diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 278b380199..0000000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.snap whitespace=-blank-at-eol diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index f62d0ce407..0000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,275 +0,0 @@ -name: CI - -on: - push: - branches: [master] - tags: - - v* - - pull_request: - -env: - CARGO_TERM_COLOR: always - CARGO_INCREMENTAL: 0 - CARGO_PROFILE_TEST_DEBUG: 0 - RUST_BACKTRACE: full - SOLC_VERSION: v0.8.30 - FOUNDRY_VERSION: v1.5.1 - -jobs: - lint: - runs-on: ubuntu-latest - env: - RUSTFLAGS: "-D warnings" - steps: - - uses: actions/checkout@v5 - - name: Install rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - components: rustfmt, clippy - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Generate tree-sitter parser - working-directory: crates/tree-sitter-fe - run: | - # Install only the pinned tree-sitter CLI (skip the root package's - # Node-addon build, which the Rust build doesn't use), then generate - # parser.c and friends from grammar.js. - npm ci --ignore-scripts - npm rebuild tree-sitter-cli - npx tree-sitter generate --abi=14 - - name: Cache Dependencies - uses: Swatinem/rust-cache@v2 - - name: Validate release notes entry - run: ./newsfragments/validate_files.py - - name: Lint with rustfmt - run: cargo fmt --all -- --check - - name: Lint with clippy - run: cargo clippy --locked --workspace --all-targets --all-features -- -D clippy::all - - test: - # Build & Test runs on all platforms - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-latest - - os: macOS-latest - - os: windows-latest - steps: - - uses: actions/checkout@v5 - - name: Install rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Generate tree-sitter parser - working-directory: crates/tree-sitter-fe - shell: bash - run: | - # Install only the pinned tree-sitter CLI (skip the root package's - # Node-addon build, which the Rust build doesn't use), then generate - # parser.c and friends from grammar.js. - npm ci --ignore-scripts - npm rebuild tree-sitter-cli - npx tree-sitter generate --abi=14 - - name: Cache solc - id: solc-cache - uses: actions/cache@v4 - with: - path: ${{ runner.os == 'Windows' && format('{0}\\solc-{1}.exe', runner.temp, env.SOLC_VERSION) || format('{0}/solc-{1}', runner.temp, env.SOLC_VERSION) }} - key: solc-${{ runner.os }}-${{ env.SOLC_VERSION }} - - name: Download solc (Linux/macOS) - if: steps.solc-cache.outputs.cache-hit != 'true' && runner.os != 'Windows' - run: | - set -euo pipefail - if [ "${{ runner.os }}" = "Linux" ]; then - url="https://github.com/ethereum/solidity/releases/download/${SOLC_VERSION}/solc-static-linux" - else - url="https://github.com/ethereum/solidity/releases/download/${SOLC_VERSION}/solc-macos" - fi - curl -Ls "$url" -o "$RUNNER_TEMP/solc-${SOLC_VERSION}" - chmod +x "$RUNNER_TEMP/solc-${SOLC_VERSION}" - - name: Download solc (Windows) - if: steps.solc-cache.outputs.cache-hit != 'true' && runner.os == 'Windows' - shell: pwsh - run: | - $url = "https://github.com/ethereum/solidity/releases/download/$env:SOLC_VERSION/solc-windows.exe" - $output = "$env:RUNNER_TEMP\solc-$env:SOLC_VERSION.exe" - Invoke-WebRequest -Uri $url -OutFile $output - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: ${{ env.FOUNDRY_VERSION }} - - name: Install cargo-nextest - uses: taiki-e/install-action@nextest - - name: Cache Dependencies - uses: Swatinem/rust-cache@v2 - with: - cache-workspace-crates: true - - name: Build - run: cargo test --release --workspace --all-features --no-run --locked --exclude fe-language-server --exclude fe-bench - - name: Run tests - env: - FE_SOLC_PATH: ${{ runner.os == 'Windows' && format('{0}\\solc-{1}.exe', runner.temp, env.SOLC_VERSION) || format('{0}/solc-{1}', runner.temp, env.SOLC_VERSION) }} - run: cargo nextest run --release --workspace --all-features --no-fail-fast --locked --exclude fe-language-server --exclude fe-bench - - wasm-wasi-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - name: Install rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - - name: Install WASM targets - run: | - rustup target add wasm32-unknown-unknown - rustup target add wasm32-wasip1 - - name: Cache Dependencies - uses: Swatinem/rust-cache@v2 - - name: Check core crates for wasm32-unknown-unknown - run: cargo check --locked -p fe-common -p fe-parser -p fe-hir --target wasm32-unknown-unknown - - name: Check filesystem crates for wasm32-wasip1 - run: cargo check --locked -p fe-driver -p fe-resolver --target wasm32-wasip1 - - release: - # Only run this when we push a tag - if: startsWith(github.ref, 'refs/tags/') - runs-on: ${{ matrix.os }} - needs: [lint, test, wasm-wasi-check] - permissions: - contents: write - strategy: - matrix: - include: - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - BIN_FILE: fe_linux_amd64 - EXT: "" - EXTRA_FEATURES: "" - STRIP: strip - - os: ubuntu-latest - target: aarch64-unknown-linux-gnu - BIN_FILE: fe_linux_arm64 - EXT: "" - EXTRA_FEATURES: "" - STRIP: aarch64-linux-gnu-strip - - os: macOS-latest - target: aarch64-apple-darwin - BIN_FILE: fe_mac_arm64 - EXT: "" - EXTRA_FEATURES: "" - STRIP: strip - - os: macOS-latest - target: x86_64-apple-darwin - BIN_FILE: fe_mac_amd64 - EXT: "" - EXTRA_FEATURES: "" - STRIP: strip - - os: windows-latest - target: x86_64-pc-windows-msvc - BIN_FILE: fe_windows_amd64.exe - EXT: ".exe" - EXTRA_FEATURES: "" - STRIP: "" - - steps: - - uses: actions/checkout@v5 - - name: Install cross-compilation toolchain (Linux ARM64) - if: matrix.target == 'aarch64-unknown-linux-gnu' - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu - - name: Install rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - targets: ${{ matrix.target }} - - name: Build - env: - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc - run: cargo build --locked --release --target ${{ matrix.target }} ${{ matrix.EXTRA_FEATURES }} - - name: Strip binary (Unix) - if: runner.os != 'Windows' - run: ${{ matrix.STRIP }} target/${{ matrix.target }}/release/fe - - name: Rename binary - shell: bash - run: mv target/${{ matrix.target }}/release/fe${{ matrix.EXT }} target/${{ matrix.target }}/release/${{ matrix.BIN_FILE }} - - name: Release - uses: softprops/action-gh-release@v2 - with: - files: target/${{ matrix.target }}/release/${{ matrix.BIN_FILE }} - prerelease: true - - docs: - if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') - runs-on: ubuntu-latest - needs: [release] - steps: - - uses: actions/checkout@v5 - - - name: Download fe binary from release - env: - GH_TOKEN: ${{ github.token }} - run: | - gh release download "$GITHUB_REF_NAME" --pattern 'fe_linux_amd64' --dir /tmp - chmod +x /tmp/fe_linux_amd64 - - - name: Generate documentation - run: | - mkdir -p /tmp/docs-out - timeout 300 /tmp/fe_linux_amd64 doc --builtins -o /tmp/docs-out json - /tmp/fe_linux_amd64 doc -o /tmp/docs-out bundle --with-css - python3 -c " - import json, sys - with open('/tmp/docs-out/docs.json') as f: - d = json.load(f) - sv = d.get('schema_version') - cv = d.get('compiler_version') - if not sv or not cv: - print(f'ERROR: missing schema_version={sv} or compiler_version={cv}', file=sys.stderr) - sys.exit(1) - print(f'docs.json: schema v{sv}, compiler v{cv}, {len(d[\"index\"][\"items\"])} items') - " - - - name: Deploy to doc site - uses: actions/checkout@v5 - with: - repository: fe-lang/fe-docs - token: ${{ secrets.DOC_DEPLOY_TOKEN }} - path: fe-docs - ref: main - - - name: Deploy docs - run: | - cd fe-docs - make deploy VERSION="${GITHUB_REF_NAME#v}" OUTDIR=/tmp/docs-out - - - name: Push doc site - run: | - cd fe-docs - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add versions.json fe-web.js fe-highlight.css styles.css "${GITHUB_REF_NAME#v}/" - if git diff-index --quiet HEAD; then - echo "No changes to deploy" - exit 0 - fi - git commit -m "Deploy docs for $GITHUB_REF_NAME" - for attempt in 1 2 3; do - if git push; then - exit 0 - fi - echo "Push failed (attempt $attempt), rebasing..." - git pull --rebase - done - echo "ERROR: Failed to push after 3 attempts" >&2 - exit 1 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index abd2877c54..0000000000 --- a/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -.idea -/target -**/*.rs.bk -tarpaulin-report.html -/output -/docs/tmp_snippets -.vscode -.DS_Store -**/*.fe-lsp.json -**/.fe-lsp/ - -# OpenSpec and AI assistant files -openspec/ -AGENTS.md -CLAUDE.md -.claude/ -.gemini/ - -# Local debug artifacts -stackify_*.txt -trace_*.txt diff --git a/.towncrier.template.md b/.towncrier.template.md deleted file mode 100644 index 997b6e4354..0000000000 --- a/.towncrier.template.md +++ /dev/null @@ -1,28 +0,0 @@ -{% for section, _ in sections.items() %} -{%- if section %}{{section}}{% endif -%} - -{% if sections[section] %} -{% for category, val in definitions.items() if category in sections[section]%} -### {{ definitions[category]['name'] }} - -{% if definitions[category]['showcontent'] %} -{% for text, values in sections[section][category].items() %} -- {{ values|join(', ') }} {{ text }} -{% endfor %} - -{% else %} -- {{ sections[section][category]['']|join(', ') }} - -{% endif %} -{% if sections[section][category]|length == 0 %} -No significant changes. - -{% else %} -{% endif %} - -{% endfor %} -{% else %} -No significant changes. - -{% endif %} -{% endfor %} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index e1f31fd4b7..0000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "editor.tabSize": 4, - "rust-analyzer.linkedProjects": [ - "./crates/language-server/Cargo.toml" - ], -} \ No newline at end of file diff --git a/.zed/settings.json b/.zed/settings.json deleted file mode 100644 index 59859a5956..0000000000 --- a/.zed/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "languages": { - "Fe": { - "enable_language_server": false - } - } -} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 8bc9993da6..0000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,192 +0,0 @@ -# Changelog - -[//]: # (towncrier release notes start) -## 26.2.0 (2026-06-23) - -### Features - -- Contract fields are now immutable by default unless declared with `mut`. Immutable fields must be initialized before every successful `init` exit and are embedded into contract code; declare fields as `mut` to keep using storage-backed mutable contract state. During `init`, immutable field reads before assignment observe the zero/default value, reassignment is allowed, and the last write is the value embedded into the deployed contract. Binding a field without `mut` as a `mut` effect (`uses (mut field)`) is an error everywhere except `init`'s code-backed fields; this applies to explicit handle fields (e.g. `StorPtr`) as well. - - The compiler verifies initialization with a definite-assignment analysis: a field counts as initialized when it is assigned whole-value (including compound assignment such as `+=`) on every path that reaches the end of `init`, whether directly or through helper functions that receive the field via a `mut` effect or a `mut T` argument. Branches merge conservatively and loop bodies are assumed to possibly run zero times (conditions that are literal `true`/`false` are folded), so assignments guarded by runtime-dependent loop conditions are not credited. Member-wise initialization of an aggregate field (`p.a = ...; p.b = ...`) does not count; assign the whole value instead. ([#1334](https://github.com/argotorg/fe/issues/1334)) -- `fe doc` overhaul for message-based contracts: `msg` variants now render - as children of their parent msg page (matching enum variants), contract - pages gain dedicated init and message-handler sections, and `#[test]` - functions are hidden from generated docs by default (restore them with - `--include-tests`). The doc viewer also exposes CSS variables for fonts, - weights, and layout so downstream sites can retheme it without CSS - specificity battles. ([#1419](https://github.com/argotorg/fe/issues/1419)) -- Added `Option::ok_or` and `Option::ok_or_else` to `core`, mirroring Rust's API, plus a `Panic::from(code)` shorthand constructor. Combined with `Result::unwrap`, this lets users attach a typed error value (e.g. `Panic::from(POP_EMPTY)`) to an Option-unwrap so reverts carry meaningful Solidity-compatible selectors instead of always landing on `Panic(0x01)`. ([#1430](https://github.com/argotorg/fe/issues/1430)) -- `StorageMap` now accepts every primitive integer type (`u8`–`u128`, `usize`, `i8`–`i256`, `isize`) and `bool` as a key, in addition to the previously supported `u256`, `Address`, and tuples. The new `StorageKey` impls left-pad each key to 32 bytes via `WordRepr::to_word()`, so slot derivation matches Solidity's `mapping(intN/uintN/bool => V)` convention exactly. Useful for storage layouts that want to pack indices into a single slot (e.g. `mapping(uint128 => V)` queues). ([#1431](https://github.com/argotorg/fe/issues/1431)) -- Improved optimization options for the default Sonatina backend: - - - `-O1`/`--optimize 1` is now distinct from `-O2` and is the default optimization level. It keeps Sonatina's optimization pipeline enabled while using lower exact-search caps for stack shuffling; usually getting close to `-O2` gas and bytecode while substantially reducing compile time. - - `-O0`/`--optimize 0` now and disables the stack shuffling exact solver entirely in favor of a greedy heuristic, making unoptimized builds much faster. - - ([#1435](https://github.com/argotorg/fe/issues/1435)) -- Added core `String` utilities for fixed-width byte round-trips, effective byte length, concatenation, and equality in const and runtime code. ([#1437](https://github.com/argotorg/fe/issues/1437)) -- Lossless `bool` to integer casts with `as` are now allowed. ([#1445](https://github.com/argotorg/fe/issues/1445)) -- Exposed selected raw EVM operations through `std::evm::ops`, including byte/sign-extension, balance/code inspection, gas price, and blob fee/hash reads. ([#1453](https://github.com/argotorg/fe/issues/1453)) -- Added marker-only `#[must_use]` support for functions, structs, and enums, and marked `core::result::Result` as must-use so ignored fallible results are diagnosed unless explicitly discarded with `let _ = ...`. ([#1468](https://github.com/argotorg/fe/issues/1468)) -- Precompiles: - - `std::evm::crypto` precompile wrappers now `Result` - instead of reverting on precompile call failure. - - Added typed wrappers for the remaining EVM crypto precompiles, including - RIPEMD-160, identity, Blake2F, KZG point evaluation, BLS12-381 operations, and - P-256 verification. - - `ecrecover` now rejects non-canonical secp256k1 signatures before returning - a recovered address. - - added `ecrecover_raw` which does not perform canonical signature checks. ([#1468](https://github.com/argotorg/fe/issues/1468)) -- Added `assert!` builtin, e.g. `assert!(ok)`. Takes an optional second string - literal argument: `assert!(ok, "something's not ok")`. Assertion failure results - in a revert, with Solidity-compatible `Error(string)` payload. `assert!` can - also be used in `const fn`s at compile time; assertion failure results in a - compile-time failure. ([#1471](https://github.com/argotorg/fe/issues/1471)) -- Added the `Bounded` trait in `core::num`, exposing inclusive numeric type bounds as `T::min()` and `T::max()` `const fn` methods on all primitive integer types. ([#1474](https://github.com/argotorg/fe/issues/1474)) -- Added the `Abs` and `UnsignedAbs` traits in `core::num`, providing magnitude operations as `const fn` on all signed integer types. `Abs` bundles `abs`, `checked_abs`, `wrapping_abs`, `saturating_abs`, and `overflowing_abs`, each taking a different stance on the asymmetric `T::MIN` edge case. `UnsignedAbs::unsigned_abs()` returns the magnitude in the unsigned type of the same width — handling `T::MIN` without overflow. ([#1474](https://github.com/argotorg/fe/issues/1474)) -- Inherent `impl` blocks now support associated `const` items. Consts may reference the impl's generic parameters and other consts of the same impl, are evaluated at compile time per instantiation, and can be used in both value and type positions (e.g. array sizes): - - ```fe - pub struct Packed {} - - impl Packed { - const LANES: u256 = 256 / BITS - const LANE_MASK: u256 = (1 << BITS) - 1 - - pub fn lanes(self) -> u256 { - Self::LANES - } - } - ``` - - This is the idiomatic place for derived constants on a generic container; previously the math had to be repeated as local bindings in every method. Inherent consts take precedence over trait consts of the same name, with the trait const still reachable via a qualified path like `::X`. - - Further details: - - - Consts are private to the defining module by default; mark them `pub const` to export them. - - Consts of the enclosing impl are in scope unqualified inside the impl, like trait consts in trait default methods. - - Inherent consts can be used as const generic arguments (`Holder`). - - A const on a conditional impl (`impl Wrap where T: Marker`) is only available when the receiver satisfies the bound. - - Two inherent impls of the same type that define the same const are a definition-site conflict, exactly like conflicting inherent methods (regardless of their `where` clauses). Collisions with an enum variant name or with an inherent associated function of the same name are also rejected. - - A const initializer that is not const-evaluable (e.g. a non-`const fn` call) is rejected at its definition, like a top-level `const`. - - ([#1479](https://github.com/argotorg/fe/issues/1479)) -- Added `fe build --emit metadata`, which writes a Solidity-standard contract `metadata.json` per contract (sources with `keccak256`, compiler version, resolved build settings, transitive dependency sources, and ABI) so verifiers like Sourcify can reproduce and check the bytecode. ([#1487](https://github.com/argotorg/fe/issues/1487)) - -### Bugfixes - -- Fixed `fe test` output so failure details are printed immediately after the corresponding failed test status when tests run in parallel. ([#1420](https://github.com/argotorg/fe/issues/1420)) -- Fixed a compiler panic when code_region_len or code_region_offset was called on an unresolved generic contract runtime parameter. ([#1429](https://github.com/argotorg/fe/issues/1429)) -- Fixed a compiler panic when generic associated constants were used in const expressions before their concrete types were known. ([#1429](https://github.com/argotorg/fe/issues/1429)) -- Fixed Sonatina ABI encoding and decoding for negative signed integers narrower than 256 bits. ([#1434](https://github.com/argotorg/fe/issues/1434)) -- Sonatina: - - Fixed EVM encoded-pointer provenance across calls and memory operations, with more precise escape summaries for i256 pointer carriers, aggregates, malloc-derived pointers, and local/argument/nonlocal storage. This also improves memory-planning performance by avoiding unnecessarily conservative escape assumptions. - - Fixed GVN value-phi materialization so cached/generated value phis are rejected unless they cover the currently reachable predecessors. - - Improved stackify spill slot reuse logic. This fixes a bug where a scratch slot could be reused for values that overlap during phi/control-flow transitions. - - ([#1435](https://github.com/argotorg/fe/issues/1435)) -- Fixed ABfI encoding for `evm.call` message payloads with multiple dynamic fields, and for dynamic custom error payloads. ([#1439](https://github.com/argotorg/fe/issues/1439)) -- Fixed expression-context `&&` and `||` lowering so right-hand side expressions are only evaluated when short-circuiting requires them. ([#1447](https://github.com/argotorg/fe/issues/1447)) -- Fixed compiler panic when lowering zero-sized effect types. ([#1449](https://github.com/argotorg/fe/issues/1449)) -- Allowed blanket implementations of external traits when the implementor is a type parameter directly bounded by a local trait. ([#1450](https://github.com/argotorg/fe/issues/1450)) -- Fixed calls through projected effect providers, such as `with (store.map)`, so nested calls preserve the projected provider's concrete target type. ([#1459](https://github.com/argotorg/fe/issues/1459)) -- Sonatina: - - Fix unchecked signed EVM division and remainder for narrow signed integer types. - - Fix EVM codegen for spilled phi values so control-flow joins do not let one edge's object storage clobber another edge's phi source. ([#1470](https://github.com/argotorg/fe/issues/1470)) -- Fixed the parser rejecting multiple items on the same line inside `impl`, `trait`, and `extern` blocks. The tree-sitter grammar already allowed `impl Foo for Bar { fn a() {} fn b() {} }`, but the main parser required a newline between items. ([#1475](https://github.com/argotorg/fe/issues/1475)) -- Fixed compiler panics when tuple type aliases were used as event or custom error fields. ([#1481](https://github.com/argotorg/fe/issues/1481)) -- Fixed JSON ABI generation for events so fields marked with `#[indexed]` are emitted with `"indexed": true`. ([#1485](https://github.com/argotorg/fe/issues/1485)) -- Fixed contract field layout for nested types containing inferred const slot parameters. Contract fields whose storage slot or address space cannot be determined are now reported as errors instead of being laid out incorrectly. ([#1492](https://github.com/argotorg/fe/issues/1492)) -- Trait associated `const` implementations are now validated against their declarations. A missing associated const, type mismatch (including param-typed const defaults), or otherwise ill-formed const definitions are reported as errors instead of being silently accepted or producing a panic in a later stage. ([#1492](https://github.com/argotorg/fe/issues/1492)) -- Fixed a compiler panic when an `if let`/`while let` condition's pattern was not followed by `=`. The parser now reports a "expected `=`" error and recovers instead of crashing. ([#1497](https://github.com/argotorg/fe/issues/1497)) - -### Performance improvements - -- Fe: - - Lower named aggregate constants as Sonatina const refs. - - Only emit Sonatina data regions for constants that are explicitly used as code regions. - - Avoid duplicated const data in generated bytecode for large const arrays. - - Improve runtime lowering for const-backed local borrows. - - Avoid emitting real globals/data entries for zero-sized aggregate constants. - - Lower view aggregate arguments in a representation-flexible way so the compiler can avoid unnecessary aggregate allocation and copying. - Sonatina: - - Compact and specialize constref loads. - - Deduplicate const data. - - Coalesce adjacent const loads. - - Prune dead const sections and functions. - - Reduce compile-time blowups for large const arrays. ([#1433](https://github.com/argotorg/fe/issues/1433)) -- Sonatina: - - Improved stack shuffling performance via cache improvements and short-circuiting trivial operand-prep cases. - - Improved memory placement performance. - - ([#1435](https://github.com/argotorg/fe/issues/1435)) -- Improved Solidity ABI encoding and decoding performance for dynamic payloads by avoiding redundant memory copies and adding faster paths for canonical dynamic arrays. ([#1440](https://github.com/argotorg/fe/issues/1440)) -- Calldata ABI decode optimizations: - - Decode contract `recv` arguments directly from calldata instead of first copying the payload into memory. - - Inline hot ABI decoding helpers and storage map key paths to reduce generated wrapper overhead. ([#1448](https://github.com/argotorg/fe/issues/1448)) -- Sonatina: - - EVM lowering now goes via a "machine EVM" instruction set, with additional - optimizations and better stack and memory management. - - Improve inlining for small specialized helpers, especially helpers with known callsite arguments or scalarizable object arguments. - - Sink pure computations into the branch or join block where their results are used, reducing unnecessary work and stack pressure. ([#1470](https://github.com/argotorg/fe/issues/1470)) -- Fe: - - Avoid object-backed runtime storage for read-only owned aggregates, tuple destructuring, and read-only aggregate helper calls. - - Construct runtime aggregate values directly. - Sonatina: - - Account for scalarizable aggregate inserts, extracts, and returns when deciding whether to inline small helpers. - - Copy aggregate insert-value webs directly to memory during aggregate legalization instead of materializing source aggregate slots. - - Skip zero-sized aggregate leaf memory operations during aggregate legalization. ([#1483](https://github.com/argotorg/fe/issues/1483)) -- Sonatina: - - Keep explicit `inline(never)` annotations on generated const-data helper variants, preserving source-level code-size controls. - - Emit large EVM constants in shorter forms when a small runtime operation can replace a much larger literal. - - Remove duplicate private helper bodies after EVM lowering when they compile to identical bytecode. - - Remove repeated constant-only helper parameters when every private call passes the same value. - - Drop unnecessary overflow checks for offsets inside statically sized EVM memory allocations. - - Deduplicate terminal EVM return/revert code. - - Replace static const object initialization with direct scalar values where possible. - - Reuse fixed scratch slots for private temporary EVM buffers whose lifetimes do not overlap. - - Reuse known EVM free-pointer bounds across internal calls to avoid redundant allocator setup. - - Build private return/revert payload buffers at fixed addresses instead of routing them through the heap allocator. ([#1488](https://github.com/argotorg/fe/issues/1488)) -- Avoid lowering read-only scalars as memory-backed places. ([#1489](https://github.com/argotorg/fe/issues/1489)) - - -## 26.1.0 (2026-04-30) - -### Features - -- Update the core ABI helper traits and APIs. Custom ABI implementations now use `AbiSize::HEAD_SIZE`, `payload_size`, `Decode::decode_payload`, and `AbiSpan::payload_end`; encoders are created with a fixed output size, and root versus field encoding is split into explicit helpers such as `encode_alloc` and `encode_single_root_alloc`. ([#1404-abi](https://github.com/argotorg/fe/issues/1404-abi)) -- Added `assert_msg(cond, message)`, which reverts with a Solidity-compatible `Error(string)` payload (selector `0x08c379a0`) when `cond` is false. ([#1348](https://github.com/argotorg/fe/issues/1348)) -- Replace the git resolver backend from git2 (libgit2) to gitoxide (pure Rust). This removes the OpenSSL/libgit2 C dependency and adds sparse checkout support, allowing the resolver to fetch only the required subdirectory of a remote repository instead of the entire tree. ([#1383](https://github.com/argotorg/fe/issues/1383)) -- Expose missing `Ctx` trait APIs: `origin`, `coinbase`, `prevrandao`, `gaslimit`, `chainid`, `basefee`, `selfbalance`, and `blockhash`. ([#1388](https://github.com/argotorg/fe/issues/1388)) -- Add `#[error]` attribute for Solidity-compatible custom error types. Structs annotated with `#[error]` get auto-generated `ErrorVariant`, `AbiSize`, and `Encode` implementations with a compile-time computed 4-byte selector. A new `revert_error()` function emits selector-prefixed ABI-encoded revert data. Includes a predefined `Panic` error type matching Solidity's `Panic(uint256)`. ([#1395](https://github.com/argotorg/fe/issues/1395)) -- Improve `fe doc` and generated documentation bundles: message declarations and message variants now render with dedicated item kinds and complete signatures, `fe doc --builtins --stdlib-path ` can document a stdlib loaded from disk, docs JSON includes pre-rendered Markdown HTML, and the web viewer can load gzipped docs JSON bundles. ([#1401](https://github.com/argotorg/fe/issues/1401)) -- Replace backend lowering with the staged SMIR/NSMIR/MIR pipeline. This expands compile-time function evaluation, including const calls that produce aggregate values and symbolic array repeat expressions such as `[value; N]` where `N` is a const generic. ([#1404](https://github.com/argotorg/fe/issues/1404)) -- Add `static_assert(bool_expr)` for compile-time assertions, with diagnostics that show evaluated comparison operands and operators when an assertion fails. ([#1412](https://github.com/argotorg/fe/issues/1412)) -- Expand `const fn` evaluation to support mutable locals, assignments, aggregate field and index writes, `while` and `while let` loops with `break` and `continue`, match/destructuring patterns, and const operator trait implementations. This allows more ordinary helper code, including array and proof builders, to run during CTFE. ([#1413](https://github.com/argotorg/fe/issues/1413)) -- The standard prelude now includes `sol`, `Bytes`, `Decode`, and `AbiDecoder`, so common Solidity selector and ABI decoding code no longer needs explicit imports. ([#1417](https://github.com/argotorg/fe/issues/1417)) -- Checked arithmetic overflow now reverts with a Solidity-compatible `Panic(uint256)` payload (code `0x11`) instead of empty revert data. This makes overflow failures identifiable by off-chain tooling such as Foundry, Hardhat, and block explorers. -- Extend `#[test(should_revert)]` with `panic` and `selector` arguments for verifying revert payloads. `#[test(should_revert, panic = 0x11)]` checks that the test reverts with a Solidity-compatible `Panic(uint256)` and the expected code. `#[test(should_revert, selector = 0x4e487b71)]` checks only the 4-byte error selector. -- Make primitive numeric and boolean intrinsics, `IntDowncast` methods, and EVM `addmod`/`mulmod` const-evaluable. This enables modular arithmetic and field-arithmetic-heavy code to be used in `const fn` and `static_assert`. -- `Result::unwrap()` now emits selector-prefixed revert data for `#[error]` types. Previously, `unwrap()` on a `Result` where `E` is an `#[error]` type would ABI-encode the error without the 4-byte selector. Now the monomorphizer routes these to `revert_error()` instead of `revert()`, producing Solidity-compatible error payloads. -- `assert(false)` now reverts with a Solidity-compatible `Panic(uint256)` payload (code `0x01`) instead of empty revert data. This makes assertion failures identifiable by off-chain tooling. - -### Bugfixes - -- Fix several array and aggregate codegen bugs. Readonly array locals, call results, constructor arguments, and view parameters now preserve their code-backed or borrowed representation until materialization is required. Code-backed arrays copied to storage are staged through memory before word loads and use storage slot offsets instead of byte offsets. Runtime array literals now populate each element before loading the aggregate value. ([#1404-array-codegen](https://github.com/argotorg/fe/issues/1404-array-codegen)) -- Fix never type (`!`) handling in trait checking and lowering. The compiler now avoids probing trait implementations for bare `!`, producing the intended diagnostic for invalid uses, and treats extern functions declared `-> !` as intrinsically non-returning even when they appear in functions with generic or associated return types. ([#1410-never-type](https://github.com/argotorg/fe/issues/1410-never-type)) -- Suppress downstream type mismatch diagnostics when the underlying type is already invalid. This reduces cascading error noise and makes compiler output easier to read. ([#1386](https://github.com/argotorg/fe/issues/1386)) -- Fix chained method call type inference (e.g. `result.map(fn1).map(fn2)`). The compiler now correctly unifies types through canonicalized receivers, resolving incorrect type mismatch errors on valid method chains. ([#1389](https://github.com/argotorg/fe/issues/1389)) -- Overhaul LSP stability and observability: worker-thread panics now surface as visible errors instead of being silently swallowed, a dual-layer logging system writes detailed diagnostics to workspace-local `.fe-lsp/` log files with automatic rotation and retention, and a dispatch-deadlock in concurrent request handling has been fixed via an upgraded async-lsp dependency. ([#1392](https://github.com/argotorg/fe/issues/1392)) -- Remove redundant `EvmResultExt` trait and `unwrap_or_revert()` method. Since `Result::unwrap()` already ABI-encodes errors on revert via `panic_with_value`, `unwrap_or_revert()` was a leftover that duplicated this behavior. ([#1395](https://github.com/argotorg/fe/issues/1395)) -- Fix several MIR correctness issues: `fe build --contract` now filters Sonatina IR output correctly, ingot builds work when contracts are re-exported from the root module, generic calls can forward concrete EVM effects, and escaping storage borrows are rejected. ([#1404](https://github.com/argotorg/fe/issues/1404)) -- Report invalid dependency paths in `fe.toml` as configuration diagnostics instead of panicking. ([#1408](https://github.com/argotorg/fe/issues/1408)) -- Fix `StorageBytes.encode_return` so multi-word `bytes` values are ABI-encoded from allocated return memory instead of clobbering scratch memory. ([#1409](https://github.com/argotorg/fe/issues/1409)) -- Fix CTFE evaluation of unchecked and wrapping numeric intrinsics to use fixed-width word semantics for wrapping negation, bitwise not, shifts, and division/remainder edge cases. -- Fix generic operator overload resolution so ambiguous trait method candidates are preserved and can be disambiguated by argument constraints. Generic wrappers such as field element types can now support mixed operator impls like `Fr + u256`. - -### Performance improvements - -- Improve CTFE performance and scale by reducing repeated const interning, using copy-on-write aggregate stores, caching semantic bodies and instances, and raising the default CTFE step limit to 1,000,000. Larger constant computations such as Poseidon test vectors can now complete during normal checks. - -### Internal Changes - for Fe Contributors - -- Bump sonatina to eb50941. ([#1393](https://github.com/argotorg/fe/issues/1393)) diff --git a/CLI.md b/CLI.md deleted file mode 100644 index 987a540788..0000000000 --- a/CLI.md +++ /dev/null @@ -1,493 +0,0 @@ -# Fe CLI behavior (current implementation) - -This document describes the **current** behavior of the `fe` CLI as implemented in this repository (crate `crates/fe`). -It is not a stability guarantee. - -## Conventions - -### Global options - -- `--color `: controls colored output (default: `auto`). - -### Output streams - -- **Stdout**: “normal” command output (e.g. artifact paths, formatted file paths, dependency trees). -- **Stderr**: diagnostics, errors, warnings, and hints. - -### Message prefixes - -User-facing diagnostics follow these conventions: - -- `Error: ...` for errors (typically causes non-zero exit for `build`, `check`, `test`, `fmt --check`). -- `Warning: ...` for non-fatal warnings. -- `Hint: ...` for suggestions following an error. - -The CLI intentionally does **not** use emoji/icon markers. - -### Exit codes - -- `0` on success. -- `1` on failure. -- `2` on CLI usage/argument parsing errors (emitted by `clap`, e.g. unknown flags or missing values). - -Notable exceptions: - -- `fe check` / `fe build` / `fe tree` on a workspace root with **no members** prints a warning explaining why (no members configured, or configured paths don't exist) and exits `0`. - -### Paths and UTF-8 - -Many CLI paths use `camino::Utf8PathBuf` internally. If a relevant path (including the current directory) is not valid UTF-8, the CLI may error. - -### Colors - -Some subcommands emit ANSI-colored output: - -- `fe fmt --check` prints colored diffs. -- `fe test` prints colored `ok` / `FAILED`. -- `fe tree` renders cycle nodes in red via ANSI escape codes. - -Color emission is controlled by `--color` and respects common environment conventions (`CLICOLOR_FORCE`, `NO_COLOR`, `CLICOLOR`) in `auto` mode. - -## Target resolution (paths vs workspace member names) - -Several subcommands take a single “target” argument which can be: - -- a **standalone** `.fe` file, -- a **directory** containing `fe.toml` (ingot root or workspace root), -- or a **workspace member name** (when run from within a workspace context). - -The general rules are: - -1) **`fe.toml` file paths are rejected**. Pass the containing directory instead. -2) A path that is a **file** must end in `.fe` to be treated as a source file. -3) A path that is a **directory** must contain `fe.toml` to be treated as a project. -4) A **workspace member name** is only considered when the argument: - - looks like a name (ASCII alphanumeric and `_`), and - - the current working directory is inside a workspace context that contains a matching member. - - If the argument also exists as a filesystem path, the CLI requires that the name and path refer to the same member (see disambiguation below). - - Note: name lookup uses the workspace’s “default selection” of members. If the workspace `fe.toml` sets `default-members`, only those members are considered by default; non-default members may need to be targeted by path. - -### Disambiguation: “name” vs existing path - -If the argument both: - -- looks like a workspace member name, **and** -- exists as a path, - -then the CLI requires that they refer to the **same** workspace member; otherwise it errors with a disambiguation message (e.g. “argument matches a workspace member name but does not match the provided path”). - -### Standalone vs ingot context for `.fe` files - -For `build` and `check`: - -- If you pass a `.fe` file that lives under an **ingot** (nearest ancestor `fe.toml` parses as an ingot config), the command runs in **ingot context** (so imports resolve as they would from the ingot). - - Override: `--standalone` forces standalone mode for that `.fe` file target. -- If you pass a `.fe` file that lives under a **workspace root** (nearest ancestor `fe.toml` parses as a workspace config), the command treats the file as **standalone** unless you explicitly target the workspace/ingot by passing a directory or member name. - -## `fe build` - -Compiles Fe contracts to EVM bytecode. - -Builds use the Sonatina codegen pipeline and generate EVM bytecode directly. - -### Synopsis - -``` -fe build [--standalone] [--contract ] [--optimize ] [--out-dir ] [--report [--report-out ] [--report-failed-only]] [path] -``` - -If `path` is omitted, it defaults to `.`. - -### Inputs - -`fe build` accepts: - -- a `.fe` file path (standalone mode unless the file is inside an ingot; see above), -- an ingot directory (contains `fe.toml` parsing as `[ingot]`), -- a workspace root directory (contains `fe.toml` parsing as `[workspace]`), -- a workspace member name (when run from inside a workspace). - -### Output directory - -- Standalone `.fe` file default: `/out` -- Ingot directory default: `/out` -- Workspace root default: `/out` -- Override: `--out-dir ` - - If `` is relative, it is resolved relative to the **current working directory**. - - Note: default output directories are derived from the **canonicalized** (absolute) target path, so the printed `Wrote ...` paths are absolute by default unless `--out-dir` is set. - -### What gets built - -#### Standalone `.fe` file target - -- The compiler analyzes the file’s top-level module. -- Contracts are discovered and, by default, **all** contracts in that module are built. - -#### Ingot target - -- The ingot and its dependencies are resolved/initialized. -- `src/lib.fe` is treated as the ingot’s root module. If it is missing, the CLI behaves as if an empty `src/lib.fe` existed (a “phantom” root module). -- Contracts are discovered across the ingot’s entire source set (`src/**/*.fe` top-level modules), not only `src/lib.fe`. -- By default, **all** discovered contracts are built. - -#### Workspace root target - -Workspace builds use a **flat output directory**: - -- All member artifacts are written directly into the same `out` directory. -- Before building, the CLI checks for **artifact name collisions** across workspace members: - - Artifact filenames are derived from a sanitized contract name (see below). - - Collision detection is **case-insensitive** (e.g. `Foo` and `foo` collide) to avoid filesystem-dependent behavior on case-insensitive filesystems. - - If multiple contracts (possibly from different members) map to the same artifact base name, the build errors and lists the conflicts. - -Workspace member selection: - -- The set of members considered is the workspace’s “default selection”. - - If `default-members` is present, only those members are built. - - Otherwise, all discovered members are built (including any `dev` members). -- Workspace builds skip members with **zero** contracts; if all selected members have zero contracts, the build fails with `Error: No contracts found to build`. - -### Contract selection: `--contract ` - -- For standalone files and ingots: - - If `` exists, only that contract is built. - - If not found, the build errors and prints “Available contracts:” with a list. -- For workspace roots: - - If **exactly one** workspace member contains the contract, that member is built for that contract. - - If **zero** members contain the contract, it errors. - - It also prints “Available contracts:” for the workspace (unique contract names), capped at `50`, followed by `... and N more` if applicable. - - If **multiple** members contain the contract, it errors and prints a “Matches:” list and a hint to build a specific member by name or path. - -### Optimization - -Optimization is controlled by `--optimize ` / `-O `. - -Defaults: - -- `--optimize` defaults to `1`. -- Supported levels: - - `0`: none - - `s`: size-oriented - - `1`: balanced (default) - - `2`: aggressive - - -### Artifacts and filenames - -For each built contract, `fe build` writes (depending on `--emit`): - -- `/.bin` (deploy bytecode, hex + trailing newline) -- `/.runtime.bin` (runtime bytecode, hex + trailing newline) -- `/.abi.json` (Solidity-compatible ABI; only when `--emit abi`) -- `/.metadata.json` (Solidity-standard contract metadata for verifiers like Sourcify; only when `--emit metadata`) - -For the Sonatina backend, `.bin` is the **init section** bytes and `.runtime.bin` is the **runtime section** bytes. - -The `metadata.json` artifact follows the Solidity Contract Metadata schema (`version: 1`), adapted to Fe. It is a complete, deterministic recompilation input: rebuilding with the same compiler version, `sources`, and `settings` reproduces the same bytecode. Its shape: - -``` -{ - "version": 1, - "language": "Fe", - "compiler": { "version": "", "commit": "" }, - "sources": { - "": { "keccak256": "0x...", "content": "..." }, ... - }, - "settings": { - "compilationTarget": { "": "" }, - "optimizer": { "level": "0|1|2|s" }, - "arithmetic": "checked|unchecked", - "dependencyArithmetic": "defer|checked|unchecked", - "evmVersion": "osaka", - "ingots": [ - { - "name": "", "version": "|null", "namespace": "", - "arithmetic": "checked|unchecked", "dependencyArithmetic": "defer|checked|unchecked", - "dependencies": { "": "" } - }, ... - ] - }, - "output": { "abi": [ ... ] } -} -``` - -`` is the file's path relative to its owning ingot root (e.g. `src/counter.fe`); for a -standalone `.fe` target, it is the file's basename. `sources` contains every `.fe` file of the -contract's owning ingot **plus all transitive dependency ingots**, the latter namespaced by the -ingot's dependency alias (e.g. `mylib/src/lib.fe`). The bundled `core` and `std` are excluded -because they are pinned to `compiler.version` (a verifier re-runs the same compiler, which ships -them). `settings.ingots[]` records, per non-builtin ingot, what a verifier needs to regenerate its -`fe.toml` and `src/` layout. - -The on-screen output is per-artifact: - -``` -Wrote /.bin -Wrote /.runtime.bin -``` - -Filenames are “sanitized” from contract names: - -- Allowed: ASCII alphanumeric, `_`, `-` -- Other characters become `_` -- If the sanitized name is empty, it becomes `contract` - -This sanitization is also what the workspace collision check uses. - -### Reports: `--report` - -`fe build` can optionally write a `.tar.gz` debugging report (useful for sharing failures): - -- `--report`: enable report generation. -- `--report-out `: output path (default: `fe-build-report.tar.gz`). -- `--report-failed-only`: only write the report if `fe build` fails. - -The build report is best-effort and includes: - -- `inputs/`: the ingot or `.fe` file inputs (same rules as `fe check` / `fe test`). -- `artifacts/`: emitted Sonatina IR and bytecode artifacts (when available). -- `errors/`: best-effort captured errors/panics (if any). -- `meta/`: environment and tool metadata. - -## `fe check` - -Type-checks and analyzes Fe code (no bytecode output). - -### Synopsis - -``` -fe check [--standalone] [--dump-mir] [--report [--report-out ] [--report-failed-only]] [path] -``` - -If `path` is omitted, it defaults to `.`. - -### Inputs - -Same target resolution rules as `fe build`: - -- `.fe` file, ingot directory, workspace root directory, or workspace member name. - -### Workspace behavior - -- `fe check ` checks all members in the workspace’s default selection. - - If the workspace `fe.toml` sets `default-members`, only those member paths are checked. - - Otherwise, all discovered members are checked. -- If the selection is empty, it prints a warning explaining why (no members configured, or configured paths don't exist on disk) and exits `0`. - -### Dependency errors - -When checking an ingot with dependencies, if downstream ingots have errors, `fe check` prints a summary line: - -- `Error: Downstream ingot has errors` -- or `Error: Downstream ingots have errors` - -Then, for each dependency with errors, it prints a short header (name/version when available) and its URL, followed by emitted diagnostics. - -### Optional outputs - -- `--dump-mir`: prints MIR for the root module (only when there are no analysis errors). - -### Reports: `--report` - -`fe check` can optionally write a `.tar.gz` debugging report (useful for sharing failures): - -- `--report`: enable report generation. -- `--report-out `: output path (default: `fe-check-report.tar.gz`). -- `--report-failed-only`: only write the report if `fe check` fails. - -The check report is analysis-only and includes: - -- `inputs/`: the ingot or `.fe` file inputs. -- `errors/`: diagnostics output (when available). -- `artifacts/`: MIR dump (when available). -- `meta/`: environment and tool metadata. - -## `fe tree` - -Prints the ingot dependency tree. - -### Synopsis - -``` -fe tree [path] -``` - -If `path` is omitted, it defaults to `.`. - -### Inputs - -`fe tree` accepts: - -- a directory path (ingot root or workspace root), -- a workspace member name (when run from inside a workspace). - -Unlike `build`/`check`, `fe tree` does not take a `.fe` file target. - -### Output format - -The tree output is a text tree using `├──`/`└──` connectors. - -Annotations: - -- Cycle closures are labeled with ` [cycle]`. -- Local → remote edges are labeled with ` [remote]`. -- Nodes that are part of a cycle are rendered in red via ANSI escape codes. - - This respects `--color` (and `NO_COLOR` in `auto` mode). - -### Workspace roots - -When the target is a workspace root, `fe tree` prints a separate tree per member, each preceded by: - -``` -== == -``` - -### Diagnostics and exit status - -If `fe tree` prints any `Error:` diagnostics (including ingot initialization diagnostics like dependency cycles), it exits `1`. - -Even when it exits `1`, it still prints the dependency tree for the target (best-effort). - -## `fe fmt` - -Formats Fe source code. - -### Synopsis - -``` -fe fmt [path] [--check] -``` - -### Inputs - -- If `path` is a file: formats that single file. -- If `path` is a directory: formats all `.fe` files under that directory (recursive). -- If `path` is omitted: finds the current project root (via `fe.toml`) and formats all `.fe` files under `/src`. - -### `--check` - -- Does not write changes. -- Prints a unified diff for each file that would change. -- Exits `1` if any files are unformatted (or if IO errors occur). - -## `fe test` - -Runs Fe tests via the test harness (revm-based execution). - -### Synopsis - -``` -fe test [--filter ] [--jobs ] [--grouped] [--show-logs] [--optimize ] [--trace-evm] [--trace-evm-keep ] [--trace-evm-stack-n ] [--debug-dir ] [--report [--report-out ]] [--report-dir [--report-failed-only]] [--call-trace] [path]... -``` - -### Inputs - -- Zero or more paths (files or directories). -- Supports glob patterns (e.g. `crates/fe/tests/fixtures/fe_test/*.fe`). -- When omitted, defaults to the current project root (like `cargo test`). - -### Discovery and filtering - -- Tests are functions marked with a `#[test]` attribute. -- `--filter ` is a substring match against the test’s name. - -### Execution - -- `--jobs ` controls how many suites run in parallel (`0` = auto). -- By default, parallel execution uses per-test jobs after suite discovery. -- `--grouped` keeps suite-by-suite execution (each worker runs whole suites). - -### Debugging - -- `--trace-evm`, `--trace-evm-keep`, `--trace-evm-stack-n` enable EVM opcode tracing. -- `--debug-dir ` writes debug outputs (traces) into a directory. -- `--call-trace` prints a normalized call trace for each test. - -### Output - -- Per-test output is `PASS [s] ` / `FAIL [s] ` (colored). -- In multi-input runs, output is tabular: ` `, with suite names colored magenta. -- Progress/status labels include `COMPILING`, `READY` (blue), `PASS` (green), `FAIL` (red), and `ERROR` (red). -- `--show-logs` prints EVM logs (when available). -- A summary is printed if at least one test ran. -- If a suite has no tests, it prints `Warning: No tests found in ` and continues (exit code is still `0` if there are no failures elsewhere). - -### Reports: `--report` and `--report-dir` - -- `--report` writes a single `.tar.gz` report (default output: `fe-test-report.tar.gz`). -- `--report-dir ` writes one `.tar.gz` report per input suite into `` (useful with globs). -- `--report-failed-only` only writes per-suite reports for failing suites (requires `--report-dir`). - -Optimization flags: - -- Optimization is controlled by `--optimize ` / `-O `. -- Supported levels are `0`, `s`, `1`, and `2`. - -## `fe new` - -Creates a new ingot or workspace layout. - -### Synopsis - -``` -fe new [--workspace] [--name ] [--version ] -``` - -### Behavior - -- `fe new ` creates an ingot: - - `/fe.toml` (ingot config) - - `/src/lib.fe` (conventional root module; missing `src/lib.fe` is treated as an empty root module) -- `fe new --workspace ` creates a workspace root with `/fe.toml`. - -Safety checks: - -- Refuses to overwrite an existing `fe.toml` or `src/lib.fe`. -- Errors if the target path exists and is a file. - -Workspace suggestion: - -- After creating an ingot, if an enclosing workspace is detected, `fe new` may print a suggestion to add the ingot path to the workspace’s `members` (or `members.main` for grouped configs). -- If workspace member discovery fails, it prints a warning: - -``` -Warning: failed to check workspace members:
-``` - -## `fe completion` - -Generates shell completion scripts for `fe`. - -### Synopsis - -``` -fe completion -``` - -This writes the completion script to **stdout**. Supported shells are determined by `clap_complete` (commonly: `bash`, `zsh`, `fish`, `powershell`, `elvish`). - -## `fe lsif` - -Generates an LSIF index for code navigation. - -### Synopsis - -``` -fe lsif [-o, --output ] [path] -``` - -- If `path` is omitted, it defaults to `.`. -- If `--output` is omitted, the index is written to **stdout**. - -## `fe scip` - -Generates a SCIP index for code navigation. - -### Synopsis - -``` -fe scip [-o, --output ] [path] -``` - -- If `path` is omitted, it defaults to `.`. -- `--output` defaults to `index.scip`. diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 9291df17c5..0000000000 --- a/Cargo.lock +++ /dev/null @@ -1,8122 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "act-locally" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef9a921eb67a664d9e4d4ec3cc00caac360326f12625edc77ec3f5ce60fa7254" -dependencies = [ - "futures", - "smol", - "tracing", -] - -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] -name = "alloy-eip2124" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "741bdd7499908b3aa0b159bba11e71c8cddd009a2c2eb7a06e825f1ec87900a5" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "crc", - "serde", - "thiserror 2.0.18", -] - -[[package]] -name = "alloy-eip2930" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9441120fa82df73e8959ae0e4ab8ade03de2aaae61be313fbf5746277847ce25" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "borsh", - "serde", -] - -[[package]] -name = "alloy-eip7702" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2919c5a56a1007492da313e7a3b6d45ef5edc5d33416fdec63c0d7a2702a0d20" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "borsh", - "k256", - "serde", - "thiserror 2.0.18", -] - -[[package]] -name = "alloy-eip7928" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3231de68d5d6e75332b7489cfcc7f4dfabeba94d990a10e4b923af0e6623540" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "borsh", - "serde", -] - -[[package]] -name = "alloy-eips" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def1626eea28d48c6cc0a6f16f34d4af0001906e4f889df6c660b39c86fd044d" -dependencies = [ - "alloy-eip2124", - "alloy-eip2930", - "alloy-eip7702", - "alloy-eip7928", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "auto_impl", - "borsh", - "c-kzg", - "derive_more 2.0.1", - "either", - "serde", - "serde_with", - "sha2", - "thiserror 2.0.18", -] - -[[package]] -name = "alloy-primitives" -version = "1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b1483f8c2562bf35f0270b697d5b5fe8170464e935bd855a4c5eaf6f89b354" -dependencies = [ - "alloy-rlp", - "bytes", - "cfg-if", - "const-hex", - "derive_more 2.0.1", - "foldhash 0.2.0", - "hashbrown 0.16.1", - "indexmap 2.13.0", - "itoa", - "k256", - "keccak-asm", - "paste", - "proptest", - "rand 0.9.2", - "rapidhash", - "ruint", - "rustc-hash 2.1.1", - "serde", - "sha3", -] - -[[package]] -name = "alloy-rlp" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e93e50f64a77ad9c5470bf2ad0ca02f228da70c792a8f06634801e202579f35e" -dependencies = [ - "alloy-rlp-derive", - "arrayvec 0.7.6", - "bytes", -] - -[[package]] -name = "alloy-rlp-derive" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce8849c74c9ca0f5a03da1c865e3eb6f768df816e67dd3721a398a8a7e398011" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "alloy-serde" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6d631f8b975229361d8af7b2c749af31c73b3cf1352f90e144ddb06227105e" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", -] - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anes" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" - -[[package]] -name = "annotate-snippets" -version = "0.12.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e4850548ff4a25a77ce3bda7241874e17fb702ea551f0cc62a2dbe052f1272" -dependencies = [ - "anstyle", - "unicode-width 0.2.2", -] - -[[package]] -name = "anstream" -version = "0.6.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" - -[[package]] -name = "anstyle-parse" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys 0.61.2", -] - -[[package]] -name = "anyhow" -version = "1.0.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea" - -[[package]] -name = "arc-swap" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a3a1fd6f75306b68087b831f025c712524bcb19aad54e557b1129cfa0a2b207" -dependencies = [ - "rustversion", -] - -[[package]] -name = "ark-bls12-381" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df4dcc01ff89867cd86b0da835f23c3f02738353aaee7dde7495af71363b8d5" -dependencies = [ - "ark-ec", - "ark-ff 0.5.0", - "ark-serialize 0.5.0", - "ark-std 0.5.0", -] - -[[package]] -name = "ark-bn254" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" -dependencies = [ - "ark-ec", - "ark-ff 0.5.0", - "ark-r1cs-std", - "ark-std 0.5.0", -] - -[[package]] -name = "ark-ec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" -dependencies = [ - "ahash", - "ark-ff 0.5.0", - "ark-poly", - "ark-serialize 0.5.0", - "ark-std 0.5.0", - "educe", - "fnv", - "hashbrown 0.15.5", - "itertools 0.13.0", - "num-bigint", - "num-integer", - "num-traits", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" -dependencies = [ - "ark-ff-asm 0.3.0", - "ark-ff-macros 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", - "derivative", - "num-bigint", - "num-traits", - "paste", - "rustc_version 0.3.3", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" -dependencies = [ - "ark-ff-asm 0.4.2", - "ark-ff-macros 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", - "derivative", - "digest 0.10.7", - "itertools 0.10.5", - "num-bigint", - "num-traits", - "paste", - "rustc_version 0.4.1", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" -dependencies = [ - "ark-ff-asm 0.5.0", - "ark-ff-macros 0.5.0", - "ark-serialize 0.5.0", - "ark-std 0.5.0", - "arrayvec 0.7.6", - "digest 0.10.7", - "educe", - "itertools 0.13.0", - "num-bigint", - "num-traits", - "paste", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-asm" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-asm" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" -dependencies = [ - "quote", - "syn 2.0.116", -] - -[[package]] -name = "ark-ff-macros" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" -dependencies = [ - "num-bigint", - "num-traits", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" -dependencies = [ - "num-bigint", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" -dependencies = [ - "num-bigint", - "num-traits", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "ark-poly" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" -dependencies = [ - "ahash", - "ark-ff 0.5.0", - "ark-serialize 0.5.0", - "ark-std 0.5.0", - "educe", - "fnv", - "hashbrown 0.15.5", -] - -[[package]] -name = "ark-r1cs-std" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941551ef1df4c7a401de7068758db6503598e6f01850bdb2cfdb614a1f9dbea1" -dependencies = [ - "ark-ec", - "ark-ff 0.5.0", - "ark-relations", - "ark-std 0.5.0", - "educe", - "num-bigint", - "num-integer", - "num-traits", - "tracing", -] - -[[package]] -name = "ark-relations" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" -dependencies = [ - "ark-ff 0.5.0", - "ark-std 0.5.0", - "tracing", - "tracing-subscriber 0.2.25", -] - -[[package]] -name = "ark-serialize" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" -dependencies = [ - "ark-std 0.3.0", - "digest 0.9.0", -] - -[[package]] -name = "ark-serialize" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" -dependencies = [ - "ark-std 0.4.0", - "digest 0.10.7", - "num-bigint", -] - -[[package]] -name = "ark-serialize" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" -dependencies = [ - "ark-serialize-derive", - "ark-std 0.5.0", - "arrayvec 0.7.6", - "digest 0.10.7", - "num-bigint", -] - -[[package]] -name = "ark-serialize-derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "ark-std" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" -dependencies = [ - "num-traits", - "rand 0.8.6", -] - -[[package]] -name = "ark-std" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand 0.8.6", -] - -[[package]] -name = "ark-std" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" -dependencies = [ - "num-traits", - "rand 0.8.6", -] - -[[package]] -name = "arrayref" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - -[[package]] -name = "ascii_tree" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6c635b3aa665c649ad1415f1573c85957dfa47690ec27aebe7ec17efe3c643" - -[[package]] -name = "async-channel" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" -dependencies = [ - "concurrent-queue", - "event-listener 2.5.3", - "futures-core", -] - -[[package]] -name = "async-channel" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-compat" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ba85bc55464dcbf728b56d97e119d673f4cf9062be330a9a26f3acf504a590" -dependencies = [ - "futures-core", - "futures-io", - "once_cell", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "async-executor" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "pin-project-lite", - "slab", -] - -[[package]] -name = "async-fs" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5" -dependencies = [ - "async-lock", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-global-executor" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" -dependencies = [ - "async-channel 2.5.0", - "async-executor", - "async-io", - "async-lock", - "blocking", - "futures-lite", - "once_cell", -] - -[[package]] -name = "async-io" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" -dependencies = [ - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-lock" -version = "3.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" -dependencies = [ - "event-listener 5.4.1", - "event-listener-strategy", - "pin-project-lite", -] - -[[package]] -name = "async-lsp" -version = "0.2.3" -source = "git+https://github.com/fe-lang/async-lsp?branch=main#ce9c0f26ebf417754247451f5293a1bc182ca6a2" -dependencies = [ - "futures", - "lsp-types", - "pin-project-lite", - "rustix", - "serde", - "serde_json", - "thiserror 2.0.18", - "tokio", - "tower-layer", - "tower-service", - "tracing", - "waitpid-any", -] - -[[package]] -name = "async-net" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" -dependencies = [ - "async-io", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-process" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" -dependencies = [ - "async-channel 2.5.0", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if", - "event-listener 5.4.1", - "futures-lite", - "rustix", -] - -[[package]] -name = "async-signal" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix", - "signal-hook-registry", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-std" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8e079a4ab67ae52b7403632e4618815d6db36d2a010cfe41b02c1b1578f93b" -dependencies = [ - "async-channel 1.9.0", - "async-global-executor", - "async-io", - "async-lock", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "once_cell", - "pin-project-lite", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - -[[package]] -name = "async-trait" -version = "0.1.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "aurora-engine-modexp" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518bc5745a6264b5fd7b09dffb9667e400ee9e2bbe18555fac75e1fe9afa0df9" -dependencies = [ - "hex", - "num", -] - -[[package]] -name = "auto_impl" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "aws-lc-rs" -version = "1.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec6fb3fe69024a75fa7e1bfb48aa6cf59706a101658ea01bfd33b2b248a038f" -dependencies = [ - "aws-lc-sys", - "zeroize", -] - -[[package]] -name = "aws-lc-sys" -version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50037ee5e1e41e7b8f9d161680a725bd1626cb6f8c7e901f91f942850852fe7" -dependencies = [ - "cc", - "cmake", - "dunce", - "fs_extra", -] - -[[package]] -name = "axum" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" -dependencies = [ - "axum-core", - "base64", - "bytes", - "form_urlencoded", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-util", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "serde_core", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sha1", - "sync_wrapper", - "tokio", - "tokio-tungstenite 0.28.0", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "axum-core" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "http-body-util", - "mime", - "pin-project-lite", - "sync_wrapper", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "az" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5eb007b7cacc6c660343e96f650fedf4b5a77512399eb952ca6642cf8d13f7" - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "base64ct" -version = "1.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" - -[[package]] -name = "beef" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" - -[[package]] -name = "bimap" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" - -[[package]] -name = "binary-merge" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597bb81c80a54b6a4381b23faba8d7774b144c94cbd1d6fe3f1329bd776554ab" - -[[package]] -name = "bit-set" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" - -[[package]] -name = "bitcoin-io" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dee39a0ee5b4095224a0cfc6bf4cc1baf0f9624b96b367e53b66d974e51d953" - -[[package]] -name = "bitcoin_hashes" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26ec84b80c482df901772e931a9a681e26a1b9ee2302edeff23cb30328745c8b" -dependencies = [ - "bitcoin-io", - "hex-conservative", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "blocking" -version = "1.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" -dependencies = [ - "async-channel 2.5.0", - "async-task", - "futures-io", - "futures-lite", - "piper", -] - -[[package]] -name = "blst" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcdb4c7013139a150f9fc55d123186dbfaba0d912817466282c73ac49e71fb45" -dependencies = [ - "cc", - "glob", - "threadpool", - "zeroize", -] - -[[package]] -name = "borsh" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" -dependencies = [ - "borsh-derive", - "cfg_aliases", -] - -[[package]] -name = "borsh-derive" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0686c856aa6aac0c4498f936d7d6a02df690f614c03e4d906d1018062b5c5e2c" -dependencies = [ - "once_cell", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "boxcar" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f64beae40a84da1b4b26ff2761a5b895c12adc41dc25aaee1c4f2bbfe97a6e" - -[[package]] -name = "bstr" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" -dependencies = [ - "memchr", - "regex-automata", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" - -[[package]] -name = "byte-slice-cast" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" -dependencies = [ - "serde", -] - -[[package]] -name = "c-kzg" -version = "2.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e00bf4b112b07b505472dbefd19e37e53307e2bfed5a79e0cc161d58ccd0e687" -dependencies = [ - "blst", - "cc", - "glob", - "hex", - "libc", - "once_cell", - "serde", -] - -[[package]] -name = "camino" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" - -[[package]] -name = "cast" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" - -[[package]] -name = "cc" -version = "1.2.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" -dependencies = [ - "find-msvc-tools", - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - -[[package]] -name = "chrono" -version = "0.4.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" -dependencies = [ - "iana-time-zone", - "num-traits", - "serde", - "windows-link", -] - -[[package]] -name = "ciborium" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" -dependencies = [ - "ciborium-io", - "ciborium-ll", - "serde", -] - -[[package]] -name = "ciborium-io" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" - -[[package]] -name = "ciborium-ll" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" -dependencies = [ - "ciborium-io", - "half", -] - -[[package]] -name = "clap" -version = "4.5.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5caf74d17c3aec5495110c34cc3f78644bfa89af6c8993ed4de2790e49b6499" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "370daa45065b80218950227371916a1633217ae42b2715b2287b606dcd618e24" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_complete" -version = "4.5.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c757a3b7e39161a4e56f9365141ada2a6c915a8622c408ab6bb4b5d047371031" -dependencies = [ - "clap", -] - -[[package]] -name = "clap_derive" -version = "4.5.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "clap_lex" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" - -[[package]] -name = "clru" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197fd99cb113a8d5d9b6376f3aa817f32c1078f2343b714fff7d2ca44fdf67d5" -dependencies = [ - "hashbrown 0.16.1", -] - -[[package]] -name = "cmake" -version = "0.1.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" -dependencies = [ - "cc", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width 0.1.14", -] - -[[package]] -name = "colorchoice" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" - -[[package]] -name = "colored" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" -dependencies = [ - "lazy_static", - "windows-sys 0.59.0", -] - -[[package]] -name = "combine" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "console" -version = "0.15.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" -dependencies = [ - "encode_unicode", - "libc", - "once_cell", - "windows-sys 0.59.0", -] - -[[package]] -name = "const-hex" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bb320cac8a0750d7f25280aa97b09c26edfe161164238ecbbb31092b079e735" -dependencies = [ - "cfg-if", - "cpufeatures", - "proptest", - "serde_core", -] - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "const_format" -version = "0.2.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7faa7469a93a566e9ccc1c73fe783b4a65c274c5ace346038dca9c39fe0030ad" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "core-foundation" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "countme" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "cranelift-bitset" -version = "0.126.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006fe8776f6d81acb83571f52e7737a54c6dec1ba75e2b7b5a68af15451f88ee" - -[[package]] -name = "cranelift-bitset" -version = "0.130.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a44150c2f471a94023482bda1902710746e4bed9f9973d60c5a94319b06d" -dependencies = [ - "wasmtime-internal-core", -] - -[[package]] -name = "cranelift-entity" -version = "0.126.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcca10e8c33eac67a45be4e09d236e274697831ca6bf4c4a927f7570eb8436a8" -dependencies = [ - "cranelift-bitset 0.126.2", -] - -[[package]] -name = "cranelift-entity" -version = "0.130.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3109e417257082d88087f5bcce677525bdaa8322b88dd7f175ed1a1fd41d546c" -dependencies = [ - "cranelift-bitset 0.130.1", - "wasmtime-internal-core", -] - -[[package]] -name = "crc" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" - -[[package]] -name = "crc32fast" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "criterion" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" -dependencies = [ - "anes", - "cast", - "ciborium", - "clap", - "criterion-plot", - "is-terminal", - "itertools 0.10.5", - "num-traits", - "once_cell", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", -] - -[[package]] -name = "criterion-plot" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" -dependencies = [ - "cast", - "itertools 0.10.5", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-queue" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "darling" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.116", -] - -[[package]] -name = "darling_macro" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "dashmap" -version = "6.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" -dependencies = [ - "cfg-if", - "crossbeam-utils", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", - "rayon", -] - -[[package]] -name = "data-encoding" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" - -[[package]] -name = "der" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "deranged" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc3dc5ad92c2e2d1c193bbbbdf2ea477cb81331de4f3103f267ca18368b988c4" -dependencies = [ - "powerfmt", - "serde_core", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive-where" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef941ded77d15ca19b40374869ac6000af1c9f2a4c0f3d4c70926287e6364a8f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "derive_more" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" -dependencies = [ - "derive_more-impl 1.0.0", -] - -[[package]] -name = "derive_more" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" -dependencies = [ - "derive_more-impl 2.0.1", -] - -[[package]] -name = "derive_more-impl" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "derive_more-impl" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", - "unicode-xid", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "dir-test" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62c013fe825864f3e4593f36426c1fa7a74f5603f13ca8d1af7a990c1cd94a79" -dependencies = [ - "dir-test-macros", -] - -[[package]] -name = "dir-test-macros" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d42f54d7b4a6bc2400fe5b338e35d1a335787585375322f49c5d5fe7b243da7e" -dependencies = [ - "glob", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "dogged" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2638df109789fe360f0d9998c5438dd19a36678aaf845e46f285b688b1a1657a" - -[[package]] -name = "dot2" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "855423f2158bcc73798b3b9a666ec4204597a72370dc91dbdb8e7f9519de8cc3" - -[[package]] -name = "dot2" -version = "1.0.0" -source = "git+https://github.com/sanpii/dot2.rs.git#5c4ffa7182d3e6c14b91b94bb9efaad1e218022b" - -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - -[[package]] -name = "dyn-clone" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" - -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] - -[[package]] -name = "educe" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" -dependencies = [ - "enum-ordinalize", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest 0.10.7", - "ff", - "generic-array", - "group", - "pkcs8", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "ena" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1" -dependencies = [ - "dogged", - "log", -] - -[[package]] -name = "encode_unicode" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" - -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enum-ordinalize" -version = "4.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" -dependencies = [ - "enum-ordinalize-derive", -] - -[[package]] -name = "enum-ordinalize-derive" -version = "4.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "ethabi" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" -dependencies = [ - "ethereum-types", - "hex", - "once_cell", - "regex", - "serde", - "serde_json", - "sha3", - "thiserror 1.0.69", - "uint 0.9.5", -] - -[[package]] -name = "ethbloom" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "primitive-types 0.12.2", - "scale-info", - "uint 0.9.5", -] - -[[package]] -name = "ethers-core" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" -dependencies = [ - "arrayvec 0.7.6", - "bytes", - "chrono", - "const-hex", - "elliptic-curve", - "ethabi", - "generic-array", - "k256", - "num_enum", - "open-fastrlp", - "rand 0.8.6", - "rlp", - "serde", - "serde_json", - "strum", - "tempfile", - "thiserror 1.0.69", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "event-listener" -version = "5.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" -dependencies = [ - "event-listener 5.4.1", - "pin-project-lite", -] - -[[package]] -name = "faster-hex" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7223ae2d2f179b803433d9c830478527e92b8117eab39460edae7f1614d9fb73" -dependencies = [ - "heapless", - "serde", -] - -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - -[[package]] -name = "fastrlp" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" -dependencies = [ - "arrayvec 0.7.6", - "auto_impl", - "bytes", -] - -[[package]] -name = "fastrlp" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" -dependencies = [ - "arrayvec 0.7.6", - "auto_impl", - "bytes", -] - -[[package]] -name = "fe" -version = "26.2.0" -dependencies = [ - "axum", - "camino", - "clap", - "clap_complete", - "colored", - "cranelift-entity 0.130.1", - "crossbeam-channel", - "dir-test", - "ethers-core", - "fe-codegen", - "fe-common", - "fe-contract-harness", - "fe-driver", - "fe-fmt", - "fe-hir", - "fe-language-server", - "fe-mir", - "fe-resolver", - "fe-semantic-indexing", - "fe-solc-runner", - "fe-test-utils", - "fe-web", - "gix", - "glob", - "hex", - "petgraph", - "protobuf", - "rayon", - "rustc-hash 2.1.1", - "salsa", - "scip", - "serde", - "serde_json", - "sha2", - "similar", - "smol_str 0.1.24", - "tempfile", - "tiny-keccak", - "tokio", - "toml", - "tracing", - "url", - "walkdir", -] - -[[package]] -name = "fe-bench" -version = "26.2.0" -dependencies = [ - "camino", - "criterion", - "fe-common", - "fe-driver", - "fe-hir", - "fe-parser", - "fe-semantic-indexing", - "tempfile", - "tracing", - "url", - "walkdir", -] - -[[package]] -name = "fe-codegen" -version = "26.2.0" -dependencies = [ - "dir-test", - "fe-common", - "fe-driver", - "fe-hir", - "fe-mir", - "fe-test-utils", - "hex", - "num-bigint", - "rustc-hash 2.1.1", - "smallvec 1.15.1", - "smallvec 2.0.0-alpha.12", - "sonatina-codegen", - "sonatina-ir", - "sonatina-triple", - "sonatina-verifier", - "tracing", - "url", -] - -[[package]] -name = "fe-common" -version = "26.2.0" -dependencies = [ - "camino", - "fe-parser", - "ordermap", - "paste", - "petgraph", - "radix_immutable", - "rust-embed", - "rustc-hash 2.1.1", - "salsa", - "serde-semver", - "smol_str 0.1.24", - "toml", - "tracing", - "typed-path", - "url", -] - -[[package]] -name = "fe-contract-harness" -version = "26.2.0" -dependencies = [ - "ethers-core", - "fe-codegen", - "fe-common", - "fe-driver", - "hex", - "revm", - "serde_json", - "thiserror 1.0.69", - "tracing", - "url", -] - -[[package]] -name = "fe-dataflow" -version = "26.2.0" -dependencies = [ - "cranelift-entity 0.130.1", -] - -[[package]] -name = "fe-driver" -version = "26.2.0" -dependencies = [ - "camino", - "codespan-reporting", - "fe-common", - "fe-hir", - "fe-resolver", - "glob", - "petgraph", - "salsa", - "smol_str 0.1.24", - "tempfile", - "tracing", - "url", -] - -[[package]] -name = "fe-fmt" -version = "26.2.0" -dependencies = [ - "dir-test", - "fe-parser", - "fe-test-utils", - "pretty", -] - -[[package]] -name = "fe-hir" -version = "26.2.0" -dependencies = [ - "ascii_tree", - "bitflags 2.11.0", - "camino", - "codespan-reporting", - "cranelift-entity 0.130.1", - "derive_more 1.0.0", - "dir-test", - "dot2 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either", - "ena", - "fe-common", - "fe-dataflow", - "fe-driver", - "fe-parser", - "fe-test-utils", - "indexmap 2.13.0", - "itertools 0.14.0", - "num-bigint", - "num-traits", - "paste", - "ruint", - "rustc-hash 2.1.1", - "salsa", - "smallvec 1.15.1", - "smallvec 2.0.0-alpha.12", - "thin-vec", - "tiny-keccak", - "tracing", - "url", -] - -[[package]] -name = "fe-language-server" -version = "26.2.0" -dependencies = [ - "act-locally", - "anyhow", - "async-compat", - "async-lsp", - "async-std", - "axum", - "camino", - "clap", - "codespan-reporting", - "criterion", - "dir-test", - "fe-codegen", - "fe-common", - "fe-driver", - "fe-fmt", - "fe-hir", - "fe-mir", - "fe-parser", - "fe-resolver", - "fe-semantic-indexing", - "fe-test-utils", - "fe-web", - "futures", - "futures-batch", - "rustc-hash 2.1.1", - "salsa", - "serde", - "serde_json", - "smol_str 0.1.24", - "tempfile", - "tokio", - "tokio-tungstenite 0.26.2", - "tokio-util", - "tower", - "tracing", - "tracing-subscriber 0.3.22", - "url", -] - -[[package]] -name = "fe-mir" -version = "26.2.0" -dependencies = [ - "cranelift-entity 0.130.1", - "fe-common", - "fe-dataflow", - "fe-driver", - "fe-hir", - "num-bigint", - "num-traits", - "rustc-hash 2.1.1", - "salsa", - "url", -] - -[[package]] -name = "fe-parser" -version = "26.2.0" -dependencies = [ - "derive_more 1.0.0", - "dir-test", - "fe-test-utils", - "lazy_static", - "logos", - "num_enum", - "rowan", - "smallvec 2.0.0-alpha.12", - "tracing", - "tracing-subscriber 0.3.22", - "tree-sitter", - "tree-sitter-fe", - "unwrap-infallible", - "wasm-bindgen", - "wasm-bindgen-test", -] - -[[package]] -name = "fe-resolver" -version = "26.2.0" -dependencies = [ - "camino", - "dir-test", - "fe-common", - "fe-test-utils", - "gix", - "glob", - "indexmap 2.13.0", - "libc", - "petgraph", - "sha2", - "smol_str 0.1.24", - "tempfile", - "toml", - "tracing", - "url", - "windows-sys 0.61.2", -] - -[[package]] -name = "fe-semantic-indexing" -version = "26.2.0" -dependencies = [ - "camino", - "dir-test", - "fe-common", - "fe-driver", - "fe-hir", - "fe-test-utils", - "fe-web", - "rustc-hash 2.1.1", - "salsa", - "scip", - "serde", - "serde_json", - "tempfile", - "url", -] - -[[package]] -name = "fe-solc-runner" -version = "26.2.0" -dependencies = [ - "fe-contract-harness", - "indexmap 2.13.0", - "serde_json", -] - -[[package]] -name = "fe-test-utils" -version = "26.2.0" -dependencies = [ - "fe-common", - "insta", - "regex", - "tracing", - "tracing-subscriber 0.3.22", - "tracing-tree", - "url", -] - -[[package]] -name = "fe-uitest" -version = "26.2.0" -dependencies = [ - "dir-test", - "fe-common", - "fe-driver", - "fe-hir", - "fe-test-utils", - "url", - "wasm-bindgen-test", -] - -[[package]] -name = "fe-web" -version = "26.2.0" -dependencies = [ - "insta", - "js-sys", - "protobuf", - "pulldown-cmark", - "schemars 0.8.22", - "scip", - "serde", - "serde_json", - "wasm-bindgen", - "wasm-bindgen-test", -] - -[[package]] -name = "ff" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "filetime" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db" -dependencies = [ - "cfg-if", - "libc", - "libredox", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" - -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand 0.8.6", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foldhash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" - -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "fs_extra" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-batch" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f444c45a1cb86f2a7e301469fd50a82084a60dadc25d94529a8312276ecb71a" -dependencies = [ - "futures", - "futures-timer", - "pin-utils", -] - -[[package]] -name = "futures-channel" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" - -[[package]] -name = "futures-executor" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" - -[[package]] -name = "futures-lite" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - -[[package]] -name = "futures-macro" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "futures-sink" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" - -[[package]] -name = "futures-task" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" - -[[package]] -name = "futures-timer" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" - -[[package]] -name = "futures-util" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "r-efi", - "wasip2", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasip2", - "wasip3", -] - -[[package]] -name = "gix" -version = "0.83.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce52001b946a6249d5d0d3011df0a042ac3f8a4d013460db6476577b0b9c567" -dependencies = [ - "gix-actor", - "gix-archive", - "gix-attributes", - "gix-blame", - "gix-command", - "gix-commitgraph", - "gix-config", - "gix-credentials", - "gix-date", - "gix-diff", - "gix-dir", - "gix-discover", - "gix-error", - "gix-features", - "gix-filter", - "gix-fs", - "gix-glob", - "gix-hash", - "gix-hashtable", - "gix-ignore", - "gix-index", - "gix-lock", - "gix-merge", - "gix-negotiate", - "gix-object", - "gix-odb", - "gix-pack", - "gix-path", - "gix-pathspec", - "gix-prompt", - "gix-protocol", - "gix-ref", - "gix-refspec", - "gix-revision", - "gix-revwalk", - "gix-sec", - "gix-shallow", - "gix-status", - "gix-submodule", - "gix-tempfile", - "gix-trace", - "gix-transport", - "gix-traverse", - "gix-url", - "gix-utils", - "gix-validate", - "gix-worktree", - "gix-worktree-state", - "gix-worktree-stream", - "nonempty", - "smallvec 1.15.1", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-actor" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "272916673b83714734b15d4ef3c8b5f1ccddb15fea8ff548430b97c1ab7b7ed8" -dependencies = [ - "bstr", - "gix-date", - "gix-error", -] - -[[package]] -name = "gix-archive" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a20ec244b733338d4cb60e5e05eac700dab7fcc689647b1d1daa9396b119342" -dependencies = [ - "bstr", - "gix-date", - "gix-error", - "gix-object", - "gix-worktree-stream", -] - -[[package]] -name = "gix-attributes" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe17c5a1c0b6f2ef1476aa1d3222ea50cdff67608016613a58bfc3e078046000" -dependencies = [ - "bstr", - "gix-glob", - "gix-path", - "gix-quote", - "gix-trace", - "kstring", - "smallvec 1.15.1", - "thiserror 2.0.18", - "unicode-bom", -] - -[[package]] -name = "gix-bitmap" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecbfc77ec6852294e341ecc305a490b59f2813e6ca42d79efda5099dcab1894" -dependencies = [ - "gix-error", -] - -[[package]] -name = "gix-blame" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dab9a942ab54a9661ded7397c3bf927274e7afa94494db0d75cfcbde02ca0a" -dependencies = [ - "gix-commitgraph", - "gix-date", - "gix-diff", - "gix-error", - "gix-hash", - "gix-object", - "gix-revwalk", - "gix-trace", - "gix-traverse", - "gix-worktree", - "smallvec 1.15.1", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-chunk" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edf288be9b60fe7231de03771faa292be1493d84786f68727e33ad1f91764320" -dependencies = [ - "gix-error", -] - -[[package]] -name = "gix-command" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86335306511abe43d75c866d4b1f3d90932fe202edcd43e1314036333e7384d8" -dependencies = [ - "bstr", - "gix-path", - "gix-quote", - "gix-trace", - "shell-words", -] - -[[package]] -name = "gix-commitgraph" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3b5aa0f24e19028c261d229aeeedafcaaa52ebd71021cc15184620fc9d32eb" -dependencies = [ - "bstr", - "gix-chunk", - "gix-error", - "gix-hash", - "memmap2", - "nonempty", -] - -[[package]] -name = "gix-config" -version = "0.56.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c01848aebd21c67f6ba41f1de8efd46ae96df21f001954a3c9e1517e514d410" -dependencies = [ - "bstr", - "gix-config-value", - "gix-features", - "gix-glob", - "gix-path", - "gix-ref", - "gix-sec", - "smallvec 1.15.1", - "thiserror 2.0.18", - "unicode-bom", -] - -[[package]] -name = "gix-config-value" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b39ed39ee4c10a3b157f9fb94bac8098d9f8e56201f0cf7dee6c187416c4b2" -dependencies = [ - "bitflags 2.11.0", - "bstr", - "gix-path", - "libc", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-credentials" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ca11598b70811d7b16ff90945a6e57dfe521e85b744e51636965fe39cc8f60" -dependencies = [ - "bstr", - "gix-command", - "gix-config-value", - "gix-date", - "gix-path", - "gix-prompt", - "gix-sec", - "gix-trace", - "gix-url", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-date" -version = "0.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94cdae4eb4b0f4136e3d9b3aa2d2cd03cfb5bb9b636b31263aea2df86d41543" -dependencies = [ - "bstr", - "gix-error", - "itoa", - "jiff", - "smallvec 1.15.1", -] - -[[package]] -name = "gix-diff" -version = "0.63.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc08e0fa1a91ff5f24affeab052f198056645e1de004910bde7b82b50ea5982a" -dependencies = [ - "bstr", - "gix-command", - "gix-filter", - "gix-fs", - "gix-hash", - "gix-imara-diff", - "gix-object", - "gix-path", - "gix-tempfile", - "gix-trace", - "gix-traverse", - "gix-worktree", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-dir" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a0fc06e9e1e430cbf0a313666976d90f822f461a6525320427aa9b8af5236c" -dependencies = [ - "bstr", - "gix-discover", - "gix-fs", - "gix-ignore", - "gix-index", - "gix-object", - "gix-path", - "gix-pathspec", - "gix-trace", - "gix-utils", - "gix-worktree", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-discover" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17852e6a501e688a1702b24ebe5b3761d4719455bc869fd29f38b0b859bcad34" -dependencies = [ - "bstr", - "dunce", - "gix-fs", - "gix-path", - "gix-ref", - "gix-sec", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-error" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e207b971746ab724fccdfced2e4e19e854744611904a0195d3aa8fda8a110613" -dependencies = [ - "bstr", -] - -[[package]] -name = "gix-features" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af375693ad5333d0a2c66b4c5b2cbe9ccc38e34f8e8bf24e4ae42c12307fdc4f" -dependencies = [ - "bytes", - "crc32fast", - "gix-path", - "gix-trace", - "gix-utils", - "libc", - "once_cell", - "prodash", - "thiserror 2.0.18", - "walkdir", - "zlib-rs", -] - -[[package]] -name = "gix-filter" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac917dbe9653c9b615d248db91907a365bd779750c9e1b457a9d9fdeece3a08" -dependencies = [ - "bstr", - "encoding_rs", - "gix-attributes", - "gix-command", - "gix-hash", - "gix-object", - "gix-packetline", - "gix-path", - "gix-quote", - "gix-trace", - "gix-utils", - "smallvec 1.15.1", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-fs" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e1967daac9848757c47c2aef0c57bcadc1a897347f559778249bf286a536c86" -dependencies = [ - "bstr", - "fastrand", - "gix-features", - "gix-path", - "gix-utils", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-glob" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bf29249a069bf2507f5964f80997f37b134d320ea348d66527726b9be2c38c" -dependencies = [ - "bitflags 2.11.0", - "bstr", - "gix-features", - "gix-path", -] - -[[package]] -name = "gix-hash" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf70d1e252337eed16360f8b8ebb71865ece58eab7954b39ce38b420de703d2" -dependencies = [ - "faster-hex", - "gix-features", - "sha1-checked", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-hashtable" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d33b455e07b3c16d3b2eeebc7b38d2dafcbf8a653de1138ef55d4c2a1fd0b08b" -dependencies = [ - "gix-hash", - "hashbrown 0.16.1", - "parking_lot", -] - -[[package]] -name = "gix-ignore" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb13fbbeeafee943e52b61fcc88dfddf6a452fcaf0c4d0cdc8f218fa25bbec5" -dependencies = [ - "bstr", - "gix-glob", - "gix-path", - "gix-trace", - "unicode-bom", -] - -[[package]] -name = "gix-imara-diff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39eb0623e15e4cb83c02ce6a959e48fadd1ae3b715b36b5acc01816e01388c82" -dependencies = [ - "bstr", - "hashbrown 0.16.1", -] - -[[package]] -name = "gix-index" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c3ef97ad08121e4327a6226bd63fed6b9e3c6b976d48bddd4356d9d41191db" -dependencies = [ - "bitflags 2.11.0", - "bstr", - "filetime", - "fnv", - "gix-bitmap", - "gix-features", - "gix-fs", - "gix-hash", - "gix-lock", - "gix-object", - "gix-traverse", - "gix-utils", - "gix-validate", - "hashbrown 0.16.1", - "itoa", - "libc", - "memmap2", - "rustix", - "smallvec 1.15.1", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-lock" -version = "23.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b3bc074e5723027b482dcd9ab99d95804a53742f6de812d0172fbba4a186c1" -dependencies = [ - "gix-tempfile", - "gix-utils", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-merge" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74bbcdcc52b70a32f0a151b024dff9d0fcf56ee48f00d9503e735af9d99ea881" -dependencies = [ - "bstr", - "gix-command", - "gix-diff", - "gix-filter", - "gix-fs", - "gix-hash", - "gix-imara-diff", - "gix-index", - "gix-object", - "gix-path", - "gix-quote", - "gix-revision", - "gix-revwalk", - "gix-tempfile", - "gix-trace", - "gix-worktree", - "nonempty", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-negotiate" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "103d42bfade1b8a96ca5005933127bdad461ce588d92422b2c2daa3ff20d780c" -dependencies = [ - "bitflags 2.11.0", - "gix-commitgraph", - "gix-date", - "gix-hash", - "gix-object", - "gix-revwalk", -] - -[[package]] -name = "gix-object" -version = "0.60.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38075a95d7cc5df8afd38e72c617026c1456952207a4120a7f55a3fbf93b4d7" -dependencies = [ - "bstr", - "gix-actor", - "gix-date", - "gix-features", - "gix-hash", - "gix-hashtable", - "gix-utils", - "gix-validate", - "itoa", - "smallvec 1.15.1", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-odb" -version = "0.80.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeeda12a9663120418735ecdc1250d06eeab0be75700e47b3402a981331716ba" -dependencies = [ - "arc-swap", - "gix-features", - "gix-fs", - "gix-hash", - "gix-hashtable", - "gix-object", - "gix-pack", - "gix-path", - "gix-quote", - "memmap2", - "parking_lot", - "tempfile", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-pack" -version = "0.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf02e6f5c8f07a069c9ea5245f40d9b14856ada4086091dc99941b49002b4fa" -dependencies = [ - "clru", - "gix-chunk", - "gix-error", - "gix-features", - "gix-hash", - "gix-hashtable", - "gix-object", - "gix-path", - "gix-tempfile", - "memmap2", - "parking_lot", - "smallvec 1.15.1", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-packetline" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "362246df440ee691699f0664cbf7006a6ece477db6734222be95e4198e5656e6" -dependencies = [ - "bstr", - "faster-hex", - "gix-trace", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-path" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a6059e8a4c1b7f406e24716499cefa3926e060876fb1959ef225efeee346e" -dependencies = [ - "bstr", - "gix-trace", - "gix-validate", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-pathspec" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a84a4f083dd70fb49f4377e13afa6d90df2daaa1c705c49d6ff1331fc7e8855" -dependencies = [ - "bitflags 2.11.0", - "bstr", - "gix-attributes", - "gix-config-value", - "gix-glob", - "gix-path", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-prompt" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e041a626c64cb69e4117fcdf80da8d0e454fba3b1f420412792d191f52251aee" -dependencies = [ - "gix-command", - "gix-config-value", - "parking_lot", - "rustix", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-protocol" -version = "0.61.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4bee82db63ec635996b96efae71cf467c155fa3f34a556184373224a26c4fd" -dependencies = [ - "bstr", - "gix-credentials", - "gix-date", - "gix-features", - "gix-hash", - "gix-lock", - "gix-negotiate", - "gix-object", - "gix-ref", - "gix-refspec", - "gix-revwalk", - "gix-shallow", - "gix-trace", - "gix-transport", - "gix-utils", - "maybe-async", - "nonempty", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-quote" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e97b73791a64bc0fa7dd2c5b3e551136115f97750b876ed1c952c7a7dbaf8be" -dependencies = [ - "bstr", - "gix-error", - "gix-utils", -] - -[[package]] -name = "gix-ref" -version = "0.63.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8ba9cc15f558b274c99349b83130f5ec83459660828fde9718bbbb43a726167" -dependencies = [ - "gix-actor", - "gix-features", - "gix-fs", - "gix-hash", - "gix-lock", - "gix-object", - "gix-path", - "gix-tempfile", - "gix-utils", - "gix-validate", - "memmap2", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-refspec" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61755b27d57edc8940a1b1593c8c61548ca8e4c02da1ed8d5bfeda9eb2a6b761" -dependencies = [ - "bstr", - "gix-error", - "gix-glob", - "gix-hash", - "gix-revision", - "gix-validate", - "smallvec 1.15.1", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-revision" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb5288fac706d3ea3e4e2ba9ec38b78743b8c02f422e18cb342299cfd6ab7e8" -dependencies = [ - "bitflags 2.11.0", - "bstr", - "gix-commitgraph", - "gix-date", - "gix-error", - "gix-hash", - "gix-object", - "gix-revwalk", - "gix-trace", - "nonempty", -] - -[[package]] -name = "gix-revwalk" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313813706b073a12ff7f9b2896bf3e6504cdac7cfbc97b1920114724705069f0" -dependencies = [ - "gix-commitgraph", - "gix-date", - "gix-error", - "gix-hash", - "gix-hashtable", - "gix-object", - "smallvec 1.15.1", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-sec" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5a3a2d3e504a238136751e646a6c028252286a0ea64ea9974bf0498633407c6" -dependencies = [ - "bitflags 2.11.0", - "gix-path", - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "gix-shallow" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29187305521bfacf4aefd284ab28dbfa9fb74abd39a5e63dd313b1baa5808c27" -dependencies = [ - "bstr", - "gix-hash", - "gix-lock", - "nonempty", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-status" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c6d2a8c521ffa205fe7e268c82e6d1378ba37cd826ca10ab6129fdc29a4b65" -dependencies = [ - "bstr", - "filetime", - "gix-diff", - "gix-dir", - "gix-features", - "gix-filter", - "gix-fs", - "gix-hash", - "gix-index", - "gix-object", - "gix-path", - "gix-pathspec", - "gix-worktree", - "portable-atomic", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-submodule" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd5fc8692890bd71a596e540fd4c364f8460eaa82c4eaaedebde6e1e3eb4d91" -dependencies = [ - "bstr", - "gix-config", - "gix-path", - "gix-pathspec", - "gix-refspec", - "gix-url", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-tempfile" -version = "23.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "691ea1e31435c7e7d4d04705ec9d1c0d9482c46b2acf512bc723939d8f0af7fb" -dependencies = [ - "dashmap", - "gix-fs", - "libc", - "parking_lot", - "tempfile", -] - -[[package]] -name = "gix-trace" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f23569e55f2ffaf958617353b9734a7d52a7c19c439eeaa5e3efc217fd2270e" - -[[package]] -name = "gix-transport" -version = "0.57.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffd6a5c676b92d4ead5f5a2b2935024415dec69edc997b6090ca9cac010a3018" -dependencies = [ - "base64", - "bstr", - "gix-command", - "gix-credentials", - "gix-features", - "gix-packetline", - "gix-quote", - "gix-sec", - "gix-url", - "reqwest", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-traverse" -version = "0.57.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a14b7052c0786676c03e71fcfde7d7f0f8e8316e642b5cec6bb3998719b2ce5c" -dependencies = [ - "bitflags 2.11.0", - "gix-commitgraph", - "gix-date", - "gix-hash", - "gix-hashtable", - "gix-object", - "gix-revwalk", - "smallvec 1.15.1", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-url" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35842d099e813f6f6bba529e88d4670572149c3df79b7a412952259887721ece" -dependencies = [ - "bstr", - "gix-path", - "percent-encoding", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-utils" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e477b4f07a6e8da4ba791c53c858102959703c60d70f199932010d5b94adb2c" -dependencies = [ - "bstr", - "fastrand", - "unicode-normalization", -] - -[[package]] -name = "gix-validate" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e26ac2602b43eadfdca0560b81d3341944162a3c9f64ccdeef8fc501ad80dad5" -dependencies = [ - "bstr", -] - -[[package]] -name = "gix-worktree" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d69955eb5e2910832f88d041964b809eee01dadd579237e0b55efec58fd406fd" -dependencies = [ - "bstr", - "gix-attributes", - "gix-fs", - "gix-glob", - "gix-hash", - "gix-ignore", - "gix-index", - "gix-object", - "gix-path", - "gix-validate", -] - -[[package]] -name = "gix-worktree-state" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a96dccbcf9e8fe0291c55f06e08da93ebb2e691c1311276f541eefcc6d70800" -dependencies = [ - "bstr", - "gix-features", - "gix-filter", - "gix-fs", - "gix-index", - "gix-object", - "gix-path", - "gix-worktree", - "io-close", - "thiserror 2.0.18", -] - -[[package]] -name = "gix-worktree-stream" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8444b8ed4662e1a0c97f3eceda29630001a1bbb2632201e50312623e594213" -dependencies = [ - "gix-attributes", - "gix-error", - "gix-features", - "gix-filter", - "gix-fs", - "gix-hash", - "gix-object", - "gix-path", - "gix-traverse", - "parking_lot", -] - -[[package]] -name = "glob" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" - -[[package]] -name = "gloo-timers" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "gmp-mpfr-sys" -version = "1.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f8970a75c006bb2f8ae79c6768a116dd215fa8346a87aed99bf9d82ca43394" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "h2" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap 2.13.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "half" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" -dependencies = [ - "cfg-if", - "crunchy", - "zerocopy", -] - -[[package]] -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - -[[package]] -name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash 0.1.5", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash 0.2.0", - "serde", - "serde_core", -] - -[[package]] -name = "hashlink" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" -dependencies = [ - "hashbrown 0.15.5", -] - -[[package]] -name = "heapless" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" -dependencies = [ - "hash32", - "stable_deref_trait", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hex-conservative" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f" -dependencies = [ - "arrayvec 0.7.6", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "http" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" -dependencies = [ - "bytes", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" -dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "pin-utils", - "smallvec 1.15.1", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" -dependencies = [ - "http", - "hyper", - "hyper-util", - "rustls", - "tokio", - "tokio-rustls", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" -dependencies = [ - "base64", - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "ipnet", - "libc", - "percent-encoding", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "icu_collections" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec 1.15.1", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" - -[[package]] -name = "icu_properties" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" - -[[package]] -name = "icu_provider" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "id-arena" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec 1.15.1", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" -dependencies = [ - "equivalent", - "hashbrown 0.16.1", - "serde", - "serde_core", -] - -[[package]] -name = "inplace-vec-builder" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf64c2edc8226891a71f127587a2861b132d2b942310843814d5001d99a1d307" -dependencies = [ - "smallvec 1.15.1", -] - -[[package]] -name = "insta" -version = "1.46.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82db8c87c7f1ccecb34ce0c24399b8a73081427f3c7c50a5d597925356115e4" -dependencies = [ - "console", - "once_cell", - "regex", - "serde", - "similar", - "tempfile", -] - -[[package]] -name = "io-close" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cadcf447f06744f8ce713d2d6239bb5bde2c357a452397a9ed90c625da390bc" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "ipnet" -version = "2.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" - -[[package]] -name = "iri-string" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "is-terminal" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" - -[[package]] -name = "jiff" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3546dc96b6d42c5f24902af9e2538e82e39ad350b0c766eb3fbf2d8f3d8359" -dependencies = [ - "jiff-static", - "jiff-tzdb-platform", - "log", - "portable-atomic", - "portable-atomic-util", - "serde_core", - "windows-sys 0.61.2", -] - -[[package]] -name = "jiff-static" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a8c8b344124222efd714b73bb41f8b5120b27a7cc1c75593a6ff768d9d05aa4" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "jiff-tzdb" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c900ef84826f1338a557697dc8fc601df9ca9af4ac137c7fb61d4c6f2dfd3076" - -[[package]] -name = "jiff-tzdb-platform" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" -dependencies = [ - "jiff-tzdb", -] - -[[package]] -name = "jni" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" -dependencies = [ - "cesu8", - "cfg-if", - "combine", - "jni-sys 0.3.1", - "log", - "thiserror 1.0.69", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "jni-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" -dependencies = [ - "jni-sys 0.4.1", -] - -[[package]] -name = "jni-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" -dependencies = [ - "jni-sys-macros", -] - -[[package]] -name = "jni-sys-macros" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" -dependencies = [ - "quote", - "syn 2.0.116", -] - -[[package]] -name = "jobserver" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" -dependencies = [ - "getrandom 0.3.4", - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "k256" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2", -] - -[[package]] -name = "keccak" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "keccak-asm" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b646a74e746cd25045aa0fd42f4f7f78aa6d119380182c7e63a5593c4ab8df6f" -dependencies = [ - "digest 0.10.7", - "sha3-asm", -] - -[[package]] -name = "kstring" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558bf9508a558512042d3095138b1f7b8fe90c5467d94f9f1da28b3731c5dbd1" -dependencies = [ - "static_assertions", -] - -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - -[[package]] -name = "libc" -version = "0.2.182" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" - -[[package]] -name = "libm" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" - -[[package]] -name = "libredox" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" -dependencies = [ - "bitflags 2.11.0", - "libc", - "plain", - "redox_syscall 0.7.4", -] - -[[package]] -name = "linux-raw-sys" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" - -[[package]] -name = "litemap" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" - -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" -dependencies = [ - "value-bag", -] - -[[package]] -name = "logos" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff472f899b4ec2d99161c51f60ff7075eeb3097069a36050d8037a6325eb8154" -dependencies = [ - "logos-derive", -] - -[[package]] -name = "logos-codegen" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "192a3a2b90b0c05b27a0b2c43eecdb7c415e29243acc3f89cc8247a5b693045c" -dependencies = [ - "beef", - "fnv", - "lazy_static", - "proc-macro2", - "quote", - "regex-syntax", - "rustc_version 0.4.1", - "syn 2.0.116", -] - -[[package]] -name = "logos-derive" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "605d9697bcd5ef3a42d38efc51541aa3d6a4a25f7ab6d1ed0da5ac632a26b470" -dependencies = [ - "logos-codegen", -] - -[[package]] -name = "lru-slab" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" - -[[package]] -name = "lsp-types" -version = "0.95.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e34d33a8e9b006cd3fc4fe69a921affa097bae4bb65f76271f4644f9a334365" -dependencies = [ - "bitflags 1.3.2", - "serde", - "serde_json", - "serde_repr", - "url", -] - -[[package]] -name = "matchers" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "matchit" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" - -[[package]] -name = "maybe-async" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "memchr" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" - -[[package]] -name = "memmap2" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" -dependencies = [ - "libc", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "minicov" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4869b6a491569605d66d3952bcdf03df789e5b536e5f0cf7758a7f08a55ae24d" -dependencies = [ - "cc", - "walkdir", -] - -[[package]] -name = "mio" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.61.2", -] - -[[package]] -name = "nonempty" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9737e026353e5cd0736f98eddae28665118eb6f6600902a7f50db585621fecb6" - -[[package]] -name = "nu-ansi-term" -version = "0.50.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_cpus" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_enum" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" -dependencies = [ - "num_enum_derive", - "rustversion", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "once_cell_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" - -[[package]] -name = "oorandom" -version = "11.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" - -[[package]] -name = "open-fastrlp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" -dependencies = [ - "arrayvec 0.7.6", - "auto_impl", - "bytes", - "ethereum-types", - "open-fastrlp-derive", -] - -[[package]] -name = "open-fastrlp-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" -dependencies = [ - "bytes", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "openssl-probe" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" - -[[package]] -name = "ordermap" -version = "0.5.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b100f7dd605611822d30e182214d3c02fdefce2d801d23993f6b6ba6ca1392af" -dependencies = [ - "indexmap 2.13.0", -] - -[[package]] -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - -[[package]] -name = "parity-scale-codec" -version = "3.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799781ae679d79a948e13d4824a40970bfa500058d245760dd857301059810fa" -dependencies = [ - "arrayvec 0.7.6", - "bitvec", - "byte-slice-cast", - "const_format", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "rustversion", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34b4653168b563151153c9e4c08ebed57fb8262bebfa79711552fa983c623e7a" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - -[[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.5.18", - "smallvec 1.15.1", - "windows-link", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "pest" -version = "2.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662" -dependencies = [ - "memchr", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "pest_meta" -version = "2.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220" -dependencies = [ - "pest", - "sha2", -] - -[[package]] -name = "petgraph" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" -dependencies = [ - "fixedbitset", - "hashbrown 0.15.5", - "indexmap 2.13.0", - "serde", -] - -[[package]] -name = "phf" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" -dependencies = [ - "phf_macros", - "phf_shared", - "serde", -] - -[[package]] -name = "phf_generator" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" -dependencies = [ - "fastrand", - "phf_shared", -] - -[[package]] -name = "phf_macros" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" -dependencies = [ - "phf_generator", - "phf_shared", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "phf_shared" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "piper" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" - -[[package]] -name = "plotters" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" - -[[package]] -name = "plotters-svg" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" -dependencies = [ - "plotters-backend", -] - -[[package]] -name = "polling" -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" -dependencies = [ - "cfg-if", - "concurrent-queue", - "hermit-abi", - "pin-project-lite", - "rustix", - "windows-sys 0.61.2", -] - -[[package]] -name = "portable-atomic" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" - -[[package]] -name = "portable-atomic-util" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "potential_utf" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" -dependencies = [ - "zerovec", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "pretty" -version = "0.12.5" -source = "git+https://github.com/sbillig/pretty.rs?branch=max-width-group#33cbcf85447a2237eead7175352a52dc26923a1e" -dependencies = [ - "arrayvec 0.5.2", - "typed-arena", - "unicode-width 0.2.2", -] - -[[package]] -name = "prettyplease" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" -dependencies = [ - "proc-macro2", - "syn 2.0.116", -] - -[[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", -] - -[[package]] -name = "primitive-types" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "uint 0.9.5", -] - -[[package]] -name = "primitive-types" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721a1da530b5a2633218dc9f75713394c983c352be88d2d7c9ee85e2c4c21794" -dependencies = [ - "fixed-hash", - "uint 0.10.0", -] - -[[package]] -name = "proc-macro-crate" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" -dependencies = [ - "toml_edit 0.23.10+spec-1.0.0", -] - -[[package]] -name = "proc-macro2" -version = "1.0.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "prodash" -version = "31.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962200e2d7d551451297d9fdce85138374019ada198e30ea9ede38034e27604c" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "proptest" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37566cb3fdacef14c0737f9546df7cfeadbfbc9fef10991038bf5015d0c80532" -dependencies = [ - "bit-set", - "bit-vec", - "bitflags 2.11.0", - "num-traits", - "rand 0.9.2", - "rand_chacha 0.9.0", - "rand_xorshift", - "regex-syntax", - "rusty-fork", - "tempfile", - "unarray", -] - -[[package]] -name = "protobuf" -version = "3.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65a1d4ddae7d8b5de68153b48f6aa3bba8cb002b243dbdbc55a5afbc98f99f4" -dependencies = [ - "once_cell", - "protobuf-support", - "thiserror 1.0.69", -] - -[[package]] -name = "protobuf-support" -version = "3.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e36c2f31e0a47f9280fb347ef5e461ffcd2c52dd520d8e216b52f93b0b0d7d6" -dependencies = [ - "thiserror 1.0.69", -] - -[[package]] -name = "pulldown-cmark" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14" -dependencies = [ - "bitflags 2.11.0", - "memchr", - "pulldown-cmark-escape", - "unicase", -] - -[[package]] -name = "pulldown-cmark-escape" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quinn" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" -dependencies = [ - "bytes", - "cfg_aliases", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash 2.1.1", - "rustls", - "socket2", - "thiserror 2.0.18", - "tokio", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-proto" -version = "0.11.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" -dependencies = [ - "aws-lc-rs", - "bytes", - "getrandom 0.3.4", - "lru-slab", - "rand 0.9.2", - "ring", - "rustc-hash 2.1.1", - "rustls", - "rustls-pki-types", - "slab", - "thiserror 2.0.18", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.60.2", -] - -[[package]] -name = "quote" -version = "1.0.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "radix_immutable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dafbb83194e5cbdc904a1cb110deb10368327536b8129ca0f361f21dbd7a5703" -dependencies = [ - "once_cell", -] - -[[package]] -name = "rand" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" -dependencies = [ - "rand_chacha 0.9.0", - "rand_core 0.9.5", - "serde", -] - -[[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 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core 0.9.5", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] - -[[package]] -name = "rand_core" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" -dependencies = [ - "getrandom 0.3.4", - "serde", -] - -[[package]] -name = "rand_xorshift" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" -dependencies = [ - "rand_core 0.9.5", -] - -[[package]] -name = "rapidhash" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111325c42c4bafae99e777cd77b40dea9a2b30c69e9d8c74b6eccd7fba4337de" -dependencies = [ - "rustversion", -] - -[[package]] -name = "rayon" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags 2.11.0", -] - -[[package]] -name = "redox_syscall" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f450ad9c3b1da563fb6948a8e0fb0fb9269711c9c73d9ea1de5058c79c8d643a" -dependencies = [ - "bitflags 2.11.0", -] - -[[package]] -name = "ref-cast" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "regex" -version = "1.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" - -[[package]] -name = "reqwest" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-util", - "js-sys", - "log", - "mime", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-pki-types", - "rustls-platform-verifier", - "sync_wrapper", - "tokio", - "tokio-rustls", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "revm" -version = "33.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c85ed0028f043f87b3c88d4a4cb6f0a76440085523b6a8afe5ff003cf418054" -dependencies = [ - "revm-bytecode", - "revm-context", - "revm-context-interface", - "revm-database", - "revm-database-interface", - "revm-handler", - "revm-inspector", - "revm-interpreter", - "revm-precompile", - "revm-primitives", - "revm-state", -] - -[[package]] -name = "revm-bytecode" -version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2c6b5e6e8dd1e28a4a60e5f46615d4ef0809111c9e63208e55b5c7058200fb0" -dependencies = [ - "bitvec", - "phf", - "revm-primitives", - "serde", -] - -[[package]] -name = "revm-context" -version = "12.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f038f0c9c723393ac897a5df9140b21cfa98f5753a2cb7d0f28fa430c4118abf" -dependencies = [ - "bitvec", - "cfg-if", - "derive-where", - "revm-bytecode", - "revm-context-interface", - "revm-database-interface", - "revm-primitives", - "revm-state", - "serde", -] - -[[package]] -name = "revm-context-interface" -version = "13.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "431c9a14e4ef1be41ae503708fd02d974f80ef1f2b6b23b5e402e8d854d1b225" -dependencies = [ - "alloy-eip2930", - "alloy-eip7702", - "auto_impl", - "either", - "revm-database-interface", - "revm-primitives", - "revm-state", - "serde", -] - -[[package]] -name = "revm-database" -version = "9.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "980d8d6bba78c5dd35b83abbb6585b0b902eb25ea4448ed7bfba6283b0337191" -dependencies = [ - "alloy-eips", - "revm-bytecode", - "revm-database-interface", - "revm-primitives", - "revm-state", - "serde", -] - -[[package]] -name = "revm-database-interface" -version = "8.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cce03e3780287b07abe58faf4a7f5d8be7e81321f93ccf3343c8f7755602bae" -dependencies = [ - "auto_impl", - "either", - "revm-primitives", - "revm-state", - "serde", -] - -[[package]] -name = "revm-handler" -version = "14.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d44f8f6dbeec3fecf9fe55f78ef0a758bdd92ea46cd4f1ca6e2a946b32c367f3" -dependencies = [ - "auto_impl", - "derive-where", - "revm-bytecode", - "revm-context", - "revm-context-interface", - "revm-database-interface", - "revm-interpreter", - "revm-precompile", - "revm-primitives", - "revm-state", - "serde", -] - -[[package]] -name = "revm-inspector" -version = "14.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5617e49216ce1ca6c8826bcead0386bc84f49359ef67cde6d189961735659f93" -dependencies = [ - "auto_impl", - "either", - "revm-context", - "revm-database-interface", - "revm-handler", - "revm-interpreter", - "revm-primitives", - "revm-state", - "serde", - "serde_json", -] - -[[package]] -name = "revm-interpreter" -version = "31.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26ec36405f7477b9dccdc6caa3be19adf5662a7a0dffa6270cdb13a090c077e5" -dependencies = [ - "revm-bytecode", - "revm-context-interface", - "revm-primitives", - "revm-state", - "serde", -] - -[[package]] -name = "revm-precompile" -version = "31.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a62958af953cc4043e93b5be9b8497df84cc3bd612b865c49a7a7dfa26a84e2" -dependencies = [ - "ark-bls12-381", - "ark-bn254", - "ark-ec", - "ark-ff 0.5.0", - "ark-serialize 0.5.0", - "arrayref", - "aurora-engine-modexp", - "c-kzg", - "cfg-if", - "k256", - "p256", - "revm-primitives", - "ripemd", - "rug", - "secp256k1", - "sha2", -] - -[[package]] -name = "revm-primitives" -version = "21.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29e161db429d465c09ba9cbff0df49e31049fe6b549e28eb0b7bd642fcbd4412" -dependencies = [ - "alloy-primitives", - "num_enum", - "once_cell", - "serde", -] - -[[package]] -name = "revm-state" -version = "8.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d8be953b7e374dbdea0773cf360debed8df394ea8d82a8b240a6b5da37592fc" -dependencies = [ - "bitflags 2.11.0", - "revm-bytecode", - "revm-primitives", - "serde", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "ring" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.17", - "libc", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "ripemd" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "rlp" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" -dependencies = [ - "bytes", - "rlp-derive", - "rustc-hex", -] - -[[package]] -name = "rlp-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "rowan" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "417a3a9f582e349834051b8a10c8d71ca88da4211e4093528e36b9845f6b5f21" -dependencies = [ - "countme", - "hashbrown 0.14.5", - "rustc-hash 1.1.0", - "text-size", -] - -[[package]] -name = "rug" -version = "1.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de190ec858987c79cad4da30e19e546139b3339331282832af004d0ea7829639" -dependencies = [ - "az", - "gmp-mpfr-sys", - "libc", - "libm", -] - -[[package]] -name = "ruint" -version = "1.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c141e807189ad38a07276942c6623032d3753c8859c146104ac2e4d68865945a" -dependencies = [ - "alloy-rlp", - "ark-ff 0.3.0", - "ark-ff 0.4.2", - "ark-ff 0.5.0", - "bytes", - "fastrlp 0.3.1", - "fastrlp 0.4.0", - "num-bigint", - "num-integer", - "num-traits", - "parity-scale-codec", - "primitive-types 0.12.2", - "proptest", - "rand 0.8.6", - "rand 0.9.2", - "rlp", - "ruint-macro", - "serde_core", - "valuable", - "zeroize", -] - -[[package]] -name = "ruint-macro" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" - -[[package]] -name = "rust-embed" -version = "8.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04113cb9355a377d83f06ef1f0a45b8ab8cd7d8b1288160717d66df5c7988d27" -dependencies = [ - "rust-embed-impl", - "rust-embed-utils", - "walkdir", -] - -[[package]] -name = "rust-embed-impl" -version = "8.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0902e4c7c8e997159ab384e6d0fc91c221375f6894346ae107f47dd0f3ccaa" -dependencies = [ - "proc-macro2", - "quote", - "rust-embed-utils", - "syn 2.0.116", - "walkdir", -] - -[[package]] -name = "rust-embed-utils" -version = "8.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bcdef0be6fe7f6fa333b1073c949729274b05f123a0ad7efcb8efd878e5c3b1" -dependencies = [ - "sha2", - "walkdir", -] - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hash" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver 1.0.27", -] - -[[package]] -name = "rustix" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" -dependencies = [ - "bitflags 2.11.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustls" -version = "0.23.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f9466fb2c14ea04357e91413efb882e2a6d4a406e625449bc0a5d360d53a21" -dependencies = [ - "aws-lc-rs", - "once_cell", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-native-certs" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" -dependencies = [ - "openssl-probe", - "rustls-pki-types", - "schannel", - "security-framework", -] - -[[package]] -name = "rustls-pki-types" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" -dependencies = [ - "web-time", - "zeroize", -] - -[[package]] -name = "rustls-platform-verifier" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784" -dependencies = [ - "core-foundation", - "core-foundation-sys", - "jni", - "log", - "once_cell", - "rustls", - "rustls-native-certs", - "rustls-platform-verifier-android", - "rustls-webpki", - "security-framework", - "security-framework-sys", - "webpki-root-certs", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustls-platform-verifier-android" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" - -[[package]] -name = "rustls-webpki" -version = "0.103.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" -dependencies = [ - "aws-lc-rs", - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" - -[[package]] -name = "rusty-fork" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" -dependencies = [ - "fnv", - "quick-error", - "tempfile", - "wait-timeout", -] - -[[package]] -name = "ryu" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" - -[[package]] -name = "salsa" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be22155f8d9732518b2db2bf379fe6f0b2375e76b08b7c8fe6c1b887d548c24" -dependencies = [ - "boxcar", - "crossbeam-queue", - "dashmap", - "hashbrown 0.15.5", - "hashlink", - "indexmap 2.13.0", - "parking_lot", - "portable-atomic", - "rayon", - "rustc-hash 2.1.1", - "salsa-macro-rules", - "salsa-macros", - "smallvec 1.15.1", - "thin-vec", - "tracing", -] - -[[package]] -name = "salsa-macro-rules" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55a7ef0a84e336f7c5f0332d81727f5629fe042d2aa556c75307afebc9f78a5" - -[[package]] -name = "salsa-macros" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d0e88a9c0c0d231a63f83dcd1a2c5e5d11044fac4b65bc9ad3b68ab48b0a0ab" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.116", - "synstructure", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scale-info" -version = "2.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346a3b32eba2640d17a9cb5927056b08f3de90f65b72fe09402c2ad07d684d0b" -dependencies = [ - "cfg-if", - "derive_more 1.0.0", - "parity-scale-codec", - "scale-info-derive", -] - -[[package]] -name = "scale-info-derive" -version = "2.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6630024bf739e2179b91fb424b28898baf819414262c5d376677dbff1fe7ebf" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "schannel" -version = "0.1.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "schemars" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" -dependencies = [ - "dyn-clone", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 2.0.116", -] - -[[package]] -name = "scip" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0cc97469a1eef9e457bd6e935c8727d2e18c59489f06cd98207a6439a6498c" -dependencies = [ - "protobuf", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] - -[[package]] -name = "secp256k1" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3c81b43dc2d8877c216a3fccf76677ee1ebccd429566d3e67447290d0c42b2" -dependencies = [ - "bitcoin_hashes", - "rand 0.9.2", - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb913707158fadaf0d8702c2db0e857de66eb003ccfdda5924b5f5ac98efb38" -dependencies = [ - "cc", -] - -[[package]] -name = "security-framework" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" -dependencies = [ - "bitflags 2.11.0", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" -dependencies = [ - "serde", - "serde_core", -] - -[[package]] -name = "semver-parser" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2" -dependencies = [ - "pest", -] - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde-semver" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9418264b4789ea78183e45ed1785323a0a9d28c24b612c2f360ce86d3c87c301" -dependencies = [ - "proc-macro2", - "quote", - "semver 1.0.27", - "serde", - "serde-semver-derive", - "syn 1.0.109", -] - -[[package]] -name = "serde-semver-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb59c4005cc1e817ddad0dbc3b9af809cf49c989d0da46f735edf9629c0db19" -dependencies = [ - "proc-macro2", - "quote", - "semver 1.0.27", - "syn 1.0.109", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "serde_derive_internals" -version = "0.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "serde_json" -version = "1.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" -dependencies = [ - "indexmap 2.13.0", - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "serde_path_to_error" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" -dependencies = [ - "itoa", - "serde", - "serde_core", -] - -[[package]] -name = "serde_repr" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "serde_spanned" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "3.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fa237f2807440d238e0364a218270b98f767a00d3dada77b1c53ae88940e2e7" -dependencies = [ - "base64", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.13.0", - "schemars 0.9.0", - "schemars 1.2.1", - "serde_core", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha1-checked" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89f599ac0c323ebb1c6082821a54962b839832b03984598375bff3975b804423" -dependencies = [ - "digest 0.10.7", - "sha1", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.7", - "keccak", -] - -[[package]] -name = "sha3-asm" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b31139435f327c93c6038ed350ae4588e2c70a13d50599509fee6349967ba35a" -dependencies = [ - "cc", - "cfg-if", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shell-words" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest 0.10.7", - "rand_core 0.6.4", -] - -[[package]] -name = "similar" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" - -[[package]] -name = "siphasher" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" - -[[package]] -name = "smallvec" -version = "2.0.0-alpha.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef784004ca8777809dcdad6ac37629f0a97caee4c685fcea805278d81dd8b857" - -[[package]] -name = "smol" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33bd3e260892199c3ccfc487c88b2da2265080acb316cd920da72fdfd7c599f" -dependencies = [ - "async-channel 2.5.0", - "async-executor", - "async-fs", - "async-io", - "async-lock", - "async-net", - "async-process", - "blocking", - "futures-lite", -] - -[[package]] -name = "smol_str" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad6c857cbab2627dcf01ec85a623ca4e7dcb5691cbaa3d7fb7653671f0d09c9" -dependencies = [ - "serde", -] - -[[package]] -name = "smol_str" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f7a918bd2a9951d18ee6e48f076843e8e73a9a5d22cf05bcd4b7a81bdd04e17" -dependencies = [ - "borsh", - "serde_core", -] - -[[package]] -name = "socket2" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] - -[[package]] -name = "sonatina-codegen" -version = "0.0.3-alpha" -source = "git+https://github.com/fe-lang/sonatina?rev=039a9f5#039a9f530856a7c0097ffc9dad904eed3bf33fe3" -dependencies = [ - "bit-set", - "cranelift-entity 0.126.2", - "dashmap", - "indexmap 2.13.0", - "rayon", - "rustc-hash 2.1.1", - "smallvec 1.15.1", - "sonatina-ir", - "sonatina-macros", - "sonatina-triple", - "sonatina-verifier", - "tracing", - "vec-collections", -] - -[[package]] -name = "sonatina-ir" -version = "0.0.3-alpha" -source = "git+https://github.com/fe-lang/sonatina?rev=039a9f5#039a9f530856a7c0097ffc9dad904eed3bf33fe3" -dependencies = [ - "bit-set", - "bitflags 2.11.0", - "cranelift-entity 0.126.2", - "dashmap", - "dot2 1.0.0 (git+https://github.com/sanpii/dot2.rs.git)", - "dyn-clone", - "indexmap 2.13.0", - "parking_lot", - "primitive-types 0.14.0", - "rayon", - "rustc-hash 2.1.1", - "smallvec 1.15.1", - "smol_str 0.3.5", - "sonatina-macros", - "sonatina-triple", - "vec-collections", -] - -[[package]] -name = "sonatina-macros" -version = "0.0.3-alpha" -source = "git+https://github.com/fe-lang/sonatina?rev=039a9f5#039a9f530856a7c0097ffc9dad904eed3bf33fe3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "sonatina-parser" -version = "0.0.3-alpha" -source = "git+https://github.com/fe-lang/sonatina?rev=039a9f5#039a9f530856a7c0097ffc9dad904eed3bf33fe3" -dependencies = [ - "annotate-snippets", - "bimap", - "cranelift-entity 0.126.2", - "derive_more 2.0.1", - "either", - "hex", - "pest", - "pest_derive", - "rustc-hash 2.1.1", - "smallvec 1.15.1", - "smol_str 0.3.5", - "sonatina-ir", - "sonatina-triple", - "tracing", -] - -[[package]] -name = "sonatina-triple" -version = "0.0.3-alpha" -source = "git+https://github.com/fe-lang/sonatina?rev=039a9f5#039a9f530856a7c0097ffc9dad904eed3bf33fe3" -dependencies = [ - "thiserror 2.0.18", -] - -[[package]] -name = "sonatina-verifier" -version = "0.0.3-alpha" -source = "git+https://github.com/fe-lang/sonatina?rev=039a9f5#039a9f530856a7c0097ffc9dad904eed3bf33fe3" -dependencies = [ - "cranelift-entity 0.126.2", - "rayon", - "rustc-hash 2.1.1", - "smallvec 1.15.1", - "sonatina-ir", - "sonatina-macros", - "sonatina-parser", - "sonatina-triple", - "tracing", -] - -[[package]] -name = "sorted-iter" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bceb57dc07c92cdae60f5b27b3fa92ecaaa42fe36c55e22dbfb0b44893e0b1f7" - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "streaming-iterator" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.116", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df424c70518695237746f84cede799c9c58fcb37450d7b23716568cc8bc69cb" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -dependencies = [ - "futures-core", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "tempfile" -version = "3.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" -dependencies = [ - "fastrand", - "getrandom 0.4.1", - "once_cell", - "rustix", - "windows-sys 0.61.2", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "text-size" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" - -[[package]] -name = "thin-vec" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "259cdf8ed4e4aca6f1e9d011e10bd53f524a2d0637d7b28450f6c64ac298c4c6" - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" -dependencies = [ - "thiserror-impl 2.0.18", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "thread_local" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "time" -version = "0.3.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde_core", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" - -[[package]] -name = "time-macros" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinystr" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tinytemplate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "tinyvec" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.49.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" -dependencies = [ - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2", - "tokio-macros", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-macros" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "tokio-rustls" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite 0.26.2", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite 0.28.0", -] - -[[package]] -name = "tokio-util" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" -dependencies = [ - "bytes", - "futures-core", - "futures-io", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime 0.6.11", - "toml_edit 0.22.27", -] - -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_datetime" -version = "0.7.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_edit" -version = "0.22.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" -dependencies = [ - "indexmap 2.13.0", - "serde", - "serde_spanned", - "toml_datetime 0.6.11", - "toml_write", - "winnow", -] - -[[package]] -name = "toml_edit" -version = "0.23.10+spec-1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" -dependencies = [ - "indexmap 2.13.0", - "toml_datetime 0.7.5+spec-1.1.0", - "toml_parser", - "winnow", -] - -[[package]] -name = "toml_parser" -version = "1.0.9+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" -dependencies = [ - "winnow", -] - -[[package]] -name = "toml_write" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" - -[[package]] -name = "tower" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper", - "tokio", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-http" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" -dependencies = [ - "bitflags 2.11.0", - "bytes", - "futures-util", - "http", - "http-body", - "iri-string", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" -dependencies = [ - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" -dependencies = [ - "matchers", - "once_cell", - "regex-automata", - "sharded-slab", - "thread_local", - "tracing", - "tracing-core", -] - -[[package]] -name = "tracing-tree" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac87aa03b6a4d5a7e4810d1a80c19601dbe0f8a837e9177f23af721c7ba7beec" -dependencies = [ - "nu-ansi-term", - "tracing-core", - "tracing-log", - "tracing-subscriber 0.3.22", -] - -[[package]] -name = "tree-sitter" -version = "0.24.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5387dffa7ffc7d2dae12b50c6f7aab8ff79d6210147c6613561fc3d474c6f75" -dependencies = [ - "cc", - "regex", - "regex-syntax", - "streaming-iterator", - "tree-sitter-language", -] - -[[package]] -name = "tree-sitter-fe" -version = "26.2.0" -dependencies = [ - "cc", - "tree-sitter", - "tree-sitter-language", -] - -[[package]] -name = "tree-sitter-language" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "009994f150cc0cd50ff54917d5bc8bffe8cad10ca10d81c34da2ec421ae61782" - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "tungstenite" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" -dependencies = [ - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand 0.9.2", - "sha1", - "thiserror 2.0.18", - "utf-8", -] - -[[package]] -name = "tungstenite" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442" -dependencies = [ - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand 0.9.2", - "sha1", - "thiserror 2.0.18", - "utf-8", -] - -[[package]] -name = "typed-arena" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" - -[[package]] -name = "typed-path" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e" - -[[package]] -name = "typenum" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" - -[[package]] -name = "ucd-trie" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" - -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "uint" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909988d098b2f738727b161a106cfc7cab00c539c2687a8836f8e565976fb53e" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unarray" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" - -[[package]] -name = "unicase" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" - -[[package]] -name = "unicode-bom" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217" - -[[package]] -name = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[package]] -name = "unicode-normalization" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "unwrap-infallible" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", - "serde_derive", -] - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "valuable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" - -[[package]] -name = "value-bag" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba6f5989077681266825251a52748b8c1d8a4ad098cc37e440103d0ea717fc0" - -[[package]] -name = "vec-collections" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9965c8f2ffed1dbcd16cafe18a009642f540fa22661c6cfd6309ddb02e4982" -dependencies = [ - "binary-merge", - "inplace-vec-builder", - "lazy_static", - "num-traits", - "smallvec 1.15.1", - "sorted-iter", -] - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "wait-timeout" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" -dependencies = [ - "libc", -] - -[[package]] -name = "waitpid-any" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18aa3ce681e189f125c4c1e1388c03285e2fd434ef52c7203084012ac29c5e4a" -dependencies = [ - "rustix", - "windows-sys 0.59.0", -] - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.2+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasip3" -version = "0.4.0+wasi-0.3.0-rc-2026-01-06" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" -dependencies = [ - "cfg-if", - "futures-util", - "js-sys", - "once_cell", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn 2.0.116", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-bindgen-test" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45649196a53b0b7a15101d845d44d2dda7374fc1b5b5e2bbf58b7577ff4b346d" -dependencies = [ - "async-trait", - "cast", - "js-sys", - "libm", - "minicov", - "nu-ansi-term", - "num-traits", - "oorandom", - "serde", - "serde_json", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-bindgen-test-macro", - "wasm-bindgen-test-shared", -] - -[[package]] -name = "wasm-bindgen-test-macro" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f579cdd0123ac74b94e1a4a72bd963cf30ebac343f2df347da0b8df24cdebed2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "wasm-bindgen-test-shared" -version = "0.2.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8145dd1593bf0fb137dbfa85b8be79ec560a447298955877804640e40c2d6ea" - -[[package]] -name = "wasm-encoder" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" -dependencies = [ - "leb128fmt", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" -dependencies = [ - "anyhow", - "indexmap 2.13.0", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" -dependencies = [ - "bitflags 2.11.0", - "hashbrown 0.15.5", - "indexmap 2.13.0", - "semver 1.0.27", -] - -[[package]] -name = "wasmtime-internal-core" -version = "43.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22632b187e1b0716f1b9ac57ad29013bed33175fcb19e10bb6896126f82fac67" -dependencies = [ - "hashbrown 0.16.1", - "libm", -] - -[[package]] -name = "web-sys" -version = "0.3.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-root-certs" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31141ce3fc3e300ae89b78c0dd67f9708061d1d2eda54b8209346fd6be9a92c" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.5", -] - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.1", - "windows_aarch64_msvc 0.53.1", - "windows_i686_gnu 0.53.1", - "windows_i686_gnullvm 0.53.1", - "windows_i686_msvc 0.53.1", - "windows_x86_64_gnu 0.53.1", - "windows_x86_64_gnullvm 0.53.1", - "windows_x86_64_msvc 0.53.1", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - -[[package]] -name = "winnow" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" -dependencies = [ - "memchr", -] - -[[package]] -name = "wit-bindgen" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" -dependencies = [ - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen-core" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" -dependencies = [ - "anyhow", - "heck", - "indexmap 2.13.0", - "prettyplease", - "syn 2.0.116", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn 2.0.116", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" -dependencies = [ - "anyhow", - "bitflags 2.11.0", - "indexmap 2.13.0", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" -dependencies = [ - "anyhow", - "id-arena", - "indexmap 2.13.0", - "log", - "semver 1.0.27", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - -[[package]] -name = "writeable" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "yoke" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.8.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "zerotrie" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.116", -] - -[[package]] -name = "zlib-rs" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be3d40e40a133f9c916ee3f9f4fa2d9d63435b5fbe1bfc6d9dae0aa0ada1513" - -[[package]] -name = "zmij" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index b404888dfd..0000000000 --- a/Cargo.toml +++ /dev/null @@ -1,101 +0,0 @@ -[workspace] -members = ["crates/*"] -resolver = "2" - -[workspace.package] -edition = "2024" - -[workspace.dependencies] -common = { path = "crates/common", package = "fe-common" } -dataflow = { path = "crates/fe-dataflow", package = "fe-dataflow" } -driver = { path = "crates/driver", package = "fe-driver" } -fmt = { path = "crates/fmt", package = "fe-fmt" } -hir = { path = "crates/hir", package = "fe-hir" } -parser = { path = "crates/parser", package = "fe-parser" } -test-utils = { path = "crates/test-utils", package = "fe-test-utils" } -resolver = { path = "crates/resolver", package = "fe-resolver" } -codegen = { path = "crates/codegen", package = "fe-codegen" } -fe-web = { path = "crates/fe-web" } -semantic-indexing = { path = "crates/semantic-indexing", package = "fe-semantic-indexing" } -language-server = { path = "crates/language-server", package = "fe-language-server" } -mir = { path = "crates/mir", package = "fe-mir" } -cranelift-entity = "0.130" -url = "2.5.4" -camino = "1.1.9" -typed-path = "0.12.3" -clap = { version = "4.5.26", features = ["derive"] } -clap_complete = "4.5.65" -codespan-reporting = "0.11" -derive_more = { version = "1.0", default-features = false, features = [ - "from", - "try_into", -] } -dir-test = "0.4" -glob = "0.3.2" -crossbeam-channel = "0.5.15" -gix = { version = "0.83.0", default-features = false } -rustc-hash = "2.1.0" -num-bigint = "0.4" -num-traits = "0.2" -paste = "1.0.15" -salsa = "0.20" -smallvec = { version = "2.0.0-alpha.11" } -smallvec1 = { version = "1", package = "smallvec" } -thin-vec = "0.2.16" -smol_str = { version = "0.1", features = ["serde"] } -serde-semver = "0.2.1" -tracing = "0.1.41" -tracing-subscriber = { version = "0.3.19", default-features = false, features = ["std", "fmt", "env-filter"] } -tracing-tree = "0.4.0" -wasm-bindgen-test = "0.3" -semver = "1.0.26" -petgraph = "0.8" -sonatina-ir = { git = "https://github.com/fe-lang/sonatina", rev = "039a9f5" } -sonatina-triple = { git = "https://github.com/fe-lang/sonatina", rev = "039a9f5" } -sonatina-codegen = { git = "https://github.com/fe-lang/sonatina", rev = "039a9f5" } -sonatina-verifier = { git = "https://github.com/fe-lang/sonatina", rev = "039a9f5" } - -[profile.dev] -# Set to 0 to make the build faster and debugging more difficult. -debug = 0 - -[profile.test] -# Set to 0 to make the build faster and debugging more difficult. -debug = 0 - -[profile.release] -debug = 0 - -[profile.dev.package] -revm = { opt-level = 3 } -revm-bytecode = { opt-level = 3 } -revm-context = { opt-level = 3 } -revm-context-interface = { opt-level = 3 } -revm-database = { opt-level = 3 } -revm-database-interface = { opt-level = 3 } -revm-handler = { opt-level = 3 } -revm-inspector = { opt-level = 3 } -revm-interpreter = { opt-level = 3 } -revm-precompile = { opt-level = 3 } -revm-primitives = { opt-level = 3 } -revm-state = { opt-level = 3 } -sonatina-ir = { opt-level = 3 } -sonatina-codegen = { opt-level = 3 } -sonatina-verifier = { opt-level = 3 } - -[profile.test.package] -revm = { opt-level = 3 } -revm-bytecode = { opt-level = 3 } -revm-context = { opt-level = 3 } -revm-context-interface = { opt-level = 3 } -revm-database = { opt-level = 3 } -revm-database-interface = { opt-level = 3 } -revm-handler = { opt-level = 3 } -revm-inspector = { opt-level = 3 } -revm-interpreter = { opt-level = 3 } -revm-precompile = { opt-level = 3 } -revm-primitives = { opt-level = 3 } -revm-state = { opt-level = 3 } -sonatina-ir = { opt-level = 3 } -sonatina-codegen = { opt-level = 3 } -sonatina-verifier = { opt-level = 3 } diff --git a/LICENSE-APACHE b/LICENSE-APACHE deleted file mode 100644 index 1b5ec8b78e..0000000000 --- a/LICENSE-APACHE +++ /dev/null @@ -1,176 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS diff --git a/Makefile b/Makefile deleted file mode 100644 index 1a45c86ac5..0000000000 --- a/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -.PHONY: docker-test -docker-test: - docker run \ - --rm \ - --volume "$(shell pwd):/mnt" \ - --workdir '/mnt' \ - rustlang/rust:nightly \ - cargo test --workspace - -.PHONY: docker-wasm-test -docker-wasm-test: - docker run \ - --rm \ - --volume "$(shell pwd):/mnt" \ - --workdir '/mnt' \ - rust:latest \ - /bin/bash -c "rustup target add wasm32-unknown-unknown && cargo test -p fe-common -p fe-parser -p fe-hir --target wasm32-unknown-unknown" - -.PHONY: treesitter-generate -treesitter-generate: - # Generate the tree-sitter parser with the pinned CLI. The generated - # sources (parser.c, grammar.json, node-types.json, src/tree_sitter/) are - # not tracked in git; they're regenerated from grammar.js at build time. - cd crates/tree-sitter-fe && npm ci --ignore-scripts && npm rebuild tree-sitter-cli && npx tree-sitter generate --abi=14 - -.PHONY: test -test: treesitter-generate - # Builds and runs the workspace tests, including the tree-sitter grammar - # test (crates/parser/tests/tree_sitter_parse.rs), which parses every .fe - # fixture against the freshly generated grammar. - cargo nextest run --release --workspace --all-features --no-fail-fast \ - --exclude fe-language-server --exclude fe-bench - -.PHONY: check-wasm -check-wasm: - @echo "Checking core crates for wasm32-unknown-unknown..." - cargo check -p fe-common -p fe-parser -p fe-hir --target wasm32-unknown-unknown - @echo "✓ Core crates support wasm32-unknown-unknown" - -.PHONY: check-wasi -check-wasi: - @echo "Checking filesystem-dependent crates for wasm32-wasip1..." - cargo check -p fe-driver -p fe-resolver --target wasm32-wasip1 - @echo "✓ Filesystem crates support wasm32-wasip1" - -.PHONY: check-wasm-all -check-wasm-all: check-wasm check-wasi - @echo "✓ All WASM/WASI checks passed" - -.PHONY: coverage -coverage: - cargo tarpaulin --workspace --all-features --verbose --timeout 120 --exclude-files 'tests/*' --exclude-files 'main.rs' --out xml html -- --skip differential:: - -.PHONY: clippy -clippy: - cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::upper-case-acronyms -A clippy::large-enum-variant -W clippy::print_stdout -W clippy::print_stderr - -.PHONY: rustfmt -rustfmt: - cargo fmt --all -- --check - -.PHONY: lint -lint: rustfmt clippy - -.PHONY: build-docs -build-docs: - cargo doc --no-deps --workspace - -README.md: src/main.rs - cargo readme --no-title --no-indent-headings > README.md - -notes: - towncrier build --yes --version $(version) - git commit -m "Compile release notes" - -release: - # Ensure release notes where generated before running the release command - ./newsfragments/validate_files.py is-empty - cargo release $(version) --execute --all --no-tag --no-push - # Run the tests again because we may have to adjust some based on the update version - cargo test --workspace - -push-tag: - # Run `make release version=` first - ./newsfragments/validate_files.py is-empty - # Tag the release with the current version number - git tag "v$$(cargo pkgid fe | cut -d# -f2 | cut -d: -f2)" - git push --tags upstream diff --git a/README.md b/README.md deleted file mode 100644 index 8e5240c728..0000000000 --- a/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# Fe - -Fe is a Rust-like, statically typed language for the Ethereum Virtual Machine -(EVM), with explicit effects, message-passing contracts, and an integrated -toolchain. - -> **Status:** Fe 26.x is **not production-ready**. See the -> [Fe 26 release announcement](https://blog.fe-lang.org/posts/fe26-a-fresh-start/) -> for context. - -- Website: -- Docs: -- Blog: -- Zulip: - -## Install - -Use `feup`: - -```bash -curl -fsSL https://raw.githubusercontent.com/argotorg/fe/master/feup/feup.sh | bash -``` - -See for language documentation, examples, and other -installation options. - -## CLI - -The compiler is exposed through the `fe` binary. See [`CLI.md`](./CLI.md) for -the command reference. - -## Repository Layout - -- `crates/` - compiler crates, CLI, language server, and supporting tools -- `ingots/core/` - `core` ingot, built into every compilation -- `ingots/std/` - Fe standard library -- `feup/` - the `feup` installer script -- `newsfragments/` - release note fragments consumed by towncrier - -## Development - -Run the workspace tests: - -```bash -cargo test --workspace -``` - -Snapshot tests use [`insta`](https://insta.rs/): - -```bash -cargo insta review -cargo insta accept --workspace -``` - -## Contributing - -Non-trivial language or architecture changes should start as a discussion on -GitHub or Zulip. For bug fixes and small improvements, a PR against `master` is -fine. - -## License - -Licensed under the [Apache License, Version 2.0](./LICENSE-APACHE). diff --git a/crates/language-server/test_files/messy/dangling.fe b/compiler-docs/.lock similarity index 100% rename from crates/language-server/test_files/messy/dangling.fe rename to compiler-docs/.lock diff --git a/compiler-docs/crates.js b/compiler-docs/crates.js new file mode 100644 index 0000000000..93cbe18ad9 --- /dev/null +++ b/compiler-docs/crates.js @@ -0,0 +1,2 @@ +window.ALL_CRATES = ["fe","fe_abi","fe_analyzer","fe_codegen","fe_common","fe_compiler_test_utils","fe_compiler_tests","fe_compiler_tests_legacy","fe_driver","fe_library","fe_mir","fe_parser","fe_test_files","fe_test_runner","fe_yulc"]; +//{"start":21,"fragment_lengths":[4,9,14,13,12,25,20,27,12,13,9,12,16,17,10]} \ No newline at end of file diff --git a/compiler-docs/fe/all.html b/compiler-docs/fe/all.html new file mode 100644 index 0000000000..8a7290f6d0 --- /dev/null +++ b/compiler-docs/fe/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/compiler-docs/fe/fn.main.html b/compiler-docs/fe/fn.main.html new file mode 100644 index 0000000000..82130c514b --- /dev/null +++ b/compiler-docs/fe/fn.main.html @@ -0,0 +1 @@ +main in fe - Rust

Function main

Source
pub(crate) fn main()
\ No newline at end of file diff --git a/compiler-docs/fe/index.html b/compiler-docs/fe/index.html new file mode 100644 index 0000000000..3e7a86a51b --- /dev/null +++ b/compiler-docs/fe/index.html @@ -0,0 +1 @@ +fe - Rust

Crate fe

Source

Modules§

task 🔒

Structs§

FelangCli 🔒

Functions§

main 🔒
\ No newline at end of file diff --git a/compiler-docs/fe/sidebar-items.js b/compiler-docs/fe/sidebar-items.js new file mode 100644 index 0000000000..0e912cd34b --- /dev/null +++ b/compiler-docs/fe/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["main"],"mod":["task"],"struct":["FelangCli"]}; \ No newline at end of file diff --git a/compiler-docs/fe/struct.FelangCli.html b/compiler-docs/fe/struct.FelangCli.html new file mode 100644 index 0000000000..4775bcd101 --- /dev/null +++ b/compiler-docs/fe/struct.FelangCli.html @@ -0,0 +1,109 @@ +FelangCli in fe - Rust

Struct FelangCli

Source
pub(crate) struct FelangCli {
+    pub(crate) command: Commands,
+}

Fields§

§command: Commands

Trait Implementations§

Source§

impl Args for FelangCli

Source§

fn augment_args<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can instantiate Self. Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can update self. Read more
Source§

impl CommandFactory for FelangCli

Source§

fn into_app<'b>() -> Command<'b>

Deprecated, replaced with CommandFactory::command
Source§

fn into_app_for_update<'b>() -> Command<'b>

Deprecated, replaced with CommandFactory::command_for_update
§

fn command<'help>() -> App<'help>

Build a [Command] that can instantiate Self. Read more
§

fn command_for_update<'help>() -> App<'help>

Build a [Command] that can update self. Read more
Source§

impl FromArgMatches for FelangCli

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches, +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for FelangCli

§

fn parse() -> Self

Parse from std::env::args_os(), exit on error
§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
§

fn parse_from<I, T>(itr: I) -> Self
where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone,

Parse from iterator, exit on error
§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
§

fn update_from<I, T>(&mut self, itr: I)
where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone,

Update from iterator, exit on error
§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe/task/build/constant.DEFAULT_OUTPUT_DIR_NAME.html b/compiler-docs/fe/task/build/constant.DEFAULT_OUTPUT_DIR_NAME.html new file mode 100644 index 0000000000..279c8f306e --- /dev/null +++ b/compiler-docs/fe/task/build/constant.DEFAULT_OUTPUT_DIR_NAME.html @@ -0,0 +1 @@ +DEFAULT_OUTPUT_DIR_NAME in fe::task::build - Rust

Constant DEFAULT_OUTPUT_DIR_NAME

Source
const DEFAULT_OUTPUT_DIR_NAME: &str = "output";
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/enum.Emit.html b/compiler-docs/fe/task/build/enum.Emit.html new file mode 100644 index 0000000000..7f420a5ec4 --- /dev/null +++ b/compiler-docs/fe/task/build/enum.Emit.html @@ -0,0 +1,117 @@ +Emit in fe::task::build - Rust

Enum Emit

Source
enum Emit {
+    Abi,
+    Ast,
+    LoweredAst,
+    Bytecode,
+    RuntimeBytecode,
+    Tokens,
+    Yul,
+}

Variants§

§

Abi

§

Ast

§

LoweredAst

§

Bytecode

§

RuntimeBytecode

§

Tokens

§

Yul

Trait Implementations§

Source§

impl Clone for Emit

Source§

fn clone(&self) -> Emit

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Emit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Ord for Emit

Source§

fn cmp(&self, other: &Emit) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Emit

Source§

fn eq(&self, other: &Emit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for Emit

Source§

fn partial_cmp(&self, other: &Emit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl ValueEnum for Emit

Source§

fn value_variants<'a>() -> &'a [Self]

All possible argument values, in display order.
Source§

fn to_possible_value<'a>(&self) -> Option<PossibleValue<'a>>

The canonical argument value. Read more
§

fn from_str(input: &str, ignore_case: bool) -> Result<Self, String>

Parse an argument into Self.
Source§

impl Copy for Emit

Source§

impl Eq for Emit

Source§

impl StructuralPartialEq for Emit

Auto Trait Implementations§

§

impl Freeze for Emit

§

impl RefUnwindSafe for Emit

§

impl Send for Emit

§

impl Sync for Emit

§

impl Unpin for Emit

§

impl UnwindSafe for Emit

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> DynClone for T
where + T: Clone,

Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe/task/build/fn.build.html b/compiler-docs/fe/task/build/fn.build.html new file mode 100644 index 0000000000..06e47bd07a --- /dev/null +++ b/compiler-docs/fe/task/build/fn.build.html @@ -0,0 +1 @@ +build in fe::task::build - Rust

Function build

Source
pub fn build(compile_arg: BuildArgs)
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/fn.build_ingot.html b/compiler-docs/fe/task/build/fn.build_ingot.html new file mode 100644 index 0000000000..731f0f1c63 --- /dev/null +++ b/compiler-docs/fe/task/build/fn.build_ingot.html @@ -0,0 +1 @@ +build_ingot in fe::task::build - Rust

Function build_ingot

Source
fn build_ingot(compile_arg: &BuildArgs) -> (String, CompiledModule)
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/fn.build_single_file.html b/compiler-docs/fe/task/build/fn.build_single_file.html new file mode 100644 index 0000000000..9d2e80117f --- /dev/null +++ b/compiler-docs/fe/task/build/fn.build_single_file.html @@ -0,0 +1 @@ +build_single_file in fe::task::build - Rust

Function build_single_file

Source
fn build_single_file(compile_arg: &BuildArgs) -> (String, CompiledModule)
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/fn.ioerr_to_string.html b/compiler-docs/fe/task/build/fn.ioerr_to_string.html new file mode 100644 index 0000000000..bf0d40ceb3 --- /dev/null +++ b/compiler-docs/fe/task/build/fn.ioerr_to_string.html @@ -0,0 +1 @@ +ioerr_to_string in fe::task::build - Rust

Function ioerr_to_string

Source
fn ioerr_to_string(error: Error) -> String
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/fn.mir_dump.html b/compiler-docs/fe/task/build/fn.mir_dump.html new file mode 100644 index 0000000000..171a825f4f --- /dev/null +++ b/compiler-docs/fe/task/build/fn.mir_dump.html @@ -0,0 +1 @@ +mir_dump in fe::task::build - Rust

Function mir_dump

Source
fn mir_dump(input_path: &str)
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/fn.verify_nonexistent_or_empty.html b/compiler-docs/fe/task/build/fn.verify_nonexistent_or_empty.html new file mode 100644 index 0000000000..cd45f60fe9 --- /dev/null +++ b/compiler-docs/fe/task/build/fn.verify_nonexistent_or_empty.html @@ -0,0 +1 @@ +verify_nonexistent_or_empty in fe::task::build - Rust

Function verify_nonexistent_or_empty

Source
fn verify_nonexistent_or_empty(dir: &Path) -> Result<(), String>
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/fn.write_compiled_module.html b/compiler-docs/fe/task/build/fn.write_compiled_module.html new file mode 100644 index 0000000000..28de4cffeb --- /dev/null +++ b/compiler-docs/fe/task/build/fn.write_compiled_module.html @@ -0,0 +1,7 @@ +write_compiled_module in fe::task::build - Rust

Function write_compiled_module

Source
fn write_compiled_module(
+    module: CompiledModule,
+    file_content: &str,
+    targets: &[Emit],
+    output_dir: &str,
+    overwrite: bool,
+) -> Result<(), String>
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/fn.write_output.html b/compiler-docs/fe/task/build/fn.write_output.html new file mode 100644 index 0000000000..e70f5a321b --- /dev/null +++ b/compiler-docs/fe/task/build/fn.write_output.html @@ -0,0 +1 @@ +write_output in fe::task::build - Rust

Function write_output

Source
fn write_output(path: &Path, content: &str) -> Result<(), String>
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/index.html b/compiler-docs/fe/task/build/index.html new file mode 100644 index 0000000000..dc6416c344 --- /dev/null +++ b/compiler-docs/fe/task/build/index.html @@ -0,0 +1 @@ +fe::task::build - Rust

Module build

Source

Structs§

BuildArgs

Enums§

Emit 🔒

Constants§

DEFAULT_OUTPUT_DIR_NAME 🔒

Functions§

build
build_ingot 🔒
build_single_file 🔒
ioerr_to_string 🔒
mir_dump 🔒
verify_nonexistent_or_empty 🔒
write_compiled_module 🔒
write_output 🔒
\ No newline at end of file diff --git a/compiler-docs/fe/task/build/sidebar-items.js b/compiler-docs/fe/task/build/sidebar-items.js new file mode 100644 index 0000000000..77dc7c0ee2 --- /dev/null +++ b/compiler-docs/fe/task/build/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["DEFAULT_OUTPUT_DIR_NAME"],"enum":["Emit"],"fn":["build","build_ingot","build_single_file","ioerr_to_string","mir_dump","verify_nonexistent_or_empty","write_compiled_module","write_output"],"struct":["BuildArgs"]}; \ No newline at end of file diff --git a/compiler-docs/fe/task/build/struct.BuildArgs.html b/compiler-docs/fe/task/build/struct.BuildArgs.html new file mode 100644 index 0000000000..3063cf4dd9 --- /dev/null +++ b/compiler-docs/fe/task/build/struct.BuildArgs.html @@ -0,0 +1,106 @@ +BuildArgs in fe::task::build - Rust

Struct BuildArgs

Source
pub struct BuildArgs {
+    input_path: String,
+    output_dir: String,
+    emit: Vec<Emit>,
+    mir: bool,
+    overwrite: bool,
+    optimize: Option<bool>,
+}

Fields§

§input_path: String§output_dir: String§emit: Vec<Emit>§mir: bool§overwrite: bool§optimize: Option<bool>

Trait Implementations§

Source§

impl Args for BuildArgs

Source§

fn augment_args<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can instantiate Self. Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can update self. Read more
Source§

impl FromArgMatches for BuildArgs

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches, +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe/task/check/fn.check.html b/compiler-docs/fe/task/check/fn.check.html new file mode 100644 index 0000000000..2b42078f4a --- /dev/null +++ b/compiler-docs/fe/task/check/fn.check.html @@ -0,0 +1 @@ +check in fe::task::check - Rust

Function check

Source
pub fn check(args: CheckArgs)
\ No newline at end of file diff --git a/compiler-docs/fe/task/check/fn.check_ingot.html b/compiler-docs/fe/task/check/fn.check_ingot.html new file mode 100644 index 0000000000..b4a82e71a4 --- /dev/null +++ b/compiler-docs/fe/task/check/fn.check_ingot.html @@ -0,0 +1 @@ +check_ingot in fe::task::check - Rust

Function check_ingot

Source
fn check_ingot(db: &mut Db, input_path: &str) -> Vec<Diagnostic>
\ No newline at end of file diff --git a/compiler-docs/fe/task/check/fn.check_single_file.html b/compiler-docs/fe/task/check/fn.check_single_file.html new file mode 100644 index 0000000000..bf273fcae4 --- /dev/null +++ b/compiler-docs/fe/task/check/fn.check_single_file.html @@ -0,0 +1 @@ +check_single_file in fe::task::check - Rust

Function check_single_file

Source
fn check_single_file(db: &mut Db, input_path: &str) -> Vec<Diagnostic>
\ No newline at end of file diff --git a/compiler-docs/fe/task/check/index.html b/compiler-docs/fe/task/check/index.html new file mode 100644 index 0000000000..003cfb34e9 --- /dev/null +++ b/compiler-docs/fe/task/check/index.html @@ -0,0 +1 @@ +fe::task::check - Rust

Module check

Source

Structs§

CheckArgs

Functions§

check
check_ingot 🔒
check_single_file 🔒
\ No newline at end of file diff --git a/compiler-docs/fe/task/check/sidebar-items.js b/compiler-docs/fe/task/check/sidebar-items.js new file mode 100644 index 0000000000..f883328035 --- /dev/null +++ b/compiler-docs/fe/task/check/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["check","check_ingot","check_single_file"],"struct":["CheckArgs"]}; \ No newline at end of file diff --git a/compiler-docs/fe/task/check/struct.CheckArgs.html b/compiler-docs/fe/task/check/struct.CheckArgs.html new file mode 100644 index 0000000000..97749b9dc5 --- /dev/null +++ b/compiler-docs/fe/task/check/struct.CheckArgs.html @@ -0,0 +1,101 @@ +CheckArgs in fe::task::check - Rust

Struct CheckArgs

Source
pub struct CheckArgs {
+    input_path: String,
+}

Fields§

§input_path: String

Trait Implementations§

Source§

impl Args for CheckArgs

Source§

fn augment_args<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can instantiate Self. Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can update self. Read more
Source§

impl FromArgMatches for CheckArgs

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches, +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe/task/enum.Commands.html b/compiler-docs/fe/task/enum.Commands.html new file mode 100644 index 0000000000..5549dd7a78 --- /dev/null +++ b/compiler-docs/fe/task/enum.Commands.html @@ -0,0 +1,103 @@ +Commands in fe::task - Rust

Enum Commands

Source
pub enum Commands {
+    Build(BuildArgs),
+    Check(CheckArgs),
+    New(NewProjectArgs),
+}

Variants§

Trait Implementations§

Source§

impl FromArgMatches for Commands

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches, +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( + &mut self, + __clap_arg_matches: &mut ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Subcommand for Commands

Source§

fn augment_subcommands<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can instantiate Self. Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can update self. Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe/task/index.html b/compiler-docs/fe/task/index.html new file mode 100644 index 0000000000..6c8eb00da9 --- /dev/null +++ b/compiler-docs/fe/task/index.html @@ -0,0 +1 @@ +fe::task - Rust

Module task

Source

Re-exports§

pub use build::build;
pub use build::BuildArgs;
pub use check::check;
pub use check::CheckArgs;
pub use new::create_new_project;
pub use new::NewProjectArgs;

Modules§

build 🔒
check 🔒
new 🔒

Enums§

Commands
\ No newline at end of file diff --git a/compiler-docs/fe/task/new/constant.SRC_TEMPLATE_DIR.html b/compiler-docs/fe/task/new/constant.SRC_TEMPLATE_DIR.html new file mode 100644 index 0000000000..4e1d7a71a4 --- /dev/null +++ b/compiler-docs/fe/task/new/constant.SRC_TEMPLATE_DIR.html @@ -0,0 +1 @@ +SRC_TEMPLATE_DIR in fe::task::new - Rust

Constant SRC_TEMPLATE_DIR

Source
const SRC_TEMPLATE_DIR: Dir<'_>;
\ No newline at end of file diff --git a/compiler-docs/fe/task/new/fn.create_new_project.html b/compiler-docs/fe/task/new/fn.create_new_project.html new file mode 100644 index 0000000000..1f8b390245 --- /dev/null +++ b/compiler-docs/fe/task/new/fn.create_new_project.html @@ -0,0 +1 @@ +create_new_project in fe::task::new - Rust

Function create_new_project

Source
pub fn create_new_project(args: NewProjectArgs)
\ No newline at end of file diff --git a/compiler-docs/fe/task/new/fn.create_project.html b/compiler-docs/fe/task/new/fn.create_project.html new file mode 100644 index 0000000000..3899c24e82 --- /dev/null +++ b/compiler-docs/fe/task/new/fn.create_project.html @@ -0,0 +1 @@ +create_project in fe::task::new - Rust

Function create_project

Source
fn create_project(name: &str, path: &Path)
\ No newline at end of file diff --git a/compiler-docs/fe/task/new/index.html b/compiler-docs/fe/task/new/index.html new file mode 100644 index 0000000000..9142b7d15d --- /dev/null +++ b/compiler-docs/fe/task/new/index.html @@ -0,0 +1 @@ +fe::task::new - Rust

Module new

Source

Structs§

NewProjectArgs

Constants§

SRC_TEMPLATE_DIR 🔒

Functions§

create_new_project
create_project 🔒
\ No newline at end of file diff --git a/compiler-docs/fe/task/new/sidebar-items.js b/compiler-docs/fe/task/new/sidebar-items.js new file mode 100644 index 0000000000..23184c9740 --- /dev/null +++ b/compiler-docs/fe/task/new/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["SRC_TEMPLATE_DIR"],"fn":["create_new_project","create_project"],"struct":["NewProjectArgs"]}; \ No newline at end of file diff --git a/compiler-docs/fe/task/new/struct.NewProjectArgs.html b/compiler-docs/fe/task/new/struct.NewProjectArgs.html new file mode 100644 index 0000000000..8e5a929364 --- /dev/null +++ b/compiler-docs/fe/task/new/struct.NewProjectArgs.html @@ -0,0 +1,101 @@ +NewProjectArgs in fe::task::new - Rust

Struct NewProjectArgs

Source
pub struct NewProjectArgs {
+    name: String,
+}

Fields§

§name: String

Trait Implementations§

Source§

impl Args for NewProjectArgs

Source§

fn augment_args<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can instantiate Self. Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to [Command] so it can update self. Read more
Source§

impl FromArgMatches for NewProjectArgs

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches, +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches, +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe/task/sidebar-items.js b/compiler-docs/fe/task/sidebar-items.js new file mode 100644 index 0000000000..d29fbf5b5e --- /dev/null +++ b/compiler-docs/fe/task/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Commands"],"mod":["build","check","new"]}; \ No newline at end of file diff --git a/compiler-docs/fe_abi/all.html b/compiler-docs/fe_abi/all.html new file mode 100644 index 0000000000..9ec1c72c36 --- /dev/null +++ b/compiler-docs/fe_abi/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/compiler-docs/fe_abi/contract/index.html b/compiler-docs/fe_abi/contract/index.html new file mode 100644 index 0000000000..66eac489b8 --- /dev/null +++ b/compiler-docs/fe_abi/contract/index.html @@ -0,0 +1 @@ +fe_abi::contract - Rust

Module contract

Source

Structs§

AbiContract
\ No newline at end of file diff --git a/compiler-docs/fe_abi/contract/sidebar-items.js b/compiler-docs/fe_abi/contract/sidebar-items.js new file mode 100644 index 0000000000..745d35a877 --- /dev/null +++ b/compiler-docs/fe_abi/contract/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["AbiContract"]}; \ No newline at end of file diff --git a/compiler-docs/fe_abi/contract/struct.AbiContract.html b/compiler-docs/fe_abi/contract/struct.AbiContract.html new file mode 100644 index 0000000000..a0a5247575 --- /dev/null +++ b/compiler-docs/fe_abi/contract/struct.AbiContract.html @@ -0,0 +1,20 @@ +AbiContract in fe_abi::contract - Rust

Struct AbiContract

Source
pub struct AbiContract { /* private fields */ }

Implementations§

Source§

impl AbiContract

Source

pub fn new(funcs: Vec<AbiFunction>, events: Vec<AbiEvent>) -> Self

Trait Implementations§

Source§

impl Clone for AbiContract

Source§

fn clone(&self) -> AbiContract

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiContract

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AbiContract

Source§

fn eq(&self, other: &AbiContract) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for AbiContract

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AbiContract

Source§

impl StructuralPartialEq for AbiContract

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/event/index.html b/compiler-docs/fe_abi/event/index.html new file mode 100644 index 0000000000..60ebefd14e --- /dev/null +++ b/compiler-docs/fe_abi/event/index.html @@ -0,0 +1 @@ +fe_abi::event - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_abi/event/sidebar-items.js b/compiler-docs/fe_abi/event/sidebar-items.js new file mode 100644 index 0000000000..bc46aa71df --- /dev/null +++ b/compiler-docs/fe_abi/event/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["AbiEvent","AbiEventField","AbiEventSignature"]}; \ No newline at end of file diff --git a/compiler-docs/fe_abi/event/struct.AbiEvent.html b/compiler-docs/fe_abi/event/struct.AbiEvent.html new file mode 100644 index 0000000000..543908885b --- /dev/null +++ b/compiler-docs/fe_abi/event/struct.AbiEvent.html @@ -0,0 +1,26 @@ +AbiEvent in fe_abi::event - Rust

Struct AbiEvent

Source
pub struct AbiEvent {
+    pub ty: &'static str,
+    pub name: String,
+    pub inputs: Vec<AbiEventField>,
+    pub anonymous: bool,
+}

Fields§

§ty: &'static str§name: String§inputs: Vec<AbiEventField>§anonymous: bool

Implementations§

Source§

impl AbiEvent

Source

pub fn new(name: String, fields: Vec<AbiEventField>, anonymous: bool) -> Self

Source

pub fn signature(&self) -> AbiEventSignature

Trait Implementations§

Source§

impl Clone for AbiEvent

Source§

fn clone(&self) -> AbiEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AbiEvent

Source§

fn eq(&self, other: &AbiEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for AbiEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AbiEvent

Source§

impl StructuralPartialEq for AbiEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/event/struct.AbiEventField.html b/compiler-docs/fe_abi/event/struct.AbiEventField.html new file mode 100644 index 0000000000..ca33b265c0 --- /dev/null +++ b/compiler-docs/fe_abi/event/struct.AbiEventField.html @@ -0,0 +1,25 @@ +AbiEventField in fe_abi::event - Rust

Struct AbiEventField

Source
pub struct AbiEventField {
+    pub name: String,
+    pub ty: AbiType,
+    pub indexed: bool,
+}

Fields§

§name: String§ty: AbiType§indexed: bool

Implementations§

Source§

impl AbiEventField

Source

pub fn new(name: String, ty: impl Into<AbiType>, indexed: bool) -> Self

Trait Implementations§

Source§

impl Clone for AbiEventField

Source§

fn clone(&self) -> AbiEventField

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiEventField

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AbiEventField

Source§

fn eq(&self, other: &AbiEventField) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for AbiEventField

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AbiEventField

Source§

impl StructuralPartialEq for AbiEventField

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/event/struct.AbiEventSignature.html b/compiler-docs/fe_abi/event/struct.AbiEventSignature.html new file mode 100644 index 0000000000..2a88718a1b --- /dev/null +++ b/compiler-docs/fe_abi/event/struct.AbiEventSignature.html @@ -0,0 +1,11 @@ +AbiEventSignature in fe_abi::event - Rust

Struct AbiEventSignature

Source
pub struct AbiEventSignature { /* private fields */ }

Implementations§

Source§

impl AbiEventSignature

Source

pub fn signature(&self) -> &str

Source

pub fn hash_hex(&self) -> String

Source

pub fn hash_raw(&self) -> [u8; 32]

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/function/enum.AbiFunctionType.html b/compiler-docs/fe_abi/function/enum.AbiFunctionType.html new file mode 100644 index 0000000000..07e47d69f6 --- /dev/null +++ b/compiler-docs/fe_abi/function/enum.AbiFunctionType.html @@ -0,0 +1,27 @@ +AbiFunctionType in fe_abi::function - Rust

Enum AbiFunctionType

Source
pub enum AbiFunctionType {
+    Function,
+    Constructor,
+    Receive,
+    Payable,
+    Fallback,
+}

Variants§

§

Function

§

Constructor

§

Receive

§

Payable

§

Fallback

Trait Implementations§

Source§

impl Clone for AbiFunctionType

Source§

fn clone(&self) -> AbiFunctionType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiFunctionType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AbiFunctionType

Source§

fn eq(&self, other: &AbiFunctionType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for AbiFunctionType

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for AbiFunctionType

Source§

impl Eq for AbiFunctionType

Source§

impl StructuralPartialEq for AbiFunctionType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/function/enum.CtxParam.html b/compiler-docs/fe_abi/function/enum.CtxParam.html new file mode 100644 index 0000000000..6cec50bda7 --- /dev/null +++ b/compiler-docs/fe_abi/function/enum.CtxParam.html @@ -0,0 +1,15 @@ +CtxParam in fe_abi::function - Rust

Enum CtxParam

Source
pub enum CtxParam {
+    None,
+    Imm,
+    Mut,
+}

Variants§

§

None

§

Imm

§

Mut

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/function/enum.SelfParam.html b/compiler-docs/fe_abi/function/enum.SelfParam.html new file mode 100644 index 0000000000..c7015b4cbf --- /dev/null +++ b/compiler-docs/fe_abi/function/enum.SelfParam.html @@ -0,0 +1,15 @@ +SelfParam in fe_abi::function - Rust

Enum SelfParam

Source
pub enum SelfParam {
+    None,
+    Imm,
+    Mut,
+}

Variants§

§

None

§

Imm

§

Mut

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/function/enum.StateMutability.html b/compiler-docs/fe_abi/function/enum.StateMutability.html new file mode 100644 index 0000000000..230dad6cb9 --- /dev/null +++ b/compiler-docs/fe_abi/function/enum.StateMutability.html @@ -0,0 +1,27 @@ +StateMutability in fe_abi::function - Rust

Enum StateMutability

Source
pub enum StateMutability {
+    Pure,
+    View,
+    Nonpayable,
+    Payable,
+}
Expand description

The mutability of a public function.

+

Variants§

§

Pure

§

View

§

Nonpayable

§

Payable

Implementations§

Trait Implementations§

Source§

impl Clone for StateMutability

Source§

fn clone(&self) -> StateMutability

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StateMutability

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for StateMutability

Source§

fn eq(&self, other: &StateMutability) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for StateMutability

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for StateMutability

Source§

impl StructuralPartialEq for StateMutability

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/function/index.html b/compiler-docs/fe_abi/function/index.html new file mode 100644 index 0000000000..53d7db5e90 --- /dev/null +++ b/compiler-docs/fe_abi/function/index.html @@ -0,0 +1 @@ +fe_abi::function - Rust

Module function

Source

Structs§

AbiFunction
AbiFunctionSelector

Enums§

AbiFunctionType
CtxParam
SelfParam
StateMutability
The mutability of a public function.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/function/sidebar-items.js b/compiler-docs/fe_abi/function/sidebar-items.js new file mode 100644 index 0000000000..7dfdacc3d1 --- /dev/null +++ b/compiler-docs/fe_abi/function/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["AbiFunctionType","CtxParam","SelfParam","StateMutability"],"struct":["AbiFunction","AbiFunctionSelector"]}; \ No newline at end of file diff --git a/compiler-docs/fe_abi/function/struct.AbiFunction.html b/compiler-docs/fe_abi/function/struct.AbiFunction.html new file mode 100644 index 0000000000..afe2f86207 --- /dev/null +++ b/compiler-docs/fe_abi/function/struct.AbiFunction.html @@ -0,0 +1,27 @@ +AbiFunction in fe_abi::function - Rust

Struct AbiFunction

Source
pub struct AbiFunction { /* private fields */ }

Implementations§

Source§

impl AbiFunction

Source

pub fn new( + func_type: AbiFunctionType, + name: String, + args: Vec<(String, AbiType)>, + ret_ty: Option<AbiType>, + state_mutability: StateMutability, +) -> Self

Source

pub fn selector(&self) -> AbiFunctionSelector

Trait Implementations§

Source§

impl Clone for AbiFunction

Source§

fn clone(&self) -> AbiFunction

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AbiFunction

Source§

fn eq(&self, other: &AbiFunction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for AbiFunction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AbiFunction

Source§

impl StructuralPartialEq for AbiFunction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/function/struct.AbiFunctionSelector.html b/compiler-docs/fe_abi/function/struct.AbiFunctionSelector.html new file mode 100644 index 0000000000..3e15665f2f --- /dev/null +++ b/compiler-docs/fe_abi/function/struct.AbiFunctionSelector.html @@ -0,0 +1,12 @@ +AbiFunctionSelector in fe_abi::function - Rust

Struct AbiFunctionSelector

Source
pub struct AbiFunctionSelector { /* private fields */ }

Implementations§

Source§

impl AbiFunctionSelector

Source

pub fn selector_signature(&self) -> &str

Source

pub fn selector_raw(&self) -> [u8; 4]

Source

pub fn hex(&self) -> String

Returns first 4 bytes of signature hash in hex.

+

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/index.html b/compiler-docs/fe_abi/index.html new file mode 100644 index 0000000000..2f8dc4b42e --- /dev/null +++ b/compiler-docs/fe_abi/index.html @@ -0,0 +1 @@ +fe_abi - Rust

Crate fe_abi

Source

Modules§

contract
event
function
types
\ No newline at end of file diff --git a/compiler-docs/fe_abi/sidebar-items.js b/compiler-docs/fe_abi/sidebar-items.js new file mode 100644 index 0000000000..16c17313a0 --- /dev/null +++ b/compiler-docs/fe_abi/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["contract","event","function","types"]}; \ No newline at end of file diff --git a/compiler-docs/fe_abi/types/enum.AbiType.html b/compiler-docs/fe_abi/types/enum.AbiType.html new file mode 100644 index 0000000000..e89e292d38 --- /dev/null +++ b/compiler-docs/fe_abi/types/enum.AbiType.html @@ -0,0 +1,34 @@ +AbiType in fe_abi::types - Rust

Enum AbiType

Source
pub enum AbiType {
+    UInt(usize),
+    Int(usize),
+    Address,
+    Bool,
+    Function,
+    Array {
+        elem_ty: Box<AbiType>,
+        len: usize,
+    },
+    Tuple(Vec<AbiTupleField>),
+    Bytes,
+    String,
+}

Variants§

§

UInt(usize)

§

Int(usize)

§

Address

§

Bool

§

Function

§

Array

Fields

§elem_ty: Box<AbiType>
§len: usize
§

Tuple(Vec<AbiTupleField>)

§

Bytes

§

String

Implementations§

Source§

impl AbiType

Source

pub fn selector_type_name(&self) -> String

Source

pub fn abi_type_name(&self) -> String

Source

pub fn header_size(&self) -> usize

Source

pub fn is_primitive(&self) -> bool

Source

pub fn is_bytes(&self) -> bool

Source

pub fn is_string(&self) -> bool

Source

pub fn is_static(&self) -> bool

Source

pub fn size(&self) -> Option<usize>

Returns bytes size of the encoded type if the type is static.

+

Trait Implementations§

Source§

impl Clone for AbiType

Source§

fn clone(&self) -> AbiType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AbiType

Source§

fn eq(&self, other: &AbiType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for AbiType

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AbiType

Source§

impl StructuralPartialEq for AbiType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_abi/types/index.html b/compiler-docs/fe_abi/types/index.html new file mode 100644 index 0000000000..cd69943a39 --- /dev/null +++ b/compiler-docs/fe_abi/types/index.html @@ -0,0 +1 @@ +fe_abi::types - Rust

Module types

Source

Structs§

AbiTupleField

Enums§

AbiType
\ No newline at end of file diff --git a/compiler-docs/fe_abi/types/sidebar-items.js b/compiler-docs/fe_abi/types/sidebar-items.js new file mode 100644 index 0000000000..eb93bd85b4 --- /dev/null +++ b/compiler-docs/fe_abi/types/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["AbiType"],"struct":["AbiTupleField"]}; \ No newline at end of file diff --git a/compiler-docs/fe_abi/types/struct.AbiTupleField.html b/compiler-docs/fe_abi/types/struct.AbiTupleField.html new file mode 100644 index 0000000000..8050698fb6 --- /dev/null +++ b/compiler-docs/fe_abi/types/struct.AbiTupleField.html @@ -0,0 +1,24 @@ +AbiTupleField in fe_abi::types - Rust

Struct AbiTupleField

Source
pub struct AbiTupleField {
+    pub name: String,
+    pub ty: AbiType,
+}

Fields§

§name: String§ty: AbiType

Implementations§

Source§

impl AbiTupleField

Source

pub fn new(name: String, ty: impl Into<AbiType>) -> Self

Trait Implementations§

Source§

impl Clone for AbiTupleField

Source§

fn clone(&self) -> AbiTupleField

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiTupleField

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AbiTupleField

Source§

fn eq(&self, other: &AbiTupleField) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for AbiTupleField

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AbiTupleField

Source§

impl StructuralPartialEq for AbiTupleField

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/all.html b/compiler-docs/fe_analyzer/all.html new file mode 100644 index 0000000000..5055222619 --- /dev/null +++ b/compiler-docs/fe_analyzer/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Structs

Enums

Traits

Functions

Type Aliases

Constants

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/builtins/enum.ContractTypeMethod.html b/compiler-docs/fe_analyzer/builtins/enum.ContractTypeMethod.html new file mode 100644 index 0000000000..6ce0429d93 --- /dev/null +++ b/compiler-docs/fe_analyzer/builtins/enum.ContractTypeMethod.html @@ -0,0 +1,25 @@ +ContractTypeMethod in fe_analyzer::builtins - Rust

Enum ContractTypeMethod

Source
pub enum ContractTypeMethod {
+    Create,
+    Create2,
+}

Variants§

§

Create

§

Create2

Implementations§

Trait Implementations§

Source§

impl AsRef<str> for ContractTypeMethod

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for ContractTypeMethod

Source§

fn clone(&self) -> ContractTypeMethod

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContractTypeMethod

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for ContractTypeMethod

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<ContractTypeMethod, <Self as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for ContractTypeMethod

Source§

fn eq(&self, other: &ContractTypeMethod) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl TryFrom<&str> for ContractTypeMethod

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from( + s: &str, +) -> Result<ContractTypeMethod, <Self as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl Copy for ContractTypeMethod

Source§

impl Eq for ContractTypeMethod

Source§

impl StructuralPartialEq for ContractTypeMethod

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/builtins/enum.GlobalFunction.html b/compiler-docs/fe_analyzer/builtins/enum.GlobalFunction.html new file mode 100644 index 0000000000..64f1bbfeaf --- /dev/null +++ b/compiler-docs/fe_analyzer/builtins/enum.GlobalFunction.html @@ -0,0 +1,33 @@ +GlobalFunction in fe_analyzer::builtins - Rust

Enum GlobalFunction

Source
pub enum GlobalFunction {
+    Keccak256,
+}

Variants§

§

Keccak256

Trait Implementations§

Source§

impl AsRef<str> for GlobalFunction

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for GlobalFunction

Source§

fn clone(&self) -> GlobalFunction

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GlobalFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for GlobalFunction

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<GlobalFunction, <Self as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for GlobalFunction

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoEnumIterator for GlobalFunction

Source§

impl Ord for GlobalFunction

Source§

fn cmp(&self, other: &GlobalFunction) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for GlobalFunction

Source§

fn eq(&self, other: &GlobalFunction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for GlobalFunction

Source§

fn partial_cmp(&self, other: &GlobalFunction) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl TryFrom<&str> for GlobalFunction

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<GlobalFunction, <Self as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl Copy for GlobalFunction

Source§

impl Eq for GlobalFunction

Source§

impl StructuralPartialEq for GlobalFunction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/builtins/enum.Intrinsic.html b/compiler-docs/fe_analyzer/builtins/enum.Intrinsic.html new file mode 100644 index 0000000000..b097b48ecd --- /dev/null +++ b/compiler-docs/fe_analyzer/builtins/enum.Intrinsic.html @@ -0,0 +1,109 @@ +Intrinsic in fe_analyzer::builtins - Rust

Enum Intrinsic

Source
pub enum Intrinsic {
+
Show 76 variants __stop, + __add, + __sub, + __mul, + __div, + __sdiv, + __mod, + __smod, + __exp, + __not, + __lt, + __gt, + __slt, + __sgt, + __eq, + __iszero, + __and, + __or, + __xor, + __byte, + __shl, + __shr, + __sar, + __addmod, + __mulmod, + __signextend, + __keccak256, + __pc, + __pop, + __mload, + __mstore, + __mstore8, + __sload, + __sstore, + __msize, + __gas, + __address, + __balance, + __selfbalance, + __caller, + __callvalue, + __calldataload, + __calldatasize, + __calldatacopy, + __codesize, + __codecopy, + __extcodesize, + __extcodecopy, + __returndatasize, + __returndatacopy, + __extcodehash, + __create, + __create2, + __call, + __callcode, + __delegatecall, + __staticcall, + __return, + __revert, + __selfdestruct, + __invalid, + __log0, + __log1, + __log2, + __log3, + __log4, + __chainid, + __basefee, + __origin, + __gasprice, + __blockhash, + __coinbase, + __timestamp, + __number, + __prevrandao, + __gaslimit, +
}
Expand description

The evm functions exposed by yul.

+

Variants§

§

__stop

§

__add

§

__sub

§

__mul

§

__div

§

__sdiv

§

__mod

§

__smod

§

__exp

§

__not

§

__lt

§

__gt

§

__slt

§

__sgt

§

__eq

§

__iszero

§

__and

§

__or

§

__xor

§

__byte

§

__shl

§

__shr

§

__sar

§

__addmod

§

__mulmod

§

__signextend

§

__keccak256

§

__pc

§

__pop

§

__mload

§

__mstore

§

__mstore8

§

__sload

§

__sstore

§

__msize

§

__gas

§

__address

§

__balance

§

__selfbalance

§

__caller

§

__callvalue

§

__calldataload

§

__calldatasize

§

__calldatacopy

§

__codesize

§

__codecopy

§

__extcodesize

§

__extcodecopy

§

__returndatasize

§

__returndatacopy

§

__extcodehash

§

__create

§

__create2

§

__call

§

__callcode

§

__delegatecall

§

__staticcall

§

__return

§

__revert

§

__selfdestruct

§

__invalid

§

__log0

§

__log1

§

__log2

§

__log3

§

__log4

§

__chainid

§

__basefee

§

__origin

§

__gasprice

§

__blockhash

§

__coinbase

§

__timestamp

§

__number

§

__prevrandao

§

__gaslimit

Implementations§

Source§

impl Intrinsic

Source

pub fn arg_count(&self) -> usize

Source

pub fn return_type(&self) -> Base

Trait Implementations§

Source§

impl AsRef<str> for Intrinsic

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Intrinsic

Source§

fn clone(&self) -> Intrinsic

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Intrinsic

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for Intrinsic

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Intrinsic, <Self as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Intrinsic

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoEnumIterator for Intrinsic

Source§

impl Ord for Intrinsic

Source§

fn cmp(&self, other: &Intrinsic) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Intrinsic

Source§

fn eq(&self, other: &Intrinsic) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for Intrinsic

Source§

fn partial_cmp(&self, other: &Intrinsic) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl TryFrom<&str> for Intrinsic

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<Intrinsic, <Self as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl Copy for Intrinsic

Source§

impl Eq for Intrinsic

Source§

impl StructuralPartialEq for Intrinsic

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/builtins/enum.ValueMethod.html b/compiler-docs/fe_analyzer/builtins/enum.ValueMethod.html new file mode 100644 index 0000000000..20a0de590d --- /dev/null +++ b/compiler-docs/fe_analyzer/builtins/enum.ValueMethod.html @@ -0,0 +1,25 @@ +ValueMethod in fe_analyzer::builtins - Rust

Enum ValueMethod

Source
pub enum ValueMethod {
+    ToMem,
+    AbiEncode,
+}

Variants§

§

ToMem

§

AbiEncode

Trait Implementations§

Source§

impl AsRef<str> for ValueMethod

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for ValueMethod

Source§

fn clone(&self) -> ValueMethod

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ValueMethod

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for ValueMethod

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<ValueMethod, <Self as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for ValueMethod

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ValueMethod

Source§

fn eq(&self, other: &ValueMethod) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl TryFrom<&str> for ValueMethod

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<ValueMethod, <Self as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl Copy for ValueMethod

Source§

impl Eq for ValueMethod

Source§

impl StructuralPartialEq for ValueMethod

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/builtins/index.html b/compiler-docs/fe_analyzer/builtins/index.html new file mode 100644 index 0000000000..d24a8254de --- /dev/null +++ b/compiler-docs/fe_analyzer/builtins/index.html @@ -0,0 +1 @@ +fe_analyzer::builtins - Rust

Module builtins

Source

Structs§

GlobalFunctionIter
IntrinsicIter

Enums§

ContractTypeMethod
GlobalFunction
Intrinsic
The evm functions exposed by yul.
ValueMethod
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/builtins/sidebar-items.js b/compiler-docs/fe_analyzer/builtins/sidebar-items.js new file mode 100644 index 0000000000..261c3e4c84 --- /dev/null +++ b/compiler-docs/fe_analyzer/builtins/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["ContractTypeMethod","GlobalFunction","Intrinsic","ValueMethod"],"struct":["GlobalFunctionIter","IntrinsicIter"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/builtins/struct.GlobalFunctionIter.html b/compiler-docs/fe_analyzer/builtins/struct.GlobalFunctionIter.html new file mode 100644 index 0000000000..4cbc8c8d2e --- /dev/null +++ b/compiler-docs/fe_analyzer/builtins/struct.GlobalFunctionIter.html @@ -0,0 +1,221 @@ +GlobalFunctionIter in fe_analyzer::builtins - Rust

Struct GlobalFunctionIter

Source
pub struct GlobalFunctionIter { /* private fields */ }

Trait Implementations§

Source§

impl Clone for GlobalFunctionIter

Source§

fn clone(&self) -> GlobalFunctionIter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DoubleEndedIterator for GlobalFunctionIter

Source§

fn next_back(&mut self) -> Option<<Self as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
Source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.37.0 · Source§

fn nth_back(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element from the end of the iterator. Read more
1.27.0 · Source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes +elements starting from the back of the iterator. Read more
1.27.0 · Source§

fn rfold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single, +final value, starting from the back. Read more
1.27.0 · Source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
Source§

impl ExactSizeIterator for GlobalFunctionIter

Source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
Source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
Source§

impl Iterator for GlobalFunctionIter

Source§

type Item = GlobalFunction

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<<Self as Iterator>::Item>

Advances the iterator and returns the next value. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
Source§

fn nth(&mut self, n: usize) -> Option<<Self as Iterator>::Item>

Returns the nth element of the iterator. Read more
Source§

fn next_chunk<const N: usize>( + &mut self, +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where + T: 'a, + Self: Sized + DoubleEndedIterator<Item = &'a mut T>, + P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
Source§

fn try_reduce<R>( + &mut self, + f: impl FnMut(Self::Item, Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
Source§

fn try_find<R>( + &mut self, + f: impl FnMut(&Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where + P: FnMut(Self::Item) -> bool, + Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its +index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · Source§

fn rev(self) -> Rev<Self>
where + Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: Copy + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: Clone + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · Source§

fn cycle(self) -> Cycle<Self>
where + Self: Sized + Clone,

Repeats an iterator endlessly. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<I> IntoIterator for I
where + I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/builtins/struct.IntrinsicIter.html b/compiler-docs/fe_analyzer/builtins/struct.IntrinsicIter.html new file mode 100644 index 0000000000..f4e7ab9d86 --- /dev/null +++ b/compiler-docs/fe_analyzer/builtins/struct.IntrinsicIter.html @@ -0,0 +1,221 @@ +IntrinsicIter in fe_analyzer::builtins - Rust

Struct IntrinsicIter

Source
pub struct IntrinsicIter { /* private fields */ }

Trait Implementations§

Source§

impl Clone for IntrinsicIter

Source§

fn clone(&self) -> IntrinsicIter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DoubleEndedIterator for IntrinsicIter

Source§

fn next_back(&mut self) -> Option<<Self as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
Source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.37.0 · Source§

fn nth_back(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element from the end of the iterator. Read more
1.27.0 · Source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes +elements starting from the back of the iterator. Read more
1.27.0 · Source§

fn rfold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single, +final value, starting from the back. Read more
1.27.0 · Source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
Source§

impl ExactSizeIterator for IntrinsicIter

Source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
Source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
Source§

impl Iterator for IntrinsicIter

Source§

type Item = Intrinsic

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<<Self as Iterator>::Item>

Advances the iterator and returns the next value. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
Source§

fn nth(&mut self, n: usize) -> Option<<Self as Iterator>::Item>

Returns the nth element of the iterator. Read more
Source§

fn next_chunk<const N: usize>( + &mut self, +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where + T: 'a, + Self: Sized + DoubleEndedIterator<Item = &'a mut T>, + P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
Source§

fn try_reduce<R>( + &mut self, + f: impl FnMut(Self::Item, Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
Source§

fn try_find<R>( + &mut self, + f: impl FnMut(&Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where + P: FnMut(Self::Item) -> bool, + Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its +index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · Source§

fn rev(self) -> Rev<Self>
where + Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: Copy + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: Clone + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · Source§

fn cycle(self) -> Cycle<Self>
where + Self: Sized + Clone,

Repeats an iterator endlessly. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<I> IntoIterator for I
where + I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/constants/constant.EMITTABLE_TRAIT_NAME.html b/compiler-docs/fe_analyzer/constants/constant.EMITTABLE_TRAIT_NAME.html new file mode 100644 index 0000000000..49409555cf --- /dev/null +++ b/compiler-docs/fe_analyzer/constants/constant.EMITTABLE_TRAIT_NAME.html @@ -0,0 +1 @@ +EMITTABLE_TRAIT_NAME in fe_analyzer::constants - Rust

Constant EMITTABLE_TRAIT_NAME

Source
pub const EMITTABLE_TRAIT_NAME: &str = "Emittable";
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/constants/constant.EMIT_FN_NAME.html b/compiler-docs/fe_analyzer/constants/constant.EMIT_FN_NAME.html new file mode 100644 index 0000000000..c7deb53ab1 --- /dev/null +++ b/compiler-docs/fe_analyzer/constants/constant.EMIT_FN_NAME.html @@ -0,0 +1 @@ +EMIT_FN_NAME in fe_analyzer::constants - Rust

Constant EMIT_FN_NAME

Source
pub const EMIT_FN_NAME: &str = "emit";
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/constants/constant.INDEXED.html b/compiler-docs/fe_analyzer/constants/constant.INDEXED.html new file mode 100644 index 0000000000..e35f5e2582 --- /dev/null +++ b/compiler-docs/fe_analyzer/constants/constant.INDEXED.html @@ -0,0 +1 @@ +INDEXED in fe_analyzer::constants - Rust

Constant INDEXED

Source
pub const INDEXED: &str = "indexed";
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/constants/constant.MAX_INDEXED_EVENT_FIELDS.html b/compiler-docs/fe_analyzer/constants/constant.MAX_INDEXED_EVENT_FIELDS.html new file mode 100644 index 0000000000..969bd77f45 --- /dev/null +++ b/compiler-docs/fe_analyzer/constants/constant.MAX_INDEXED_EVENT_FIELDS.html @@ -0,0 +1 @@ +MAX_INDEXED_EVENT_FIELDS in fe_analyzer::constants - Rust

Constant MAX_INDEXED_EVENT_FIELDS

Source
pub const MAX_INDEXED_EVENT_FIELDS: usize = 3;
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/constants/index.html b/compiler-docs/fe_analyzer/constants/index.html new file mode 100644 index 0000000000..770c9f3c6a --- /dev/null +++ b/compiler-docs/fe_analyzer/constants/index.html @@ -0,0 +1 @@ +fe_analyzer::constants - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/constants/sidebar-items.js b/compiler-docs/fe_analyzer/constants/sidebar-items.js new file mode 100644 index 0000000000..6d34019cd5 --- /dev/null +++ b/compiler-docs/fe_analyzer/constants/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["EMITTABLE_TRAIT_NAME","EMIT_FN_NAME","INDEXED","MAX_INDEXED_EVENT_FIELDS"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/enum.AdjustmentKind.html b/compiler-docs/fe_analyzer/context/enum.AdjustmentKind.html new file mode 100644 index 0000000000..577f7235ad --- /dev/null +++ b/compiler-docs/fe_analyzer/context/enum.AdjustmentKind.html @@ -0,0 +1,26 @@ +AdjustmentKind in fe_analyzer::context - Rust

Enum AdjustmentKind

Source
pub enum AdjustmentKind {
+    Copy,
+    Load,
+    IntSizeIncrease,
+    StringSizeIncrease,
+}

Variants§

§

Copy

§

Load

Load from storage ptr

+
§

IntSizeIncrease

§

StringSizeIncrease

Trait Implementations§

Source§

impl Clone for AdjustmentKind

Source§

fn clone(&self) -> AdjustmentKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AdjustmentKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AdjustmentKind

Source§

fn eq(&self, other: &AdjustmentKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for AdjustmentKind

Source§

impl Eq for AdjustmentKind

Source§

impl StructuralPartialEq for AdjustmentKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/enum.CallType.html b/compiler-docs/fe_analyzer/context/enum.CallType.html new file mode 100644 index 0000000000..f89400e6de --- /dev/null +++ b/compiler-docs/fe_analyzer/context/enum.CallType.html @@ -0,0 +1,53 @@ +CallType in fe_analyzer::context - Rust

Enum CallType

Source
pub enum CallType {
+    BuiltinFunction(GlobalFunction),
+    Intrinsic(Intrinsic),
+    BuiltinValueMethod {
+        method: ValueMethod,
+        typ: TypeId,
+    },
+    BuiltinAssociatedFunction {
+        contract: ContractId,
+        function: ContractTypeMethod,
+    },
+    AssociatedFunction {
+        typ: TypeId,
+        function: FunctionId,
+    },
+    ValueMethod {
+        typ: TypeId,
+        method: FunctionId,
+    },
+    TraitValueMethod {
+        trait_id: TraitId,
+        method: FunctionSigId,
+        generic_type: Generic,
+    },
+    External {
+        contract: ContractId,
+        function: FunctionId,
+    },
+    Pure(FunctionId),
+    TypeConstructor(TypeId),
+    EnumConstructor(EnumVariantId),
+}
Expand description

The type of a function call.

+

Variants§

§

BuiltinFunction(GlobalFunction)

§

Intrinsic(Intrinsic)

§

BuiltinValueMethod

Fields

§

BuiltinAssociatedFunction

Fields

§contract: ContractId
§

AssociatedFunction

Fields

§function: FunctionId
§

ValueMethod

Fields

§method: FunctionId
§

TraitValueMethod

Fields

§trait_id: TraitId
§generic_type: Generic
§

External

Fields

§contract: ContractId
§function: FunctionId
§

Pure(FunctionId)

§

TypeConstructor(TypeId)

§

EnumConstructor(EnumVariantId)

Implementations§

Source§

impl CallType

Source

pub fn function(&self) -> Option<FunctionId>

Source

pub fn function_name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn is_unsafe(&self, db: &dyn AnalyzerDb) -> bool

Trait Implementations§

Source§

impl Clone for CallType

Source§

fn clone(&self) -> CallType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CallType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CallType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CallType

Source§

fn eq(&self, other: &CallType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for CallType

Source§

impl StructuralPartialEq for CallType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/enum.Constant.html b/compiler-docs/fe_analyzer/context/enum.Constant.html new file mode 100644 index 0000000000..846df665b0 --- /dev/null +++ b/compiler-docs/fe_analyzer/context/enum.Constant.html @@ -0,0 +1,34 @@ +Constant in fe_analyzer::context - Rust

Enum Constant

Source
pub enum Constant {
+    Int(BigInt),
+    Address(BigInt),
+    Bool(bool),
+    Str(SmolStr),
+}
Expand description

Represents constant value.

+

Variants§

§

Int(BigInt)

§

Address(BigInt)

§

Bool(bool)

§

Str(SmolStr)

Implementations§

Source§

impl Constant

Source

pub fn from_num_str( + context: &mut dyn AnalyzerContext, + s: &str, + typ: &Type, + span: Span, +) -> Result<Self, ConstEvalError>

Returns constant from numeric literal represented by string.

+
§Panics
+

Panics if s is invalid string for numeric literal.

+

Trait Implementations§

Source§

impl Clone for Constant

Source§

fn clone(&self) -> Constant

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Constant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Constant

Source§

fn eq(&self, other: &Constant) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Constant

Source§

impl StructuralPartialEq for Constant

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/enum.NamedThing.html b/compiler-docs/fe_analyzer/context/enum.NamedThing.html new file mode 100644 index 0000000000..a4e5f66890 --- /dev/null +++ b/compiler-docs/fe_analyzer/context/enum.NamedThing.html @@ -0,0 +1,41 @@ +NamedThing in fe_analyzer::context - Rust

Enum NamedThing

Source
pub enum NamedThing {
+    Item(Item),
+    EnumVariant(EnumVariantId),
+    SelfValue {
+        decl: Option<SelfDecl>,
+        parent: Option<Item>,
+        span: Option<Span>,
+    },
+    Variable {
+        name: SmolStr,
+        typ: Result<TypeId, TypeError>,
+        is_const: bool,
+        span: Span,
+    },
+}

Variants§

§

Item(Item)

§

EnumVariant(EnumVariantId)

§

SelfValue

Fields

§decl: Option<SelfDecl>

Function self parameter.

+
§parent: Option<Item>

The function’s parent, if any. If None, self has been +used in a module-level function.

+
§span: Option<Span>
§

Variable

Fields

§name: SmolStr
§is_const: bool
§span: Span

Implementations§

Source§

impl NamedThing

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Option<Span>

Source

pub fn is_builtin(&self) -> bool

Source

pub fn item_kind_display_name(&self) -> &str

Source

pub fn resolve_path_segment( + &self, + db: &dyn AnalyzerDb, + segment: &SmolStr, +) -> Option<NamedThing>

Trait Implementations§

Source§

impl Clone for NamedThing

Source§

fn clone(&self) -> NamedThing

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NamedThing

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for NamedThing

Source§

fn eq(&self, other: &NamedThing) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for NamedThing

Source§

impl StructuralPartialEq for NamedThing

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/index.html b/compiler-docs/fe_analyzer/context/index.html new file mode 100644 index 0000000000..685f43f9ea --- /dev/null +++ b/compiler-docs/fe_analyzer/context/index.html @@ -0,0 +1 @@ +fe_analyzer::context - Rust

Module context

Source

Structs§

Adjustment
Analysis
DiagnosticVoucher
This should only be created by AnalyzerContext.
ExpressionAttributes
Contains contextual information relating to an expression AST node.
FunctionBody
Label
TempContext

Enums§

AdjustmentKind
CallType
The type of a function call.
Constant
Represents constant value.
NamedThing

Traits§

AnalyzerContext
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/sidebar-items.js b/compiler-docs/fe_analyzer/context/sidebar-items.js new file mode 100644 index 0000000000..efc87ffddd --- /dev/null +++ b/compiler-docs/fe_analyzer/context/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["AdjustmentKind","CallType","Constant","NamedThing"],"struct":["Adjustment","Analysis","DiagnosticVoucher","ExpressionAttributes","FunctionBody","Label","TempContext"],"trait":["AnalyzerContext"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/struct.Adjustment.html b/compiler-docs/fe_analyzer/context/struct.Adjustment.html new file mode 100644 index 0000000000..53e66b80be --- /dev/null +++ b/compiler-docs/fe_analyzer/context/struct.Adjustment.html @@ -0,0 +1,23 @@ +Adjustment in fe_analyzer::context - Rust

Struct Adjustment

Source
pub struct Adjustment {
+    pub into: TypeId,
+    pub kind: AdjustmentKind,
+}

Fields§

§into: TypeId§kind: AdjustmentKind

Trait Implementations§

Source§

impl Clone for Adjustment

Source§

fn clone(&self) -> Adjustment

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Adjustment

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Adjustment

Source§

fn eq(&self, other: &Adjustment) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for Adjustment

Source§

impl Eq for Adjustment

Source§

impl StructuralPartialEq for Adjustment

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/struct.Analysis.html b/compiler-docs/fe_analyzer/context/struct.Analysis.html new file mode 100644 index 0000000000..917432c986 --- /dev/null +++ b/compiler-docs/fe_analyzer/context/struct.Analysis.html @@ -0,0 +1,29 @@ +Analysis in fe_analyzer::context - Rust

Struct Analysis

Source
pub struct Analysis<T> {
+    pub value: T,
+    pub diagnostics: Rc<[Diagnostic]>,
+}

Fields§

§value: T§diagnostics: Rc<[Diagnostic]>

Implementations§

Source§

impl<T> Analysis<T>

Source

pub fn new(value: T, diagnostics: Rc<[Diagnostic]>) -> Self

Source

pub fn sink_diagnostics(&self, sink: &mut impl DiagnosticSink)

Source

pub fn has_diag(&self) -> bool

Trait Implementations§

Source§

impl<T: Clone> Clone for Analysis<T>

Source§

fn clone(&self) -> Analysis<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Analysis<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Hash> Hash for Analysis<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PartialEq> PartialEq for Analysis<T>

Source§

fn eq(&self, other: &Analysis<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl<T: Eq> Eq for Analysis<T>

Source§

impl<T> StructuralPartialEq for Analysis<T>

Auto Trait Implementations§

§

impl<T> Freeze for Analysis<T>
where + T: Freeze,

§

impl<T> RefUnwindSafe for Analysis<T>
where + T: RefUnwindSafe,

§

impl<T> !Send for Analysis<T>

§

impl<T> !Sync for Analysis<T>

§

impl<T> Unpin for Analysis<T>
where + T: Unpin,

§

impl<T> UnwindSafe for Analysis<T>
where + T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/struct.DiagnosticVoucher.html b/compiler-docs/fe_analyzer/context/struct.DiagnosticVoucher.html new file mode 100644 index 0000000000..afa3155d57 --- /dev/null +++ b/compiler-docs/fe_analyzer/context/struct.DiagnosticVoucher.html @@ -0,0 +1,23 @@ +DiagnosticVoucher in fe_analyzer::context - Rust

Struct DiagnosticVoucher

Source
pub struct DiagnosticVoucher(/* private fields */);
Expand description

This should only be created by AnalyzerContext.

+

Implementations§

Trait Implementations§

Source§

impl Clone for DiagnosticVoucher

Source§

fn clone(&self) -> DiagnosticVoucher

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DiagnosticVoucher

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for DiagnosticVoucher

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for DiagnosticVoucher

Source§

fn eq(&self, other: &DiagnosticVoucher) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for DiagnosticVoucher

Source§

impl StructuralPartialEq for DiagnosticVoucher

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/struct.ExpressionAttributes.html b/compiler-docs/fe_analyzer/context/struct.ExpressionAttributes.html new file mode 100644 index 0000000000..526890b1c3 --- /dev/null +++ b/compiler-docs/fe_analyzer/context/struct.ExpressionAttributes.html @@ -0,0 +1,33 @@ +ExpressionAttributes in fe_analyzer::context - Rust

Struct ExpressionAttributes

Source
pub struct ExpressionAttributes {
+    pub typ: TypeId,
+    pub const_value: Option<Constant>,
+    pub type_adjustments: Vec<Adjustment>,
+}
Expand description

Contains contextual information relating to an expression AST node.

+

Fields§

§typ: TypeId§const_value: Option<Constant>§type_adjustments: Vec<Adjustment>

Implementations§

Trait Implementations§

Source§

impl Clone for ExpressionAttributes

Source§

fn clone(&self) -> ExpressionAttributes

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExpressionAttributes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DisplayWithDb for ExpressionAttributes

Source§

fn format( + &self, + db: &dyn AnalyzerDb, + f: &mut Formatter<'_>, +) -> Result<(), Error>

Source§

impl PartialEq for ExpressionAttributes

Source§

fn eq(&self, other: &ExpressionAttributes) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for ExpressionAttributes

Source§

impl StructuralPartialEq for ExpressionAttributes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Displayable for T
where + T: DisplayWithDb,

Source§

fn display<'a, 'b>( + &'a self, + db: &'b dyn AnalyzerDb, +) -> DisplayableWrapper<'b, &'a Self>

Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/struct.FunctionBody.html b/compiler-docs/fe_analyzer/context/struct.FunctionBody.html new file mode 100644 index 0000000000..47047453f2 --- /dev/null +++ b/compiler-docs/fe_analyzer/context/struct.FunctionBody.html @@ -0,0 +1,26 @@ +FunctionBody in fe_analyzer::context - Rust

Struct FunctionBody

Source
pub struct FunctionBody {
+    pub expressions: IndexMap<NodeId, ExpressionAttributes>,
+    pub matches: IndexMap<NodeId, PatternMatrix>,
+    pub var_types: IndexMap<NodeId, TypeId>,
+    pub calls: IndexMap<NodeId, CallType>,
+    pub spans: HashMap<NodeId, Span>,
+}

Fields§

§expressions: IndexMap<NodeId, ExpressionAttributes>§matches: IndexMap<NodeId, PatternMatrix>§var_types: IndexMap<NodeId, TypeId>§calls: IndexMap<NodeId, CallType>§spans: HashMap<NodeId, Span>

Trait Implementations§

Source§

impl Clone for FunctionBody

Source§

fn clone(&self) -> FunctionBody

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionBody

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FunctionBody

Source§

fn default() -> FunctionBody

Returns the “default value” for a type. Read more
Source§

impl PartialEq for FunctionBody

Source§

fn eq(&self, other: &FunctionBody) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for FunctionBody

Source§

impl StructuralPartialEq for FunctionBody

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/struct.Label.html b/compiler-docs/fe_analyzer/context/struct.Label.html new file mode 100644 index 0000000000..0dc1c80e76 --- /dev/null +++ b/compiler-docs/fe_analyzer/context/struct.Label.html @@ -0,0 +1,34 @@ +Label in fe_analyzer::context - Rust

Struct Label

Source
pub struct Label {
+    pub style: LabelStyle,
+    pub span: Span,
+    pub message: String,
+}

Fields§

§style: LabelStyle§span: Span§message: String

Implementations§

Source§

impl Label

Source

pub fn primary<S>(span: Span, message: S) -> Label
where + S: Into<String>,

Create a primary label with the given message. This will underline the +given span with carets (^^^^).

+
Source

pub fn secondary<S>(span: Span, message: S) -> Label
where + S: Into<String>,

Create a secondary label with the given message. This will underline the +given span with hyphens (----).

+
Source

pub fn into_cs_label(self) -> Label<SourceFileId>

Convert into a [codespan_reporting::Diagnostic::Label]

+

Trait Implementations§

Source§

impl Clone for Label

Source§

fn clone(&self) -> Label

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Label

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Hash for Label

Source§

fn hash<__H>(&self, state: &mut __H)
where + __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Label

Source§

fn eq(&self, other: &Label) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Label

Source§

impl StructuralPartialEq for Label

Auto Trait Implementations§

§

impl Freeze for Label

§

impl RefUnwindSafe for Label

§

impl Send for Label

§

impl Sync for Label

§

impl Unpin for Label

§

impl UnwindSafe for Label

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/struct.TempContext.html b/compiler-docs/fe_analyzer/context/struct.TempContext.html new file mode 100644 index 0000000000..470d480444 --- /dev/null +++ b/compiler-docs/fe_analyzer/context/struct.TempContext.html @@ -0,0 +1,63 @@ +TempContext in fe_analyzer::context - Rust

Struct TempContext

Source
pub struct TempContext {
+    pub diagnostics: RefCell<Vec<Diagnostic>>,
+}

Fields§

§diagnostics: RefCell<Vec<Diagnostic>>

Trait Implementations§

Source§

impl AnalyzerContext for TempContext

Source§

fn db(&self) -> &dyn AnalyzerDb

Source§

fn resolve_name( + &self, + _name: &str, + _span: Span, +) -> Result<Option<NamedThing>, IncompleteItem>

Source§

fn resolve_path( + &self, + _path: &Path, + _span: Span, +) -> Result<NamedThing, FatalError>

Resolves the given path and registers all errors
Source§

fn resolve_visible_path(&self, _path: &Path) -> Option<NamedThing>

Resolves the given path only if it is visible. Does not register any errors
Source§

fn resolve_any_path(&self, _path: &Path) -> Option<NamedThing>

Resolves the given path. Does not register any errors
Source§

fn add_expression(&self, _node: &Node<Expr>, _attributes: ExpressionAttributes)

Attribute contextual information to an expression node. Read more
Source§

fn update_expression( + &self, + _node: &Node<Expr>, + _f: &dyn Fn(&mut ExpressionAttributes), +)

Update the expression attributes. Read more
Source§

fn expr_typ(&self, _expr: &Node<Expr>) -> Type

Returns a type of an expression. Read more
Source§

fn add_constant( + &self, + _name: &Node<SmolStr>, + _expr: &Node<Expr>, + _value: Constant, +)

Add evaluated constant value in a constant declaration to the context.
Source§

fn constant_value_by_name( + &self, + _name: &SmolStr, + _span: Span, +) -> Result<Option<Constant>, IncompleteItem>

Returns constant value from variable name.
Source§

fn parent(&self) -> Item

Returns an item enclosing current context. Read more
Source§

fn module(&self) -> ModuleId

Returns the module enclosing current context.
Source§

fn parent_function(&self) -> FunctionId

Returns a function id that encloses a context. Read more
Source§

fn add_call(&self, _node: &Node<Expr>, _call_type: CallType)

Panics Read more
Source§

fn get_call(&self, _node: &Node<Expr>) -> Option<CallType>

Source§

fn is_in_function(&self) -> bool

Returns true if the context is in function scope.
Source§

fn inherits_type(&self, _typ: BlockScopeType) -> bool

Returns true if the scope or any of its parents is of the given type.
Source§

fn add_diagnostic(&self, diag: Diagnostic)

Source§

fn get_context_type(&self) -> Option<TypeId>

Returns the Context type, if it is defined.
Source§

fn error( + &self, + message: &str, + label_span: Span, + label: &str, +) -> DiagnosticVoucher

Source§

fn root_item(&self) -> Item

Returns a non-function item that encloses a context. Read more
Source§

fn type_error( + &self, + message: &str, + span: Span, + expected: TypeId, + actual: TypeId, +) -> DiagnosticVoucher

Source§

fn not_yet_implemented(&self, feature: &str, span: Span) -> DiagnosticVoucher

Source§

fn fancy_error( + &self, + message: &str, + labels: Vec<Label>, + notes: Vec<String>, +) -> DiagnosticVoucher

Source§

fn duplicate_name_error( + &self, + message: &str, + name: &str, + original: Span, + duplicate: Span, +) -> DiagnosticVoucher

Source§

fn name_conflict_error( + &self, + name_kind: &str, + name: &str, + original: &NamedThing, + original_span: Option<Span>, + duplicate_span: Span, +) -> DiagnosticVoucher

Source§

fn register_diag(&self, diag: Diagnostic) -> DiagnosticVoucher

Source§

impl Default for TempContext

Source§

fn default() -> TempContext

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/context/trait.AnalyzerContext.html b/compiler-docs/fe_analyzer/context/trait.AnalyzerContext.html new file mode 100644 index 0000000000..4d8ed43d32 --- /dev/null +++ b/compiler-docs/fe_analyzer/context/trait.AnalyzerContext.html @@ -0,0 +1,178 @@ +AnalyzerContext in fe_analyzer::context - Rust

Trait AnalyzerContext

Source
pub trait AnalyzerContext {
+
Show 27 methods // Required methods + fn resolve_name( + &self, + name: &str, + span: Span, + ) -> Result<Option<NamedThing>, IncompleteItem>; + fn resolve_path( + &self, + path: &Path, + span: Span, + ) -> Result<NamedThing, FatalError>; + fn resolve_visible_path(&self, path: &Path) -> Option<NamedThing>; + fn resolve_any_path(&self, path: &Path) -> Option<NamedThing>; + fn add_diagnostic(&self, diag: Diagnostic); + fn db(&self) -> &dyn AnalyzerDb; + fn add_expression( + &self, + node: &Node<Expr>, + attributes: ExpressionAttributes, + ); + fn update_expression( + &self, + node: &Node<Expr>, + f: &dyn Fn(&mut ExpressionAttributes), + ); + fn expr_typ(&self, expr: &Node<Expr>) -> Type; + fn add_constant( + &self, + name: &Node<SmolStr>, + expr: &Node<Expr>, + value: Constant, + ); + fn constant_value_by_name( + &self, + name: &SmolStr, + span: Span, + ) -> Result<Option<Constant>, IncompleteItem>; + fn parent(&self) -> Item; + fn module(&self) -> ModuleId; + fn parent_function(&self) -> FunctionId; + fn add_call(&self, node: &Node<Expr>, call_type: CallType); + fn get_call(&self, node: &Node<Expr>) -> Option<CallType>; + fn is_in_function(&self) -> bool; + fn inherits_type(&self, typ: BlockScopeType) -> bool; + fn get_context_type(&self) -> Option<TypeId>; + + // Provided methods + fn error( + &self, + message: &str, + label_span: Span, + label: &str, + ) -> DiagnosticVoucher { ... } + fn root_item(&self) -> Item { ... } + fn type_error( + &self, + message: &str, + span: Span, + expected: TypeId, + actual: TypeId, + ) -> DiagnosticVoucher { ... } + fn not_yet_implemented( + &self, + feature: &str, + span: Span, + ) -> DiagnosticVoucher { ... } + fn fancy_error( + &self, + message: &str, + labels: Vec<Label>, + notes: Vec<String>, + ) -> DiagnosticVoucher { ... } + fn duplicate_name_error( + &self, + message: &str, + name: &str, + original: Span, + duplicate: Span, + ) -> DiagnosticVoucher { ... } + fn name_conflict_error( + &self, + name_kind: &str, + name: &str, + original: &NamedThing, + original_span: Option<Span>, + duplicate_span: Span, + ) -> DiagnosticVoucher { ... } + fn register_diag(&self, diag: Diagnostic) -> DiagnosticVoucher { ... } +
}

Required Methods§

Source

fn resolve_name( + &self, + name: &str, + span: Span, +) -> Result<Option<NamedThing>, IncompleteItem>

Source

fn resolve_path( + &self, + path: &Path, + span: Span, +) -> Result<NamedThing, FatalError>

Resolves the given path and registers all errors

+
Source

fn resolve_visible_path(&self, path: &Path) -> Option<NamedThing>

Resolves the given path only if it is visible. Does not register any errors

+
Source

fn resolve_any_path(&self, path: &Path) -> Option<NamedThing>

Resolves the given path. Does not register any errors

+
Source

fn add_diagnostic(&self, diag: Diagnostic)

Source

fn db(&self) -> &dyn AnalyzerDb

Source

fn add_expression(&self, node: &Node<Expr>, attributes: ExpressionAttributes)

Attribute contextual information to an expression node.

+
§Panics
+

Panics if an entry already exists for the node id.

+
Source

fn update_expression( + &self, + node: &Node<Expr>, + f: &dyn Fn(&mut ExpressionAttributes), +)

Update the expression attributes.

+
§Panics
+

Panics if an entry does not already exist for the node id.

+
Source

fn expr_typ(&self, expr: &Node<Expr>) -> Type

Returns a type of an expression.

+
§Panics
+

Panics if type analysis is not performed for an expr.

+
Source

fn add_constant(&self, name: &Node<SmolStr>, expr: &Node<Expr>, value: Constant)

Add evaluated constant value in a constant declaration to the context.

+
Source

fn constant_value_by_name( + &self, + name: &SmolStr, + span: Span, +) -> Result<Option<Constant>, IncompleteItem>

Returns constant value from variable name.

+
Source

fn parent(&self) -> Item

Returns an item enclosing current context.

+
§Example
contract Foo:
+    fn foo():
+       if ...:
+           ...
+       else:
+           ...
+

If the context is in then block, then this function returns +Item::Function(..).

+
Source

fn module(&self) -> ModuleId

Returns the module enclosing current context.

+
Source

fn parent_function(&self) -> FunctionId

Returns a function id that encloses a context.

+
§Panics
+

Panics if a context is not in a function. Use Self::is_in_function +to determine whether a context is in a function.

+
Source

fn add_call(&self, node: &Node<Expr>, call_type: CallType)

§Panics
+

Panics if a context is not in a function. Use Self::is_in_function +to determine whether a context is in a function.

+
Source

fn get_call(&self, node: &Node<Expr>) -> Option<CallType>

Source

fn is_in_function(&self) -> bool

Returns true if the context is in function scope.

+
Source

fn inherits_type(&self, typ: BlockScopeType) -> bool

Returns true if the scope or any of its parents is of the given type.

+
Source

fn get_context_type(&self) -> Option<TypeId>

Returns the Context type, if it is defined.

+

Provided Methods§

Source

fn error( + &self, + message: &str, + label_span: Span, + label: &str, +) -> DiagnosticVoucher

Source

fn root_item(&self) -> Item

Returns a non-function item that encloses a context.

+
§Example
contract Foo:
+    fn foo():
+       if ...:
+           ...
+       else:
+           ...
+

If the context is in then block, then this function returns +Item::Type(TypeDef::Contract(..)).

+
Source

fn type_error( + &self, + message: &str, + span: Span, + expected: TypeId, + actual: TypeId, +) -> DiagnosticVoucher

Source

fn not_yet_implemented(&self, feature: &str, span: Span) -> DiagnosticVoucher

Source

fn fancy_error( + &self, + message: &str, + labels: Vec<Label>, + notes: Vec<String>, +) -> DiagnosticVoucher

Source

fn duplicate_name_error( + &self, + message: &str, + name: &str, + original: Span, + duplicate: Span, +) -> DiagnosticVoucher

Source

fn name_conflict_error( + &self, + name_kind: &str, + name: &str, + original: &NamedThing, + original_span: Option<Span>, + duplicate_span: Span, +) -> DiagnosticVoucher

Source

fn register_diag(&self, diag: Diagnostic) -> DiagnosticVoucher

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/index.html b/compiler-docs/fe_analyzer/db/index.html new file mode 100644 index 0000000000..a370ea9a1e --- /dev/null +++ b/compiler-docs/fe_analyzer/db/index.html @@ -0,0 +1 @@ +fe_analyzer::db - Rust

Module db

Source

Structs§

AllImplsQuery
AnalyzerDbGroupStorage__
AnalyzerDbStorage
Representative struct for the query group.
ContractAllFieldsQuery
ContractAllFunctionsQuery
ContractCallFunctionQuery
ContractDependencyGraphQuery
ContractFieldMapQuery
ContractFieldTypeQuery
ContractFunctionMapQuery
ContractInitFunctionQuery
ContractPublicFunctionMapQuery
ContractRuntimeDependencyGraphQuery
EnumAllFunctionsQuery
EnumAllVariantsQuery
EnumDependencyGraphQuery
EnumFunctionMapQuery
EnumVariantKindQuery
EnumVariantMapQuery
FunctionBodyQuery
FunctionDependencyGraphQuery
FunctionSignatureQuery
FunctionSigsQuery
ImplAllFunctionsQuery
ImplForQuery
ImplFunctionMapQuery
IngotExternalIngotsQuery
IngotFilesQuery
IngotModulesQuery
IngotRootModuleQuery
InternAttributeLookupQuery
InternAttributeQuery
InternContractFieldLookupQuery
InternContractFieldQuery
InternContractLookupQuery
InternContractQuery
InternEnumLookupQuery
InternEnumQuery
InternEnumVariantLookupQuery
InternEnumVariantQuery
InternFunctionLookupQuery
InternFunctionQuery
InternFunctionSigLookupQuery
InternFunctionSigQuery
InternImplLookupQuery
InternImplQuery
InternIngotLookupQuery
InternIngotQuery
InternModuleConstLookupQuery
InternModuleConstQuery
InternModuleLookupQuery
InternModuleQuery
InternStructFieldLookupQuery
InternStructFieldQuery
InternStructLookupQuery
InternStructQuery
InternTraitLookupQuery
InternTraitQuery
InternTypeAliasLookupQuery
InternTypeAliasQuery
InternTypeLookupQuery
InternTypeQuery
ModuleAllImplsQuery
ModuleAllItemsQuery
ModuleConstantTypeQuery
ModuleConstantValueQuery
ModuleConstantsQuery
ModuleContractsQuery
ModuleFilePathQuery
ModuleImplMapQuery
ModuleIsIncompleteQuery
ModuleItemMapQuery
ModuleParentModuleQuery
ModuleParseQuery
ModuleStructsQuery
ModuleSubmodulesQuery
ModuleTestsQuery
ModuleUsedItemMapQuery
RootIngotQuery
StructAllFieldsQuery
StructAllFunctionsQuery
StructDependencyGraphQuery
StructFieldMapQuery
StructFieldTypeQuery
StructFunctionMapQuery
TestDb
TraitAllFunctionsQuery
TraitFunctionMapQuery
TraitIsImplementedForQuery
TypeAliasTypeQuery

Traits§

AnalyzerDb
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/sidebar-items.js b/compiler-docs/fe_analyzer/db/sidebar-items.js new file mode 100644 index 0000000000..c0c5935442 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["AllImplsQuery","AnalyzerDbGroupStorage__","AnalyzerDbStorage","ContractAllFieldsQuery","ContractAllFunctionsQuery","ContractCallFunctionQuery","ContractDependencyGraphQuery","ContractFieldMapQuery","ContractFieldTypeQuery","ContractFunctionMapQuery","ContractInitFunctionQuery","ContractPublicFunctionMapQuery","ContractRuntimeDependencyGraphQuery","EnumAllFunctionsQuery","EnumAllVariantsQuery","EnumDependencyGraphQuery","EnumFunctionMapQuery","EnumVariantKindQuery","EnumVariantMapQuery","FunctionBodyQuery","FunctionDependencyGraphQuery","FunctionSignatureQuery","FunctionSigsQuery","ImplAllFunctionsQuery","ImplForQuery","ImplFunctionMapQuery","IngotExternalIngotsQuery","IngotFilesQuery","IngotModulesQuery","IngotRootModuleQuery","InternAttributeLookupQuery","InternAttributeQuery","InternContractFieldLookupQuery","InternContractFieldQuery","InternContractLookupQuery","InternContractQuery","InternEnumLookupQuery","InternEnumQuery","InternEnumVariantLookupQuery","InternEnumVariantQuery","InternFunctionLookupQuery","InternFunctionQuery","InternFunctionSigLookupQuery","InternFunctionSigQuery","InternImplLookupQuery","InternImplQuery","InternIngotLookupQuery","InternIngotQuery","InternModuleConstLookupQuery","InternModuleConstQuery","InternModuleLookupQuery","InternModuleQuery","InternStructFieldLookupQuery","InternStructFieldQuery","InternStructLookupQuery","InternStructQuery","InternTraitLookupQuery","InternTraitQuery","InternTypeAliasLookupQuery","InternTypeAliasQuery","InternTypeLookupQuery","InternTypeQuery","ModuleAllImplsQuery","ModuleAllItemsQuery","ModuleConstantTypeQuery","ModuleConstantValueQuery","ModuleConstantsQuery","ModuleContractsQuery","ModuleFilePathQuery","ModuleImplMapQuery","ModuleIsIncompleteQuery","ModuleItemMapQuery","ModuleParentModuleQuery","ModuleParseQuery","ModuleStructsQuery","ModuleSubmodulesQuery","ModuleTestsQuery","ModuleUsedItemMapQuery","RootIngotQuery","StructAllFieldsQuery","StructAllFunctionsQuery","StructDependencyGraphQuery","StructFieldMapQuery","StructFieldTypeQuery","StructFunctionMapQuery","TestDb","TraitAllFunctionsQuery","TraitFunctionMapQuery","TraitIsImplementedForQuery","TypeAliasTypeQuery"],"trait":["AnalyzerDb"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.AllImplsQuery.html b/compiler-docs/fe_analyzer/db/struct.AllImplsQuery.html new file mode 100644 index 0000000000..c5240bc929 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.AllImplsQuery.html @@ -0,0 +1,46 @@ +AllImplsQuery in fe_analyzer::db - Rust

Struct AllImplsQuery

Source
pub struct AllImplsQuery;

Implementations§

Source§

impl AllImplsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl AllImplsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for AllImplsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AllImplsQuery

Source§

fn default() -> AllImplsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for AllImplsQuery

Source§

const QUERY_INDEX: u16 = 83u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "all_impls"

Name of the query method (e.g., foo)
Source§

type Key = TypeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[ImplId]>

What value does the query return?
Source§

type Storage = DerivedStorage<AllImplsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for AllImplsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for AllImplsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.AnalyzerDbGroupStorage__.html b/compiler-docs/fe_analyzer/db/struct.AnalyzerDbGroupStorage__.html new file mode 100644 index 0000000000..99521e72b5 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.AnalyzerDbGroupStorage__.html @@ -0,0 +1,113 @@ +AnalyzerDbGroupStorage__ in fe_analyzer::db - Rust

Struct AnalyzerDbGroupStorage__

Source
pub struct AnalyzerDbGroupStorage__ {
Show 87 fields + pub intern_ingot: Arc<<InternIngotQuery as Query>::Storage>, + pub lookup_intern_ingot: Arc<<InternIngotLookupQuery as Query>::Storage>, + pub intern_module: Arc<<InternModuleQuery as Query>::Storage>, + pub lookup_intern_module: Arc<<InternModuleLookupQuery as Query>::Storage>, + pub intern_module_const: Arc<<InternModuleConstQuery as Query>::Storage>, + pub lookup_intern_module_const: Arc<<InternModuleConstLookupQuery as Query>::Storage>, + pub intern_struct: Arc<<InternStructQuery as Query>::Storage>, + pub lookup_intern_struct: Arc<<InternStructLookupQuery as Query>::Storage>, + pub intern_struct_field: Arc<<InternStructFieldQuery as Query>::Storage>, + pub lookup_intern_struct_field: Arc<<InternStructFieldLookupQuery as Query>::Storage>, + pub intern_enum: Arc<<InternEnumQuery as Query>::Storage>, + pub lookup_intern_enum: Arc<<InternEnumLookupQuery as Query>::Storage>, + pub intern_attribute: Arc<<InternAttributeQuery as Query>::Storage>, + pub lookup_intern_attribute: Arc<<InternAttributeLookupQuery as Query>::Storage>, + pub intern_enum_variant: Arc<<InternEnumVariantQuery as Query>::Storage>, + pub lookup_intern_enum_variant: Arc<<InternEnumVariantLookupQuery as Query>::Storage>, + pub intern_trait: Arc<<InternTraitQuery as Query>::Storage>, + pub lookup_intern_trait: Arc<<InternTraitLookupQuery as Query>::Storage>, + pub intern_impl: Arc<<InternImplQuery as Query>::Storage>, + pub lookup_intern_impl: Arc<<InternImplLookupQuery as Query>::Storage>, + pub intern_type_alias: Arc<<InternTypeAliasQuery as Query>::Storage>, + pub lookup_intern_type_alias: Arc<<InternTypeAliasLookupQuery as Query>::Storage>, + pub intern_contract: Arc<<InternContractQuery as Query>::Storage>, + pub lookup_intern_contract: Arc<<InternContractLookupQuery as Query>::Storage>, + pub intern_contract_field: Arc<<InternContractFieldQuery as Query>::Storage>, + pub lookup_intern_contract_field: Arc<<InternContractFieldLookupQuery as Query>::Storage>, + pub intern_function_sig: Arc<<InternFunctionSigQuery as Query>::Storage>, + pub lookup_intern_function_sig: Arc<<InternFunctionSigLookupQuery as Query>::Storage>, + pub intern_function: Arc<<InternFunctionQuery as Query>::Storage>, + pub lookup_intern_function: Arc<<InternFunctionLookupQuery as Query>::Storage>, + pub intern_type: Arc<<InternTypeQuery as Query>::Storage>, + pub lookup_intern_type: Arc<<InternTypeLookupQuery as Query>::Storage>, + pub ingot_files: Arc<<IngotFilesQuery as Query>::Storage>, + pub ingot_external_ingots: Arc<<IngotExternalIngotsQuery as Query>::Storage>, + pub root_ingot: Arc<<RootIngotQuery as Query>::Storage>, + pub ingot_modules: Arc<<IngotModulesQuery as Query>::Storage>, + pub ingot_root_module: Arc<<IngotRootModuleQuery as Query>::Storage>, + pub module_file_path: Arc<<ModuleFilePathQuery as Query>::Storage>, + pub module_parse: Arc<<ModuleParseQuery as Query>::Storage>, + pub module_is_incomplete: Arc<<ModuleIsIncompleteQuery as Query>::Storage>, + pub module_all_items: Arc<<ModuleAllItemsQuery as Query>::Storage>, + pub module_all_impls: Arc<<ModuleAllImplsQuery as Query>::Storage>, + pub module_item_map: Arc<<ModuleItemMapQuery as Query>::Storage>, + pub module_impl_map: Arc<<ModuleImplMapQuery as Query>::Storage>, + pub module_contracts: Arc<<ModuleContractsQuery as Query>::Storage>, + pub module_structs: Arc<<ModuleStructsQuery as Query>::Storage>, + pub module_constants: Arc<<ModuleConstantsQuery as Query>::Storage>, + pub module_used_item_map: Arc<<ModuleUsedItemMapQuery as Query>::Storage>, + pub module_parent_module: Arc<<ModuleParentModuleQuery as Query>::Storage>, + pub module_submodules: Arc<<ModuleSubmodulesQuery as Query>::Storage>, + pub module_tests: Arc<<ModuleTestsQuery as Query>::Storage>, + pub module_constant_type: Arc<<ModuleConstantTypeQuery as Query>::Storage>, + pub module_constant_value: Arc<<ModuleConstantValueQuery as Query>::Storage>, + pub contract_all_functions: Arc<<ContractAllFunctionsQuery as Query>::Storage>, + pub contract_function_map: Arc<<ContractFunctionMapQuery as Query>::Storage>, + pub contract_public_function_map: Arc<<ContractPublicFunctionMapQuery as Query>::Storage>, + pub contract_init_function: Arc<<ContractInitFunctionQuery as Query>::Storage>, + pub contract_call_function: Arc<<ContractCallFunctionQuery as Query>::Storage>, + pub contract_all_fields: Arc<<ContractAllFieldsQuery as Query>::Storage>, + pub contract_field_map: Arc<<ContractFieldMapQuery as Query>::Storage>, + pub contract_field_type: Arc<<ContractFieldTypeQuery as Query>::Storage>, + pub contract_dependency_graph: Arc<<ContractDependencyGraphQuery as Query>::Storage>, + pub contract_runtime_dependency_graph: Arc<<ContractRuntimeDependencyGraphQuery as Query>::Storage>, + pub function_signature: Arc<<FunctionSignatureQuery as Query>::Storage>, + pub function_body: Arc<<FunctionBodyQuery as Query>::Storage>, + pub function_dependency_graph: Arc<<FunctionDependencyGraphQuery as Query>::Storage>, + pub struct_all_fields: Arc<<StructAllFieldsQuery as Query>::Storage>, + pub struct_field_map: Arc<<StructFieldMapQuery as Query>::Storage>, + pub struct_field_type: Arc<<StructFieldTypeQuery as Query>::Storage>, + pub struct_all_functions: Arc<<StructAllFunctionsQuery as Query>::Storage>, + pub struct_function_map: Arc<<StructFunctionMapQuery as Query>::Storage>, + pub struct_dependency_graph: Arc<<StructDependencyGraphQuery as Query>::Storage>, + pub enum_all_variants: Arc<<EnumAllVariantsQuery as Query>::Storage>, + pub enum_variant_map: Arc<<EnumVariantMapQuery as Query>::Storage>, + pub enum_all_functions: Arc<<EnumAllFunctionsQuery as Query>::Storage>, + pub enum_function_map: Arc<<EnumFunctionMapQuery as Query>::Storage>, + pub enum_dependency_graph: Arc<<EnumDependencyGraphQuery as Query>::Storage>, + pub enum_variant_kind: Arc<<EnumVariantKindQuery as Query>::Storage>, + pub trait_all_functions: Arc<<TraitAllFunctionsQuery as Query>::Storage>, + pub trait_function_map: Arc<<TraitFunctionMapQuery as Query>::Storage>, + pub trait_is_implemented_for: Arc<<TraitIsImplementedForQuery as Query>::Storage>, + pub impl_all_functions: Arc<<ImplAllFunctionsQuery as Query>::Storage>, + pub impl_function_map: Arc<<ImplFunctionMapQuery as Query>::Storage>, + pub all_impls: Arc<<AllImplsQuery as Query>::Storage>, + pub impl_for: Arc<<ImplForQuery as Query>::Storage>, + pub function_sigs: Arc<<FunctionSigsQuery as Query>::Storage>, + pub type_alias_type: Arc<<TypeAliasTypeQuery as Query>::Storage>, +
}

Fields§

§intern_ingot: Arc<<InternIngotQuery as Query>::Storage>§lookup_intern_ingot: Arc<<InternIngotLookupQuery as Query>::Storage>§intern_module: Arc<<InternModuleQuery as Query>::Storage>§lookup_intern_module: Arc<<InternModuleLookupQuery as Query>::Storage>§intern_module_const: Arc<<InternModuleConstQuery as Query>::Storage>§lookup_intern_module_const: Arc<<InternModuleConstLookupQuery as Query>::Storage>§intern_struct: Arc<<InternStructQuery as Query>::Storage>§lookup_intern_struct: Arc<<InternStructLookupQuery as Query>::Storage>§intern_struct_field: Arc<<InternStructFieldQuery as Query>::Storage>§lookup_intern_struct_field: Arc<<InternStructFieldLookupQuery as Query>::Storage>§intern_enum: Arc<<InternEnumQuery as Query>::Storage>§lookup_intern_enum: Arc<<InternEnumLookupQuery as Query>::Storage>§intern_attribute: Arc<<InternAttributeQuery as Query>::Storage>§lookup_intern_attribute: Arc<<InternAttributeLookupQuery as Query>::Storage>§intern_enum_variant: Arc<<InternEnumVariantQuery as Query>::Storage>§lookup_intern_enum_variant: Arc<<InternEnumVariantLookupQuery as Query>::Storage>§intern_trait: Arc<<InternTraitQuery as Query>::Storage>§lookup_intern_trait: Arc<<InternTraitLookupQuery as Query>::Storage>§intern_impl: Arc<<InternImplQuery as Query>::Storage>§lookup_intern_impl: Arc<<InternImplLookupQuery as Query>::Storage>§intern_type_alias: Arc<<InternTypeAliasQuery as Query>::Storage>§lookup_intern_type_alias: Arc<<InternTypeAliasLookupQuery as Query>::Storage>§intern_contract: Arc<<InternContractQuery as Query>::Storage>§lookup_intern_contract: Arc<<InternContractLookupQuery as Query>::Storage>§intern_contract_field: Arc<<InternContractFieldQuery as Query>::Storage>§lookup_intern_contract_field: Arc<<InternContractFieldLookupQuery as Query>::Storage>§intern_function_sig: Arc<<InternFunctionSigQuery as Query>::Storage>§lookup_intern_function_sig: Arc<<InternFunctionSigLookupQuery as Query>::Storage>§intern_function: Arc<<InternFunctionQuery as Query>::Storage>§lookup_intern_function: Arc<<InternFunctionLookupQuery as Query>::Storage>§intern_type: Arc<<InternTypeQuery as Query>::Storage>§lookup_intern_type: Arc<<InternTypeLookupQuery as Query>::Storage>§ingot_files: Arc<<IngotFilesQuery as Query>::Storage>§ingot_external_ingots: Arc<<IngotExternalIngotsQuery as Query>::Storage>§root_ingot: Arc<<RootIngotQuery as Query>::Storage>§ingot_modules: Arc<<IngotModulesQuery as Query>::Storage>§ingot_root_module: Arc<<IngotRootModuleQuery as Query>::Storage>§module_file_path: Arc<<ModuleFilePathQuery as Query>::Storage>§module_parse: Arc<<ModuleParseQuery as Query>::Storage>§module_is_incomplete: Arc<<ModuleIsIncompleteQuery as Query>::Storage>§module_all_items: Arc<<ModuleAllItemsQuery as Query>::Storage>§module_all_impls: Arc<<ModuleAllImplsQuery as Query>::Storage>§module_item_map: Arc<<ModuleItemMapQuery as Query>::Storage>§module_impl_map: Arc<<ModuleImplMapQuery as Query>::Storage>§module_contracts: Arc<<ModuleContractsQuery as Query>::Storage>§module_structs: Arc<<ModuleStructsQuery as Query>::Storage>§module_constants: Arc<<ModuleConstantsQuery as Query>::Storage>§module_used_item_map: Arc<<ModuleUsedItemMapQuery as Query>::Storage>§module_parent_module: Arc<<ModuleParentModuleQuery as Query>::Storage>§module_submodules: Arc<<ModuleSubmodulesQuery as Query>::Storage>§module_tests: Arc<<ModuleTestsQuery as Query>::Storage>§module_constant_type: Arc<<ModuleConstantTypeQuery as Query>::Storage>§module_constant_value: Arc<<ModuleConstantValueQuery as Query>::Storage>§contract_all_functions: Arc<<ContractAllFunctionsQuery as Query>::Storage>§contract_function_map: Arc<<ContractFunctionMapQuery as Query>::Storage>§contract_public_function_map: Arc<<ContractPublicFunctionMapQuery as Query>::Storage>§contract_init_function: Arc<<ContractInitFunctionQuery as Query>::Storage>§contract_call_function: Arc<<ContractCallFunctionQuery as Query>::Storage>§contract_all_fields: Arc<<ContractAllFieldsQuery as Query>::Storage>§contract_field_map: Arc<<ContractFieldMapQuery as Query>::Storage>§contract_field_type: Arc<<ContractFieldTypeQuery as Query>::Storage>§contract_dependency_graph: Arc<<ContractDependencyGraphQuery as Query>::Storage>§contract_runtime_dependency_graph: Arc<<ContractRuntimeDependencyGraphQuery as Query>::Storage>§function_signature: Arc<<FunctionSignatureQuery as Query>::Storage>§function_body: Arc<<FunctionBodyQuery as Query>::Storage>§function_dependency_graph: Arc<<FunctionDependencyGraphQuery as Query>::Storage>§struct_all_fields: Arc<<StructAllFieldsQuery as Query>::Storage>§struct_field_map: Arc<<StructFieldMapQuery as Query>::Storage>§struct_field_type: Arc<<StructFieldTypeQuery as Query>::Storage>§struct_all_functions: Arc<<StructAllFunctionsQuery as Query>::Storage>§struct_function_map: Arc<<StructFunctionMapQuery as Query>::Storage>§struct_dependency_graph: Arc<<StructDependencyGraphQuery as Query>::Storage>§enum_all_variants: Arc<<EnumAllVariantsQuery as Query>::Storage>§enum_variant_map: Arc<<EnumVariantMapQuery as Query>::Storage>§enum_all_functions: Arc<<EnumAllFunctionsQuery as Query>::Storage>§enum_function_map: Arc<<EnumFunctionMapQuery as Query>::Storage>§enum_dependency_graph: Arc<<EnumDependencyGraphQuery as Query>::Storage>§enum_variant_kind: Arc<<EnumVariantKindQuery as Query>::Storage>§trait_all_functions: Arc<<TraitAllFunctionsQuery as Query>::Storage>§trait_function_map: Arc<<TraitFunctionMapQuery as Query>::Storage>§trait_is_implemented_for: Arc<<TraitIsImplementedForQuery as Query>::Storage>§impl_all_functions: Arc<<ImplAllFunctionsQuery as Query>::Storage>§impl_function_map: Arc<<ImplFunctionMapQuery as Query>::Storage>§all_impls: Arc<<AllImplsQuery as Query>::Storage>§impl_for: Arc<<ImplForQuery as Query>::Storage>§function_sigs: Arc<<FunctionSigsQuery as Query>::Storage>§type_alias_type: Arc<<TypeAliasTypeQuery as Query>::Storage>

Implementations§

Source§

impl AnalyzerDbGroupStorage__

Source

pub fn new(group_index: u16) -> Self

Source§

impl AnalyzerDbGroupStorage__

Source

pub fn fmt_index( + &self, + db: &(dyn AnalyzerDb + '_), + input: DatabaseKeyIndex, + fmt: &mut Formatter<'_>, +) -> Result

Source

pub fn maybe_changed_since( + &self, + db: &(dyn AnalyzerDb + '_), + input: DatabaseKeyIndex, + revision: Revision, +) -> bool

Source

pub fn for_each_query( + &self, + _runtime: &Runtime, + op: &mut dyn FnMut(&dyn QueryStorageMassOps), +)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.AnalyzerDbStorage.html b/compiler-docs/fe_analyzer/db/struct.AnalyzerDbStorage.html new file mode 100644 index 0000000000..3f8e33df65 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.AnalyzerDbStorage.html @@ -0,0 +1,12 @@ +AnalyzerDbStorage in fe_analyzer::db - Rust

Struct AnalyzerDbStorage

Source
pub struct AnalyzerDbStorage {}
Expand description

Representative struct for the query group.

+

Trait Implementations§

Source§

impl HasQueryGroup<AnalyzerDbStorage> for TestDb

Source§

fn group_storage(&self) -> &<AnalyzerDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl QueryGroup for AnalyzerDbStorage

Source§

type DynDb = dyn AnalyzerDb

Dyn version of the associated database trait.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractAllFieldsQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractAllFieldsQuery.html new file mode 100644 index 0000000000..5d8ac81e8a --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractAllFieldsQuery.html @@ -0,0 +1,46 @@ +ContractAllFieldsQuery in fe_analyzer::db - Rust

Struct ContractAllFieldsQuery

Source
pub struct ContractAllFieldsQuery;

Implementations§

Source§

impl ContractAllFieldsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractAllFieldsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractAllFieldsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractAllFieldsQuery

Source§

fn default() -> ContractAllFieldsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractAllFieldsQuery

Source§

const QUERY_INDEX: u16 = 58u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_all_fields"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[ContractFieldId]>

What value does the query return?
Source§

type Storage = DerivedStorage<ContractAllFieldsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractAllFieldsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractAllFieldsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractAllFunctionsQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractAllFunctionsQuery.html new file mode 100644 index 0000000000..188f5ec338 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractAllFunctionsQuery.html @@ -0,0 +1,46 @@ +ContractAllFunctionsQuery in fe_analyzer::db - Rust

Struct ContractAllFunctionsQuery

Source
pub struct ContractAllFunctionsQuery;

Implementations§

Source§

impl ContractAllFunctionsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractAllFunctionsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractAllFunctionsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractAllFunctionsQuery

Source§

fn default() -> ContractAllFunctionsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractAllFunctionsQuery

Source§

const QUERY_INDEX: u16 = 53u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_all_functions"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[FunctionId]>

What value does the query return?
Source§

type Storage = DerivedStorage<ContractAllFunctionsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractAllFunctionsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractAllFunctionsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractCallFunctionQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractCallFunctionQuery.html new file mode 100644 index 0000000000..0180d87564 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractCallFunctionQuery.html @@ -0,0 +1,46 @@ +ContractCallFunctionQuery in fe_analyzer::db - Rust

Struct ContractCallFunctionQuery

Source
pub struct ContractCallFunctionQuery;

Implementations§

Source§

impl ContractCallFunctionQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractCallFunctionQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractCallFunctionQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractCallFunctionQuery

Source§

fn default() -> ContractCallFunctionQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractCallFunctionQuery

Source§

const QUERY_INDEX: u16 = 57u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_call_function"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Option<FunctionId>>

What value does the query return?
Source§

type Storage = DerivedStorage<ContractCallFunctionQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractCallFunctionQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractCallFunctionQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractDependencyGraphQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractDependencyGraphQuery.html new file mode 100644 index 0000000000..4a9b9a2d9f --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractDependencyGraphQuery.html @@ -0,0 +1,46 @@ +ContractDependencyGraphQuery in fe_analyzer::db - Rust

Struct ContractDependencyGraphQuery

Source
pub struct ContractDependencyGraphQuery;

Implementations§

Source§

impl ContractDependencyGraphQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractDependencyGraphQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractDependencyGraphQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractDependencyGraphQuery

Source§

fn default() -> ContractDependencyGraphQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractDependencyGraphQuery

Source§

const QUERY_INDEX: u16 = 61u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_dependency_graph"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = DepGraphWrapper

What value does the query return?
Source§

type Storage = DerivedStorage<ContractDependencyGraphQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractDependencyGraphQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractDependencyGraphQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

Source§

fn recover( + db: &<Self as QueryDb<'_>>::DynDb, + cycle: &[DatabaseKeyIndex], + key0: &<Self as Query>::Key, +) -> Option<<Self as Query>::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractFieldMapQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractFieldMapQuery.html new file mode 100644 index 0000000000..c898195876 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractFieldMapQuery.html @@ -0,0 +1,46 @@ +ContractFieldMapQuery in fe_analyzer::db - Rust

Struct ContractFieldMapQuery

Source
pub struct ContractFieldMapQuery;

Implementations§

Source§

impl ContractFieldMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractFieldMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractFieldMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractFieldMapQuery

Source§

fn default() -> ContractFieldMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractFieldMapQuery

Source§

const QUERY_INDEX: u16 = 59u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_field_map"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, ContractFieldId>>>

What value does the query return?
Source§

type Storage = DerivedStorage<ContractFieldMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractFieldMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractFieldMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractFieldTypeQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractFieldTypeQuery.html new file mode 100644 index 0000000000..24bc236413 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractFieldTypeQuery.html @@ -0,0 +1,46 @@ +ContractFieldTypeQuery in fe_analyzer::db - Rust

Struct ContractFieldTypeQuery

Source
pub struct ContractFieldTypeQuery;

Implementations§

Source§

impl ContractFieldTypeQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractFieldTypeQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractFieldTypeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractFieldTypeQuery

Source§

fn default() -> ContractFieldTypeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractFieldTypeQuery

Source§

const QUERY_INDEX: u16 = 60u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_field_type"

Name of the query method (e.g., foo)
Source§

type Key = ContractFieldId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Result<TypeId, TypeError>>

What value does the query return?
Source§

type Storage = DerivedStorage<ContractFieldTypeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractFieldTypeQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractFieldTypeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractFunctionMapQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractFunctionMapQuery.html new file mode 100644 index 0000000000..8441e64474 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractFunctionMapQuery.html @@ -0,0 +1,46 @@ +ContractFunctionMapQuery in fe_analyzer::db - Rust

Struct ContractFunctionMapQuery

Source
pub struct ContractFunctionMapQuery;

Implementations§

Source§

impl ContractFunctionMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractFunctionMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractFunctionMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractFunctionMapQuery

Source§

fn default() -> ContractFunctionMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractFunctionMapQuery

Source§

const QUERY_INDEX: u16 = 54u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_function_map"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

What value does the query return?
Source§

type Storage = DerivedStorage<ContractFunctionMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractFunctionMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractFunctionMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractInitFunctionQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractInitFunctionQuery.html new file mode 100644 index 0000000000..4f27665b25 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractInitFunctionQuery.html @@ -0,0 +1,46 @@ +ContractInitFunctionQuery in fe_analyzer::db - Rust

Struct ContractInitFunctionQuery

Source
pub struct ContractInitFunctionQuery;

Implementations§

Source§

impl ContractInitFunctionQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractInitFunctionQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractInitFunctionQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractInitFunctionQuery

Source§

fn default() -> ContractInitFunctionQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractInitFunctionQuery

Source§

const QUERY_INDEX: u16 = 56u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_init_function"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Option<FunctionId>>

What value does the query return?
Source§

type Storage = DerivedStorage<ContractInitFunctionQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractInitFunctionQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractInitFunctionQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractPublicFunctionMapQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractPublicFunctionMapQuery.html new file mode 100644 index 0000000000..5b8e12fa9a --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractPublicFunctionMapQuery.html @@ -0,0 +1,46 @@ +ContractPublicFunctionMapQuery in fe_analyzer::db - Rust

Struct ContractPublicFunctionMapQuery

Source
pub struct ContractPublicFunctionMapQuery;

Implementations§

Source§

impl ContractPublicFunctionMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractPublicFunctionMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractPublicFunctionMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractPublicFunctionMapQuery

Source§

fn default() -> ContractPublicFunctionMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractPublicFunctionMapQuery

Source§

const QUERY_INDEX: u16 = 55u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_public_function_map"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<IndexMap<SmolStr, FunctionId>>

What value does the query return?
Source§

type Storage = DerivedStorage<ContractPublicFunctionMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractPublicFunctionMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractPublicFunctionMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ContractRuntimeDependencyGraphQuery.html b/compiler-docs/fe_analyzer/db/struct.ContractRuntimeDependencyGraphQuery.html new file mode 100644 index 0000000000..4cfc3d6d2a --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ContractRuntimeDependencyGraphQuery.html @@ -0,0 +1,46 @@ +ContractRuntimeDependencyGraphQuery in fe_analyzer::db - Rust

Struct ContractRuntimeDependencyGraphQuery

Source
pub struct ContractRuntimeDependencyGraphQuery;

Implementations§

Source§

impl ContractRuntimeDependencyGraphQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ContractRuntimeDependencyGraphQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ContractRuntimeDependencyGraphQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ContractRuntimeDependencyGraphQuery

Source§

fn default() -> ContractRuntimeDependencyGraphQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ContractRuntimeDependencyGraphQuery

Source§

const QUERY_INDEX: u16 = 62u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "contract_runtime_dependency_graph"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = DepGraphWrapper

What value does the query return?
Source§

type Storage = DerivedStorage<ContractRuntimeDependencyGraphQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ContractRuntimeDependencyGraphQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ContractRuntimeDependencyGraphQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

Source§

fn recover( + db: &<Self as QueryDb<'_>>::DynDb, + cycle: &[DatabaseKeyIndex], + key0: &<Self as Query>::Key, +) -> Option<<Self as Query>::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.EnumAllFunctionsQuery.html b/compiler-docs/fe_analyzer/db/struct.EnumAllFunctionsQuery.html new file mode 100644 index 0000000000..308ea807ab --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.EnumAllFunctionsQuery.html @@ -0,0 +1,46 @@ +EnumAllFunctionsQuery in fe_analyzer::db - Rust

Struct EnumAllFunctionsQuery

Source
pub struct EnumAllFunctionsQuery;

Implementations§

Source§

impl EnumAllFunctionsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl EnumAllFunctionsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for EnumAllFunctionsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnumAllFunctionsQuery

Source§

fn default() -> EnumAllFunctionsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for EnumAllFunctionsQuery

Source§

const QUERY_INDEX: u16 = 74u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "enum_all_functions"

Name of the query method (e.g., foo)
Source§

type Key = EnumId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[FunctionId]>

What value does the query return?
Source§

type Storage = DerivedStorage<EnumAllFunctionsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for EnumAllFunctionsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for EnumAllFunctionsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.EnumAllVariantsQuery.html b/compiler-docs/fe_analyzer/db/struct.EnumAllVariantsQuery.html new file mode 100644 index 0000000000..d68a2e2a34 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.EnumAllVariantsQuery.html @@ -0,0 +1,46 @@ +EnumAllVariantsQuery in fe_analyzer::db - Rust

Struct EnumAllVariantsQuery

Source
pub struct EnumAllVariantsQuery;

Implementations§

Source§

impl EnumAllVariantsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl EnumAllVariantsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for EnumAllVariantsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnumAllVariantsQuery

Source§

fn default() -> EnumAllVariantsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for EnumAllVariantsQuery

Source§

const QUERY_INDEX: u16 = 72u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "enum_all_variants"

Name of the query method (e.g., foo)
Source§

type Key = EnumId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[EnumVariantId]>

What value does the query return?
Source§

type Storage = DerivedStorage<EnumAllVariantsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for EnumAllVariantsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for EnumAllVariantsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.EnumDependencyGraphQuery.html b/compiler-docs/fe_analyzer/db/struct.EnumDependencyGraphQuery.html new file mode 100644 index 0000000000..3b374d9f7a --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.EnumDependencyGraphQuery.html @@ -0,0 +1,46 @@ +EnumDependencyGraphQuery in fe_analyzer::db - Rust

Struct EnumDependencyGraphQuery

Source
pub struct EnumDependencyGraphQuery;

Implementations§

Source§

impl EnumDependencyGraphQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl EnumDependencyGraphQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for EnumDependencyGraphQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnumDependencyGraphQuery

Source§

fn default() -> EnumDependencyGraphQuery

Returns the “default value” for a type. Read more
Source§

impl Query for EnumDependencyGraphQuery

Source§

const QUERY_INDEX: u16 = 76u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "enum_dependency_graph"

Name of the query method (e.g., foo)
Source§

type Key = EnumId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<DepGraphWrapper>

What value does the query return?
Source§

type Storage = DerivedStorage<EnumDependencyGraphQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for EnumDependencyGraphQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for EnumDependencyGraphQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

Source§

fn recover( + db: &<Self as QueryDb<'_>>::DynDb, + cycle: &[DatabaseKeyIndex], + key0: &<Self as Query>::Key, +) -> Option<<Self as Query>::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.EnumFunctionMapQuery.html b/compiler-docs/fe_analyzer/db/struct.EnumFunctionMapQuery.html new file mode 100644 index 0000000000..61fd562c64 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.EnumFunctionMapQuery.html @@ -0,0 +1,46 @@ +EnumFunctionMapQuery in fe_analyzer::db - Rust

Struct EnumFunctionMapQuery

Source
pub struct EnumFunctionMapQuery;

Implementations§

Source§

impl EnumFunctionMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl EnumFunctionMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for EnumFunctionMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnumFunctionMapQuery

Source§

fn default() -> EnumFunctionMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for EnumFunctionMapQuery

Source§

const QUERY_INDEX: u16 = 75u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "enum_function_map"

Name of the query method (e.g., foo)
Source§

type Key = EnumId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

What value does the query return?
Source§

type Storage = DerivedStorage<EnumFunctionMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for EnumFunctionMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for EnumFunctionMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.EnumVariantKindQuery.html b/compiler-docs/fe_analyzer/db/struct.EnumVariantKindQuery.html new file mode 100644 index 0000000000..7faec237a5 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.EnumVariantKindQuery.html @@ -0,0 +1,46 @@ +EnumVariantKindQuery in fe_analyzer::db - Rust

Struct EnumVariantKindQuery

Source
pub struct EnumVariantKindQuery;

Implementations§

Source§

impl EnumVariantKindQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl EnumVariantKindQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for EnumVariantKindQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnumVariantKindQuery

Source§

fn default() -> EnumVariantKindQuery

Returns the “default value” for a type. Read more
Source§

impl Query for EnumVariantKindQuery

Source§

const QUERY_INDEX: u16 = 77u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "enum_variant_kind"

Name of the query method (e.g., foo)
Source§

type Key = EnumVariantId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Result<EnumVariantKind, TypeError>>

What value does the query return?
Source§

type Storage = DerivedStorage<EnumVariantKindQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for EnumVariantKindQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for EnumVariantKindQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.EnumVariantMapQuery.html b/compiler-docs/fe_analyzer/db/struct.EnumVariantMapQuery.html new file mode 100644 index 0000000000..6a4a1141f2 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.EnumVariantMapQuery.html @@ -0,0 +1,46 @@ +EnumVariantMapQuery in fe_analyzer::db - Rust

Struct EnumVariantMapQuery

Source
pub struct EnumVariantMapQuery;

Implementations§

Source§

impl EnumVariantMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl EnumVariantMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for EnumVariantMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnumVariantMapQuery

Source§

fn default() -> EnumVariantMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for EnumVariantMapQuery

Source§

const QUERY_INDEX: u16 = 73u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "enum_variant_map"

Name of the query method (e.g., foo)
Source§

type Key = EnumId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, EnumVariantId>>>

What value does the query return?
Source§

type Storage = DerivedStorage<EnumVariantMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for EnumVariantMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for EnumVariantMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.FunctionBodyQuery.html b/compiler-docs/fe_analyzer/db/struct.FunctionBodyQuery.html new file mode 100644 index 0000000000..297833ea1d --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.FunctionBodyQuery.html @@ -0,0 +1,46 @@ +FunctionBodyQuery in fe_analyzer::db - Rust

Struct FunctionBodyQuery

Source
pub struct FunctionBodyQuery;

Implementations§

Source§

impl FunctionBodyQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl FunctionBodyQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for FunctionBodyQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FunctionBodyQuery

Source§

fn default() -> FunctionBodyQuery

Returns the “default value” for a type. Read more
Source§

impl Query for FunctionBodyQuery

Source§

const QUERY_INDEX: u16 = 64u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "function_body"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<FunctionBody>>

What value does the query return?
Source§

type Storage = DerivedStorage<FunctionBodyQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for FunctionBodyQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for FunctionBodyQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.FunctionDependencyGraphQuery.html b/compiler-docs/fe_analyzer/db/struct.FunctionDependencyGraphQuery.html new file mode 100644 index 0000000000..214ec25ca8 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.FunctionDependencyGraphQuery.html @@ -0,0 +1,46 @@ +FunctionDependencyGraphQuery in fe_analyzer::db - Rust

Struct FunctionDependencyGraphQuery

Source
pub struct FunctionDependencyGraphQuery;

Implementations§

Source§

impl FunctionDependencyGraphQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl FunctionDependencyGraphQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for FunctionDependencyGraphQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FunctionDependencyGraphQuery

Source§

fn default() -> FunctionDependencyGraphQuery

Returns the “default value” for a type. Read more
Source§

impl Query for FunctionDependencyGraphQuery

Source§

const QUERY_INDEX: u16 = 65u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "function_dependency_graph"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = DepGraphWrapper

What value does the query return?
Source§

type Storage = DerivedStorage<FunctionDependencyGraphQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for FunctionDependencyGraphQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for FunctionDependencyGraphQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

Source§

fn recover( + db: &<Self as QueryDb<'_>>::DynDb, + cycle: &[DatabaseKeyIndex], + key0: &<Self as Query>::Key, +) -> Option<<Self as Query>::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.FunctionSignatureQuery.html b/compiler-docs/fe_analyzer/db/struct.FunctionSignatureQuery.html new file mode 100644 index 0000000000..7db836b28c --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.FunctionSignatureQuery.html @@ -0,0 +1,46 @@ +FunctionSignatureQuery in fe_analyzer::db - Rust

Struct FunctionSignatureQuery

Source
pub struct FunctionSignatureQuery;

Implementations§

Source§

impl FunctionSignatureQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl FunctionSignatureQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for FunctionSignatureQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FunctionSignatureQuery

Source§

fn default() -> FunctionSignatureQuery

Returns the “default value” for a type. Read more
Source§

impl Query for FunctionSignatureQuery

Source§

const QUERY_INDEX: u16 = 63u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "function_signature"

Name of the query method (e.g., foo)
Source§

type Key = FunctionSigId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<FunctionSignature>>

What value does the query return?
Source§

type Storage = DerivedStorage<FunctionSignatureQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for FunctionSignatureQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for FunctionSignatureQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.FunctionSigsQuery.html b/compiler-docs/fe_analyzer/db/struct.FunctionSigsQuery.html new file mode 100644 index 0000000000..afa29d4743 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.FunctionSigsQuery.html @@ -0,0 +1,46 @@ +FunctionSigsQuery in fe_analyzer::db - Rust

Struct FunctionSigsQuery

Source
pub struct FunctionSigsQuery;

Implementations§

Source§

impl FunctionSigsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl FunctionSigsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for FunctionSigsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FunctionSigsQuery

Source§

fn default() -> FunctionSigsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for FunctionSigsQuery

Source§

const QUERY_INDEX: u16 = 85u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "function_sigs"

Name of the query method (e.g., foo)
Source§

type Key = (TypeId, SmolStr)

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[FunctionSigId]>

What value does the query return?
Source§

type Storage = DerivedStorage<FunctionSigsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for FunctionSigsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for FunctionSigsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + (key0, key1): <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ImplAllFunctionsQuery.html b/compiler-docs/fe_analyzer/db/struct.ImplAllFunctionsQuery.html new file mode 100644 index 0000000000..d2601f0d0c --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ImplAllFunctionsQuery.html @@ -0,0 +1,46 @@ +ImplAllFunctionsQuery in fe_analyzer::db - Rust

Struct ImplAllFunctionsQuery

Source
pub struct ImplAllFunctionsQuery;

Implementations§

Source§

impl ImplAllFunctionsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ImplAllFunctionsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ImplAllFunctionsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ImplAllFunctionsQuery

Source§

fn default() -> ImplAllFunctionsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ImplAllFunctionsQuery

Source§

const QUERY_INDEX: u16 = 81u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "impl_all_functions"

Name of the query method (e.g., foo)
Source§

type Key = ImplId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[FunctionId]>

What value does the query return?
Source§

type Storage = DerivedStorage<ImplAllFunctionsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ImplAllFunctionsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ImplAllFunctionsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ImplForQuery.html b/compiler-docs/fe_analyzer/db/struct.ImplForQuery.html new file mode 100644 index 0000000000..4ac94dbf33 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ImplForQuery.html @@ -0,0 +1,46 @@ +ImplForQuery in fe_analyzer::db - Rust

Struct ImplForQuery

Source
pub struct ImplForQuery;

Implementations§

Source§

impl ImplForQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ImplForQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ImplForQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ImplForQuery

Source§

fn default() -> ImplForQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ImplForQuery

Source§

const QUERY_INDEX: u16 = 84u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "impl_for"

Name of the query method (e.g., foo)
Source§

type Key = (TypeId, TraitId)

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Option<ImplId>

What value does the query return?
Source§

type Storage = DerivedStorage<ImplForQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ImplForQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ImplForQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + (key0, key1): <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ImplFunctionMapQuery.html b/compiler-docs/fe_analyzer/db/struct.ImplFunctionMapQuery.html new file mode 100644 index 0000000000..186619a7c8 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ImplFunctionMapQuery.html @@ -0,0 +1,46 @@ +ImplFunctionMapQuery in fe_analyzer::db - Rust

Struct ImplFunctionMapQuery

Source
pub struct ImplFunctionMapQuery;

Implementations§

Source§

impl ImplFunctionMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ImplFunctionMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ImplFunctionMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ImplFunctionMapQuery

Source§

fn default() -> ImplFunctionMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ImplFunctionMapQuery

Source§

const QUERY_INDEX: u16 = 82u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "impl_function_map"

Name of the query method (e.g., foo)
Source§

type Key = ImplId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

What value does the query return?
Source§

type Storage = DerivedStorage<ImplFunctionMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ImplFunctionMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ImplFunctionMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.IngotExternalIngotsQuery.html b/compiler-docs/fe_analyzer/db/struct.IngotExternalIngotsQuery.html new file mode 100644 index 0000000000..41d55d1ff9 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.IngotExternalIngotsQuery.html @@ -0,0 +1,39 @@ +IngotExternalIngotsQuery in fe_analyzer::db - Rust

Struct IngotExternalIngotsQuery

Source
pub struct IngotExternalIngotsQuery;

Implementations§

Source§

impl IngotExternalIngotsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl IngotExternalIngotsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for IngotExternalIngotsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IngotExternalIngotsQuery

Source§

fn default() -> IngotExternalIngotsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for IngotExternalIngotsQuery

Source§

const QUERY_INDEX: u16 = 33u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "ingot_external_ingots"

Name of the query method (e.g., foo)
Source§

type Key = IngotId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<IndexMap<SmolStr, IngotId>>

What value does the query return?
Source§

type Storage = InputStorage<IngotExternalIngotsQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for IngotExternalIngotsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.IngotFilesQuery.html b/compiler-docs/fe_analyzer/db/struct.IngotFilesQuery.html new file mode 100644 index 0000000000..d787d7bb7e --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.IngotFilesQuery.html @@ -0,0 +1,39 @@ +IngotFilesQuery in fe_analyzer::db - Rust

Struct IngotFilesQuery

Source
pub struct IngotFilesQuery;

Implementations§

Source§

impl IngotFilesQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl IngotFilesQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for IngotFilesQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IngotFilesQuery

Source§

fn default() -> IngotFilesQuery

Returns the “default value” for a type. Read more
Source§

impl Query for IngotFilesQuery

Source§

const QUERY_INDEX: u16 = 32u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "ingot_files"

Name of the query method (e.g., foo)
Source§

type Key = IngotId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[SourceFileId]>

What value does the query return?
Source§

type Storage = InputStorage<IngotFilesQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for IngotFilesQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.IngotModulesQuery.html b/compiler-docs/fe_analyzer/db/struct.IngotModulesQuery.html new file mode 100644 index 0000000000..cb8d5de3b9 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.IngotModulesQuery.html @@ -0,0 +1,46 @@ +IngotModulesQuery in fe_analyzer::db - Rust

Struct IngotModulesQuery

Source
pub struct IngotModulesQuery;

Implementations§

Source§

impl IngotModulesQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl IngotModulesQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for IngotModulesQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IngotModulesQuery

Source§

fn default() -> IngotModulesQuery

Returns the “default value” for a type. Read more
Source§

impl Query for IngotModulesQuery

Source§

const QUERY_INDEX: u16 = 35u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "ingot_modules"

Name of the query method (e.g., foo)
Source§

type Key = IngotId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[ModuleId]>

What value does the query return?
Source§

type Storage = DerivedStorage<IngotModulesQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for IngotModulesQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for IngotModulesQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.IngotRootModuleQuery.html b/compiler-docs/fe_analyzer/db/struct.IngotRootModuleQuery.html new file mode 100644 index 0000000000..76f06f8d13 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.IngotRootModuleQuery.html @@ -0,0 +1,46 @@ +IngotRootModuleQuery in fe_analyzer::db - Rust

Struct IngotRootModuleQuery

Source
pub struct IngotRootModuleQuery;

Implementations§

Source§

impl IngotRootModuleQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl IngotRootModuleQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for IngotRootModuleQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IngotRootModuleQuery

Source§

fn default() -> IngotRootModuleQuery

Returns the “default value” for a type. Read more
Source§

impl Query for IngotRootModuleQuery

Source§

const QUERY_INDEX: u16 = 36u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "ingot_root_module"

Name of the query method (e.g., foo)
Source§

type Key = IngotId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Option<ModuleId>

What value does the query return?
Source§

type Storage = DerivedStorage<IngotRootModuleQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for IngotRootModuleQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for IngotRootModuleQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternAttributeLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternAttributeLookupQuery.html new file mode 100644 index 0000000000..672572971b --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternAttributeLookupQuery.html @@ -0,0 +1,39 @@ +InternAttributeLookupQuery in fe_analyzer::db - Rust

Struct InternAttributeLookupQuery

Source
pub struct InternAttributeLookupQuery;

Implementations§

Source§

impl InternAttributeLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternAttributeLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternAttributeLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternAttributeLookupQuery

Source§

fn default() -> InternAttributeLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternAttributeLookupQuery

Source§

const QUERY_INDEX: u16 = 13u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_attribute"

Name of the query method (e.g., foo)
Source§

type Key = AttributeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Attribute>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternAttributeLookupQuery, InternAttributeQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternAttributeLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternAttributeQuery.html b/compiler-docs/fe_analyzer/db/struct.InternAttributeQuery.html new file mode 100644 index 0000000000..fcdddcb21a --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternAttributeQuery.html @@ -0,0 +1,39 @@ +InternAttributeQuery in fe_analyzer::db - Rust

Struct InternAttributeQuery

Source
pub struct InternAttributeQuery;

Implementations§

Source§

impl InternAttributeQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternAttributeQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternAttributeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternAttributeQuery

Source§

fn default() -> InternAttributeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternAttributeQuery

Source§

const QUERY_INDEX: u16 = 12u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_attribute"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Attribute>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = AttributeId

What value does the query return?
Source§

type Storage = InternedStorage<InternAttributeQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternAttributeQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternContractFieldLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternContractFieldLookupQuery.html new file mode 100644 index 0000000000..cac88e41b3 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternContractFieldLookupQuery.html @@ -0,0 +1,39 @@ +InternContractFieldLookupQuery in fe_analyzer::db - Rust

Struct InternContractFieldLookupQuery

Source
pub struct InternContractFieldLookupQuery;

Implementations§

Source§

impl InternContractFieldLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternContractFieldLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternContractFieldLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternContractFieldLookupQuery

Source§

fn default() -> InternContractFieldLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternContractFieldLookupQuery

Source§

const QUERY_INDEX: u16 = 25u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_contract_field"

Name of the query method (e.g., foo)
Source§

type Key = ContractFieldId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<ContractField>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternContractFieldLookupQuery, InternContractFieldQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternContractFieldLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternContractFieldQuery.html b/compiler-docs/fe_analyzer/db/struct.InternContractFieldQuery.html new file mode 100644 index 0000000000..5a6784b97b --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternContractFieldQuery.html @@ -0,0 +1,39 @@ +InternContractFieldQuery in fe_analyzer::db - Rust

Struct InternContractFieldQuery

Source
pub struct InternContractFieldQuery;

Implementations§

Source§

impl InternContractFieldQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternContractFieldQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternContractFieldQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternContractFieldQuery

Source§

fn default() -> InternContractFieldQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternContractFieldQuery

Source§

const QUERY_INDEX: u16 = 24u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_contract_field"

Name of the query method (e.g., foo)
Source§

type Key = Rc<ContractField>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = ContractFieldId

What value does the query return?
Source§

type Storage = InternedStorage<InternContractFieldQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternContractFieldQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternContractLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternContractLookupQuery.html new file mode 100644 index 0000000000..2c75382b76 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternContractLookupQuery.html @@ -0,0 +1,39 @@ +InternContractLookupQuery in fe_analyzer::db - Rust

Struct InternContractLookupQuery

Source
pub struct InternContractLookupQuery;

Implementations§

Source§

impl InternContractLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternContractLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternContractLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternContractLookupQuery

Source§

fn default() -> InternContractLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternContractLookupQuery

Source§

const QUERY_INDEX: u16 = 23u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_contract"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Contract>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternContractLookupQuery, InternContractQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternContractLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternContractQuery.html b/compiler-docs/fe_analyzer/db/struct.InternContractQuery.html new file mode 100644 index 0000000000..3524c4a400 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternContractQuery.html @@ -0,0 +1,39 @@ +InternContractQuery in fe_analyzer::db - Rust

Struct InternContractQuery

Source
pub struct InternContractQuery;

Implementations§

Source§

impl InternContractQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternContractQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternContractQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternContractQuery

Source§

fn default() -> InternContractQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternContractQuery

Source§

const QUERY_INDEX: u16 = 22u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_contract"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Contract>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = ContractId

What value does the query return?
Source§

type Storage = InternedStorage<InternContractQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternContractQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternEnumLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternEnumLookupQuery.html new file mode 100644 index 0000000000..bf8b0e8ec1 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternEnumLookupQuery.html @@ -0,0 +1,39 @@ +InternEnumLookupQuery in fe_analyzer::db - Rust

Struct InternEnumLookupQuery

Source
pub struct InternEnumLookupQuery;

Implementations§

Source§

impl InternEnumLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternEnumLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternEnumLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternEnumLookupQuery

Source§

fn default() -> InternEnumLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternEnumLookupQuery

Source§

const QUERY_INDEX: u16 = 11u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_enum"

Name of the query method (e.g., foo)
Source§

type Key = EnumId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Enum>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternEnumLookupQuery, InternEnumQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternEnumLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternEnumQuery.html b/compiler-docs/fe_analyzer/db/struct.InternEnumQuery.html new file mode 100644 index 0000000000..444a2c1b62 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternEnumQuery.html @@ -0,0 +1,39 @@ +InternEnumQuery in fe_analyzer::db - Rust

Struct InternEnumQuery

Source
pub struct InternEnumQuery;

Implementations§

Source§

impl InternEnumQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternEnumQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternEnumQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternEnumQuery

Source§

fn default() -> InternEnumQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternEnumQuery

Source§

const QUERY_INDEX: u16 = 10u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_enum"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Enum>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = EnumId

What value does the query return?
Source§

type Storage = InternedStorage<InternEnumQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternEnumQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternEnumVariantLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternEnumVariantLookupQuery.html new file mode 100644 index 0000000000..da8afe1ce7 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternEnumVariantLookupQuery.html @@ -0,0 +1,39 @@ +InternEnumVariantLookupQuery in fe_analyzer::db - Rust

Struct InternEnumVariantLookupQuery

Source
pub struct InternEnumVariantLookupQuery;

Implementations§

Source§

impl InternEnumVariantLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternEnumVariantLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternEnumVariantLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternEnumVariantLookupQuery

Source§

fn default() -> InternEnumVariantLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternEnumVariantLookupQuery

Source§

const QUERY_INDEX: u16 = 15u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_enum_variant"

Name of the query method (e.g., foo)
Source§

type Key = EnumVariantId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<EnumVariant>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternEnumVariantLookupQuery, InternEnumVariantQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternEnumVariantLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternEnumVariantQuery.html b/compiler-docs/fe_analyzer/db/struct.InternEnumVariantQuery.html new file mode 100644 index 0000000000..2566fbd534 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternEnumVariantQuery.html @@ -0,0 +1,39 @@ +InternEnumVariantQuery in fe_analyzer::db - Rust

Struct InternEnumVariantQuery

Source
pub struct InternEnumVariantQuery;

Implementations§

Source§

impl InternEnumVariantQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternEnumVariantQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternEnumVariantQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternEnumVariantQuery

Source§

fn default() -> InternEnumVariantQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternEnumVariantQuery

Source§

const QUERY_INDEX: u16 = 14u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_enum_variant"

Name of the query method (e.g., foo)
Source§

type Key = Rc<EnumVariant>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = EnumVariantId

What value does the query return?
Source§

type Storage = InternedStorage<InternEnumVariantQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternEnumVariantQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternFunctionLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternFunctionLookupQuery.html new file mode 100644 index 0000000000..3cbab6ff1f --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternFunctionLookupQuery.html @@ -0,0 +1,39 @@ +InternFunctionLookupQuery in fe_analyzer::db - Rust

Struct InternFunctionLookupQuery

Source
pub struct InternFunctionLookupQuery;

Implementations§

Source§

impl InternFunctionLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternFunctionLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternFunctionLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternFunctionLookupQuery

Source§

fn default() -> InternFunctionLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternFunctionLookupQuery

Source§

const QUERY_INDEX: u16 = 29u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_function"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Function>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternFunctionLookupQuery, InternFunctionQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternFunctionLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternFunctionQuery.html b/compiler-docs/fe_analyzer/db/struct.InternFunctionQuery.html new file mode 100644 index 0000000000..cccc00c331 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternFunctionQuery.html @@ -0,0 +1,39 @@ +InternFunctionQuery in fe_analyzer::db - Rust

Struct InternFunctionQuery

Source
pub struct InternFunctionQuery;

Implementations§

Source§

impl InternFunctionQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternFunctionQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternFunctionQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternFunctionQuery

Source§

fn default() -> InternFunctionQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternFunctionQuery

Source§

const QUERY_INDEX: u16 = 28u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_function"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Function>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = FunctionId

What value does the query return?
Source§

type Storage = InternedStorage<InternFunctionQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternFunctionQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternFunctionSigLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternFunctionSigLookupQuery.html new file mode 100644 index 0000000000..371ca265c4 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternFunctionSigLookupQuery.html @@ -0,0 +1,39 @@ +InternFunctionSigLookupQuery in fe_analyzer::db - Rust

Struct InternFunctionSigLookupQuery

Source
pub struct InternFunctionSigLookupQuery;

Implementations§

Source§

impl InternFunctionSigLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternFunctionSigLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternFunctionSigLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternFunctionSigLookupQuery

Source§

fn default() -> InternFunctionSigLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternFunctionSigLookupQuery

Source§

const QUERY_INDEX: u16 = 27u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_function_sig"

Name of the query method (e.g., foo)
Source§

type Key = FunctionSigId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<FunctionSig>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternFunctionSigLookupQuery, InternFunctionSigQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternFunctionSigLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternFunctionSigQuery.html b/compiler-docs/fe_analyzer/db/struct.InternFunctionSigQuery.html new file mode 100644 index 0000000000..a8955fb2b1 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternFunctionSigQuery.html @@ -0,0 +1,39 @@ +InternFunctionSigQuery in fe_analyzer::db - Rust

Struct InternFunctionSigQuery

Source
pub struct InternFunctionSigQuery;

Implementations§

Source§

impl InternFunctionSigQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternFunctionSigQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternFunctionSigQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternFunctionSigQuery

Source§

fn default() -> InternFunctionSigQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternFunctionSigQuery

Source§

const QUERY_INDEX: u16 = 26u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_function_sig"

Name of the query method (e.g., foo)
Source§

type Key = Rc<FunctionSig>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = FunctionSigId

What value does the query return?
Source§

type Storage = InternedStorage<InternFunctionSigQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternFunctionSigQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternImplLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternImplLookupQuery.html new file mode 100644 index 0000000000..499a97f977 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternImplLookupQuery.html @@ -0,0 +1,39 @@ +InternImplLookupQuery in fe_analyzer::db - Rust

Struct InternImplLookupQuery

Source
pub struct InternImplLookupQuery;

Implementations§

Source§

impl InternImplLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternImplLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternImplLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternImplLookupQuery

Source§

fn default() -> InternImplLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternImplLookupQuery

Source§

const QUERY_INDEX: u16 = 19u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_impl"

Name of the query method (e.g., foo)
Source§

type Key = ImplId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Impl>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternImplLookupQuery, InternImplQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternImplLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternImplQuery.html b/compiler-docs/fe_analyzer/db/struct.InternImplQuery.html new file mode 100644 index 0000000000..b0b814e79b --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternImplQuery.html @@ -0,0 +1,39 @@ +InternImplQuery in fe_analyzer::db - Rust

Struct InternImplQuery

Source
pub struct InternImplQuery;

Implementations§

Source§

impl InternImplQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternImplQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternImplQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternImplQuery

Source§

fn default() -> InternImplQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternImplQuery

Source§

const QUERY_INDEX: u16 = 18u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_impl"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Impl>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = ImplId

What value does the query return?
Source§

type Storage = InternedStorage<InternImplQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternImplQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternIngotLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternIngotLookupQuery.html new file mode 100644 index 0000000000..f1d4291e45 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternIngotLookupQuery.html @@ -0,0 +1,39 @@ +InternIngotLookupQuery in fe_analyzer::db - Rust

Struct InternIngotLookupQuery

Source
pub struct InternIngotLookupQuery;

Implementations§

Source§

impl InternIngotLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternIngotLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternIngotLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternIngotLookupQuery

Source§

fn default() -> InternIngotLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternIngotLookupQuery

Source§

const QUERY_INDEX: u16 = 1u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_ingot"

Name of the query method (e.g., foo)
Source§

type Key = IngotId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Ingot>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternIngotLookupQuery, InternIngotQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternIngotLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternIngotQuery.html b/compiler-docs/fe_analyzer/db/struct.InternIngotQuery.html new file mode 100644 index 0000000000..c03e8f5c6b --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternIngotQuery.html @@ -0,0 +1,39 @@ +InternIngotQuery in fe_analyzer::db - Rust

Struct InternIngotQuery

Source
pub struct InternIngotQuery;

Implementations§

Source§

impl InternIngotQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternIngotQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternIngotQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternIngotQuery

Source§

fn default() -> InternIngotQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternIngotQuery

Source§

const QUERY_INDEX: u16 = 0u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_ingot"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Ingot>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = IngotId

What value does the query return?
Source§

type Storage = InternedStorage<InternIngotQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternIngotQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternModuleConstLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternModuleConstLookupQuery.html new file mode 100644 index 0000000000..9129f2841b --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternModuleConstLookupQuery.html @@ -0,0 +1,39 @@ +InternModuleConstLookupQuery in fe_analyzer::db - Rust

Struct InternModuleConstLookupQuery

Source
pub struct InternModuleConstLookupQuery;

Implementations§

Source§

impl InternModuleConstLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternModuleConstLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternModuleConstLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternModuleConstLookupQuery

Source§

fn default() -> InternModuleConstLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternModuleConstLookupQuery

Source§

const QUERY_INDEX: u16 = 5u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_module_const"

Name of the query method (e.g., foo)
Source§

type Key = ModuleConstantId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<ModuleConstant>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternModuleConstLookupQuery, InternModuleConstQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternModuleConstLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternModuleConstQuery.html b/compiler-docs/fe_analyzer/db/struct.InternModuleConstQuery.html new file mode 100644 index 0000000000..11156c9729 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternModuleConstQuery.html @@ -0,0 +1,39 @@ +InternModuleConstQuery in fe_analyzer::db - Rust

Struct InternModuleConstQuery

Source
pub struct InternModuleConstQuery;

Implementations§

Source§

impl InternModuleConstQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternModuleConstQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternModuleConstQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternModuleConstQuery

Source§

fn default() -> InternModuleConstQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternModuleConstQuery

Source§

const QUERY_INDEX: u16 = 4u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_module_const"

Name of the query method (e.g., foo)
Source§

type Key = Rc<ModuleConstant>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = ModuleConstantId

What value does the query return?
Source§

type Storage = InternedStorage<InternModuleConstQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternModuleConstQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternModuleLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternModuleLookupQuery.html new file mode 100644 index 0000000000..16be75a9ce --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternModuleLookupQuery.html @@ -0,0 +1,39 @@ +InternModuleLookupQuery in fe_analyzer::db - Rust

Struct InternModuleLookupQuery

Source
pub struct InternModuleLookupQuery;

Implementations§

Source§

impl InternModuleLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternModuleLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternModuleLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternModuleLookupQuery

Source§

fn default() -> InternModuleLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternModuleLookupQuery

Source§

const QUERY_INDEX: u16 = 3u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_module"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Module>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternModuleLookupQuery, InternModuleQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternModuleLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternModuleQuery.html b/compiler-docs/fe_analyzer/db/struct.InternModuleQuery.html new file mode 100644 index 0000000000..6de8fb5928 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternModuleQuery.html @@ -0,0 +1,39 @@ +InternModuleQuery in fe_analyzer::db - Rust

Struct InternModuleQuery

Source
pub struct InternModuleQuery;

Implementations§

Source§

impl InternModuleQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternModuleQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternModuleQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternModuleQuery

Source§

fn default() -> InternModuleQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternModuleQuery

Source§

const QUERY_INDEX: u16 = 2u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_module"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Module>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = ModuleId

What value does the query return?
Source§

type Storage = InternedStorage<InternModuleQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternModuleQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternStructFieldLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternStructFieldLookupQuery.html new file mode 100644 index 0000000000..aab62a9633 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternStructFieldLookupQuery.html @@ -0,0 +1,39 @@ +InternStructFieldLookupQuery in fe_analyzer::db - Rust

Struct InternStructFieldLookupQuery

Source
pub struct InternStructFieldLookupQuery;

Implementations§

Source§

impl InternStructFieldLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternStructFieldLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternStructFieldLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternStructFieldLookupQuery

Source§

fn default() -> InternStructFieldLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternStructFieldLookupQuery

Source§

const QUERY_INDEX: u16 = 9u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_struct_field"

Name of the query method (e.g., foo)
Source§

type Key = StructFieldId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<StructField>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternStructFieldLookupQuery, InternStructFieldQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternStructFieldLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternStructFieldQuery.html b/compiler-docs/fe_analyzer/db/struct.InternStructFieldQuery.html new file mode 100644 index 0000000000..4c25f4edea --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternStructFieldQuery.html @@ -0,0 +1,39 @@ +InternStructFieldQuery in fe_analyzer::db - Rust

Struct InternStructFieldQuery

Source
pub struct InternStructFieldQuery;

Implementations§

Source§

impl InternStructFieldQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternStructFieldQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternStructFieldQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternStructFieldQuery

Source§

fn default() -> InternStructFieldQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternStructFieldQuery

Source§

const QUERY_INDEX: u16 = 8u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_struct_field"

Name of the query method (e.g., foo)
Source§

type Key = Rc<StructField>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = StructFieldId

What value does the query return?
Source§

type Storage = InternedStorage<InternStructFieldQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternStructFieldQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternStructLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternStructLookupQuery.html new file mode 100644 index 0000000000..0561ba9672 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternStructLookupQuery.html @@ -0,0 +1,39 @@ +InternStructLookupQuery in fe_analyzer::db - Rust

Struct InternStructLookupQuery

Source
pub struct InternStructLookupQuery;

Implementations§

Source§

impl InternStructLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternStructLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternStructLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternStructLookupQuery

Source§

fn default() -> InternStructLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternStructLookupQuery

Source§

const QUERY_INDEX: u16 = 7u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_struct"

Name of the query method (e.g., foo)
Source§

type Key = StructId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Struct>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternStructLookupQuery, InternStructQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternStructLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternStructQuery.html b/compiler-docs/fe_analyzer/db/struct.InternStructQuery.html new file mode 100644 index 0000000000..77e038d7ab --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternStructQuery.html @@ -0,0 +1,39 @@ +InternStructQuery in fe_analyzer::db - Rust

Struct InternStructQuery

Source
pub struct InternStructQuery;

Implementations§

Source§

impl InternStructQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternStructQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternStructQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternStructQuery

Source§

fn default() -> InternStructQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternStructQuery

Source§

const QUERY_INDEX: u16 = 6u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_struct"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Struct>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = StructId

What value does the query return?
Source§

type Storage = InternedStorage<InternStructQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternStructQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternTraitLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternTraitLookupQuery.html new file mode 100644 index 0000000000..49627c53ce --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternTraitLookupQuery.html @@ -0,0 +1,39 @@ +InternTraitLookupQuery in fe_analyzer::db - Rust

Struct InternTraitLookupQuery

Source
pub struct InternTraitLookupQuery;

Implementations§

Source§

impl InternTraitLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternTraitLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternTraitLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternTraitLookupQuery

Source§

fn default() -> InternTraitLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternTraitLookupQuery

Source§

const QUERY_INDEX: u16 = 17u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_trait"

Name of the query method (e.g., foo)
Source§

type Key = TraitId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Trait>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternTraitLookupQuery, InternTraitQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternTraitLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternTraitQuery.html b/compiler-docs/fe_analyzer/db/struct.InternTraitQuery.html new file mode 100644 index 0000000000..10158b546c --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternTraitQuery.html @@ -0,0 +1,39 @@ +InternTraitQuery in fe_analyzer::db - Rust

Struct InternTraitQuery

Source
pub struct InternTraitQuery;

Implementations§

Source§

impl InternTraitQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternTraitQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternTraitQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternTraitQuery

Source§

fn default() -> InternTraitQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternTraitQuery

Source§

const QUERY_INDEX: u16 = 16u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_trait"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Trait>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = TraitId

What value does the query return?
Source§

type Storage = InternedStorage<InternTraitQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternTraitQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternTypeAliasLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternTypeAliasLookupQuery.html new file mode 100644 index 0000000000..cea85ec198 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternTypeAliasLookupQuery.html @@ -0,0 +1,39 @@ +InternTypeAliasLookupQuery in fe_analyzer::db - Rust

Struct InternTypeAliasLookupQuery

Source
pub struct InternTypeAliasLookupQuery;

Implementations§

Source§

impl InternTypeAliasLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternTypeAliasLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternTypeAliasLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternTypeAliasLookupQuery

Source§

fn default() -> InternTypeAliasLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternTypeAliasLookupQuery

Source§

const QUERY_INDEX: u16 = 21u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_type_alias"

Name of the query method (e.g., foo)
Source§

type Key = TypeAliasId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<TypeAlias>

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternTypeAliasLookupQuery, InternTypeAliasQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternTypeAliasLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternTypeAliasQuery.html b/compiler-docs/fe_analyzer/db/struct.InternTypeAliasQuery.html new file mode 100644 index 0000000000..dd604a3c65 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternTypeAliasQuery.html @@ -0,0 +1,39 @@ +InternTypeAliasQuery in fe_analyzer::db - Rust

Struct InternTypeAliasQuery

Source
pub struct InternTypeAliasQuery;

Implementations§

Source§

impl InternTypeAliasQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternTypeAliasQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternTypeAliasQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternTypeAliasQuery

Source§

fn default() -> InternTypeAliasQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternTypeAliasQuery

Source§

const QUERY_INDEX: u16 = 20u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_type_alias"

Name of the query method (e.g., foo)
Source§

type Key = Rc<TypeAlias>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = TypeAliasId

What value does the query return?
Source§

type Storage = InternedStorage<InternTypeAliasQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternTypeAliasQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternTypeLookupQuery.html b/compiler-docs/fe_analyzer/db/struct.InternTypeLookupQuery.html new file mode 100644 index 0000000000..abae3d37ff --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternTypeLookupQuery.html @@ -0,0 +1,39 @@ +InternTypeLookupQuery in fe_analyzer::db - Rust

Struct InternTypeLookupQuery

Source
pub struct InternTypeLookupQuery;

Implementations§

Source§

impl InternTypeLookupQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternTypeLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternTypeLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternTypeLookupQuery

Source§

fn default() -> InternTypeLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternTypeLookupQuery

Source§

const QUERY_INDEX: u16 = 31u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_type"

Name of the query method (e.g., foo)
Source§

type Key = TypeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Type

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternTypeLookupQuery, InternTypeQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternTypeLookupQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.InternTypeQuery.html b/compiler-docs/fe_analyzer/db/struct.InternTypeQuery.html new file mode 100644 index 0000000000..cdfbacab86 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.InternTypeQuery.html @@ -0,0 +1,39 @@ +InternTypeQuery in fe_analyzer::db - Rust

Struct InternTypeQuery

Source
pub struct InternTypeQuery;

Implementations§

Source§

impl InternTypeQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternTypeQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternTypeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternTypeQuery

Source§

fn default() -> InternTypeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternTypeQuery

Source§

const QUERY_INDEX: u16 = 30u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_type"

Name of the query method (e.g., foo)
Source§

type Key = Type

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = TypeId

What value does the query return?
Source§

type Storage = InternedStorage<InternTypeQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternTypeQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleAllImplsQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleAllImplsQuery.html new file mode 100644 index 0000000000..f501748782 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleAllImplsQuery.html @@ -0,0 +1,46 @@ +ModuleAllImplsQuery in fe_analyzer::db - Rust

Struct ModuleAllImplsQuery

Source
pub struct ModuleAllImplsQuery;

Implementations§

Source§

impl ModuleAllImplsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleAllImplsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleAllImplsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleAllImplsQuery

Source§

fn default() -> ModuleAllImplsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleAllImplsQuery

Source§

const QUERY_INDEX: u16 = 41u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_all_impls"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<[ImplId]>>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleAllImplsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleAllImplsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleAllImplsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleAllItemsQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleAllItemsQuery.html new file mode 100644 index 0000000000..925c5f1260 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleAllItemsQuery.html @@ -0,0 +1,46 @@ +ModuleAllItemsQuery in fe_analyzer::db - Rust

Struct ModuleAllItemsQuery

Source
pub struct ModuleAllItemsQuery;

Implementations§

Source§

impl ModuleAllItemsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleAllItemsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleAllItemsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleAllItemsQuery

Source§

fn default() -> ModuleAllItemsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleAllItemsQuery

Source§

const QUERY_INDEX: u16 = 40u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_all_items"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[Item]>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleAllItemsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleAllItemsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleAllItemsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleConstantTypeQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleConstantTypeQuery.html new file mode 100644 index 0000000000..23389c0595 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleConstantTypeQuery.html @@ -0,0 +1,46 @@ +ModuleConstantTypeQuery in fe_analyzer::db - Rust

Struct ModuleConstantTypeQuery

Source
pub struct ModuleConstantTypeQuery;

Implementations§

Source§

impl ModuleConstantTypeQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleConstantTypeQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleConstantTypeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleConstantTypeQuery

Source§

fn default() -> ModuleConstantTypeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleConstantTypeQuery

Source§

const QUERY_INDEX: u16 = 51u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_constant_type"

Name of the query method (e.g., foo)
Source§

type Key = ModuleConstantId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Result<TypeId, TypeError>>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleConstantTypeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleConstantTypeQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleConstantTypeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

Source§

fn recover( + db: &<Self as QueryDb<'_>>::DynDb, + cycle: &[DatabaseKeyIndex], + key0: &<Self as Query>::Key, +) -> Option<<Self as Query>::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleConstantValueQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleConstantValueQuery.html new file mode 100644 index 0000000000..93eddecf14 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleConstantValueQuery.html @@ -0,0 +1,46 @@ +ModuleConstantValueQuery in fe_analyzer::db - Rust

Struct ModuleConstantValueQuery

Source
pub struct ModuleConstantValueQuery;

Implementations§

Source§

impl ModuleConstantValueQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleConstantValueQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleConstantValueQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleConstantValueQuery

Source§

fn default() -> ModuleConstantValueQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleConstantValueQuery

Source§

const QUERY_INDEX: u16 = 52u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_constant_value"

Name of the query method (e.g., foo)
Source§

type Key = ModuleConstantId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Result<Constant, ConstEvalError>>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleConstantValueQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleConstantValueQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleConstantValueQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

Source§

fn recover( + db: &<Self as QueryDb<'_>>::DynDb, + cycle: &[DatabaseKeyIndex], + key0: &<Self as Query>::Key, +) -> Option<<Self as Query>::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleConstantsQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleConstantsQuery.html new file mode 100644 index 0000000000..92ceb862db --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleConstantsQuery.html @@ -0,0 +1,46 @@ +ModuleConstantsQuery in fe_analyzer::db - Rust

Struct ModuleConstantsQuery

Source
pub struct ModuleConstantsQuery;

Implementations§

Source§

impl ModuleConstantsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleConstantsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleConstantsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleConstantsQuery

Source§

fn default() -> ModuleConstantsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleConstantsQuery

Source§

const QUERY_INDEX: u16 = 46u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_constants"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Vec<ModuleConstantId>>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleConstantsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleConstantsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleConstantsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleContractsQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleContractsQuery.html new file mode 100644 index 0000000000..697f53dfcd --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleContractsQuery.html @@ -0,0 +1,46 @@ +ModuleContractsQuery in fe_analyzer::db - Rust

Struct ModuleContractsQuery

Source
pub struct ModuleContractsQuery;

Implementations§

Source§

impl ModuleContractsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleContractsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleContractsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleContractsQuery

Source§

fn default() -> ModuleContractsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleContractsQuery

Source§

const QUERY_INDEX: u16 = 44u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_contracts"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[ContractId]>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleContractsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleContractsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleContractsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleFilePathQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleFilePathQuery.html new file mode 100644 index 0000000000..f39fc1dd50 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleFilePathQuery.html @@ -0,0 +1,46 @@ +ModuleFilePathQuery in fe_analyzer::db - Rust

Struct ModuleFilePathQuery

Source
pub struct ModuleFilePathQuery;

Implementations§

Source§

impl ModuleFilePathQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleFilePathQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleFilePathQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleFilePathQuery

Source§

fn default() -> ModuleFilePathQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleFilePathQuery

Source§

const QUERY_INDEX: u16 = 37u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_file_path"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = SmolStr

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleFilePathQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleFilePathQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleFilePathQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleImplMapQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleImplMapQuery.html new file mode 100644 index 0000000000..440b237414 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleImplMapQuery.html @@ -0,0 +1,46 @@ +ModuleImplMapQuery in fe_analyzer::db - Rust

Struct ModuleImplMapQuery

Source
pub struct ModuleImplMapQuery;

Implementations§

Source§

impl ModuleImplMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleImplMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleImplMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleImplMapQuery

Source§

fn default() -> ModuleImplMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleImplMapQuery

Source§

const QUERY_INDEX: u16 = 43u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_impl_map"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<(TraitId, TypeId), ImplId>>>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleImplMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleImplMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleImplMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleIsIncompleteQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleIsIncompleteQuery.html new file mode 100644 index 0000000000..337224339f --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleIsIncompleteQuery.html @@ -0,0 +1,46 @@ +ModuleIsIncompleteQuery in fe_analyzer::db - Rust

Struct ModuleIsIncompleteQuery

Source
pub struct ModuleIsIncompleteQuery;

Implementations§

Source§

impl ModuleIsIncompleteQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleIsIncompleteQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleIsIncompleteQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleIsIncompleteQuery

Source§

fn default() -> ModuleIsIncompleteQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleIsIncompleteQuery

Source§

const QUERY_INDEX: u16 = 39u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_is_incomplete"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = bool

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleIsIncompleteQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleIsIncompleteQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleIsIncompleteQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleItemMapQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleItemMapQuery.html new file mode 100644 index 0000000000..372d641cda --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleItemMapQuery.html @@ -0,0 +1,46 @@ +ModuleItemMapQuery in fe_analyzer::db - Rust

Struct ModuleItemMapQuery

Source
pub struct ModuleItemMapQuery;

Implementations§

Source§

impl ModuleItemMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleItemMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleItemMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleItemMapQuery

Source§

fn default() -> ModuleItemMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleItemMapQuery

Source§

const QUERY_INDEX: u16 = 42u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_item_map"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, Item>>>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleItemMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleItemMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleItemMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleParentModuleQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleParentModuleQuery.html new file mode 100644 index 0000000000..5ad1595697 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleParentModuleQuery.html @@ -0,0 +1,46 @@ +ModuleParentModuleQuery in fe_analyzer::db - Rust

Struct ModuleParentModuleQuery

Source
pub struct ModuleParentModuleQuery;

Implementations§

Source§

impl ModuleParentModuleQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleParentModuleQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleParentModuleQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleParentModuleQuery

Source§

fn default() -> ModuleParentModuleQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleParentModuleQuery

Source§

const QUERY_INDEX: u16 = 48u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_parent_module"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Option<ModuleId>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleParentModuleQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleParentModuleQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleParentModuleQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleParseQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleParseQuery.html new file mode 100644 index 0000000000..7ac5786ef4 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleParseQuery.html @@ -0,0 +1,46 @@ +ModuleParseQuery in fe_analyzer::db - Rust

Struct ModuleParseQuery

Source
pub struct ModuleParseQuery;

Implementations§

Source§

impl ModuleParseQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleParseQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleParseQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleParseQuery

Source§

fn default() -> ModuleParseQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleParseQuery

Source§

const QUERY_INDEX: u16 = 38u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_parse"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<Module>>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleParseQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleParseQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleParseQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleStructsQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleStructsQuery.html new file mode 100644 index 0000000000..61a9313f0c --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleStructsQuery.html @@ -0,0 +1,46 @@ +ModuleStructsQuery in fe_analyzer::db - Rust

Struct ModuleStructsQuery

Source
pub struct ModuleStructsQuery;

Implementations§

Source§

impl ModuleStructsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleStructsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleStructsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleStructsQuery

Source§

fn default() -> ModuleStructsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleStructsQuery

Source§

const QUERY_INDEX: u16 = 45u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_structs"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[StructId]>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleStructsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleStructsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleStructsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleSubmodulesQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleSubmodulesQuery.html new file mode 100644 index 0000000000..0458e651e5 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleSubmodulesQuery.html @@ -0,0 +1,46 @@ +ModuleSubmodulesQuery in fe_analyzer::db - Rust

Struct ModuleSubmodulesQuery

Source
pub struct ModuleSubmodulesQuery;

Implementations§

Source§

impl ModuleSubmodulesQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleSubmodulesQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleSubmodulesQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleSubmodulesQuery

Source§

fn default() -> ModuleSubmodulesQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleSubmodulesQuery

Source§

const QUERY_INDEX: u16 = 49u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_submodules"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[ModuleId]>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleSubmodulesQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleSubmodulesQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleSubmodulesQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleTestsQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleTestsQuery.html new file mode 100644 index 0000000000..8a17c81cda --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleTestsQuery.html @@ -0,0 +1,46 @@ +ModuleTestsQuery in fe_analyzer::db - Rust

Struct ModuleTestsQuery

Source
pub struct ModuleTestsQuery;

Implementations§

Source§

impl ModuleTestsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleTestsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleTestsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleTestsQuery

Source§

fn default() -> ModuleTestsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleTestsQuery

Source§

const QUERY_INDEX: u16 = 50u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_tests"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Vec<FunctionId>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleTestsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleTestsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleTestsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.ModuleUsedItemMapQuery.html b/compiler-docs/fe_analyzer/db/struct.ModuleUsedItemMapQuery.html new file mode 100644 index 0000000000..2642ffd162 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.ModuleUsedItemMapQuery.html @@ -0,0 +1,46 @@ +ModuleUsedItemMapQuery in fe_analyzer::db - Rust

Struct ModuleUsedItemMapQuery

Source
pub struct ModuleUsedItemMapQuery;

Implementations§

Source§

impl ModuleUsedItemMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl ModuleUsedItemMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for ModuleUsedItemMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleUsedItemMapQuery

Source§

fn default() -> ModuleUsedItemMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for ModuleUsedItemMapQuery

Source§

const QUERY_INDEX: u16 = 47u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "module_used_item_map"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>>

What value does the query return?
Source§

type Storage = DerivedStorage<ModuleUsedItemMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for ModuleUsedItemMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for ModuleUsedItemMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.RootIngotQuery.html b/compiler-docs/fe_analyzer/db/struct.RootIngotQuery.html new file mode 100644 index 0000000000..b021fefef6 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.RootIngotQuery.html @@ -0,0 +1,39 @@ +RootIngotQuery in fe_analyzer::db - Rust

Struct RootIngotQuery

Source
pub struct RootIngotQuery;

Implementations§

Source§

impl RootIngotQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl RootIngotQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for RootIngotQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RootIngotQuery

Source§

fn default() -> RootIngotQuery

Returns the “default value” for a type. Read more
Source§

impl Query for RootIngotQuery

Source§

const QUERY_INDEX: u16 = 34u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "root_ingot"

Name of the query method (e.g., foo)
Source§

type Key = ()

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = IngotId

What value does the query return?
Source§

type Storage = InputStorage<RootIngotQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for RootIngotQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.StructAllFieldsQuery.html b/compiler-docs/fe_analyzer/db/struct.StructAllFieldsQuery.html new file mode 100644 index 0000000000..ff756b032a --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.StructAllFieldsQuery.html @@ -0,0 +1,46 @@ +StructAllFieldsQuery in fe_analyzer::db - Rust

Struct StructAllFieldsQuery

Source
pub struct StructAllFieldsQuery;

Implementations§

Source§

impl StructAllFieldsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl StructAllFieldsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for StructAllFieldsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StructAllFieldsQuery

Source§

fn default() -> StructAllFieldsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for StructAllFieldsQuery

Source§

const QUERY_INDEX: u16 = 66u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "struct_all_fields"

Name of the query method (e.g., foo)
Source§

type Key = StructId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[StructFieldId]>

What value does the query return?
Source§

type Storage = DerivedStorage<StructAllFieldsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for StructAllFieldsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for StructAllFieldsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.StructAllFunctionsQuery.html b/compiler-docs/fe_analyzer/db/struct.StructAllFunctionsQuery.html new file mode 100644 index 0000000000..2ee9aab29c --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.StructAllFunctionsQuery.html @@ -0,0 +1,46 @@ +StructAllFunctionsQuery in fe_analyzer::db - Rust

Struct StructAllFunctionsQuery

Source
pub struct StructAllFunctionsQuery;

Implementations§

Source§

impl StructAllFunctionsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl StructAllFunctionsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for StructAllFunctionsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StructAllFunctionsQuery

Source§

fn default() -> StructAllFunctionsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for StructAllFunctionsQuery

Source§

const QUERY_INDEX: u16 = 69u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "struct_all_functions"

Name of the query method (e.g., foo)
Source§

type Key = StructId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[FunctionId]>

What value does the query return?
Source§

type Storage = DerivedStorage<StructAllFunctionsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for StructAllFunctionsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for StructAllFunctionsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.StructDependencyGraphQuery.html b/compiler-docs/fe_analyzer/db/struct.StructDependencyGraphQuery.html new file mode 100644 index 0000000000..6b72d2e3f3 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.StructDependencyGraphQuery.html @@ -0,0 +1,46 @@ +StructDependencyGraphQuery in fe_analyzer::db - Rust

Struct StructDependencyGraphQuery

Source
pub struct StructDependencyGraphQuery;

Implementations§

Source§

impl StructDependencyGraphQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl StructDependencyGraphQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for StructDependencyGraphQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StructDependencyGraphQuery

Source§

fn default() -> StructDependencyGraphQuery

Returns the “default value” for a type. Read more
Source§

impl Query for StructDependencyGraphQuery

Source§

const QUERY_INDEX: u16 = 71u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "struct_dependency_graph"

Name of the query method (e.g., foo)
Source§

type Key = StructId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<DepGraphWrapper>

What value does the query return?
Source§

type Storage = DerivedStorage<StructDependencyGraphQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for StructDependencyGraphQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for StructDependencyGraphQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

Source§

fn recover( + db: &<Self as QueryDb<'_>>::DynDb, + cycle: &[DatabaseKeyIndex], + key0: &<Self as Query>::Key, +) -> Option<<Self as Query>::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.StructFieldMapQuery.html b/compiler-docs/fe_analyzer/db/struct.StructFieldMapQuery.html new file mode 100644 index 0000000000..bd43bbb173 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.StructFieldMapQuery.html @@ -0,0 +1,46 @@ +StructFieldMapQuery in fe_analyzer::db - Rust

Struct StructFieldMapQuery

Source
pub struct StructFieldMapQuery;

Implementations§

Source§

impl StructFieldMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl StructFieldMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for StructFieldMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StructFieldMapQuery

Source§

fn default() -> StructFieldMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for StructFieldMapQuery

Source§

const QUERY_INDEX: u16 = 67u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "struct_field_map"

Name of the query method (e.g., foo)
Source§

type Key = StructId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, StructFieldId>>>

What value does the query return?
Source§

type Storage = DerivedStorage<StructFieldMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for StructFieldMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for StructFieldMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.StructFieldTypeQuery.html b/compiler-docs/fe_analyzer/db/struct.StructFieldTypeQuery.html new file mode 100644 index 0000000000..75ed50ad53 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.StructFieldTypeQuery.html @@ -0,0 +1,46 @@ +StructFieldTypeQuery in fe_analyzer::db - Rust

Struct StructFieldTypeQuery

Source
pub struct StructFieldTypeQuery;

Implementations§

Source§

impl StructFieldTypeQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl StructFieldTypeQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for StructFieldTypeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StructFieldTypeQuery

Source§

fn default() -> StructFieldTypeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for StructFieldTypeQuery

Source§

const QUERY_INDEX: u16 = 68u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "struct_field_type"

Name of the query method (e.g., foo)
Source§

type Key = StructFieldId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Result<TypeId, TypeError>>

What value does the query return?
Source§

type Storage = DerivedStorage<StructFieldTypeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for StructFieldTypeQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for StructFieldTypeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.StructFunctionMapQuery.html b/compiler-docs/fe_analyzer/db/struct.StructFunctionMapQuery.html new file mode 100644 index 0000000000..dcdc45f88d --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.StructFunctionMapQuery.html @@ -0,0 +1,46 @@ +StructFunctionMapQuery in fe_analyzer::db - Rust

Struct StructFunctionMapQuery

Source
pub struct StructFunctionMapQuery;

Implementations§

Source§

impl StructFunctionMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl StructFunctionMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for StructFunctionMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StructFunctionMapQuery

Source§

fn default() -> StructFunctionMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for StructFunctionMapQuery

Source§

const QUERY_INDEX: u16 = 70u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "struct_function_map"

Name of the query method (e.g., foo)
Source§

type Key = StructId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

What value does the query return?
Source§

type Storage = DerivedStorage<StructFunctionMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for StructFunctionMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for StructFunctionMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.TestDb.html b/compiler-docs/fe_analyzer/db/struct.TestDb.html new file mode 100644 index 0000000000..62de4a0f87 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.TestDb.html @@ -0,0 +1,123 @@ +TestDb in fe_analyzer::db - Rust

Struct TestDb

Source
pub struct TestDb { /* private fields */ }

Trait Implementations§

Source§

impl Database for TestDb

§

fn sweep_all(&self, strategy: SweepStrategy)

Iterates through all query storage and removes any values that +have not been used since the last revision was created. The +intended use-cycle is that you first execute all of your +“main” queries; this will ensure that all query values they +consume are marked as used. You then invoke this method to +remove other values that were not needed for your main query +results.
§

fn salsa_event(&self, event_fn: Event)

This function is invoked at key points in the salsa +runtime. It permits the database to be customized and to +inject logging or other custom behavior.
§

fn on_propagated_panic(&self) -> !

This function is invoked when a dependent query is being computed by the +other thread, and that thread panics.
§

fn salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.
§

fn salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.
Source§

impl DatabaseOps for TestDb

Source§

fn ops_database(&self) -> &dyn Database

Upcast this type to a dyn Database.
Source§

fn ops_salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.
Source§

fn ops_salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.
Source§

fn fmt_index(&self, input: DatabaseKeyIndex, fmt: &mut Formatter<'_>) -> Result

Formats a database key index in a human readable fashion.
Source§

fn maybe_changed_since( + &self, + input: DatabaseKeyIndex, + revision: Revision, +) -> bool

True if the computed value for input may have changed since revision.
Source§

fn for_each_query(&self, op: &mut dyn FnMut(&dyn QueryStorageMassOps))

Executes the callback for each kind of query.
Source§

impl DatabaseStorageTypes for TestDb

Source§

type DatabaseStorage = __SalsaDatabaseStorage

Defines the “storage type”, where all the query data is kept. +This type is defined by the database_storage macro.
Source§

impl Default for TestDb

Source§

fn default() -> TestDb

Returns the “default value” for a type. Read more
Source§

impl HasQueryGroup<AnalyzerDbStorage> for TestDb

Source§

fn group_storage(&self) -> &<AnalyzerDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl HasQueryGroup<SourceDbStorage> for TestDb

Source§

fn group_storage(&self) -> &<SourceDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl Upcast<dyn SourceDb> for TestDb

Source§

fn upcast(&self) -> &(dyn SourceDb + 'static)

Source§

impl UpcastMut<dyn SourceDb> for TestDb

Source§

fn upcast_mut(&mut self) -> &mut (dyn SourceDb + 'static)

Auto Trait Implementations§

§

impl !Freeze for TestDb

§

impl RefUnwindSafe for TestDb

§

impl !Send for TestDb

§

impl !Sync for TestDb

§

impl Unpin for TestDb

§

impl UnwindSafe for TestDb

Blanket Implementations§

Source§

impl<DB> AnalyzerDb for DB
where + DB: SourceDb + Upcast<dyn SourceDb> + UpcastMut<dyn SourceDb> + Database + HasQueryGroup<AnalyzerDbStorage>,

Source§

fn intern_ingot(&self, key0: Rc<Ingot>) -> IngotId

Source§

fn lookup_intern_ingot(&self, key0: IngotId) -> Rc<Ingot>

Source§

fn intern_module(&self, key0: Rc<Module>) -> ModuleId

Source§

fn lookup_intern_module(&self, key0: ModuleId) -> Rc<Module>

Source§

fn intern_module_const(&self, key0: Rc<ModuleConstant>) -> ModuleConstantId

Source§

fn lookup_intern_module_const( + &self, + key0: ModuleConstantId, +) -> Rc<ModuleConstant>

Source§

fn intern_struct(&self, key0: Rc<Struct>) -> StructId

Source§

fn lookup_intern_struct(&self, key0: StructId) -> Rc<Struct>

Source§

fn intern_struct_field(&self, key0: Rc<StructField>) -> StructFieldId

Source§

fn lookup_intern_struct_field(&self, key0: StructFieldId) -> Rc<StructField>

Source§

fn intern_enum(&self, key0: Rc<Enum>) -> EnumId

Source§

fn lookup_intern_enum(&self, key0: EnumId) -> Rc<Enum>

Source§

fn intern_attribute(&self, key0: Rc<Attribute>) -> AttributeId

Source§

fn lookup_intern_attribute(&self, key0: AttributeId) -> Rc<Attribute>

Source§

fn intern_enum_variant(&self, key0: Rc<EnumVariant>) -> EnumVariantId

Source§

fn lookup_intern_enum_variant(&self, key0: EnumVariantId) -> Rc<EnumVariant>

Source§

fn intern_trait(&self, key0: Rc<Trait>) -> TraitId

Source§

fn lookup_intern_trait(&self, key0: TraitId) -> Rc<Trait>

Source§

fn intern_impl(&self, key0: Rc<Impl>) -> ImplId

Source§

fn lookup_intern_impl(&self, key0: ImplId) -> Rc<Impl>

Source§

fn intern_type_alias(&self, key0: Rc<TypeAlias>) -> TypeAliasId

Source§

fn lookup_intern_type_alias(&self, key0: TypeAliasId) -> Rc<TypeAlias>

Source§

fn intern_contract(&self, key0: Rc<Contract>) -> ContractId

Source§

fn lookup_intern_contract(&self, key0: ContractId) -> Rc<Contract>

Source§

fn intern_contract_field(&self, key0: Rc<ContractField>) -> ContractFieldId

Source§

fn lookup_intern_contract_field( + &self, + key0: ContractFieldId, +) -> Rc<ContractField>

Source§

fn intern_function_sig(&self, key0: Rc<FunctionSig>) -> FunctionSigId

Source§

fn lookup_intern_function_sig(&self, key0: FunctionSigId) -> Rc<FunctionSig>

Source§

fn intern_function(&self, key0: Rc<Function>) -> FunctionId

Source§

fn lookup_intern_function(&self, key0: FunctionId) -> Rc<Function>

Source§

fn intern_type(&self, key0: Type) -> TypeId

Source§

fn lookup_intern_type(&self, key0: TypeId) -> Type

Source§

fn ingot_files(&self, key0: IngotId) -> Rc<[SourceFileId]>

Source§

fn set_ingot_files(&mut self, key0: IngotId, value__: Rc<[SourceFileId]>)

Set the value of the ingot_files input. Read more
Source§

fn set_ingot_files_with_durability( + &mut self, + key0: IngotId, + value__: Rc<[SourceFileId]>, + durability__: Durability, +)

Set the value of the ingot_files input and promise +that its value will never change again. Read more
Source§

fn ingot_external_ingots(&self, key0: IngotId) -> Rc<IndexMap<SmolStr, IngotId>>

Source§

fn set_ingot_external_ingots( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, +)

Set the value of the ingot_external_ingots input. Read more
Source§

fn set_ingot_external_ingots_with_durability( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, + durability__: Durability, +)

Set the value of the ingot_external_ingots input and promise +that its value will never change again. Read more
Source§

fn root_ingot(&self) -> IngotId

Source§

fn set_root_ingot(&mut self, value__: IngotId)

Set the value of the root_ingot input. Read more
Source§

fn set_root_ingot_with_durability( + &mut self, + value__: IngotId, + durability__: Durability, +)

Set the value of the root_ingot input and promise +that its value will never change again. Read more
Source§

fn ingot_modules(&self, key0: IngotId) -> Rc<[ModuleId]>

Source§

fn ingot_root_module(&self, key0: IngotId) -> Option<ModuleId>

Source§

fn module_file_path(&self, key0: ModuleId) -> SmolStr

Source§

fn module_parse(&self, key0: ModuleId) -> Analysis<Rc<Module>>

Source§

fn module_is_incomplete(&self, key0: ModuleId) -> bool

Source§

fn module_all_items(&self, key0: ModuleId) -> Rc<[Item]>

Source§

fn module_all_impls(&self, key0: ModuleId) -> Analysis<Rc<[ImplId]>>

Source§

fn module_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, Item>>>

Source§

fn module_impl_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<(TraitId, TypeId), ImplId>>>

Source§

fn module_contracts(&self, key0: ModuleId) -> Rc<[ContractId]>

Source§

fn module_structs(&self, key0: ModuleId) -> Rc<[StructId]>

Source§

fn module_constants(&self, key0: ModuleId) -> Rc<Vec<ModuleConstantId>>

Source§

fn module_used_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>>

Source§

fn module_parent_module(&self, key0: ModuleId) -> Option<ModuleId>

Source§

fn module_submodules(&self, key0: ModuleId) -> Rc<[ModuleId]>

Source§

fn module_tests(&self, key0: ModuleId) -> Vec<FunctionId>

Source§

fn module_constant_type( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<TypeId, TypeError>>

Source§

fn module_constant_value( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<Constant, ConstEvalError>>

Source§

fn contract_all_functions(&self, key0: ContractId) -> Rc<[FunctionId]>

Source§

fn contract_function_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

Source§

fn contract_public_function_map( + &self, + key0: ContractId, +) -> Rc<IndexMap<SmolStr, FunctionId>>

Source§

fn contract_init_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

Source§

fn contract_call_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

Source§

fn contract_all_fields(&self, key0: ContractId) -> Rc<[ContractFieldId]>

Source§

fn contract_field_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, ContractFieldId>>>

Source§

fn contract_field_type( + &self, + key0: ContractFieldId, +) -> Analysis<Result<TypeId, TypeError>>

Source§

fn contract_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

Source§

fn contract_runtime_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

Source§

fn function_signature( + &self, + key0: FunctionSigId, +) -> Analysis<Rc<FunctionSignature>>

Source§

fn function_body(&self, key0: FunctionId) -> Analysis<Rc<FunctionBody>>

Source§

fn function_dependency_graph(&self, key0: FunctionId) -> DepGraphWrapper

Source§

fn struct_all_fields(&self, key0: StructId) -> Rc<[StructFieldId]>

Source§

fn struct_field_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, StructFieldId>>>

Source§

fn struct_field_type( + &self, + key0: StructFieldId, +) -> Analysis<Result<TypeId, TypeError>>

Source§

fn struct_all_functions(&self, key0: StructId) -> Rc<[FunctionId]>

Source§

fn struct_function_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

Source§

fn struct_dependency_graph(&self, key0: StructId) -> Analysis<DepGraphWrapper>

Source§

fn enum_all_variants(&self, key0: EnumId) -> Rc<[EnumVariantId]>

Source§

fn enum_variant_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, EnumVariantId>>>

Source§

fn enum_all_functions(&self, key0: EnumId) -> Rc<[FunctionId]>

Source§

fn enum_function_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

Source§

fn enum_dependency_graph(&self, key0: EnumId) -> Analysis<DepGraphWrapper>

Source§

fn enum_variant_kind( + &self, + key0: EnumVariantId, +) -> Analysis<Result<EnumVariantKind, TypeError>>

Source§

fn trait_all_functions(&self, key0: TraitId) -> Rc<[FunctionSigId]>

Source§

fn trait_function_map( + &self, + key0: TraitId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionSigId>>>

Source§

fn trait_is_implemented_for(&self, key0: TraitId, key1: TypeId) -> bool

Source§

fn impl_all_functions(&self, key0: ImplId) -> Rc<[FunctionId]>

Source§

fn impl_function_map( + &self, + key0: ImplId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

Source§

fn all_impls(&self, key0: TypeId) -> Rc<[ImplId]>

Source§

fn impl_for(&self, key0: TypeId, key1: TraitId) -> Option<ImplId>

Source§

fn function_sigs(&self, key0: TypeId, key1: SmolStr) -> Rc<[FunctionSigId]>

Source§

fn type_alias_type( + &self, + key0: TypeAliasId, +) -> Analysis<Result<TypeId, TypeError>>

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<DB> SourceDb for DB
where + DB: Database + HasQueryGroup<SourceDbStorage>,

Source§

fn intern_file(&self, key0: File) -> SourceFileId

Source§

fn lookup_intern_file(&self, key0: SourceFileId) -> File

Source§

fn file_content(&self, key0: SourceFileId) -> Rc<str>

Set with `fn set_file_content(&mut self, file: SourceFileId, content: Rc)
Source§

fn set_file_content(&mut self, key0: SourceFileId, value__: Rc<str>)

Set the value of the file_content input. Read more
Source§

fn set_file_content_with_durability( + &mut self, + key0: SourceFileId, + value__: Rc<str>, + durability__: Durability, +)

Set the value of the file_content input and promise +that its value will never change again. Read more
Source§

fn file_line_starts(&self, key0: SourceFileId) -> Rc<[usize]>

Source§

fn file_name(&self, key0: SourceFileId) -> SmolStr

Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.TraitAllFunctionsQuery.html b/compiler-docs/fe_analyzer/db/struct.TraitAllFunctionsQuery.html new file mode 100644 index 0000000000..77b9992e5d --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.TraitAllFunctionsQuery.html @@ -0,0 +1,46 @@ +TraitAllFunctionsQuery in fe_analyzer::db - Rust

Struct TraitAllFunctionsQuery

Source
pub struct TraitAllFunctionsQuery;

Implementations§

Source§

impl TraitAllFunctionsQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl TraitAllFunctionsQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for TraitAllFunctionsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TraitAllFunctionsQuery

Source§

fn default() -> TraitAllFunctionsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for TraitAllFunctionsQuery

Source§

const QUERY_INDEX: u16 = 78u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "trait_all_functions"

Name of the query method (e.g., foo)
Source§

type Key = TraitId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[FunctionSigId]>

What value does the query return?
Source§

type Storage = DerivedStorage<TraitAllFunctionsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for TraitAllFunctionsQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for TraitAllFunctionsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.TraitFunctionMapQuery.html b/compiler-docs/fe_analyzer/db/struct.TraitFunctionMapQuery.html new file mode 100644 index 0000000000..cb07bdd92e --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.TraitFunctionMapQuery.html @@ -0,0 +1,46 @@ +TraitFunctionMapQuery in fe_analyzer::db - Rust

Struct TraitFunctionMapQuery

Source
pub struct TraitFunctionMapQuery;

Implementations§

Source§

impl TraitFunctionMapQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl TraitFunctionMapQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for TraitFunctionMapQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TraitFunctionMapQuery

Source§

fn default() -> TraitFunctionMapQuery

Returns the “default value” for a type. Read more
Source§

impl Query for TraitFunctionMapQuery

Source§

const QUERY_INDEX: u16 = 79u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "trait_function_map"

Name of the query method (e.g., foo)
Source§

type Key = TraitId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Rc<IndexMap<SmolStr, FunctionSigId>>>

What value does the query return?
Source§

type Storage = DerivedStorage<TraitFunctionMapQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for TraitFunctionMapQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for TraitFunctionMapQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.TraitIsImplementedForQuery.html b/compiler-docs/fe_analyzer/db/struct.TraitIsImplementedForQuery.html new file mode 100644 index 0000000000..e5725533bf --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.TraitIsImplementedForQuery.html @@ -0,0 +1,46 @@ +TraitIsImplementedForQuery in fe_analyzer::db - Rust

Struct TraitIsImplementedForQuery

Source
pub struct TraitIsImplementedForQuery;

Implementations§

Source§

impl TraitIsImplementedForQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl TraitIsImplementedForQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for TraitIsImplementedForQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TraitIsImplementedForQuery

Source§

fn default() -> TraitIsImplementedForQuery

Returns the “default value” for a type. Read more
Source§

impl Query for TraitIsImplementedForQuery

Source§

const QUERY_INDEX: u16 = 80u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "trait_is_implemented_for"

Name of the query method (e.g., foo)
Source§

type Key = (TraitId, TypeId)

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = bool

What value does the query return?
Source§

type Storage = DerivedStorage<TraitIsImplementedForQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for TraitIsImplementedForQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for TraitIsImplementedForQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + (key0, key1): <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/struct.TypeAliasTypeQuery.html b/compiler-docs/fe_analyzer/db/struct.TypeAliasTypeQuery.html new file mode 100644 index 0000000000..3531c7dd71 --- /dev/null +++ b/compiler-docs/fe_analyzer/db/struct.TypeAliasTypeQuery.html @@ -0,0 +1,46 @@ +TypeAliasTypeQuery in fe_analyzer::db - Rust

Struct TypeAliasTypeQuery

Source
pub struct TypeAliasTypeQuery;

Implementations§

Source§

impl TypeAliasTypeQuery

Source

pub fn in_db(self, db: &dyn AnalyzerDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl TypeAliasTypeQuery

Source

pub fn in_db_mut(self, db: &mut dyn AnalyzerDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for TypeAliasTypeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TypeAliasTypeQuery

Source§

fn default() -> TypeAliasTypeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for TypeAliasTypeQuery

Source§

const QUERY_INDEX: u16 = 86u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "type_alias_type"

Name of the query method (e.g., foo)
Source§

type Key = TypeAliasId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Analysis<Result<TypeId, TypeError>>

What value does the query return?
Source§

type Storage = DerivedStorage<TypeAliasTypeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for TypeAliasTypeQuery

Source§

type DynDb = dyn AnalyzerDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = AnalyzerDbStorage

Associate query group struct.
Source§

type GroupStorage = AnalyzerDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for TypeAliasTypeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

Source§

fn recover( + db: &<Self as QueryDb<'_>>::DynDb, + cycle: &[DatabaseKeyIndex], + key0: &<Self as Query>::Key, +) -> Option<<Self as Query>::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/db/trait.AnalyzerDb.html b/compiler-docs/fe_analyzer/db/trait.AnalyzerDb.html new file mode 100644 index 0000000000..9845da493b --- /dev/null +++ b/compiler-docs/fe_analyzer/db/trait.AnalyzerDb.html @@ -0,0 +1,318 @@ +AnalyzerDb in fe_analyzer::db - Rust

Trait AnalyzerDb

Source
pub trait AnalyzerDb:
+    Database
+    + HasQueryGroup<AnalyzerDbStorage>
+    + SourceDb
+    + Upcast<dyn SourceDb>
+    + UpcastMut<dyn SourceDb> {
+
Show 93 methods // Required methods + fn intern_ingot(&self, key0: Rc<Ingot>) -> IngotId; + fn lookup_intern_ingot(&self, key0: IngotId) -> Rc<Ingot>; + fn intern_module(&self, key0: Rc<Module>) -> ModuleId; + fn lookup_intern_module(&self, key0: ModuleId) -> Rc<Module>; + fn intern_module_const(&self, key0: Rc<ModuleConstant>) -> ModuleConstantId; + fn lookup_intern_module_const( + &self, + key0: ModuleConstantId, + ) -> Rc<ModuleConstant>; + fn intern_struct(&self, key0: Rc<Struct>) -> StructId; + fn lookup_intern_struct(&self, key0: StructId) -> Rc<Struct>; + fn intern_struct_field(&self, key0: Rc<StructField>) -> StructFieldId; + fn lookup_intern_struct_field(&self, key0: StructFieldId) -> Rc<StructField>; + fn intern_enum(&self, key0: Rc<Enum>) -> EnumId; + fn lookup_intern_enum(&self, key0: EnumId) -> Rc<Enum>; + fn intern_attribute(&self, key0: Rc<Attribute>) -> AttributeId; + fn lookup_intern_attribute(&self, key0: AttributeId) -> Rc<Attribute>; + fn intern_enum_variant(&self, key0: Rc<EnumVariant>) -> EnumVariantId; + fn lookup_intern_enum_variant(&self, key0: EnumVariantId) -> Rc<EnumVariant>; + fn intern_trait(&self, key0: Rc<Trait>) -> TraitId; + fn lookup_intern_trait(&self, key0: TraitId) -> Rc<Trait>; + fn intern_impl(&self, key0: Rc<Impl>) -> ImplId; + fn lookup_intern_impl(&self, key0: ImplId) -> Rc<Impl>; + fn intern_type_alias(&self, key0: Rc<TypeAlias>) -> TypeAliasId; + fn lookup_intern_type_alias(&self, key0: TypeAliasId) -> Rc<TypeAlias>; + fn intern_contract(&self, key0: Rc<Contract>) -> ContractId; + fn lookup_intern_contract(&self, key0: ContractId) -> Rc<Contract>; + fn intern_contract_field(&self, key0: Rc<ContractField>) -> ContractFieldId; + fn lookup_intern_contract_field( + &self, + key0: ContractFieldId, + ) -> Rc<ContractField>; + fn intern_function_sig(&self, key0: Rc<FunctionSig>) -> FunctionSigId; + fn lookup_intern_function_sig(&self, key0: FunctionSigId) -> Rc<FunctionSig>; + fn intern_function(&self, key0: Rc<Function>) -> FunctionId; + fn lookup_intern_function(&self, key0: FunctionId) -> Rc<Function>; + fn intern_type(&self, key0: Type) -> TypeId; + fn lookup_intern_type(&self, key0: TypeId) -> Type; + fn ingot_files(&self, key0: IngotId) -> Rc<[SourceFileId]>; + fn set_ingot_files(&mut self, key0: IngotId, value__: Rc<[SourceFileId]>); + fn set_ingot_files_with_durability( + &mut self, + key0: IngotId, + value__: Rc<[SourceFileId]>, + durability__: Durability, + ); + fn ingot_external_ingots( + &self, + key0: IngotId, + ) -> Rc<IndexMap<SmolStr, IngotId>>; + fn set_ingot_external_ingots( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, + ); + fn set_ingot_external_ingots_with_durability( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, + durability__: Durability, + ); + fn root_ingot(&self) -> IngotId; + fn set_root_ingot(&mut self, value__: IngotId); + fn set_root_ingot_with_durability( + &mut self, + value__: IngotId, + durability__: Durability, + ); + fn ingot_modules(&self, key0: IngotId) -> Rc<[ModuleId]>; + fn ingot_root_module(&self, key0: IngotId) -> Option<ModuleId>; + fn module_file_path(&self, key0: ModuleId) -> SmolStr; + fn module_parse(&self, key0: ModuleId) -> Analysis<Rc<Module>>; + fn module_is_incomplete(&self, key0: ModuleId) -> bool; + fn module_all_items(&self, key0: ModuleId) -> Rc<[Item]>; + fn module_all_impls(&self, key0: ModuleId) -> Analysis<Rc<[ImplId]>>; + fn module_item_map( + &self, + key0: ModuleId, + ) -> Analysis<Rc<IndexMap<SmolStr, Item>>>; + fn module_impl_map( + &self, + key0: ModuleId, + ) -> Analysis<Rc<IndexMap<(TraitId, TypeId), ImplId>>>; + fn module_contracts(&self, key0: ModuleId) -> Rc<[ContractId]>; + fn module_structs(&self, key0: ModuleId) -> Rc<[StructId]>; + fn module_constants(&self, key0: ModuleId) -> Rc<Vec<ModuleConstantId>>; + fn module_used_item_map( + &self, + key0: ModuleId, + ) -> Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>>; + fn module_parent_module(&self, key0: ModuleId) -> Option<ModuleId>; + fn module_submodules(&self, key0: ModuleId) -> Rc<[ModuleId]>; + fn module_tests(&self, key0: ModuleId) -> Vec<FunctionId>; + fn module_constant_type( + &self, + key0: ModuleConstantId, + ) -> Analysis<Result<TypeId, TypeError>>; + fn module_constant_value( + &self, + key0: ModuleConstantId, + ) -> Analysis<Result<Constant, ConstEvalError>>; + fn contract_all_functions(&self, key0: ContractId) -> Rc<[FunctionId]>; + fn contract_function_map( + &self, + key0: ContractId, + ) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>; + fn contract_public_function_map( + &self, + key0: ContractId, + ) -> Rc<IndexMap<SmolStr, FunctionId>>; + fn contract_init_function( + &self, + key0: ContractId, + ) -> Analysis<Option<FunctionId>>; + fn contract_call_function( + &self, + key0: ContractId, + ) -> Analysis<Option<FunctionId>>; + fn contract_all_fields(&self, key0: ContractId) -> Rc<[ContractFieldId]>; + fn contract_field_map( + &self, + key0: ContractId, + ) -> Analysis<Rc<IndexMap<SmolStr, ContractFieldId>>>; + fn contract_field_type( + &self, + key0: ContractFieldId, + ) -> Analysis<Result<TypeId, TypeError>>; + fn contract_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper; + fn contract_runtime_dependency_graph( + &self, + key0: ContractId, + ) -> DepGraphWrapper; + fn function_signature( + &self, + key0: FunctionSigId, + ) -> Analysis<Rc<FunctionSignature>>; + fn function_body(&self, key0: FunctionId) -> Analysis<Rc<FunctionBody>>; + fn function_dependency_graph(&self, key0: FunctionId) -> DepGraphWrapper; + fn struct_all_fields(&self, key0: StructId) -> Rc<[StructFieldId]>; + fn struct_field_map( + &self, + key0: StructId, + ) -> Analysis<Rc<IndexMap<SmolStr, StructFieldId>>>; + fn struct_field_type( + &self, + key0: StructFieldId, + ) -> Analysis<Result<TypeId, TypeError>>; + fn struct_all_functions(&self, key0: StructId) -> Rc<[FunctionId]>; + fn struct_function_map( + &self, + key0: StructId, + ) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>; + fn struct_dependency_graph( + &self, + key0: StructId, + ) -> Analysis<DepGraphWrapper>; + fn enum_all_variants(&self, key0: EnumId) -> Rc<[EnumVariantId]>; + fn enum_variant_map( + &self, + key0: EnumId, + ) -> Analysis<Rc<IndexMap<SmolStr, EnumVariantId>>>; + fn enum_all_functions(&self, key0: EnumId) -> Rc<[FunctionId]>; + fn enum_function_map( + &self, + key0: EnumId, + ) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>; + fn enum_dependency_graph(&self, key0: EnumId) -> Analysis<DepGraphWrapper>; + fn enum_variant_kind( + &self, + key0: EnumVariantId, + ) -> Analysis<Result<EnumVariantKind, TypeError>>; + fn trait_all_functions(&self, key0: TraitId) -> Rc<[FunctionSigId]>; + fn trait_function_map( + &self, + key0: TraitId, + ) -> Analysis<Rc<IndexMap<SmolStr, FunctionSigId>>>; + fn trait_is_implemented_for(&self, key0: TraitId, key1: TypeId) -> bool; + fn impl_all_functions(&self, key0: ImplId) -> Rc<[FunctionId]>; + fn impl_function_map( + &self, + key0: ImplId, + ) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>; + fn all_impls(&self, key0: TypeId) -> Rc<[ImplId]>; + fn impl_for(&self, key0: TypeId, key1: TraitId) -> Option<ImplId>; + fn function_sigs(&self, key0: TypeId, key1: SmolStr) -> Rc<[FunctionSigId]>; + fn type_alias_type( + &self, + key0: TypeAliasId, + ) -> Analysis<Result<TypeId, TypeError>>; +
}

Required Methods§

Source

fn intern_ingot(&self, key0: Rc<Ingot>) -> IngotId

Source

fn lookup_intern_ingot(&self, key0: IngotId) -> Rc<Ingot>

Source

fn intern_module(&self, key0: Rc<Module>) -> ModuleId

Source

fn lookup_intern_module(&self, key0: ModuleId) -> Rc<Module>

Source

fn intern_module_const(&self, key0: Rc<ModuleConstant>) -> ModuleConstantId

Source

fn lookup_intern_module_const( + &self, + key0: ModuleConstantId, +) -> Rc<ModuleConstant>

Source

fn intern_struct(&self, key0: Rc<Struct>) -> StructId

Source

fn lookup_intern_struct(&self, key0: StructId) -> Rc<Struct>

Source

fn intern_struct_field(&self, key0: Rc<StructField>) -> StructFieldId

Source

fn lookup_intern_struct_field(&self, key0: StructFieldId) -> Rc<StructField>

Source

fn intern_enum(&self, key0: Rc<Enum>) -> EnumId

Source

fn lookup_intern_enum(&self, key0: EnumId) -> Rc<Enum>

Source

fn intern_attribute(&self, key0: Rc<Attribute>) -> AttributeId

Source

fn lookup_intern_attribute(&self, key0: AttributeId) -> Rc<Attribute>

Source

fn intern_enum_variant(&self, key0: Rc<EnumVariant>) -> EnumVariantId

Source

fn lookup_intern_enum_variant(&self, key0: EnumVariantId) -> Rc<EnumVariant>

Source

fn intern_trait(&self, key0: Rc<Trait>) -> TraitId

Source

fn lookup_intern_trait(&self, key0: TraitId) -> Rc<Trait>

Source

fn intern_impl(&self, key0: Rc<Impl>) -> ImplId

Source

fn lookup_intern_impl(&self, key0: ImplId) -> Rc<Impl>

Source

fn intern_type_alias(&self, key0: Rc<TypeAlias>) -> TypeAliasId

Source

fn lookup_intern_type_alias(&self, key0: TypeAliasId) -> Rc<TypeAlias>

Source

fn intern_contract(&self, key0: Rc<Contract>) -> ContractId

Source

fn lookup_intern_contract(&self, key0: ContractId) -> Rc<Contract>

Source

fn intern_contract_field(&self, key0: Rc<ContractField>) -> ContractFieldId

Source

fn lookup_intern_contract_field( + &self, + key0: ContractFieldId, +) -> Rc<ContractField>

Source

fn intern_function_sig(&self, key0: Rc<FunctionSig>) -> FunctionSigId

Source

fn lookup_intern_function_sig(&self, key0: FunctionSigId) -> Rc<FunctionSig>

Source

fn intern_function(&self, key0: Rc<Function>) -> FunctionId

Source

fn lookup_intern_function(&self, key0: FunctionId) -> Rc<Function>

Source

fn intern_type(&self, key0: Type) -> TypeId

Source

fn lookup_intern_type(&self, key0: TypeId) -> Type

Source

fn ingot_files(&self, key0: IngotId) -> Rc<[SourceFileId]>

Source

fn set_ingot_files(&mut self, key0: IngotId, value__: Rc<[SourceFileId]>)

Set the value of the ingot_files input.

+

See ingot_files for details.

+

Note: Setting values will trigger cancellation +of any ongoing queries; this method blocks until +those queries have been cancelled.

+
Source

fn set_ingot_files_with_durability( + &mut self, + key0: IngotId, + value__: Rc<[SourceFileId]>, + durability__: Durability, +)

Set the value of the ingot_files input and promise +that its value will never change again.

+

See ingot_files for details.

+

Note: Setting values will trigger cancellation +of any ongoing queries; this method blocks until +those queries have been cancelled.

+
Source

fn ingot_external_ingots(&self, key0: IngotId) -> Rc<IndexMap<SmolStr, IngotId>>

Source

fn set_ingot_external_ingots( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, +)

Set the value of the ingot_external_ingots input.

+

See ingot_external_ingots for details.

+

Note: Setting values will trigger cancellation +of any ongoing queries; this method blocks until +those queries have been cancelled.

+
Source

fn set_ingot_external_ingots_with_durability( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, + durability__: Durability, +)

Set the value of the ingot_external_ingots input and promise +that its value will never change again.

+

See ingot_external_ingots for details.

+

Note: Setting values will trigger cancellation +of any ongoing queries; this method blocks until +those queries have been cancelled.

+
Source

fn root_ingot(&self) -> IngotId

Source

fn set_root_ingot(&mut self, value__: IngotId)

Set the value of the root_ingot input.

+

See root_ingot for details.

+

Note: Setting values will trigger cancellation +of any ongoing queries; this method blocks until +those queries have been cancelled.

+
Source

fn set_root_ingot_with_durability( + &mut self, + value__: IngotId, + durability__: Durability, +)

Set the value of the root_ingot input and promise +that its value will never change again.

+

See root_ingot for details.

+

Note: Setting values will trigger cancellation +of any ongoing queries; this method blocks until +those queries have been cancelled.

+
Source

fn ingot_modules(&self, key0: IngotId) -> Rc<[ModuleId]>

Source

fn ingot_root_module(&self, key0: IngotId) -> Option<ModuleId>

Source

fn module_file_path(&self, key0: ModuleId) -> SmolStr

Source

fn module_parse(&self, key0: ModuleId) -> Analysis<Rc<Module>>

Source

fn module_is_incomplete(&self, key0: ModuleId) -> bool

Source

fn module_all_items(&self, key0: ModuleId) -> Rc<[Item]>

Source

fn module_all_impls(&self, key0: ModuleId) -> Analysis<Rc<[ImplId]>>

Source

fn module_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, Item>>>

Source

fn module_impl_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<(TraitId, TypeId), ImplId>>>

Source

fn module_contracts(&self, key0: ModuleId) -> Rc<[ContractId]>

Source

fn module_structs(&self, key0: ModuleId) -> Rc<[StructId]>

Source

fn module_constants(&self, key0: ModuleId) -> Rc<Vec<ModuleConstantId>>

Source

fn module_used_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>>

Source

fn module_parent_module(&self, key0: ModuleId) -> Option<ModuleId>

Source

fn module_submodules(&self, key0: ModuleId) -> Rc<[ModuleId]>

Source

fn module_tests(&self, key0: ModuleId) -> Vec<FunctionId>

Source

fn module_constant_type( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<TypeId, TypeError>>

Source

fn module_constant_value( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<Constant, ConstEvalError>>

Source

fn contract_all_functions(&self, key0: ContractId) -> Rc<[FunctionId]>

Source

fn contract_function_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

Source

fn contract_public_function_map( + &self, + key0: ContractId, +) -> Rc<IndexMap<SmolStr, FunctionId>>

Source

fn contract_init_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

Source

fn contract_call_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

Source

fn contract_all_fields(&self, key0: ContractId) -> Rc<[ContractFieldId]>

Source

fn contract_field_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, ContractFieldId>>>

Source

fn contract_field_type( + &self, + key0: ContractFieldId, +) -> Analysis<Result<TypeId, TypeError>>

Source

fn contract_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

Source

fn contract_runtime_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

Source

fn function_signature( + &self, + key0: FunctionSigId, +) -> Analysis<Rc<FunctionSignature>>

Source

fn function_body(&self, key0: FunctionId) -> Analysis<Rc<FunctionBody>>

Source

fn function_dependency_graph(&self, key0: FunctionId) -> DepGraphWrapper

Source

fn struct_all_fields(&self, key0: StructId) -> Rc<[StructFieldId]>

Source

fn struct_field_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, StructFieldId>>>

Source

fn struct_field_type( + &self, + key0: StructFieldId, +) -> Analysis<Result<TypeId, TypeError>>

Source

fn struct_all_functions(&self, key0: StructId) -> Rc<[FunctionId]>

Source

fn struct_function_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

Source

fn struct_dependency_graph(&self, key0: StructId) -> Analysis<DepGraphWrapper>

Source

fn enum_all_variants(&self, key0: EnumId) -> Rc<[EnumVariantId]>

Source

fn enum_variant_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, EnumVariantId>>>

Source

fn enum_all_functions(&self, key0: EnumId) -> Rc<[FunctionId]>

Source

fn enum_function_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

Source

fn enum_dependency_graph(&self, key0: EnumId) -> Analysis<DepGraphWrapper>

Source

fn enum_variant_kind( + &self, + key0: EnumVariantId, +) -> Analysis<Result<EnumVariantKind, TypeError>>

Source

fn trait_all_functions(&self, key0: TraitId) -> Rc<[FunctionSigId]>

Source

fn trait_function_map( + &self, + key0: TraitId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionSigId>>>

Source

fn trait_is_implemented_for(&self, key0: TraitId, key1: TypeId) -> bool

Source

fn impl_all_functions(&self, key0: ImplId) -> Rc<[FunctionId]>

Source

fn impl_function_map( + &self, + key0: ImplId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

Source

fn all_impls(&self, key0: TypeId) -> Rc<[ImplId]>

Source

fn impl_for(&self, key0: TypeId, key1: TraitId) -> Option<ImplId>

Source

fn function_sigs(&self, key0: TypeId, key1: SmolStr) -> Rc<[FunctionSigId]>

Source

fn type_alias_type( + &self, + key0: TypeAliasId, +) -> Analysis<Result<TypeId, TypeError>>

Implementors§

Source§

impl<DB> AnalyzerDb for DB
where + DB: SourceDb + Upcast<dyn SourceDb> + UpcastMut<dyn SourceDb> + Database + HasQueryGroup<AnalyzerDbStorage>,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/display/index.html b/compiler-docs/fe_analyzer/display/index.html new file mode 100644 index 0000000000..fd30e471ee --- /dev/null +++ b/compiler-docs/fe_analyzer/display/index.html @@ -0,0 +1 @@ +fe_analyzer::display - Rust

Module display

Source

Structs§

DisplayableWrapper

Traits§

DisplayWithDb
Displayable
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/display/sidebar-items.js b/compiler-docs/fe_analyzer/display/sidebar-items.js new file mode 100644 index 0000000000..f7c350dff7 --- /dev/null +++ b/compiler-docs/fe_analyzer/display/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["DisplayableWrapper"],"trait":["DisplayWithDb","Displayable"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/display/struct.DisplayableWrapper.html b/compiler-docs/fe_analyzer/display/struct.DisplayableWrapper.html new file mode 100644 index 0000000000..fc93dafbd9 --- /dev/null +++ b/compiler-docs/fe_analyzer/display/struct.DisplayableWrapper.html @@ -0,0 +1,14 @@ +DisplayableWrapper in fe_analyzer::display - Rust

Struct DisplayableWrapper

Source
pub struct DisplayableWrapper<'a, T> { /* private fields */ }

Implementations§

Source§

impl<'a, T> DisplayableWrapper<'a, T>

Source

pub fn new(db: &'a dyn AnalyzerDb, inner: T) -> Self

Source

pub fn child(&self, inner: T) -> Self

Trait Implementations§

Source§

impl<T: DisplayWithDb> Display for DisplayableWrapper<'_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for DisplayableWrapper<'a, T>
where + T: Freeze,

§

impl<'a, T> !RefUnwindSafe for DisplayableWrapper<'a, T>

§

impl<'a, T> !Send for DisplayableWrapper<'a, T>

§

impl<'a, T> !Sync for DisplayableWrapper<'a, T>

§

impl<'a, T> Unpin for DisplayableWrapper<'a, T>
where + T: Unpin,

§

impl<'a, T> !UnwindSafe for DisplayableWrapper<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/display/trait.DisplayWithDb.html b/compiler-docs/fe_analyzer/display/trait.DisplayWithDb.html new file mode 100644 index 0000000000..ef93391626 --- /dev/null +++ b/compiler-docs/fe_analyzer/display/trait.DisplayWithDb.html @@ -0,0 +1,5 @@ +DisplayWithDb in fe_analyzer::display - Rust

Trait DisplayWithDb

Source
pub trait DisplayWithDb {
+    // Required method
+    fn format(&self, db: &dyn AnalyzerDb, f: &mut Formatter<'_>) -> Result;
+}

Required Methods§

Source

fn format(&self, db: &dyn AnalyzerDb, f: &mut Formatter<'_>) -> Result

Implementations on Foreign Types§

Source§

impl<T> DisplayWithDb for &T
where + T: DisplayWithDb + ?Sized,

Source§

fn format(&self, db: &dyn AnalyzerDb, f: &mut Formatter<'_>) -> Result

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/display/trait.Displayable.html b/compiler-docs/fe_analyzer/display/trait.Displayable.html new file mode 100644 index 0000000000..fa0df23414 --- /dev/null +++ b/compiler-docs/fe_analyzer/display/trait.Displayable.html @@ -0,0 +1,10 @@ +Displayable in fe_analyzer::display - Rust

Trait Displayable

Source
pub trait Displayable: DisplayWithDb {
+    // Provided method
+    fn display<'a, 'b>(
+        &'a self,
+        db: &'b dyn AnalyzerDb,
+    ) -> DisplayableWrapper<'b, &'a Self> { ... }
+}

Provided Methods§

Source

fn display<'a, 'b>( + &'a self, + db: &'b dyn AnalyzerDb, +) -> DisplayableWrapper<'b, &'a Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/enum.BinaryOperationError.html b/compiler-docs/fe_analyzer/errors/enum.BinaryOperationError.html new file mode 100644 index 0000000000..d0e5d19402 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/enum.BinaryOperationError.html @@ -0,0 +1,25 @@ +BinaryOperationError in fe_analyzer::errors - Rust

Enum BinaryOperationError

Source
pub enum BinaryOperationError {
+    TypesNotCompatible,
+    TypesNotNumeric,
+    RightTooLarge,
+    RightIsSigned,
+    NotEqualAndUnsigned,
+}
Expand description

Errors that can result from a binary operation

+

Variants§

§

TypesNotCompatible

§

TypesNotNumeric

§

RightTooLarge

§

RightIsSigned

§

NotEqualAndUnsigned

Trait Implementations§

Source§

impl Debug for BinaryOperationError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BinaryOperationError

Source§

fn eq(&self, other: &BinaryOperationError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for BinaryOperationError

Source§

impl StructuralPartialEq for BinaryOperationError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/enum.IndexingError.html b/compiler-docs/fe_analyzer/errors/enum.IndexingError.html new file mode 100644 index 0000000000..47ec16a5ff --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/enum.IndexingError.html @@ -0,0 +1,22 @@ +IndexingError in fe_analyzer::errors - Rust

Enum IndexingError

Source
pub enum IndexingError {
+    WrongIndexType,
+    NotSubscriptable,
+}
Expand description

Errors that can result from indexing

+

Variants§

§

WrongIndexType

§

NotSubscriptable

Trait Implementations§

Source§

impl Debug for IndexingError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for IndexingError

Source§

fn eq(&self, other: &IndexingError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for IndexingError

Source§

impl StructuralPartialEq for IndexingError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/enum.TypeCoercionError.html b/compiler-docs/fe_analyzer/errors/enum.TypeCoercionError.html new file mode 100644 index 0000000000..5575fc21f9 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/enum.TypeCoercionError.html @@ -0,0 +1,26 @@ +TypeCoercionError in fe_analyzer::errors - Rust

Enum TypeCoercionError

Source
pub enum TypeCoercionError {
+    RequiresToMem,
+    Incompatible,
+    SelfContractType,
+}
Expand description

Errors that can result from an implicit type coercion

+

Variants§

§

RequiresToMem

Value is in storage and must be explicitly moved with .to_mem()

+
§

Incompatible

Value type cannot be coerced to the expected type

+
§

SelfContractType

self contract used where an external contract value is expected

+

Trait Implementations§

Source§

impl Debug for TypeCoercionError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TypeCoercionError

Source§

fn eq(&self, other: &TypeCoercionError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for TypeCoercionError

Source§

impl StructuralPartialEq for TypeCoercionError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/fn.duplicate_name_error.html b/compiler-docs/fe_analyzer/errors/fn.duplicate_name_error.html new file mode 100644 index 0000000000..751bad02c8 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/fn.duplicate_name_error.html @@ -0,0 +1,6 @@ +duplicate_name_error in fe_analyzer::errors - Rust

Function duplicate_name_error

Source
pub fn duplicate_name_error(
+    message: &str,
+    name: &str,
+    original: Span,
+    duplicate: Span,
+) -> Diagnostic
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/fn.error.html b/compiler-docs/fe_analyzer/errors/fn.error.html new file mode 100644 index 0000000000..4c55b98f52 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/fn.error.html @@ -0,0 +1,5 @@ +error in fe_analyzer::errors - Rust

Function error

Source
pub fn error(
+    message: impl Into<String>,
+    label_span: Span,
+    label: impl Into<String>,
+) -> Diagnostic
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/fn.fancy_error.html b/compiler-docs/fe_analyzer/errors/fn.fancy_error.html new file mode 100644 index 0000000000..c27dc869d3 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/fn.fancy_error.html @@ -0,0 +1,5 @@ +fancy_error in fe_analyzer::errors - Rust

Function fancy_error

Source
pub fn fancy_error(
+    message: impl Into<String>,
+    labels: Vec<Label>,
+    notes: Vec<String>,
+) -> Diagnostic
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/fn.name_conflict_error.html b/compiler-docs/fe_analyzer/errors/fn.name_conflict_error.html new file mode 100644 index 0000000000..5f028c8a25 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/fn.name_conflict_error.html @@ -0,0 +1,7 @@ +name_conflict_error in fe_analyzer::errors - Rust

Function name_conflict_error

Source
pub fn name_conflict_error(
+    name_kind: &str,
+    name: &str,
+    original: &NamedThing,
+    original_span: Option<Span>,
+    duplicate_span: Span,
+) -> Diagnostic
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/fn.not_yet_implemented.html b/compiler-docs/fe_analyzer/errors/fn.not_yet_implemented.html new file mode 100644 index 0000000000..e6b7f25353 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/fn.not_yet_implemented.html @@ -0,0 +1 @@ +not_yet_implemented in fe_analyzer::errors - Rust

Function not_yet_implemented

Source
pub fn not_yet_implemented(feature: impl Display, span: Span) -> Diagnostic
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/fn.self_contract_type_error.html b/compiler-docs/fe_analyzer/errors/fn.self_contract_type_error.html new file mode 100644 index 0000000000..1d53810ab0 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/fn.self_contract_type_error.html @@ -0,0 +1 @@ +self_contract_type_error in fe_analyzer::errors - Rust

Function self_contract_type_error

Source
pub fn self_contract_type_error(span: Span, typ: &dyn Display) -> Diagnostic
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/fn.to_mem_error.html b/compiler-docs/fe_analyzer/errors/fn.to_mem_error.html new file mode 100644 index 0000000000..b5b5876827 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/fn.to_mem_error.html @@ -0,0 +1 @@ +to_mem_error in fe_analyzer::errors - Rust

Function to_mem_error

Source
pub fn to_mem_error(span: Span) -> Diagnostic
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/fn.type_error.html b/compiler-docs/fe_analyzer/errors/fn.type_error.html new file mode 100644 index 0000000000..964c33edc9 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/fn.type_error.html @@ -0,0 +1,6 @@ +type_error in fe_analyzer::errors - Rust

Function type_error

Source
pub fn type_error(
+    message: impl Into<String>,
+    span: Span,
+    expected: impl Display,
+    actual: impl Display,
+) -> Diagnostic
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/index.html b/compiler-docs/fe_analyzer/errors/index.html new file mode 100644 index 0000000000..21d1532fc0 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/index.html @@ -0,0 +1,7 @@ +fe_analyzer::errors - Rust

Module errors

Source
Expand description

Semantic errors.

+

Structs§

AlreadyDefined
Error to be returned from APIs that should reject duplicate definitions
ConstEvalError
Error indicating constant evaluation failed.
FatalError
Error to be returned when otherwise no meaningful information can be returned. +Can’t be created unless a diagnostic has been emitted, and thus a DiagnosticVoucher +has been obtained. (See comment on TypeError)
IncompleteItem
Error returned by ModuleId::resolve_name if the name is not found, and parsing of the module +failed. In this case, emitting an error message about failure to resolve the name might be misleading, +because the file may in fact contain an item with the given name, somewhere after the syntax error that caused +parsing to fail.
TypeError
Error indicating that a type is invalid.

Enums§

BinaryOperationError
Errors that can result from a binary operation
IndexingError
Errors that can result from indexing
TypeCoercionError
Errors that can result from an implicit type coercion

Functions§

duplicate_name_error
error
fancy_error
name_conflict_error
not_yet_implemented
self_contract_type_error
to_mem_error
type_error
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/sidebar-items.js b/compiler-docs/fe_analyzer/errors/sidebar-items.js new file mode 100644 index 0000000000..79106423cd --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["BinaryOperationError","IndexingError","TypeCoercionError"],"fn":["duplicate_name_error","error","fancy_error","name_conflict_error","not_yet_implemented","self_contract_type_error","to_mem_error","type_error"],"struct":["AlreadyDefined","ConstEvalError","FatalError","IncompleteItem","TypeError"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/struct.AlreadyDefined.html b/compiler-docs/fe_analyzer/errors/struct.AlreadyDefined.html new file mode 100644 index 0000000000..68bab7222c --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/struct.AlreadyDefined.html @@ -0,0 +1,12 @@ +AlreadyDefined in fe_analyzer::errors - Rust

Struct AlreadyDefined

Source
pub struct AlreadyDefined(/* private fields */);
Expand description

Error to be returned from APIs that should reject duplicate definitions

+

Implementations§

Trait Implementations§

Source§

impl Debug for AlreadyDefined

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<AlreadyDefined> for FatalError

Source§

fn from(err: AlreadyDefined) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/struct.ConstEvalError.html b/compiler-docs/fe_analyzer/errors/struct.ConstEvalError.html new file mode 100644 index 0000000000..d11229c38f --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/struct.ConstEvalError.html @@ -0,0 +1,33 @@ +ConstEvalError in fe_analyzer::errors - Rust

Struct ConstEvalError

Source
pub struct ConstEvalError(/* private fields */);
Expand description

Error indicating constant evaluation failed.

+

This error emitted when

+
    +
  1. an expression can’t be evaluated in compilation time
  2. +
  3. arithmetic overflow occurred during evaluation
  4. +
  5. zero division is detected during evaluation
  6. +
+

Can’t be created unless a diagnostic has been emitted, and thus a DiagnosticVoucher +has been obtained. (See comment on TypeError)

+

NOTE: Clone is required because these are stored in a salsa db. +Please don’t clone these manually.

+

Implementations§

Trait Implementations§

Source§

impl Clone for ConstEvalError

Source§

fn clone(&self) -> ConstEvalError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConstEvalError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ConstEvalError> for FatalError

Source§

fn from(err: ConstEvalError) -> Self

Converts to this type from the input type.
Source§

impl From<ConstEvalError> for TypeError

Source§

fn from(err: ConstEvalError) -> Self

Converts to this type from the input type.
Source§

impl From<FatalError> for ConstEvalError

Source§

fn from(err: FatalError) -> Self

Converts to this type from the input type.
Source§

impl From<IncompleteItem> for ConstEvalError

Source§

fn from(err: IncompleteItem) -> Self

Converts to this type from the input type.
Source§

impl From<TypeError> for ConstEvalError

Source§

fn from(err: TypeError) -> Self

Converts to this type from the input type.
Source§

impl Hash for ConstEvalError

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ConstEvalError

Source§

fn eq(&self, other: &ConstEvalError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for ConstEvalError

Source§

impl StructuralPartialEq for ConstEvalError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/struct.FatalError.html b/compiler-docs/fe_analyzer/errors/struct.FatalError.html new file mode 100644 index 0000000000..b1dc54341f --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/struct.FatalError.html @@ -0,0 +1,16 @@ +FatalError in fe_analyzer::errors - Rust

Struct FatalError

Source
pub struct FatalError(/* private fields */);
Expand description

Error to be returned when otherwise no meaningful information can be returned. +Can’t be created unless a diagnostic has been emitted, and thus a DiagnosticVoucher +has been obtained. (See comment on TypeError)

+

Implementations§

Source§

impl FatalError

Source

pub fn new(voucher: DiagnosticVoucher) -> Self

Create a FatalError instance, given a “voucher” +obtained by emitting an error via an AnalyzerContext.

+

Trait Implementations§

Source§

impl Debug for FatalError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<AlreadyDefined> for FatalError

Source§

fn from(err: AlreadyDefined) -> Self

Converts to this type from the input type.
Source§

impl From<ConstEvalError> for FatalError

Source§

fn from(err: ConstEvalError) -> Self

Converts to this type from the input type.
Source§

impl From<FatalError> for ConstEvalError

Source§

fn from(err: FatalError) -> Self

Converts to this type from the input type.
Source§

impl From<FatalError> for TypeError

Source§

fn from(err: FatalError) -> Self

Converts to this type from the input type.
Source§

impl From<IncompleteItem> for FatalError

Source§

fn from(err: IncompleteItem) -> Self

Converts to this type from the input type.
Source§

impl From<TypeError> for FatalError

Source§

fn from(err: TypeError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/struct.IncompleteItem.html b/compiler-docs/fe_analyzer/errors/struct.IncompleteItem.html new file mode 100644 index 0000000000..2c8c7f1f53 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/struct.IncompleteItem.html @@ -0,0 +1,15 @@ +IncompleteItem in fe_analyzer::errors - Rust

Struct IncompleteItem

Source
pub struct IncompleteItem(/* private fields */);
Expand description

Error returned by ModuleId::resolve_name if the name is not found, and parsing of the module +failed. In this case, emitting an error message about failure to resolve the name might be misleading, +because the file may in fact contain an item with the given name, somewhere after the syntax error that caused +parsing to fail.

+

Implementations§

Source§

impl IncompleteItem

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Debug for IncompleteItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<IncompleteItem> for ConstEvalError

Source§

fn from(err: IncompleteItem) -> Self

Converts to this type from the input type.
Source§

impl From<IncompleteItem> for FatalError

Source§

fn from(err: IncompleteItem) -> Self

Converts to this type from the input type.
Source§

impl From<IncompleteItem> for TypeError

Source§

fn from(err: IncompleteItem) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/errors/struct.TypeError.html b/compiler-docs/fe_analyzer/errors/struct.TypeError.html new file mode 100644 index 0000000000..b152fe77d0 --- /dev/null +++ b/compiler-docs/fe_analyzer/errors/struct.TypeError.html @@ -0,0 +1,36 @@ +TypeError in fe_analyzer::errors - Rust

Struct TypeError

Source
pub struct TypeError(/* private fields */);
Expand description

Error indicating that a type is invalid.

+

Note that the “type” of a thing (eg the type of a FunctionParam) +in crate::namespace::types is sometimes represented as a +Result<Type, TypeError>.

+

If, for example, a function parameter has an undefined type, we emit a Diagnostic message, +give that parameter a “type” of Err(TypeError), and carry on. If/when that parameter is +used in the function body, we assume that a diagnostic message about the undefined type +has already been emitted, and halt the analysis of the function body.

+

To ensure that that assumption is sound, a diagnostic must be emitted before creating +a TypeError. So that the rust compiler can help us enforce this rule, a TypeError +cannot be constructed without providing a DiagnosticVoucher. A voucher can be obtained +by calling an error function on an AnalyzerContext. +Please don’t try to work around this restriction.

+

Example: TypeError::new(context.error("something is wrong", some_span, "this thing"))

+

Implementations§

Source§

impl TypeError

Source

pub fn new(voucher: DiagnosticVoucher) -> Self

Trait Implementations§

Source§

impl Clone for TypeError

Source§

fn clone(&self) -> TypeError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ConstEvalError> for TypeError

Source§

fn from(err: ConstEvalError) -> Self

Converts to this type from the input type.
Source§

impl From<FatalError> for TypeError

Source§

fn from(err: FatalError) -> Self

Converts to this type from the input type.
Source§

impl From<IncompleteItem> for TypeError

Source§

fn from(err: IncompleteItem) -> Self

Converts to this type from the input type.
Source§

impl From<TypeError> for ConstEvalError

Source§

fn from(err: TypeError) -> Self

Converts to this type from the input type.
Source§

impl From<TypeError> for FatalError

Source§

fn from(err: TypeError) -> Self

Converts to this type from the input type.
Source§

impl Hash for TypeError

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TypeError

Source§

fn eq(&self, other: &TypeError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for TypeError

Source§

impl StructuralPartialEq for TypeError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/fn.analyze_ingot.html b/compiler-docs/fe_analyzer/fn.analyze_ingot.html new file mode 100644 index 0000000000..86f2e5e22a --- /dev/null +++ b/compiler-docs/fe_analyzer/fn.analyze_ingot.html @@ -0,0 +1,4 @@ +analyze_ingot in fe_analyzer - Rust

Function analyze_ingot

Source
pub fn analyze_ingot(
+    db: &dyn AnalyzerDb,
+    ingot_id: IngotId,
+) -> Result<(), Vec<Diagnostic>>
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/fn.analyze_module.html b/compiler-docs/fe_analyzer/fn.analyze_module.html new file mode 100644 index 0000000000..9c41af7d1c --- /dev/null +++ b/compiler-docs/fe_analyzer/fn.analyze_module.html @@ -0,0 +1,4 @@ +analyze_module in fe_analyzer - Rust

Function analyze_module

Source
pub fn analyze_module(
+    db: &dyn AnalyzerDb,
+    module_id: ModuleId,
+) -> Result<(), Vec<Diagnostic>>
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/index.html b/compiler-docs/fe_analyzer/index.html new file mode 100644 index 0000000000..f2e27b9f9c --- /dev/null +++ b/compiler-docs/fe_analyzer/index.html @@ -0,0 +1,6 @@ +fe_analyzer - Rust

Crate fe_analyzer

Source
Expand description

Fe semantic analysis.

+

This library is used to analyze the semantics of a given Fe AST. It detects +any semantic errors within a given AST and produces a Context instance +that can be used to query contextual information attributed to AST nodes.

+

Re-exports§

pub use db::AnalyzerDb;
pub use db::TestDb;

Modules§

builtins
constants
context
db
display
errors
Semantic errors.
namespace
pattern_analysis
This module includes utility structs and its functions for pattern matching +analysis. The algorithm here is based on Warnings for pattern matching

Functions§

analyze_ingot
analyze_module
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/index.html b/compiler-docs/fe_analyzer/namespace/index.html new file mode 100644 index 0000000000..3720a3591b --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/index.html @@ -0,0 +1 @@ +fe_analyzer::namespace - Rust

Module namespace

Source

Modules§

items
scopes
types
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/enum.DepLocality.html b/compiler-docs/fe_analyzer/namespace/items/enum.DepLocality.html new file mode 100644 index 0000000000..5def51b881 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/enum.DepLocality.html @@ -0,0 +1,26 @@ +DepLocality in fe_analyzer::namespace::items - Rust

Enum DepLocality

Source
pub enum DepLocality {
+    Local,
+    External,
+}
Expand description

DepGraph edge label. “Locality” refers to the deployed state; +Local dependencies are those that will be compiled together, while +External dependencies will only be reachable via an evm CALL* op.

+

Variants§

§

Local

§

External

Trait Implementations§

Source§

impl Clone for DepLocality

Source§

fn clone(&self) -> DepLocality

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DepLocality

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DepLocality

Source§

fn eq(&self, other: &DepLocality) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for DepLocality

Source§

impl Eq for DepLocality

Source§

impl StructuralPartialEq for DepLocality

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/enum.EnumVariantKind.html b/compiler-docs/fe_analyzer/namespace/items/enum.EnumVariantKind.html new file mode 100644 index 0000000000..a5162b086c --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/enum.EnumVariantKind.html @@ -0,0 +1,29 @@ +EnumVariantKind in fe_analyzer::namespace::items - Rust

Enum EnumVariantKind

Source
pub enum EnumVariantKind {
+    Unit,
+    Tuple(SmallVec<[TypeId; 4]>),
+}

Variants§

§

Unit

§

Tuple(SmallVec<[TypeId; 4]>)

Implementations§

Source§

impl EnumVariantKind

Source

pub fn display_name(&self) -> &'static str

Source

pub fn field_len(&self) -> usize

Source

pub fn is_unit(&self) -> bool

Trait Implementations§

Source§

impl Clone for EnumVariantKind

Source§

fn clone(&self) -> EnumVariantKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnumVariantKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DisplayWithDb for EnumVariantKind

Source§

fn format(&self, db: &dyn AnalyzerDb, f: &mut Formatter<'_>) -> Result

Source§

impl Hash for EnumVariantKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EnumVariantKind

Source§

fn eq(&self, other: &EnumVariantKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for EnumVariantKind

Source§

impl StructuralPartialEq for EnumVariantKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Displayable for T
where + T: DisplayWithDb,

Source§

fn display<'a, 'b>( + &'a self, + db: &'b dyn AnalyzerDb, +) -> DisplayableWrapper<'b, &'a Self>

Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/enum.IngotMode.html b/compiler-docs/fe_analyzer/namespace/items/enum.IngotMode.html new file mode 100644 index 0000000000..b681730d6b --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/enum.IngotMode.html @@ -0,0 +1,29 @@ +IngotMode in fe_analyzer::namespace::items - Rust

Enum IngotMode

Source
pub enum IngotMode {
+    Main,
+    Lib,
+    StandaloneModule,
+}

Variants§

§

Main

The target of compilation. Expected to have a main.fe file.

+
§

Lib

A library; expected to have a lib.fe file.

+
§

StandaloneModule

A fake ingot, created to hold a single module with any filename.

+

Trait Implementations§

Source§

impl Clone for IngotMode

Source§

fn clone(&self) -> IngotMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IngotMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for IngotMode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for IngotMode

Source§

fn eq(&self, other: &IngotMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for IngotMode

Source§

impl Eq for IngotMode

Source§

impl StructuralPartialEq for IngotMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/enum.Item.html b/compiler-docs/fe_analyzer/namespace/items/enum.Item.html new file mode 100644 index 0000000000..c1b716737b --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/enum.Item.html @@ -0,0 +1,57 @@ +Item in fe_analyzer::namespace::items - Rust

Enum Item

Source
pub enum Item {
+    Ingot(IngotId),
+    Module(ModuleId),
+    Type(TypeDef),
+    GenericType(GenericType),
+    Trait(TraitId),
+    Impl(ImplId),
+    Function(FunctionId),
+    Constant(ModuleConstantId),
+    BuiltinFunction(GlobalFunction),
+    Intrinsic(Intrinsic),
+    Attribute(AttributeId),
+}
Expand description

A named item. This does not include things inside of +a function body.

+

Variants§

§

Ingot(IngotId)

§

Module(ModuleId)

§

Type(TypeDef)

§

GenericType(GenericType)

§

Trait(TraitId)

§

Impl(ImplId)

§

Function(FunctionId)

§

Constant(ModuleConstantId)

§

BuiltinFunction(GlobalFunction)

§

Intrinsic(Intrinsic)

§

Attribute(AttributeId)

Implementations§

Source§

impl Item

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Option<Span>

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_builtin(&self) -> bool

Source

pub fn is_struct(&self, val: &StructId) -> bool

Source

pub fn is_contract(&self) -> bool

Source

pub fn item_kind_display_name(&self) -> &'static str

Source

pub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>>

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Option<Item>

Source

pub fn module(&self, db: &dyn AnalyzerDb) -> Option<ModuleId>

Source

pub fn path(&self, db: &dyn AnalyzerDb) -> Rc<[SmolStr]>

Source

pub fn dependency_graph(&self, db: &dyn AnalyzerDb) -> Option<Rc<DepGraph>>

Source

pub fn resolve_path_segments( + &self, + db: &dyn AnalyzerDb, + segments: &[Node<SmolStr>], +) -> Analysis<Option<NamedThing>>

Source

pub fn function_sig( + &self, + db: &dyn AnalyzerDb, + name: &str, +) -> Option<FunctionSigId>

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Source

pub fn attributes(&self, db: &dyn AnalyzerDb) -> Vec<AttributeId>

Trait Implementations§

Source§

impl Clone for Item

Source§

fn clone(&self) -> Item

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Item

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Item

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Item

Source§

fn cmp(&self, other: &Item) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Item

Source§

fn eq(&self, other: &Item) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for Item

Source§

fn partial_cmp(&self, other: &Item) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for Item

Source§

impl Eq for Item

Source§

impl StructuralPartialEq for Item

Auto Trait Implementations§

§

impl Freeze for Item

§

impl RefUnwindSafe for Item

§

impl Send for Item

§

impl Sync for Item

§

impl Unpin for Item

§

impl UnwindSafe for Item

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/enum.ModuleSource.html b/compiler-docs/fe_analyzer/namespace/items/enum.ModuleSource.html new file mode 100644 index 0000000000..c11040f90e --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/enum.ModuleSource.html @@ -0,0 +1,27 @@ +ModuleSource in fe_analyzer::namespace::items - Rust

Enum ModuleSource

Source
pub enum ModuleSource {
+    File(SourceFileId),
+    Dir(SmolStr),
+}

Variants§

§

File(SourceFileId)

§

Dir(SmolStr)

For directory modules without a corresponding source file +(which will soon not be allowed, and this variant can go away).

+

Trait Implementations§

Source§

impl Clone for ModuleSource

Source§

fn clone(&self) -> ModuleSource

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModuleSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ModuleSource

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ModuleSource

Source§

fn eq(&self, other: &ModuleSource) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for ModuleSource

Source§

impl StructuralPartialEq for ModuleSource

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/enum.TypeDef.html b/compiler-docs/fe_analyzer/namespace/items/enum.TypeDef.html new file mode 100644 index 0000000000..ce6f9cb4c5 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/enum.TypeDef.html @@ -0,0 +1,41 @@ +TypeDef in fe_analyzer::namespace::items - Rust

Enum TypeDef

Source
pub enum TypeDef {
+    Alias(TypeAliasId),
+    Struct(StructId),
+    Enum(EnumId),
+    Contract(ContractId),
+    Primitive(Base),
+}

Variants§

§

Alias(TypeAliasId)

§

Struct(StructId)

§

Enum(EnumId)

§

Contract(ContractId)

§

Primitive(Base)

Implementations§

Source§

impl TypeDef

Source

pub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>>

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Option<Span>

Source

pub fn typ(&self, db: &dyn AnalyzerDb) -> Result<Type, TypeError>

Source

pub fn type_id(&self, db: &dyn AnalyzerDb) -> Result<TypeId, TypeError>

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Option<Item>

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for TypeDef

Source§

fn clone(&self) -> TypeDef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for TypeDef

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for TypeDef

Source§

fn cmp(&self, other: &TypeDef) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for TypeDef

Source§

fn eq(&self, other: &TypeDef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for TypeDef

Source§

fn partial_cmp(&self, other: &TypeDef) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for TypeDef

Source§

impl Eq for TypeDef

Source§

impl StructuralPartialEq for TypeDef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/fn.builtin_items.html b/compiler-docs/fe_analyzer/namespace/items/fn.builtin_items.html new file mode 100644 index 0000000000..31b4c0fec9 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/fn.builtin_items.html @@ -0,0 +1 @@ +builtin_items in fe_analyzer::namespace::items - Rust

Function builtin_items

Source
pub fn builtin_items() -> IndexMap<SmolStr, Item>
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/fn.walk_local_dependencies.html b/compiler-docs/fe_analyzer/namespace/items/fn.walk_local_dependencies.html new file mode 100644 index 0000000000..948559add9 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/fn.walk_local_dependencies.html @@ -0,0 +1,2 @@ +walk_local_dependencies in fe_analyzer::namespace::items - Rust

Function walk_local_dependencies

Source
pub fn walk_local_dependencies<F>(graph: &DepGraph, root: Item, fun: F)
where + F: FnMut(Item),
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/index.html b/compiler-docs/fe_analyzer/namespace/items/index.html new file mode 100644 index 0000000000..8f2b9f2d3d --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/index.html @@ -0,0 +1,6 @@ +fe_analyzer::namespace::items - Rust

Module items

Source

Structs§

Attribute
AttributeId
Contract
ContractField
ContractFieldId
ContractId
DepGraphWrapper
Enum
EnumId
EnumVariant
EnumVariantId
Function
FunctionId
FunctionSig
FunctionSigId
Impl
ImplId
Ingot
An Ingot is composed of a tree of Modules (set via +[AnalyzerDb::set_ingot_module_tree]), and doesn’t have direct knowledge of +files.
IngotId
Module
ModuleConstant
ModuleConstantId
ModuleId
Id of a Module, which corresponds to a single Fe source file.
Struct
StructField
StructFieldId
StructId
Trait
TraitId
TypeAlias
TypeAliasId

Enums§

DepLocality
DepGraph edge label. “Locality” refers to the deployed state; +Local dependencies are those that will be compiled together, while +External dependencies will only be reachable via an evm CALL* op.
EnumVariantKind
IngotMode
Item
A named item. This does not include things inside of +a function body.
ModuleSource
TypeDef

Traits§

DiagnosticSink

Functions§

builtin_items
walk_local_dependencies

Type Aliases§

DepGraph
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/sidebar-items.js b/compiler-docs/fe_analyzer/namespace/items/sidebar-items.js new file mode 100644 index 0000000000..97139cad16 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["DepLocality","EnumVariantKind","IngotMode","Item","ModuleSource","TypeDef"],"fn":["builtin_items","walk_local_dependencies"],"struct":["Attribute","AttributeId","Contract","ContractField","ContractFieldId","ContractId","DepGraphWrapper","Enum","EnumId","EnumVariant","EnumVariantId","Function","FunctionId","FunctionSig","FunctionSigId","Impl","ImplId","Ingot","IngotId","Module","ModuleConstant","ModuleConstantId","ModuleId","Struct","StructField","StructFieldId","StructId","Trait","TraitId","TypeAlias","TypeAliasId"],"trait":["DiagnosticSink"],"type":["DepGraph"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.Attribute.html b/compiler-docs/fe_analyzer/namespace/items/struct.Attribute.html new file mode 100644 index 0000000000..89d9ef4004 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.Attribute.html @@ -0,0 +1,25 @@ +Attribute in fe_analyzer::namespace::items - Rust

Struct Attribute

Source
pub struct Attribute {
+    pub ast: Node<SmolStr>,
+    pub module: ModuleId,
+}

Fields§

§ast: Node<SmolStr>§module: ModuleId

Trait Implementations§

Source§

impl Clone for Attribute

Source§

fn clone(&self) -> Attribute

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Attribute

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Attribute

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Attribute

Source§

fn eq(&self, other: &Attribute) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Attribute

Source§

impl StructuralPartialEq for Attribute

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.AttributeId.html b/compiler-docs/fe_analyzer/namespace/items/struct.AttributeId.html new file mode 100644 index 0000000000..c6489f4fc8 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.AttributeId.html @@ -0,0 +1,31 @@ +AttributeId in fe_analyzer::namespace::items - Rust

Struct AttributeId

Source
pub struct AttributeId(/* private fields */);

Implementations§

Source§

impl AttributeId

Source

pub fn data(self, db: &dyn AnalyzerDb) -> Rc<Attribute>

Source

pub fn span(self, db: &dyn AnalyzerDb) -> Span

Source

pub fn name(self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn module(self, db: &dyn AnalyzerDb) -> ModuleId

Source

pub fn parent(self, db: &dyn AnalyzerDb) -> Item

Trait Implementations§

Source§

impl Clone for AttributeId

Source§

fn clone(&self) -> AttributeId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AttributeId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AttributeId

Source§

fn default() -> AttributeId

Returns the “default value” for a type. Read more
Source§

impl Hash for AttributeId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for AttributeId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for AttributeId

Source§

fn cmp(&self, other: &AttributeId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for AttributeId

Source§

fn eq(&self, other: &AttributeId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for AttributeId

Source§

fn partial_cmp(&self, other: &AttributeId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for AttributeId

Source§

impl Eq for AttributeId

Source§

impl StructuralPartialEq for AttributeId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.Contract.html b/compiler-docs/fe_analyzer/namespace/items/struct.Contract.html new file mode 100644 index 0000000000..d219bca379 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.Contract.html @@ -0,0 +1,26 @@ +Contract in fe_analyzer::namespace::items - Rust

Struct Contract

Source
pub struct Contract {
+    pub name: SmolStr,
+    pub ast: Node<Contract>,
+    pub module: ModuleId,
+}

Fields§

§name: SmolStr§ast: Node<Contract>§module: ModuleId

Trait Implementations§

Source§

impl Clone for Contract

Source§

fn clone(&self) -> Contract

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Contract

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Contract

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Contract

Source§

fn eq(&self, other: &Contract) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Contract

Source§

impl StructuralPartialEq for Contract

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.ContractField.html b/compiler-docs/fe_analyzer/namespace/items/struct.ContractField.html new file mode 100644 index 0000000000..3324f30471 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.ContractField.html @@ -0,0 +1,25 @@ +ContractField in fe_analyzer::namespace::items - Rust

Struct ContractField

Source
pub struct ContractField {
+    pub ast: Node<Field>,
+    pub parent: ContractId,
+}

Fields§

§ast: Node<Field>§parent: ContractId

Trait Implementations§

Source§

impl Clone for ContractField

Source§

fn clone(&self) -> ContractField

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContractField

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ContractField

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ContractField

Source§

fn eq(&self, other: &ContractField) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for ContractField

Source§

impl StructuralPartialEq for ContractField

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.ContractFieldId.html b/compiler-docs/fe_analyzer/namespace/items/struct.ContractFieldId.html new file mode 100644 index 0000000000..7c9a6ecd43 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.ContractFieldId.html @@ -0,0 +1,35 @@ +ContractFieldId in fe_analyzer::namespace::items - Rust

Struct ContractFieldId

Source
pub struct ContractFieldId(/* private fields */);

Implementations§

Source§

impl ContractFieldId

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<ContractField>

Source

pub fn typ(&self, db: &dyn AnalyzerDb) -> Result<TypeId, TypeError>

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for ContractFieldId

Source§

fn clone(&self) -> ContractFieldId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContractFieldId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ContractFieldId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for ContractFieldId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for ContractFieldId

Source§

fn cmp(&self, other: &ContractFieldId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ContractFieldId

Source§

fn eq(&self, other: &ContractFieldId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for ContractFieldId

Source§

fn partial_cmp(&self, other: &ContractFieldId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for ContractFieldId

Source§

impl Eq for ContractFieldId

Source§

impl StructuralPartialEq for ContractFieldId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.ContractId.html b/compiler-docs/fe_analyzer/namespace/items/struct.ContractId.html new file mode 100644 index 0000000000..dd41bdb5c2 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.ContractId.html @@ -0,0 +1,61 @@ +ContractId in fe_analyzer::namespace::items - Rust

Struct ContractId

Source
pub struct ContractId(/* private fields */);

Implementations§

Source§

impl ContractId

Source

pub fn as_type(&self, db: &dyn AnalyzerDb) -> TypeId

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Contract>

Source

pub fn span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId

Source

pub fn fields( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, ContractFieldId>>

Source

pub fn field_type( + &self, + db: &dyn AnalyzerDb, + name: &str, +) -> Option<Result<TypeId, TypeError>>

Source

pub fn resolve_name( + &self, + db: &dyn AnalyzerDb, + name: &str, +) -> Result<Option<NamedThing>, IncompleteItem>

Source

pub fn init_function(&self, db: &dyn AnalyzerDb) -> Option<FunctionId>

Source

pub fn call_function(&self, db: &dyn AnalyzerDb) -> Option<FunctionId>

Source

pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionId]>

Source

pub fn functions( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, FunctionId>>

User functions, public and not. Excludes __init__ and __call__.

+
Source

pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionId>

Lookup a function by name. Searches all user functions, private or not. +Excludes __init__ and __call__.

+
Source

pub fn public_functions( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, FunctionId>>

Excludes __init__ and __call__.

+
Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Item

Source

pub fn dependency_graph(&self, db: &dyn AnalyzerDb) -> Rc<DepGraph>

Dependency graph of the contract type, which consists of the field types +and the dependencies of those types.

+

NOTE: Contract items should only

+
Source

pub fn runtime_dependency_graph(&self, db: &dyn AnalyzerDb) -> Rc<DepGraph>

Dependency graph of the (imaginary) __call__ function, which +dispatches to the contract’s public functions.

+
Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for ContractId

Source§

fn clone(&self) -> ContractId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContractId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ContractId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for ContractId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for ContractId

Source§

fn cmp(&self, other: &ContractId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ContractId

Source§

fn eq(&self, other: &ContractId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for ContractId

Source§

fn partial_cmp(&self, other: &ContractId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for ContractId

Source§

impl Eq for ContractId

Source§

impl StructuralPartialEq for ContractId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.DepGraphWrapper.html b/compiler-docs/fe_analyzer/namespace/items/struct.DepGraphWrapper.html new file mode 100644 index 0000000000..b3497021a7 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.DepGraphWrapper.html @@ -0,0 +1,20 @@ +DepGraphWrapper in fe_analyzer::namespace::items - Rust

Struct DepGraphWrapper

Source
pub struct DepGraphWrapper(pub Rc<DepGraph>);

Tuple Fields§

§0: Rc<DepGraph>

Trait Implementations§

Source§

impl Clone for DepGraphWrapper

Source§

fn clone(&self) -> DepGraphWrapper

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DepGraphWrapper

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DepGraphWrapper

Source§

fn eq(&self, other: &DepGraphWrapper) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for DepGraphWrapper

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.Enum.html b/compiler-docs/fe_analyzer/namespace/items/struct.Enum.html new file mode 100644 index 0000000000..79a4e3b9ff --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.Enum.html @@ -0,0 +1,25 @@ +Enum in fe_analyzer::namespace::items - Rust

Struct Enum

Source
pub struct Enum {
+    pub ast: Node<Enum>,
+    pub module: ModuleId,
+}

Fields§

§ast: Node<Enum>§module: ModuleId

Trait Implementations§

Source§

impl Clone for Enum

Source§

fn clone(&self) -> Enum

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Enum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Enum

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Enum

Source§

fn eq(&self, other: &Enum) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Enum

Source§

impl StructuralPartialEq for Enum

Auto Trait Implementations§

§

impl Freeze for Enum

§

impl RefUnwindSafe for Enum

§

impl Send for Enum

§

impl Sync for Enum

§

impl Unpin for Enum

§

impl UnwindSafe for Enum

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.EnumId.html b/compiler-docs/fe_analyzer/namespace/items/struct.EnumId.html new file mode 100644 index 0000000000..ae77c7b576 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.EnumId.html @@ -0,0 +1,41 @@ +EnumId in fe_analyzer::namespace::items - Rust

Struct EnumId

Source
pub struct EnumId(/* private fields */);

Implementations§

Source§

impl EnumId

Source

pub fn data(self, db: &dyn AnalyzerDb) -> Rc<Enum>

Source

pub fn span(self, db: &dyn AnalyzerDb) -> Span

Source

pub fn name(self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn name_span(self, db: &dyn AnalyzerDb) -> Span

Source

pub fn as_type(self, db: &dyn AnalyzerDb) -> TypeId

Source

pub fn is_public(self, db: &dyn AnalyzerDb) -> bool

Source

pub fn variant(self, db: &dyn AnalyzerDb, name: &str) -> Option<EnumVariantId>

Source

pub fn variants( + self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, EnumVariantId>>

Source

pub fn module(self, db: &dyn AnalyzerDb) -> ModuleId

Source

pub fn parent(self, db: &dyn AnalyzerDb) -> Item

Source

pub fn dependency_graph(self, db: &dyn AnalyzerDb) -> Rc<DepGraph>

Source

pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionId]>

Source

pub fn functions( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, FunctionId>>

Source

pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionId>

Source

pub fn sink_diagnostics( + self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for EnumId

Source§

fn clone(&self) -> EnumId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnumId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnumId

Source§

fn default() -> EnumId

Returns the “default value” for a type. Read more
Source§

impl Hash for EnumId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for EnumId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for EnumId

Source§

fn cmp(&self, other: &EnumId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for EnumId

Source§

fn eq(&self, other: &EnumId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for EnumId

Source§

fn partial_cmp(&self, other: &EnumId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for EnumId

Source§

impl Eq for EnumId

Source§

impl StructuralPartialEq for EnumId

Auto Trait Implementations§

§

impl Freeze for EnumId

§

impl RefUnwindSafe for EnumId

§

impl Send for EnumId

§

impl Sync for EnumId

§

impl Unpin for EnumId

§

impl UnwindSafe for EnumId

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.EnumVariant.html b/compiler-docs/fe_analyzer/namespace/items/struct.EnumVariant.html new file mode 100644 index 0000000000..081086ef57 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.EnumVariant.html @@ -0,0 +1,26 @@ +EnumVariant in fe_analyzer::namespace::items - Rust

Struct EnumVariant

Source
pub struct EnumVariant {
+    pub ast: Node<Variant>,
+    pub tag: usize,
+    pub parent: EnumId,
+}

Fields§

§ast: Node<Variant>§tag: usize§parent: EnumId

Trait Implementations§

Source§

impl Clone for EnumVariant

Source§

fn clone(&self) -> EnumVariant

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnumVariant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for EnumVariant

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EnumVariant

Source§

fn eq(&self, other: &EnumVariant) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for EnumVariant

Source§

impl StructuralPartialEq for EnumVariant

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.EnumVariantId.html b/compiler-docs/fe_analyzer/namespace/items/struct.EnumVariantId.html new file mode 100644 index 0000000000..7fd4822972 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.EnumVariantId.html @@ -0,0 +1,35 @@ +EnumVariantId in fe_analyzer::namespace::items - Rust

Struct EnumVariantId

Source
pub struct EnumVariantId(/* private fields */);

Implementations§

Source§

impl EnumVariantId

Source

pub fn data(self, db: &dyn AnalyzerDb) -> Rc<EnumVariant>

Source

pub fn name(self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn span(self, db: &dyn AnalyzerDb) -> Span

Source

pub fn name_with_parent(self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn kind(self, db: &dyn AnalyzerDb) -> Result<EnumVariantKind, TypeError>

Source

pub fn disc(self, db: &dyn AnalyzerDb) -> usize

Source

pub fn sink_diagnostics( + self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Source

pub fn parent(self, db: &dyn AnalyzerDb) -> EnumId

Trait Implementations§

Source§

impl Clone for EnumVariantId

Source§

fn clone(&self) -> EnumVariantId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnumVariantId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for EnumVariantId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for EnumVariantId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for EnumVariantId

Source§

fn cmp(&self, other: &EnumVariantId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for EnumVariantId

Source§

fn eq(&self, other: &EnumVariantId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for EnumVariantId

Source§

fn partial_cmp(&self, other: &EnumVariantId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for EnumVariantId

Source§

impl Eq for EnumVariantId

Source§

impl StructuralPartialEq for EnumVariantId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.Function.html b/compiler-docs/fe_analyzer/namespace/items/struct.Function.html new file mode 100644 index 0000000000..79f20cfa93 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.Function.html @@ -0,0 +1,30 @@ +Function in fe_analyzer::namespace::items - Rust

Struct Function

Source
pub struct Function {
+    pub ast: Node<Function>,
+    pub sig: FunctionSigId,
+}

Fields§

§ast: Node<Function>§sig: FunctionSigId

Implementations§

Source§

impl Function

Source

pub fn new( + db: &dyn AnalyzerDb, + ast: &Node<Function>, + parent: Option<Item>, + module: ModuleId, +) -> Self

Trait Implementations§

Source§

impl Clone for Function

Source§

fn clone(&self) -> Function

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Function

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Function

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Function

Source§

fn eq(&self, other: &Function) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Function

Source§

impl StructuralPartialEq for Function

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.FunctionId.html b/compiler-docs/fe_analyzer/namespace/items/struct.FunctionId.html new file mode 100644 index 0000000000..6dc9132790 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.FunctionId.html @@ -0,0 +1,35 @@ +FunctionId in fe_analyzer::namespace::items - Rust

Struct FunctionId

Source
pub struct FunctionId(/* private fields */);

Implementations§

Source§

impl FunctionId

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Function>

Source

pub fn span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId

Source

pub fn self_type(&self, db: &dyn AnalyzerDb) -> Option<TypeId>

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Item

Source

pub fn takes_self(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn self_span(&self, db: &dyn AnalyzerDb) -> Option<Span>

Source

pub fn is_generic(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_constructor(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_unsafe(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn unsafe_span(&self, db: &dyn AnalyzerDb) -> Option<Span>

Source

pub fn signature(&self, db: &dyn AnalyzerDb) -> Rc<FunctionSignature>

Source

pub fn sig(&self, db: &dyn AnalyzerDb) -> FunctionSigId

Source

pub fn body(&self, db: &dyn AnalyzerDb) -> Rc<FunctionBody>

Source

pub fn dependency_graph(&self, db: &dyn AnalyzerDb) -> Rc<DepGraph>

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Source

pub fn is_contract_func(self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_test(&self, db: &dyn AnalyzerDb) -> bool

Trait Implementations§

Source§

impl Clone for FunctionId

Source§

fn clone(&self) -> FunctionId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FunctionId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for FunctionId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for FunctionId

Source§

fn cmp(&self, other: &FunctionId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for FunctionId

Source§

fn eq(&self, other: &FunctionId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for FunctionId

Source§

fn partial_cmp(&self, other: &FunctionId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for FunctionId

Source§

impl Eq for FunctionId

Source§

impl StructuralPartialEq for FunctionId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.FunctionSig.html b/compiler-docs/fe_analyzer/namespace/items/struct.FunctionSig.html new file mode 100644 index 0000000000..c64555df44 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.FunctionSig.html @@ -0,0 +1,26 @@ +FunctionSig in fe_analyzer::namespace::items - Rust

Struct FunctionSig

Source
pub struct FunctionSig {
+    pub ast: Node<FunctionSignature>,
+    pub parent: Option<Item>,
+    pub module: ModuleId,
+}

Fields§

§ast: Node<FunctionSignature>§parent: Option<Item>§module: ModuleId

Trait Implementations§

Source§

impl Clone for FunctionSig

Source§

fn clone(&self) -> FunctionSig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionSig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FunctionSig

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FunctionSig

Source§

fn eq(&self, other: &FunctionSig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for FunctionSig

Source§

impl StructuralPartialEq for FunctionSig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.FunctionSigId.html b/compiler-docs/fe_analyzer/namespace/items/struct.FunctionSigId.html new file mode 100644 index 0000000000..f62e24b02d --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.FunctionSigId.html @@ -0,0 +1,40 @@ +FunctionSigId in fe_analyzer::namespace::items - Rust

Struct FunctionSigId

Source
pub struct FunctionSigId(/* private fields */);

Implementations§

Source§

impl FunctionSigId

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<FunctionSig>

Source

pub fn takes_self(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn self_type(&self, db: &dyn AnalyzerDb) -> Option<TypeId>

Source

pub fn self_span(&self, db: &dyn AnalyzerDb) -> Option<Span>

Source

pub fn signature(&self, db: &dyn AnalyzerDb) -> Rc<FunctionSignature>

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn unsafe_span(&self, db: &dyn AnalyzerDb) -> Option<Span>

Source

pub fn is_constructor(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn pub_span(&self, db: &dyn AnalyzerDb) -> Option<Span>

Source

pub fn self_item(&self, db: &dyn AnalyzerDb) -> Option<Item>

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Item

Source

pub fn function(&self, db: &dyn AnalyzerDb) -> Option<FunctionId>

Looks up the FunctionId based on the parent of the function signature

+
Source

pub fn is_trait_fn(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_module_fn(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_impl_fn(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_generic(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn generic_params(&self, db: &dyn AnalyzerDb) -> Vec<GenericParameter>

Source

pub fn generic_param( + &self, + db: &dyn AnalyzerDb, + param_name: &str, +) -> Option<GenericParameter>

Source

pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId

Source

pub fn is_contract_func(self, db: &dyn AnalyzerDb) -> bool

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for FunctionSigId

Source§

fn clone(&self) -> FunctionSigId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionSigId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FunctionSigId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for FunctionSigId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for FunctionSigId

Source§

fn cmp(&self, other: &FunctionSigId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for FunctionSigId

Source§

fn eq(&self, other: &FunctionSigId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for FunctionSigId

Source§

fn partial_cmp(&self, other: &FunctionSigId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for FunctionSigId

Source§

impl Eq for FunctionSigId

Source§

impl StructuralPartialEq for FunctionSigId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.Impl.html b/compiler-docs/fe_analyzer/namespace/items/struct.Impl.html new file mode 100644 index 0000000000..ee3a86ef9a --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.Impl.html @@ -0,0 +1,27 @@ +Impl in fe_analyzer::namespace::items - Rust

Struct Impl

Source
pub struct Impl {
+    pub trait_id: TraitId,
+    pub receiver: TypeId,
+    pub module: ModuleId,
+    pub ast: Node<Impl>,
+}

Fields§

§trait_id: TraitId§receiver: TypeId§module: ModuleId§ast: Node<Impl>

Trait Implementations§

Source§

impl Clone for Impl

Source§

fn clone(&self) -> Impl

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Impl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Impl

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Impl

Source§

fn eq(&self, other: &Impl) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Impl

Source§

impl StructuralPartialEq for Impl

Auto Trait Implementations§

§

impl Freeze for Impl

§

impl RefUnwindSafe for Impl

§

impl Send for Impl

§

impl Sync for Impl

§

impl Unpin for Impl

§

impl UnwindSafe for Impl

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.ImplId.html b/compiler-docs/fe_analyzer/namespace/items/struct.ImplId.html new file mode 100644 index 0000000000..48a89f95b5 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.ImplId.html @@ -0,0 +1,46 @@ +ImplId in fe_analyzer::namespace::items - Rust

Struct ImplId

Source
pub struct ImplId(/* private fields */);

Implementations§

Source§

impl ImplId

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Impl>

Source

pub fn span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId

Source

pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionId]>

Source

pub fn trait_id(&self, db: &dyn AnalyzerDb) -> TraitId

Source

pub fn receiver(&self, db: &dyn AnalyzerDb) -> TypeId

Source

pub fn is_receiver_type(&self, other: TypeId, db: &dyn AnalyzerDb) -> bool

Returns true if other either is Self or the type of the receiver

+
Source

pub fn can_stand_in_for( + &self, + db: &dyn AnalyzerDb, + type_in_impl: TypeId, + type_in_trait: TypeId, +) -> bool

Returns true if the type_in_impl can stand in for the type_in_trait as a type used +for a parameter or as a return type

+
Source

pub fn ast(&self, db: &dyn AnalyzerDb) -> Node<Impl>

Source

pub fn functions( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, FunctionId>>

Source

pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionId>

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Item

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for ImplId

Source§

fn clone(&self) -> ImplId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ImplId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ImplId

Source§

fn default() -> ImplId

Returns the “default value” for a type. Read more
Source§

impl Hash for ImplId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for ImplId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for ImplId

Source§

fn cmp(&self, other: &ImplId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ImplId

Source§

fn eq(&self, other: &ImplId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for ImplId

Source§

fn partial_cmp(&self, other: &ImplId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for ImplId

Source§

impl Eq for ImplId

Source§

impl StructuralPartialEq for ImplId

Auto Trait Implementations§

§

impl Freeze for ImplId

§

impl RefUnwindSafe for ImplId

§

impl Send for ImplId

§

impl Sync for ImplId

§

impl Unpin for ImplId

§

impl UnwindSafe for ImplId

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.Ingot.html b/compiler-docs/fe_analyzer/namespace/items/struct.Ingot.html new file mode 100644 index 0000000000..058e5650ed --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.Ingot.html @@ -0,0 +1,29 @@ +Ingot in fe_analyzer::namespace::items - Rust

Struct Ingot

Source
pub struct Ingot {
+    pub name: SmolStr,
+    pub mode: IngotMode,
+    pub src_dir: SmolStr,
+}
Expand description

An Ingot is composed of a tree of Modules (set via +[AnalyzerDb::set_ingot_module_tree]), and doesn’t have direct knowledge of +files.

+

Fields§

§name: SmolStr§mode: IngotMode§src_dir: SmolStr

Trait Implementations§

Source§

impl Clone for Ingot

Source§

fn clone(&self) -> Ingot

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ingot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Ingot

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Ingot

Source§

fn eq(&self, other: &Ingot) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Ingot

Source§

impl StructuralPartialEq for Ingot

Auto Trait Implementations§

§

impl Freeze for Ingot

§

impl RefUnwindSafe for Ingot

§

impl Send for Ingot

§

impl Sync for Ingot

§

impl Unpin for Ingot

§

impl UnwindSafe for Ingot

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.IngotId.html b/compiler-docs/fe_analyzer/namespace/items/struct.IngotId.html new file mode 100644 index 0000000000..4a789eba51 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.IngotId.html @@ -0,0 +1,53 @@ +IngotId in fe_analyzer::namespace::items - Rust

Struct IngotId

Source
pub struct IngotId(/* private fields */);

Implementations§

Source§

impl IngotId

Source

pub fn std_lib(db: &mut dyn AnalyzerDb) -> Self

Source

pub fn from_build_files( + db: &mut dyn AnalyzerDb, + build_files: &BuildFiles, +) -> Self

Source

pub fn from_files( + db: &mut dyn AnalyzerDb, + name: &str, + mode: IngotMode, + file_kind: FileKind, + files: &[(impl AsRef<str>, impl AsRef<str>)], +) -> Self

Source

pub fn external_ingots( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, IngotId>>

Source

pub fn all_modules(&self, db: &dyn AnalyzerDb) -> Rc<[ModuleId]>

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Ingot>

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn root_module(&self, db: &dyn AnalyzerDb) -> Option<ModuleId>

Returns the main.fe, or lib.fe module, depending on the ingot “mode” +(IngotMode).

+
Source

pub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>>

Source

pub fn diagnostics(&self, db: &dyn AnalyzerDb) -> Vec<Diagnostic>

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Source

pub fn sink_external_ingot_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for IngotId

Source§

fn clone(&self) -> IngotId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IngotId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for IngotId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for IngotId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for IngotId

Source§

fn cmp(&self, other: &IngotId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for IngotId

Source§

fn eq(&self, other: &IngotId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for IngotId

Source§

fn partial_cmp(&self, other: &IngotId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for IngotId

Source§

impl Eq for IngotId

Source§

impl StructuralPartialEq for IngotId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.Module.html b/compiler-docs/fe_analyzer/namespace/items/struct.Module.html new file mode 100644 index 0000000000..72a0d33237 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.Module.html @@ -0,0 +1,26 @@ +Module in fe_analyzer::namespace::items - Rust

Struct Module

Source
pub struct Module {
+    pub name: SmolStr,
+    pub ingot: IngotId,
+    pub source: ModuleSource,
+}

Fields§

§name: SmolStr§ingot: IngotId§source: ModuleSource

Trait Implementations§

Source§

impl Clone for Module

Source§

fn clone(&self) -> Module

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Module

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Module

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Module

Source§

fn eq(&self, other: &Module) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Module

Source§

impl StructuralPartialEq for Module

Auto Trait Implementations§

§

impl Freeze for Module

§

impl RefUnwindSafe for Module

§

impl Send for Module

§

impl Sync for Module

§

impl Unpin for Module

§

impl UnwindSafe for Module

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.ModuleConstant.html b/compiler-docs/fe_analyzer/namespace/items/struct.ModuleConstant.html new file mode 100644 index 0000000000..8621ae699e --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.ModuleConstant.html @@ -0,0 +1,25 @@ +ModuleConstant in fe_analyzer::namespace::items - Rust

Struct ModuleConstant

Source
pub struct ModuleConstant {
+    pub ast: Node<ConstantDecl>,
+    pub module: ModuleId,
+}

Fields§

§ast: Node<ConstantDecl>§module: ModuleId

Trait Implementations§

Source§

impl Clone for ModuleConstant

Source§

fn clone(&self) -> ModuleConstant

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModuleConstant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ModuleConstant

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ModuleConstant

Source§

fn eq(&self, other: &ModuleConstant) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for ModuleConstant

Source§

impl StructuralPartialEq for ModuleConstant

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.ModuleConstantId.html b/compiler-docs/fe_analyzer/namespace/items/struct.ModuleConstantId.html new file mode 100644 index 0000000000..4599d025b6 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.ModuleConstantId.html @@ -0,0 +1,38 @@ +ModuleConstantId in fe_analyzer::namespace::items - Rust

Struct ModuleConstantId

Source
pub struct ModuleConstantId(/* private fields */);

Implementations§

Source§

impl ModuleConstantId

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<ModuleConstant>

Source

pub fn span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn typ(&self, db: &dyn AnalyzerDb) -> Result<TypeId, TypeError>

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn constant_value( + &self, + db: &dyn AnalyzerDb, +) -> Result<Constant, ConstEvalError>

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn value(&self, db: &dyn AnalyzerDb) -> Expr

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Item

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId

Source

pub fn node_id(&self, db: &dyn AnalyzerDb) -> NodeId

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for ModuleConstantId

Source§

fn clone(&self) -> ModuleConstantId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModuleConstantId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ModuleConstantId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for ModuleConstantId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for ModuleConstantId

Source§

fn cmp(&self, other: &ModuleConstantId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ModuleConstantId

Source§

fn eq(&self, other: &ModuleConstantId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for ModuleConstantId

Source§

fn partial_cmp(&self, other: &ModuleConstantId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for ModuleConstantId

Source§

impl Eq for ModuleConstantId

Source§

impl StructuralPartialEq for ModuleConstantId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.ModuleId.html b/compiler-docs/fe_analyzer/namespace/items/struct.ModuleId.html new file mode 100644 index 0000000000..8c57f250c4 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.ModuleId.html @@ -0,0 +1,96 @@ +ModuleId in fe_analyzer::namespace::items - Rust

Struct ModuleId

Source
pub struct ModuleId(/* private fields */);
Expand description

Id of a Module, which corresponds to a single Fe source file.

+

Implementations§

Source§

impl ModuleId

Source

pub fn new_standalone( + db: &mut dyn AnalyzerDb, + path: &str, + content: &str, +) -> Self

Source

pub fn new( + db: &dyn AnalyzerDb, + name: &str, + source: ModuleSource, + ingot: IngotId, +) -> Self

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Module>

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn file_path_relative_to_src_dir(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn ast(&self, db: &dyn AnalyzerDb) -> Rc<Module>

Source

pub fn ingot(&self, db: &dyn AnalyzerDb) -> IngotId

Source

pub fn is_incomplete(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_in_std(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn all_items(&self, db: &dyn AnalyzerDb) -> Rc<[Item]>

Includes duplicate names

+
Source

pub fn all_impls(&self, db: &dyn AnalyzerDb) -> Rc<[ImplId]>

Includes duplicate names

+
Source

pub fn impls( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<(TraitId, TypeId), ImplId>>

Source

pub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>>

Returns a map of the named items in the module

+
Source

pub fn used_items( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, (Span, Item)>>

Returns a name -> (name_span, external_item) map for all use +statements in a module.

+
Source

pub fn tests(&self, db: &dyn AnalyzerDb) -> Vec<FunctionId>

Source

pub fn is_in_scope(&self, db: &dyn AnalyzerDb, item: Item) -> bool

Returns true if the item is in scope of the module.

+
Source

pub fn non_used_internal_items( + &self, + db: &dyn AnalyzerDb, +) -> IndexMap<SmolStr, Item>

Returns all of the internal items, except for used items. This is used +when resolving use statements, as it does not create a query +cycle.

+
Source

pub fn internal_items(&self, db: &dyn AnalyzerDb) -> IndexMap<SmolStr, Item>

Returns all of the internal items. Internal items refers to the set of +items visible when inside of a module.

+
Source

pub fn resolve_path( + &self, + db: &dyn AnalyzerDb, + path: &Path, +) -> Analysis<Option<NamedThing>>

Resolve a path that starts with an item defined in the module.

+
Source

pub fn resolve_path_non_used_internal( + &self, + db: &dyn AnalyzerDb, + path: &Path, +) -> Analysis<Option<NamedThing>>

Resolve a path that starts with an internal item. We omit used items to +avoid a query cycle.

+
Source

pub fn resolve_path_internal( + &self, + db: &dyn AnalyzerDb, + path: &Path, +) -> Analysis<Option<NamedThing>>

Resolve a path that starts with an internal item.

+
Source

pub fn resolve_name( + &self, + db: &dyn AnalyzerDb, + name: &str, +) -> Result<Option<NamedThing>, IncompleteItem>

Returns Err(IncompleteItem) if the name could not be resolved, and the +module was not completely parsed (due to a syntax error).

+
Source

pub fn resolve_constant( + &self, + db: &dyn AnalyzerDb, + name: &str, +) -> Result<Option<ModuleConstantId>, IncompleteItem>

Source

pub fn submodules(&self, db: &dyn AnalyzerDb) -> Rc<[ModuleId]>

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Item

Source

pub fn parent_module(&self, db: &dyn AnalyzerDb) -> Option<ModuleId>

Source

pub fn all_contracts(&self, db: &dyn AnalyzerDb) -> Vec<ContractId>

All contracts, including from submodules and including duplicates

+
Source

pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Vec<FunctionId>

All functions, including from submodules and including duplicates

+
Source

pub fn global_items(&self, db: &dyn AnalyzerDb) -> IndexMap<SmolStr, Item>

Returns the map of ingot deps, built-ins, and the ingot itself as +“ingot”.

+
Source

pub fn all_constants(&self, db: &dyn AnalyzerDb) -> Rc<Vec<ModuleConstantId>>

All module constants.

+
Source

pub fn diagnostics(&self, db: &dyn AnalyzerDb) -> Vec<Diagnostic>

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for ModuleId

Source§

fn clone(&self) -> ModuleId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModuleId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ModuleId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for ModuleId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for ModuleId

Source§

fn cmp(&self, other: &ModuleId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ModuleId

Source§

fn eq(&self, other: &ModuleId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for ModuleId

Source§

fn partial_cmp(&self, other: &ModuleId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for ModuleId

Source§

impl Eq for ModuleId

Source§

impl StructuralPartialEq for ModuleId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.Struct.html b/compiler-docs/fe_analyzer/namespace/items/struct.Struct.html new file mode 100644 index 0000000000..00de9326eb --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.Struct.html @@ -0,0 +1,25 @@ +Struct in fe_analyzer::namespace::items - Rust

Struct Struct

Source
pub struct Struct {
+    pub ast: Node<Struct>,
+    pub module: ModuleId,
+}

Fields§

§ast: Node<Struct>§module: ModuleId

Trait Implementations§

Source§

impl Clone for Struct

Source§

fn clone(&self) -> Struct

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Struct

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Struct

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Struct

Source§

fn eq(&self, other: &Struct) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Struct

Source§

impl StructuralPartialEq for Struct

Auto Trait Implementations§

§

impl Freeze for Struct

§

impl RefUnwindSafe for Struct

§

impl Send for Struct

§

impl Sync for Struct

§

impl Unpin for Struct

§

impl UnwindSafe for Struct

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.StructField.html b/compiler-docs/fe_analyzer/namespace/items/struct.StructField.html new file mode 100644 index 0000000000..f279d43f4c --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.StructField.html @@ -0,0 +1,25 @@ +StructField in fe_analyzer::namespace::items - Rust

Struct StructField

Source
pub struct StructField {
+    pub ast: Node<Field>,
+    pub parent: StructId,
+}

Fields§

§ast: Node<Field>§parent: StructId

Trait Implementations§

Source§

impl Clone for StructField

Source§

fn clone(&self) -> StructField

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StructField

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for StructField

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for StructField

Source§

fn eq(&self, other: &StructField) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for StructField

Source§

impl StructuralPartialEq for StructField

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.StructFieldId.html b/compiler-docs/fe_analyzer/namespace/items/struct.StructFieldId.html new file mode 100644 index 0000000000..0fa6345312 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.StructFieldId.html @@ -0,0 +1,35 @@ +StructFieldId in fe_analyzer::namespace::items - Rust

Struct StructFieldId

Source
pub struct StructFieldId(/* private fields */);

Implementations§

Source§

impl StructFieldId

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<StructField>

Source

pub fn attributes(&self, db: &dyn AnalyzerDb) -> Vec<SmolStr>

Source

pub fn is_indexed(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn typ(&self, db: &dyn AnalyzerDb) -> Result<TypeId, TypeError>

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for StructFieldId

Source§

fn clone(&self) -> StructFieldId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StructFieldId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for StructFieldId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for StructFieldId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for StructFieldId

Source§

fn cmp(&self, other: &StructFieldId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for StructFieldId

Source§

fn eq(&self, other: &StructFieldId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for StructFieldId

Source§

fn partial_cmp(&self, other: &StructFieldId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for StructFieldId

Source§

impl Eq for StructFieldId

Source§

impl StructuralPartialEq for StructFieldId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.StructId.html b/compiler-docs/fe_analyzer/namespace/items/struct.StructId.html new file mode 100644 index 0000000000..ba8552b687 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.StructId.html @@ -0,0 +1,41 @@ +StructId in fe_analyzer::namespace::items - Rust

Struct StructId

Source
pub struct StructId(/* private fields */);

Implementations§

Source§

impl StructId

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Struct>

Source

pub fn span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId

Source

pub fn as_type(&self, db: &dyn AnalyzerDb) -> TypeId

Source

pub fn has_private_field(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn field(&self, db: &dyn AnalyzerDb, name: &str) -> Option<StructFieldId>

Source

pub fn fields( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, StructFieldId>>

Source

pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionId]>

Source

pub fn functions( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, FunctionId>>

Source

pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionId>

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Item

Source

pub fn dependency_graph(&self, db: &dyn AnalyzerDb) -> Rc<DepGraph>

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for StructId

Source§

fn clone(&self) -> StructId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StructId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StructId

Source§

fn default() -> StructId

Returns the “default value” for a type. Read more
Source§

impl Hash for StructId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for StructId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for StructId

Source§

fn cmp(&self, other: &StructId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for StructId

Source§

fn eq(&self, other: &StructId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for StructId

Source§

fn partial_cmp(&self, other: &StructId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for StructId

Source§

impl Eq for StructId

Source§

impl StructuralPartialEq for StructId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.Trait.html b/compiler-docs/fe_analyzer/namespace/items/struct.Trait.html new file mode 100644 index 0000000000..3f36ddf307 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.Trait.html @@ -0,0 +1,25 @@ +Trait in fe_analyzer::namespace::items - Rust

Struct Trait

Source
pub struct Trait {
+    pub ast: Node<Trait>,
+    pub module: ModuleId,
+}

Fields§

§ast: Node<Trait>§module: ModuleId

Trait Implementations§

Source§

impl Clone for Trait

Source§

fn clone(&self) -> Trait

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Trait

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Trait

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Trait

Source§

fn eq(&self, other: &Trait) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Trait

Source§

impl StructuralPartialEq for Trait

Auto Trait Implementations§

§

impl Freeze for Trait

§

impl RefUnwindSafe for Trait

§

impl Send for Trait

§

impl Sync for Trait

§

impl Unpin for Trait

§

impl UnwindSafe for Trait

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.TraitId.html b/compiler-docs/fe_analyzer/namespace/items/struct.TraitId.html new file mode 100644 index 0000000000..cb4d3d3b10 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.TraitId.html @@ -0,0 +1,38 @@ +TraitId in fe_analyzer::namespace::items - Rust

Struct TraitId

Source
pub struct TraitId(/* private fields */);

Implementations§

Source§

impl TraitId

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Trait>

Source

pub fn span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId

Source

pub fn as_trait_or_type(&self) -> TraitOrType

Source

pub fn is_implemented_for(&self, db: &dyn AnalyzerDb, ty: TypeId) -> bool

Source

pub fn is_in_std(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_std_trait(&self, db: &dyn AnalyzerDb, name: &str) -> bool

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Item

Source

pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionSigId]>

Source

pub fn functions( + &self, + db: &dyn AnalyzerDb, +) -> Rc<IndexMap<SmolStr, FunctionSigId>>

Source

pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionSigId>

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for TraitId

Source§

fn clone(&self) -> TraitId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TraitId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TraitId

Source§

fn default() -> TraitId

Returns the “default value” for a type. Read more
Source§

impl Hash for TraitId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for TraitId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for TraitId

Source§

fn cmp(&self, other: &TraitId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for TraitId

Source§

fn eq(&self, other: &TraitId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for TraitId

Source§

fn partial_cmp(&self, other: &TraitId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for TraitId

Source§

impl Eq for TraitId

Source§

impl StructuralPartialEq for TraitId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.TypeAlias.html b/compiler-docs/fe_analyzer/namespace/items/struct.TypeAlias.html new file mode 100644 index 0000000000..4c4dd7b7cd --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.TypeAlias.html @@ -0,0 +1,25 @@ +TypeAlias in fe_analyzer::namespace::items - Rust

Struct TypeAlias

Source
pub struct TypeAlias {
+    pub ast: Node<TypeAlias>,
+    pub module: ModuleId,
+}

Fields§

§ast: Node<TypeAlias>§module: ModuleId

Trait Implementations§

Source§

impl Clone for TypeAlias

Source§

fn clone(&self) -> TypeAlias

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeAlias

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for TypeAlias

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TypeAlias

Source§

fn eq(&self, other: &TypeAlias) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for TypeAlias

Source§

impl StructuralPartialEq for TypeAlias

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/struct.TypeAliasId.html b/compiler-docs/fe_analyzer/namespace/items/struct.TypeAliasId.html new file mode 100644 index 0000000000..5b8eb39f5f --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/struct.TypeAliasId.html @@ -0,0 +1,35 @@ +TypeAliasId in fe_analyzer::namespace::items - Rust

Struct TypeAliasId

Source
pub struct TypeAliasId(/* private fields */);

Implementations§

Source§

impl TypeAliasId

Source

pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<TypeAlias>

Source

pub fn span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span

Source

pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn type_id(&self, db: &dyn AnalyzerDb) -> Result<TypeId, TypeError>

Source

pub fn parent(&self, db: &dyn AnalyzerDb) -> Item

Source

pub fn sink_diagnostics( + &self, + db: &dyn AnalyzerDb, + sink: &mut impl DiagnosticSink, +)

Trait Implementations§

Source§

impl Clone for TypeAliasId

Source§

fn clone(&self) -> TypeAliasId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeAliasId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for TypeAliasId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for TypeAliasId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for TypeAliasId

Source§

fn cmp(&self, other: &TypeAliasId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for TypeAliasId

Source§

fn eq(&self, other: &TypeAliasId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for TypeAliasId

Source§

fn partial_cmp(&self, other: &TypeAliasId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for TypeAliasId

Source§

impl Eq for TypeAliasId

Source§

impl StructuralPartialEq for TypeAliasId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/trait.DiagnosticSink.html b/compiler-docs/fe_analyzer/namespace/items/trait.DiagnosticSink.html new file mode 100644 index 0000000000..5bfa72e0b7 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/trait.DiagnosticSink.html @@ -0,0 +1,7 @@ +DiagnosticSink in fe_analyzer::namespace::items - Rust

Trait DiagnosticSink

Source
pub trait DiagnosticSink {
+    // Required method
+    fn push(&mut self, diag: &Diagnostic);
+
+    // Provided method
+    fn push_all<'a>(&mut self, iter: impl Iterator<Item = &'a Diagnostic>) { ... }
+}

Required Methods§

Source

fn push(&mut self, diag: &Diagnostic)

Provided Methods§

Source

fn push_all<'a>(&mut self, iter: impl Iterator<Item = &'a Diagnostic>)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl DiagnosticSink for Vec<Diagnostic>

Source§

fn push(&mut self, diag: &Diagnostic)

Source§

fn push_all<'a>(&mut self, iter: impl Iterator<Item = &'a Diagnostic>)

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/items/type.DepGraph.html b/compiler-docs/fe_analyzer/namespace/items/type.DepGraph.html new file mode 100644 index 0000000000..369457b2ca --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/items/type.DepGraph.html @@ -0,0 +1 @@ +DepGraph in fe_analyzer::namespace::items - Rust

Type Alias DepGraph

Source
pub type DepGraph = DiGraphMap<Item, DepLocality>;

Aliased Type§

pub struct DepGraph { /* private fields */ }
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/scopes/enum.BlockScopeType.html b/compiler-docs/fe_analyzer/namespace/scopes/enum.BlockScopeType.html new file mode 100644 index 0000000000..e4c1799955 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/scopes/enum.BlockScopeType.html @@ -0,0 +1,27 @@ +BlockScopeType in fe_analyzer::namespace::scopes - Rust

Enum BlockScopeType

Source
pub enum BlockScopeType {
+    Function,
+    IfElse,
+    Match,
+    MatchArm,
+    Loop,
+    Unsafe,
+}

Variants§

§

Function

§

IfElse

§

Match

§

MatchArm

§

Loop

§

Unsafe

Trait Implementations§

Source§

impl Clone for BlockScopeType

Source§

fn clone(&self) -> BlockScopeType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BlockScopeType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BlockScopeType

Source§

fn eq(&self, other: &BlockScopeType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for BlockScopeType

Source§

impl StructuralPartialEq for BlockScopeType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/scopes/fn.check_visibility.html b/compiler-docs/fe_analyzer/namespace/scopes/fn.check_visibility.html new file mode 100644 index 0000000000..15a54890eb --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/scopes/fn.check_visibility.html @@ -0,0 +1,7 @@ +check_visibility in fe_analyzer::namespace::scopes - Rust

Function check_visibility

Source
pub fn check_visibility(
+    context: &dyn AnalyzerContext,
+    named_thing: &NamedThing,
+    span: Span,
+)
Expand description

Check an item visibility and sink diagnostics if an item is invisible from +the scope.

+
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/scopes/index.html b/compiler-docs/fe_analyzer/namespace/scopes/index.html new file mode 100644 index 0000000000..0da622256d --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/scopes/index.html @@ -0,0 +1,2 @@ +fe_analyzer::namespace::scopes - Rust

Module scopes

Source

Structs§

BlockScope
FunctionScope
ItemScope

Enums§

BlockScopeType

Functions§

check_visibility
Check an item visibility and sink diagnostics if an item is invisible from +the scope.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/scopes/sidebar-items.js b/compiler-docs/fe_analyzer/namespace/scopes/sidebar-items.js new file mode 100644 index 0000000000..836a614aa1 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/scopes/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["BlockScopeType"],"fn":["check_visibility"],"struct":["BlockScope","FunctionScope","ItemScope"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/scopes/struct.BlockScope.html b/compiler-docs/fe_analyzer/namespace/scopes/struct.BlockScope.html new file mode 100644 index 0000000000..b31e65768f --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/scopes/struct.BlockScope.html @@ -0,0 +1,70 @@ +BlockScope in fe_analyzer::namespace::scopes - Rust

Struct BlockScope

Source
pub struct BlockScope<'a, 'b> {
+    pub root: &'a FunctionScope<'b>,
+    pub parent: Option<&'a BlockScope<'a, 'b>>,
+    pub variable_defs: BTreeMap<String, (TypeId, bool, Span)>,
+    pub constant_defs: RefCell<BTreeMap<String, Constant>>,
+    pub typ: BlockScopeType,
+}

Fields§

§root: &'a FunctionScope<'b>§parent: Option<&'a BlockScope<'a, 'b>>§variable_defs: BTreeMap<String, (TypeId, bool, Span)>

Maps Name -> (Type, is_const, span)

+
§constant_defs: RefCell<BTreeMap<String, Constant>>§typ: BlockScopeType

Implementations§

Source§

impl<'a, 'b> BlockScope<'a, 'b>

Source

pub fn new(root: &'a FunctionScope<'b>, typ: BlockScopeType) -> Self

Source

pub fn new_child(&'a self, typ: BlockScopeType) -> Self

Source

pub fn add_var( + &mut self, + name: &str, + typ: TypeId, + is_const: bool, + span: Span, +) -> Result<(), AlreadyDefined>

Add a variable to the block scope.

+

Trait Implementations§

Source§

impl AnalyzerContext for BlockScope<'_, '_>

Source§

fn db(&self) -> &dyn AnalyzerDb

Source§

fn resolve_name( + &self, + name: &str, + span: Span, +) -> Result<Option<NamedThing>, IncompleteItem>

Source§

fn add_expression(&self, node: &Node<Expr>, attributes: ExpressionAttributes)

Attribute contextual information to an expression node. Read more
Source§

fn update_expression( + &self, + node: &Node<Expr>, + f: &dyn Fn(&mut ExpressionAttributes), +)

Update the expression attributes. Read more
Source§

fn expr_typ(&self, expr: &Node<Expr>) -> Type

Returns a type of an expression. Read more
Source§

fn add_constant(&self, name: &Node<SmolStr>, expr: &Node<Expr>, value: Constant)

Add evaluated constant value in a constant declaration to the context.
Source§

fn constant_value_by_name( + &self, + name: &SmolStr, + span: Span, +) -> Result<Option<Constant>, IncompleteItem>

Returns constant value from variable name.
Source§

fn parent(&self) -> Item

Returns an item enclosing current context. Read more
Source§

fn module(&self) -> ModuleId

Returns the module enclosing current context.
Source§

fn parent_function(&self) -> FunctionId

Returns a function id that encloses a context. Read more
Source§

fn add_call(&self, node: &Node<Expr>, call_type: CallType)

Panics Read more
Source§

fn get_call(&self, node: &Node<Expr>) -> Option<CallType>

Source§

fn is_in_function(&self) -> bool

Returns true if the context is in function scope.
Source§

fn inherits_type(&self, typ: BlockScopeType) -> bool

Returns true if the scope or any of its parents is of the given type.
Source§

fn resolve_path( + &self, + path: &Path, + span: Span, +) -> Result<NamedThing, FatalError>

Resolves the given path and registers all errors
Source§

fn resolve_visible_path(&self, path: &Path) -> Option<NamedThing>

Resolves the given path only if it is visible. Does not register any errors
Source§

fn resolve_any_path(&self, path: &Path) -> Option<NamedThing>

Resolves the given path. Does not register any errors
Source§

fn add_diagnostic(&self, diag: Diagnostic)

Source§

fn get_context_type(&self) -> Option<TypeId>

Returns the Context type, if it is defined.
Source§

fn error( + &self, + message: &str, + label_span: Span, + label: &str, +) -> DiagnosticVoucher

Source§

fn root_item(&self) -> Item

Returns a non-function item that encloses a context. Read more
Source§

fn type_error( + &self, + message: &str, + span: Span, + expected: TypeId, + actual: TypeId, +) -> DiagnosticVoucher

Source§

fn not_yet_implemented(&self, feature: &str, span: Span) -> DiagnosticVoucher

Source§

fn fancy_error( + &self, + message: &str, + labels: Vec<Label>, + notes: Vec<String>, +) -> DiagnosticVoucher

Source§

fn duplicate_name_error( + &self, + message: &str, + name: &str, + original: Span, + duplicate: Span, +) -> DiagnosticVoucher

Source§

fn name_conflict_error( + &self, + name_kind: &str, + name: &str, + original: &NamedThing, + original_span: Option<Span>, + duplicate_span: Span, +) -> DiagnosticVoucher

Source§

fn register_diag(&self, diag: Diagnostic) -> DiagnosticVoucher

Auto Trait Implementations§

§

impl<'a, 'b> !Freeze for BlockScope<'a, 'b>

§

impl<'a, 'b> !RefUnwindSafe for BlockScope<'a, 'b>

§

impl<'a, 'b> !Send for BlockScope<'a, 'b>

§

impl<'a, 'b> !Sync for BlockScope<'a, 'b>

§

impl<'a, 'b> Unpin for BlockScope<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for BlockScope<'a, 'b>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/scopes/struct.FunctionScope.html b/compiler-docs/fe_analyzer/namespace/scopes/struct.FunctionScope.html new file mode 100644 index 0000000000..2e30c071c4 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/scopes/struct.FunctionScope.html @@ -0,0 +1,66 @@ +FunctionScope in fe_analyzer::namespace::scopes - Rust

Struct FunctionScope

Source
pub struct FunctionScope<'a> {
+    pub db: &'a dyn AnalyzerDb,
+    pub function: FunctionId,
+    pub body: RefCell<FunctionBody>,
+    pub diagnostics: RefCell<Vec<Diagnostic>>,
+}

Fields§

§db: &'a dyn AnalyzerDb§function: FunctionId§body: RefCell<FunctionBody>§diagnostics: RefCell<Vec<Diagnostic>>

Implementations§

Source§

impl<'a> FunctionScope<'a>

Source

pub fn new(db: &'a dyn AnalyzerDb, function: FunctionId) -> Self

Source

pub fn function_return_type(&self) -> Result<TypeId, TypeError>

Source

pub fn map_variable_type<T>(&self, node: &Node<T>, typ: TypeId)

Source

pub fn map_pattern_matrix(&self, node: &Node<FuncStmt>, matrix: PatternMatrix)

Trait Implementations§

Source§

impl<'a> AnalyzerContext for FunctionScope<'a>

Source§

fn db(&self) -> &dyn AnalyzerDb

Source§

fn add_diagnostic(&self, diag: Diagnostic)

Source§

fn add_expression(&self, node: &Node<Expr>, attributes: ExpressionAttributes)

Attribute contextual information to an expression node. Read more
Source§

fn update_expression( + &self, + node: &Node<Expr>, + f: &dyn Fn(&mut ExpressionAttributes), +)

Update the expression attributes. Read more
Source§

fn expr_typ(&self, expr: &Node<Expr>) -> Type

Returns a type of an expression. Read more
Source§

fn add_constant( + &self, + _name: &Node<SmolStr>, + expr: &Node<Expr>, + value: Constant, +)

Add evaluated constant value in a constant declaration to the context.
Source§

fn constant_value_by_name( + &self, + _name: &SmolStr, + _span: Span, +) -> Result<Option<Constant>, IncompleteItem>

Returns constant value from variable name.
Source§

fn parent(&self) -> Item

Returns an item enclosing current context. Read more
Source§

fn module(&self) -> ModuleId

Returns the module enclosing current context.
Source§

fn parent_function(&self) -> FunctionId

Returns a function id that encloses a context. Read more
Source§

fn add_call(&self, node: &Node<Expr>, call_type: CallType)

Panics Read more
Source§

fn get_call(&self, node: &Node<Expr>) -> Option<CallType>

Source§

fn is_in_function(&self) -> bool

Returns true if the context is in function scope.
Source§

fn inherits_type(&self, _typ: BlockScopeType) -> bool

Returns true if the scope or any of its parents is of the given type.
Source§

fn resolve_name( + &self, + name: &str, + span: Span, +) -> Result<Option<NamedThing>, IncompleteItem>

Source§

fn resolve_path( + &self, + path: &Path, + span: Span, +) -> Result<NamedThing, FatalError>

Resolves the given path and registers all errors
Source§

fn resolve_visible_path(&self, path: &Path) -> Option<NamedThing>

Resolves the given path only if it is visible. Does not register any errors
Source§

fn resolve_any_path(&self, path: &Path) -> Option<NamedThing>

Resolves the given path. Does not register any errors
Source§

fn get_context_type(&self) -> Option<TypeId>

Returns the Context type, if it is defined.
Source§

fn error( + &self, + message: &str, + label_span: Span, + label: &str, +) -> DiagnosticVoucher

Source§

fn root_item(&self) -> Item

Returns a non-function item that encloses a context. Read more
Source§

fn type_error( + &self, + message: &str, + span: Span, + expected: TypeId, + actual: TypeId, +) -> DiagnosticVoucher

Source§

fn not_yet_implemented(&self, feature: &str, span: Span) -> DiagnosticVoucher

Source§

fn fancy_error( + &self, + message: &str, + labels: Vec<Label>, + notes: Vec<String>, +) -> DiagnosticVoucher

Source§

fn duplicate_name_error( + &self, + message: &str, + name: &str, + original: Span, + duplicate: Span, +) -> DiagnosticVoucher

Source§

fn name_conflict_error( + &self, + name_kind: &str, + name: &str, + original: &NamedThing, + original_span: Option<Span>, + duplicate_span: Span, +) -> DiagnosticVoucher

Source§

fn register_diag(&self, diag: Diagnostic) -> DiagnosticVoucher

Auto Trait Implementations§

§

impl<'a> !Freeze for FunctionScope<'a>

§

impl<'a> !RefUnwindSafe for FunctionScope<'a>

§

impl<'a> !Send for FunctionScope<'a>

§

impl<'a> !Sync for FunctionScope<'a>

§

impl<'a> Unpin for FunctionScope<'a>

§

impl<'a> !UnwindSafe for FunctionScope<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/scopes/struct.ItemScope.html b/compiler-docs/fe_analyzer/namespace/scopes/struct.ItemScope.html new file mode 100644 index 0000000000..f84042777a --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/scopes/struct.ItemScope.html @@ -0,0 +1,65 @@ +ItemScope in fe_analyzer::namespace::scopes - Rust

Struct ItemScope

Source
pub struct ItemScope<'a> {
+    pub diagnostics: RefCell<Vec<Diagnostic>>,
+    /* private fields */
+}

Fields§

§diagnostics: RefCell<Vec<Diagnostic>>

Implementations§

Source§

impl<'a> ItemScope<'a>

Source

pub fn new(db: &'a dyn AnalyzerDb, module: ModuleId) -> Self

Trait Implementations§

Source§

impl<'a> AnalyzerContext for ItemScope<'a>

Source§

fn get_context_type(&self) -> Option<TypeId>

Gets std::context::Context if it exists

+
Source§

fn db(&self) -> &dyn AnalyzerDb

Source§

fn add_expression(&self, node: &Node<Expr>, attributes: ExpressionAttributes)

Attribute contextual information to an expression node. Read more
Source§

fn update_expression( + &self, + node: &Node<Expr>, + f: &dyn Fn(&mut ExpressionAttributes), +)

Update the expression attributes. Read more
Source§

fn expr_typ(&self, expr: &Node<Expr>) -> Type

Returns a type of an expression. Read more
Source§

fn add_constant( + &self, + _name: &Node<SmolStr>, + _expr: &Node<Expr>, + _value: Constant, +)

Add evaluated constant value in a constant declaration to the context.
Source§

fn constant_value_by_name( + &self, + name: &SmolStr, + _span: Span, +) -> Result<Option<Constant>, IncompleteItem>

Returns constant value from variable name.
Source§

fn parent(&self) -> Item

Returns an item enclosing current context. Read more
Source§

fn module(&self) -> ModuleId

Returns the module enclosing current context.
Source§

fn parent_function(&self) -> FunctionId

Returns a function id that encloses a context. Read more
Source§

fn add_call(&self, _node: &Node<Expr>, _call_type: CallType)

Panics Read more
Source§

fn get_call(&self, _node: &Node<Expr>) -> Option<CallType>

Source§

fn is_in_function(&self) -> bool

Returns true if the context is in function scope.
Source§

fn inherits_type(&self, _typ: BlockScopeType) -> bool

Returns true if the scope or any of its parents is of the given type.
Source§

fn resolve_name( + &self, + name: &str, + span: Span, +) -> Result<Option<NamedThing>, IncompleteItem>

Source§

fn resolve_path( + &self, + path: &Path, + span: Span, +) -> Result<NamedThing, FatalError>

Resolves the given path and registers all errors
Source§

fn resolve_visible_path(&self, path: &Path) -> Option<NamedThing>

Resolves the given path only if it is visible. Does not register any errors
Source§

fn resolve_any_path(&self, path: &Path) -> Option<NamedThing>

Resolves the given path. Does not register any errors
Source§

fn add_diagnostic(&self, diag: Diagnostic)

Source§

fn error( + &self, + message: &str, + label_span: Span, + label: &str, +) -> DiagnosticVoucher

Source§

fn root_item(&self) -> Item

Returns a non-function item that encloses a context. Read more
Source§

fn type_error( + &self, + message: &str, + span: Span, + expected: TypeId, + actual: TypeId, +) -> DiagnosticVoucher

Source§

fn not_yet_implemented(&self, feature: &str, span: Span) -> DiagnosticVoucher

Source§

fn fancy_error( + &self, + message: &str, + labels: Vec<Label>, + notes: Vec<String>, +) -> DiagnosticVoucher

Source§

fn duplicate_name_error( + &self, + message: &str, + name: &str, + original: Span, + duplicate: Span, +) -> DiagnosticVoucher

Source§

fn name_conflict_error( + &self, + name_kind: &str, + name: &str, + original: &NamedThing, + original_span: Option<Span>, + duplicate_span: Span, +) -> DiagnosticVoucher

Source§

fn register_diag(&self, diag: Diagnostic) -> DiagnosticVoucher

Auto Trait Implementations§

§

impl<'a> !Freeze for ItemScope<'a>

§

impl<'a> !RefUnwindSafe for ItemScope<'a>

§

impl<'a> !Send for ItemScope<'a>

§

impl<'a> !Sync for ItemScope<'a>

§

impl<'a> Unpin for ItemScope<'a>

§

impl<'a> !UnwindSafe for ItemScope<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/sidebar-items.js b/compiler-docs/fe_analyzer/namespace/sidebar-items.js new file mode 100644 index 0000000000..46a2407c74 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["items","scopes","types"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/constant.U256.html b/compiler-docs/fe_analyzer/namespace/types/constant.U256.html new file mode 100644 index 0000000000..1e86bcce3f --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/constant.U256.html @@ -0,0 +1 @@ +U256 in fe_analyzer::namespace::types - Rust

Constant U256

Source
pub const U256: Base;
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/enum.Base.html b/compiler-docs/fe_analyzer/namespace/types/enum.Base.html new file mode 100644 index 0000000000..b31c825294 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/enum.Base.html @@ -0,0 +1,37 @@ +Base in fe_analyzer::namespace::types - Rust

Enum Base

Source
pub enum Base {
+    Numeric(Integer),
+    Bool,
+    Address,
+    Unit,
+}

Variants§

§

Numeric(Integer)

§

Bool

§

Address

§

Unit

Implementations§

Source§

impl Base

Source

pub fn name(&self) -> SmolStr

Source

pub fn u256() -> Base

Trait Implementations§

Source§

impl Clone for Base

Source§

fn clone(&self) -> Base

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Base

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Base

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Base> for Type

Source§

fn from(value: Base) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Base

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Base

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Base

Source§

fn cmp(&self, other: &Base) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Base

Source§

fn eq(&self, other: &Base) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for Base

Source§

fn partial_cmp(&self, other: &Base) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for Base

Source§

impl Eq for Base

Source§

impl StructuralPartialEq for Base

Auto Trait Implementations§

§

impl Freeze for Base

§

impl RefUnwindSafe for Base

§

impl Send for Base

§

impl Sync for Base

§

impl Unpin for Base

§

impl UnwindSafe for Base

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/enum.GenericArg.html b/compiler-docs/fe_analyzer/namespace/types/enum.GenericArg.html new file mode 100644 index 0000000000..9abc7cb984 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/enum.GenericArg.html @@ -0,0 +1,25 @@ +GenericArg in fe_analyzer::namespace::types - Rust

Enum GenericArg

Source
pub enum GenericArg {
+    Int(usize),
+    Type(TypeId),
+}

Variants§

§

Int(usize)

§

Type(TypeId)

Trait Implementations§

Source§

impl Clone for GenericArg

Source§

fn clone(&self) -> GenericArg

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GenericArg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for GenericArg

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GenericArg

Source§

fn eq(&self, other: &GenericArg) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for GenericArg

Source§

impl StructuralPartialEq for GenericArg

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/enum.GenericParamKind.html b/compiler-docs/fe_analyzer/namespace/types/enum.GenericParamKind.html new file mode 100644 index 0000000000..30abd145a4 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/enum.GenericParamKind.html @@ -0,0 +1,26 @@ +GenericParamKind in fe_analyzer::namespace::types - Rust

Enum GenericParamKind

Source
pub enum GenericParamKind {
+    Int,
+    PrimitiveType,
+    AnyType,
+}

Variants§

§

Int

§

PrimitiveType

§

AnyType

Trait Implementations§

Source§

impl Clone for GenericParamKind

Source§

fn clone(&self) -> GenericParamKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GenericParamKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for GenericParamKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GenericParamKind

Source§

fn eq(&self, other: &GenericParamKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for GenericParamKind

Source§

impl Eq for GenericParamKind

Source§

impl StructuralPartialEq for GenericParamKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/enum.GenericType.html b/compiler-docs/fe_analyzer/namespace/types/enum.GenericType.html new file mode 100644 index 0000000000..c6669994e6 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/enum.GenericType.html @@ -0,0 +1,35 @@ +GenericType in fe_analyzer::namespace::types - Rust

Enum GenericType

Source
pub enum GenericType {
+    Array,
+    String,
+    Map,
+}

Variants§

§

Array

§

String

§

Map

Implementations§

Source§

impl GenericType

Source

pub fn name(&self) -> SmolStr

Source

pub fn params(&self) -> Vec<GenericParam>

Source

pub fn apply(&self, db: &dyn AnalyzerDb, args: &[GenericArg]) -> Option<TypeId>

Trait Implementations§

Source§

impl AsRef<str> for GenericType

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for GenericType

Source§

fn clone(&self) -> GenericType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GenericType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for GenericType

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<GenericType, <Self as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for GenericType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoEnumIterator for GenericType

Source§

impl Ord for GenericType

Source§

fn cmp(&self, other: &GenericType) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for GenericType

Source§

fn eq(&self, other: &GenericType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for GenericType

Source§

fn partial_cmp(&self, other: &GenericType) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl TryFrom<&str> for GenericType

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<GenericType, <Self as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl Copy for GenericType

Source§

impl Eq for GenericType

Source§

impl StructuralPartialEq for GenericType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/enum.Integer.html b/compiler-docs/fe_analyzer/namespace/types/enum.Integer.html new file mode 100644 index 0000000000..22ea8ae69c --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/enum.Integer.html @@ -0,0 +1,52 @@ +Integer in fe_analyzer::namespace::types - Rust

Enum Integer

Source
pub enum Integer {
+    U256,
+    U128,
+    U64,
+    U32,
+    U16,
+    U8,
+    I256,
+    I128,
+    I64,
+    I32,
+    I16,
+    I8,
+}

Variants§

§

U256

§

U128

§

U64

§

U32

§

U16

§

U8

§

I256

§

I128

§

I64

§

I32

§

I16

§

I8

Implementations§

Source§

impl Integer

Source

pub fn is_signed(&self) -> bool

Returns true if the integer is signed, otherwise false

+
Source

pub fn size(&self) -> usize

Source

pub fn bits(&self) -> usize

Returns size of integer type in bits.

+
Source

pub fn can_hold(&self, other: Integer) -> bool

Returns true if the integer is at least the same size (or larger) than +other

+
Source

pub fn fits(&self, num: BigInt) -> bool

Returns true if num represents a number that fits the type

+
Source

pub fn max_value(&self) -> BigInt

Returns max value of the integer type.

+
Source

pub fn min_value(&self) -> BigInt

Returns min value of the integer type.

+

Trait Implementations§

Source§

impl AsRef<str> for Integer

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Integer

Source§

fn clone(&self) -> Integer

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Integer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Integer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for Integer

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Integer, <Self as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Integer

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoEnumIterator for Integer

Source§

impl Ord for Integer

Source§

fn cmp(&self, other: &Integer) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Integer

Source§

fn eq(&self, other: &Integer) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for Integer

Source§

fn partial_cmp(&self, other: &Integer) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl TryFrom<&str> for Integer

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<Integer, <Self as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl Copy for Integer

Source§

impl Eq for Integer

Source§

impl StructuralPartialEq for Integer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/enum.TraitOrType.html b/compiler-docs/fe_analyzer/namespace/types/enum.TraitOrType.html new file mode 100644 index 0000000000..36d1fb162e --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/enum.TraitOrType.html @@ -0,0 +1,25 @@ +TraitOrType in fe_analyzer::namespace::types - Rust

Enum TraitOrType

Source
pub enum TraitOrType {
+    TraitId(TraitId),
+    TypeId(TypeId),
+}

Variants§

§

TraitId(TraitId)

§

TypeId(TypeId)

Trait Implementations§

Source§

impl Clone for TraitOrType

Source§

fn clone(&self) -> TraitOrType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TraitOrType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for TraitOrType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TraitOrType

Source§

fn eq(&self, other: &TraitOrType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for TraitOrType

Source§

impl StructuralPartialEq for TraitOrType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/enum.Type.html b/compiler-docs/fe_analyzer/namespace/types/enum.Type.html new file mode 100644 index 0000000000..b7db921754 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/enum.Type.html @@ -0,0 +1,48 @@ +Type in fe_analyzer::namespace::types - Rust

Enum Type

Source
pub enum Type {
+
Show 13 variants Base(Base), + Array(Array), + Map(Map), + Tuple(Tuple), + String(FeString), + Contract(ContractId), + SelfContract(ContractId), + SelfType(TraitOrType), + Struct(StructId), + Enum(EnumId), + Generic(Generic), + SPtr(TypeId), + Mut(TypeId), +
}

Variants§

§

Base(Base)

§

Array(Array)

§

Map(Map)

§

Tuple(Tuple)

§

String(FeString)

§

Contract(ContractId)

An “external” contract. Effectively just a newtyped address.

+
§

SelfContract(ContractId)

The type of a contract while it’s being executed. Ie. the type +of self within a contract function.

+
§

SelfType(TraitOrType)

§

Struct(StructId)

§

Enum(EnumId)

§

Generic(Generic)

§

SPtr(TypeId)

§

Mut(TypeId)

Implementations§

Source§

impl Type

Source

pub fn id(&self, db: &dyn AnalyzerDb) -> TypeId

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn def_span(&self, context: &dyn AnalyzerContext) -> Option<Span>

Source

pub fn bool() -> Self

Creates an instance of bool.

+
Source

pub fn address() -> Self

Creates an instance of address.

+
Source

pub fn u256() -> Self

Creates an instance of u256.

+
Source

pub fn u8() -> Self

Creates an instance of u8.

+
Source

pub fn unit() -> Self

Creates an instance of ().

+
Source

pub fn is_unit(&self) -> bool

Source

pub fn int(int_type: Integer) -> Self

Source

pub fn has_fixed_size(&self, db: &dyn AnalyzerDb) -> bool

Trait Implementations§

Source§

impl Clone for Type

Source§

fn clone(&self) -> Type

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Type

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DisplayWithDb for Type

Source§

fn format(&self, db: &dyn AnalyzerDb, f: &mut Formatter<'_>) -> Result

Source§

impl From<Base> for Type

Source§

fn from(value: Base) -> Self

Converts to this type from the input type.
Source§

impl Hash for Type

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Type

Source§

fn eq(&self, other: &Type) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Type

Source§

impl StructuralPartialEq for Type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl !Send for Type

§

impl !Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Displayable for T
where + T: DisplayWithDb,

Source§

fn display<'a, 'b>( + &'a self, + db: &'b dyn AnalyzerDb, +) -> DisplayableWrapper<'b, &'a Self>

Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/fn.address_max.html b/compiler-docs/fe_analyzer/namespace/types/fn.address_max.html new file mode 100644 index 0000000000..a2a6d2e9b4 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/fn.address_max.html @@ -0,0 +1 @@ +address_max in fe_analyzer::namespace::types - Rust

Function address_max

Source
pub fn address_max() -> BigInt
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/fn.i256_max.html b/compiler-docs/fe_analyzer/namespace/types/fn.i256_max.html new file mode 100644 index 0000000000..ebbfaad3c4 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/fn.i256_max.html @@ -0,0 +1 @@ +i256_max in fe_analyzer::namespace::types - Rust

Function i256_max

Source
pub fn i256_max() -> BigInt
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/fn.i256_min.html b/compiler-docs/fe_analyzer/namespace/types/fn.i256_min.html new file mode 100644 index 0000000000..f479aa572f --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/fn.i256_min.html @@ -0,0 +1 @@ +i256_min in fe_analyzer::namespace::types - Rust

Function i256_min

Source
pub fn i256_min() -> BigInt
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/fn.u256_max.html b/compiler-docs/fe_analyzer/namespace/types/fn.u256_max.html new file mode 100644 index 0000000000..cbc9d6ab9d --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/fn.u256_max.html @@ -0,0 +1 @@ +u256_max in fe_analyzer::namespace::types - Rust

Function u256_max

Source
pub fn u256_max() -> BigInt
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/fn.u256_min.html b/compiler-docs/fe_analyzer/namespace/types/fn.u256_min.html new file mode 100644 index 0000000000..37ac9f16f0 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/fn.u256_min.html @@ -0,0 +1 @@ +u256_min in fe_analyzer::namespace::types - Rust

Function u256_min

Source
pub fn u256_min() -> BigInt
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/index.html b/compiler-docs/fe_analyzer/namespace/types/index.html new file mode 100644 index 0000000000..ae89345bdc --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/index.html @@ -0,0 +1 @@ +fe_analyzer::namespace::types - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/sidebar-items.js b/compiler-docs/fe_analyzer/namespace/types/sidebar-items.js new file mode 100644 index 0000000000..97668c6126 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["U256"],"enum":["Base","GenericArg","GenericParamKind","GenericType","Integer","TraitOrType","Type"],"fn":["address_max","i256_max","i256_min","u256_max","u256_min"],"struct":["Array","CtxDecl","FeString","FunctionParam","FunctionSignature","Generic","GenericParam","GenericTypeIter","IntegerIter","Map","SelfDecl","Tuple","TypeId"],"trait":["SafeNames","TypeDowncast"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.Array.html b/compiler-docs/fe_analyzer/namespace/types/struct.Array.html new file mode 100644 index 0000000000..cc840a3d31 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.Array.html @@ -0,0 +1,25 @@ +Array in fe_analyzer::namespace::types - Rust

Struct Array

Source
pub struct Array {
+    pub size: usize,
+    pub inner: TypeId,
+}

Fields§

§size: usize§inner: TypeId

Trait Implementations§

Source§

impl Clone for Array

Source§

fn clone(&self) -> Array

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Array

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Array

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Array

Source§

fn eq(&self, other: &Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for Array

Source§

impl Eq for Array

Source§

impl StructuralPartialEq for Array

Auto Trait Implementations§

§

impl Freeze for Array

§

impl RefUnwindSafe for Array

§

impl Send for Array

§

impl Sync for Array

§

impl Unpin for Array

§

impl UnwindSafe for Array

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.CtxDecl.html b/compiler-docs/fe_analyzer/namespace/types/struct.CtxDecl.html new file mode 100644 index 0000000000..faac5c0a70 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.CtxDecl.html @@ -0,0 +1,25 @@ +CtxDecl in fe_analyzer::namespace::types - Rust

Struct CtxDecl

Source
pub struct CtxDecl {
+    pub span: Span,
+    pub mut_: Option<Span>,
+}

Fields§

§span: Span§mut_: Option<Span>

Trait Implementations§

Source§

impl Clone for CtxDecl

Source§

fn clone(&self) -> CtxDecl

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CtxDecl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for CtxDecl

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CtxDecl

Source§

fn eq(&self, other: &CtxDecl) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for CtxDecl

Source§

impl Eq for CtxDecl

Source§

impl StructuralPartialEq for CtxDecl

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.FeString.html b/compiler-docs/fe_analyzer/namespace/types/struct.FeString.html new file mode 100644 index 0000000000..912e569017 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.FeString.html @@ -0,0 +1,34 @@ +FeString in fe_analyzer::namespace::types - Rust

Struct FeString

Source
pub struct FeString {
+    pub max_size: usize,
+}

Fields§

§max_size: usize

Trait Implementations§

Source§

impl Clone for FeString

Source§

fn clone(&self) -> FeString

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FeString

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FeString

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FeString

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for FeString

Source§

fn cmp(&self, other: &FeString) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for FeString

Source§

fn eq(&self, other: &FeString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for FeString

Source§

fn partial_cmp(&self, other: &FeString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for FeString

Source§

impl Eq for FeString

Source§

impl StructuralPartialEq for FeString

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.FunctionParam.html b/compiler-docs/fe_analyzer/namespace/types/struct.FunctionParam.html new file mode 100644 index 0000000000..617cdc27c9 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.FunctionParam.html @@ -0,0 +1,30 @@ +FunctionParam in fe_analyzer::namespace::types - Rust

Struct FunctionParam

Source
pub struct FunctionParam {
+    pub name: SmolStr,
+    pub typ: Result<TypeId, TypeError>,
+    /* private fields */
+}

Fields§

§name: SmolStr§typ: Result<TypeId, TypeError>

Implementations§

Source§

impl FunctionParam

Source

pub fn new( + label: Option<&str>, + name: &str, + typ: Result<TypeId, TypeError>, +) -> Self

Source

pub fn label(&self) -> Option<&str>

Trait Implementations§

Source§

impl Clone for FunctionParam

Source§

fn clone(&self) -> FunctionParam

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionParam

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FunctionParam

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FunctionParam

Source§

fn eq(&self, other: &FunctionParam) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for FunctionParam

Source§

impl StructuralPartialEq for FunctionParam

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.FunctionSignature.html b/compiler-docs/fe_analyzer/namespace/types/struct.FunctionSignature.html new file mode 100644 index 0000000000..9ec40de98c --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.FunctionSignature.html @@ -0,0 +1,31 @@ +FunctionSignature in fe_analyzer::namespace::types - Rust

Struct FunctionSignature

Source
pub struct FunctionSignature {
+    pub self_decl: Option<SelfDecl>,
+    pub ctx_decl: Option<CtxDecl>,
+    pub params: Vec<FunctionParam>,
+    pub return_type: Result<TypeId, TypeError>,
+}

Fields§

§self_decl: Option<SelfDecl>§ctx_decl: Option<CtxDecl>§params: Vec<FunctionParam>§return_type: Result<TypeId, TypeError>

Trait Implementations§

Source§

impl Clone for FunctionSignature

Source§

fn clone(&self) -> FunctionSignature

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionSignature

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DisplayWithDb for FunctionSignature

Source§

fn format(&self, db: &dyn AnalyzerDb, f: &mut Formatter<'_>) -> Result

Source§

impl Hash for FunctionSignature

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FunctionSignature

Source§

fn eq(&self, other: &FunctionSignature) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for FunctionSignature

Source§

impl StructuralPartialEq for FunctionSignature

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Displayable for T
where + T: DisplayWithDb,

Source§

fn display<'a, 'b>( + &'a self, + db: &'b dyn AnalyzerDb, +) -> DisplayableWrapper<'b, &'a Self>

Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.Generic.html b/compiler-docs/fe_analyzer/namespace/types/struct.Generic.html new file mode 100644 index 0000000000..056ae4c8ed --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.Generic.html @@ -0,0 +1,34 @@ +Generic in fe_analyzer::namespace::types - Rust

Struct Generic

Source
pub struct Generic {
+    pub name: SmolStr,
+    pub bounds: Rc<[TraitId]>,
+}

Fields§

§name: SmolStr§bounds: Rc<[TraitId]>

Trait Implementations§

Source§

impl Clone for Generic

Source§

fn clone(&self) -> Generic

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Generic

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Generic

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Generic

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Generic

Source§

fn cmp(&self, other: &Generic) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Generic

Source§

fn eq(&self, other: &Generic) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for Generic

Source§

fn partial_cmp(&self, other: &Generic) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Eq for Generic

Source§

impl StructuralPartialEq for Generic

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.GenericParam.html b/compiler-docs/fe_analyzer/namespace/types/struct.GenericParam.html new file mode 100644 index 0000000000..9479bf5d02 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.GenericParam.html @@ -0,0 +1,14 @@ +GenericParam in fe_analyzer::namespace::types - Rust

Struct GenericParam

Source
pub struct GenericParam {
+    pub name: SmolStr,
+    pub kind: GenericParamKind,
+}

Fields§

§name: SmolStr§kind: GenericParamKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.GenericTypeIter.html b/compiler-docs/fe_analyzer/namespace/types/struct.GenericTypeIter.html new file mode 100644 index 0000000000..2892d21faa --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.GenericTypeIter.html @@ -0,0 +1,221 @@ +GenericTypeIter in fe_analyzer::namespace::types - Rust

Struct GenericTypeIter

Source
pub struct GenericTypeIter { /* private fields */ }

Trait Implementations§

Source§

impl Clone for GenericTypeIter

Source§

fn clone(&self) -> GenericTypeIter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DoubleEndedIterator for GenericTypeIter

Source§

fn next_back(&mut self) -> Option<<Self as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
Source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.37.0 · Source§

fn nth_back(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element from the end of the iterator. Read more
1.27.0 · Source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes +elements starting from the back of the iterator. Read more
1.27.0 · Source§

fn rfold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single, +final value, starting from the back. Read more
1.27.0 · Source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
Source§

impl ExactSizeIterator for GenericTypeIter

Source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
Source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
Source§

impl Iterator for GenericTypeIter

Source§

type Item = GenericType

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<<Self as Iterator>::Item>

Advances the iterator and returns the next value. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
Source§

fn nth(&mut self, n: usize) -> Option<<Self as Iterator>::Item>

Returns the nth element of the iterator. Read more
Source§

fn next_chunk<const N: usize>( + &mut self, +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where + T: 'a, + Self: Sized + DoubleEndedIterator<Item = &'a mut T>, + P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
Source§

fn try_reduce<R>( + &mut self, + f: impl FnMut(Self::Item, Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
Source§

fn try_find<R>( + &mut self, + f: impl FnMut(&Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where + P: FnMut(Self::Item) -> bool, + Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its +index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · Source§

fn rev(self) -> Rev<Self>
where + Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: Copy + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: Clone + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · Source§

fn cycle(self) -> Cycle<Self>
where + Self: Sized + Clone,

Repeats an iterator endlessly. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<I> IntoIterator for I
where + I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.IntegerIter.html b/compiler-docs/fe_analyzer/namespace/types/struct.IntegerIter.html new file mode 100644 index 0000000000..1735a9edab --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.IntegerIter.html @@ -0,0 +1,221 @@ +IntegerIter in fe_analyzer::namespace::types - Rust

Struct IntegerIter

Source
pub struct IntegerIter { /* private fields */ }

Trait Implementations§

Source§

impl Clone for IntegerIter

Source§

fn clone(&self) -> IntegerIter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DoubleEndedIterator for IntegerIter

Source§

fn next_back(&mut self) -> Option<<Self as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
Source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.37.0 · Source§

fn nth_back(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element from the end of the iterator. Read more
1.27.0 · Source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes +elements starting from the back of the iterator. Read more
1.27.0 · Source§

fn rfold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single, +final value, starting from the back. Read more
1.27.0 · Source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
Source§

impl ExactSizeIterator for IntegerIter

Source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
Source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
Source§

impl Iterator for IntegerIter

Source§

type Item = Integer

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<<Self as Iterator>::Item>

Advances the iterator and returns the next value. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
Source§

fn nth(&mut self, n: usize) -> Option<<Self as Iterator>::Item>

Returns the nth element of the iterator. Read more
Source§

fn next_chunk<const N: usize>( + &mut self, +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where + T: 'a, + Self: Sized + DoubleEndedIterator<Item = &'a mut T>, + P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
Source§

fn try_reduce<R>( + &mut self, + f: impl FnMut(Self::Item, Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
Source§

fn try_find<R>( + &mut self, + f: impl FnMut(&Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where + P: FnMut(Self::Item) -> bool, + Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its +index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · Source§

fn rev(self) -> Rev<Self>
where + Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: Copy + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: Clone + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · Source§

fn cycle(self) -> Cycle<Self>
where + Self: Sized + Clone,

Repeats an iterator endlessly. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<I> IntoIterator for I
where + I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.Map.html b/compiler-docs/fe_analyzer/namespace/types/struct.Map.html new file mode 100644 index 0000000000..310013f626 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.Map.html @@ -0,0 +1,25 @@ +Map in fe_analyzer::namespace::types - Rust

Struct Map

Source
pub struct Map {
+    pub key: TypeId,
+    pub value: TypeId,
+}

Fields§

§key: TypeId§value: TypeId

Trait Implementations§

Source§

impl Clone for Map

Source§

fn clone(&self) -> Map

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Map

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Map

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Map

Source§

fn eq(&self, other: &Map) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Map

Source§

impl StructuralPartialEq for Map

Auto Trait Implementations§

§

impl Freeze for Map

§

impl RefUnwindSafe for Map

§

impl Send for Map

§

impl Sync for Map

§

impl Unpin for Map

§

impl UnwindSafe for Map

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.SelfDecl.html b/compiler-docs/fe_analyzer/namespace/types/struct.SelfDecl.html new file mode 100644 index 0000000000..5b79ee103d --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.SelfDecl.html @@ -0,0 +1,25 @@ +SelfDecl in fe_analyzer::namespace::types - Rust

Struct SelfDecl

Source
pub struct SelfDecl {
+    pub span: Span,
+    pub mut_: Option<Span>,
+}

Fields§

§span: Span§mut_: Option<Span>

Implementations§

Source§

impl SelfDecl

Source

pub fn is_mut(&self) -> bool

Trait Implementations§

Source§

impl Clone for SelfDecl

Source§

fn clone(&self) -> SelfDecl

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SelfDecl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for SelfDecl

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SelfDecl

Source§

fn eq(&self, other: &SelfDecl) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for SelfDecl

Source§

impl Eq for SelfDecl

Source§

impl StructuralPartialEq for SelfDecl

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.Tuple.html b/compiler-docs/fe_analyzer/namespace/types/struct.Tuple.html new file mode 100644 index 0000000000..8d2de2acc4 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.Tuple.html @@ -0,0 +1,24 @@ +Tuple in fe_analyzer::namespace::types - Rust

Struct Tuple

Source
pub struct Tuple {
+    pub items: Rc<[TypeId]>,
+}

Fields§

§items: Rc<[TypeId]>

Trait Implementations§

Source§

impl Clone for Tuple

Source§

fn clone(&self) -> Tuple

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Tuple

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Tuple

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Tuple

Source§

fn eq(&self, other: &Tuple) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Tuple

Source§

impl StructuralPartialEq for Tuple

Auto Trait Implementations§

§

impl Freeze for Tuple

§

impl RefUnwindSafe for Tuple

§

impl !Send for Tuple

§

impl !Sync for Tuple

§

impl Unpin for Tuple

§

impl UnwindSafe for Tuple

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/struct.TypeId.html b/compiler-docs/fe_analyzer/namespace/types/struct.TypeId.html new file mode 100644 index 0000000000..de3fc5dce5 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/struct.TypeId.html @@ -0,0 +1,71 @@ +TypeId in fe_analyzer::namespace::types - Rust

Struct TypeId

Source
pub struct TypeId(/* private fields */);

Implementations§

Source§

impl TypeId

Source

pub fn unit(db: &dyn AnalyzerDb) -> Self

Source

pub fn bool(db: &dyn AnalyzerDb) -> Self

Source

pub fn int(db: &dyn AnalyzerDb, int: Integer) -> Self

Source

pub fn address(db: &dyn AnalyzerDb) -> Self

Source

pub fn base(db: &dyn AnalyzerDb, t: Base) -> Self

Source

pub fn tuple(db: &dyn AnalyzerDb, items: &[TypeId]) -> Self

Source

pub fn typ(&self, db: &dyn AnalyzerDb) -> Type

Source

pub fn deref_typ(&self, db: &dyn AnalyzerDb) -> Type

Source

pub fn deref(self, db: &dyn AnalyzerDb) -> TypeId

Source

pub fn make_sptr(self, db: &dyn AnalyzerDb) -> TypeId

Source

pub fn has_fixed_size(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_primitive(&self, db: &dyn AnalyzerDb) -> bool

true if Type::Base or Type::Contract (which is just an Address)

+
Source

pub fn is_bool(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_contract(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_integer(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_map(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_string(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_self_ty(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn as_struct(&self, db: &dyn AnalyzerDb) -> Option<StructId>

Source

pub fn as_trait_or_type(&self) -> TraitOrType

Source

pub fn is_struct(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_sptr(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_generic(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_mut(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn kind_display_name(&self, db: &dyn AnalyzerDb) -> &str

Source

pub fn get_impl_for( + &self, + db: &dyn AnalyzerDb, + trait_: TraitId, +) -> Option<ImplId>

Return the impl for the given trait. There can only ever be a single +implementation per concrete type and trait.

+
Source

pub fn trait_function_candidates( + &self, + context: &mut dyn AnalyzerContext, + fn_name: &str, +) -> (Vec<(FunctionId, ImplId)>, Vec<(FunctionId, ImplId)>)

Looks up all possible candidates of the given function name that are implemented via traits. +Groups results in two lists, the first contains all theoretical possible candidates and +the second contains only those that are actually callable because the trait is in scope.

+
Source

pub fn function_sig( + &self, + db: &dyn AnalyzerDb, + name: &str, +) -> Option<FunctionSigId>

Signature for the function with the given name defined directly on the type. +Does not consider trait impls.

+
Source

pub fn function_sigs( + &self, + db: &dyn AnalyzerDb, + name: &str, +) -> Rc<[FunctionSigId]>

Like function_sig but returns a Vec<FunctionSigId> which not only +considers functions natively implemented on the type but also those +that are provided by implemented traits on the type.

+
Source

pub fn self_function( + &self, + db: &dyn AnalyzerDb, + name: &str, +) -> Option<FunctionSigId>

Source

pub fn is_emittable(self, db: &dyn AnalyzerDb) -> bool

Returns true if the type qualifies to implement the Emittable trait +TODO: This function should be removed when we add Encode / Decode +trait

+
Source

pub fn is_encodable(self, db: &dyn AnalyzerDb) -> Result<bool, TypeError>

Returns true if the type is encodable in Solidity ABI. +TODO: This function must be removed when we add Encode/Decode trait.

+

Trait Implementations§

Source§

impl Clone for TypeId

Source§

fn clone(&self) -> TypeId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TypeId

Source§

fn default() -> TypeId

Returns the “default value” for a type. Read more
Source§

impl DisplayWithDb for TypeId

Source§

fn format(&self, db: &dyn AnalyzerDb, f: &mut Formatter<'_>) -> Result

Source§

impl Hash for TypeId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for TypeId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for TypeId

Source§

fn cmp(&self, other: &TypeId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for TypeId

Source§

fn eq(&self, other: &TypeId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for TypeId

Source§

fn partial_cmp(&self, other: &TypeId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl TypeDowncast for TypeId

Source§

fn as_array(&self, db: &dyn AnalyzerDb) -> Option<Array>

Source§

fn as_tuple(&self, db: &dyn AnalyzerDb) -> Option<Tuple>

Source§

fn as_string(&self, db: &dyn AnalyzerDb) -> Option<FeString>

Source§

fn as_map(&self, db: &dyn AnalyzerDb) -> Option<Map>

Source§

fn as_int(&self, db: &dyn AnalyzerDb) -> Option<Integer>

Source§

impl Copy for TypeId

Source§

impl Eq for TypeId

Source§

impl StructuralPartialEq for TypeId

Auto Trait Implementations§

§

impl Freeze for TypeId

§

impl RefUnwindSafe for TypeId

§

impl Send for TypeId

§

impl Sync for TypeId

§

impl Unpin for TypeId

§

impl UnwindSafe for TypeId

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> Displayable for T
where + T: DisplayWithDb,

Source§

fn display<'a, 'b>( + &'a self, + db: &'b dyn AnalyzerDb, +) -> DisplayableWrapper<'b, &'a Self>

Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/trait.SafeNames.html b/compiler-docs/fe_analyzer/namespace/types/trait.SafeNames.html new file mode 100644 index 0000000000..e96d02553a --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/trait.SafeNames.html @@ -0,0 +1,6 @@ +SafeNames in fe_analyzer::namespace::types - Rust

Trait SafeNames

Source
pub trait SafeNames {
+    // Required method
+    fn lower_snake(&self) -> String;
+}
Expand description

Names that can be used to build identifiers without collision.

+

Required Methods§

Source

fn lower_snake(&self) -> String

Name in the lower snake format (e.g. lower_snake_case).

+

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/namespace/types/trait.TypeDowncast.html b/compiler-docs/fe_analyzer/namespace/types/trait.TypeDowncast.html new file mode 100644 index 0000000000..0c94bc4eb2 --- /dev/null +++ b/compiler-docs/fe_analyzer/namespace/types/trait.TypeDowncast.html @@ -0,0 +1,8 @@ +TypeDowncast in fe_analyzer::namespace::types - Rust

Trait TypeDowncast

Source
pub trait TypeDowncast {
+    // Required methods
+    fn as_array(&self, db: &dyn AnalyzerDb) -> Option<Array>;
+    fn as_tuple(&self, db: &dyn AnalyzerDb) -> Option<Tuple>;
+    fn as_string(&self, db: &dyn AnalyzerDb) -> Option<FeString>;
+    fn as_map(&self, db: &dyn AnalyzerDb) -> Option<Map>;
+    fn as_int(&self, db: &dyn AnalyzerDb) -> Option<Integer>;
+}

Required Methods§

Source

fn as_array(&self, db: &dyn AnalyzerDb) -> Option<Array>

Source

fn as_tuple(&self, db: &dyn AnalyzerDb) -> Option<Tuple>

Source

fn as_string(&self, db: &dyn AnalyzerDb) -> Option<FeString>

Source

fn as_map(&self, db: &dyn AnalyzerDb) -> Option<Map>

Source

fn as_int(&self, db: &dyn AnalyzerDb) -> Option<Integer>

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/pattern_analysis/enum.ConstructorKind.html b/compiler-docs/fe_analyzer/pattern_analysis/enum.ConstructorKind.html new file mode 100644 index 0000000000..2dbcba7363 --- /dev/null +++ b/compiler-docs/fe_analyzer/pattern_analysis/enum.ConstructorKind.html @@ -0,0 +1,27 @@ +ConstructorKind in fe_analyzer::pattern_analysis - Rust

Enum ConstructorKind

Source
pub enum ConstructorKind {
+    Enum(EnumVariantId),
+    Tuple(TypeId),
+    Struct(StructId),
+    Literal((LiteralPattern, TypeId)),
+}

Variants§

Implementations§

Source§

impl ConstructorKind

Source

pub fn field_types(&self, db: &dyn AnalyzerDb) -> Vec<TypeId>

Source

pub fn arity(&self, db: &dyn AnalyzerDb) -> usize

Source

pub fn ty(&self, db: &dyn AnalyzerDb) -> TypeId

Trait Implementations§

Source§

impl Clone for ConstructorKind

Source§

fn clone(&self) -> ConstructorKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConstructorKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ConstructorKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ConstructorKind

Source§

fn eq(&self, other: &ConstructorKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for ConstructorKind

Source§

impl Eq for ConstructorKind

Source§

impl StructuralPartialEq for ConstructorKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/pattern_analysis/enum.LiteralConstructor.html b/compiler-docs/fe_analyzer/pattern_analysis/enum.LiteralConstructor.html new file mode 100644 index 0000000000..951e0f884d --- /dev/null +++ b/compiler-docs/fe_analyzer/pattern_analysis/enum.LiteralConstructor.html @@ -0,0 +1,24 @@ +LiteralConstructor in fe_analyzer::pattern_analysis - Rust

Enum LiteralConstructor

Source
pub enum LiteralConstructor {
+    Bool(bool),
+}

Variants§

§

Bool(bool)

Trait Implementations§

Source§

impl Clone for LiteralConstructor

Source§

fn clone(&self) -> LiteralConstructor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LiteralConstructor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for LiteralConstructor

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LiteralConstructor

Source§

fn eq(&self, other: &LiteralConstructor) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for LiteralConstructor

Source§

impl Eq for LiteralConstructor

Source§

impl StructuralPartialEq for LiteralConstructor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/pattern_analysis/enum.SimplifiedPatternKind.html b/compiler-docs/fe_analyzer/pattern_analysis/enum.SimplifiedPatternKind.html new file mode 100644 index 0000000000..377e1569b1 --- /dev/null +++ b/compiler-docs/fe_analyzer/pattern_analysis/enum.SimplifiedPatternKind.html @@ -0,0 +1,30 @@ +SimplifiedPatternKind in fe_analyzer::pattern_analysis - Rust

Enum SimplifiedPatternKind

Source
pub enum SimplifiedPatternKind {
+    WildCard(Option<(SmolStr, usize)>),
+    Constructor {
+        kind: ConstructorKind,
+        fields: Vec<SimplifiedPattern>,
+    },
+    Or(Vec<SimplifiedPattern>),
+}

Variants§

§

WildCard(Option<(SmolStr, usize)>)

§

Constructor

§

Or(Vec<SimplifiedPattern>)

Implementations§

Trait Implementations§

Source§

impl Clone for SimplifiedPatternKind

Source§

fn clone(&self) -> SimplifiedPatternKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SimplifiedPatternKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SimplifiedPatternKind

Source§

fn eq(&self, other: &SimplifiedPatternKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for SimplifiedPatternKind

Source§

impl StructuralPartialEq for SimplifiedPatternKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/pattern_analysis/index.html b/compiler-docs/fe_analyzer/pattern_analysis/index.html new file mode 100644 index 0000000000..a40df913fa --- /dev/null +++ b/compiler-docs/fe_analyzer/pattern_analysis/index.html @@ -0,0 +1,5 @@ +fe_analyzer::pattern_analysis - Rust

Module pattern_analysis

Source
Expand description

This module includes utility structs and its functions for pattern matching +analysis. The algorithm here is based on Warnings for pattern matching

+

In this module, we assume all types are well-typed, so we can rely on the +type information without checking it.

+

Structs§

PatternMatrix
PatternRowVec
SigmaSet
SimplifiedPattern

Enums§

ConstructorKind
LiteralConstructor
SimplifiedPatternKind
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/pattern_analysis/sidebar-items.js b/compiler-docs/fe_analyzer/pattern_analysis/sidebar-items.js new file mode 100644 index 0000000000..e090f1131b --- /dev/null +++ b/compiler-docs/fe_analyzer/pattern_analysis/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["ConstructorKind","LiteralConstructor","SimplifiedPatternKind"],"struct":["PatternMatrix","PatternRowVec","SigmaSet","SimplifiedPattern"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/pattern_analysis/struct.PatternMatrix.html b/compiler-docs/fe_analyzer/pattern_analysis/struct.PatternMatrix.html new file mode 100644 index 0000000000..ab6ef4ef97 --- /dev/null +++ b/compiler-docs/fe_analyzer/pattern_analysis/struct.PatternMatrix.html @@ -0,0 +1,27 @@ +PatternMatrix in fe_analyzer::pattern_analysis - Rust

Struct PatternMatrix

Source
pub struct PatternMatrix { /* private fields */ }

Implementations§

Source§

impl PatternMatrix

Source

pub fn new(rows: Vec<PatternRowVec>) -> Self

Source

pub fn from_arms<'db>( + scope: &'db BlockScope<'db, 'db>, + arms: &[Node<MatchArm>], + ty: TypeId, +) -> Self

Source

pub fn rows(&self) -> &[PatternRowVec]

Source

pub fn into_rows(self) -> Vec<PatternRowVec>

Source

pub fn find_non_exhaustiveness( + &self, + db: &dyn AnalyzerDb, +) -> Option<Vec<SimplifiedPattern>>

Source

pub fn is_row_useful(&self, db: &dyn AnalyzerDb, row: usize) -> bool

Source

pub fn nrows(&self) -> usize

Source

pub fn ncols(&self) -> usize

Source

pub fn swap_col(&mut self, col1: usize, col2: usize)

Source

pub fn sigma_set(&self) -> SigmaSet

Source

pub fn phi_specialize(&self, db: &dyn AnalyzerDb, ctor: ConstructorKind) -> Self

Source

pub fn d_specialize(&self, db: &dyn AnalyzerDb) -> Self

Trait Implementations§

Source§

impl Clone for PatternMatrix

Source§

fn clone(&self) -> PatternMatrix

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PatternMatrix

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PatternMatrix

Source§

fn eq(&self, other: &PatternMatrix) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for PatternMatrix

Source§

impl StructuralPartialEq for PatternMatrix

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/pattern_analysis/struct.PatternRowVec.html b/compiler-docs/fe_analyzer/pattern_analysis/struct.PatternRowVec.html new file mode 100644 index 0000000000..78639564b7 --- /dev/null +++ b/compiler-docs/fe_analyzer/pattern_analysis/struct.PatternRowVec.html @@ -0,0 +1,26 @@ +PatternRowVec in fe_analyzer::pattern_analysis - Rust

Struct PatternRowVec

Source
pub struct PatternRowVec {
+    pub inner: Vec<SimplifiedPattern>,
+}

Fields§

§inner: Vec<SimplifiedPattern>

Implementations§

Source§

impl PatternRowVec

Source

pub fn new(inner: Vec<SimplifiedPattern>) -> Self

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn pats(&self) -> &[SimplifiedPattern]

Source

pub fn head(&self) -> Option<&SimplifiedPattern>

Source

pub fn phi_specialize( + &self, + db: &dyn AnalyzerDb, + ctor: ConstructorKind, +) -> Vec<Self>

Source

pub fn swap(&mut self, a: usize, b: usize)

Source

pub fn d_specialize(&self, _db: &dyn AnalyzerDb) -> Vec<Self>

Source

pub fn collect_column_ctors(&self, column: usize) -> Vec<ConstructorKind>

Trait Implementations§

Source§

impl Clone for PatternRowVec

Source§

fn clone(&self) -> PatternRowVec

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PatternRowVec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PatternRowVec

Source§

fn eq(&self, other: &PatternRowVec) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for PatternRowVec

Source§

impl StructuralPartialEq for PatternRowVec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/pattern_analysis/struct.SigmaSet.html b/compiler-docs/fe_analyzer/pattern_analysis/struct.SigmaSet.html new file mode 100644 index 0000000000..6c24079e20 --- /dev/null +++ b/compiler-docs/fe_analyzer/pattern_analysis/struct.SigmaSet.html @@ -0,0 +1,23 @@ +SigmaSet in fe_analyzer::pattern_analysis - Rust

Struct SigmaSet

Source
pub struct SigmaSet(/* private fields */);

Implementations§

Source§

impl SigmaSet

Source

pub fn from_rows<'a>( + rows: impl Iterator<Item = &'a PatternRowVec>, + column: usize, +) -> Self

Source

pub fn complete_sigma(db: &dyn AnalyzerDb, ty: TypeId) -> Self

Source

pub fn is_complete(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> impl Iterator<Item = &ConstructorKind>

Source

pub fn difference(&self, other: &Self) -> Self

Trait Implementations§

Source§

impl Clone for SigmaSet

Source§

fn clone(&self) -> SigmaSet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SigmaSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl IntoIterator for SigmaSet

Source§

type Item = ConstructorKind

The type of the elements being iterated over.
Source§

type IntoIter = <IndexSet<ConstructorKind> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for SigmaSet

Source§

fn eq(&self, other: &SigmaSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for SigmaSet

Source§

impl StructuralPartialEq for SigmaSet

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/pattern_analysis/struct.SimplifiedPattern.html b/compiler-docs/fe_analyzer/pattern_analysis/struct.SimplifiedPattern.html new file mode 100644 index 0000000000..27a804350c --- /dev/null +++ b/compiler-docs/fe_analyzer/pattern_analysis/struct.SimplifiedPattern.html @@ -0,0 +1,27 @@ +SimplifiedPattern in fe_analyzer::pattern_analysis - Rust

Struct SimplifiedPattern

Source
pub struct SimplifiedPattern {
+    pub kind: SimplifiedPatternKind,
+    pub ty: TypeId,
+}

Fields§

§kind: SimplifiedPatternKind§ty: TypeId

Implementations§

Source§

impl SimplifiedPattern

Source

pub fn new(kind: SimplifiedPatternKind, ty: TypeId) -> Self

Source

pub fn wildcard(bind: Option<(SmolStr, usize)>, ty: TypeId) -> Self

Source

pub fn is_wildcard(&self) -> bool

Trait Implementations§

Source§

impl Clone for SimplifiedPattern

Source§

fn clone(&self) -> SimplifiedPattern

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SimplifiedPattern

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DisplayWithDb for SimplifiedPattern

Source§

fn format(&self, db: &dyn AnalyzerDb, f: &mut Formatter<'_>) -> Result

Source§

impl PartialEq for SimplifiedPattern

Source§

fn eq(&self, other: &SimplifiedPattern) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for SimplifiedPattern

Source§

impl StructuralPartialEq for SimplifiedPattern

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Displayable for T
where + T: DisplayWithDb,

Source§

fn display<'a, 'b>( + &'a self, + db: &'b dyn AnalyzerDb, +) -> DisplayableWrapper<'b, &'a Self>

Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_analyzer/sidebar-items.js b/compiler-docs/fe_analyzer/sidebar-items.js new file mode 100644 index 0000000000..5ac4d35640 --- /dev/null +++ b/compiler-docs/fe_analyzer/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["analyze_ingot","analyze_module"],"mod":["builtins","constants","context","db","display","errors","namespace","pattern_analysis"]}; \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/traversal/pattern_analysis/enum.ConstructorKind.html b/compiler-docs/fe_analyzer/traversal/pattern_analysis/enum.ConstructorKind.html new file mode 100644 index 0000000000..5bba4a1f83 --- /dev/null +++ b/compiler-docs/fe_analyzer/traversal/pattern_analysis/enum.ConstructorKind.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_analyzer/pattern_analysis/enum.ConstructorKind.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/traversal/pattern_analysis/enum.LiteralConstructor.html b/compiler-docs/fe_analyzer/traversal/pattern_analysis/enum.LiteralConstructor.html new file mode 100644 index 0000000000..385ee87317 --- /dev/null +++ b/compiler-docs/fe_analyzer/traversal/pattern_analysis/enum.LiteralConstructor.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_analyzer/pattern_analysis/enum.LiteralConstructor.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/traversal/pattern_analysis/enum.SimplifiedPatternKind.html b/compiler-docs/fe_analyzer/traversal/pattern_analysis/enum.SimplifiedPatternKind.html new file mode 100644 index 0000000000..714b8ce7bb --- /dev/null +++ b/compiler-docs/fe_analyzer/traversal/pattern_analysis/enum.SimplifiedPatternKind.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_analyzer/pattern_analysis/enum.SimplifiedPatternKind.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/traversal/pattern_analysis/index.html b/compiler-docs/fe_analyzer/traversal/pattern_analysis/index.html new file mode 100644 index 0000000000..f48ee721f9 --- /dev/null +++ b/compiler-docs/fe_analyzer/traversal/pattern_analysis/index.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_analyzer/pattern_analysis/index.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.PatternMatrix.html b/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.PatternMatrix.html new file mode 100644 index 0000000000..dc8b80e32b --- /dev/null +++ b/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.PatternMatrix.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_analyzer/pattern_analysis/struct.PatternMatrix.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.PatternRowVec.html b/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.PatternRowVec.html new file mode 100644 index 0000000000..e5a150afdc --- /dev/null +++ b/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.PatternRowVec.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_analyzer/pattern_analysis/struct.PatternRowVec.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.SigmaSet.html b/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.SigmaSet.html new file mode 100644 index 0000000000..4213287d15 --- /dev/null +++ b/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.SigmaSet.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_analyzer/pattern_analysis/struct.SigmaSet.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.SimplifiedPattern.html b/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.SimplifiedPattern.html new file mode 100644 index 0000000000..6fa68ba8e1 --- /dev/null +++ b/compiler-docs/fe_analyzer/traversal/pattern_analysis/struct.SimplifiedPattern.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_analyzer/pattern_analysis/struct.SimplifiedPattern.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_codegen/all.html b/compiler-docs/fe_codegen/all.html new file mode 100644 index 0000000000..c0e87cc195 --- /dev/null +++ b/compiler-docs/fe_codegen/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/index.html b/compiler-docs/fe_codegen/db/index.html new file mode 100644 index 0000000000..1a38066f00 --- /dev/null +++ b/compiler-docs/fe_codegen/db/index.html @@ -0,0 +1 @@ +fe_codegen::db - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/sidebar-items.js b/compiler-docs/fe_codegen/db/sidebar-items.js new file mode 100644 index 0000000000..4c04492145 --- /dev/null +++ b/compiler-docs/fe_codegen/db/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["CodegenAbiContractQuery","CodegenAbiEventQuery","CodegenAbiFunctionArgumentMaximumSizeQuery","CodegenAbiFunctionQuery","CodegenAbiFunctionReturnMaximumSizeQuery","CodegenAbiModuleEventsQuery","CodegenAbiTypeMaximumSizeQuery","CodegenAbiTypeMinimumSizeQuery","CodegenAbiTypeQuery","CodegenConstantStringSymbolNameQuery","CodegenContractDeployerSymbolNameQuery","CodegenContractSymbolNameQuery","CodegenDbGroupStorage__","CodegenDbStorage","CodegenFunctionSymbolNameQuery","CodegenLegalizedBodyQuery","CodegenLegalizedSignatureQuery","CodegenLegalizedTypeQuery","Db"],"trait":["CodegenDb"]}; \ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenAbiContractQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenAbiContractQuery.html new file mode 100644 index 0000000000..f65d3458bf --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenAbiContractQuery.html @@ -0,0 +1,46 @@ +CodegenAbiContractQuery in fe_codegen::db - Rust

Struct CodegenAbiContractQuery

Source
pub struct CodegenAbiContractQuery;

Implementations§

Source§

impl CodegenAbiContractQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenAbiContractQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenAbiContractQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenAbiContractQuery

Source§

fn default() -> CodegenAbiContractQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenAbiContractQuery

Source§

const QUERY_INDEX: u16 = 7u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_abi_contract"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = AbiContract

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenAbiContractQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenAbiContractQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenAbiContractQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenAbiEventQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenAbiEventQuery.html new file mode 100644 index 0000000000..914576551a --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenAbiEventQuery.html @@ -0,0 +1,46 @@ +CodegenAbiEventQuery in fe_codegen::db - Rust

Struct CodegenAbiEventQuery

Source
pub struct CodegenAbiEventQuery;

Implementations§

Source§

impl CodegenAbiEventQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenAbiEventQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenAbiEventQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenAbiEventQuery

Source§

fn default() -> CodegenAbiEventQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenAbiEventQuery

Source§

const QUERY_INDEX: u16 = 6u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_abi_event"

Name of the query method (e.g., foo)
Source§

type Key = TypeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = AbiEvent

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenAbiEventQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenAbiEventQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenAbiEventQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenAbiFunctionArgumentMaximumSizeQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenAbiFunctionArgumentMaximumSizeQuery.html new file mode 100644 index 0000000000..736705410d --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenAbiFunctionArgumentMaximumSizeQuery.html @@ -0,0 +1,46 @@ +CodegenAbiFunctionArgumentMaximumSizeQuery in fe_codegen::db - Rust

Struct CodegenAbiFunctionArgumentMaximumSizeQuery

Source
pub struct CodegenAbiFunctionArgumentMaximumSizeQuery;

Implementations§

Source§

impl CodegenAbiFunctionArgumentMaximumSizeQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenAbiFunctionArgumentMaximumSizeQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenAbiFunctionArgumentMaximumSizeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenAbiFunctionArgumentMaximumSizeQuery

Source§

fn default() -> CodegenAbiFunctionArgumentMaximumSizeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenAbiFunctionArgumentMaximumSizeQuery

Source§

const QUERY_INDEX: u16 = 11u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_abi_function_argument_maximum_size"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = usize

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenAbiFunctionArgumentMaximumSizeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenAbiFunctionArgumentMaximumSizeQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenAbiFunctionArgumentMaximumSizeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenAbiFunctionQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenAbiFunctionQuery.html new file mode 100644 index 0000000000..18c939d5ec --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenAbiFunctionQuery.html @@ -0,0 +1,46 @@ +CodegenAbiFunctionQuery in fe_codegen::db - Rust

Struct CodegenAbiFunctionQuery

Source
pub struct CodegenAbiFunctionQuery;

Implementations§

Source§

impl CodegenAbiFunctionQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenAbiFunctionQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenAbiFunctionQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenAbiFunctionQuery

Source§

fn default() -> CodegenAbiFunctionQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenAbiFunctionQuery

Source§

const QUERY_INDEX: u16 = 5u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_abi_function"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = AbiFunction

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenAbiFunctionQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenAbiFunctionQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenAbiFunctionQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenAbiFunctionReturnMaximumSizeQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenAbiFunctionReturnMaximumSizeQuery.html new file mode 100644 index 0000000000..99ffda96f1 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenAbiFunctionReturnMaximumSizeQuery.html @@ -0,0 +1,46 @@ +CodegenAbiFunctionReturnMaximumSizeQuery in fe_codegen::db - Rust

Struct CodegenAbiFunctionReturnMaximumSizeQuery

Source
pub struct CodegenAbiFunctionReturnMaximumSizeQuery;

Implementations§

Source§

impl CodegenAbiFunctionReturnMaximumSizeQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenAbiFunctionReturnMaximumSizeQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenAbiFunctionReturnMaximumSizeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenAbiFunctionReturnMaximumSizeQuery

Source§

fn default() -> CodegenAbiFunctionReturnMaximumSizeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenAbiFunctionReturnMaximumSizeQuery

Source§

const QUERY_INDEX: u16 = 12u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_abi_function_return_maximum_size"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = usize

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenAbiFunctionReturnMaximumSizeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenAbiFunctionReturnMaximumSizeQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenAbiFunctionReturnMaximumSizeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenAbiModuleEventsQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenAbiModuleEventsQuery.html new file mode 100644 index 0000000000..2926ea1d2d --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenAbiModuleEventsQuery.html @@ -0,0 +1,46 @@ +CodegenAbiModuleEventsQuery in fe_codegen::db - Rust

Struct CodegenAbiModuleEventsQuery

Source
pub struct CodegenAbiModuleEventsQuery;

Implementations§

Source§

impl CodegenAbiModuleEventsQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenAbiModuleEventsQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenAbiModuleEventsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenAbiModuleEventsQuery

Source§

fn default() -> CodegenAbiModuleEventsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenAbiModuleEventsQuery

Source§

const QUERY_INDEX: u16 = 8u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_abi_module_events"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Vec<AbiEvent>

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenAbiModuleEventsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenAbiModuleEventsQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenAbiModuleEventsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenAbiTypeMaximumSizeQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenAbiTypeMaximumSizeQuery.html new file mode 100644 index 0000000000..d858f44113 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenAbiTypeMaximumSizeQuery.html @@ -0,0 +1,46 @@ +CodegenAbiTypeMaximumSizeQuery in fe_codegen::db - Rust

Struct CodegenAbiTypeMaximumSizeQuery

Source
pub struct CodegenAbiTypeMaximumSizeQuery;

Implementations§

Source§

impl CodegenAbiTypeMaximumSizeQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenAbiTypeMaximumSizeQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenAbiTypeMaximumSizeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenAbiTypeMaximumSizeQuery

Source§

fn default() -> CodegenAbiTypeMaximumSizeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenAbiTypeMaximumSizeQuery

Source§

const QUERY_INDEX: u16 = 9u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_abi_type_maximum_size"

Name of the query method (e.g., foo)
Source§

type Key = TypeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = usize

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenAbiTypeMaximumSizeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenAbiTypeMaximumSizeQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenAbiTypeMaximumSizeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenAbiTypeMinimumSizeQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenAbiTypeMinimumSizeQuery.html new file mode 100644 index 0000000000..81a39c9dce --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenAbiTypeMinimumSizeQuery.html @@ -0,0 +1,46 @@ +CodegenAbiTypeMinimumSizeQuery in fe_codegen::db - Rust

Struct CodegenAbiTypeMinimumSizeQuery

Source
pub struct CodegenAbiTypeMinimumSizeQuery;

Implementations§

Source§

impl CodegenAbiTypeMinimumSizeQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenAbiTypeMinimumSizeQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenAbiTypeMinimumSizeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenAbiTypeMinimumSizeQuery

Source§

fn default() -> CodegenAbiTypeMinimumSizeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenAbiTypeMinimumSizeQuery

Source§

const QUERY_INDEX: u16 = 10u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_abi_type_minimum_size"

Name of the query method (e.g., foo)
Source§

type Key = TypeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = usize

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenAbiTypeMinimumSizeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenAbiTypeMinimumSizeQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenAbiTypeMinimumSizeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenAbiTypeQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenAbiTypeQuery.html new file mode 100644 index 0000000000..c1b20815b9 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenAbiTypeQuery.html @@ -0,0 +1,46 @@ +CodegenAbiTypeQuery in fe_codegen::db - Rust

Struct CodegenAbiTypeQuery

Source
pub struct CodegenAbiTypeQuery;

Implementations§

Source§

impl CodegenAbiTypeQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenAbiTypeQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenAbiTypeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenAbiTypeQuery

Source§

fn default() -> CodegenAbiTypeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenAbiTypeQuery

Source§

const QUERY_INDEX: u16 = 4u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_abi_type"

Name of the query method (e.g., foo)
Source§

type Key = TypeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = AbiType

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenAbiTypeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenAbiTypeQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenAbiTypeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenConstantStringSymbolNameQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenConstantStringSymbolNameQuery.html new file mode 100644 index 0000000000..485e419336 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenConstantStringSymbolNameQuery.html @@ -0,0 +1,46 @@ +CodegenConstantStringSymbolNameQuery in fe_codegen::db - Rust

Struct CodegenConstantStringSymbolNameQuery

Source
pub struct CodegenConstantStringSymbolNameQuery;

Implementations§

Source§

impl CodegenConstantStringSymbolNameQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenConstantStringSymbolNameQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenConstantStringSymbolNameQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenConstantStringSymbolNameQuery

Source§

fn default() -> CodegenConstantStringSymbolNameQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenConstantStringSymbolNameQuery

Source§

const QUERY_INDEX: u16 = 15u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_constant_string_symbol_name"

Name of the query method (e.g., foo)
Source§

type Key = String

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<String>

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenConstantStringSymbolNameQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenConstantStringSymbolNameQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenConstantStringSymbolNameQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenContractDeployerSymbolNameQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenContractDeployerSymbolNameQuery.html new file mode 100644 index 0000000000..3a951dd841 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenContractDeployerSymbolNameQuery.html @@ -0,0 +1,46 @@ +CodegenContractDeployerSymbolNameQuery in fe_codegen::db - Rust

Struct CodegenContractDeployerSymbolNameQuery

Source
pub struct CodegenContractDeployerSymbolNameQuery;

Implementations§

Source§

impl CodegenContractDeployerSymbolNameQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenContractDeployerSymbolNameQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenContractDeployerSymbolNameQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenContractDeployerSymbolNameQuery

Source§

fn default() -> CodegenContractDeployerSymbolNameQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenContractDeployerSymbolNameQuery

Source§

const QUERY_INDEX: u16 = 14u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_contract_deployer_symbol_name"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<String>

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenContractDeployerSymbolNameQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenContractDeployerSymbolNameQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenContractDeployerSymbolNameQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenContractSymbolNameQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenContractSymbolNameQuery.html new file mode 100644 index 0000000000..3f0445c149 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenContractSymbolNameQuery.html @@ -0,0 +1,46 @@ +CodegenContractSymbolNameQuery in fe_codegen::db - Rust

Struct CodegenContractSymbolNameQuery

Source
pub struct CodegenContractSymbolNameQuery;

Implementations§

Source§

impl CodegenContractSymbolNameQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenContractSymbolNameQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenContractSymbolNameQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenContractSymbolNameQuery

Source§

fn default() -> CodegenContractSymbolNameQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenContractSymbolNameQuery

Source§

const QUERY_INDEX: u16 = 13u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_contract_symbol_name"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<String>

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenContractSymbolNameQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenContractSymbolNameQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenContractSymbolNameQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenDbGroupStorage__.html b/compiler-docs/fe_codegen/db/struct.CodegenDbGroupStorage__.html new file mode 100644 index 0000000000..229da9fd11 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenDbGroupStorage__.html @@ -0,0 +1,42 @@ +CodegenDbGroupStorage__ in fe_codegen::db - Rust

Struct CodegenDbGroupStorage__

Source
pub struct CodegenDbGroupStorage__ {
Show 16 fields + pub codegen_legalized_signature: Arc<<CodegenLegalizedSignatureQuery as Query>::Storage>, + pub codegen_legalized_body: Arc<<CodegenLegalizedBodyQuery as Query>::Storage>, + pub codegen_function_symbol_name: Arc<<CodegenFunctionSymbolNameQuery as Query>::Storage>, + pub codegen_legalized_type: Arc<<CodegenLegalizedTypeQuery as Query>::Storage>, + pub codegen_abi_type: Arc<<CodegenAbiTypeQuery as Query>::Storage>, + pub codegen_abi_function: Arc<<CodegenAbiFunctionQuery as Query>::Storage>, + pub codegen_abi_event: Arc<<CodegenAbiEventQuery as Query>::Storage>, + pub codegen_abi_contract: Arc<<CodegenAbiContractQuery as Query>::Storage>, + pub codegen_abi_module_events: Arc<<CodegenAbiModuleEventsQuery as Query>::Storage>, + pub codegen_abi_type_maximum_size: Arc<<CodegenAbiTypeMaximumSizeQuery as Query>::Storage>, + pub codegen_abi_type_minimum_size: Arc<<CodegenAbiTypeMinimumSizeQuery as Query>::Storage>, + pub codegen_abi_function_argument_maximum_size: Arc<<CodegenAbiFunctionArgumentMaximumSizeQuery as Query>::Storage>, + pub codegen_abi_function_return_maximum_size: Arc<<CodegenAbiFunctionReturnMaximumSizeQuery as Query>::Storage>, + pub codegen_contract_symbol_name: Arc<<CodegenContractSymbolNameQuery as Query>::Storage>, + pub codegen_contract_deployer_symbol_name: Arc<<CodegenContractDeployerSymbolNameQuery as Query>::Storage>, + pub codegen_constant_string_symbol_name: Arc<<CodegenConstantStringSymbolNameQuery as Query>::Storage>, +
}

Fields§

§codegen_legalized_signature: Arc<<CodegenLegalizedSignatureQuery as Query>::Storage>§codegen_legalized_body: Arc<<CodegenLegalizedBodyQuery as Query>::Storage>§codegen_function_symbol_name: Arc<<CodegenFunctionSymbolNameQuery as Query>::Storage>§codegen_legalized_type: Arc<<CodegenLegalizedTypeQuery as Query>::Storage>§codegen_abi_type: Arc<<CodegenAbiTypeQuery as Query>::Storage>§codegen_abi_function: Arc<<CodegenAbiFunctionQuery as Query>::Storage>§codegen_abi_event: Arc<<CodegenAbiEventQuery as Query>::Storage>§codegen_abi_contract: Arc<<CodegenAbiContractQuery as Query>::Storage>§codegen_abi_module_events: Arc<<CodegenAbiModuleEventsQuery as Query>::Storage>§codegen_abi_type_maximum_size: Arc<<CodegenAbiTypeMaximumSizeQuery as Query>::Storage>§codegen_abi_type_minimum_size: Arc<<CodegenAbiTypeMinimumSizeQuery as Query>::Storage>§codegen_abi_function_argument_maximum_size: Arc<<CodegenAbiFunctionArgumentMaximumSizeQuery as Query>::Storage>§codegen_abi_function_return_maximum_size: Arc<<CodegenAbiFunctionReturnMaximumSizeQuery as Query>::Storage>§codegen_contract_symbol_name: Arc<<CodegenContractSymbolNameQuery as Query>::Storage>§codegen_contract_deployer_symbol_name: Arc<<CodegenContractDeployerSymbolNameQuery as Query>::Storage>§codegen_constant_string_symbol_name: Arc<<CodegenConstantStringSymbolNameQuery as Query>::Storage>

Implementations§

Source§

impl CodegenDbGroupStorage__

Source

pub fn new(group_index: u16) -> Self

Source§

impl CodegenDbGroupStorage__

Source

pub fn fmt_index( + &self, + db: &(dyn CodegenDb + '_), + input: DatabaseKeyIndex, + fmt: &mut Formatter<'_>, +) -> Result

Source

pub fn maybe_changed_since( + &self, + db: &(dyn CodegenDb + '_), + input: DatabaseKeyIndex, + revision: Revision, +) -> bool

Source

pub fn for_each_query( + &self, + _runtime: &Runtime, + op: &mut dyn FnMut(&dyn QueryStorageMassOps), +)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenDbStorage.html b/compiler-docs/fe_codegen/db/struct.CodegenDbStorage.html new file mode 100644 index 0000000000..ffa48cc24e --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenDbStorage.html @@ -0,0 +1,12 @@ +CodegenDbStorage in fe_codegen::db - Rust

Struct CodegenDbStorage

Source
pub struct CodegenDbStorage {}
Expand description

Representative struct for the query group.

+

Trait Implementations§

Source§

impl HasQueryGroup<CodegenDbStorage> for Db

Source§

fn group_storage(&self) -> &<CodegenDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl QueryGroup for CodegenDbStorage

Source§

type DynDb = dyn CodegenDb

Dyn version of the associated database trait.
Source§

type GroupStorage = CodegenDbGroupStorage__

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenFunctionSymbolNameQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenFunctionSymbolNameQuery.html new file mode 100644 index 0000000000..e42d4d3146 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenFunctionSymbolNameQuery.html @@ -0,0 +1,46 @@ +CodegenFunctionSymbolNameQuery in fe_codegen::db - Rust

Struct CodegenFunctionSymbolNameQuery

Source
pub struct CodegenFunctionSymbolNameQuery;

Implementations§

Source§

impl CodegenFunctionSymbolNameQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenFunctionSymbolNameQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenFunctionSymbolNameQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenFunctionSymbolNameQuery

Source§

fn default() -> CodegenFunctionSymbolNameQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenFunctionSymbolNameQuery

Source§

const QUERY_INDEX: u16 = 2u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_function_symbol_name"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<String>

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenFunctionSymbolNameQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenFunctionSymbolNameQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenFunctionSymbolNameQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenLegalizedBodyQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenLegalizedBodyQuery.html new file mode 100644 index 0000000000..e84e357011 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenLegalizedBodyQuery.html @@ -0,0 +1,46 @@ +CodegenLegalizedBodyQuery in fe_codegen::db - Rust

Struct CodegenLegalizedBodyQuery

Source
pub struct CodegenLegalizedBodyQuery;

Implementations§

Source§

impl CodegenLegalizedBodyQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenLegalizedBodyQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenLegalizedBodyQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenLegalizedBodyQuery

Source§

fn default() -> CodegenLegalizedBodyQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenLegalizedBodyQuery

Source§

const QUERY_INDEX: u16 = 1u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_legalized_body"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<FunctionBody>

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenLegalizedBodyQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenLegalizedBodyQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenLegalizedBodyQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenLegalizedSignatureQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenLegalizedSignatureQuery.html new file mode 100644 index 0000000000..091dc17269 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenLegalizedSignatureQuery.html @@ -0,0 +1,46 @@ +CodegenLegalizedSignatureQuery in fe_codegen::db - Rust

Struct CodegenLegalizedSignatureQuery

Source
pub struct CodegenLegalizedSignatureQuery;

Implementations§

Source§

impl CodegenLegalizedSignatureQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenLegalizedSignatureQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenLegalizedSignatureQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenLegalizedSignatureQuery

Source§

fn default() -> CodegenLegalizedSignatureQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenLegalizedSignatureQuery

Source§

const QUERY_INDEX: u16 = 0u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_legalized_signature"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<FunctionSignature>

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenLegalizedSignatureQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenLegalizedSignatureQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenLegalizedSignatureQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.CodegenLegalizedTypeQuery.html b/compiler-docs/fe_codegen/db/struct.CodegenLegalizedTypeQuery.html new file mode 100644 index 0000000000..ab681f0db4 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.CodegenLegalizedTypeQuery.html @@ -0,0 +1,46 @@ +CodegenLegalizedTypeQuery in fe_codegen::db - Rust

Struct CodegenLegalizedTypeQuery

Source
pub struct CodegenLegalizedTypeQuery;

Implementations§

Source§

impl CodegenLegalizedTypeQuery

Source

pub fn in_db(self, db: &dyn CodegenDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl CodegenLegalizedTypeQuery

Source

pub fn in_db_mut(self, db: &mut dyn CodegenDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for CodegenLegalizedTypeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CodegenLegalizedTypeQuery

Source§

fn default() -> CodegenLegalizedTypeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for CodegenLegalizedTypeQuery

Source§

const QUERY_INDEX: u16 = 3u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "codegen_legalized_type"

Name of the query method (e.g., foo)
Source§

type Key = TypeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = TypeId

What value does the query return?
Source§

type Storage = DerivedStorage<CodegenLegalizedTypeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for CodegenLegalizedTypeQuery

Source§

type DynDb = dyn CodegenDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = CodegenDbStorage

Associate query group struct.
Source§

type GroupStorage = CodegenDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for CodegenLegalizedTypeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/struct.Db.html b/compiler-docs/fe_codegen/db/struct.Db.html new file mode 100644 index 0000000000..27f0bcde77 --- /dev/null +++ b/compiler-docs/fe_codegen/db/struct.Db.html @@ -0,0 +1,135 @@ +Db in fe_codegen::db - Rust

Struct Db

Source
pub struct Db { /* private fields */ }

Trait Implementations§

Source§

impl Database for Db

§

fn sweep_all(&self, strategy: SweepStrategy)

Iterates through all query storage and removes any values that +have not been used since the last revision was created. The +intended use-cycle is that you first execute all of your +“main” queries; this will ensure that all query values they +consume are marked as used. You then invoke this method to +remove other values that were not needed for your main query +results.
§

fn salsa_event(&self, event_fn: Event)

This function is invoked at key points in the salsa +runtime. It permits the database to be customized and to +inject logging or other custom behavior.
§

fn on_propagated_panic(&self) -> !

This function is invoked when a dependent query is being computed by the +other thread, and that thread panics.
§

fn salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.
§

fn salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.
Source§

impl DatabaseOps for Db

Source§

fn ops_database(&self) -> &dyn Database

Upcast this type to a dyn Database.
Source§

fn ops_salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.
Source§

fn ops_salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.
Source§

fn fmt_index(&self, input: DatabaseKeyIndex, fmt: &mut Formatter<'_>) -> Result

Formats a database key index in a human readable fashion.
Source§

fn maybe_changed_since( + &self, + input: DatabaseKeyIndex, + revision: Revision, +) -> bool

True if the computed value for input may have changed since revision.
Source§

fn for_each_query(&self, op: &mut dyn FnMut(&dyn QueryStorageMassOps))

Executes the callback for each kind of query.
Source§

impl DatabaseStorageTypes for Db

Source§

type DatabaseStorage = __SalsaDatabaseStorage

Defines the “storage type”, where all the query data is kept. +This type is defined by the database_storage macro.
Source§

impl Default for Db

Source§

fn default() -> Db

Returns the “default value” for a type. Read more
Source§

impl HasQueryGroup<AnalyzerDbStorage> for Db

Source§

fn group_storage(&self) -> &<AnalyzerDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl HasQueryGroup<CodegenDbStorage> for Db

Source§

fn group_storage(&self) -> &<CodegenDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl HasQueryGroup<MirDbStorage> for Db

Source§

fn group_storage(&self) -> &<MirDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl HasQueryGroup<SourceDbStorage> for Db

Source§

fn group_storage(&self) -> &<SourceDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl Upcast<dyn AnalyzerDb> for Db

Source§

fn upcast(&self) -> &(dyn AnalyzerDb + 'static)

Source§

impl Upcast<dyn MirDb> for Db

Source§

fn upcast(&self) -> &(dyn MirDb + 'static)

Source§

impl Upcast<dyn SourceDb> for Db

Source§

fn upcast(&self) -> &(dyn SourceDb + 'static)

Source§

impl UpcastMut<dyn AnalyzerDb> for Db

Source§

fn upcast_mut(&mut self) -> &mut (dyn AnalyzerDb + 'static)

Source§

impl UpcastMut<dyn MirDb> for Db

Source§

fn upcast_mut(&mut self) -> &mut (dyn MirDb + 'static)

Source§

impl UpcastMut<dyn SourceDb> for Db

Source§

fn upcast_mut(&mut self) -> &mut (dyn SourceDb + 'static)

Auto Trait Implementations§

§

impl !Freeze for Db

§

impl RefUnwindSafe for Db

§

impl !Send for Db

§

impl !Sync for Db

§

impl Unpin for Db

§

impl UnwindSafe for Db

Blanket Implementations§

§

impl<DB> AnalyzerDb for DB
where + DB: SourceDb + Upcast<dyn SourceDb> + UpcastMut<dyn SourceDb> + Database + HasQueryGroup<AnalyzerDbStorage>,

§

fn intern_ingot(&self, key0: Rc<Ingot>) -> IngotId

§

fn lookup_intern_ingot(&self, key0: IngotId) -> Rc<Ingot>

§

fn intern_module(&self, key0: Rc<Module>) -> ModuleId

§

fn lookup_intern_module(&self, key0: ModuleId) -> Rc<Module>

§

fn intern_module_const(&self, key0: Rc<ModuleConstant>) -> ModuleConstantId

§

fn lookup_intern_module_const( + &self, + key0: ModuleConstantId, +) -> Rc<ModuleConstant>

§

fn intern_struct(&self, key0: Rc<Struct>) -> StructId

§

fn lookup_intern_struct(&self, key0: StructId) -> Rc<Struct>

§

fn intern_struct_field(&self, key0: Rc<StructField>) -> StructFieldId

§

fn lookup_intern_struct_field(&self, key0: StructFieldId) -> Rc<StructField>

§

fn intern_enum(&self, key0: Rc<Enum>) -> EnumId

§

fn lookup_intern_enum(&self, key0: EnumId) -> Rc<Enum>

§

fn intern_attribute(&self, key0: Rc<Attribute>) -> AttributeId

§

fn lookup_intern_attribute(&self, key0: AttributeId) -> Rc<Attribute>

§

fn intern_enum_variant(&self, key0: Rc<EnumVariant>) -> EnumVariantId

§

fn lookup_intern_enum_variant(&self, key0: EnumVariantId) -> Rc<EnumVariant>

§

fn intern_trait(&self, key0: Rc<Trait>) -> TraitId

§

fn lookup_intern_trait(&self, key0: TraitId) -> Rc<Trait>

§

fn intern_impl(&self, key0: Rc<Impl>) -> ImplId

§

fn lookup_intern_impl(&self, key0: ImplId) -> Rc<Impl>

§

fn intern_type_alias(&self, key0: Rc<TypeAlias>) -> TypeAliasId

§

fn lookup_intern_type_alias(&self, key0: TypeAliasId) -> Rc<TypeAlias>

§

fn intern_contract(&self, key0: Rc<Contract>) -> ContractId

§

fn lookup_intern_contract(&self, key0: ContractId) -> Rc<Contract>

§

fn intern_contract_field(&self, key0: Rc<ContractField>) -> ContractFieldId

§

fn lookup_intern_contract_field( + &self, + key0: ContractFieldId, +) -> Rc<ContractField>

§

fn intern_function_sig(&self, key0: Rc<FunctionSig>) -> FunctionSigId

§

fn lookup_intern_function_sig(&self, key0: FunctionSigId) -> Rc<FunctionSig>

§

fn intern_function(&self, key0: Rc<Function>) -> FunctionId

§

fn lookup_intern_function(&self, key0: FunctionId) -> Rc<Function>

§

fn intern_type(&self, key0: Type) -> TypeId

§

fn lookup_intern_type(&self, key0: TypeId) -> Type

§

fn ingot_files(&self, key0: IngotId) -> Rc<[SourceFileId]>

§

fn set_ingot_files(&mut self, key0: IngotId, value__: Rc<[SourceFileId]>)

Set the value of the ingot_files input. Read more
§

fn set_ingot_files_with_durability( + &mut self, + key0: IngotId, + value__: Rc<[SourceFileId]>, + durability__: Durability, +)

Set the value of the ingot_files input and promise +that its value will never change again. Read more
§

fn ingot_external_ingots(&self, key0: IngotId) -> Rc<IndexMap<SmolStr, IngotId>>

§

fn set_ingot_external_ingots( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, +)

Set the value of the ingot_external_ingots input. Read more
§

fn set_ingot_external_ingots_with_durability( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, + durability__: Durability, +)

Set the value of the ingot_external_ingots input and promise +that its value will never change again. Read more
§

fn root_ingot(&self) -> IngotId

§

fn set_root_ingot(&mut self, value__: IngotId)

Set the value of the root_ingot input. Read more
§

fn set_root_ingot_with_durability( + &mut self, + value__: IngotId, + durability__: Durability, +)

Set the value of the root_ingot input and promise +that its value will never change again. Read more
§

fn ingot_modules(&self, key0: IngotId) -> Rc<[ModuleId]>

§

fn ingot_root_module(&self, key0: IngotId) -> Option<ModuleId>

§

fn module_file_path(&self, key0: ModuleId) -> SmolStr

§

fn module_parse(&self, key0: ModuleId) -> Analysis<Rc<Module>>

§

fn module_is_incomplete(&self, key0: ModuleId) -> bool

§

fn module_all_items(&self, key0: ModuleId) -> Rc<[Item]>

§

fn module_all_impls(&self, key0: ModuleId) -> Analysis<Rc<[ImplId]>>

§

fn module_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, Item>>>

§

fn module_impl_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<(TraitId, TypeId), ImplId>>>

§

fn module_contracts(&self, key0: ModuleId) -> Rc<[ContractId]>

§

fn module_structs(&self, key0: ModuleId) -> Rc<[StructId]>

§

fn module_constants(&self, key0: ModuleId) -> Rc<Vec<ModuleConstantId>>

§

fn module_used_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>>

§

fn module_parent_module(&self, key0: ModuleId) -> Option<ModuleId>

§

fn module_submodules(&self, key0: ModuleId) -> Rc<[ModuleId]>

§

fn module_tests(&self, key0: ModuleId) -> Vec<FunctionId>

§

fn module_constant_type( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<TypeId, TypeError>>

§

fn module_constant_value( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<Constant, ConstEvalError>>

§

fn contract_all_functions(&self, key0: ContractId) -> Rc<[FunctionId]>

§

fn contract_function_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn contract_public_function_map( + &self, + key0: ContractId, +) -> Rc<IndexMap<SmolStr, FunctionId>>

§

fn contract_init_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

§

fn contract_call_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

§

fn contract_all_fields(&self, key0: ContractId) -> Rc<[ContractFieldId]>

§

fn contract_field_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, ContractFieldId>>>

§

fn contract_field_type( + &self, + key0: ContractFieldId, +) -> Analysis<Result<TypeId, TypeError>>

§

fn contract_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

§

fn contract_runtime_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

§

fn function_signature( + &self, + key0: FunctionSigId, +) -> Analysis<Rc<FunctionSignature>>

§

fn function_body(&self, key0: FunctionId) -> Analysis<Rc<FunctionBody>>

§

fn function_dependency_graph(&self, key0: FunctionId) -> DepGraphWrapper

§

fn struct_all_fields(&self, key0: StructId) -> Rc<[StructFieldId]>

§

fn struct_field_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, StructFieldId>>>

§

fn struct_field_type( + &self, + key0: StructFieldId, +) -> Analysis<Result<TypeId, TypeError>>

§

fn struct_all_functions(&self, key0: StructId) -> Rc<[FunctionId]>

§

fn struct_function_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn struct_dependency_graph(&self, key0: StructId) -> Analysis<DepGraphWrapper>

§

fn enum_all_variants(&self, key0: EnumId) -> Rc<[EnumVariantId]>

§

fn enum_variant_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, EnumVariantId>>>

§

fn enum_all_functions(&self, key0: EnumId) -> Rc<[FunctionId]>

§

fn enum_function_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn enum_dependency_graph(&self, key0: EnumId) -> Analysis<DepGraphWrapper>

§

fn enum_variant_kind( + &self, + key0: EnumVariantId, +) -> Analysis<Result<EnumVariantKind, TypeError>>

§

fn trait_all_functions(&self, key0: TraitId) -> Rc<[FunctionSigId]>

§

fn trait_function_map( + &self, + key0: TraitId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionSigId>>>

§

fn trait_is_implemented_for(&self, key0: TraitId, key1: TypeId) -> bool

§

fn impl_all_functions(&self, key0: ImplId) -> Rc<[FunctionId]>

§

fn impl_function_map( + &self, + key0: ImplId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn all_impls(&self, key0: TypeId) -> Rc<[ImplId]>

§

fn impl_for(&self, key0: TypeId, key1: TraitId) -> Option<ImplId>

§

fn function_sigs(&self, key0: TypeId, key1: SmolStr) -> Rc<[FunctionSigId]>

§

fn type_alias_type( + &self, + key0: TypeAliasId, +) -> Analysis<Result<TypeId, TypeError>>

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<DB> CodegenDb for DB
where + DB: MirDb + Upcast<dyn MirDb> + UpcastMut<dyn MirDb> + Database + HasQueryGroup<CodegenDbStorage>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<DB> MirDb for DB
where + DB: AnalyzerDb + Upcast<dyn AnalyzerDb> + UpcastMut<dyn AnalyzerDb> + Database + HasQueryGroup<MirDbStorage>,

Source§

impl<DB> SourceDb for DB
where + DB: Database + HasQueryGroup<SourceDbStorage>,

Source§

fn intern_file(&self, key0: File) -> SourceFileId

Source§

fn lookup_intern_file(&self, key0: SourceFileId) -> File

Source§

fn file_content(&self, key0: SourceFileId) -> Rc<str>

Set with `fn set_file_content(&mut self, file: SourceFileId, content: Rc)
Source§

fn set_file_content(&mut self, key0: SourceFileId, value__: Rc<str>)

Set the value of the file_content input. Read more
Source§

fn set_file_content_with_durability( + &mut self, + key0: SourceFileId, + value__: Rc<str>, + durability__: Durability, +)

Set the value of the file_content input and promise +that its value will never change again. Read more
Source§

fn file_line_starts(&self, key0: SourceFileId) -> Rc<[usize]>

Source§

fn file_name(&self, key0: SourceFileId) -> SmolStr

Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/db/trait.CodegenDb.html b/compiler-docs/fe_codegen/db/trait.CodegenDb.html new file mode 100644 index 0000000000..4b5ef2cd51 --- /dev/null +++ b/compiler-docs/fe_codegen/db/trait.CodegenDb.html @@ -0,0 +1,37 @@ +CodegenDb in fe_codegen::db - Rust

Trait CodegenDb

Source
pub trait CodegenDb:
+    Database
+    + HasQueryGroup<CodegenDbStorage>
+    + MirDb
+    + Upcast<dyn MirDb>
+    + UpcastMut<dyn MirDb> {
+
Show 16 methods // Required methods + fn codegen_legalized_signature( + &self, + key0: FunctionId, + ) -> Rc<FunctionSignature>; + fn codegen_legalized_body(&self, key0: FunctionId) -> Rc<FunctionBody>; + fn codegen_function_symbol_name(&self, key0: FunctionId) -> Rc<String>; + fn codegen_legalized_type(&self, key0: TypeId) -> TypeId; + fn codegen_abi_type(&self, key0: TypeId) -> AbiType; + fn codegen_abi_function(&self, key0: FunctionId) -> AbiFunction; + fn codegen_abi_event(&self, key0: TypeId) -> AbiEvent; + fn codegen_abi_contract(&self, key0: ContractId) -> AbiContract; + fn codegen_abi_module_events(&self, key0: ModuleId) -> Vec<AbiEvent>; + fn codegen_abi_type_maximum_size(&self, key0: TypeId) -> usize; + fn codegen_abi_type_minimum_size(&self, key0: TypeId) -> usize; + fn codegen_abi_function_argument_maximum_size( + &self, + key0: FunctionId, + ) -> usize; + fn codegen_abi_function_return_maximum_size( + &self, + key0: FunctionId, + ) -> usize; + fn codegen_contract_symbol_name(&self, key0: ContractId) -> Rc<String>; + fn codegen_contract_deployer_symbol_name( + &self, + key0: ContractId, + ) -> Rc<String>; + fn codegen_constant_string_symbol_name(&self, key0: String) -> Rc<String>; +
}

Required Methods§

Implementors§

Source§

impl<DB> CodegenDb for DB
where + DB: MirDb + Upcast<dyn MirDb> + UpcastMut<dyn MirDb> + Database + HasQueryGroup<CodegenDbStorage>,

\ No newline at end of file diff --git a/compiler-docs/fe_codegen/index.html b/compiler-docs/fe_codegen/index.html new file mode 100644 index 0000000000..2c62a0f12a --- /dev/null +++ b/compiler-docs/fe_codegen/index.html @@ -0,0 +1 @@ +fe_codegen - Rust

Crate fe_codegen

Source

Modules§

db
yul
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/sidebar-items.js b/compiler-docs/fe_codegen/sidebar-items.js new file mode 100644 index 0000000000..e5f397f699 --- /dev/null +++ b/compiler-docs/fe_codegen/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["db","yul"]}; \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/index.html b/compiler-docs/fe_codegen/yul/index.html new file mode 100644 index 0000000000..9147263c7a --- /dev/null +++ b/compiler-docs/fe_codegen/yul/index.html @@ -0,0 +1 @@ +fe_codegen::yul - Rust

Module yul

Source

Modules§

isel
legalize
runtime
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/context/index.html b/compiler-docs/fe_codegen/yul/isel/context/index.html new file mode 100644 index 0000000000..3e10543d4b --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/context/index.html @@ -0,0 +1 @@ +fe_codegen::yul::isel::context - Rust

Module context

Source

Structs§

Context
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/context/sidebar-items.js b/compiler-docs/fe_codegen/yul/isel/context/sidebar-items.js new file mode 100644 index 0000000000..d31239d146 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/context/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Context"]}; \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/context/struct.Context.html b/compiler-docs/fe_codegen/yul/isel/context/struct.Context.html new file mode 100644 index 0000000000..84b48c7c67 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/context/struct.Context.html @@ -0,0 +1,14 @@ +Context in fe_codegen::yul::isel::context - Rust

Struct Context

Source
pub struct Context {
+    pub runtime: Box<dyn RuntimeProvider>,
+    /* private fields */
+}

Fields§

§runtime: Box<dyn RuntimeProvider>

Trait Implementations§

Source§

impl Default for Context

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Context

§

impl !RefUnwindSafe for Context

§

impl !Send for Context

§

impl !Sync for Context

§

impl Unpin for Context

§

impl !UnwindSafe for Context

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/contract/fn.lower_contract.html b/compiler-docs/fe_codegen/yul/isel/contract/fn.lower_contract.html new file mode 100644 index 0000000000..039910e363 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/contract/fn.lower_contract.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../../fe_codegen/yul/isel/fn.lower_contract.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/contract/fn.lower_contract_deployable.html b/compiler-docs/fe_codegen/yul/isel/contract/fn.lower_contract_deployable.html new file mode 100644 index 0000000000..3fbfe01517 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/contract/fn.lower_contract_deployable.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../../fe_codegen/yul/isel/fn.lower_contract_deployable.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/fn.lower_contract.html b/compiler-docs/fe_codegen/yul/isel/fn.lower_contract.html new file mode 100644 index 0000000000..828d17fd1e --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/fn.lower_contract.html @@ -0,0 +1 @@ +lower_contract in fe_codegen::yul::isel - Rust

Function lower_contract

Source
pub fn lower_contract(db: &dyn CodegenDb, contract: ContractId) -> Object
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/fn.lower_contract_deployable.html b/compiler-docs/fe_codegen/yul/isel/fn.lower_contract_deployable.html new file mode 100644 index 0000000000..12673712db --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/fn.lower_contract_deployable.html @@ -0,0 +1,4 @@ +lower_contract_deployable in fe_codegen::yul::isel - Rust

Function lower_contract_deployable

Source
pub fn lower_contract_deployable(
+    db: &dyn CodegenDb,
+    contract: ContractId,
+) -> Object
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/fn.lower_function.html b/compiler-docs/fe_codegen/yul/isel/fn.lower_function.html new file mode 100644 index 0000000000..184aafb3ae --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/fn.lower_function.html @@ -0,0 +1,5 @@ +lower_function in fe_codegen::yul::isel - Rust

Function lower_function

Source
pub fn lower_function(
+    db: &dyn CodegenDb,
+    ctx: &mut Context,
+    function: FunctionId,
+) -> FunctionDefinition
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/fn.lower_test.html b/compiler-docs/fe_codegen/yul/isel/fn.lower_test.html new file mode 100644 index 0000000000..553d1ae480 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/fn.lower_test.html @@ -0,0 +1 @@ +lower_test in fe_codegen::yul::isel - Rust

Function lower_test

Source
pub fn lower_test(db: &dyn CodegenDb, test: FunctionId) -> Object
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/function/fn.lower_function.html b/compiler-docs/fe_codegen/yul/isel/function/fn.lower_function.html new file mode 100644 index 0000000000..52af4a8690 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/function/fn.lower_function.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../../fe_codegen/yul/isel/fn.lower_function.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/index.html b/compiler-docs/fe_codegen/yul/isel/index.html new file mode 100644 index 0000000000..b8d0126676 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/index.html @@ -0,0 +1 @@ +fe_codegen::yul::isel - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/sidebar-items.js b/compiler-docs/fe_codegen/yul/isel/sidebar-items.js new file mode 100644 index 0000000000..3bec7b23bc --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["lower_contract","lower_contract_deployable","lower_function","lower_test"],"mod":["context"]}; \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/isel/test/fn.lower_test.html b/compiler-docs/fe_codegen/yul/isel/test/fn.lower_test.html new file mode 100644 index 0000000000..233f0432fe --- /dev/null +++ b/compiler-docs/fe_codegen/yul/isel/test/fn.lower_test.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../../fe_codegen/yul/isel/fn.lower_test.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/legalize/body/fn.legalize_func_body.html b/compiler-docs/fe_codegen/yul/legalize/body/fn.legalize_func_body.html new file mode 100644 index 0000000000..1834c6bb95 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/legalize/body/fn.legalize_func_body.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../../fe_codegen/yul/legalize/fn.legalize_func_body.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/legalize/fn.legalize_func_body.html b/compiler-docs/fe_codegen/yul/legalize/fn.legalize_func_body.html new file mode 100644 index 0000000000..df95f2f15d --- /dev/null +++ b/compiler-docs/fe_codegen/yul/legalize/fn.legalize_func_body.html @@ -0,0 +1 @@ +legalize_func_body in fe_codegen::yul::legalize - Rust

Function legalize_func_body

Source
pub fn legalize_func_body(db: &dyn CodegenDb, body: &mut FunctionBody)
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/legalize/fn.legalize_func_signature.html b/compiler-docs/fe_codegen/yul/legalize/fn.legalize_func_signature.html new file mode 100644 index 0000000000..0a0875876d --- /dev/null +++ b/compiler-docs/fe_codegen/yul/legalize/fn.legalize_func_signature.html @@ -0,0 +1 @@ +legalize_func_signature in fe_codegen::yul::legalize - Rust

Function legalize_func_signature

Source
pub fn legalize_func_signature(db: &dyn CodegenDb, sig: &mut FunctionSignature)
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/legalize/index.html b/compiler-docs/fe_codegen/yul/legalize/index.html new file mode 100644 index 0000000000..e41c80d5c4 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/legalize/index.html @@ -0,0 +1 @@ +fe_codegen::yul::legalize - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/legalize/sidebar-items.js b/compiler-docs/fe_codegen/yul/legalize/sidebar-items.js new file mode 100644 index 0000000000..c4c368b332 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/legalize/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["legalize_func_body","legalize_func_signature"]}; \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/legalize/signature/fn.legalize_func_signature.html b/compiler-docs/fe_codegen/yul/legalize/signature/fn.legalize_func_signature.html new file mode 100644 index 0000000000..7d82aef80b --- /dev/null +++ b/compiler-docs/fe_codegen/yul/legalize/signature/fn.legalize_func_signature.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../../fe_codegen/yul/legalize/fn.legalize_func_signature.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/runtime/enum.AbiSrcLocation.html b/compiler-docs/fe_codegen/yul/runtime/enum.AbiSrcLocation.html new file mode 100644 index 0000000000..ccb48d326d --- /dev/null +++ b/compiler-docs/fe_codegen/yul/runtime/enum.AbiSrcLocation.html @@ -0,0 +1,16 @@ +AbiSrcLocation in fe_codegen::yul::runtime - Rust

Enum AbiSrcLocation

Source
pub enum AbiSrcLocation {
+    CallData,
+    Memory,
+}

Variants§

§

CallData

§

Memory

Trait Implementations§

Source§

impl Clone for AbiSrcLocation

Source§

fn clone(&self) -> AbiSrcLocation

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiSrcLocation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for AbiSrcLocation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/runtime/index.html b/compiler-docs/fe_codegen/yul/runtime/index.html new file mode 100644 index 0000000000..10f2234db9 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/runtime/index.html @@ -0,0 +1 @@ +fe_codegen::yul::runtime - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/runtime/sidebar-items.js b/compiler-docs/fe_codegen/yul/runtime/sidebar-items.js new file mode 100644 index 0000000000..f8894c45b7 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/runtime/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["AbiSrcLocation"],"struct":["DefaultRuntimeProvider"],"trait":["RuntimeProvider"]}; \ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/runtime/struct.DefaultRuntimeProvider.html b/compiler-docs/fe_codegen/yul/runtime/struct.DefaultRuntimeProvider.html new file mode 100644 index 0000000000..6d6c03d372 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/runtime/struct.DefaultRuntimeProvider.html @@ -0,0 +1,144 @@ +DefaultRuntimeProvider in fe_codegen::yul::runtime - Rust

Struct DefaultRuntimeProvider

Source
pub struct DefaultRuntimeProvider { /* private fields */ }

Trait Implementations§

Source§

impl Debug for DefaultRuntimeProvider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DefaultRuntimeProvider

Source§

fn default() -> DefaultRuntimeProvider

Returns the “default value” for a type. Read more
Source§

impl RuntimeProvider for DefaultRuntimeProvider

Source§

fn collect_definitions(&self) -> Vec<FunctionDefinition>

Source§

fn alloc(&mut self, _db: &dyn CodegenDb, bytes: Expression) -> Expression

Source§

fn avail(&mut self, _db: &dyn CodegenDb) -> Expression

Source§

fn create( + &mut self, + db: &dyn CodegenDb, + contract: ContractId, + value: Expression, +) -> Expression

Source§

fn create2( + &mut self, + db: &dyn CodegenDb, + contract: ContractId, + value: Expression, + salt: Expression, +) -> Expression

Source§

fn emit( + &mut self, + db: &dyn CodegenDb, + event: Expression, + event_ty: TypeId, +) -> Expression

Source§

fn revert( + &mut self, + db: &dyn CodegenDb, + arg: Option<Expression>, + arg_name: &str, + arg_ty: TypeId, +) -> Expression

Source§

fn external_call( + &mut self, + db: &dyn CodegenDb, + function: FunctionId, + args: Vec<Expression>, +) -> Expression

Source§

fn map_value_ptr( + &mut self, + db: &dyn CodegenDb, + map_ptr: Expression, + key: Expression, + key_ty: TypeId, +) -> Expression

Source§

fn aggregate_init( + &mut self, + db: &dyn CodegenDb, + ptr: Expression, + args: Vec<Expression>, + ptr_ty: TypeId, + arg_tys: Vec<TypeId>, +) -> Expression

Source§

fn string_copy( + &mut self, + db: &dyn CodegenDb, + dst: Expression, + data: &str, + is_dst_storage: bool, +) -> Expression

Source§

fn string_construct( + &mut self, + db: &dyn CodegenDb, + data: &str, + string_len: usize, +) -> Expression

Source§

fn ptr_copy( + &mut self, + _db: &dyn CodegenDb, + src: Expression, + dst: Expression, + size: Expression, + is_src_storage: bool, + is_dst_storage: bool, +) -> Expression

Copy data from src to dst. +NOTE: src and dst must be aligned by 32 when a ptr is storage ptr.
Source§

fn ptr_store( + &mut self, + db: &dyn CodegenDb, + ptr: Expression, + imm: Expression, + ptr_ty: TypeId, +) -> Expression

Source§

fn ptr_load( + &mut self, + db: &dyn CodegenDb, + ptr: Expression, + ptr_ty: TypeId, +) -> Expression

Source§

fn abi_encode( + &mut self, + db: &dyn CodegenDb, + src: Expression, + dst: Expression, + src_ty: TypeId, + is_dst_storage: bool, +) -> Expression

Source§

fn abi_encode_seq( + &mut self, + db: &dyn CodegenDb, + src: &[Expression], + dst: Expression, + src_tys: &[TypeId], + is_dst_storage: bool, +) -> Expression

Source§

fn abi_decode( + &mut self, + db: &dyn CodegenDb, + src: Expression, + size: Expression, + types: &[TypeId], + abi_loc: AbiSrcLocation, +) -> Expression

Source§

fn safe_add( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source§

fn safe_sub( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source§

fn safe_mul( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source§

fn safe_div( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source§

fn safe_mod( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source§

fn safe_pow( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source§

fn primitive_cast( + &mut self, + db: &dyn CodegenDb, + value: Expression, + from_ty: TypeId, +) -> Expression

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/runtime/trait.RuntimeProvider.html b/compiler-docs/fe_codegen/yul/runtime/trait.RuntimeProvider.html new file mode 100644 index 0000000000..9ce48d6a26 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/runtime/trait.RuntimeProvider.html @@ -0,0 +1,296 @@ +RuntimeProvider in fe_codegen::yul::runtime - Rust

Trait RuntimeProvider

Source
pub trait RuntimeProvider {
+
Show 25 methods // Required methods + fn collect_definitions(&self) -> Vec<FunctionDefinition>; + fn alloc(&mut self, db: &dyn CodegenDb, size: Expression) -> Expression; + fn avail(&mut self, db: &dyn CodegenDb) -> Expression; + fn create( + &mut self, + db: &dyn CodegenDb, + contract: ContractId, + value: Expression, + ) -> Expression; + fn create2( + &mut self, + db: &dyn CodegenDb, + contract: ContractId, + value: Expression, + salt: Expression, + ) -> Expression; + fn emit( + &mut self, + db: &dyn CodegenDb, + event: Expression, + event_ty: TypeId, + ) -> Expression; + fn revert( + &mut self, + db: &dyn CodegenDb, + arg: Option<Expression>, + arg_name: &str, + arg_ty: TypeId, + ) -> Expression; + fn external_call( + &mut self, + db: &dyn CodegenDb, + function: FunctionId, + args: Vec<Expression>, + ) -> Expression; + fn map_value_ptr( + &mut self, + db: &dyn CodegenDb, + map_ptr: Expression, + key: Expression, + key_ty: TypeId, + ) -> Expression; + fn aggregate_init( + &mut self, + db: &dyn CodegenDb, + ptr: Expression, + args: Vec<Expression>, + ptr_ty: TypeId, + arg_tys: Vec<TypeId>, + ) -> Expression; + fn string_copy( + &mut self, + db: &dyn CodegenDb, + dst: Expression, + data: &str, + is_dst_storage: bool, + ) -> Expression; + fn string_construct( + &mut self, + db: &dyn CodegenDb, + data: &str, + string_len: usize, + ) -> Expression; + fn ptr_copy( + &mut self, + db: &dyn CodegenDb, + src: Expression, + dst: Expression, + size: Expression, + is_src_storage: bool, + is_dst_storage: bool, + ) -> Expression; + fn ptr_store( + &mut self, + db: &dyn CodegenDb, + ptr: Expression, + imm: Expression, + ptr_ty: TypeId, + ) -> Expression; + fn ptr_load( + &mut self, + db: &dyn CodegenDb, + ptr: Expression, + ptr_ty: TypeId, + ) -> Expression; + fn abi_encode( + &mut self, + db: &dyn CodegenDb, + src: Expression, + dst: Expression, + src_ty: TypeId, + is_dst_storage: bool, + ) -> Expression; + fn abi_encode_seq( + &mut self, + db: &dyn CodegenDb, + src: &[Expression], + dst: Expression, + src_tys: &[TypeId], + is_dst_storage: bool, + ) -> Expression; + fn abi_decode( + &mut self, + db: &dyn CodegenDb, + src: Expression, + size: Expression, + types: &[TypeId], + abi_loc: AbiSrcLocation, + ) -> Expression; + fn safe_add( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, + ) -> Expression; + fn safe_sub( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, + ) -> Expression; + fn safe_mul( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, + ) -> Expression; + fn safe_div( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, + ) -> Expression; + fn safe_mod( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, + ) -> Expression; + fn safe_pow( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, + ) -> Expression; + + // Provided method + fn primitive_cast( + &mut self, + db: &dyn CodegenDb, + value: Expression, + from_ty: TypeId, + ) -> Expression { ... } +
}

Required Methods§

Source

fn collect_definitions(&self) -> Vec<FunctionDefinition>

Source

fn alloc(&mut self, db: &dyn CodegenDb, size: Expression) -> Expression

Source

fn avail(&mut self, db: &dyn CodegenDb) -> Expression

Source

fn create( + &mut self, + db: &dyn CodegenDb, + contract: ContractId, + value: Expression, +) -> Expression

Source

fn create2( + &mut self, + db: &dyn CodegenDb, + contract: ContractId, + value: Expression, + salt: Expression, +) -> Expression

Source

fn emit( + &mut self, + db: &dyn CodegenDb, + event: Expression, + event_ty: TypeId, +) -> Expression

Source

fn revert( + &mut self, + db: &dyn CodegenDb, + arg: Option<Expression>, + arg_name: &str, + arg_ty: TypeId, +) -> Expression

Source

fn external_call( + &mut self, + db: &dyn CodegenDb, + function: FunctionId, + args: Vec<Expression>, +) -> Expression

Source

fn map_value_ptr( + &mut self, + db: &dyn CodegenDb, + map_ptr: Expression, + key: Expression, + key_ty: TypeId, +) -> Expression

Source

fn aggregate_init( + &mut self, + db: &dyn CodegenDb, + ptr: Expression, + args: Vec<Expression>, + ptr_ty: TypeId, + arg_tys: Vec<TypeId>, +) -> Expression

Source

fn string_copy( + &mut self, + db: &dyn CodegenDb, + dst: Expression, + data: &str, + is_dst_storage: bool, +) -> Expression

Source

fn string_construct( + &mut self, + db: &dyn CodegenDb, + data: &str, + string_len: usize, +) -> Expression

Source

fn ptr_copy( + &mut self, + db: &dyn CodegenDb, + src: Expression, + dst: Expression, + size: Expression, + is_src_storage: bool, + is_dst_storage: bool, +) -> Expression

Copy data from src to dst. +NOTE: src and dst must be aligned by 32 when a ptr is storage ptr.

+
Source

fn ptr_store( + &mut self, + db: &dyn CodegenDb, + ptr: Expression, + imm: Expression, + ptr_ty: TypeId, +) -> Expression

Source

fn ptr_load( + &mut self, + db: &dyn CodegenDb, + ptr: Expression, + ptr_ty: TypeId, +) -> Expression

Source

fn abi_encode( + &mut self, + db: &dyn CodegenDb, + src: Expression, + dst: Expression, + src_ty: TypeId, + is_dst_storage: bool, +) -> Expression

Source

fn abi_encode_seq( + &mut self, + db: &dyn CodegenDb, + src: &[Expression], + dst: Expression, + src_tys: &[TypeId], + is_dst_storage: bool, +) -> Expression

Source

fn abi_decode( + &mut self, + db: &dyn CodegenDb, + src: Expression, + size: Expression, + types: &[TypeId], + abi_loc: AbiSrcLocation, +) -> Expression

Source

fn safe_add( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source

fn safe_sub( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source

fn safe_mul( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source

fn safe_div( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source

fn safe_mod( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Source

fn safe_pow( + &mut self, + db: &dyn CodegenDb, + lhs: Expression, + rhs: Expression, + ty: TypeId, +) -> Expression

Provided Methods§

Source

fn primitive_cast( + &mut self, + db: &dyn CodegenDb, + value: Expression, + from_ty: TypeId, +) -> Expression

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_codegen/yul/sidebar-items.js b/compiler-docs/fe_codegen/yul/sidebar-items.js new file mode 100644 index 0000000000..6684c69798 --- /dev/null +++ b/compiler-docs/fe_codegen/yul/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["isel","legalize","runtime"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/all.html b/compiler-docs/fe_common/all.html new file mode 100644 index 0000000000..dd834c8a65 --- /dev/null +++ b/compiler-docs/fe_common/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/index.html b/compiler-docs/fe_common/db/index.html new file mode 100644 index 0000000000..4d8a2d8d44 --- /dev/null +++ b/compiler-docs/fe_common/db/index.html @@ -0,0 +1 @@ +fe_common::db - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/sidebar-items.js b/compiler-docs/fe_common/db/sidebar-items.js new file mode 100644 index 0000000000..0dbd491578 --- /dev/null +++ b/compiler-docs/fe_common/db/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["FileContentQuery","FileLineStartsQuery","FileNameQuery","InternFileLookupQuery","InternFileQuery","SourceDbGroupStorage__","SourceDbStorage","TestDb"],"trait":["SourceDb","Upcast","UpcastMut"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/db/struct.FileContentQuery.html b/compiler-docs/fe_common/db/struct.FileContentQuery.html new file mode 100644 index 0000000000..f3088329e5 --- /dev/null +++ b/compiler-docs/fe_common/db/struct.FileContentQuery.html @@ -0,0 +1,39 @@ +FileContentQuery in fe_common::db - Rust

Struct FileContentQuery

Source
pub struct FileContentQuery;

Implementations§

Source§

impl FileContentQuery

Source

pub fn in_db(self, db: &dyn SourceDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl FileContentQuery

Source

pub fn in_db_mut(self, db: &mut dyn SourceDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for FileContentQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileContentQuery

Source§

fn default() -> FileContentQuery

Returns the “default value” for a type. Read more
Source§

impl Query for FileContentQuery

Source§

const QUERY_INDEX: u16 = 2u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "file_content"

Name of the query method (e.g., foo)
Source§

type Key = SourceFileId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<str>

What value does the query return?
Source§

type Storage = InputStorage<FileContentQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for FileContentQuery

Source§

type DynDb = dyn SourceDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = SourceDbStorage

Associate query group struct.
Source§

type GroupStorage = SourceDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/struct.FileLineStartsQuery.html b/compiler-docs/fe_common/db/struct.FileLineStartsQuery.html new file mode 100644 index 0000000000..3cda608ce0 --- /dev/null +++ b/compiler-docs/fe_common/db/struct.FileLineStartsQuery.html @@ -0,0 +1,46 @@ +FileLineStartsQuery in fe_common::db - Rust

Struct FileLineStartsQuery

Source
pub struct FileLineStartsQuery;

Implementations§

Source§

impl FileLineStartsQuery

Source

pub fn in_db(self, db: &dyn SourceDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl FileLineStartsQuery

Source

pub fn in_db_mut(self, db: &mut dyn SourceDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for FileLineStartsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileLineStartsQuery

Source§

fn default() -> FileLineStartsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for FileLineStartsQuery

Source§

const QUERY_INDEX: u16 = 3u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "file_line_starts"

Name of the query method (e.g., foo)
Source§

type Key = SourceFileId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<[usize]>

What value does the query return?
Source§

type Storage = DerivedStorage<FileLineStartsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for FileLineStartsQuery

Source§

type DynDb = dyn SourceDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = SourceDbStorage

Associate query group struct.
Source§

type GroupStorage = SourceDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for FileLineStartsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/struct.FileNameQuery.html b/compiler-docs/fe_common/db/struct.FileNameQuery.html new file mode 100644 index 0000000000..b10fedaa97 --- /dev/null +++ b/compiler-docs/fe_common/db/struct.FileNameQuery.html @@ -0,0 +1,46 @@ +FileNameQuery in fe_common::db - Rust

Struct FileNameQuery

Source
pub struct FileNameQuery;

Implementations§

Source§

impl FileNameQuery

Source

pub fn in_db(self, db: &dyn SourceDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl FileNameQuery

Source

pub fn in_db_mut(self, db: &mut dyn SourceDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for FileNameQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileNameQuery

Source§

fn default() -> FileNameQuery

Returns the “default value” for a type. Read more
Source§

impl Query for FileNameQuery

Source§

const QUERY_INDEX: u16 = 4u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "file_name"

Name of the query method (e.g., foo)
Source§

type Key = SourceFileId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = SmolStr

What value does the query return?
Source§

type Storage = DerivedStorage<FileNameQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for FileNameQuery

Source§

type DynDb = dyn SourceDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = SourceDbStorage

Associate query group struct.
Source§

type GroupStorage = SourceDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for FileNameQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/struct.InternFileLookupQuery.html b/compiler-docs/fe_common/db/struct.InternFileLookupQuery.html new file mode 100644 index 0000000000..88c73e05e7 --- /dev/null +++ b/compiler-docs/fe_common/db/struct.InternFileLookupQuery.html @@ -0,0 +1,39 @@ +InternFileLookupQuery in fe_common::db - Rust

Struct InternFileLookupQuery

Source
pub struct InternFileLookupQuery;

Implementations§

Source§

impl InternFileLookupQuery

Source

pub fn in_db(self, db: &dyn SourceDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternFileLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn SourceDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternFileLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternFileLookupQuery

Source§

fn default() -> InternFileLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternFileLookupQuery

Source§

const QUERY_INDEX: u16 = 1u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_intern_file"

Name of the query method (e.g., foo)
Source§

type Key = SourceFileId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = File

What value does the query return?
Source§

type Storage = LookupInternedStorage<InternFileLookupQuery, InternFileQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternFileLookupQuery

Source§

type DynDb = dyn SourceDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = SourceDbStorage

Associate query group struct.
Source§

type GroupStorage = SourceDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/struct.InternFileQuery.html b/compiler-docs/fe_common/db/struct.InternFileQuery.html new file mode 100644 index 0000000000..e38ab8918d --- /dev/null +++ b/compiler-docs/fe_common/db/struct.InternFileQuery.html @@ -0,0 +1,39 @@ +InternFileQuery in fe_common::db - Rust

Struct InternFileQuery

Source
pub struct InternFileQuery;

Implementations§

Source§

impl InternFileQuery

Source

pub fn in_db(self, db: &dyn SourceDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl InternFileQuery

Source

pub fn in_db_mut(self, db: &mut dyn SourceDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for InternFileQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InternFileQuery

Source§

fn default() -> InternFileQuery

Returns the “default value” for a type. Read more
Source§

impl Query for InternFileQuery

Source§

const QUERY_INDEX: u16 = 0u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "intern_file"

Name of the query method (e.g., foo)
Source§

type Key = File

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = SourceFileId

What value does the query return?
Source§

type Storage = InternedStorage<InternFileQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for InternFileQuery

Source§

type DynDb = dyn SourceDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = SourceDbStorage

Associate query group struct.
Source§

type GroupStorage = SourceDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/struct.SourceDbGroupStorage__.html b/compiler-docs/fe_common/db/struct.SourceDbGroupStorage__.html new file mode 100644 index 0000000000..b25fcc2497 --- /dev/null +++ b/compiler-docs/fe_common/db/struct.SourceDbGroupStorage__.html @@ -0,0 +1,31 @@ +SourceDbGroupStorage__ in fe_common::db - Rust

Struct SourceDbGroupStorage__

Source
pub struct SourceDbGroupStorage__ {
+    pub intern_file: Arc<<InternFileQuery as Query>::Storage>,
+    pub lookup_intern_file: Arc<<InternFileLookupQuery as Query>::Storage>,
+    pub file_content: Arc<<FileContentQuery as Query>::Storage>,
+    pub file_line_starts: Arc<<FileLineStartsQuery as Query>::Storage>,
+    pub file_name: Arc<<FileNameQuery as Query>::Storage>,
+}

Fields§

§intern_file: Arc<<InternFileQuery as Query>::Storage>§lookup_intern_file: Arc<<InternFileLookupQuery as Query>::Storage>§file_content: Arc<<FileContentQuery as Query>::Storage>§file_line_starts: Arc<<FileLineStartsQuery as Query>::Storage>§file_name: Arc<<FileNameQuery as Query>::Storage>

Implementations§

Source§

impl SourceDbGroupStorage__

Source

pub fn new(group_index: u16) -> Self

Source§

impl SourceDbGroupStorage__

Source

pub fn fmt_index( + &self, + db: &(dyn SourceDb + '_), + input: DatabaseKeyIndex, + fmt: &mut Formatter<'_>, +) -> Result

Source

pub fn maybe_changed_since( + &self, + db: &(dyn SourceDb + '_), + input: DatabaseKeyIndex, + revision: Revision, +) -> bool

Source

pub fn for_each_query( + &self, + _runtime: &Runtime, + op: &mut dyn FnMut(&dyn QueryStorageMassOps), +)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/struct.SourceDbStorage.html b/compiler-docs/fe_common/db/struct.SourceDbStorage.html new file mode 100644 index 0000000000..20326d65d1 --- /dev/null +++ b/compiler-docs/fe_common/db/struct.SourceDbStorage.html @@ -0,0 +1,12 @@ +SourceDbStorage in fe_common::db - Rust

Struct SourceDbStorage

Source
pub struct SourceDbStorage {}
Expand description

Representative struct for the query group.

+

Trait Implementations§

Source§

impl HasQueryGroup<SourceDbStorage> for TestDb

Source§

fn group_storage(&self) -> &<SourceDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl QueryGroup for SourceDbStorage

Source§

type DynDb = dyn SourceDb

Dyn version of the associated database trait.
Source§

type GroupStorage = SourceDbGroupStorage__

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/struct.TestDb.html b/compiler-docs/fe_common/db/struct.TestDb.html new file mode 100644 index 0000000000..a5f44d6a28 --- /dev/null +++ b/compiler-docs/fe_common/db/struct.TestDb.html @@ -0,0 +1,32 @@ +TestDb in fe_common::db - Rust

Struct TestDb

Source
pub struct TestDb { /* private fields */ }

Trait Implementations§

Source§

impl Database for TestDb

§

fn sweep_all(&self, strategy: SweepStrategy)

Iterates through all query storage and removes any values that +have not been used since the last revision was created. The +intended use-cycle is that you first execute all of your +“main” queries; this will ensure that all query values they +consume are marked as used. You then invoke this method to +remove other values that were not needed for your main query +results.
§

fn salsa_event(&self, event_fn: Event)

This function is invoked at key points in the salsa +runtime. It permits the database to be customized and to +inject logging or other custom behavior.
§

fn on_propagated_panic(&self) -> !

This function is invoked when a dependent query is being computed by the +other thread, and that thread panics.
§

fn salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.
§

fn salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.
Source§

impl DatabaseOps for TestDb

Source§

fn ops_database(&self) -> &dyn Database

Upcast this type to a dyn Database.
Source§

fn ops_salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.
Source§

fn ops_salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.
Source§

fn fmt_index(&self, input: DatabaseKeyIndex, fmt: &mut Formatter<'_>) -> Result

Formats a database key index in a human readable fashion.
Source§

fn maybe_changed_since( + &self, + input: DatabaseKeyIndex, + revision: Revision, +) -> bool

True if the computed value for input may have changed since revision.
Source§

fn for_each_query(&self, op: &mut dyn FnMut(&dyn QueryStorageMassOps))

Executes the callback for each kind of query.
Source§

impl DatabaseStorageTypes for TestDb

Source§

type DatabaseStorage = __SalsaDatabaseStorage

Defines the “storage type”, where all the query data is kept. +This type is defined by the database_storage macro.
Source§

impl Default for TestDb

Source§

fn default() -> TestDb

Returns the “default value” for a type. Read more
Source§

impl HasQueryGroup<SourceDbStorage> for TestDb

Source§

fn group_storage(&self) -> &<SourceDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.

Auto Trait Implementations§

§

impl !Freeze for TestDb

§

impl RefUnwindSafe for TestDb

§

impl !Send for TestDb

§

impl !Sync for TestDb

§

impl Unpin for TestDb

§

impl UnwindSafe for TestDb

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<DB> SourceDb for DB
where + DB: Database + HasQueryGroup<SourceDbStorage>,

Source§

fn intern_file(&self, key0: File) -> SourceFileId

Source§

fn lookup_intern_file(&self, key0: SourceFileId) -> File

Source§

fn file_content(&self, key0: SourceFileId) -> Rc<str>

Set with `fn set_file_content(&mut self, file: SourceFileId, content: Rc)
Source§

fn set_file_content(&mut self, key0: SourceFileId, value__: Rc<str>)

Set the value of the file_content input. Read more
Source§

fn set_file_content_with_durability( + &mut self, + key0: SourceFileId, + value__: Rc<str>, + durability__: Durability, +)

Set the value of the file_content input and promise +that its value will never change again. Read more
Source§

fn file_line_starts(&self, key0: SourceFileId) -> Rc<[usize]>

Source§

fn file_name(&self, key0: SourceFileId) -> SmolStr

Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/db/trait.SourceDb.html b/compiler-docs/fe_common/db/trait.SourceDb.html new file mode 100644 index 0000000000..8dff6797f7 --- /dev/null +++ b/compiler-docs/fe_common/db/trait.SourceDb.html @@ -0,0 +1,33 @@ +SourceDb in fe_common::db - Rust

Trait SourceDb

Source
pub trait SourceDb: Database + HasQueryGroup<SourceDbStorage> {
+    // Required methods
+    fn intern_file(&self, key0: File) -> SourceFileId;
+    fn lookup_intern_file(&self, key0: SourceFileId) -> File;
+    fn file_content(&self, key0: SourceFileId) -> Rc<str>;
+    fn set_file_content(&mut self, key0: SourceFileId, value__: Rc<str>);
+    fn set_file_content_with_durability(
+        &mut self,
+        key0: SourceFileId,
+        value__: Rc<str>,
+        durability__: Durability,
+    );
+    fn file_line_starts(&self, key0: SourceFileId) -> Rc<[usize]>;
+    fn file_name(&self, key0: SourceFileId) -> SmolStr;
+}

Required Methods§

Source

fn intern_file(&self, key0: File) -> SourceFileId

Source

fn lookup_intern_file(&self, key0: SourceFileId) -> File

Source

fn file_content(&self, key0: SourceFileId) -> Rc<str>

Set with `fn set_file_content(&mut self, file: SourceFileId, content: Rc)

+
Source

fn set_file_content(&mut self, key0: SourceFileId, value__: Rc<str>)

Set the value of the file_content input.

+

See file_content for details.

+

Note: Setting values will trigger cancellation +of any ongoing queries; this method blocks until +those queries have been cancelled.

+
Source

fn set_file_content_with_durability( + &mut self, + key0: SourceFileId, + value__: Rc<str>, + durability__: Durability, +)

Set the value of the file_content input and promise +that its value will never change again.

+

See file_content for details.

+

Note: Setting values will trigger cancellation +of any ongoing queries; this method blocks until +those queries have been cancelled.

+
Source

fn file_line_starts(&self, key0: SourceFileId) -> Rc<[usize]>

Source

fn file_name(&self, key0: SourceFileId) -> SmolStr

Implementors§

Source§

impl<DB> SourceDb for DB
where + DB: Database + HasQueryGroup<SourceDbStorage>,

\ No newline at end of file diff --git a/compiler-docs/fe_common/db/trait.Upcast.html b/compiler-docs/fe_common/db/trait.Upcast.html new file mode 100644 index 0000000000..27ebc91e53 --- /dev/null +++ b/compiler-docs/fe_common/db/trait.Upcast.html @@ -0,0 +1,4 @@ +Upcast in fe_common::db - Rust

Trait Upcast

Source
pub trait Upcast<T: ?Sized> {
+    // Required method
+    fn upcast(&self) -> &T;
+}

Required Methods§

Source

fn upcast(&self) -> &T

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_common/db/trait.UpcastMut.html b/compiler-docs/fe_common/db/trait.UpcastMut.html new file mode 100644 index 0000000000..a95b363fee --- /dev/null +++ b/compiler-docs/fe_common/db/trait.UpcastMut.html @@ -0,0 +1,4 @@ +UpcastMut in fe_common::db - Rust

Trait UpcastMut

Source
pub trait UpcastMut<T: ?Sized> {
+    // Required method
+    fn upcast_mut(&mut self) -> &mut T;
+}

Required Methods§

Source

fn upcast_mut(&mut self) -> &mut T

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/cs/enum.LabelStyle.html b/compiler-docs/fe_common/diagnostics/cs/enum.LabelStyle.html new file mode 100644 index 0000000000..0477a90a0c --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/cs/enum.LabelStyle.html @@ -0,0 +1,28 @@ +LabelStyle in fe_common::diagnostics::cs - Rust

Enum LabelStyle

pub enum LabelStyle {
+    Primary,
+    Secondary,
+}

Variants§

§

Primary

Labels that describe the primary cause of a diagnostic.

+
§

Secondary

Labels that provide additional context for a diagnostic.

+

Trait Implementations§

§

impl Clone for LabelStyle

§

fn clone(&self) -> LabelStyle

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for LabelStyle

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<LabelStyle> for LabelStyle

Source§

fn from(other: LabelStyle) -> LabelStyle

Converts to this type from the input type.
§

impl PartialEq for LabelStyle

§

fn eq(&self, other: &LabelStyle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialOrd for LabelStyle

§

fn partial_cmp(&self, other: &LabelStyle) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl Copy for LabelStyle

§

impl Eq for LabelStyle

§

impl StructuralPartialEq for LabelStyle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/cs/enum.Severity.html b/compiler-docs/fe_common/diagnostics/cs/enum.Severity.html new file mode 100644 index 0000000000..684fcb944e --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/cs/enum.Severity.html @@ -0,0 +1,46 @@ +Severity in fe_common::diagnostics::cs - Rust

Enum Severity

pub enum Severity {
+    Bug,
+    Error,
+    Warning,
+    Note,
+    Help,
+}
Expand description

A severity level for diagnostic messages.

+

These are ordered in the following way:

+ +
use codespan_reporting::diagnostic::Severity;
+
+assert!(Severity::Bug > Severity::Error);
+assert!(Severity::Error > Severity::Warning);
+assert!(Severity::Warning > Severity::Note);
+assert!(Severity::Note > Severity::Help);
+

Variants§

§

Bug

An unexpected bug.

+
§

Error

An error.

+
§

Warning

A warning.

+
§

Note

A note.

+
§

Help

A help message.

+

Trait Implementations§

§

impl Clone for Severity

§

fn clone(&self) -> Severity

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Severity

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Hash for Severity

§

fn hash<__H>(&self, state: &mut __H)
where + __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for Severity

§

fn eq(&self, other: &Severity) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialOrd for Severity

§

fn partial_cmp(&self, other: &Severity) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl Copy for Severity

§

impl Eq for Severity

§

impl StructuralPartialEq for Severity

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/cs/index.html b/compiler-docs/fe_common/diagnostics/cs/index.html new file mode 100644 index 0000000000..f6aff2a335 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/cs/index.html @@ -0,0 +1,3 @@ +fe_common::diagnostics::cs - Rust

Module cs

Expand description

Diagnostic data structures.

+

Structs§

Diagnostic
Represents a diagnostic message that can provide information like errors and +warnings to the user.
Label
A label describing an underlined region of code associated with a diagnostic.

Enums§

LabelStyle
Severity
A severity level for diagnostic messages.
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/cs/sidebar-items.js b/compiler-docs/fe_common/diagnostics/cs/sidebar-items.js new file mode 100644 index 0000000000..7d8844f436 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/cs/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["LabelStyle","Severity"],"struct":["Diagnostic","Label"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/cs/struct.Diagnostic.html b/compiler-docs/fe_common/diagnostics/cs/struct.Diagnostic.html new file mode 100644 index 0000000000..0f20f85412 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/cs/struct.Diagnostic.html @@ -0,0 +1,59 @@ +Diagnostic in fe_common::diagnostics::cs - Rust

Struct Diagnostic

pub struct Diagnostic<FileId> {
+    pub severity: Severity,
+    pub code: Option<String>,
+    pub message: String,
+    pub labels: Vec<Label<FileId>>,
+    pub notes: Vec<String>,
+}
Expand description

Represents a diagnostic message that can provide information like errors and +warnings to the user.

+

The position of a Diagnostic is considered to be the position of the Label that has the earliest starting position and has the highest style which appears in all the labels of the diagnostic.

+

Fields§

§severity: Severity

The overall severity of the diagnostic

+
§code: Option<String>

An optional code that identifies this diagnostic.

+
§message: String

The main message associated with this diagnostic.

+

These should not include line breaks, and in order support the ‘short’ +diagnostic display mod, the message should be specific enough to make +sense on its own, without additional context provided by labels and notes.

+
§labels: Vec<Label<FileId>>

Source labels that describe the cause of the diagnostic. +The order of the labels inside the vector does not have any meaning. +The labels are always arranged in the order they appear in the source code.

+
§notes: Vec<String>

Notes that are associated with the primary cause of the diagnostic. +These can include line breaks for improved formatting.

+

Implementations§

§

impl<FileId> Diagnostic<FileId>

pub fn new(severity: Severity) -> Diagnostic<FileId>

Create a new diagnostic.

+

pub fn bug() -> Diagnostic<FileId>

Create a new diagnostic with a severity of Severity::Bug.

+

pub fn error() -> Diagnostic<FileId>

Create a new diagnostic with a severity of Severity::Error.

+

pub fn warning() -> Diagnostic<FileId>

Create a new diagnostic with a severity of Severity::Warning.

+

pub fn note() -> Diagnostic<FileId>

Create a new diagnostic with a severity of Severity::Note.

+

pub fn help() -> Diagnostic<FileId>

Create a new diagnostic with a severity of Severity::Help.

+

pub fn with_code(self, code: impl Into<String>) -> Diagnostic<FileId>

Set the error code of the diagnostic.

+

pub fn with_message(self, message: impl Into<String>) -> Diagnostic<FileId>

Set the message of the diagnostic.

+

pub fn with_labels(self, labels: Vec<Label<FileId>>) -> Diagnostic<FileId>

Add some labels to the diagnostic.

+

pub fn with_notes(self, notes: Vec<String>) -> Diagnostic<FileId>

Add some notes to the diagnostic.

+

Trait Implementations§

§

impl<FileId> Clone for Diagnostic<FileId>
where + FileId: Clone,

§

fn clone(&self) -> Diagnostic<FileId>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<FileId> Debug for Diagnostic<FileId>
where + FileId: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<FileId> PartialEq for Diagnostic<FileId>
where + FileId: PartialEq,

§

fn eq(&self, other: &Diagnostic<FileId>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<FileId> Eq for Diagnostic<FileId>
where + FileId: Eq,

§

impl<FileId> StructuralPartialEq for Diagnostic<FileId>

Auto Trait Implementations§

§

impl<FileId> Freeze for Diagnostic<FileId>

§

impl<FileId> RefUnwindSafe for Diagnostic<FileId>
where + FileId: RefUnwindSafe,

§

impl<FileId> Send for Diagnostic<FileId>
where + FileId: Send,

§

impl<FileId> Sync for Diagnostic<FileId>
where + FileId: Sync,

§

impl<FileId> Unpin for Diagnostic<FileId>
where + FileId: Unpin,

§

impl<FileId> UnwindSafe for Diagnostic<FileId>
where + FileId: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/cs/struct.Label.html b/compiler-docs/fe_common/diagnostics/cs/struct.Label.html new file mode 100644 index 0000000000..5bdd0ba665 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/cs/struct.Label.html @@ -0,0 +1,52 @@ +Label in fe_common::diagnostics::cs - Rust

Struct Label

pub struct Label<FileId> {
+    pub style: LabelStyle,
+    pub file_id: FileId,
+    pub range: Range<usize>,
+    pub message: String,
+}
Expand description

A label describing an underlined region of code associated with a diagnostic.

+

Fields§

§style: LabelStyle

The style of the label.

+
§file_id: FileId

The file that we are labelling.

+
§range: Range<usize>

The range in bytes we are going to include in the final snippet.

+
§message: String

An optional message to provide some additional information for the +underlined code. These should not include line breaks.

+

Implementations§

§

impl<FileId> Label<FileId>

pub fn new( + style: LabelStyle, + file_id: FileId, + range: impl Into<Range<usize>>, +) -> Label<FileId>

Create a new label.

+

pub fn primary(file_id: FileId, range: impl Into<Range<usize>>) -> Label<FileId>

Create a new label with a style of LabelStyle::Primary.

+

pub fn secondary( + file_id: FileId, + range: impl Into<Range<usize>>, +) -> Label<FileId>

Create a new label with a style of LabelStyle::Secondary.

+

pub fn with_message(self, message: impl Into<String>) -> Label<FileId>

Add a message to the diagnostic.

+

Trait Implementations§

§

impl<FileId> Clone for Label<FileId>
where + FileId: Clone,

§

fn clone(&self) -> Label<FileId>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<FileId> Debug for Label<FileId>
where + FileId: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<FileId> PartialEq for Label<FileId>
where + FileId: PartialEq,

§

fn eq(&self, other: &Label<FileId>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<FileId> Eq for Label<FileId>
where + FileId: Eq,

§

impl<FileId> StructuralPartialEq for Label<FileId>

Auto Trait Implementations§

§

impl<FileId> Freeze for Label<FileId>
where + FileId: Freeze,

§

impl<FileId> RefUnwindSafe for Label<FileId>
where + FileId: RefUnwindSafe,

§

impl<FileId> Send for Label<FileId>
where + FileId: Send,

§

impl<FileId> Sync for Label<FileId>
where + FileId: Sync,

§

impl<FileId> Unpin for Label<FileId>
where + FileId: Unpin,

§

impl<FileId> UnwindSafe for Label<FileId>
where + FileId: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/enum.LabelStyle.html b/compiler-docs/fe_common/diagnostics/enum.LabelStyle.html new file mode 100644 index 0000000000..0038871f01 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/enum.LabelStyle.html @@ -0,0 +1,25 @@ +LabelStyle in fe_common::diagnostics - Rust

Enum LabelStyle

Source
pub enum LabelStyle {
+    Primary,
+    Secondary,
+}

Variants§

§

Primary

§

Secondary

Trait Implementations§

Source§

impl Clone for LabelStyle

Source§

fn clone(&self) -> LabelStyle

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LabelStyle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<LabelStyle> for LabelStyle

Source§

fn from(other: LabelStyle) -> LabelStyle

Converts to this type from the input type.
Source§

impl Hash for LabelStyle

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LabelStyle

Source§

fn eq(&self, other: &LabelStyle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for LabelStyle

Source§

impl Eq for LabelStyle

Source§

impl StructuralPartialEq for LabelStyle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/enum.Severity.html b/compiler-docs/fe_common/diagnostics/enum.Severity.html new file mode 100644 index 0000000000..7d2acc1776 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/enum.Severity.html @@ -0,0 +1,46 @@ +Severity in fe_common::diagnostics - Rust

Enum Severity

pub enum Severity {
+    Bug,
+    Error,
+    Warning,
+    Note,
+    Help,
+}
Expand description

A severity level for diagnostic messages.

+

These are ordered in the following way:

+ +
use codespan_reporting::diagnostic::Severity;
+
+assert!(Severity::Bug > Severity::Error);
+assert!(Severity::Error > Severity::Warning);
+assert!(Severity::Warning > Severity::Note);
+assert!(Severity::Note > Severity::Help);
+

Variants§

§

Bug

An unexpected bug.

+
§

Error

An error.

+
§

Warning

A warning.

+
§

Note

A note.

+
§

Help

A help message.

+

Trait Implementations§

§

impl Clone for Severity

§

fn clone(&self) -> Severity

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Severity

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Hash for Severity

§

fn hash<__H>(&self, state: &mut __H)
where + __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for Severity

§

fn eq(&self, other: &Severity) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialOrd for Severity

§

fn partial_cmp(&self, other: &Severity) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl Copy for Severity

§

impl Eq for Severity

§

impl StructuralPartialEq for Severity

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/fn.diagnostics_string.html b/compiler-docs/fe_common/diagnostics/fn.diagnostics_string.html new file mode 100644 index 0000000000..9b8f102f54 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/fn.diagnostics_string.html @@ -0,0 +1,5 @@ +diagnostics_string in fe_common::diagnostics - Rust

Function diagnostics_string

Source
pub fn diagnostics_string(
+    db: &dyn SourceDb,
+    diagnostics: &[Diagnostic],
+) -> String
Expand description

Format the given diagnostics as a string.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/fn.print_diagnostics.html b/compiler-docs/fe_common/diagnostics/fn.print_diagnostics.html new file mode 100644 index 0000000000..3f075ba6d4 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/fn.print_diagnostics.html @@ -0,0 +1,2 @@ +print_diagnostics in fe_common::diagnostics - Rust

Function print_diagnostics

Source
pub fn print_diagnostics(db: &dyn SourceDb, diagnostics: &[Diagnostic])
Expand description

Print the given diagnostics to stderr.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/index.html b/compiler-docs/fe_common/diagnostics/index.html new file mode 100644 index 0000000000..92681af402 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/index.html @@ -0,0 +1 @@ +fe_common::diagnostics - Rust

Module diagnostics

Source

Modules§

cs
Diagnostic data structures.

Structs§

Diagnostic
Label

Enums§

LabelStyle
Severity
A severity level for diagnostic messages.

Functions§

diagnostics_string
Format the given diagnostics as a string.
print_diagnostics
Print the given diagnostics to stderr.
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/sidebar-items.js b/compiler-docs/fe_common/diagnostics/sidebar-items.js new file mode 100644 index 0000000000..5e0b6da6a8 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["LabelStyle","Severity"],"fn":["diagnostics_string","print_diagnostics"],"mod":["cs"],"struct":["Diagnostic","Label"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/struct.Diagnostic.html b/compiler-docs/fe_common/diagnostics/struct.Diagnostic.html new file mode 100644 index 0000000000..f86c13f20f --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/struct.Diagnostic.html @@ -0,0 +1,27 @@ +Diagnostic in fe_common::diagnostics - Rust

Struct Diagnostic

Source
pub struct Diagnostic {
+    pub severity: Severity,
+    pub message: String,
+    pub labels: Vec<Label>,
+    pub notes: Vec<String>,
+}

Fields§

§severity: Severity§message: String§labels: Vec<Label>§notes: Vec<String>

Implementations§

Source§

impl Diagnostic

Source

pub fn into_cs(self) -> Diagnostic<SourceFileId>

Source

pub fn error(message: String) -> Self

Trait Implementations§

Source§

impl Clone for Diagnostic

Source§

fn clone(&self) -> Diagnostic

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Diagnostic

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Diagnostic

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Diagnostic

Source§

fn eq(&self, other: &Diagnostic) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Diagnostic

Source§

impl StructuralPartialEq for Diagnostic

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/diagnostics/struct.Label.html b/compiler-docs/fe_common/diagnostics/struct.Label.html new file mode 100644 index 0000000000..0b234605b0 --- /dev/null +++ b/compiler-docs/fe_common/diagnostics/struct.Label.html @@ -0,0 +1,31 @@ +Label in fe_common::diagnostics - Rust

Struct Label

Source
pub struct Label {
+    pub style: LabelStyle,
+    pub span: Span,
+    pub message: String,
+}

Fields§

§style: LabelStyle§span: Span§message: String

Implementations§

Source§

impl Label

Source

pub fn primary<S: Into<String>>(span: Span, message: S) -> Self

Create a primary label with the given message. This will underline the +given span with carets (^^^^).

+
Source

pub fn secondary<S: Into<String>>(span: Span, message: S) -> Self

Create a secondary label with the given message. This will underline the +given span with hyphens (----).

+
Source

pub fn into_cs_label(self) -> Label<SourceFileId>

Convert into a [codespan_reporting::Diagnostic::Label]

+

Trait Implementations§

Source§

impl Clone for Label

Source§

fn clone(&self) -> Label

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Label

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Label

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Label

Source§

fn eq(&self, other: &Label) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Label

Source§

impl StructuralPartialEq for Label

Auto Trait Implementations§

§

impl Freeze for Label

§

impl RefUnwindSafe for Label

§

impl Send for Label

§

impl Sync for Label

§

impl Unpin for Label

§

impl UnwindSafe for Label

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/files/enum.FileKind.html b/compiler-docs/fe_common/files/enum.FileKind.html new file mode 100644 index 0000000000..31a9ce3600 --- /dev/null +++ b/compiler-docs/fe_common/files/enum.FileKind.html @@ -0,0 +1,27 @@ +FileKind in fe_common::files - Rust

Enum FileKind

Source
pub enum FileKind {
+    Local,
+    Std,
+}

Variants§

§

Local

User file; either part of the target project or an imported ingot

+
§

Std

File is part of the fe standard library

+

Trait Implementations§

Source§

impl Clone for FileKind

Source§

fn clone(&self) -> FileKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FileKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FileKind

Source§

fn eq(&self, other: &FileKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for FileKind

Source§

impl Eq for FileKind

Source§

impl StructuralPartialEq for FileKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/files/enum.Utf8Component.html b/compiler-docs/fe_common/files/enum.Utf8Component.html new file mode 100644 index 0000000000..7340642b8f --- /dev/null +++ b/compiler-docs/fe_common/files/enum.Utf8Component.html @@ -0,0 +1,79 @@ +Utf8Component in fe_common::files - Rust

Enum Utf8Component

pub enum Utf8Component<'a> {
+    Prefix(Utf8PrefixComponent<'a>),
+    RootDir,
+    CurDir,
+    ParentDir,
+    Normal(&'a str),
+}
Expand description

A single component of a path.

+

A Utf8Component roughly corresponds to a substring between path separators +(/ or \).

+

This enum is created by iterating over [Utf8Components], which in turn is +created by the components method on Utf8Path.

+

§Examples

+
use camino::{Utf8Component, Utf8Path};
+
+let path = Utf8Path::new("/tmp/foo/bar.txt");
+let components = path.components().collect::<Vec<_>>();
+assert_eq!(&components, &[
+    Utf8Component::RootDir,
+    Utf8Component::Normal("tmp"),
+    Utf8Component::Normal("foo"),
+    Utf8Component::Normal("bar.txt"),
+]);
+

Variants§

§

Prefix(Utf8PrefixComponent<'a>)

A Windows path prefix, e.g., C: or \\server\share.

+

There is a large variety of prefix types, see [Utf8Prefix]’s documentation +for more.

+

Does not occur on Unix.

+
§

RootDir

The root directory component, appears after any prefix and before anything else.

+

It represents a separator that designates that a path starts from root.

+
§

CurDir

A reference to the current directory, i.e., ..

+
§

ParentDir

A reference to the parent directory, i.e., ...

+
§

Normal(&'a str)

A normal component, e.g., a and b in a/b.

+

This variant is the most common one, it represents references to files +or directories.

+

Implementations§

§

impl<'a> Utf8Component<'a>

pub fn as_str(&self) -> &'a str

Extracts the underlying str slice.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("./tmp/foo/bar.txt");
+let components: Vec<_> = path.components().map(|comp| comp.as_str()).collect();
+assert_eq!(&components, &[".", "tmp", "foo", "bar.txt"]);
+

pub fn as_os_str(&self) -> &'a OsStr

Extracts the underlying OsStr slice.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("./tmp/foo/bar.txt");
+let components: Vec<_> = path.components().map(|comp| comp.as_os_str()).collect();
+assert_eq!(&components, &[".", "tmp", "foo", "bar.txt"]);
+

Trait Implementations§

§

impl AsRef<OsStr> for Utf8Component<'_>

§

fn as_ref(&self) -> &OsStr

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Path> for Utf8Component<'_>

§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Utf8Path> for Utf8Component<'_>

§

fn as_ref(&self) -> &Utf8Path

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<str> for Utf8Component<'_>

§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<'a> Clone for Utf8Component<'a>

§

fn clone(&self) -> Utf8Component<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<'a> Debug for Utf8Component<'a>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'a> Display for Utf8Component<'a>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'a> Hash for Utf8Component<'a>

§

fn hash<__H>(&self, state: &mut __H)
where + __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<'a> Ord for Utf8Component<'a>

§

fn cmp(&self, other: &Utf8Component<'a>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
§

impl<'a> PartialEq for Utf8Component<'a>

§

fn eq(&self, other: &Utf8Component<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a> PartialOrd for Utf8Component<'a>

§

fn partial_cmp(&self, other: &Utf8Component<'a>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a> Copy for Utf8Component<'a>

§

impl<'a> Eq for Utf8Component<'a>

§

impl<'a> StructuralPartialEq for Utf8Component<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Utf8Component<'a>

§

impl<'a> RefUnwindSafe for Utf8Component<'a>

§

impl<'a> Send for Utf8Component<'a>

§

impl<'a> Sync for Utf8Component<'a>

§

impl<'a> Unpin for Utf8Component<'a>

§

impl<'a> UnwindSafe for Utf8Component<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/files/fn.common_prefix.html b/compiler-docs/fe_common/files/fn.common_prefix.html new file mode 100644 index 0000000000..e561b808cf --- /dev/null +++ b/compiler-docs/fe_common/files/fn.common_prefix.html @@ -0,0 +1,3 @@ +common_prefix in fe_common::files - Rust

Function common_prefix

Source
pub fn common_prefix(left: &Utf8Path, right: &Utf8Path) -> Utf8PathBuf
Expand description

Returns the common prefix of two paths. If the paths are identical, +returns the path parent.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/files/index.html b/compiler-docs/fe_common/files/index.html new file mode 100644 index 0000000000..1de297a896 --- /dev/null +++ b/compiler-docs/fe_common/files/index.html @@ -0,0 +1,2 @@ +fe_common::files - Rust

Module files

Source

Re-exports§

pub use fe_library::include_dir;

Structs§

File
SourceFileId
Utf8Path
A slice of a UTF-8 path (akin to str).
Utf8PathBuf
An owned, mutable UTF-8 path (akin to String).

Enums§

FileKind
Utf8Component
A single component of a path.

Functions§

common_prefix
Returns the common prefix of two paths. If the paths are identical, +returns the path parent.
\ No newline at end of file diff --git a/compiler-docs/fe_common/files/sidebar-items.js b/compiler-docs/fe_common/files/sidebar-items.js new file mode 100644 index 0000000000..2d536dd89a --- /dev/null +++ b/compiler-docs/fe_common/files/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["FileKind","Utf8Component"],"fn":["common_prefix"],"struct":["File","SourceFileId","Utf8Path","Utf8PathBuf"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/files/struct.File.html b/compiler-docs/fe_common/files/struct.File.html new file mode 100644 index 0000000000..1010a0e9cb --- /dev/null +++ b/compiler-docs/fe_common/files/struct.File.html @@ -0,0 +1,30 @@ +File in fe_common::files - Rust

Struct File

Source
pub struct File {
+    pub kind: FileKind,
+    pub path: Rc<Utf8PathBuf>,
+}

Fields§

§kind: FileKind

Differentiates between local source files and fe std lib +files, which may have the same path (for salsa’s sake).

+
§path: Rc<Utf8PathBuf>

Path of the file. May include src/ dir or longer prefix; +this prefix will be stored in the Ingot::src_path, and stripped +off as needed.

+

Trait Implementations§

Source§

impl Clone for File

Source§

fn clone(&self) -> File

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for File

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for File

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for File

Source§

fn eq(&self, other: &File) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for File

Source§

impl StructuralPartialEq for File

Auto Trait Implementations§

§

impl Freeze for File

§

impl RefUnwindSafe for File

§

impl !Send for File

§

impl !Sync for File

§

impl Unpin for File

§

impl UnwindSafe for File

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/files/struct.SourceFileId.html b/compiler-docs/fe_common/files/struct.SourceFileId.html new file mode 100644 index 0000000000..1d866de848 --- /dev/null +++ b/compiler-docs/fe_common/files/struct.SourceFileId.html @@ -0,0 +1,33 @@ +SourceFileId in fe_common::files - Rust

Struct SourceFileId

Source
pub struct SourceFileId(/* private fields */);

Implementations§

Source§

impl SourceFileId

Source

pub fn new_local(db: &mut dyn SourceDb, path: &str, content: Rc<str>) -> Self

Source

pub fn new_std(db: &mut dyn SourceDb, path: &str, content: Rc<str>) -> Self

Source

pub fn new( + db: &mut dyn SourceDb, + kind: FileKind, + path: &str, + content: Rc<str>, +) -> Self

Source

pub fn path(&self, db: &dyn SourceDb) -> Rc<Utf8PathBuf>

Source

pub fn content(&self, db: &dyn SourceDb) -> Rc<str>

Source

pub fn line_index(&self, db: &dyn SourceDb, byte_index: usize) -> usize

Source

pub fn line_range( + &self, + db: &dyn SourceDb, + line_index: usize, +) -> Option<Range<usize>>

Source

pub fn dummy_file() -> Self

Source

pub fn is_dummy(self) -> bool

Trait Implementations§

Source§

impl Clone for SourceFileId

Source§

fn clone(&self) -> SourceFileId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SourceFileId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SourceFileId

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for SourceFileId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for SourceFileId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl PartialEq for SourceFileId

Source§

fn eq(&self, other: &SourceFileId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for SourceFileId

Source§

impl Eq for SourceFileId

Source§

impl StructuralPartialEq for SourceFileId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_common/files/struct.Utf8Path.html b/compiler-docs/fe_common/files/struct.Utf8Path.html new file mode 100644 index 0000000000..eef3a2983b --- /dev/null +++ b/compiler-docs/fe_common/files/struct.Utf8Path.html @@ -0,0 +1,667 @@ +Utf8Path in fe_common::files - Rust

Struct Utf8Path

pub struct Utf8Path(/* private fields */);
Expand description

A slice of a UTF-8 path (akin to str).

+

This type supports a number of operations for inspecting a path, including +breaking the path into its components (separated by / on Unix and by either +/ or \ on Windows), extracting the file name, determining whether the path +is absolute, and so on.

+

This is an unsized type, meaning that it must always be used behind a +pointer like & or Box. For an owned version of this type, +see Utf8PathBuf.

+

§Examples

+
use camino::Utf8Path;
+
+// Note: this example does work on Windows
+let path = Utf8Path::new("./foo/bar.txt");
+
+let parent = path.parent();
+assert_eq!(parent, Some(Utf8Path::new("./foo")));
+
+let file_stem = path.file_stem();
+assert_eq!(file_stem, Some("bar"));
+
+let extension = path.extension();
+assert_eq!(extension, Some("txt"));
+

Implementations§

§

impl Utf8Path

pub fn new(s: &(impl AsRef<str> + ?Sized)) -> &Utf8Path

Directly wraps a string slice as a Utf8Path slice.

+

This is a cost-free conversion.

+
§Examples
+
use camino::Utf8Path;
+
+Utf8Path::new("foo.txt");
+

You can create Utf8Paths from Strings, or even other Utf8Paths:

+ +
use camino::Utf8Path;
+
+let string = String::from("foo.txt");
+let from_string = Utf8Path::new(&string);
+let from_path = Utf8Path::new(&from_string);
+assert_eq!(from_string, from_path);
+

pub fn from_path(path: &Path) -> Option<&Utf8Path>

Converts a Path to a Utf8Path.

+

Returns None if the path is not valid UTF-8.

+

For a version that returns a type that implements std::error::Error, use the +TryFrom<&Path> impl.

+
§Examples
+
use camino::Utf8Path;
+use std::ffi::OsStr;
+use std::os::unix::ffi::OsStrExt;
+use std::path::Path;
+
+let unicode_path = Path::new("/valid/unicode");
+Utf8Path::from_path(unicode_path).expect("valid Unicode path succeeded");
+
+// Paths on Unix can be non-UTF-8.
+let non_unicode_str = OsStr::from_bytes(b"\xFF\xFF\xFF");
+let non_unicode_path = Path::new(non_unicode_str);
+assert!(Utf8Path::from_path(non_unicode_path).is_none(), "non-Unicode path failed");
+

pub fn as_std_path(&self) -> &Path

Converts a Utf8Path to a Path.

+

This is equivalent to the AsRef<&Path> for &Utf8Path impl, but may aid in type inference.

+
§Examples
+
use camino::Utf8Path;
+use std::path::Path;
+
+let utf8_path = Utf8Path::new("foo.txt");
+let std_path: &Path = utf8_path.as_std_path();
+assert_eq!(std_path.to_str(), Some("foo.txt"));
+
+// Convert back to a Utf8Path.
+let new_utf8_path = Utf8Path::from_path(std_path).unwrap();
+assert_eq!(new_utf8_path, "foo.txt");
+

pub fn as_str(&self) -> &str

Yields the underlying str slice.

+

Unlike Path::to_str, this always returns a slice because the contents of a Utf8Path +are guaranteed to be valid UTF-8.

+
§Examples
+
use camino::Utf8Path;
+
+let s = Utf8Path::new("foo.txt").as_str();
+assert_eq!(s, "foo.txt");
+

pub fn as_os_str(&self) -> &OsStr

Yields the underlying OsStr slice.

+
§Examples
+
use camino::Utf8Path;
+
+let os_str = Utf8Path::new("foo.txt").as_os_str();
+assert_eq!(os_str, std::ffi::OsStr::new("foo.txt"));
+

pub fn to_path_buf(&self) -> Utf8PathBuf

Converts a Utf8Path to an owned Utf8PathBuf.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path_buf = Utf8Path::new("foo.txt").to_path_buf();
+assert_eq!(path_buf, Utf8PathBuf::from("foo.txt"));
+

pub fn is_absolute(&self) -> bool

Returns true if the Utf8Path is absolute, i.e., if it is independent of +the current directory.

+
    +
  • +

    On Unix, a path is absolute if it starts with the root, so +is_absolute and has_root are equivalent.

    +
  • +
  • +

    On Windows, a path is absolute if it has a prefix and starts with the +root: c:\windows is absolute, while c:temp and \temp are not.

    +
  • +
+
§Examples
+
use camino::Utf8Path;
+
+assert!(!Utf8Path::new("foo.txt").is_absolute());
+

pub fn is_relative(&self) -> bool

Returns true if the Utf8Path is relative, i.e., not absolute.

+

See is_absolute’s documentation for more details.

+
§Examples
+
use camino::Utf8Path;
+
+assert!(Utf8Path::new("foo.txt").is_relative());
+

pub fn has_root(&self) -> bool

Returns true if the Utf8Path has a root.

+
    +
  • +

    On Unix, a path has a root if it begins with /.

    +
  • +
  • +

    On Windows, a path has a root if it:

    +
      +
    • has no prefix and begins with a separator, e.g., \windows
    • +
    • has a prefix followed by a separator, e.g., c:\windows but not c:windows
    • +
    • has any non-disk prefix, e.g., \\server\share
    • +
    +
  • +
+
§Examples
+
use camino::Utf8Path;
+
+assert!(Utf8Path::new("/etc/passwd").has_root());
+

pub fn parent(&self) -> Option<&Utf8Path>

Returns the Path without its final component, if there is one.

+

Returns None if the path terminates in a root or prefix.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/foo/bar");
+let parent = path.parent().unwrap();
+assert_eq!(parent, Utf8Path::new("/foo"));
+
+let grand_parent = parent.parent().unwrap();
+assert_eq!(grand_parent, Utf8Path::new("/"));
+assert_eq!(grand_parent.parent(), None);
+

pub fn ancestors(&self) -> Utf8Ancestors<'_>

Produces an iterator over Utf8Path and its ancestors.

+

The iterator will yield the Utf8Path that is returned if the parent method is used zero +or more times. That means, the iterator will yield &self, &self.parent().unwrap(), +&self.parent().unwrap().parent().unwrap() and so on. If the parent method returns +None, the iterator will do likewise. The iterator will always yield at least one value, +namely &self.

+
§Examples
+
use camino::Utf8Path;
+
+let mut ancestors = Utf8Path::new("/foo/bar").ancestors();
+assert_eq!(ancestors.next(), Some(Utf8Path::new("/foo/bar")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("/foo")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("/")));
+assert_eq!(ancestors.next(), None);
+
+let mut ancestors = Utf8Path::new("../foo/bar").ancestors();
+assert_eq!(ancestors.next(), Some(Utf8Path::new("../foo/bar")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("../foo")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("..")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("")));
+assert_eq!(ancestors.next(), None);
+

pub fn file_name(&self) -> Option<&str>

Returns the final component of the Utf8Path, if there is one.

+

If the path is a normal file, this is the file name. If it’s the path of a directory, this +is the directory name.

+

Returns None if the path terminates in ...

+
§Examples
+
use camino::Utf8Path;
+
+assert_eq!(Some("bin"), Utf8Path::new("/usr/bin/").file_name());
+assert_eq!(Some("foo.txt"), Utf8Path::new("tmp/foo.txt").file_name());
+assert_eq!(Some("foo.txt"), Utf8Path::new("foo.txt/.").file_name());
+assert_eq!(Some("foo.txt"), Utf8Path::new("foo.txt/.//").file_name());
+assert_eq!(None, Utf8Path::new("foo.txt/..").file_name());
+assert_eq!(None, Utf8Path::new("/").file_name());
+

pub fn strip_prefix( + &self, + base: impl AsRef<Path>, +) -> Result<&Utf8Path, StripPrefixError>

Returns a path that, when joined onto base, yields self.

+
§Errors
+

If base is not a prefix of self (i.e., starts_with +returns false), returns Err.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path = Utf8Path::new("/test/haha/foo.txt");
+
+assert_eq!(path.strip_prefix("/"), Ok(Utf8Path::new("test/haha/foo.txt")));
+assert_eq!(path.strip_prefix("/test"), Ok(Utf8Path::new("haha/foo.txt")));
+assert_eq!(path.strip_prefix("/test/"), Ok(Utf8Path::new("haha/foo.txt")));
+assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Utf8Path::new("")));
+assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Utf8Path::new("")));
+
+assert!(path.strip_prefix("test").is_err());
+assert!(path.strip_prefix("/haha").is_err());
+
+let prefix = Utf8PathBuf::from("/test/");
+assert_eq!(path.strip_prefix(prefix), Ok(Utf8Path::new("haha/foo.txt")));
+

pub fn starts_with(&self, base: impl AsRef<Path>) -> bool

Determines whether base is a prefix of self.

+

Only considers whole path components to match.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/etc/passwd");
+
+assert!(path.starts_with("/etc"));
+assert!(path.starts_with("/etc/"));
+assert!(path.starts_with("/etc/passwd"));
+assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
+assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay
+
+assert!(!path.starts_with("/e"));
+assert!(!path.starts_with("/etc/passwd.txt"));
+
+assert!(!Utf8Path::new("/etc/foo.rs").starts_with("/etc/foo"));
+

pub fn ends_with(&self, base: impl AsRef<Path>) -> bool

Determines whether child is a suffix of self.

+

Only considers whole path components to match.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/etc/resolv.conf");
+
+assert!(path.ends_with("resolv.conf"));
+assert!(path.ends_with("etc/resolv.conf"));
+assert!(path.ends_with("/etc/resolv.conf"));
+
+assert!(!path.ends_with("/resolv.conf"));
+assert!(!path.ends_with("conf")); // use .extension() instead
+

pub fn file_stem(&self) -> Option<&str>

Extracts the stem (non-extension) portion of self.file_name.

+

The stem is:

+
    +
  • None, if there is no file name;
  • +
  • The entire file name if there is no embedded .;
  • +
  • The entire file name if the file name begins with . and has no other .s within;
  • +
  • Otherwise, the portion of the file name before the final .
  • +
+
§Examples
+
use camino::Utf8Path;
+
+assert_eq!("foo", Utf8Path::new("foo.rs").file_stem().unwrap());
+assert_eq!("foo.tar", Utf8Path::new("foo.tar.gz").file_stem().unwrap());
+

pub fn extension(&self) -> Option<&str>

Extracts the extension of self.file_name, if possible.

+

The extension is:

+
    +
  • None, if there is no file name;
  • +
  • None, if there is no embedded .;
  • +
  • None, if the file name begins with . and has no other .s within;
  • +
  • Otherwise, the portion of the file name after the final .
  • +
+
§Examples
+
use camino::Utf8Path;
+
+assert_eq!("rs", Utf8Path::new("foo.rs").extension().unwrap());
+assert_eq!("gz", Utf8Path::new("foo.tar.gz").extension().unwrap());
+

pub fn join(&self, path: impl AsRef<Utf8Path>) -> Utf8PathBuf

Creates an owned Utf8PathBuf with path adjoined to self.

+

See Utf8PathBuf::push for more details on what it means to adjoin a path.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+assert_eq!(Utf8Path::new("/etc").join("passwd"), Utf8PathBuf::from("/etc/passwd"));
+

pub fn join_os(&self, path: impl AsRef<Path>) -> PathBuf

Creates an owned PathBuf with path adjoined to self.

+

See PathBuf::push for more details on what it means to adjoin a path.

+
§Examples
+
use camino::Utf8Path;
+use std::path::PathBuf;
+
+assert_eq!(Utf8Path::new("/etc").join_os("passwd"), PathBuf::from("/etc/passwd"));
+

pub fn with_file_name(&self, file_name: impl AsRef<str>) -> Utf8PathBuf

Creates an owned Utf8PathBuf like self but with the given file name.

+

See Utf8PathBuf::set_file_name for more details.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path = Utf8Path::new("/tmp/foo.txt");
+assert_eq!(path.with_file_name("bar.txt"), Utf8PathBuf::from("/tmp/bar.txt"));
+
+let path = Utf8Path::new("/tmp");
+assert_eq!(path.with_file_name("var"), Utf8PathBuf::from("/var"));
+

pub fn with_extension(&self, extension: impl AsRef<str>) -> Utf8PathBuf

Creates an owned Utf8PathBuf like self but with the given extension.

+

See Utf8PathBuf::set_extension for more details.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path = Utf8Path::new("foo.rs");
+assert_eq!(path.with_extension("txt"), Utf8PathBuf::from("foo.txt"));
+
+let path = Utf8Path::new("foo.tar.gz");
+assert_eq!(path.with_extension(""), Utf8PathBuf::from("foo.tar"));
+assert_eq!(path.with_extension("xz"), Utf8PathBuf::from("foo.tar.xz"));
+assert_eq!(path.with_extension("").with_extension("txt"), Utf8PathBuf::from("foo.txt"));
+

pub fn components(&self) -> Utf8Components<'_>

Produces an iterator over the Utf8Components of the path.

+

When parsing the path, there is a small amount of normalization:

+
    +
  • +

    Repeated separators are ignored, so a/b and a//b both have +a and b as components.

    +
  • +
  • +

    Occurrences of . are normalized away, except if they are at the +beginning of the path. For example, a/./b, a/b/, a/b/. and +a/b all have a and b as components, but ./a/b starts with +an additional CurDir component.

    +
  • +
  • +

    A trailing slash is normalized away, /a/b and /a/b/ are equivalent.

    +
  • +
+

Note that no other normalization takes place; in particular, a/c +and a/b/../c are distinct, to account for the possibility that b +is a symbolic link (so its parent isn’t a).

+
§Examples
+
use camino::{Utf8Component, Utf8Path};
+
+let mut components = Utf8Path::new("/tmp/foo.txt").components();
+
+assert_eq!(components.next(), Some(Utf8Component::RootDir));
+assert_eq!(components.next(), Some(Utf8Component::Normal("tmp")));
+assert_eq!(components.next(), Some(Utf8Component::Normal("foo.txt")));
+assert_eq!(components.next(), None)
+

pub fn iter(&self) -> Iter<'_>

Produces an iterator over the path’s components viewed as str +slices.

+

For more information about the particulars of how the path is separated +into components, see components.

+
§Examples
+
use camino::Utf8Path;
+
+let mut it = Utf8Path::new("/tmp/foo.txt").iter();
+assert_eq!(it.next(), Some(std::path::MAIN_SEPARATOR.to_string().as_str()));
+assert_eq!(it.next(), Some("tmp"));
+assert_eq!(it.next(), Some("foo.txt"));
+assert_eq!(it.next(), None)
+

pub fn metadata(&self) -> Result<Metadata, Error>

Queries the file system to get information about a file, directory, etc.

+

This function will traverse symbolic links to query information about the +destination file.

+

This is an alias to fs::metadata.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/Minas/tirith");
+let metadata = path.metadata().expect("metadata call failed");
+println!("{:?}", metadata.file_type());
+

Queries the metadata about a file without following symlinks.

+

This is an alias to fs::symlink_metadata.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/Minas/tirith");
+let metadata = path.symlink_metadata().expect("symlink_metadata call failed");
+println!("{:?}", metadata.file_type());
+

pub fn canonicalize(&self) -> Result<PathBuf, Error>

Returns the canonical, absolute form of the path with all intermediate +components normalized and symbolic links resolved.

+

This returns a PathBuf because even if a symlink is valid Unicode, its target may not +be. For a version that returns a Utf8PathBuf, see +canonicalize_utf8.

+

This is an alias to fs::canonicalize.

+
§Examples
+
use camino::Utf8Path;
+use std::path::PathBuf;
+
+let path = Utf8Path::new("/foo/test/../test/bar.rs");
+assert_eq!(path.canonicalize().unwrap(), PathBuf::from("/foo/test/bar.rs"));
+

pub fn canonicalize_utf8(&self) -> Result<Utf8PathBuf, Error>

Returns the canonical, absolute form of the path with all intermediate +components normalized and symbolic links resolved.

+

This method attempts to convert the resulting PathBuf into a Utf8PathBuf. For a +version that does not attempt to do this conversion, see +canonicalize.

+
§Errors
+

The I/O operation may return an error: see the fs::canonicalize +documentation for more.

+

If the resulting path is not UTF-8, an io::Error is returned with the +ErrorKind set to InvalidData and the payload set to a +[FromPathBufError].

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path = Utf8Path::new("/foo/test/../test/bar.rs");
+assert_eq!(path.canonicalize_utf8().unwrap(), Utf8PathBuf::from("/foo/test/bar.rs"));
+

Reads a symbolic link, returning the file that the link points to.

+

This returns a PathBuf because even if a symlink is valid Unicode, its target may not +be. For a version that returns a Utf8PathBuf, see +read_link_utf8.

+

This is an alias to fs::read_link.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/laputa/sky_castle.rs");
+let path_link = path.read_link().expect("read_link call failed");
+

Reads a symbolic link, returning the file that the link points to.

+

This method attempts to convert the resulting PathBuf into a Utf8PathBuf. For a +version that does not attempt to do this conversion, see read_link.

+
§Errors
+

The I/O operation may return an error: see the fs::read_link +documentation for more.

+

If the resulting path is not UTF-8, an io::Error is returned with the +ErrorKind set to InvalidData and the payload set to a +[FromPathBufError].

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/laputa/sky_castle.rs");
+let path_link = path.read_link_utf8().expect("read_link call failed");
+

pub fn read_dir(&self) -> Result<ReadDir, Error>

Returns an iterator over the entries within a directory.

+

The iterator will yield instances of io::Result<fs::DirEntry>. New +errors may be encountered after an iterator is initially constructed.

+

This is an alias to fs::read_dir.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/laputa");
+for entry in path.read_dir().expect("read_dir call failed") {
+    if let Ok(entry) = entry {
+        println!("{:?}", entry.path());
+    }
+}
+

pub fn read_dir_utf8(&self) -> Result<ReadDirUtf8, Error>

Returns an iterator over the entries within a directory.

+

The iterator will yield instances of io::Result<[Utf8DirEntry]>. New +errors may be encountered after an iterator is initially constructed.

+
§Errors
+

The I/O operation may return an error: see the fs::read_dir +documentation for more.

+

If a directory entry is not UTF-8, an io::Error is returned with the +ErrorKind set to InvalidData and the payload set to a +[FromPathBufError].

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/laputa");
+for entry in path.read_dir_utf8().expect("read_dir call failed") {
+    if let Ok(entry) = entry {
+        println!("{}", entry.path());
+    }
+}
+

pub fn exists(&self) -> bool

Returns true if the path points at an existing entity.

+

Warning: this method may be error-prone, consider using try_exists() instead! +It also has a risk of introducing time-of-check to time-of-use (TOCTOU) bugs.

+

This function will traverse symbolic links to query information about the +destination file. In case of broken symbolic links this will return false.

+

If you cannot access the directory containing the file, e.g., because of a +permission error, this will return false.

+
§Examples
+
use camino::Utf8Path;
+assert!(!Utf8Path::new("does_not_exist.txt").exists());
+
§See Also
+

This is a convenience function that coerces errors to false. If you want to +check errors, call fs::metadata.

+

pub fn try_exists(&self) -> Result<bool, Error>

Returns Ok(true) if the path points at an existing entity.

+

This function will traverse symbolic links to query information about the +destination file. In case of broken symbolic links this will return Ok(false).

+

As opposed to the exists() method, this one doesn’t silently ignore errors +unrelated to the path not existing. (E.g. it will return Err(_) in case of permission +denied on some of the parent directories.)

+

Note that while this avoids some pitfalls of the exists() method, it still can not +prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios +where those bugs are not an issue.

+
§Examples
+
use camino::Utf8Path;
+assert!(!Utf8Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"));
+assert!(Utf8Path::new("/root/secret_file.txt").try_exists().is_err());
+

pub fn is_file(&self) -> bool

Returns true if the path exists on disk and is pointing at a regular file.

+

This function will traverse symbolic links to query information about the +destination file. In case of broken symbolic links this will return false.

+

If you cannot access the directory containing the file, e.g., because of a +permission error, this will return false.

+
§Examples
+
use camino::Utf8Path;
+assert_eq!(Utf8Path::new("./is_a_directory/").is_file(), false);
+assert_eq!(Utf8Path::new("a_file.txt").is_file(), true);
+
§See Also
+

This is a convenience function that coerces errors to false. If you want to +check errors, call fs::metadata and handle its Result. Then call +fs::Metadata::is_file if it was Ok.

+

When the goal is simply to read from (or write to) the source, the most +reliable way to test the source can be read (or written to) is to open +it. Only using is_file can break workflows like diff <( prog_a ) on +a Unix-like system for example. See fs::File::open or +fs::OpenOptions::open for more information.

+

pub fn is_dir(&self) -> bool

Returns true if the path exists on disk and is pointing at a directory.

+

This function will traverse symbolic links to query information about the +destination file. In case of broken symbolic links this will return false.

+

If you cannot access the directory containing the file, e.g., because of a +permission error, this will return false.

+
§Examples
+
use camino::Utf8Path;
+assert_eq!(Utf8Path::new("./is_a_directory/").is_dir(), true);
+assert_eq!(Utf8Path::new("a_file.txt").is_dir(), false);
+
§See Also
+

This is a convenience function that coerces errors to false. If you want to +check errors, call fs::metadata and handle its Result. Then call +fs::Metadata::is_dir if it was Ok.

+

Returns true if the path exists on disk and is pointing at a symbolic link.

+

This function will not traverse symbolic links. +In case of a broken symbolic link this will also return true.

+

If you cannot access the directory containing the file, e.g., because of a +permission error, this will return false.

+
§Examples
+
use camino::Utf8Path;
+use std::os::unix::fs::symlink;
+
+let link_path = Utf8Path::new("link");
+symlink("/origin_does_not_exist/", link_path).unwrap();
+assert_eq!(link_path.is_symlink(), true);
+assert_eq!(link_path.exists(), false);
+
§See Also
+

This is a convenience function that coerces errors to false. If you want to +check errors, call Utf8Path::symlink_metadata and handle its Result. Then call +fs::Metadata::is_symlink if it was Ok.

+

pub fn into_path_buf(self: Box<Utf8Path>) -> Utf8PathBuf

Converts a Box<Utf8Path> into a Utf8PathBuf without copying or allocating.

+

Trait Implementations§

§

impl AsRef<OsStr> for Utf8Path

§

fn as_ref(&self) -> &OsStr

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Path> for Utf8Path

§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Utf8Path> for Utf8Component<'_>

§

fn as_ref(&self) -> &Utf8Path

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Utf8Path> for Utf8Path

§

fn as_ref(&self) -> &Utf8Path

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Utf8Path> for Utf8PathBuf

§

fn as_ref(&self) -> &Utf8Path

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Utf8Path> for str

§

fn as_ref(&self) -> &Utf8Path

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<str> for Utf8Path

§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
§

impl Borrow<Utf8Path> for Utf8PathBuf

§

fn borrow(&self) -> &Utf8Path

Immutably borrows from an owned value. Read more
§

impl Debug for Utf8Path

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Display for Utf8Path

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'a> From<&'a str> for &'a Utf8Path

§

fn from(s: &'a str) -> &'a Utf8Path

Converts to this type from the input type.
§

impl Hash for Utf8Path

§

fn hash<H>(&self, state: &mut H)
where + H: Hasher,

Feeds this value into the given Hasher. Read more
§

impl<'a> IntoIterator for &'a Utf8Path

§

type Item = &'a str

The type of the elements being iterated over.
§

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> Iter<'a>

Creates an iterator from a value. Read more
§

impl Ord for Utf8Path

§

fn cmp(&self, other: &Utf8Path) -> Ordering

This method returns an Ordering between self and other. Read more
§

impl<'a, 'b> PartialEq<&'a OsStr> for Utf8Path

§

fn eq(&self, other: &&'a OsStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<&'a Path> for Utf8Path

§

fn eq(&self, other: &&'a Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<&'a Utf8Path> for OsStr

§

fn eq(&self, other: &&'a Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<&'a Utf8Path> for Path

§

fn eq(&self, other: &&'a Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<&'a Utf8Path> for Utf8PathBuf

§

fn eq(&self, other: &&'a Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<&'a Utf8Path> for str

§

fn eq(&self, other: &&'a Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<&'a str> for Utf8Path

§

fn eq(&self, other: &&'a str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for Utf8Path

§

fn eq(&self, other: &Cow<'a, OsStr>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'a, Path>> for Utf8Path

§

fn eq(&self, other: &Cow<'a, Path>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'a, Utf8Path>> for &'b Utf8Path

§

fn eq(&self, other: &Cow<'a, Utf8Path>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'a, Utf8Path>> for Utf8Path

§

fn eq(&self, other: &Cow<'a, Utf8Path>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'a, str>> for Utf8Path

§

fn eq(&self, other: &Cow<'a, str>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'b, OsStr>> for &'a Utf8Path

§

fn eq(&self, other: &Cow<'b, OsStr>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'b, Path>> for &'a Utf8Path

§

fn eq(&self, other: &Cow<'b, Path>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'b, str>> for &'a Utf8Path

§

fn eq(&self, other: &Cow<'b, str>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<OsStr> for &'a Utf8Path

§

fn eq(&self, other: &OsStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<OsStr> for Utf8Path

§

fn eq(&self, other: &OsStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<OsString> for &'a Utf8Path

§

fn eq(&self, other: &OsString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<OsString> for Utf8Path

§

fn eq(&self, other: &OsString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Path> for &'a Utf8Path

§

fn eq(&self, other: &Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Path> for Utf8Path

§

fn eq(&self, other: &Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<PathBuf> for &'a Utf8Path

§

fn eq(&self, other: &PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<PathBuf> for Utf8Path

§

fn eq(&self, other: &PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<String> for &'a Utf8Path

§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<String> for Utf8Path

§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8Path> for &'a OsStr

§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8Path> for &'a Path

§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8Path> for &'a str

§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8Path> for OsStr

§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8Path> for Path

§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8Path> for Utf8PathBuf

§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8Path> for str

§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for &'a Utf8Path

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for Utf8Path

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<str> for &'a Utf8Path

§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<str> for Utf8Path

§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialEq for Utf8Path

§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialOrd<&'a OsStr> for Utf8Path

§

fn partial_cmp(&self, other: &&'a OsStr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<&'a Path> for Utf8Path

§

fn partial_cmp(&self, other: &&'a Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<&'a Utf8Path> for OsStr

§

fn partial_cmp(&self, other: &&'a Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<&'a Utf8Path> for Path

§

fn partial_cmp(&self, other: &&'a Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<&'a Utf8Path> for Utf8PathBuf

§

fn partial_cmp(&self, other: &&'a Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<&'a Utf8Path> for str

§

fn partial_cmp(&self, other: &&'a Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<&'a str> for Utf8Path

§

fn partial_cmp(&self, other: &&'a str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'a, OsStr>> for Utf8Path

§

fn partial_cmp(&self, other: &Cow<'a, OsStr>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'a, Path>> for Utf8Path

§

fn partial_cmp(&self, other: &Cow<'a, Path>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'a, Utf8Path>> for &'b Utf8Path

§

fn partial_cmp(&self, other: &Cow<'a, Utf8Path>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'a, Utf8Path>> for Utf8Path

§

fn partial_cmp(&self, other: &Cow<'a, Utf8Path>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'a, str>> for Utf8Path

§

fn partial_cmp(&self, other: &Cow<'a, str>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'b, OsStr>> for &'a Utf8Path

§

fn partial_cmp(&self, other: &Cow<'b, OsStr>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'b, Path>> for &'a Utf8Path

§

fn partial_cmp(&self, other: &Cow<'b, Path>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'b, str>> for &'a Utf8Path

§

fn partial_cmp(&self, other: &Cow<'b, str>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<OsStr> for &'a Utf8Path

§

fn partial_cmp(&self, other: &OsStr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<OsStr> for Utf8Path

§

fn partial_cmp(&self, other: &OsStr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<OsString> for &'a Utf8Path

§

fn partial_cmp(&self, other: &OsString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<OsString> for Utf8Path

§

fn partial_cmp(&self, other: &OsString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Path> for &'a Utf8Path

§

fn partial_cmp(&self, other: &Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Path> for Utf8Path

§

fn partial_cmp(&self, other: &Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<PathBuf> for &'a Utf8Path

§

fn partial_cmp(&self, other: &PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<PathBuf> for Utf8Path

§

fn partial_cmp(&self, other: &PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<String> for &'a Utf8Path

§

fn partial_cmp(&self, other: &String) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<String> for Utf8Path

§

fn partial_cmp(&self, other: &String) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8Path> for &'a OsStr

§

fn partial_cmp(&self, other: &Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8Path> for &'a Path

§

fn partial_cmp(&self, other: &Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8Path> for &'a str

§

fn partial_cmp(&self, other: &Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8Path> for OsStr

§

fn partial_cmp(&self, other: &Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8Path> for Path

§

fn partial_cmp(&self, other: &Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8Path> for Utf8PathBuf

§

fn partial_cmp(&self, other: &Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8Path> for str

§

fn partial_cmp(&self, other: &Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for &'a Utf8Path

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for Utf8Path

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<str> for &'a Utf8Path

§

fn partial_cmp(&self, other: &str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<str> for Utf8Path

§

fn partial_cmp(&self, other: &str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl PartialOrd for Utf8Path

§

fn partial_cmp(&self, other: &Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl ToOwned for Utf8Path

§

type Owned = Utf8PathBuf

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> Utf8PathBuf

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<'a> TryFrom<&'a Path> for &'a Utf8Path

§

type Error = FromPathError

The type returned in the event of a conversion error.
§

fn try_from( + path: &'a Path, +) -> Result<&'a Utf8Path, <&'a Utf8Path as TryFrom<&'a Path>>::Error>

Performs the conversion.
§

impl Eq for Utf8Path

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
\ No newline at end of file diff --git a/compiler-docs/fe_common/files/struct.Utf8PathBuf.html b/compiler-docs/fe_common/files/struct.Utf8PathBuf.html new file mode 100644 index 0000000000..32735f1084 --- /dev/null +++ b/compiler-docs/fe_common/files/struct.Utf8PathBuf.html @@ -0,0 +1,768 @@ +Utf8PathBuf in fe_common::files - Rust

Struct Utf8PathBuf

pub struct Utf8PathBuf(/* private fields */);
Expand description

An owned, mutable UTF-8 path (akin to String).

+

This type provides methods like push and set_extension that mutate +the path in place. It also implements Deref to Utf8Path, meaning that +all methods on Utf8Path slices are available on Utf8PathBuf values as well.

+

§Examples

+

You can use push to build up a Utf8PathBuf from +components:

+ +
use camino::Utf8PathBuf;
+
+let mut path = Utf8PathBuf::new();
+
+path.push(r"C:\");
+path.push("windows");
+path.push("system32");
+
+path.set_extension("dll");
+

However, push is best used for dynamic situations. This is a better way +to do this when you know all of the components ahead of time:

+ +
use camino::Utf8PathBuf;
+
+let path: Utf8PathBuf = [r"C:\", "windows", "system32.dll"].iter().collect();
+

We can still do better than this! Since these are all strings, we can use +From::from:

+ +
use camino::Utf8PathBuf;
+
+let path = Utf8PathBuf::from(r"C:\windows\system32.dll");
+

Which method works best depends on what kind of situation you’re in.

+

Implementations§

§

impl Utf8PathBuf

pub fn new() -> Utf8PathBuf

Allocates an empty Utf8PathBuf.

+
§Examples
+
use camino::Utf8PathBuf;
+
+let path = Utf8PathBuf::new();
+

pub fn from_path_buf(path: PathBuf) -> Result<Utf8PathBuf, PathBuf>

Creates a new Utf8PathBuf from a PathBuf containing valid UTF-8 characters.

+

Errors with the original PathBuf if it is not valid UTF-8.

+

For a version that returns a type that implements std::error::Error, use the +TryFrom<PathBuf> impl.

+
§Examples
+
use camino::Utf8PathBuf;
+use std::ffi::OsStr;
+use std::os::unix::ffi::OsStrExt;
+use std::path::PathBuf;
+
+let unicode_path = PathBuf::from("/valid/unicode");
+Utf8PathBuf::from_path_buf(unicode_path).expect("valid Unicode path succeeded");
+
+// Paths on Unix can be non-UTF-8.
+let non_unicode_str = OsStr::from_bytes(b"\xFF\xFF\xFF");
+let non_unicode_path = PathBuf::from(non_unicode_str);
+Utf8PathBuf::from_path_buf(non_unicode_path).expect_err("non-Unicode path failed");
+

pub fn into_std_path_buf(self) -> PathBuf

Converts a Utf8PathBuf to a PathBuf.

+

This is equivalent to the From<Utf8PathBuf> for PathBuf impl, but may aid in type +inference.

+
§Examples
+
use camino::Utf8PathBuf;
+use std::path::PathBuf;
+
+let utf8_path_buf = Utf8PathBuf::from("foo.txt");
+let std_path_buf = utf8_path_buf.into_std_path_buf();
+assert_eq!(std_path_buf.to_str(), Some("foo.txt"));
+
+// Convert back to a Utf8PathBuf.
+let new_utf8_path_buf = Utf8PathBuf::from_path_buf(std_path_buf).unwrap();
+assert_eq!(new_utf8_path_buf, "foo.txt");
+

pub fn with_capacity(capacity: usize) -> Utf8PathBuf

Creates a new Utf8PathBuf with a given capacity used to create the internal PathBuf. +See with_capacity defined on PathBuf.

+

Requires Rust 1.44 or newer.

+
§Examples
+
use camino::Utf8PathBuf;
+
+let mut path = Utf8PathBuf::with_capacity(10);
+let capacity = path.capacity();
+
+// This push is done without reallocating
+path.push(r"C:\");
+
+assert_eq!(capacity, path.capacity());
+

pub fn as_path(&self) -> &Utf8Path

Coerces to a Utf8Path slice.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let p = Utf8PathBuf::from("/test");
+assert_eq!(Utf8Path::new("/test"), p.as_path());
+

pub fn push(&mut self, path: impl AsRef<Utf8Path>)

Extends self with path.

+

If path is absolute, it replaces the current path.

+

On Windows:

+
    +
  • if path has a root but no prefix (e.g., \windows), it +replaces everything except for the prefix (if any) of self.
  • +
  • if path has a prefix but no root, it replaces self.
  • +
+
§Examples
+

Pushing a relative path extends the existing path:

+ +
use camino::Utf8PathBuf;
+
+let mut path = Utf8PathBuf::from("/tmp");
+path.push("file.bk");
+assert_eq!(path, Utf8PathBuf::from("/tmp/file.bk"));
+

Pushing an absolute path replaces the existing path:

+ +
use camino::Utf8PathBuf;
+
+let mut path = Utf8PathBuf::from("/tmp");
+path.push("/etc");
+assert_eq!(path, Utf8PathBuf::from("/etc"));
+

pub fn pop(&mut self) -> bool

Truncates self to self.parent.

+

Returns false and does nothing if self.parent is None. +Otherwise, returns true.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let mut p = Utf8PathBuf::from("/spirited/away.rs");
+
+p.pop();
+assert_eq!(Utf8Path::new("/spirited"), p);
+p.pop();
+assert_eq!(Utf8Path::new("/"), p);
+

pub fn set_file_name(&mut self, file_name: impl AsRef<str>)

Updates self.file_name to file_name.

+

If self.file_name was None, this is equivalent to pushing +file_name.

+

Otherwise it is equivalent to calling pop and then pushing +file_name. The new path will be a sibling of the original path. +(That is, it will have the same parent.)

+
§Examples
+
use camino::Utf8PathBuf;
+
+let mut buf = Utf8PathBuf::from("/");
+assert_eq!(buf.file_name(), None);
+buf.set_file_name("bar");
+assert_eq!(buf, Utf8PathBuf::from("/bar"));
+assert!(buf.file_name().is_some());
+buf.set_file_name("baz.txt");
+assert_eq!(buf, Utf8PathBuf::from("/baz.txt"));
+

pub fn set_extension(&mut self, extension: impl AsRef<str>) -> bool

Updates self.extension to extension.

+

Returns false and does nothing if self.file_name is None, +returns true and updates the extension otherwise.

+

If self.extension is None, the extension is added; otherwise +it is replaced.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let mut p = Utf8PathBuf::from("/feel/the");
+
+p.set_extension("force");
+assert_eq!(Utf8Path::new("/feel/the.force"), p.as_path());
+
+p.set_extension("dark_side");
+assert_eq!(Utf8Path::new("/feel/the.dark_side"), p.as_path());
+

pub fn into_string(self) -> String

Consumes the Utf8PathBuf, yielding its internal String storage.

+
§Examples
+
use camino::Utf8PathBuf;
+
+let p = Utf8PathBuf::from("/the/head");
+let s = p.into_string();
+assert_eq!(s, "/the/head");
+

pub fn into_os_string(self) -> OsString

Consumes the Utf8PathBuf, yielding its internal OsString storage.

+
§Examples
+
use camino::Utf8PathBuf;
+use std::ffi::OsStr;
+
+let p = Utf8PathBuf::from("/the/head");
+let s = p.into_os_string();
+assert_eq!(s, OsStr::new("/the/head"));
+

pub fn into_boxed_path(self) -> Box<Utf8Path>

Converts this Utf8PathBuf into a boxed Utf8Path.

+

pub fn capacity(&self) -> usize

Invokes capacity on the underlying instance of PathBuf.

+

Requires Rust 1.44 or newer.

+

pub fn clear(&mut self)

Invokes clear on the underlying instance of PathBuf.

+

Requires Rust 1.44 or newer.

+

pub fn reserve(&mut self, additional: usize)

Invokes reserve on the underlying instance of PathBuf.

+

Requires Rust 1.44 or newer.

+

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Invokes try_reserve on the underlying instance of PathBuf.

+

Requires Rust 1.63 or newer.

+

pub fn reserve_exact(&mut self, additional: usize)

Invokes reserve_exact on the underlying instance of PathBuf.

+

Requires Rust 1.44 or newer.

+

pub fn try_reserve_exact( + &mut self, + additional: usize, +) -> Result<(), TryReserveError>

Invokes try_reserve_exact on the underlying instance of PathBuf.

+

Requires Rust 1.63 or newer.

+

pub fn shrink_to_fit(&mut self)

Invokes shrink_to_fit on the underlying instance of PathBuf.

+

Requires Rust 1.44 or newer.

+

pub fn shrink_to(&mut self, min_capacity: usize)

Invokes shrink_to on the underlying instance of PathBuf.

+

Requires Rust 1.56 or newer.

+

Methods from Deref<Target = Utf8Path>§

pub fn as_std_path(&self) -> &Path

Converts a Utf8Path to a Path.

+

This is equivalent to the AsRef<&Path> for &Utf8Path impl, but may aid in type inference.

+
§Examples
+
use camino::Utf8Path;
+use std::path::Path;
+
+let utf8_path = Utf8Path::new("foo.txt");
+let std_path: &Path = utf8_path.as_std_path();
+assert_eq!(std_path.to_str(), Some("foo.txt"));
+
+// Convert back to a Utf8Path.
+let new_utf8_path = Utf8Path::from_path(std_path).unwrap();
+assert_eq!(new_utf8_path, "foo.txt");
+

pub fn as_str(&self) -> &str

Yields the underlying str slice.

+

Unlike Path::to_str, this always returns a slice because the contents of a Utf8Path +are guaranteed to be valid UTF-8.

+
§Examples
+
use camino::Utf8Path;
+
+let s = Utf8Path::new("foo.txt").as_str();
+assert_eq!(s, "foo.txt");
+

pub fn as_os_str(&self) -> &OsStr

Yields the underlying OsStr slice.

+
§Examples
+
use camino::Utf8Path;
+
+let os_str = Utf8Path::new("foo.txt").as_os_str();
+assert_eq!(os_str, std::ffi::OsStr::new("foo.txt"));
+

pub fn to_path_buf(&self) -> Utf8PathBuf

Converts a Utf8Path to an owned Utf8PathBuf.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path_buf = Utf8Path::new("foo.txt").to_path_buf();
+assert_eq!(path_buf, Utf8PathBuf::from("foo.txt"));
+

pub fn is_absolute(&self) -> bool

Returns true if the Utf8Path is absolute, i.e., if it is independent of +the current directory.

+
    +
  • +

    On Unix, a path is absolute if it starts with the root, so +is_absolute and has_root are equivalent.

    +
  • +
  • +

    On Windows, a path is absolute if it has a prefix and starts with the +root: c:\windows is absolute, while c:temp and \temp are not.

    +
  • +
+
§Examples
+
use camino::Utf8Path;
+
+assert!(!Utf8Path::new("foo.txt").is_absolute());
+

pub fn is_relative(&self) -> bool

Returns true if the Utf8Path is relative, i.e., not absolute.

+

See is_absolute’s documentation for more details.

+
§Examples
+
use camino::Utf8Path;
+
+assert!(Utf8Path::new("foo.txt").is_relative());
+

pub fn has_root(&self) -> bool

Returns true if the Utf8Path has a root.

+
    +
  • +

    On Unix, a path has a root if it begins with /.

    +
  • +
  • +

    On Windows, a path has a root if it:

    +
      +
    • has no prefix and begins with a separator, e.g., \windows
    • +
    • has a prefix followed by a separator, e.g., c:\windows but not c:windows
    • +
    • has any non-disk prefix, e.g., \\server\share
    • +
    +
  • +
+
§Examples
+
use camino::Utf8Path;
+
+assert!(Utf8Path::new("/etc/passwd").has_root());
+

pub fn parent(&self) -> Option<&Utf8Path>

Returns the Path without its final component, if there is one.

+

Returns None if the path terminates in a root or prefix.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/foo/bar");
+let parent = path.parent().unwrap();
+assert_eq!(parent, Utf8Path::new("/foo"));
+
+let grand_parent = parent.parent().unwrap();
+assert_eq!(grand_parent, Utf8Path::new("/"));
+assert_eq!(grand_parent.parent(), None);
+

pub fn ancestors(&self) -> Utf8Ancestors<'_>

Produces an iterator over Utf8Path and its ancestors.

+

The iterator will yield the Utf8Path that is returned if the parent method is used zero +or more times. That means, the iterator will yield &self, &self.parent().unwrap(), +&self.parent().unwrap().parent().unwrap() and so on. If the parent method returns +None, the iterator will do likewise. The iterator will always yield at least one value, +namely &self.

+
§Examples
+
use camino::Utf8Path;
+
+let mut ancestors = Utf8Path::new("/foo/bar").ancestors();
+assert_eq!(ancestors.next(), Some(Utf8Path::new("/foo/bar")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("/foo")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("/")));
+assert_eq!(ancestors.next(), None);
+
+let mut ancestors = Utf8Path::new("../foo/bar").ancestors();
+assert_eq!(ancestors.next(), Some(Utf8Path::new("../foo/bar")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("../foo")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("..")));
+assert_eq!(ancestors.next(), Some(Utf8Path::new("")));
+assert_eq!(ancestors.next(), None);
+

pub fn file_name(&self) -> Option<&str>

Returns the final component of the Utf8Path, if there is one.

+

If the path is a normal file, this is the file name. If it’s the path of a directory, this +is the directory name.

+

Returns None if the path terminates in ...

+
§Examples
+
use camino::Utf8Path;
+
+assert_eq!(Some("bin"), Utf8Path::new("/usr/bin/").file_name());
+assert_eq!(Some("foo.txt"), Utf8Path::new("tmp/foo.txt").file_name());
+assert_eq!(Some("foo.txt"), Utf8Path::new("foo.txt/.").file_name());
+assert_eq!(Some("foo.txt"), Utf8Path::new("foo.txt/.//").file_name());
+assert_eq!(None, Utf8Path::new("foo.txt/..").file_name());
+assert_eq!(None, Utf8Path::new("/").file_name());
+

pub fn strip_prefix( + &self, + base: impl AsRef<Path>, +) -> Result<&Utf8Path, StripPrefixError>

Returns a path that, when joined onto base, yields self.

+
§Errors
+

If base is not a prefix of self (i.e., starts_with +returns false), returns Err.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path = Utf8Path::new("/test/haha/foo.txt");
+
+assert_eq!(path.strip_prefix("/"), Ok(Utf8Path::new("test/haha/foo.txt")));
+assert_eq!(path.strip_prefix("/test"), Ok(Utf8Path::new("haha/foo.txt")));
+assert_eq!(path.strip_prefix("/test/"), Ok(Utf8Path::new("haha/foo.txt")));
+assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Utf8Path::new("")));
+assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Utf8Path::new("")));
+
+assert!(path.strip_prefix("test").is_err());
+assert!(path.strip_prefix("/haha").is_err());
+
+let prefix = Utf8PathBuf::from("/test/");
+assert_eq!(path.strip_prefix(prefix), Ok(Utf8Path::new("haha/foo.txt")));
+

pub fn starts_with(&self, base: impl AsRef<Path>) -> bool

Determines whether base is a prefix of self.

+

Only considers whole path components to match.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/etc/passwd");
+
+assert!(path.starts_with("/etc"));
+assert!(path.starts_with("/etc/"));
+assert!(path.starts_with("/etc/passwd"));
+assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
+assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay
+
+assert!(!path.starts_with("/e"));
+assert!(!path.starts_with("/etc/passwd.txt"));
+
+assert!(!Utf8Path::new("/etc/foo.rs").starts_with("/etc/foo"));
+

pub fn ends_with(&self, base: impl AsRef<Path>) -> bool

Determines whether child is a suffix of self.

+

Only considers whole path components to match.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/etc/resolv.conf");
+
+assert!(path.ends_with("resolv.conf"));
+assert!(path.ends_with("etc/resolv.conf"));
+assert!(path.ends_with("/etc/resolv.conf"));
+
+assert!(!path.ends_with("/resolv.conf"));
+assert!(!path.ends_with("conf")); // use .extension() instead
+

pub fn file_stem(&self) -> Option<&str>

Extracts the stem (non-extension) portion of self.file_name.

+

The stem is:

+
    +
  • None, if there is no file name;
  • +
  • The entire file name if there is no embedded .;
  • +
  • The entire file name if the file name begins with . and has no other .s within;
  • +
  • Otherwise, the portion of the file name before the final .
  • +
+
§Examples
+
use camino::Utf8Path;
+
+assert_eq!("foo", Utf8Path::new("foo.rs").file_stem().unwrap());
+assert_eq!("foo.tar", Utf8Path::new("foo.tar.gz").file_stem().unwrap());
+

pub fn extension(&self) -> Option<&str>

Extracts the extension of self.file_name, if possible.

+

The extension is:

+
    +
  • None, if there is no file name;
  • +
  • None, if there is no embedded .;
  • +
  • None, if the file name begins with . and has no other .s within;
  • +
  • Otherwise, the portion of the file name after the final .
  • +
+
§Examples
+
use camino::Utf8Path;
+
+assert_eq!("rs", Utf8Path::new("foo.rs").extension().unwrap());
+assert_eq!("gz", Utf8Path::new("foo.tar.gz").extension().unwrap());
+

pub fn join(&self, path: impl AsRef<Utf8Path>) -> Utf8PathBuf

Creates an owned Utf8PathBuf with path adjoined to self.

+

See Utf8PathBuf::push for more details on what it means to adjoin a path.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+assert_eq!(Utf8Path::new("/etc").join("passwd"), Utf8PathBuf::from("/etc/passwd"));
+

pub fn join_os(&self, path: impl AsRef<Path>) -> PathBuf

Creates an owned PathBuf with path adjoined to self.

+

See PathBuf::push for more details on what it means to adjoin a path.

+
§Examples
+
use camino::Utf8Path;
+use std::path::PathBuf;
+
+assert_eq!(Utf8Path::new("/etc").join_os("passwd"), PathBuf::from("/etc/passwd"));
+

pub fn with_file_name(&self, file_name: impl AsRef<str>) -> Utf8PathBuf

Creates an owned Utf8PathBuf like self but with the given file name.

+

See Utf8PathBuf::set_file_name for more details.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path = Utf8Path::new("/tmp/foo.txt");
+assert_eq!(path.with_file_name("bar.txt"), Utf8PathBuf::from("/tmp/bar.txt"));
+
+let path = Utf8Path::new("/tmp");
+assert_eq!(path.with_file_name("var"), Utf8PathBuf::from("/var"));
+

pub fn with_extension(&self, extension: impl AsRef<str>) -> Utf8PathBuf

Creates an owned Utf8PathBuf like self but with the given extension.

+

See Utf8PathBuf::set_extension for more details.

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path = Utf8Path::new("foo.rs");
+assert_eq!(path.with_extension("txt"), Utf8PathBuf::from("foo.txt"));
+
+let path = Utf8Path::new("foo.tar.gz");
+assert_eq!(path.with_extension(""), Utf8PathBuf::from("foo.tar"));
+assert_eq!(path.with_extension("xz"), Utf8PathBuf::from("foo.tar.xz"));
+assert_eq!(path.with_extension("").with_extension("txt"), Utf8PathBuf::from("foo.txt"));
+

pub fn components(&self) -> Utf8Components<'_>

Produces an iterator over the Utf8Components of the path.

+

When parsing the path, there is a small amount of normalization:

+
    +
  • +

    Repeated separators are ignored, so a/b and a//b both have +a and b as components.

    +
  • +
  • +

    Occurrences of . are normalized away, except if they are at the +beginning of the path. For example, a/./b, a/b/, a/b/. and +a/b all have a and b as components, but ./a/b starts with +an additional CurDir component.

    +
  • +
  • +

    A trailing slash is normalized away, /a/b and /a/b/ are equivalent.

    +
  • +
+

Note that no other normalization takes place; in particular, a/c +and a/b/../c are distinct, to account for the possibility that b +is a symbolic link (so its parent isn’t a).

+
§Examples
+
use camino::{Utf8Component, Utf8Path};
+
+let mut components = Utf8Path::new("/tmp/foo.txt").components();
+
+assert_eq!(components.next(), Some(Utf8Component::RootDir));
+assert_eq!(components.next(), Some(Utf8Component::Normal("tmp")));
+assert_eq!(components.next(), Some(Utf8Component::Normal("foo.txt")));
+assert_eq!(components.next(), None)
+

pub fn iter(&self) -> Iter<'_>

Produces an iterator over the path’s components viewed as str +slices.

+

For more information about the particulars of how the path is separated +into components, see components.

+
§Examples
+
use camino::Utf8Path;
+
+let mut it = Utf8Path::new("/tmp/foo.txt").iter();
+assert_eq!(it.next(), Some(std::path::MAIN_SEPARATOR.to_string().as_str()));
+assert_eq!(it.next(), Some("tmp"));
+assert_eq!(it.next(), Some("foo.txt"));
+assert_eq!(it.next(), None)
+

pub fn metadata(&self) -> Result<Metadata, Error>

Queries the file system to get information about a file, directory, etc.

+

This function will traverse symbolic links to query information about the +destination file.

+

This is an alias to fs::metadata.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/Minas/tirith");
+let metadata = path.metadata().expect("metadata call failed");
+println!("{:?}", metadata.file_type());
+

Queries the metadata about a file without following symlinks.

+

This is an alias to fs::symlink_metadata.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/Minas/tirith");
+let metadata = path.symlink_metadata().expect("symlink_metadata call failed");
+println!("{:?}", metadata.file_type());
+

pub fn canonicalize(&self) -> Result<PathBuf, Error>

Returns the canonical, absolute form of the path with all intermediate +components normalized and symbolic links resolved.

+

This returns a PathBuf because even if a symlink is valid Unicode, its target may not +be. For a version that returns a Utf8PathBuf, see +canonicalize_utf8.

+

This is an alias to fs::canonicalize.

+
§Examples
+
use camino::Utf8Path;
+use std::path::PathBuf;
+
+let path = Utf8Path::new("/foo/test/../test/bar.rs");
+assert_eq!(path.canonicalize().unwrap(), PathBuf::from("/foo/test/bar.rs"));
+

pub fn canonicalize_utf8(&self) -> Result<Utf8PathBuf, Error>

Returns the canonical, absolute form of the path with all intermediate +components normalized and symbolic links resolved.

+

This method attempts to convert the resulting PathBuf into a Utf8PathBuf. For a +version that does not attempt to do this conversion, see +canonicalize.

+
§Errors
+

The I/O operation may return an error: see the fs::canonicalize +documentation for more.

+

If the resulting path is not UTF-8, an io::Error is returned with the +ErrorKind set to InvalidData and the payload set to a +[FromPathBufError].

+
§Examples
+
use camino::{Utf8Path, Utf8PathBuf};
+
+let path = Utf8Path::new("/foo/test/../test/bar.rs");
+assert_eq!(path.canonicalize_utf8().unwrap(), Utf8PathBuf::from("/foo/test/bar.rs"));
+

Reads a symbolic link, returning the file that the link points to.

+

This returns a PathBuf because even if a symlink is valid Unicode, its target may not +be. For a version that returns a Utf8PathBuf, see +read_link_utf8.

+

This is an alias to fs::read_link.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/laputa/sky_castle.rs");
+let path_link = path.read_link().expect("read_link call failed");
+

Reads a symbolic link, returning the file that the link points to.

+

This method attempts to convert the resulting PathBuf into a Utf8PathBuf. For a +version that does not attempt to do this conversion, see read_link.

+
§Errors
+

The I/O operation may return an error: see the fs::read_link +documentation for more.

+

If the resulting path is not UTF-8, an io::Error is returned with the +ErrorKind set to InvalidData and the payload set to a +[FromPathBufError].

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/laputa/sky_castle.rs");
+let path_link = path.read_link_utf8().expect("read_link call failed");
+

pub fn read_dir(&self) -> Result<ReadDir, Error>

Returns an iterator over the entries within a directory.

+

The iterator will yield instances of io::Result<fs::DirEntry>. New +errors may be encountered after an iterator is initially constructed.

+

This is an alias to fs::read_dir.

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/laputa");
+for entry in path.read_dir().expect("read_dir call failed") {
+    if let Ok(entry) = entry {
+        println!("{:?}", entry.path());
+    }
+}
+

pub fn read_dir_utf8(&self) -> Result<ReadDirUtf8, Error>

Returns an iterator over the entries within a directory.

+

The iterator will yield instances of io::Result<[Utf8DirEntry]>. New +errors may be encountered after an iterator is initially constructed.

+
§Errors
+

The I/O operation may return an error: see the fs::read_dir +documentation for more.

+

If a directory entry is not UTF-8, an io::Error is returned with the +ErrorKind set to InvalidData and the payload set to a +[FromPathBufError].

+
§Examples
+
use camino::Utf8Path;
+
+let path = Utf8Path::new("/laputa");
+for entry in path.read_dir_utf8().expect("read_dir call failed") {
+    if let Ok(entry) = entry {
+        println!("{}", entry.path());
+    }
+}
+

pub fn exists(&self) -> bool

Returns true if the path points at an existing entity.

+

Warning: this method may be error-prone, consider using try_exists() instead! +It also has a risk of introducing time-of-check to time-of-use (TOCTOU) bugs.

+

This function will traverse symbolic links to query information about the +destination file. In case of broken symbolic links this will return false.

+

If you cannot access the directory containing the file, e.g., because of a +permission error, this will return false.

+
§Examples
+
use camino::Utf8Path;
+assert!(!Utf8Path::new("does_not_exist.txt").exists());
+
§See Also
+

This is a convenience function that coerces errors to false. If you want to +check errors, call fs::metadata.

+

pub fn try_exists(&self) -> Result<bool, Error>

Returns Ok(true) if the path points at an existing entity.

+

This function will traverse symbolic links to query information about the +destination file. In case of broken symbolic links this will return Ok(false).

+

As opposed to the exists() method, this one doesn’t silently ignore errors +unrelated to the path not existing. (E.g. it will return Err(_) in case of permission +denied on some of the parent directories.)

+

Note that while this avoids some pitfalls of the exists() method, it still can not +prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios +where those bugs are not an issue.

+
§Examples
+
use camino::Utf8Path;
+assert!(!Utf8Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"));
+assert!(Utf8Path::new("/root/secret_file.txt").try_exists().is_err());
+

pub fn is_file(&self) -> bool

Returns true if the path exists on disk and is pointing at a regular file.

+

This function will traverse symbolic links to query information about the +destination file. In case of broken symbolic links this will return false.

+

If you cannot access the directory containing the file, e.g., because of a +permission error, this will return false.

+
§Examples
+
use camino::Utf8Path;
+assert_eq!(Utf8Path::new("./is_a_directory/").is_file(), false);
+assert_eq!(Utf8Path::new("a_file.txt").is_file(), true);
+
§See Also
+

This is a convenience function that coerces errors to false. If you want to +check errors, call fs::metadata and handle its Result. Then call +fs::Metadata::is_file if it was Ok.

+

When the goal is simply to read from (or write to) the source, the most +reliable way to test the source can be read (or written to) is to open +it. Only using is_file can break workflows like diff <( prog_a ) on +a Unix-like system for example. See fs::File::open or +fs::OpenOptions::open for more information.

+

pub fn is_dir(&self) -> bool

Returns true if the path exists on disk and is pointing at a directory.

+

This function will traverse symbolic links to query information about the +destination file. In case of broken symbolic links this will return false.

+

If you cannot access the directory containing the file, e.g., because of a +permission error, this will return false.

+
§Examples
+
use camino::Utf8Path;
+assert_eq!(Utf8Path::new("./is_a_directory/").is_dir(), true);
+assert_eq!(Utf8Path::new("a_file.txt").is_dir(), false);
+
§See Also
+

This is a convenience function that coerces errors to false. If you want to +check errors, call fs::metadata and handle its Result. Then call +fs::Metadata::is_dir if it was Ok.

+

Returns true if the path exists on disk and is pointing at a symbolic link.

+

This function will not traverse symbolic links. +In case of a broken symbolic link this will also return true.

+

If you cannot access the directory containing the file, e.g., because of a +permission error, this will return false.

+
§Examples
+
use camino::Utf8Path;
+use std::os::unix::fs::symlink;
+
+let link_path = Utf8Path::new("link");
+symlink("/origin_does_not_exist/", link_path).unwrap();
+assert_eq!(link_path.is_symlink(), true);
+assert_eq!(link_path.exists(), false);
+
§See Also
+

This is a convenience function that coerces errors to false. If you want to +check errors, call Utf8Path::symlink_metadata and handle its Result. Then call +fs::Metadata::is_symlink if it was Ok.

+

Trait Implementations§

§

impl AsRef<OsStr> for Utf8PathBuf

§

fn as_ref(&self) -> &OsStr

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Path> for Utf8PathBuf

§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Utf8Path> for Utf8PathBuf

§

fn as_ref(&self) -> &Utf8Path

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<str> for Utf8PathBuf

§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
§

impl Borrow<Utf8Path> for Utf8PathBuf

§

fn borrow(&self) -> &Utf8Path

Immutably borrows from an owned value. Read more
§

impl Clone for Utf8PathBuf

§

fn clone(&self) -> Utf8PathBuf

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Utf8PathBuf

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for Utf8PathBuf

§

fn default() -> Utf8PathBuf

Returns the “default value” for a type. Read more
§

impl Deref for Utf8PathBuf

§

type Target = Utf8Path

The resulting type after dereferencing.
§

fn deref(&self) -> &Utf8Path

Dereferences the value.
§

impl Display for Utf8PathBuf

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<P> Extend<P> for Utf8PathBuf
where + P: AsRef<Utf8Path>,

§

fn extend<I>(&mut self, iter: I)
where + I: IntoIterator<Item = P>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
§

impl<T> From<&T> for Utf8PathBuf
where + T: AsRef<str> + ?Sized,

§

fn from(s: &T) -> Utf8PathBuf

Converts to this type from the input type.
§

impl From<Box<Utf8Path>> for Utf8PathBuf

§

fn from(path: Box<Utf8Path>) -> Utf8PathBuf

Converts to this type from the input type.
§

impl<'a> From<Cow<'a, Utf8Path>> for Utf8PathBuf

§

fn from(path: Cow<'a, Utf8Path>) -> Utf8PathBuf

Converts to this type from the input type.
§

impl From<String> for Utf8PathBuf

§

fn from(string: String) -> Utf8PathBuf

Converts to this type from the input type.
§

impl<P> FromIterator<P> for Utf8PathBuf
where + P: AsRef<Utf8Path>,

§

fn from_iter<I>(iter: I) -> Utf8PathBuf
where + I: IntoIterator<Item = P>,

Creates a value from an iterator. Read more
§

impl FromStr for Utf8PathBuf

§

type Err = Infallible

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<Utf8PathBuf, <Utf8PathBuf as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for Utf8PathBuf

§

fn hash<H>(&self, state: &mut H)
where + H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<'a> IntoIterator for &'a Utf8PathBuf

§

type Item = &'a str

The type of the elements being iterated over.
§

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> Iter<'a>

Creates an iterator from a value. Read more
§

impl Ord for Utf8PathBuf

§

fn cmp(&self, other: &Utf8PathBuf) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
§

impl<'a, 'b> PartialEq<&'a OsStr> for Utf8PathBuf

§

fn eq(&self, other: &&'a OsStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<&'a Path> for Utf8PathBuf

§

fn eq(&self, other: &&'a Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<&'a Utf8Path> for Utf8PathBuf

§

fn eq(&self, other: &&'a Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<&'a str> for Utf8PathBuf

§

fn eq(&self, other: &&'a str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for Utf8PathBuf

§

fn eq(&self, other: &Cow<'a, OsStr>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'a, Path>> for Utf8PathBuf

§

fn eq(&self, other: &Cow<'a, Path>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'a, Utf8Path>> for Utf8PathBuf

§

fn eq(&self, other: &Cow<'a, Utf8Path>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Cow<'a, str>> for Utf8PathBuf

§

fn eq(&self, other: &Cow<'a, str>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<OsStr> for Utf8PathBuf

§

fn eq(&self, other: &OsStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<OsString> for Utf8PathBuf

§

fn eq(&self, other: &OsString) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Path> for Utf8PathBuf

§

fn eq(&self, other: &Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<PathBuf> for Utf8PathBuf

§

fn eq(&self, other: &PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<String> for Utf8PathBuf

§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8Path> for Utf8PathBuf

§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for &'a OsStr

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for &'a Path

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for &'a Utf8Path

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for &'a str

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for OsStr

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for Path

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for Utf8Path

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<Utf8PathBuf> for str

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialEq<str> for Utf8PathBuf

§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialEq for Utf8PathBuf

§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a, 'b> PartialOrd<&'a OsStr> for Utf8PathBuf

§

fn partial_cmp(&self, other: &&'a OsStr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<&'a Path> for Utf8PathBuf

§

fn partial_cmp(&self, other: &&'a Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<&'a Utf8Path> for Utf8PathBuf

§

fn partial_cmp(&self, other: &&'a Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<&'a str> for Utf8PathBuf

§

fn partial_cmp(&self, other: &&'a str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'a, OsStr>> for Utf8PathBuf

§

fn partial_cmp(&self, other: &Cow<'a, OsStr>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'a, Path>> for Utf8PathBuf

§

fn partial_cmp(&self, other: &Cow<'a, Path>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'a, Utf8Path>> for Utf8PathBuf

§

fn partial_cmp(&self, other: &Cow<'a, Utf8Path>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Cow<'a, str>> for Utf8PathBuf

§

fn partial_cmp(&self, other: &Cow<'a, str>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<OsStr> for Utf8PathBuf

§

fn partial_cmp(&self, other: &OsStr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<OsString> for Utf8PathBuf

§

fn partial_cmp(&self, other: &OsString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Path> for Utf8PathBuf

§

fn partial_cmp(&self, other: &Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<PathBuf> for Utf8PathBuf

§

fn partial_cmp(&self, other: &PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<String> for Utf8PathBuf

§

fn partial_cmp(&self, other: &String) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8Path> for Utf8PathBuf

§

fn partial_cmp(&self, other: &Utf8Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for &'a OsStr

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for &'a Path

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for &'a Utf8Path

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for &'a str

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for OsStr

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for Path

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for Utf8Path

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<Utf8PathBuf> for str

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl<'a, 'b> PartialOrd<str> for Utf8PathBuf

§

fn partial_cmp(&self, other: &str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl PartialOrd for Utf8PathBuf

§

fn partial_cmp(&self, other: &Utf8PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl TryFrom<PathBuf> for Utf8PathBuf

§

type Error = FromPathBufError

The type returned in the event of a conversion error.
§

fn try_from( + path: PathBuf, +) -> Result<Utf8PathBuf, <Utf8PathBuf as TryFrom<PathBuf>>::Error>

Performs the conversion.
§

impl Eq for Utf8PathBuf

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<P, T> Receiver for P
where + P: Deref<Target = T> + ?Sized, + T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/index.html b/compiler-docs/fe_common/index.html new file mode 100644 index 0000000000..1ebb99b7d7 --- /dev/null +++ b/compiler-docs/fe_common/index.html @@ -0,0 +1,2 @@ +fe_common - Rust

Crate fe_common

Source

Re-exports§

pub use files::File;
pub use files::FileKind;
pub use files::SourceFileId;

Modules§

db
diagnostics
files
numeric
panic
utils

Macros§

assert_snapshot_wasm
assert_strings_eq
Compare the given strings and panic when not equal with a colorized line +diff.
impl_intern_key

Structs§

Span
An exclusive span of byte offsets in a source file.

Traits§

Spanned
\ No newline at end of file diff --git a/compiler-docs/fe_common/macro.assert_snapshot_wasm!.html b/compiler-docs/fe_common/macro.assert_snapshot_wasm!.html new file mode 100644 index 0000000000..bbfb81b29d --- /dev/null +++ b/compiler-docs/fe_common/macro.assert_snapshot_wasm!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.assert_snapshot_wasm.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_common/macro.assert_snapshot_wasm.html b/compiler-docs/fe_common/macro.assert_snapshot_wasm.html new file mode 100644 index 0000000000..4a38efda6f --- /dev/null +++ b/compiler-docs/fe_common/macro.assert_snapshot_wasm.html @@ -0,0 +1,3 @@ +assert_snapshot_wasm in fe_common - Rust

Macro assert_snapshot_wasm

Source
macro_rules! assert_snapshot_wasm {
+    ($path:expr, $actual:expr) => { ... };
+}
\ No newline at end of file diff --git a/compiler-docs/fe_common/macro.assert_strings_eq!.html b/compiler-docs/fe_common/macro.assert_strings_eq!.html new file mode 100644 index 0000000000..65aac92273 --- /dev/null +++ b/compiler-docs/fe_common/macro.assert_strings_eq!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.assert_strings_eq.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_common/macro.assert_strings_eq.html b/compiler-docs/fe_common/macro.assert_strings_eq.html new file mode 100644 index 0000000000..cbeb698ad1 --- /dev/null +++ b/compiler-docs/fe_common/macro.assert_strings_eq.html @@ -0,0 +1,7 @@ +assert_strings_eq in fe_common - Rust

Macro assert_strings_eq

Source
macro_rules! assert_strings_eq {
+    ($left:expr, $right:expr,) => { ... };
+    ($left:expr, $right:expr) => { ... };
+    ($left:expr, $right:expr, $($args:tt)*) => { ... };
+}
Expand description

Compare the given strings and panic when not equal with a colorized line +diff.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/macro.impl_intern_key!.html b/compiler-docs/fe_common/macro.impl_intern_key!.html new file mode 100644 index 0000000000..76c12bee1d --- /dev/null +++ b/compiler-docs/fe_common/macro.impl_intern_key!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.impl_intern_key.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_common/macro.impl_intern_key.html b/compiler-docs/fe_common/macro.impl_intern_key.html new file mode 100644 index 0000000000..de6ddd06cf --- /dev/null +++ b/compiler-docs/fe_common/macro.impl_intern_key.html @@ -0,0 +1,3 @@ +impl_intern_key in fe_common - Rust

Macro impl_intern_key

Source
macro_rules! impl_intern_key {
+    ($name:ident) => { ... };
+}
\ No newline at end of file diff --git a/compiler-docs/fe_common/numeric/enum.Radix.html b/compiler-docs/fe_common/numeric/enum.Radix.html new file mode 100644 index 0000000000..93f441cea5 --- /dev/null +++ b/compiler-docs/fe_common/numeric/enum.Radix.html @@ -0,0 +1,27 @@ +Radix in fe_common::numeric - Rust

Enum Radix

Source
pub enum Radix {
+    Hexadecimal,
+    Decimal,
+    Octal,
+    Binary,
+}
Expand description

A type that represents the radix of a numeric literal.

+

Variants§

§

Hexadecimal

§

Decimal

§

Octal

§

Binary

Implementations§

Source§

impl Radix

Source

pub fn as_num(self) -> u32

Returns number representation of the radix.

+

Trait Implementations§

Source§

impl Clone for Radix

Source§

fn clone(&self) -> Radix

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Radix

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Radix

Source§

fn eq(&self, other: &Radix) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for Radix

Source§

impl Eq for Radix

Source§

impl StructuralPartialEq for Radix

Auto Trait Implementations§

§

impl Freeze for Radix

§

impl RefUnwindSafe for Radix

§

impl Send for Radix

§

impl Sync for Radix

§

impl Unpin for Radix

§

impl UnwindSafe for Radix

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/numeric/fn.to_hex_str.html b/compiler-docs/fe_common/numeric/fn.to_hex_str.html new file mode 100644 index 0000000000..8f80143a9e --- /dev/null +++ b/compiler-docs/fe_common/numeric/fn.to_hex_str.html @@ -0,0 +1 @@ +to_hex_str in fe_common::numeric - Rust

Function to_hex_str

Source
pub fn to_hex_str(val: &BigInt) -> String
\ No newline at end of file diff --git a/compiler-docs/fe_common/numeric/index.html b/compiler-docs/fe_common/numeric/index.html new file mode 100644 index 0000000000..26ea7e7c18 --- /dev/null +++ b/compiler-docs/fe_common/numeric/index.html @@ -0,0 +1 @@ +fe_common::numeric - Rust

Module numeric

Source

Structs§

Literal
A helper type to interpret a numeric literal represented by string.

Enums§

Radix
A type that represents the radix of a numeric literal.

Functions§

to_hex_str
\ No newline at end of file diff --git a/compiler-docs/fe_common/numeric/sidebar-items.js b/compiler-docs/fe_common/numeric/sidebar-items.js new file mode 100644 index 0000000000..df6d260a4b --- /dev/null +++ b/compiler-docs/fe_common/numeric/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Radix"],"fn":["to_hex_str"],"struct":["Literal"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/numeric/struct.Literal.html b/compiler-docs/fe_common/numeric/struct.Literal.html new file mode 100644 index 0000000000..091e1054b6 --- /dev/null +++ b/compiler-docs/fe_common/numeric/struct.Literal.html @@ -0,0 +1,16 @@ +Literal in fe_common::numeric - Rust

Struct Literal

Source
pub struct Literal<'a> { /* private fields */ }
Expand description

A helper type to interpret a numeric literal represented by string.

+

Implementations§

Source§

impl<'a> Literal<'a>

Source

pub fn new(src: &'a str) -> Self

Source

pub fn parse<T: Num>(&self) -> Result<T, T::FromStrRadixErr>

Parse the numeric literal to T.

+
Source

pub fn radix(&self) -> Radix

Returns radix of the numeric literal.

+

Trait Implementations§

Source§

impl<'a> Clone for Literal<'a>

Source§

fn clone(&self) -> Literal<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Literal<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Literal<'a>

§

impl<'a> RefUnwindSafe for Literal<'a>

§

impl<'a> Send for Literal<'a>

§

impl<'a> Sync for Literal<'a>

§

impl<'a> Unpin for Literal<'a>

§

impl<'a> UnwindSafe for Literal<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/panic/fn.install_panic_hook.html b/compiler-docs/fe_common/panic/fn.install_panic_hook.html new file mode 100644 index 0000000000..f689368c1f --- /dev/null +++ b/compiler-docs/fe_common/panic/fn.install_panic_hook.html @@ -0,0 +1 @@ +install_panic_hook in fe_common::panic - Rust

Function install_panic_hook

Source
pub fn install_panic_hook()
\ No newline at end of file diff --git a/compiler-docs/fe_common/panic/index.html b/compiler-docs/fe_common/panic/index.html new file mode 100644 index 0000000000..363a29d643 --- /dev/null +++ b/compiler-docs/fe_common/panic/index.html @@ -0,0 +1 @@ +fe_common::panic - Rust

Module panic

Source

Functions§

install_panic_hook
\ No newline at end of file diff --git a/compiler-docs/fe_common/panic/sidebar-items.js b/compiler-docs/fe_common/panic/sidebar-items.js new file mode 100644 index 0000000000..0ddac1d609 --- /dev/null +++ b/compiler-docs/fe_common/panic/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["install_panic_hook"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/sidebar-items.js b/compiler-docs/fe_common/sidebar-items.js new file mode 100644 index 0000000000..61d4b4f207 --- /dev/null +++ b/compiler-docs/fe_common/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"macro":["assert_snapshot_wasm","assert_strings_eq","impl_intern_key"],"mod":["db","diagnostics","files","numeric","panic","utils"],"struct":["Span"],"trait":["Spanned"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/span/struct.Span.html b/compiler-docs/fe_common/span/struct.Span.html new file mode 100644 index 0000000000..bed03a2164 --- /dev/null +++ b/compiler-docs/fe_common/span/struct.Span.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../fe_common/struct.Span.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_common/span/trait.Spanned.html b/compiler-docs/fe_common/span/trait.Spanned.html new file mode 100644 index 0000000000..879084c593 --- /dev/null +++ b/compiler-docs/fe_common/span/trait.Spanned.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../fe_common/trait.Spanned.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_common/struct.Span.html b/compiler-docs/fe_common/struct.Span.html new file mode 100644 index 0000000000..c10dd82ed6 --- /dev/null +++ b/compiler-docs/fe_common/struct.Span.html @@ -0,0 +1,37 @@ +Span in fe_common - Rust

Struct Span

Source
pub struct Span {
+    pub file_id: SourceFileId,
+    pub start: usize,
+    pub end: usize,
+}
Expand description

An exclusive span of byte offsets in a source file.

+

Fields§

§file_id: SourceFileId§start: usize

A byte offset specifying the inclusive start of a span.

+
§end: usize

A byte offset specifying the exclusive end of a span.

+

Implementations§

Source§

impl Span

Source

pub fn new(file_id: SourceFileId, start: usize, end: usize) -> Self

Source

pub fn zero(file_id: SourceFileId) -> Self

Source

pub fn dummy() -> Self

Source

pub fn is_dummy(&self) -> bool

Source

pub fn from_pair<S, E>(start_elem: S, end_elem: E) -> Self
where + S: Into<Span>, + E: Into<Span>,

Trait Implementations§

Source§

impl<'a, T> Add<&'a T> for Span
where + T: Spanned,

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a T) -> Self

Performs the + operation. Read more
Source§

impl<'a, T> Add<Option<&'a T>> for Span
where + Span: Add<&'a T, Output = Self>,

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: Option<&'a T>) -> Self

Performs the + operation. Read more
Source§

impl Add<Option<Span>> for Span

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: Option<Span>) -> Self

Performs the + operation. Read more
Source§

impl Add for Span

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl<T> AddAssign<T> for Span
where + Span: Add<T, Output = Self>,

Source§

fn add_assign(&mut self, other: T)

Performs the += operation. Read more
Source§

impl Clone for Span

Source§

fn clone(&self) -> Span

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Span

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Span

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Span> for Range<usize>

Source§

fn from(span: Span) -> Self

Converts to this type from the input type.
Source§

impl Hash for Span

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Span

Source§

fn eq(&self, other: &Span) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Span

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Span

Source§

impl Eq for Span

Source§

impl StructuralPartialEq for Span

Auto Trait Implementations§

§

impl Freeze for Span

§

impl RefUnwindSafe for Span

§

impl Send for Span

§

impl Sync for Span

§

impl Unpin for Span

§

impl UnwindSafe for Span

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_common/trait.Spanned.html b/compiler-docs/fe_common/trait.Spanned.html new file mode 100644 index 0000000000..c60650fd47 --- /dev/null +++ b/compiler-docs/fe_common/trait.Spanned.html @@ -0,0 +1,4 @@ +Spanned in fe_common - Rust

Trait Spanned

Source
pub trait Spanned {
+    // Required method
+    fn span(&self) -> Span;
+}

Required Methods§

Source

fn span(&self) -> Span

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/dirs/fn.get_fe_deps.html b/compiler-docs/fe_common/utils/dirs/fn.get_fe_deps.html new file mode 100644 index 0000000000..59ba5c4eb1 --- /dev/null +++ b/compiler-docs/fe_common/utils/dirs/fn.get_fe_deps.html @@ -0,0 +1 @@ +get_fe_deps in fe_common::utils::dirs - Rust

Function get_fe_deps

Source
pub fn get_fe_deps() -> PathBuf
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/dirs/fn.get_fe_home.html b/compiler-docs/fe_common/utils/dirs/fn.get_fe_home.html new file mode 100644 index 0000000000..226f38fb74 --- /dev/null +++ b/compiler-docs/fe_common/utils/dirs/fn.get_fe_home.html @@ -0,0 +1 @@ +get_fe_home in fe_common::utils::dirs - Rust

Function get_fe_home

Source
pub fn get_fe_home() -> PathBuf
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/dirs/index.html b/compiler-docs/fe_common/utils/dirs/index.html new file mode 100644 index 0000000000..f0b817ca1f --- /dev/null +++ b/compiler-docs/fe_common/utils/dirs/index.html @@ -0,0 +1 @@ +fe_common::utils::dirs - Rust

Module dirs

Source

Functions§

get_fe_deps
get_fe_home
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/dirs/sidebar-items.js b/compiler-docs/fe_common/utils/dirs/sidebar-items.js new file mode 100644 index 0000000000..bc67f01f09 --- /dev/null +++ b/compiler-docs/fe_common/utils/dirs/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["get_fe_deps","get_fe_home"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/enum.DependencyKind.html b/compiler-docs/fe_common/utils/files/enum.DependencyKind.html new file mode 100644 index 0000000000..f2c5951cfa --- /dev/null +++ b/compiler-docs/fe_common/utils/files/enum.DependencyKind.html @@ -0,0 +1,16 @@ +DependencyKind in fe_common::utils::files - Rust

Enum DependencyKind

Source
pub enum DependencyKind {
+    Local(LocalDependency),
+    Git(GitDependency),
+}

Variants§

Trait Implementations§

Source§

impl Clone for DependencyKind

Source§

fn clone(&self) -> DependencyKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/enum.FileLoader.html b/compiler-docs/fe_common/utils/files/enum.FileLoader.html new file mode 100644 index 0000000000..d39651a4d0 --- /dev/null +++ b/compiler-docs/fe_common/utils/files/enum.FileLoader.html @@ -0,0 +1,14 @@ +FileLoader in fe_common::utils::files - Rust

Enum FileLoader

Source
pub enum FileLoader {
+    Static(Vec<(&'static str, &'static str)>),
+    Fs,
+}

Variants§

§

Static(Vec<(&'static str, &'static str)>)

§

Fs

Implementations§

Source§

impl FileLoader

Source

pub fn canonicalize_path(&self, path: &str) -> Result<SmolStr, String>

Source

pub fn fe_files(&self, path: &str) -> Result<Vec<(String, String)>, String>

Source

pub fn file_content(&self, path: &str) -> Result<String, String>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/enum.ProjectMode.html b/compiler-docs/fe_common/utils/files/enum.ProjectMode.html new file mode 100644 index 0000000000..d48bec817d --- /dev/null +++ b/compiler-docs/fe_common/utils/files/enum.ProjectMode.html @@ -0,0 +1,23 @@ +ProjectMode in fe_common::utils::files - Rust

Enum ProjectMode

Source
pub enum ProjectMode {
+    Main,
+    Lib,
+}

Variants§

§

Main

§

Lib

Trait Implementations§

Source§

impl Clone for ProjectMode

Source§

fn clone(&self) -> ProjectMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl PartialEq for ProjectMode

Source§

fn eq(&self, other: &ProjectMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for ProjectMode

Source§

impl Eq for ProjectMode

Source§

impl StructuralPartialEq for ProjectMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/fn.get_project_root.html b/compiler-docs/fe_common/utils/files/fn.get_project_root.html new file mode 100644 index 0000000000..c5ae00e171 --- /dev/null +++ b/compiler-docs/fe_common/utils/files/fn.get_project_root.html @@ -0,0 +1,2 @@ +get_project_root in fe_common::utils::files - Rust

Function get_project_root

Source
pub fn get_project_root() -> Option<String>
Expand description

Returns the root path of the current Fe project

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/index.html b/compiler-docs/fe_common/utils/files/index.html new file mode 100644 index 0000000000..9ee0b8570c --- /dev/null +++ b/compiler-docs/fe_common/utils/files/index.html @@ -0,0 +1 @@ +fe_common::utils::files - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/sidebar-items.js b/compiler-docs/fe_common/utils/files/sidebar-items.js new file mode 100644 index 0000000000..aceea560a2 --- /dev/null +++ b/compiler-docs/fe_common/utils/files/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["DependencyKind","FileLoader","ProjectMode"],"fn":["get_project_root"],"struct":["BuildFiles","Dependency","GitDependency","LocalDependency","ProjectFiles"],"trait":["DependencyResolver"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/struct.BuildFiles.html b/compiler-docs/fe_common/utils/files/struct.BuildFiles.html new file mode 100644 index 0000000000..42ab88cbc3 --- /dev/null +++ b/compiler-docs/fe_common/utils/files/struct.BuildFiles.html @@ -0,0 +1,19 @@ +BuildFiles in fe_common::utils::files - Rust

Struct BuildFiles

Source
pub struct BuildFiles {
+    pub root_project_path: SmolStr,
+    pub project_files: IndexMap<SmolStr, ProjectFiles>,
+}

Fields§

§root_project_path: SmolStr§project_files: IndexMap<SmolStr, ProjectFiles>

Implementations§

Source§

impl BuildFiles

Source

pub fn root_project_mode(&self) -> ProjectMode

Source

pub fn load_fs(root_path: &str) -> Result<Self, String>

Build files are loaded from the file system.

+
Source

pub fn load_static( + files: Vec<(&'static str, &'static str)>, + root_path: &str, +) -> Result<Self, String>

Build files are loaded from static file vector.

+

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/struct.Dependency.html b/compiler-docs/fe_common/utils/files/struct.Dependency.html new file mode 100644 index 0000000000..76f735a660 --- /dev/null +++ b/compiler-docs/fe_common/utils/files/struct.Dependency.html @@ -0,0 +1,18 @@ +Dependency in fe_common::utils::files - Rust

Struct Dependency

Source
pub struct Dependency {
+    pub name: SmolStr,
+    pub version: Option<SmolStr>,
+    pub canonicalized_path: SmolStr,
+    pub kind: DependencyKind,
+}

Fields§

§name: SmolStr§version: Option<SmolStr>§canonicalized_path: SmolStr§kind: DependencyKind

Trait Implementations§

Source§

impl Clone for Dependency

Source§

fn clone(&self) -> Dependency

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/struct.GitDependency.html b/compiler-docs/fe_common/utils/files/struct.GitDependency.html new file mode 100644 index 0000000000..f00df75ff5 --- /dev/null +++ b/compiler-docs/fe_common/utils/files/struct.GitDependency.html @@ -0,0 +1,16 @@ +GitDependency in fe_common::utils::files - Rust

Struct GitDependency

Source
pub struct GitDependency { /* private fields */ }

Trait Implementations§

Source§

impl Clone for GitDependency

Source§

fn clone(&self) -> GitDependency

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DependencyResolver for GitDependency

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/struct.LocalDependency.html b/compiler-docs/fe_common/utils/files/struct.LocalDependency.html new file mode 100644 index 0000000000..c11c14eb93 --- /dev/null +++ b/compiler-docs/fe_common/utils/files/struct.LocalDependency.html @@ -0,0 +1,16 @@ +LocalDependency in fe_common::utils::files - Rust

Struct LocalDependency

Source
pub struct LocalDependency;

Trait Implementations§

Source§

impl Clone for LocalDependency

Source§

fn clone(&self) -> LocalDependency

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DependencyResolver for LocalDependency

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/struct.ProjectFiles.html b/compiler-docs/fe_common/utils/files/struct.ProjectFiles.html new file mode 100644 index 0000000000..384bca33d5 --- /dev/null +++ b/compiler-docs/fe_common/utils/files/struct.ProjectFiles.html @@ -0,0 +1,17 @@ +ProjectFiles in fe_common::utils::files - Rust

Struct ProjectFiles

Source
pub struct ProjectFiles {
+    pub name: SmolStr,
+    pub version: SmolStr,
+    pub mode: ProjectMode,
+    pub dependencies: Vec<Dependency>,
+    pub src: Vec<(String, String)>,
+}

Fields§

§name: SmolStr§version: SmolStr§mode: ProjectMode§dependencies: Vec<Dependency>§src: Vec<(String, String)>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/files/trait.DependencyResolver.html b/compiler-docs/fe_common/utils/files/trait.DependencyResolver.html new file mode 100644 index 0000000000..76f6fe6752 --- /dev/null +++ b/compiler-docs/fe_common/utils/files/trait.DependencyResolver.html @@ -0,0 +1,10 @@ +DependencyResolver in fe_common::utils::files - Rust

Trait DependencyResolver

Source
pub trait DependencyResolver {
+    // Required method
+    fn resolve(
+        dep: &Dependency,
+        loader: &FileLoader,
+    ) -> Result<ProjectFiles, String>;
+}

Required Methods§

Source

fn resolve( + dep: &Dependency, + loader: &FileLoader, +) -> Result<ProjectFiles, String>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/git/fn.fetch_and_checkout.html b/compiler-docs/fe_common/utils/git/fn.fetch_and_checkout.html new file mode 100644 index 0000000000..ce992939e4 --- /dev/null +++ b/compiler-docs/fe_common/utils/git/fn.fetch_and_checkout.html @@ -0,0 +1,7 @@ +fetch_and_checkout in fe_common::utils::git - Rust

Function fetch_and_checkout

Source
pub fn fetch_and_checkout<P: AsRef<Path>>(
+    remote: &str,
+    target_directory: P,
+    refspec: &str,
+) -> Result<(), Box<dyn Error>>
Expand description

Fetch and checkout the specified refspec from the remote repository without +fetching any additional history.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/git/index.html b/compiler-docs/fe_common/utils/git/index.html new file mode 100644 index 0000000000..8d00af3236 --- /dev/null +++ b/compiler-docs/fe_common/utils/git/index.html @@ -0,0 +1,2 @@ +fe_common::utils::git - Rust

Module git

Source

Functions§

fetch_and_checkout
Fetch and checkout the specified refspec from the remote repository without +fetching any additional history.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/git/sidebar-items.js b/compiler-docs/fe_common/utils/git/sidebar-items.js new file mode 100644 index 0000000000..8528f078b2 --- /dev/null +++ b/compiler-docs/fe_common/utils/git/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["fetch_and_checkout"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/utils/humanize/fn.pluralize_conditionally.html b/compiler-docs/fe_common/utils/humanize/fn.pluralize_conditionally.html new file mode 100644 index 0000000000..dc346697ce --- /dev/null +++ b/compiler-docs/fe_common/utils/humanize/fn.pluralize_conditionally.html @@ -0,0 +1,4 @@ +pluralize_conditionally in fe_common::utils::humanize - Rust

Function pluralize_conditionally

Source
pub fn pluralize_conditionally(
+    pluralizable: impl Pluralizable,
+    count: usize,
+) -> String
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/humanize/index.html b/compiler-docs/fe_common/utils/humanize/index.html new file mode 100644 index 0000000000..e714338f1f --- /dev/null +++ b/compiler-docs/fe_common/utils/humanize/index.html @@ -0,0 +1 @@ +fe_common::utils::humanize - Rust

Module humanize

Source

Traits§

Pluralizable
A trait to derive plural or singular representations from

Functions§

pluralize_conditionally
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/humanize/sidebar-items.js b/compiler-docs/fe_common/utils/humanize/sidebar-items.js new file mode 100644 index 0000000000..226b3cfd33 --- /dev/null +++ b/compiler-docs/fe_common/utils/humanize/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["pluralize_conditionally"],"trait":["Pluralizable"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/utils/humanize/trait.Pluralizable.html b/compiler-docs/fe_common/utils/humanize/trait.Pluralizable.html new file mode 100644 index 0000000000..62b5047cdc --- /dev/null +++ b/compiler-docs/fe_common/utils/humanize/trait.Pluralizable.html @@ -0,0 +1,6 @@ +Pluralizable in fe_common::utils::humanize - Rust

Trait Pluralizable

Source
pub trait Pluralizable {
+    // Required methods
+    fn to_plural(&self) -> String;
+    fn to_singular(&self) -> String;
+}
Expand description

A trait to derive plural or singular representations from

+

Required Methods§

Implementations on Foreign Types§

Source§

impl Pluralizable for &str

Source§

impl Pluralizable for (&str, &str)

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/index.html b/compiler-docs/fe_common/utils/index.html new file mode 100644 index 0000000000..e29f9937cf --- /dev/null +++ b/compiler-docs/fe_common/utils/index.html @@ -0,0 +1 @@ +fe_common::utils - Rust

Module utils

Source

Modules§

dirs
files
git
humanize
keccak
ron
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/keccak/fn.full.html b/compiler-docs/fe_common/utils/keccak/fn.full.html new file mode 100644 index 0000000000..eae7751a1f --- /dev/null +++ b/compiler-docs/fe_common/utils/keccak/fn.full.html @@ -0,0 +1,2 @@ +full in fe_common::utils::keccak - Rust

Function full

Source
pub fn full(content: &[u8]) -> String
Expand description

Get the full 32 byte hash of the content.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/keccak/fn.full_as_bytes.html b/compiler-docs/fe_common/utils/keccak/fn.full_as_bytes.html new file mode 100644 index 0000000000..4875dd9f6d --- /dev/null +++ b/compiler-docs/fe_common/utils/keccak/fn.full_as_bytes.html @@ -0,0 +1,2 @@ +full_as_bytes in fe_common::utils::keccak - Rust

Function full_as_bytes

Source
pub fn full_as_bytes(content: &[u8]) -> [u8; 32]
Expand description

Get the full 32 byte hash of the content as a byte array.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/keccak/fn.partial.html b/compiler-docs/fe_common/utils/keccak/fn.partial.html new file mode 100644 index 0000000000..c8f99c577d --- /dev/null +++ b/compiler-docs/fe_common/utils/keccak/fn.partial.html @@ -0,0 +1,2 @@ +partial in fe_common::utils::keccak - Rust

Function partial

Source
pub fn partial(content: &[u8], size: usize) -> String
Expand description

Take the first size number of bytes of the hash with no padding.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/keccak/fn.partial_right_padded.html b/compiler-docs/fe_common/utils/keccak/fn.partial_right_padded.html new file mode 100644 index 0000000000..78ad17e1b4 --- /dev/null +++ b/compiler-docs/fe_common/utils/keccak/fn.partial_right_padded.html @@ -0,0 +1,3 @@ +partial_right_padded in fe_common::utils::keccak - Rust

Function partial_right_padded

Source
pub fn partial_right_padded(content: &[u8], size: usize) -> String
Expand description

Take the first size number of bytes of the hash and pad the right side +with zeros to 32 bytes.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/keccak/index.html b/compiler-docs/fe_common/utils/keccak/index.html new file mode 100644 index 0000000000..5f7bcd3adf --- /dev/null +++ b/compiler-docs/fe_common/utils/keccak/index.html @@ -0,0 +1,2 @@ +fe_common::utils::keccak - Rust

Module keccak

Source

Functions§

full
Get the full 32 byte hash of the content.
full_as_bytes
Get the full 32 byte hash of the content as a byte array.
partial
Take the first size number of bytes of the hash with no padding.
partial_right_padded
Take the first size number of bytes of the hash and pad the right side +with zeros to 32 bytes.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/keccak/sidebar-items.js b/compiler-docs/fe_common/utils/keccak/sidebar-items.js new file mode 100644 index 0000000000..13bdbf8279 --- /dev/null +++ b/compiler-docs/fe_common/utils/keccak/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["full","full_as_bytes","partial","partial_right_padded"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/utils/ron/fn.to_ron_string_pretty.html b/compiler-docs/fe_common/utils/ron/fn.to_ron_string_pretty.html new file mode 100644 index 0000000000..d21af9c847 --- /dev/null +++ b/compiler-docs/fe_common/utils/ron/fn.to_ron_string_pretty.html @@ -0,0 +1,4 @@ +to_ron_string_pretty in fe_common::utils::ron - Rust

Function to_ron_string_pretty

Source
pub fn to_ron_string_pretty<T>(value: &T) -> Result<String>
where + T: Serialize,
Expand description

Convenience function to serialize objects in RON format with custom pretty +printing config and struct names.

+
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/ron/index.html b/compiler-docs/fe_common/utils/ron/index.html new file mode 100644 index 0000000000..e88903f7ce --- /dev/null +++ b/compiler-docs/fe_common/utils/ron/index.html @@ -0,0 +1,2 @@ +fe_common::utils::ron - Rust

Module ron

Source

Structs§

Diff
Wrapper struct for formatting changesets from the difference package.

Functions§

to_ron_string_pretty
Convenience function to serialize objects in RON format with custom pretty +printing config and struct names.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/ron/sidebar-items.js b/compiler-docs/fe_common/utils/ron/sidebar-items.js new file mode 100644 index 0000000000..dc250fef05 --- /dev/null +++ b/compiler-docs/fe_common/utils/ron/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["to_ron_string_pretty"],"struct":["Diff"]}; \ No newline at end of file diff --git a/compiler-docs/fe_common/utils/ron/struct.Diff.html b/compiler-docs/fe_common/utils/ron/struct.Diff.html new file mode 100644 index 0000000000..91680fb65c --- /dev/null +++ b/compiler-docs/fe_common/utils/ron/struct.Diff.html @@ -0,0 +1,13 @@ +Diff in fe_common::utils::ron - Rust

Struct Diff

Source
pub struct Diff(/* private fields */);
Expand description

Wrapper struct for formatting changesets from the difference package.

+

Implementations§

Source§

impl Diff

Source

pub fn new(left: &str, right: &str) -> Self

Trait Implementations§

Source§

impl Display for Diff

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Diff

§

impl RefUnwindSafe for Diff

§

impl Send for Diff

§

impl Sync for Diff

§

impl Unpin for Diff

§

impl UnwindSafe for Diff

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_common/utils/sidebar-items.js b/compiler-docs/fe_common/utils/sidebar-items.js new file mode 100644 index 0000000000..857e59addd --- /dev/null +++ b/compiler-docs/fe_common/utils/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["dirs","files","git","humanize","keccak","ron"]}; \ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/all.html b/compiler-docs/fe_compiler_test_utils/all.html new file mode 100644 index 0000000000..5ab06ebe07 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/constant.DEFAULT_CALLER.html b/compiler-docs/fe_compiler_test_utils/constant.DEFAULT_CALLER.html new file mode 100644 index 0000000000..5d87febe45 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/constant.DEFAULT_CALLER.html @@ -0,0 +1 @@ +DEFAULT_CALLER in fe_compiler_test_utils - Rust

Constant DEFAULT_CALLER

Source
pub const DEFAULT_CALLER: &str = "1000000000000000000000000000000000000001";
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.address.html b/compiler-docs/fe_compiler_test_utils/fn.address.html new file mode 100644 index 0000000000..d37d1ae5cd --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.address.html @@ -0,0 +1 @@ +address in fe_compiler_test_utils - Rust

Function address

Source
pub fn address(s: &str) -> H160
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.address_array_token.html b/compiler-docs/fe_compiler_test_utils/fn.address_array_token.html new file mode 100644 index 0000000000..b164cd0f51 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.address_array_token.html @@ -0,0 +1 @@ +address_array_token in fe_compiler_test_utils - Rust

Function address_array_token

Source
pub fn address_array_token(v: &[&str]) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.address_token.html b/compiler-docs/fe_compiler_test_utils/fn.address_token.html new file mode 100644 index 0000000000..08d52c02b6 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.address_token.html @@ -0,0 +1 @@ +address_token in fe_compiler_test_utils - Rust

Function address_token

Source
pub fn address_token(s: &str) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.bool_token.html b/compiler-docs/fe_compiler_test_utils/fn.bool_token.html new file mode 100644 index 0000000000..3f548b1659 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.bool_token.html @@ -0,0 +1 @@ +bool_token in fe_compiler_test_utils - Rust

Function bool_token

Source
pub fn bool_token(val: bool) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.bytes_token.html b/compiler-docs/fe_compiler_test_utils/fn.bytes_token.html new file mode 100644 index 0000000000..5c9b7aaa05 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.bytes_token.html @@ -0,0 +1 @@ +bytes_token in fe_compiler_test_utils - Rust

Function bytes_token

Source
pub fn bytes_token(s: &str) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.encode_error_reason.html b/compiler-docs/fe_compiler_test_utils/fn.encode_error_reason.html new file mode 100644 index 0000000000..b09ca4ab4b --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.encode_error_reason.html @@ -0,0 +1 @@ +encode_error_reason in fe_compiler_test_utils - Rust

Function encode_error_reason

Source
pub fn encode_error_reason(reason: &str) -> Vec<u8> 
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.encode_revert.html b/compiler-docs/fe_compiler_test_utils/fn.encode_revert.html new file mode 100644 index 0000000000..c08fcff184 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.encode_revert.html @@ -0,0 +1 @@ +encode_revert in fe_compiler_test_utils - Rust

Function encode_revert

Source
pub fn encode_revert(selector: &str, input: &[Token]) -> Vec<u8> 
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.encoded_div_or_mod_by_zero.html b/compiler-docs/fe_compiler_test_utils/fn.encoded_div_or_mod_by_zero.html new file mode 100644 index 0000000000..330cc65a80 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.encoded_div_or_mod_by_zero.html @@ -0,0 +1 @@ +encoded_div_or_mod_by_zero in fe_compiler_test_utils - Rust

Function encoded_div_or_mod_by_zero

Source
pub fn encoded_div_or_mod_by_zero() -> Vec<u8> 
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.encoded_invalid_abi_data.html b/compiler-docs/fe_compiler_test_utils/fn.encoded_invalid_abi_data.html new file mode 100644 index 0000000000..b68cde4706 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.encoded_invalid_abi_data.html @@ -0,0 +1 @@ +encoded_invalid_abi_data in fe_compiler_test_utils - Rust

Function encoded_invalid_abi_data

Source
pub fn encoded_invalid_abi_data() -> Vec<u8> 
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.encoded_over_or_underflow.html b/compiler-docs/fe_compiler_test_utils/fn.encoded_over_or_underflow.html new file mode 100644 index 0000000000..6ee4d1f621 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.encoded_over_or_underflow.html @@ -0,0 +1 @@ +encoded_over_or_underflow in fe_compiler_test_utils - Rust

Function encoded_over_or_underflow

Source
pub fn encoded_over_or_underflow() -> Vec<u8> 
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.encoded_panic_assert.html b/compiler-docs/fe_compiler_test_utils/fn.encoded_panic_assert.html new file mode 100644 index 0000000000..d7889832a7 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.encoded_panic_assert.html @@ -0,0 +1 @@ +encoded_panic_assert in fe_compiler_test_utils - Rust

Function encoded_panic_assert

Source
pub fn encoded_panic_assert() -> Vec<u8> 
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.encoded_panic_out_of_bounds.html b/compiler-docs/fe_compiler_test_utils/fn.encoded_panic_out_of_bounds.html new file mode 100644 index 0000000000..1f39c449b8 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.encoded_panic_out_of_bounds.html @@ -0,0 +1 @@ +encoded_panic_out_of_bounds in fe_compiler_test_utils - Rust

Function encoded_panic_out_of_bounds

Source
pub fn encoded_panic_out_of_bounds() -> Vec<u8> 
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.get_2s_complement_for_negative.html b/compiler-docs/fe_compiler_test_utils/fn.get_2s_complement_for_negative.html new file mode 100644 index 0000000000..db030cee6b --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.get_2s_complement_for_negative.html @@ -0,0 +1,3 @@ +get_2s_complement_for_negative in fe_compiler_test_utils - Rust

Function get_2s_complement_for_negative

Source
pub fn get_2s_complement_for_negative(assume_negative: U256) -> U256
Expand description

To get the 2s complement value for e.g. -128 call +get_2s_complement_for_negative(128)

+
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.int_array_token.html b/compiler-docs/fe_compiler_test_utils/fn.int_array_token.html new file mode 100644 index 0000000000..c59daa8d78 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.int_array_token.html @@ -0,0 +1 @@ +int_array_token in fe_compiler_test_utils - Rust

Function int_array_token

Source
pub fn int_array_token(v: &[i64]) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.int_token.html b/compiler-docs/fe_compiler_test_utils/fn.int_token.html new file mode 100644 index 0000000000..7347357ed3 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.int_token.html @@ -0,0 +1 @@ +int_token in fe_compiler_test_utils - Rust

Function int_token

Source
pub fn int_token(val: i64) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.load_contract.html b/compiler-docs/fe_compiler_test_utils/fn.load_contract.html new file mode 100644 index 0000000000..5c9017eeb5 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.load_contract.html @@ -0,0 +1,5 @@ +load_contract in fe_compiler_test_utils - Rust

Function load_contract

Source
pub fn load_contract(
+    address: H160,
+    fixture: &str,
+    contract_name: &str,
+) -> ContractHarness
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.string_token.html b/compiler-docs/fe_compiler_test_utils/fn.string_token.html new file mode 100644 index 0000000000..5223361e2e --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.string_token.html @@ -0,0 +1 @@ +string_token in fe_compiler_test_utils - Rust

Function string_token

Source
pub fn string_token(s: &str) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.to_2s_complement.html b/compiler-docs/fe_compiler_test_utils/fn.to_2s_complement.html new file mode 100644 index 0000000000..5d64a3cddb --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.to_2s_complement.html @@ -0,0 +1 @@ +to_2s_complement in fe_compiler_test_utils - Rust

Function to_2s_complement

Source
pub fn to_2s_complement(val: i64) -> U256
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.tuple_token.html b/compiler-docs/fe_compiler_test_utils/fn.tuple_token.html new file mode 100644 index 0000000000..bd2aab6260 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.tuple_token.html @@ -0,0 +1 @@ +tuple_token in fe_compiler_test_utils - Rust

Function tuple_token

Source
pub fn tuple_token(tokens: &[Token]) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.uint_array_token.html b/compiler-docs/fe_compiler_test_utils/fn.uint_array_token.html new file mode 100644 index 0000000000..74d2777805 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.uint_array_token.html @@ -0,0 +1 @@ +uint_array_token in fe_compiler_test_utils - Rust

Function uint_array_token

Source
pub fn uint_array_token(v: &[u64]) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.uint_token.html b/compiler-docs/fe_compiler_test_utils/fn.uint_token.html new file mode 100644 index 0000000000..0710810dc3 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.uint_token.html @@ -0,0 +1 @@ +uint_token in fe_compiler_test_utils - Rust

Function uint_token

Source
pub fn uint_token(n: u64) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.uint_token_from_dec_str.html b/compiler-docs/fe_compiler_test_utils/fn.uint_token_from_dec_str.html new file mode 100644 index 0000000000..5770769964 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.uint_token_from_dec_str.html @@ -0,0 +1 @@ +uint_token_from_dec_str in fe_compiler_test_utils - Rust

Function uint_token_from_dec_str

Source
pub fn uint_token_from_dec_str(val: &str) -> Token
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.validate_return.html b/compiler-docs/fe_compiler_test_utils/fn.validate_return.html new file mode 100644 index 0000000000..e7033057ef --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.validate_return.html @@ -0,0 +1,4 @@ +validate_return in fe_compiler_test_utils - Rust

Function validate_return

Source
pub fn validate_return(
+    capture: Capture<(ExitReason, Vec<u8>), Infallible>,
+    expected_data: &[u8],
+)
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.validate_revert.html b/compiler-docs/fe_compiler_test_utils/fn.validate_revert.html new file mode 100644 index 0000000000..c6af880f0e --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.validate_revert.html @@ -0,0 +1,4 @@ +validate_revert in fe_compiler_test_utils - Rust

Function validate_revert

Source
pub fn validate_revert(
+    capture: Capture<(ExitReason, Vec<u8>), Infallible>,
+    expected_data: &[u8],
+)
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.with_executor.html b/compiler-docs/fe_compiler_test_utils/fn.with_executor.html new file mode 100644 index 0000000000..8f325c58d7 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.with_executor.html @@ -0,0 +1 @@ +with_executor in fe_compiler_test_utils - Rust

Function with_executor

Source
pub fn with_executor(test: &dyn Fn(Executor<'_, '_>))
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/fn.with_executor_backend.html b/compiler-docs/fe_compiler_test_utils/fn.with_executor_backend.html new file mode 100644 index 0000000000..c05ff70c57 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/fn.with_executor_backend.html @@ -0,0 +1,4 @@ +with_executor_backend in fe_compiler_test_utils - Rust

Function with_executor_backend

Source
pub fn with_executor_backend(
+    backend: Backend<'_>,
+    test: &dyn Fn(Executor<'_, '_>),
+)
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/index.html b/compiler-docs/fe_compiler_test_utils/index.html new file mode 100644 index 0000000000..c1df8d89b7 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/index.html @@ -0,0 +1,2 @@ +fe_compiler_test_utils - Rust

Crate fe_compiler_test_utils

Source

Macros§

assert_harness_gas_report

Structs§

ContractHarness
ExecutionOutput
GasRecord
GasReporter
NumericAbiTokenBounds
Runtime
SolidityCompileError

Constants§

DEFAULT_CALLER

Traits§

ToBeBytes

Functions§

address
address_array_token
address_token
bool_token
bytes_token
encode_error_reason
encode_revert
encoded_div_or_mod_by_zero
encoded_invalid_abi_data
encoded_over_or_underflow
encoded_panic_assert
encoded_panic_out_of_bounds
get_2s_complement_for_negative
To get the 2s complement value for e.g. -128 call +get_2s_complement_for_negative(128)
int_array_token
int_token
load_contract
string_token
to_2s_complement
tuple_token
uint_array_token
uint_token
uint_token_from_dec_str
validate_return
validate_revert
with_executor
with_executor_backend

Type Aliases§

Backend
Executor
StackState
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/macro.assert_harness_gas_report!.html b/compiler-docs/fe_compiler_test_utils/macro.assert_harness_gas_report!.html new file mode 100644 index 0000000000..97bc8a73cd --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/macro.assert_harness_gas_report!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.assert_harness_gas_report.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/macro.assert_harness_gas_report.html b/compiler-docs/fe_compiler_test_utils/macro.assert_harness_gas_report.html new file mode 100644 index 0000000000..bb3416948b --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/macro.assert_harness_gas_report.html @@ -0,0 +1,4 @@ +assert_harness_gas_report in fe_compiler_test_utils - Rust

Macro assert_harness_gas_report

Source
macro_rules! assert_harness_gas_report {
+    ($harness: expr) => { ... };
+    ($harness: expr, $($expr:expr),*) => { ... };
+}
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/sidebar-items.js b/compiler-docs/fe_compiler_test_utils/sidebar-items.js new file mode 100644 index 0000000000..5f4f697188 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["DEFAULT_CALLER"],"fn":["address","address_array_token","address_token","bool_token","bytes_token","encode_error_reason","encode_revert","encoded_div_or_mod_by_zero","encoded_invalid_abi_data","encoded_over_or_underflow","encoded_panic_assert","encoded_panic_out_of_bounds","get_2s_complement_for_negative","int_array_token","int_token","load_contract","string_token","to_2s_complement","tuple_token","uint_array_token","uint_token","uint_token_from_dec_str","validate_return","validate_revert","with_executor","with_executor_backend"],"macro":["assert_harness_gas_report"],"struct":["ContractHarness","ExecutionOutput","GasRecord","GasReporter","NumericAbiTokenBounds","Runtime","SolidityCompileError"],"trait":["ToBeBytes"],"type":["Backend","Executor","StackState"]}; \ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/struct.ContractHarness.html b/compiler-docs/fe_compiler_test_utils/struct.ContractHarness.html new file mode 100644 index 0000000000..8fd4a022b8 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/struct.ContractHarness.html @@ -0,0 +1,143 @@ +ContractHarness in fe_compiler_test_utils - Rust

Struct ContractHarness

Source
pub struct ContractHarness {
+    pub gas_reporter: GasReporter,
+    pub address: H160,
+    pub abi: Contract,
+    pub caller: H160,
+    pub value: U256,
+}

Fields§

§gas_reporter: GasReporter§address: H160§abi: Contract§caller: H160§value: U256

Implementations§

Source§

impl ContractHarness

Source

pub fn capture_call( + &self, + executor: &mut Executor<'_, '_>, + name: &str, + input: &[Token], +) -> Capture<(ExitReason, Vec<u8>), Infallible>

Source

pub fn build_calldata(&self, name: &str, input: &[Token]) -> Vec<u8>

Source

pub fn capture_call_raw_bytes( + &self, + executor: &mut Executor<'_, '_>, + input: Vec<u8>, +) -> Capture<(ExitReason, Vec<u8>), Infallible>

Source

pub fn test_function( + &self, + executor: &mut Executor<'_, '_>, + name: &str, + input: &[Token], + output: Option<&Token>, +)

Source

pub fn call_function( + &self, + executor: &mut Executor<'_, '_>, + name: &str, + input: &[Token], +) -> Option<Token>

Source

pub fn test_function_reverts( + &self, + executor: &mut Executor<'_, '_>, + name: &str, + input: &[Token], + revert_data: &[u8], +)

Source

pub fn test_call_reverts( + &self, + executor: &mut Executor<'_, '_>, + input: Vec<u8>, + revert_data: &[u8], +)

Source

pub fn test_function_returns( + &self, + executor: &mut Executor<'_, '_>, + name: &str, + input: &[Token], + return_data: &[u8], +)

Source

pub fn test_call_returns( + &self, + executor: &mut Executor<'_, '_>, + input: Vec<u8>, + return_data: &[u8], +)

Source

pub fn events_emitted( + &self, + executor: Executor<'_, '_>, + events: &[(&str, &[Token])], +)

Source

pub fn set_caller(&mut self, caller: H160)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> MaybeDebug for T

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/struct.ExecutionOutput.html b/compiler-docs/fe_compiler_test_utils/struct.ExecutionOutput.html new file mode 100644 index 0000000000..b998e92e46 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/struct.ExecutionOutput.html @@ -0,0 +1,95 @@ +ExecutionOutput in fe_compiler_test_utils - Rust

Struct ExecutionOutput

Source
pub struct ExecutionOutput { /* private fields */ }

Implementations§

Source§

impl ExecutionOutput

Source

pub fn new(exit_reason: ExitReason, data: Vec<u8>) -> ExecutionOutput

Create an ExecutionOutput instance

+
Source

pub fn expect_success(self) -> ExecutionOutput

Panic if the execution did not succeed.

+
Source

pub fn expect_revert(self) -> ExecutionOutput

Panic if the execution did not revert.

+
Source

pub fn expect_revert_reason(self, reason: &str) -> ExecutionOutput

Panic if the output is not an encoded error reason of the given string.

+

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> MaybeDebug for T

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/struct.GasRecord.html b/compiler-docs/fe_compiler_test_utils/struct.GasRecord.html new file mode 100644 index 0000000000..1aaebd0efb --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/struct.GasRecord.html @@ -0,0 +1,94 @@ +GasRecord in fe_compiler_test_utils - Rust

Struct GasRecord

Source
pub struct GasRecord {
+    pub description: String,
+    pub gas_used: u64,
+}

Fields§

§description: String§gas_used: u64

Trait Implementations§

Source§

impl Debug for GasRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> MaybeDebug for T

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/struct.GasReporter.html b/compiler-docs/fe_compiler_test_utils/struct.GasReporter.html new file mode 100644 index 0000000000..6223d4a672 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/struct.GasReporter.html @@ -0,0 +1,97 @@ +GasReporter in fe_compiler_test_utils - Rust

Struct GasReporter

Source
pub struct GasReporter { /* private fields */ }

Implementations§

Source§

impl GasReporter

Source

pub fn add_record(&self, description: &str, gas_used: u64)

Source

pub fn add_func_call_record( + &self, + function: &str, + input: &[Token], + gas_used: u64, +)

Trait Implementations§

Source§

impl Debug for GasReporter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GasReporter

Source§

fn default() -> GasReporter

Returns the “default value” for a type. Read more
Source§

impl Display for GasReporter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> MaybeDebug for T

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/struct.NumericAbiTokenBounds.html b/compiler-docs/fe_compiler_test_utils/struct.NumericAbiTokenBounds.html new file mode 100644 index 0000000000..2d97a55d89 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/struct.NumericAbiTokenBounds.html @@ -0,0 +1,97 @@ +NumericAbiTokenBounds in fe_compiler_test_utils - Rust

Struct NumericAbiTokenBounds

Source
pub struct NumericAbiTokenBounds {
+    pub size: u64,
+    pub u_min: Token,
+    pub i_min: Token,
+    pub u_max: Token,
+    pub i_max: Token,
+}

Fields§

§size: u64§u_min: Token§i_min: Token§u_max: Token§i_max: Token

Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> MaybeDebug for T

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/struct.Runtime.html b/compiler-docs/fe_compiler_test_utils/struct.Runtime.html new file mode 100644 index 0000000000..4506f479a7 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/struct.Runtime.html @@ -0,0 +1,95 @@ +Runtime in fe_compiler_test_utils - Rust

Struct Runtime

Source
pub struct Runtime { /* private fields */ }

Implementations§

Source§

impl Runtime

Source

pub fn new() -> Runtime

Create a new Runtime instance.

+
Source

pub fn with_functions(self, fns: Vec<Statement>) -> Runtime

Add the given set of functions

+
Source

pub fn with_test_statements(self, statements: Vec<Statement>) -> Runtime

Add the given set of test statements

+
Source

pub fn with_data(self, data: Vec<Data>) -> Runtime

Source

pub fn to_yul(&self) -> Object

Generate the top level YUL object

+

Trait Implementations§

Source§

impl Default for Runtime

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> MaybeDebug for T

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/struct.SolidityCompileError.html b/compiler-docs/fe_compiler_test_utils/struct.SolidityCompileError.html new file mode 100644 index 0000000000..82bec50605 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/struct.SolidityCompileError.html @@ -0,0 +1,92 @@ +SolidityCompileError in fe_compiler_test_utils - Rust

Struct SolidityCompileError

Source
pub struct SolidityCompileError(/* private fields */);

Trait Implementations§

Source§

impl Debug for SolidityCompileError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SolidityCompileError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for SolidityCompileError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> MaybeDebug for T

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/trait.ToBeBytes.html b/compiler-docs/fe_compiler_test_utils/trait.ToBeBytes.html new file mode 100644 index 0000000000..6809b229e9 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/trait.ToBeBytes.html @@ -0,0 +1,4 @@ +ToBeBytes in fe_compiler_test_utils - Rust

Trait ToBeBytes

Source
pub trait ToBeBytes {
+    // Required method
+    fn to_be_bytes(&self) -> [u8; 32];
+}

Required Methods§

Source

fn to_be_bytes(&self) -> [u8; 32]

Implementations on Foreign Types§

Source§

impl ToBeBytes for U256

Source§

fn to_be_bytes(&self) -> [u8; 32]

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/type.Backend.html b/compiler-docs/fe_compiler_test_utils/type.Backend.html new file mode 100644 index 0000000000..6340948d78 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/type.Backend.html @@ -0,0 +1 @@ +Backend in fe_compiler_test_utils - Rust

Type Alias Backend

Source
pub type Backend<'a> = MemoryBackend<'a>;

Aliased Type§

pub struct Backend<'a> { /* private fields */ }
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/type.Executor.html b/compiler-docs/fe_compiler_test_utils/type.Executor.html new file mode 100644 index 0000000000..26753627d5 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/type.Executor.html @@ -0,0 +1 @@ +Executor in fe_compiler_test_utils - Rust

Type Alias Executor

Source
pub type Executor<'a, 'b> = StackExecutor<'a, 'b, StackState<'a>, ()>;

Aliased Type§

pub struct Executor<'a, 'b> { /* private fields */ }
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_test_utils/type.StackState.html b/compiler-docs/fe_compiler_test_utils/type.StackState.html new file mode 100644 index 0000000000..1a6adc0de3 --- /dev/null +++ b/compiler-docs/fe_compiler_test_utils/type.StackState.html @@ -0,0 +1 @@ +StackState in fe_compiler_test_utils - Rust

Type Alias StackState

Source
pub type StackState<'a> = MemoryStackState<'a, 'a, Backend<'a>>;

Aliased Type§

pub struct StackState<'a> { /* private fields */ }
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_tests/all.html b/compiler-docs/fe_compiler_tests/all.html new file mode 100644 index 0000000000..16f71b01c1 --- /dev/null +++ b/compiler-docs/fe_compiler_tests/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_tests/index.html b/compiler-docs/fe_compiler_tests/index.html new file mode 100644 index 0000000000..4ba358bfb4 --- /dev/null +++ b/compiler-docs/fe_compiler_tests/index.html @@ -0,0 +1 @@ +fe_compiler_tests - Rust

Crate fe_compiler_tests

Source
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_tests/sidebar-items.js b/compiler-docs/fe_compiler_tests/sidebar-items.js new file mode 100644 index 0000000000..5244ce01cc --- /dev/null +++ b/compiler-docs/fe_compiler_tests/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {}; \ No newline at end of file diff --git a/compiler-docs/fe_compiler_tests_legacy/all.html b/compiler-docs/fe_compiler_tests_legacy/all.html new file mode 100644 index 0000000000..7ecc0ba639 --- /dev/null +++ b/compiler-docs/fe_compiler_tests_legacy/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

\ No newline at end of file diff --git a/compiler-docs/fe_compiler_tests_legacy/index.html b/compiler-docs/fe_compiler_tests_legacy/index.html new file mode 100644 index 0000000000..1e573826d2 --- /dev/null +++ b/compiler-docs/fe_compiler_tests_legacy/index.html @@ -0,0 +1 @@ +fe_compiler_tests_legacy - Rust

Crate fe_compiler_tests_legacy

Source
\ No newline at end of file diff --git a/compiler-docs/fe_compiler_tests_legacy/sidebar-items.js b/compiler-docs/fe_compiler_tests_legacy/sidebar-items.js new file mode 100644 index 0000000000..5244ce01cc --- /dev/null +++ b/compiler-docs/fe_compiler_tests_legacy/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {}; \ No newline at end of file diff --git a/compiler-docs/fe_driver/all.html b/compiler-docs/fe_driver/all.html new file mode 100644 index 0000000000..dfd00c6f60 --- /dev/null +++ b/compiler-docs/fe_driver/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/compiler-docs/fe_driver/fn.check_ingot.html b/compiler-docs/fe_driver/fn.check_ingot.html new file mode 100644 index 0000000000..9687a30bee --- /dev/null +++ b/compiler-docs/fe_driver/fn.check_ingot.html @@ -0,0 +1 @@ +check_ingot in fe_driver - Rust

Function check_ingot

Source
pub fn check_ingot(db: &mut Db, build_files: &BuildFiles) -> Vec<Diagnostic>
\ No newline at end of file diff --git a/compiler-docs/fe_driver/fn.check_single_file.html b/compiler-docs/fe_driver/fn.check_single_file.html new file mode 100644 index 0000000000..378ac4d7fe --- /dev/null +++ b/compiler-docs/fe_driver/fn.check_single_file.html @@ -0,0 +1 @@ +check_single_file in fe_driver - Rust

Function check_single_file

Source
pub fn check_single_file(db: &mut Db, path: &str, src: &str) -> Vec<Diagnostic>
\ No newline at end of file diff --git a/compiler-docs/fe_driver/fn.compile_ingot.html b/compiler-docs/fe_driver/fn.compile_ingot.html new file mode 100644 index 0000000000..d3e7ddfc29 --- /dev/null +++ b/compiler-docs/fe_driver/fn.compile_ingot.html @@ -0,0 +1,10 @@ +compile_ingot in fe_driver - Rust

Function compile_ingot

Source
pub fn compile_ingot(
+    db: &mut Db,
+    build_files: &BuildFiles,
+    with_bytecode: bool,
+    with_runtime_bytecode: bool,
+    optimize: bool,
+) -> Result<CompiledModule, CompileError>
Expand description

Compiles the main module of a project.

+

If with_bytecode is set to false, the compiler will skip the final Yul -> +Bytecode pass. This is useful when debugging invalid Yul code.

+
\ No newline at end of file diff --git a/compiler-docs/fe_driver/fn.compile_single_file.html b/compiler-docs/fe_driver/fn.compile_single_file.html new file mode 100644 index 0000000000..7437677f56 --- /dev/null +++ b/compiler-docs/fe_driver/fn.compile_single_file.html @@ -0,0 +1,8 @@ +compile_single_file in fe_driver - Rust

Function compile_single_file

Source
pub fn compile_single_file(
+    db: &mut Db,
+    path: &str,
+    src: &str,
+    with_bytecode: bool,
+    with_runtime_bytecode: bool,
+    optimize: bool,
+) -> Result<CompiledModule, CompileError>
\ No newline at end of file diff --git a/compiler-docs/fe_driver/fn.dump_mir_single_file.html b/compiler-docs/fe_driver/fn.dump_mir_single_file.html new file mode 100644 index 0000000000..31c8f5e8a1 --- /dev/null +++ b/compiler-docs/fe_driver/fn.dump_mir_single_file.html @@ -0,0 +1,6 @@ +dump_mir_single_file in fe_driver - Rust

Function dump_mir_single_file

Source
pub fn dump_mir_single_file(
+    db: &mut Db,
+    path: &str,
+    src: &str,
+) -> Result<String, CompileError>
Expand description

Returns graphviz string.

+
\ No newline at end of file diff --git a/compiler-docs/fe_driver/index.html b/compiler-docs/fe_driver/index.html new file mode 100644 index 0000000000..c413065619 --- /dev/null +++ b/compiler-docs/fe_driver/index.html @@ -0,0 +1 @@ +fe_driver - Rust

Crate fe_driver

Source

Structs§

CompileError
CompiledContract
The artifacts of a compiled contract.
CompiledModule
The artifacts of a compiled module.
Db

Traits§

CodegenDb

Functions§

check_ingot
check_single_file
compile_ingot
Compiles the main module of a project.
compile_single_file
dump_mir_single_file
Returns graphviz string.
\ No newline at end of file diff --git a/compiler-docs/fe_driver/sidebar-items.js b/compiler-docs/fe_driver/sidebar-items.js new file mode 100644 index 0000000000..742ac793e3 --- /dev/null +++ b/compiler-docs/fe_driver/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["check_ingot","check_single_file","compile_ingot","compile_single_file","dump_mir_single_file"],"struct":["CompileError","CompiledContract","CompiledModule","Db"],"trait":["CodegenDb"]}; \ No newline at end of file diff --git a/compiler-docs/fe_driver/struct.CompileError.html b/compiler-docs/fe_driver/struct.CompileError.html new file mode 100644 index 0000000000..ecd3d9103e --- /dev/null +++ b/compiler-docs/fe_driver/struct.CompileError.html @@ -0,0 +1,91 @@ +CompileError in fe_driver - Rust

Struct CompileError

Source
pub struct CompileError(pub Vec<Diagnostic>);

Tuple Fields§

§0: Vec<Diagnostic>

Trait Implementations§

Source§

impl Debug for CompileError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe_driver/struct.CompiledContract.html b/compiler-docs/fe_driver/struct.CompiledContract.html new file mode 100644 index 0000000000..30d2cfc3cf --- /dev/null +++ b/compiler-docs/fe_driver/struct.CompiledContract.html @@ -0,0 +1,96 @@ +CompiledContract in fe_driver - Rust

Struct CompiledContract

Source
pub struct CompiledContract {
+    pub json_abi: String,
+    pub yul: String,
+    pub origin: ContractId,
+}
Expand description

The artifacts of a compiled contract.

+

Fields§

§json_abi: String§yul: String§origin: ContractId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe_driver/struct.CompiledModule.html b/compiler-docs/fe_driver/struct.CompiledModule.html new file mode 100644 index 0000000000..db442bc9c2 --- /dev/null +++ b/compiler-docs/fe_driver/struct.CompiledModule.html @@ -0,0 +1,96 @@ +CompiledModule in fe_driver - Rust

Struct CompiledModule

Source
pub struct CompiledModule {
+    pub src_ast: String,
+    pub lowered_ast: String,
+    pub contracts: IndexMap<String, CompiledContract>,
+}
Expand description

The artifacts of a compiled module.

+

Fields§

§src_ast: String§lowered_ast: String§contracts: IndexMap<String, CompiledContract>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe_driver/struct.Db.html b/compiler-docs/fe_driver/struct.Db.html new file mode 100644 index 0000000000..a89b27e003 --- /dev/null +++ b/compiler-docs/fe_driver/struct.Db.html @@ -0,0 +1,210 @@ +Db in fe_driver - Rust

Struct Db

pub struct Db { /* private fields */ }

Trait Implementations§

§

impl Database for Db

§

fn sweep_all(&self, strategy: SweepStrategy)

Iterates through all query storage and removes any values that +have not been used since the last revision was created. The +intended use-cycle is that you first execute all of your +“main” queries; this will ensure that all query values they +consume are marked as used. You then invoke this method to +remove other values that were not needed for your main query +results.
§

fn salsa_event(&self, event_fn: Event)

This function is invoked at key points in the salsa +runtime. It permits the database to be customized and to +inject logging or other custom behavior.
§

fn on_propagated_panic(&self) -> !

This function is invoked when a dependent query is being computed by the +other thread, and that thread panics.
§

fn salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.
§

fn salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.
§

impl Default for Db

§

fn default() -> Db

Returns the “default value” for a type. Read more
§

impl Upcast<dyn AnalyzerDb> for Db

§

fn upcast(&self) -> &(dyn AnalyzerDb + 'static)

§

impl Upcast<dyn MirDb> for Db

§

fn upcast(&self) -> &(dyn MirDb + 'static)

§

impl Upcast<dyn SourceDb> for Db

§

fn upcast(&self) -> &(dyn SourceDb + 'static)

§

impl UpcastMut<dyn AnalyzerDb> for Db

§

fn upcast_mut(&mut self) -> &mut (dyn AnalyzerDb + 'static)

§

impl UpcastMut<dyn MirDb> for Db

§

fn upcast_mut(&mut self) -> &mut (dyn MirDb + 'static)

§

impl UpcastMut<dyn SourceDb> for Db

§

fn upcast_mut(&mut self) -> &mut (dyn SourceDb + 'static)

Auto Trait Implementations§

§

impl !Freeze for Db

§

impl RefUnwindSafe for Db

§

impl !Send for Db

§

impl !Sync for Db

§

impl Unpin for Db

§

impl UnwindSafe for Db

Blanket Implementations§

§

impl<DB> AnalyzerDb for DB
where + DB: SourceDb + Upcast<dyn SourceDb> + UpcastMut<dyn SourceDb> + Database + HasQueryGroup<AnalyzerDbStorage>,

§

fn intern_ingot(&self, key0: Rc<Ingot>) -> IngotId

§

fn lookup_intern_ingot(&self, key0: IngotId) -> Rc<Ingot>

§

fn intern_module(&self, key0: Rc<Module>) -> ModuleId

§

fn lookup_intern_module(&self, key0: ModuleId) -> Rc<Module>

§

fn intern_module_const(&self, key0: Rc<ModuleConstant>) -> ModuleConstantId

§

fn lookup_intern_module_const( + &self, + key0: ModuleConstantId, +) -> Rc<ModuleConstant>

§

fn intern_struct(&self, key0: Rc<Struct>) -> StructId

§

fn lookup_intern_struct(&self, key0: StructId) -> Rc<Struct>

§

fn intern_struct_field(&self, key0: Rc<StructField>) -> StructFieldId

§

fn lookup_intern_struct_field(&self, key0: StructFieldId) -> Rc<StructField>

§

fn intern_enum(&self, key0: Rc<Enum>) -> EnumId

§

fn lookup_intern_enum(&self, key0: EnumId) -> Rc<Enum>

§

fn intern_attribute(&self, key0: Rc<Attribute>) -> AttributeId

§

fn lookup_intern_attribute(&self, key0: AttributeId) -> Rc<Attribute>

§

fn intern_enum_variant(&self, key0: Rc<EnumVariant>) -> EnumVariantId

§

fn lookup_intern_enum_variant(&self, key0: EnumVariantId) -> Rc<EnumVariant>

§

fn intern_trait(&self, key0: Rc<Trait>) -> TraitId

§

fn lookup_intern_trait(&self, key0: TraitId) -> Rc<Trait>

§

fn intern_impl(&self, key0: Rc<Impl>) -> ImplId

§

fn lookup_intern_impl(&self, key0: ImplId) -> Rc<Impl>

§

fn intern_type_alias(&self, key0: Rc<TypeAlias>) -> TypeAliasId

§

fn lookup_intern_type_alias(&self, key0: TypeAliasId) -> Rc<TypeAlias>

§

fn intern_contract(&self, key0: Rc<Contract>) -> ContractId

§

fn lookup_intern_contract(&self, key0: ContractId) -> Rc<Contract>

§

fn intern_contract_field(&self, key0: Rc<ContractField>) -> ContractFieldId

§

fn lookup_intern_contract_field( + &self, + key0: ContractFieldId, +) -> Rc<ContractField>

§

fn intern_function_sig(&self, key0: Rc<FunctionSig>) -> FunctionSigId

§

fn lookup_intern_function_sig(&self, key0: FunctionSigId) -> Rc<FunctionSig>

§

fn intern_function(&self, key0: Rc<Function>) -> FunctionId

§

fn lookup_intern_function(&self, key0: FunctionId) -> Rc<Function>

§

fn intern_type(&self, key0: Type) -> TypeId

§

fn lookup_intern_type(&self, key0: TypeId) -> Type

§

fn ingot_files(&self, key0: IngotId) -> Rc<[SourceFileId]>

§

fn set_ingot_files(&mut self, key0: IngotId, value__: Rc<[SourceFileId]>)

Set the value of the ingot_files input. Read more
§

fn set_ingot_files_with_durability( + &mut self, + key0: IngotId, + value__: Rc<[SourceFileId]>, + durability__: Durability, +)

Set the value of the ingot_files input and promise +that its value will never change again. Read more
§

fn ingot_external_ingots(&self, key0: IngotId) -> Rc<IndexMap<SmolStr, IngotId>>

§

fn set_ingot_external_ingots( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, +)

Set the value of the ingot_external_ingots input. Read more
§

fn set_ingot_external_ingots_with_durability( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, + durability__: Durability, +)

Set the value of the ingot_external_ingots input and promise +that its value will never change again. Read more
§

fn root_ingot(&self) -> IngotId

§

fn set_root_ingot(&mut self, value__: IngotId)

Set the value of the root_ingot input. Read more
§

fn set_root_ingot_with_durability( + &mut self, + value__: IngotId, + durability__: Durability, +)

Set the value of the root_ingot input and promise +that its value will never change again. Read more
§

fn ingot_modules(&self, key0: IngotId) -> Rc<[ModuleId]>

§

fn ingot_root_module(&self, key0: IngotId) -> Option<ModuleId>

§

fn module_file_path(&self, key0: ModuleId) -> SmolStr

§

fn module_parse(&self, key0: ModuleId) -> Analysis<Rc<Module>>

§

fn module_is_incomplete(&self, key0: ModuleId) -> bool

§

fn module_all_items(&self, key0: ModuleId) -> Rc<[Item]>

§

fn module_all_impls(&self, key0: ModuleId) -> Analysis<Rc<[ImplId]>>

§

fn module_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, Item>>>

§

fn module_impl_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<(TraitId, TypeId), ImplId>>>

§

fn module_contracts(&self, key0: ModuleId) -> Rc<[ContractId]>

§

fn module_structs(&self, key0: ModuleId) -> Rc<[StructId]>

§

fn module_constants(&self, key0: ModuleId) -> Rc<Vec<ModuleConstantId>>

§

fn module_used_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>>

§

fn module_parent_module(&self, key0: ModuleId) -> Option<ModuleId>

§

fn module_submodules(&self, key0: ModuleId) -> Rc<[ModuleId]>

§

fn module_tests(&self, key0: ModuleId) -> Vec<FunctionId>

§

fn module_constant_type( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<TypeId, TypeError>>

§

fn module_constant_value( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<Constant, ConstEvalError>>

§

fn contract_all_functions(&self, key0: ContractId) -> Rc<[FunctionId]>

§

fn contract_function_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn contract_public_function_map( + &self, + key0: ContractId, +) -> Rc<IndexMap<SmolStr, FunctionId>>

§

fn contract_init_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

§

fn contract_call_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

§

fn contract_all_fields(&self, key0: ContractId) -> Rc<[ContractFieldId]>

§

fn contract_field_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, ContractFieldId>>>

§

fn contract_field_type( + &self, + key0: ContractFieldId, +) -> Analysis<Result<TypeId, TypeError>>

§

fn contract_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

§

fn contract_runtime_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

§

fn function_signature( + &self, + key0: FunctionSigId, +) -> Analysis<Rc<FunctionSignature>>

§

fn function_body(&self, key0: FunctionId) -> Analysis<Rc<FunctionBody>>

§

fn function_dependency_graph(&self, key0: FunctionId) -> DepGraphWrapper

§

fn struct_all_fields(&self, key0: StructId) -> Rc<[StructFieldId]>

§

fn struct_field_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, StructFieldId>>>

§

fn struct_field_type( + &self, + key0: StructFieldId, +) -> Analysis<Result<TypeId, TypeError>>

§

fn struct_all_functions(&self, key0: StructId) -> Rc<[FunctionId]>

§

fn struct_function_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn struct_dependency_graph(&self, key0: StructId) -> Analysis<DepGraphWrapper>

§

fn enum_all_variants(&self, key0: EnumId) -> Rc<[EnumVariantId]>

§

fn enum_variant_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, EnumVariantId>>>

§

fn enum_all_functions(&self, key0: EnumId) -> Rc<[FunctionId]>

§

fn enum_function_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn enum_dependency_graph(&self, key0: EnumId) -> Analysis<DepGraphWrapper>

§

fn enum_variant_kind( + &self, + key0: EnumVariantId, +) -> Analysis<Result<EnumVariantKind, TypeError>>

§

fn trait_all_functions(&self, key0: TraitId) -> Rc<[FunctionSigId]>

§

fn trait_function_map( + &self, + key0: TraitId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionSigId>>>

§

fn trait_is_implemented_for(&self, key0: TraitId, key1: TypeId) -> bool

§

fn impl_all_functions(&self, key0: ImplId) -> Rc<[FunctionId]>

§

fn impl_function_map( + &self, + key0: ImplId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn all_impls(&self, key0: TypeId) -> Rc<[ImplId]>

§

fn impl_for(&self, key0: TypeId, key1: TraitId) -> Option<ImplId>

§

fn function_sigs(&self, key0: TypeId, key1: SmolStr) -> Rc<[FunctionSigId]>

§

fn type_alias_type( + &self, + key0: TypeAliasId, +) -> Analysis<Result<TypeId, TypeError>>

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<DB> CodegenDb for DB
where + DB: MirDb + Upcast<dyn MirDb> + UpcastMut<dyn MirDb> + Database + HasQueryGroup<CodegenDbStorage>,

§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<DB> MirDb for DB
where + DB: AnalyzerDb + Upcast<dyn AnalyzerDb> + UpcastMut<dyn AnalyzerDb> + Database + HasQueryGroup<MirDbStorage>,

§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<DB> SourceDb for DB
where + DB: Database + HasQueryGroup<SourceDbStorage>,

Source§

fn intern_file(&self, key0: File) -> SourceFileId

Source§

fn lookup_intern_file(&self, key0: SourceFileId) -> File

Source§

fn file_content(&self, key0: SourceFileId) -> Rc<str>

Set with `fn set_file_content(&mut self, file: SourceFileId, content: Rc)
Source§

fn set_file_content(&mut self, key0: SourceFileId, value__: Rc<str>)

Set the value of the file_content input. Read more
Source§

fn set_file_content_with_durability( + &mut self, + key0: SourceFileId, + value__: Rc<str>, + durability__: Durability, +)

Set the value of the file_content input and promise +that its value will never change again. Read more
Source§

fn file_line_starts(&self, key0: SourceFileId) -> Rc<[usize]>

Source§

fn file_name(&self, key0: SourceFileId) -> SmolStr

§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe_driver/trait.CodegenDb.html b/compiler-docs/fe_driver/trait.CodegenDb.html new file mode 100644 index 0000000000..cd53280ad6 --- /dev/null +++ b/compiler-docs/fe_driver/trait.CodegenDb.html @@ -0,0 +1,37 @@ +CodegenDb in fe_driver - Rust

Trait CodegenDb

pub trait CodegenDb:
+    Database
+    + HasQueryGroup<CodegenDbStorage>
+    + MirDb
+    + Upcast<dyn MirDb>
+    + UpcastMut<dyn MirDb> {
+
Show 16 methods // Required methods + fn codegen_legalized_signature( + &self, + key0: FunctionId, + ) -> Rc<FunctionSignature>; + fn codegen_legalized_body(&self, key0: FunctionId) -> Rc<FunctionBody>; + fn codegen_function_symbol_name(&self, key0: FunctionId) -> Rc<String>; + fn codegen_legalized_type(&self, key0: TypeId) -> TypeId; + fn codegen_abi_type(&self, key0: TypeId) -> AbiType; + fn codegen_abi_function(&self, key0: FunctionId) -> AbiFunction; + fn codegen_abi_event(&self, key0: TypeId) -> AbiEvent; + fn codegen_abi_contract(&self, key0: ContractId) -> AbiContract; + fn codegen_abi_module_events(&self, key0: ModuleId) -> Vec<AbiEvent>; + fn codegen_abi_type_maximum_size(&self, key0: TypeId) -> usize; + fn codegen_abi_type_minimum_size(&self, key0: TypeId) -> usize; + fn codegen_abi_function_argument_maximum_size( + &self, + key0: FunctionId, + ) -> usize; + fn codegen_abi_function_return_maximum_size( + &self, + key0: FunctionId, + ) -> usize; + fn codegen_contract_symbol_name(&self, key0: ContractId) -> Rc<String>; + fn codegen_contract_deployer_symbol_name( + &self, + key0: ContractId, + ) -> Rc<String>; + fn codegen_constant_string_symbol_name(&self, key0: String) -> Rc<String>; +
}

Required Methods§

Implementors§

§

impl<DB> CodegenDb for DB
where + DB: MirDb + Upcast<dyn MirDb> + UpcastMut<dyn MirDb> + Database + HasQueryGroup<CodegenDbStorage>,

\ No newline at end of file diff --git a/compiler-docs/fe_library/all.html b/compiler-docs/fe_library/all.html new file mode 100644 index 0000000000..456cf3aa87 --- /dev/null +++ b/compiler-docs/fe_library/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Functions

Constants

\ No newline at end of file diff --git a/compiler-docs/fe_library/constant.STD.html b/compiler-docs/fe_library/constant.STD.html new file mode 100644 index 0000000000..bda11b4880 --- /dev/null +++ b/compiler-docs/fe_library/constant.STD.html @@ -0,0 +1 @@ +STD in fe_library - Rust

Constant STD

Source
pub const STD: Dir<'_>;
\ No newline at end of file diff --git a/compiler-docs/fe_library/fn.static_dir_files.html b/compiler-docs/fe_library/fn.static_dir_files.html new file mode 100644 index 0000000000..d14ac89816 --- /dev/null +++ b/compiler-docs/fe_library/fn.static_dir_files.html @@ -0,0 +1,3 @@ +static_dir_files in fe_library - Rust

Function static_dir_files

Source
pub fn static_dir_files(
+    dir: &'static Dir<'_>,
+) -> Vec<(&'static str, &'static str)>
\ No newline at end of file diff --git a/compiler-docs/fe_library/fn.std_src_files.html b/compiler-docs/fe_library/fn.std_src_files.html new file mode 100644 index 0000000000..e92c15d9ea --- /dev/null +++ b/compiler-docs/fe_library/fn.std_src_files.html @@ -0,0 +1 @@ +std_src_files in fe_library - Rust

Function std_src_files

Source
pub fn std_src_files() -> Vec<(&'static str, &'static str)>
\ No newline at end of file diff --git a/compiler-docs/fe_library/index.html b/compiler-docs/fe_library/index.html new file mode 100644 index 0000000000..b165d60e6a --- /dev/null +++ b/compiler-docs/fe_library/index.html @@ -0,0 +1 @@ +fe_library - Rust

Crate fe_library

Source

Re-exports§

pub use ::include_dir;

Constants§

STD

Functions§

static_dir_files
std_src_files
\ No newline at end of file diff --git a/compiler-docs/fe_library/sidebar-items.js b/compiler-docs/fe_library/sidebar-items.js new file mode 100644 index 0000000000..93c2f1794f --- /dev/null +++ b/compiler-docs/fe_library/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["STD"],"fn":["static_dir_files","std_src_files"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/all.html b/compiler-docs/fe_mir/all.html new file mode 100644 index 0000000000..9c8df6ec82 --- /dev/null +++ b/compiler-docs/fe_mir/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Structs

Enums

Traits

Functions

Type Aliases

\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/cfg/index.html b/compiler-docs/fe_mir/analysis/cfg/index.html new file mode 100644 index 0000000000..c0c908c146 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/cfg/index.html @@ -0,0 +1 @@ +fe_mir::analysis::cfg - Rust

Module cfg

Source

Structs§

CfgPostOrder
ControlFlowGraph
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/cfg/sidebar-items.js b/compiler-docs/fe_mir/analysis/cfg/sidebar-items.js new file mode 100644 index 0000000000..3b53904b73 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/cfg/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["CfgPostOrder","ControlFlowGraph"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/cfg/struct.CfgPostOrder.html b/compiler-docs/fe_mir/analysis/cfg/struct.CfgPostOrder.html new file mode 100644 index 0000000000..c36ddc1305 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/cfg/struct.CfgPostOrder.html @@ -0,0 +1,209 @@ +CfgPostOrder in fe_mir::analysis::cfg - Rust

Struct CfgPostOrder

Source
pub struct CfgPostOrder<'a> { /* private fields */ }

Trait Implementations§

Source§

impl<'a> Iterator for CfgPostOrder<'a>

Source§

type Item = Id<BasicBlock>

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<BasicBlockId>

Advances the iterator and returns the next value. Read more
Source§

fn next_chunk<const N: usize>( + &mut self, +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · Source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · Source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.29.0 · Source§

fn flatten(self) -> Flatten<Self>
where + Self: Sized, + Self::Item: IntoIterator,

Creates an iterator that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn try_collect<B>( + &mut self, +) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
where + Self: Sized, + Self::Item: Try, + <Self::Item as Try>::Residual: Residual<B>, + B: FromIterator<<Self::Item as Try>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect)
Fallibly transforms an iterator into a collection, short circuiting if +a failure is encountered. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
Source§

fn try_reduce<R>( + &mut self, + f: impl FnMut(Self::Item, Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
Source§

fn try_find<R>( + &mut self, + f: impl FnMut(&Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: Copy + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: Clone + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for CfgPostOrder<'a>

§

impl<'a> RefUnwindSafe for CfgPostOrder<'a>

§

impl<'a> Send for CfgPostOrder<'a>

§

impl<'a> Sync for CfgPostOrder<'a>

§

impl<'a> Unpin for CfgPostOrder<'a>

§

impl<'a> UnwindSafe for CfgPostOrder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<I> IntoIterator for I
where + I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/cfg/struct.ControlFlowGraph.html b/compiler-docs/fe_mir/analysis/cfg/struct.ControlFlowGraph.html new file mode 100644 index 0000000000..8db3152ae7 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/cfg/struct.ControlFlowGraph.html @@ -0,0 +1,20 @@ +ControlFlowGraph in fe_mir::analysis::cfg - Rust

Struct ControlFlowGraph

Source
pub struct ControlFlowGraph { /* private fields */ }

Implementations§

Source§

impl ControlFlowGraph

Source

pub fn compute(func: &FunctionBody) -> Self

Source

pub fn entry(&self) -> BasicBlockId

Source

pub fn preds(&self, block: BasicBlockId) -> &[BasicBlockId]

Source

pub fn succs(&self, block: BasicBlockId) -> &[BasicBlockId]

Source

pub fn post_order(&self) -> CfgPostOrder<'_>

Trait Implementations§

Source§

impl Clone for ControlFlowGraph

Source§

fn clone(&self) -> ControlFlowGraph

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ControlFlowGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ControlFlowGraph

Source§

fn eq(&self, other: &ControlFlowGraph) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for ControlFlowGraph

Source§

impl StructuralPartialEq for ControlFlowGraph

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/domtree/index.html b/compiler-docs/fe_mir/analysis/domtree/index.html new file mode 100644 index 0000000000..3e7b24321d --- /dev/null +++ b/compiler-docs/fe_mir/analysis/domtree/index.html @@ -0,0 +1,4 @@ +fe_mir::analysis::domtree - Rust

Module domtree

Source
Expand description

This module contains dominator tree related structs.

+

The algorithm is based on Keith D. Cooper., Timothy J. Harvey., and Ken +Kennedy.: A Simple, Fast Dominance Algorithm: https://www.cs.rice.edu/~keith/EMBED/dom.pdf

+

Structs§

DFSet
Dominance frontiers of each blocks.
DomTree
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/domtree/sidebar-items.js b/compiler-docs/fe_mir/analysis/domtree/sidebar-items.js new file mode 100644 index 0000000000..e91f8a7dfa --- /dev/null +++ b/compiler-docs/fe_mir/analysis/domtree/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["DFSet","DomTree"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/domtree/struct.DFSet.html b/compiler-docs/fe_mir/analysis/domtree/struct.DFSet.html new file mode 100644 index 0000000000..6056cee1b2 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/domtree/struct.DFSet.html @@ -0,0 +1,17 @@ +DFSet in fe_mir::analysis::domtree - Rust

Struct DFSet

Source
pub struct DFSet(/* private fields */);
Expand description

Dominance frontiers of each blocks.

+

Implementations§

Source§

impl DFSet

Source

pub fn frontiers( + &self, + block: BasicBlockId, +) -> Option<impl Iterator<Item = BasicBlockId> + '_>

Returns all dominance frontieres of a block.

+
Source

pub fn frontier_num(&self, block: BasicBlockId) -> usize

Returns number of frontier blocks of a block.

+

Trait Implementations§

Source§

impl Debug for DFSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DFSet

Source§

fn default() -> DFSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for DFSet

§

impl RefUnwindSafe for DFSet

§

impl Send for DFSet

§

impl Sync for DFSet

§

impl Unpin for DFSet

§

impl UnwindSafe for DFSet

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/domtree/struct.DomTree.html b/compiler-docs/fe_mir/analysis/domtree/struct.DomTree.html new file mode 100644 index 0000000000..f2dc405d4f --- /dev/null +++ b/compiler-docs/fe_mir/analysis/domtree/struct.DomTree.html @@ -0,0 +1,25 @@ +DomTree in fe_mir::analysis::domtree - Rust

Struct DomTree

Source
pub struct DomTree { /* private fields */ }

Implementations§

Source§

impl DomTree

Source

pub fn compute(cfg: &ControlFlowGraph) -> Self

Source

pub fn idom(&self, block: BasicBlockId) -> Option<BasicBlockId>

Returns the immediate dominator of the block. +Returns None if the block is unreachable from the entry block, or the +block is the entry block itself.

+
Source

pub fn strictly_dominates( + &self, + block1: BasicBlockId, + block2: BasicBlockId, +) -> bool

Returns true if block1 strictly dominates block2.

+
Source

pub fn dominates(&self, block1: BasicBlockId, block2: BasicBlockId) -> bool

Returns true if block1 dominates block2.

+
Source

pub fn is_reachable(&self, block: BasicBlockId) -> bool

Returns true if block is reachable from the entry block.

+
Source

pub fn rpo(&self) -> &[BasicBlockId]

Returns blocks in RPO.

+
Source

pub fn compute_df(&self, cfg: &ControlFlowGraph) -> DFSet

Compute dominance frontiers of each blocks.

+

Trait Implementations§

Source§

impl Clone for DomTree

Source§

fn clone(&self) -> DomTree

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DomTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/index.html b/compiler-docs/fe_mir/analysis/index.html new file mode 100644 index 0000000000..d69ba9b466 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/index.html @@ -0,0 +1 @@ +fe_mir::analysis - Rust

Module analysis

Source

Re-exports§

pub use cfg::ControlFlowGraph;
pub use domtree::DomTree;
pub use loop_tree::LoopTree;
pub use post_domtree::PostDomTree;

Modules§

cfg
domtree
This module contains dominator tree related structs.
loop_tree
post_domtree
This module contains implementation of Post Dominator Tree.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/loop_tree/index.html b/compiler-docs/fe_mir/analysis/loop_tree/index.html new file mode 100644 index 0000000000..5d694d77f0 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/loop_tree/index.html @@ -0,0 +1 @@ +fe_mir::analysis::loop_tree - Rust

Module loop_tree

Source

Structs§

BlocksInLoopPostOrder
Loop
LoopTree

Type Aliases§

LoopId
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/loop_tree/sidebar-items.js b/compiler-docs/fe_mir/analysis/loop_tree/sidebar-items.js new file mode 100644 index 0000000000..2c5cf81800 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/loop_tree/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["BlocksInLoopPostOrder","Loop","LoopTree"],"type":["LoopId"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/loop_tree/struct.BlocksInLoopPostOrder.html b/compiler-docs/fe_mir/analysis/loop_tree/struct.BlocksInLoopPostOrder.html new file mode 100644 index 0000000000..0d8b9bb3f4 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/loop_tree/struct.BlocksInLoopPostOrder.html @@ -0,0 +1,209 @@ +BlocksInLoopPostOrder in fe_mir::analysis::loop_tree - Rust

Struct BlocksInLoopPostOrder

Source
pub struct BlocksInLoopPostOrder<'a, 'b> { /* private fields */ }

Trait Implementations§

Source§

impl<'a, 'b> Iterator for BlocksInLoopPostOrder<'a, 'b>

Source§

type Item = Id<BasicBlock>

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
Source§

fn next_chunk<const N: usize>( + &mut self, +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · Source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · Source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.29.0 · Source§

fn flatten(self) -> Flatten<Self>
where + Self: Sized, + Self::Item: IntoIterator,

Creates an iterator that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn try_collect<B>( + &mut self, +) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
where + Self: Sized, + Self::Item: Try, + <Self::Item as Try>::Residual: Residual<B>, + B: FromIterator<<Self::Item as Try>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect)
Fallibly transforms an iterator into a collection, short circuiting if +a failure is encountered. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
Source§

fn try_reduce<R>( + &mut self, + f: impl FnMut(Self::Item, Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
Source§

fn try_find<R>( + &mut self, + f: impl FnMut(&Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: Copy + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: Clone + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for BlocksInLoopPostOrder<'a, 'b>

§

impl<'a, 'b> RefUnwindSafe for BlocksInLoopPostOrder<'a, 'b>

§

impl<'a, 'b> Send for BlocksInLoopPostOrder<'a, 'b>

§

impl<'a, 'b> Sync for BlocksInLoopPostOrder<'a, 'b>

§

impl<'a, 'b> Unpin for BlocksInLoopPostOrder<'a, 'b>

§

impl<'a, 'b> UnwindSafe for BlocksInLoopPostOrder<'a, 'b>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<I> IntoIterator for I
where + I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/loop_tree/struct.Loop.html b/compiler-docs/fe_mir/analysis/loop_tree/struct.Loop.html new file mode 100644 index 0000000000..45edf5afeb --- /dev/null +++ b/compiler-docs/fe_mir/analysis/loop_tree/struct.Loop.html @@ -0,0 +1,27 @@ +Loop in fe_mir::analysis::loop_tree - Rust

Struct Loop

Source
pub struct Loop {
+    pub header: BasicBlockId,
+    pub parent: Option<LoopId>,
+    pub children: Vec<LoopId>,
+}

Fields§

§header: BasicBlockId

A header of the loop.

+
§parent: Option<LoopId>

A parent loop that includes the loop.

+
§children: Vec<LoopId>

Child loops that the loop includes.

+

Trait Implementations§

Source§

impl Clone for Loop

Source§

fn clone(&self) -> Loop

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Loop

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Loop

Source§

fn eq(&self, other: &Loop) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Loop

Source§

impl StructuralPartialEq for Loop

Auto Trait Implementations§

§

impl Freeze for Loop

§

impl RefUnwindSafe for Loop

§

impl Send for Loop

§

impl Sync for Loop

§

impl Unpin for Loop

§

impl UnwindSafe for Loop

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/loop_tree/struct.LoopTree.html b/compiler-docs/fe_mir/analysis/loop_tree/struct.LoopTree.html new file mode 100644 index 0000000000..64294d9bb8 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/loop_tree/struct.LoopTree.html @@ -0,0 +1,27 @@ +LoopTree in fe_mir::analysis::loop_tree - Rust

Struct LoopTree

Source
pub struct LoopTree { /* private fields */ }

Implementations§

Source§

impl LoopTree

Source

pub fn compute(cfg: &ControlFlowGraph, domtree: &DomTree) -> Self

Source

pub fn iter_blocks_post_order<'a, 'b>( + &'a self, + cfg: &'b ControlFlowGraph, + lp: LoopId, +) -> BlocksInLoopPostOrder<'a, 'b>

Returns all blocks in the loop.

+
Source

pub fn loops(&self) -> impl Iterator<Item = LoopId> + '_

Returns all loops in a function body. +An outer loop is guaranteed to be iterated before its inner loops.

+
Source

pub fn loop_num(&self) -> usize

Returns number of loops found.

+
Source

pub fn is_block_in_loop(&self, block: BasicBlockId, lp: LoopId) -> bool

Returns true if the block is in the lp.

+
Source

pub fn loop_header(&self, lp: LoopId) -> BasicBlockId

Returns header block of the lp.

+
Source

pub fn parent_loop(&self, lp: LoopId) -> Option<LoopId>

Get parent loop of the lp if exists.

+
Source

pub fn loop_of_block(&self, block: BasicBlockId) -> Option<LoopId>

Returns the loop that the block belongs to. +If the block belongs to multiple loops, then returns the innermost +loop.

+

Trait Implementations§

Source§

impl Clone for LoopTree

Source§

fn clone(&self) -> LoopTree

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LoopTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LoopTree

Source§

fn default() -> LoopTree

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/loop_tree/type.LoopId.html b/compiler-docs/fe_mir/analysis/loop_tree/type.LoopId.html new file mode 100644 index 0000000000..7c55163770 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/loop_tree/type.LoopId.html @@ -0,0 +1 @@ +LoopId in fe_mir::analysis::loop_tree - Rust

Type Alias LoopId

Source
pub type LoopId = Id<Loop>;

Aliased Type§

pub struct LoopId { /* private fields */ }
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/post_domtree/enum.PostIDom.html b/compiler-docs/fe_mir/analysis/post_domtree/enum.PostIDom.html new file mode 100644 index 0000000000..494070de3a --- /dev/null +++ b/compiler-docs/fe_mir/analysis/post_domtree/enum.PostIDom.html @@ -0,0 +1,24 @@ +PostIDom in fe_mir::analysis::post_domtree - Rust

Enum PostIDom

Source
pub enum PostIDom {
+    DummyEntry,
+    DummyExit,
+    Block(BasicBlockId),
+}

Variants§

§

DummyEntry

§

DummyExit

§

Block(BasicBlockId)

Trait Implementations§

Source§

impl Clone for PostIDom

Source§

fn clone(&self) -> PostIDom

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PostIDom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PostIDom

Source§

fn eq(&self, other: &PostIDom) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for PostIDom

Source§

impl Eq for PostIDom

Source§

impl StructuralPartialEq for PostIDom

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/post_domtree/index.html b/compiler-docs/fe_mir/analysis/post_domtree/index.html new file mode 100644 index 0000000000..3ed8fc4a2d --- /dev/null +++ b/compiler-docs/fe_mir/analysis/post_domtree/index.html @@ -0,0 +1,2 @@ +fe_mir::analysis::post_domtree - Rust

Module post_domtree

Source
Expand description

This module contains implementation of Post Dominator Tree.

+

Structs§

PostDomTree

Enums§

PostIDom
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/post_domtree/sidebar-items.js b/compiler-docs/fe_mir/analysis/post_domtree/sidebar-items.js new file mode 100644 index 0000000000..be2c288fe1 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/post_domtree/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["PostIDom"],"struct":["PostDomTree"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/post_domtree/struct.PostDomTree.html b/compiler-docs/fe_mir/analysis/post_domtree/struct.PostDomTree.html new file mode 100644 index 0000000000..5504c775ad --- /dev/null +++ b/compiler-docs/fe_mir/analysis/post_domtree/struct.PostDomTree.html @@ -0,0 +1,12 @@ +PostDomTree in fe_mir::analysis::post_domtree - Rust

Struct PostDomTree

Source
pub struct PostDomTree { /* private fields */ }

Implementations§

Source§

impl PostDomTree

Source

pub fn compute(func: &FunctionBody) -> Self

Source

pub fn post_idom(&self, block: BasicBlockId) -> PostIDom

Source

pub fn is_reachable(&self, block: BasicBlockId) -> bool

Returns true if block is reachable from the exit blocks.

+

Trait Implementations§

Source§

impl Debug for PostDomTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/analysis/sidebar-items.js b/compiler-docs/fe_mir/analysis/sidebar-items.js new file mode 100644 index 0000000000..9a48888d34 --- /dev/null +++ b/compiler-docs/fe_mir/analysis/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["cfg","domtree","loop_tree","post_domtree"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/db/index.html b/compiler-docs/fe_mir/db/index.html new file mode 100644 index 0000000000..48f3e99882 --- /dev/null +++ b/compiler-docs/fe_mir/db/index.html @@ -0,0 +1 @@ +fe_mir::db - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/sidebar-items.js b/compiler-docs/fe_mir/db/sidebar-items.js new file mode 100644 index 0000000000..7064af42a5 --- /dev/null +++ b/compiler-docs/fe_mir/db/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["MirDbGroupStorage__","MirDbStorage","MirInternConstLookupQuery","MirInternConstQuery","MirInternFunctionLookupQuery","MirInternFunctionQuery","MirInternTypeLookupQuery","MirInternTypeQuery","MirLowerContractAllFunctionsQuery","MirLowerEnumAllFunctionsQuery","MirLowerModuleAllFunctionsQuery","MirLowerStructAllFunctionsQuery","MirLoweredConstantQuery","MirLoweredFuncBodyQuery","MirLoweredFuncSignatureQuery","MirLoweredMonomorphizedFuncSignatureQuery","MirLoweredPseudoMonomorphizedFuncSignatureQuery","MirLoweredTypeQuery","NewDb"],"trait":["MirDb"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirDbGroupStorage__.html b/compiler-docs/fe_mir/db/struct.MirDbGroupStorage__.html new file mode 100644 index 0000000000..4249ad5526 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirDbGroupStorage__.html @@ -0,0 +1,42 @@ +MirDbGroupStorage__ in fe_mir::db - Rust

Struct MirDbGroupStorage__

Source
pub struct MirDbGroupStorage__ {
Show 16 fields + pub mir_intern_const: Arc<<MirInternConstQuery as Query>::Storage>, + pub lookup_mir_intern_const: Arc<<MirInternConstLookupQuery as Query>::Storage>, + pub mir_intern_type: Arc<<MirInternTypeQuery as Query>::Storage>, + pub lookup_mir_intern_type: Arc<<MirInternTypeLookupQuery as Query>::Storage>, + pub mir_intern_function: Arc<<MirInternFunctionQuery as Query>::Storage>, + pub lookup_mir_intern_function: Arc<<MirInternFunctionLookupQuery as Query>::Storage>, + pub mir_lower_module_all_functions: Arc<<MirLowerModuleAllFunctionsQuery as Query>::Storage>, + pub mir_lower_contract_all_functions: Arc<<MirLowerContractAllFunctionsQuery as Query>::Storage>, + pub mir_lower_struct_all_functions: Arc<<MirLowerStructAllFunctionsQuery as Query>::Storage>, + pub mir_lower_enum_all_functions: Arc<<MirLowerEnumAllFunctionsQuery as Query>::Storage>, + pub mir_lowered_type: Arc<<MirLoweredTypeQuery as Query>::Storage>, + pub mir_lowered_constant: Arc<<MirLoweredConstantQuery as Query>::Storage>, + pub mir_lowered_func_signature: Arc<<MirLoweredFuncSignatureQuery as Query>::Storage>, + pub mir_lowered_monomorphized_func_signature: Arc<<MirLoweredMonomorphizedFuncSignatureQuery as Query>::Storage>, + pub mir_lowered_pseudo_monomorphized_func_signature: Arc<<MirLoweredPseudoMonomorphizedFuncSignatureQuery as Query>::Storage>, + pub mir_lowered_func_body: Arc<<MirLoweredFuncBodyQuery as Query>::Storage>, +
}

Fields§

§mir_intern_const: Arc<<MirInternConstQuery as Query>::Storage>§lookup_mir_intern_const: Arc<<MirInternConstLookupQuery as Query>::Storage>§mir_intern_type: Arc<<MirInternTypeQuery as Query>::Storage>§lookup_mir_intern_type: Arc<<MirInternTypeLookupQuery as Query>::Storage>§mir_intern_function: Arc<<MirInternFunctionQuery as Query>::Storage>§lookup_mir_intern_function: Arc<<MirInternFunctionLookupQuery as Query>::Storage>§mir_lower_module_all_functions: Arc<<MirLowerModuleAllFunctionsQuery as Query>::Storage>§mir_lower_contract_all_functions: Arc<<MirLowerContractAllFunctionsQuery as Query>::Storage>§mir_lower_struct_all_functions: Arc<<MirLowerStructAllFunctionsQuery as Query>::Storage>§mir_lower_enum_all_functions: Arc<<MirLowerEnumAllFunctionsQuery as Query>::Storage>§mir_lowered_type: Arc<<MirLoweredTypeQuery as Query>::Storage>§mir_lowered_constant: Arc<<MirLoweredConstantQuery as Query>::Storage>§mir_lowered_func_signature: Arc<<MirLoweredFuncSignatureQuery as Query>::Storage>§mir_lowered_monomorphized_func_signature: Arc<<MirLoweredMonomorphizedFuncSignatureQuery as Query>::Storage>§mir_lowered_pseudo_monomorphized_func_signature: Arc<<MirLoweredPseudoMonomorphizedFuncSignatureQuery as Query>::Storage>§mir_lowered_func_body: Arc<<MirLoweredFuncBodyQuery as Query>::Storage>

Implementations§

Source§

impl MirDbGroupStorage__

Source

pub fn new(group_index: u16) -> Self

Source§

impl MirDbGroupStorage__

Source

pub fn fmt_index( + &self, + db: &(dyn MirDb + '_), + input: DatabaseKeyIndex, + fmt: &mut Formatter<'_>, +) -> Result

Source

pub fn maybe_changed_since( + &self, + db: &(dyn MirDb + '_), + input: DatabaseKeyIndex, + revision: Revision, +) -> bool

Source

pub fn for_each_query( + &self, + _runtime: &Runtime, + op: &mut dyn FnMut(&dyn QueryStorageMassOps), +)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirDbStorage.html b/compiler-docs/fe_mir/db/struct.MirDbStorage.html new file mode 100644 index 0000000000..137d60a809 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirDbStorage.html @@ -0,0 +1,12 @@ +MirDbStorage in fe_mir::db - Rust

Struct MirDbStorage

Source
pub struct MirDbStorage {}
Expand description

Representative struct for the query group.

+

Trait Implementations§

Source§

impl HasQueryGroup<MirDbStorage> for NewDb

Source§

fn group_storage(&self) -> &<MirDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl QueryGroup for MirDbStorage

Source§

type DynDb = dyn MirDb

Dyn version of the associated database trait.
Source§

type GroupStorage = MirDbGroupStorage__

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirInternConstLookupQuery.html b/compiler-docs/fe_mir/db/struct.MirInternConstLookupQuery.html new file mode 100644 index 0000000000..040e130c70 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirInternConstLookupQuery.html @@ -0,0 +1,39 @@ +MirInternConstLookupQuery in fe_mir::db - Rust

Struct MirInternConstLookupQuery

Source
pub struct MirInternConstLookupQuery;

Implementations§

Source§

impl MirInternConstLookupQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirInternConstLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirInternConstLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirInternConstLookupQuery

Source§

fn default() -> MirInternConstLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirInternConstLookupQuery

Source§

const QUERY_INDEX: u16 = 1u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_mir_intern_const"

Name of the query method (e.g., foo)
Source§

type Key = ConstantId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Constant>

What value does the query return?
Source§

type Storage = LookupInternedStorage<MirInternConstLookupQuery, MirInternConstQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirInternConstLookupQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirInternConstQuery.html b/compiler-docs/fe_mir/db/struct.MirInternConstQuery.html new file mode 100644 index 0000000000..c69327e0b8 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirInternConstQuery.html @@ -0,0 +1,39 @@ +MirInternConstQuery in fe_mir::db - Rust

Struct MirInternConstQuery

Source
pub struct MirInternConstQuery;

Implementations§

Source§

impl MirInternConstQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirInternConstQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirInternConstQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirInternConstQuery

Source§

fn default() -> MirInternConstQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirInternConstQuery

Source§

const QUERY_INDEX: u16 = 0u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_intern_const"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Constant>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = ConstantId

What value does the query return?
Source§

type Storage = InternedStorage<MirInternConstQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirInternConstQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirInternFunctionLookupQuery.html b/compiler-docs/fe_mir/db/struct.MirInternFunctionLookupQuery.html new file mode 100644 index 0000000000..7ba92e6ec5 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirInternFunctionLookupQuery.html @@ -0,0 +1,39 @@ +MirInternFunctionLookupQuery in fe_mir::db - Rust

Struct MirInternFunctionLookupQuery

Source
pub struct MirInternFunctionLookupQuery;

Implementations§

Source§

impl MirInternFunctionLookupQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirInternFunctionLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirInternFunctionLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirInternFunctionLookupQuery

Source§

fn default() -> MirInternFunctionLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirInternFunctionLookupQuery

Source§

const QUERY_INDEX: u16 = 5u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_mir_intern_function"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<FunctionSignature>

What value does the query return?
Source§

type Storage = LookupInternedStorage<MirInternFunctionLookupQuery, MirInternFunctionQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirInternFunctionLookupQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirInternFunctionQuery.html b/compiler-docs/fe_mir/db/struct.MirInternFunctionQuery.html new file mode 100644 index 0000000000..814e451840 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirInternFunctionQuery.html @@ -0,0 +1,39 @@ +MirInternFunctionQuery in fe_mir::db - Rust

Struct MirInternFunctionQuery

Source
pub struct MirInternFunctionQuery;

Implementations§

Source§

impl MirInternFunctionQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirInternFunctionQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirInternFunctionQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirInternFunctionQuery

Source§

fn default() -> MirInternFunctionQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirInternFunctionQuery

Source§

const QUERY_INDEX: u16 = 4u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_intern_function"

Name of the query method (e.g., foo)
Source§

type Key = Rc<FunctionSignature>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = FunctionId

What value does the query return?
Source§

type Storage = InternedStorage<MirInternFunctionQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirInternFunctionQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirInternTypeLookupQuery.html b/compiler-docs/fe_mir/db/struct.MirInternTypeLookupQuery.html new file mode 100644 index 0000000000..a717fa0b11 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirInternTypeLookupQuery.html @@ -0,0 +1,39 @@ +MirInternTypeLookupQuery in fe_mir::db - Rust

Struct MirInternTypeLookupQuery

Source
pub struct MirInternTypeLookupQuery;

Implementations§

Source§

impl MirInternTypeLookupQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirInternTypeLookupQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirInternTypeLookupQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirInternTypeLookupQuery

Source§

fn default() -> MirInternTypeLookupQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirInternTypeLookupQuery

Source§

const QUERY_INDEX: u16 = 3u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "lookup_mir_intern_type"

Name of the query method (e.g., foo)
Source§

type Key = TypeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Type>

What value does the query return?
Source§

type Storage = LookupInternedStorage<MirInternTypeLookupQuery, MirInternTypeQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirInternTypeLookupQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirInternTypeQuery.html b/compiler-docs/fe_mir/db/struct.MirInternTypeQuery.html new file mode 100644 index 0000000000..a94291a1ea --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirInternTypeQuery.html @@ -0,0 +1,39 @@ +MirInternTypeQuery in fe_mir::db - Rust

Struct MirInternTypeQuery

Source
pub struct MirInternTypeQuery;

Implementations§

Source§

impl MirInternTypeQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirInternTypeQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirInternTypeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirInternTypeQuery

Source§

fn default() -> MirInternTypeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirInternTypeQuery

Source§

const QUERY_INDEX: u16 = 2u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_intern_type"

Name of the query method (e.g., foo)
Source§

type Key = Rc<Type>

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = TypeId

What value does the query return?
Source§

type Storage = InternedStorage<MirInternTypeQuery>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirInternTypeQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLowerContractAllFunctionsQuery.html b/compiler-docs/fe_mir/db/struct.MirLowerContractAllFunctionsQuery.html new file mode 100644 index 0000000000..d343940f3b --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLowerContractAllFunctionsQuery.html @@ -0,0 +1,46 @@ +MirLowerContractAllFunctionsQuery in fe_mir::db - Rust

Struct MirLowerContractAllFunctionsQuery

Source
pub struct MirLowerContractAllFunctionsQuery;

Implementations§

Source§

impl MirLowerContractAllFunctionsQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLowerContractAllFunctionsQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLowerContractAllFunctionsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLowerContractAllFunctionsQuery

Source§

fn default() -> MirLowerContractAllFunctionsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLowerContractAllFunctionsQuery

Source§

const QUERY_INDEX: u16 = 7u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lower_contract_all_functions"

Name of the query method (e.g., foo)
Source§

type Key = ContractId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Vec<FunctionId>>

What value does the query return?
Source§

type Storage = DerivedStorage<MirLowerContractAllFunctionsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLowerContractAllFunctionsQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLowerContractAllFunctionsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLowerEnumAllFunctionsQuery.html b/compiler-docs/fe_mir/db/struct.MirLowerEnumAllFunctionsQuery.html new file mode 100644 index 0000000000..6b1cb45289 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLowerEnumAllFunctionsQuery.html @@ -0,0 +1,46 @@ +MirLowerEnumAllFunctionsQuery in fe_mir::db - Rust

Struct MirLowerEnumAllFunctionsQuery

Source
pub struct MirLowerEnumAllFunctionsQuery;

Implementations§

Source§

impl MirLowerEnumAllFunctionsQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLowerEnumAllFunctionsQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLowerEnumAllFunctionsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLowerEnumAllFunctionsQuery

Source§

fn default() -> MirLowerEnumAllFunctionsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLowerEnumAllFunctionsQuery

Source§

const QUERY_INDEX: u16 = 9u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lower_enum_all_functions"

Name of the query method (e.g., foo)
Source§

type Key = EnumId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Vec<FunctionId>>

What value does the query return?
Source§

type Storage = DerivedStorage<MirLowerEnumAllFunctionsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLowerEnumAllFunctionsQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLowerEnumAllFunctionsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLowerModuleAllFunctionsQuery.html b/compiler-docs/fe_mir/db/struct.MirLowerModuleAllFunctionsQuery.html new file mode 100644 index 0000000000..7e48b06e89 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLowerModuleAllFunctionsQuery.html @@ -0,0 +1,46 @@ +MirLowerModuleAllFunctionsQuery in fe_mir::db - Rust

Struct MirLowerModuleAllFunctionsQuery

Source
pub struct MirLowerModuleAllFunctionsQuery;

Implementations§

Source§

impl MirLowerModuleAllFunctionsQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLowerModuleAllFunctionsQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLowerModuleAllFunctionsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLowerModuleAllFunctionsQuery

Source§

fn default() -> MirLowerModuleAllFunctionsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLowerModuleAllFunctionsQuery

Source§

const QUERY_INDEX: u16 = 6u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lower_module_all_functions"

Name of the query method (e.g., foo)
Source§

type Key = ModuleId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Vec<FunctionId>>

What value does the query return?
Source§

type Storage = DerivedStorage<MirLowerModuleAllFunctionsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLowerModuleAllFunctionsQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLowerModuleAllFunctionsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLowerStructAllFunctionsQuery.html b/compiler-docs/fe_mir/db/struct.MirLowerStructAllFunctionsQuery.html new file mode 100644 index 0000000000..8a5c8dd113 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLowerStructAllFunctionsQuery.html @@ -0,0 +1,46 @@ +MirLowerStructAllFunctionsQuery in fe_mir::db - Rust

Struct MirLowerStructAllFunctionsQuery

Source
pub struct MirLowerStructAllFunctionsQuery;

Implementations§

Source§

impl MirLowerStructAllFunctionsQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLowerStructAllFunctionsQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLowerStructAllFunctionsQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLowerStructAllFunctionsQuery

Source§

fn default() -> MirLowerStructAllFunctionsQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLowerStructAllFunctionsQuery

Source§

const QUERY_INDEX: u16 = 8u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lower_struct_all_functions"

Name of the query method (e.g., foo)
Source§

type Key = StructId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<Vec<FunctionId>>

What value does the query return?
Source§

type Storage = DerivedStorage<MirLowerStructAllFunctionsQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLowerStructAllFunctionsQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLowerStructAllFunctionsQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLoweredConstantQuery.html b/compiler-docs/fe_mir/db/struct.MirLoweredConstantQuery.html new file mode 100644 index 0000000000..7c4bb4f825 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLoweredConstantQuery.html @@ -0,0 +1,46 @@ +MirLoweredConstantQuery in fe_mir::db - Rust

Struct MirLoweredConstantQuery

Source
pub struct MirLoweredConstantQuery;

Implementations§

Source§

impl MirLoweredConstantQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLoweredConstantQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLoweredConstantQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLoweredConstantQuery

Source§

fn default() -> MirLoweredConstantQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLoweredConstantQuery

Source§

const QUERY_INDEX: u16 = 11u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lowered_constant"

Name of the query method (e.g., foo)
Source§

type Key = ModuleConstantId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = ConstantId

What value does the query return?
Source§

type Storage = DerivedStorage<MirLoweredConstantQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLoweredConstantQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLoweredConstantQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLoweredFuncBodyQuery.html b/compiler-docs/fe_mir/db/struct.MirLoweredFuncBodyQuery.html new file mode 100644 index 0000000000..fb2cc7a21a --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLoweredFuncBodyQuery.html @@ -0,0 +1,46 @@ +MirLoweredFuncBodyQuery in fe_mir::db - Rust

Struct MirLoweredFuncBodyQuery

Source
pub struct MirLoweredFuncBodyQuery;

Implementations§

Source§

impl MirLoweredFuncBodyQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLoweredFuncBodyQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLoweredFuncBodyQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLoweredFuncBodyQuery

Source§

fn default() -> MirLoweredFuncBodyQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLoweredFuncBodyQuery

Source§

const QUERY_INDEX: u16 = 15u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lowered_func_body"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = Rc<FunctionBody>

What value does the query return?
Source§

type Storage = DerivedStorage<MirLoweredFuncBodyQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLoweredFuncBodyQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLoweredFuncBodyQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLoweredFuncSignatureQuery.html b/compiler-docs/fe_mir/db/struct.MirLoweredFuncSignatureQuery.html new file mode 100644 index 0000000000..616c8fce5f --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLoweredFuncSignatureQuery.html @@ -0,0 +1,46 @@ +MirLoweredFuncSignatureQuery in fe_mir::db - Rust

Struct MirLoweredFuncSignatureQuery

Source
pub struct MirLoweredFuncSignatureQuery;

Implementations§

Source§

impl MirLoweredFuncSignatureQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLoweredFuncSignatureQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLoweredFuncSignatureQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLoweredFuncSignatureQuery

Source§

fn default() -> MirLoweredFuncSignatureQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLoweredFuncSignatureQuery

Source§

const QUERY_INDEX: u16 = 12u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lowered_func_signature"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = FunctionId

What value does the query return?
Source§

type Storage = DerivedStorage<MirLoweredFuncSignatureQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLoweredFuncSignatureQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLoweredFuncSignatureQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLoweredMonomorphizedFuncSignatureQuery.html b/compiler-docs/fe_mir/db/struct.MirLoweredMonomorphizedFuncSignatureQuery.html new file mode 100644 index 0000000000..30088a086a --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLoweredMonomorphizedFuncSignatureQuery.html @@ -0,0 +1,46 @@ +MirLoweredMonomorphizedFuncSignatureQuery in fe_mir::db - Rust

Struct MirLoweredMonomorphizedFuncSignatureQuery

Source
pub struct MirLoweredMonomorphizedFuncSignatureQuery;

Implementations§

Source§

impl MirLoweredMonomorphizedFuncSignatureQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLoweredMonomorphizedFuncSignatureQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLoweredMonomorphizedFuncSignatureQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLoweredMonomorphizedFuncSignatureQuery

Source§

fn default() -> MirLoweredMonomorphizedFuncSignatureQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLoweredMonomorphizedFuncSignatureQuery

Source§

const QUERY_INDEX: u16 = 13u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lowered_monomorphized_func_signature"

Name of the query method (e.g., foo)
Source§

type Key = (FunctionId, BTreeMap<SmolStr, TypeId>)

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = FunctionId

What value does the query return?
Source§

type Storage = DerivedStorage<MirLoweredMonomorphizedFuncSignatureQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLoweredMonomorphizedFuncSignatureQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLoweredMonomorphizedFuncSignatureQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + (key0, key1): <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLoweredPseudoMonomorphizedFuncSignatureQuery.html b/compiler-docs/fe_mir/db/struct.MirLoweredPseudoMonomorphizedFuncSignatureQuery.html new file mode 100644 index 0000000000..f5ce19797a --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLoweredPseudoMonomorphizedFuncSignatureQuery.html @@ -0,0 +1,46 @@ +MirLoweredPseudoMonomorphizedFuncSignatureQuery in fe_mir::db - Rust

Struct MirLoweredPseudoMonomorphizedFuncSignatureQuery

Source
pub struct MirLoweredPseudoMonomorphizedFuncSignatureQuery;

Implementations§

Source§

impl MirLoweredPseudoMonomorphizedFuncSignatureQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLoweredPseudoMonomorphizedFuncSignatureQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLoweredPseudoMonomorphizedFuncSignatureQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLoweredPseudoMonomorphizedFuncSignatureQuery

Source§

fn default() -> MirLoweredPseudoMonomorphizedFuncSignatureQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLoweredPseudoMonomorphizedFuncSignatureQuery

Source§

const QUERY_INDEX: u16 = 14u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lowered_pseudo_monomorphized_func_signature"

Name of the query method (e.g., foo)
Source§

type Key = FunctionId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = FunctionId

What value does the query return?
Source§

type Storage = DerivedStorage<MirLoweredPseudoMonomorphizedFuncSignatureQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLoweredPseudoMonomorphizedFuncSignatureQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLoweredPseudoMonomorphizedFuncSignatureQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.MirLoweredTypeQuery.html b/compiler-docs/fe_mir/db/struct.MirLoweredTypeQuery.html new file mode 100644 index 0000000000..7453f7999f --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.MirLoweredTypeQuery.html @@ -0,0 +1,46 @@ +MirLoweredTypeQuery in fe_mir::db - Rust

Struct MirLoweredTypeQuery

Source
pub struct MirLoweredTypeQuery;

Implementations§

Source§

impl MirLoweredTypeQuery

Source

pub fn in_db(self, db: &dyn MirDb) -> QueryTable<'_, Self>

Get access to extra methods pertaining to this query. For +example, you can use this to run the GC (sweep) across a +single input. You can also use it to invoke this query, though +it’s more common to use the trait method on the database +itself.

+
Source§

impl MirLoweredTypeQuery

Source

pub fn in_db_mut(self, db: &mut dyn MirDb) -> QueryTableMut<'_, Self>

Like in_db, but gives access to methods for setting the +value of an input. Not applicable to derived queries.

+
§Threads, cancellation, and blocking
+

Mutating the value of a query cannot be done while there are +still other queries executing. If you are using your database +within a single thread, this is not a problem: you only have +&self access to the database, but this method requires &mut self.

+

However, if you have used snapshot to create other threads, +then attempts to set will block the current thread until +those snapshots are dropped (usually when those threads +complete). This also implies that if you create a snapshot but +do not send it to another thread, then invoking set will +deadlock.

+

Before blocking, the thread that is attempting to set will +also set a cancellation flag. In the threads operating on +snapshots, you can use the is_current_revision_canceled +method to check for this flag and bring those operations to a +close, thus allowing the set to succeed. Ignoring this flag +may lead to “starvation”, meaning that the thread attempting +to set has to wait a long, long time. =)

+

Trait Implementations§

Source§

impl Debug for MirLoweredTypeQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MirLoweredTypeQuery

Source§

fn default() -> MirLoweredTypeQuery

Returns the “default value” for a type. Read more
Source§

impl Query for MirLoweredTypeQuery

Source§

const QUERY_INDEX: u16 = 10u16

A unique index identifying this query within the group.
Source§

const QUERY_NAME: &'static str = "mir_lowered_type"

Name of the query method (e.g., foo)
Source§

type Key = TypeId

Type that you you give as a parameter – for queries with zero +or more than one input, this will be a tuple.
Source§

type Value = TypeId

What value does the query return?
Source§

type Storage = DerivedStorage<MirLoweredTypeQuery, AlwaysMemoizeValue>

Internal struct storing the values for the query.
Source§

fn query_storage<'a>( + group_storage: &'a <Self as QueryDb<'_>>::GroupStorage, +) -> &'a Arc<Self::Storage>

Extact storage for this query from the storage for its group.
Source§

impl<'d> QueryDb<'d> for MirLoweredTypeQuery

Source§

type DynDb = dyn MirDb + 'd

Dyn version of the associated trait for this query group.
Source§

type Group = MirDbStorage

Associate query group struct.
Source§

type GroupStorage = MirDbGroupStorage__

Generated struct that contains storage for all queries in a group.
Source§

impl QueryFunction for MirLoweredTypeQuery

Source§

fn execute( + db: &<Self as QueryDb<'_>>::DynDb, + key0: <Self as Query>::Key, +) -> <Self as Query>::Value

§

fn recover( + db: &Self::DynDb, + cycle: &[DatabaseKeyIndex], + key: &Self::Key, +) -> Option<Self::Value>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/struct.NewDb.html b/compiler-docs/fe_mir/db/struct.NewDb.html new file mode 100644 index 0000000000..d42c23bd83 --- /dev/null +++ b/compiler-docs/fe_mir/db/struct.NewDb.html @@ -0,0 +1,134 @@ +NewDb in fe_mir::db - Rust

Struct NewDb

Source
pub struct NewDb { /* private fields */ }

Trait Implementations§

Source§

impl Database for NewDb

§

fn sweep_all(&self, strategy: SweepStrategy)

Iterates through all query storage and removes any values that +have not been used since the last revision was created. The +intended use-cycle is that you first execute all of your +“main” queries; this will ensure that all query values they +consume are marked as used. You then invoke this method to +remove other values that were not needed for your main query +results.
§

fn salsa_event(&self, event_fn: Event)

This function is invoked at key points in the salsa +runtime. It permits the database to be customized and to +inject logging or other custom behavior.
§

fn on_propagated_panic(&self) -> !

This function is invoked when a dependent query is being computed by the +other thread, and that thread panics.
§

fn salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.
§

fn salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.
Source§

impl DatabaseOps for NewDb

Source§

fn ops_database(&self) -> &dyn Database

Upcast this type to a dyn Database.
Source§

fn ops_salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.
Source§

fn ops_salsa_runtime_mut(&mut self) -> &mut Runtime

Gives access to the underlying salsa runtime.
Source§

fn fmt_index(&self, input: DatabaseKeyIndex, fmt: &mut Formatter<'_>) -> Result

Formats a database key index in a human readable fashion.
Source§

fn maybe_changed_since( + &self, + input: DatabaseKeyIndex, + revision: Revision, +) -> bool

True if the computed value for input may have changed since revision.
Source§

fn for_each_query(&self, op: &mut dyn FnMut(&dyn QueryStorageMassOps))

Executes the callback for each kind of query.
Source§

impl DatabaseStorageTypes for NewDb

Source§

type DatabaseStorage = __SalsaDatabaseStorage

Defines the “storage type”, where all the query data is kept. +This type is defined by the database_storage macro.
Source§

impl Default for NewDb

Source§

fn default() -> NewDb

Returns the “default value” for a type. Read more
Source§

impl HasQueryGroup<AnalyzerDbStorage> for NewDb

Source§

fn group_storage(&self) -> &<AnalyzerDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl HasQueryGroup<MirDbStorage> for NewDb

Source§

fn group_storage(&self) -> &<MirDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl HasQueryGroup<SourceDbStorage> for NewDb

Source§

fn group_storage(&self) -> &<SourceDbStorage as QueryGroup>::GroupStorage

Access the group storage struct from the database.
Source§

impl Upcast<dyn AnalyzerDb> for NewDb

Source§

fn upcast(&self) -> &(dyn AnalyzerDb + 'static)

Source§

impl Upcast<dyn SourceDb> for NewDb

Source§

fn upcast(&self) -> &(dyn SourceDb + 'static)

Source§

impl UpcastMut<dyn AnalyzerDb> for NewDb

Source§

fn upcast_mut(&mut self) -> &mut (dyn AnalyzerDb + 'static)

Source§

impl UpcastMut<dyn SourceDb> for NewDb

Source§

fn upcast_mut(&mut self) -> &mut (dyn SourceDb + 'static)

Auto Trait Implementations§

§

impl !Freeze for NewDb

§

impl RefUnwindSafe for NewDb

§

impl !Send for NewDb

§

impl !Sync for NewDb

§

impl Unpin for NewDb

§

impl UnwindSafe for NewDb

Blanket Implementations§

§

impl<DB> AnalyzerDb for DB
where + DB: SourceDb + Upcast<dyn SourceDb> + UpcastMut<dyn SourceDb> + Database + HasQueryGroup<AnalyzerDbStorage>,

§

fn intern_ingot(&self, key0: Rc<Ingot>) -> IngotId

§

fn lookup_intern_ingot(&self, key0: IngotId) -> Rc<Ingot>

§

fn intern_module(&self, key0: Rc<Module>) -> ModuleId

§

fn lookup_intern_module(&self, key0: ModuleId) -> Rc<Module>

§

fn intern_module_const(&self, key0: Rc<ModuleConstant>) -> ModuleConstantId

§

fn lookup_intern_module_const( + &self, + key0: ModuleConstantId, +) -> Rc<ModuleConstant>

§

fn intern_struct(&self, key0: Rc<Struct>) -> StructId

§

fn lookup_intern_struct(&self, key0: StructId) -> Rc<Struct>

§

fn intern_struct_field(&self, key0: Rc<StructField>) -> StructFieldId

§

fn lookup_intern_struct_field(&self, key0: StructFieldId) -> Rc<StructField>

§

fn intern_enum(&self, key0: Rc<Enum>) -> EnumId

§

fn lookup_intern_enum(&self, key0: EnumId) -> Rc<Enum>

§

fn intern_attribute(&self, key0: Rc<Attribute>) -> AttributeId

§

fn lookup_intern_attribute(&self, key0: AttributeId) -> Rc<Attribute>

§

fn intern_enum_variant(&self, key0: Rc<EnumVariant>) -> EnumVariantId

§

fn lookup_intern_enum_variant(&self, key0: EnumVariantId) -> Rc<EnumVariant>

§

fn intern_trait(&self, key0: Rc<Trait>) -> TraitId

§

fn lookup_intern_trait(&self, key0: TraitId) -> Rc<Trait>

§

fn intern_impl(&self, key0: Rc<Impl>) -> ImplId

§

fn lookup_intern_impl(&self, key0: ImplId) -> Rc<Impl>

§

fn intern_type_alias(&self, key0: Rc<TypeAlias>) -> TypeAliasId

§

fn lookup_intern_type_alias(&self, key0: TypeAliasId) -> Rc<TypeAlias>

§

fn intern_contract(&self, key0: Rc<Contract>) -> ContractId

§

fn lookup_intern_contract(&self, key0: ContractId) -> Rc<Contract>

§

fn intern_contract_field(&self, key0: Rc<ContractField>) -> ContractFieldId

§

fn lookup_intern_contract_field( + &self, + key0: ContractFieldId, +) -> Rc<ContractField>

§

fn intern_function_sig(&self, key0: Rc<FunctionSig>) -> FunctionSigId

§

fn lookup_intern_function_sig(&self, key0: FunctionSigId) -> Rc<FunctionSig>

§

fn intern_function(&self, key0: Rc<Function>) -> FunctionId

§

fn lookup_intern_function(&self, key0: FunctionId) -> Rc<Function>

§

fn intern_type(&self, key0: Type) -> TypeId

§

fn lookup_intern_type(&self, key0: TypeId) -> Type

§

fn ingot_files(&self, key0: IngotId) -> Rc<[SourceFileId]>

§

fn set_ingot_files(&mut self, key0: IngotId, value__: Rc<[SourceFileId]>)

Set the value of the ingot_files input. Read more
§

fn set_ingot_files_with_durability( + &mut self, + key0: IngotId, + value__: Rc<[SourceFileId]>, + durability__: Durability, +)

Set the value of the ingot_files input and promise +that its value will never change again. Read more
§

fn ingot_external_ingots(&self, key0: IngotId) -> Rc<IndexMap<SmolStr, IngotId>>

§

fn set_ingot_external_ingots( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, +)

Set the value of the ingot_external_ingots input. Read more
§

fn set_ingot_external_ingots_with_durability( + &mut self, + key0: IngotId, + value__: Rc<IndexMap<SmolStr, IngotId>>, + durability__: Durability, +)

Set the value of the ingot_external_ingots input and promise +that its value will never change again. Read more
§

fn root_ingot(&self) -> IngotId

§

fn set_root_ingot(&mut self, value__: IngotId)

Set the value of the root_ingot input. Read more
§

fn set_root_ingot_with_durability( + &mut self, + value__: IngotId, + durability__: Durability, +)

Set the value of the root_ingot input and promise +that its value will never change again. Read more
§

fn ingot_modules(&self, key0: IngotId) -> Rc<[ModuleId]>

§

fn ingot_root_module(&self, key0: IngotId) -> Option<ModuleId>

§

fn module_file_path(&self, key0: ModuleId) -> SmolStr

§

fn module_parse(&self, key0: ModuleId) -> Analysis<Rc<Module>>

§

fn module_is_incomplete(&self, key0: ModuleId) -> bool

§

fn module_all_items(&self, key0: ModuleId) -> Rc<[Item]>

§

fn module_all_impls(&self, key0: ModuleId) -> Analysis<Rc<[ImplId]>>

§

fn module_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, Item>>>

§

fn module_impl_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<(TraitId, TypeId), ImplId>>>

§

fn module_contracts(&self, key0: ModuleId) -> Rc<[ContractId]>

§

fn module_structs(&self, key0: ModuleId) -> Rc<[StructId]>

§

fn module_constants(&self, key0: ModuleId) -> Rc<Vec<ModuleConstantId>>

§

fn module_used_item_map( + &self, + key0: ModuleId, +) -> Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>>

§

fn module_parent_module(&self, key0: ModuleId) -> Option<ModuleId>

§

fn module_submodules(&self, key0: ModuleId) -> Rc<[ModuleId]>

§

fn module_tests(&self, key0: ModuleId) -> Vec<FunctionId>

§

fn module_constant_type( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<TypeId, TypeError>>

§

fn module_constant_value( + &self, + key0: ModuleConstantId, +) -> Analysis<Result<Constant, ConstEvalError>>

§

fn contract_all_functions(&self, key0: ContractId) -> Rc<[FunctionId]>

§

fn contract_function_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn contract_public_function_map( + &self, + key0: ContractId, +) -> Rc<IndexMap<SmolStr, FunctionId>>

§

fn contract_init_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

§

fn contract_call_function( + &self, + key0: ContractId, +) -> Analysis<Option<FunctionId>>

§

fn contract_all_fields(&self, key0: ContractId) -> Rc<[ContractFieldId]>

§

fn contract_field_map( + &self, + key0: ContractId, +) -> Analysis<Rc<IndexMap<SmolStr, ContractFieldId>>>

§

fn contract_field_type( + &self, + key0: ContractFieldId, +) -> Analysis<Result<TypeId, TypeError>>

§

fn contract_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

§

fn contract_runtime_dependency_graph(&self, key0: ContractId) -> DepGraphWrapper

§

fn function_signature( + &self, + key0: FunctionSigId, +) -> Analysis<Rc<FunctionSignature>>

§

fn function_body(&self, key0: FunctionId) -> Analysis<Rc<FunctionBody>>

§

fn function_dependency_graph(&self, key0: FunctionId) -> DepGraphWrapper

§

fn struct_all_fields(&self, key0: StructId) -> Rc<[StructFieldId]>

§

fn struct_field_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, StructFieldId>>>

§

fn struct_field_type( + &self, + key0: StructFieldId, +) -> Analysis<Result<TypeId, TypeError>>

§

fn struct_all_functions(&self, key0: StructId) -> Rc<[FunctionId]>

§

fn struct_function_map( + &self, + key0: StructId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn struct_dependency_graph(&self, key0: StructId) -> Analysis<DepGraphWrapper>

§

fn enum_all_variants(&self, key0: EnumId) -> Rc<[EnumVariantId]>

§

fn enum_variant_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, EnumVariantId>>>

§

fn enum_all_functions(&self, key0: EnumId) -> Rc<[FunctionId]>

§

fn enum_function_map( + &self, + key0: EnumId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn enum_dependency_graph(&self, key0: EnumId) -> Analysis<DepGraphWrapper>

§

fn enum_variant_kind( + &self, + key0: EnumVariantId, +) -> Analysis<Result<EnumVariantKind, TypeError>>

§

fn trait_all_functions(&self, key0: TraitId) -> Rc<[FunctionSigId]>

§

fn trait_function_map( + &self, + key0: TraitId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionSigId>>>

§

fn trait_is_implemented_for(&self, key0: TraitId, key1: TypeId) -> bool

§

fn impl_all_functions(&self, key0: ImplId) -> Rc<[FunctionId]>

§

fn impl_function_map( + &self, + key0: ImplId, +) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>

§

fn all_impls(&self, key0: TypeId) -> Rc<[ImplId]>

§

fn impl_for(&self, key0: TypeId, key1: TraitId) -> Option<ImplId>

§

fn function_sigs(&self, key0: TypeId, key1: SmolStr) -> Rc<[FunctionSigId]>

§

fn type_alias_type( + &self, + key0: TypeAliasId, +) -> Analysis<Result<TypeId, TypeError>>

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<DB> MirDb for DB
where + DB: AnalyzerDb + Upcast<dyn AnalyzerDb> + UpcastMut<dyn AnalyzerDb> + Database + HasQueryGroup<MirDbStorage>,

§

impl<DB> SourceDb for DB
where + DB: Database + HasQueryGroup<SourceDbStorage>,

§

fn intern_file(&self, key0: File) -> SourceFileId

§

fn lookup_intern_file(&self, key0: SourceFileId) -> File

§

fn file_content(&self, key0: SourceFileId) -> Rc<str>

Set with `fn set_file_content(&mut self, file: SourceFileId, content: Rc)
§

fn set_file_content(&mut self, key0: SourceFileId, value__: Rc<str>)

Set the value of the file_content input. Read more
§

fn set_file_content_with_durability( + &mut self, + key0: SourceFileId, + value__: Rc<str>, + durability__: Durability, +)

Set the value of the file_content input and promise +that its value will never change again. Read more
§

fn file_line_starts(&self, key0: SourceFileId) -> Rc<[usize]>

§

fn file_name(&self, key0: SourceFileId) -> SmolStr

Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/db/trait.MirDb.html b/compiler-docs/fe_mir/db/trait.MirDb.html new file mode 100644 index 0000000000..dfbad8a2b2 --- /dev/null +++ b/compiler-docs/fe_mir/db/trait.MirDb.html @@ -0,0 +1,54 @@ +MirDb in fe_mir::db - Rust

Trait MirDb

Source
pub trait MirDb:
+    Database
+    + HasQueryGroup<MirDbStorage>
+    + AnalyzerDb
+    + Upcast<dyn AnalyzerDb>
+    + UpcastMut<dyn AnalyzerDb> {
+
Show 16 methods // Required methods + fn mir_intern_const(&self, key0: Rc<Constant>) -> ConstantId; + fn lookup_mir_intern_const(&self, key0: ConstantId) -> Rc<Constant>; + fn mir_intern_type(&self, key0: Rc<Type>) -> TypeId; + fn lookup_mir_intern_type(&self, key0: TypeId) -> Rc<Type>; + fn mir_intern_function(&self, key0: Rc<FunctionSignature>) -> FunctionId; + fn lookup_mir_intern_function( + &self, + key0: FunctionId, + ) -> Rc<FunctionSignature>; + fn mir_lower_module_all_functions( + &self, + key0: ModuleId, + ) -> Rc<Vec<FunctionId>>; + fn mir_lower_contract_all_functions( + &self, + key0: ContractId, + ) -> Rc<Vec<FunctionId>>; + fn mir_lower_struct_all_functions( + &self, + key0: StructId, + ) -> Rc<Vec<FunctionId>>; + fn mir_lower_enum_all_functions(&self, key0: EnumId) -> Rc<Vec<FunctionId>>; + fn mir_lowered_type(&self, key0: TypeId) -> TypeId; + fn mir_lowered_constant(&self, key0: ModuleConstantId) -> ConstantId; + fn mir_lowered_func_signature(&self, key0: FunctionId) -> FunctionId; + fn mir_lowered_monomorphized_func_signature( + &self, + key0: FunctionId, + key1: BTreeMap<SmolStr, TypeId>, + ) -> FunctionId; + fn mir_lowered_pseudo_monomorphized_func_signature( + &self, + key0: FunctionId, + ) -> FunctionId; + fn mir_lowered_func_body(&self, key0: FunctionId) -> Rc<FunctionBody>; +
}

Required Methods§

Source

fn mir_intern_const(&self, key0: Rc<Constant>) -> ConstantId

Source

fn lookup_mir_intern_const(&self, key0: ConstantId) -> Rc<Constant>

Source

fn mir_intern_type(&self, key0: Rc<Type>) -> TypeId

Source

fn lookup_mir_intern_type(&self, key0: TypeId) -> Rc<Type>

Source

fn mir_intern_function(&self, key0: Rc<FunctionSignature>) -> FunctionId

Source

fn lookup_mir_intern_function(&self, key0: FunctionId) -> Rc<FunctionSignature>

Source

fn mir_lower_module_all_functions(&self, key0: ModuleId) -> Rc<Vec<FunctionId>>

Source

fn mir_lower_contract_all_functions( + &self, + key0: ContractId, +) -> Rc<Vec<FunctionId>>

Source

fn mir_lower_struct_all_functions(&self, key0: StructId) -> Rc<Vec<FunctionId>>

Source

fn mir_lower_enum_all_functions(&self, key0: EnumId) -> Rc<Vec<FunctionId>>

Source

fn mir_lowered_type(&self, key0: TypeId) -> TypeId

Source

fn mir_lowered_constant(&self, key0: ModuleConstantId) -> ConstantId

Source

fn mir_lowered_func_signature(&self, key0: FunctionId) -> FunctionId

Source

fn mir_lowered_monomorphized_func_signature( + &self, + key0: FunctionId, + key1: BTreeMap<SmolStr, TypeId>, +) -> FunctionId

Source

fn mir_lowered_pseudo_monomorphized_func_signature( + &self, + key0: FunctionId, +) -> FunctionId

Source

fn mir_lowered_func_body(&self, key0: FunctionId) -> Rc<FunctionBody>

Implementors§

Source§

impl<DB> MirDb for DB
where + DB: AnalyzerDb + Upcast<dyn AnalyzerDb> + UpcastMut<dyn AnalyzerDb> + Database + HasQueryGroup<MirDbStorage>,

\ No newline at end of file diff --git a/compiler-docs/fe_mir/graphviz/fn.write_mir_graphs.html b/compiler-docs/fe_mir/graphviz/fn.write_mir_graphs.html new file mode 100644 index 0000000000..73bab9b041 --- /dev/null +++ b/compiler-docs/fe_mir/graphviz/fn.write_mir_graphs.html @@ -0,0 +1,6 @@ +write_mir_graphs in fe_mir::graphviz - Rust

Function write_mir_graphs

Source
pub fn write_mir_graphs<W: Write>(
+    db: &dyn MirDb,
+    module: ModuleId,
+    w: &mut W,
+) -> Result<()>
Expand description

Writes mir graphs of functions in a module.

+
\ No newline at end of file diff --git a/compiler-docs/fe_mir/graphviz/index.html b/compiler-docs/fe_mir/graphviz/index.html new file mode 100644 index 0000000000..8d7ebfe042 --- /dev/null +++ b/compiler-docs/fe_mir/graphviz/index.html @@ -0,0 +1 @@ +fe_mir::graphviz - Rust

Module graphviz

Source

Functions§

write_mir_graphs
Writes mir graphs of functions in a module.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/graphviz/sidebar-items.js b/compiler-docs/fe_mir/graphviz/sidebar-items.js new file mode 100644 index 0000000000..cd5ad48797 --- /dev/null +++ b/compiler-docs/fe_mir/graphviz/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["write_mir_graphs"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/index.html b/compiler-docs/fe_mir/index.html new file mode 100644 index 0000000000..7437765bc5 --- /dev/null +++ b/compiler-docs/fe_mir/index.html @@ -0,0 +1 @@ +fe_mir - Rust

Crate fe_mir

Source

Modules§

analysis
db
graphviz
ir
pretty_print
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/basic_block/index.html b/compiler-docs/fe_mir/ir/basic_block/index.html new file mode 100644 index 0000000000..ba57a62618 --- /dev/null +++ b/compiler-docs/fe_mir/ir/basic_block/index.html @@ -0,0 +1 @@ +fe_mir::ir::basic_block - Rust

Module basic_block

Source

Structs§

BasicBlock

Type Aliases§

BasicBlockId
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/basic_block/sidebar-items.js b/compiler-docs/fe_mir/ir/basic_block/sidebar-items.js new file mode 100644 index 0000000000..50c3409a66 --- /dev/null +++ b/compiler-docs/fe_mir/ir/basic_block/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["BasicBlock"],"type":["BasicBlockId"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/basic_block/struct.BasicBlock.html b/compiler-docs/fe_mir/ir/basic_block/struct.BasicBlock.html new file mode 100644 index 0000000000..0277f7719a --- /dev/null +++ b/compiler-docs/fe_mir/ir/basic_block/struct.BasicBlock.html @@ -0,0 +1,22 @@ +BasicBlock in fe_mir::ir::basic_block - Rust

Struct BasicBlock

Source
pub struct BasicBlock {}

Trait Implementations§

Source§

impl Clone for BasicBlock

Source§

fn clone(&self) -> BasicBlock

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BasicBlock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for BasicBlock

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BasicBlock

Source§

fn eq(&self, other: &BasicBlock) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for BasicBlock

Source§

impl Eq for BasicBlock

Source§

impl StructuralPartialEq for BasicBlock

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/basic_block/type.BasicBlockId.html b/compiler-docs/fe_mir/ir/basic_block/type.BasicBlockId.html new file mode 100644 index 0000000000..03c5664ec2 --- /dev/null +++ b/compiler-docs/fe_mir/ir/basic_block/type.BasicBlockId.html @@ -0,0 +1 @@ +BasicBlockId in fe_mir::ir::basic_block - Rust

Type Alias BasicBlockId

Source
pub type BasicBlockId = Id<BasicBlock>;

Aliased Type§

pub struct BasicBlockId { /* private fields */ }
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_builder/index.html b/compiler-docs/fe_mir/ir/body_builder/index.html new file mode 100644 index 0000000000..d22e13a9b9 --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_builder/index.html @@ -0,0 +1 @@ +fe_mir::ir::body_builder - Rust

Module body_builder

Source

Structs§

BodyBuilder
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_builder/sidebar-items.js b/compiler-docs/fe_mir/ir/body_builder/sidebar-items.js new file mode 100644 index 0000000000..24f416595a --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_builder/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["BodyBuilder"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_builder/struct.BodyBuilder.html b/compiler-docs/fe_mir/ir/body_builder/struct.BodyBuilder.html new file mode 100644 index 0000000000..178a890525 --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_builder/struct.BodyBuilder.html @@ -0,0 +1,104 @@ +BodyBuilder in fe_mir::ir::body_builder - Rust

Struct BodyBuilder

Source
pub struct BodyBuilder {
+    pub body: FunctionBody,
+    /* private fields */
+}

Fields§

§body: FunctionBody

Implementations§

Source§

impl BodyBuilder

Source

pub fn new(fid: FunctionId, source: SourceInfo) -> Self

Source

pub fn build(self) -> FunctionBody

Source

pub fn func_id(&self) -> FunctionId

Source

pub fn make_block(&mut self) -> BasicBlockId

Source

pub fn make_value(&mut self, value: impl Into<Value>) -> ValueId

Source

pub fn map_result(&mut self, inst: InstId, result: AssignableValue)

Source

pub fn inst_result(&mut self, inst: InstId) -> Option<&AssignableValue>

Source

pub fn move_to_block(&mut self, block: BasicBlockId)

Source

pub fn move_to_block_top(&mut self, block: BasicBlockId)

Source

pub fn make_unit(&mut self, unit_ty: TypeId) -> ValueId

Source

pub fn make_imm(&mut self, imm: BigInt, ty: TypeId) -> ValueId

Source

pub fn make_imm_from_bool(&mut self, imm: bool, ty: TypeId) -> ValueId

Source

pub fn make_constant(&mut self, constant: ConstantId, ty: TypeId) -> ValueId

Source

pub fn declare(&mut self, local: Local) -> ValueId

Source

pub fn store_func_arg(&mut self, local: Local) -> ValueId

Source

pub fn not(&mut self, value: ValueId, source: SourceInfo) -> InstId

Source

pub fn neg(&mut self, value: ValueId, source: SourceInfo) -> InstId

Source

pub fn inv(&mut self, value: ValueId, source: SourceInfo) -> InstId

Source

pub fn add(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn sub(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn mul(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn div(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn modulo( + &mut self, + lhs: ValueId, + rhs: ValueId, + source: SourceInfo, +) -> InstId

Source

pub fn pow(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn shl(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn shr(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn bit_or( + &mut self, + lhs: ValueId, + rhs: ValueId, + source: SourceInfo, +) -> InstId

Source

pub fn bit_xor( + &mut self, + lhs: ValueId, + rhs: ValueId, + source: SourceInfo, +) -> InstId

Source

pub fn bit_and( + &mut self, + lhs: ValueId, + rhs: ValueId, + source: SourceInfo, +) -> InstId

Source

pub fn logical_and( + &mut self, + lhs: ValueId, + rhs: ValueId, + source: SourceInfo, +) -> InstId

Source

pub fn logical_or( + &mut self, + lhs: ValueId, + rhs: ValueId, + source: SourceInfo, +) -> InstId

Source

pub fn eq(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn ne(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn ge(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn gt(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn le(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn lt(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId

Source

pub fn primitive_cast( + &mut self, + value: ValueId, + result_ty: TypeId, + source: SourceInfo, +) -> InstId

Source

pub fn untag_cast( + &mut self, + value: ValueId, + result_ty: TypeId, + source: SourceInfo, +) -> InstId

Source

pub fn aggregate_construct( + &mut self, + ty: TypeId, + args: Vec<ValueId>, + source: SourceInfo, +) -> InstId

Source

pub fn bind(&mut self, src: ValueId, source: SourceInfo) -> InstId

Source

pub fn mem_copy(&mut self, src: ValueId, source: SourceInfo) -> InstId

Source

pub fn load(&mut self, src: ValueId, source: SourceInfo) -> InstId

Source

pub fn aggregate_access( + &mut self, + value: ValueId, + indices: Vec<ValueId>, + source: SourceInfo, +) -> InstId

Source

pub fn map_access( + &mut self, + value: ValueId, + key: ValueId, + source: SourceInfo, +) -> InstId

Source

pub fn call( + &mut self, + func: FunctionId, + args: Vec<ValueId>, + call_type: CallType, + source: SourceInfo, +) -> InstId

Source

pub fn keccak256(&mut self, arg: ValueId, source: SourceInfo) -> InstId

Source

pub fn abi_encode(&mut self, arg: ValueId, source: SourceInfo) -> InstId

Source

pub fn create( + &mut self, + value: ValueId, + contract: ContractId, + source: SourceInfo, +) -> InstId

Source

pub fn create2( + &mut self, + value: ValueId, + salt: ValueId, + contract: ContractId, + source: SourceInfo, +) -> InstId

Source

pub fn yul_intrinsic( + &mut self, + op: YulIntrinsicOp, + args: Vec<ValueId>, + source: SourceInfo, +) -> InstId

Source

pub fn jump(&mut self, dest: BasicBlockId, source: SourceInfo) -> InstId

Source

pub fn branch( + &mut self, + cond: ValueId, + then: BasicBlockId, + else_: BasicBlockId, + source: SourceInfo, +) -> InstId

Source

pub fn switch( + &mut self, + disc: ValueId, + table: SwitchTable, + default: Option<BasicBlockId>, + source: SourceInfo, +) -> InstId

Source

pub fn revert(&mut self, arg: Option<ValueId>, source: SourceInfo) -> InstId

Source

pub fn emit(&mut self, arg: ValueId, source: SourceInfo) -> InstId

Source

pub fn ret(&mut self, arg: ValueId, source: SourceInfo) -> InstId

Source

pub fn nop(&mut self, source: SourceInfo) -> InstId

Source

pub fn value_ty(&mut self, value: ValueId) -> TypeId

Source

pub fn value_data(&mut self, value: ValueId) -> &Value

Source

pub fn is_block_terminated(&mut self, block: BasicBlockId) -> bool

Returns true if current block is terminated.

+
Source

pub fn is_current_block_terminated(&mut self) -> bool

Source

pub fn current_block(&mut self) -> BasicBlockId

Source

pub fn remove_inst(&mut self, inst: InstId)

Source

pub fn inst_data(&self, inst: InstId) -> &Inst

Trait Implementations§

Source§

impl Debug for BodyBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_cursor/enum.CursorLocation.html b/compiler-docs/fe_mir/ir/body_cursor/enum.CursorLocation.html new file mode 100644 index 0000000000..34c0fbb7a4 --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_cursor/enum.CursorLocation.html @@ -0,0 +1,26 @@ +CursorLocation in fe_mir::ir::body_cursor - Rust

Enum CursorLocation

Source
pub enum CursorLocation {
+    Inst(InstId),
+    BlockTop(BasicBlockId),
+    BlockBottom(BasicBlockId),
+    NoWhere,
+}
Expand description

Specify a current location of BodyCursor

+

Variants§

§

Inst(InstId)

§

BlockTop(BasicBlockId)

§

BlockBottom(BasicBlockId)

§

NoWhere

Trait Implementations§

Source§

impl Clone for CursorLocation

Source§

fn clone(&self) -> CursorLocation

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CursorLocation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CursorLocation

Source§

fn eq(&self, other: &CursorLocation) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for CursorLocation

Source§

impl Eq for CursorLocation

Source§

impl StructuralPartialEq for CursorLocation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_cursor/index.html b/compiler-docs/fe_mir/ir/body_cursor/index.html new file mode 100644 index 0000000000..ca1f9b4094 --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_cursor/index.html @@ -0,0 +1,3 @@ +fe_mir::ir::body_cursor - Rust

Module body_cursor

Source
Expand description

This module provides a collection of structs to modify function body +in-place.

+

Structs§

BodyCursor

Enums§

CursorLocation
Specify a current location of BodyCursor
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_cursor/sidebar-items.js b/compiler-docs/fe_mir/ir/body_cursor/sidebar-items.js new file mode 100644 index 0000000000..bb2e01db68 --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_cursor/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["CursorLocation"],"struct":["BodyCursor"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_cursor/struct.BodyCursor.html b/compiler-docs/fe_mir/ir/body_cursor/struct.BodyCursor.html new file mode 100644 index 0000000000..637200d350 --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_cursor/struct.BodyCursor.html @@ -0,0 +1,35 @@ +BodyCursor in fe_mir::ir::body_cursor - Rust

Struct BodyCursor

Source
pub struct BodyCursor<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> BodyCursor<'a>

Source

pub fn new(body: &'a mut FunctionBody, loc: CursorLocation) -> Self

Source

pub fn new_at_entry(body: &'a mut FunctionBody) -> Self

Source

pub fn set_loc(&mut self, loc: CursorLocation)

Source

pub fn loc(&self) -> CursorLocation

Source

pub fn next_loc(&self) -> CursorLocation

Source

pub fn prev_loc(&self) -> CursorLocation

Source

pub fn next_block(&self) -> Option<BasicBlockId>

Source

pub fn prev_block(&self) -> Option<BasicBlockId>

Source

pub fn proceed(&mut self)

Source

pub fn back(&mut self)

Source

pub fn body(&self) -> &FunctionBody

Source

pub fn body_mut(&mut self) -> &mut FunctionBody

Source

pub fn set_to_entry(&mut self)

Sets a cursor to an entry block.

+
Source

pub fn insert_inst(&mut self, inst: InstId)

Insert InstId to a location where a cursor points. +If you need to store and insert Inst, use [store_and_insert_inst].

+
§Panics
+

Panics if a cursor points CursorLocation::NoWhere.

+
Source

pub fn store_and_insert_inst(&mut self, data: Inst) -> InstId

Source

pub fn remove_inst(&mut self)

Remove a current pointed Inst from a function body. A cursor +proceeds to a next inst.

+
§Panics
+

Panics if a cursor doesn’t point CursorLocation::Inst.

+
Source

pub fn remove_block(&mut self)

Remove a current pointed block and contained insts from a function +body. A cursor proceeds to a next block.

+
§Panics
+

Panics if a cursor doesn’t point CursorLocation::Inst.

+
Source

pub fn insert_block(&mut self, block: BasicBlockId)

Insert BasicBlockId to a location where a cursor points. +If you need to store and insert BasicBlock, use +[store_and_insert_block].

+
§Panics
+

Panics if a cursor points CursorLocation::NoWhere.

+
Source

pub fn store_and_insert_block(&mut self, block: BasicBlock) -> BasicBlockId

Source

pub fn map_result(&mut self, result: AssignableValue) -> Option<ValueId>

Source

pub fn expect_inst(&self) -> InstId

Returns current inst that cursor points.

+
§Panics
+

Panics if a cursor doesn’t point CursorLocation::Inst.

+
Source

pub fn expect_block(&self) -> BasicBlockId

Returns current block that cursor points.

+
§Panics
+

Panics if a cursor points CursorLocation::NoWhere.

+

Auto Trait Implementations§

§

impl<'a> Freeze for BodyCursor<'a>

§

impl<'a> RefUnwindSafe for BodyCursor<'a>

§

impl<'a> Send for BodyCursor<'a>

§

impl<'a> Sync for BodyCursor<'a>

§

impl<'a> Unpin for BodyCursor<'a>

§

impl<'a> !UnwindSafe for BodyCursor<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_order/index.html b/compiler-docs/fe_mir/ir/body_order/index.html new file mode 100644 index 0000000000..b90dd98fe0 --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_order/index.html @@ -0,0 +1 @@ +fe_mir::ir::body_order - Rust

Module body_order

Source

Structs§

BodyOrder
Represents basic block order and instruction order.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_order/sidebar-items.js b/compiler-docs/fe_mir/ir/body_order/sidebar-items.js new file mode 100644 index 0000000000..a8e1023e35 --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_order/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["BodyOrder"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/body_order/struct.BodyOrder.html b/compiler-docs/fe_mir/ir/body_order/struct.BodyOrder.html new file mode 100644 index 0000000000..fcf587721c --- /dev/null +++ b/compiler-docs/fe_mir/ir/body_order/struct.BodyOrder.html @@ -0,0 +1,132 @@ +BodyOrder in fe_mir::ir::body_order - Rust

Struct BodyOrder

Source
pub struct BodyOrder { /* private fields */ }
Expand description

Represents basic block order and instruction order.

+

Implementations§

Source§

impl BodyOrder

Source

pub fn new(entry_block: BasicBlockId) -> Self

Source

pub fn entry(&self) -> BasicBlockId

Returns an entry block of a function body.

+
Source

pub fn last_block(&self) -> BasicBlockId

Returns a last block of a function body.

+
Source

pub fn is_block_empty(&self, block: BasicBlockId) -> bool

Returns true if a block doesn’t contain any block.

+
Source

pub fn is_block_inserted(&self, block: BasicBlockId) -> bool

Returns true if a function body contains a given block.

+
Source

pub fn block_num(&self) -> usize

Returns a number of block in a function.

+
Source

pub fn prev_block(&self, block: BasicBlockId) -> Option<BasicBlockId>

Returns a previous block of a given block.

+
§Panics
+

Panics if block is not inserted yet.

+
Source

pub fn next_block(&self, block: BasicBlockId) -> Option<BasicBlockId>

Returns a next block of a given block.

+
§Panics
+

Panics if block is not inserted yet.

+
Source

pub fn is_inst_inserted(&self, inst: InstId) -> bool

Returns true is a given inst is inserted.

+
Source

pub fn first_inst(&self, block: BasicBlockId) -> Option<InstId>

Returns first instruction of a block if exists.

+
§Panics
+

Panics if block is not inserted yet.

+
Source

pub fn terminator( + &self, + store: &BodyDataStore, + block: BasicBlockId, +) -> Option<InstId>

Returns a terminator instruction of a block.

+
§Panics
+

Panics if

+
    +
  1. block is not inserted yet.
  2. +
+
Source

pub fn is_terminated(&self, store: &BodyDataStore, block: BasicBlockId) -> bool

Returns true if a block is terminated.

+
Source

pub fn last_inst(&self, block: BasicBlockId) -> Option<InstId>

Returns a last instruction of a block.

+
§Panics
+

Panics if block is not inserted yet.

+
Source

pub fn prev_inst(&self, inst: InstId) -> Option<InstId>

Returns a previous instruction of a given inst.

+
§Panics
+

Panics if inst is not inserted yet.

+
Source

pub fn next_inst(&self, inst: InstId) -> Option<InstId>

Returns a next instruction of a given inst.

+
§Panics
+

Panics if inst is not inserted yet.

+
Source

pub fn inst_block(&self, inst: InstId) -> BasicBlockId

Returns a block to which a given inst belongs.

+
§Panics
+

Panics if inst is not inserted yet.

+
Source

pub fn iter_block(&self) -> impl Iterator<Item = BasicBlockId> + '_

Returns an iterator which iterates all basic blocks in a function body +in pre-order.

+
Source

pub fn iter_inst( + &self, + block: BasicBlockId, +) -> impl Iterator<Item = InstId> + '_

Returns an iterator which iterates all instruction in a given block in +pre-order.

+
§Panics
+

Panics if block is not inserted yet.

+
Source

pub fn append_block(&mut self, block: BasicBlockId)

Appends a given block to a function body.

+
§Panics
+

Panics if a given block is already inserted to a function.

+
Source

pub fn insert_block_before_block( + &mut self, + block: BasicBlockId, + before: BasicBlockId, +)

Inserts a given block before a before block.

+
§Panics
+

Panics if

+
    +
  1. a given block is already inserted.
  2. +
  3. a given before block is NOTE inserted yet.
  4. +
+
Source

pub fn insert_block_after_block( + &mut self, + block: BasicBlockId, + after: BasicBlockId, +)

Inserts a given block after a after block.

+
§Panics
+

Panics if

+
    +
  1. a given block is already inserted.
  2. +
  3. a given after block is NOTE inserted yet.
  4. +
+
Source

pub fn remove_block(&mut self, block: BasicBlockId)

Remove a given block from a function. All instructions in a block are +also removed.

+
§Panics
+

Panics if

+
    +
  1. a given block is NOT inserted.
  2. +
  3. a block is the last one block in a function.
  4. +
+
Source

pub fn append_inst(&mut self, inst: InstId, block: BasicBlockId)

Appends inst to the end of a block

+
§Panics
+

Panics if

+
    +
  1. a given block is NOT inserted.
  2. +
  3. a given inst is already inserted.
  4. +
+
Source

pub fn prepend_inst(&mut self, inst: InstId, block: BasicBlockId)

Prepends inst to the beginning of a block

+
§Panics
+

Panics if

+
    +
  1. a given block is NOT inserted.
  2. +
  3. a given inst is already inserted.
  4. +
+
Source

pub fn insert_inst_before_inst(&mut self, inst: InstId, before: InstId)

Insert inst before before inst.

+
§Panics
+

Panics if

+
    +
  1. a given before is NOT inserted.
  2. +
  3. a given inst is already inserted.
  4. +
+
Source

pub fn insert_inst_after(&mut self, inst: InstId, after: InstId)

Insert inst after after inst.

+
§Panics
+

Panics if

+
    +
  1. a given after is NOT inserted.
  2. +
  3. a given inst is already inserted.
  4. +
+
Source

pub fn remove_inst(&mut self, inst: InstId)

Remove instruction from the function body.

+
§Panics
+

Panics if a given inst is not inserted.

+

Trait Implementations§

Source§

impl Clone for BodyOrder

Source§

fn clone(&self) -> BodyOrder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BodyOrder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BodyOrder

Source§

fn eq(&self, other: &BodyOrder) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for BodyOrder

Source§

impl StructuralPartialEq for BodyOrder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/constant/enum.ConstantValue.html b/compiler-docs/fe_mir/ir/constant/enum.ConstantValue.html new file mode 100644 index 0000000000..bc237784ce --- /dev/null +++ b/compiler-docs/fe_mir/ir/constant/enum.ConstantValue.html @@ -0,0 +1,26 @@ +ConstantValue in fe_mir::ir::constant - Rust

Enum ConstantValue

Source
pub enum ConstantValue {
+    Immediate(BigInt),
+    Str(SmolStr),
+    Bool(bool),
+}

Variants§

§

Immediate(BigInt)

§

Str(SmolStr)

§

Bool(bool)

Trait Implementations§

Source§

impl Clone for ConstantValue

Source§

fn clone(&self) -> ConstantValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConstantValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Constant> for ConstantValue

Source§

fn from(value: Constant) -> Self

Converts to this type from the input type.
Source§

impl Hash for ConstantValue

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ConstantValue

Source§

fn eq(&self, other: &ConstantValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for ConstantValue

Source§

impl StructuralPartialEq for ConstantValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/constant/index.html b/compiler-docs/fe_mir/ir/constant/index.html new file mode 100644 index 0000000000..e2ca2ff9cf --- /dev/null +++ b/compiler-docs/fe_mir/ir/constant/index.html @@ -0,0 +1 @@ +fe_mir::ir::constant - Rust

Module constant

Source

Structs§

Constant
ConstantId
An interned Id for Constant.

Enums§

ConstantValue
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/constant/sidebar-items.js b/compiler-docs/fe_mir/ir/constant/sidebar-items.js new file mode 100644 index 0000000000..7ae3b94cad --- /dev/null +++ b/compiler-docs/fe_mir/ir/constant/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["ConstantValue"],"struct":["Constant","ConstantId"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/constant/struct.Constant.html b/compiler-docs/fe_mir/ir/constant/struct.Constant.html new file mode 100644 index 0000000000..45b90e1b45 --- /dev/null +++ b/compiler-docs/fe_mir/ir/constant/struct.Constant.html @@ -0,0 +1,33 @@ +Constant in fe_mir::ir::constant - Rust

Struct Constant

Source
pub struct Constant {
+    pub name: SmolStr,
+    pub value: ConstantValue,
+    pub ty: TypeId,
+    pub module_id: ModuleId,
+    pub source: SourceInfo,
+}

Fields§

§name: SmolStr

A name of a constant.

+
§value: ConstantValue

A value of a constant.

+
§ty: TypeId

A type of a constant.

+
§module_id: ModuleId

A module where a constant is declared.

+
§source: SourceInfo

A span where a constant is declared.

+

Trait Implementations§

Source§

impl Clone for Constant

Source§

fn clone(&self) -> Constant

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Constant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Constant

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Constant

Source§

fn eq(&self, other: &Constant) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Constant

Source§

impl StructuralPartialEq for Constant

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/constant/struct.ConstantId.html b/compiler-docs/fe_mir/ir/constant/struct.ConstantId.html new file mode 100644 index 0000000000..de18db7ec9 --- /dev/null +++ b/compiler-docs/fe_mir/ir/constant/struct.ConstantId.html @@ -0,0 +1,23 @@ +ConstantId in fe_mir::ir::constant - Rust

Struct ConstantId

Source
pub struct ConstantId(/* private fields */);
Expand description

An interned Id for Constant.

+

Implementations§

Source§

impl ConstantId

Source

pub fn data(self, db: &dyn MirDb) -> Rc<Constant>

Source

pub fn ty(self, db: &dyn MirDb) -> TypeId

Trait Implementations§

Source§

impl Clone for ConstantId

Source§

fn clone(&self) -> ConstantId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConstantId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ConstantId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for ConstantId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl PartialEq for ConstantId

Source§

fn eq(&self, other: &ConstantId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for ConstantId

Source§

impl Eq for ConstantId

Source§

impl StructuralPartialEq for ConstantId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/function/enum.Linkage.html b/compiler-docs/fe_mir/ir/function/enum.Linkage.html new file mode 100644 index 0000000000..553c2b9735 --- /dev/null +++ b/compiler-docs/fe_mir/ir/function/enum.Linkage.html @@ -0,0 +1,31 @@ +Linkage in fe_mir::ir::function - Rust

Enum Linkage

Source
pub enum Linkage {
+    Private,
+    Public,
+    Export,
+}

Variants§

§

Private

A function can only be called within the same module.

+
§

Public

A function can be called from other modules, but can NOT be called from +other accounts and transactions.

+
§

Export

A function can be called from other modules, and also can be called from +other accounts and transactions.

+

Implementations§

Trait Implementations§

Source§

impl Clone for Linkage

Source§

fn clone(&self) -> Linkage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Linkage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Linkage

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Linkage

Source§

fn eq(&self, other: &Linkage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for Linkage

Source§

impl Eq for Linkage

Source§

impl StructuralPartialEq for Linkage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/function/index.html b/compiler-docs/fe_mir/ir/function/index.html new file mode 100644 index 0000000000..2a9fdf35ac --- /dev/null +++ b/compiler-docs/fe_mir/ir/function/index.html @@ -0,0 +1,3 @@ +fe_mir::ir::function - Rust

Module function

Source

Structs§

BodyDataStore
A collection of basic block, instructions and values appear in a function +body.
FunctionBody
A function body, which is not stored in salsa db to enable in-place +transformation.
FunctionId
FunctionParam
FunctionSignature
Represents function signature.

Enums§

Linkage
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/function/sidebar-items.js b/compiler-docs/fe_mir/ir/function/sidebar-items.js new file mode 100644 index 0000000000..e32c20ed9a --- /dev/null +++ b/compiler-docs/fe_mir/ir/function/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Linkage"],"struct":["BodyDataStore","FunctionBody","FunctionId","FunctionParam","FunctionSignature"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/function/struct.BodyDataStore.html b/compiler-docs/fe_mir/ir/function/struct.BodyDataStore.html new file mode 100644 index 0000000000..e836f8eba5 --- /dev/null +++ b/compiler-docs/fe_mir/ir/function/struct.BodyDataStore.html @@ -0,0 +1,29 @@ +BodyDataStore in fe_mir::ir::function - Rust

Struct BodyDataStore

Source
pub struct BodyDataStore { /* private fields */ }
Expand description

A collection of basic block, instructions and values appear in a function +body.

+

Implementations§

Source§

impl BodyDataStore

Source

pub fn store_inst(&mut self, inst: Inst) -> InstId

Source

pub fn inst_data(&self, inst: InstId) -> &Inst

Source

pub fn inst_data_mut(&mut self, inst: InstId) -> &mut Inst

Source

pub fn replace_inst(&mut self, inst: InstId, new: Inst) -> Inst

Source

pub fn store_value(&mut self, value: Value) -> ValueId

Source

pub fn is_nop(&self, inst: InstId) -> bool

Source

pub fn is_terminator(&self, inst: InstId) -> bool

Source

pub fn branch_info(&self, inst: InstId) -> BranchInfo<'_>

Source

pub fn value_data(&self, value: ValueId) -> &Value

Source

pub fn value_data_mut(&mut self, value: ValueId) -> &mut Value

Source

pub fn values(&self) -> impl Iterator<Item = &Value>

Source

pub fn values_mut(&mut self) -> impl Iterator<Item = &mut Value>

Source

pub fn store_block(&mut self, block: BasicBlock) -> BasicBlockId

Source

pub fn inst_result(&self, inst: InstId) -> Option<&AssignableValue>

Returns an instruction result

+
Source

pub fn map_result(&mut self, inst: InstId, result: AssignableValue)

Source

pub fn remove_inst_result(&mut self, inst: InstId) -> Option<AssignableValue>

Source

pub fn rewrite_branch_dest( + &mut self, + inst: InstId, + from: BasicBlockId, + to: BasicBlockId, +)

Source

pub fn value_ty(&self, vid: ValueId) -> TypeId

Source

pub fn locals(&self) -> &[ValueId]

Source

pub fn locals_mut(&mut self) -> &[ValueId]

Source

pub fn func_args(&self) -> impl Iterator<Item = ValueId> + '_

Source

pub fn func_args_mut(&mut self) -> impl Iterator<Item = &mut Value>

Source

pub fn local_name(&self, value: ValueId) -> Option<&str>

Returns Some(local_name) if value is Value::Local.

+
Source

pub fn replace_value(&mut self, value: ValueId, to: Value) -> Value

Trait Implementations§

Source§

impl Clone for BodyDataStore

Source§

fn clone(&self) -> BodyDataStore

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BodyDataStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BodyDataStore

Source§

fn default() -> BodyDataStore

Returns the “default value” for a type. Read more
Source§

impl PartialEq for BodyDataStore

Source§

fn eq(&self, other: &BodyDataStore) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for BodyDataStore

Source§

impl StructuralPartialEq for BodyDataStore

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/function/struct.FunctionBody.html b/compiler-docs/fe_mir/ir/function/struct.FunctionBody.html new file mode 100644 index 0000000000..9d9352964c --- /dev/null +++ b/compiler-docs/fe_mir/ir/function/struct.FunctionBody.html @@ -0,0 +1,28 @@ +FunctionBody in fe_mir::ir::function - Rust

Struct FunctionBody

Source
pub struct FunctionBody {
+    pub fid: FunctionId,
+    pub store: BodyDataStore,
+    pub order: BodyOrder,
+    pub source: SourceInfo,
+}
Expand description

A function body, which is not stored in salsa db to enable in-place +transformation.

+

Fields§

§fid: FunctionId§store: BodyDataStore§order: BodyOrder

Tracks order of basic blocks and instructions in a function body.

+
§source: SourceInfo

Implementations§

Source§

impl FunctionBody

Source

pub fn new(fid: FunctionId, source: SourceInfo) -> Self

Trait Implementations§

Source§

impl Clone for FunctionBody

Source§

fn clone(&self) -> FunctionBody

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionBody

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for FunctionBody

Source§

fn eq(&self, other: &FunctionBody) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for FunctionBody

Source§

impl StructuralPartialEq for FunctionBody

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/function/struct.FunctionId.html b/compiler-docs/fe_mir/ir/function/struct.FunctionId.html new file mode 100644 index 0000000000..4b8d4f1a4d --- /dev/null +++ b/compiler-docs/fe_mir/ir/function/struct.FunctionId.html @@ -0,0 +1,33 @@ +FunctionId in fe_mir::ir::function - Rust

Struct FunctionId

Source
pub struct FunctionId(pub u32);

Tuple Fields§

§0: u32

Implementations§

Source§

impl FunctionId

Source

pub fn signature(self, db: &dyn MirDb) -> Rc<FunctionSignature>

Source

pub fn return_type(self, db: &dyn MirDb) -> Option<TypeId>

Source

pub fn linkage(self, db: &dyn MirDb) -> Linkage

Source

pub fn analyzer_func(self, db: &dyn MirDb) -> FunctionId

Source

pub fn body(self, db: &dyn MirDb) -> Rc<FunctionBody>

Source

pub fn module(self, db: &dyn MirDb) -> ModuleId

Source

pub fn is_contract_init(self, db: &dyn MirDb) -> bool

Source

pub fn type_suffix(&self, db: &dyn MirDb) -> SmolStr

Returns a type suffix if a generic function was monomorphized

+
Source

pub fn name(&self, db: &dyn MirDb) -> SmolStr

Source

pub fn debug_name(self, db: &dyn MirDb) -> SmolStr

Returns class_name::fn_name if a function is a method else fn_name.

+
Source

pub fn returns_aggregate(self, db: &dyn MirDb) -> bool

Trait Implementations§

Source§

impl Clone for FunctionId

Source§

fn clone(&self) -> FunctionId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FunctionId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for FunctionId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for FunctionId

Source§

fn cmp(&self, other: &FunctionId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for FunctionId

Source§

fn eq(&self, other: &FunctionId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for FunctionId

Source§

fn partial_cmp(&self, other: &FunctionId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for FunctionId

Source§

impl Eq for FunctionId

Source§

impl StructuralPartialEq for FunctionId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<N> NodeTrait for N
where + N: Copy + Ord + Hash,

\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/function/struct.FunctionParam.html b/compiler-docs/fe_mir/ir/function/struct.FunctionParam.html new file mode 100644 index 0000000000..4c7a826bd5 --- /dev/null +++ b/compiler-docs/fe_mir/ir/function/struct.FunctionParam.html @@ -0,0 +1,26 @@ +FunctionParam in fe_mir::ir::function - Rust

Struct FunctionParam

Source
pub struct FunctionParam {
+    pub name: SmolStr,
+    pub ty: TypeId,
+    pub source: SourceInfo,
+}

Fields§

§name: SmolStr§ty: TypeId§source: SourceInfo

Trait Implementations§

Source§

impl Clone for FunctionParam

Source§

fn clone(&self) -> FunctionParam

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionParam

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FunctionParam

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FunctionParam

Source§

fn eq(&self, other: &FunctionParam) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for FunctionParam

Source§

impl StructuralPartialEq for FunctionParam

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/function/struct.FunctionSignature.html b/compiler-docs/fe_mir/ir/function/struct.FunctionSignature.html new file mode 100644 index 0000000000..4d14026e65 --- /dev/null +++ b/compiler-docs/fe_mir/ir/function/struct.FunctionSignature.html @@ -0,0 +1,30 @@ +FunctionSignature in fe_mir::ir::function - Rust

Struct FunctionSignature

Source
pub struct FunctionSignature {
+    pub params: Vec<FunctionParam>,
+    pub resolved_generics: BTreeMap<SmolStr, TypeId>,
+    pub return_type: Option<TypeId>,
+    pub module_id: ModuleId,
+    pub analyzer_func_id: FunctionId,
+    pub linkage: Linkage,
+}
Expand description

Represents function signature.

+

Fields§

§params: Vec<FunctionParam>§resolved_generics: BTreeMap<SmolStr, TypeId>§return_type: Option<TypeId>§module_id: ModuleId§analyzer_func_id: FunctionId§linkage: Linkage

Trait Implementations§

Source§

impl Clone for FunctionSignature

Source§

fn clone(&self) -> FunctionSignature

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionSignature

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FunctionSignature

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FunctionSignature

Source§

fn eq(&self, other: &FunctionSignature) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for FunctionSignature

Source§

impl StructuralPartialEq for FunctionSignature

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/index.html b/compiler-docs/fe_mir/ir/index.html new file mode 100644 index 0000000000..438c527979 --- /dev/null +++ b/compiler-docs/fe_mir/ir/index.html @@ -0,0 +1,3 @@ +fe_mir::ir - Rust

Module ir

Source

Re-exports§

pub use basic_block::BasicBlock;
pub use basic_block::BasicBlockId;
pub use constant::Constant;
pub use constant::ConstantId;
pub use function::FunctionBody;
pub use function::FunctionId;
pub use function::FunctionParam;
pub use function::FunctionSignature;
pub use inst::Inst;
pub use inst::InstId;
pub use types::Type;
pub use types::TypeId;
pub use types::TypeKind;
pub use value::Value;
pub use value::ValueId;

Modules§

basic_block
body_builder
body_cursor
This module provides a collection of structs to modify function body +in-place.
body_order
constant
function
inst
types
value

Structs§

SourceInfo
An original source information that indicates where mir entities derive +from. SourceInfo is mainly used for diagnostics.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/enum.BinOp.html b/compiler-docs/fe_mir/ir/inst/enum.BinOp.html new file mode 100644 index 0000000000..cd8f2e668f --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/enum.BinOp.html @@ -0,0 +1,43 @@ +BinOp in fe_mir::ir::inst - Rust

Enum BinOp

Source
pub enum BinOp {
+
Show 19 variants Add, + Sub, + Mul, + Div, + Mod, + Pow, + Shl, + Shr, + BitOr, + BitXor, + BitAnd, + LogicalAnd, + LogicalOr, + Eq, + Ne, + Ge, + Gt, + Le, + Lt, +
}

Variants§

§

Add

§

Sub

§

Mul

§

Div

§

Mod

§

Pow

§

Shl

§

Shr

§

BitOr

§

BitXor

§

BitAnd

§

LogicalAnd

§

LogicalOr

§

Eq

§

Ne

§

Ge

§

Gt

§

Le

§

Lt

Trait Implementations§

Source§

impl Clone for BinOp

Source§

fn clone(&self) -> BinOp

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BinOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for BinOp

Source§

fn fmt(&self, w: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for BinOp

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BinOp

Source§

fn eq(&self, other: &BinOp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for BinOp

Source§

impl Eq for BinOp

Source§

impl StructuralPartialEq for BinOp

Auto Trait Implementations§

§

impl Freeze for BinOp

§

impl RefUnwindSafe for BinOp

§

impl Send for BinOp

§

impl Sync for BinOp

§

impl Unpin for BinOp

§

impl UnwindSafe for BinOp

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/enum.BranchInfo.html b/compiler-docs/fe_mir/ir/inst/enum.BranchInfo.html new file mode 100644 index 0000000000..3484beccf7 --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/enum.BranchInfo.html @@ -0,0 +1,16 @@ +BranchInfo in fe_mir::ir::inst - Rust

Enum BranchInfo

Source
pub enum BranchInfo<'a> {
+    NotBranch,
+    Jump(BasicBlockId),
+    Branch(ValueId, BasicBlockId, BasicBlockId),
+    Switch(ValueId, &'a SwitchTable, Option<BasicBlockId>),
+}

Variants§

Implementations§

Source§

impl<'a> BranchInfo<'a>

Source

pub fn is_not_a_branch(&self) -> bool

Source

pub fn block_iter(&self) -> BlockIter<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for BranchInfo<'a>

§

impl<'a> RefUnwindSafe for BranchInfo<'a>

§

impl<'a> Send for BranchInfo<'a>

§

impl<'a> Sync for BranchInfo<'a>

§

impl<'a> Unpin for BranchInfo<'a>

§

impl<'a> UnwindSafe for BranchInfo<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/enum.CallType.html b/compiler-docs/fe_mir/ir/inst/enum.CallType.html new file mode 100644 index 0000000000..3d699b305d --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/enum.CallType.html @@ -0,0 +1,26 @@ +CallType in fe_mir::ir::inst - Rust

Enum CallType

Source
pub enum CallType {
+    Internal,
+    External,
+}

Variants§

§

Internal

§

External

Trait Implementations§

Source§

impl Clone for CallType

Source§

fn clone(&self) -> CallType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CallType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CallType

Source§

fn fmt(&self, w: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for CallType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CallType

Source§

fn eq(&self, other: &CallType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for CallType

Source§

impl Eq for CallType

Source§

impl StructuralPartialEq for CallType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/enum.CastKind.html b/compiler-docs/fe_mir/ir/inst/enum.CastKind.html new file mode 100644 index 0000000000..0dc34b1ebc --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/enum.CastKind.html @@ -0,0 +1,27 @@ +CastKind in fe_mir::ir::inst - Rust

Enum CastKind

Source
pub enum CastKind {
+    Primitive,
+    Untag,
+}

Variants§

§

Primitive

A cast from a primitive type to a primitive type.

+
§

Untag

A cast from an enum type to its underlying type.

+

Trait Implementations§

Source§

impl Clone for CastKind

Source§

fn clone(&self) -> CastKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CastKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for CastKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CastKind

Source§

fn eq(&self, other: &CastKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for CastKind

Source§

impl StructuralPartialEq for CastKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/enum.InstKind.html b/compiler-docs/fe_mir/ir/inst/enum.InstKind.html new file mode 100644 index 0000000000..8612818ed4 --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/enum.InstKind.html @@ -0,0 +1,121 @@ +InstKind in fe_mir::ir::inst - Rust

Enum InstKind

Source
pub enum InstKind {
+
Show 23 variants Declare { + local: ValueId, + }, + Unary { + op: UnOp, + value: ValueId, + }, + Binary { + op: BinOp, + lhs: ValueId, + rhs: ValueId, + }, + Cast { + kind: CastKind, + value: ValueId, + to: TypeId, + }, + AggregateConstruct { + ty: TypeId, + args: Vec<ValueId>, + }, + Bind { + src: ValueId, + }, + MemCopy { + src: ValueId, + }, + Load { + src: ValueId, + }, + AggregateAccess { + value: ValueId, + indices: Vec<ValueId>, + }, + MapAccess { + key: ValueId, + value: ValueId, + }, + Call { + func: FunctionId, + args: Vec<ValueId>, + call_type: CallType, + }, + Jump { + dest: BasicBlockId, + }, + Branch { + cond: ValueId, + then: BasicBlockId, + else_: BasicBlockId, + }, + Switch { + disc: ValueId, + table: SwitchTable, + default: Option<BasicBlockId>, + }, + Revert { + arg: Option<ValueId>, + }, + Emit { + arg: ValueId, + }, + Return { + arg: Option<ValueId>, + }, + Keccak256 { + arg: ValueId, + }, + AbiEncode { + arg: ValueId, + }, + Nop, + Create { + value: ValueId, + contract: ContractId, + }, + Create2 { + value: ValueId, + salt: ValueId, + contract: ContractId, + }, + YulIntrinsic { + op: YulIntrinsicOp, + args: Vec<ValueId>, + }, +
}

Variants§

§

Declare

This is not a real instruction, just used to tag a position where a +local is declared.

+

Fields

§local: ValueId
§

Unary

Unary instruction.

+

Fields

§op: UnOp
§value: ValueId
§

Binary

Binary instruction.

+

Fields

§

Cast

Fields

§value: ValueId
§

AggregateConstruct

Constructs aggregate value, i.e. struct, tuple and array.

+

Fields

§args: Vec<ValueId>
§

Bind

Fields

§

MemCopy

Fields

§

Load

Load a primitive value from a ptr

+

Fields

§

AggregateAccess

Access to aggregate fields or elements.

+

§Example

struct Foo:
+    x: i32
+    y: Array<i32, 8>
+

foo.y is lowered into `AggregateAccess(foo, [1])’ for example.

+

Fields

§value: ValueId
§indices: Vec<ValueId>
§

MapAccess

Fields

§value: ValueId
§

Call

Fields

§args: Vec<ValueId>
§call_type: CallType
§

Jump

Unconditional jump instruction.

+

Fields

§

Branch

Conditional branching instruction.

+

Fields

§cond: ValueId
§

Switch

Fields

§disc: ValueId
§

Revert

Fields

§

Emit

Fields

§

Return

Fields

§

Keccak256

Fields

§

AbiEncode

Fields

§

Nop

§

Create

Fields

§value: ValueId
§contract: ContractId
§

Create2

Fields

§value: ValueId
§salt: ValueId
§contract: ContractId
§

YulIntrinsic

Trait Implementations§

Source§

impl Clone for InstKind

Source§

fn clone(&self) -> InstKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InstKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for InstKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for InstKind

Source§

fn eq(&self, other: &InstKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for InstKind

Source§

impl StructuralPartialEq for InstKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/enum.IterBase.html b/compiler-docs/fe_mir/ir/inst/enum.IterBase.html new file mode 100644 index 0000000000..41791364cd --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/enum.IterBase.html @@ -0,0 +1,231 @@ +IterBase in fe_mir::ir::inst - Rust

Enum IterBase

Source
pub enum IterBase<'a, T> {
+    Zero,
+    One(Option<T>),
+    Slice(Iter<'a, T>),
+    Chain(Box<IterBase<'a, T>>, Box<IterBase<'a, T>>),
+}

Variants§

§

Zero

§

One(Option<T>)

§

Slice(Iter<'a, T>)

§

Chain(Box<IterBase<'a, T>>, Box<IterBase<'a, T>>)

Trait Implementations§

Source§

impl<'a, T> Iterator for IterBase<'a, T>
where + T: Copy,

Source§

type Item = T

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
Source§

fn next_chunk<const N: usize>( + &mut self, +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · Source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · Source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.29.0 · Source§

fn flatten(self) -> Flatten<Self>
where + Self: Sized, + Self::Item: IntoIterator,

Creates an iterator that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn try_collect<B>( + &mut self, +) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
where + Self: Sized, + Self::Item: Try, + <Self::Item as Try>::Residual: Residual<B>, + B: FromIterator<<Self::Item as Try>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect)
Fallibly transforms an iterator into a collection, short circuiting if +a failure is encountered. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
Source§

fn try_reduce<R>( + &mut self, + f: impl FnMut(Self::Item, Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
Source§

fn try_find<R>( + &mut self, + f: impl FnMut(&Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: Copy + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: Clone + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for IterBase<'a, T>
where + T: Freeze,

§

impl<'a, T> RefUnwindSafe for IterBase<'a, T>
where + T: RefUnwindSafe,

§

impl<'a, T> Send for IterBase<'a, T>
where + T: Send + Sync,

§

impl<'a, T> Sync for IterBase<'a, T>
where + T: Sync,

§

impl<'a, T> Unpin for IterBase<'a, T>
where + T: Unpin,

§

impl<'a, T> UnwindSafe for IterBase<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<I> IntoIterator for I
where + I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<I> UnicodeNormalization<I> for I
where + I: Iterator<Item = char>,

§

fn nfd(self) -> Decompositions<I>

Returns an iterator over the string in Unicode Normalization Form D +(canonical decomposition).
§

fn nfkd(self) -> Decompositions<I>

Returns an iterator over the string in Unicode Normalization Form KD +(compatibility decomposition).
§

fn nfc(self) -> Recompositions<I>

An Iterator over the string in Unicode Normalization Form C +(canonical decomposition followed by canonical composition).
§

fn nfkc(self) -> Recompositions<I>

An Iterator over the string in Unicode Normalization Form KC +(compatibility decomposition followed by canonical composition).
§

fn cjk_compat_variants(self) -> Replacements<I>

A transformation which replaces CJK Compatibility Ideograph codepoints +with normal forms using Standardized Variation Sequences. This is not +part of the canonical or compatibility decomposition algorithms, but +performing it before those algorithms produces normalized output which +better preserves the intent of the original text. Read more
§

fn stream_safe(self) -> StreamSafe<I>

An Iterator over the string with Conjoining Grapheme Joiner characters +inserted according to the Stream-Safe Text Process (UAX15-D4)
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/enum.IterMutBase.html b/compiler-docs/fe_mir/ir/inst/enum.IterMutBase.html new file mode 100644 index 0000000000..8640746894 --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/enum.IterMutBase.html @@ -0,0 +1,217 @@ +IterMutBase in fe_mir::ir::inst - Rust

Enum IterMutBase

Source
pub enum IterMutBase<'a, T> {
+    Zero,
+    One(Option<&'a mut T>),
+    Slice(IterMut<'a, T>),
+    Chain(Box<IterMutBase<'a, T>>, Box<IterMutBase<'a, T>>),
+}

Variants§

§

Zero

§

One(Option<&'a mut T>)

§

Slice(IterMut<'a, T>)

§

Chain(Box<IterMutBase<'a, T>>, Box<IterMutBase<'a, T>>)

Trait Implementations§

Source§

impl<'a, T> Iterator for IterMutBase<'a, T>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
Source§

fn next_chunk<const N: usize>( + &mut self, +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · Source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · Source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.29.0 · Source§

fn flatten(self) -> Flatten<Self>
where + Self: Sized, + Self::Item: IntoIterator,

Creates an iterator that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn try_collect<B>( + &mut self, +) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
where + Self: Sized, + Self::Item: Try, + <Self::Item as Try>::Residual: Residual<B>, + B: FromIterator<<Self::Item as Try>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect)
Fallibly transforms an iterator into a collection, short circuiting if +a failure is encountered. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
Source§

fn try_reduce<R>( + &mut self, + f: impl FnMut(Self::Item, Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
Source§

fn try_find<R>( + &mut self, + f: impl FnMut(&Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: Copy + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: Clone + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for IterMutBase<'a, T>

§

impl<'a, T> RefUnwindSafe for IterMutBase<'a, T>
where + T: RefUnwindSafe,

§

impl<'a, T> Send for IterMutBase<'a, T>
where + T: Send,

§

impl<'a, T> Sync for IterMutBase<'a, T>
where + T: Sync,

§

impl<'a, T> Unpin for IterMutBase<'a, T>

§

impl<'a, T> !UnwindSafe for IterMutBase<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<I> IntoIterator for I
where + I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/enum.UnOp.html b/compiler-docs/fe_mir/ir/inst/enum.UnOp.html new file mode 100644 index 0000000000..b24b67c0f2 --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/enum.UnOp.html @@ -0,0 +1,30 @@ +UnOp in fe_mir::ir::inst - Rust

Enum UnOp

Source
pub enum UnOp {
+    Not,
+    Neg,
+    Inv,
+}

Variants§

§

Not

not operator for logical inversion.

+
§

Neg

- operator for negation.

+
§

Inv

~ operator for bitwise inversion.

+

Trait Implementations§

Source§

impl Clone for UnOp

Source§

fn clone(&self) -> UnOp

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UnOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for UnOp

Source§

fn fmt(&self, w: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for UnOp

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for UnOp

Source§

fn eq(&self, other: &UnOp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for UnOp

Source§

impl Eq for UnOp

Source§

impl StructuralPartialEq for UnOp

Auto Trait Implementations§

§

impl Freeze for UnOp

§

impl RefUnwindSafe for UnOp

§

impl Send for UnOp

§

impl Sync for UnOp

§

impl Unpin for UnOp

§

impl UnwindSafe for UnOp

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/enum.YulIntrinsicOp.html b/compiler-docs/fe_mir/ir/inst/enum.YulIntrinsicOp.html new file mode 100644 index 0000000000..883b83d9dc --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/enum.YulIntrinsicOp.html @@ -0,0 +1,100 @@ +YulIntrinsicOp in fe_mir::ir::inst - Rust

Enum YulIntrinsicOp

Source
pub enum YulIntrinsicOp {
+
Show 76 variants Stop, + Add, + Sub, + Mul, + Div, + Sdiv, + Mod, + Smod, + Exp, + Not, + Lt, + Gt, + Slt, + Sgt, + Eq, + Iszero, + And, + Or, + Xor, + Byte, + Shl, + Shr, + Sar, + Addmod, + Mulmod, + Signextend, + Keccak256, + Pc, + Pop, + Mload, + Mstore, + Mstore8, + Sload, + Sstore, + Msize, + Gas, + Address, + Balance, + Selfbalance, + Caller, + Callvalue, + Calldataload, + Calldatasize, + Calldatacopy, + Codesize, + Codecopy, + Extcodesize, + Extcodecopy, + Returndatasize, + Returndatacopy, + Extcodehash, + Create, + Create2, + Call, + Callcode, + Delegatecall, + Staticcall, + Return, + Revert, + Selfdestruct, + Invalid, + Log0, + Log1, + Log2, + Log3, + Log4, + Chainid, + Basefee, + Origin, + Gasprice, + Blockhash, + Coinbase, + Timestamp, + Number, + Prevrandao, + Gaslimit, +
}

Variants§

§

Stop

§

Add

§

Sub

§

Mul

§

Div

§

Sdiv

§

Mod

§

Smod

§

Exp

§

Not

§

Lt

§

Gt

§

Slt

§

Sgt

§

Eq

§

Iszero

§

And

§

Or

§

Xor

§

Byte

§

Shl

§

Shr

§

Sar

§

Addmod

§

Mulmod

§

Signextend

§

Keccak256

§

Pc

§

Pop

§

Mload

§

Mstore

§

Mstore8

§

Sload

§

Sstore

§

Msize

§

Gas

§

Address

§

Balance

§

Selfbalance

§

Caller

§

Callvalue

§

Calldataload

§

Calldatasize

§

Calldatacopy

§

Codesize

§

Codecopy

§

Extcodesize

§

Extcodecopy

§

Returndatasize

§

Returndatacopy

§

Extcodehash

§

Create

§

Create2

§

Call

§

Callcode

§

Delegatecall

§

Staticcall

§

Return

§

Revert

§

Selfdestruct

§

Invalid

§

Log0

§

Log1

§

Log2

§

Log3

§

Log4

§

Chainid

§

Basefee

§

Origin

§

Gasprice

§

Blockhash

§

Coinbase

§

Timestamp

§

Number

§

Prevrandao

§

Gaslimit

Implementations§

Trait Implementations§

Source§

impl Clone for YulIntrinsicOp

Source§

fn clone(&self) -> YulIntrinsicOp

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for YulIntrinsicOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for YulIntrinsicOp

Source§

fn fmt(&self, w: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Intrinsic> for YulIntrinsicOp

Source§

fn from(val: Intrinsic) -> Self

Converts to this type from the input type.
Source§

impl Hash for YulIntrinsicOp

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for YulIntrinsicOp

Source§

fn eq(&self, other: &YulIntrinsicOp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for YulIntrinsicOp

Source§

impl Eq for YulIntrinsicOp

Source§

impl StructuralPartialEq for YulIntrinsicOp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/index.html b/compiler-docs/fe_mir/ir/inst/index.html new file mode 100644 index 0000000000..4a6cd9608e --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/index.html @@ -0,0 +1 @@ +fe_mir::ir::inst - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/sidebar-items.js b/compiler-docs/fe_mir/ir/inst/sidebar-items.js new file mode 100644 index 0000000000..f72b94ba31 --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["BinOp","BranchInfo","CallType","CastKind","InstKind","IterBase","IterMutBase","UnOp","YulIntrinsicOp"],"struct":["Inst","SwitchTable"],"type":["BlockIter","InstId","ValueIter","ValueIterMut"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/struct.Inst.html b/compiler-docs/fe_mir/ir/inst/struct.Inst.html new file mode 100644 index 0000000000..9b5bbf4781 --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/struct.Inst.html @@ -0,0 +1,29 @@ +Inst in fe_mir::ir::inst - Rust

Struct Inst

Source
pub struct Inst {
+    pub kind: InstKind,
+    pub source: SourceInfo,
+}

Fields§

§kind: InstKind§source: SourceInfo

Implementations§

Source§

impl Inst

Source

pub fn new(kind: InstKind, source: SourceInfo) -> Self

Source

pub fn unary(op: UnOp, value: ValueId, source: SourceInfo) -> Self

Source

pub fn binary(op: BinOp, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> Self

Source

pub fn intrinsic( + op: YulIntrinsicOp, + args: Vec<ValueId>, + source: SourceInfo, +) -> Self

Source

pub fn nop() -> Self

Source

pub fn is_terminator(&self) -> bool

Source

pub fn branch_info(&self) -> BranchInfo<'_>

Source

pub fn args(&self) -> ValueIter<'_>

Source

pub fn args_mut(&mut self) -> ValueIterMut<'_>

Trait Implementations§

Source§

impl Clone for Inst

Source§

fn clone(&self) -> Inst

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Inst

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Inst

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Inst

Source§

fn eq(&self, other: &Inst) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Inst

Source§

impl StructuralPartialEq for Inst

Auto Trait Implementations§

§

impl Freeze for Inst

§

impl RefUnwindSafe for Inst

§

impl Send for Inst

§

impl Sync for Inst

§

impl Unpin for Inst

§

impl UnwindSafe for Inst

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/struct.SwitchTable.html b/compiler-docs/fe_mir/ir/inst/struct.SwitchTable.html new file mode 100644 index 0000000000..3071dfba42 --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/struct.SwitchTable.html @@ -0,0 +1,22 @@ +SwitchTable in fe_mir::ir::inst - Rust

Struct SwitchTable

Source
pub struct SwitchTable { /* private fields */ }

Implementations§

Source§

impl SwitchTable

Source

pub fn iter(&self) -> impl Iterator<Item = (ValueId, BasicBlockId)> + '_

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn add_arm(&mut self, value: ValueId, block: BasicBlockId)

Trait Implementations§

Source§

impl Clone for SwitchTable

Source§

fn clone(&self) -> SwitchTable

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SwitchTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SwitchTable

Source§

fn default() -> SwitchTable

Returns the “default value” for a type. Read more
Source§

impl Hash for SwitchTable

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SwitchTable

Source§

fn eq(&self, other: &SwitchTable) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for SwitchTable

Source§

impl StructuralPartialEq for SwitchTable

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/type.BlockIter.html b/compiler-docs/fe_mir/ir/inst/type.BlockIter.html new file mode 100644 index 0000000000..1c1ad8ce80 --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/type.BlockIter.html @@ -0,0 +1,6 @@ +BlockIter in fe_mir::ir::inst - Rust

Type Alias BlockIter

Source
pub type BlockIter<'a> = IterBase<'a, BasicBlockId>;

Aliased Type§

pub enum BlockIter<'a> {
+    Zero,
+    One(Option<Id<BasicBlock>>),
+    Slice(Iter<'a, Id<BasicBlock>>),
+    Chain(Box<IterBase<'a, Id<BasicBlock>>>, Box<IterBase<'a, Id<BasicBlock>>>),
+}

Variants§

§

Zero

§

One(Option<Id<BasicBlock>>)

§

Slice(Iter<'a, Id<BasicBlock>>)

§

Chain(Box<IterBase<'a, Id<BasicBlock>>>, Box<IterBase<'a, Id<BasicBlock>>>)

\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/type.InstId.html b/compiler-docs/fe_mir/ir/inst/type.InstId.html new file mode 100644 index 0000000000..7152f8541f --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/type.InstId.html @@ -0,0 +1,6 @@ +InstId in fe_mir::ir::inst - Rust

Type Alias InstId

Source
pub type InstId = Id<Inst>;

Aliased Type§

pub struct InstId { /* private fields */ }

Trait Implementations§

Source§

impl PrettyPrint for InstId

Source§

fn pretty_print<W: Write>( + &self, + db: &dyn MirDb, + store: &BodyDataStore, + w: &mut W, +) -> Result

Source§

fn pretty_string(&self, db: &dyn MirDb, store: &BodyDataStore) -> String

\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/type.ValueIter.html b/compiler-docs/fe_mir/ir/inst/type.ValueIter.html new file mode 100644 index 0000000000..81e3541d29 --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/type.ValueIter.html @@ -0,0 +1,6 @@ +ValueIter in fe_mir::ir::inst - Rust

Type Alias ValueIter

Source
pub type ValueIter<'a> = IterBase<'a, ValueId>;

Aliased Type§

pub enum ValueIter<'a> {
+    Zero,
+    One(Option<Id<Value>>),
+    Slice(Iter<'a, Id<Value>>),
+    Chain(Box<IterBase<'a, Id<Value>>>, Box<IterBase<'a, Id<Value>>>),
+}

Variants§

§

Zero

§

One(Option<Id<Value>>)

§

Slice(Iter<'a, Id<Value>>)

§

Chain(Box<IterBase<'a, Id<Value>>>, Box<IterBase<'a, Id<Value>>>)

\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/inst/type.ValueIterMut.html b/compiler-docs/fe_mir/ir/inst/type.ValueIterMut.html new file mode 100644 index 0000000000..a72b8711ec --- /dev/null +++ b/compiler-docs/fe_mir/ir/inst/type.ValueIterMut.html @@ -0,0 +1,6 @@ +ValueIterMut in fe_mir::ir::inst - Rust

Type Alias ValueIterMut

Source
pub type ValueIterMut<'a> = IterMutBase<'a, ValueId>;

Aliased Type§

pub enum ValueIterMut<'a> {
+    Zero,
+    One(Option<&'a mut Id<Value>>),
+    Slice(IterMut<'a, Id<Value>>),
+    Chain(Box<IterMutBase<'a, Id<Value>>>, Box<IterMutBase<'a, Id<Value>>>),
+}

Variants§

§

Zero

§

One(Option<&'a mut Id<Value>>)

§

Slice(IterMut<'a, Id<Value>>)

§

Chain(Box<IterMutBase<'a, Id<Value>>>, Box<IterMutBase<'a, Id<Value>>>)

\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/sidebar-items.js b/compiler-docs/fe_mir/ir/sidebar-items.js new file mode 100644 index 0000000000..5e2dfdb31f --- /dev/null +++ b/compiler-docs/fe_mir/ir/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["basic_block","body_builder","body_cursor","body_order","constant","function","inst","types","value"],"struct":["SourceInfo"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/struct.SourceInfo.html b/compiler-docs/fe_mir/ir/struct.SourceInfo.html new file mode 100644 index 0000000000..82ddf8ca66 --- /dev/null +++ b/compiler-docs/fe_mir/ir/struct.SourceInfo.html @@ -0,0 +1,27 @@ +SourceInfo in fe_mir::ir - Rust

Struct SourceInfo

Source
pub struct SourceInfo {
+    pub span: Span,
+    pub id: NodeId,
+}
Expand description

An original source information that indicates where mir entities derive +from. SourceInfo is mainly used for diagnostics.

+

Fields§

§span: Span§id: NodeId

Implementations§

Source§

impl SourceInfo

Source

pub fn dummy() -> Self

Source

pub fn is_dummy(&self) -> bool

Trait Implementations§

Source§

impl Clone for SourceInfo

Source§

fn clone(&self) -> SourceInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SourceInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> From<&Node<T>> for SourceInfo

Source§

fn from(node: &Node<T>) -> Self

Converts to this type from the input type.
Source§

impl Hash for SourceInfo

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SourceInfo

Source§

fn eq(&self, other: &SourceInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for SourceInfo

Source§

impl StructuralPartialEq for SourceInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/enum.TypeKind.html b/compiler-docs/fe_mir/ir/types/enum.TypeKind.html new file mode 100644 index 0000000000..677e0cf1e6 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/enum.TypeKind.html @@ -0,0 +1,47 @@ +TypeKind in fe_mir::ir::types - Rust

Enum TypeKind

Source
pub enum TypeKind {
+
Show 24 variants I8, + I16, + I32, + I64, + I128, + I256, + U8, + U16, + U32, + U64, + U128, + U256, + Bool, + Address, + Unit, + Array(ArrayDef), + String(usize), + Tuple(TupleDef), + Struct(StructDef), + Enum(EnumDef), + Contract(StructDef), + Map(MapDef), + MPtr(TypeId), + SPtr(TypeId), +
}

Variants§

§

I8

§

I16

§

I32

§

I64

§

I128

§

I256

§

U8

§

U16

§

U32

§

U64

§

U128

§

U256

§

Bool

§

Address

§

Unit

§

Array(ArrayDef)

§

String(usize)

§

Tuple(TupleDef)

§

Struct(StructDef)

§

Enum(EnumDef)

§

Contract(StructDef)

§

Map(MapDef)

§

MPtr(TypeId)

§

SPtr(TypeId)

Trait Implementations§

Source§

impl Clone for TypeKind

Source§

fn clone(&self) -> TypeKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for TypeKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TypeKind

Source§

fn eq(&self, other: &TypeKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for TypeKind

Source§

impl StructuralPartialEq for TypeKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/index.html b/compiler-docs/fe_mir/ir/types/index.html new file mode 100644 index 0000000000..8c3e161750 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/index.html @@ -0,0 +1 @@ +fe_mir::ir::types - Rust

Module types

Source

Structs§

ArrayDef
A static array type definition.
EnumDef
A user defined struct type definition.
EnumVariant
A user defined struct type definition.
EventDef
A user defined struct type definition.
MapDef
A map type definition.
StructDef
A user defined struct type definition.
TupleDef
A tuple type definition.
Type
TypeId
An interned Id for ArrayDef.

Enums§

TypeKind
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/sidebar-items.js b/compiler-docs/fe_mir/ir/types/sidebar-items.js new file mode 100644 index 0000000000..24bf659759 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["TypeKind"],"struct":["ArrayDef","EnumDef","EnumVariant","EventDef","MapDef","StructDef","TupleDef","Type","TypeId"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/struct.ArrayDef.html b/compiler-docs/fe_mir/ir/types/struct.ArrayDef.html new file mode 100644 index 0000000000..82f1d0056c --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/struct.ArrayDef.html @@ -0,0 +1,26 @@ +ArrayDef in fe_mir::ir::types - Rust

Struct ArrayDef

Source
pub struct ArrayDef {
+    pub elem_ty: TypeId,
+    pub len: usize,
+}
Expand description

A static array type definition.

+

Fields§

§elem_ty: TypeId§len: usize

Trait Implementations§

Source§

impl Clone for ArrayDef

Source§

fn clone(&self) -> ArrayDef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ArrayDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ArrayDef

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ArrayDef

Source§

fn eq(&self, other: &ArrayDef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for ArrayDef

Source§

impl StructuralPartialEq for ArrayDef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/struct.EnumDef.html b/compiler-docs/fe_mir/ir/types/struct.EnumDef.html new file mode 100644 index 0000000000..af353cb3e8 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/struct.EnumDef.html @@ -0,0 +1,28 @@ +EnumDef in fe_mir::ir::types - Rust

Struct EnumDef

Source
pub struct EnumDef {
+    pub name: SmolStr,
+    pub variants: Vec<EnumVariant>,
+    pub span: Span,
+    pub module_id: ModuleId,
+}
Expand description

A user defined struct type definition.

+

Fields§

§name: SmolStr§variants: Vec<EnumVariant>§span: Span§module_id: ModuleId

Implementations§

Trait Implementations§

Source§

impl Clone for EnumDef

Source§

fn clone(&self) -> EnumDef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnumDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for EnumDef

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EnumDef

Source§

fn eq(&self, other: &EnumDef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for EnumDef

Source§

impl StructuralPartialEq for EnumDef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/struct.EnumVariant.html b/compiler-docs/fe_mir/ir/types/struct.EnumVariant.html new file mode 100644 index 0000000000..50b5790432 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/struct.EnumVariant.html @@ -0,0 +1,27 @@ +EnumVariant in fe_mir::ir::types - Rust

Struct EnumVariant

Source
pub struct EnumVariant {
+    pub name: SmolStr,
+    pub span: Span,
+    pub ty: TypeId,
+}
Expand description

A user defined struct type definition.

+

Fields§

§name: SmolStr§span: Span§ty: TypeId

Trait Implementations§

Source§

impl Clone for EnumVariant

Source§

fn clone(&self) -> EnumVariant

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnumVariant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for EnumVariant

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EnumVariant

Source§

fn eq(&self, other: &EnumVariant) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for EnumVariant

Source§

impl StructuralPartialEq for EnumVariant

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/struct.EventDef.html b/compiler-docs/fe_mir/ir/types/struct.EventDef.html new file mode 100644 index 0000000000..3c7f5b75d2 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/struct.EventDef.html @@ -0,0 +1,28 @@ +EventDef in fe_mir::ir::types - Rust

Struct EventDef

Source
pub struct EventDef {
+    pub name: SmolStr,
+    pub fields: Vec<(SmolStr, TypeId, bool)>,
+    pub span: Span,
+    pub module_id: ModuleId,
+}
Expand description

A user defined struct type definition.

+

Fields§

§name: SmolStr§fields: Vec<(SmolStr, TypeId, bool)>§span: Span§module_id: ModuleId

Trait Implementations§

Source§

impl Clone for EventDef

Source§

fn clone(&self) -> EventDef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EventDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for EventDef

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EventDef

Source§

fn eq(&self, other: &EventDef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for EventDef

Source§

impl StructuralPartialEq for EventDef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/struct.MapDef.html b/compiler-docs/fe_mir/ir/types/struct.MapDef.html new file mode 100644 index 0000000000..fd17e2f578 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/struct.MapDef.html @@ -0,0 +1,26 @@ +MapDef in fe_mir::ir::types - Rust

Struct MapDef

Source
pub struct MapDef {
+    pub key_ty: TypeId,
+    pub value_ty: TypeId,
+}
Expand description

A map type definition.

+

Fields§

§key_ty: TypeId§value_ty: TypeId

Trait Implementations§

Source§

impl Clone for MapDef

Source§

fn clone(&self) -> MapDef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MapDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for MapDef

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for MapDef

Source§

fn eq(&self, other: &MapDef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for MapDef

Source§

impl Eq for MapDef

Source§

impl StructuralPartialEq for MapDef

Auto Trait Implementations§

§

impl Freeze for MapDef

§

impl RefUnwindSafe for MapDef

§

impl Send for MapDef

§

impl Sync for MapDef

§

impl Unpin for MapDef

§

impl UnwindSafe for MapDef

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/struct.StructDef.html b/compiler-docs/fe_mir/ir/types/struct.StructDef.html new file mode 100644 index 0000000000..1664da5800 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/struct.StructDef.html @@ -0,0 +1,28 @@ +StructDef in fe_mir::ir::types - Rust

Struct StructDef

Source
pub struct StructDef {
+    pub name: SmolStr,
+    pub fields: Vec<(SmolStr, TypeId)>,
+    pub span: Span,
+    pub module_id: ModuleId,
+}
Expand description

A user defined struct type definition.

+

Fields§

§name: SmolStr§fields: Vec<(SmolStr, TypeId)>§span: Span§module_id: ModuleId

Trait Implementations§

Source§

impl Clone for StructDef

Source§

fn clone(&self) -> StructDef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StructDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for StructDef

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for StructDef

Source§

fn eq(&self, other: &StructDef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for StructDef

Source§

impl StructuralPartialEq for StructDef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/struct.TupleDef.html b/compiler-docs/fe_mir/ir/types/struct.TupleDef.html new file mode 100644 index 0000000000..5e7d3484ad --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/struct.TupleDef.html @@ -0,0 +1,25 @@ +TupleDef in fe_mir::ir::types - Rust

Struct TupleDef

Source
pub struct TupleDef {
+    pub items: Vec<TypeId>,
+}
Expand description

A tuple type definition.

+

Fields§

§items: Vec<TypeId>

Trait Implementations§

Source§

impl Clone for TupleDef

Source§

fn clone(&self) -> TupleDef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TupleDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for TupleDef

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TupleDef

Source§

fn eq(&self, other: &TupleDef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for TupleDef

Source§

impl StructuralPartialEq for TupleDef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/struct.Type.html b/compiler-docs/fe_mir/ir/types/struct.Type.html new file mode 100644 index 0000000000..59809d8347 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/struct.Type.html @@ -0,0 +1,25 @@ +Type in fe_mir::ir::types - Rust

Struct Type

Source
pub struct Type {
+    pub kind: TypeKind,
+    pub analyzer_ty: Option<TypeId>,
+}

Fields§

§kind: TypeKind§analyzer_ty: Option<TypeId>

Implementations§

Source§

impl Type

Source

pub fn new(kind: TypeKind, analyzer_ty: Option<TypeId>) -> Self

Trait Implementations§

Source§

impl Clone for Type

Source§

fn clone(&self) -> Type

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Type

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Type

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Type

Source§

fn eq(&self, other: &Type) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Type

Source§

impl StructuralPartialEq for Type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl Send for Type

§

impl Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/types/struct.TypeId.html b/compiler-docs/fe_mir/ir/types/struct.TypeId.html new file mode 100644 index 0000000000..d2f7c80ac8 --- /dev/null +++ b/compiler-docs/fe_mir/ir/types/struct.TypeId.html @@ -0,0 +1,40 @@ +TypeId in fe_mir::ir::types - Rust

Struct TypeId

Source
pub struct TypeId(pub u32);
Expand description

An interned Id for ArrayDef.

+

Tuple Fields§

§0: u32

Implementations§

Source§

impl TypeId

Source

pub fn data(self, db: &dyn MirDb) -> Rc<Type>

Source

pub fn analyzer_ty(self, db: &dyn MirDb) -> Option<TypeId>

Source

pub fn projection_ty(self, db: &dyn MirDb, access: &Value) -> TypeId

Source

pub fn deref(self, db: &dyn MirDb) -> TypeId

Source

pub fn make_sptr(self, db: &dyn MirDb) -> TypeId

Source

pub fn make_mptr(self, db: &dyn MirDb) -> TypeId

Source

pub fn projection_ty_imm(self, db: &dyn MirDb, index: usize) -> TypeId

Source

pub fn aggregate_field_num(self, db: &dyn MirDb) -> usize

Source

pub fn enum_disc_type(self, db: &dyn MirDb) -> TypeId

Source

pub fn enum_data_offset(self, db: &dyn MirDb, slot_size: usize) -> usize

Source

pub fn enum_variant_type( + self, + db: &dyn MirDb, + variant_id: EnumVariantId, +) -> TypeId

Source

pub fn index_from_fname(self, db: &dyn MirDb, fname: &str) -> BigInt

Source

pub fn is_primitive(self, db: &dyn MirDb) -> bool

Source

pub fn is_integral(self, db: &dyn MirDb) -> bool

Source

pub fn is_address(self, db: &dyn MirDb) -> bool

Source

pub fn is_unit(self, db: &dyn MirDb) -> bool

Source

pub fn is_enum(self, db: &dyn MirDb) -> bool

Source

pub fn is_signed(self, db: &dyn MirDb) -> bool

Source

pub fn size_of(self, db: &dyn MirDb, slot_size: usize) -> usize

Returns size of the type in bytes.

+
Source

pub fn is_zero_sized(self, db: &dyn MirDb) -> bool

Source

pub fn align_of(self, db: &dyn MirDb, slot_size: usize) -> usize

Source

pub fn aggregate_elem_offset<T>( + self, + db: &dyn MirDb, + elem_idx: T, + slot_size: usize, +) -> usize
where + T: ToPrimitive,

Returns an offset of the element of aggregate type.

+
Source

pub fn is_aggregate(self, db: &dyn MirDb) -> bool

Source

pub fn is_struct(self, db: &dyn MirDb) -> bool

Source

pub fn is_array(self, db: &dyn MirDb) -> bool

Source

pub fn is_string(self, db: &dyn MirDb) -> bool

Source

pub fn is_ptr(self, db: &dyn MirDb) -> bool

Source

pub fn is_mptr(self, db: &dyn MirDb) -> bool

Source

pub fn is_sptr(self, db: &dyn MirDb) -> bool

Source

pub fn is_map(self, db: &dyn MirDb) -> bool

Source

pub fn is_contract(self, db: &dyn MirDb) -> bool

Source

pub fn array_elem_size(self, db: &dyn MirDb, slot_size: usize) -> usize

Source

pub fn print<W: Write>(&self, db: &dyn MirDb, w: &mut W) -> Result

Source

pub fn as_string(&self, db: &dyn MirDb) -> String

Trait Implementations§

Source§

impl Clone for TypeId

Source§

fn clone(&self) -> TypeId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for TypeId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InternKey for TypeId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl PartialEq for TypeId

Source§

fn eq(&self, other: &TypeId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PrettyPrint for TypeId

Source§

fn pretty_print<W: Write>( + &self, + db: &dyn MirDb, + _store: &BodyDataStore, + w: &mut W, +) -> Result

Source§

fn pretty_string(&self, db: &dyn MirDb, store: &BodyDataStore) -> String

Source§

impl Copy for TypeId

Source§

impl Eq for TypeId

Source§

impl StructuralPartialEq for TypeId

Auto Trait Implementations§

§

impl Freeze for TypeId

§

impl RefUnwindSafe for TypeId

§

impl Send for TypeId

§

impl Sync for TypeId

§

impl Unpin for TypeId

§

impl UnwindSafe for TypeId

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/value/enum.AssignableValue.html b/compiler-docs/fe_mir/ir/value/enum.AssignableValue.html new file mode 100644 index 0000000000..312457b456 --- /dev/null +++ b/compiler-docs/fe_mir/ir/value/enum.AssignableValue.html @@ -0,0 +1,37 @@ +AssignableValue in fe_mir::ir::value - Rust

Enum AssignableValue

Source
pub enum AssignableValue {
+    Value(ValueId),
+    Aggregate {
+        lhs: Box<AssignableValue>,
+        idx: ValueId,
+    },
+    Map {
+        lhs: Box<AssignableValue>,
+        key: ValueId,
+    },
+}

Variants§

§

Value(ValueId)

§

Aggregate

§

Map

Implementations§

Source§

impl AssignableValue

Source

pub fn ty(&self, db: &dyn MirDb, store: &BodyDataStore) -> TypeId

Source

pub fn value_id(&self) -> Option<ValueId>

Trait Implementations§

Source§

impl Clone for AssignableValue

Source§

fn clone(&self) -> AssignableValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AssignableValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Id<Value>> for AssignableValue

Source§

fn from(value: ValueId) -> Self

Converts to this type from the input type.
Source§

impl Hash for AssignableValue

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AssignableValue

Source§

fn eq(&self, other: &AssignableValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PrettyPrint for AssignableValue

Source§

fn pretty_print<W: Write>( + &self, + db: &dyn MirDb, + store: &BodyDataStore, + w: &mut W, +) -> Result

Source§

fn pretty_string(&self, db: &dyn MirDb, store: &BodyDataStore) -> String

Source§

impl Eq for AssignableValue

Source§

impl StructuralPartialEq for AssignableValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/value/enum.Value.html b/compiler-docs/fe_mir/ir/value/enum.Value.html new file mode 100644 index 0000000000..fcbe0f45d0 --- /dev/null +++ b/compiler-docs/fe_mir/ir/value/enum.Value.html @@ -0,0 +1,44 @@ +Value in fe_mir::ir::value - Rust

Enum Value

Source
pub enum Value {
+    Temporary {
+        inst: InstId,
+        ty: TypeId,
+    },
+    Local(Local),
+    Immediate {
+        imm: BigInt,
+        ty: TypeId,
+    },
+    Constant {
+        constant: ConstantId,
+        ty: TypeId,
+    },
+    Unit {
+        ty: TypeId,
+    },
+}

Variants§

§

Temporary

A value resulted from an instruction.

+

Fields

§inst: InstId
§

Local(Local)

A local variable declared in a function body.

+
§

Immediate

An immediate value.

+

Fields

§

Constant

A constant value.

+

Fields

§constant: ConstantId
§

Unit

A singleton value representing Unit type.

+

Fields

Implementations§

Source§

impl Value

Source

pub fn ty(&self) -> TypeId

Source

pub fn is_imm(&self) -> bool

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Value

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Value

Source§

fn eq(&self, other: &Value) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Value

Source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/value/index.html b/compiler-docs/fe_mir/ir/value/index.html new file mode 100644 index 0000000000..9aad91eb93 --- /dev/null +++ b/compiler-docs/fe_mir/ir/value/index.html @@ -0,0 +1 @@ +fe_mir::ir::value - Rust

Module value

Source

Structs§

Local

Enums§

AssignableValue
Value

Type Aliases§

ValueId
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/value/sidebar-items.js b/compiler-docs/fe_mir/ir/value/sidebar-items.js new file mode 100644 index 0000000000..11357c9f58 --- /dev/null +++ b/compiler-docs/fe_mir/ir/value/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["AssignableValue","Value"],"struct":["Local"],"type":["ValueId"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/value/struct.Local.html b/compiler-docs/fe_mir/ir/value/struct.Local.html new file mode 100644 index 0000000000..6f9c095d4d --- /dev/null +++ b/compiler-docs/fe_mir/ir/value/struct.Local.html @@ -0,0 +1,31 @@ +Local in fe_mir::ir::value - Rust

Struct Local

Source
pub struct Local {
+    pub name: SmolStr,
+    pub ty: TypeId,
+    pub is_arg: bool,
+    pub is_tmp: bool,
+    pub source: SourceInfo,
+}

Fields§

§name: SmolStr

An original name of a local variable.

+
§ty: TypeId§is_arg: bool

true if a local is a function argument.

+
§is_tmp: bool

true if a local is introduced in MIR.

+
§source: SourceInfo

Implementations§

Source§

impl Local

Source

pub fn user_local(name: SmolStr, ty: TypeId, source: SourceInfo) -> Local

Source

pub fn arg_local(name: SmolStr, ty: TypeId, source: SourceInfo) -> Local

Source

pub fn tmp_local(name: SmolStr, ty: TypeId) -> Local

Trait Implementations§

Source§

impl Clone for Local

Source§

fn clone(&self) -> Local

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Local

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Local

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Local

Source§

fn eq(&self, other: &Local) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Local

Source§

impl StructuralPartialEq for Local

Auto Trait Implementations§

§

impl Freeze for Local

§

impl RefUnwindSafe for Local

§

impl Send for Local

§

impl Sync for Local

§

impl Unpin for Local

§

impl UnwindSafe for Local

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_mir/ir/value/type.ValueId.html b/compiler-docs/fe_mir/ir/value/type.ValueId.html new file mode 100644 index 0000000000..bbffbe3238 --- /dev/null +++ b/compiler-docs/fe_mir/ir/value/type.ValueId.html @@ -0,0 +1,6 @@ +ValueId in fe_mir::ir::value - Rust

Type Alias ValueId

Source
pub type ValueId = Id<Value>;

Aliased Type§

pub struct ValueId { /* private fields */ }

Trait Implementations§

Source§

impl PrettyPrint for ValueId

Source§

fn pretty_print<W: Write>( + &self, + db: &dyn MirDb, + store: &BodyDataStore, + w: &mut W, +) -> Result

Source§

fn pretty_string(&self, db: &dyn MirDb, store: &BodyDataStore) -> String

\ No newline at end of file diff --git a/compiler-docs/fe_mir/pretty_print/index.html b/compiler-docs/fe_mir/pretty_print/index.html new file mode 100644 index 0000000000..32213716f5 --- /dev/null +++ b/compiler-docs/fe_mir/pretty_print/index.html @@ -0,0 +1 @@ +fe_mir::pretty_print - Rust

Module pretty_print

Source

Traits§

PrettyPrint
\ No newline at end of file diff --git a/compiler-docs/fe_mir/pretty_print/sidebar-items.js b/compiler-docs/fe_mir/pretty_print/sidebar-items.js new file mode 100644 index 0000000000..d2a6034954 --- /dev/null +++ b/compiler-docs/fe_mir/pretty_print/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"trait":["PrettyPrint"]}; \ No newline at end of file diff --git a/compiler-docs/fe_mir/pretty_print/trait.PrettyPrint.html b/compiler-docs/fe_mir/pretty_print/trait.PrettyPrint.html new file mode 100644 index 0000000000..25644cb29e --- /dev/null +++ b/compiler-docs/fe_mir/pretty_print/trait.PrettyPrint.html @@ -0,0 +1,22 @@ +PrettyPrint in fe_mir::pretty_print - Rust

Trait PrettyPrint

Source
pub trait PrettyPrint {
+    // Required method
+    fn pretty_print<W: Write>(
+        &self,
+        db: &dyn MirDb,
+        store: &BodyDataStore,
+        w: &mut W,
+    ) -> Result;
+
+    // Provided method
+    fn pretty_string(&self, db: &dyn MirDb, store: &BodyDataStore) -> String { ... }
+}

Required Methods§

Source

fn pretty_print<W: Write>( + &self, + db: &dyn MirDb, + store: &BodyDataStore, + w: &mut W, +) -> Result

Provided Methods§

Source

fn pretty_string(&self, db: &dyn MirDb, store: &BodyDataStore) -> String

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl PrettyPrint for &[ValueId]

Source§

fn pretty_print<W: Write>( + &self, + db: &dyn MirDb, + store: &BodyDataStore, + w: &mut W, +) -> Result

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_mir/sidebar-items.js b/compiler-docs/fe_mir/sidebar-items.js new file mode 100644 index 0000000000..12f0860546 --- /dev/null +++ b/compiler-docs/fe_mir/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["analysis","db","graphviz","ir","pretty_print"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/all.html b/compiler-docs/fe_parser/all.html new file mode 100644 index 0000000000..3a183ef640 --- /dev/null +++ b/compiler-docs/fe_parser/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Structs

Enums

Traits

Functions

Type Aliases

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.BinOperator.html b/compiler-docs/fe_parser/ast/enum.BinOperator.html new file mode 100644 index 0000000000..0e1d1e756f --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.BinOperator.html @@ -0,0 +1,38 @@ +BinOperator in fe_parser::ast - Rust

Enum BinOperator

Source
pub enum BinOperator {
+    Add,
+    Sub,
+    Mult,
+    Div,
+    Mod,
+    Pow,
+    LShift,
+    RShift,
+    BitOr,
+    BitXor,
+    BitAnd,
+}

Variants§

§

Add

§

Sub

§

Mult

§

Div

§

Mod

§

Pow

§

LShift

§

RShift

§

BitOr

§

BitXor

§

BitAnd

Trait Implementations§

Source§

impl Clone for BinOperator

Source§

fn clone(&self) -> BinOperator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BinOperator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BinOperator

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for BinOperator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for BinOperator

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BinOperator

Source§

fn eq(&self, other: &BinOperator) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for BinOperator

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for BinOperator

Source§

impl Eq for BinOperator

Source§

impl StructuralPartialEq for BinOperator

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.BoolOperator.html b/compiler-docs/fe_parser/ast/enum.BoolOperator.html new file mode 100644 index 0000000000..9e891d8526 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.BoolOperator.html @@ -0,0 +1,29 @@ +BoolOperator in fe_parser::ast - Rust

Enum BoolOperator

Source
pub enum BoolOperator {
+    And,
+    Or,
+}

Variants§

§

And

§

Or

Trait Implementations§

Source§

impl Clone for BoolOperator

Source§

fn clone(&self) -> BoolOperator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BoolOperator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BoolOperator

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for BoolOperator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for BoolOperator

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BoolOperator

Source§

fn eq(&self, other: &BoolOperator) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for BoolOperator

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for BoolOperator

Source§

impl Eq for BoolOperator

Source§

impl StructuralPartialEq for BoolOperator

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.CompOperator.html b/compiler-docs/fe_parser/ast/enum.CompOperator.html new file mode 100644 index 0000000000..141bf3be91 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.CompOperator.html @@ -0,0 +1,33 @@ +CompOperator in fe_parser::ast - Rust

Enum CompOperator

Source
pub enum CompOperator {
+    Eq,
+    NotEq,
+    Lt,
+    LtE,
+    Gt,
+    GtE,
+}

Variants§

§

Eq

§

NotEq

§

Lt

§

LtE

§

Gt

§

GtE

Trait Implementations§

Source§

impl Clone for CompOperator

Source§

fn clone(&self) -> CompOperator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CompOperator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CompOperator

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for CompOperator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for CompOperator

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CompOperator

Source§

fn eq(&self, other: &CompOperator) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for CompOperator

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for CompOperator

Source§

impl Eq for CompOperator

Source§

impl StructuralPartialEq for CompOperator

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.ContractStmt.html b/compiler-docs/fe_parser/ast/enum.ContractStmt.html new file mode 100644 index 0000000000..f56783855a --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.ContractStmt.html @@ -0,0 +1,28 @@ +ContractStmt in fe_parser::ast - Rust

Enum ContractStmt

Source
pub enum ContractStmt {
+    Function(Node<Function>),
+}

Variants§

§

Function(Node<Function>)

Trait Implementations§

Source§

impl Clone for ContractStmt

Source§

fn clone(&self) -> ContractStmt

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContractStmt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ContractStmt

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ContractStmt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ContractStmt

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ContractStmt

Source§

fn eq(&self, other: &ContractStmt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for ContractStmt

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Spanned for ContractStmt

Source§

fn span(&self) -> Span

Source§

impl Eq for ContractStmt

Source§

impl StructuralPartialEq for ContractStmt

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.Expr.html b/compiler-docs/fe_parser/ast/enum.Expr.html new file mode 100644 index 0000000000..f0534f3d90 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.Expr.html @@ -0,0 +1,80 @@ +Expr in fe_parser::ast - Rust

Enum Expr

Source
pub enum Expr {
+
Show 17 variants Ternary { + if_expr: Box<Node<Expr>>, + test: Box<Node<Expr>>, + else_expr: Box<Node<Expr>>, + }, + BoolOperation { + left: Box<Node<Expr>>, + op: Node<BoolOperator>, + right: Box<Node<Expr>>, + }, + BinOperation { + left: Box<Node<Expr>>, + op: Node<BinOperator>, + right: Box<Node<Expr>>, + }, + UnaryOperation { + op: Node<UnaryOperator>, + operand: Box<Node<Expr>>, + }, + CompOperation { + left: Box<Node<Expr>>, + op: Node<CompOperator>, + right: Box<Node<Expr>>, + }, + Attribute { + value: Box<Node<Expr>>, + attr: Node<SmolStr>, + }, + Subscript { + value: Box<Node<Expr>>, + index: Box<Node<Expr>>, + }, + Call { + func: Box<Node<Expr>>, + generic_args: Option<Node<Vec<GenericArg>>>, + args: Node<Vec<Node<CallArg>>>, + }, + List { + elts: Vec<Node<Expr>>, + }, + Repeat { + value: Box<Node<Expr>>, + len: Box<Node<GenericArg>>, + }, + Tuple { + elts: Vec<Node<Expr>>, + }, + Bool(bool), + Name(SmolStr), + Path(Path), + Num(SmolStr), + Str(SmolStr), + Unit, +
}

Variants§

§

Ternary

Fields

§if_expr: Box<Node<Expr>>
§test: Box<Node<Expr>>
§else_expr: Box<Node<Expr>>
§

BoolOperation

Fields

§left: Box<Node<Expr>>
§right: Box<Node<Expr>>
§

BinOperation

Fields

§left: Box<Node<Expr>>
§right: Box<Node<Expr>>
§

UnaryOperation

Fields

§operand: Box<Node<Expr>>
§

CompOperation

Fields

§left: Box<Node<Expr>>
§right: Box<Node<Expr>>
§

Attribute

Fields

§value: Box<Node<Expr>>
§

Subscript

Fields

§value: Box<Node<Expr>>
§index: Box<Node<Expr>>
§

Call

Fields

§func: Box<Node<Expr>>
§generic_args: Option<Node<Vec<GenericArg>>>
§

List

Fields

§elts: Vec<Node<Expr>>
§

Repeat

Fields

§value: Box<Node<Expr>>
§

Tuple

Fields

§elts: Vec<Node<Expr>>
§

Bool(bool)

§

Name(SmolStr)

§

Path(Path)

§

Num(SmolStr)

§

Str(SmolStr)

§

Unit

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Expr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Expr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Expr

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Expr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Expr

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Expr

Source§

fn eq(&self, other: &Expr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Expr

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Expr

Source§

impl StructuralPartialEq for Expr

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnwindSafe for Expr

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.FuncStmt.html b/compiler-docs/fe_parser/ast/enum.FuncStmt.html new file mode 100644 index 0000000000..fe60db116b --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.FuncStmt.html @@ -0,0 +1,81 @@ +FuncStmt in fe_parser::ast - Rust

Enum FuncStmt

Source
pub enum FuncStmt {
+
Show 15 variants Return { + value: Option<Node<Expr>>, + }, + VarDecl { + mut_: Option<Span>, + target: Node<VarDeclTarget>, + typ: Node<TypeDesc>, + value: Option<Node<Expr>>, + }, + ConstantDecl { + name: Node<SmolStr>, + typ: Node<TypeDesc>, + value: Node<Expr>, + }, + Assign { + target: Node<Expr>, + value: Node<Expr>, + }, + AugAssign { + target: Node<Expr>, + op: Node<BinOperator>, + value: Node<Expr>, + }, + For { + target: Node<SmolStr>, + iter: Node<Expr>, + body: Vec<Node<FuncStmt>>, + }, + While { + test: Node<Expr>, + body: Vec<Node<FuncStmt>>, + }, + If { + test: Node<Expr>, + body: Vec<Node<FuncStmt>>, + or_else: Vec<Node<FuncStmt>>, + }, + Match { + expr: Node<Expr>, + arms: Vec<Node<MatchArm>>, + }, + Assert { + test: Node<Expr>, + msg: Option<Node<Expr>>, + }, + Expr { + value: Node<Expr>, + }, + Break, + Continue, + Revert { + error: Option<Node<Expr>>, + }, + Unsafe(Vec<Node<FuncStmt>>), +
}

Variants§

§

Return

Fields

§value: Option<Node<Expr>>
§

VarDecl

Fields

§mut_: Option<Span>
§value: Option<Node<Expr>>
§

ConstantDecl

Fields

§value: Node<Expr>
§

Assign

Fields

§target: Node<Expr>
§value: Node<Expr>
§

AugAssign

Fields

§target: Node<Expr>
§value: Node<Expr>
§

For

Fields

§target: Node<SmolStr>
§iter: Node<Expr>
§

While

Fields

§test: Node<Expr>
§

If

Fields

§test: Node<Expr>
§or_else: Vec<Node<FuncStmt>>
§

Match

Fields

§expr: Node<Expr>
§

Assert

Fields

§test: Node<Expr>
§

Expr

Fields

§value: Node<Expr>
§

Break

§

Continue

§

Revert

Fields

§error: Option<Node<Expr>>
§

Unsafe(Vec<Node<FuncStmt>>)

Trait Implementations§

Source§

impl Clone for FuncStmt

Source§

fn clone(&self) -> FuncStmt

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FuncStmt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FuncStmt

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for FuncStmt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FuncStmt

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FuncStmt

Source§

fn eq(&self, other: &FuncStmt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for FuncStmt

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for FuncStmt

Source§

impl StructuralPartialEq for FuncStmt

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.FunctionArg.html b/compiler-docs/fe_parser/ast/enum.FunctionArg.html new file mode 100644 index 0000000000..6d6a8ee1f1 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.FunctionArg.html @@ -0,0 +1,36 @@ +FunctionArg in fe_parser::ast - Rust

Enum FunctionArg

Source
pub enum FunctionArg {
+    Regular {
+        mut_: Option<Span>,
+        label: Option<Node<SmolStr>>,
+        name: Node<SmolStr>,
+        typ: Node<TypeDesc>,
+    },
+    Self_ {
+        mut_: Option<Span>,
+    },
+}

Variants§

§

Regular

Fields

§mut_: Option<Span>
§

Self_

Fields

§mut_: Option<Span>

Implementations§

Source§

impl FunctionArg

Source

pub fn label_span(&self) -> Option<Span>

Source

pub fn name_span(&self) -> Option<Span>

Source

pub fn typ_span(&self) -> Option<Span>

Trait Implementations§

Source§

impl Clone for FunctionArg

Source§

fn clone(&self) -> FunctionArg

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionArg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FunctionArg

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for FunctionArg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for FunctionArg

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FunctionArg

Source§

fn eq(&self, other: &FunctionArg) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for FunctionArg

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for FunctionArg

Source§

impl StructuralPartialEq for FunctionArg

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.GenericArg.html b/compiler-docs/fe_parser/ast/enum.GenericArg.html new file mode 100644 index 0000000000..b1aea72df6 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.GenericArg.html @@ -0,0 +1,30 @@ +GenericArg in fe_parser::ast - Rust

Enum GenericArg

Source
pub enum GenericArg {
+    TypeDesc(Node<TypeDesc>),
+    Int(Node<usize>),
+    ConstExpr(Node<Expr>),
+}

Variants§

§

TypeDesc(Node<TypeDesc>)

§

Int(Node<usize>)

§

ConstExpr(Node<Expr>)

Trait Implementations§

Source§

impl Clone for GenericArg

Source§

fn clone(&self) -> GenericArg

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GenericArg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for GenericArg

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for GenericArg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for GenericArg

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GenericArg

Source§

fn eq(&self, other: &GenericArg) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for GenericArg

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Spanned for GenericArg

Source§

fn span(&self) -> Span

Source§

impl Eq for GenericArg

Source§

impl StructuralPartialEq for GenericArg

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.GenericParameter.html b/compiler-docs/fe_parser/ast/enum.GenericParameter.html new file mode 100644 index 0000000000..b84bfda90d --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.GenericParameter.html @@ -0,0 +1,32 @@ +GenericParameter in fe_parser::ast - Rust

Enum GenericParameter

Source
pub enum GenericParameter {
+    Unbounded(Node<SmolStr>),
+    Bounded {
+        name: Node<SmolStr>,
+        bound: Node<TypeDesc>,
+    },
+}

Variants§

§

Unbounded(Node<SmolStr>)

§

Bounded

Fields

Implementations§

Trait Implementations§

Source§

impl Clone for GenericParameter

Source§

fn clone(&self) -> GenericParameter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GenericParameter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for GenericParameter

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for GenericParameter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for GenericParameter

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GenericParameter

Source§

fn eq(&self, other: &GenericParameter) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for GenericParameter

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Spanned for GenericParameter

Source§

fn span(&self) -> Span

Source§

impl Eq for GenericParameter

Source§

impl StructuralPartialEq for GenericParameter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.LiteralPattern.html b/compiler-docs/fe_parser/ast/enum.LiteralPattern.html new file mode 100644 index 0000000000..2d2533f16f --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.LiteralPattern.html @@ -0,0 +1,28 @@ +LiteralPattern in fe_parser::ast - Rust

Enum LiteralPattern

Source
pub enum LiteralPattern {
+    Bool(bool),
+}

Variants§

§

Bool(bool)

Trait Implementations§

Source§

impl Clone for LiteralPattern

Source§

fn clone(&self) -> LiteralPattern

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LiteralPattern

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for LiteralPattern

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for LiteralPattern

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for LiteralPattern

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LiteralPattern

Source§

fn eq(&self, other: &LiteralPattern) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for LiteralPattern

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for LiteralPattern

Source§

impl Eq for LiteralPattern

Source§

impl StructuralPartialEq for LiteralPattern

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.ModuleStmt.html b/compiler-docs/fe_parser/ast/enum.ModuleStmt.html new file mode 100644 index 0000000000..8331b16680 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.ModuleStmt.html @@ -0,0 +1,39 @@ +ModuleStmt in fe_parser::ast - Rust

Enum ModuleStmt

Source
pub enum ModuleStmt {
+    Pragma(Node<Pragma>),
+    Use(Node<Use>),
+    TypeAlias(Node<TypeAlias>),
+    Contract(Node<Contract>),
+    Constant(Node<ConstantDecl>),
+    Struct(Node<Struct>),
+    Enum(Node<Enum>),
+    Trait(Node<Trait>),
+    Impl(Node<Impl>),
+    Function(Node<Function>),
+    Attribute(Node<SmolStr>),
+    ParseError(Span),
+}

Variants§

§

Pragma(Node<Pragma>)

§

Use(Node<Use>)

§

TypeAlias(Node<TypeAlias>)

§

Contract(Node<Contract>)

§

Constant(Node<ConstantDecl>)

§

Struct(Node<Struct>)

§

Enum(Node<Enum>)

§

Trait(Node<Trait>)

§

Impl(Node<Impl>)

§

Function(Node<Function>)

§

Attribute(Node<SmolStr>)

§

ParseError(Span)

Trait Implementations§

Source§

impl Clone for ModuleStmt

Source§

fn clone(&self) -> ModuleStmt

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModuleStmt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ModuleStmt

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ModuleStmt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ModuleStmt

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ModuleStmt

Source§

fn eq(&self, other: &ModuleStmt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for ModuleStmt

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Spanned for ModuleStmt

Source§

fn span(&self) -> Span

Source§

impl Eq for ModuleStmt

Source§

impl StructuralPartialEq for ModuleStmt

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.Pattern.html b/compiler-docs/fe_parser/ast/enum.Pattern.html new file mode 100644 index 0000000000..0ede6340e0 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.Pattern.html @@ -0,0 +1,48 @@ +Pattern in fe_parser::ast - Rust

Enum Pattern

Source
pub enum Pattern {
+    WildCard,
+    Rest,
+    Literal(Node<LiteralPattern>),
+    Tuple(Vec<Node<Pattern>>),
+    Path(Node<Path>),
+    PathTuple(Node<Path>, Vec<Node<Pattern>>),
+    PathStruct {
+        path: Node<Path>,
+        fields: Vec<(Node<SmolStr>, Node<Pattern>)>,
+        has_rest: bool,
+    },
+    Or(Vec<Node<Pattern>>),
+}

Variants§

§

WildCard

Represents a wildcard pattern _.

+
§

Rest

Rest pattern. e.g., ..

+
§

Literal(Node<LiteralPattern>)

Represents a literal pattern. e.g., true.

+
§

Tuple(Vec<Node<Pattern>>)

Represents tuple destructuring pattern. e.g., (x, y, z).

+
§

Path(Node<Path>)

Represents unit variant pattern. e.g., Enum::Unit.

+
§

PathTuple(Node<Path>, Vec<Node<Pattern>>)

Represents tuple variant pattern. e.g., Enum::Tuple(x, y, z).

+
§

PathStruct

Represents struct or struct variant destructuring pattern. e.g., +MyStruct {x: pat1, y: pat2}}.

+

Fields

§path: Node<Path>
§fields: Vec<(Node<SmolStr>, Node<Pattern>)>
§has_rest: bool
§

Or(Vec<Node<Pattern>>)

Represents or pattern. e.g., EnumUnit | EnumTuple(_, _, _)

+

Implementations§

Source§

impl Pattern

Source

pub fn is_rest(&self) -> bool

Trait Implementations§

Source§

impl Clone for Pattern

Source§

fn clone(&self) -> Pattern

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pattern

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Pattern

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Pattern

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Pattern

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Pattern

Source§

fn eq(&self, other: &Pattern) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Pattern

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Pattern

Source§

impl StructuralPartialEq for Pattern

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.TypeDesc.html b/compiler-docs/fe_parser/ast/enum.TypeDesc.html new file mode 100644 index 0000000000..4ef672a4f4 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.TypeDesc.html @@ -0,0 +1,40 @@ +TypeDesc in fe_parser::ast - Rust

Enum TypeDesc

Source
pub enum TypeDesc {
+    Unit,
+    Base {
+        base: SmolStr,
+    },
+    Path(Path),
+    Tuple {
+        items: Vec1<Node<TypeDesc>>,
+    },
+    Generic {
+        base: Node<SmolStr>,
+        args: Node<Vec<GenericArg>>,
+    },
+    SelfType,
+}

Variants§

§

Unit

§

Base

Fields

§base: SmolStr
§

Path(Path)

§

Tuple

Fields

§items: Vec1<Node<TypeDesc>>
§

Generic

Fields

§

SelfType

Trait Implementations§

Source§

impl Clone for TypeDesc

Source§

fn clone(&self) -> TypeDesc

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeDesc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TypeDesc

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TypeDesc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for TypeDesc

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TypeDesc

Source§

fn eq(&self, other: &TypeDesc) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for TypeDesc

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for TypeDesc

Source§

impl StructuralPartialEq for TypeDesc

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.UnaryOperator.html b/compiler-docs/fe_parser/ast/enum.UnaryOperator.html new file mode 100644 index 0000000000..3e5c68358d --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.UnaryOperator.html @@ -0,0 +1,30 @@ +UnaryOperator in fe_parser::ast - Rust

Enum UnaryOperator

Source
pub enum UnaryOperator {
+    Invert,
+    Not,
+    USub,
+}

Variants§

§

Invert

§

Not

§

USub

Trait Implementations§

Source§

impl Clone for UnaryOperator

Source§

fn clone(&self) -> UnaryOperator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UnaryOperator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for UnaryOperator

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for UnaryOperator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for UnaryOperator

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for UnaryOperator

Source§

fn eq(&self, other: &UnaryOperator) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for UnaryOperator

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for UnaryOperator

Source§

impl Eq for UnaryOperator

Source§

impl StructuralPartialEq for UnaryOperator

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.UseTree.html b/compiler-docs/fe_parser/ast/enum.UseTree.html new file mode 100644 index 0000000000..9104dae5ba --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.UseTree.html @@ -0,0 +1,38 @@ +UseTree in fe_parser::ast - Rust

Enum UseTree

Source
pub enum UseTree {
+    Glob {
+        prefix: Path,
+    },
+    Nested {
+        prefix: Path,
+        children: Vec<Node<UseTree>>,
+    },
+    Simple {
+        path: Path,
+        rename: Option<Node<SmolStr>>,
+    },
+}

Variants§

§

Glob

Fields

§prefix: Path
§

Nested

Fields

§prefix: Path
§children: Vec<Node<UseTree>>
§

Simple

Fields

§path: Path

Trait Implementations§

Source§

impl Clone for UseTree

Source§

fn clone(&self) -> UseTree

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UseTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for UseTree

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for UseTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for UseTree

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for UseTree

Source§

fn eq(&self, other: &UseTree) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for UseTree

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for UseTree

Source§

impl StructuralPartialEq for UseTree

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.VarDeclTarget.html b/compiler-docs/fe_parser/ast/enum.VarDeclTarget.html new file mode 100644 index 0000000000..5970094721 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.VarDeclTarget.html @@ -0,0 +1,29 @@ +VarDeclTarget in fe_parser::ast - Rust

Enum VarDeclTarget

Source
pub enum VarDeclTarget {
+    Name(SmolStr),
+    Tuple(Vec<Node<VarDeclTarget>>),
+}

Variants§

Trait Implementations§

Source§

impl Clone for VarDeclTarget

Source§

fn clone(&self) -> VarDeclTarget

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VarDeclTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for VarDeclTarget

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for VarDeclTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for VarDeclTarget

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for VarDeclTarget

Source§

fn eq(&self, other: &VarDeclTarget) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for VarDeclTarget

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for VarDeclTarget

Source§

impl StructuralPartialEq for VarDeclTarget

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/enum.VariantKind.html b/compiler-docs/fe_parser/ast/enum.VariantKind.html new file mode 100644 index 0000000000..8eccf73459 --- /dev/null +++ b/compiler-docs/fe_parser/ast/enum.VariantKind.html @@ -0,0 +1,39 @@ +VariantKind in fe_parser::ast - Rust

Enum VariantKind

Source
pub enum VariantKind {
+    Unit,
+    Tuple(Vec<Node<TypeDesc>>),
+}
Expand description

Enum variant kind.

+

Variants§

§

Unit

Unit variant. +E.g., Bar in

+
enum Foo {
+    Bar
+    Baz(u32, i32)
+}
§

Tuple(Vec<Node<TypeDesc>>)

Tuple variant. +E.g., Baz(u32, i32) in

+
enum Foo {
+    Bar
+    Baz(u32, i32)
+}

Trait Implementations§

Source§

impl Clone for VariantKind

Source§

fn clone(&self) -> VariantKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VariantKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for VariantKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for VariantKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for VariantKind

Source§

fn eq(&self, other: &VariantKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for VariantKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for VariantKind

Source§

impl StructuralPartialEq for VariantKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/index.html b/compiler-docs/fe_parser/ast/index.html new file mode 100644 index 0000000000..6345b0cd49 --- /dev/null +++ b/compiler-docs/fe_parser/ast/index.html @@ -0,0 +1 @@ +fe_parser::ast - Rust

Module ast

Source

Structs§

CallArg
ConstantDecl
Contract
Enum
Field
struct or contract field, with optional ‘pub’ and ‘const’ qualifiers
Function
FunctionSignature
Impl
MatchArm
Module
Path
Pragma
SmolStr
A SmolStr is a string type that has the following properties:
Struct
Trait
TypeAlias
Use
Variant
Enum variant definition.

Enums§

BinOperator
BoolOperator
CompOperator
ContractStmt
Expr
FuncStmt
FunctionArg
GenericArg
GenericParameter
LiteralPattern
ModuleStmt
Pattern
TypeDesc
UnaryOperator
UseTree
VarDeclTarget
VariantKind
Enum variant kind.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/sidebar-items.js b/compiler-docs/fe_parser/ast/sidebar-items.js new file mode 100644 index 0000000000..075bdbe892 --- /dev/null +++ b/compiler-docs/fe_parser/ast/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["BinOperator","BoolOperator","CompOperator","ContractStmt","Expr","FuncStmt","FunctionArg","GenericArg","GenericParameter","LiteralPattern","ModuleStmt","Pattern","TypeDesc","UnaryOperator","UseTree","VarDeclTarget","VariantKind"],"struct":["CallArg","ConstantDecl","Contract","Enum","Field","Function","FunctionSignature","Impl","MatchArm","Module","Path","Pragma","SmolStr","Struct","Trait","TypeAlias","Use","Variant"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.CallArg.html b/compiler-docs/fe_parser/ast/struct.CallArg.html new file mode 100644 index 0000000000..5cfad5c87f --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.CallArg.html @@ -0,0 +1,29 @@ +CallArg in fe_parser::ast - Rust

Struct CallArg

Source
pub struct CallArg {
+    pub label: Option<Node<SmolStr>>,
+    pub value: Node<Expr>,
+}

Fields§

§label: Option<Node<SmolStr>>§value: Node<Expr>

Trait Implementations§

Source§

impl Clone for CallArg

Source§

fn clone(&self) -> CallArg

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CallArg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CallArg

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for CallArg

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for CallArg

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CallArg

Source§

fn eq(&self, other: &CallArg) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for CallArg

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for CallArg

Source§

impl StructuralPartialEq for CallArg

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.ConstantDecl.html b/compiler-docs/fe_parser/ast/struct.ConstantDecl.html new file mode 100644 index 0000000000..98f915a339 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.ConstantDecl.html @@ -0,0 +1,31 @@ +ConstantDecl in fe_parser::ast - Rust

Struct ConstantDecl

Source
pub struct ConstantDecl {
+    pub name: Node<SmolStr>,
+    pub typ: Node<TypeDesc>,
+    pub value: Node<Expr>,
+    pub pub_qual: Option<Span>,
+}

Fields§

§name: Node<SmolStr>§typ: Node<TypeDesc>§value: Node<Expr>§pub_qual: Option<Span>

Trait Implementations§

Source§

impl Clone for ConstantDecl

Source§

fn clone(&self) -> ConstantDecl

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConstantDecl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ConstantDecl

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ConstantDecl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ConstantDecl

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ConstantDecl

Source§

fn eq(&self, other: &ConstantDecl) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for ConstantDecl

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for ConstantDecl

Source§

impl StructuralPartialEq for ConstantDecl

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Contract.html b/compiler-docs/fe_parser/ast/struct.Contract.html new file mode 100644 index 0000000000..567afdfe23 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Contract.html @@ -0,0 +1,31 @@ +Contract in fe_parser::ast - Rust

Struct Contract

Source
pub struct Contract {
+    pub name: Node<SmolStr>,
+    pub fields: Vec<Node<Field>>,
+    pub body: Vec<ContractStmt>,
+    pub pub_qual: Option<Span>,
+}

Fields§

§name: Node<SmolStr>§fields: Vec<Node<Field>>§body: Vec<ContractStmt>§pub_qual: Option<Span>

Trait Implementations§

Source§

impl Clone for Contract

Source§

fn clone(&self) -> Contract

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Contract

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Contract

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Contract

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Contract

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Contract

Source§

fn eq(&self, other: &Contract) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Contract

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Contract

Source§

impl StructuralPartialEq for Contract

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Enum.html b/compiler-docs/fe_parser/ast/struct.Enum.html new file mode 100644 index 0000000000..9c42b2e6f7 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Enum.html @@ -0,0 +1,31 @@ +Enum in fe_parser::ast - Rust

Struct Enum

Source
pub struct Enum {
+    pub name: Node<SmolStr>,
+    pub variants: Vec<Node<Variant>>,
+    pub functions: Vec<Node<Function>>,
+    pub pub_qual: Option<Span>,
+}

Fields§

§name: Node<SmolStr>§variants: Vec<Node<Variant>>§functions: Vec<Node<Function>>§pub_qual: Option<Span>

Trait Implementations§

Source§

impl Clone for Enum

Source§

fn clone(&self) -> Enum

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Enum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Enum

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Enum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Enum

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Enum

Source§

fn eq(&self, other: &Enum) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Enum

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Enum

Source§

impl StructuralPartialEq for Enum

Auto Trait Implementations§

§

impl Freeze for Enum

§

impl RefUnwindSafe for Enum

§

impl Send for Enum

§

impl Sync for Enum

§

impl Unpin for Enum

§

impl UnwindSafe for Enum

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Field.html b/compiler-docs/fe_parser/ast/struct.Field.html new file mode 100644 index 0000000000..727b57c79d --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Field.html @@ -0,0 +1,34 @@ +Field in fe_parser::ast - Rust

Struct Field

Source
pub struct Field {
+    pub is_pub: bool,
+    pub is_const: bool,
+    pub attributes: Vec<Node<SmolStr>>,
+    pub name: Node<SmolStr>,
+    pub typ: Node<TypeDesc>,
+    pub value: Option<Node<Expr>>,
+}
Expand description

struct or contract field, with optional ‘pub’ and ‘const’ qualifiers

+

Fields§

§is_pub: bool§is_const: bool§attributes: Vec<Node<SmolStr>>§name: Node<SmolStr>§typ: Node<TypeDesc>§value: Option<Node<Expr>>

Trait Implementations§

Source§

impl Clone for Field

Source§

fn clone(&self) -> Field

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Field

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Field

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Field

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Field

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Field

Source§

fn eq(&self, other: &Field) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Field

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Field

Source§

impl StructuralPartialEq for Field

Auto Trait Implementations§

§

impl Freeze for Field

§

impl RefUnwindSafe for Field

§

impl Send for Field

§

impl Sync for Field

§

impl Unpin for Field

§

impl UnwindSafe for Field

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Function.html b/compiler-docs/fe_parser/ast/struct.Function.html new file mode 100644 index 0000000000..99b3bfad32 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Function.html @@ -0,0 +1,29 @@ +Function in fe_parser::ast - Rust

Struct Function

Source
pub struct Function {
+    pub sig: Node<FunctionSignature>,
+    pub body: Vec<Node<FuncStmt>>,
+}

Fields§

§sig: Node<FunctionSignature>§body: Vec<Node<FuncStmt>>

Trait Implementations§

Source§

impl Clone for Function

Source§

fn clone(&self) -> Function

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Function

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Function

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Function

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Function

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Function

Source§

fn eq(&self, other: &Function) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Function

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Function

Source§

impl StructuralPartialEq for Function

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.FunctionSignature.html b/compiler-docs/fe_parser/ast/struct.FunctionSignature.html new file mode 100644 index 0000000000..b8f17b5e75 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.FunctionSignature.html @@ -0,0 +1,32 @@ +FunctionSignature in fe_parser::ast - Rust

Struct FunctionSignature

Source
pub struct FunctionSignature {
+    pub pub_: Option<Span>,
+    pub unsafe_: Option<Span>,
+    pub name: Node<SmolStr>,
+    pub generic_params: Node<Vec<GenericParameter>>,
+    pub args: Vec<Node<FunctionArg>>,
+    pub return_type: Option<Node<TypeDesc>>,
+}

Fields§

§pub_: Option<Span>§unsafe_: Option<Span>§name: Node<SmolStr>§generic_params: Node<Vec<GenericParameter>>§args: Vec<Node<FunctionArg>>§return_type: Option<Node<TypeDesc>>

Trait Implementations§

Source§

impl Clone for FunctionSignature

Source§

fn clone(&self) -> FunctionSignature

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionSignature

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FunctionSignature

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for FunctionSignature

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FunctionSignature

Source§

fn eq(&self, other: &FunctionSignature) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for FunctionSignature

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for FunctionSignature

Source§

impl StructuralPartialEq for FunctionSignature

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Impl.html b/compiler-docs/fe_parser/ast/struct.Impl.html new file mode 100644 index 0000000000..ee9d2331a7 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Impl.html @@ -0,0 +1,30 @@ +Impl in fe_parser::ast - Rust

Struct Impl

Source
pub struct Impl {
+    pub impl_trait: Node<SmolStr>,
+    pub receiver: Node<TypeDesc>,
+    pub functions: Vec<Node<Function>>,
+}

Fields§

§impl_trait: Node<SmolStr>§receiver: Node<TypeDesc>§functions: Vec<Node<Function>>

Trait Implementations§

Source§

impl Clone for Impl

Source§

fn clone(&self) -> Impl

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Impl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Impl

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Impl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Impl

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Impl

Source§

fn eq(&self, other: &Impl) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Impl

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Impl

Source§

impl StructuralPartialEq for Impl

Auto Trait Implementations§

§

impl Freeze for Impl

§

impl RefUnwindSafe for Impl

§

impl Send for Impl

§

impl Sync for Impl

§

impl Unpin for Impl

§

impl UnwindSafe for Impl

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.MatchArm.html b/compiler-docs/fe_parser/ast/struct.MatchArm.html new file mode 100644 index 0000000000..993ba77ef2 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.MatchArm.html @@ -0,0 +1,29 @@ +MatchArm in fe_parser::ast - Rust

Struct MatchArm

Source
pub struct MatchArm {
+    pub pat: Node<Pattern>,
+    pub body: Vec<Node<FuncStmt>>,
+}

Fields§

§pat: Node<Pattern>§body: Vec<Node<FuncStmt>>

Trait Implementations§

Source§

impl Clone for MatchArm

Source§

fn clone(&self) -> MatchArm

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MatchArm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MatchArm

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for MatchArm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for MatchArm

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for MatchArm

Source§

fn eq(&self, other: &MatchArm) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for MatchArm

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for MatchArm

Source§

impl StructuralPartialEq for MatchArm

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Module.html b/compiler-docs/fe_parser/ast/struct.Module.html new file mode 100644 index 0000000000..4cb8be8265 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Module.html @@ -0,0 +1,28 @@ +Module in fe_parser::ast - Rust

Struct Module

Source
pub struct Module {
+    pub body: Vec<ModuleStmt>,
+}

Fields§

§body: Vec<ModuleStmt>

Trait Implementations§

Source§

impl Clone for Module

Source§

fn clone(&self) -> Module

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Module

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Module

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Module

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Module

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Module

Source§

fn eq(&self, other: &Module) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Module

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Module

Source§

impl StructuralPartialEq for Module

Auto Trait Implementations§

§

impl Freeze for Module

§

impl RefUnwindSafe for Module

§

impl Send for Module

§

impl Sync for Module

§

impl Unpin for Module

§

impl UnwindSafe for Module

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Path.html b/compiler-docs/fe_parser/ast/struct.Path.html new file mode 100644 index 0000000000..dfac899600 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Path.html @@ -0,0 +1,28 @@ +Path in fe_parser::ast - Rust

Struct Path

Source
pub struct Path {
+    pub segments: Vec<Node<SmolStr>>,
+}

Fields§

§segments: Vec<Node<SmolStr>>

Implementations§

Source§

impl Path

Source

pub fn remove_last(&self) -> Path

Trait Implementations§

Source§

impl Clone for Path

Source§

fn clone(&self) -> Path

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Path

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Path

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Path

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Path

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Path

Source§

fn eq(&self, other: &Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Path

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Path

Source§

impl StructuralPartialEq for Path

Auto Trait Implementations§

§

impl Freeze for Path

§

impl RefUnwindSafe for Path

§

impl Send for Path

§

impl Sync for Path

§

impl Unpin for Path

§

impl UnwindSafe for Path

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Pragma.html b/compiler-docs/fe_parser/ast/struct.Pragma.html new file mode 100644 index 0000000000..9932a89c49 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Pragma.html @@ -0,0 +1,28 @@ +Pragma in fe_parser::ast - Rust

Struct Pragma

Source
pub struct Pragma {
+    pub version_requirement: Node<SmolStr>,
+}

Fields§

§version_requirement: Node<SmolStr>

Trait Implementations§

Source§

impl Clone for Pragma

Source§

fn clone(&self) -> Pragma

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pragma

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Pragma

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Pragma

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Pragma

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Pragma

Source§

fn eq(&self, other: &Pragma) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Pragma

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Pragma

Source§

impl StructuralPartialEq for Pragma

Auto Trait Implementations§

§

impl Freeze for Pragma

§

impl RefUnwindSafe for Pragma

§

impl Send for Pragma

§

impl Sync for Pragma

§

impl Unpin for Pragma

§

impl UnwindSafe for Pragma

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.SmolStr.html b/compiler-docs/fe_parser/ast/struct.SmolStr.html new file mode 100644 index 0000000000..696548b432 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.SmolStr.html @@ -0,0 +1,1368 @@ +SmolStr in fe_parser::ast - Rust

Struct SmolStr

pub struct SmolStr(/* private fields */);
Expand description

A SmolStr is a string type that has the following properties:

+
    +
  • size_of::<SmolStr>() == size_of::<String>()
  • +
  • Clone is O(1)
  • +
  • Strings are stack-allocated if they are: +
      +
    • Up to 23 bytes long
    • +
    • Longer than 23 bytes, but substrings of WS (see below). Such strings consist +solely of consecutive newlines, followed by consecutive spaces
    • +
    +
  • +
  • If a string does not satisfy the aforementioned conditions, it is heap-allocated
  • +
+

Unlike String, however, SmolStr is immutable. The primary use case for +SmolStr is a good enough default storage for tokens of typical programming +languages. Strings consisting of a series of newlines, followed by a series of +whitespace are a typical pattern in computer programs because of indentation. +Note that a specialized interner might be a better solution for some use cases.

+

WS: A string of 32 newlines followed by 128 spaces.

+

Implementations§

§

impl SmolStr

pub const fn new_inline_from_ascii(len: usize, bytes: &[u8]) -> SmolStr

👎Deprecated: Use new_inline instead

pub const fn new_inline(text: &str) -> SmolStr

Constructs inline variant of SmolStr.

+

Panics if text.len() > 23.

+

pub fn new<T>(text: T) -> SmolStr
where + T: AsRef<str>,

pub fn as_str(&self) -> &str

pub fn to_string(&self) -> String

pub fn len(&self) -> usize

pub fn is_empty(&self) -> bool

pub fn is_heap_allocated(&self) -> bool

Methods from Deref<Target = str>§

1.0.0 · Source

pub fn len(&self) -> usize

Returns the length of self.

+

This length is in bytes, not chars or graphemes. In other words, +it might not be what a human considers the length of the string.

+
§Examples
+
let len = "foo".len();
+assert_eq!(3, len);
+
+assert_eq!("ƒoo".len(), 4); // fancy f!
+assert_eq!("ƒoo".chars().count(), 3);
+
1.0.0 · Source

pub fn is_empty(&self) -> bool

Returns true if self has a length of zero bytes.

+
§Examples
+
let s = "";
+assert!(s.is_empty());
+
+let s = "not empty";
+assert!(!s.is_empty());
+
1.9.0 · Source

pub fn is_char_boundary(&self, index: usize) -> bool

Checks that index-th byte is the first byte in a UTF-8 code point +sequence or the end of the string.

+

The start and end of the string (when index == self.len()) are +considered to be boundaries.

+

Returns false if index is greater than self.len().

+
§Examples
+
let s = "Löwe 老虎 Léopard";
+assert!(s.is_char_boundary(0));
+// start of `老`
+assert!(s.is_char_boundary(6));
+assert!(s.is_char_boundary(s.len()));
+
+// second byte of `ö`
+assert!(!s.is_char_boundary(2));
+
+// third byte of `老`
+assert!(!s.is_char_boundary(8));
+
Source

pub fn floor_char_boundary(&self, index: usize) -> usize

🔬This is a nightly-only experimental API. (round_char_boundary)

Finds the closest x not exceeding index where is_char_boundary(x) is true.

+

This method can help you truncate a string so that it’s still valid UTF-8, but doesn’t +exceed a given number of bytes. Note that this is done purely at the character level +and can still visually split graphemes, even though the underlying characters aren’t +split. For example, the emoji 🧑‍🔬 (scientist) could be split so that the string only +includes 🧑 (person) instead.

+
§Examples
+
#![feature(round_char_boundary)]
+let s = "❤️🧡💛💚💙💜";
+assert_eq!(s.len(), 26);
+assert!(!s.is_char_boundary(13));
+
+let closest = s.floor_char_boundary(13);
+assert_eq!(closest, 10);
+assert_eq!(&s[..closest], "❤️🧡");
+
Source

pub fn ceil_char_boundary(&self, index: usize) -> usize

🔬This is a nightly-only experimental API. (round_char_boundary)

Finds the closest x not below index where is_char_boundary(x) is true.

+

If index is greater than the length of the string, this returns the length of the string.

+

This method is the natural complement to floor_char_boundary. See that method +for more details.

+
§Examples
+
#![feature(round_char_boundary)]
+let s = "❤️🧡💛💚💙💜";
+assert_eq!(s.len(), 26);
+assert!(!s.is_char_boundary(13));
+
+let closest = s.ceil_char_boundary(13);
+assert_eq!(closest, 14);
+assert_eq!(&s[..closest], "❤️🧡💛");
+
1.0.0 · Source

pub fn as_bytes(&self) -> &[u8]

Converts a string slice to a byte slice. To convert the byte slice back +into a string slice, use the from_utf8 function.

+
§Examples
+
let bytes = "bors".as_bytes();
+assert_eq!(b"bors", bytes);
+
1.0.0 · Source

pub fn as_ptr(&self) -> *const u8

Converts a string slice to a raw pointer.

+

As string slices are a slice of bytes, the raw pointer points to a +u8. This pointer will be pointing to the first byte of the string +slice.

+

The caller must ensure that the returned pointer is never written to. +If you need to mutate the contents of the string slice, use as_mut_ptr.

+
§Examples
+
let s = "Hello";
+let ptr = s.as_ptr();
+
1.20.0 · Source

pub fn get<I>(&self, i: I) -> Option<&<I as SliceIndex<str>>::Output>
where + I: SliceIndex<str>,

Returns a subslice of str.

+

This is the non-panicking alternative to indexing the str. Returns +None whenever equivalent indexing operation would panic.

+
§Examples
+
let v = String::from("🗻∈🌏");
+
+assert_eq!(Some("🗻"), v.get(0..4));
+
+// indices not on UTF-8 sequence boundaries
+assert!(v.get(1..).is_none());
+assert!(v.get(..8).is_none());
+
+// out of bounds
+assert!(v.get(..42).is_none());
+
1.20.0 · Source

pub unsafe fn get_unchecked<I>(&self, i: I) -> &<I as SliceIndex<str>>::Output
where + I: SliceIndex<str>,

Returns an unchecked subslice of str.

+

This is the unchecked alternative to indexing the str.

+
§Safety
+

Callers of this function are responsible that these preconditions are +satisfied:

+
    +
  • The starting index must not exceed the ending index;
  • +
  • Indexes must be within bounds of the original slice;
  • +
  • Indexes must lie on UTF-8 sequence boundaries.
  • +
+

Failing that, the returned string slice may reference invalid memory or +violate the invariants communicated by the str type.

+
§Examples
+
let v = "🗻∈🌏";
+unsafe {
+    assert_eq!("🗻", v.get_unchecked(0..4));
+    assert_eq!("∈", v.get_unchecked(4..7));
+    assert_eq!("🌏", v.get_unchecked(7..11));
+}
+
1.0.0 · Source

pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str

👎Deprecated since 1.29.0: use get_unchecked(begin..end) instead

Creates a string slice from another string slice, bypassing safety +checks.

+

This is generally not recommended, use with caution! For a safe +alternative see str and Index.

+

This new slice goes from begin to end, including begin but +excluding end.

+

To get a mutable string slice instead, see the +slice_mut_unchecked method.

+
§Safety
+

Callers of this function are responsible that three preconditions are +satisfied:

+
    +
  • begin must not exceed end.
  • +
  • begin and end must be byte positions within the string slice.
  • +
  • begin and end must lie on UTF-8 sequence boundaries.
  • +
+
§Examples
+
let s = "Löwe 老虎 Léopard";
+
+unsafe {
+    assert_eq!("Löwe 老虎 Léopard", s.slice_unchecked(0, 21));
+}
+
+let s = "Hello, world!";
+
+unsafe {
+    assert_eq!("world", s.slice_unchecked(7, 12));
+}
+
1.4.0 · Source

pub fn split_at(&self, mid: usize) -> (&str, &str)

Divides one string slice into two at an index.

+

The argument, mid, should be a byte offset from the start of the +string. It must also be on the boundary of a UTF-8 code point.

+

The two slices returned go from the start of the string slice to mid, +and from mid to the end of the string slice.

+

To get mutable string slices instead, see the split_at_mut +method.

+
§Panics
+

Panics if mid is not on a UTF-8 code point boundary, or if it is past +the end of the last code point of the string slice. For a non-panicking +alternative see split_at_checked.

+
§Examples
+
let s = "Per Martin-Löf";
+
+let (first, last) = s.split_at(3);
+
+assert_eq!("Per", first);
+assert_eq!(" Martin-Löf", last);
+
1.80.0 · Source

pub fn split_at_checked(&self, mid: usize) -> Option<(&str, &str)>

Divides one string slice into two at an index.

+

The argument, mid, should be a valid byte offset from the start of the +string. It must also be on the boundary of a UTF-8 code point. The +method returns None if that’s not the case.

+

The two slices returned go from the start of the string slice to mid, +and from mid to the end of the string slice.

+

To get mutable string slices instead, see the split_at_mut_checked +method.

+
§Examples
+
let s = "Per Martin-Löf";
+
+let (first, last) = s.split_at_checked(3).unwrap();
+assert_eq!("Per", first);
+assert_eq!(" Martin-Löf", last);
+
+assert_eq!(None, s.split_at_checked(13));  // Inside “ö”
+assert_eq!(None, s.split_at_checked(16));  // Beyond the string length
+
1.0.0 · Source

pub fn chars(&self) -> Chars<'_>

Returns an iterator over the chars of a string slice.

+

As a string slice consists of valid UTF-8, we can iterate through a +string slice by char. This method returns such an iterator.

+

It’s important to remember that char represents a Unicode Scalar +Value, and might not match your idea of what a ‘character’ is. Iteration +over grapheme clusters may be what you actually want. This functionality +is not provided by Rust’s standard library, check crates.io instead.

+
§Examples
+

Basic usage:

+ +
let word = "goodbye";
+
+let count = word.chars().count();
+assert_eq!(7, count);
+
+let mut chars = word.chars();
+
+assert_eq!(Some('g'), chars.next());
+assert_eq!(Some('o'), chars.next());
+assert_eq!(Some('o'), chars.next());
+assert_eq!(Some('d'), chars.next());
+assert_eq!(Some('b'), chars.next());
+assert_eq!(Some('y'), chars.next());
+assert_eq!(Some('e'), chars.next());
+
+assert_eq!(None, chars.next());
+

Remember, chars might not match your intuition about characters:

+ +
let y = "y̆";
+
+let mut chars = y.chars();
+
+assert_eq!(Some('y'), chars.next()); // not 'y̆'
+assert_eq!(Some('\u{0306}'), chars.next());
+
+assert_eq!(None, chars.next());
+
1.0.0 · Source

pub fn char_indices(&self) -> CharIndices<'_>

Returns an iterator over the chars of a string slice, and their +positions.

+

As a string slice consists of valid UTF-8, we can iterate through a +string slice by char. This method returns an iterator of both +these chars, as well as their byte positions.

+

The iterator yields tuples. The position is first, the char is +second.

+
§Examples
+

Basic usage:

+ +
let word = "goodbye";
+
+let count = word.char_indices().count();
+assert_eq!(7, count);
+
+let mut char_indices = word.char_indices();
+
+assert_eq!(Some((0, 'g')), char_indices.next());
+assert_eq!(Some((1, 'o')), char_indices.next());
+assert_eq!(Some((2, 'o')), char_indices.next());
+assert_eq!(Some((3, 'd')), char_indices.next());
+assert_eq!(Some((4, 'b')), char_indices.next());
+assert_eq!(Some((5, 'y')), char_indices.next());
+assert_eq!(Some((6, 'e')), char_indices.next());
+
+assert_eq!(None, char_indices.next());
+

Remember, chars might not match your intuition about characters:

+ +
let yes = "y̆es";
+
+let mut char_indices = yes.char_indices();
+
+assert_eq!(Some((0, 'y')), char_indices.next()); // not (0, 'y̆')
+assert_eq!(Some((1, '\u{0306}')), char_indices.next());
+
+// note the 3 here - the previous character took up two bytes
+assert_eq!(Some((3, 'e')), char_indices.next());
+assert_eq!(Some((4, 's')), char_indices.next());
+
+assert_eq!(None, char_indices.next());
+
1.0.0 · Source

pub fn bytes(&self) -> Bytes<'_>

Returns an iterator over the bytes of a string slice.

+

As a string slice consists of a sequence of bytes, we can iterate +through a string slice by byte. This method returns such an iterator.

+
§Examples
+
let mut bytes = "bors".bytes();
+
+assert_eq!(Some(b'b'), bytes.next());
+assert_eq!(Some(b'o'), bytes.next());
+assert_eq!(Some(b'r'), bytes.next());
+assert_eq!(Some(b's'), bytes.next());
+
+assert_eq!(None, bytes.next());
+
1.1.0 · Source

pub fn split_whitespace(&self) -> SplitWhitespace<'_>

Splits a string slice by whitespace.

+

The iterator returned will return string slices that are sub-slices of +the original string slice, separated by any amount of whitespace.

+

‘Whitespace’ is defined according to the terms of the Unicode Derived +Core Property White_Space. If you only want to split on ASCII whitespace +instead, use split_ascii_whitespace.

+
§Examples
+

Basic usage:

+ +
let mut iter = "A few words".split_whitespace();
+
+assert_eq!(Some("A"), iter.next());
+assert_eq!(Some("few"), iter.next());
+assert_eq!(Some("words"), iter.next());
+
+assert_eq!(None, iter.next());
+

All kinds of whitespace are considered:

+ +
let mut iter = " Mary   had\ta\u{2009}little  \n\t lamb".split_whitespace();
+assert_eq!(Some("Mary"), iter.next());
+assert_eq!(Some("had"), iter.next());
+assert_eq!(Some("a"), iter.next());
+assert_eq!(Some("little"), iter.next());
+assert_eq!(Some("lamb"), iter.next());
+
+assert_eq!(None, iter.next());
+

If the string is empty or all whitespace, the iterator yields no string slices:

+ +
assert_eq!("".split_whitespace().next(), None);
+assert_eq!("   ".split_whitespace().next(), None);
+
1.34.0 · Source

pub fn split_ascii_whitespace(&self) -> SplitAsciiWhitespace<'_>

Splits a string slice by ASCII whitespace.

+

The iterator returned will return string slices that are sub-slices of +the original string slice, separated by any amount of ASCII whitespace.

+

This uses the same definition as char::is_ascii_whitespace. +To split by Unicode Whitespace instead, use split_whitespace.

+
§Examples
+

Basic usage:

+ +
let mut iter = "A few words".split_ascii_whitespace();
+
+assert_eq!(Some("A"), iter.next());
+assert_eq!(Some("few"), iter.next());
+assert_eq!(Some("words"), iter.next());
+
+assert_eq!(None, iter.next());
+

Various kinds of ASCII whitespace are considered +(see char::is_ascii_whitespace):

+ +
let mut iter = " Mary   had\ta little  \n\t lamb".split_ascii_whitespace();
+assert_eq!(Some("Mary"), iter.next());
+assert_eq!(Some("had"), iter.next());
+assert_eq!(Some("a"), iter.next());
+assert_eq!(Some("little"), iter.next());
+assert_eq!(Some("lamb"), iter.next());
+
+assert_eq!(None, iter.next());
+

If the string is empty or all ASCII whitespace, the iterator yields no string slices:

+ +
assert_eq!("".split_ascii_whitespace().next(), None);
+assert_eq!("   ".split_ascii_whitespace().next(), None);
+
1.0.0 · Source

pub fn lines(&self) -> Lines<'_>

Returns an iterator over the lines of a string, as string slices.

+

Lines are split at line endings that are either newlines (\n) or +sequences of a carriage return followed by a line feed (\r\n).

+

Line terminators are not included in the lines returned by the iterator.

+

Note that any carriage return (\r) not immediately followed by a +line feed (\n) does not split a line. These carriage returns are +thereby included in the produced lines.

+

The final line ending is optional. A string that ends with a final line +ending will return the same lines as an otherwise identical string +without a final line ending.

+
§Examples
+

Basic usage:

+ +
let text = "foo\r\nbar\n\nbaz\r";
+let mut lines = text.lines();
+
+assert_eq!(Some("foo"), lines.next());
+assert_eq!(Some("bar"), lines.next());
+assert_eq!(Some(""), lines.next());
+// Trailing carriage return is included in the last line
+assert_eq!(Some("baz\r"), lines.next());
+
+assert_eq!(None, lines.next());
+

The final line does not require any ending:

+ +
let text = "foo\nbar\n\r\nbaz";
+let mut lines = text.lines();
+
+assert_eq!(Some("foo"), lines.next());
+assert_eq!(Some("bar"), lines.next());
+assert_eq!(Some(""), lines.next());
+assert_eq!(Some("baz"), lines.next());
+
+assert_eq!(None, lines.next());
+
1.0.0 · Source

pub fn lines_any(&self) -> LinesAny<'_>

👎Deprecated since 1.4.0: use lines() instead now

Returns an iterator over the lines of a string.

+
1.8.0 · Source

pub fn encode_utf16(&self) -> EncodeUtf16<'_>

Returns an iterator of u16 over the string encoded +as native endian UTF-16 (without byte-order mark).

+
§Examples
+
let text = "Zażółć gęślą jaźń";
+
+let utf8_len = text.len();
+let utf16_len = text.encode_utf16().count();
+
+assert!(utf16_len <= utf8_len);
+
1.0.0 · Source

pub fn contains<P>(&self, pat: P) -> bool
where + P: Pattern,

Returns true if the given pattern matches a sub-slice of +this string slice.

+

Returns false if it does not.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Examples
+
let bananas = "bananas";
+
+assert!(bananas.contains("nana"));
+assert!(!bananas.contains("apples"));
+
1.0.0 · Source

pub fn starts_with<P>(&self, pat: P) -> bool
where + P: Pattern,

Returns true if the given pattern matches a prefix of this +string slice.

+

Returns false if it does not.

+

The pattern can be a &str, in which case this function will return true if +the &str is a prefix of this string slice.

+

The pattern can also be a char, a slice of chars, or a +function or closure that determines if a character matches. +These will only be checked against the first character of this string slice. +Look at the second example below regarding behavior for slices of chars.

+
§Examples
+
let bananas = "bananas";
+
+assert!(bananas.starts_with("bana"));
+assert!(!bananas.starts_with("nana"));
+ +
let bananas = "bananas";
+
+// Note that both of these assert successfully.
+assert!(bananas.starts_with(&['b', 'a', 'n', 'a']));
+assert!(bananas.starts_with(&['a', 'b', 'c', 'd']));
+
1.0.0 · Source

pub fn ends_with<P>(&self, pat: P) -> bool
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Returns true if the given pattern matches a suffix of this +string slice.

+

Returns false if it does not.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Examples
+
let bananas = "bananas";
+
+assert!(bananas.ends_with("anas"));
+assert!(!bananas.ends_with("nana"));
+
1.0.0 · Source

pub fn find<P>(&self, pat: P) -> Option<usize>
where + P: Pattern,

Returns the byte index of the first character of this string slice that +matches the pattern.

+

Returns None if the pattern doesn’t match.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Examples
+

Simple patterns:

+ +
let s = "Löwe 老虎 Léopard Gepardi";
+
+assert_eq!(s.find('L'), Some(0));
+assert_eq!(s.find('é'), Some(14));
+assert_eq!(s.find("pard"), Some(17));
+

More complex patterns using point-free style and closures:

+ +
let s = "Löwe 老虎 Léopard";
+
+assert_eq!(s.find(char::is_whitespace), Some(5));
+assert_eq!(s.find(char::is_lowercase), Some(1));
+assert_eq!(s.find(|c: char| c.is_whitespace() || c.is_lowercase()), Some(1));
+assert_eq!(s.find(|c: char| (c < 'o') && (c > 'a')), Some(4));
+

Not finding the pattern:

+ +
let s = "Löwe 老虎 Léopard";
+let x: &[_] = &['1', '2'];
+
+assert_eq!(s.find(x), None);
+
1.0.0 · Source

pub fn rfind<P>(&self, pat: P) -> Option<usize>
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Returns the byte index for the first character of the last match of the pattern in +this string slice.

+

Returns None if the pattern doesn’t match.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Examples
+

Simple patterns:

+ +
let s = "Löwe 老虎 Léopard Gepardi";
+
+assert_eq!(s.rfind('L'), Some(13));
+assert_eq!(s.rfind('é'), Some(14));
+assert_eq!(s.rfind("pard"), Some(24));
+

More complex patterns with closures:

+ +
let s = "Löwe 老虎 Léopard";
+
+assert_eq!(s.rfind(char::is_whitespace), Some(12));
+assert_eq!(s.rfind(char::is_lowercase), Some(20));
+

Not finding the pattern:

+ +
let s = "Löwe 老虎 Léopard";
+let x: &[_] = &['1', '2'];
+
+assert_eq!(s.rfind(x), None);
+
1.0.0 · Source

pub fn split<P>(&self, pat: P) -> Split<'_, P>
where + P: Pattern,

Returns an iterator over substrings of this string slice, separated by +characters matched by a pattern.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+

If there are no matches the full string slice is returned as the only +item in the iterator.

+
§Iterator behavior
+

The returned iterator will be a DoubleEndedIterator if the pattern +allows a reverse search and forward/reverse search yields the same +elements. This is true for, e.g., char, but not for &str.

+

If the pattern allows a reverse search but its results might differ +from a forward search, the rsplit method can be used.

+
§Examples
+

Simple patterns:

+ +
let v: Vec<&str> = "Mary had a little lamb".split(' ').collect();
+assert_eq!(v, ["Mary", "had", "a", "little", "lamb"]);
+
+let v: Vec<&str> = "".split('X').collect();
+assert_eq!(v, [""]);
+
+let v: Vec<&str> = "lionXXtigerXleopard".split('X').collect();
+assert_eq!(v, ["lion", "", "tiger", "leopard"]);
+
+let v: Vec<&str> = "lion::tiger::leopard".split("::").collect();
+assert_eq!(v, ["lion", "tiger", "leopard"]);
+
+let v: Vec<&str> = "AABBCC".split("DD").collect();
+assert_eq!(v, ["AABBCC"]);
+
+let v: Vec<&str> = "abc1def2ghi".split(char::is_numeric).collect();
+assert_eq!(v, ["abc", "def", "ghi"]);
+
+let v: Vec<&str> = "lionXtigerXleopard".split(char::is_uppercase).collect();
+assert_eq!(v, ["lion", "tiger", "leopard"]);
+

If the pattern is a slice of chars, split on each occurrence of any of the characters:

+ +
let v: Vec<&str> = "2020-11-03 23:59".split(&['-', ' ', ':', '@'][..]).collect();
+assert_eq!(v, ["2020", "11", "03", "23", "59"]);
+

A more complex pattern, using a closure:

+ +
let v: Vec<&str> = "abc1defXghi".split(|c| c == '1' || c == 'X').collect();
+assert_eq!(v, ["abc", "def", "ghi"]);
+

If a string contains multiple contiguous separators, you will end up +with empty strings in the output:

+ +
let x = "||||a||b|c".to_string();
+let d: Vec<_> = x.split('|').collect();
+
+assert_eq!(d, &["", "", "", "", "a", "", "b", "c"]);
+

Contiguous separators are separated by the empty string.

+ +
let x = "(///)".to_string();
+let d: Vec<_> = x.split('/').collect();
+
+assert_eq!(d, &["(", "", "", ")"]);
+

Separators at the start or end of a string are neighbored +by empty strings.

+ +
let d: Vec<_> = "010".split("0").collect();
+assert_eq!(d, &["", "1", ""]);
+

When the empty string is used as a separator, it separates +every character in the string, along with the beginning +and end of the string.

+ +
let f: Vec<_> = "rust".split("").collect();
+assert_eq!(f, &["", "r", "u", "s", "t", ""]);
+

Contiguous separators can lead to possibly surprising behavior +when whitespace is used as the separator. This code is correct:

+ +
let x = "    a  b c".to_string();
+let d: Vec<_> = x.split(' ').collect();
+
+assert_eq!(d, &["", "", "", "", "a", "", "b", "c"]);
+

It does not give you:

+ +
assert_eq!(d, &["a", "b", "c"]);
+

Use split_whitespace for this behavior.

+
1.51.0 · Source

pub fn split_inclusive<P>(&self, pat: P) -> SplitInclusive<'_, P>
where + P: Pattern,

Returns an iterator over substrings of this string slice, separated by +characters matched by a pattern.

+

Differs from the iterator produced by split in that split_inclusive +leaves the matched part as the terminator of the substring.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Examples
+
let v: Vec<&str> = "Mary had a little lamb\nlittle lamb\nlittle lamb."
+    .split_inclusive('\n').collect();
+assert_eq!(v, ["Mary had a little lamb\n", "little lamb\n", "little lamb."]);
+

If the last element of the string is matched, +that element will be considered the terminator of the preceding substring. +That substring will be the last item returned by the iterator.

+ +
let v: Vec<&str> = "Mary had a little lamb\nlittle lamb\nlittle lamb.\n"
+    .split_inclusive('\n').collect();
+assert_eq!(v, ["Mary had a little lamb\n", "little lamb\n", "little lamb.\n"]);
+
1.0.0 · Source

pub fn rsplit<P>(&self, pat: P) -> RSplit<'_, P>
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Returns an iterator over substrings of the given string slice, separated +by characters matched by a pattern and yielded in reverse order.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Iterator behavior
+

The returned iterator requires that the pattern supports a reverse +search, and it will be a DoubleEndedIterator if a forward/reverse +search yields the same elements.

+

For iterating from the front, the split method can be used.

+
§Examples
+

Simple patterns:

+ +
let v: Vec<&str> = "Mary had a little lamb".rsplit(' ').collect();
+assert_eq!(v, ["lamb", "little", "a", "had", "Mary"]);
+
+let v: Vec<&str> = "".rsplit('X').collect();
+assert_eq!(v, [""]);
+
+let v: Vec<&str> = "lionXXtigerXleopard".rsplit('X').collect();
+assert_eq!(v, ["leopard", "tiger", "", "lion"]);
+
+let v: Vec<&str> = "lion::tiger::leopard".rsplit("::").collect();
+assert_eq!(v, ["leopard", "tiger", "lion"]);
+

A more complex pattern, using a closure:

+ +
let v: Vec<&str> = "abc1defXghi".rsplit(|c| c == '1' || c == 'X').collect();
+assert_eq!(v, ["ghi", "def", "abc"]);
+
1.0.0 · Source

pub fn split_terminator<P>(&self, pat: P) -> SplitTerminator<'_, P>
where + P: Pattern,

Returns an iterator over substrings of the given string slice, separated +by characters matched by a pattern.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+

Equivalent to split, except that the trailing substring +is skipped if empty.

+

This method can be used for string data that is terminated, +rather than separated by a pattern.

+
§Iterator behavior
+

The returned iterator will be a DoubleEndedIterator if the pattern +allows a reverse search and forward/reverse search yields the same +elements. This is true for, e.g., char, but not for &str.

+

If the pattern allows a reverse search but its results might differ +from a forward search, the rsplit_terminator method can be used.

+
§Examples
+
let v: Vec<&str> = "A.B.".split_terminator('.').collect();
+assert_eq!(v, ["A", "B"]);
+
+let v: Vec<&str> = "A..B..".split_terminator(".").collect();
+assert_eq!(v, ["A", "", "B", ""]);
+
+let v: Vec<&str> = "A.B:C.D".split_terminator(&['.', ':'][..]).collect();
+assert_eq!(v, ["A", "B", "C", "D"]);
+
1.0.0 · Source

pub fn rsplit_terminator<P>(&self, pat: P) -> RSplitTerminator<'_, P>
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Returns an iterator over substrings of self, separated by characters +matched by a pattern and yielded in reverse order.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+

Equivalent to split, except that the trailing substring is +skipped if empty.

+

This method can be used for string data that is terminated, +rather than separated by a pattern.

+
§Iterator behavior
+

The returned iterator requires that the pattern supports a +reverse search, and it will be double ended if a forward/reverse +search yields the same elements.

+

For iterating from the front, the split_terminator method can be +used.

+
§Examples
+
let v: Vec<&str> = "A.B.".rsplit_terminator('.').collect();
+assert_eq!(v, ["B", "A"]);
+
+let v: Vec<&str> = "A..B..".rsplit_terminator(".").collect();
+assert_eq!(v, ["", "B", "", "A"]);
+
+let v: Vec<&str> = "A.B:C.D".rsplit_terminator(&['.', ':'][..]).collect();
+assert_eq!(v, ["D", "C", "B", "A"]);
+
1.0.0 · Source

pub fn splitn<P>(&self, n: usize, pat: P) -> SplitN<'_, P>
where + P: Pattern,

Returns an iterator over substrings of the given string slice, separated +by a pattern, restricted to returning at most n items.

+

If n substrings are returned, the last substring (the nth substring) +will contain the remainder of the string.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Iterator behavior
+

The returned iterator will not be double ended, because it is +not efficient to support.

+

If the pattern allows a reverse search, the rsplitn method can be +used.

+
§Examples
+

Simple patterns:

+ +
let v: Vec<&str> = "Mary had a little lambda".splitn(3, ' ').collect();
+assert_eq!(v, ["Mary", "had", "a little lambda"]);
+
+let v: Vec<&str> = "lionXXtigerXleopard".splitn(3, "X").collect();
+assert_eq!(v, ["lion", "", "tigerXleopard"]);
+
+let v: Vec<&str> = "abcXdef".splitn(1, 'X').collect();
+assert_eq!(v, ["abcXdef"]);
+
+let v: Vec<&str> = "".splitn(1, 'X').collect();
+assert_eq!(v, [""]);
+

A more complex pattern, using a closure:

+ +
let v: Vec<&str> = "abc1defXghi".splitn(2, |c| c == '1' || c == 'X').collect();
+assert_eq!(v, ["abc", "defXghi"]);
+
1.0.0 · Source

pub fn rsplitn<P>(&self, n: usize, pat: P) -> RSplitN<'_, P>
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Returns an iterator over substrings of this string slice, separated by a +pattern, starting from the end of the string, restricted to returning at +most n items.

+

If n substrings are returned, the last substring (the nth substring) +will contain the remainder of the string.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Iterator behavior
+

The returned iterator will not be double ended, because it is not +efficient to support.

+

For splitting from the front, the splitn method can be used.

+
§Examples
+

Simple patterns:

+ +
let v: Vec<&str> = "Mary had a little lamb".rsplitn(3, ' ').collect();
+assert_eq!(v, ["lamb", "little", "Mary had a"]);
+
+let v: Vec<&str> = "lionXXtigerXleopard".rsplitn(3, 'X').collect();
+assert_eq!(v, ["leopard", "tiger", "lionX"]);
+
+let v: Vec<&str> = "lion::tiger::leopard".rsplitn(2, "::").collect();
+assert_eq!(v, ["leopard", "lion::tiger"]);
+

A more complex pattern, using a closure:

+ +
let v: Vec<&str> = "abc1defXghi".rsplitn(2, |c| c == '1' || c == 'X').collect();
+assert_eq!(v, ["ghi", "abc1def"]);
+
1.52.0 · Source

pub fn split_once<P>(&self, delimiter: P) -> Option<(&str, &str)>
where + P: Pattern,

Splits the string on the first occurrence of the specified delimiter and +returns prefix before delimiter and suffix after delimiter.

+
§Examples
+
assert_eq!("cfg".split_once('='), None);
+assert_eq!("cfg=".split_once('='), Some(("cfg", "")));
+assert_eq!("cfg=foo".split_once('='), Some(("cfg", "foo")));
+assert_eq!("cfg=foo=bar".split_once('='), Some(("cfg", "foo=bar")));
+
1.52.0 · Source

pub fn rsplit_once<P>(&self, delimiter: P) -> Option<(&str, &str)>
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Splits the string on the last occurrence of the specified delimiter and +returns prefix before delimiter and suffix after delimiter.

+
§Examples
+
assert_eq!("cfg".rsplit_once('='), None);
+assert_eq!("cfg=foo".rsplit_once('='), Some(("cfg", "foo")));
+assert_eq!("cfg=foo=bar".rsplit_once('='), Some(("cfg=foo", "bar")));
+
1.2.0 · Source

pub fn matches<P>(&self, pat: P) -> Matches<'_, P>
where + P: Pattern,

Returns an iterator over the disjoint matches of a pattern within the +given string slice.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Iterator behavior
+

The returned iterator will be a DoubleEndedIterator if the pattern +allows a reverse search and forward/reverse search yields the same +elements. This is true for, e.g., char, but not for &str.

+

If the pattern allows a reverse search but its results might differ +from a forward search, the rmatches method can be used.

+
§Examples
+
let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect();
+assert_eq!(v, ["abc", "abc", "abc"]);
+
+let v: Vec<&str> = "1abc2abc3".matches(char::is_numeric).collect();
+assert_eq!(v, ["1", "2", "3"]);
+
1.2.0 · Source

pub fn rmatches<P>(&self, pat: P) -> RMatches<'_, P>
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Returns an iterator over the disjoint matches of a pattern within this +string slice, yielded in reverse order.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Iterator behavior
+

The returned iterator requires that the pattern supports a reverse +search, and it will be a DoubleEndedIterator if a forward/reverse +search yields the same elements.

+

For iterating from the front, the matches method can be used.

+
§Examples
+
let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect();
+assert_eq!(v, ["abc", "abc", "abc"]);
+
+let v: Vec<&str> = "1abc2abc3".rmatches(char::is_numeric).collect();
+assert_eq!(v, ["3", "2", "1"]);
+
1.5.0 · Source

pub fn match_indices<P>(&self, pat: P) -> MatchIndices<'_, P>
where + P: Pattern,

Returns an iterator over the disjoint matches of a pattern within this string +slice as well as the index that the match starts at.

+

For matches of pat within self that overlap, only the indices +corresponding to the first match are returned.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Iterator behavior
+

The returned iterator will be a DoubleEndedIterator if the pattern +allows a reverse search and forward/reverse search yields the same +elements. This is true for, e.g., char, but not for &str.

+

If the pattern allows a reverse search but its results might differ +from a forward search, the rmatch_indices method can be used.

+
§Examples
+
let v: Vec<_> = "abcXXXabcYYYabc".match_indices("abc").collect();
+assert_eq!(v, [(0, "abc"), (6, "abc"), (12, "abc")]);
+
+let v: Vec<_> = "1abcabc2".match_indices("abc").collect();
+assert_eq!(v, [(1, "abc"), (4, "abc")]);
+
+let v: Vec<_> = "ababa".match_indices("aba").collect();
+assert_eq!(v, [(0, "aba")]); // only the first `aba`
+
1.5.0 · Source

pub fn rmatch_indices<P>(&self, pat: P) -> RMatchIndices<'_, P>
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Returns an iterator over the disjoint matches of a pattern within self, +yielded in reverse order along with the index of the match.

+

For matches of pat within self that overlap, only the indices +corresponding to the last match are returned.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Iterator behavior
+

The returned iterator requires that the pattern supports a reverse +search, and it will be a DoubleEndedIterator if a forward/reverse +search yields the same elements.

+

For iterating from the front, the match_indices method can be used.

+
§Examples
+
let v: Vec<_> = "abcXXXabcYYYabc".rmatch_indices("abc").collect();
+assert_eq!(v, [(12, "abc"), (6, "abc"), (0, "abc")]);
+
+let v: Vec<_> = "1abcabc2".rmatch_indices("abc").collect();
+assert_eq!(v, [(4, "abc"), (1, "abc")]);
+
+let v: Vec<_> = "ababa".rmatch_indices("aba").collect();
+assert_eq!(v, [(2, "aba")]); // only the last `aba`
+
1.0.0 · Source

pub fn trim(&self) -> &str

Returns a string slice with leading and trailing whitespace removed.

+

‘Whitespace’ is defined according to the terms of the Unicode Derived +Core Property White_Space, which includes newlines.

+
§Examples
+
let s = "\n Hello\tworld\t\n";
+
+assert_eq!("Hello\tworld", s.trim());
+
1.30.0 · Source

pub fn trim_start(&self) -> &str

Returns a string slice with leading whitespace removed.

+

‘Whitespace’ is defined according to the terms of the Unicode Derived +Core Property White_Space, which includes newlines.

+
§Text directionality
+

A string is a sequence of bytes. start in this context means the first +position of that byte string; for a left-to-right language like English or +Russian, this will be left side, and for right-to-left languages like +Arabic or Hebrew, this will be the right side.

+
§Examples
+

Basic usage:

+ +
let s = "\n Hello\tworld\t\n";
+assert_eq!("Hello\tworld\t\n", s.trim_start());
+

Directionality:

+ +
let s = "  English  ";
+assert!(Some('E') == s.trim_start().chars().next());
+
+let s = "  עברית  ";
+assert!(Some('ע') == s.trim_start().chars().next());
+
1.30.0 · Source

pub fn trim_end(&self) -> &str

Returns a string slice with trailing whitespace removed.

+

‘Whitespace’ is defined according to the terms of the Unicode Derived +Core Property White_Space, which includes newlines.

+
§Text directionality
+

A string is a sequence of bytes. end in this context means the last +position of that byte string; for a left-to-right language like English or +Russian, this will be right side, and for right-to-left languages like +Arabic or Hebrew, this will be the left side.

+
§Examples
+

Basic usage:

+ +
let s = "\n Hello\tworld\t\n";
+assert_eq!("\n Hello\tworld", s.trim_end());
+

Directionality:

+ +
let s = "  English  ";
+assert!(Some('h') == s.trim_end().chars().rev().next());
+
+let s = "  עברית  ";
+assert!(Some('ת') == s.trim_end().chars().rev().next());
+
1.0.0 · Source

pub fn trim_left(&self) -> &str

👎Deprecated since 1.33.0: superseded by trim_start

Returns a string slice with leading whitespace removed.

+

‘Whitespace’ is defined according to the terms of the Unicode Derived +Core Property White_Space.

+
§Text directionality
+

A string is a sequence of bytes. ‘Left’ in this context means the first +position of that byte string; for a language like Arabic or Hebrew +which are ‘right to left’ rather than ‘left to right’, this will be +the right side, not the left.

+
§Examples
+

Basic usage:

+ +
let s = " Hello\tworld\t";
+
+assert_eq!("Hello\tworld\t", s.trim_left());
+

Directionality:

+ +
let s = "  English";
+assert!(Some('E') == s.trim_left().chars().next());
+
+let s = "  עברית";
+assert!(Some('ע') == s.trim_left().chars().next());
+
1.0.0 · Source

pub fn trim_right(&self) -> &str

👎Deprecated since 1.33.0: superseded by trim_end

Returns a string slice with trailing whitespace removed.

+

‘Whitespace’ is defined according to the terms of the Unicode Derived +Core Property White_Space.

+
§Text directionality
+

A string is a sequence of bytes. ‘Right’ in this context means the last +position of that byte string; for a language like Arabic or Hebrew +which are ‘right to left’ rather than ‘left to right’, this will be +the left side, not the right.

+
§Examples
+

Basic usage:

+ +
let s = " Hello\tworld\t";
+
+assert_eq!(" Hello\tworld", s.trim_right());
+

Directionality:

+ +
let s = "English  ";
+assert!(Some('h') == s.trim_right().chars().rev().next());
+
+let s = "עברית  ";
+assert!(Some('ת') == s.trim_right().chars().rev().next());
+
1.0.0 · Source

pub fn trim_matches<P>(&self, pat: P) -> &str
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> DoubleEndedSearcher<'a>,

Returns a string slice with all prefixes and suffixes that match a +pattern repeatedly removed.

+

The pattern can be a char, a slice of chars, or a function +or closure that determines if a character matches.

+
§Examples
+

Simple patterns:

+ +
assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar");
+assert_eq!("123foo1bar123".trim_matches(char::is_numeric), "foo1bar");
+
+let x: &[_] = &['1', '2'];
+assert_eq!("12foo1bar12".trim_matches(x), "foo1bar");
+

A more complex pattern, using a closure:

+ +
assert_eq!("1foo1barXX".trim_matches(|c| c == '1' || c == 'X'), "foo1bar");
+
1.30.0 · Source

pub fn trim_start_matches<P>(&self, pat: P) -> &str
where + P: Pattern,

Returns a string slice with all prefixes that match a pattern +repeatedly removed.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Text directionality
+

A string is a sequence of bytes. start in this context means the first +position of that byte string; for a left-to-right language like English or +Russian, this will be left side, and for right-to-left languages like +Arabic or Hebrew, this will be the right side.

+
§Examples
+
assert_eq!("11foo1bar11".trim_start_matches('1'), "foo1bar11");
+assert_eq!("123foo1bar123".trim_start_matches(char::is_numeric), "foo1bar123");
+
+let x: &[_] = &['1', '2'];
+assert_eq!("12foo1bar12".trim_start_matches(x), "foo1bar12");
+
1.45.0 · Source

pub fn strip_prefix<P>(&self, prefix: P) -> Option<&str>
where + P: Pattern,

Returns a string slice with the prefix removed.

+

If the string starts with the pattern prefix, returns the substring after the prefix, +wrapped in Some. Unlike trim_start_matches, this method removes the prefix exactly once.

+

If the string does not start with prefix, returns None.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Examples
+
assert_eq!("foo:bar".strip_prefix("foo:"), Some("bar"));
+assert_eq!("foo:bar".strip_prefix("bar"), None);
+assert_eq!("foofoo".strip_prefix("foo"), Some("foo"));
+
1.45.0 · Source

pub fn strip_suffix<P>(&self, suffix: P) -> Option<&str>
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Returns a string slice with the suffix removed.

+

If the string ends with the pattern suffix, returns the substring before the suffix, +wrapped in Some. Unlike trim_end_matches, this method removes the suffix exactly once.

+

If the string does not end with suffix, returns None.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Examples
+
assert_eq!("bar:foo".strip_suffix(":foo"), Some("bar"));
+assert_eq!("bar:foo".strip_suffix("bar"), None);
+assert_eq!("foofoo".strip_suffix("foo"), Some("foo"));
+
Source

pub fn trim_prefix<P>(&self, prefix: P) -> &str
where + P: Pattern,

🔬This is a nightly-only experimental API. (trim_prefix_suffix)

Returns a string slice with the optional prefix removed.

+

If the string starts with the pattern prefix, returns the substring after the prefix. +Unlike strip_prefix, this method always returns &str for easy method chaining, +instead of returning Option<&str>.

+

If the string does not start with prefix, returns the original string unchanged.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Examples
+
#![feature(trim_prefix_suffix)]
+
+// Prefix present - removes it
+assert_eq!("foo:bar".trim_prefix("foo:"), "bar");
+assert_eq!("foofoo".trim_prefix("foo"), "foo");
+
+// Prefix absent - returns original string
+assert_eq!("foo:bar".trim_prefix("bar"), "foo:bar");
+
+// Method chaining example
+assert_eq!("<https://example.com/>".trim_prefix('<').trim_suffix('>'), "https://example.com/");
+
Source

pub fn trim_suffix<P>(&self, suffix: P) -> &str
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

🔬This is a nightly-only experimental API. (trim_prefix_suffix)

Returns a string slice with the optional suffix removed.

+

If the string ends with the pattern suffix, returns the substring before the suffix. +Unlike strip_suffix, this method always returns &str for easy method chaining, +instead of returning Option<&str>.

+

If the string does not end with suffix, returns the original string unchanged.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Examples
+
#![feature(trim_prefix_suffix)]
+
+// Suffix present - removes it
+assert_eq!("bar:foo".trim_suffix(":foo"), "bar");
+assert_eq!("foofoo".trim_suffix("foo"), "foo");
+
+// Suffix absent - returns original string
+assert_eq!("bar:foo".trim_suffix("bar"), "bar:foo");
+
+// Method chaining example
+assert_eq!("<https://example.com/>".trim_prefix('<').trim_suffix('>'), "https://example.com/");
+
1.30.0 · Source

pub fn trim_end_matches<P>(&self, pat: P) -> &str
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

Returns a string slice with all suffixes that match a pattern +repeatedly removed.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Text directionality
+

A string is a sequence of bytes. end in this context means the last +position of that byte string; for a left-to-right language like English or +Russian, this will be right side, and for right-to-left languages like +Arabic or Hebrew, this will be the left side.

+
§Examples
+

Simple patterns:

+ +
assert_eq!("11foo1bar11".trim_end_matches('1'), "11foo1bar");
+assert_eq!("123foo1bar123".trim_end_matches(char::is_numeric), "123foo1bar");
+
+let x: &[_] = &['1', '2'];
+assert_eq!("12foo1bar12".trim_end_matches(x), "12foo1bar");
+

A more complex pattern, using a closure:

+ +
assert_eq!("1fooX".trim_end_matches(|c| c == '1' || c == 'X'), "1foo");
+
1.0.0 · Source

pub fn trim_left_matches<P>(&self, pat: P) -> &str
where + P: Pattern,

👎Deprecated since 1.33.0: superseded by trim_start_matches

Returns a string slice with all prefixes that match a pattern +repeatedly removed.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Text directionality
+

A string is a sequence of bytes. ‘Left’ in this context means the first +position of that byte string; for a language like Arabic or Hebrew +which are ‘right to left’ rather than ‘left to right’, this will be +the right side, not the left.

+
§Examples
+
assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11");
+assert_eq!("123foo1bar123".trim_left_matches(char::is_numeric), "foo1bar123");
+
+let x: &[_] = &['1', '2'];
+assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12");
+
1.0.0 · Source

pub fn trim_right_matches<P>(&self, pat: P) -> &str
where + P: Pattern, + <P as Pattern>::Searcher<'a>: for<'a> ReverseSearcher<'a>,

👎Deprecated since 1.33.0: superseded by trim_end_matches

Returns a string slice with all suffixes that match a pattern +repeatedly removed.

+

The pattern can be a &str, char, a slice of chars, or a +function or closure that determines if a character matches.

+
§Text directionality
+

A string is a sequence of bytes. ‘Right’ in this context means the last +position of that byte string; for a language like Arabic or Hebrew +which are ‘right to left’ rather than ‘left to right’, this will be +the left side, not the right.

+
§Examples
+

Simple patterns:

+ +
assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar");
+assert_eq!("123foo1bar123".trim_right_matches(char::is_numeric), "123foo1bar");
+
+let x: &[_] = &['1', '2'];
+assert_eq!("12foo1bar12".trim_right_matches(x), "12foo1bar");
+

A more complex pattern, using a closure:

+ +
assert_eq!("1fooX".trim_right_matches(|c| c == '1' || c == 'X'), "1foo");
+
1.0.0 · Source

pub fn parse<F>(&self) -> Result<F, <F as FromStr>::Err>
where + F: FromStr,

Parses this string slice into another type.

+

Because parse is so general, it can cause problems with type +inference. As such, parse is one of the few times you’ll see +the syntax affectionately known as the ‘turbofish’: ::<>. This +helps the inference algorithm understand specifically which type +you’re trying to parse into.

+

parse can parse into any type that implements the FromStr trait.

+
§Errors
+

Will return Err if it’s not possible to parse this string slice into +the desired type.

+
§Examples
+

Basic usage:

+ +
let four: u32 = "4".parse().unwrap();
+
+assert_eq!(4, four);
+

Using the ‘turbofish’ instead of annotating four:

+ +
let four = "4".parse::<u32>();
+
+assert_eq!(Ok(4), four);
+

Failing to parse:

+ +
let nope = "j".parse::<u32>();
+
+assert!(nope.is_err());
+
1.23.0 · Source

pub fn is_ascii(&self) -> bool

Checks if all characters in this string are within the ASCII range.

+
§Examples
+
let ascii = "hello!\n";
+let non_ascii = "Grüße, Jürgen ❤";
+
+assert!(ascii.is_ascii());
+assert!(!non_ascii.is_ascii());
+
Source

pub fn as_ascii(&self) -> Option<&[AsciiChar]>

🔬This is a nightly-only experimental API. (ascii_char)

If this string slice is_ascii, returns it as a slice +of ASCII characters, otherwise returns None.

+
Source

pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar]

🔬This is a nightly-only experimental API. (ascii_char)

Converts this string slice into a slice of ASCII characters, +without checking whether they are valid.

+
§Safety
+

Every character in this string must be ASCII, or else this is UB.

+
1.23.0 · Source

pub fn eq_ignore_ascii_case(&self, other: &str) -> bool

Checks that two strings are an ASCII case-insensitive match.

+

Same as to_ascii_lowercase(a) == to_ascii_lowercase(b), +but without allocating and copying temporaries.

+
§Examples
+
assert!("Ferris".eq_ignore_ascii_case("FERRIS"));
+assert!("Ferrös".eq_ignore_ascii_case("FERRöS"));
+assert!(!"Ferrös".eq_ignore_ascii_case("FERRÖS"));
+
1.80.0 · Source

pub fn trim_ascii_start(&self) -> &str

Returns a string slice with leading ASCII whitespace removed.

+

‘Whitespace’ refers to the definition used by +u8::is_ascii_whitespace.

+
§Examples
+
assert_eq!(" \t \u{3000}hello world\n".trim_ascii_start(), "\u{3000}hello world\n");
+assert_eq!("  ".trim_ascii_start(), "");
+assert_eq!("".trim_ascii_start(), "");
+
1.80.0 · Source

pub fn trim_ascii_end(&self) -> &str

Returns a string slice with trailing ASCII whitespace removed.

+

‘Whitespace’ refers to the definition used by +u8::is_ascii_whitespace.

+
§Examples
+
assert_eq!("\r hello world\u{3000}\n ".trim_ascii_end(), "\r hello world\u{3000}");
+assert_eq!("  ".trim_ascii_end(), "");
+assert_eq!("".trim_ascii_end(), "");
+
1.80.0 · Source

pub fn trim_ascii(&self) -> &str

Returns a string slice with leading and trailing ASCII whitespace +removed.

+

‘Whitespace’ refers to the definition used by +u8::is_ascii_whitespace.

+
§Examples
+
assert_eq!("\r hello world\n ".trim_ascii(), "hello world");
+assert_eq!("  ".trim_ascii(), "");
+assert_eq!("".trim_ascii(), "");
+
1.34.0 · Source

pub fn escape_debug(&self) -> EscapeDebug<'_>

Returns an iterator that escapes each char in self with char::escape_debug.

+

Note: only extended grapheme codepoints that begin the string will be +escaped.

+
§Examples
+

As an iterator:

+ +
for c in "❤\n!".escape_debug() {
+    print!("{c}");
+}
+println!();
+

Using println! directly:

+ +
println!("{}", "❤\n!".escape_debug());
+

Both are equivalent to:

+ +
println!("❤\\n!");
+

Using to_string:

+ +
assert_eq!("❤\n!".escape_debug().to_string(), "❤\\n!");
+
1.34.0 · Source

pub fn escape_default(&self) -> EscapeDefault<'_>

Returns an iterator that escapes each char in self with char::escape_default.

+
§Examples
+

As an iterator:

+ +
for c in "❤\n!".escape_default() {
+    print!("{c}");
+}
+println!();
+

Using println! directly:

+ +
println!("{}", "❤\n!".escape_default());
+

Both are equivalent to:

+ +
println!("\\u{{2764}}\\n!");
+

Using to_string:

+ +
assert_eq!("❤\n!".escape_default().to_string(), "\\u{2764}\\n!");
+
1.34.0 · Source

pub fn escape_unicode(&self) -> EscapeUnicode<'_>

Returns an iterator that escapes each char in self with char::escape_unicode.

+
§Examples
+

As an iterator:

+ +
for c in "❤\n!".escape_unicode() {
+    print!("{c}");
+}
+println!();
+

Using println! directly:

+ +
println!("{}", "❤\n!".escape_unicode());
+

Both are equivalent to:

+ +
println!("\\u{{2764}}\\u{{a}}\\u{{21}}");
+

Using to_string:

+ +
assert_eq!("❤\n!".escape_unicode().to_string(), "\\u{2764}\\u{a}\\u{21}");
+
Source

pub fn substr_range(&self, substr: &str) -> Option<Range<usize>>

🔬This is a nightly-only experimental API. (substr_range)

Returns the range that a substring points to.

+

Returns None if substr does not point within self.

+

Unlike str::find, this does not search through the string. +Instead, it uses pointer arithmetic to find where in the string +substr is derived from.

+

This is useful for extending str::split and similar methods.

+

Note that this method may return false positives (typically either +Some(0..0) or Some(self.len()..self.len())) if substr is a +zero-length str that points at the beginning or end of another, +independent, str.

+
§Examples
+
#![feature(substr_range)]
+
+let data = "a, b, b, a";
+let mut iter = data.split(", ").map(|s| data.substr_range(s).unwrap());
+
+assert_eq!(iter.next(), Some(0..1));
+assert_eq!(iter.next(), Some(3..4));
+assert_eq!(iter.next(), Some(6..7));
+assert_eq!(iter.next(), Some(9..10));
+
Source

pub fn as_str(&self) -> &str

🔬This is a nightly-only experimental API. (str_as_str)

Returns the same string as a string slice &str.

+

This method is redundant when used directly on &str, but +it helps dereferencing other string-like types to string slices, +for example references to Box<str> or Arc<str>.

+
1.0.0 · Source

pub fn replace<P>(&self, from: P, to: &str) -> String
where + P: Pattern,

Replaces all matches of a pattern with another string.

+

replace creates a new String, and copies the data from this string slice into it. +While doing so, it attempts to find matches of a pattern. If it finds any, it +replaces them with the replacement string slice.

+
§Examples
+
let s = "this is old";
+
+assert_eq!("this is new", s.replace("old", "new"));
+assert_eq!("than an old", s.replace("is", "an"));
+

When the pattern doesn’t match, it returns this string slice as String:

+ +
let s = "this is old";
+assert_eq!(s, s.replace("cookie monster", "little lamb"));
+
1.16.0 · Source

pub fn replacen<P>(&self, pat: P, to: &str, count: usize) -> String
where + P: Pattern,

Replaces first N matches of a pattern with another string.

+

replacen creates a new String, and copies the data from this string slice into it. +While doing so, it attempts to find matches of a pattern. If it finds any, it +replaces them with the replacement string slice at most count times.

+
§Examples
+
let s = "foo foo 123 foo";
+assert_eq!("new new 123 foo", s.replacen("foo", "new", 2));
+assert_eq!("faa fao 123 foo", s.replacen('o', "a", 3));
+assert_eq!("foo foo new23 foo", s.replacen(char::is_numeric, "new", 1));
+

When the pattern doesn’t match, it returns this string slice as String:

+ +
let s = "this is old";
+assert_eq!(s, s.replacen("cookie monster", "little lamb", 10));
+
1.2.0 · Source

pub fn to_lowercase(&self) -> String

Returns the lowercase equivalent of this string slice, as a new String.

+

‘Lowercase’ is defined according to the terms of the Unicode Derived Core Property +Lowercase.

+

Since some characters can expand into multiple characters when changing +the case, this function returns a String instead of modifying the +parameter in-place.

+
§Examples
+

Basic usage:

+ +
let s = "HELLO";
+
+assert_eq!("hello", s.to_lowercase());
+

A tricky example, with sigma:

+ +
let sigma = "Σ";
+
+assert_eq!("σ", sigma.to_lowercase());
+
+// but at the end of a word, it's ς, not σ:
+let odysseus = "ὈΔΥΣΣΕΎΣ";
+
+assert_eq!("ὀδυσσεύς", odysseus.to_lowercase());
+

Languages without case are not changed:

+ +
let new_year = "农历新年";
+
+assert_eq!(new_year, new_year.to_lowercase());
+
1.2.0 · Source

pub fn to_uppercase(&self) -> String

Returns the uppercase equivalent of this string slice, as a new String.

+

‘Uppercase’ is defined according to the terms of the Unicode Derived Core Property +Uppercase.

+

Since some characters can expand into multiple characters when changing +the case, this function returns a String instead of modifying the +parameter in-place.

+
§Examples
+

Basic usage:

+ +
let s = "hello";
+
+assert_eq!("HELLO", s.to_uppercase());
+

Scripts without case are not changed:

+ +
let new_year = "农历新年";
+
+assert_eq!(new_year, new_year.to_uppercase());
+

One character can become multiple:

+ +
let s = "tschüß";
+
+assert_eq!("TSCHÜSS", s.to_uppercase());
+
1.16.0 · Source

pub fn repeat(&self, n: usize) -> String

Creates a new String by repeating a string n times.

+
§Panics
+

This function will panic if the capacity would overflow.

+
§Examples
+

Basic usage:

+ +
assert_eq!("abc".repeat(4), String::from("abcabcabcabc"));
+

A panic upon overflow:

+ +
// this will panic at runtime
+let huge = "0123456789abcdef".repeat(usize::MAX);
+
1.23.0 · Source

pub fn to_ascii_uppercase(&self) -> String

Returns a copy of this string where each character is mapped to its +ASCII upper case equivalent.

+

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, +but non-ASCII letters are unchanged.

+

To uppercase the value in-place, use make_ascii_uppercase.

+

To uppercase ASCII characters in addition to non-ASCII characters, use +to_uppercase.

+
§Examples
+
let s = "Grüße, Jürgen ❤";
+
+assert_eq!("GRüßE, JüRGEN ❤", s.to_ascii_uppercase());
+
1.23.0 · Source

pub fn to_ascii_lowercase(&self) -> String

Returns a copy of this string where each character is mapped to its +ASCII lower case equivalent.

+

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, +but non-ASCII letters are unchanged.

+

To lowercase the value in-place, use make_ascii_lowercase.

+

To lowercase ASCII characters in addition to non-ASCII characters, use +to_lowercase.

+
§Examples
+
let s = "Grüße, Jürgen ❤";
+
+assert_eq!("grüße, jürgen ❤", s.to_ascii_lowercase());
+

Trait Implementations§

§

impl Borrow<str> for SmolStr

§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
§

impl Clone for SmolStr

§

fn clone(&self) -> SmolStr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for SmolStr

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for SmolStr

§

fn default() -> SmolStr

Returns the “default value” for a type. Read more
§

impl Deref for SmolStr

§

type Target = str

The resulting type after dereferencing.
§

fn deref(&self) -> &str

Dereferences the value.
§

impl<'de> Deserialize<'de> for SmolStr

§

fn deserialize<D>( + deserializer: D, +) -> Result<SmolStr, <D as Deserializer<'de>>::Error>
where + D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for SmolStr

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> From<T> for SmolStr
where + T: AsRef<str>,

§

fn from(text: T) -> SmolStr

Converts to this type from the input type.
§

impl<'a> FromIterator<&'a String> for SmolStr

§

fn from_iter<I>(iter: I) -> SmolStr
where + I: IntoIterator<Item = &'a String>,

Creates a value from an iterator. Read more
§

impl<'a> FromIterator<&'a str> for SmolStr

§

fn from_iter<I>(iter: I) -> SmolStr
where + I: IntoIterator<Item = &'a str>,

Creates a value from an iterator. Read more
§

impl FromIterator<String> for SmolStr

§

fn from_iter<I>(iter: I) -> SmolStr
where + I: IntoIterator<Item = String>,

Creates a value from an iterator. Read more
§

impl FromIterator<char> for SmolStr

§

fn from_iter<I>(iter: I) -> SmolStr
where + I: IntoIterator<Item = char>,

Creates a value from an iterator. Read more
§

impl FromStr for SmolStr

§

type Err = Infallible

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<SmolStr, <SmolStr as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for SmolStr

§

fn hash<H>(&self, hasher: &mut H)
where + H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl Ord for SmolStr

§

fn cmp(&self, other: &SmolStr) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
§

impl<'a> PartialEq<&'a String> for SmolStr

§

fn eq(&self, other: &&'a String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a> PartialEq<&'a str> for SmolStr

§

fn eq(&self, other: &&'a str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl<'a> PartialEq<SmolStr> for &'a str

§

fn eq(&self, other: &SmolStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialEq<SmolStr> for str

§

fn eq(&self, other: &SmolStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialEq<String> for SmolStr

§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialEq<str> for SmolStr

§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialEq for SmolStr

§

fn eq(&self, other: &SmolStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
§

impl PartialOrd for SmolStr

§

fn partial_cmp(&self, other: &SmolStr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
§

impl Serialize for SmolStr

§

fn serialize<S>( + &self, + serializer: S, +) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where + S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Eq for SmolStr

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<P, T> Receiver for P
where + P: Deref<Target = T> + ?Sized, + T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Struct.html b/compiler-docs/fe_parser/ast/struct.Struct.html new file mode 100644 index 0000000000..c71404d4c4 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Struct.html @@ -0,0 +1,31 @@ +Struct in fe_parser::ast - Rust

Struct Struct

Source
pub struct Struct {
+    pub name: Node<SmolStr>,
+    pub fields: Vec<Node<Field>>,
+    pub functions: Vec<Node<Function>>,
+    pub pub_qual: Option<Span>,
+}

Fields§

§name: Node<SmolStr>§fields: Vec<Node<Field>>§functions: Vec<Node<Function>>§pub_qual: Option<Span>

Trait Implementations§

Source§

impl Clone for Struct

Source§

fn clone(&self) -> Struct

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Struct

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Struct

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Struct

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Struct

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Struct

Source§

fn eq(&self, other: &Struct) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Struct

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Struct

Source§

impl StructuralPartialEq for Struct

Auto Trait Implementations§

§

impl Freeze for Struct

§

impl RefUnwindSafe for Struct

§

impl Send for Struct

§

impl Sync for Struct

§

impl Unpin for Struct

§

impl UnwindSafe for Struct

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Trait.html b/compiler-docs/fe_parser/ast/struct.Trait.html new file mode 100644 index 0000000000..cc4946eb76 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Trait.html @@ -0,0 +1,30 @@ +Trait in fe_parser::ast - Rust

Struct Trait

Source
pub struct Trait {
+    pub name: Node<SmolStr>,
+    pub functions: Vec<Node<FunctionSignature>>,
+    pub pub_qual: Option<Span>,
+}

Fields§

§name: Node<SmolStr>§functions: Vec<Node<FunctionSignature>>§pub_qual: Option<Span>

Trait Implementations§

Source§

impl Clone for Trait

Source§

fn clone(&self) -> Trait

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Trait

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Trait

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Trait

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Trait

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Trait

Source§

fn eq(&self, other: &Trait) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Trait

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Trait

Source§

impl StructuralPartialEq for Trait

Auto Trait Implementations§

§

impl Freeze for Trait

§

impl RefUnwindSafe for Trait

§

impl Send for Trait

§

impl Sync for Trait

§

impl Unpin for Trait

§

impl UnwindSafe for Trait

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.TypeAlias.html b/compiler-docs/fe_parser/ast/struct.TypeAlias.html new file mode 100644 index 0000000000..2832c8ed44 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.TypeAlias.html @@ -0,0 +1,30 @@ +TypeAlias in fe_parser::ast - Rust

Struct TypeAlias

Source
pub struct TypeAlias {
+    pub name: Node<SmolStr>,
+    pub typ: Node<TypeDesc>,
+    pub pub_qual: Option<Span>,
+}

Fields§

§name: Node<SmolStr>§typ: Node<TypeDesc>§pub_qual: Option<Span>

Trait Implementations§

Source§

impl Clone for TypeAlias

Source§

fn clone(&self) -> TypeAlias

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeAlias

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TypeAlias

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TypeAlias

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for TypeAlias

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TypeAlias

Source§

fn eq(&self, other: &TypeAlias) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for TypeAlias

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for TypeAlias

Source§

impl StructuralPartialEq for TypeAlias

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Use.html b/compiler-docs/fe_parser/ast/struct.Use.html new file mode 100644 index 0000000000..9a6e4b1215 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Use.html @@ -0,0 +1,28 @@ +Use in fe_parser::ast - Rust

Struct Use

Source
pub struct Use {
+    pub tree: Node<UseTree>,
+}

Fields§

§tree: Node<UseTree>

Trait Implementations§

Source§

impl Clone for Use

Source§

fn clone(&self) -> Use

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Use

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Use

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Use

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Use

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Use

Source§

fn eq(&self, other: &Use) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Use

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Use

Source§

impl StructuralPartialEq for Use

Auto Trait Implementations§

§

impl Freeze for Use

§

impl RefUnwindSafe for Use

§

impl Send for Use

§

impl Sync for Use

§

impl Unpin for Use

§

impl UnwindSafe for Use

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/ast/struct.Variant.html b/compiler-docs/fe_parser/ast/struct.Variant.html new file mode 100644 index 0000000000..7c0009ea52 --- /dev/null +++ b/compiler-docs/fe_parser/ast/struct.Variant.html @@ -0,0 +1,30 @@ +Variant in fe_parser::ast - Rust

Struct Variant

Source
pub struct Variant {
+    pub name: Node<SmolStr>,
+    pub kind: VariantKind,
+}
Expand description

Enum variant definition.

+

Fields§

§name: Node<SmolStr>§kind: VariantKind

Trait Implementations§

Source§

impl Clone for Variant

Source§

fn clone(&self) -> Variant

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Variant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Variant

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Variant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Variant

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Variant

Source§

fn eq(&self, other: &Variant) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Variant

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Variant

Source§

impl StructuralPartialEq for Variant

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/fn.parse_file.html b/compiler-docs/fe_parser/fn.parse_file.html new file mode 100644 index 0000000000..41cdcfc84e --- /dev/null +++ b/compiler-docs/fe_parser/fn.parse_file.html @@ -0,0 +1,11 @@ +parse_file in fe_parser - Rust

Function parse_file

Source
pub fn parse_file(file_id: SourceFileId, src: &str) -> (Module, Vec<Diagnostic>)
Expand description

Parse a Module from the file content string.

+

Returns a Module (which may be incomplete), and a vec of Diagnostics +(which may be empty) to display to the user. If any of the returned +diagnostics are errors, the compilation of this file should ultimately fail.

+

If a fatal parse error occurred, the last element of the Module::body will +be a ModuleStmt::ParseError. The parser currently has very limited ability +to recover from syntax errors; this is just a first meager attempt at returning a +useful AST when there are syntax errors.

+

A SourceFileId is required to associate any diagnostics with the +underlying file.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/contracts/fn.parse_contract_def.html b/compiler-docs/fe_parser/grammar/contracts/fn.parse_contract_def.html new file mode 100644 index 0000000000..e9b4887003 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/contracts/fn.parse_contract_def.html @@ -0,0 +1,7 @@ +parse_contract_def in fe_parser::grammar::contracts - Rust

Function parse_contract_def

Source
pub fn parse_contract_def(
+    par: &mut Parser<'_>,
+    contract_pub_qual: Option<Span>,
+) -> ParseResult<Node<Contract>>
Expand description

Parse a contract definition.

+

§Panics

+

Panics if the next token isn’t contract.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/contracts/index.html b/compiler-docs/fe_parser/grammar/contracts/index.html new file mode 100644 index 0000000000..1747a2bad2 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/contracts/index.html @@ -0,0 +1 @@ +fe_parser::grammar::contracts - Rust

Module contracts

Source

Functions§

parse_contract_def
Parse a contract definition.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/contracts/sidebar-items.js b/compiler-docs/fe_parser/grammar/contracts/sidebar-items.js new file mode 100644 index 0000000000..6b31cd56ef --- /dev/null +++ b/compiler-docs/fe_parser/grammar/contracts/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["parse_contract_def"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/expressions/fn.parse_call_args.html b/compiler-docs/fe_parser/grammar/expressions/fn.parse_call_args.html new file mode 100644 index 0000000000..69f63cfb4e --- /dev/null +++ b/compiler-docs/fe_parser/grammar/expressions/fn.parse_call_args.html @@ -0,0 +1,4 @@ +parse_call_args in fe_parser::grammar::expressions - Rust

Function parse_call_args

Source
pub fn parse_call_args(
+    par: &mut Parser<'_>,
+) -> ParseResult<Node<Vec<Node<CallArg>>>>
Expand description

Parse call arguments

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/expressions/fn.parse_expr.html b/compiler-docs/fe_parser/grammar/expressions/fn.parse_expr.html new file mode 100644 index 0000000000..239052f9da --- /dev/null +++ b/compiler-docs/fe_parser/grammar/expressions/fn.parse_expr.html @@ -0,0 +1,2 @@ +parse_expr in fe_parser::grammar::expressions - Rust

Function parse_expr

Source
pub fn parse_expr(par: &mut Parser<'_>) -> ParseResult<Node<Expr>>
Expand description

Parse an expression, starting with the next token.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/expressions/fn.parse_expr_with_min_bp.html b/compiler-docs/fe_parser/grammar/expressions/fn.parse_expr_with_min_bp.html new file mode 100644 index 0000000000..a80859bfaf --- /dev/null +++ b/compiler-docs/fe_parser/grammar/expressions/fn.parse_expr_with_min_bp.html @@ -0,0 +1,6 @@ +parse_expr_with_min_bp in fe_parser::grammar::expressions - Rust

Function parse_expr_with_min_bp

Source
pub fn parse_expr_with_min_bp(
+    par: &mut Parser<'_>,
+    min_bp: u8,
+) -> ParseResult<Node<Expr>>
Expand description

Parse an expression, stopping if/when we reach an operator that binds less +tightly than given binding power.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/expressions/index.html b/compiler-docs/fe_parser/grammar/expressions/index.html new file mode 100644 index 0000000000..357fb65efe --- /dev/null +++ b/compiler-docs/fe_parser/grammar/expressions/index.html @@ -0,0 +1,2 @@ +fe_parser::grammar::expressions - Rust

Module expressions

Source

Functions§

parse_call_args
Parse call arguments
parse_expr
Parse an expression, starting with the next token.
parse_expr_with_min_bp
Parse an expression, stopping if/when we reach an operator that binds less +tightly than given binding power.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/expressions/sidebar-items.js b/compiler-docs/fe_parser/grammar/expressions/sidebar-items.js new file mode 100644 index 0000000000..5a45a79b97 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/expressions/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["parse_call_args","parse_expr","parse_expr_with_min_bp"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_assert_stmt.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_assert_stmt.html new file mode 100644 index 0000000000..ffb86ef0f8 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_assert_stmt.html @@ -0,0 +1,4 @@ +parse_assert_stmt in fe_parser::grammar::functions - Rust

Function parse_assert_stmt

Source
pub fn parse_assert_stmt(par: &mut Parser<'_>) -> ParseResult<Node<FuncStmt>>
Expand description

Parse an assert statement.

+

§Panics

+

Panics if the next token isn’t assert.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_fn_def.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_fn_def.html new file mode 100644 index 0000000000..e6d2387e62 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_fn_def.html @@ -0,0 +1,6 @@ +parse_fn_def in fe_parser::grammar::functions - Rust

Function parse_fn_def

Source
pub fn parse_fn_def(
+    par: &mut Parser<'_>,
+    pub_qual: Option<Span>,
+) -> ParseResult<Node<Function>>
Expand description

Parse a function definition. The optional pub qualifier must be parsed by +the caller, and passed in. Next token must be unsafe or fn.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_fn_sig.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_fn_sig.html new file mode 100644 index 0000000000..ba0fb8e989 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_fn_sig.html @@ -0,0 +1,7 @@ +parse_fn_sig in fe_parser::grammar::functions - Rust

Function parse_fn_sig

Source
pub fn parse_fn_sig(
+    par: &mut Parser<'_>,
+    pub_qual: Option<Span>,
+) -> ParseResult<Node<FunctionSignature>>
Expand description

Parse a function definition without a body. The optional pub qualifier +must be parsed by the caller, and passed in. Next token must be unsafe or +fn.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_for_stmt.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_for_stmt.html new file mode 100644 index 0000000000..975e5cf1d1 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_for_stmt.html @@ -0,0 +1,4 @@ +parse_for_stmt in fe_parser::grammar::functions - Rust

Function parse_for_stmt

Source
pub fn parse_for_stmt(par: &mut Parser<'_>) -> ParseResult<Node<FuncStmt>>
Expand description

Parse a for statement.

+

§Panics

+

Panics if the next token isn’t for.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_generic_param.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_generic_param.html new file mode 100644 index 0000000000..985f4276d3 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_generic_param.html @@ -0,0 +1,5 @@ +parse_generic_param in fe_parser::grammar::functions - Rust

Function parse_generic_param

Source
pub fn parse_generic_param(
+    par: &mut Parser<'_>,
+) -> ParseResult<GenericParameter>
Expand description

Parse a single generic function parameter (eg. T:SomeTrait in fn foo<T: SomeTrait>(some_arg: u256) -> bool). # Panics +Panics if the first token isn’t Name.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_generic_params.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_generic_params.html new file mode 100644 index 0000000000..cfb2bad1f9 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_generic_params.html @@ -0,0 +1,5 @@ +parse_generic_params in fe_parser::grammar::functions - Rust

Function parse_generic_params

Source
pub fn parse_generic_params(
+    par: &mut Parser<'_>,
+) -> ParseResult<Node<Vec<GenericParameter>>>
Expand description

Parse an angle-bracket-wrapped list of generic arguments (eg. <T, R: SomeTrait> in fn foo<T, R: SomeTrait>(some_arg: u256) -> bool). # Panics +Panics if the first token isn’t <.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_if_stmt.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_if_stmt.html new file mode 100644 index 0000000000..c42825e2d2 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_if_stmt.html @@ -0,0 +1,4 @@ +parse_if_stmt in fe_parser::grammar::functions - Rust

Function parse_if_stmt

Source
pub fn parse_if_stmt(par: &mut Parser<'_>) -> ParseResult<Node<FuncStmt>>
Expand description

Parse an if statement.

+

§Panics

+

Panics if the next token isn’t if.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_match_arms.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_match_arms.html new file mode 100644 index 0000000000..5fad691d22 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_match_arms.html @@ -0,0 +1,3 @@ +parse_match_arms in fe_parser::grammar::functions - Rust

Function parse_match_arms

Source
pub fn parse_match_arms(
+    par: &mut Parser<'_>,
+) -> ParseResult<Vec<Node<MatchArm>>>
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_match_stmt.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_match_stmt.html new file mode 100644 index 0000000000..52a0c41d7d --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_match_stmt.html @@ -0,0 +1,4 @@ +parse_match_stmt in fe_parser::grammar::functions - Rust

Function parse_match_stmt

Source
pub fn parse_match_stmt(par: &mut Parser<'_>) -> ParseResult<Node<FuncStmt>>
Expand description

Parse a match statement.

+

§Panics

+

Panics if the next token isn’t match.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_pattern.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_pattern.html new file mode 100644 index 0000000000..919c0052f9 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_pattern.html @@ -0,0 +1 @@ +parse_pattern in fe_parser::grammar::functions - Rust

Function parse_pattern

Source
pub fn parse_pattern(par: &mut Parser<'_>) -> ParseResult<Node<Pattern>>
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_return_stmt.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_return_stmt.html new file mode 100644 index 0000000000..8e21ca248c --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_return_stmt.html @@ -0,0 +1,4 @@ +parse_return_stmt in fe_parser::grammar::functions - Rust

Function parse_return_stmt

Source
pub fn parse_return_stmt(par: &mut Parser<'_>) -> ParseResult<Node<FuncStmt>>
Expand description

Parse a return statement.

+

§Panics

+

Panics if the next token isn’t return.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_revert_stmt.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_revert_stmt.html new file mode 100644 index 0000000000..064fe2f629 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_revert_stmt.html @@ -0,0 +1,4 @@ +parse_revert_stmt in fe_parser::grammar::functions - Rust

Function parse_revert_stmt

Source
pub fn parse_revert_stmt(par: &mut Parser<'_>) -> ParseResult<Node<FuncStmt>>
Expand description

Parse a revert statement.

+

§Panics

+

Panics if the next token isn’t revert.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_single_word_stmt.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_single_word_stmt.html new file mode 100644 index 0000000000..815b1163bc --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_single_word_stmt.html @@ -0,0 +1,6 @@ +parse_single_word_stmt in fe_parser::grammar::functions - Rust

Function parse_single_word_stmt

Source
pub fn parse_single_word_stmt(
+    par: &mut Parser<'_>,
+) -> ParseResult<Node<FuncStmt>>
Expand description

Parse a continue, break, pass, or revert statement.

+

§Panics

+

Panics if the next token isn’t one of the above.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_stmt.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_stmt.html new file mode 100644 index 0000000000..46a60f0993 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_stmt.html @@ -0,0 +1,2 @@ +parse_stmt in fe_parser::grammar::functions - Rust

Function parse_stmt

Source
pub fn parse_stmt(par: &mut Parser<'_>) -> ParseResult<Node<FuncStmt>>
Expand description

Parse a function-level statement.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_unsafe_block.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_unsafe_block.html new file mode 100644 index 0000000000..2705d05ffc --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_unsafe_block.html @@ -0,0 +1,4 @@ +parse_unsafe_block in fe_parser::grammar::functions - Rust

Function parse_unsafe_block

Source
pub fn parse_unsafe_block(par: &mut Parser<'_>) -> ParseResult<Node<FuncStmt>>
Expand description

Parse an unsafe block.

+

§Panics

+

Panics if the next token isn’t unsafe.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/fn.parse_while_stmt.html b/compiler-docs/fe_parser/grammar/functions/fn.parse_while_stmt.html new file mode 100644 index 0000000000..8c9c6e3049 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/fn.parse_while_stmt.html @@ -0,0 +1,4 @@ +parse_while_stmt in fe_parser::grammar::functions - Rust

Function parse_while_stmt

Source
pub fn parse_while_stmt(par: &mut Parser<'_>) -> ParseResult<Node<FuncStmt>>
Expand description

Parse a while statement.

+

§Panics

+

Panics if the next token isn’t while.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/index.html b/compiler-docs/fe_parser/grammar/functions/index.html new file mode 100644 index 0000000000..eb10b054e6 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/index.html @@ -0,0 +1,6 @@ +fe_parser::grammar::functions - Rust

Module functions

Source

Functions§

parse_assert_stmt
Parse an assert statement.
parse_fn_def
Parse a function definition. The optional pub qualifier must be parsed by +the caller, and passed in. Next token must be unsafe or fn.
parse_fn_sig
Parse a function definition without a body. The optional pub qualifier +must be parsed by the caller, and passed in. Next token must be unsafe or +fn.
parse_for_stmt
Parse a for statement.
parse_generic_param
Parse a single generic function parameter (eg. T:SomeTrait in fn foo<T: SomeTrait>(some_arg: u256) -> bool). # Panics +Panics if the first token isn’t Name.
parse_generic_params
Parse an angle-bracket-wrapped list of generic arguments (eg. <T, R: SomeTrait> in fn foo<T, R: SomeTrait>(some_arg: u256) -> bool). # Panics +Panics if the first token isn’t <.
parse_if_stmt
Parse an if statement.
parse_match_arms
parse_match_stmt
Parse a match statement.
parse_pattern
parse_return_stmt
Parse a return statement.
parse_revert_stmt
Parse a revert statement.
parse_single_word_stmt
Parse a continue, break, pass, or revert statement.
parse_stmt
Parse a function-level statement.
parse_unsafe_block
Parse an unsafe block.
parse_while_stmt
Parse a while statement.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/functions/sidebar-items.js b/compiler-docs/fe_parser/grammar/functions/sidebar-items.js new file mode 100644 index 0000000000..088b1ad187 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/functions/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["parse_assert_stmt","parse_fn_def","parse_fn_sig","parse_for_stmt","parse_generic_param","parse_generic_params","parse_if_stmt","parse_match_arms","parse_match_stmt","parse_pattern","parse_return_stmt","parse_revert_stmt","parse_single_word_stmt","parse_stmt","parse_unsafe_block","parse_while_stmt"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/index.html b/compiler-docs/fe_parser/grammar/index.html new file mode 100644 index 0000000000..5f8f310dff --- /dev/null +++ b/compiler-docs/fe_parser/grammar/index.html @@ -0,0 +1 @@ +fe_parser::grammar - Rust
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/module/fn.parse_constant.html b/compiler-docs/fe_parser/grammar/module/fn.parse_constant.html new file mode 100644 index 0000000000..ff9a6c1c3c --- /dev/null +++ b/compiler-docs/fe_parser/grammar/module/fn.parse_constant.html @@ -0,0 +1,7 @@ +parse_constant in fe_parser::grammar::module - Rust

Function parse_constant

Source
pub fn parse_constant(
+    par: &mut Parser<'_>,
+    pub_qual: Option<Span>,
+) -> ParseResult<Node<ConstantDecl>>
Expand description

Parse a constant, e.g. const MAGIC_NUMBER: u256 = 4711.

+

§Panics

+

Panics if the next token isn’t const.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/module/fn.parse_module.html b/compiler-docs/fe_parser/grammar/module/fn.parse_module.html new file mode 100644 index 0000000000..3f23e3cf52 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/module/fn.parse_module.html @@ -0,0 +1,2 @@ +parse_module in fe_parser::grammar::module - Rust

Function parse_module

Source
pub fn parse_module(par: &mut Parser<'_>) -> Node<Module>
Expand description

Parse a Module.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/module/fn.parse_module_stmt.html b/compiler-docs/fe_parser/grammar/module/fn.parse_module_stmt.html new file mode 100644 index 0000000000..7f748b962d --- /dev/null +++ b/compiler-docs/fe_parser/grammar/module/fn.parse_module_stmt.html @@ -0,0 +1,2 @@ +parse_module_stmt in fe_parser::grammar::module - Rust

Function parse_module_stmt

Source
pub fn parse_module_stmt(par: &mut Parser<'_>) -> ParseResult<ModuleStmt>
Expand description

Parse a ModuleStmt.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/module/fn.parse_pragma.html b/compiler-docs/fe_parser/grammar/module/fn.parse_pragma.html new file mode 100644 index 0000000000..07f362a8ef --- /dev/null +++ b/compiler-docs/fe_parser/grammar/module/fn.parse_pragma.html @@ -0,0 +1,2 @@ +parse_pragma in fe_parser::grammar::module - Rust

Function parse_pragma

Source
pub fn parse_pragma(par: &mut Parser<'_>) -> ParseResult<Node<Pragma>>
Expand description

Parse a pragma <version-requirement> statement.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/module/fn.parse_use.html b/compiler-docs/fe_parser/grammar/module/fn.parse_use.html new file mode 100644 index 0000000000..c7f1569a2f --- /dev/null +++ b/compiler-docs/fe_parser/grammar/module/fn.parse_use.html @@ -0,0 +1,4 @@ +parse_use in fe_parser::grammar::module - Rust

Function parse_use

Source
pub fn parse_use(par: &mut Parser<'_>) -> ParseResult<Node<Use>>
Expand description

Parse a use statement.

+

§Panics

+

Panics if the next token isn’t use.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/module/fn.parse_use_tree.html b/compiler-docs/fe_parser/grammar/module/fn.parse_use_tree.html new file mode 100644 index 0000000000..cd318e786c --- /dev/null +++ b/compiler-docs/fe_parser/grammar/module/fn.parse_use_tree.html @@ -0,0 +1,2 @@ +parse_use_tree in fe_parser::grammar::module - Rust

Function parse_use_tree

Source
pub fn parse_use_tree(par: &mut Parser<'_>) -> ParseResult<Node<UseTree>>
Expand description

Parse a use tree.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/module/index.html b/compiler-docs/fe_parser/grammar/module/index.html new file mode 100644 index 0000000000..c48e8c7156 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/module/index.html @@ -0,0 +1 @@ +fe_parser::grammar::module - Rust

Module module

Source

Functions§

parse_constant
Parse a constant, e.g. const MAGIC_NUMBER: u256 = 4711.
parse_module
Parse a Module.
parse_module_stmt
Parse a ModuleStmt.
parse_pragma
Parse a pragma <version-requirement> statement.
parse_use
Parse a use statement.
parse_use_tree
Parse a use tree.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/module/sidebar-items.js b/compiler-docs/fe_parser/grammar/module/sidebar-items.js new file mode 100644 index 0000000000..027949ed32 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/module/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["parse_constant","parse_module","parse_module_stmt","parse_pragma","parse_use","parse_use_tree"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/sidebar-items.js b/compiler-docs/fe_parser/grammar/sidebar-items.js new file mode 100644 index 0000000000..8551943604 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["contracts","expressions","functions","module","types"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_enum_def.html b/compiler-docs/fe_parser/grammar/types/fn.parse_enum_def.html new file mode 100644 index 0000000000..f38bc56c27 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_enum_def.html @@ -0,0 +1,7 @@ +parse_enum_def in fe_parser::grammar::types - Rust

Function parse_enum_def

Source
pub fn parse_enum_def(
+    par: &mut Parser<'_>,
+    pub_qual: Option<Span>,
+) -> ParseResult<Node<Enum>>
Expand description

Parse a [ModuleStmt::Enum].

+

§Panics

+

Panics if the next token isn’t TokenKind::Enum.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_field.html b/compiler-docs/fe_parser/grammar/types/fn.parse_field.html new file mode 100644 index 0000000000..11974decf3 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_field.html @@ -0,0 +1,8 @@ +parse_field in fe_parser::grammar::types - Rust

Function parse_field

Source
pub fn parse_field(
+    par: &mut Parser<'_>,
+    attributes: Vec<Node<SmolStr>>,
+    pub_qual: Option<Span>,
+    const_qual: Option<Span>,
+) -> ParseResult<Node<Field>>
Expand description

Parse a field for a struct or contract. The leading optional pub and +const qualifiers must be parsed by the caller, and passed in.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_generic_args.html b/compiler-docs/fe_parser/grammar/types/fn.parse_generic_args.html new file mode 100644 index 0000000000..ebcb693bc6 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_generic_args.html @@ -0,0 +1,7 @@ +parse_generic_args in fe_parser::grammar::types - Rust

Function parse_generic_args

Source
pub fn parse_generic_args(
+    par: &mut Parser<'_>,
+) -> ParseResult<Node<Vec<GenericArg>>>
Expand description

Parse an angle-bracket-wrapped list of generic arguments (eg. the tail end +of Map<address, u256>).

+

§Panics

+

Panics if the first token isn’t <.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_impl_def.html b/compiler-docs/fe_parser/grammar/types/fn.parse_impl_def.html new file mode 100644 index 0000000000..7edb05ad9e --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_impl_def.html @@ -0,0 +1,4 @@ +parse_impl_def in fe_parser::grammar::types - Rust

Function parse_impl_def

Source
pub fn parse_impl_def(par: &mut Parser<'_>) -> ParseResult<Node<Impl>>
Expand description

Parse an impl block.

+

§Panics

+

Panics if the next token isn’t impl.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_opt_qualifier.html b/compiler-docs/fe_parser/grammar/types/fn.parse_opt_qualifier.html new file mode 100644 index 0000000000..c27ee7a06c --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_opt_qualifier.html @@ -0,0 +1,2 @@ +parse_opt_qualifier in fe_parser::grammar::types - Rust

Function parse_opt_qualifier

Source
pub fn parse_opt_qualifier(par: &mut Parser<'_>, tk: TokenKind) -> Option<Span>
Expand description

Parse an optional qualifier (pub, const, or idx).

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_path_tail.html b/compiler-docs/fe_parser/grammar/types/fn.parse_path_tail.html new file mode 100644 index 0000000000..73ece4ea08 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_path_tail.html @@ -0,0 +1,5 @@ +parse_path_tail in fe_parser::grammar::types - Rust

Function parse_path_tail

Source
pub fn parse_path_tail<'a>(
+    par: &mut Parser<'a>,
+    head: Node<SmolStr>,
+) -> (Path, Span, Option<Token<'a>>)
Expand description

Returns path and trailing :: token, if present.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_struct_def.html b/compiler-docs/fe_parser/grammar/types/fn.parse_struct_def.html new file mode 100644 index 0000000000..ba2fc4749c --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_struct_def.html @@ -0,0 +1,7 @@ +parse_struct_def in fe_parser::grammar::types - Rust

Function parse_struct_def

Source
pub fn parse_struct_def(
+    par: &mut Parser<'_>,
+    pub_qual: Option<Span>,
+) -> ParseResult<Node<Struct>>
Expand description

Parse a [ModuleStmt::Struct].

+

§Panics

+

Panics if the next token isn’t struct.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_trait_def.html b/compiler-docs/fe_parser/grammar/types/fn.parse_trait_def.html new file mode 100644 index 0000000000..8302e353e0 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_trait_def.html @@ -0,0 +1,7 @@ +parse_trait_def in fe_parser::grammar::types - Rust

Function parse_trait_def

Source
pub fn parse_trait_def(
+    par: &mut Parser<'_>,
+    pub_qual: Option<Span>,
+) -> ParseResult<Node<Trait>>
Expand description

Parse a trait definition.

+

§Panics

+

Panics if the next token isn’t trait.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_type_alias.html b/compiler-docs/fe_parser/grammar/types/fn.parse_type_alias.html new file mode 100644 index 0000000000..057fad02c1 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_type_alias.html @@ -0,0 +1,7 @@ +parse_type_alias in fe_parser::grammar::types - Rust

Function parse_type_alias

Source
pub fn parse_type_alias(
+    par: &mut Parser<'_>,
+    pub_qual: Option<Span>,
+) -> ParseResult<Node<TypeAlias>>
Expand description

Parse a type alias definition, e.g. type MyMap = Map<u8, address>.

+

§Panics

+

Panics if the next token isn’t type.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_type_desc.html b/compiler-docs/fe_parser/grammar/types/fn.parse_type_desc.html new file mode 100644 index 0000000000..e2fd066e79 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_type_desc.html @@ -0,0 +1,2 @@ +parse_type_desc in fe_parser::grammar::types - Rust

Function parse_type_desc

Source
pub fn parse_type_desc(par: &mut Parser<'_>) -> ParseResult<Node<TypeDesc>>
Expand description

Parse a type description, e.g. u8 or Map<address, u256>.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/fn.parse_variant.html b/compiler-docs/fe_parser/grammar/types/fn.parse_variant.html new file mode 100644 index 0000000000..6caf1e5772 --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/fn.parse_variant.html @@ -0,0 +1,4 @@ +parse_variant in fe_parser::grammar::types - Rust

Function parse_variant

Source
pub fn parse_variant(par: &mut Parser<'_>) -> ParseResult<Node<Variant>>
Expand description

Parse a variant for a enum definition.

+

§Panics

+

Panics if the next token isn’t TokenKind::Name.

+
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/index.html b/compiler-docs/fe_parser/grammar/types/index.html new file mode 100644 index 0000000000..9adca7f0cf --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/index.html @@ -0,0 +1,3 @@ +fe_parser::grammar::types - Rust

Module types

Source

Functions§

parse_enum_def
Parse a [ModuleStmt::Enum].
parse_field
Parse a field for a struct or contract. The leading optional pub and +const qualifiers must be parsed by the caller, and passed in.
parse_generic_args
Parse an angle-bracket-wrapped list of generic arguments (eg. the tail end +of Map<address, u256>).
parse_impl_def
Parse an impl block.
parse_opt_qualifier
Parse an optional qualifier (pub, const, or idx).
parse_path_tail
Returns path and trailing :: token, if present.
parse_struct_def
Parse a [ModuleStmt::Struct].
parse_trait_def
Parse a trait definition.
parse_type_alias
Parse a type alias definition, e.g. type MyMap = Map<u8, address>.
parse_type_desc
Parse a type description, e.g. u8 or Map<address, u256>.
parse_variant
Parse a variant for a enum definition.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/grammar/types/sidebar-items.js b/compiler-docs/fe_parser/grammar/types/sidebar-items.js new file mode 100644 index 0000000000..f17d380f7e --- /dev/null +++ b/compiler-docs/fe_parser/grammar/types/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["parse_enum_def","parse_field","parse_generic_args","parse_impl_def","parse_opt_qualifier","parse_path_tail","parse_struct_def","parse_trait_def","parse_type_alias","parse_type_desc","parse_variant"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/index.html b/compiler-docs/fe_parser/index.html new file mode 100644 index 0000000000..04370b85e7 --- /dev/null +++ b/compiler-docs/fe_parser/index.html @@ -0,0 +1,3 @@ +fe_parser - Rust

Crate fe_parser

Source

Re-exports§

pub use lexer::Token;
pub use lexer::TokenKind;

Modules§

ast
grammar
lexer
node

Structs§

Label
ParseFailed
Parser
Parser maintains the parsing state, such as the token stream, +“enclosure” (paren, brace, ..) stack, diagnostics, etc. +Syntax parsing logic is in the crate::grammar module.

Functions§

parse_file
Parse a Module from the file content string.

Type Aliases§

ParseResult
\ No newline at end of file diff --git a/compiler-docs/fe_parser/lexer/enum.TokenKind.html b/compiler-docs/fe_parser/lexer/enum.TokenKind.html new file mode 100644 index 0000000000..3240045eaa --- /dev/null +++ b/compiler-docs/fe_parser/lexer/enum.TokenKind.html @@ -0,0 +1,121 @@ +TokenKind in fe_parser::lexer - Rust

Enum TokenKind

Source
pub enum TokenKind {
+
Show 87 variants Error, + Newline, + Name, + Int, + Hex, + Octal, + Binary, + Text, + True, + False, + Assert, + Break, + Continue, + Contract, + Fn, + Const, + Else, + Idx, + If, + Match, + Impl, + Pragma, + For, + Pub, + Return, + Revert, + SelfType, + SelfValue, + Struct, + Enum, + Trait, + Type, + Unsafe, + While, + And, + As, + In, + Not, + Or, + Let, + Mut, + Use, + ParenOpen, + ParenClose, + BracketOpen, + BracketClose, + BraceOpen, + BraceClose, + Colon, + ColonColon, + Comma, + Hash, + Semi, + Plus, + Minus, + Star, + Slash, + Pipe, + Amper, + Lt, + LtLt, + Gt, + GtGt, + Eq, + Dot, + DotDot, + Percent, + EqEq, + NotEq, + LtEq, + GtEq, + Tilde, + Hat, + StarStar, + StarStarEq, + PlusEq, + MinusEq, + StarEq, + SlashEq, + PercentEq, + AmperEq, + PipeEq, + HatEq, + LtLtEq, + GtGtEq, + Arrow, + FatArrow, +
}

Variants§

§

Error

§

Newline

§

Name

§

Int

§

Hex

§

Octal

§

Binary

§

Text

§

True

§

False

§

Assert

§

Break

§

Continue

§

Contract

§

Fn

§

Const

§

Else

§

Idx

§

If

§

Match

§

Impl

§

Pragma

§

For

§

Pub

§

Return

§

Revert

§

SelfType

§

SelfValue

§

Struct

§

Enum

§

Trait

§

Type

§

Unsafe

§

While

§

And

§

As

§

In

§

Not

§

Or

§

Let

§

Mut

§

Use

§

ParenOpen

§

ParenClose

§

BracketOpen

§

BracketClose

§

BraceOpen

§

BraceClose

§

Colon

§

ColonColon

§

Comma

§

Hash

§

Semi

§

Plus

§

Minus

§

Star

§

Slash

§

Pipe

§

Amper

§

Lt

§

LtLt

§

Gt

§

GtGt

§

Eq

§

Dot

§

DotDot

§

Percent

§

EqEq

§

NotEq

§

LtEq

§

GtEq

§

Tilde

§

Hat

§

StarStar

§

StarStarEq

§

PlusEq

§

MinusEq

§

StarEq

§

SlashEq

§

PercentEq

§

AmperEq

§

PipeEq

§

HatEq

§

LtLtEq

§

GtGtEq

§

Arrow

§

FatArrow

Implementations§

Source§

impl TokenKind

Source

pub fn describe(&self) -> &str

Return a user-friendly description of the token kind. E.g. +TokenKind::Newline => “a newline” +TokenKind::Colon => “:

+

Trait Implementations§

Source§

impl Clone for TokenKind

Source§

fn clone(&self) -> TokenKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TokenKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'s> Logos<'s> for TokenKind

Source§

const ERROR: Self = TokenKind::Error

Helper const of the variant marked as #[error].
Source§

type Extras = ()

Associated type Extras for the particular lexer. This can be set using +#[logos(extras = MyExtras)] and accessed inside callbacks.
Source§

type Source = str

Source type this token can be lexed from. This will default to str, +unless one of the defined patterns explicitly uses non-unicode byte values +or byte slices, in which case that implementation will use [u8].
Source§

fn lex(lex: &mut Lexer<'s, Self>)

The heart of Logos. Called by the Lexer. The implementation for this function +is generated by the logos-derive crate.
§

fn lexer(source: &'source Self::Source) -> Lexer<'source, Self>
where + Self::Extras: Default,

Create a new instance of a Lexer that will produce tokens implementing +this Logos.
§

fn lexer_with_extras( + source: &'source Self::Source, + extras: Self::Extras, +) -> Lexer<'source, Self>

Create a new instance of a Lexer with the provided Extras that will +produce tokens implementing this Logos.
Source§

impl PartialEq for TokenKind

Source§

fn eq(&self, other: &TokenKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for TokenKind

Source§

impl Eq for TokenKind

Source§

impl StructuralPartialEq for TokenKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/lexer/index.html b/compiler-docs/fe_parser/lexer/index.html new file mode 100644 index 0000000000..f72e245e43 --- /dev/null +++ b/compiler-docs/fe_parser/lexer/index.html @@ -0,0 +1 @@ +fe_parser::lexer - Rust

Module lexer

Source

Structs§

Lexer
Token

Enums§

TokenKind
\ No newline at end of file diff --git a/compiler-docs/fe_parser/lexer/sidebar-items.js b/compiler-docs/fe_parser/lexer/sidebar-items.js new file mode 100644 index 0000000000..bbe99d1cc8 --- /dev/null +++ b/compiler-docs/fe_parser/lexer/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["TokenKind"],"struct":["Lexer","Token"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/lexer/struct.Lexer.html b/compiler-docs/fe_parser/lexer/struct.Lexer.html new file mode 100644 index 0000000000..0c0b1d9018 --- /dev/null +++ b/compiler-docs/fe_parser/lexer/struct.Lexer.html @@ -0,0 +1,195 @@ +Lexer in fe_parser::lexer - Rust

Struct Lexer

Source
pub struct Lexer<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Lexer<'a>

Source

pub fn new(file_id: SourceFileId, src: &'a str) -> Lexer<'_>

Create a new lexer with the given source code string.

+
Source

pub fn source(&self) -> &'a str

Return the full source code string that’s being tokenized.

+

Trait Implementations§

Source§

impl<'a> Clone for Lexer<'a>

Source§

fn clone(&self) -> Lexer<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Iterator for Lexer<'a>

Source§

type Item = Token<'a>

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
Source§

fn next_chunk<const N: usize>( + &mut self, +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · Source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · Source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
Source§

fn try_reduce<R>( + &mut self, + f: impl FnMut(Self::Item, Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
Source§

fn try_find<R>( + &mut self, + f: impl FnMut(&Self::Item) -> R, +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: Copy + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: Clone + 'a, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · Source§

fn cycle(self) -> Cycle<Self>
where + Self: Sized + Clone,

Repeats an iterator endlessly. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Lexer<'a>

§

impl<'a> RefUnwindSafe for Lexer<'a>

§

impl<'a> Send for Lexer<'a>

§

impl<'a> Sync for Lexer<'a>

§

impl<'a> Unpin for Lexer<'a>

§

impl<'a> UnwindSafe for Lexer<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<I> IntoIterator for I
where + I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/lexer/struct.Token.html b/compiler-docs/fe_parser/lexer/struct.Token.html new file mode 100644 index 0000000000..db039e33de --- /dev/null +++ b/compiler-docs/fe_parser/lexer/struct.Token.html @@ -0,0 +1,24 @@ +Token in fe_parser::lexer - Rust

Struct Token

Source
pub struct Token<'a> {
+    pub kind: TokenKind,
+    pub text: &'a str,
+    pub span: Span,
+}

Fields§

§kind: TokenKind§text: &'a str§span: Span

Trait Implementations§

Source§

impl<'a> Add<&Token<'a>> for Span

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: &Token<'a>) -> Self

Performs the + operation. Read more
Source§

impl<'a> Clone for Token<'a>

Source§

fn clone(&self) -> Token<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Token<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<Token<'a>> for Node<SmolStr>

Source§

fn from(tok: Token<'a>) -> Node<SmolStr>

Converts to this type from the input type.
Source§

impl<'a> PartialEq for Token<'a>

Source§

fn eq(&self, other: &Token<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl<'a> Eq for Token<'a>

Source§

impl<'a> StructuralPartialEq for Token<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Token<'a>

§

impl<'a> RefUnwindSafe for Token<'a>

§

impl<'a> Send for Token<'a>

§

impl<'a> Sync for Token<'a>

§

impl<'a> Unpin for Token<'a>

§

impl<'a> UnwindSafe for Token<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/lexer/token/enum.TokenKind.html b/compiler-docs/fe_parser/lexer/token/enum.TokenKind.html new file mode 100644 index 0000000000..24f9bbe054 --- /dev/null +++ b/compiler-docs/fe_parser/lexer/token/enum.TokenKind.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_parser/lexer/enum.TokenKind.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_parser/lexer/token/struct.Token.html b/compiler-docs/fe_parser/lexer/token/struct.Token.html new file mode 100644 index 0000000000..dd6eee4eb3 --- /dev/null +++ b/compiler-docs/fe_parser/lexer/token/struct.Token.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../fe_parser/lexer/struct.Token.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_parser/node/index.html b/compiler-docs/fe_parser/node/index.html new file mode 100644 index 0000000000..cd97d50516 --- /dev/null +++ b/compiler-docs/fe_parser/node/index.html @@ -0,0 +1 @@ +fe_parser::node - Rust

Module node

Source

Structs§

Node
NodeId
Span
An exclusive span of byte offsets in a source file.

Traits§

Spanned
\ No newline at end of file diff --git a/compiler-docs/fe_parser/node/sidebar-items.js b/compiler-docs/fe_parser/node/sidebar-items.js new file mode 100644 index 0000000000..3078e3d906 --- /dev/null +++ b/compiler-docs/fe_parser/node/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Node","NodeId","Span"],"trait":["Spanned"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/node/struct.Node.html b/compiler-docs/fe_parser/node/struct.Node.html new file mode 100644 index 0000000000..c7fc1140d0 --- /dev/null +++ b/compiler-docs/fe_parser/node/struct.Node.html @@ -0,0 +1,38 @@ +Node in fe_parser::node - Rust

Struct Node

Source
pub struct Node<T> {
+    pub kind: T,
+    pub id: NodeId,
+    pub span: Span,
+}

Fields§

§kind: T§id: NodeId§span: Span

Implementations§

Source§

impl Node<Contract>

Source

pub fn name(&self) -> &str

Source§

impl Node<Struct>

Source

pub fn name(&self) -> &str

Source§

impl Node<Enum>

Source

pub fn name(&self) -> &str

Source§

impl Node<Variant>

Source

pub fn name(&self) -> &str

Source§

impl Node<Trait>

Source

pub fn name(&self) -> &str

Source§

impl Node<Field>

Source

pub fn name(&self) -> &str

Source§

impl Node<Function>

Source

pub fn name(&self) -> &str

Source§

impl Node<FunctionArg>

Source

pub fn name(&self) -> &str

Source

pub fn name_span(&self) -> Span

Source§

impl Node<TypeAlias>

Source

pub fn name(&self) -> &str

Source§

impl<T> Node<T>

Source

pub fn new(kind: T, span: Span) -> Self

Trait Implementations§

Source§

impl<T: Clone> Clone for Node<T>

Source§

fn clone(&self) -> Node<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Node<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, T> Deserialize<'de> for Node<T>
where + T: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Node<Function>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> From<&Node<T>> for NodeId

Source§

fn from(node: &Node<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&Node<T>> for Span

Source§

fn from(node: &Node<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Token<'a>> for Node<SmolStr>

Source§

fn from(tok: Token<'a>) -> Node<SmolStr>

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for Node<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PartialEq> PartialEq for Node<T>

Source§

fn eq(&self, other: &Node<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl<T> Serialize for Node<T>
where + T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T> Spanned for Node<T>

Source§

fn span(&self) -> Span

Source§

impl<T: Eq> Eq for Node<T>

Source§

impl<T> StructuralPartialEq for Node<T>

Auto Trait Implementations§

§

impl<T> Freeze for Node<T>
where + T: Freeze,

§

impl<T> RefUnwindSafe for Node<T>
where + T: RefUnwindSafe,

§

impl<T> Send for Node<T>
where + T: Send,

§

impl<T> Sync for Node<T>
where + T: Sync,

§

impl<T> Unpin for Node<T>
where + T: Unpin,

§

impl<T> UnwindSafe for Node<T>
where + T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/node/struct.NodeId.html b/compiler-docs/fe_parser/node/struct.NodeId.html new file mode 100644 index 0000000000..f127b8d450 --- /dev/null +++ b/compiler-docs/fe_parser/node/struct.NodeId.html @@ -0,0 +1,30 @@ +NodeId in fe_parser::node - Rust

Struct NodeId

Source
pub struct NodeId(/* private fields */);

Implementations§

Source§

impl NodeId

Source

pub fn create() -> Self

Source

pub fn dummy() -> Self

Source

pub fn is_dummy(self) -> bool

Trait Implementations§

Source§

impl Clone for NodeId

Source§

fn clone(&self) -> NodeId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NodeId

Source§

fn default() -> NodeId

Returns the “default value” for a type. Read more
Source§

impl<T> From<&Box<Node<T>>> for NodeId

Source§

fn from(node: &Box<Node<T>>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&Node<T>> for NodeId

Source§

fn from(node: &Node<T>) -> Self

Converts to this type from the input type.
Source§

impl Hash for NodeId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for NodeId

Source§

fn cmp(&self, other: &NodeId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for NodeId

Source§

fn eq(&self, other: &NodeId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl PartialOrd for NodeId

Source§

fn partial_cmp(&self, other: &NodeId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the +<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > +operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by +the >= operator. Read more
Source§

impl Copy for NodeId

Source§

impl Eq for NodeId

Source§

impl StructuralPartialEq for NodeId

Auto Trait Implementations§

§

impl Freeze for NodeId

§

impl RefUnwindSafe for NodeId

§

impl Send for NodeId

§

impl Sync for NodeId

§

impl Unpin for NodeId

§

impl UnwindSafe for NodeId

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/node/struct.Span.html b/compiler-docs/fe_parser/node/struct.Span.html new file mode 100644 index 0000000000..49ad91c22a --- /dev/null +++ b/compiler-docs/fe_parser/node/struct.Span.html @@ -0,0 +1,43 @@ +Span in fe_parser::node - Rust

Struct Span

Source
pub struct Span {
+    pub file_id: SourceFileId,
+    pub start: usize,
+    pub end: usize,
+}
Expand description

An exclusive span of byte offsets in a source file.

+

Fields§

§file_id: SourceFileId§start: usize

A byte offset specifying the inclusive start of a span.

+
§end: usize

A byte offset specifying the exclusive end of a span.

+

Implementations§

Source§

impl Span

Source

pub fn new(file_id: SourceFileId, start: usize, end: usize) -> Span

Source

pub fn zero(file_id: SourceFileId) -> Span

Source

pub fn dummy() -> Span

Source

pub fn is_dummy(&self) -> bool

Source

pub fn from_pair<S, E>(start_elem: S, end_elem: E) -> Span
where + S: Into<Span>, + E: Into<Span>,

Trait Implementations§

Source§

impl<'a, T> Add<&'a T> for Span
where + T: Spanned,

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a T) -> Span

Performs the + operation. Read more
Source§

impl<'a> Add<&Token<'a>> for Span

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: &Token<'a>) -> Self

Performs the + operation. Read more
Source§

impl<'a, T> Add<Option<&'a T>> for Span
where + Span: Add<&'a T, Output = Span>,

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: Option<&'a T>) -> Span

Performs the + operation. Read more
Source§

impl Add<Option<Span>> for Span

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: Option<Span>) -> Span

Performs the + operation. Read more
Source§

impl Add for Span

Source§

type Output = Span

The resulting type after applying the + operator.
Source§

fn add(self, other: Span) -> Span

Performs the + operation. Read more
Source§

impl<T> AddAssign<T> for Span
where + Span: Add<T, Output = Span>,

Source§

fn add_assign(&mut self, other: T)

Performs the += operation. Read more
Source§

impl Clone for Span

Source§

fn clone(&self) -> Span

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Span

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Span

Source§

fn deserialize<__D>( + __deserializer: __D, +) -> Result<Span, <__D as Deserializer<'de>>::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> From<&Box<Node<T>>> for Span

Source§

fn from(node: &Box<Node<T>>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<&Node<T>> for Span

Source§

fn from(node: &Node<T>) -> Self

Converts to this type from the input type.
Source§

impl Hash for Span

Source§

fn hash<__H>(&self, state: &mut __H)
where + __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Span

Source§

fn eq(&self, other: &Span) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for Span

Source§

fn serialize<__S>( + &self, + __serializer: __S, +) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Span

Source§

impl Eq for Span

Source§

impl StructuralPartialEq for Span

Auto Trait Implementations§

§

impl Freeze for Span

§

impl RefUnwindSafe for Span

§

impl Send for Span

§

impl Sync for Span

§

impl Unpin for Span

§

impl UnwindSafe for Span

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/compiler-docs/fe_parser/node/trait.Spanned.html b/compiler-docs/fe_parser/node/trait.Spanned.html new file mode 100644 index 0000000000..c3140f9734 --- /dev/null +++ b/compiler-docs/fe_parser/node/trait.Spanned.html @@ -0,0 +1,4 @@ +Spanned in fe_parser::node - Rust

Trait Spanned

Source
pub trait Spanned {
+    // Required method
+    fn span(&self) -> Span;
+}

Required Methods§

Source

fn span(&self) -> Span

Implementors§

\ No newline at end of file diff --git a/compiler-docs/fe_parser/parser/struct.Label.html b/compiler-docs/fe_parser/parser/struct.Label.html new file mode 100644 index 0000000000..87ea1515b1 --- /dev/null +++ b/compiler-docs/fe_parser/parser/struct.Label.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../fe_parser/struct.Label.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_parser/parser/struct.ParseFailed.html b/compiler-docs/fe_parser/parser/struct.ParseFailed.html new file mode 100644 index 0000000000..b1843d8358 --- /dev/null +++ b/compiler-docs/fe_parser/parser/struct.ParseFailed.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../fe_parser/struct.ParseFailed.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_parser/parser/struct.Parser.html b/compiler-docs/fe_parser/parser/struct.Parser.html new file mode 100644 index 0000000000..6f325de554 --- /dev/null +++ b/compiler-docs/fe_parser/parser/struct.Parser.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../fe_parser/struct.Parser.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_parser/parser/type.ParseResult.html b/compiler-docs/fe_parser/parser/type.ParseResult.html new file mode 100644 index 0000000000..366f14864a --- /dev/null +++ b/compiler-docs/fe_parser/parser/type.ParseResult.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../fe_parser/type.ParseResult.html...

+ + + \ No newline at end of file diff --git a/compiler-docs/fe_parser/sidebar-items.js b/compiler-docs/fe_parser/sidebar-items.js new file mode 100644 index 0000000000..245b322b5e --- /dev/null +++ b/compiler-docs/fe_parser/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["parse_file"],"mod":["ast","grammar","lexer","node"],"struct":["Label","ParseFailed","Parser"],"type":["ParseResult"]}; \ No newline at end of file diff --git a/compiler-docs/fe_parser/struct.Label.html b/compiler-docs/fe_parser/struct.Label.html new file mode 100644 index 0000000000..36a29f7e99 --- /dev/null +++ b/compiler-docs/fe_parser/struct.Label.html @@ -0,0 +1,34 @@ +Label in fe_parser - Rust

Struct Label

Source
pub struct Label {
+    pub style: LabelStyle,
+    pub span: Span,
+    pub message: String,
+}

Fields§

§style: LabelStyle§span: Span§message: String

Implementations§

Source§

impl Label

Source

pub fn primary<S>(span: Span, message: S) -> Label
where + S: Into<String>,

Create a primary label with the given message. This will underline the +given span with carets (^^^^).

+
Source

pub fn secondary<S>(span: Span, message: S) -> Label
where + S: Into<String>,

Create a secondary label with the given message. This will underline the +given span with hyphens (----).

+
Source

pub fn into_cs_label(self) -> Label<SourceFileId>

Convert into a [codespan_reporting::Diagnostic::Label]

+

Trait Implementations§

Source§

impl Clone for Label

Source§

fn clone(&self) -> Label

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Label

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Hash for Label

Source§

fn hash<__H>(&self, state: &mut __H)
where + __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Label

Source§

fn eq(&self, other: &Label) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Eq for Label

Source§

impl StructuralPartialEq for Label

Auto Trait Implementations§

§

impl Freeze for Label

§

impl RefUnwindSafe for Label

§

impl Send for Label

§

impl Sync for Label

§

impl Unpin for Label

§

impl UnwindSafe for Label

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/struct.ParseFailed.html b/compiler-docs/fe_parser/struct.ParseFailed.html new file mode 100644 index 0000000000..d33e9f02db --- /dev/null +++ b/compiler-docs/fe_parser/struct.ParseFailed.html @@ -0,0 +1,23 @@ +ParseFailed in fe_parser - Rust

Struct ParseFailed

Source
pub struct ParseFailed;

Trait Implementations§

Source§

impl Clone for ParseFailed

Source§

fn clone(&self) -> ParseFailed

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParseFailed

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ParseFailed

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Error for ParseFailed

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Hash for ParseFailed

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ParseFailed

Source§

fn eq(&self, other: &ParseFailed) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Copy for ParseFailed

Source§

impl Eq for ParseFailed

Source§

impl StructuralPartialEq for ParseFailed

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where + T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T> ToOwned for T
where + T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/struct.Parser.html b/compiler-docs/fe_parser/struct.Parser.html new file mode 100644 index 0000000000..780e587fa9 --- /dev/null +++ b/compiler-docs/fe_parser/struct.Parser.html @@ -0,0 +1,81 @@ +Parser in fe_parser - Rust

Struct Parser

Source
pub struct Parser<'a> {
+    pub file_id: SourceFileId,
+    pub diagnostics: Vec<Diagnostic>,
+    /* private fields */
+}
Expand description

Parser maintains the parsing state, such as the token stream, +“enclosure” (paren, brace, ..) stack, diagnostics, etc. +Syntax parsing logic is in the crate::grammar module.

+

See [BTParser] if you need backtrackable parser.

+

Fields§

§file_id: SourceFileId§diagnostics: Vec<Diagnostic>

The diagnostics (errors and warnings) emitted during parsing.

+

Implementations§

Source§

impl<'a> Parser<'a>

Source

pub fn new(file_id: SourceFileId, content: &'a str) -> Self

Create a new parser for a source code string and associated file id.

+
Source

pub fn as_bt_parser<'b>(&'b mut self) -> BTParser<'a, 'b>

Returns back tracking parser.

+
Source

pub fn next(&mut self) -> ParseResult<Token<'a>>

Return the next token, or an error if we’ve reached the end of the file.

+
Source

pub fn peek_or_err(&mut self) -> ParseResult<TokenKind>

Take a peek at the next token kind without consuming it, or return an +error if we’ve reached the end of the file.

+
Source

pub fn peek(&mut self) -> Option<TokenKind>

Take a peek at the next token kind. Returns None if we’ve reached the +end of the file.

+
Source

pub fn split_next(&mut self) -> ParseResult<Token<'a>>

Split the next token into two tokens, returning the first. Only supports +splitting the >> token into two > tokens, specifically for +parsing the closing angle bracket of a generic type argument list +(Map<x, Map<y, z>>).

+
§Panics
+

Panics if the next token isn’t >>

+
Source

pub fn done(&mut self) -> bool

Returns true if the parser has reached the end of the file.

+
Source

pub fn eat_newlines(&mut self)

Source

pub fn assert(&mut self, tk: TokenKind) -> Token<'a>

Assert that the next token kind it matches the expected token +kind, and return it. This should be used in cases where the next token +kind is expected to have been checked already.

+
§Panics
+

Panics if the next token kind isn’t tk.

+
Source

pub fn expect<S: Into<String>>( + &mut self, + expected: TokenKind, + message: S, +) -> ParseResult<Token<'a>>

If the next token matches the expected kind, return it. Otherwise emit +an error diagnostic with the given message and return an error.

+
Source

pub fn expect_with_notes<Str, NotesFn>( + &mut self, + expected: TokenKind, + message: Str, + notes_fn: NotesFn, +) -> ParseResult<Token<'a>>
where + Str: Into<String>, + NotesFn: FnOnce(&Token<'_>) -> Vec<String>,

Like Parser::expect, but with additional notes to be appended to the +bottom of the diagnostic message. The notes are provided by a +function that returns a Vec<String>, to avoid allocations in the +case where the token is as expected.

+
Source

pub fn optional(&mut self, kind: TokenKind) -> Option<Token<'a>>

If the next token matches the expected kind, return it. Otherwise return +None.

+
Source

pub fn unexpected_token_error<S: Into<String>>( + &mut self, + tok: &Token<'_>, + message: S, + notes: Vec<String>, +)

Emit an “unexpected token” error diagnostic with the given message.

+
Source

pub fn enter_block( + &mut self, + context_span: Span, + context_name: &str, +) -> ParseResult<()>

Enter a “block”, which is a brace-enclosed list of statements, +separated by newlines and/or semicolons. +This checks for and consumes the { that precedes the block.

+
Source

pub fn expect_stmt_end(&mut self, context_name: &str) -> ParseResult<()>

Consumes newlines and semicolons. Returns Ok if one or more newlines or +semicolons are consumed, or if the next token is a }.

+
Source

pub fn error<S: Into<String>>(&mut self, span: Span, message: S)

Emit an error diagnostic, but don’t stop parsing

+
Source

pub fn fancy_error<S: Into<String>>( + &mut self, + message: S, + labels: Vec<Label>, + notes: Vec<String>, +)

Emit a “fancy” error diagnostic with any number of labels and notes, +but don’t stop parsing.

+

Auto Trait Implementations§

§

impl<'a> Freeze for Parser<'a>

§

impl<'a> RefUnwindSafe for Parser<'a>

§

impl<'a> Send for Parser<'a>

§

impl<'a> Sync for Parser<'a>

§

impl<'a> Unpin for Parser<'a>

§

impl<'a> UnwindSafe for Parser<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_parser/type.ParseResult.html b/compiler-docs/fe_parser/type.ParseResult.html new file mode 100644 index 0000000000..4d44941c3e --- /dev/null +++ b/compiler-docs/fe_parser/type.ParseResult.html @@ -0,0 +1,6 @@ +ParseResult in fe_parser - Rust

Type Alias ParseResult

Source
pub type ParseResult<T> = Result<T, ParseFailed>;

Aliased Type§

pub enum ParseResult<T> {
+    Ok(T),
+    Err(ParseFailed),
+}

Variants§

§1.0.0

Ok(T)

Contains the success value

+
§1.0.0

Err(ParseFailed)

Contains the error value

+
\ No newline at end of file diff --git a/compiler-docs/fe_test_files/all.html b/compiler-docs/fe_test_files/all.html new file mode 100644 index 0000000000..ab4c55477e --- /dev/null +++ b/compiler-docs/fe_test_files/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/compiler-docs/fe_test_files/fn.fixture.html b/compiler-docs/fe_test_files/fn.fixture.html new file mode 100644 index 0000000000..a5e3b82a09 --- /dev/null +++ b/compiler-docs/fe_test_files/fn.fixture.html @@ -0,0 +1 @@ +fixture in fe_test_files - Rust

Function fixture

Source
pub fn fixture(path: &str) -> &'static str
\ No newline at end of file diff --git a/compiler-docs/fe_test_files/fn.fixture_bytes.html b/compiler-docs/fe_test_files/fn.fixture_bytes.html new file mode 100644 index 0000000000..a11bf3e988 --- /dev/null +++ b/compiler-docs/fe_test_files/fn.fixture_bytes.html @@ -0,0 +1 @@ +fixture_bytes in fe_test_files - Rust

Function fixture_bytes

Source
pub fn fixture_bytes(path: &str) -> &'static [u8] 
\ No newline at end of file diff --git a/compiler-docs/fe_test_files/fn.fixture_dir.html b/compiler-docs/fe_test_files/fn.fixture_dir.html new file mode 100644 index 0000000000..4bf2f0cb39 --- /dev/null +++ b/compiler-docs/fe_test_files/fn.fixture_dir.html @@ -0,0 +1 @@ +fixture_dir in fe_test_files - Rust

Function fixture_dir

Source
pub fn fixture_dir(path: &str) -> &Dir<'static>
\ No newline at end of file diff --git a/compiler-docs/fe_test_files/fn.fixture_dir_files.html b/compiler-docs/fe_test_files/fn.fixture_dir_files.html new file mode 100644 index 0000000000..4bfa1d1e3c --- /dev/null +++ b/compiler-docs/fe_test_files/fn.fixture_dir_files.html @@ -0,0 +1,2 @@ +fixture_dir_files in fe_test_files - Rust

Function fixture_dir_files

Source
pub fn fixture_dir_files(path: &str) -> Vec<(&'static str, &'static str)>
Expand description

Returns (file_path, file_content)

+
\ No newline at end of file diff --git a/compiler-docs/fe_test_files/fn.new_fixture_dir_files.html b/compiler-docs/fe_test_files/fn.new_fixture_dir_files.html new file mode 100644 index 0000000000..b5a3f88938 --- /dev/null +++ b/compiler-docs/fe_test_files/fn.new_fixture_dir_files.html @@ -0,0 +1,2 @@ +new_fixture_dir_files in fe_test_files - Rust

Function new_fixture_dir_files

Source
pub fn new_fixture_dir_files(path: &str) -> Vec<(&'static str, &'static str)>
Expand description

Returns (file_path, file_content)

+
\ No newline at end of file diff --git a/compiler-docs/fe_test_files/index.html b/compiler-docs/fe_test_files/index.html new file mode 100644 index 0000000000..bd34c8f7f6 --- /dev/null +++ b/compiler-docs/fe_test_files/index.html @@ -0,0 +1 @@ +fe_test_files - Rust

Crate fe_test_files

Source

Functions§

fixture
fixture_bytes
fixture_dir
fixture_dir_files
Returns (file_path, file_content)
new_fixture_dir_files
Returns (file_path, file_content)
\ No newline at end of file diff --git a/compiler-docs/fe_test_files/sidebar-items.js b/compiler-docs/fe_test_files/sidebar-items.js new file mode 100644 index 0000000000..58ff4389ca --- /dev/null +++ b/compiler-docs/fe_test_files/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["fixture","fixture_bytes","fixture_dir","fixture_dir_files","new_fixture_dir_files"]}; \ No newline at end of file diff --git a/compiler-docs/fe_test_runner/all.html b/compiler-docs/fe_test_runner/all.html new file mode 100644 index 0000000000..67f9159183 --- /dev/null +++ b/compiler-docs/fe_test_runner/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Structs

Functions

\ No newline at end of file diff --git a/compiler-docs/fe_test_runner/fn.execute.html b/compiler-docs/fe_test_runner/fn.execute.html new file mode 100644 index 0000000000..6251eec0a1 --- /dev/null +++ b/compiler-docs/fe_test_runner/fn.execute.html @@ -0,0 +1,6 @@ +execute in fe_test_runner - Rust

Function execute

Source
pub fn execute(
+    name: &str,
+    events: &[Event],
+    bytecode: &str,
+    sink: &mut TestSink,
+) -> bool
\ No newline at end of file diff --git a/compiler-docs/fe_test_runner/index.html b/compiler-docs/fe_test_runner/index.html new file mode 100644 index 0000000000..a219e3d028 --- /dev/null +++ b/compiler-docs/fe_test_runner/index.html @@ -0,0 +1 @@ +fe_test_runner - Rust

Crate fe_test_runner

Source

Re-exports§

pub use ethabi;

Structs§

TestSink

Functions§

execute
\ No newline at end of file diff --git a/compiler-docs/fe_test_runner/sidebar-items.js b/compiler-docs/fe_test_runner/sidebar-items.js new file mode 100644 index 0000000000..78183fd290 --- /dev/null +++ b/compiler-docs/fe_test_runner/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["execute"],"struct":["TestSink"]}; \ No newline at end of file diff --git a/compiler-docs/fe_test_runner/struct.TestSink.html b/compiler-docs/fe_test_runner/struct.TestSink.html new file mode 100644 index 0000000000..80f7f749e6 --- /dev/null +++ b/compiler-docs/fe_test_runner/struct.TestSink.html @@ -0,0 +1,92 @@ +TestSink in fe_test_runner - Rust

Struct TestSink

Source
pub struct TestSink { /* private fields */ }

Implementations§

Source§

impl TestSink

Source

pub fn new(collect_logs: bool) -> Self

Source

pub fn test_count(&self) -> usize

Source

pub fn failure_count(&self) -> usize

Source

pub fn logs_count(&self) -> usize

Source

pub fn success_count(&self) -> usize

Source

pub fn insert_failure(&mut self, name: &str, reason: &str)

Source

pub fn insert_logs(&mut self, name: &str, logs: &str)

Source

pub fn inc_success_count(&mut self)

Source

pub fn failure_details(&self) -> String

Source

pub fn logs_details(&self) -> String

Trait Implementations§

Source§

impl Debug for TestSink

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TestSink

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where + Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where + Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where + Self: Display,

Causes self to use its Display implementation when +Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where + Self: LowerExp,

Causes self to use its LowerExp implementation when +Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where + Self: LowerHex,

Causes self to use its LowerHex implementation when +Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where + Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where + Self: Pointer,

Causes self to use its Pointer implementation when +Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where + Self: UpperExp,

Causes self to use its UpperExp implementation when +Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where + Self: UpperHex,

Causes self to use its UpperHex implementation when +Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where + &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
§

impl<T> Pipe for T
where + T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where + Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where + R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where + R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where + Self: Borrow<B>, + B: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( + &'a mut self, + func: impl FnOnce(&'a mut B) -> R, +) -> R
where + Self: BorrowMut<B>, + B: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe +function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where + Self: AsRef<U>, + U: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where + Self: AsMut<U>, + U: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe +function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where + Self: Deref<Target = T>, + T: 'a + ?Sized, + R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( + &'a mut self, + func: impl FnOnce(&'a mut T) -> R, +) -> R
where + Self: DerefMut<Target = T> + Deref, + T: 'a + ?Sized, + R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe +function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where + Self: Borrow<B>, + B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release +builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where + Self: BorrowMut<B>, + B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release +builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where + Self: AsRef<R>, + R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release +builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where + Self: AsMut<R>, + R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release +builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where + Self: Deref<Target = T>, + T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release +builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where + Self: DerefMut<Target = T> + Deref, + T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release +builds.
Source§

impl<T> ToString for T
where + T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where + Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/compiler-docs/fe_yulc/all.html b/compiler-docs/fe_yulc/all.html new file mode 100644 index 0000000000..39c19d2d37 --- /dev/null +++ b/compiler-docs/fe_yulc/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/compiler-docs/fe_yulc/fn.compile.html b/compiler-docs/fe_yulc/fn.compile.html new file mode 100644 index 0000000000..a0acbefdf7 --- /dev/null +++ b/compiler-docs/fe_yulc/fn.compile.html @@ -0,0 +1,6 @@ +compile in fe_yulc - Rust

Function compile

Source
pub fn compile(
+    contracts: impl Iterator<Item = (impl AsRef<str>, impl AsRef<str>)>,
+    optimize: bool,
+) -> Result<IndexMap<String, ContractBytecode>, YulcError>
Expand description

Compile a map of Yul contracts to a map of bytecode contracts.

+

Returns a contract_name -> hex_encoded_bytecode map.

+
\ No newline at end of file diff --git a/compiler-docs/fe_yulc/fn.compile_single_contract.html b/compiler-docs/fe_yulc/fn.compile_single_contract.html new file mode 100644 index 0000000000..3b855074f0 --- /dev/null +++ b/compiler-docs/fe_yulc/fn.compile_single_contract.html @@ -0,0 +1,7 @@ +compile_single_contract in fe_yulc - Rust

Function compile_single_contract

Source
pub fn compile_single_contract(
+    _name: &str,
+    _yul_src: &str,
+    _optimize: bool,
+    _verify_runtime_bytecode: bool,
+) -> Result<ContractBytecode, YulcError>
Expand description

Compiles a single Yul contract to bytecode.

+
\ No newline at end of file diff --git a/compiler-docs/fe_yulc/index.html b/compiler-docs/fe_yulc/index.html new file mode 100644 index 0000000000..81b11dde23 --- /dev/null +++ b/compiler-docs/fe_yulc/index.html @@ -0,0 +1 @@ +fe_yulc - Rust

Crate fe_yulc

Source

Structs§

ContractBytecode
YulcError

Functions§

compile
Compile a map of Yul contracts to a map of bytecode contracts.
compile_single_contract
Compiles a single Yul contract to bytecode.
\ No newline at end of file diff --git a/compiler-docs/fe_yulc/sidebar-items.js b/compiler-docs/fe_yulc/sidebar-items.js new file mode 100644 index 0000000000..b446eb2011 --- /dev/null +++ b/compiler-docs/fe_yulc/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["compile","compile_single_contract"],"struct":["ContractBytecode","YulcError"]}; \ No newline at end of file diff --git a/compiler-docs/fe_yulc/struct.ContractBytecode.html b/compiler-docs/fe_yulc/struct.ContractBytecode.html new file mode 100644 index 0000000000..ffaa2fe95f --- /dev/null +++ b/compiler-docs/fe_yulc/struct.ContractBytecode.html @@ -0,0 +1,14 @@ +ContractBytecode in fe_yulc - Rust

Struct ContractBytecode

Source
pub struct ContractBytecode {
+    pub bytecode: String,
+    pub runtime_bytecode: String,
+}

Fields§

§bytecode: String§runtime_bytecode: String

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/fe_yulc/struct.YulcError.html b/compiler-docs/fe_yulc/struct.YulcError.html new file mode 100644 index 0000000000..48ea5f23a1 --- /dev/null +++ b/compiler-docs/fe_yulc/struct.YulcError.html @@ -0,0 +1,11 @@ +YulcError in fe_yulc - Rust

Struct YulcError

Source
pub struct YulcError(pub String);

Tuple Fields§

§0: String

Trait Implementations§

Source§

impl Debug for YulcError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where + T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where + T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

+
Source§

impl<T, U> Into<U> for T
where + U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
Source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/compiler-docs/help.html b/compiler-docs/help.html new file mode 100644 index 0000000000..e7c66c6d58 --- /dev/null +++ b/compiler-docs/help.html @@ -0,0 +1 @@ +Help

Rustdoc help

Back
\ No newline at end of file diff --git a/compiler-docs/search-index.js b/compiler-docs/search-index.js new file mode 100644 index 0000000000..4a2859d5e7 --- /dev/null +++ b/compiler-docs/search-index.js @@ -0,0 +1,4 @@ +var searchIndex = new Map(JSON.parse('[["fe",{"t":"FNNNNONNNNNNHCNNNNNNPEPEGPENNNNCECEENNNNNCNNNNNNPPFPSGPPPPNNNNNNNHHHNNNNNONNNNNNNNNNONNHOHOOONNNNNNNNNNNNHNNHHFNNNNHHHNNNONNNNNNNFSNNNNHHNNNNONNNNNN","n":["FelangCli","augment_args","augment_args_for_update","borrow","borrow_mut","command","from","from_arg_matches","from_arg_matches_mut","into","into_app","into_app_for_update","main","task","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","Build","BuildArgs","Check","CheckArgs","Commands","New","NewProjectArgs","augment_subcommands","augment_subcommands_for_update","borrow","borrow_mut","build","","check","","create_new_project","from","from_arg_matches","from_arg_matches_mut","has_subcommand","into","new","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","Abi","Ast","BuildArgs","Bytecode","DEFAULT_OUTPUT_DIR_NAME","Emit","LoweredAst","RuntimeBytecode","Tokens","Yul","__clone_box","augment_args","augment_args_for_update","borrow","","borrow_mut","","build","build_ingot","build_single_file","clone","clone_into","clone_to_uninit","cmp","compare","emit","eq","equivalent","","","","fmt","from","","from_arg_matches","from_arg_matches_mut","input_path","into","","ioerr_to_string","mir","mir_dump","optimize","output_dir","overwrite","partial_cmp","to_owned","to_possible_value","try_from","","try_into","","type_id","","update_from_arg_matches","update_from_arg_matches_mut","value_variants","verify_nonexistent_or_empty","vzip","","write_compiled_module","write_output","CheckArgs","augment_args","augment_args_for_update","borrow","borrow_mut","check","check_ingot","check_single_file","from","from_arg_matches","from_arg_matches_mut","input_path","into","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","NewProjectArgs","SRC_TEMPLATE_DIR","augment_args","augment_args_for_update","borrow","borrow_mut","create_new_project","create_project","from","from_arg_matches","from_arg_matches_mut","into","name","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip"],"q":[[0,"fe"],[20,"fe::task"],[48,"fe::task::build"],[110,"fe::task::check"],[129,"fe::task::new"],[148,"clap::builder::command"],[149,"clap::parser::matches::arg_matches"],[150,"clap::error"],[151,"core::result"],[152,"core::any"],[153,"dyn_clone::sealed"],[154,"alloc::string"],[155,"fe_driver"],[156,"core::cmp"],[157,"alloc::vec"],[158,"core::fmt"],[159,"std::io::error"],[160,"core::option"],[161,"clap::builder::possible_value"],[162,"std::path"],[163,"fe_codegen::db"],[164,"fe_common::diagnostics"],[165,"include_dir::dir"]],"i":"`h0000000000``000000j`0``0`0000`````00000`000000Bd0`0``00000Al01010```1111101111111000010`0`000111101010001`10```Cj000```00000000000``Db000``00000000000","f":"`{bb}0{d{{d{c}}}{}}{{{d{f}}}{{d{fc}}}{}}{hj}{cc{}}{{{d{l}}}{{A`{hn}}}}{{{d{fl}}}{{A`{hn}}}}{{}c{}}{{}b}0{{}Ab}`{c{{A`{e}}}{}{}}{{}{{A`{c}}}{}}{dAd}{{{d{fh}}{d{l}}}{{A`{Abn}}}}{{{d{fh}}{d{fl}}}{{A`{Abn}}}}{{}c{}}```````??>=`````;{{{d{l}}}{{A`{jn}}}}{{{d{fl}}}{{A`{jn}}}}{{{d{Af}}}Ah};`876{{{d{fj}}{d{l}}}{{A`{Abn}}}}{{{d{fj}}{d{fl}}}{{A`{Abn}}}}5````{{}d}`````{{dAj}Ab}{bb}0{d{{d{c}}}{}}0{{{d{f}}}{{d{fc}}}{}}0{AlAb}{{{d{Al}}}{{Bb{AnB`}}}}0{{{d{Bd}}}Bd}{{d{d{fc}}}Ab{}}{{dBf}Ab}{{{d{Bd}}{d{Bd}}}Bh}{{d{d{c}}}Bh{}}{AlBj}{{{d{Bd}}{d{Bd}}}Ah}{{d{d{c}}}Ah{}}000{{{d{Bd}}{d{fBl}}}Bn}{cc{}}0{{{d{l}}}{{A`{Aln}}}}{{{d{fl}}}{{A`{Aln}}}}{AlAn}{{}c{}}0{C`An}{AlAh}{{{d{Af}}}Ab}{AlCb}52{{{d{Bd}}{d{Bd}}}{{Cb{Bh}}}}{dc{}}{{{d{Bd}}}{{Cb{Cd}}}}{c{{A`{e}}}{}{}}0{{}{{A`{c}}}{}}0{dAd}0{{{d{fAl}}{d{l}}}{{A`{Abn}}}}{{{d{fAl}}{d{fl}}}{{A`{Abn}}}}{{}{{d{{Cf{Bd}}}}}}{{{d{Ch}}}{{A`{AbAn}}}}{{}c{}}0{{B`{d{Af}}{d{{Cf{Bd}}}}{d{Af}}Ah}{{A`{AbAn}}}}{{{d{Ch}}{d{Af}}}{{A`{AbAn}}}}`{bb}0{d{{d{c}}}{}}{{{d{f}}}{{d{fc}}}{}}{CjAb}{{{d{fCl}}{d{Af}}}{{Bj{Cn}}}}0{cc{}}{{{d{l}}}{{A`{Cjn}}}}{{{d{fl}}}{{A`{Cjn}}}}{CjAn}{{}c{}}{c{{A`{e}}}{}{}}{{}{{A`{c}}}{}}{dAd}{{{d{fCj}}{d{l}}}{{A`{Abn}}}}{{{d{fCj}}{d{fl}}}{{A`{Abn}}}}{{}c{}}`{{}D`}{bb}0{d{{d{c}}}{}}{{{d{f}}}{{d{fc}}}{}}{DbAb}{{{d{Af}}{d{Ch}}}Ab}{cc{}}{{{d{l}}}{{A`{Dbn}}}}{{{d{fl}}}{{A`{Dbn}}}}?{DbAn}?>={{{d{fDb}}{d{l}}}{{A`{Abn}}}}{{{d{fDb}}{d{fl}}}{{A`{Abn}}}}<","D":"Ah","p":[[8,"Command",148],[1,"reference",null,null,1],[0,"mut"],[5,"FelangCli",0],[6,"Commands",20],[5,"ArgMatches",149],[5,"Error",150],[6,"Result",151,null,1],[1,"unit"],[5,"TypeId",152],[1,"str"],[1,"bool"],[5,"Private",153],[5,"BuildArgs",48],[5,"String",154],[5,"CompiledModule",155],[1,"tuple",null,null,1],[6,"Emit",48],[1,"u8"],[6,"Ordering",156],[5,"Vec",157],[5,"Formatter",158],[8,"Result",158],[5,"Error",159],[6,"Option",160,null,1],[5,"PossibleValue",161],[1,"slice"],[5,"Path",162],[5,"CheckArgs",110],[5,"Db",163],[5,"Diagnostic",164],[5,"Dir",165],[5,"NewProjectArgs",129]],"r":[[21,48],[23,110],[26,129],[32,48],[34,110],[35,129]],"b":[],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAIgACwAAAAYACAABAAsAGQAmAAIAKgAmAFMAAgBYAB4AeAACAHwADQCLAAEAjgAGAA==","P":[[3,"T"],[5,""],[6,"T"],[7,""],[9,"U"],[10,""],[14,"U,T"],[15,"U"],[16,""],[19,"V"],[27,""],[29,"T"],[37,""],[40,"U"],[42,"U,T"],[43,"U"],[44,""],[47,"V"],[52,""],[61,"T"],[65,""],[69,"T"],[70,""],[72,"K"],[73,""],[75,"K"],[79,""],[80,"T"],[82,""],[85,"U"],[87,""],[94,"T"],[95,""],[96,"U,T"],[98,"U"],[100,""],[106,"V"],[108,""],[113,"T"],[115,""],[118,"T"],[119,""],[122,"U"],[123,"U,T"],[124,"U"],[125,""],[128,"V"],[130,""],[133,"T"],[135,""],[137,"T"],[138,""],[140,"U"],[141,""],[142,"U,T"],[143,"U"],[144,""],[147,"V"]]}],["fe_abi",{"t":"CCCCFNNNNNNNNNNNNNNNNNNNFFFONNNNNNNNNNNNNNNNNNNNNNNNNNNNNOONNNOONNNNNNNNNNNNNNOONNNFFGPGPPPPPPPPPPPPPGGPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNFGPPPPPPPPPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNONNOO","n":["contract","event","function","types","AbiContract","borrow","borrow_mut","clone","clone_into","clone_to_uninit","eq","equivalent","","","","fmt","from","into","new","serialize","to_owned","try_from","try_into","type_id","AbiEvent","AbiEventField","AbiEventSignature","anonymous","borrow","","","borrow_mut","","","clone","","clone_into","","clone_to_uninit","","eq","","equivalent","","","","","","","","fmt","","from","","","hash_hex","hash_raw","indexed","inputs","into","","","name","","new","","serialize","","signature","","to_owned","","try_from","","","try_into","","","ty","","type_id","","","AbiFunction","AbiFunctionSelector","AbiFunctionType","Constructor","CtxParam","Fallback","Function","Imm","","Mut","","None","","Nonpayable","Payable","","Pure","Receive","SelfParam","StateMutability","View","borrow","","","","","","borrow_mut","","","","","","clone","","","clone_into","","","clone_to_uninit","","","eq","","","equivalent","","","","","","","","","","","","fmt","","","from","","","","","","from_self_and_ctx_params","hex","into","","","","","","new","selector","selector_raw","selector_signature","serialize","","","to_owned","","","try_from","","","","","","try_into","","","","","","type_id","","","","","","AbiTupleField","AbiType","Address","Array","Bool","Bytes","Function","Int","String","Tuple","UInt","abi_type_name","borrow","","borrow_mut","","clone","","clone_into","","clone_to_uninit","","eq","","equivalent","","","","","","","","fmt","","from","","header_size","into","","is_bytes","is_primitive","is_static","is_string","name","new","selector_type_name","serialize","","size","to_owned","","try_from","","try_into","","ty","type_id","","elem_ty","len"],"q":[[0,"fe_abi"],[4,"fe_abi::contract"],[24,"fe_abi::event"],[83,"fe_abi::function"],[185,"fe_abi::types"],[243,"fe_abi::types::AbiType"],[245,"core::fmt"],[246,"alloc::vec"],[247,"core::result"],[248,"serde::ser"],[249,"core::any"],[250,"alloc::string"],[251,"core::convert"],[252,"core::option"],[253,"alloc::boxed"]],"i":"`````f000000000000000000```AfB`1An1202020202022220000201201102120202020122012012020120```Bn`00C`Cb1010Bl0303``021Cd1Ab5431205205205205205222200005555205431205214312050011205205431205431205431205``Bf0000000000Cj10101010101111000010101101111001101101010010Cn0","f":"`````{b{{b{c}}}{}}{{{b{d}}}{{b{dc}}}{}}{{{b{f}}}f}{{b{b{dc}}}h{}}{{bj}h}{{{b{f}}{b{f}}}l}{{b{b{c}}}l{}}000{{{b{f}}{b{dn}}}A`}{cc{}}{{}c{}}{{{Ad{Ab}}{Ad{Af}}}f}{{{b{f}}c}AhAj}{bc{}}{c{{Ah{e}}}{}{}}{{}{{Ah{c}}}{}}{bAl}```{Afl}{b{{b{c}}}{}}00{{{b{d}}}{{b{dc}}}{}}00{{{b{Af}}}Af}{{{b{An}}}An}{{b{b{dc}}}h{}}0{{bj}h}0{{{b{Af}}{b{Af}}}l}{{{b{An}}{b{An}}}l}{{b{b{c}}}l{}}0000000{{{b{Af}}{b{dn}}}A`}{{{b{An}}{b{dn}}}A`}{cc{}}00{{{b{B`}}}Bb}{{{b{B`}}}{{Bd{j}}}}{Anl}{AfAd}{{}c{}}00{AfBb}{AnBb}{{Bb{Ad{An}}l}Af}{{Bbcl}An{{Bh{Bf}}}}{{{b{Af}}c}AhAj}{{{b{An}}c}AhAj}{{{b{B`}}}{{b{Bj}}}}{{{b{Af}}}B`}{bc{}}0{c{{Ah{e}}}{}{}}00{{}{{Ah{c}}}{}}00{Afb}{AnBf}{bAl}00`````````````````````{b{{b{c}}}{}}00000{{{b{d}}}{{b{dc}}}{}}00000{{{b{Bl}}}Bl}{{{b{Ab}}}Ab}{{{b{Bn}}}Bn}{{b{b{dc}}}h{}}00{{bj}h}00{{{b{Bl}}{b{Bl}}}l}{{{b{Ab}}{b{Ab}}}l}{{{b{Bn}}{b{Bn}}}l}{{b{b{c}}}l{}}00000000000{{{b{Bl}}{b{dn}}}A`}{{{b{Ab}}{b{dn}}}A`}{{{b{Bn}}{b{dn}}}A`}{cc{}}00000{{C`Cb}Bl}{{{b{Cd}}}Bb}{{}c{}}00000{{BnBb{Ad{{Cf{BbBf}}}}{Ch{Bf}}Bl}Ab}{{{b{Ab}}}Cd}{{{b{Cd}}}{{Bd{j}}}}{{{b{Cd}}}{{b{Bj}}}}{{{b{Bl}}c}AhAj}{{{b{Ab}}c}AhAj}{{{b{Bn}}c}AhAj}{bc{}}00{c{{Ah{e}}}{}{}}00000{{}{{Ah{c}}}{}}00000{bAl}00000```````````{{{b{Bf}}}Bb}{b{{b{c}}}{}}0{{{b{d}}}{{b{dc}}}{}}0{{{b{Bf}}}Bf}{{{b{Cj}}}Cj}{{b{b{dc}}}h{}}0{{bj}h}0{{{b{Bf}}{b{Bf}}}l}{{{b{Cj}}{b{Cj}}}l}{{b{b{c}}}l{}}0000000{{{b{Bf}}{b{dn}}}A`}{{{b{Cj}}{b{dn}}}A`}{cc{}}0{{{b{Bf}}}Cl}{{}c{}}0{{{b{Bf}}}l}000{CjBb}{{Bbc}Cj{{Bh{Bf}}}}{{{b{Bf}}}Bb}{{{b{Bf}}c}AhAj}{{{b{Cj}}c}AhAj}{{{b{Bf}}}{{Ch{Cl}}}}{bc{}}0{c{{Ah{e}}}{}{}}0{{}{{Ah{c}}}{}}0{CjBf}{bAl}0{CnD`}{CnCl}","D":"Cf","p":[[1,"reference",null,null,1],[0,"mut"],[5,"AbiContract",4],[1,"unit"],[1,"u8"],[1,"bool"],[5,"Formatter",245],[8,"Result",245],[5,"AbiFunction",83],[5,"Vec",246],[5,"AbiEvent",24],[6,"Result",247,null,1],[10,"Serializer",248],[5,"TypeId",249],[5,"AbiEventField",24],[5,"AbiEventSignature",24],[5,"String",250],[1,"array"],[6,"AbiType",185],[10,"Into",251,null,1],[1,"str"],[6,"StateMutability",83],[6,"AbiFunctionType",83],[6,"SelfParam",83],[6,"CtxParam",83],[5,"AbiFunctionSelector",83],[1,"tuple",null,null,1],[6,"Option",252,null,1],[5,"AbiTupleField",185],[1,"usize"],[15,"Array",243],[5,"Box",253,null,1]],"r":[],"b":[],"c":"OjAAAAAAAAA=","e":"OzAAAAEAANoACgAAABAAEwAhADgAAwA/ACcAaAAnAJYAAACeAD0A3gAAAOEACADrAAoA","P":[[5,"T"],[7,""],[8,"T"],[9,""],[11,"K"],[15,""],[16,"T"],[17,"U"],[18,""],[19,"S"],[20,"T"],[21,"U,T"],[22,"U"],[23,""],[28,"T"],[34,""],[36,"T"],[38,""],[42,"K"],[50,""],[52,"T"],[55,""],[59,"U"],[62,""],[66,"__S"],[68,""],[70,"T"],[72,"U,T"],[75,"U"],[78,""],[104,"T"],[116,""],[119,"T"],[122,""],[128,"K"],[140,""],[143,"T"],[149,""],[151,"U"],[157,""],[161,"__S"],[164,"T"],[167,"U,T"],[173,"U"],[179,""],[197,"T"],[201,""],[203,"T"],[205,""],[209,"K"],[217,""],[219,"T"],[221,""],[222,"U"],[224,""],[231,"S"],[232,"__S"],[233,""],[234,"T"],[236,"U,T"],[238,"U"],[240,""]]}],["fe_analyzer",{"t":"EEHHCCCCCCCCPGPPGFGFPPGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNSSSSPFGFKPPPPPGGPFPPFPFPPPPFPGPPPPFPPPPMNMNMNMNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOMNMNNNOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNONNNNNNNNNNNNNNNNNNNNNNNNNNNMNMNNNNNMNNNNNNNNNNNNONNMNNNOOOMNNNNNNNNMNMNNNMNMNMNNMNNNNOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOONNNNNNNNNNNNMNOOOOOOOOOOOOOOOOOOOOOOFKFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNOMNOMNOMNOMNOMNOMNOMNOMNOMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNOMNOMNOMNOMNOMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNOMNOMNOMNONNMNOMNOMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNOMNOMNOMNOMNOMNOMNOMNOMNONMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNOMNOMNOMNOMNONMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNONNMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNONNMNMNMNMNMNMNMNOMNOMNOMNOMNOMNOMNOMNOMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNKKFNNNNNMNNNNNNNFGFFPFGPPPPPPGFPPPNNNNNNNNNNNNNNNNNNNNNNHNNNNNNNNNNNNNNNNNNNNNNNNNHHNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHNNNNNHHHNNNNNNNNNNNNNNNNNNHNNNNNNNNCCCPFPFPPFPFFFIFGKPFPFFFGPPFPFFFPFPFFPFGPGPPPFPFFFGPPFPFFFFPFPPFFGPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNOOOOOOOOONNNNNNNNNNNNNNNNNOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOONNNNNNNNNNNNNNNNNNNNNMNNONNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNONNNNNNNNNNNONNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHFGPFPFPPPPNNNNNNNNNNNNNONNNNNNNNHNNNONNNNNNOOONNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNONNNNNNNNNONNNNNNNOPPFPPGPPPFPFFFFPGFGGFPPPPPPPPGFFPPPPPPKPFPPPPPGFPGPKFPPPPSPPPPNNHNMNMNNMNNNMNNNMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHHNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNOONNNNMNONNOONNNNOOONNNNNNNNONNNNNNOONNONNOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNHHNNNOPPGPPGPFFFFGPPPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNOO","n":["AnalyzerDb","TestDb","analyze_ingot","analyze_module","builtins","constants","context","db","display","errors","namespace","pattern_analysis","AbiEncode","ContractTypeMethod","Create","Create2","GlobalFunction","GlobalFunctionIter","Intrinsic","IntrinsicIter","Keccak256","ToMem","ValueMethod","__add","__addmod","__address","__and","__balance","__basefee","__blockhash","__byte","__call","__callcode","__calldatacopy","__calldataload","__calldatasize","__caller","__callvalue","__chainid","__codecopy","__codesize","__coinbase","__create","__create2","__delegatecall","__div","__eq","__exp","__extcodecopy","__extcodehash","__extcodesize","__gas","__gaslimit","__gasprice","__gt","__invalid","__iszero","__keccak256","__log0","__log1","__log2","__log3","__log4","__lt","__mload","__mod","__msize","__mstore","__mstore8","__mul","__mulmod","__not","__number","__or","__origin","__pc","__pop","__prevrandao","__return","__returndatacopy","__returndatasize","__revert","__sar","__sdiv","__selfbalance","__selfdestruct","__sgt","__shl","__shr","__signextend","__sload","__slt","__smod","__sstore","__staticcall","__stop","__sub","__timestamp","__xor","arg_count","","as_ref","","","","borrow","","","","","","borrow_mut","","","","","","clone","","","","","","clone_into","","","","","","clone_to_uninit","","","","","","cmp","","compare","","eq","","","","equivalent","","","","","","","","","","","","","","","","fmt","","","","from","","","","","","from_str","","","","hash","","","into","","","","","","into_iter","","iter","","len","","next","","next_back","","nth","","partial_cmp","","return_type","size_hint","","to_owned","","","","","","try_from","","","","","","","","","","try_into","","","","","","type_id","","","","","","EMITTABLE_TRAIT_NAME","EMIT_FN_NAME","INDEXED","MAX_INDEXED_EVENT_FIELDS","Address","Adjustment","AdjustmentKind","Analysis","AnalyzerContext","AssociatedFunction","Bool","BuiltinAssociatedFunction","BuiltinFunction","BuiltinValueMethod","CallType","Constant","Copy","DiagnosticVoucher","EnumConstructor","EnumVariant","ExpressionAttributes","External","FunctionBody","Int","IntSizeIncrease","Intrinsic","Item","Label","Load","NamedThing","Pure","SelfValue","Str","StringSizeIncrease","TempContext","TraitValueMethod","TypeConstructor","ValueMethod","Variable","add_call","","add_constant","","add_diagnostic","","add_expression","","adjusted_type","assume_the_parser_handled_it","borrow","","","","","","","","","","","borrow_mut","","","","","","","","","","","calls","clone","","","","","","","","","","clone_into","","","","","","","","","","clone_to_uninit","","","","","","","","","","const_value","constant_value_by_name","","db","","default","","diagnostics","","duplicate_name_error","eq","","","","","","","","","","equivalent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","error","expr_typ","","expressions","fancy_error","fmt","","","","","","","","","","","format","from","","","","","","","","","","","from_num_str","function","function_name","get_call","","get_context_type","","has_diag","hash","","","inherits_type","","into","","","","","","","","","","","","into_cs_label","is_builtin","is_in_function","","is_unsafe","item_kind_display_name","kind","matches","message","module","","name","name_conflict_error","name_span","new","","not_yet_implemented","original_type","parent","","parent_function","","primary","register_diag","resolve_any_path","","resolve_name","","resolve_path","","resolve_path_segment","resolve_visible_path","","root_item","secondary","sink_diagnostics","span","spans","style","to_owned","","","","","","","","","","to_string","try_from","","","","","","","","","","","try_into","","","","","","","","","","","typ","type_adjustments","type_error","type_id","","","","","","","","","","","update_expression","","value","var_types","contract","","function","","","generic_type","method","","","trait_id","typ","","","decl","is_const","name","parent","span","","typ","AllImplsQuery","AnalyzerDb","AnalyzerDbGroupStorage__","AnalyzerDbStorage","ContractAllFieldsQuery","ContractAllFunctionsQuery","ContractCallFunctionQuery","ContractDependencyGraphQuery","ContractFieldMapQuery","ContractFieldTypeQuery","ContractFunctionMapQuery","ContractInitFunctionQuery","ContractPublicFunctionMapQuery","ContractRuntimeDependencyGraphQuery","EnumAllFunctionsQuery","EnumAllVariantsQuery","EnumDependencyGraphQuery","EnumFunctionMapQuery","EnumVariantKindQuery","EnumVariantMapQuery","FunctionBodyQuery","FunctionDependencyGraphQuery","FunctionSignatureQuery","FunctionSigsQuery","ImplAllFunctionsQuery","ImplForQuery","ImplFunctionMapQuery","IngotExternalIngotsQuery","IngotFilesQuery","IngotModulesQuery","IngotRootModuleQuery","InternAttributeLookupQuery","InternAttributeQuery","InternContractFieldLookupQuery","InternContractFieldQuery","InternContractLookupQuery","InternContractQuery","InternEnumLookupQuery","InternEnumQuery","InternEnumVariantLookupQuery","InternEnumVariantQuery","InternFunctionLookupQuery","InternFunctionQuery","InternFunctionSigLookupQuery","InternFunctionSigQuery","InternImplLookupQuery","InternImplQuery","InternIngotLookupQuery","InternIngotQuery","InternModuleConstLookupQuery","InternModuleConstQuery","InternModuleLookupQuery","InternModuleQuery","InternStructFieldLookupQuery","InternStructFieldQuery","InternStructLookupQuery","InternStructQuery","InternTraitLookupQuery","InternTraitQuery","InternTypeAliasLookupQuery","InternTypeAliasQuery","InternTypeLookupQuery","InternTypeQuery","ModuleAllImplsQuery","ModuleAllItemsQuery","ModuleConstantTypeQuery","ModuleConstantValueQuery","ModuleConstantsQuery","ModuleContractsQuery","ModuleFilePathQuery","ModuleImplMapQuery","ModuleIsIncompleteQuery","ModuleItemMapQuery","ModuleParentModuleQuery","ModuleParseQuery","ModuleStructsQuery","ModuleSubmodulesQuery","ModuleTestsQuery","ModuleUsedItemMapQuery","RootIngotQuery","StructAllFieldsQuery","StructAllFunctionsQuery","StructDependencyGraphQuery","StructFieldMapQuery","StructFieldTypeQuery","StructFunctionMapQuery","TestDb","TraitAllFunctionsQuery","TraitFunctionMapQuery","TraitIsImplementedForQuery","TypeAliasTypeQuery","all_impls","","","borrow","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","borrow_mut","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","contract_all_fields","","","contract_all_functions","","","contract_call_function","","","contract_dependency_graph","","","contract_field_map","","","contract_field_type","","","contract_function_map","","","contract_init_function","","","contract_public_function_map","","","contract_runtime_dependency_graph","","","default","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","enum_all_functions","","","enum_all_variants","","","enum_dependency_graph","","","enum_function_map","","","enum_variant_kind","","","enum_variant_map","","","execute","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","file_content","file_line_starts","file_name","fmt","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","fmt_index","","for_each_query","","from","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","function_body","","","function_dependency_graph","","","function_signature","","","function_sigs","","","group_storage","","impl_all_functions","","","impl_for","","","impl_function_map","","","in_db","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","in_db_mut","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","ingot_external_ingots","","","ingot_files","","","ingot_modules","","","ingot_root_module","","","intern_attribute","","","intern_contract","","","intern_contract_field","","","intern_enum","","","intern_enum_variant","","","intern_file","intern_function","","","intern_function_sig","","","intern_impl","","","intern_ingot","","","intern_module","","","intern_module_const","","","intern_struct","","","intern_struct_field","","","intern_trait","","","intern_type","","","intern_type_alias","","","into","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","lookup_intern_attribute","","","lookup_intern_contract","","","lookup_intern_contract_field","","","lookup_intern_enum","","","lookup_intern_enum_variant","","","lookup_intern_file","lookup_intern_function","","","lookup_intern_function_sig","","","lookup_intern_impl","","","lookup_intern_ingot","","","lookup_intern_module","","","lookup_intern_module_const","","","lookup_intern_struct","","","lookup_intern_struct_field","","","lookup_intern_trait","","","lookup_intern_type","","","lookup_intern_type_alias","","","maybe_changed_since","","module_all_impls","","","module_all_items","","","module_constant_type","","","module_constant_value","","","module_constants","","","module_contracts","","","module_file_path","","","module_impl_map","","","module_is_incomplete","","","module_item_map","","","module_parent_module","","","module_parse","","","module_structs","","","module_submodules","","","module_tests","","","module_used_item_map","","","new","ops_database","ops_salsa_runtime","ops_salsa_runtime_mut","query_storage","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","recover","","","","","","","","root_ingot","","","set_file_content","set_file_content_with_durability","set_ingot_external_ingots","","set_ingot_external_ingots_with_durability","","set_ingot_files","","set_ingot_files_with_durability","","set_root_ingot","","set_root_ingot_with_durability","","struct_all_fields","","","struct_all_functions","","","struct_dependency_graph","","","struct_field_map","","","struct_field_type","","","struct_function_map","","","trait_all_functions","","","trait_function_map","","","trait_is_implemented_for","","","try_from","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","try_into","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","type_alias_type","","","type_id","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","upcast","upcast_mut","DisplayWithDb","Displayable","DisplayableWrapper","borrow","borrow_mut","child","display","fmt","format","from","into","new","to_string","try_from","try_into","type_id","AlreadyDefined","BinaryOperationError","ConstEvalError","FatalError","Incompatible","IncompleteItem","IndexingError","NotEqualAndUnsigned","NotSubscriptable","RequiresToMem","RightIsSigned","RightTooLarge","SelfContractType","TypeCoercionError","TypeError","TypesNotCompatible","TypesNotNumeric","WrongIndexType","borrow","","","","","","","","borrow_mut","","","","","","","","clone","","clone_into","","clone_to_uninit","","duplicate_name_error","eq","","","","","equivalent","","","","","","","","","","","","","","","","","","","","error","fancy_error","fmt","","","","","","","","from","","","","","","","","","","","","","","","","","","hash","","into","","","","","","","","name_conflict_error","new","","","","","not_yet_implemented","self_contract_type_error","to_mem_error","to_owned","","try_from","","","","","","","","try_into","","","","","","","","type_error","type_id","","","","","","","","items","scopes","types","Alias","Attribute","","AttributeId","BuiltinFunction","Constant","Contract","","ContractField","ContractFieldId","ContractId","DepGraph","DepGraphWrapper","DepLocality","DiagnosticSink","Dir","Enum","","EnumId","EnumVariant","EnumVariantId","EnumVariantKind","External","File","Function","","FunctionId","FunctionSig","FunctionSigId","GenericType","Impl","","ImplId","Ingot","","IngotId","IngotMode","Intrinsic","Item","Lib","Local","Main","Module","","ModuleConstant","ModuleConstantId","ModuleId","ModuleSource","Primitive","StandaloneModule","Struct","","StructField","StructFieldId","StructId","Trait","","TraitId","Tuple","Type","TypeAlias","TypeAliasId","TypeDef","Unit","all_constants","all_contracts","all_functions","","","","","","all_impls","all_items","all_modules","as_intern_id","","","","","","","","","","","","","","","as_trait_or_type","as_type","","","ast","","","","","","","","","","","","","","","attributes","","body","borrow","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","borrow_mut","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","builtin_items","call_function","can_stand_in_for","clone","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","clone_into","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","clone_to_uninit","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","cmp","","","","","","","","","","","","","","","","","compare","","","","","","","","","","","","","","","","","constant_value","data","","","","","","","","","","","","","","","default","","","","","dependency_graph","","","","","diagnostics","","disc","display_name","eq","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","equivalent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","external_ingots","field","field_len","field_type","fields","","file_path_relative_to_src_dir","fmt","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","format","from","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","from_build_files","from_files","from_intern_id","","","","","","","","","","","","","","","function","","","","","","function_sig","functions","","","","","generic_param","generic_params","global_items","has_private_field","hash","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","impls","ingot","","init_function","internal_items","into","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","is_builtin","is_constructor","","is_contract","is_contract_func","","is_generic","","is_impl_fn","is_implemented_for","is_in_scope","is_in_std","","is_incomplete","is_indexed","is_module_fn","is_public","","","","","","","","","","","is_receiver_type","is_std_trait","is_struct","is_test","is_trait_fn","is_unit","is_unsafe","item_kind_display_name","items","","","","kind","mode","module","","","","","","","","","","","","","","","","","","","name","","","","","","","","","","","","","","","","","","","","name_span","","","","","","","","","","name_with_parent","new","","new_standalone","node_id","non_used_internal_items","parent","","","","","","","","","","","","","","","","","","parent_module","partial_cmp","","","","","","","","","","","","","","","","","path","pub_span","public_functions","push","push_all","receiver","","resolve_constant","resolve_name","","resolve_path","resolve_path_internal","resolve_path_non_used_internal","resolve_path_segments","root_module","runtime_dependency_graph","self_item","self_span","","self_type","","sig","","signature","","sink_diagnostics","","","","","","","","","","","","","","","","sink_external_ingot_diagnostics","source","span","","","","","","","","","","","src_dir","std_lib","submodules","tag","takes_self","","tests","to_owned","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","trait_id","","try_from","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","try_into","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","typ","","","","type_id","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","unsafe_span","","used_items","value","variant","variants","walk_local_dependencies","BlockScope","BlockScopeType","Function","FunctionScope","IfElse","ItemScope","Loop","Match","MatchArm","Unsafe","add_call","","","add_constant","","","add_diagnostic","","","add_expression","","","add_var","body","borrow","","","","borrow_mut","","","","check_visibility","clone","clone_into","clone_to_uninit","constant_defs","constant_value_by_name","","","db","","","","diagnostics","","eq","equivalent","","","","expr_typ","","","fmt","from","","","","function","function_return_type","get_call","","","get_context_type","","","inherits_type","","","into","","","","is_in_function","","","map_pattern_matrix","map_variable_type","module","","","new","","","new_child","parent","","","","parent_function","","","resolve_any_path","","","resolve_name","","","resolve_path","","","resolve_visible_path","","","root","to_owned","try_from","","","","try_into","","","","typ","type_id","","","","update_expression","","","variable_defs","Address","AnyType","Array","","","Base","","Bool","Contract","CtxDecl","Enum","FeString","FunctionParam","FunctionSignature","Generic","","GenericArg","GenericParam","GenericParamKind","GenericType","GenericTypeIter","I128","I16","I256","I32","I64","I8","Int","","Integer","IntegerIter","Map","","","Mut","Numeric","PrimitiveType","SPtr","SafeNames","SelfContract","SelfDecl","SelfType","String","","Struct","TraitId","TraitOrType","Tuple","","Type","","TypeDowncast","TypeId","","U128","U16","U256","","U32","U64","U8","Unit","address","","address_max","apply","as_array","","as_int","","as_intern_id","as_map","","as_ref","","as_string","","as_struct","as_trait_or_type","as_tuple","","base","bits","bool","","borrow","","","","","","","","","","","","","","","","","","","","borrow_mut","","","","","","","","","","","","","","","","","","","","bounds","can_hold","clone","","","","","","","","","","","","","","","","","","","clone_into","","","","","","","","","","","","","","","","","","","clone_to_uninit","","","","","","","","","","","","","","","","","","","cmp","","","","","","compare","","","","","","ctx_decl","def_span","default","deref","deref_typ","eq","","","","","","","","","","","","","","","","","equivalent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","fits","fmt","","","","","","","","","","","","","","","","","","","","","format","","","from","","","","","","","","","","","","","","","","","","","","","from_intern_id","from_str","","","function_sig","function_sigs","get_impl_for","has_fixed_size","","hash","","","","","","","","","","","","","","","","","i256_max","i256_min","id","inner","int","","into","","","","","","","","","","","","","","","","","","","","into_iter","","is_bool","is_contract","is_emittable","is_encodable","is_generic","is_integer","is_map","is_mut","","is_primitive","is_self_ty","is_signed","is_sptr","is_string","is_struct","is_unit","items","iter","","key","kind","kind_display_name","label","len","","lower_snake","make_sptr","max_size","max_value","min_value","mut_","","name","","","","","","","new","next","","next_back","","nth","","params","","partial_cmp","","","","","","return_type","self_decl","self_function","size","","size_hint","","span","","to_owned","","","","","","","","","","","","","","","","","","","to_string","","","","trait_function_candidates","try_from","","","","","","","","","","","","","","","","","","","","","","try_into","","","","","","","","","","","","","","","","","","","","tuple","typ","","type_id","","","","","","","","","","","","","","","","","","","","u256","","u256_max","u256_min","u8","unit","","value","Bool","Constructor","ConstructorKind","Enum","Literal","LiteralConstructor","Or","PatternMatrix","PatternRowVec","SigmaSet","SimplifiedPattern","SimplifiedPatternKind","Struct","Tuple","WildCard","arity","borrow","","","","","","","borrow_mut","","","","","","","clone","","","","","","","clone_into","","","","","","","clone_to_uninit","","","","","","","collect_column_ctors","collect_ctors","complete_sigma","ctor_with_wild_card_fields","d_specialize","","difference","eq","","","","","","","equivalent","","","","","","","","","","","","","","","","","","","","","","","","","","","","field_types","find_non_exhaustiveness","fmt","","","","","","","format","from","","","","","","","from_arms","from_rows","hash","","head","inner","into","","","","","","","into_iter","into_rows","is_complete","is_empty","","is_row_useful","is_wildcard","iter","kind","len","","ncols","new","","","nrows","pats","phi_specialize","","rows","sigma_set","swap","swap_col","to_owned","","","","","","","try_from","","","","","","","try_into","","","","","","","ty","","type_id","","","","","","","wildcard","fields","kind"],"q":[[0,"fe_analyzer"],[12,"fe_analyzer::builtins"],[227,"fe_analyzer::constants"],[231,"fe_analyzer::context"],[532,"fe_analyzer::context::CallType"],[545,"fe_analyzer::context::NamedThing"],[552,"fe_analyzer::db"],[2063,"fe_analyzer::display"],[2079,"fe_analyzer::errors"],[2219,"fe_analyzer::namespace"],[2222,"fe_analyzer::namespace::items"],[3319,"fe_analyzer::namespace::scopes"],[3443,"fe_analyzer::namespace::types"],[3989,"fe_analyzer::pattern_analysis"],[4166,"fe_analyzer::pattern_analysis::SimplifiedPatternKind"],[4168,"fe_common::diagnostics"],[4169,"alloc::vec"],[4170,"core::result"],[4171,"core::cmp"],[4172,"core::fmt"],[4173,"core::hash"],[4174,"core::option"],[4175,"core::any"],[4176,"fe_parser::ast"],[4177,"fe_parser::node"],[4178,"smol_str"],[4179,"indexmap::map"],[4180,"core::clone"],[4181,"fe_common::span"],[4182,"alloc::rc"],[4183,"core::cell"],[4184,"alloc::string"],[4185,"fe_common::files"],[4186,"codespan_reporting::diagnostic"],[4187,"core::convert"],[4188,"std::collections::hash::map"],[4189,"core::ops::function"],[4190,"alloc::sync"],[4191,"salsa"],[4192,"salsa::runtime"],[4193,"salsa::revision"],[4194,"salsa::durability"],[4195,"fe_common::db"],[4196,"salsa::intern_id"],[4197,"fe_common::utils::files"],[4198,"core::iter::traits::iterator"],[4199,"fe_analyzer::traversal::pattern_analysis"],[4200,"alloc::collections::btree::map"],[4201,"num_bigint::bigint"],[4202,"fe_analyzer::traversal"]],"i":"````````````Ah`Ab0````Al2`Af0000000000000000000000000000000000000000000000000000000000000000000000000002031203B`231Bb51342051342051342051342032325342555533334444222253425134205342532513420103210101010322105134205513344220513420513420````Dd````Cn1000``Ej`1Ef`2`3120`1`2031`2220ChD`101010DfDjE`Eb624Dl4Eh9:;328461509:;132841509:;32841509:;32841509:;576766126732841509:;33332222888844441111555500009999::::;;;;7761732841509::;5328461509:;;::7676232476328461509:;03876:801376878257576763776767687673231332841509:;:328461509:;328461509:;557328461509:;7621HlI`1Ib1IdIhIj22130J`Jb01100```````````````````````````````````````````````````````````````````````````````````````````bAEnJfBAf1K`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAEnBAfJfK`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAEnb1Jf120120120120120120120120120K`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAEnb1Jf120120120120120OfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAEn00K`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElJfAEn10BAf2K`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAEnb1Jf12012012022120120120K`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElK`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElbAEnJf2102102102102102102102101210210210210210210210210210210210BAf1K`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAEnb1Jf1201201201202120120120120120120120120120120120021201201201201201201201201201201201201201201201200222K`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAAfAAhABjABlACbACnADh7bAEnJf11212121212121210210210210210210210210210BAf1K`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAEnBAfJfK`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAEnb1JfBAf1K`KbKdKfKhKjKlKnL`LbLdLfLhLjLlLnM`MbMdMfMhMjMlMnN`NbNdNfNhNjNlNnO`ObOdOfOhOjOlOnA@`A@bA@dA@fA@hA@jA@lA@nAA`AAbAAdAAfAAhAAjAAlAAnAB`ABbABdABfABhABjABlABnAC`ACbACdACfAChACjAClACnAD`ADbADdADfADhADjADlADnAE`AEbAEdAEfAEhAEjAElAEn00```AJh00AJj1AJl2222222````AKb``AK`AJn2112``110JnHbFnEnAKd56743210567424242`4256744442222555566667777``432105674444333332222105674243210567`43210```424321056743210567`43210567```ALb`Gl`00`1```````AL``2````ALd1`2```2`2``2``2`AKn10`3````40`4````3`AFd4```0A`00HnAI`AF`JdIn55f06AHlAIj7JjIlG`9AIdAGd:AFb:99=<;>:AHjAIhAGfAGhAHbAH`AHnAIbAGbAGjAGlAHdAIfGlAIdG`2AKnAHffAL`AHhA`AHjAHlALbAIhAIjAGfHnAGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALdGlAKnAHffAL`AHhA`AHjAHlALbAIhAIjAGfHnAGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALd`Hn5GlAKnAHffAL`AHhA`AHjAHlALbAIhAIjAGf=AGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALdGlAKnAHffAL`AHhA`AHjAHlALbAIhAIjAGfHnAGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALdGlAKnAHffAL`AHhA`AHjAHlALbAIhAIjAGfHnAGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALdGlfA`AHlALbAIjHnJjIlG`AI`AIdAGdAF`AFbJdInGlfA`AHlALbAIjHnJjIlG`AI`AIdAGdAF`AFbJdIn=?>=;:987654321064310Gl;874fA`5AFd3AKnAHf4AL`AHh5AHjAHlALbAIhAIjAGfHnAGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALdGl000AKn000AHf000f000AL`000AHh000A`000AHj000AHl000ALb000AIh000AIj000AGf000Hn000AGh000Jj000AHb000Il000AH`000G`000AHn000AI`000AIb000AId000AGb000AGd000AGj000AF`000AGl000AFb000AFd000AHd000Jd000AIf000In000Jl000ALd000fAI`8Hn01A`GlAKnAHf6AL`AHh5AHjAHlALbAIhAIjAGf70AKnAHffAL`AHhA`AHjAHlALbAIhAIjAGfHnAGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInA`0AHhHn2GlAKnAHffAL`67AHjAHlALbAIhAIjAGf;AGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALdGlIlG`2101015A`060AId34AHlALbAIjHn76AI`5AF`=?=:89AFd9;;f96AFbAHf>96=<5AGd5JdInAHjAIhAGfAHbAHnAGbAGjAHdAIfGl?A`AHlALbAIjHnJjIlG`AI`AIdAGdAF`AFbJdInAHfAHhAGfGlAHlALbAIjHnIlG`AI`>;=A`AH`181918765432AGdAF`AFbJdInAGhAHbAIbAGl:Glf=213AHlALbAIjHnJjIlG`AI`AIdAF`AFbJdIn>AHh=;:765AGd5432AHffA`AGl=<1GlAKn54AL`84AHjAHlALbAIhAIjAGfHnAGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALd45GlAKnAHffAL`AHhA`AHjAHlALbAIhAIjAGfHnAGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALdGlAKnAHffAL`AHhA`AHjAHlALbAIhAIjAGfHnAGhJjAHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALdAHlALbJjAIdGlAKnAHffAL`AHhA`AHj;::AIhAIj0AGfHnAGh>AHbIlAH`G`AHnAI`AIbAIdAGbAGdAGjAF`AGlAFbAFdAHdJdAIfInJlALdIlG`A`AHl==```Gd`0`0000AMhAMjAMl2102102100121032103`3330210210121333332103210311210210210210321011210210021002102102102102100321032103021032100CbB@``FfANf`131`1````1`````ANn000003ANh```323543`3`3323AKj``4`1``0222`22264Dh`4ANj101101450111011461B@b7329AOf6ANlAO`IfAOdAObAFlAOhAOjAOlANfAOnB@`ANh>FfAKjDhCbAOfANnANlAO`IfAOdAObAFlAOhAOjAOlANfAOnB@`ANh:=FfAKjDhCbAOfANnANlAO`IfAOdAObAFlAOhAOjAOlANfAOnB@`ANhFfAKjDhCbAOfANnANlAO`IfAOdAObAFlAOhAOjAOlANfAOnB@`ANhFfAKjDhCbAOfANnANlAO`IfAOdAObAFlAOhAOjAOlANfAOnB@`ANhDhCb?<:510?<:59Ff2220AKj32ANnANlAO`IfAOdAObAFlAOhAOjAOlANfB@`ANh>>>>====Dh000Cb000>>>>====<<<<;;;;::::99998888777766665555444433332222>FfAKj322ANn0ANlAO`If0AOdAOb0AFlAOhAOjAOlANfB@`ANh>Dh7B@bFf0AKj3CbAOfANnANlAO`IfAOdAObAFlAOhAOjAOlANfAOnB@`ANhDhCb?5111Ff20AKj32ANnANlAO`IfAOdAObAFlAOhAOjAOlANfB@`ANh``>;>DhB@bFfAKj3CbAOfANnANlAO`IfAOdAObAFlAOhAOjAOlANfAOnB@`ANh>2Dh0000000700>000Ff;?5=B@b27AOf6B@d4=ANn0<;45Cb:4If<<4:4:4:;?7120AOb?=AKjDh?>==``>>DhAO`B@lB@j`B@f0`1`````0010AN`B@h324B@nBA`3254610325461032546103254610051530132546103333222255554444666611110000433254610232546103146003254610131103212103320303033033254610325461032546104232546102BAd0","f":"``{{{d{b}}f}{{n{h{l{j}}}}}}{{{d{b}}A`}{{n{h{l{j}}}}}}```````````````````````````````````````````````````````````````````````````````````````````````{{{d{Ab}}}Ad}{{{d{Af}}}Ad}{{{d{Ah}}}{{d{Aj}}}}{{{d{Al}}}{{d{Aj}}}}{{{d{Ab}}}{{d{Aj}}}}{{{d{Af}}}{{d{Aj}}}}{d{{d{c}}}{}}00000{{{d{An}}}{{d{Anc}}}{}}00000{{{d{Ah}}}Ah}{{{d{B`}}}B`}{{{d{Al}}}Al}{{{d{Ab}}}Ab}{{{d{Af}}}Af}{{{d{Bb}}}Bb}{{d{d{Anc}}}h{}}00000{{dBd}h}00000{{{d{Al}}{d{Al}}}Bf}{{{d{Af}}{d{Af}}}Bf}{{d{d{c}}}Bf{}}0{{{d{Ah}}{d{Ah}}}Bh}{{{d{Al}}{d{Al}}}Bh}{{{d{Ab}}{d{Ab}}}Bh}{{{d{Af}}{d{Af}}}Bh}{{d{d{c}}}Bh{}}000000000000000{{{d{Ah}}{d{AnBj}}}Bl}{{{d{Al}}{d{AnBj}}}Bl}{{{d{Ab}}{d{AnBj}}}Bl}{{{d{Af}}{d{AnBj}}}Bl}{cc{}}00000{{{d{Aj}}}{{n{Ahc}}}{}}{{{d{Aj}}}{{n{Alc}}}{}}{{{d{Aj}}}{{n{Abc}}}{}}{{{d{Aj}}}{{n{Afc}}}{}}{{{d{Ah}}{d{Anc}}}hBn}{{{d{Al}}{d{Anc}}}hBn}{{{d{Af}}{d{Anc}}}hBn}{{}c{}}00000{{}c{}}0{{}B`}{{}Bb}{{{d{B`}}}Ad}{{{d{Bb}}}Ad}{{{d{AnB`}}}{{C`{c}}}{}}{{{d{AnBb}}}{{C`{c}}}{}}10{{{d{AnB`}}Ad}{{C`{c}}}{}}{{{d{AnBb}}Ad}{{C`{c}}}{}}{{{d{Al}}{d{Al}}}{{C`{Bf}}}}{{{d{Af}}{d{Af}}}{{C`{Bf}}}}{{{d{Af}}}Cb}{{{d{B`}}}{{Cd{Ad{C`{Ad}}}}}}{{{d{Bb}}}{{Cd{Ad{C`{Ad}}}}}}{dc{}}00000{c{{n{e}}}{}{}}{{{d{Aj}}}{{n{Ahc}}}{}}11{{{d{Aj}}}{{n{Alc}}}{}}{{{d{Aj}}}{{n{Abc}}}{}}3{{{d{Aj}}}{{n{Afc}}}{}}44{{}{{n{c}}}{}}00000{dCf}00000{{}d}00{{}Ad}```````````````````````````````````{{{d{Ch}}{d{{Cl{Cj}}}}Cn}h}{{{d{D`}}{d{{Cl{Cj}}}}Cn}h}{{{d{Ch}}{d{{Cl{Db}}}}{d{{Cl{Cj}}}}Dd}h}{{{d{D`}}{d{{Cl{Db}}}}{d{{Cl{Cj}}}}Dd}h}{{{d{Ch}}j}h}{{{d{D`}}j}h}{{{d{Ch}}{d{{Cl{Cj}}}}Df}h}{{{d{D`}}{d{{Cl{Cj}}}}Df}h}{{{d{Df}}}Dh}{{}Dj}{d{{d{c}}}{}}0000000000{{{d{An}}}{{d{Anc}}}{}}0000000000{DlDn}{{{d{E`}}}E`}{{{d{{Eb{c}}}}}{{Eb{c}}}Ed}{{{d{Ef}}}Ef}{{{d{Dj}}}Dj}{{{d{Dl}}}Dl}{{{d{Df}}}Df}{{{d{Eh}}}Eh}{{{d{Ej}}}Ej}{{{d{Cn}}}Cn}{{{d{Dd}}}Dd}{{d{d{Anc}}}h{}}000000000{{dBd}h}000000000{DfC`}{{{d{Ch}}{d{Db}}El}{{n{{C`{Dd}}En}}}}{{{d{D`}}{d{Db}}El}{{n{{C`{Dd}}En}}}}{{{d{Ch}}}{{d{b}}}}{{{d{D`}}}{{d{b}}}}{{}D`}{{}Dl}{EbF`}{D`Fb}{{{d{Ch}}{d{Aj}}{d{Aj}}ElEl}Dj}{{{d{E`}}{d{E`}}}Bh}{{{d{{Eb{c}}}}{d{{Eb{c}}}}}BhFd}{{{d{Ef}}{d{Ef}}}Bh}{{{d{Dj}}{d{Dj}}}Bh}{{{d{Dl}}{d{Dl}}}Bh}{{{d{Df}}{d{Df}}}Bh}{{{d{Eh}}{d{Eh}}}Bh}{{{d{Ej}}{d{Ej}}}Bh}{{{d{Cn}}{d{Cn}}}Bh}{{{d{Dd}}{d{Dd}}}Bh}{{d{d{c}}}Bh{}}000000000000000000000000000000000000000{{{d{Ch}}{d{Aj}}El{d{Aj}}}Dj}{{{d{Ch}}{d{{Cl{Cj}}}}}Ff}{{{d{D`}}{d{{Cl{Cj}}}}}Ff}{DlDn}{{{d{Ch}}{d{Aj}}{l{E`}}{l{Fh}}}Dj}{{{d{E`}}{d{AnBj}}}{{n{hFj}}}}{{{d{{Eb{c}}}}{d{AnBj}}}BlFl}{{{d{Ef}}{d{AnBj}}}Bl}{{{d{Dj}}{d{AnBj}}}Bl}{{{d{Dl}}{d{AnBj}}}Bl}{{{d{Df}}{d{AnBj}}}Bl}{{{d{Eh}}{d{AnBj}}}Bl}{{{d{Ej}}{d{AnBj}}}Bl}{{{d{Cn}}{d{AnBj}}}Bl}{{{d{Cn}}{d{AnBj}}}{{n{hFj}}}}{{{d{Dd}}{d{AnBj}}}Bl}{{{d{Df}}{d{b}}{d{AnBj}}}{{n{hFj}}}}{cc{}}0000000000{{{d{AnCh}}{d{Aj}}{d{Ff}}El}{{n{DdFn}}}}{{{d{Cn}}}{{C`{G`}}}}{{{d{Cn}}{d{b}}}Db}{{{d{Ch}}{d{{Cl{Cj}}}}}{{C`{Cn}}}}{{{d{D`}}{d{{Cl{Cj}}}}}{{C`{Cn}}}}{{{d{Ch}}}{{C`{Dh}}}}{{{d{D`}}}{{C`{Dh}}}}{{{d{{Eb{c}}}}}Bh{}}{{{d{E`}}{d{Anc}}}hBn}{{{d{{Eb{c}}}}{d{Ane}}}hGbBn}{{{d{Dj}}{d{Anc}}}hBn}{{{d{Ch}}Gd}Bh}{{{d{D`}}Gd}Bh}{{}c{}}0000000000{EhDh}{E`{{Gh{Gf}}}}{{{d{Ef}}}Bh}{{{d{Ch}}}Bh}{{{d{D`}}}Bh}{{{d{Cn}}{d{b}}}Bh}{{{d{Ef}}}{{d{Aj}}}}{EhEj}{DlDn}{E`Fh}{{{d{Ch}}}A`}{{{d{D`}}}A`}{{{d{Ef}}{d{b}}}Db}{{{d{Ch}}{d{Aj}}{d{Aj}}{d{Ef}}{C`{El}}El}Dj}{{{d{Ef}}{d{b}}}{{C`{El}}}}{{c{F`{{Gj{j}}}}}{{Eb{c}}}{}}{DhDf}{{{d{Ch}}{d{Aj}}El}Dj}{{{d{Df}}}Dh}{{{d{Ch}}}Gl}{{{d{D`}}}Gl}{{{d{Ch}}}G`}{{{d{D`}}}G`}{{Elc}E`{{Gn{Fh}}}}{{{d{Ch}}j}Dj}{{{d{Ch}}{d{H`}}}{{C`{Ef}}}}{{{d{D`}}{d{H`}}}{{C`{Ef}}}}{{{d{Ch}}{d{Aj}}El}{{n{{C`{Ef}}En}}}}{{{d{D`}}{d{Aj}}El}{{n{{C`{Ef}}En}}}}{{{d{Ch}}{d{H`}}El}{{n{EfHb}}}}{{{d{D`}}{d{H`}}El}{{n{EfHb}}}}{{{d{Ef}}{d{b}}{d{Db}}}{{C`{Ef}}}}65<8{{{d{{Eb{c}}}}{d{Ane}}}h{}Hd}{E`El}{DlHf}{E`Hh}{dc{}}000000000{dFh}{c{{n{e}}}{}{}}0000000000{{}{{n{c}}}{}}0000000000{DfDh}{Dfl}{{{d{Ch}}{d{Aj}}ElDhDh}Dj}{dCf}0000000000{{{d{Ch}}{d{{Cl{Cj}}}}{d{Hj}}}h}{{{d{D`}}{d{{Cl{Cj}}}}{d{Hj}}}h}{Eb}{DlDn}{HlHn}{I`Hn}{HlAb}{IbG`}{I`G`}{IdIf}{IhAh}{IjG`}{IdIl}{IdIn}{IhDh}{IbDh}{IjDh}{J`C`}{JbBh}{JbDb}22{JbEl}{Jbn}```````````````````````````````````````````````````````````````````````````````````````````{{{d{b}}Dh}{{F`{{Gj{Jd}}}}}}{{dDh}{{F`{{Gj{Jd}}}}}}{JfJh}{d{{d{c}}}{}}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{{d{An}}}{{d{Anc}}}{}}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{{d{b}}Hn}{{F`{{Gj{Jj}}}}}}{{dHn}{{F`{{Gj{Jj}}}}}}4{{{d{b}}Hn}{{F`{{Gj{G`}}}}}}{{dHn}{{F`{{Gj{G`}}}}}}6{{{d{b}}Hn}{{Eb{{C`{G`}}}}}}{{dHn}{{Eb{{C`{G`}}}}}}8{{{d{b}}Hn}Jl}{{dHn}Jl}:{{{d{b}}Hn}{{Eb{{F`{{Dn{DbJj}}}}}}}}{{dHn}{{Eb{{F`{{Dn{DbJj}}}}}}}}<{{{d{b}}Jj}{{Eb{{n{DhJn}}}}}}{{dJj}{{Eb{{n{DhJn}}}}}}>{{{d{b}}Hn}{{Eb{{F`{{Dn{DbG`}}}}}}}}{{dHn}{{Eb{{F`{{Dn{DbG`}}}}}}}}{JfJh}:90{{{d{b}}Hn}{{F`{{Dn{DbG`}}}}}}{{dHn}{{F`{{Dn{DbG`}}}}}}2:92{{}K`}{{}Kb}{{}Kd}{{}Kf}{{}Kh}{{}Kj}{{}Kl}{{}Kn}{{}L`}{{}Lb}{{}Ld}{{}Lf}{{}Lh}{{}Lj}{{}Ll}{{}Ln}{{}M`}{{}Mb}{{}Md}{{}Mf}{{}Mh}{{}Mj}{{}Ml}{{}Mn}{{}N`}{{}Nb}{{}Nd}{{}Nf}{{}Nh}{{}Nj}{{}Nl}{{}Nn}{{}O`}{{}Ob}{{}Od}{{}Of}{{}Oh}{{}Oj}{{}Ol}{{}On}{{}A@`}{{}A@b}{{}A@d}{{}A@f}{{}A@h}{{}A@j}{{}A@l}{{}A@n}{{}AA`}{{}AAb}{{}AAd}{{}AAf}{{}AAh}{{}AAj}{{}AAl}{{}AAn}{{}AB`}{{}ABb}{{}ABd}{{}ABf}{{}ABh}{{}ABj}{{}ABl}{{}ABn}{{}AC`}{{}ACb}{{}ACd}{{}ACf}{{}ACh}{{}ACj}{{}ACl}{{}ACn}{{}AD`}{{}ADb}{{}ADd}{{}ADf}{{}ADh}{{}ADj}{{}ADl}{{}ADn}{{}AE`}{{}AEb}{{}AEd}{{}AEf}{{}AEh}{{}AEj}{{}AEl}{{}AEn}{{{d{b}}AF`}{{F`{{Gj{G`}}}}}}{{dAF`}{{F`{{Gj{G`}}}}}}{JfJh}{{{d{b}}AF`}{{F`{{Gj{AFb}}}}}}{{dAF`}{{F`{{Gj{AFb}}}}}}2{{{d{b}}AF`}{{Eb{Jl}}}}{{dAF`}{{Eb{Jl}}}}4{{{d{b}}AF`}{{Eb{{F`{{Dn{DbG`}}}}}}}}{{dAF`}{{Eb{{F`{{Dn{DbG`}}}}}}}}6{{{d{b}}AFb}{{Eb{{n{AFdJn}}}}}}{{dAFb}{{Eb{{n{AFdJn}}}}}}8{{{d{b}}AF`}{{Eb{{F`{{Dn{DbAFb}}}}}}}}{{dAF`}{{Eb{{F`{{Dn{DbAFb}}}}}}}}:{{{d{c}}e}g{}{}{}}000000000000000000000000000000000000000000000000000{{dGf}{{F`{Aj}}}}{{dGf}{{F`{{Gj{Ad}}}}}}{{dGf}Db}{{{d{K`}}{d{AnBj}}}Bl}{{{d{Kb}}{d{AnBj}}}Bl}{{{d{Kd}}{d{AnBj}}}Bl}{{{d{Kf}}{d{AnBj}}}Bl}{{{d{Kh}}{d{AnBj}}}Bl}{{{d{Kj}}{d{AnBj}}}Bl}{{{d{Kl}}{d{AnBj}}}Bl}{{{d{Kn}}{d{AnBj}}}Bl}{{{d{L`}}{d{AnBj}}}Bl}{{{d{Lb}}{d{AnBj}}}Bl}{{{d{Ld}}{d{AnBj}}}Bl}{{{d{Lf}}{d{AnBj}}}Bl}{{{d{Lh}}{d{AnBj}}}Bl}{{{d{Lj}}{d{AnBj}}}Bl}{{{d{Ll}}{d{AnBj}}}Bl}{{{d{Ln}}{d{AnBj}}}Bl}{{{d{M`}}{d{AnBj}}}Bl}{{{d{Mb}}{d{AnBj}}}Bl}{{{d{Md}}{d{AnBj}}}Bl}{{{d{Mf}}{d{AnBj}}}Bl}{{{d{Mh}}{d{AnBj}}}Bl}{{{d{Mj}}{d{AnBj}}}Bl}{{{d{Ml}}{d{AnBj}}}Bl}{{{d{Mn}}{d{AnBj}}}Bl}{{{d{N`}}{d{AnBj}}}Bl}{{{d{Nb}}{d{AnBj}}}Bl}{{{d{Nd}}{d{AnBj}}}Bl}{{{d{Nf}}{d{AnBj}}}Bl}{{{d{Nh}}{d{AnBj}}}Bl}{{{d{Nj}}{d{AnBj}}}Bl}{{{d{Nl}}{d{AnBj}}}Bl}{{{d{Nn}}{d{AnBj}}}Bl}{{{d{O`}}{d{AnBj}}}Bl}{{{d{Ob}}{d{AnBj}}}Bl}{{{d{Od}}{d{AnBj}}}Bl}{{{d{Of}}{d{AnBj}}}Bl}{{{d{Oh}}{d{AnBj}}}Bl}{{{d{Oj}}{d{AnBj}}}Bl}{{{d{Ol}}{d{AnBj}}}Bl}{{{d{On}}{d{AnBj}}}Bl}{{{d{A@`}}{d{AnBj}}}Bl}{{{d{A@b}}{d{AnBj}}}Bl}{{{d{A@d}}{d{AnBj}}}Bl}{{{d{A@f}}{d{AnBj}}}Bl}{{{d{A@h}}{d{AnBj}}}Bl}{{{d{A@j}}{d{AnBj}}}Bl}{{{d{A@l}}{d{AnBj}}}Bl}{{{d{A@n}}{d{AnBj}}}Bl}{{{d{AA`}}{d{AnBj}}}Bl}{{{d{AAb}}{d{AnBj}}}Bl}{{{d{AAd}}{d{AnBj}}}Bl}{{{d{AAf}}{d{AnBj}}}Bl}{{{d{AAh}}{d{AnBj}}}Bl}{{{d{AAj}}{d{AnBj}}}Bl}{{{d{AAl}}{d{AnBj}}}Bl}{{{d{AAn}}{d{AnBj}}}Bl}{{{d{AB`}}{d{AnBj}}}Bl}{{{d{ABb}}{d{AnBj}}}Bl}{{{d{ABd}}{d{AnBj}}}Bl}{{{d{ABf}}{d{AnBj}}}Bl}{{{d{ABh}}{d{AnBj}}}Bl}{{{d{ABj}}{d{AnBj}}}Bl}{{{d{ABl}}{d{AnBj}}}Bl}{{{d{ABn}}{d{AnBj}}}Bl}{{{d{AC`}}{d{AnBj}}}Bl}{{{d{ACb}}{d{AnBj}}}Bl}{{{d{ACd}}{d{AnBj}}}Bl}{{{d{ACf}}{d{AnBj}}}Bl}{{{d{ACh}}{d{AnBj}}}Bl}{{{d{ACj}}{d{AnBj}}}Bl}{{{d{ACl}}{d{AnBj}}}Bl}{{{d{ACn}}{d{AnBj}}}Bl}{{{d{AD`}}{d{AnBj}}}Bl}{{{d{ADb}}{d{AnBj}}}Bl}{{{d{ADd}}{d{AnBj}}}Bl}{{{d{ADf}}{d{AnBj}}}Bl}{{{d{ADh}}{d{AnBj}}}Bl}{{{d{ADj}}{d{AnBj}}}Bl}{{{d{ADl}}{d{AnBj}}}Bl}{{{d{ADn}}{d{AnBj}}}Bl}{{{d{AE`}}{d{AnBj}}}Bl}{{{d{AEb}}{d{AnBj}}}Bl}{{{d{AEd}}{d{AnBj}}}Bl}{{{d{AEf}}{d{AnBj}}}Bl}{{{d{AEh}}{d{AnBj}}}Bl}{{{d{AEj}}{d{AnBj}}}Bl}{{{d{AEl}}{d{AnBj}}}Bl}{{{d{Jf}}{d{b}}AFf{d{AnBj}}}Bl}{{{d{AEn}}AFf{d{AnBj}}}Bl}{{{d{Jf}}{d{AFh}}{d{AnAFj}}}h}{{{d{AEn}}{d{AnAFj}}}h}{cc{}}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{{d{b}}G`}{{Eb{{F`{Dl}}}}}}{{dG`}{{Eb{{F`{Dl}}}}}}{JfJh}{{{d{b}}G`}Jl}{{dG`}Jl}2{{{d{b}}Il}{{Eb{{F`{AFl}}}}}}{{dIl}{{Eb{{F`{AFl}}}}}}4{{{d{b}}DhDb}{{F`{{Gj{Il}}}}}}{{dDhDb}{{F`{{Gj{Il}}}}}}6{{{d{AEn}}}d}0{{{d{b}}Jd}{{F`{{Gj{G`}}}}}}{{dJd}{{F`{{Gj{G`}}}}}}9{{{d{b}}DhIn}{{C`{Jd}}}}{{dDhIn}{{C`{Jd}}}};{{{d{b}}Jd}{{Eb{{F`{{Dn{DbG`}}}}}}}}{{dJd}{{Eb{{F`{{Dn{DbG`}}}}}}}}={{K`{d{b}}}{{AFn{K`}}}}{{Kb{d{b}}}{{AFn{Kb}}}}{{Kd{d{b}}}{{AFn{Kd}}}}{{Kf{d{b}}}{{AFn{Kf}}}}{{Kh{d{b}}}{{AFn{Kh}}}}{{Kj{d{b}}}{{AFn{Kj}}}}{{Kl{d{b}}}{{AFn{Kl}}}}{{Kn{d{b}}}{{AFn{Kn}}}}{{L`{d{b}}}{{AFn{L`}}}}{{Lb{d{b}}}{{AFn{Lb}}}}{{Ld{d{b}}}{{AFn{Ld}}}}{{Lf{d{b}}}{{AFn{Lf}}}}{{Lh{d{b}}}{{AFn{Lh}}}}{{Lj{d{b}}}{{AFn{Lj}}}}{{Ll{d{b}}}{{AFn{Ll}}}}{{Ln{d{b}}}{{AFn{Ln}}}}{{M`{d{b}}}{{AFn{M`}}}}{{Mb{d{b}}}{{AFn{Mb}}}}{{Md{d{b}}}{{AFn{Md}}}}{{Mf{d{b}}}{{AFn{Mf}}}}{{Mh{d{b}}}{{AFn{Mh}}}}{{Mj{d{b}}}{{AFn{Mj}}}}{{Ml{d{b}}}{{AFn{Ml}}}}{{Mn{d{b}}}{{AFn{Mn}}}}{{N`{d{b}}}{{AFn{N`}}}}{{Nb{d{b}}}{{AFn{Nb}}}}{{Nd{d{b}}}{{AFn{Nd}}}}{{Nf{d{b}}}{{AFn{Nf}}}}{{Nh{d{b}}}{{AFn{Nh}}}}{{Nj{d{b}}}{{AFn{Nj}}}}{{Nl{d{b}}}{{AFn{Nl}}}}{{Nn{d{b}}}{{AFn{Nn}}}}{{O`{d{b}}}{{AFn{O`}}}}{{Ob{d{b}}}{{AFn{Ob}}}}{{Od{d{b}}}{{AFn{Od}}}}{{Of{d{b}}}{{AFn{Of}}}}{{Oh{d{b}}}{{AFn{Oh}}}}{{Oj{d{b}}}{{AFn{Oj}}}}{{Ol{d{b}}}{{AFn{Ol}}}}{{On{d{b}}}{{AFn{On}}}}{{A@`{d{b}}}{{AFn{A@`}}}}{{A@b{d{b}}}{{AFn{A@b}}}}{{A@d{d{b}}}{{AFn{A@d}}}}{{A@f{d{b}}}{{AFn{A@f}}}}{{A@h{d{b}}}{{AFn{A@h}}}}{{A@j{d{b}}}{{AFn{A@j}}}}{{A@l{d{b}}}{{AFn{A@l}}}}{{A@n{d{b}}}{{AFn{A@n}}}}{{AA`{d{b}}}{{AFn{AA`}}}}{{AAb{d{b}}}{{AFn{AAb}}}}{{AAd{d{b}}}{{AFn{AAd}}}}{{AAf{d{b}}}{{AFn{AAf}}}}{{AAh{d{b}}}{{AFn{AAh}}}}{{AAj{d{b}}}{{AFn{AAj}}}}{{AAl{d{b}}}{{AFn{AAl}}}}{{AAn{d{b}}}{{AFn{AAn}}}}{{AB`{d{b}}}{{AFn{AB`}}}}{{ABb{d{b}}}{{AFn{ABb}}}}{{ABd{d{b}}}{{AFn{ABd}}}}{{ABf{d{b}}}{{AFn{ABf}}}}{{ABh{d{b}}}{{AFn{ABh}}}}{{ABj{d{b}}}{{AFn{ABj}}}}{{ABl{d{b}}}{{AFn{ABl}}}}{{ABn{d{b}}}{{AFn{ABn}}}}{{AC`{d{b}}}{{AFn{AC`}}}}{{ACb{d{b}}}{{AFn{ACb}}}}{{ACd{d{b}}}{{AFn{ACd}}}}{{ACf{d{b}}}{{AFn{ACf}}}}{{ACh{d{b}}}{{AFn{ACh}}}}{{ACj{d{b}}}{{AFn{ACj}}}}{{ACl{d{b}}}{{AFn{ACl}}}}{{ACn{d{b}}}{{AFn{ACn}}}}{{AD`{d{b}}}{{AFn{AD`}}}}{{ADb{d{b}}}{{AFn{ADb}}}}{{ADd{d{b}}}{{AFn{ADd}}}}{{ADf{d{b}}}{{AFn{ADf}}}}{{ADh{d{b}}}{{AFn{ADh}}}}{{ADj{d{b}}}{{AFn{ADj}}}}{{ADl{d{b}}}{{AFn{ADl}}}}{{ADn{d{b}}}{{AFn{ADn}}}}{{AE`{d{b}}}{{AFn{AE`}}}}{{AEb{d{b}}}{{AFn{AEb}}}}{{AEd{d{b}}}{{AFn{AEd}}}}{{AEf{d{b}}}{{AFn{AEf}}}}{{AEh{d{b}}}{{AFn{AEh}}}}{{AEj{d{b}}}{{AFn{AEj}}}}{{AEl{d{b}}}{{AFn{AEl}}}}{{K`{d{Anb}}}{{AG`{K`}}}}{{Kb{d{Anb}}}{{AG`{Kb}}}}{{Kd{d{Anb}}}{{AG`{Kd}}}}{{Kf{d{Anb}}}{{AG`{Kf}}}}{{Kh{d{Anb}}}{{AG`{Kh}}}}{{Kj{d{Anb}}}{{AG`{Kj}}}}{{Kl{d{Anb}}}{{AG`{Kl}}}}{{Kn{d{Anb}}}{{AG`{Kn}}}}{{L`{d{Anb}}}{{AG`{L`}}}}{{Lb{d{Anb}}}{{AG`{Lb}}}}{{Ld{d{Anb}}}{{AG`{Ld}}}}{{Lf{d{Anb}}}{{AG`{Lf}}}}{{Lh{d{Anb}}}{{AG`{Lh}}}}{{Lj{d{Anb}}}{{AG`{Lj}}}}{{Ll{d{Anb}}}{{AG`{Ll}}}}{{Ln{d{Anb}}}{{AG`{Ln}}}}{{M`{d{Anb}}}{{AG`{M`}}}}{{Mb{d{Anb}}}{{AG`{Mb}}}}{{Md{d{Anb}}}{{AG`{Md}}}}{{Mf{d{Anb}}}{{AG`{Mf}}}}{{Mh{d{Anb}}}{{AG`{Mh}}}}{{Mj{d{Anb}}}{{AG`{Mj}}}}{{Ml{d{Anb}}}{{AG`{Ml}}}}{{Mn{d{Anb}}}{{AG`{Mn}}}}{{N`{d{Anb}}}{{AG`{N`}}}}{{Nb{d{Anb}}}{{AG`{Nb}}}}{{Nd{d{Anb}}}{{AG`{Nd}}}}{{Nf{d{Anb}}}{{AG`{Nf}}}}{{Nh{d{Anb}}}{{AG`{Nh}}}}{{Nj{d{Anb}}}{{AG`{Nj}}}}{{Nl{d{Anb}}}{{AG`{Nl}}}}{{Nn{d{Anb}}}{{AG`{Nn}}}}{{O`{d{Anb}}}{{AG`{O`}}}}{{Ob{d{Anb}}}{{AG`{Ob}}}}{{Od{d{Anb}}}{{AG`{Od}}}}{{Of{d{Anb}}}{{AG`{Of}}}}{{Oh{d{Anb}}}{{AG`{Oh}}}}{{Oj{d{Anb}}}{{AG`{Oj}}}}{{Ol{d{Anb}}}{{AG`{Ol}}}}{{On{d{Anb}}}{{AG`{On}}}}{{A@`{d{Anb}}}{{AG`{A@`}}}}{{A@b{d{Anb}}}{{AG`{A@b}}}}{{A@d{d{Anb}}}{{AG`{A@d}}}}{{A@f{d{Anb}}}{{AG`{A@f}}}}{{A@h{d{Anb}}}{{AG`{A@h}}}}{{A@j{d{Anb}}}{{AG`{A@j}}}}{{A@l{d{Anb}}}{{AG`{A@l}}}}{{A@n{d{Anb}}}{{AG`{A@n}}}}{{AA`{d{Anb}}}{{AG`{AA`}}}}{{AAb{d{Anb}}}{{AG`{AAb}}}}{{AAd{d{Anb}}}{{AG`{AAd}}}}{{AAf{d{Anb}}}{{AG`{AAf}}}}{{AAh{d{Anb}}}{{AG`{AAh}}}}{{AAj{d{Anb}}}{{AG`{AAj}}}}{{AAl{d{Anb}}}{{AG`{AAl}}}}{{AAn{d{Anb}}}{{AG`{AAn}}}}{{AB`{d{Anb}}}{{AG`{AB`}}}}{{ABb{d{Anb}}}{{AG`{ABb}}}}{{ABd{d{Anb}}}{{AG`{ABd}}}}{{ABf{d{Anb}}}{{AG`{ABf}}}}{{ABh{d{Anb}}}{{AG`{ABh}}}}{{ABj{d{Anb}}}{{AG`{ABj}}}}{{ABl{d{Anb}}}{{AG`{ABl}}}}{{ABn{d{Anb}}}{{AG`{ABn}}}}{{AC`{d{Anb}}}{{AG`{AC`}}}}{{ACb{d{Anb}}}{{AG`{ACb}}}}{{ACd{d{Anb}}}{{AG`{ACd}}}}{{ACf{d{Anb}}}{{AG`{ACf}}}}{{ACh{d{Anb}}}{{AG`{ACh}}}}{{ACj{d{Anb}}}{{AG`{ACj}}}}{{ACl{d{Anb}}}{{AG`{ACl}}}}{{ACn{d{Anb}}}{{AG`{ACn}}}}{{AD`{d{Anb}}}{{AG`{AD`}}}}{{ADb{d{Anb}}}{{AG`{ADb}}}}{{ADd{d{Anb}}}{{AG`{ADd}}}}{{ADf{d{Anb}}}{{AG`{ADf}}}}{{ADh{d{Anb}}}{{AG`{ADh}}}}{{ADj{d{Anb}}}{{AG`{ADj}}}}{{ADl{d{Anb}}}{{AG`{ADl}}}}{{ADn{d{Anb}}}{{AG`{ADn}}}}{{AE`{d{Anb}}}{{AG`{AE`}}}}{{AEb{d{Anb}}}{{AG`{AEb}}}}{{AEd{d{Anb}}}{{AG`{AEd}}}}{{AEf{d{Anb}}}{{AG`{AEf}}}}{{AEh{d{Anb}}}{{AG`{AEh}}}}{{AEj{d{Anb}}}{{AG`{AEj}}}}{{AEl{d{Anb}}}{{AG`{AEl}}}}{{{d{b}}f}{{F`{{Dn{Dbf}}}}}}{{df}{{F`{{Dn{Dbf}}}}}}{JfJh}{{{d{b}}f}{{F`{{Gj{Gf}}}}}}{{df}{{F`{{Gj{Gf}}}}}}2{{{d{b}}f}{{F`{{Gj{A`}}}}}}{{df}{{F`{{Gj{A`}}}}}}4{{{d{b}}f}{{C`{A`}}}}{{df}{{C`{A`}}}}6{{{d{b}}{F`{AGb}}}AGd}{{d{F`{AGb}}}AGd}8{{{d{b}}{F`{AGf}}}Hn}{{d{F`{AGf}}}Hn}:{{{d{b}}{F`{AGh}}}Jj}{{d{F`{AGh}}}Jj}<{{{d{b}}{F`{AGj}}}AF`}{{d{F`{AGj}}}AF`}>{{{d{b}}{F`{AGl}}}AFb}{{d{F`{AGl}}}AFb}{JfJh}{{dAGn}Gf}{{{d{b}}{F`{AH`}}}G`}{{d{F`{AH`}}}G`}3{{{d{b}}{F`{AHb}}}Il}{{d{F`{AHb}}}Il}5{{{d{b}}{F`{AHd}}}Jd}{{d{F`{AHd}}}Jd}7{{{d{b}}{F`{AHf}}}f}{{d{F`{AHf}}}f}9{{{d{b}}{F`{AHh}}}A`}{{d{F`{AHh}}}A`};{{{d{b}}{F`{AHj}}}AHl}{{d{F`{AHj}}}AHl}={{{d{b}}{F`{AHn}}}AI`}{{d{F`{AHn}}}AI`}?{{{d{b}}{F`{AIb}}}AId}{{d{F`{AIb}}}AId}{JfJh}{{{d{b}}{F`{AIf}}}In}{{d{F`{AIf}}}In}2{{{d{b}}Ff}Dh}{{dFf}Dh}4{{{d{b}}{F`{AIh}}}AIj}{{d{F`{AIh}}}AIj}6{{}c{}}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{{d{b}}AGd}{{F`{AGb}}}}{{dAGd}{{F`{AGb}}}}9{{{d{b}}Hn}{{F`{AGf}}}}{{dHn}{{F`{AGf}}}};{{{d{b}}Jj}{{F`{AGh}}}}{{dJj}{{F`{AGh}}}}={{{d{b}}AF`}{{F`{AGj}}}}{{dAF`}{{F`{AGj}}}}?{{{d{b}}AFb}{{F`{AGl}}}}{{dAFb}{{F`{AGl}}}}{JfJh}{{dGf}AGn}{{{d{b}}G`}{{F`{AH`}}}}{{dG`}{{F`{AH`}}}}3{{{d{b}}Il}{{F`{AHb}}}}{{dIl}{{F`{AHb}}}}5{{{d{b}}Jd}{{F`{AHd}}}}{{dJd}{{F`{AHd}}}}7{{{d{b}}f}{{F`{AHf}}}}{{df}{{F`{AHf}}}}9{{{d{b}}A`}{{F`{AHh}}}}{{dA`}{{F`{AHh}}}};{{{d{b}}AHl}{{F`{AHj}}}}{{dAHl}{{F`{AHj}}}}={{{d{b}}AI`}{{F`{AHn}}}}{{dAI`}{{F`{AHn}}}}?{{{d{b}}AId}{{F`{AIb}}}}{{dAId}{{F`{AIb}}}}{JfJh}{{{d{b}}In}{{F`{AIf}}}}{{dIn}{{F`{AIf}}}}2{{{d{b}}Dh}Ff}{{dDh}Ff}4{{{d{b}}AIj}{{F`{AIh}}}}{{dAIj}{{F`{AIh}}}}6{{{d{Jf}}{d{b}}AFfAIl}Bh}{{{d{AEn}}AFfAIl}Bh}{{{d{b}}A`}{{Eb{{F`{{Gj{Jd}}}}}}}}{{dA`}{{Eb{{F`{{Gj{Jd}}}}}}}}:{{{d{b}}A`}{{F`{{Gj{Gl}}}}}}{{dA`}{{F`{{Gj{Gl}}}}}}<{{{d{b}}AHl}{{Eb{{n{DhJn}}}}}}{{dAHl}{{Eb{{n{DhJn}}}}}}>{{{d{b}}AHl}{{Eb{{n{DdFn}}}}}}{{dAHl}{{Eb{{n{DdFn}}}}}}{JfJh}{{{d{b}}A`}{{F`{{l{AHl}}}}}}{{dA`}{{F`{{l{AHl}}}}}}2{{{d{b}}A`}{{F`{{Gj{Hn}}}}}}{{dA`}{{F`{{Gj{Hn}}}}}}4{{{d{b}}A`}Db}{{dA`}Db}6{{{d{b}}A`}{{Eb{{F`{{Dn{{Cd{InDh}}Jd}}}}}}}}{{dA`}{{Eb{{F`{{Dn{{Cd{InDh}}Jd}}}}}}}}8{{{d{b}}A`}Bh}{{dA`}Bh}:{{{d{b}}A`}{{Eb{{F`{{Dn{DbGl}}}}}}}}{{dA`}{{Eb{{F`{{Dn{DbGl}}}}}}}}<{{{d{b}}A`}{{C`{A`}}}}{{dA`}{{C`{A`}}}}>{{{d{b}}A`}{{Eb{{F`{AIn}}}}}}{{dA`}{{Eb{{F`{AIn}}}}}}{JfJh}{{{d{b}}A`}{{F`{{Gj{AI`}}}}}}{{dA`}{{F`{{Gj{AI`}}}}}}2{{{d{b}}A`}{{F`{{Gj{A`}}}}}}{{dA`}{{F`{{Gj{A`}}}}}}4{{{d{b}}A`}{{l{G`}}}}{{dA`}{{l{G`}}}}6{{{d{b}}A`}{{Eb{{F`{{Dn{Db{Cd{ElGl}}}}}}}}}}{{dA`}{{Eb{{F`{{Dn{Db{Cd{ElGl}}}}}}}}}}8{AJ`Jf}{{{d{AEn}}}{{d{AJb}}}}{{{d{AEn}}}{{d{AFh}}}}{{{d{AnAEn}}}{{d{AnAFh}}}}{{{d{c}}}{{d{{Jh{e}}}}}{}{}}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{{d{c}}{d{{Gj{AFf}}}}{d{e}}}{{C`{g}}}{}{}{}}0000000{{{d{b}}}f}{df}{JfJh}{{{d{An}}Gf{F`{Aj}}}h}{{{d{An}}Gf{F`{Aj}}AJd}h}{{{d{Anb}}f{F`{{Dn{Dbf}}}}}h}{{{d{An}}f{F`{{Dn{Dbf}}}}}h}{{{d{Anb}}f{F`{{Dn{Dbf}}}}AJd}h}{{{d{An}}f{F`{{Dn{Dbf}}}}AJd}h}{{{d{Anb}}f{F`{{Gj{Gf}}}}}h}{{{d{An}}f{F`{{Gj{Gf}}}}}h}{{{d{Anb}}f{F`{{Gj{Gf}}}}AJd}h}{{{d{An}}f{F`{{Gj{Gf}}}}AJd}h}{{{d{Anb}}f}h}{{{d{An}}f}h}{{{d{Anb}}fAJd}h}{{{d{An}}fAJd}h}{{{d{b}}AI`}{{F`{{Gj{AId}}}}}}{{dAI`}{{F`{{Gj{AId}}}}}}{JfJh}{{{d{b}}AI`}{{F`{{Gj{G`}}}}}}{{dAI`}{{F`{{Gj{G`}}}}}}2{{{d{b}}AI`}{{Eb{Jl}}}}{{dAI`}{{Eb{Jl}}}}4{{{d{b}}AI`}{{Eb{{F`{{Dn{DbAId}}}}}}}}{{dAI`}{{Eb{{F`{{Dn{DbAId}}}}}}}}6{{{d{b}}AId}{{Eb{{n{DhJn}}}}}}{{dAId}{{Eb{{n{DhJn}}}}}}8{{{d{b}}AI`}{{Eb{{F`{{Dn{DbG`}}}}}}}}{{dAI`}{{Eb{{F`{{Dn{DbG`}}}}}}}}:{{{d{b}}In}{{F`{{Gj{Il}}}}}}{{dIn}{{F`{{Gj{Il}}}}}}<{{{d{b}}In}{{Eb{{F`{{Dn{DbIl}}}}}}}}{{dIn}{{Eb{{F`{{Dn{DbIl}}}}}}}}>{{{d{b}}InDh}Bh}{{dInDh}Bh}{JfJh}{c{{n{e}}}{}{}}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{}{{n{c}}}{}}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{{d{b}}AIj}{{Eb{{n{DhJn}}}}}}{{dAIj}{{Eb{{n{DhJn}}}}}}4{dCf}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{{d{AEn}}}{{d{AJf}}}}{{{d{AnAEn}}}{{d{AnAJf}}}}```{d{{d{c}}}{}}{{{d{An}}}{{d{Anc}}}{}}{{{d{{AJh{c}}}}c}{{AJh{c}}}{}}{{{d{AJj}}{d{b}}}{{AJh{{d{AJj}}}}}}{{{d{{AJh{c}}}}{d{AnBj}}}BlAJl}{{{d{AJl}}{d{b}}{d{AnBj}}}Bl}{cc{}}{{}c{}}{{{d{b}}c}{{AJh{c}}}{}}{dFh}{c{{n{e}}}{}{}}{{}{{n{c}}}{}}>``````````````````;;;;;;;;::::::::{{{d{Jn}}}Jn}{{{d{Fn}}}Fn}{{d{d{Anc}}}h{}}0{{dBd}h}0{{{d{Aj}}{d{Aj}}ElEl}j}{{{d{Jn}}{d{Jn}}}Bh}{{{d{Fn}}{d{Fn}}}Bh}{{{d{AJn}}{d{AJn}}}Bh}{{{d{AK`}}{d{AK`}}}Bh}{{{d{AKb}}{d{AKb}}}Bh}{{d{d{c}}}Bh{}}0000000000000000000{{cEle}j{{Gn{Fh}}}{{Gn{Fh}}}}{{c{l{E`}}{l{Fh}}}j{{Gn{Fh}}}}{{{d{Jn}}{d{AnBj}}}Bl}{{{d{Hb}}{d{AnBj}}}Bl}{{{d{Fn}}{d{AnBj}}}Bl}{{{d{En}}{d{AnBj}}}Bl}{{{d{AKd}}{d{AnBj}}}Bl}{{{d{AJn}}{d{AnBj}}}Bl}{{{d{AK`}}{d{AnBj}}}Bl}{{{d{AKb}}{d{AnBj}}}Bl}{EnJn}{cc{}}{FnJn}{HbJn}{FnHb}3{AKdHb}{EnHb}{JnHb}{JnFn}{HbFn}{EnFn}999999{{{d{Jn}}{d{Anc}}}hBn}{{{d{Fn}}{d{Anc}}}hBn}{{}c{}}0000000{{{d{Aj}}{d{Aj}}{d{Ef}}{C`{El}}El}j}{DjJn}{DjHb}{DjFn}{{}En}{DjAKd}{{cEl}jAKf}{{El{d{AKf}}}j}{Elj}{dc{}}0{c{{n{e}}}{}{}}0000000{{}{{n{c}}}{}}0000000{{cEleg}j{{Gn{Fh}}}AKfAKf}{dCf}0000000```````````````````````````````````````````````````````````````````{{{d{A`}}{d{b}}}{{F`{{l{AHl}}}}}}{{{d{A`}}{d{b}}}{{l{Hn}}}}{{{d{A`}}{d{b}}}{{l{G`}}}}{{{d{Hn}}{d{b}}}{{F`{{Gj{G`}}}}}}{{{d{AI`}}{d{b}}}{{F`{{Gj{G`}}}}}}{{{d{AF`}}{d{b}}}{{F`{{Gj{G`}}}}}}{{{d{Jd}}{d{b}}}{{F`{{Gj{G`}}}}}}{{{d{In}}{d{b}}}{{F`{{Gj{Il}}}}}}{{{d{A`}}{d{b}}}{{F`{{Gj{Jd}}}}}}{{{d{A`}}{d{b}}}{{F`{{Gj{Gl}}}}}}{{{d{f}}{d{b}}}{{F`{{Gj{A`}}}}}}{{{d{f}}}AKh}{{{d{A`}}}AKh}{{{d{AHl}}}AKh}{{{d{AIj}}}AKh}{{{d{Hn}}}AKh}{{{d{Jj}}}AKh}{{{d{Il}}}AKh}{{{d{G`}}}AKh}{{{d{AI`}}}AKh}{{{d{AId}}}AKh}{{{d{AGd}}}AKh}{{{d{AF`}}}AKh}{{{d{AFb}}}AKh}{{{d{Jd}}}AKh}{{{d{In}}}AKh}{{{d{In}}}AKj}{{{d{Hn}}{d{b}}}Dh}{{{d{AI`}}{d{b}}}Dh}{{AF`{d{b}}}Dh}{{{d{A`}}{d{b}}}{{F`{AIn}}}}{{{d{Jd}}{d{b}}}{{Cl{AKl}}}}{AHjCl}{AIhCl}{AGfCl}{AGhCl}{AHbCl}{AH`Cl}{AHnCl}{AIbCl}{AGbCl}{AGjCl}{AGlCl}{AHdCl}{AIfCl}{{{d{Gl}}{d{b}}}{{l{AGd}}}}{{{d{AId}}{d{b}}}{{l{Db}}}}{{{d{G`}}{d{b}}}{{F`{Dl}}}}{d{{d{c}}}{}}000000000000000000000000000000000000{{{d{An}}}{{d{Anc}}}{}}000000000000000000000000000000000000{{}{{Dn{DbGl}}}}{{{d{Hn}}{d{b}}}{{C`{G`}}}}{{{d{Jd}}{d{b}}DhDh}Bh}{{{d{Gl}}}Gl}{{{d{AKn}}}AKn}{{{d{AHf}}}AHf}{{{d{f}}}f}{{{d{AL`}}}AL`}{{{d{AHh}}}AHh}{{{d{A`}}}A`}{{{d{AHj}}}AHj}{{{d{AHl}}}AHl}{{{d{ALb}}}ALb}{{{d{AIh}}}AIh}{{{d{AIj}}}AIj}{{{d{AGf}}}AGf}{{{d{Hn}}}Hn}{{{d{AGh}}}AGh}{{{d{Jj}}}Jj}{{{d{AHb}}}AHb}{{{d{Il}}}Il}{{{d{AH`}}}AH`}{{{d{G`}}}G`}{{{d{AHn}}}AHn}{{{d{AI`}}}AI`}{{{d{AIb}}}AIb}{{{d{AId}}}AId}{{{d{AGb}}}AGb}{{{d{AGd}}}AGd}{{{d{AGj}}}AGj}{{{d{AF`}}}AF`}{{{d{AGl}}}AGl}{{{d{AFb}}}AFb}{{{d{AFd}}}AFd}{{{d{AHd}}}AHd}{{{d{Jd}}}Jd}{{{d{AIf}}}AIf}{{{d{In}}}In}{{{d{Jl}}}Jl}{{{d{ALd}}}ALd}{{d{d{Anc}}}h{}}000000000000000000000000000000000000{{dBd}h}000000000000000000000000000000000000{{{d{Gl}}{d{Gl}}}Bf}{{{d{f}}{d{f}}}Bf}{{{d{A`}}{d{A`}}}Bf}{{{d{AHl}}{d{AHl}}}Bf}{{{d{ALb}}{d{ALb}}}Bf}{{{d{AIj}}{d{AIj}}}Bf}{{{d{Hn}}{d{Hn}}}Bf}{{{d{Jj}}{d{Jj}}}Bf}{{{d{Il}}{d{Il}}}Bf}{{{d{G`}}{d{G`}}}Bf}{{{d{AI`}}{d{AI`}}}Bf}{{{d{AId}}{d{AId}}}Bf}{{{d{AGd}}{d{AGd}}}Bf}{{{d{AF`}}{d{AF`}}}Bf}{{{d{AFb}}{d{AFb}}}Bf}{{{d{Jd}}{d{Jd}}}Bf}{{{d{In}}{d{In}}}Bf}{{d{d{c}}}Bf{}}0000000000000000{{{d{AHl}}{d{b}}}{{n{DdFn}}}}{{{d{f}}{d{b}}}{{F`{AHf}}}}{{{d{A`}}{d{b}}}{{F`{AHh}}}}{{{d{AHl}}{d{b}}}{{F`{AHj}}}}{{{d{AIj}}{d{b}}}{{F`{AIh}}}}{{{d{Hn}}{d{b}}}{{F`{AGf}}}}{{{d{Jj}}{d{b}}}{{F`{AGh}}}}{{{d{Il}}{d{b}}}{{F`{AHb}}}}{{{d{G`}}{d{b}}}{{F`{AH`}}}}{{{d{AI`}}{d{b}}}{{F`{AHn}}}}{{{d{AId}}{d{b}}}{{F`{AIb}}}}{{AGd{d{b}}}{{F`{AGb}}}}{{AF`{d{b}}}{{F`{AGj}}}}{{AFb{d{b}}}{{F`{AGl}}}}{{{d{Jd}}{d{b}}}{{F`{AHd}}}}{{{d{In}}{d{b}}}{{F`{AIf}}}}{{}AI`}{{}AGd}{{}AF`}{{}Jd}{{}In}{{{d{Gl}}{d{b}}}{{C`{{F`{ALf}}}}}}{{{d{Hn}}{d{b}}}{{F`{ALf}}}}{{{d{G`}}{d{b}}}{{F`{ALf}}}}{{{d{AI`}}{d{b}}}{{F`{ALf}}}}{{AF`{d{b}}}{{F`{ALf}}}}{{{d{f}}{d{b}}}{{l{j}}}}{{{d{A`}}{d{b}}}{{l{j}}}}{{AFb{d{b}}}Ad}{{{d{AFd}}}{{d{Aj}}}}{{{d{Gl}}{d{Gl}}}Bh}{{{d{AKn}}{d{AKn}}}Bh}{{{d{AHf}}{d{AHf}}}Bh}{{{d{f}}{d{f}}}Bh}{{{d{AL`}}{d{AL`}}}Bh}{{{d{AHh}}{d{AHh}}}Bh}{{{d{A`}}{d{A`}}}Bh}{{{d{AHj}}{d{AHj}}}Bh}{{{d{AHl}}{d{AHl}}}Bh}{{{d{ALb}}{d{ALb}}}Bh}{{{d{AIh}}{d{AIh}}}Bh}{{{d{AIj}}{d{AIj}}}Bh}{{{d{AGf}}{d{AGf}}}Bh}{{{d{Hn}}{d{Hn}}}Bh}{{{d{AGh}}{d{AGh}}}Bh}{{{d{Jj}}{d{Jj}}}Bh}{{{d{AHb}}{d{AHb}}}Bh}{{{d{Il}}{d{Il}}}Bh}{{{d{AH`}}{d{AH`}}}Bh}{{{d{G`}}{d{G`}}}Bh}{{{d{AHn}}{d{AHn}}}Bh}{{{d{AI`}}{d{AI`}}}Bh}{{{d{AIb}}{d{AIb}}}Bh}{{{d{AId}}{d{AId}}}Bh}{{{d{AGb}}{d{AGb}}}Bh}{{{d{AGd}}{d{AGd}}}Bh}{{{d{AGj}}{d{AGj}}}Bh}{{{d{AF`}}{d{AF`}}}Bh}{{{d{AGl}}{d{AGl}}}Bh}{{{d{AFb}}{d{AFb}}}Bh}{{{d{AFd}}{d{AFd}}}Bh}{{{d{AHd}}{d{AHd}}}Bh}{{{d{Jd}}{d{Jd}}}Bh}{{{d{AIf}}{d{AIf}}}Bh}{{{d{In}}{d{In}}}Bh}{{{d{Jl}}{d{Jl}}}Bh}{{{d{ALd}}{d{ALd}}}Bh}{{d{d{c}}}Bh{}}000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{{{d{f}}{d{b}}}{{F`{{Dn{Dbf}}}}}}{{{d{AI`}}{d{b}}{d{Aj}}}{{C`{AId}}}}{{{d{AFd}}}Ad}{{{d{Hn}}{d{b}}{d{Aj}}}{{C`{{n{DhJn}}}}}}{{{d{Hn}}{d{b}}}{{F`{{Dn{DbJj}}}}}}{{{d{AI`}}{d{b}}}{{F`{{Dn{DbAId}}}}}}{{{d{A`}}{d{b}}}Db}{{{d{Gl}}{d{AnBj}}}Bl}{{{d{AKn}}{d{AnBj}}}Bl}{{{d{AHf}}{d{AnBj}}}Bl}{{{d{f}}{d{AnBj}}}Bl}{{{d{AL`}}{d{AnBj}}}Bl}{{{d{AHh}}{d{AnBj}}}Bl}{{{d{A`}}{d{AnBj}}}Bl}{{{d{AHj}}{d{AnBj}}}Bl}{{{d{AHl}}{d{AnBj}}}Bl}{{{d{ALb}}{d{AnBj}}}Bl}{{{d{AIh}}{d{AnBj}}}Bl}{{{d{AIj}}{d{AnBj}}}Bl}{{{d{AGf}}{d{AnBj}}}Bl}{{{d{Hn}}{d{AnBj}}}Bl}{{{d{AGh}}{d{AnBj}}}Bl}{{{d{Jj}}{d{AnBj}}}Bl}{{{d{AHb}}{d{AnBj}}}Bl}{{{d{Il}}{d{AnBj}}}Bl}{{{d{AH`}}{d{AnBj}}}Bl}{{{d{G`}}{d{AnBj}}}Bl}{{{d{AHn}}{d{AnBj}}}Bl}{{{d{AI`}}{d{AnBj}}}Bl}{{{d{AIb}}{d{AnBj}}}Bl}{{{d{AId}}{d{AnBj}}}Bl}{{{d{AGb}}{d{AnBj}}}Bl}{{{d{AGd}}{d{AnBj}}}Bl}{{{d{AGj}}{d{AnBj}}}Bl}{{{d{AF`}}{d{AnBj}}}Bl}{{{d{AGl}}{d{AnBj}}}Bl}{{{d{AFb}}{d{AnBj}}}Bl}{{{d{AFd}}{d{AnBj}}}Bl}{{{d{AHd}}{d{AnBj}}}Bl}{{{d{Jd}}{d{AnBj}}}Bl}{{{d{AIf}}{d{AnBj}}}Bl}{{{d{In}}{d{AnBj}}}Bl}{{{d{Jl}}{d{AnBj}}}Bl}{{{d{ALd}}{d{AnBj}}}Bl}{{{d{AFd}}{d{b}}{d{AnBj}}}Bl}{cc{}}000000000000000000000000000000000000{{{d{Anb}}{d{ALh}}}f}{{{d{Anb}}{d{Aj}}AKnALj{d{{Gj{{Cd{ce}}}}}}}f{{ALl{Aj}}}{{ALl{Aj}}}}{AKhf}{AKhA`}{AKhAHl}{AKhAIj}{AKhHn}{AKhJj}{AKhIl}{AKhG`}{AKhAI`}{AKhAId}{AKhAGd}{AKhAF`}{AKhAFb}{AKhJd}{AKhIn}{{{d{Hn}}{d{b}}{d{Aj}}}{{C`{G`}}}}{{{d{Il}}{d{b}}}{{C`{G`}}}}{{{d{AI`}}{d{b}}{d{Aj}}}{{C`{G`}}}}{{{d{AF`}}{d{b}}{d{Aj}}}{{C`{G`}}}}{{{d{Jd}}{d{b}}{d{Aj}}}{{C`{G`}}}}{{{d{In}}{d{b}}{d{Aj}}}{{C`{Il}}}}{{{d{Gl}}{d{b}}{d{Aj}}}{{C`{Il}}}}{{{d{Hn}}{d{b}}}{{F`{{Dn{DbG`}}}}}}{{{d{AI`}}{d{b}}}{{F`{{Dn{DbG`}}}}}}{{{d{AF`}}{d{b}}}{{F`{{Dn{DbG`}}}}}}{{{d{Jd}}{d{b}}}{{F`{{Dn{DbG`}}}}}}{{{d{In}}{d{b}}}{{F`{{Dn{DbIl}}}}}}{{{d{Il}}{d{b}}{d{Aj}}}{{C`{ALn}}}}{{{d{Il}}{d{b}}}{{l{ALn}}}}{{{d{A`}}{d{b}}}{{Dn{DbGl}}}}{{{d{AI`}}{d{b}}}Bh}{{{d{Gl}}{d{Anc}}}hBn}{{{d{AKn}}{d{Anc}}}hBn}{{{d{AHf}}{d{Anc}}}hBn}{{{d{f}}{d{Anc}}}hBn}{{{d{AL`}}{d{Anc}}}hBn}{{{d{AHh}}{d{Anc}}}hBn}{{{d{A`}}{d{Anc}}}hBn}{{{d{AHj}}{d{Anc}}}hBn}{{{d{AHl}}{d{Anc}}}hBn}{{{d{ALb}}{d{Anc}}}hBn}{{{d{AIh}}{d{Anc}}}hBn}{{{d{AIj}}{d{Anc}}}hBn}{{{d{AGf}}{d{Anc}}}hBn}{{{d{Hn}}{d{Anc}}}hBn}{{{d{AGh}}{d{Anc}}}hBn}{{{d{Jj}}{d{Anc}}}hBn}{{{d{AHb}}{d{Anc}}}hBn}{{{d{Il}}{d{Anc}}}hBn}{{{d{AH`}}{d{Anc}}}hBn}{{{d{G`}}{d{Anc}}}hBn}{{{d{AHn}}{d{Anc}}}hBn}{{{d{AI`}}{d{Anc}}}hBn}{{{d{AIb}}{d{Anc}}}hBn}{{{d{AId}}{d{Anc}}}hBn}{{{d{AGb}}{d{Anc}}}hBn}{{{d{AGd}}{d{Anc}}}hBn}{{{d{AGj}}{d{Anc}}}hBn}{{{d{AF`}}{d{Anc}}}hBn}{{{d{AGl}}{d{Anc}}}hBn}{{{d{AFb}}{d{Anc}}}hBn}{{{d{AFd}}{d{Anc}}}hBn}{{{d{AHd}}{d{Anc}}}hBn}{{{d{Jd}}{d{Anc}}}hBn}{{{d{AIf}}{d{Anc}}}hBn}{{{d{In}}{d{Anc}}}hBn}{{{d{A`}}{d{b}}}{{F`{{Dn{{Cd{InDh}}Jd}}}}}}{{{d{A`}}{d{b}}}f}{AHhf}{{{d{Hn}}{d{b}}}{{C`{G`}}}}{{{d{A`}}{d{b}}}{{Dn{DbGl}}}}{{}c{}}000000000000000000000000000000000000{{{d{Gl}}}Bh}{{{d{Il}}{d{b}}}Bh}{{{d{G`}}{d{b}}}Bh}2{{Il{d{b}}}Bh}{{G`{d{b}}}Bh}323{{{d{In}}{d{b}}Dh}Bh}{{{d{A`}}{d{b}}Gl}Bh}{{{d{A`}}{d{b}}}Bh}{{{d{In}}{d{b}}}Bh}1{{{d{AId}}{d{b}}}Bh}8{{{d{Gl}}{d{b}}}Bh}{{{d{AHl}}{d{b}}}Bh}{{{d{ALb}}{d{b}}}Bh}{{{d{AIj}}{d{b}}}Bh}{{{d{Hn}}{d{b}}}Bh}=<{{{d{AI`}}{d{b}}}Bh}6{{AF`{d{b}}}Bh}8{{{d{Jd}}Dh{d{b}}}Bh}{{{d{In}}{d{b}}{d{Aj}}}Bh}{{{d{Gl}}{d{AI`}}}Bh}{{{d{G`}}{d{b}}}Bh}{{{d{Il}}{d{b}}}Bh}{{{d{AFd}}}Bh}2{{{d{Gl}}}{{d{Aj}}}}{{{d{Gl}}{d{b}}}{{F`{{Dn{DbGl}}}}}}{{{d{f}}{d{b}}}{{F`{{Dn{DbGl}}}}}}{{{d{A`}}{d{b}}}{{F`{{Dn{DbGl}}}}}}{{{d{ALb}}{d{b}}}{{F`{{Dn{DbGl}}}}}}{{AFb{d{b}}}{{n{AFdJn}}}}{AHfAKn}{{{d{Gl}}{d{b}}}{{C`{A`}}}}{{{d{AHl}}{d{b}}}A`}{{{d{Hn}}{d{b}}}A`}{{{d{Il}}{d{b}}}A`}{{{d{G`}}{d{b}}}A`}{{{d{AI`}}{d{b}}}A`}{{AGd{d{b}}}A`}{{AF`{d{b}}}A`}{{{d{Jd}}{d{b}}}A`}{{{d{In}}{d{b}}}A`}{AHjA`}{AIhA`}{AGfA`}{AHbA`}{AHnA`}{AGbA`}{AGjA`}{AHdA`}{AIfA`}{{{d{Gl}}{d{b}}}Db}{{{d{f}}{d{b}}}Db}{{{d{A`}}{d{b}}}Db}{{{d{AHl}}{d{b}}}Db}{{{d{ALb}}{d{b}}}Db}{{{d{AIj}}{d{b}}}Db}{{{d{Hn}}{d{b}}}Db}{{{d{Jj}}{d{b}}}Db}{{{d{Il}}{d{b}}}Db}{{{d{G`}}{d{b}}}Db}{{{d{AI`}}{d{b}}}Db}{{{d{AId}}{d{b}}}Db}{{AGd{d{b}}}Db}{{AF`{d{b}}}Db}{{AFb{d{b}}}Db}{{{d{Jd}}{d{b}}}Db}{{{d{In}}{d{b}}}Db}{AHfDb}{AHhDb}{AGfDb}{{{d{Gl}}{d{b}}}{{C`{El}}}}{{{d{AHl}}{d{b}}}El}{{{d{ALb}}{d{b}}}{{C`{El}}}}{{{d{AIj}}{d{b}}}El}{{{d{Hn}}{d{b}}}El}{{{d{Il}}{d{b}}}El}{{{d{G`}}{d{b}}}El}{{{d{AI`}}{d{b}}}El}{{AF`{d{b}}}El}{{{d{In}}{d{b}}}El}?{{{d{b}}{d{Aj}}AL`f}A`}{{{d{b}}{d{{Cl{AM`}}}}{C`{Gl}}A`}AH`}{{{d{Anb}}{d{Aj}}{d{Aj}}}A`}{{{d{AHl}}{d{b}}}AMb}{{{d{A`}}{d{b}}}{{Dn{DbGl}}}}{{{d{Gl}}{d{b}}}{{C`{Gl}}}}{{{d{A`}}{d{b}}}Gl}{{{d{AHl}}{d{b}}}Gl}{{{d{ALb}}{d{b}}}{{C`{Gl}}}}{{{d{AIj}}{d{b}}}Gl}{{{d{Hn}}{d{b}}}Gl}{{{d{Il}}{d{b}}}Gl}{{{d{G`}}{d{b}}}Gl}{{{d{AI`}}{d{b}}}Gl}{{AGd{d{b}}}Gl}{{AF`{d{b}}}Gl}{{AFb{d{b}}}AF`}{{{d{Jd}}{d{b}}}Gl}{{{d{In}}{d{b}}}Gl}{AGhHn}{AHbC`}{AIbAI`}{AGlAF`}{{{d{A`}}{d{b}}}{{C`{A`}}}}{{{d{Gl}}{d{Gl}}}{{C`{Bf}}}}{{{d{f}}{d{f}}}{{C`{Bf}}}}{{{d{A`}}{d{A`}}}{{C`{Bf}}}}{{{d{AHl}}{d{AHl}}}{{C`{Bf}}}}{{{d{ALb}}{d{ALb}}}{{C`{Bf}}}}{{{d{AIj}}{d{AIj}}}{{C`{Bf}}}}{{{d{Hn}}{d{Hn}}}{{C`{Bf}}}}{{{d{Jj}}{d{Jj}}}{{C`{Bf}}}}{{{d{Il}}{d{Il}}}{{C`{Bf}}}}{{{d{G`}}{d{G`}}}{{C`{Bf}}}}{{{d{AI`}}{d{AI`}}}{{C`{Bf}}}}{{{d{AId}}{d{AId}}}{{C`{Bf}}}}{{{d{AGd}}{d{AGd}}}{{C`{Bf}}}}{{{d{AF`}}{d{AF`}}}{{C`{Bf}}}}{{{d{AFb}}{d{AFb}}}{{C`{Bf}}}}{{{d{Jd}}{d{Jd}}}{{C`{Bf}}}}{{{d{In}}{d{In}}}{{C`{Bf}}}}{{{d{Gl}}{d{b}}}{{F`{{Gj{Db}}}}}}{{{d{Il}}{d{b}}}{{C`{El}}}}{{{d{Hn}}{d{b}}}{{F`{{Dn{DbG`}}}}}}{{{d{AnHd}}{d{j}}}h}{{{d{AnHd}}c}h{{AMf{}{{AMd{{d{j}}}}}}}}{{{d{Jd}}{d{b}}}Dh}{AHdDh}{{{d{A`}}{d{b}}{d{Aj}}}{{n{{C`{AHl}}En}}}}{{{d{A`}}{d{b}}{d{Aj}}}{{n{{C`{Ef}}En}}}}{{{d{Hn}}{d{b}}{d{Aj}}}{{n{{C`{Ef}}En}}}}{{{d{A`}}{d{b}}{d{H`}}}{{Eb{{C`{Ef}}}}}}00{{{d{Gl}}{d{b}}{d{{Gj{{Cl{Db}}}}}}}{{Eb{{C`{Ef}}}}}}{{{d{f}}{d{b}}}{{C`{A`}}}}{{{d{Hn}}{d{b}}}{{F`{ALf}}}}{{{d{Il}}{d{b}}}{{C`{Gl}}}}={{{d{G`}}{d{b}}}{{C`{El}}}}{{{d{Il}}{d{b}}}{{C`{Dh}}}}{{{d{G`}}{d{b}}}{{C`{Dh}}}}{{{d{G`}}{d{b}}}Il}{AH`Il}{{{d{Il}}{d{b}}}{{F`{AFl}}}}{{{d{G`}}{d{b}}}{{F`{AFl}}}}{{{d{Gl}}{d{b}}{d{Anc}}}hHd}{{{d{f}}{d{b}}{d{Anc}}}hHd}{{{d{A`}}{d{b}}{d{Anc}}}hHd}{{{d{AHl}}{d{b}}{d{Anc}}}hHd}{{{d{ALb}}{d{b}}{d{Anc}}}hHd}{{{d{AIj}}{d{b}}{d{Anc}}}hHd}{{{d{Hn}}{d{b}}{d{Anc}}}hHd}{{{d{Jj}}{d{b}}{d{Anc}}}hHd}{{{d{Il}}{d{b}}{d{Anc}}}hHd}{{{d{G`}}{d{b}}{d{Anc}}}hHd}{{{d{AI`}}{d{b}}{d{Anc}}}hHd}{{{d{AId}}{d{b}}{d{Anc}}}hHd}{{AF`{d{b}}{d{Anc}}}hHd}{{AFb{d{b}}{d{Anc}}}hHd}{{{d{Jd}}{d{b}}{d{Anc}}}hHd}{{{d{In}}{d{b}}{d{Anc}}}hHd}>{AHhAL`}{{{d{AHl}}{d{b}}}El}{{{d{AIj}}{d{b}}}El}{{{d{Hn}}{d{b}}}El}{{{d{G`}}{d{b}}}El}{{{d{AI`}}{d{b}}}El}{{{d{AId}}{d{b}}}El}{{AGd{d{b}}}El}{{AF`{d{b}}}El}{{AFb{d{b}}}El}{{{d{Jd}}{d{b}}}El}{{{d{In}}{d{b}}}El}{AHfDb}{{{d{Anb}}}f}{{{d{A`}}{d{b}}}{{F`{{Gj{A`}}}}}}{AGlAd}{{{d{Il}}{d{b}}}Bh}{{{d{G`}}{d{b}}}Bh}{{{d{A`}}{d{b}}}{{l{G`}}}}{dc{}}000000000000000000000000000000000000{{{d{Jd}}{d{b}}}In}{AHdIn}{c{{n{e}}}{}{}}000000000000000000000000000000000000{{}{{n{c}}}{}}000000000000000000000000000000000000{{{d{AHl}}{d{b}}}{{n{DhJn}}}}{{{d{ALb}}{d{b}}}{{n{FfJn}}}}{{{d{Jj}}{d{b}}}{{n{DhJn}}}}{{{d{AId}}{d{b}}}{{n{DhJn}}}}{dCf}00000000{{{d{ALb}}{d{b}}}{{n{DhJn}}}}111{{{d{AIj}}{d{b}}}{{n{DhJn}}}}2222222222222222222222222{{{d{Il}}{d{b}}}{{C`{El}}}}{{{d{G`}}{d{b}}}{{C`{El}}}}{{{d{A`}}{d{b}}}{{F`{{Dn{Db{Cd{ElGl}}}}}}}}{{{d{AHl}}{d{b}}}Cj}{{AF`{d{b}}{d{Aj}}}{{C`{AFb}}}}{{AF`{d{b}}}{{F`{{Dn{DbAFb}}}}}}{{{d{ALf}}Glc}h{{AFj{Gl}}}}``````````{{{d{AMh}}{d{{Cl{Cj}}}}Cn}h}{{{d{AMj}}{d{{Cl{Cj}}}}Cn}h}{{{d{AMl}}{d{{Cl{Cj}}}}Cn}h}{{{d{AMh}}{d{{Cl{Db}}}}{d{{Cl{Cj}}}}Dd}h}{{{d{AMj}}{d{{Cl{Db}}}}{d{{Cl{Cj}}}}Dd}h}{{{d{AMl}}{d{{Cl{Db}}}}{d{{Cl{Cj}}}}Dd}h}{{{d{AMh}}j}h}{{{d{AMj}}j}h}{{{d{AMl}}j}h}{{{d{AMh}}{d{{Cl{Cj}}}}Df}h}{{{d{AMj}}{d{{Cl{Cj}}}}Df}h}{{{d{AMl}}{d{{Cl{Cj}}}}Df}h}{{{d{AnAMl}}{d{Aj}}DhBhEl}{{n{hAKd}}}}{AMjFb}{d{{d{c}}}{}}000{{{d{An}}}{{d{Anc}}}{}}000{{{d{Ch}}{d{Ef}}El}h}{{{d{Gd}}}Gd}{{d{d{Anc}}}h{}}{{dBd}h}{AMlFb}{{{d{AMh}}{d{Db}}El}{{n{{C`{Dd}}En}}}}{{{d{AMj}}{d{Db}}El}{{n{{C`{Dd}}En}}}}{{{d{AMl}}{d{Db}}El}{{n{{C`{Dd}}En}}}}{{{d{AMh}}}{{d{b}}}}{{{d{AMj}}}{{d{b}}}}{{{d{AMl}}}{{d{b}}}}{AMjd}{AMhFb}?{{{d{Gd}}{d{Gd}}}Bh}{{d{d{c}}}Bh{}}000{{{d{AMh}}{d{{Cl{Cj}}}}}Ff}{{{d{AMj}}{d{{Cl{Cj}}}}}Ff}{{{d{AMl}}{d{{Cl{Cj}}}}}Ff}{{{d{Gd}}{d{AnBj}}}Bl}{cc{}}000{AMjG`}{{{d{AMj}}}{{n{DhJn}}}}{{{d{AMh}}{d{{Cl{Cj}}}}}{{C`{Cn}}}}{{{d{AMj}}{d{{Cl{Cj}}}}}{{C`{Cn}}}}{{{d{AMl}}{d{{Cl{Cj}}}}}{{C`{Cn}}}}{{{d{AMh}}}{{C`{Dh}}}}{{{d{AMj}}}{{C`{Dh}}}}{{{d{AMl}}}{{C`{Dh}}}}{{{d{AMh}}Gd}Bh}{{{d{AMj}}Gd}Bh}{{{d{AMl}}Gd}Bh}{{}c{}}000{{{d{AMh}}}Bh}{{{d{AMj}}}Bh}{{{d{AMl}}}Bh}{{{d{AMj}}{d{{Cl{AMn}}}}AN`}h}{{{d{AMj}}{d{{Cl{c}}}}Dh}h{}}{{{d{AMh}}}A`}{{{d{AMj}}}A`}{{{d{AMl}}}A`}{{{d{b}}A`}AMh}{{{d{b}}G`}AMj}{{{d{AMj}}Gd}AMl}{{{d{AMl}}Gd}AMl}{{{d{AMh}}}Gl}{{{d{AMj}}}Gl}{{{d{AMl}}}Gl}{AMlC`}{{{d{AMh}}}G`}{{{d{AMj}}}G`}{{{d{AMl}}}G`}{{{d{AMh}}{d{H`}}}{{C`{Ef}}}}{{{d{AMj}}{d{H`}}}{{C`{Ef}}}}{{{d{AMl}}{d{H`}}}{{C`{Ef}}}}{{{d{AMh}}{d{Aj}}El}{{n{{C`{Ef}}En}}}}{{{d{AMj}}{d{Aj}}El}{{n{{C`{Ef}}En}}}}{{{d{AMl}}{d{Aj}}El}{{n{{C`{Ef}}En}}}}{{{d{AMh}}{d{H`}}El}{{n{EfHb}}}}{{{d{AMj}}{d{H`}}El}{{n{EfHb}}}}{{{d{AMl}}{d{H`}}El}{{n{EfHb}}}}876{AMld}{dc{}}{c{{n{e}}}{}{}}000{{}{{n{c}}}{}}000{AMlGd}{dCf}000{{{d{AMh}}{d{{Cl{Cj}}}}{d{Hj}}}h}{{{d{AMj}}{d{{Cl{Cj}}}}{d{Hj}}}h}{{{d{AMl}}{d{{Cl{Cj}}}}{d{Hj}}}h}{AMlANb}`````````````````````````````````````````````````````````{{}Cb}````{{}Ff}{{{d{b}}}Dh}{{}ANd}{{{d{ANf}}{d{b}}{d{{Gj{ANh}}}}}{{C`{Dh}}}}{{{d{ANj}}{d{b}}}{{C`{ANl}}}}{{{d{Dh}}{d{b}}}{{C`{ANl}}}}{{{d{ANj}}{d{b}}}{{C`{ANn}}}}{{{d{Dh}}{d{b}}}{{C`{ANn}}}}{{{d{Dh}}}AKh}{{{d{ANj}}{d{b}}}{{C`{AO`}}}}{{{d{Dh}}{d{b}}}{{C`{AO`}}}}{{{d{ANn}}}{{d{Aj}}}}{{{d{ANf}}}{{d{Aj}}}}{{{d{ANj}}{d{b}}}{{C`{AOb}}}}{{{d{Dh}}{d{b}}}{{C`{AOb}}}}{{{d{Dh}}{d{b}}}{{C`{AI`}}}}{{{d{Dh}}}AKj}{{{d{ANj}}{d{b}}}{{C`{AOd}}}}{{{d{Dh}}{d{b}}}{{C`{AOd}}}}{{{d{b}}Cb}Dh}{{{d{ANn}}}Ad}{{}Ff}{{{d{b}}}Dh}{d{{d{c}}}{}}0000000000000000000{{{d{An}}}{{d{Anc}}}{}}0000000000000000000{IfF`}{{{d{ANn}}ANn}Bh}{{{d{Ff}}}Ff}{{{d{AKj}}}AKj}{{{d{Dh}}}Dh}{{{d{Cb}}}Cb}{{{d{AOf}}}AOf}{{{d{ANn}}}ANn}{{{d{ANl}}}ANl}{{{d{AO`}}}AO`}{{{d{If}}}If}{{{d{AOd}}}AOd}{{{d{AOb}}}AOb}{{{d{AFl}}}AFl}{{{d{AOh}}}AOh}{{{d{AOj}}}AOj}{{{d{AOl}}}AOl}{{{d{ANf}}}ANf}{{{d{AOn}}}AOn}{{{d{B@`}}}B@`}{{{d{ANh}}}ANh}{{d{d{Anc}}}h{}}000000000000000000{{dBd}h}000000000000000000{{{d{Dh}}{d{Dh}}}Bf}{{{d{Cb}}{d{Cb}}}Bf}{{{d{ANn}}{d{ANn}}}Bf}{{{d{If}}{d{If}}}Bf}{{{d{AOb}}{d{AOb}}}Bf}{{{d{ANf}}{d{ANf}}}Bf}{{d{d{c}}}Bf{}}00000{AFlC`}{{{d{Ff}}{d{Ch}}}{{C`{El}}}}{{}Dh}{{Dh{d{b}}}Dh}{{{d{Dh}}{d{b}}}Ff}{{{d{Ff}}{d{Ff}}}Bh}{{{d{AKj}}{d{AKj}}}Bh}{{{d{Dh}}{d{Dh}}}Bh}{{{d{Cb}}{d{Cb}}}Bh}{{{d{ANn}}{d{ANn}}}Bh}{{{d{ANl}}{d{ANl}}}Bh}{{{d{AO`}}{d{AO`}}}Bh}{{{d{If}}{d{If}}}Bh}{{{d{AOd}}{d{AOd}}}Bh}{{{d{AOb}}{d{AOb}}}Bh}{{{d{AFl}}{d{AFl}}}Bh}{{{d{AOh}}{d{AOh}}}Bh}{{{d{AOj}}{d{AOj}}}Bh}{{{d{AOl}}{d{AOl}}}Bh}{{{d{ANf}}{d{ANf}}}Bh}{{{d{B@`}}{d{B@`}}}Bh}{{{d{ANh}}{d{ANh}}}Bh}{{d{d{c}}}Bh{}}0000000000000000000000000000000000000000000000000000000000000000000{{{d{ANn}}ANd}Bh}{{{d{Ff}}{d{AnBj}}}Bl}{{{d{AKj}}{d{AnBj}}}Bl}{{{d{Dh}}{d{AnBj}}}Bl}{{{d{Cb}}{d{AnBj}}}Bl}0{{{d{ANn}}{d{AnBj}}}Bl}0{{{d{ANl}}{d{AnBj}}}Bl}{{{d{AO`}}{d{AnBj}}}Bl}{{{d{If}}{d{AnBj}}}Bl}0{{{d{AOd}}{d{AnBj}}}Bl}{{{d{AOb}}{d{AnBj}}}Bl}0{{{d{AFl}}{d{AnBj}}}Bl}{{{d{AOh}}{d{AnBj}}}Bl}{{{d{AOj}}{d{AnBj}}}Bl}{{{d{AOl}}{d{AnBj}}}Bl}{{{d{ANf}}{d{AnBj}}}Bl}{{{d{B@`}}{d{AnBj}}}Bl}{{{d{ANh}}{d{AnBj}}}Bl}{{{d{Ff}}{d{b}}{d{AnBj}}}Bl}{{{d{Dh}}{d{b}}{d{AnBj}}}Bl}{{{d{AFl}}{d{b}}{d{AnBj}}}Bl}{cc{}}{CbFf}1111111111111111111{AKhDh}{{{d{Aj}}}{{n{Cbc}}}{}}{{{d{Aj}}}{{n{ANnc}}}{}}{{{d{Aj}}}{{n{ANfc}}}{}}{{{d{Dh}}{d{b}}{d{Aj}}}{{C`{Il}}}}{{{d{Dh}}{d{b}}{d{Aj}}}{{F`{{Gj{Il}}}}}}{{{d{Dh}}{d{b}}In}{{C`{Jd}}}}{{{d{Ff}}{d{b}}}Bh}{{{d{Dh}}{d{b}}}Bh}{{{d{Ff}}{d{Anc}}}hBn}{{{d{AKj}}{d{Anc}}}hBn}{{{d{Dh}}{d{Anc}}}hBn}{{{d{Cb}}{d{Anc}}}hBn}{{{d{ANn}}{d{Anc}}}hBn}{{{d{ANl}}{d{Anc}}}hBn}{{{d{AO`}}{d{Anc}}}hBn}{{{d{If}}{d{Anc}}}hBn}{{{d{AOd}}{d{Anc}}}hBn}{{{d{AOb}}{d{Anc}}}hBn}{{{d{AFl}}{d{Anc}}}hBn}{{{d{AOh}}{d{Anc}}}hBn}{{{d{AOj}}{d{Anc}}}hBn}{{{d{AOl}}{d{Anc}}}hBn}{{{d{ANf}}{d{Anc}}}hBn}{{{d{B@`}}{d{Anc}}}hBn}{{{d{ANh}}{d{Anc}}}hBn}{{}ANd}0{{{d{Ff}}{d{b}}}Dh}{ANlDh}{ANnFf}{{{d{b}}ANn}Dh}{{}c{}}0000000000000000000{{}c{}}0{{{d{Dh}}{d{b}}}Bh}0{{Dh{d{b}}}Bh}{{Dh{d{b}}}{{n{BhJn}}}}2222{{{d{AOh}}}Bh}33{{{d{ANn}}}Bh}444{{{d{Ff}}}Bh}{AOdF`}{{}AOf}{{}AOn}{AO`Dh}{B@bB@`}{{{d{Dh}}{d{b}}}{{d{Aj}}}}{{{d{AOl}}}{{C`{{d{Aj}}}}}}{{{d{AOf}}}Ad}{{{d{AOn}}}Ad}{{{d{B@d}}}Fh}{{Dh{d{b}}}Dh}{AObAd}{{{d{ANn}}}ANd}0{AOhC`}{AOjC`}{{{d{Ff}}{d{b}}}Db}{{{d{Dh}}{d{b}}}Db}{{{d{Cb}}}Db}{{{d{ANf}}}Db}{B@bDb}{IfDb}{AOlDb}{{{C`{{d{Aj}}}}{d{Aj}}{n{DhJn}}}AOl}{{{d{AnAOf}}}{{C`{c}}}{}}{{{d{AnAOn}}}{{C`{c}}}{}}10{{{d{AnAOf}}Ad}{{C`{c}}}{}}{{{d{AnAOn}}Ad}{{C`{c}}}{}}{{{d{ANf}}}{{l{B@b}}}}{AFll}{{{d{Dh}}{d{Dh}}}{{C`{Bf}}}}{{{d{Cb}}{d{Cb}}}{{C`{Bf}}}}{{{d{ANn}}{d{ANn}}}{{C`{Bf}}}}{{{d{If}}{d{If}}}{{C`{Bf}}}}{{{d{AOb}}{d{AOb}}}{{C`{Bf}}}}{{{d{ANf}}{d{ANf}}}{{C`{Bf}}}}{AFln}{AFlC`}{{{d{Dh}}{d{b}}{d{Aj}}}{{C`{Il}}}}{{{d{ANn}}}Ad}{ANlAd}{{{d{AOf}}}{{Cd{Ad{C`{Ad}}}}}}{{{d{AOn}}}{{Cd{Ad{C`{Ad}}}}}}{AOhEl}{AOjEl}{dc{}}000000000000000000{dFh}000{{{d{Dh}}{d{AnCh}}{d{Aj}}}{{Cd{{l{{Cd{G`Jd}}}}{l{{Cd{G`Jd}}}}}}}}{c{{n{e}}}{}{}}00000{{{d{Aj}}}{{n{ANnc}}}{}}11111111111{{{d{Aj}}}{{n{ANfc}}}{}}222{{}{{n{c}}}{}}0000000000000000000{{{d{b}}{d{{Gj{Dh}}}}}Dh}{{{d{Dh}}{d{b}}}Ff}{AOln}{dCf}0000000000000000000{{}Ff}{{}Cb}{{}ANd}022{{{d{b}}}Dh}{AO`Dh}```````````````{{{d{B@f}}{d{b}}}Ad}{d{{d{c}}}{}}000000{{{d{An}}}{{d{Anc}}}{}}000000{{{d{AN`}}}AN`}{{{d{B@h}}}B@h}{{{d{B@j}}}B@j}{{{d{B@f}}}B@f}{{{d{B@l}}}B@l}{{{d{B@n}}}B@n}{{{d{BA`}}}BA`}{{d{d{Anc}}}h{}}000000{{dBd}h}000000{{{d{BA`}}Ad}{{l{B@f}}}}{{{d{B@j}}}{{l{B@f}}}}{{{d{b}}Dh}B@n}{{{d{b}}B@f}B@j}{{{d{AN`}}{d{b}}}AN`}{{{d{BA`}}{d{b}}}{{l{BA`}}}}{{{d{B@n}}{d{B@n}}}B@n}{{{d{AN`}}{d{AN`}}}Bh}{{{d{B@h}}{d{B@h}}}Bh}{{{d{B@j}}{d{B@j}}}Bh}{{{d{B@f}}{d{B@f}}}Bh}{{{d{B@l}}{d{B@l}}}Bh}{{{d{B@n}}{d{B@n}}}Bh}{{{d{BA`}}{d{BA`}}}Bh}{{d{d{c}}}Bh{}}000000000000000000000000000{{{d{B@f}}{d{b}}}{{l{Dh}}}}{{{d{AN`}}{d{b}}}{{C`{{l{B@h}}}}}}{{{d{AN`}}{d{AnBj}}}Bl}{{{d{B@h}}{d{AnBj}}}Bl}{{{d{B@j}}{d{AnBj}}}Bl}{{{d{B@f}}{d{AnBj}}}Bl}{{{d{B@l}}{d{AnBj}}}Bl}{{{d{B@n}}{d{AnBj}}}Bl}{{{d{BA`}}{d{AnBj}}}Bl}{{{d{B@h}}{d{b}}{d{AnBj}}}Bl}{cc{}}000000{{{d{AMl}}{d{{Gj{{Cl{BAb}}}}}}Dh}AN`}{{cAd}B@n{{AMf{}{{AMd{{d{BA`}}}}}}}}{{{d{B@f}}{d{Anc}}}hBn}{{{d{B@l}}{d{Anc}}}hBn}{{{d{BA`}}}{{C`{{d{B@h}}}}}}{BA`l}{{}c{}}000000{B@nc{}}{AN`{{l{BA`}}}}{{{d{B@n}}{d{b}}}Bh}{{{d{B@n}}}Bh}{{{d{BA`}}}Bh}{{{d{AN`}}{d{b}}Ad}Bh}{{{d{B@h}}}Bh}{{{d{B@n}}}{{`{{AMf{}{{AMd{{d{B@f}}}}}}}}}}{B@hB@j}{{{d{B@n}}}Ad}{{{d{BA`}}}Ad}{{{d{AN`}}}Ad}{{{l{BA`}}}AN`}{{B@jDh}B@h}{{{l{B@h}}}BA`}3{{{d{BA`}}}{{d{{Gj{B@h}}}}}}{{{d{AN`}}{d{b}}B@f}AN`}{{{d{BA`}}{d{b}}B@f}{{l{BA`}}}}{{{d{AN`}}}{{d{{Gj{BA`}}}}}}{{{d{AN`}}}B@n}{{{d{AnBA`}}AdAd}h}{{{d{AnAN`}}AdAd}h}{dc{}}000000{c{{n{e}}}{}{}}000000{{}{{n{c}}}{}}000000{{{d{B@f}}{d{b}}}Dh}{B@hDh}{dCf}000000{{{C`{{Cd{DbAd}}}}Dh}B@h}{BAdl}{BAdB@f}","D":"EAd","p":[[10,"AnalyzerDb",552],[1,"reference",null,null,1],[5,"IngotId",2222],[1,"unit"],[5,"Diagnostic",4168],[5,"Vec",4169],[6,"Result",4170,null,1],[5,"ModuleId",2222],[6,"ContractTypeMethod",12],[1,"usize"],[6,"Intrinsic",12],[6,"ValueMethod",12],[1,"str"],[6,"GlobalFunction",12],[0,"mut"],[5,"GlobalFunctionIter",12],[5,"IntrinsicIter",12],[1,"u8"],[6,"Ordering",4171],[1,"bool"],[5,"Formatter",4172],[8,"Result",4172],[10,"Hasher",4173],[6,"Option",4174,null,1],[6,"Base",3443],[1,"tuple",null,null,1],[5,"TypeId",4175],[10,"AnalyzerContext",231],[6,"Expr",4176],[5,"Node",4177],[6,"CallType",231],[5,"TempContext",231],[5,"SmolStr",4178],[6,"Constant",231],[5,"ExpressionAttributes",231],[5,"TypeId",3443],[5,"DiagnosticVoucher",231],[5,"FunctionBody",231],[5,"IndexMap",4179],[5,"Label",231,4168],[5,"Analysis",231],[10,"Clone",4180],[6,"NamedThing",231],[5,"Adjustment",231],[6,"AdjustmentKind",231],[5,"Span",4181],[5,"IncompleteItem",2079],[5,"Rc",4182,null,1],[5,"RefCell",4183],[10,"PartialEq",4171],[6,"Type",3443],[5,"String",4184],[5,"Error",4172],[10,"Debug",4172],[5,"ConstEvalError",2079],[5,"FunctionId",2222],[10,"Hash",4173],[6,"BlockScopeType",3319],[5,"SourceFileId",4185],[5,"Label",4186],[1,"slice"],[6,"Item",2222],[10,"Into",4187,null,1],[5,"Path",4176],[5,"FatalError",2079],[10,"DiagnosticSink",2222],[5,"HashMap",4188],[6,"LabelStyle",4168],[10,"Fn",4189],[15,"BuiltinAssociatedFunction",532],[5,"ContractId",2222],[15,"External",532],[15,"AssociatedFunction",532],[15,"TraitValueMethod",532],[5,"Generic",3443],[15,"BuiltinValueMethod",532],[15,"ValueMethod",532],[5,"FunctionSigId",2222],[5,"TraitId",2222],[15,"SelfValue",545],[15,"Variable",545],[5,"ImplId",2222],[5,"AnalyzerDbGroupStorage__",552],[5,"Arc",4190,null,1],[5,"ContractFieldId",2222],[5,"DepGraphWrapper",2222],[5,"TypeError",2079],[5,"InternIngotQuery",552],[5,"InternIngotLookupQuery",552],[5,"InternModuleQuery",552],[5,"InternModuleLookupQuery",552],[5,"InternModuleConstQuery",552],[5,"InternModuleConstLookupQuery",552],[5,"InternStructQuery",552],[5,"InternStructLookupQuery",552],[5,"InternStructFieldQuery",552],[5,"InternStructFieldLookupQuery",552],[5,"InternEnumQuery",552],[5,"InternEnumLookupQuery",552],[5,"InternAttributeQuery",552],[5,"InternAttributeLookupQuery",552],[5,"InternEnumVariantQuery",552],[5,"InternEnumVariantLookupQuery",552],[5,"InternTraitQuery",552],[5,"InternTraitLookupQuery",552],[5,"InternImplQuery",552],[5,"InternImplLookupQuery",552],[5,"InternTypeAliasQuery",552],[5,"InternTypeAliasLookupQuery",552],[5,"InternContractQuery",552],[5,"InternContractLookupQuery",552],[5,"InternContractFieldQuery",552],[5,"InternContractFieldLookupQuery",552],[5,"InternFunctionSigQuery",552],[5,"InternFunctionSigLookupQuery",552],[5,"InternFunctionQuery",552],[5,"InternFunctionLookupQuery",552],[5,"InternTypeQuery",552],[5,"InternTypeLookupQuery",552],[5,"IngotFilesQuery",552],[5,"IngotExternalIngotsQuery",552],[5,"RootIngotQuery",552],[5,"IngotModulesQuery",552],[5,"IngotRootModuleQuery",552],[5,"ModuleFilePathQuery",552],[5,"ModuleParseQuery",552],[5,"ModuleIsIncompleteQuery",552],[5,"ModuleAllItemsQuery",552],[5,"ModuleAllImplsQuery",552],[5,"ModuleItemMapQuery",552],[5,"ModuleImplMapQuery",552],[5,"ModuleContractsQuery",552],[5,"ModuleStructsQuery",552],[5,"ModuleConstantsQuery",552],[5,"ModuleUsedItemMapQuery",552],[5,"ModuleParentModuleQuery",552],[5,"ModuleSubmodulesQuery",552],[5,"ModuleTestsQuery",552],[5,"ModuleConstantTypeQuery",552],[5,"ModuleConstantValueQuery",552],[5,"ContractAllFunctionsQuery",552],[5,"ContractFunctionMapQuery",552],[5,"ContractPublicFunctionMapQuery",552],[5,"ContractInitFunctionQuery",552],[5,"ContractCallFunctionQuery",552],[5,"ContractAllFieldsQuery",552],[5,"ContractFieldMapQuery",552],[5,"ContractFieldTypeQuery",552],[5,"ContractDependencyGraphQuery",552],[5,"ContractRuntimeDependencyGraphQuery",552],[5,"FunctionSignatureQuery",552],[5,"FunctionBodyQuery",552],[5,"FunctionDependencyGraphQuery",552],[5,"StructAllFieldsQuery",552],[5,"StructFieldMapQuery",552],[5,"StructFieldTypeQuery",552],[5,"StructAllFunctionsQuery",552],[5,"StructFunctionMapQuery",552],[5,"StructDependencyGraphQuery",552],[5,"EnumAllVariantsQuery",552],[5,"EnumVariantMapQuery",552],[5,"EnumAllFunctionsQuery",552],[5,"EnumFunctionMapQuery",552],[5,"EnumDependencyGraphQuery",552],[5,"EnumVariantKindQuery",552],[5,"TraitAllFunctionsQuery",552],[5,"TraitFunctionMapQuery",552],[5,"TraitIsImplementedForQuery",552],[5,"ImplAllFunctionsQuery",552],[5,"ImplFunctionMapQuery",552],[5,"AllImplsQuery",552],[5,"ImplForQuery",552],[5,"FunctionSigsQuery",552],[5,"TypeAliasTypeQuery",552],[5,"TestDb",552],[5,"EnumId",2222],[5,"EnumVariantId",2222],[6,"EnumVariantKind",2222],[5,"DatabaseKeyIndex",4191],[5,"Runtime",4192],[10,"FnMut",4189],[5,"FunctionSignature",3443],[5,"QueryTable",4191],[5,"QueryTableMut",4191],[5,"Attribute",2222],[5,"AttributeId",2222],[5,"Contract",2222],[5,"ContractField",2222],[5,"Enum",2222],[5,"EnumVariant",2222],[5,"File",4185],[5,"Function",2222],[5,"FunctionSig",2222],[5,"Impl",2222],[5,"Ingot",2222],[5,"Module",2222],[5,"ModuleConstant",2222],[5,"ModuleConstantId",2222],[5,"Struct",2222],[5,"StructId",2222],[5,"StructField",2222],[5,"StructFieldId",2222],[5,"Trait",2222],[5,"TypeAlias",2222],[5,"TypeAliasId",2222],[5,"Revision",4193],[5,"Module",4176],[1,"u16"],[10,"Database",4191],[5,"Durability",4194],[10,"SourceDb",4195],[5,"DisplayableWrapper",2063],[10,"Displayable",2063],[10,"DisplayWithDb",2063],[6,"IndexingError",2079],[6,"BinaryOperationError",2079],[6,"TypeCoercionError",2079],[5,"AlreadyDefined",2079],[10,"Display",4172],[5,"InternId",4196],[6,"TraitOrType",3443],[5,"Impl",4176],[6,"IngotMode",2222],[6,"ModuleSource",2222],[6,"TypeDef",2222],[6,"DepLocality",2222],[8,"DepGraph",2222],[5,"BuildFiles",4197],[6,"FileKind",4185],[10,"AsRef",4187],[6,"GenericParameter",4176],[5,"Function",4176],[5,"NodeId",4177],[17,"Item"],[10,"Iterator",4198],[5,"ItemScope",3319],[5,"FunctionScope",3319],[5,"BlockScope",3319],[6,"FuncStmt",4176],[5,"PatternMatrix",3989,4199],[5,"BTreeMap",4200],[5,"BigInt",4201],[6,"GenericType",3443],[6,"GenericArg",3443],[10,"TypeDowncast",3443],[5,"Array",3443],[6,"Integer",3443],[5,"Map",3443],[5,"FeString",3443],[5,"Tuple",3443],[5,"IntegerIter",3443],[5,"SelfDecl",3443],[5,"CtxDecl",3443],[5,"FunctionParam",3443],[5,"GenericTypeIter",3443],[6,"GenericParamKind",3443],[5,"GenericParam",3443],[10,"SafeNames",3443],[6,"ConstructorKind",3989,4199],[5,"SimplifiedPattern",3989,4199],[6,"SimplifiedPatternKind",3989,4199],[6,"LiteralConstructor",3989,4199],[5,"SigmaSet",3989,4199],[5,"PatternRowVec",3989,4199],[5,"MatchArm",4176],[15,"Constructor",4166],[5,"AnalyzerDbStorage",552]],"r":[[0,552],[1,552],[11,4202],[254,4168],[276,4168],[287,4168],[299,4168],[309,4168],[319,4168],[339,4168],[349,4168],[350,4168],[351,4168],[352,4168],[394,4168],[406,4168],[425,4168],[430,4168],[442,4168],[450,4168],[464,4168],[476,4168],[478,4168],[480,4168],[481,4168],[492,4168],[503,4168],[517,4168],[3989,4199],[3990,4199],[3991,4199],[3992,4199],[3993,4199],[3994,4199],[3995,4199],[3996,4199],[3997,4199],[3998,4199],[3999,4199],[4000,4199],[4001,4199],[4002,4199],[4003,4199],[4004,4199],[4005,4199],[4006,4199],[4007,4199],[4008,4199],[4009,4199],[4010,4199],[4011,4199],[4012,4199],[4013,4199],[4014,4199],[4015,4199],[4016,4199],[4017,4199],[4018,4199],[4019,4199],[4020,4199],[4021,4199],[4022,4199],[4023,4199],[4024,4199],[4025,4199],[4026,4199],[4027,4199],[4028,4199],[4029,4199],[4030,4199],[4031,4199],[4032,4199],[4033,4199],[4034,4199],[4035,4199],[4036,4199],[4037,4199],[4038,4199],[4039,4199],[4040,4199],[4041,4199],[4042,4199],[4043,4199],[4044,4199],[4045,4199],[4046,4199],[4047,4199],[4048,4199],[4049,4199],[4050,4199],[4051,4199],[4052,4199],[4053,4199],[4054,4199],[4055,4199],[4056,4199],[4057,4199],[4058,4199],[4059,4199],[4060,4199],[4061,4199],[4062,4199],[4063,4199],[4064,4199],[4065,4199],[4066,4199],[4067,4199],[4068,4199],[4069,4199],[4070,4199],[4071,4199],[4072,4199],[4073,4199],[4074,4199],[4075,4199],[4076,4199],[4077,4199],[4078,4199],[4079,4199],[4080,4199],[4081,4199],[4082,4199],[4083,4199],[4084,4199],[4085,4199],[4086,4199],[4087,4199],[4088,4199],[4089,4199],[4090,4199],[4091,4199],[4092,4199],[4093,4199],[4094,4199],[4095,4199],[4096,4199],[4097,4199],[4098,4199],[4099,4199],[4100,4199],[4101,4199],[4102,4199],[4103,4199],[4104,4199],[4105,4199],[4106,4199],[4107,4199],[4108,4199],[4109,4199],[4110,4199],[4111,4199],[4112,4199],[4113,4199],[4114,4199],[4115,4199],[4116,4199],[4117,4199],[4118,4199],[4119,4199],[4120,4199],[4121,4199],[4122,4199],[4123,4199],[4124,4199],[4125,4199],[4126,4199],[4127,4199],[4128,4199],[4129,4199],[4130,4199],[4131,4199],[4132,4199],[4133,4199],[4134,4199],[4135,4199],[4136,4199],[4137,4199],[4138,4199],[4139,4199],[4140,4199],[4141,4199],[4142,4199],[4143,4199],[4144,4199],[4145,4199],[4146,4199],[4147,4199],[4148,4199],[4149,4199],[4150,4199],[4151,4199],[4152,4199],[4153,4199],[4154,4199],[4155,4199],[4156,4199],[4157,4199],[4158,4199],[4159,4199],[4160,4199],[4161,4199],[4162,4199],[4163,4199],[4164,4199],[4165,4199]],"b":[[402,"impl-Debug-for-CallType"],[403,"impl-Display-for-CallType"],[1210,"impl-HasQueryGroup%3CSourceDbStorage%3E-for-TestDb"],[1211,"impl-HasQueryGroup%3CAnalyzerDbStorage%3E-for-TestDb"],[2155,"impl-From%3CIncompleteItem%3E-for-TypeError"],[2157,"impl-From%3CConstEvalError%3E-for-TypeError"],[2158,"impl-From%3CFatalError%3E-for-TypeError"],[2159,"impl-From%3CConstEvalError%3E-for-FatalError"],[2161,"impl-From%3CAlreadyDefined%3E-for-FatalError"],[2162,"impl-From%3CIncompleteItem%3E-for-FatalError"],[2163,"impl-From%3CTypeError%3E-for-FatalError"],[2164,"impl-From%3CTypeError%3E-for-ConstEvalError"],[2165,"impl-From%3CFatalError%3E-for-ConstEvalError"],[2166,"impl-From%3CIncompleteItem%3E-for-ConstEvalError"],[3733,"impl-Display-for-Base"],[3734,"impl-Debug-for-Base"],[3735,"impl-Display-for-Integer"],[3736,"impl-Debug-for-Integer"],[3739,"impl-Debug-for-Generic"],[3740,"impl-Display-for-Generic"],[3742,"impl-Display-for-FeString"],[3743,"impl-Debug-for-FeString"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAL4NZgABAAgACwAAAA0ABQAUAI8AqgAGALcAOgD0AAAA9gABAPkABgABAQkADAEAAA4BAgASATgATAE6AIgBDgCjAQMAqAEEAK4BAAC6AQAAvAEAAL4BBQDFAQcAzgEAANABAADSAQAA1AECANgBAQDbAQAA3gEyABICDwAjAgEAJgIFAC0CJwKvBBYAdAU8AAsGygDXBgAA2QYAANsGAADdBgAA3wYAAOEGNwEbCAQAJwgBACoIAQAvCD0AbggCAHIIBQB+CAEAiAgBAIsIMAC9CAAAvwgQANEIAwDXCAAA2QgDAN4IAQDhCA0A8ggEAPkIcQBsCaYAFArsACYLEAA5CwQAPwsFAEYLJwCUCwkAnwsPALALCAC6CzgA9AslABsMBAAhDAAAJQwAACgMygD0DBkADw0IABkNFQAzDQQAOQ0EAEINMAB0DQcAfQ0cAJwNFQCzDRIAyA0pAPMNngCTDhcArA4AAMAOAwDHDhgA9A4DAPoOBAAADwAAAg8MABAPAQAUDzcATQ9AAI8PAgCUD2gABBAFABEQNwA=","P":[[105,"T"],[117,""],[123,"T"],[129,""],[137,"K"],[139,""],[143,"K"],[159,""],[163,"T"],[169,"FromStr::Err"],[173,"__H"],[176,"U"],[182,"I"],[184,""],[188,"Iterator::Item"],[194,""],[199,"T"],[205,"U,T"],[206,"TryFrom::Error"],[207,"U,T"],[209,"TryFrom::Error"],[211,"U,T"],[212,"TryFrom::Error"],[213,"U,T"],[215,"U"],[221,""],[276,"T"],[298,""],[300,"T"],[301,""],[309,"T"],[319,""],[340,"T"],[341,""],[349,"K"],[389,""],[395,"T"],[396,""],[406,"T"],[417,""],[424,"T"],[425,"__H"],[426,"T,__H"],[427,"__H"],[428,""],[430,"U"],[441,""],[456,"T"],[457,""],[464,"S"],[465,""],[476,"S"],[477,"T"],[478,""],[481,"T"],[491,""],[492,"U,T"],[503,"U"],[514,""],[646,"T"],[826,""],[962,"QueryDb::DynDb,Query::Key,Query::Value"],[1014,""],[1108,"T"],[1198,""],[1456,"U"],[1546,""],[1649,"QueryDb::GroupStorage,Query::Storage"],[1736,"QueryDb::DynDb,Query::Key,Query::Value"],[1744,""],[1788,"U,T"],[1878,"U"],[1968,""],[2066,"T"],[2069,""],[2070,"T"],[2071,""],[2072,"T"],[2073,"U"],[2074,"T"],[2075,""],[2076,"U,T"],[2077,"U"],[2078,""],[2097,"T"],[2113,""],[2115,"T"],[2117,""],[2125,"K"],[2145,""],[2156,"T"],[2157,""],[2160,"T"],[2161,""],[2167,"T"],[2173,"__H"],[2175,"U"],[2183,""],[2192,"T"],[2194,"U,T"],[2202,"U"],[2210,""],[2334,"T"],[2408,""],[2448,"T"],[2485,""],[2539,"K"],[2556,""],[2623,"K"],[2771,""],[2816,"T"],[2853,""],[2886,"__H"],[2921,""],[2926,"U"],[2963,""],[3156,"T"],[3193,""],[3195,"U,T"],[3232,"U"],[3269,""],[3318,"F"],[3329,""],[3343,"T"],[3351,""],[3353,"T"],[3354,""],[3366,"K"],[3370,""],[3374,"T"],[3378,""],[3389,"U"],[3393,""],[3397,"T"],[3398,""],[3425,"T"],[3426,"U,T"],[3430,"U"],[3434,""],[3528,"T"],[3568,""],[3589,"T"],[3608,""],[3633,"K"],[3639,""],[3661,"K"],[3729,""],[3754,"T"],[3755,""],[3756,"T"],[3775,""],[3776,"FromStr::Err"],[3779,""],[3784,"__H"],[3801,""],[3807,"U"],[3827,"I"],[3829,""],[3869,"Iterator::Item"],[3875,""],[3892,"T"],[3911,""],[3916,"U,T"],[3922,"TryFrom::Error"],[3923,"U,T"],[3934,"TryFrom::Error"],[3935,"U,T"],[3938,"U"],[3958,""],[4005,"T"],[4019,""],[4026,"T"],[4033,""],[4054,"K"],[4082,""],[4092,"T"],[4099,""],[4101,"__H"],[4103,""],[4105,"U"],[4112,"IntoIterator::IntoIter"],[4113,""],[4135,"T"],[4142,"U,T"],[4149,"U"],[4156,""]]}],["fe_codegen",{"t":"CCFFFFFFFFFFFFKFFFFFFFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNCCCCHHHHFNNNNNONNNHHGPFPKMNMNMNMNMNMNNNNNNNNMNMNMNNMNMNNNNNNNMNNMNMNMNMNMNMNMNMNMNMNMNMNNNNNNNN","n":["db","yul","CodegenAbiContractQuery","CodegenAbiEventQuery","CodegenAbiFunctionArgumentMaximumSizeQuery","CodegenAbiFunctionQuery","CodegenAbiFunctionReturnMaximumSizeQuery","CodegenAbiModuleEventsQuery","CodegenAbiTypeMaximumSizeQuery","CodegenAbiTypeMinimumSizeQuery","CodegenAbiTypeQuery","CodegenConstantStringSymbolNameQuery","CodegenContractDeployerSymbolNameQuery","CodegenContractSymbolNameQuery","CodegenDb","CodegenDbGroupStorage__","CodegenDbStorage","CodegenFunctionSymbolNameQuery","CodegenLegalizedBodyQuery","CodegenLegalizedSignatureQuery","CodegenLegalizedTypeQuery","Db","all_impls","borrow","","","","","","","","","","","","","","","","","","","borrow_mut","","","","","","","","","","","","","","","","","","","codegen_abi_contract","","","codegen_abi_event","","","codegen_abi_function","","","codegen_abi_function_argument_maximum_size","","","codegen_abi_function_return_maximum_size","","","codegen_abi_module_events","","","codegen_abi_type","","","codegen_abi_type_maximum_size","","","codegen_abi_type_minimum_size","","","codegen_constant_string_symbol_name","","","codegen_contract_deployer_symbol_name","","","codegen_contract_symbol_name","","","codegen_function_symbol_name","","","codegen_legalized_body","","","codegen_legalized_signature","","","codegen_legalized_type","","","contract_all_fields","contract_all_functions","contract_call_function","contract_dependency_graph","contract_field_map","contract_field_type","contract_function_map","contract_init_function","contract_public_function_map","contract_runtime_dependency_graph","default","","","","","","","","","","","","","","","","","enum_all_functions","enum_all_variants","enum_dependency_graph","enum_function_map","enum_variant_kind","enum_variant_map","execute","","","","","","","","","","","","","","","","file_content","file_line_starts","file_name","fmt","","","","","","","","","","","","","","","","fmt_index","","for_each_query","","from","","","","","","","","","","","","","","","","","","","function_body","function_dependency_graph","function_signature","function_sigs","group_storage","","","","impl_all_functions","impl_for","impl_function_map","in_db","","","","","","","","","","","","","","","","in_db_mut","","","","","","","","","","","","","","","","ingot_external_ingots","ingot_files","ingot_modules","ingot_root_module","intern_attribute","intern_contract","intern_contract_field","intern_enum","intern_enum_variant","intern_file","intern_function","intern_function_sig","intern_impl","intern_ingot","intern_module","intern_module_const","intern_struct","intern_struct_field","intern_trait","intern_type","intern_type_alias","into","","","","","","","","","","","","","","","","","","","lookup_intern_attribute","lookup_intern_contract","lookup_intern_contract_field","lookup_intern_enum","lookup_intern_enum_variant","lookup_intern_file","lookup_intern_function","lookup_intern_function_sig","lookup_intern_impl","lookup_intern_ingot","lookup_intern_module","lookup_intern_module_const","lookup_intern_struct","lookup_intern_struct_field","lookup_intern_trait","lookup_intern_type","lookup_intern_type_alias","lookup_mir_intern_const","lookup_mir_intern_function","lookup_mir_intern_type","maybe_changed_since","","mir_intern_const","mir_intern_function","mir_intern_type","mir_lower_contract_all_functions","mir_lower_enum_all_functions","mir_lower_module_all_functions","mir_lower_struct_all_functions","mir_lowered_constant","mir_lowered_func_body","mir_lowered_func_signature","mir_lowered_monomorphized_func_signature","mir_lowered_pseudo_monomorphized_func_signature","mir_lowered_type","module_all_impls","module_all_items","module_constant_type","module_constant_value","module_constants","module_contracts","module_file_path","module_impl_map","module_is_incomplete","module_item_map","module_parent_module","module_parse","module_structs","module_submodules","module_tests","module_used_item_map","new","ops_database","ops_salsa_runtime","ops_salsa_runtime_mut","query_storage","","","","","","","","","","","","","","","","root_ingot","set_file_content","set_file_content_with_durability","set_ingot_external_ingots","set_ingot_external_ingots_with_durability","set_ingot_files","set_ingot_files_with_durability","set_root_ingot","set_root_ingot_with_durability","struct_all_fields","struct_all_functions","struct_dependency_graph","struct_field_map","struct_field_type","struct_function_map","trait_all_functions","trait_function_map","trait_is_implemented_for","try_from","","","","","","","","","","","","","","","","","","","try_into","","","","","","","","","","","","","","","","","","","type_alias_type","type_id","","","","","","","","","","","","","","","","","","","upcast","","","upcast_mut","","","isel","legalize","runtime","context","lower_contract","lower_contract_deployable","lower_function","lower_test","Context","borrow","borrow_mut","default","from","into","runtime","try_from","try_into","type_id","legalize_func_body","legalize_func_signature","AbiSrcLocation","CallData","DefaultRuntimeProvider","Memory","RuntimeProvider","abi_decode","","abi_encode","","abi_encode_seq","","aggregate_init","","alloc","","avail","","borrow","","borrow_mut","","clone","clone_into","clone_to_uninit","collect_definitions","","create","","create2","","default","emit","","external_call","","fmt","","from","","into","","map_value_ptr","","primitive_cast","ptr_copy","","ptr_load","","ptr_store","","revert","","safe_add","","safe_div","","safe_mod","","safe_mul","","safe_pow","","safe_sub","","string_construct","","string_copy","","to_owned","try_from","","try_into","","type_id",""],"q":[[0,"fe_codegen"],[2,"fe_codegen::db"],[436,"fe_codegen::yul"],[439,"fe_codegen::yul::isel"],[444,"fe_codegen::yul::isel::context"],[454,"fe_codegen::yul::legalize"],[456,"fe_codegen::yul::runtime"],[531,"fe_analyzer::namespace::types"],[532,"fe_analyzer::namespace::items"],[533,"alloc::rc"],[534,"fe_abi::contract"],[535,"alloc::sync"],[536,"fe_mir::ir::types"],[537,"fe_abi::event"],[538,"fe_mir::ir::function"],[539,"fe_abi::function"],[540,"alloc::vec"],[541,"fe_abi::types"],[542,"alloc::string"],[543,"core::option"],[544,"fe_analyzer::context"],[545,"smol_str"],[546,"indexmap::map"],[547,"fe_analyzer::errors"],[548,"core::result"],[549,"fe_common::files"],[550,"core::fmt"],[551,"salsa"],[552,"salsa::runtime"],[553,"core::ops::function"],[554,"fe_mir::ir::constant"],[555,"salsa::revision"],[556,"alloc::collections::btree::map"],[557,"fe_parser::ast"],[558,"fe_common::span"],[559,"salsa::durability"],[560,"core::any"],[561,"fe_analyzer::db"],[562,"fe_common::db"],[563,"fe_mir::db"],[564,"yultsur::yul"],[565,"alloc::boxed"],[566,"fe_codegen::yul::isel::contract"],[567,"fe_codegen::yul::isel::function"],[568,"fe_codegen::yul::isel::test"],[569,"fe_codegen::yul::legalize::body"],[570,"fe_codegen::yul::legalize::signature"]],"i":"``````````````````````F`NjAdD`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`NjAdD`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`n1Ad1201201201201201201201201201201201201201201202222222222D`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`000000D`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`00D`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnAdF`10Nj2D`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`00000000000D`DbDdDfDhDjDlDnE`EbEdEfEhEjElEn?>=<;:9876543210F`00000000000000000000NjAdD`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`00000000000000000000Ad1111111111111111111111111111110111D`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`00000000000000000NjAdD`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`NjAdD`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`0NjAdD`DbDdDfDhDjDlDnE`EbEdEfEhEjElEnF`000000`````````Mj00000000```Nd`0`N`Nf10101010102020222101010010102020201011010101010101010101010102202020","f":"``````````````````````{{bd}{{j{{h{f}}}}}}{b{{b{c}}}{}}000000000000000000{{{b{l}}}{{b{lc}}}{}}000000000000000000{{{b{n}}A`}Ab}{{bA`}Ab}{AdAf}{{{b{n}}Ah}Aj}{{bAh}Aj}2{{{b{n}}Al}An}{{bAl}An}4{{{b{n}}Al}B`}{{bAl}B`}6106{{{b{n}}Bb}{{Bd{Aj}}}}{{bBb}{{Bd{Aj}}}}8{{{b{n}}Ah}Bf}{{bAh}Bf}:{{{b{n}}Ah}B`}{{bAh}B`}<10<{{{b{n}}Bh}{{j{Bh}}}}{{bBh}{{j{Bh}}}}>{{{b{n}}A`}{{j{Bh}}}}{{bA`}{{j{Bh}}}}{AdAf}210{{{b{n}}Al}{{j{Bh}}}}{{bAl}{{j{Bh}}}}2{{{b{n}}Al}{{j{Bj}}}}{{bAl}{{j{Bj}}}}4{{{b{n}}Al}{{j{Bl}}}}{{bAl}{{j{Bl}}}}6{{{b{n}}Ah}Ah}{{bAh}Ah}8{{bA`}{{j{{h{Bn}}}}}}{{bA`}{{j{{h{C`}}}}}}{{bA`}{{Cd{{Cb{C`}}}}}}{{bA`}Cf}{{bA`}{{Cd{{j{{Cj{ChBn}}}}}}}}{{bBn}{{Cd{{Cn{dCl}}}}}}{{bA`}{{Cd{{j{{Cj{ChC`}}}}}}}}4{{bA`}{{j{{Cj{ChC`}}}}}}4{{}D`}{{}Db}{{}Dd}{{}Df}{{}Dh}{{}Dj}{{}Dl}{{}Dn}{{}E`}{{}Eb}{{}Ed}{{}Ef}{{}Eh}{{}Ej}{{}El}{{}En}{{}F`}{{bFb}{{j{{h{C`}}}}}}{{bFb}{{j{{h{Fd}}}}}}{{bFb}{{Cd{Cf}}}}{{bFb}{{Cd{{j{{Cj{ChC`}}}}}}}}{{bFd}{{Cd{{Cn{FfCl}}}}}}{{bFb}{{Cd{{j{{Cj{ChFd}}}}}}}}{{{b{c}}e}g{}{}{}}000000000000000{{bFh}{{j{Fj}}}}{{bFh}{{j{{h{B`}}}}}}{{bFh}Ch}{{{b{D`}}{b{lFl}}}Fn}{{{b{Db}}{b{lFl}}}Fn}{{{b{Dd}}{b{lFl}}}Fn}{{{b{Df}}{b{lFl}}}Fn}{{{b{Dh}}{b{lFl}}}Fn}{{{b{Dj}}{b{lFl}}}Fn}{{{b{Dl}}{b{lFl}}}Fn}{{{b{Dn}}{b{lFl}}}Fn}{{{b{E`}}{b{lFl}}}Fn}{{{b{Eb}}{b{lFl}}}Fn}{{{b{Ed}}{b{lFl}}}Fn}{{{b{Ef}}{b{lFl}}}Fn}{{{b{Eh}}{b{lFl}}}Fn}{{{b{Ej}}{b{lFl}}}Fn}{{{b{El}}{b{lFl}}}Fn}{{{b{En}}{b{lFl}}}Fn}{{{b{Ad}}{b{n}}G`{b{lFl}}}Fn}{{{b{F`}}G`{b{lFl}}}Fn}{{{b{Ad}}{b{Gb}}{b{lGd}}}Gf}{{{b{F`}}{b{lGd}}}Gf}{cc{}}000000000000000000{{bC`}{{Cd{{j{Gh}}}}}}{{bC`}Cf}{{bGj}{{Cd{{j{Gl}}}}}}{{bdCh}{{j{{h{Gj}}}}}}{{{b{F`}}}b}000{{bf}{{j{{h{C`}}}}}}{{bdGn}{{Cb{f}}}}{{bf}{{Cd{{j{{Cj{ChC`}}}}}}}}{{D`{b{n}}}{{H`{D`}}}}{{Db{b{n}}}{{H`{Db}}}}{{Dd{b{n}}}{{H`{Dd}}}}{{Df{b{n}}}{{H`{Df}}}}{{Dh{b{n}}}{{H`{Dh}}}}{{Dj{b{n}}}{{H`{Dj}}}}{{Dl{b{n}}}{{H`{Dl}}}}{{Dn{b{n}}}{{H`{Dn}}}}{{E`{b{n}}}{{H`{E`}}}}{{Eb{b{n}}}{{H`{Eb}}}}{{Ed{b{n}}}{{H`{Ed}}}}{{Ef{b{n}}}{{H`{Ef}}}}{{Eh{b{n}}}{{H`{Eh}}}}{{Ej{b{n}}}{{H`{Ej}}}}{{El{b{n}}}{{H`{El}}}}{{En{b{n}}}{{H`{En}}}}{{D`{b{ln}}}{{Hb{D`}}}}{{Db{b{ln}}}{{Hb{Db}}}}{{Dd{b{ln}}}{{Hb{Dd}}}}{{Df{b{ln}}}{{Hb{Df}}}}{{Dh{b{ln}}}{{Hb{Dh}}}}{{Dj{b{ln}}}{{Hb{Dj}}}}{{Dl{b{ln}}}{{Hb{Dl}}}}{{Dn{b{ln}}}{{Hb{Dn}}}}{{E`{b{ln}}}{{Hb{E`}}}}{{Eb{b{ln}}}{{Hb{Eb}}}}{{Ed{b{ln}}}{{Hb{Ed}}}}{{Ef{b{ln}}}{{Hb{Ef}}}}{{Eh{b{ln}}}{{Hb{Eh}}}}{{Ej{b{ln}}}{{Hb{Ej}}}}{{El{b{ln}}}{{Hb{El}}}}{{En{b{ln}}}{{Hb{En}}}}{{bHd}{{j{{Cj{ChHd}}}}}}{{bHd}{{j{{h{Fh}}}}}}{{bHd}{{j{{h{Bb}}}}}}{{bHd}{{Cb{Bb}}}}{{b{j{Hf}}}Hh}{{b{j{Hj}}}A`}{{b{j{Hl}}}Bn}{{b{j{Hn}}}Fb}{{b{j{I`}}}Fd}{{bIb}Fh}{{b{j{Id}}}C`}{{b{j{If}}}Gj}{{b{j{Ih}}}f}{{b{j{Ij}}}Hd}{{b{j{Il}}}Bb}{{b{j{In}}}J`}{{b{j{Jb}}}Jd}{{b{j{Jf}}}Jh}{{b{j{Jj}}}Gn}{{bJl}d}{{b{j{Jn}}}K`}{{}c{}}000000000000000000{{bHh}{{j{Hf}}}}{{bA`}{{j{Hj}}}}{{bBn}{{j{Hl}}}}{{bFb}{{j{Hn}}}}{{bFd}{{j{I`}}}}{{bFh}Ib}{{bC`}{{j{Id}}}}{{bGj}{{j{If}}}}{{bf}{{j{Ih}}}}{{bHd}{{j{Ij}}}}{{bBb}{{j{Il}}}}{{bJ`}{{j{In}}}}{{bJd}{{j{Jb}}}}{{bJh}{{j{Jf}}}}{{bGn}{{j{Jj}}}}{{bd}Jl}{{bK`}{{j{Jn}}}}{{bKb}{{j{Kd}}}}{{bAl}{{j{Bl}}}}{{bAh}{{j{Kf}}}}{{{b{Ad}}{b{n}}G`Kh}Kj}{{{b{F`}}G`Kh}Kj}{{b{j{Kd}}}Kb}{{b{j{Bl}}}Al}{{b{j{Kf}}}Ah}{{bA`}{{j{{Bd{Al}}}}}}{{bFb}{{j{{Bd{Al}}}}}}{{bBb}{{j{{Bd{Al}}}}}}{{bJd}{{j{{Bd{Al}}}}}}{{bJ`}Kb}{{bAl}{{j{Bj}}}}{{bC`}Al}{{bC`{Kl{Chd}}}Al}1{{bd}Ah}{{bBb}{{Cd{{j{{h{f}}}}}}}}{{bBb}{{j{{h{Kn}}}}}}{{bJ`}{{Cd{{Cn{dCl}}}}}}{{bJ`}{{Cd{{Cn{L`Lb}}}}}}{{bBb}{{j{{Bd{J`}}}}}}{{bBb}{{j{{h{A`}}}}}}{{bBb}Ch}{{bBb}{{Cd{{j{{Cj{{Ld{Gnd}}f}}}}}}}}{{bBb}Kj}{{bBb}{{Cd{{j{{Cj{ChKn}}}}}}}}{{bBb}{{Cb{Bb}}}}{{bBb}{{Cd{{j{Lf}}}}}}{{bBb}{{j{{h{Jd}}}}}}{{bBb}{{j{{h{Bb}}}}}}{{bBb}{{Bd{C`}}}}{{bBb}{{Cd{{j{{Cj{Ch{Ld{LhKn}}}}}}}}}}{LjAd}{{{b{F`}}}{{b{Ll}}}}{{{b{F`}}}{{b{Gb}}}}{{{b{lF`}}}{{b{lGb}}}}{{{b{c}}}{{b{{Af{e}}}}}{}{}}000000000000000{bHd}{{{b{l}}Fh{j{Fj}}}Gf}{{{b{l}}Fh{j{Fj}}Ln}Gf}{{{b{l}}Hd{j{{Cj{ChHd}}}}}Gf}{{{b{l}}Hd{j{{Cj{ChHd}}}}Ln}Gf}{{{b{l}}Hd{j{{h{Fh}}}}}Gf}{{{b{l}}Hd{j{{h{Fh}}}}Ln}Gf}{{{b{l}}Hd}Gf}{{{b{l}}HdLn}Gf}{{bJd}{{j{{h{Jh}}}}}}{{bJd}{{j{{h{C`}}}}}}{{bJd}{{Cd{Cf}}}}{{bJd}{{Cd{{j{{Cj{ChJh}}}}}}}}{{bJh}{{Cd{{Cn{dCl}}}}}}{{bJd}{{Cd{{j{{Cj{ChC`}}}}}}}}{{bGn}{{j{{h{Gj}}}}}}{{bGn}{{Cd{{j{{Cj{ChGj}}}}}}}}{{bGnd}Kj}{c{{Cn{e}}}{}{}}000000000000000000{{}{{Cn{c}}}{}}000000000000000000{{bK`}{{Cd{{Cn{dCl}}}}}}{bM`}000000000000000000{{{b{F`}}}{{b{Mb}}}}{{{b{F`}}}{{b{Md}}}}{{{b{F`}}}{{b{Mf}}}}{{{b{lF`}}}{{b{lMd}}}}{{{b{lF`}}}{{b{lMf}}}}{{{b{lF`}}}{{b{lMb}}}}````{{{b{n}}A`}Mh}0{{{b{n}}{b{lMj}}Al}Ml}{{{b{n}}C`}Mh}`{b{{b{c}}}{}}{{{b{l}}}{{b{lc}}}{}}{{}Mj}{cc{}}{{}c{}}{MjMn}{c{{Cn{e}}}{}{}}{{}{{Cn{c}}}{}}{bM`}{{{b{n}}{b{lBj}}}Gf}{{{b{n}}{b{lBl}}}Gf}`````{{{b{lN`}}{b{n}}NbNb{b{{h{Ah}}}}Nd}Nb}{{{b{lNf}}{b{n}}NbNb{b{{h{Ah}}}}Nd}Nb}{{{b{lN`}}{b{n}}NbNbAhKj}Nb}{{{b{lNf}}{b{n}}NbNbAhKj}Nb}{{{b{lN`}}{b{n}}{b{{h{Nb}}}}Nb{b{{h{Ah}}}}Kj}Nb}{{{b{lNf}}{b{n}}{b{{h{Nb}}}}Nb{b{{h{Ah}}}}Kj}Nb}{{{b{lN`}}{b{n}}Nb{Bd{Nb}}Ah{Bd{Ah}}}Nb}{{{b{lNf}}{b{n}}Nb{Bd{Nb}}Ah{Bd{Ah}}}Nb}{{{b{lN`}}{b{n}}Nb}Nb}{{{b{lNf}}{b{n}}Nb}Nb}{{{b{lN`}}{b{n}}}Nb}{{{b{lNf}}{b{n}}}Nb}{b{{b{c}}}{}}0{{{b{l}}}{{b{lc}}}{}}0{{{b{Nd}}}Nd}{{b{b{lc}}}Gf{}}{{bNh}Gf}{{{b{N`}}}{{Bd{Ml}}}}{{{b{Nf}}}{{Bd{Ml}}}}{{{b{lN`}}{b{n}}A`Nb}Nb}{{{b{lNf}}{b{n}}A`Nb}Nb}{{{b{lN`}}{b{n}}A`NbNb}Nb}{{{b{lNf}}{b{n}}A`NbNb}Nb}{{}Nf}{{{b{lN`}}{b{n}}NbAh}Nb}{{{b{lNf}}{b{n}}NbAh}Nb}{{{b{lN`}}{b{n}}Al{Bd{Nb}}}Nb}{{{b{lNf}}{b{n}}Al{Bd{Nb}}}Nb}{{{b{Nd}}{b{lFl}}}Fn}{{{b{Nf}}{b{lFl}}}Fn}{cc{}}0{{}c{}}0{{{b{lN`}}{b{n}}NbNbAh}Nb}{{{b{lNf}}{b{n}}NbNbAh}Nb}9{{{b{lN`}}{b{n}}NbNbNbKjKj}Nb}{{{b{lNf}}{b{n}}NbNbNbKjKj}Nb};:32{{{b{lN`}}{b{n}}{Cb{Nb}}{b{Fj}}Ah}Nb}{{{b{lNf}}{b{n}}{Cb{Nb}}{b{Fj}}Ah}Nb}545454545454{{{b{lN`}}{b{n}}{b{Fj}}B`}Nb}{{{b{lNf}}{b{n}}{b{Fj}}B`}Nb}{{{b{lN`}}{b{n}}Nb{b{Fj}}Kj}Nb}{{{b{lNf}}{b{n}}Nb{b{Fj}}Kj}Nb}{bc{}}{c{{Cn{e}}}{}{}}0{{}{{Cn{c}}}{}}0{bM`}0","D":"Il","p":[[1,"reference",null,null,1],[5,"TypeId",531],[5,"ImplId",532],[1,"slice"],[5,"Rc",533,null,1],[0,"mut"],[10,"CodegenDb",2],[5,"ContractId",532],[5,"AbiContract",534],[5,"CodegenDbGroupStorage__",2],[5,"Arc",535,null,1],[5,"TypeId",536],[5,"AbiEvent",537],[5,"FunctionId",538],[5,"AbiFunction",539],[1,"usize"],[5,"ModuleId",532],[5,"Vec",540],[6,"AbiType",541],[5,"String",542],[5,"FunctionBody",538],[5,"FunctionSignature",538],[5,"ContractFieldId",532],[5,"FunctionId",532],[6,"Option",543,null,1],[5,"Analysis",544],[5,"DepGraphWrapper",532],[5,"SmolStr",545],[5,"IndexMap",546],[5,"TypeError",547],[6,"Result",548,null,1],[5,"CodegenLegalizedSignatureQuery",2],[5,"CodegenLegalizedBodyQuery",2],[5,"CodegenFunctionSymbolNameQuery",2],[5,"CodegenLegalizedTypeQuery",2],[5,"CodegenAbiTypeQuery",2],[5,"CodegenAbiFunctionQuery",2],[5,"CodegenAbiEventQuery",2],[5,"CodegenAbiContractQuery",2],[5,"CodegenAbiModuleEventsQuery",2],[5,"CodegenAbiTypeMaximumSizeQuery",2],[5,"CodegenAbiTypeMinimumSizeQuery",2],[5,"CodegenAbiFunctionArgumentMaximumSizeQuery",2],[5,"CodegenAbiFunctionReturnMaximumSizeQuery",2],[5,"CodegenContractSymbolNameQuery",2],[5,"CodegenContractDeployerSymbolNameQuery",2],[5,"CodegenConstantStringSymbolNameQuery",2],[5,"Db",2],[5,"EnumId",532],[5,"EnumVariantId",532],[6,"EnumVariantKind",532],[5,"SourceFileId",549],[1,"str"],[5,"Formatter",550],[8,"Result",550],[5,"DatabaseKeyIndex",551],[5,"Runtime",552],[10,"FnMut",553],[1,"unit"],[5,"FunctionBody",544],[5,"FunctionSigId",532],[5,"FunctionSignature",531],[5,"TraitId",532],[5,"QueryTable",551],[5,"QueryTableMut",551],[5,"IngotId",532],[5,"Attribute",532],[5,"AttributeId",532],[5,"Contract",532],[5,"ContractField",532],[5,"Enum",532],[5,"EnumVariant",532],[5,"File",549],[5,"Function",532],[5,"FunctionSig",532],[5,"Impl",532],[5,"Ingot",532],[5,"Module",532],[5,"ModuleConstant",532],[5,"ModuleConstantId",532],[5,"Struct",532],[5,"StructId",532],[5,"StructField",532],[5,"StructFieldId",532],[5,"Trait",532],[6,"Type",531],[5,"TypeAlias",532],[5,"TypeAliasId",532],[5,"ConstantId",554],[5,"Constant",554],[5,"Type",536],[5,"Revision",555],[1,"bool"],[5,"BTreeMap",556],[6,"Item",532],[6,"Constant",544],[5,"ConstEvalError",547],[1,"tuple",null,null,1],[5,"Module",557],[5,"Span",558],[1,"u16"],[10,"Database",551],[5,"Durability",559],[5,"TypeId",560],[10,"AnalyzerDb",561],[10,"SourceDb",562],[10,"MirDb",563],[5,"Object",564],[5,"Context",444],[5,"FunctionDefinition",564],[5,"Box",565,null,1],[10,"RuntimeProvider",456],[6,"Expression",564],[6,"AbiSrcLocation",456],[5,"DefaultRuntimeProvider",456],[1,"u8"],[5,"CodegenDbStorage",2]],"r":[[440,566],[441,566],[442,567],[443,568],[454,569],[455,570]],"b":[[204,"impl-HasQueryGroup%3CAnalyzerDbStorage%3E-for-Db"],[205,"impl-HasQueryGroup%3CCodegenDbStorage%3E-for-Db"],[206,"impl-HasQueryGroup%3CMirDbStorage%3E-for-Db"],[207,"impl-HasQueryGroup%3CSourceDbStorage%3E-for-Db"],[430,"impl-Upcast%3Cdyn+AnalyzerDb%3E-for-Db"],[431,"impl-Upcast%3Cdyn+SourceDb%3E-for-Db"],[432,"impl-Upcast%3Cdyn+MirDb%3E-for-Db"],[433,"impl-UpcastMut%3Cdyn+SourceDb%3E-for-Db"],[434,"impl-UpcastMut%3Cdyn+MirDb%3E-for-Db"],[435,"impl-UpcastMut%3Cdyn+AnalyzerDb%3E-for-Db"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAMUBCAAAABAAEgCjAMkACgD0ABQAHAGkAMMBKgDyAQIA9gEdAA==","P":[[23,"T"],[61,""],[142,"QueryDb::DynDb,Query::Key,Query::Value"],[158,""],[181,"T"],[200,""],[264,"U"],[283,""],[338,"QueryDb::GroupStorage,Query::Storage"],[354,""],[372,"U,T"],[391,"U"],[410,""],[445,"T"],[447,""],[448,"T"],[449,"U"],[450,""],[451,"U,T"],[452,"U"],[453,""],[473,"T"],[477,""],[478,"T"],[479,""],[493,"T"],[495,"U"],[497,""],[524,"T"],[525,"U,T"],[527,"U"],[529,""]]}],["fe_common",{"t":"EEEFKNNNNNQQNNNNNCNCNONNNNNOCNNNNQNNNCCNMONNNNCNFFFFFKFFFKKNNNNNNNNNNNNNNNNNNNNNNNNMNOMNOMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNMNONNNNNNNNMNONNNNNNNNNNNMNMNNNNNNNNNNNNNNNNNNNNNNNNNMMPFPPFGPPPGPNNNNNNNNNNNNNNNNNNNNCHNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOONNHNOOONNNNNNNNNNNNNNNNPFPPFGPPPGPNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNONNNNNNNNNNNOOONNNONNONOONNNNNNNNNNNNNNNNNNPFGPPPPPFPGFFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNENNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNPPPFPGNNNNNNNNNNNNNNNNNNNNNNNNNHNNNNNNNNHCCCCCCHHFFGKGPPFPPFPFGPNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNONNNNNNNNNNNNNNNHNNNNNNNNONNOOOOMNNNOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOHKHMMHHHHFNNNNNNHNNNN","n":["File","FileKind","SourceFileId","Span","Spanned","add","","","","add_assign","assert_snapshot_wasm","assert_strings_eq","borrow","borrow_mut","clone","clone_into","clone_to_uninit","db","deserialize","diagnostics","dummy","end","eq","equivalent","","","","file_id","files","fmt","from","from_pair","hash","impl_intern_key","into","is_dummy","new","numeric","panic","serialize","span","start","to_owned","try_from","try_into","type_id","utils","zero","FileContentQuery","FileLineStartsQuery","FileNameQuery","InternFileLookupQuery","InternFileQuery","SourceDb","SourceDbGroupStorage__","SourceDbStorage","TestDb","Upcast","UpcastMut","borrow","","","","","","","","borrow_mut","","","","","","","","default","","","","","","execute","","file_content","","","file_line_starts","","","file_name","","","fmt","","","","","fmt_index","","for_each_query","","from","","","","","","","","group_storage","in_db","","","","","in_db_mut","","","","","intern_file","","","into","","","","","","","","lookup_intern_file","","","maybe_changed_since","","new","ops_database","ops_salsa_runtime","ops_salsa_runtime_mut","query_storage","","","","","set_file_content","","set_file_content_with_durability","","try_from","","","","","","","","try_into","","","","","","","","type_id","","","","","","","","upcast","upcast_mut","Bug","Diagnostic","Error","Help","Label","LabelStyle","Note","Primary","Secondary","Severity","Warning","borrow","","","","borrow_mut","","","","clone","","","","clone_into","","","","clone_to_uninit","","","","cs","diagnostics_string","eq","","","","equivalent","","","","","","","","","","","","","","","","error","fmt","","","","from","","","","hash","","","","into","","","","into_cs","into_cs_label","labels","message","","notes","partial_cmp","primary","print_diagnostics","secondary","severity","span","style","to_owned","","","","try_from","","","","try_into","","","","type_id","","","","Bug","Diagnostic","Error","Help","Label","LabelStyle","Note","Primary","Secondary","Severity","Warning","borrow","","","borrow_mut","","","bug","clone","","","clone_into","","","clone_to_uninit","","","code","eq","","","equivalent","","","","","","","","","","","","error","file_id","fmt","","","from","","","","help","into","","","labels","message","","new","","note","notes","partial_cmp","primary","range","secondary","severity","style","to_owned","","","try_from","","","try_into","","","type_id","","","warning","with_code","with_labels","with_message","","with_notes","CurDir","File","FileKind","Local","Normal","ParentDir","Prefix","RootDir","SourceFileId","Std","Utf8Component","Utf8Path","Utf8PathBuf","ancestors","as_intern_id","as_os_str","","as_path","as_ref","","","","","","","","","","","","as_std_path","as_str","","borrow","","","","","","","borrow_mut","","","","","","canonicalize","canonicalize_utf8","capacity","clear","clone","","","","","clone_into","","","","","clone_to_uninit","","","","","cmp","","","common_prefix","compare","","","components","content","default","deref","deserialize","dummy_file","ends_with","eq","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","equivalent","","","","","","","","","","","","","","","","","","","","","","","","exists","extend","extension","file_name","file_stem","fmt","","","","","","","","","from","","","","","","","","","","from_intern_id","from_iter","from_path","from_path_buf","from_str","has_root","hash","","","","","","include_dir","into","","","","","into_boxed_path","into_iter","","into_os_string","into_path_buf","into_std_path_buf","into_string","is_absolute","is_dir","is_dummy","is_file","is_relative","is_symlink","iter","join","join_os","kind","line_index","line_range","metadata","new","","","new_local","new_std","parent","partial_cmp","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","path","","pop","push","read_dir","read_dir_utf8","read_link","read_link_utf8","reserve","reserve_exact","set_extension","set_file_name","shrink_to","shrink_to_fit","starts_with","strip_prefix","symlink_metadata","to_owned","","","","","","to_path_buf","to_string","","","try_exists","try_from","","","","","","","try_into","","","","","try_reserve","try_reserve_exact","type_id","","","","","","with_capacity","with_extension","with_file_name","Binary","Decimal","Hexadecimal","Literal","Octal","Radix","as_num","borrow","","borrow_mut","","clone","","clone_into","","clone_to_uninit","","eq","equivalent","","","","fmt","","from","","into","","new","parse","radix","to_hex_str","to_owned","","try_from","","try_into","","type_id","","install_panic_hook","dirs","files","git","humanize","keccak","ron","get_fe_deps","get_fe_home","BuildFiles","Dependency","DependencyKind","DependencyResolver","FileLoader","Fs","Git","GitDependency","Lib","Local","LocalDependency","Main","ProjectFiles","ProjectMode","Static","borrow","","","","","","","","borrow_mut","","","","","","","","canonicalize_path","canonicalized_path","clone","","","","","clone_into","","","","","clone_to_uninit","","","","","dependencies","eq","equivalent","","","","fe_files","file_content","from","","","","","","","","get_project_root","into","","","","","","","","kind","load_fs","load_static","mode","name","","project_files","resolve","","","root_project_mode","root_project_path","src","to_owned","","","","","try_from","","","","","","","","try_into","","","","","","","","type_id","","","","","","","","version","","fetch_and_checkout","Pluralizable","pluralize_conditionally","to_plural","to_singular","full","full_as_bytes","partial","partial_right_padded","Diff","borrow","borrow_mut","fmt","from","into","new","to_ron_string_pretty","to_string","try_from","try_into","type_id"],"q":[[0,"fe_common"],[48,"fe_common::db"],[175,"fe_common::diagnostics"],[275,"fe_common::diagnostics::cs"],[276,"fe_common::diagnostics"],[278,"fe_common::diagnostics::cs"],[280,"fe_common::diagnostics"],[281,"fe_common::diagnostics::cs"],[284,"fe_common::diagnostics"],[285,"fe_common::diagnostics::cs"],[361,"fe_common::files"],[672,"fe_common::numeric"],[712,"fe_common::panic"],[713,"fe_common::utils"],[719,"fe_common::utils::dirs"],[721,"fe_common::utils::files"],[838,"fe_common::utils::git"],[839,"fe_common::utils::humanize"],[843,"fe_common::utils::keccak"],[847,"fe_common::utils::ron"],[859,"fe_common::span"],[860,"core::option"],[861,"core::result"],[862,"serde::de"],[863,"core::fmt"],[864,"core::convert"],[865,"core::hash"],[866,"serde::ser"],[867,"core::any"],[868,"alloc::rc"],[869,"alloc::sync"],[870,"smol_str"],[871,"salsa"],[872,"salsa::runtime"],[873,"core::ops::function"],[874,"salsa::revision"],[875,"salsa::durability"],[876,"core::marker"],[877,"codespan_reporting::diagnostic"],[878,"alloc::string"],[879,"alloc::vec"],[880,"core::cmp"],[881,"core::clone"],[882,"core::ops::range"],[883,"camino"],[884,"salsa::intern_id"],[885,"std::ffi::os_str"],[886,"std::path"],[887,"std::io::error"],[888,"alloc::borrow"],[889,"core::iter::traits::collect"],[890,"alloc::boxed"],[891,"std::fs"],[892,"alloc::collections"],[893,"num_traits"],[894,"num_bigint::bigint"],[895,"indexmap::map"],[896,"core::error"],[897,"ron::ser"]],"i":"`````b0000``00000`0`00000000`0000`000``0f11111`1```````````M`ChBfBhBjBlBnC`7654321054321021Cb17017017654327171876543211654326543201787654321017717111654320101876543218765432187654321EdEhEj`00``0En0`11El1F`3120312031203120``312033331111222200001312031203120312010110130`010031203120312031203`33``3Fn0`40FhFf2100210210210021022221111000001210221002100101000211101210210210210000100H```Hj1111`0```GhAh13Hb2222000044442242004Dj423150423311150421504215042315`31532112233333333333333333333333333311111111111111115042333311115555000044442222313333311550423111115042213113315042`15042131131133233333302233122233333333333333333333333333311111111111111115201133331111113333150423315331150421504211315042133Jf00`0`00Jj1010101011111101010000`10101010``````````````K`Kj`Kd1`0``22L`Kl2KbKfKh674352106725210652106521063555557774352106`743521062443324Mb215546321785463217854632178546321743```Lf0`````Lj00000`0000","f":"`````{{b{d{c}}}bf}{{bb}b}{{b{h{b}}}b}{{b{h{{d{c}}}}}b{}}{{{d{jb}}c}l{}}``{d{{d{c}}}{}}{{{d{j}}}{{d{jc}}}{}}{{{d{b}}}b}{{d{d{jc}}}l{}}{{dn}l}`{c{{A`{b}}}Ab}`{{}b}{bAd}{{{d{b}}{d{b}}}Af}{{d{d{c}}}Af{}}000{bAh}`{{{d{b}}{d{jAj}}}Al}{cc{}}{{ce}b{{An{b}}}{{An{b}}}}{{{d{b}}{d{jc}}}lB`}`{{}c{}}{{{d{b}}}Af}{{AhAdAd}b}``{{{d{b}}c}A`Bb}{{{d{f}}}b}<{dc{}}{c{{A`{e}}}{}{}}{{}{{A`{c}}}{}}{dBd}`{Ahb}```````````{d{{d{c}}}{}}0000000{{{d{j}}}{{d{jc}}}{}}0000000{{}Bf}{{}Bh}{{}Bj}{{}Bl}{{}Bn}{{}C`}{{{d{c}}e}g{}{}{}}0{{{d{Cb}}Ah}{{Cf{Cd}}}}{{dAh}{{Cf{Cd}}}}{ChCj}{{{d{Cb}}Ah}{{Cf{{Cl{Ad}}}}}}{{dAh}{{Cf{{Cl{Ad}}}}}}2{{{d{Cb}}Ah}Cn}{{dAh}Cn}4{{{d{Bf}}{d{jAj}}}Al}{{{d{Bh}}{d{jAj}}}Al}{{{d{Bj}}{d{jAj}}}Al}{{{d{Bl}}{d{jAj}}}Al}{{{d{Bn}}{d{jAj}}}Al}{{{d{Ch}}{d{Cb}}D`{d{jAj}}}Al}{{{d{C`}}D`{d{jAj}}}Al}{{{d{Ch}}{d{Db}}{d{jDd}}}l}{{{d{C`}}{d{jDd}}}l}{cc{}}0000000{{{d{C`}}}d}{{Bf{d{Cb}}}{{Df{Bf}}}}{{Bh{d{Cb}}}{{Df{Bh}}}}{{Bj{d{Cb}}}{{Df{Bj}}}}{{Bl{d{Cb}}}{{Df{Bl}}}}{{Bn{d{Cb}}}{{Df{Bn}}}}{{Bf{d{jCb}}}{{Dh{Bf}}}}{{Bh{d{jCb}}}{{Dh{Bh}}}}{{Bj{d{jCb}}}{{Dh{Bj}}}}{{Bl{d{jCb}}}{{Dh{Bl}}}}{{Bn{d{jCb}}}{{Dh{Bn}}}}{{{d{Cb}}Dj}Ah}{{dDj}Ah}{ChCj}{{}c{}}0000000{{{d{Cb}}Ah}Dj}{{dAh}Dj}3{{{d{Ch}}{d{Cb}}D`Dl}Af}{{{d{C`}}D`Dl}Af}{DnCh}{{{d{C`}}}{{d{E`}}}}{{{d{C`}}}{{d{Db}}}}{{{d{jC`}}}{{d{jDb}}}}{{{d{c}}}{{d{{Cj{e}}}}}{}{}}0000{{{d{jCb}}Ah{Cf{Cd}}}l}{{{d{j}}Ah{Cf{Cd}}}l}{{{d{jCb}}Ah{Cf{Cd}}Eb}l}{{{d{j}}Ah{Cf{Cd}}Eb}l}{c{{A`{e}}}{}{}}0000000{{}{{A`{c}}}{}}0000000{dBd}0000000{{{d{Ed}}}{{d{c}}}Ef}{{{d{jEh}}}{{d{jc}}}Ef}```````````{d{{d{c}}}{}}000{{{d{j}}}{{d{jc}}}{}}000{{{d{Ej}}}Ej}{{{d{El}}}El}{{{d{En}}}En}{{{d{F`}}}F`}{{d{d{jc}}}l{}}000{{dn}l}000`{{{d{Cb}}{d{{Cl{El}}}}}Fb}{{{d{Ej}}{d{Ej}}}Af}{{{d{El}}{d{El}}}Af}{{{d{En}}{d{En}}}Af}{{{d{F`}}{d{F`}}}Af}{{d{d{c}}}Af{}}000000000000000{FbEl}{{{d{Ej}}{d{jAj}}}{{A`{lFd}}}}{{{d{El}}{d{jAj}}}Al}{{{d{En}}{d{jAj}}}Al}{{{d{F`}}{d{jAj}}}Al}{cc{}}000{{{d{Ej}}{d{jc}}}lB`}{{{d{El}}{d{jc}}}lB`}{{{d{En}}{d{jc}}}lB`}{{{d{F`}}{d{jc}}}lB`}{{}c{}}000{El{{Ff{Ah}}}}{F`{{Fh{Ah}}}}{ElFj}{ElFb}{F`Fb}2{{{d{Ej}}{d{Ej}}}{{h{Fl}}}}{{bc}F`{{An{Fb}}}}{{{d{Cb}}{d{{Cl{El}}}}}l}1{ElEj}{F`b}{F`En}{dc{}}000{c{{A`{e}}}{}{}}000{{}{{A`{c}}}{}}000{dBd}000```````````{d{{d{c}}}{}}00{{{d{j}}}{{d{jc}}}{}}00{{}{{Ff{c}}}{}}{{{d{Fn}}}Fn}{{{d{{Fh{c}}}}}{{Fh{c}}}G`}{{{d{{Ff{c}}}}}{{Ff{c}}}G`}{{d{d{jc}}}l{}}00{{dn}l}00{Ffh}{{{d{Fn}}{d{Fn}}}Af}{{{d{{Fh{c}}}}{d{{Fh{c}}}}}AfGb}{{{d{{Ff{c}}}}{d{{Ff{c}}}}}AfGb}{{d{d{c}}}Af{}}00000000000:{Fh}{{{d{Fn}}{d{jAj}}}{{A`{lFd}}}}{{{d{{Fh{c}}}}{d{jAj}}}{{A`{lFd}}}Gd}{{{d{{Ff{c}}}}{d{jAj}}}{{A`{lFd}}}Gd}{EnFn}{cc{}}00{{}{{Ff{c}}}{}}{{}c{}}00{FfFj}{FhFb}{FfFb}{{Fnce}{{Fh{c}}}{}{{An{{Gf{Ad}}}}}}{Ej{{Ff{c}}}{}}64{{{d{Fn}}{d{Fn}}}{{h{Fl}}}}{{ce}{{Fh{c}}}{}{{An{{Gf{Ad}}}}}}{FhGf}1{FfEj}{FhFn}{dc{}}00{c{{A`{e}}}{}{}}00{{}{{A`{c}}}{}}00{dBd}00?{{{Ff{c}}e}{{Ff{c}}}{}{{An{Fb}}}}{{{Ff{c}}{Fj{{Fh{c}}}}}{{Ff{c}}}{}}{{{Fh{c}}e}{{Fh{c}}}{}{{An{Fb}}}}2{{{Ff{c}}{Fj{Fb}}}{{Ff{c}}}{}}`````````````{{{d{Gh}}}Gj}{{{d{Ah}}}Gl}{{{d{Gh}}}{{d{Gn}}}}{{{d{H`}}}{{d{Gn}}}}{{{d{Hb}}}{{d{Gh}}}}{{{d{Gh}}}{{d{Cd}}}}{{{d{Gh}}}{{d{Gh}}}}4{{{d{Gh}}}{{d{Hd}}}}3{{{d{Hb}}}{{d{Gn}}}}{{{d{Hb}}}{{d{Hd}}}}{{{d{Hb}}}{{d{Cd}}}}{{{d{H`}}}{{d{Cd}}}}8{{{d{H`}}}{{d{Hd}}}}{{{d{H`}}}{{d{Gh}}}}682{d{{d{c}}}{}}0:0000{{{d{j}}}{{d{jc}}}{}}00000{{{d{Gh}}}{{A`{HfHh}}}}{{{d{Gh}}}{{A`{HbHh}}}}{{{d{Hb}}}Ad}{{{d{jHb}}}l}{{{d{Hb}}}Hb}{{{d{H`}}}H`}{{{d{Dj}}}Dj}{{{d{Hj}}}Hj}{{{d{Ah}}}Ah}{{d{d{jc}}}l{}}0000{{dn}l}0000{{{d{Gh}}{d{Gh}}}Fl}{{{d{Hb}}{d{Hb}}}Fl}{{{d{H`}}{d{H`}}}Fl}{{{d{Gh}}{d{Gh}}}Hb}{{d{d{c}}}Fl{}}00{{{d{Gh}}}Hl}{{{d{Ah}}{d{Cb}}}{{Cf{Cd}}}}{{}Hb}{{{d{Hb}}}{{d{Gh}}}}{c{{A`{Ah}}}Ab}{{}Ah}{{{d{Gh}}c}Af{{Hn{Hd}}}}{{{d{{d{Gh}}}}{d{{I`{Gn}}}}}Af}{{{d{Gh}}{d{Hf}}}Af}{{{d{Gh}}{d{{I`{Gn}}}}}Af}{{{d{Gh}}{d{{d{Gn}}}}}Af}{{{d{Gh}}{d{Gn}}}Af}{{{d{{d{Gh}}}}{d{Gn}}}Af}{{{d{Gh}}{d{Gh}}}Af}{{{d{Gh}}{d{Hb}}}Af}{{{d{Gh}}{d{Ib}}}Af}{{{d{{d{Gh}}}}{d{Fb}}}Af}{{{d{{d{Gh}}}}{d{{I`{Cd}}}}}Af}{{{d{{d{Gh}}}}{d{Cd}}}Af}{{{d{Gh}}{d{Fb}}}Af}{{{d{{d{Gh}}}}{d{Ib}}}Af}{{{d{Gh}}{d{{d{Cd}}}}}Af}{{{d{Gh}}{d{Cd}}}Af}{{{d{{d{Gh}}}}{d{Hb}}}Af}{{{d{Gh}}{d{{I`{Gh}}}}}Af}{{{d{{d{Gh}}}}{d{{I`{Gh}}}}}Af}{{{d{Gh}}{d{Hd}}}Af}{{{d{{d{Gh}}}}{d{Hf}}}Af}{{{d{{d{Gh}}}}{d{{I`{Hd}}}}}Af}{{{d{{d{Gh}}}}{d{Hd}}}Af}{{{d{Gh}}{d{{d{Hd}}}}}Af}{{{d{Gh}}{d{{I`{Hd}}}}}Af}{{{d{Gh}}{d{{I`{Cd}}}}}Af}{{{d{Hb}}{d{Gn}}}Af}{{{d{Hb}}{d{Hf}}}Af}{{{d{Hb}}{d{{d{Gh}}}}}Af}{{{d{Hb}}{d{Ib}}}Af}{{{d{Hb}}{d{{I`{Cd}}}}}Af}{{{d{Hb}}{d{{d{Cd}}}}}Af}{{{d{Hb}}{d{Cd}}}Af}{{{d{Hb}}{d{{I`{Gh}}}}}Af}{{{d{Hb}}{d{Hd}}}Af}{{{d{Hb}}{d{{d{Hd}}}}}Af}{{{d{Hb}}{d{{I`{Gn}}}}}Af}{{{d{Hb}}{d{{I`{Hd}}}}}Af}{{{d{Hb}}{d{Hb}}}Af}{{{d{Hb}}{d{{d{Gn}}}}}Af}{{{d{Hb}}{d{Gh}}}Af}{{{d{Hb}}{d{Fb}}}Af}{{{d{H`}}{d{H`}}}Af}{{{d{Dj}}{d{Dj}}}Af}{{{d{Hj}}{d{Hj}}}Af}{{{d{Ah}}{d{Ah}}}Af}{{d{d{c}}}Af{}}00000000000000000000000{{{d{Gh}}}Af}{{{d{jHb}}e}l{{Hn{Gh}}}{{If{}{{Id{c}}}}}}{{{d{Gh}}}{{h{{d{Cd}}}}}}00{{{d{Gh}}{d{jAj}}}{{A`{lFd}}}}0{{{d{Hb}}{d{jAj}}}{{A`{lFd}}}}0{{{d{H`}}{d{jAj}}}{{A`{lFd}}}}0{{{d{Dj}}{d{jAj}}}Al}{{{d{Hj}}{d{jAj}}}Al}{{{d{Ah}}{d{jAj}}}Al}{{{d{Cd}}}{{d{Gh}}}}{cc{}}{FbHb}{{{d{c}}}Hb{{Hn{Cd}}Ef}}{{{Ih{Gh}}}Hb}{{{I`{Gh}}}Hb}4444{GlAh}{eHb{{Hn{Gh}}}{{If{}{{Id{c}}}}}}{{{d{Hd}}}{{h{{d{Gh}}}}}}{Hf{{A`{HbHf}}}}{{{d{Cd}}}{{A`{Hb}}}}{{{d{Gh}}}Af}{{{d{Gh}}{d{jc}}}lB`}{{{d{Hb}}{d{jc}}}lB`}{{{d{H`}}{d{jc}}}lB`}{{{d{Dj}}{d{jc}}}lB`}{{{d{Hj}}{d{jc}}}lB`}{{{d{Ah}}{d{jc}}}lB`}`{{}c{}}0000{Hb{{Ih{Gh}}}}{{{d{Gh}}}Ij}{{{d{Hb}}}Ij}{HbIb}{{{Ih{Gh}}}Hb}{HbHf}{HbFb}>>{AhAf}???6{{{d{Gh}}c}Hb{{Hn{Gh}}}}{{{d{Gh}}c}Hf{{Hn{Hd}}}}{DjHj}{{{d{Ah}}{d{Cb}}Ad}Ad}{{{d{Ah}}{d{Cb}}Ad}{{h{{Gf{Ad}}}}}}{{{d{Gh}}}{{A`{IlHh}}}}{{{d{c}}}{{d{Gh}}}{{Hn{Cd}}Ef}}{{}Hb}{{{d{jCb}}Hj{d{Cd}}{Cf{Cd}}}Ah}{{{d{jCb}}{d{Cd}}{Cf{Cd}}}Ah}0{{{d{Gh}}}{{h{{d{Gh}}}}}}{{{d{{d{Gh}}}}{d{Gn}}}{{h{Fl}}}}{{{d{Gh}}{d{{d{Gn}}}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{{I`{Gh}}}}}{{h{Fl}}}}{{{d{Gh}}{d{Hd}}}{{h{Fl}}}}{{{d{Gh}}{d{Hb}}}{{h{Fl}}}}{{{d{Gh}}{d{{d{Hd}}}}}{{h{Fl}}}}{{{d{Gh}}{d{{I`{Hd}}}}}{{h{Fl}}}}{{{d{Gh}}{d{Hf}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{Hd}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{{I`{Hd}}}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{Hf}}}{{h{Fl}}}}{{{d{Gh}}{d{Cd}}}{{h{Fl}}}}{{{d{Gh}}{d{{d{Cd}}}}}{{h{Fl}}}}{{{d{Gh}}{d{Gh}}}{{h{Fl}}}}{{{d{Gh}}{d{Fb}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{Ib}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{Hb}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{{I`{Gn}}}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{Cd}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{{I`{Cd}}}}}{{h{Fl}}}}{{{d{{d{Gh}}}}{d{Fb}}}{{h{Fl}}}}{{{d{Gh}}{d{{I`{Gh}}}}}{{h{Fl}}}}{{{d{Gh}}{d{Ib}}}{{h{Fl}}}}{{{d{Gh}}{d{Gn}}}{{h{Fl}}}}{{{d{Gh}}{d{{I`{Gn}}}}}{{h{Fl}}}}{{{d{Gh}}{d{{I`{Cd}}}}}{{h{Fl}}}}{{{d{Hb}}{d{Gn}}}{{h{Fl}}}}{{{d{Hb}}{d{{I`{Cd}}}}}{{h{Fl}}}}{{{d{Hb}}{d{{I`{Gh}}}}}{{h{Fl}}}}{{{d{Hb}}{d{Ib}}}{{h{Fl}}}}{{{d{Hb}}{d{{I`{Gn}}}}}{{h{Fl}}}}{{{d{Hb}}{d{{d{Gn}}}}}{{h{Fl}}}}{{{d{Hb}}{d{Hd}}}{{h{Fl}}}}{{{d{Hb}}{d{{d{Gh}}}}}{{h{Fl}}}}{{{d{Hb}}{d{Gh}}}{{h{Fl}}}}{{{d{Hb}}{d{Hb}}}{{h{Fl}}}}{{{d{Hb}}{d{{d{Hd}}}}}{{h{Fl}}}}{{{d{Hb}}{d{{I`{Hd}}}}}{{h{Fl}}}}{{{d{Hb}}{d{Hf}}}{{h{Fl}}}}{{{d{Hb}}{d{{d{Cd}}}}}{{h{Fl}}}}{{{d{Hb}}{d{Fb}}}{{h{Fl}}}}{{{d{Hb}}{d{Cd}}}{{h{Fl}}}}{{{d{H`}}{d{H`}}}{{h{Fl}}}}{{{d{Ah}}{d{Cb}}}{{Cf{Hb}}}}{DjCf}{{{d{jHb}}}Af}{{{d{jHb}}c}l{{Hn{Gh}}}}{{{d{Gh}}}{{A`{InHh}}}}{{{d{Gh}}}{{A`{J`Hh}}}}{{{d{Gh}}}{{A`{HfHh}}}}{{{d{Gh}}}{{A`{HbHh}}}}{{{d{jHb}}Ad}l}0{{{d{jHb}}c}Af{{Hn{Cd}}}}{{{d{jHb}}c}l{{Hn{Cd}}}}2{{{d{jHb}}}l}{{{d{Gh}}c}Af{{Hn{Hd}}}}{{{d{Gh}}c}{{A`{{d{Gh}}Jb}}}{{Hn{Hd}}}}{{{d{Gh}}}{{A`{IlHh}}}}{{{d{Gh}}}Hb}{dc{}}00001{dFb}00{{{d{Gh}}}{{A`{AfHh}}}}{{{d{Hd}}}{{A`{{d{Gh}}}}}}{c{{A`{e}}}{}{}}{Hf{{A`{Hb}}}}1111{{}{{A`{c}}}{}}0000{{{d{jHb}}Ad}{{A`{lJd}}}}0{dBd}00000{AdHb}{{{d{Gh}}c}Hb{{Hn{Cd}}}}0``````{JfJh}{d{{d{c}}}{}}0{{{d{j}}}{{d{jc}}}{}}0{{{d{Jf}}}Jf}{{{d{Jj}}}Jj}{{d{d{jc}}}l{}}0{{dn}l}0{{{d{Jf}}{d{Jf}}}Af}{{d{d{c}}}Af{}}000{{{d{Jf}}{d{jAj}}}Al}{{{d{Jj}}{d{jAj}}}Al}{cc{}}0{{}c{}}0{{{d{Cd}}}Jj}{{{d{Jj}}}{{A`{c}}}Jl}{{{d{Jj}}}Jf}{{{d{Jn}}}Fb}{dc{}}0{c{{A`{e}}}{}{}}0{{}{{A`{c}}}{}}0{dBd}0{{}l}``````{{}Hf}0```````````````{d{{d{c}}}{}}0000000{{{d{j}}}{{d{jc}}}{}}0000000{{{d{K`}}{d{Cd}}}{{A`{CnFb}}}}{KbCn}{{{d{Kd}}}Kd}{{{d{Kb}}}Kb}{{{d{Kf}}}Kf}{{{d{Kh}}}Kh}{{{d{Kj}}}Kj}{{d{d{jc}}}l{}}0000{{dn}l}0000{KlFj}{{{d{Kd}}{d{Kd}}}Af}{{d{d{c}}}Af{}}000{{{d{K`}}{d{Cd}}}{{A`{{Fj{{Kn{FbFb}}}}Fb}}}}{{{d{K`}}{d{Cd}}}{{A`{FbFb}}}}{cc{}}0000000{{}{{h{Fb}}}}{{}c{}}0000000{KbKj}{{{d{Cd}}}{{A`{L`Fb}}}}{{{Fj{{Kn{{d{Cd}}{d{Cd}}}}}}{d{Cd}}}{{A`{L`Fb}}}}{KlKd}{KlCn}{KbCn}{L`Lb}{{{d{Kb}}{d{K`}}}{{A`{KlFb}}}}00{{{d{L`}}}Kd}{L`Cn}{KlFj}{dc{}}0000{c{{A`{e}}}{}{}}0000000{{}{{A`{c}}}{}}0000000{dBd}0000000:{Kbh}{{{d{Cd}}c{d{Cd}}}{{A`{l{Ih{Ld}}}}}{{Hn{Hd}}}}`{{cAd}FbLf}{{{d{Lf}}}Fb}0{{{d{{Cl{n}}}}}Fb}{{{d{{Cl{n}}}}}{{Lh{n}}}}{{{d{{Cl{n}}}}Ad}Fb}0`{d{{d{c}}}{}}{{{d{j}}}{{d{jc}}}{}}{{{d{Lj}}{d{jAj}}}Al}{cc{}}{{}c{}}{{{d{Cd}}{d{Cd}}}Lj}{{{d{c}}}{{Ll{Fb}}}Ln}{dFb}{c{{A`{e}}}{}{}}{{}{{A`{c}}}{}}{dBd}","D":"AJn","p":[[5,"Span",0,859],[1,"reference",null,null,1],[10,"Spanned",0,859],[6,"Option",860,null,1],[0,"mut"],[1,"unit"],[1,"u8"],[6,"Result",861,null,1],[10,"Deserializer",862],[1,"usize"],[1,"bool"],[5,"SourceFileId",361],[5,"Formatter",863],[8,"Result",863],[10,"Into",864,null,1],[10,"Hasher",865],[10,"Serializer",866],[5,"TypeId",867],[5,"InternFileQuery",48],[5,"InternFileLookupQuery",48],[5,"FileContentQuery",48],[5,"FileLineStartsQuery",48],[5,"FileNameQuery",48],[5,"TestDb",48],[10,"SourceDb",48],[1,"str"],[5,"Rc",868,null,1],[5,"SourceDbGroupStorage__",48],[5,"Arc",869,null,1],[1,"slice"],[5,"SmolStr",870],[5,"DatabaseKeyIndex",871],[5,"Runtime",872],[10,"FnMut",873],[5,"QueryTable",871],[5,"QueryTableMut",871],[5,"File",361],[5,"Revision",874],[1,"u16"],[10,"Database",871],[5,"Durability",875],[10,"Upcast",48],[10,"Sized",876],[10,"UpcastMut",48],[6,"Severity",284,877],[5,"Diagnostic",284],[6,"LabelStyle",284],[5,"Label",284],[5,"String",878],[5,"Error",863],[5,"Diagnostic",285,877],[5,"Label",285,877],[5,"Vec",879],[6,"Ordering",880],[6,"LabelStyle",285,877],[10,"Clone",881],[10,"PartialEq",880],[10,"Debug",863],[5,"Range",882],[5,"Utf8Path",361,883],[5,"Utf8Ancestors",883],[5,"InternId",884],[5,"OsStr",885],[6,"Utf8Component",361,883],[5,"Utf8PathBuf",361,883],[5,"Path",886],[5,"PathBuf",886],[5,"Error",887],[6,"FileKind",361],[5,"Utf8Components",883],[10,"AsRef",864],[6,"Cow",888],[5,"OsString",885],[17,"Item"],[10,"IntoIterator",889],[5,"Box",890,null,1],[5,"Iter",883],[5,"Metadata",891],[5,"ReadDir",891],[5,"ReadDirUtf8",883],[5,"StripPrefixError",886],[5,"TryReserveError",892],[6,"Radix",672],[1,"u32"],[5,"Literal",672],[10,"Num",893],[5,"BigInt",894],[6,"FileLoader",721],[5,"Dependency",721],[6,"ProjectMode",721],[5,"LocalDependency",721],[5,"GitDependency",721],[6,"DependencyKind",721],[5,"ProjectFiles",721],[1,"tuple",null,null,1],[5,"BuildFiles",721],[5,"IndexMap",895],[10,"Error",896],[10,"Pluralizable",839],[1,"array"],[5,"Diff",847],[8,"Result",897],[10,"Serialize",866],[5,"SourceDbStorage",48],[10,"DependencyResolver",721]],"r":[[0,361],[1,361],[2,361],[3,859],[4,859],[5,859],[6,859],[7,859],[8,859],[9,859],[12,859],[13,859],[14,859],[15,859],[16,859],[18,859],[20,859],[21,859],[22,859],[23,859],[24,859],[25,859],[26,859],[27,859],[29,859],[30,859],[31,859],[32,859],[34,859],[35,859],[36,859],[39,859],[40,859],[41,859],[42,859],[43,859],[44,859],[45,859],[47,859],[175,877],[177,877],[178,877],[181,877],[184,877],[185,877],[186,877],[190,877],[194,877],[198,877],[202,877],[208,877],[212,877],[213,877],[214,877],[215,877],[229,877],[233,877],[237,877],[241,877],[251,877],[258,877],[262,877],[266,877],[270,877],[274,877],[275,877],[276,877],[277,877],[278,877],[279,877],[280,877],[281,877],[282,877],[283,877],[284,877],[285,877],[286,877],[287,877],[288,877],[289,877],[290,877],[291,877],[292,877],[293,877],[294,877],[295,877],[296,877],[297,877],[298,877],[299,877],[300,877],[301,877],[302,877],[303,877],[304,877],[305,877],[306,877],[307,877],[308,877],[309,877],[310,877],[311,877],[312,877],[313,877],[314,877],[315,877],[316,877],[317,877],[318,877],[319,877],[320,877],[321,877],[322,877],[323,877],[324,877],[325,877],[326,877],[327,877],[328,877],[329,877],[330,877],[331,877],[332,877],[333,877],[334,877],[335,877],[336,877],[337,877],[338,877],[339,877],[340,877],[341,877],[342,877],[343,877],[344,877],[345,877],[346,877],[347,877],[348,877],[349,877],[350,877],[351,877],[352,877],[353,877],[354,877],[355,877],[356,877],[357,877],[358,877],[359,877],[360,877],[361,883],[365,883],[366,883],[367,883],[368,883],[371,883],[372,883],[373,883],[374,883],[376,883],[377,883],[378,883],[379,883],[380,883],[381,883],[382,883],[383,883],[384,883],[385,883],[386,883],[387,883],[388,883],[389,883],[390,883],[391,883],[392,883],[393,883],[394,883],[395,883],[396,883],[397,883],[401,883],[402,883],[403,883],[407,883],[408,883],[409,883],[410,883],[411,883],[412,883],[416,883],[417,883],[421,883],[422,883],[426,883],[427,883],[428,883],[430,883],[431,883],[432,883],[433,883],[435,883],[436,883],[439,883],[440,883],[441,883],[442,883],[443,883],[444,883],[445,883],[446,883],[447,883],[448,883],[449,883],[450,883],[451,883],[452,883],[453,883],[454,883],[455,883],[456,883],[457,883],[458,883],[459,883],[460,883],[461,883],[462,883],[463,883],[464,883],[465,883],[466,883],[467,883],[468,883],[469,883],[470,883],[471,883],[472,883],[473,883],[474,883],[475,883],[476,883],[477,883],[478,883],[479,883],[480,883],[481,883],[482,883],[486,883],[487,883],[488,883],[489,883],[490,883],[491,883],[492,883],[493,883],[494,883],[495,883],[496,883],[497,883],[510,883],[511,883],[512,883],[513,883],[514,883],[515,883],[516,883],[517,883],[518,883],[519,883],[520,883],[524,883],[525,883],[526,883],[527,883],[528,883],[529,883],[530,883],[535,883],[536,883],[537,883],[538,883],[539,883],[540,883],[541,883],[542,883],[547,883],[548,883],[552,883],[553,883],[554,883],[555,883],[556,883],[557,883],[558,883],[559,883],[560,883],[562,883],[563,883],[564,883],[565,883],[566,883],[567,883],[571,883],[572,883],[573,883],[577,883],[578,883],[579,883],[580,883],[581,883],[582,883],[583,883],[584,883],[585,883],[586,883],[587,883],[588,883],[589,883],[590,883],[591,883],[592,883],[593,883],[594,883],[595,883],[596,883],[597,883],[598,883],[599,883],[600,883],[601,883],[602,883],[603,883],[604,883],[605,883],[606,883],[607,883],[608,883],[609,883],[610,883],[611,883],[612,883],[613,883],[614,883],[615,883],[616,883],[617,883],[618,883],[619,883],[620,883],[623,883],[624,883],[625,883],[626,883],[627,883],[628,883],[629,883],[630,883],[631,883],[632,883],[633,883],[634,883],[635,883],[636,883],[637,883],[638,883],[639,883],[640,883],[644,883],[645,883],[646,883],[647,883],[648,883],[649,883],[650,883],[651,883],[652,883],[656,883],[657,883],[661,883],[662,883],[663,883],[664,883],[665,883],[669,883],[670,883],[671,883]],"b":[[5,"impl-Add%3C%26T%3E-for-Span"],[6,"impl-Add-for-Span"],[7,"impl-Add%3COption%3CSpan%3E%3E-for-Span"],[8,"impl-Add%3COption%3C%26T%3E%3E-for-Span"],[379,"impl-AsRef%3Cstr%3E-for-Utf8Path"],[380,"impl-AsRef%3CUtf8Path%3E-for-Utf8Path"],[381,"impl-AsRef%3COsStr%3E-for-Utf8Path"],[382,"impl-AsRef%3CPath%3E-for-Utf8Path"],[383,"impl-AsRef%3CUtf8Path%3E-for-Utf8PathBuf"],[384,"impl-AsRef%3COsStr%3E-for-Utf8PathBuf"],[385,"impl-AsRef%3CPath%3E-for-Utf8PathBuf"],[386,"impl-AsRef%3Cstr%3E-for-Utf8PathBuf"],[387,"impl-AsRef%3Cstr%3E-for-Utf8Component%3C\'_%3E"],[388,"impl-AsRef%3COsStr%3E-for-Utf8Component%3C\'_%3E"],[389,"impl-AsRef%3CPath%3E-for-Utf8Component%3C\'_%3E"],[390,"impl-AsRef%3CUtf8Path%3E-for-Utf8Component%3C\'_%3E"],[440,"impl-PartialEq%3CCow%3C\'b,+OsStr%3E%3E-for-%26Utf8Path"],[441,"impl-PartialEq%3CPathBuf%3E-for-Utf8Path"],[442,"impl-PartialEq%3CCow%3C\'a,+OsStr%3E%3E-for-Utf8Path"],[443,"impl-PartialEq%3C%26OsStr%3E-for-Utf8Path"],[444,"impl-PartialEq%3COsStr%3E-for-Utf8Path"],[445,"impl-PartialEq%3COsStr%3E-for-%26Utf8Path"],[446,"impl-PartialEq-for-Utf8Path"],[447,"impl-PartialEq%3CUtf8PathBuf%3E-for-Utf8Path"],[448,"impl-PartialEq%3COsString%3E-for-Utf8Path"],[449,"impl-PartialEq%3CString%3E-for-%26Utf8Path"],[450,"impl-PartialEq%3CCow%3C\'b,+str%3E%3E-for-%26Utf8Path"],[451,"impl-PartialEq%3Cstr%3E-for-%26Utf8Path"],[452,"impl-PartialEq%3CString%3E-for-Utf8Path"],[453,"impl-PartialEq%3COsString%3E-for-%26Utf8Path"],[454,"impl-PartialEq%3C%26str%3E-for-Utf8Path"],[455,"impl-PartialEq%3Cstr%3E-for-Utf8Path"],[456,"impl-PartialEq%3CUtf8PathBuf%3E-for-%26Utf8Path"],[457,"impl-PartialEq%3CCow%3C\'a,+Utf8Path%3E%3E-for-Utf8Path"],[458,"impl-PartialEq%3CCow%3C\'a,+Utf8Path%3E%3E-for-%26Utf8Path"],[459,"impl-PartialEq%3CPath%3E-for-Utf8Path"],[460,"impl-PartialEq%3CPathBuf%3E-for-%26Utf8Path"],[461,"impl-PartialEq%3CCow%3C\'b,+Path%3E%3E-for-%26Utf8Path"],[462,"impl-PartialEq%3CPath%3E-for-%26Utf8Path"],[463,"impl-PartialEq%3C%26Path%3E-for-Utf8Path"],[464,"impl-PartialEq%3CCow%3C\'a,+Path%3E%3E-for-Utf8Path"],[465,"impl-PartialEq%3CCow%3C\'a,+str%3E%3E-for-Utf8Path"],[466,"impl-PartialEq%3COsStr%3E-for-Utf8PathBuf"],[467,"impl-PartialEq%3CPathBuf%3E-for-Utf8PathBuf"],[468,"impl-PartialEq%3C%26Utf8Path%3E-for-Utf8PathBuf"],[469,"impl-PartialEq%3COsString%3E-for-Utf8PathBuf"],[470,"impl-PartialEq%3CCow%3C\'a,+str%3E%3E-for-Utf8PathBuf"],[471,"impl-PartialEq%3C%26str%3E-for-Utf8PathBuf"],[472,"impl-PartialEq%3Cstr%3E-for-Utf8PathBuf"],[473,"impl-PartialEq%3CCow%3C\'a,+Utf8Path%3E%3E-for-Utf8PathBuf"],[474,"impl-PartialEq%3CPath%3E-for-Utf8PathBuf"],[475,"impl-PartialEq%3C%26Path%3E-for-Utf8PathBuf"],[476,"impl-PartialEq%3CCow%3C\'a,+OsStr%3E%3E-for-Utf8PathBuf"],[477,"impl-PartialEq%3CCow%3C\'a,+Path%3E%3E-for-Utf8PathBuf"],[478,"impl-PartialEq-for-Utf8PathBuf"],[479,"impl-PartialEq%3C%26OsStr%3E-for-Utf8PathBuf"],[480,"impl-PartialEq%3CUtf8Path%3E-for-Utf8PathBuf"],[481,"impl-PartialEq%3CString%3E-for-Utf8PathBuf"],[515,"impl-Debug-for-Utf8Path"],[516,"impl-Display-for-Utf8Path"],[517,"impl-Debug-for-Utf8PathBuf"],[518,"impl-Display-for-Utf8PathBuf"],[519,"impl-Display-for-Utf8Component%3C\'a%3E"],[520,"impl-Debug-for-Utf8Component%3C\'a%3E"],[526,"impl-From%3CString%3E-for-Utf8PathBuf"],[527,"impl-From%3C%26T%3E-for-Utf8PathBuf"],[528,"impl-From%3CBox%3CUtf8Path%3E%3E-for-Utf8PathBuf"],[529,"impl-From%3CCow%3C\'a,+Utf8Path%3E%3E-for-Utf8PathBuf"],[578,"impl-PartialOrd%3COsStr%3E-for-%26Utf8Path"],[579,"impl-PartialOrd%3C%26OsStr%3E-for-Utf8Path"],[580,"impl-PartialOrd%3CCow%3C\'a,+Utf8Path%3E%3E-for-%26Utf8Path"],[581,"impl-PartialOrd%3CPath%3E-for-Utf8Path"],[582,"impl-PartialOrd%3CUtf8PathBuf%3E-for-Utf8Path"],[583,"impl-PartialOrd%3C%26Path%3E-for-Utf8Path"],[584,"impl-PartialOrd%3CCow%3C\'a,+Path%3E%3E-for-Utf8Path"],[585,"impl-PartialOrd%3CPathBuf%3E-for-Utf8Path"],[586,"impl-PartialOrd%3CPath%3E-for-%26Utf8Path"],[587,"impl-PartialOrd%3CCow%3C\'b,+Path%3E%3E-for-%26Utf8Path"],[588,"impl-PartialOrd%3CPathBuf%3E-for-%26Utf8Path"],[589,"impl-PartialOrd%3Cstr%3E-for-Utf8Path"],[590,"impl-PartialOrd%3C%26str%3E-for-Utf8Path"],[591,"impl-PartialOrd-for-Utf8Path"],[592,"impl-PartialOrd%3CString%3E-for-Utf8Path"],[593,"impl-PartialOrd%3COsString%3E-for-%26Utf8Path"],[594,"impl-PartialOrd%3CUtf8PathBuf%3E-for-%26Utf8Path"],[595,"impl-PartialOrd%3CCow%3C\'b,+OsStr%3E%3E-for-%26Utf8Path"],[596,"impl-PartialOrd%3Cstr%3E-for-%26Utf8Path"],[597,"impl-PartialOrd%3CCow%3C\'b,+str%3E%3E-for-%26Utf8Path"],[598,"impl-PartialOrd%3CString%3E-for-%26Utf8Path"],[599,"impl-PartialOrd%3CCow%3C\'a,+Utf8Path%3E%3E-for-Utf8Path"],[600,"impl-PartialOrd%3COsString%3E-for-Utf8Path"],[601,"impl-PartialOrd%3COsStr%3E-for-Utf8Path"],[602,"impl-PartialOrd%3CCow%3C\'a,+OsStr%3E%3E-for-Utf8Path"],[603,"impl-PartialOrd%3CCow%3C\'a,+str%3E%3E-for-Utf8Path"],[604,"impl-PartialOrd%3COsStr%3E-for-Utf8PathBuf"],[605,"impl-PartialOrd%3CCow%3C\'a,+str%3E%3E-for-Utf8PathBuf"],[606,"impl-PartialOrd%3CCow%3C\'a,+Utf8Path%3E%3E-for-Utf8PathBuf"],[607,"impl-PartialOrd%3COsString%3E-for-Utf8PathBuf"],[608,"impl-PartialOrd%3CCow%3C\'a,+OsStr%3E%3E-for-Utf8PathBuf"],[609,"impl-PartialOrd%3C%26OsStr%3E-for-Utf8PathBuf"],[610,"impl-PartialOrd%3CPath%3E-for-Utf8PathBuf"],[611,"impl-PartialOrd%3C%26Utf8Path%3E-for-Utf8PathBuf"],[612,"impl-PartialOrd%3CUtf8Path%3E-for-Utf8PathBuf"],[613,"impl-PartialOrd-for-Utf8PathBuf"],[614,"impl-PartialOrd%3C%26Path%3E-for-Utf8PathBuf"],[615,"impl-PartialOrd%3CCow%3C\'a,+Path%3E%3E-for-Utf8PathBuf"],[616,"impl-PartialOrd%3CPathBuf%3E-for-Utf8PathBuf"],[617,"impl-PartialOrd%3C%26str%3E-for-Utf8PathBuf"],[618,"impl-PartialOrd%3CString%3E-for-Utf8PathBuf"],[619,"impl-PartialOrd%3Cstr%3E-for-Utf8PathBuf"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAIQCQQAAAAMABQAGAA0ACAAXAAcAIAACACQABQArAAwAOQAaAFUAEABuAAAAeQACAIQADQCTAAAAlQAaALEAAAC0AAEAtwABALsAEwDRABgA7gADAPYAAAD4AAQAAAESABgBAAAeAQUAJQEIAC8BDgBAAQMAUgEAAFgBCwBrAQEAcgEAAHgBAAB8AQsAiwEMAJwBEQCvAQIAswEEALkBRQAAAgAABAIJAA8CAwAXAgEAGwIAAB0CBgAqAgEAMgIAADoCAQA/AgIAQwIrAH8CBQCGAgIAigILAJgCBQChAgIApQIAAKgCEAC9AgAAwAJJABsDAAAeAygASQMCAFEDAgBWAwAAWAMDAA==","P":[[5,"T"],[6,""],[8,"T"],[14,""],[15,"T"],[16,""],[18,"__D"],[20,""],[23,"K"],[27,""],[30,"T"],[31,"S,E"],[32,"__H"],[34,"U"],[35,""],[39,"__S"],[40,""],[42,"T"],[43,"U,T"],[44,"U"],[45,""],[59,"T"],[75,""],[81,"QueryDb::DynDb,Query::Key,Query::Value"],[83,""],[101,"T"],[109,""],[123,"U"],[131,""],[140,"QueryDb::GroupStorage,Query::Storage"],[145,""],[149,"U,T"],[157,"U"],[165,""],[173,"T"],[194,""],[198,"T"],[202,""],[212,"K"],[228,""],[233,"T"],[237,"__H"],[241,"U"],[245,""],[252,"S"],[253,""],[254,"S"],[255,""],[258,"T"],[262,"U,T"],[266,"U"],[270,""],[285,"T"],[291,"FileId"],[292,""],[293,"FileId"],[295,"T"],[298,""],[303,"FileId"],[305,"K"],[317,"FileId"],[318,""],[320,"FileId"],[322,""],[323,"T"],[326,"FileId"],[327,"U"],[330,""],[333,"FileId"],[336,""],[338,"FileId"],[339,""],[340,"FileId"],[341,""],[343,"T"],[346,"U,T"],[349,"U"],[352,""],[355,"FileId"],[374,""],[394,"T"],[396,""],[397,"T"],[407,""],[416,"T"],[421,""],[430,"K"],[433,""],[437,"__D"],[438,""],[486,"K"],[510,""],[511,"P,I"],[512,""],[525,"T"],[526,""],[527,"T"],[528,""],[530,"T"],[534,""],[535,"P,I"],[536,""],[540,"H"],[542,"__H"],[547,"U"],[552,""],[639,"T"],[644,""],[650,"U,T"],[651,""],[652,"U,T"],[656,"U"],[661,""],[679,"T"],[683,""],[685,"T"],[687,""],[690,"K"],[694,""],[696,"T"],[698,"U"],[700,""],[701,"T"],[702,""],[704,"T"],[706,"U,T"],[708,"U"],[710,""],[736,"T"],[752,""],[759,"T"],[764,""],[771,"K"],[775,""],[777,"T"],[785,""],[786,"U"],[794,""],[807,"T"],[812,"U,T"],[820,"U"],[828,""],[838,"P"],[840,""],[848,"T"],[850,""],[851,"T"],[852,"U"],[853,""],[854,"T"],[855,""],[856,"U,T"],[857,"U"],[858,""]]}],["fe_compiler_test_utils",{"t":"IFSFIFFFFFIKONNHOHHQHNNNNNNNNNNNNNNNHNONNNNOHHHHHHHNNNNNNNNNNNNNNNNOOHNOOHHNNNNNNNHNNNOHNNNNNHMNNNNNNNNNNNNNNNNNHNNNNNNNOOHHHHHONNNNNNNNHHNN","n":["Backend","ContractHarness","DEFAULT_CALLER","ExecutionOutput","Executor","GasRecord","GasReporter","NumericAbiTokenBounds","Runtime","SolidityCompileError","StackState","ToBeBytes","abi","add_func_call_record","add_record","address","","address_array_token","address_token","assert_harness_gas_report","bool_token","borrow","","","","","","","borrow_mut","","","","","","","build_calldata","bytes_token","call_function","caller","capture_call","capture_call_raw_bytes","default","","description","encode_error_reason","encode_revert","encoded_div_or_mod_by_zero","encoded_invalid_abi_data","encoded_over_or_underflow","encoded_panic_assert","encoded_panic_out_of_bounds","events_emitted","expect_revert","expect_revert_reason","expect_success","fmt","","","","","from","","","","","","","gas_reporter","gas_used","get_2s_complement_for_negative","get_all","i_max","i_min","int_array_token","int_token","into","","","","","","","load_contract","new","","set_caller","size","string_token","test_call_returns","test_call_reverts","test_function","test_function_returns","test_function_reverts","to_2s_complement","to_be_bytes","to_string","","to_yul","try_from","","","","","","","try_into","","","","","","","tuple_token","type_id","","","","","","","u_max","u_min","uint_array_token","uint_token","uint_token_from_dec_str","validate_return","validate_revert","value","vzip","","","","","","","with_data","with_executor","with_executor_backend","with_functions","with_test_statements"],"q":[[0,"fe_compiler_test_utils"],[140,"ethabi::contract"],[141,"ethabi::token::token"],[142,"primitive_types"],[143,"alloc::vec"],[144,"core::option"],[145,"evm_core::error"],[146,"core::convert"],[147,"alloc::string"],[148,"core::fmt"],[149,"yultsur::yul"],[150,"core::result"],[151,"core::any"],[152,"core::ops::function"]],"i":"````````````dh0`1````1BjC`Cj3BlCf64325106`6666451```````633355100643251061`222``6432510`4362`66666`D`61575436217543621`754362133`````775436215``55","f":"``{{}b}`````````{df}{{{b{h}}{b{j}}{b{{n{l}}}}A`}Ab}{{{b{h}}{b{j}}A`}Ab}{{{b{j}}}Ad}{dAd}{{{b{{n{{b{j}}}}}}}l}{{{b{j}}}l}`{Afl}{b{{b{c}}}{}}000000{{{b{Ah}}}{{b{Ahc}}}{}}000000{{{b{d}}{b{j}}{b{{n{l}}}}}{{Al{Aj}}}}4{{{b{d}}{b{AhAn}}{b{j}}{b{{n{l}}}}}{{B`{l}}}}7{{{b{d}}{b{AhAn}}{b{j}}{b{{n{l}}}}}{{Bh{{Bd{Bb{Al{Aj}}}}Bf}}}}{{{b{d}}{b{AhAn}}{Al{Aj}}}{{Bh{{Bd{Bb{Al{Aj}}}}Bf}}}}{{}Bj}{{}h}{BlBn}{{{b{j}}}{{Al{Aj}}}}{{{b{j}}{b{{n{l}}}}}{{Al{Aj}}}}{{}{{Al{Aj}}}}0000{{{b{d}}An{b{{n{{Bd{{b{j}}{b{{n{l}}}}}}}}}}}Ab}{C`C`}{{C`{b{j}}}C`}1{{{b{h}}{b{AhCb}}}Cd}0{{{b{Bl}}{b{AhCb}}}Cd}{{{b{Cf}}{b{AhCb}}}Cd}0{cc{}}000000{dh}{BlA`}{ChCh}{{}{{Cl{Cj}}}}{Cjl}0{{{b{{n{Cn}}}}}l}{Cnl}{{}c{}}000000{{Ad{b{j}}{b{j}}}d}{{}Bj}{{Bb{Al{Aj}}}C`}{{{b{Ahd}}Ad}Ab}{CjA`}{{{b{j}}}l}{{{b{d}}{b{AhAn}}{Al{Aj}}{b{{n{Aj}}}}}Ab}0{{{b{d}}{b{AhAn}}{b{j}}{b{{n{l}}}}{B`{{b{l}}}}}Ab}{{{b{d}}{b{AhAn}}{b{j}}{b{{n{l}}}}{b{{n{Aj}}}}}Ab}0{CnCh}{{{b{D`}}}{{Cl{Aj}}}}{bBn}0{{{b{Bj}}}Db}{c{{Dd{e}}}{}{}}000000{{}{{Dd{c}}}{}}000000{{{b{{n{l}}}}}l}{bDf}000000{Cjl}0{{{b{{n{A`}}}}}l}{A`l}>{{{Bh{{Bd{Bb{Al{Aj}}}}Bf}}{b{{n{Aj}}}}}Ab}0{dCh}{{}c{}}000000{{Bj{Al{Dh}}}Bj}{{{b{Dj}}}Ab}{{Dl{b{Dj}}}Ab}{{Bj{Al{Dn}}}Bj}0","D":"Bn","p":[[1,"reference",null,null,1],[5,"ContractHarness",0],[5,"Contract",140],[5,"GasReporter",0],[1,"str"],[6,"Token",141],[1,"slice"],[1,"u64"],[1,"unit"],[5,"H160",142],[1,"bool"],[0,"mut"],[1,"u8"],[5,"Vec",143],[8,"Executor",0],[6,"Option",144,null,1],[6,"ExitReason",145],[1,"tuple",null,null,1],[6,"Infallible",146],[6,"Capture",145],[5,"Runtime",0],[5,"GasRecord",0],[5,"String",147],[5,"ExecutionOutput",0],[5,"Formatter",148],[8,"Result",148],[5,"SolidityCompileError",0],[5,"U256",142],[5,"NumericAbiTokenBounds",0],[1,"array"],[1,"i64"],[10,"ToBeBytes",0],[5,"Object",149],[6,"Result",150,null,1],[5,"TypeId",151],[5,"Data",149],[10,"Fn",152],[8,"Backend",0],[6,"Statement",149]],"r":[],"b":[[55,"impl-Debug-for-GasReporter"],[56,"impl-Display-for-GasReporter"],[58,"impl-Display-for-SolidityCompileError"],[59,"impl-Debug-for-SolidityCompileError"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAHUABwAAADQAOAAEAEQAAQBHAAQAUwAAAFYACwBjACcA","P":[[21,"T"],[35,""],[60,"T"],[67,""],[75,"U"],[82,""],[98,"U,T"],[105,"U"],[112,""],[128,"V"],[135,""]]}],["fe_compiler_tests",{"t":"","n":[],"q":[],"i":"","f":"","D":"`","p":[],"r":[],"b":[],"c":"OjAAAAAAAAA=","e":"OjAAAAEAAAAAAAAAEAAAAAAA","P":[]}],["fe_compiler_tests_legacy",{"t":"","n":[],"q":[],"i":"","f":"","D":"`","p":[],"r":[],"b":[],"c":"OjAAAAAAAAA=","e":"OjAAAAEAAAAAAAAAEAAAAAAA","P":[]}],["fe_driver",{"t":"KFFFFNNNNNNNNNHHMNMNMNMNMNMNMNMNMNMNMNMNMNMNMNMNHHNNNNNNNNNNONHNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNO","n":["CodegenDb","CompileError","CompiledContract","CompiledModule","Db","all_impls","borrow","","","","borrow_mut","","","","check_ingot","check_single_file","codegen_abi_contract","","codegen_abi_event","","codegen_abi_function","","codegen_abi_function_argument_maximum_size","","codegen_abi_function_return_maximum_size","","codegen_abi_module_events","","codegen_abi_type","","codegen_abi_type_maximum_size","","codegen_abi_type_minimum_size","","codegen_constant_string_symbol_name","","codegen_contract_deployer_symbol_name","","codegen_contract_symbol_name","","codegen_function_symbol_name","","codegen_legalized_body","","codegen_legalized_signature","","codegen_legalized_type","","compile_ingot","compile_single_file","contract_all_fields","contract_all_functions","contract_call_function","contract_dependency_graph","contract_field_map","contract_field_type","contract_function_map","contract_init_function","contract_public_function_map","contract_runtime_dependency_graph","contracts","default","dump_mir_single_file","enum_all_functions","enum_all_variants","enum_dependency_graph","enum_function_map","enum_variant_kind","enum_variant_map","file_content","file_line_starts","file_name","fmt","from","","","","function_body","function_dependency_graph","function_signature","function_sigs","impl_all_functions","impl_for","impl_function_map","ingot_external_ingots","ingot_files","ingot_modules","ingot_root_module","intern_attribute","intern_contract","intern_contract_field","intern_enum","intern_enum_variant","intern_file","intern_function","intern_function_sig","intern_impl","intern_ingot","intern_module","intern_module_const","intern_struct","intern_struct_field","intern_trait","intern_type","intern_type_alias","into","","","","json_abi","lookup_intern_attribute","lookup_intern_contract","lookup_intern_contract_field","lookup_intern_enum","lookup_intern_enum_variant","lookup_intern_file","lookup_intern_function","lookup_intern_function_sig","lookup_intern_impl","lookup_intern_ingot","lookup_intern_module","lookup_intern_module_const","lookup_intern_struct","lookup_intern_struct_field","lookup_intern_trait","lookup_intern_type","lookup_intern_type_alias","lookup_mir_intern_const","lookup_mir_intern_function","lookup_mir_intern_type","lowered_ast","mir_intern_const","mir_intern_function","mir_intern_type","mir_lower_contract_all_functions","mir_lower_enum_all_functions","mir_lower_module_all_functions","mir_lower_struct_all_functions","mir_lowered_constant","mir_lowered_func_body","mir_lowered_func_signature","mir_lowered_monomorphized_func_signature","mir_lowered_pseudo_monomorphized_func_signature","mir_lowered_type","module_all_impls","module_all_items","module_constant_type","module_constant_value","module_constants","module_contracts","module_file_path","module_impl_map","module_is_incomplete","module_item_map","module_parent_module","module_parse","module_structs","module_submodules","module_tests","module_used_item_map","origin","root_ingot","set_file_content","set_file_content_with_durability","set_ingot_external_ingots","set_ingot_external_ingots_with_durability","set_ingot_files","set_ingot_files_with_durability","set_root_ingot","set_root_ingot_with_durability","src_ast","struct_all_fields","struct_all_functions","struct_dependency_graph","struct_field_map","struct_field_type","struct_function_map","trait_all_functions","trait_function_map","trait_is_implemented_for","try_from","","","","try_into","","","","type_alias_type","type_id","","","","upcast","","","upcast_mut","","","vzip","","","","yul"],"q":[[0,"fe_driver"],[204,"fe_analyzer::namespace::types"],[205,"fe_analyzer::namespace::items"],[206,"alloc::rc"],[207,"fe_codegen::db"],[208,"fe_common::utils::files"],[209,"fe_common::diagnostics"],[210,"alloc::vec"],[211,"fe_abi::contract"],[212,"fe_mir::ir::types"],[213,"fe_abi::event"],[214,"fe_mir::ir::function"],[215,"fe_abi::function"],[216,"fe_abi::types"],[217,"alloc::string"],[218,"core::result"],[219,"core::option"],[220,"fe_analyzer::context"],[221,"smol_str"],[222,"indexmap::map"],[223,"fe_analyzer::errors"],[224,"fe_common::files"],[225,"core::fmt"],[226,"fe_mir::ir::constant"],[227,"alloc::collections::btree::map"],[228,"fe_parser::ast"],[229,"fe_common::span"],[230,"salsa::durability"],[231,"core::any"],[232,"fe_mir::db"],[233,"fe_common::db"],[234,"fe_analyzer::db"]],"i":"`````nCdHlCf32103``Ah4040404040404040404040404040404``444444444434`444444444132144444444444444444444444444444321424444444444444444444434444444444444444444444444444424444444443444444444321432144321444444432142","f":"`````{{bd}{{j{{h{f}}}}}}{b{{b{c}}}{}}000{{{b{l}}}{{b{lc}}}{}}000{{{b{ln}}{b{A`}}}{{Ad{Ab}}}}{{{b{ln}}{b{Af}}{b{Af}}}{{Ad{Ab}}}}{{{b{Ah}}Aj}Al}{{bAj}Al}{{{b{Ah}}An}B`}{{bAn}B`}{{{b{Ah}}Bb}Bd}{{bBb}Bd}{{{b{Ah}}Bb}Bf}{{bBb}Bf}10{{{b{Ah}}Bh}{{Ad{B`}}}}{{bBh}{{Ad{B`}}}}{{{b{Ah}}An}Bj}{{bAn}Bj}{{{b{Ah}}An}Bf}{{bAn}Bf}10{{{b{Ah}}Bl}{{j{Bl}}}}{{bBl}{{j{Bl}}}}{{{b{Ah}}Aj}{{j{Bl}}}}{{bAj}{{j{Bl}}}}10{{{b{Ah}}Bb}{{j{Bl}}}}{{bBb}{{j{Bl}}}}{{{b{Ah}}Bb}{{j{Bn}}}}{{bBb}{{j{Bn}}}}{{{b{Ah}}Bb}{{j{C`}}}}{{bBb}{{j{C`}}}}{{{b{Ah}}An}An}{{bAn}An}{{{b{ln}}{b{A`}}CbCbCb}{{Ch{CdCf}}}}{{{b{ln}}{b{Af}}{b{Af}}CbCbCb}{{Ch{CdCf}}}}{{bAj}{{j{{h{Cj}}}}}}{{bAj}{{j{{h{Cl}}}}}}{{bAj}{{D`{{Cn{Cl}}}}}}{{bAj}Db}{{bAj}{{D`{{j{{Df{DdCj}}}}}}}}{{bCj}{{D`{{Ch{dDh}}}}}}{{bAj}{{D`{{j{{Df{DdCl}}}}}}}}4{{bAj}{{j{{Df{DdCl}}}}}}4{CdDf}{{}n}{{{b{ln}}{b{Af}}{b{Af}}}{{Ch{BlCf}}}}{{bDj}{{j{{h{Cl}}}}}}{{bDj}{{j{{h{Dl}}}}}}{{bDj}{{D`{Db}}}}{{bDj}{{D`{{j{{Df{DdCl}}}}}}}}{{bDl}{{D`{{Ch{DnDh}}}}}}{{bDj}{{D`{{j{{Df{DdDl}}}}}}}}{{bE`}{{j{Af}}}}{{bE`}{{j{{h{Bf}}}}}}{{bE`}Dd}{{{b{Cf}}{b{lEb}}}Ed}{cc{}}000{{bCl}{{D`{{j{Ef}}}}}}{{bCl}Db}{{bEh}{{D`{{j{Ej}}}}}}{{bdDd}{{j{{h{Eh}}}}}}{{bf}{{j{{h{Cl}}}}}}{{bdEl}{{Cn{f}}}}{{bf}{{D`{{j{{Df{DdCl}}}}}}}}{{bEn}{{j{{Df{DdEn}}}}}}{{bEn}{{j{{h{E`}}}}}}{{bEn}{{j{{h{Bh}}}}}}{{bEn}{{Cn{Bh}}}}{{b{j{F`}}}Fb}{{b{j{Fd}}}Aj}{{b{j{Ff}}}Cj}{{b{j{Fh}}}Dj}{{b{j{Fj}}}Dl}{{bFl}E`}{{b{j{Fn}}}Cl}{{b{j{G`}}}Eh}{{b{j{Gb}}}f}{{b{j{Gd}}}En}{{b{j{Gf}}}Bh}{{b{j{Gh}}}Gj}{{b{j{Gl}}}Gn}{{b{j{H`}}}Hb}{{b{j{Hd}}}El}{{bHf}d}{{b{j{Hh}}}Hj}{{}c{}}000{HlBl}{{bFb}{{j{F`}}}}{{bAj}{{j{Fd}}}}{{bCj}{{j{Ff}}}}{{bDj}{{j{Fh}}}}{{bDl}{{j{Fj}}}}{{bE`}Fl}{{bCl}{{j{Fn}}}}{{bEh}{{j{G`}}}}{{bf}{{j{Gb}}}}{{bEn}{{j{Gd}}}}{{bBh}{{j{Gf}}}}{{bGj}{{j{Gh}}}}{{bGn}{{j{Gl}}}}{{bHb}{{j{H`}}}}{{bEl}{{j{Hd}}}}{{bd}Hf}{{bHj}{{j{Hh}}}}{{bHn}{{j{I`}}}}{{bBb}{{j{C`}}}}{{bAn}{{j{Ib}}}}{CdBl}{{b{j{I`}}}Hn}{{b{j{C`}}}Bb}{{b{j{Ib}}}An}{{bAj}{{j{{Ad{Bb}}}}}}{{bDj}{{j{{Ad{Bb}}}}}}{{bBh}{{j{{Ad{Bb}}}}}}{{bGn}{{j{{Ad{Bb}}}}}}{{bGj}Hn}{{bBb}{{j{Bn}}}}{{bCl}Bb}{{bCl{Id{Ddd}}}Bb}1{{bd}An}{{bBh}{{D`{{j{{h{f}}}}}}}}{{bBh}{{j{{h{If}}}}}}{{bGj}{{D`{{Ch{dDh}}}}}}{{bGj}{{D`{{Ch{IhIj}}}}}}{{bBh}{{j{{Ad{Gj}}}}}}{{bBh}{{j{{h{Aj}}}}}}{{bBh}Dd}{{bBh}{{D`{{j{{Df{{Il{Eld}}f}}}}}}}}{{bBh}Cb}{{bBh}{{D`{{j{{Df{DdIf}}}}}}}}{{bBh}{{Cn{Bh}}}}{{bBh}{{D`{{j{In}}}}}}{{bBh}{{j{{h{Gn}}}}}}{{bBh}{{j{{h{Bh}}}}}}{{bBh}{{Ad{Cl}}}}{{bBh}{{D`{{j{{Df{Dd{Il{J`If}}}}}}}}}}{HlAj}{bEn}{{{b{l}}E`{j{Af}}}Jb}{{{b{l}}E`{j{Af}}Jd}Jb}{{{b{l}}En{j{{Df{DdEn}}}}}Jb}{{{b{l}}En{j{{Df{DdEn}}}}Jd}Jb}{{{b{l}}En{j{{h{E`}}}}}Jb}{{{b{l}}En{j{{h{E`}}}}Jd}Jb}{{{b{l}}En}Jb}{{{b{l}}EnJd}Jb}{CdBl}{{bGn}{{j{{h{Hb}}}}}}{{bGn}{{j{{h{Cl}}}}}}{{bGn}{{D`{Db}}}}{{bGn}{{D`{{j{{Df{DdHb}}}}}}}}{{bHb}{{D`{{Ch{dDh}}}}}}{{bGn}{{D`{{j{{Df{DdCl}}}}}}}}{{bEl}{{j{{h{Eh}}}}}}{{bEl}{{D`{{j{{Df{DdEh}}}}}}}}{{bEld}Cb}{c{{Ch{e}}}{}{}}000{{}{{Ch{c}}}{}}000{{bHj}{{D`{{Ch{dDh}}}}}}{bJf}000{{{b{n}}}{{b{Jh}}}}{{{b{n}}}{{b{Jj}}}}{{{b{n}}}{{b{Jl}}}}{{{b{ln}}}{{b{lJh}}}}{{{b{ln}}}{{b{lJj}}}}{{{b{ln}}}{{b{lJl}}}}{{}c{}}000{HlBl}","D":"Ah","p":[[1,"reference",null,null,1],[5,"TypeId",204],[5,"ImplId",205],[1,"slice"],[5,"Rc",206,null,1],[0,"mut"],[5,"Db",0,207],[5,"BuildFiles",208],[5,"Diagnostic",209],[5,"Vec",210],[1,"str"],[10,"CodegenDb",0,207],[5,"ContractId",205],[5,"AbiContract",211],[5,"TypeId",212],[5,"AbiEvent",213],[5,"FunctionId",214],[5,"AbiFunction",215],[1,"usize"],[5,"ModuleId",205],[6,"AbiType",216],[5,"String",217],[5,"FunctionBody",214],[5,"FunctionSignature",214],[1,"bool"],[5,"CompiledModule",0],[5,"CompileError",0],[6,"Result",218,null,1],[5,"ContractFieldId",205],[5,"FunctionId",205],[6,"Option",219,null,1],[5,"Analysis",220],[5,"DepGraphWrapper",205],[5,"SmolStr",221],[5,"IndexMap",222],[5,"TypeError",223],[5,"EnumId",205],[5,"EnumVariantId",205],[6,"EnumVariantKind",205],[5,"SourceFileId",224],[5,"Formatter",225],[8,"Result",225],[5,"FunctionBody",220],[5,"FunctionSigId",205],[5,"FunctionSignature",204],[5,"TraitId",205],[5,"IngotId",205],[5,"Attribute",205],[5,"AttributeId",205],[5,"Contract",205],[5,"ContractField",205],[5,"Enum",205],[5,"EnumVariant",205],[5,"File",224],[5,"Function",205],[5,"FunctionSig",205],[5,"Impl",205],[5,"Ingot",205],[5,"Module",205],[5,"ModuleConstant",205],[5,"ModuleConstantId",205],[5,"Struct",205],[5,"StructId",205],[5,"StructField",205],[5,"StructFieldId",205],[5,"Trait",205],[6,"Type",204],[5,"TypeAlias",205],[5,"TypeAliasId",205],[5,"CompiledContract",0],[5,"ConstantId",226],[5,"Constant",226],[5,"Type",212],[5,"BTreeMap",227],[6,"Item",205],[6,"Constant",220],[5,"ConstEvalError",223],[1,"tuple",null,null,1],[5,"Module",228],[5,"Span",229],[1,"unit"],[5,"Durability",230],[5,"TypeId",231],[10,"MirDb",232],[10,"SourceDb",233],[10,"AnalyzerDb",234]],"r":[[0,207],[4,207],[5,207],[9,207],[13,207],[16,207],[17,207],[18,207],[19,207],[20,207],[21,207],[22,207],[23,207],[24,207],[25,207],[26,207],[27,207],[28,207],[29,207],[30,207],[31,207],[32,207],[33,207],[34,207],[35,207],[36,207],[37,207],[38,207],[39,207],[40,207],[41,207],[42,207],[43,207],[44,207],[45,207],[46,207],[47,207],[50,207],[51,207],[52,207],[53,207],[54,207],[55,207],[56,207],[57,207],[58,207],[59,207],[61,207],[63,207],[64,207],[65,207],[66,207],[67,207],[68,207],[69,207],[70,207],[71,207],[76,207],[77,207],[78,207],[79,207],[80,207],[81,207],[82,207],[83,207],[84,207],[85,207],[86,207],[87,207],[88,207],[89,207],[90,207],[91,207],[92,207],[93,207],[94,207],[95,207],[96,207],[97,207],[98,207],[99,207],[100,207],[101,207],[102,207],[103,207],[104,207],[108,207],[110,207],[111,207],[112,207],[113,207],[114,207],[115,207],[116,207],[117,207],[118,207],[119,207],[120,207],[121,207],[122,207],[123,207],[124,207],[125,207],[126,207],[127,207],[128,207],[129,207],[131,207],[132,207],[133,207],[134,207],[135,207],[136,207],[137,207],[138,207],[139,207],[140,207],[141,207],[142,207],[143,207],[144,207],[145,207],[146,207],[147,207],[148,207],[149,207],[150,207],[151,207],[152,207],[153,207],[154,207],[155,207],[156,207],[157,207],[158,207],[159,207],[161,207],[162,207],[163,207],[164,207],[165,207],[166,207],[167,207],[168,207],[169,207],[171,207],[172,207],[173,207],[174,207],[175,207],[176,207],[177,207],[178,207],[179,207],[183,207],[187,207],[188,207],[192,207],[193,207],[194,207],[195,207],[196,207],[197,207],[198,207],[202,207]],"b":[[193,"impl-Upcast%3Cdyn+MirDb%3E-for-Db"],[194,"impl-Upcast%3Cdyn+SourceDb%3E-for-Db"],[195,"impl-Upcast%3Cdyn+AnalyzerDb%3E-for-Db"],[196,"impl-UpcastMut%3Cdyn+MirDb%3E-for-Db"],[197,"impl-UpcastMut%3Cdyn+SourceDb%3E-for-Db"],[198,"impl-UpcastMut%3Cdyn+AnalyzerDb%3E-for-Db"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAMAABgAAAAIABQArADIADABAAAkATgAbAG4AXgA=","P":[[6,"T"],[14,""],[73,"T"],[77,""],[105,"U"],[109,""],[180,"U,T"],[184,"U"],[188,""],[199,"V"],[203,""]]}],["fe_library",{"t":"SEHH","n":["STD","include_dir","static_dir_files","std_src_files"],"q":[[0,"fe_library"],[4,"include_dir::dir"],[5,"alloc::vec"]],"i":"````","f":"{{}b}`{{{d{b}}}{{j{{h{{d{f}}{d{f}}}}}}}}{{}{{j{{h{{d{f}}{d{f}}}}}}}}","D":"`","p":[[5,"Dir",4],[1,"reference",null,null,1],[1,"str"],[1,"tuple",null,null,1],[5,"Vec",5]],"r":[],"b":[],"c":"OjAAAAAAAAA=","e":"OjAAAAEAAAAAAAQAEAAAAAAAAQACAAMABAA=","P":[]}],["fe_mir",{"t":"CCCCCEEEECCCCFFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNFFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNFFIFNNNNNNONNNNNNNNNNNNNNNNNNONNNNNNNNNNNONNNNNNNNNNNNPPPFGNNNNNNNNNNNNNNNNNNNNNNNNNNNNKFFFFFFFFFFFFFFFFFFFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNOMNOMNONNMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNOMNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHEEEEEEEEEEFEEEEECCCCNNNNNCNNNNNNNNNCNOCNNONNNNCCFINNNNNNNNNNNNNNNNNNFNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNPPFGPPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNPFFGPPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOONNNNNNNNNNONNNOFPFFFFGPPNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNONONOONNNNONONNNOOONNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNPPPPPPPPPPGPPPPPIPPPGPPPGPPPPPPPGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPFIGPPPPGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPFPGPPIIPPGPPPPPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPFPPPFFFPPPPPPPPFPPPFPFFFGPPPPPPPNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOONNOOOOOOONNNNNNOOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNOOPGPPFPPPPGPINNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONOONNONNNNNNNNNNNNONNNNNOOOOOOOOOOOKMN","n":["analysis","db","graphviz","ir","pretty_print","ControlFlowGraph","DomTree","LoopTree","PostDomTree","cfg","domtree","loop_tree","post_domtree","CfgPostOrder","ControlFlowGraph","borrow","","borrow_mut","","clone","clone_into","clone_to_uninit","compute","entry","eq","equivalent","","","","fmt","from","","into","","into_iter","next","post_order","preds","succs","to_owned","try_from","","try_into","","type_id","","DFSet","DomTree","borrow","","borrow_mut","","clone","clone_into","clone_to_uninit","compute","compute_df","default","dominates","fmt","","from","","frontier_num","frontiers","idom","into","","is_reachable","rpo","strictly_dominates","to_owned","try_from","","try_into","","type_id","","BlocksInLoopPostOrder","Loop","LoopId","LoopTree","borrow","","","borrow_mut","","","children","clone","","clone_into","","clone_to_uninit","","compute","default","eq","equivalent","","","","fmt","","from","","","header","into","","","into_iter","is_block_in_loop","iter_blocks_post_order","loop_header","loop_num","loop_of_block","loops","next","parent","parent_loop","to_owned","","try_from","","","try_into","","","type_id","","","Block","DummyEntry","DummyExit","PostDomTree","PostIDom","borrow","","borrow_mut","","clone","clone_into","clone_to_uninit","compute","eq","equivalent","","","","fmt","","from","","into","","is_reachable","post_idom","to_owned","try_from","","try_into","","type_id","","MirDb","MirDbGroupStorage__","MirDbStorage","MirInternConstLookupQuery","MirInternConstQuery","MirInternFunctionLookupQuery","MirInternFunctionQuery","MirInternTypeLookupQuery","MirInternTypeQuery","MirLowerContractAllFunctionsQuery","MirLowerEnumAllFunctionsQuery","MirLowerModuleAllFunctionsQuery","MirLowerStructAllFunctionsQuery","MirLoweredConstantQuery","MirLoweredFuncBodyQuery","MirLoweredFuncSignatureQuery","MirLoweredMonomorphizedFuncSignatureQuery","MirLoweredPseudoMonomorphizedFuncSignatureQuery","MirLoweredTypeQuery","NewDb","all_impls","borrow","","","","","","","","","","","","","","","","","","","borrow_mut","","","","","","","","","","","","","","","","","","","contract_all_fields","contract_all_functions","contract_call_function","contract_dependency_graph","contract_field_map","contract_field_type","contract_function_map","contract_init_function","contract_public_function_map","contract_runtime_dependency_graph","default","","","","","","","","","","","","","","","","","enum_all_functions","enum_all_variants","enum_dependency_graph","enum_function_map","enum_variant_kind","enum_variant_map","execute","","","","","","","","","","file_content","file_line_starts","file_name","fmt","","","","","","","","","","","","","","","","fmt_index","","for_each_query","","from","","","","","","","","","","","","","","","","","","","function_body","function_dependency_graph","function_signature","function_sigs","group_storage","","","impl_all_functions","impl_for","impl_function_map","in_db","","","","","","","","","","","","","","","","in_db_mut","","","","","","","","","","","","","","","","ingot_external_ingots","ingot_files","ingot_modules","ingot_root_module","intern_attribute","intern_contract","intern_contract_field","intern_enum","intern_enum_variant","intern_file","intern_function","intern_function_sig","intern_impl","intern_ingot","intern_module","intern_module_const","intern_struct","intern_struct_field","intern_trait","intern_type","intern_type_alias","into","","","","","","","","","","","","","","","","","","","lookup_intern_attribute","lookup_intern_contract","lookup_intern_contract_field","lookup_intern_enum","lookup_intern_enum_variant","lookup_intern_file","lookup_intern_function","lookup_intern_function_sig","lookup_intern_impl","lookup_intern_ingot","lookup_intern_module","lookup_intern_module_const","lookup_intern_struct","lookup_intern_struct_field","lookup_intern_trait","lookup_intern_type","lookup_intern_type_alias","lookup_mir_intern_const","","","lookup_mir_intern_function","","","lookup_mir_intern_type","","","maybe_changed_since","","mir_intern_const","","","mir_intern_function","","","mir_intern_type","","","mir_lower_contract_all_functions","","","mir_lower_enum_all_functions","","","mir_lower_module_all_functions","","","mir_lower_struct_all_functions","","","mir_lowered_constant","","","mir_lowered_func_body","","","mir_lowered_func_signature","","","mir_lowered_monomorphized_func_signature","","","mir_lowered_pseudo_monomorphized_func_signature","","","mir_lowered_type","","","module_all_impls","module_all_items","module_constant_type","module_constant_value","module_constants","module_contracts","module_file_path","module_impl_map","module_is_incomplete","module_item_map","module_parent_module","module_parse","module_structs","module_submodules","module_tests","module_used_item_map","new","ops_database","ops_salsa_runtime","ops_salsa_runtime_mut","query_storage","","","","","","","","","","","","","","","","root_ingot","set_file_content","set_file_content_with_durability","set_ingot_external_ingots","set_ingot_external_ingots_with_durability","set_ingot_files","set_ingot_files_with_durability","set_root_ingot","set_root_ingot_with_durability","struct_all_fields","struct_all_functions","struct_dependency_graph","struct_field_map","struct_field_type","struct_function_map","trait_all_functions","trait_function_map","trait_is_implemented_for","try_from","","","","","","","","","","","","","","","","","","","try_into","","","","","","","","","","","","","","","","","","","type_alias_type","type_id","","","","","","","","","","","","","","","","","","","upcast","","upcast_mut","","write_mir_graphs","BasicBlock","BasicBlockId","Constant","ConstantId","FunctionBody","FunctionId","FunctionParam","FunctionSignature","Inst","InstId","SourceInfo","Type","TypeId","TypeKind","Value","ValueId","basic_block","body_builder","body_cursor","body_order","borrow","borrow_mut","clone","clone_into","clone_to_uninit","constant","dummy","eq","equivalent","","","","fmt","from","","function","hash","id","inst","into","is_dummy","span","to_owned","try_from","try_into","type_id","types","value","BasicBlock","BasicBlockId","borrow","borrow_mut","clone","clone_into","clone_to_uninit","eq","equivalent","","","","fmt","from","hash","into","to_owned","try_from","try_into","type_id","BodyBuilder","abi_encode","add","aggregate_access","aggregate_construct","bind","bit_and","bit_or","bit_xor","body","borrow","borrow_mut","branch","build","call","create","create2","current_block","declare","div","emit","eq","fmt","from","func_id","ge","gt","inst_data","inst_result","into","inv","is_block_terminated","is_current_block_terminated","jump","keccak256","le","load","logical_and","logical_or","lt","make_block","make_constant","make_imm","make_imm_from_bool","make_unit","make_value","map_access","map_result","mem_copy","modulo","move_to_block","move_to_block_top","mul","ne","neg","new","nop","not","pow","primitive_cast","remove_inst","ret","revert","shl","shr","store_func_arg","sub","switch","try_from","try_into","type_id","untag_cast","value_data","value_ty","yul_intrinsic","BlockBottom","BlockTop","BodyCursor","CursorLocation","Inst","NoWhere","back","body","body_mut","borrow","","borrow_mut","","clone","clone_into","clone_to_uninit","eq","equivalent","","","","expect_block","expect_inst","fmt","from","","insert_block","insert_inst","into","","loc","map_result","new","new_at_entry","next_block","next_loc","prev_block","prev_loc","proceed","remove_block","remove_inst","set_loc","set_to_entry","store_and_insert_block","store_and_insert_inst","to_owned","try_from","","try_into","","type_id","","BodyOrder","append_block","append_inst","block_num","borrow","borrow_mut","clone","clone_into","clone_to_uninit","entry","eq","equivalent","","","","first_inst","fmt","from","insert_block_after_block","insert_block_before_block","insert_inst_after","insert_inst_before_inst","inst_block","into","is_block_empty","is_block_inserted","is_inst_inserted","is_terminated","iter_block","iter_inst","last_block","last_inst","new","next_block","next_inst","prepend_inst","prev_block","prev_inst","remove_block","remove_inst","terminator","to_owned","try_from","try_into","type_id","Bool","Constant","ConstantId","ConstantValue","Immediate","Str","as_intern_id","borrow","","","borrow_mut","","","clone","","","clone_into","","","clone_to_uninit","","","data","eq","","","equivalent","","","","","","","","","","","","fmt","","","from","","","","from_intern_id","hash","","","into","","","module_id","name","source","to_owned","","","try_from","","","try_into","","","ty","","type_id","","","value","BodyDataStore","Export","FunctionBody","FunctionId","FunctionParam","FunctionSignature","Linkage","Private","Public","analyzer_func","analyzer_func_id","as_intern_id","body","borrow","","","","","","borrow_mut","","","","","","branch_info","clone","","","","","","clone_into","","","","","","clone_to_uninit","","","","","","cmp","compare","debug_name","default","eq","","","","","","equivalent","","","","","","","","","","","","","","","","","","","","","","","","fid","fmt","","","","","","from","","","","","","from_intern_id","func_args","func_args_mut","hash","","","","inst_data","inst_data_mut","inst_result","into","","","","","","is_contract_init","is_exported","is_nop","is_terminator","linkage","","local_name","locals","locals_mut","map_result","module","module_id","name","","new","order","params","partial_cmp","remove_inst_result","replace_inst","replace_value","resolved_generics","return_type","","returns_aggregate","rewrite_branch_dest","signature","source","","store","store_block","store_inst","store_value","to_owned","","","","","","try_from","","","","","","try_into","","","","","","ty","type_id","","","","","","type_suffix","value_data","value_data_mut","value_ty","values","values_mut","AbiEncode","Add","","Addmod","Address","AggregateAccess","AggregateConstruct","And","Balance","Basefee","BinOp","Binary","Bind","BitAnd","BitOr","BitXor","BlockIter","Blockhash","Branch","","BranchInfo","Byte","Call","","CallType","Callcode","Calldatacopy","Calldataload","Calldatasize","Caller","Callvalue","Cast","CastKind","Chain","","","","","Chainid","Codecopy","Codesize","Coinbase","Create","","Create2","","Declare","Delegatecall","Div","","Emit","Eq","","Exp","Extcodecopy","Extcodehash","Extcodesize","External","Gas","Gaslimit","Gasprice","Ge","Gt","","Inst","InstId","InstKind","Internal","Inv","Invalid","Iszero","IterBase","IterMutBase","Jump","","Keccak256","","Le","Load","Log0","Log1","Log2","Log3","Log4","LogicalAnd","LogicalOr","Lt","","MapAccess","MemCopy","Mload","Mod","","Msize","Mstore","Mstore8","Mul","","Mulmod","Ne","Neg","Nop","Not","","NotBranch","Number","One","","","","","Or","Origin","Pc","Pop","Pow","Prevrandao","Primitive","Return","","Returndatacopy","Returndatasize","Revert","","Sar","Sdiv","Selfbalance","Selfdestruct","Sgt","Shl","","Shr","","Signextend","Slice","","","","","Sload","Slt","Smod","Sstore","Staticcall","Stop","Sub","","Switch","","SwitchTable","Timestamp","UnOp","Unary","Untag","ValueIter","ValueIterMut","Xor","YulIntrinsic","YulIntrinsicOp","Zero","","","","","add_arm","args","args_mut","binary","block_iter","borrow","","","","","","","","","","","borrow_mut","","","","","","","","","","","branch_info","cjk_compat_variants","clone","","","","","","","","clone_into","","","","","","","","clone_to_uninit","","","","","","","","default","eq","","","","","","","","equivalent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","fmt","","","","","","","","","","","","from","","","","","","","","","","","","hash","","","","","","","","into","","","","","","","","","","","into_iter","","intrinsic","is_empty","is_not_a_branch","is_terminator","","iter","kind","len","new","next","","nfc","nfd","nfkc","nfkd","nop","pretty_print","source","stream_safe","to_owned","","","","","","","","to_string","","","","try_from","","","","","","","","","","","try_into","","","","","","","","","","","type_id","","","","","","","","","","","unary","arg","","","","","args","","","call_type","cond","contract","","default","dest","disc","else_","func","indices","key","kind","lhs","local","op","","","rhs","salt","src","","","table","then","to","ty","value","","","","","","Address","Array","ArrayDef","Bool","Contract","Enum","EnumDef","EnumVariant","EventDef","I128","I16","I256","I32","I64","I8","MPtr","Map","MapDef","SPtr","String","Struct","StructDef","Tuple","TupleDef","Type","TypeId","TypeKind","U128","U16","U256","U32","U64","U8","Unit","aggregate_elem_offset","aggregate_field_num","align_of","analyzer_ty","","array_elem_size","as_intern_id","as_string","borrow","","","","","","","","","","borrow_mut","","","","","","","","","","clone","","","","","","","","","","clone_into","","","","","","","","","","clone_to_uninit","","","","","","","","","","data","deref","elem_ty","enum_data_offset","enum_disc_type","enum_variant_type","eq","","","","","","","","","","equivalent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","fields","","fmt","","","","","","","","","","from","","","","","","","","","","from_intern_id","hash","","","","","","","","","","index_from_fname","into","","","","","","","","","","is_address","is_aggregate","is_array","is_contract","is_enum","is_integral","is_map","is_mptr","is_primitive","is_ptr","is_signed","is_sptr","is_string","is_struct","is_unit","is_zero_sized","items","key_ty","kind","len","make_mptr","make_sptr","module_id","","","name","","","","new","pretty_print","print","projection_ty","projection_ty_imm","size_of","span","","","","tag_type","to_owned","","","","","","","","","","try_from","","","","","","","","","","try_into","","","","","","","","","","ty","type_id","","","","","","","","","","value_ty","variants","Aggregate","AssignableValue","Constant","Immediate","Local","","Map","Temporary","Unit","Value","","ValueId","arg_local","borrow","","","borrow_mut","","","clone","","","clone_into","","","clone_to_uninit","","","eq","","","equivalent","","","","","","","","","","","","fmt","","","from","","","","hash","","","into","","","is_arg","is_imm","is_tmp","name","pretty_print","","source","tmp_local","to_owned","","","try_from","","","try_into","","","ty","","","type_id","","","user_local","value_id","idx","key","lhs","","constant","imm","inst","ty","","","","PrettyPrint","pretty_print","pretty_string"],"q":[[0,"fe_mir"],[5,"fe_mir::analysis"],[13,"fe_mir::analysis::cfg"],[46,"fe_mir::analysis::domtree"],[78,"fe_mir::analysis::loop_tree"],[132,"fe_mir::analysis::post_domtree"],[165,"fe_mir::db"],[574,"fe_mir::graphviz"],[575,"fe_mir::ir"],[623,"fe_mir::ir::basic_block"],[643,"fe_mir::ir::body_builder"],[718,"fe_mir::ir::body_cursor"],[770,"fe_mir::ir::body_order"],[815,"fe_mir::ir::constant"],[885,"fe_mir::ir::function"],[1056,"fe_mir::ir::inst"],[1424,"fe_mir::ir::inst::InstKind"],[1464,"fe_mir::ir::types"],[1739,"fe_mir::ir::value"],[1820,"fe_mir::ir::value::AssignableValue"],[1824,"fe_mir::ir::value::Value"],[1831,"fe_mir::pretty_print"],[1834,"core::fmt"],[1835,"core::option"],[1836,"core::result"],[1837,"core::any"],[1838,"core::iter::traits::iterator"],[1839,"alloc::vec"],[1840,"fe_analyzer::namespace::types"],[1841,"fe_analyzer::namespace::items"],[1842,"alloc::rc"],[1843,"fe_analyzer::context"],[1844,"smol_str"],[1845,"indexmap::map"],[1846,"fe_analyzer::errors"],[1847,"fe_common::files"],[1848,"salsa"],[1849,"salsa::runtime"],[1850,"core::ops::function"],[1851,"alloc::sync"],[1852,"salsa::revision"],[1853,"alloc::collections::btree::map"],[1854,"fe_parser::ast"],[1855,"fe_common::span"],[1856,"salsa::durability"],[1857,"fe_common::db"],[1858,"fe_analyzer::db"],[1859,"std::io::error"],[1860,"std::io"],[1861,"fe_parser::node"],[1862,"core::hash"],[1863,"num_bigint::bigint"],[1864,"core::convert"],[1865,"salsa::intern_id"],[1866,"core::cmp"],[1867,"unicode_normalization::replace"],[1868,"fe_analyzer::builtins"],[1869,"core::marker"],[1870,"unicode_normalization::recompose"],[1871,"unicode_normalization::decompose"],[1872,"unicode_normalization::stream_safe"],[1873,"alloc::string"],[1874,"num_traits::cast"],[1875,"alloc::boxed"]],"i":"```````````````Aff10000000000001010110000101010``B`Bb1011111011010001101111101010````CbBnBj21001010101100000102100210211111120110210210210Cd00``Cf101111011111010101001010101````````````````````FnAIbGjDnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlFnAIbGjDnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlFn0000000000DnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlFn000000:987654321000DnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlGjFn10AIb2DnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlFn0000000000DnE`EbEdEfEhEjElEnF`FbFdFfFhFjFl?>=<;:9876543210Fn00000000000000000000AIbGjDnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlFn00000000000000000Gl1Gj1201200212012012012012012012012012012012012012022222222222222220222DnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlFn00000000000000000AIbGjDnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlFnAIbGjDnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlFn0AIbGjDnE`EbEdEfEhEjElEnF`FbFdFfFhFjFlFn0000`````````````````````Nl0000`000000000`00`0000000````Od00000000000000000`Of0000000000000000000000000000000000000000000000000000000000000000000000000AA`0``00A@n000101111111110010100010000000000000001010101`AAb0000000000000000000000000000000000000000000AAh```00L`Lb12012012012012101200001111222201201221012012000012012012100120`AAn`````00LfLh110AAl23lAAd32451003245103245103245104440324510333322224444555511110000132451032451040032450003245104500430000434211340003434042110003245103245103245102324510400000ABlABfA@l0022000`22111`0AAj3`131`1111113`ABhABbABdACdACh6666868686768766666Ol777887```0ABn88``7::89:888889998::89888898890:087865432888898AC`;999;999999:9:9976543999999:98;`9`;0``9;`76543A@jA@`00::650=13<42;:650=13<42;060=13<42;0=13<42;0=13<42;10=13<42;0000====11113333<<<<44442222;;;;0=133<<442;;:650=13<42;;0=13<42;:650=13<42;6501:0;10106566660Oj171>24=53<4=5<;761>24=53<;761>24=53<;761>24=53<1ADdADfADhADjADlADnAE`AEb1AEdAEfAEhAEjAEl146AEnAF`AFbAFdAFfAFh2;28AFjAFlAFn:=6ADn4798={{{b{Gl}}G`}{{Cl{{Bl{Lf}}}}}}{{bG`}{{Cl{{Bl{Lf}}}}}}{GjLd}{{{b{Gl}}Ib}{{Cl{{Bl{Lf}}}}}}{{bIb}{{Cl{{Bl{Lf}}}}}}2{{{b{Gl}}Kb}{{Cl{{Bl{Lf}}}}}}{{bKb}{{Cl{{Bl{Lf}}}}}}4{{{b{Gl}}Jn}L`}{{bJn}L`}6{{{b{Gl}}Lf}{{Cl{l}}}}{{bLf}{{Cl{l}}}}8{{{b{Gl}}Db}Lf}{{bDb}Lf}:{{{b{Gl}}Db{M`{DhCh}}}Lf}{{bDb{M`{DhCh}}}Lf}<32<{{{b{Gl}}Ch}Lj}{{bCh}Lj}>{{bIb}{{Dd{{Cl{{Aj{Cj}}}}}}}}{{bIb}{{Cl{{Aj{Mb}}}}}}{{bJn}{{Dd{{Al{ChDl}}}}}}{{bJn}{{Dd{{Al{MdMf}}}}}}{{bIb}{{Cl{{Bl{Jn}}}}}}{{bIb}{{Cl{{Aj{Cn}}}}}}{{bIb}Dh}{{bIb}{{Dd{{Cl{{Dj{{Mh{HjCh}}Cj}}}}}}}}{{bIb}A`}{{bIb}{{Dd{{Cl{{Dj{DhMb}}}}}}}}{{bIb}{{Ah{Ib}}}}{{bIb}{{Dd{{Cl{Mj}}}}}}{{bIb}{{Cl{{Aj{Kb}}}}}}{{bIb}{{Cl{{Aj{Ib}}}}}}{{bIb}{{Bl{Db}}}}{{bIb}{{Dd{{Cl{{Dj{Dh{Mh{MlMb}}}}}}}}}}{MnGj}{{{b{Fn}}}{{b{N`}}}}{{{b{Fn}}}{{b{H`}}}}{{{b{dFn}}}{{b{dH`}}}}{{{b{c}}}{{b{{Ld{e}}}}}{}{}}000000000000000{bI`}{{{b{d}}Gf{Cl{Gh}}}h}{{{b{d}}Gf{Cl{Gh}}Nb}h}{{{b{d}}I`{Cl{{Dj{DhI`}}}}}h}{{{b{d}}I`{Cl{{Dj{DhI`}}}}Nb}h}{{{b{d}}I`{Cl{{Aj{Gf}}}}}h}{{{b{d}}I`{Cl{{Aj{Gf}}}}Nb}h}{{{b{d}}I`}h}{{{b{d}}I`Nb}h}{{bKb}{{Cl{{Aj{Kf}}}}}}{{bKb}{{Cl{{Aj{Db}}}}}}{{bKb}{{Dd{Df}}}}{{bKb}{{Dd{{Cl{{Dj{DhKf}}}}}}}}{{bKf}{{Dd{{Al{ChDl}}}}}}{{bKb}{{Dd{{Cl{{Dj{DhDb}}}}}}}}{{bHj}{{Cl{{Aj{Hf}}}}}}{{bHj}{{Dd{{Cl{{Dj{DhHf}}}}}}}}{{bHjCh}A`}{c{{Al{e}}}{}{}}000000000000000000{{}{{Al{c}}}{}}000000000000000000{{bKn}{{Dd{{Al{ChDl}}}}}}{bAn}000000000000000000{{{b{Fn}}}{{b{Nd}}}}{{{b{Fn}}}{{b{Nf}}}}{{{b{dFn}}}{{b{dNd}}}}{{{b{dFn}}}{{b{dNf}}}}{{{b{Gl}}Ib{b{dc}}}{{Nh{h}}}Nj}````````````````````{b{{b{c}}}{}}{{{b{d}}}{{b{dc}}}{}}{{{b{Nl}}}Nl}{{b{b{dc}}}h{}}{{bj}h}`{{}Nl}{{{b{Nl}}{b{Nl}}}A`}{{b{b{c}}}A`{}}000{{{b{Nl}}{b{dAb}}}Ad}{cc{}}{{{b{{Nn{c}}}}}Nl{}}`{{{b{Nl}}{b{dc}}}hO`}{NlOb}`{{}c{}}{{{b{Nl}}}A`}{NlMl}{bc{}}{c{{Al{e}}}{}{}}{{}{{Al{c}}}{}}{bAn}````{b{{b{c}}}{}}{{{b{d}}}{{b{dc}}}{}}{{{b{Od}}}Od}{{b{b{dc}}}h{}}{{bj}h}{{{b{Od}}{b{Od}}}A`}{{b{b{c}}}A`{}}000{{{b{Od}}{b{dAb}}}Ad}{cc{}}{{{b{Od}}{b{dc}}}hO`}{{}c{}}>=<;`{{{b{dOf}}OhNl}Oj}{{{b{dOf}}OhOhNl}Oj}{{{b{dOf}}Oh{Bl{Oh}}Nl}Oj}{{{b{dOf}}Lj{Bl{Oh}}Nl}Oj}3222{Ofl}?>{{{b{dOf}}OhnnNl}Oj}1{{{b{dOf}}Lf{Bl{Oh}}OlNl}Oj}{{{b{dOf}}OhCnNl}Oj}{{{b{dOf}}OhOhCnNl}Oj}{{{b{dOf}}}n}{{{b{dOf}}On}Oh}9:9{{{b{Of}}{b{dAb}}}Ad}>{{{b{Of}}}Lf};;{{{b{Of}}Oj}{{b{A@`}}}}{{{b{dOf}}Oj}{{Ah{{b{A@b}}}}}}?>{{{b{dOf}}n}A`}{{{b{dOf}}}A`}{{{b{dOf}}nNl}Oj}{{{b{dOf}}OhNl}Oj}{{{b{dOf}}OhOhNl}Oj}1000:{{{b{dOf}}L`Lj}Oh}{{{b{dOf}}A@dLj}Oh}{{{b{dOf}}A`Lj}Oh}{{{b{dOf}}Lj}Oh}{{{b{dOf}}c}Oh{{A@h{A@f}}}}5{{{b{dOf}}OjA@b}h}76{{{b{dOf}}n}h}0778{{LfNl}Of}{{{b{dOf}}Nl}Oj}:9{{{b{dOf}}OhLjNl}Oj}{{{b{dOf}}Oj}h}<{{{b{dOf}}{Ah{Oh}}Nl}Oj}<<{{{b{dOf}}On}Oh}={{{b{dOf}}OhA@j{Ah{n}}Nl}Oj}{c{{Al{e}}}{}{}}{{}{{Al{c}}}{}}{bAn}7{{{b{dOf}}Oh}{{b{A@f}}}}{{{b{dOf}}Oh}Lj}{{{b{dOf}}A@l{Bl{Oh}}Nl}Oj}``````{{{b{dA@n}}}h}{{{b{A@n}}}{{b{l}}}}{{{b{dA@n}}}{{b{dl}}}}{b{{b{c}}}{}}0{{{b{d}}}{{b{dc}}}{}}0{{{b{AA`}}}AA`}{{b{b{dc}}}h{}}{{bj}h}{{{b{AA`}}{b{AA`}}}A`}{{b{b{c}}}A`{}}000{{{b{A@n}}}n}{{{b{A@n}}}Oj}{{{b{AA`}}{b{dAb}}}Ad}{cc{}}0{{{b{dA@n}}n}h}{{{b{dA@n}}Oj}h}{{}c{}}0{{{b{A@n}}}AA`}{{{b{dA@n}}A@b}{{Ah{Oh}}}}{{{b{dl}}AA`}A@n}{{{b{dl}}}A@n}{{{b{A@n}}}{{Ah{n}}}}404{{{b{dA@n}}}h}00{{{b{dA@n}}AA`}h}1{{{b{dA@n}}Od}n}{{{b{dA@n}}A@`}Oj}{bc{}}{c{{Al{e}}}{}{}}0{{}{{Al{c}}}{}}0{bAn}0`{{{b{dAAb}}n}h}{{{b{dAAb}}Ojn}h}{{{b{AAb}}}Bd}{b{{b{c}}}{}}{{{b{d}}}{{b{dc}}}{}}{{{b{AAb}}}AAb}{{b{b{dc}}}h{}}{{bj}h}{{{b{AAb}}}n}{{{b{AAb}}{b{AAb}}}A`}{{b{b{c}}}A`{}}000{{{b{AAb}}n}{{Ah{Oj}}}}{{{b{AAb}}{b{dAb}}}Ad}{cc{}}{{{b{dAAb}}nn}h}0{{{b{dAAb}}OjOj}h}0{{{b{AAb}}Oj}n}{{}c{}}{{{b{AAb}}n}A`}0{{{b{AAb}}Oj}A`}{{{b{AAb}}{b{AAd}}n}A`}{{{b{AAb}}}{{`{{Bh{}{{Bf{n}}}}}}}}{{{b{AAb}}n}{{`{{Bh{}{{Bf{Oj}}}}}}}}>;{nAAb}{{{b{AAb}}n}{{Ah{n}}}}{{{b{AAb}}Oj}{{Ah{Oj}}}}{{{b{dAAb}}Ojn}h}21{{{b{dAAb}}n}h}{{{b{dAAb}}Oj}h}{{{b{AAb}}{b{AAd}}n}{{Ah{Oj}}}}{bc{}}{c{{Al{e}}}{}{}}{{}{{Al{c}}}{}}{bAn}``````{{{b{L`}}}AAf}{b{{b{c}}}{}}00{{{b{d}}}{{b{dc}}}{}}00{{{b{Lb}}}Lb}{{{b{L`}}}L`}{{{b{AAh}}}AAh}{{b{b{dc}}}h{}}00{{bj}h}00{{L`{b{Gl}}}{{Cl{Lb}}}}{{{b{Lb}}{b{Lb}}}A`}{{{b{L`}}{b{L`}}}A`}{{{b{AAh}}{b{AAh}}}A`}{{b{b{c}}}A`{}}00000000000{{{b{Lb}}{b{dAb}}}Ad}{{{b{L`}}{b{dAb}}}Ad}{{{b{AAh}}{b{dAb}}}Ad}{cc{}}00{MdAAh}{AAfL`}{{{b{Lb}}{b{dc}}}hO`}{{{b{L`}}{b{dc}}}hO`}{{{b{AAh}}{b{dc}}}hO`}{{}c{}}00{LbIb}{LbDh}{LbNl}{bc{}}00{c{{Al{e}}}{}{}}00{{}{{Al{c}}}{}}00{{L`{b{Gl}}}Lj}{LbLj}{bAn}00{LbAAh}`````````{{Lf{b{Gl}}}Db}{LhDb}{{{b{Lf}}}AAf}{{Lf{b{Gl}}}{{Cl{l}}}}{b{{b{c}}}{}}00000{{{b{d}}}{{b{dc}}}{}}00000{{{b{AAd}}Oj}AAj}{{{b{Lh}}}Lh}{{{b{AAl}}}AAl}{{{b{Lf}}}Lf}{{{b{AAn}}}AAn}{{{b{l}}}l}{{{b{AAd}}}AAd}{{b{b{dc}}}h{}}00000{{bj}h}00000{{{b{Lf}}{b{Lf}}}AB`}{{b{b{c}}}AB`{}}{{Lf{b{Gl}}}Dh}{{}AAd}{{{b{Lh}}{b{Lh}}}A`}{{{b{AAl}}{b{AAl}}}A`}{{{b{Lf}}{b{Lf}}}A`}{{{b{AAn}}{b{AAn}}}A`}{{{b{l}}{b{l}}}A`}{{{b{AAd}}{b{AAd}}}A`}{{b{b{c}}}A`{}}00000000000000000000000{lLf}{{{b{Lh}}{b{dAb}}}Ad}{{{b{AAl}}{b{dAb}}}Ad}{{{b{Lf}}{b{dAb}}}Ad}{{{b{AAn}}{b{dAb}}}Ad}{{{b{l}}{b{dAb}}}Ad}{{{b{AAd}}{b{dAb}}}Ad}{cc{}}00000{AAfLf}{{{b{AAd}}}{{`{{Bh{}{{Bf{Oh}}}}}}}}{{{b{dAAd}}}{{`{{Bh{}{{Bf{{b{dA@f}}}}}}}}}}{{{b{Lh}}{b{dc}}}hO`}{{{b{AAl}}{b{dc}}}hO`}{{{b{Lf}}{b{dc}}}hO`}{{{b{AAn}}{b{dc}}}hO`}{{{b{AAd}}Oj}{{b{A@`}}}}{{{b{dAAd}}Oj}{{b{dA@`}}}}{{{b{AAd}}Oj}{{Ah{{b{A@b}}}}}}{{}c{}}00000{{Lf{b{Gl}}}A`}{AAnA`}{{{b{AAd}}Oj}A`}0{{Lf{b{Gl}}}AAn}{LhAAn}{{{b{AAd}}Oh}{{Ah{{b{Gh}}}}}}{{{b{AAd}}}{{b{{Aj{Oh}}}}}}{{{b{dAAd}}}{{b{{Aj{Oh}}}}}}{{{b{dAAd}}OjA@b}h}{{Lf{b{Gl}}}Ib}{LhIb}{{{b{Lf}}{b{Gl}}}Dh}{AAlDh}{{LfNl}l}{lAAb}{LhBl}{{{b{Lf}}{b{Lf}}}{{Ah{AB`}}}}{{{b{dAAd}}Oj}{{Ah{A@b}}}}{{{b{dAAd}}OjA@`}A@`}{{{b{dAAd}}OhA@f}A@f}{LhM`}{{Lf{b{Gl}}}{{Ah{Lj}}}}{LhAh}{{Lf{b{Gl}}}A`}{{{b{dAAd}}Ojnn}h}{{Lf{b{Gl}}}{{Cl{Lh}}}}{AAlNl}{lNl}{lAAd}{{{b{dAAd}}Od}n}{{{b{dAAd}}A@`}Oj}{{{b{dAAd}}A@f}Oh}{bc{}}00000{c{{Al{e}}}{}{}}00000{{}{{Al{c}}}{}}00000{AAlLj}{bAn}00000{{{b{Lf}}{b{Gl}}}Dh}{{{b{AAd}}Oh}{{b{A@f}}}}{{{b{dAAd}}Oh}{{b{dA@f}}}}{{{b{AAd}}Oh}Lj}{{{b{AAd}}}{{`{{Bh{}{{Bf{{b{A@f}}}}}}}}}}{{{b{dAAd}}}{{`{{Bh{}{{Bf{{b{dA@f}}}}}}}}}}````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````{{{b{dA@j}}Ohn}h}{{{b{A@`}}}ABb}{{{b{dA@`}}}ABd}{{ABfOhOhNl}A@`}{{{b{AAj}}}ABh}{b{{b{c}}}{}}0000000000{{{b{d}}}{{b{dc}}}{}}0000000000{{{b{A@`}}}AAj}{{}{{ABj{c}}}{}}{{{b{A@`}}}A@`}{{{b{ABl}}}ABl}{{{b{A@j}}}A@j}{{{b{ABn}}}ABn}{{{b{ABf}}}ABf}{{{b{Ol}}}Ol}{{{b{AC`}}}AC`}{{{b{A@l}}}A@l}{{b{b{dc}}}h{}}0000000{{bj}h}0000000{{}A@j}{{{b{A@`}}{b{A@`}}}A`}{{{b{ABl}}{b{ABl}}}A`}{{{b{A@j}}{b{A@j}}}A`}{{{b{ABn}}{b{ABn}}}A`}{{{b{ABf}}{b{ABf}}}A`}{{{b{Ol}}{b{Ol}}}A`}{{{b{AC`}}{b{AC`}}}A`}{{{b{A@l}}{b{A@l}}}A`}{{b{b{c}}}A`{}}0000000000000000000000000000000{{{b{A@`}}{b{dAb}}}Ad}{{{b{ABl}}{b{dAb}}}Ad}{{{b{A@j}}{b{dAb}}}Ad}{{{b{ABn}}{b{dAb}}}Ad}0{{{b{ABf}}{b{dAb}}}Ad}0{{{b{Ol}}{b{dAb}}}Ad}0{{{b{AC`}}{b{dAb}}}Ad}{{{b{A@l}}{b{dAb}}}Ad}0{cc{}}0000000000{ACbA@l}{{{b{A@`}}{b{dc}}}hO`}{{{b{ABl}}{b{dc}}}hO`}{{{b{A@j}}{b{dc}}}hO`}{{{b{ABn}}{b{dc}}}hO`}{{{b{ABf}}{b{dc}}}hO`}{{{b{Ol}}{b{dc}}}hO`}{{{b{AC`}}{b{dc}}}hO`}{{{b{A@l}}{b{dc}}}hO`}{{}c{}}0000000000{{}c{}}0{{A@l{Bl{Oh}}Nl}A@`}{{{b{A@j}}}A`}{{{b{AAj}}}A`}{{{b{A@`}}}A`}{A@lA`}{{{b{A@j}}}{{`{{Bh{}{{Bf{{Mh{Ohn}}}}}}}}}}{A@`ABl}{{{b{A@j}}}Bd}{{ABlNl}A@`}{{{b{d{ACd{c}}}}}{{Ah{e}}}ACf{}}{{{b{d{ACh{c}}}}}{{Ah{e}}}{}{}}{{}{{ACj{c}}}{}}{{}{{ACl{c}}}{}}10{{}A@`}{{{b{Oj}}{b{Gl}}{b{AAd}}{b{dc}}}AdACn}{A@`Nl}{{}{{AD`{c}}}{}}{bc{}}0000000{bADb}000{c{{Al{e}}}{}{}}0000000000{{}{{Al{c}}}{}}0000000000{bAn}0000000000{{ABnOhNl}A@`}{ADdAh}{ADfOh}{ADhAh}{ADjOh}{ADlOh}{ADnBl}{AE`Bl}{AEbBl}{AE`Ol}{AEdOh}{AEfCn}{AEhCn}{AEjAh}{AEln}{AEjOh}{AEdn}{AE`Lf}{AEnBl}{AF`Oh}{AFbAC`}{AFdOh}{AFfOh}{AFhABn}{AFdABf}{AEbA@l}4{AEhOh}{AFjOh}{AFlOh}{AFnOh}{AEjA@j}>{AFbLj}{ADnLj}{AFhOh}{AFbOh}{AEnOh}{AF`Oh}{AEfOh};``````````````````````````````````{{Lj{b{Gl}}cBd}BdAG`}{{Lj{b{Gl}}}Bd}{{Lj{b{Gl}}Bd}Bd}{{Lj{b{Gl}}}{{Ah{Ch}}}}{LlAh}2{{{b{Lj}}}AAf}{{{b{Lj}}{b{Gl}}}ADb}{b{{b{c}}}{}}000000000{{{b{d}}}{{b{dc}}}{}}000000000{{{b{Ll}}}Ll}{{{b{AGb}}}AGb}{{{b{Lj}}}Lj}{{{b{AGd}}}AGd}{{{b{AGf}}}AGf}{{{b{AGh}}}AGh}{{{b{AGj}}}AGj}{{{b{AGl}}}AGl}{{{b{AGn}}}AGn}{{{b{AH`}}}AH`}{{b{b{dc}}}h{}}000000000{{bj}h}000000000{{Lj{b{Gl}}}{{Cl{Ll}}}}{{Lj{b{Gl}}}Lj}{AGdLj}{{Lj{b{Gl}}Bd}Bd}2{{Lj{b{Gl}}Gb}Lj}{{{b{Ll}}{b{Ll}}}A`}{{{b{AGb}}{b{AGb}}}A`}{{{b{Lj}}{b{Lj}}}A`}{{{b{AGd}}{b{AGd}}}A`}{{{b{AGf}}{b{AGf}}}A`}{{{b{AGh}}{b{AGh}}}A`}{{{b{AGj}}{b{AGj}}}A`}{{{b{AGl}}{b{AGl}}}A`}{{{b{AGn}}{b{AGn}}}A`}{{{b{AH`}}{b{AH`}}}A`}{{b{b{c}}}A`{}}000000000000000000000000000000000000000{AGhBl}{AGnBl}{{{b{Ll}}{b{dAb}}}Ad}{{{b{AGb}}{b{dAb}}}Ad}{{{b{Lj}}{b{dAb}}}Ad}{{{b{AGd}}{b{dAb}}}Ad}{{{b{AGf}}{b{dAb}}}Ad}{{{b{AGh}}{b{dAb}}}Ad}{{{b{AGj}}{b{dAb}}}Ad}{{{b{AGl}}{b{dAb}}}Ad}{{{b{AGn}}{b{dAb}}}Ad}{{{b{AH`}}{b{dAb}}}Ad}{cc{}}000000000{AAfLj}{{{b{Ll}}{b{dc}}}hO`}{{{b{AGb}}{b{dc}}}hO`}{{{b{Lj}}{b{dc}}}hO`}{{{b{AGd}}{b{dc}}}hO`}{{{b{AGf}}{b{dc}}}hO`}{{{b{AGh}}{b{dc}}}hO`}{{{b{AGj}}{b{dc}}}hO`}{{{b{AGl}}{b{dc}}}hO`}{{{b{AGn}}{b{dc}}}hO`}{{{b{AH`}}{b{dc}}}hO`}{{Lj{b{Gl}}{b{Gh}}}A@d}{{}c{}}000000000{{Lj{b{Gl}}}A`}000000000000000{AGfBl}{AH`Lj}{LlAGb}{AGdBd}{{Lj{b{Gl}}}Lj}0{AGhIb}{AGjIb}{AGnIb}{AGhDh}{AGjDh}{AGlDh}{AGnDh}{{AGb{Ah{Ch}}}Ll}{{{b{Lj}}{b{Gl}}{b{AAd}}{b{dc}}}AdACn}{{{b{Lj}}{b{Gl}}{b{dc}}}AdACn}{{Lj{b{Gl}}{b{A@f}}}Lj}{{Lj{b{Gl}}Bd}Lj}{{Lj{b{Gl}}Bd}Bd}{AGhMl}{AGjMl}{AGlMl}{AGnMl}{{{b{AGj}}}AGb}{bc{}}000000000{c{{Al{e}}}{}{}}000000000{{}{{Al{c}}}{}}000000000{AGlLj}{bAn}000000000{AH`Lj}{AGjBl}````````````{{DhLjNl}On}{b{{b{c}}}{}}00{{{b{d}}}{{b{dc}}}{}}00{{{b{A@f}}}A@f}{{{b{A@b}}}A@b}{{{b{On}}}On}{{b{b{dc}}}h{}}00{{bj}h}00{{{b{A@f}}{b{A@f}}}A`}{{{b{A@b}}{b{A@b}}}A`}{{{b{On}}{b{On}}}A`}{{b{b{c}}}A`{}}00000000000{{{b{A@f}}{b{dAb}}}Ad}{{{b{A@b}}{b{dAb}}}Ad}{{{b{On}}{b{dAb}}}Ad}{cc{}}{OhA@b}11{{{b{A@f}}{b{dc}}}hO`}{{{b{A@b}}{b{dc}}}hO`}{{{b{On}}{b{dc}}}hO`}{{}c{}}00{OnA`}{{{b{A@f}}}A`}1{OnDh}{{{b{Oh}}{b{Gl}}{b{AAd}}{b{dc}}}AdACn}{{{b{A@b}}{b{Gl}}{b{AAd}}{b{dc}}}AdACn}{OnNl}{{DhLj}On}{bc{}}00{c{{Al{e}}}{}{}}00{{}{{Al{c}}}{}}00{{{b{A@f}}}Lj}{{{b{A@b}}{b{Gl}}{b{AAd}}}Lj}{OnLj}{bAn}00{{DhLjNl}On}{{{b{A@b}}}{{Ah{Oh}}}}{AHbOh}{AHdOh}{AHbAHf}{AHdAHf}{AHhL`}{AHjA@d}{AHlOj}{AHlLj}{AHjLj}{AHhLj}{AHnLj}`{{{b{AI`}}{b{Gl}}{b{AAd}}{b{dc}}}AdACn}{{{b{AI`}}{b{Gl}}{b{AAd}}}ADb}","D":"BBh","p":[[1,"reference",null,null,1],[0,"mut"],[5,"ControlFlowGraph",13],[1,"unit"],[1,"u8"],[5,"FunctionBody",885],[8,"BasicBlockId",623],[1,"bool"],[5,"Formatter",1834],[8,"Result",1834],[5,"CfgPostOrder",13],[6,"Option",1835,null,1],[1,"slice"],[6,"Result",1836,null,1],[5,"TypeId",1837],[5,"DomTree",46],[5,"DFSet",46],[1,"usize"],[17,"Item"],[10,"Iterator",1838],[5,"Loop",78],[5,"Vec",1839],[5,"LoopTree",78],[8,"LoopId",78],[5,"BlocksInLoopPostOrder",78],[6,"PostIDom",132],[5,"PostDomTree",132],[5,"TypeId",1840],[5,"ImplId",1841],[5,"Rc",1842,null,1],[5,"ContractId",1841],[5,"ContractFieldId",1841],[5,"FunctionId",1841],[5,"Analysis",1843],[5,"DepGraphWrapper",1841],[5,"SmolStr",1844],[5,"IndexMap",1845],[5,"TypeError",1846],[5,"MirInternConstQuery",165],[5,"MirInternConstLookupQuery",165],[5,"MirInternTypeQuery",165],[5,"MirInternTypeLookupQuery",165],[5,"MirInternFunctionQuery",165],[5,"MirInternFunctionLookupQuery",165],[5,"MirLowerModuleAllFunctionsQuery",165],[5,"MirLowerContractAllFunctionsQuery",165],[5,"MirLowerStructAllFunctionsQuery",165],[5,"MirLowerEnumAllFunctionsQuery",165],[5,"MirLoweredTypeQuery",165],[5,"MirLoweredConstantQuery",165],[5,"MirLoweredFuncSignatureQuery",165],[5,"MirLoweredMonomorphizedFuncSignatureQuery",165],[5,"MirLoweredPseudoMonomorphizedFuncSignatureQuery",165],[5,"MirLoweredFuncBodyQuery",165],[5,"NewDb",165],[5,"EnumId",1841],[5,"EnumVariantId",1841],[6,"EnumVariantKind",1841],[5,"SourceFileId",1847],[1,"str"],[5,"MirDbGroupStorage__",165],[10,"MirDb",165],[5,"DatabaseKeyIndex",1848],[5,"Runtime",1849],[10,"FnMut",1850],[5,"FunctionBody",1843],[5,"FunctionSigId",1841],[5,"FunctionSignature",1840],[5,"TraitId",1841],[5,"QueryTable",1848],[5,"QueryTableMut",1848],[5,"IngotId",1841],[5,"ModuleId",1841],[5,"Attribute",1841],[5,"AttributeId",1841],[5,"Contract",1841],[5,"ContractField",1841],[5,"Enum",1841],[5,"EnumVariant",1841],[5,"File",1847],[5,"Function",1841],[5,"FunctionSig",1841],[5,"Impl",1841],[5,"Ingot",1841],[5,"Module",1841],[5,"ModuleConstant",1841],[5,"ModuleConstantId",1841],[5,"Struct",1841],[5,"StructId",1841],[5,"StructField",1841],[5,"StructFieldId",1841],[5,"Trait",1841],[6,"Type",1840],[5,"TypeAlias",1841],[5,"TypeAliasId",1841],[5,"ConstantId",815],[5,"Constant",815],[5,"Arc",1851,null,1],[5,"FunctionId",885],[5,"FunctionSignature",885],[5,"TypeId",1464],[5,"Type",1464],[5,"Revision",1852],[5,"BTreeMap",1853],[6,"Item",1841],[6,"Constant",1843],[5,"ConstEvalError",1846],[1,"tuple",null,null,1],[5,"Module",1854],[5,"Span",1855],[1,"u16"],[10,"Database",1848],[5,"Durability",1856],[10,"SourceDb",1857],[10,"AnalyzerDb",1858],[8,"Result",1859,null,1],[10,"Write",1860],[5,"SourceInfo",575],[5,"Node",1861],[10,"Hasher",1862],[5,"NodeId",1861],[5,"BasicBlock",623],[5,"BodyBuilder",643],[8,"ValueId",1739],[8,"InstId",1056],[6,"CallType",1056],[5,"Local",1739],[5,"Inst",1056],[6,"AssignableValue",1739],[5,"BigInt",1863],[6,"Value",1739],[10,"Into",1864,null,1],[5,"SwitchTable",1056],[6,"YulIntrinsicOp",1056],[5,"BodyCursor",718],[6,"CursorLocation",718],[5,"BodyOrder",770],[5,"BodyDataStore",885],[5,"InternId",1865],[6,"ConstantValue",815],[6,"BranchInfo",1056],[5,"FunctionParam",885],[6,"Linkage",885],[6,"Ordering",1866],[8,"ValueIter",1056],[8,"ValueIterMut",1056],[6,"BinOp",1056],[8,"BlockIter",1056],[5,"Replacements",1867],[6,"InstKind",1056],[6,"UnOp",1056],[6,"CastKind",1056],[6,"Intrinsic",1868],[6,"IterBase",1056],[10,"Copy",1869],[6,"IterMutBase",1056],[5,"Recompositions",1870],[5,"Decompositions",1871],[10,"Write",1834],[5,"StreamSafe",1872],[5,"String",1873],[15,"Revert",1424],[15,"Emit",1424],[15,"Return",1424],[15,"Keccak256",1424],[15,"AbiEncode",1424],[15,"AggregateConstruct",1424],[15,"Call",1424],[15,"YulIntrinsic",1424],[15,"Branch",1424],[15,"Create",1424],[15,"Create2",1424],[15,"Switch",1424],[15,"Jump",1424],[15,"AggregateAccess",1424],[15,"MapAccess",1424],[15,"Cast",1424],[15,"Binary",1424],[15,"Declare",1424],[15,"Unary",1424],[15,"Bind",1424],[15,"MemCopy",1424],[15,"Load",1424],[10,"ToPrimitive",1874],[6,"TypeKind",1464],[5,"ArrayDef",1464],[5,"TupleDef",1464],[5,"StructDef",1464],[5,"EnumDef",1464],[5,"EnumVariant",1464],[5,"EventDef",1464],[5,"MapDef",1464],[15,"Aggregate",1820],[15,"Map",1820],[5,"Box",1875,null,1],[15,"Constant",1824],[15,"Immediate",1824],[15,"Temporary",1824],[15,"Unit",1824],[10,"PrettyPrint",1831],[5,"MirDbStorage",165]],"r":[[5,13],[6,46],[7,78],[8,132],[575,623],[576,623],[577,815],[578,815],[579,885],[580,885],[581,885],[582,885],[583,1056],[584,1056],[586,1464],[587,1464],[588,1464],[589,1739],[590,1739]],"b":[[313,"impl-HasQueryGroup%3CSourceDbStorage%3E-for-NewDb"],[314,"impl-HasQueryGroup%3CAnalyzerDbStorage%3E-for-NewDb"],[315,"impl-HasQueryGroup%3CMirDbStorage%3E-for-NewDb"],[570,"impl-Upcast%3Cdyn+SourceDb%3E-for-NewDb"],[571,"impl-Upcast%3Cdyn+AnalyzerDb%3E-for-NewDb"],[572,"impl-UpcastMut%3Cdyn+SourceDb%3E-for-NewDb"],[573,"impl-UpcastMut%3Cdyn+AnalyzerDb%3E-for-NewDb"],[1317,"impl-Display-for-UnOp"],[1318,"impl-Debug-for-UnOp"],[1319,"impl-Display-for-BinOp"],[1320,"impl-Debug-for-BinOp"],[1321,"impl-Display-for-CallType"],[1322,"impl-Debug-for-CallType"],[1324,"impl-Display-for-YulIntrinsicOp"],[1325,"impl-Debug-for-YulIntrinsicOp"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAABYGUAAAAAoADAAAAA4AEAAjAAsAMAAIADoAAAA8AAEASAAQAFoADgBwAAAAdwAAAHoAHgCeAAkAqQB5ADYBCQBgARQAiAG2AEACCQBLAgYAUwINAGICBABoAhQAfgIAAIACGgCcAgQAogIAAKQCLQDTAhAA5gIAAO0CCAD4AgAA+gIIAAcDBAANAwQAEwMAACMDAAAsAwUAMwMlAFwDBABnAwkAcgMCAHkDAQB8AwAAfwMkAKUDJQDRAwgA4QMFAOgDBwDxAykAHAQJACgEAwAtBAYANQQZAFAEFABmBAQAbAQCAHAEFACGBAAAiAQNAJcEIQC7BHMAOgUIAE4FbAC8BQIAwgUHAMsFAgDPBQAA0QUAANMFBwDcBXwAYwYLAHkGIQCcBjEA0AYAANIGAADVBiQA+wYAAP4GAgAFBwAACAciAA==","P":[[15,"T"],[19,""],[20,"T"],[21,""],[25,"K"],[29,""],[30,"T"],[32,"U"],[34,"I"],[35,""],[39,"T"],[40,"U,T"],[42,"U"],[44,""],[48,"T"],[52,""],[53,"T"],[54,""],[61,"T"],[63,""],[66,"U"],[68,""],[71,"T"],[72,"U,T"],[74,"U"],[76,""],[82,"T"],[88,""],[91,"T"],[93,""],[98,"K"],[102,""],[104,"T"],[107,""],[108,"U"],[111,"I"],[112,""],[118,"Iterator::Item"],[119,""],[121,"T"],[123,"U,T"],[126,"U"],[129,""],[137,"T"],[141,""],[142,"T"],[143,""],[146,"K"],[150,""],[152,"T"],[154,"U"],[156,""],[158,"T"],[159,"U,T"],[161,"U"],[163,""],[186,"T"],[224,""],[257,"QueryDb::DynDb,Query::Key,Query::Value"],[267,""],[290,"T"],[309,""],[372,"U"],[391,""],[478,"QueryDb::GroupStorage,Query::Storage"],[494,""],[512,"U,T"],[531,"U"],[550,""],[574,"W"],[595,"T"],[597,""],[598,"T"],[599,""],[603,"K"],[607,""],[608,"T"],[611,"__H"],[612,""],[614,"U"],[615,""],[617,"T"],[618,"U,T"],[619,"U"],[620,""],[625,"T"],[627,""],[628,"T"],[629,""],[631,"K"],[635,""],[636,"T"],[637,"__H"],[638,"U"],[639,"T"],[640,"U,T"],[641,"U"],[642,""],[653,"T"],[655,""],[666,"T"],[667,""],[672,"U"],[673,""],[711,"U,T"],[712,"U"],[713,""],[727,"T"],[731,""],[732,"T"],[733,""],[735,"K"],[739,""],[742,"T"],[744,""],[746,"U"],[748,""],[763,"T"],[764,"U,T"],[766,"U"],[768,""],[774,"T"],[776,""],[777,"T"],[778,""],[781,"K"],[785,""],[787,"T"],[788,""],[793,"U"],[794,""],[811,"T"],[812,"U,T"],[813,"U"],[814,""],[822,"T"],[828,""],[831,"T"],[834,""],[841,"K"],[853,""],[856,"T"],[859,""],[861,"__H"],[864,"U"],[867,""],[870,"T"],[873,"U,T"],[876,"U"],[879,""],[898,"T"],[910,""],[917,"T"],[923,""],[930,"K"],[931,""],[939,"K"],[963,""],[970,"T"],[976,""],[979,"__H"],[983,""],[986,"U"],[992,""],[1025,"T"],[1031,"U,T"],[1037,"U"],[1043,""],[1225,"T"],[1247,""],[1248,"I"],[1249,""],[1257,"T"],[1265,""],[1282,"K"],[1314,""],[1326,"T"],[1337,""],[1338,"__H"],[1346,"U"],[1357,"I"],[1359,""],[1368,"T,Iterator::Item"],[1370,"I"],[1374,""],[1375,"W"],[1376,""],[1377,"I"],[1378,"T"],[1386,""],[1390,"U,T"],[1401,"U"],[1412,""],[1498,"T"],[1499,""],[1506,"T"],[1526,""],[1536,"T"],[1546,""],[1572,"K"],[1612,""],[1624,"T"],[1634,""],[1635,"__H"],[1645,""],[1646,"U"],[1656,""],[1686,"W"],[1688,""],[1696,"T"],[1706,"U,T"],[1716,"U"],[1726,""],[1752,"T"],[1758,""],[1761,"T"],[1764,""],[1770,"K"],[1782,""],[1785,"T"],[1786,""],[1787,"T"],[1789,"__H"],[1792,"U"],[1795,""],[1799,"W"],[1801,""],[1803,"T"],[1806,"U,T"],[1809,"U"],[1812,""],[1832,"W"],[1833,""]]}],["fe_parser",{"t":"PFPFIFEENNCNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNONNNNNNCNNNNNNCONNCNHNNNNONONNNNNNNNNNNNNPPPPPPPPPGPPPPPPGPPPFPGPPFPPFPGPFPPGPFPGFPPGFPGGPPPPFPPPPPPGPPPFPFGPPPPPPPPPPFPPPPPGPFPPPPPPPPPPFPFPPPPFPPPPPPFPGPPPGPPPPPFPGPGFGPPONOOOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNONOONNNOOOOOOOOONNNNNNOOOOOOOOONOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOCCCCCHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPFPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPFGPPPPPPNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNOONNNNNNNNNNNNFFFKNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNONNNNNONNNNNNNNNNNNNNNMNOONNNNNNNNNNNNNN","n":["Err","Label","Ok","ParseFailed","ParseResult","Parser","Token","TokenKind","as_bt_parser","assert","ast","borrow","","","borrow_mut","","","clone","","clone_into","","clone_to_uninit","","diagnostics","done","eat_newlines","enter_block","eq","","equivalent","","","","","","","","error","expect","expect_stmt_end","expect_with_notes","fancy_error","file_id","fmt","","","from","","","grammar","hash","","into","","","into_cs_label","lexer","message","new","next","node","optional","parse_file","peek","peek_or_err","primary","secondary","span","split_next","style","to_owned","","to_string","try_from","","","try_into","","","type_id","","","unexpected_token_error","Add","And","Assert","Assign","Attribute","","AugAssign","Base","BinOperation","BinOperator","BitAnd","BitOr","BitXor","Bool","","BoolOperation","BoolOperator","Bounded","Break","Call","CallArg","CompOperation","CompOperator","ConstExpr","Constant","ConstantDecl","","Continue","Contract","","ContractStmt","Div","Enum","","Eq","Expr","","Field","For","FuncStmt","Function","","","FunctionArg","FunctionSignature","Generic","GenericArg","GenericParameter","Glob","Gt","GtE","If","Impl","","Int","Invert","LShift","List","Literal","LiteralPattern","Lt","LtE","Match","MatchArm","Mod","Module","ModuleStmt","Mult","Name","","Nested","Not","NotEq","Num","Or","","ParseError","Path","","","","PathStruct","PathTuple","Pattern","Pow","Pragma","","RShift","Regular","Repeat","Rest","Return","Revert","SelfType","Self_","Simple","SmolStr","Str","Struct","","Sub","Subscript","Ternary","Trait","","Tuple","","","","","TypeAlias","","TypeDesc","","USub","UnaryOperation","UnaryOperator","Unbounded","Unit","","","Unsafe","Use","","UseTree","VarDecl","VarDeclTarget","Variant","VariantKind","While","WildCard","args","as_str","attributes","body","","","","borrow","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","borrow_mut","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","clone","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","clone_into","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","clone_to_uninit","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","cmp","compare","default","deref","deserialize","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","eq","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","equivalent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","fields","","fmt","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","from","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","from_iter","","","","from_str","functions","","","","generic_params","hash","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","impl_trait","into","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","is_const","is_empty","is_heap_allocated","is_pub","is_rest","kind","label","label_span","len","name","","","","","","","","","","name_node","name_span","new","new_inline","new_inline_from_ascii","partial_cmp","pat","pub_","pub_qual","","","","","","receiver","remove_last","return_type","segments","serialize","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","sig","span","","","","to_owned","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","to_string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","tree","try_from","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","try_into","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","typ","","","typ_span","type_id","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","unsafe_","value","","","variants","version_requirement","args","attr","else_expr","elts","","func","generic_args","if_expr","index","left","","","len","op","","","","operand","right","","","test","value","","","arms","body","","","error","expr","iter","msg","mut_","name","op","or_else","target","","","","test","","","typ","","value","","","","","","label","mut_","","name","typ","bound","name","fields","has_rest","path","args","base","","items","children","path","prefix","","rename","contracts","expressions","functions","module","types","parse_contract_def","parse_call_args","parse_expr","parse_expr_with_min_bp","parse_assert_stmt","parse_fn_def","parse_fn_sig","parse_for_stmt","parse_generic_param","parse_generic_params","parse_if_stmt","parse_match_arms","parse_match_stmt","parse_pattern","parse_return_stmt","parse_revert_stmt","parse_single_word_stmt","parse_stmt","parse_unsafe_block","parse_while_stmt","parse_constant","parse_module","parse_module_stmt","parse_pragma","parse_use","parse_use_tree","parse_enum_def","parse_field","parse_generic_args","parse_impl_def","parse_opt_qualifier","parse_path_tail","parse_struct_def","parse_trait_def","parse_type_alias","parse_type_desc","parse_variant","Amper","AmperEq","And","Arrow","As","Assert","Binary","BraceClose","BraceOpen","BracketClose","BracketOpen","Break","Colon","ColonColon","Comma","Const","Continue","Contract","Dot","DotDot","Else","Enum","Eq","EqEq","Error","False","FatArrow","Fn","For","Gt","GtEq","GtGt","GtGtEq","Hash","Hat","HatEq","Hex","Idx","If","Impl","In","Int","Let","Lexer","Lt","LtEq","LtLt","LtLtEq","Match","Minus","MinusEq","Mut","Name","Newline","Not","NotEq","Octal","Or","ParenClose","ParenOpen","Percent","PercentEq","Pipe","PipeEq","Plus","PlusEq","Pragma","Pub","Return","Revert","SelfType","SelfValue","Semi","Slash","SlashEq","Star","StarEq","StarStar","StarStarEq","Struct","Text","Tilde","Token","TokenKind","Trait","True","Type","Unsafe","Use","While","borrow","","","borrow_mut","","","clone","","","clone_into","","","clone_to_uninit","","","describe","eq","","equivalent","","","","","","","","fmt","","from","","","into","","","into_iter","kind","lex","new","next","source","span","text","to_owned","","","try_from","","","try_into","","","type_id","","","Node","NodeId","Span","Spanned","add","","","","","add_assign","borrow","","","borrow_mut","","","clone","","","clone_into","","","clone_to_uninit","","","cmp","compare","create","default","deserialize","","dummy","","end","eq","","","equivalent","","","","","","","","","","","","file_id","fmt","","","","from","","","","","","","","from_pair","hash","","","id","into","","","is_dummy","","kind","name","","","","","","","","","name_span","new","","partial_cmp","serialize","","span","","","start","to_owned","","","to_string","try_from","","","try_into","","","type_id","","","zero"],"q":[[0,"fe_parser"],[83,"fe_parser::ast"],[1064,"fe_parser::ast::Expr"],[1089,"fe_parser::ast::FuncStmt"],[1116,"fe_parser::ast::FunctionArg"],[1121,"fe_parser::ast::GenericParameter"],[1123,"fe_parser::ast::Pattern"],[1126,"fe_parser::ast::TypeDesc"],[1130,"fe_parser::ast::UseTree"],[1135,"fe_parser::grammar"],[1140,"fe_parser::grammar::contracts"],[1141,"fe_parser::grammar::expressions"],[1144,"fe_parser::grammar::functions"],[1160,"fe_parser::grammar::module"],[1166,"fe_parser::grammar::types"],[1177,"fe_parser::lexer"],[1321,"fe_parser::node"],[1427,"fe_parser::parser"],[1428,"fe_parser::lexer::token"],[1429,"fe_common::diagnostics"],[1430,"alloc::vec"],[1431,"fe_common::span"],[1432,"alloc::string"],[1433,"core::convert"],[1434,"core::ops::function"],[1435,"fe_common::files"],[1436,"core::fmt"],[1437,"core::result"],[1438,"core::hash"],[1439,"codespan_reporting::diagnostic"],[1440,"core::option"],[1441,"core::any"],[1442,"smol_str"],[1443,"core::cmp"],[1444,"serde::de"],[1445,"core::iter::traits::collect"],[1446,"serde::ser"],[1447,"alloc::boxed"],[1448,"vec1"],[1449,"logos::lexer"],[1450,"core::clone"]],"i":"Al`0`````d0`0ln21010101022221011110000222222100210`102101`122`2`22111211002102102102GnGlG`0DlGh2Fb1`555Gd22`Ff53`3`Fd5`66`5`8`5Hb`7`7``6Fl``5``Ed229`83H`<8Gb`44;`=``=Gf:325:1=;`91:11`>`;>Fn;2==:04`;``=`>```>3D`DbDdCfDfDhDj553DlDnE`EbEdEfEh9EjElEnF`FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDbCfDlDnE`EbEdEfEhDfEjElEnF`FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDbCfDlDnE`EbEdEfEhDfEjElEnF`FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDbCfDlDnE`EbEdEfEhDfEjElEnF`FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDbCfDlDnE`EbEdEfEhDfEjElEnF`FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDb0000CfDlDnE`EbEdEfEhDfEjElEnF`FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDb0000CfDlDnE`EbEdEfEhDfEjElEnF`FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDb000Cf000Dl000Dn000E`000Eb000Ed000Ef000Eh000Df000Ej000El000En000F`000Fb000Fd000Ff000Dd000Fh000Fj000Fl000D`000Dh000Fn000G`000Dj000Gb000Gd000Gf000Gh000Gj000Gl000Gn000H`000Hb000DfEjDb0Cf0Dl0Dn0E`0Eb0Ed0Ef0Eh0::99El0En0F`0Fb0Fd0Ff0Dd0Fh0FjFl0D`Dh0Fn0G`0Dj0Gb0Gd0Gf0Gh0Gj0Gl0Gn0H`0Hb0Db0CfDlDnE`EbEdEfEhDfEjElEnF`FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDb0000EjElEnF`D`5CfDlDnE`EbEdEfEhDf=<;:FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbF`DbCfDlDnE`EbEdEfEhDfEjElEn=FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDdDb01:Fh7>1FfEfEhDfEjElEn97D`7Fn::::Dj2876543F`E`40=CfDlDn3EbEd?>=<;:6FbFdFfDdFhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`HbDbCfDlDnE`EbEd98DfEjElEnF`FbFdFf?FhFjFlD`DhFnG`DjGbGdGfGhGjGlGnH`Hb=EfDd6ElDnIhIjIlJ`Jb442JdJfJhJjJl32Jn204328951K`KbKdKfKh43KjKlKnL`52Lb1876432Ld4312LfLh0Lj11Ll0Ln00M`Mb1MdMhMjMl21``````````````````````````````````````````h000000000000000000000000000000000000000000`00000000000000000000000000000000000000``000000j1Mn120120120120212111122221212012001200011120120120120````Ah000000NdI`210210210210111120212210222211110000221002221110022100210210000000000020120Nb11332113213213213","f":"`````````{{{f{bd}}h}j}`{f{{f{c}}}{}}00{{{f{b}}}{{f{bc}}}{}}00{{{f{l}}}l}{{{f{n}}}n}{{f{f{bc}}}A`{}}0{{fAb}A`}0{dAd}{{{f{bd}}}Af}{{{f{bd}}}A`}{{{f{bd}}Ah{f{Aj}}}{{Al{A`}}}}{{{f{l}}{f{l}}}Af}{{{f{n}}{f{n}}}Af}{{f{f{c}}}Af{}}0000000{{{f{bd}}Ahc}A`{{B`{An}}}}{{{f{bd}}hc}{{Al{j}}}{{B`{An}}}}{{{f{bd}}{f{Aj}}}{{Al{A`}}}}{{{f{bd}}hce}{{Al{j}}}{{B`{An}}}{{Bd{{f{j}}}{{Bb{{Ad{An}}}}}}}}{{{f{bd}}c{Ad{l}}{Ad{An}}}A`{{B`{An}}}}{dBf}{{{f{l}}{f{bBh}}}{{Bl{A`Bj}}}}{{{f{n}}{f{bBh}}}Bn}{{{f{n}}{f{bBh}}}{{Bl{A`Bj}}}}{cc{}}00`{{{f{l}}{f{bc}}}A`C`}{{{f{n}}{f{bc}}}A`C`}{{}c{}}00{l{{Cb{Bf}}}}`{lAn}{{Bf{f{Aj}}}d}{{{f{bd}}}{{Al{j}}}}`{{{f{bd}}h}{{Cd{j}}}}{{Bf{f{Aj}}}{{Cj{Cf{Ad{Ch}}}}}}{{{f{bd}}}{{Cd{h}}}}{{{f{bd}}}{{Al{h}}}}{{Ahc}l{{B`{An}}}}0{lAh}6{lCl}{fc{}}0{fAn}{c{{Bl{e}}}{}{}}00{{}{{Bl{c}}}{}}00{fCn}00{{{f{bd}}{f{j}}c{Ad{An}}}A`{{B`{An}}}}```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````{D`Ad}{{{f{Db}}}{{f{Aj}}}}{DdAd}{CfAd}{DfAd}{DhAd}{DjAd}5{f{{f{c}}}{}}0000000000000000000000000000000000{{{f{b}}}{{f{bc}}}{}}0000000000000000000000000000000000{{{f{Db}}}Db}{{{f{Cf}}}Cf}{{{f{Dl}}}Dl}{{{f{Dn}}}Dn}{{{f{E`}}}E`}{{{f{Eb}}}Eb}{{{f{Ed}}}Ed}{{{f{Ef}}}Ef}{{{f{Eh}}}Eh}{{{f{Df}}}Df}{{{f{Ej}}}Ej}{{{f{El}}}El}{{{f{En}}}En}{{{f{F`}}}F`}{{{f{Fb}}}Fb}{{{f{Fd}}}Fd}{{{f{Ff}}}Ff}{{{f{Dd}}}Dd}{{{f{Fh}}}Fh}{{{f{Fj}}}Fj}{{{f{Fl}}}Fl}{{{f{D`}}}D`}{{{f{Dh}}}Dh}{{{f{Fn}}}Fn}{{{f{G`}}}G`}{{{f{Dj}}}Dj}{{{f{Gb}}}Gb}{{{f{Gd}}}Gd}{{{f{Gf}}}Gf}{{{f{Gh}}}Gh}{{{f{Gj}}}Gj}{{{f{Gl}}}Gl}{{{f{Gn}}}Gn}{{{f{H`}}}H`}{{{f{Hb}}}Hb}{{f{f{bc}}}A`{}}0000000000000000000000000000000000{{fAb}A`}0000000000000000000000000000000000{{{f{Db}}{f{Db}}}Hd}{{f{f{c}}}Hd{}}{{}Db}{{{f{Db}}}{{f{Aj}}}}{c{{Bl{Db}}}Hf}{c{{Bl{Cf}}}Hf}{c{{Bl{Dl}}}Hf}{c{{Bl{Dn}}}Hf}{c{{Bl{E`}}}Hf}{c{{Bl{Eb}}}Hf}{c{{Bl{Ed}}}Hf}{c{{Bl{Ef}}}Hf}{c{{Bl{Eh}}}Hf}{c{{Bl{Df}}}Hf}{c{{Bl{Ej}}}Hf}{c{{Bl{El}}}Hf}{c{{Bl{En}}}Hf}{c{{Bl{F`}}}Hf}{c{{Bl{Fb}}}Hf}{c{{Bl{Fd}}}Hf}{c{{Bl{Ff}}}Hf}{c{{Bl{Dd}}}Hf}{c{{Bl{Fh}}}Hf}{c{{Bl{Fj}}}Hf}{c{{Bl{Fl}}}Hf}{c{{Bl{D`}}}Hf}{c{{Bl{Dh}}}Hf}{c{{Bl{Fn}}}Hf}{c{{Bl{G`}}}Hf}{c{{Bl{Dj}}}Hf}{c{{Bl{Gb}}}Hf}{c{{Bl{Gd}}}Hf}{c{{Bl{Gf}}}Hf}{c{{Bl{Gh}}}Hf}{c{{Bl{Gj}}}Hf}{c{{Bl{Gl}}}Hf}{c{{Bl{Gn}}}Hf}{c{{Bl{H`}}}Hf}{c{{Bl{Hb}}}Hf}{{{f{Db}}{f{{f{Aj}}}}}Af}{{{f{Db}}{f{Aj}}}Af}{{{f{Db}}{f{An}}}Af}{{{f{Db}}{f{Db}}}Af}{{{f{Db}}{f{{f{An}}}}}Af}{{{f{Cf}}{f{Cf}}}Af}{{{f{Dl}}{f{Dl}}}Af}{{{f{Dn}}{f{Dn}}}Af}{{{f{E`}}{f{E`}}}Af}{{{f{Eb}}{f{Eb}}}Af}{{{f{Ed}}{f{Ed}}}Af}{{{f{Ef}}{f{Ef}}}Af}{{{f{Eh}}{f{Eh}}}Af}{{{f{Df}}{f{Df}}}Af}{{{f{Ej}}{f{Ej}}}Af}{{{f{El}}{f{El}}}Af}{{{f{En}}{f{En}}}Af}{{{f{F`}}{f{F`}}}Af}{{{f{Fb}}{f{Fb}}}Af}{{{f{Fd}}{f{Fd}}}Af}{{{f{Ff}}{f{Ff}}}Af}{{{f{Dd}}{f{Dd}}}Af}{{{f{Fh}}{f{Fh}}}Af}{{{f{Fj}}{f{Fj}}}Af}{{{f{Fl}}{f{Fl}}}Af}{{{f{D`}}{f{D`}}}Af}{{{f{Dh}}{f{Dh}}}Af}{{{f{Fn}}{f{Fn}}}Af}{{{f{G`}}{f{G`}}}Af}{{{f{Dj}}{f{Dj}}}Af}{{{f{Gb}}{f{Gb}}}Af}{{{f{Gd}}{f{Gd}}}Af}{{{f{Gf}}{f{Gf}}}Af}{{{f{Gh}}{f{Gh}}}Af}{{{f{Gj}}{f{Gj}}}Af}{{{f{Gl}}{f{Gl}}}Af}{{{f{Gn}}{f{Gn}}}Af}{{{f{H`}}{f{H`}}}Af}{{{f{Hb}}{f{Hb}}}Af}{{f{f{c}}}Af{}}0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000{DfAd}{EjAd}{{{f{Db}}{f{bBh}}}{{Bl{A`Bj}}}}0{{{f{Cf}}{f{bBh}}}Bn}0{{{f{Dl}}{f{bBh}}}Bn}0{{{f{Dn}}{f{bBh}}}Bn}0{{{f{E`}}{f{bBh}}}Bn}0{{{f{Eb}}{f{bBh}}}Bn}0{{{f{Ed}}{f{bBh}}}Bn}0{{{f{Ef}}{f{bBh}}}Bn}0{{{f{Eh}}{f{bBh}}}Bn}0{{{f{Df}}{f{bBh}}}Bn}0{{{f{Ej}}{f{bBh}}}Bn}0{{{f{El}}{f{bBh}}}Bn}0{{{f{En}}{f{bBh}}}Bn}0{{{f{F`}}{f{bBh}}}Bn}0{{{f{Fb}}{f{bBh}}}Bn}0{{{f{Fd}}{f{bBh}}}Bn}0{{{f{Ff}}{f{bBh}}}Bn}0{{{f{Dd}}{f{bBh}}}Bn}0{{{f{Fh}}{f{bBh}}}Bn}0{{{f{Fj}}{f{bBh}}}Bn}{{{f{Fl}}{f{bBh}}}Bn}0{{{f{D`}}{f{bBh}}}Bn}{{{f{Dh}}{f{bBh}}}Bn}0{{{f{Fn}}{f{bBh}}}Bn}0{{{f{G`}}{f{bBh}}}Bn}0{{{f{Dj}}{f{bBh}}}Bn}0{{{f{Gb}}{f{bBh}}}Bn}0{{{f{Gd}}{f{bBh}}}Bn}0{{{f{Gf}}{f{bBh}}}Bn}0{{{f{Gh}}{f{bBh}}}Bn}0{{{f{Gj}}{f{bBh}}}Bn}0{{{f{Gl}}{f{bBh}}}Bn}0{{{f{Gn}}{f{bBh}}}Bn}0{{{f{H`}}{f{bBh}}}Bn}0{{{f{Hb}}{f{bBh}}}Bn}0{cc{}}{cDb{{Hh{Aj}}}}1111111111111111111111111111111111{cDb{{Hl{}{{Hj{{f{An}}}}}}}}{cDb{{Hl{}{{Hj{{f{Aj}}}}}}}}{cDb{{Hl{}{{Hj{An}}}}}}{cDb{{Hl{}{{Hj{Hn}}}}}}{{{f{Aj}}}{{Bl{Db}}}}{EjAd}{ElAd}{EnAd}{F`Ad}{D`I`}{{{f{Db}}{f{bc}}}A`C`}{{{f{Cf}}{f{bc}}}A`C`}{{{f{Dl}}{f{bc}}}A`C`}{{{f{Dn}}{f{bc}}}A`C`}{{{f{E`}}{f{bc}}}A`C`}{{{f{Eb}}{f{bc}}}A`C`}{{{f{Ed}}{f{bc}}}A`C`}{{{f{Ef}}{f{bc}}}A`C`}{{{f{Eh}}{f{bc}}}A`C`}{{{f{Df}}{f{bc}}}A`C`}{{{f{Ej}}{f{bc}}}A`C`}{{{f{El}}{f{bc}}}A`C`}{{{f{En}}{f{bc}}}A`C`}{{{f{F`}}{f{bc}}}A`C`}{{{f{Fb}}{f{bc}}}A`C`}{{{f{Fd}}{f{bc}}}A`C`}{{{f{Ff}}{f{bc}}}A`C`}{{{f{Dd}}{f{bc}}}A`C`}{{{f{Fh}}{f{bc}}}A`C`}{{{f{Fj}}{f{bc}}}A`C`}{{{f{Fl}}{f{bc}}}A`C`}{{{f{D`}}{f{bc}}}A`C`}{{{f{Dh}}{f{bc}}}A`C`}{{{f{Fn}}{f{bc}}}A`C`}{{{f{G`}}{f{bc}}}A`C`}{{{f{Dj}}{f{bc}}}A`C`}{{{f{Gb}}{f{bc}}}A`C`}{{{f{Gd}}{f{bc}}}A`C`}{{{f{Gf}}{f{bc}}}A`C`}{{{f{Gh}}{f{bc}}}A`C`}{{{f{Gj}}{f{bc}}}A`C`}{{{f{Gl}}{f{bc}}}A`C`}{{{f{Gn}}{f{bc}}}A`C`}{{{f{H`}}{f{bc}}}A`C`}{{{f{Hb}}{f{bc}}}A`C`}{F`I`}{{}c{}}0000000000000000000000000000000000{DdAf}{{{f{Db}}}Af}01{{{f{Gb}}}Af}{FhFj}{GjCd}{{{f{Fn}}}{{Cd{Ah}}}}{{{f{Db}}}Ib}{{{f{Ff}}}Db}{EfI`}{EhI`}{DfI`}{EjI`}{ElI`}{EnI`}{DdI`}{FhI`}{D`I`}{{{f{Ff}}}{{I`{Db}}}}<{cDb{{Hh{Aj}}}}{{{f{Aj}}}Db}{{Ib{f{{Id{Ab}}}}}Db}{{{f{Db}}{f{Db}}}{{Cd{Hd}}}}{DjI`}{D`Cd}{EfCd}{EhCd}{DfCd}{EjCd}{ElCd}{EnCd}{F`I`}{{{f{E`}}}E`}8{E`Ad}{{{f{Db}}c}BlIf}{{{f{Cf}}c}BlIf}{{{f{Dl}}c}BlIf}{{{f{Dn}}c}BlIf}{{{f{E`}}c}BlIf}{{{f{Eb}}c}BlIf}{{{f{Ed}}c}BlIf}{{{f{Ef}}c}BlIf}{{{f{Eh}}c}BlIf}{{{f{Df}}c}BlIf}{{{f{Ej}}c}BlIf}{{{f{El}}c}BlIf}{{{f{En}}c}BlIf}{{{f{F`}}c}BlIf}{{{f{Fb}}c}BlIf}{{{f{Fd}}c}BlIf}{{{f{Ff}}c}BlIf}{{{f{Dd}}c}BlIf}{{{f{Fh}}c}BlIf}{{{f{Fj}}c}BlIf}{{{f{Fl}}c}BlIf}{{{f{D`}}c}BlIf}{{{f{Dh}}c}BlIf}{{{f{Fn}}c}BlIf}{{{f{G`}}c}BlIf}{{{f{Dj}}c}BlIf}{{{f{Gb}}c}BlIf}{{{f{Gd}}c}BlIf}{{{f{Gf}}c}BlIf}{{{f{Gh}}c}BlIf}{{{f{Gj}}c}BlIf}{{{f{Gl}}c}BlIf}{{{f{Gn}}c}BlIf}{{{f{H`}}c}BlIf}{{{f{Hb}}c}BlIf}{DhI`}{{{f{Dl}}}Ah}{{{f{Fd}}}Ah}{{{f{Ff}}}Ah}{{{f{Fl}}}Ah}{fc{}}0000000000000000000000000000000000{{{f{Db}}}An}{fAn}00000000000000000000000000000000{EbI`}{c{{Bl{e}}}{}{}}0000000000000000000000000000000000{{}{{Bl{c}}}{}}0000000000000000000000000000000000{EfI`}{EhI`}{DdI`}{{{f{Fn}}}{{Cd{Ah}}}}{fCn}0000000000000000000000000000000000{D`Cd}5{DdCd}{GjI`}{ElAd}{DnI`}{IhI`}{IjI`}{IlIn}{J`Ad}{JbAd}{IhIn}{IhCd}4{JdIn}{JfIn}{JhIn}{JjIn}{JlIn}{JfI`}{JhI`}{JnI`}{JjI`}{JnIn}876>{IjIn}:6{K`Ad}{KbAd}{KdAd}{KfAd}{KhCd}{K`I`}{KbI`}{KjCd}{KlCd}{KnI`}{L`I`}7{KlI`}{LbI`}26{KdI`}{KfI`}{KjI`}46{LdCd}8746{LfI`}{LhCd}0{LjCd}{LhI`}0{LlI`}0{LnAd}{LnAf}{LnI`}{M`I`}{MbDb}1{MdMf}{MhAd}{MjE`}{MlE`}{MhE`}{MjCd}`````{{{f{bd}}{Cd{Ah}}}{{Al{{I`{Df}}}}}}{{{f{bd}}}{{Al{{I`{{Ad{{I`{Gj}}}}}}}}}}{{{f{bd}}}{{Al{{I`{Gh}}}}}}{{{f{bd}}Ab}{{Al{{I`{Gh}}}}}}{{{f{bd}}}{{Al{{I`{G`}}}}}}{{{f{bd}}{Cd{Ah}}}{{Al{{I`{Dh}}}}}}{{{f{bd}}{Cd{Ah}}}{{Al{{I`{D`}}}}}}2{{{f{bd}}}{{Al{Ff}}}}{{{f{bd}}}{{Al{{I`{{Ad{Ff}}}}}}}}4{{{f{bd}}}{{Al{{Ad{{I`{Dj}}}}}}}}5{{{f{bd}}}{{Al{{I`{Gb}}}}}}666666{{{f{bd}}{Cd{Ah}}}{{Al{{I`{Ef}}}}}}{{{f{bd}}}{{I`{Cf}}}}{{{f{bd}}}{{Al{Dl}}}}{{{f{bd}}}{{Al{{I`{Dn}}}}}}{{{f{bd}}}{{Al{{I`{Eb}}}}}}{{{f{bd}}}{{Al{{I`{Ed}}}}}}{{{f{bd}}{Cd{Ah}}}{{Al{{I`{El}}}}}}{{{f{bd}}{Ad{{I`{Db}}}}{Cd{Ah}}{Cd{Ah}}}{{Al{{I`{Dd}}}}}}{{{f{bd}}}{{Al{{I`{{Ad{Fd}}}}}}}}{{{f{bd}}}{{Al{{I`{F`}}}}}}{{{f{bd}}h}{{Cd{Ah}}}}{{{f{bd}}{I`{Db}}}{{Cj{E`Ah{Cd{j}}}}}}{{{f{bd}}{Cd{Ah}}}{{Al{{I`{Ej}}}}}}{{{f{bd}}{Cd{Ah}}}{{Al{{I`{En}}}}}}{{{f{bd}}{Cd{Ah}}}{{Al{{I`{Eh}}}}}}{{{f{bd}}}{{Al{{I`{Fb}}}}}}{{{f{bd}}}{{Al{{I`{Fh}}}}}}``````````````````````````````````````````````````````````````````````````````````````````{f{{f{c}}}{}}00{{{f{b}}}{{f{bc}}}{}}00{{{f{j}}}j}{{{f{h}}}h}{{{f{Mn}}}Mn}{{f{f{bc}}}A`{}}00{{fAb}A`}00{{{f{h}}}{{f{Aj}}}}{{{f{j}}{f{j}}}Af}{{{f{h}}{f{h}}}Af}{{f{f{c}}}Af{}}0000000{{{f{j}}{f{bBh}}}Bn}{{{f{h}}{f{bBh}}}Bn}{cc{}}00{{}c{}}00{{}c{}}{jh}{{{f{b{N`{h}}}}}A`}{{Bf{f{Aj}}}Mn}{{{f{bMn}}}{{Cd{c}}}{}}{{{f{Mn}}}{{f{Aj}}}}{jAh}{jf}{fc{}}00{c{{Bl{e}}}{}{}}00{{}{{Bl{c}}}{}}00{fCn}00````{{Ah{f{c}}}AhNb}{{Ah{Cd{{f{c}}}}}Ah{}}{{Ah{Cd{Ah}}}Ah}{{AhAh}Ah}{{Ah{f{j}}}Ah}{{{f{bAh}}c}A`{}}{f{{f{c}}}{}}00{{{f{b}}}{{f{bc}}}{}}00{{{f{Ah}}}Ah}{{{f{Nd}}}Nd}{{{f{{I`{c}}}}}{{I`{c}}}Nf}{{f{f{bc}}}A`{}}00{{fAb}A`}00{{{f{Nd}}{f{Nd}}}Hd}{{f{f{c}}}Hd{}}{{}Nd}0{c{{Bl{Ah}}}Hf}{c{{Bl{{I`{e}}}}}HfNh}{{}Ah}3{AhIb}{{{f{Ah}}{f{Ah}}}Af}{{{f{Nd}}{f{Nd}}}Af}{{{f{{I`{c}}}}{f{{I`{c}}}}}AfNj}{{f{f{c}}}Af{}}00000000000{AhBf}{{{f{Ah}}{f{bBh}}}{{Bl{A`Bj}}}}{{{f{Nd}}{f{bBh}}}Bn}{{{f{{I`{c}}}}{f{bBh}}}BnNl}{{{f{{I`{Dh}}}}{f{bBh}}}Bn}{cc{}}{{{f{{I`{c}}}}}Ah{}}{{{f{{In{{I`{c}}}}}}}Ah{}}{{{f{{I`{c}}}}}Nd{}}3{{{f{{In{{I`{c}}}}}}}Nd{}}4{j{{I`{Db}}}}{{ce}Ah{{B`{Ah}}}{{B`{Ah}}}}{{{f{Ah}}{f{bc}}}A`C`}{{{f{Nd}}{f{bc}}}A`C`}{{{f{{I`{c}}}}{f{be}}}A`NnC`}{I`Nd}{{}c{}}00{{{f{Ah}}}Af}{NdAf}{I`}{{{f{{I`{Dd}}}}}{{f{Aj}}}}{{{f{{I`{Ej}}}}}{{f{Aj}}}}{{{f{{I`{Dh}}}}}{{f{Aj}}}}{{{f{{I`{Eh}}}}}{{f{Aj}}}}{{{f{{I`{En}}}}}{{f{Aj}}}}{{{f{{I`{Fn}}}}}{{f{Aj}}}}{{{f{{I`{Df}}}}}{{f{Aj}}}}{{{f{{I`{Fh}}}}}{{f{Aj}}}}{{{f{{I`{El}}}}}{{f{Aj}}}}{{{f{{I`{Fn}}}}}Ah}{{BfIbIb}Ah}{{cAh}{{I`{c}}}{}}{{{f{Nd}}{f{Nd}}}{{Cd{Hd}}}}{{{f{Ah}}c}BlIf}{{{f{{I`{c}}}}e}BlO`If}{{{f{Nb}}}Ah}{{{f{{I`{c}}}}}Ah{}}{I`Ah}{AhIb}{fc{}}00{fAn}{c{{Bl{e}}}{}{}}00{{}{{Bl{c}}}{}}00{fCn}00{BfAh}","D":"AE`","p":[[0,"mut"],[5,"Parser",0,1427],[1,"reference",null,null,1],[6,"TokenKind",1177,1428],[5,"Token",1177,1428],[5,"Label",0,1429],[5,"ParseFailed",0,1427],[1,"unit"],[1,"u8"],[5,"Vec",1430],[1,"bool"],[5,"Span",1321,1431],[1,"str"],[8,"ParseResult",0,1427],[5,"String",1432],[10,"Into",1433,null,1],[17,"Output"],[10,"FnOnce",1434],[5,"SourceFileId",1435],[5,"Formatter",1436],[5,"Error",1436],[6,"Result",1437,null,1],[8,"Result",1436],[10,"Hasher",1438],[5,"Label",1439],[6,"Option",1440,null,1],[5,"Module",83],[5,"Diagnostic",1429],[1,"tuple",null,null,1],[6,"LabelStyle",1429],[5,"TypeId",1441],[5,"FunctionSignature",83],[5,"SmolStr",83,1442],[5,"Field",83],[5,"Contract",83],[5,"Function",83],[5,"MatchArm",83],[6,"ModuleStmt",83],[5,"Pragma",83],[5,"Path",83],[5,"Use",83],[6,"UseTree",83],[5,"ConstantDecl",83],[5,"TypeAlias",83],[5,"Struct",83],[5,"Enum",83],[5,"Trait",83],[5,"Impl",83],[6,"TypeDesc",83],[6,"GenericArg",83],[6,"GenericParameter",83],[5,"Variant",83],[6,"VariantKind",83],[6,"ContractStmt",83],[6,"FunctionArg",83],[6,"FuncStmt",83],[6,"Pattern",83],[6,"LiteralPattern",83],[6,"VarDeclTarget",83],[6,"Expr",83],[5,"CallArg",83],[6,"BoolOperator",83],[6,"BinOperator",83],[6,"UnaryOperator",83],[6,"CompOperator",83],[6,"Ordering",1443],[10,"Deserializer",1444],[10,"AsRef",1433],[17,"Item"],[10,"IntoIterator",1445],[1,"char"],[5,"Node",1321],[1,"usize"],[1,"slice"],[10,"Serializer",1446],[15,"Call",1064],[15,"Attribute",1064],[15,"Ternary",1064],[5,"Box",1447,null,1],[15,"List",1064],[15,"Tuple",1064],[15,"Subscript",1064],[15,"BoolOperation",1064],[15,"BinOperation",1064],[15,"CompOperation",1064],[15,"Repeat",1064],[15,"UnaryOperation",1064],[15,"Match",1089],[15,"For",1089],[15,"While",1089],[15,"If",1089],[15,"Revert",1089],[15,"Assert",1089],[15,"VarDecl",1089],[15,"ConstantDecl",1089],[15,"AugAssign",1089],[15,"Assign",1089],[15,"Return",1089],[15,"Expr",1089],[15,"Regular",1116],[15,"Self_",1116],[15,"Bounded",1121],[15,"PathStruct",1123],[15,"Generic",1126],[15,"Base",1126],[15,"Tuple",1126],[5,"Vec1",1448],[15,"Nested",1130],[15,"Simple",1130],[15,"Glob",1130],[5,"Lexer",1177],[5,"Lexer",1449],[10,"Spanned",1321,1431],[5,"NodeId",1321],[10,"Clone",1450],[10,"Deserialize",1444],[10,"PartialEq",1443],[10,"Debug",1436],[10,"Hash",1438],[10,"Serialize",1446]],"r":[[0,1427],[1,1429],[2,1427],[3,1427],[4,1427],[5,1427],[6,1428],[7,1428],[8,1427],[9,1427],[11,1427],[12,1429],[13,1427],[14,1427],[15,1429],[16,1427],[17,1429],[18,1427],[19,1429],[20,1427],[21,1429],[22,1427],[23,1427],[24,1427],[25,1427],[26,1427],[27,1429],[28,1427],[29,1429],[30,1429],[31,1429],[32,1429],[33,1427],[34,1427],[35,1427],[36,1427],[37,1427],[38,1427],[39,1427],[40,1427],[41,1427],[42,1427],[43,1429],[44,1427],[45,1427],[46,1427],[47,1429],[48,1427],[50,1429],[51,1427],[52,1427],[53,1429],[54,1427],[55,1429],[57,1429],[58,1427],[59,1427],[61,1427],[63,1427],[64,1427],[65,1429],[66,1429],[67,1429],[68,1427],[69,1429],[70,1429],[71,1427],[72,1427],[73,1427],[74,1429],[75,1427],[76,1427],[77,1429],[78,1427],[79,1427],[80,1429],[81,1427],[82,1427],[179,1442],[215,1442],[221,1442],[222,1442],[257,1442],[292,1442],[327,1442],[362,1442],[397,1442],[398,1442],[399,1442],[400,1442],[401,1442],[436,1442],[437,1442],[438,1442],[439,1442],[440,1442],[475,1442],[476,1442],[477,1442],[478,1442],[617,1442],[618,1442],[685,1442],[686,1442],[721,1442],[722,1442],[723,1442],[724,1442],[725,1442],[731,1442],[767,1442],[803,1442],[804,1442],[810,1442],[823,1442],[824,1442],[825,1442],[826,1442],[839,1442],[879,1442],[914,1442],[915,1442],[949,1442],[984,1442],[1023,1442],[1177,1428],[1178,1428],[1179,1428],[1180,1428],[1181,1428],[1182,1428],[1183,1428],[1184,1428],[1185,1428],[1186,1428],[1187,1428],[1188,1428],[1189,1428],[1190,1428],[1191,1428],[1192,1428],[1193,1428],[1194,1428],[1195,1428],[1196,1428],[1197,1428],[1198,1428],[1199,1428],[1200,1428],[1201,1428],[1202,1428],[1203,1428],[1204,1428],[1205,1428],[1206,1428],[1207,1428],[1208,1428],[1209,1428],[1210,1428],[1211,1428],[1212,1428],[1213,1428],[1214,1428],[1215,1428],[1216,1428],[1217,1428],[1218,1428],[1219,1428],[1221,1428],[1222,1428],[1223,1428],[1224,1428],[1225,1428],[1226,1428],[1227,1428],[1228,1428],[1229,1428],[1230,1428],[1231,1428],[1232,1428],[1233,1428],[1234,1428],[1235,1428],[1236,1428],[1237,1428],[1238,1428],[1239,1428],[1240,1428],[1241,1428],[1242,1428],[1243,1428],[1244,1428],[1245,1428],[1246,1428],[1247,1428],[1248,1428],[1249,1428],[1250,1428],[1251,1428],[1252,1428],[1253,1428],[1254,1428],[1255,1428],[1256,1428],[1257,1428],[1258,1428],[1259,1428],[1260,1428],[1261,1428],[1262,1428],[1263,1428],[1264,1428],[1265,1428],[1266,1428],[1267,1428],[1268,1428],[1270,1428],[1271,1428],[1273,1428],[1274,1428],[1276,1428],[1277,1428],[1279,1428],[1280,1428],[1282,1428],[1283,1428],[1284,1428],[1285,1428],[1286,1428],[1287,1428],[1288,1428],[1289,1428],[1290,1428],[1291,1428],[1292,1428],[1293,1428],[1294,1428],[1295,1428],[1296,1428],[1298,1428],[1299,1428],[1302,1428],[1303,1428],[1307,1428],[1308,1428],[1309,1428],[1310,1428],[1312,1428],[1313,1428],[1315,1428],[1316,1428],[1318,1428],[1319,1428],[1323,1431],[1324,1431],[1325,1431],[1326,1431],[1327,1431],[1328,1431],[1329,1431],[1330,1431],[1331,1431],[1334,1431],[1337,1431],[1340,1431],[1343,1431],[1350,1431],[1352,1431],[1354,1431],[1355,1431],[1358,1431],[1359,1431],[1360,1431],[1361,1431],[1370,1431],[1371,1431],[1375,1431],[1376,1431],[1377,1431],[1383,1431],[1384,1431],[1388,1431],[1391,1431],[1404,1431],[1407,1431],[1409,1431],[1412,1431],[1413,1431],[1417,1431],[1420,1431],[1423,1431],[1426,1431]],"b":[[44,"impl-Debug-for-ParseFailed"],[45,"impl-Display-for-ParseFailed"],[436,"impl-PartialEq%3C%26str%3E-for-SmolStr"],[437,"impl-PartialEq%3Cstr%3E-for-SmolStr"],[438,"impl-PartialEq%3CString%3E-for-SmolStr"],[439,"impl-PartialEq-for-SmolStr"],[440,"impl-PartialEq%3C%26String%3E-for-SmolStr"],[617,"impl-Debug-for-SmolStr"],[618,"impl-Display-for-SmolStr"],[619,"impl-Display-for-Module"],[620,"impl-Debug-for-Module"],[621,"impl-Display-for-ModuleStmt"],[622,"impl-Debug-for-ModuleStmt"],[623,"impl-Display-for-Pragma"],[624,"impl-Debug-for-Pragma"],[625,"impl-Debug-for-Path"],[626,"impl-Display-for-Path"],[627,"impl-Display-for-Use"],[628,"impl-Debug-for-Use"],[629,"impl-Display-for-UseTree"],[630,"impl-Debug-for-UseTree"],[631,"impl-Display-for-ConstantDecl"],[632,"impl-Debug-for-ConstantDecl"],[633,"impl-Debug-for-TypeAlias"],[634,"impl-Display-for-TypeAlias"],[635,"impl-Debug-for-Contract"],[636,"impl-Display-for-Contract"],[637,"impl-Debug-for-Struct"],[638,"impl-Display-for-Struct"],[639,"impl-Display-for-Enum"],[640,"impl-Debug-for-Enum"],[641,"impl-Display-for-Trait"],[642,"impl-Debug-for-Trait"],[643,"impl-Display-for-Impl"],[644,"impl-Debug-for-Impl"],[645,"impl-Display-for-TypeDesc"],[646,"impl-Debug-for-TypeDesc"],[647,"impl-Debug-for-GenericArg"],[648,"impl-Display-for-GenericArg"],[649,"impl-Debug-for-GenericParameter"],[650,"impl-Display-for-GenericParameter"],[651,"impl-Debug-for-Field"],[652,"impl-Display-for-Field"],[653,"impl-Display-for-Variant"],[654,"impl-Debug-for-Variant"],[656,"impl-Display-for-ContractStmt"],[657,"impl-Debug-for-ContractStmt"],[659,"impl-Display-for-Function"],[660,"impl-Debug-for-Function"],[661,"impl-Display-for-FunctionArg"],[662,"impl-Debug-for-FunctionArg"],[663,"impl-Debug-for-FuncStmt"],[664,"impl-Display-for-FuncStmt"],[665,"impl-Display-for-MatchArm"],[666,"impl-Debug-for-MatchArm"],[667,"impl-Debug-for-Pattern"],[668,"impl-Display-for-Pattern"],[669,"impl-Display-for-LiteralPattern"],[670,"impl-Debug-for-LiteralPattern"],[671,"impl-Debug-for-VarDeclTarget"],[672,"impl-Display-for-VarDeclTarget"],[673,"impl-Debug-for-Expr"],[674,"impl-Display-for-Expr"],[675,"impl-Display-for-CallArg"],[676,"impl-Debug-for-CallArg"],[677,"impl-Display-for-BoolOperator"],[678,"impl-Debug-for-BoolOperator"],[679,"impl-Display-for-BinOperator"],[680,"impl-Debug-for-BinOperator"],[681,"impl-Display-for-UnaryOperator"],[682,"impl-Debug-for-UnaryOperator"],[683,"impl-Debug-for-CompOperator"],[684,"impl-Display-for-CompOperator"],[721,"impl-FromIterator%3C%26String%3E-for-SmolStr"],[722,"impl-FromIterator%3C%26str%3E-for-SmolStr"],[723,"impl-FromIterator%3CString%3E-for-SmolStr"],[724,"impl-FromIterator%3Cchar%3E-for-SmolStr"],[1325,"impl-Add%3C%26T%3E-for-Span"],[1326,"impl-Add%3COption%3C%26T%3E%3E-for-Span"],[1327,"impl-Add%3COption%3CSpan%3E%3E-for-Span"],[1328,"impl-Add-for-Span"],[1329,"impl-Add%3C%26Token%3C\'a%3E%3E-for-Span"],[1373,"impl-Debug-for-Node%3CT%3E"],[1374,"impl-Display-for-Node%3CFunction%3E"],[1376,"impl-From%3C%26Node%3CT%3E%3E-for-Span"],[1377,"impl-From%3C%26Box%3CNode%3CT%3E%3E%3E-for-Span"],[1378,"impl-From%3C%26Node%3CT%3E%3E-for-NodeId"],[1380,"impl-From%3C%26Box%3CNode%3CT%3E%3E%3E-for-NodeId"],[1394,"impl-Node%3CField%3E"],[1395,"impl-Node%3CStruct%3E"],[1396,"impl-Node%3CFunction%3E"],[1397,"impl-Node%3CTypeAlias%3E"],[1398,"impl-Node%3CTrait%3E"],[1399,"impl-Node%3CFunctionArg%3E"],[1400,"impl-Node%3CContract%3E"],[1401,"impl-Node%3CVariant%3E"],[1402,"impl-Node%3CEnum%3E"]],"c":"OjAAAAEAAAAAAAAAEAAAADoD","e":"OzAAAAEAAOsEKwAAAAAAAgAAAAQAAQAHAAEACwAMABoAAAAcAAkAKwADADIAAgA5AAEAPQAAAEQAAABGAAwAVAAkAHoAEwCPAA4AnwADAKQAAACnAAYArwAEALUACADAAAoAzAAGANUAAADXANYBrwIAANICLQAjAxUAOgM6AYAEAACCBAAAmgRoAAQFCwAWBQIAGgUAABwFDwAtBR0ATAUTAGEFAgBlBQAAZwUFAHAFFACGBQ0A","P":[[11,"T"],[17,""],[19,"T"],[21,""],[29,"K"],[37,"S"],[39,""],[40,"Str,NotesFn"],[41,"S"],[42,""],[46,"T"],[50,"__H"],[52,"U"],[55,""],[65,"S"],[67,""],[70,"T"],[72,""],[73,"U,T"],[76,"U"],[79,""],[82,"S"],[214,""],[222,"T"],[292,""],[327,"T"],[362,""],[398,"K"],[399,""],[401,"D"],[402,"__D"],[436,""],[475,"K"],[615,""],[685,"T"],[721,"I"],[725,""],[731,"H"],[732,"__H"],[766,""],[767,"U"],[802,""],[823,"T"],[824,""],[839,"S"],[840,"__S"],[874,""],[879,"T"],[914,""],[949,"U,T"],[984,"U"],[1019,""],[1267,"T"],[1273,""],[1276,"T"],[1279,""],[1285,"K"],[1293,""],[1295,"T"],[1298,"U"],[1301,"I"],[1302,""],[1305,"Iterator::Item"],[1306,""],[1309,"T"],[1312,"U,T"],[1315,"U"],[1318,""],[1325,"T"],[1327,""],[1330,"T"],[1337,""],[1339,"T"],[1343,""],[1347,"K"],[1348,""],[1350,"__D"],[1351,"__D,T"],[1352,""],[1357,"T"],[1358,"K"],[1370,""],[1373,"T"],[1374,""],[1375,"T"],[1382,""],[1383,"S,E"],[1384,"__H"],[1386,"T,__H"],[1387,""],[1388,"U"],[1391,""],[1405,"T"],[1406,""],[1407,"__S"],[1408,"T,__S"],[1409,""],[1410,"T"],[1411,""],[1413,"T"],[1416,""],[1417,"U,T"],[1420,"U"],[1423,""]]}],["fe_test_files",{"t":"HHHHH","n":["fixture","fixture_bytes","fixture_dir","fixture_dir_files","new_fixture_dir_files"],"q":[[0,"fe_test_files"],[5,"include_dir::dir"],[6,"alloc::vec"]],"i":"`````","f":"{{{d{b}}}{{d{b}}}}{{{d{b}}}{{d{{h{f}}}}}}{{{d{b}}}{{d{j}}}}{{{d{b}}}{{n{{l{{d{b}}{d{b}}}}}}}}0","D":"d","p":[[1,"str"],[1,"reference",null,null,1],[1,"u8"],[1,"slice"],[5,"Dir",5],[1,"tuple",null,null,1],[5,"Vec",6]],"r":[],"b":[],"c":"OjAAAAAAAAA=","e":"OjAAAAEAAAAAAAMAEAAAAAAAAQACAAMA","P":[]}],["fe_test_runner",{"t":"FNNEHNNNNNNNNNNNNNNNNNNN","n":["TestSink","borrow","borrow_mut","ethabi","execute","failure_count","failure_details","fmt","","from","inc_success_count","insert_failure","insert_logs","into","logs_count","logs_details","new","success_count","test_count","to_string","try_from","try_into","type_id","vzip"],"q":[[0,"fe_test_runner"],[24,"ethabi::event"],[25,"alloc::string"],[26,"core::fmt"],[27,"core::result"],[28,"core::any"]],"i":"`l0``0000000000000000000","f":"`{b{{b{c}}}{}}{{{b{d}}}{{b{dc}}}{}}`{{{b{f}}{b{{j{h}}}}{b{f}}{b{dl}}}n}{{{b{l}}}A`}{{{b{l}}}Ab}{{{b{l}}{b{dAd}}}Af}0{cc{}}{{{b{dl}}}Ah}{{{b{dl}}{b{f}}{b{f}}}Ah}0{{}c{}}65{nl}77{bAb}{c{{Aj{e}}}{}{}}{{}{{Aj{c}}}{}}{bAl}{{}c{}}","D":"d","p":[[1,"reference",null,null,1],[0,"mut"],[1,"str"],[5,"Event",24],[1,"slice"],[5,"TestSink",0],[1,"bool"],[1,"usize"],[5,"String",25],[5,"Formatter",26],[8,"Result",26],[1,"unit"],[6,"Result",27,null,1],[5,"TypeId",28]],"r":[],"b":[[7,"impl-Display-for-TestSink"],[8,"impl-Debug-for-TestSink"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAABYAAwAAAAkACwACAA8ACQA=","P":[[1,"T"],[4,""],[9,"T"],[10,""],[13,"U"],[14,""],[20,"U,T"],[21,"U"],[22,""],[23,"V"]]}],["fe_yulc",{"t":"FFNNNNOHHNNNNNONNNNNN","n":["ContractBytecode","YulcError","borrow","","borrow_mut","","bytecode","compile","compile_single_contract","fmt","from","","into","","runtime_bytecode","try_from","","try_into","","type_id",""],"q":[[0,"fe_yulc"],[21,"alloc::string"],[22,"indexmap::map"],[23,"core::result"],[24,"core::convert"],[25,"core::iter::traits::iterator"],[26,"core::fmt"],[27,"core::any"]],"i":"``fn101``010101101010","f":"``{b{{b{c}}}{}}0{{{b{d}}}{{b{dc}}}{}}0{fh}{{gj}{{A`{{l{hf}}n}}}{{Ad{Ab}}}{{Ad{Ab}}}{{Aj{}{{Af{{Ah{ce}}}}}}}}{{{b{Ab}}{b{Ab}}jj}{{A`{fn}}}}{{{b{n}}{b{dAl}}}An}{cc{}}0{{}c{}}05{c{{A`{e}}}{}{}}0{{}{{A`{c}}}{}}0{bB`}0","D":"l","p":[[1,"reference",null,null,1],[0,"mut"],[5,"ContractBytecode",0],[5,"String",21],[1,"bool"],[5,"IndexMap",22],[5,"YulcError",0],[6,"Result",23,null,1],[1,"str"],[10,"AsRef",24],[17,"Item"],[1,"tuple",null,null,1],[10,"Iterator",25],[5,"Formatter",26],[8,"Result",26],[5,"TypeId",27]],"r":[],"b":[],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAA8AAwAAAAcACgAAAA8ABgA=","P":[[2,"T"],[6,""],[10,"T"],[12,"U"],[14,""],[15,"U,T"],[17,"U"],[19,""]]}]]')); +if (typeof exports !== 'undefined') exports.searchIndex = searchIndex; +else if (window.initSearch) window.initSearch(searchIndex); +//{"start":39,"fragment_lengths":[5493,5433,86127,17574,31363,4368,145,152,11561,421,42802,31988,501,1171,1103]} \ No newline at end of file diff --git a/compiler-docs/search.desc/fe/fe-desc-0-.js b/compiler-docs/search.desc/fe/fe-desc-0-.js new file mode 100644 index 0000000000..f17cc328b2 --- /dev/null +++ b/compiler-docs/search.desc/fe/fe-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe", 0, "Returns the argument unchanged.\nCalls U::from(self).\nReturns the argument unchanged.\nCalls U::from(self).\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nReturns the argument unchanged.\nCalls U::from(self).\nReturns the argument unchanged.\nCalls U::from(self).") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_abi/fe_abi-desc-0-.js b/compiler-docs/search.desc/fe_abi/fe_abi-desc-0-.js new file mode 100644 index 0000000000..4aa7e87623 --- /dev/null +++ b/compiler-docs/search.desc/fe_abi/fe_abi-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_abi", 0, "Returns the argument unchanged.\nCalls U::from(self).\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nThe mutability of a public function.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns first 4 bytes of signature hash in hex.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nReturns bytes size of the encoded type if the type is …") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_analyzer/fe_analyzer-desc-0-.js b/compiler-docs/search.desc/fe_analyzer/fe_analyzer-desc-0-.js new file mode 100644 index 0000000000..dc5b20cf83 --- /dev/null +++ b/compiler-docs/search.desc/fe_analyzer/fe_analyzer-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_analyzer", 0, "Fe semantic analysis.\nSemantic errors.\nThis module includes utility structs and its functions for …\nThe evm functions exposed by yul.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nThe type of a function call.\nRepresents constant value.\nThis should only be created by AnalyzerContext.\nContains contextual information relating to an expression …\nLoad from storage ptr\nPanics\nAdd evaluated constant value in a constant declaration to …\nAttribute contextual information to an expression node.\nReturns constant value from variable name.\nReturns a type of an expression.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns constant from numeric literal represented by …\nReturns the Context type, if it is defined.\nReturns true if the scope or any of its parents is of the …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConvert into a [codespan_reporting::Diagnostic::Label]\nReturns true if the context is in function scope.\nReturns the module enclosing current context.\nReturns an item enclosing current context.\nReturns a function id that encloses a context.\nCreate a primary label with the given message. This will …\nResolves the given path. Does not register any errors\nResolves the given path and registers all errors\nResolves the given path only if it is visible. Does not …\nReturns a non-function item that encloses a context.\nCreate a secondary label with the given message. This will …\nUpdate the expression attributes.\nFunction self parameter.\nThe function’s parent, if any. If None, self has been …\nRepresentative struct for the query group.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nSet the value of the ingot_external_ingots input.\nSet the value of the ingot_external_ingots input and …\nSet the value of the ingot_files input.\nSet the value of the ingot_files input and promise that …\nSet the value of the root_ingot input.\nSet the value of the root_ingot input and promise that its …\nReturns the argument unchanged.\nCalls U::from(self).\nError to be returned from APIs that should reject …\nErrors that can result from a binary operation\nError indicating constant evaluation failed.\nError to be returned when otherwise no meaningful …\nValue type cannot be coerced to the expected type\nError returned by ModuleId::resolve_name if the name is …\nErrors that can result from indexing\nValue is in storage and must be explicitly moved with …\nself contract used where an external contract value is …\nErrors that can result from an implicit type coercion\nError indicating that a type is invalid.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCreate a FatalError instance, given a “voucher” …\nDepGraph edge label. “Locality” refers to the deployed …\nFor directory modules without a corresponding source file …\nAn Ingot is composed of a tree of Modules (set via […\nA named item. This does not include things inside of a …\nA library; expected to have a lib.fe file.\nThe target of compilation. Expected to have a main.fe file.\nId of a Module, which corresponds to a single Fe source …\nA fake ingot, created to hold a single module with any …\nAll module constants.\nAll contracts, including from submodules and including …\nAll functions, including from submodules and including …\nIncludes duplicate names\nIncludes duplicate names\nReturns true if the type_in_impl can stand in for the …\nDependency graph of the contract type, which consists of …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nLookup a function by name. Searches all user functions, …\nLooks up the FunctionId based on the parent of the …\nUser functions, public and not. Excludes __init__ and …\nReturns the map of ingot deps, built-ins, and the ingot …\nReturns all of the internal items. Internal items refers …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nReturns true if the item is in scope of the module.\nReturns true if other either is Self or the type of the …\nReturns a map of the named items in the module\nReturns all of the internal items, except for used items. …\nExcludes __init__ and __call__.\nReturns Err(IncompleteItem) if the name could not be …\nResolve a path that starts with an item defined in the …\nResolve a path that starts with an internal item.\nResolve a path that starts with an internal item. We omit …\nReturns the main.fe, or lib.fe module, depending on the …\nDependency graph of the (imaginary) __call__ function, …\nReturns a name -> (name_span, external_item) map for all …\nAdd a variable to the block scope.\nCheck an item visibility and sink diagnostics if an item …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nGets std::context::Context if it exists\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nMaps Name -> (Type, is_const, span)\nAn “external” contract. Effectively just a newtyped …\nNames that can be used to build identifiers without …\nThe type of a contract while it’s being executed. Ie. …\nCreates an instance of address.\nReturns size of integer type in bits.\nCreates an instance of bool.\nReturns true if the integer is at least the same size (or …\nReturns true if num represents a number that fits the type\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nSignature for the function with the given name defined …\nLike function_sig but returns a Vec<FunctionSigId> which …\nReturn the impl for the given trait. There can only ever …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nReturns true if the type qualifies to implement the …\nReturns true if the type is encodable in Solidity ABI. …\ntrue if Type::Base or Type::Contract (which is just an …\nReturns true if the integer is signed, otherwise false\nName in the lower snake format (e.g. lower_snake_case).\nReturns max value of the integer type.\nReturns min value of the integer type.\nLooks up all possible candidates of the given function …\nCreates an instance of u256.\nCreates an instance of u8.\nCreates an instance of ().\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_codegen/fe_codegen-desc-0-.js b/compiler-docs/search.desc/fe_codegen/fe_codegen-desc-0-.js new file mode 100644 index 0000000000..9108a6ba94 --- /dev/null +++ b/compiler-docs/search.desc/fe_codegen/fe_codegen-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_codegen", 0, "Representative struct for the query group.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nReturns the argument unchanged.\nCalls U::from(self).\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCopy data from src to dst. NOTE: src and dst must be …") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_common/fe_common-desc-0-.js b/compiler-docs/search.desc/fe_common/fe_common-desc-0-.js new file mode 100644 index 0000000000..231ad4640c --- /dev/null +++ b/compiler-docs/search.desc/fe_common/fe_common-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_common", 0, "An exclusive span of byte offsets in a source file.\nCompare the given strings and panic when not equal with a …\nA byte offset specifying the exclusive end of a span.\nReturns the argument unchanged.\nCalls U::from(self).\nA byte offset specifying the inclusive start of a span.\nRepresentative struct for the query group.\nSet with `fn set_file_content(&mut self, file: …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nSet the value of the file_content input.\nSet the value of the file_content input and promise that …\nAn unexpected bug.\nAn error.\nA help message.\nA note.\nA severity level for diagnostic messages.\nA warning.\nDiagnostic data structures.\nFormat the given diagnostics as a string.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConvert into a [codespan_reporting::Diagnostic::Label]\nCreate a primary label with the given message. This will …\nPrint the given diagnostics to stderr.\nCreate a secondary label with the given message. This will …\nAn unexpected bug.\nRepresents a diagnostic message that can provide …\nAn error.\nA help message.\nA label describing an underlined region of code associated …\nA note.\nLabels that describe the primary cause of a diagnostic.\nLabels that provide additional context for a diagnostic.\nA severity level for diagnostic messages.\nA warning.\nCreate a new diagnostic with a severity of Severity::Bug.\nAn optional code that identifies this diagnostic.\nCreate a new diagnostic with a severity of Severity::Error.\nThe file that we are labelling.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCreate a new diagnostic with a severity of Severity::Help.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nSource labels that describe the cause of the diagnostic. …\nAn optional message to provide some additional information …\nThe main message associated with this diagnostic.\nCreate a new label.\nCreate a new diagnostic.\nCreate a new diagnostic with a severity of Severity::Note.\nNotes that are associated with the primary cause of the …\nCreate a new label with a style of LabelStyle::Primary.\nThe range in bytes we are going to include in the final …\nCreate a new label with a style of LabelStyle::Secondary.\nThe overall severity of the diagnostic\nThe style of the label.\nCreate a new diagnostic with a severity of …\nSet the error code of the diagnostic.\nAdd some labels to the diagnostic.\nAdd a message to the diagnostic.\nSet the message of the diagnostic.\nAdd some notes to the diagnostic.\nA reference to the current directory, i.e., ..\nUser file; either part of the target project or an …\nA normal component, e.g., a and b in a/b.\nA reference to the parent directory, i.e., ...\nA Windows path prefix, e.g., C: or \\\\server\\share.\nThe root directory component, appears after any prefix and …\nFile is part of the fe standard library\nA single component of a path.\nA slice of a UTF-8 path (akin to str).\nAn owned, mutable UTF-8 path (akin to String).\nProduces an iterator over Utf8Path and its ancestors.\nYields the underlying OsStr slice.\nExtracts the underlying OsStr slice.\nCoerces to a Utf8Path slice.\nConverts a Utf8Path to a Path.\nYields the underlying str slice.\nExtracts the underlying str slice.\nReturns the canonical, absolute form of the path with all …\nReturns the canonical, absolute form of the path with all …\nInvokes capacity on the underlying instance of PathBuf.\nInvokes clear on the underlying instance of PathBuf.\nReturns the common prefix of two paths. If the paths are …\nProduces an iterator over the Utf8Components of the path.\nDetermines whether child is a suffix of self.\nReturns true if the path points at an existing entity.\nExtracts the extension of self.file_name, if possible.\nReturns the final component of the Utf8Path, if there is …\nExtracts the stem (non-extension) portion of self.file_name…\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nConverts a Path to a Utf8Path.\nCreates a new Utf8PathBuf from a PathBuf containing valid …\nReturns true if the Utf8Path has a root.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConverts this Utf8PathBuf into a boxed Utf8Path.\nConsumes the Utf8PathBuf, yielding its internal OsString …\nConverts a Box<Utf8Path> into a Utf8PathBuf without …\nConverts a Utf8PathBuf to a PathBuf.\nConsumes the Utf8PathBuf, yielding its internal String …\nReturns true if the Utf8Path is absolute, i.e., if it is …\nReturns true if the path exists on disk and is pointing at …\nReturns true if the path exists on disk and is pointing at …\nReturns true if the Utf8Path is relative, i.e., not …\nReturns true if the path exists on disk and is pointing at …\nProduces an iterator over the path’s components viewed …\nCreates an owned Utf8PathBuf with path adjoined to self.\nCreates an owned PathBuf with path adjoined to self.\nDifferentiates between local source files and fe std lib …\nQueries the file system to get information about a file, …\nDirectly wraps a string slice as a Utf8Path slice.\nAllocates an empty Utf8PathBuf.\nReturns the Path without its final component, if there is …\nPath of the file. May include src/ dir or longer prefix; …\nTruncates self to self.parent.\nExtends self with path.\nReturns an iterator over the entries within a directory.\nReturns an iterator over the entries within a directory.\nReads a symbolic link, returning the file that the link …\nReads a symbolic link, returning the file that the link …\nInvokes reserve on the underlying instance of PathBuf.\nInvokes reserve_exact on the underlying instance of PathBuf…\nUpdates self.extension to extension.\nUpdates self.file_name to file_name.\nInvokes shrink_to on the underlying instance of PathBuf.\nInvokes shrink_to_fit on the underlying instance of PathBuf…\nDetermines whether base is a prefix of self.\nReturns a path that, when joined onto base, yields self.\nQueries the metadata about a file without following …\nConverts a Utf8Path to an owned Utf8PathBuf.\nReturns Ok(true) if the path points at an existing entity.\nInvokes try_reserve on the underlying instance of PathBuf.\nInvokes try_reserve_exact on the underlying instance of …\nCreates a new Utf8PathBuf with a given capacity used to …\nCreates an owned Utf8PathBuf like self but with the given …\nCreates an owned Utf8PathBuf like self but with the given …\nA helper type to interpret a numeric literal represented …\nA type that represents the radix of a numeric literal.\nReturns number representation of the radix.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nParse the numeric literal to T.\nReturns radix of the numeric literal.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the root path of the current Fe project\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nBuild files are loaded from the file system.\nBuild files are loaded from static file vector.\nFetch and checkout the specified refspec from the remote …\nA trait to derive plural or singular representations from\nGet the full 32 byte hash of the content.\nGet the full 32 byte hash of the content as a byte array.\nTake the first size number of bytes of the hash with no …\nTake the first size number of bytes of the hash and pad …\nWrapper struct for formatting changesets from the …\nReturns the argument unchanged.\nCalls U::from(self).\nConvenience function to serialize objects in RON format …") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_compiler_test_utils/fe_compiler_test_utils-desc-0-.js b/compiler-docs/search.desc/fe_compiler_test_utils/fe_compiler_test_utils-desc-0-.js new file mode 100644 index 0000000000..ed5c13f5af --- /dev/null +++ b/compiler-docs/search.desc/fe_compiler_test_utils/fe_compiler_test_utils-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_compiler_test_utils", 0, "Panic if the execution did not revert.\nPanic if the output is not an encoded error reason of the …\nPanic if the execution did not succeed.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nTo get the 2s complement value for e.g. -128 call …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCreate a new Runtime instance.\nCreate an ExecutionOutput instance\nGenerate the top level YUL object\nAdd the given set of functions\nAdd the given set of test statements") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_compiler_tests/fe_compiler_tests-desc-0-.js b/compiler-docs/search.desc/fe_compiler_tests/fe_compiler_tests-desc-0-.js new file mode 100644 index 0000000000..c44c3c48eb --- /dev/null +++ b/compiler-docs/search.desc/fe_compiler_tests/fe_compiler_tests-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_compiler_tests", 0, "") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_compiler_tests_legacy/fe_compiler_tests_legacy-desc-0-.js b/compiler-docs/search.desc/fe_compiler_tests_legacy/fe_compiler_tests_legacy-desc-0-.js new file mode 100644 index 0000000000..baaf135be0 --- /dev/null +++ b/compiler-docs/search.desc/fe_compiler_tests_legacy/fe_compiler_tests_legacy-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_compiler_tests_legacy", 0, "") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_driver/fe_driver-desc-0-.js b/compiler-docs/search.desc/fe_driver/fe_driver-desc-0-.js new file mode 100644 index 0000000000..45e6031ffc --- /dev/null +++ b/compiler-docs/search.desc/fe_driver/fe_driver-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_driver", 0, "The artifacts of a compiled contract.\nThe artifacts of a compiled module.\nCompiles the main module of a project.\nReturns graphviz string.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_library/fe_library-desc-0-.js b/compiler-docs/search.desc/fe_library/fe_library-desc-0-.js new file mode 100644 index 0000000000..f7288c344a --- /dev/null +++ b/compiler-docs/search.desc/fe_library/fe_library-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_library", 0, "") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_mir/fe_mir-desc-0-.js b/compiler-docs/search.desc/fe_mir/fe_mir-desc-0-.js new file mode 100644 index 0000000000..68eef8c25b --- /dev/null +++ b/compiler-docs/search.desc/fe_mir/fe_mir-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_mir", 0, "This module contains dominator tree related structs.\nThis module contains implementation of Post Dominator Tree.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nDominance frontiers of each blocks.\nCompute dominance frontiers of each blocks.\nReturns true if block1 dominates block2.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns number of frontier blocks of a block.\nReturns all dominance frontieres of a block.\nReturns the immediate dominator of the block. Returns None …\nCalls U::from(self).\nCalls U::from(self).\nReturns true if block is reachable from the entry block.\nReturns blocks in RPO.\nReturns true if block1 strictly dominates block2.\nChild loops that the loop includes.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nA header of the loop.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nReturns true if the block is in the lp.\nReturns all blocks in the loop.\nReturns header block of the lp.\nReturns number of loops found.\nReturns the loop that the block belongs to. If the block …\nReturns all loops in a function body. An outer loop is …\nA parent loop that includes the loop.\nGet parent loop of the lp if exists.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nReturns true if block is reachable from the exit blocks.\nRepresentative struct for the query group.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nGet access to extra methods pertaining to this query. For …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nLike in_db, but gives access to methods for setting the …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nWrites mir graphs of functions in a module.\nAn original source information that indicates where mir …\nThis module provides a collection of structs to modify …\nReturns the argument unchanged.\nCalls U::from(self).\nReturns the argument unchanged.\nCalls U::from(self).\nReturns the argument unchanged.\nCalls U::from(self).\nReturns true if current block is terminated.\nSpecify a current location of BodyCursor\nReturns current block that cursor points.\nReturns current inst that cursor points.\nReturns the argument unchanged.\nReturns the argument unchanged.\nInsert BasicBlockId to a location where a cursor points. …\nInsert InstId to a location where a cursor points. If you …\nCalls U::from(self).\nCalls U::from(self).\nRemove a current pointed block and contained insts from a …\nRemove a current pointed Inst from a function body. A …\nSets a cursor to an entry block.\nRepresents basic block order and instruction order.\nAppends a given block to a function body.\nAppends inst to the end of a block\nReturns a number of block in a function.\nReturns an entry block of a function body.\nReturns first instruction of a block if exists.\nReturns the argument unchanged.\nInserts a given block after a after block.\nInserts a given block before a before block.\nInsert inst after after inst.\nInsert inst before before inst.\nReturns a block to which a given inst belongs.\nCalls U::from(self).\nReturns true if a block doesn’t contain any block.\nReturns true if a function body contains a given block.\nReturns true is a given inst is inserted.\nReturns true if a block is terminated.\nReturns an iterator which iterates all basic blocks in a …\nReturns an iterator which iterates all instruction in a …\nReturns a last block of a function body.\nReturns a last instruction of a block.\nReturns a next block of a given block.\nReturns a next instruction of a given inst.\nPrepends inst to the beginning of a block\nReturns a previous block of a given block.\nReturns a previous instruction of a given inst.\nRemove a given block from a function. All instructions in …\nRemove instruction from the function body.\nReturns a terminator instruction of a block.\nAn interned Id for Constant.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nA module where a constant is declared.\nA name of a constant.\nA span where a constant is declared.\nA type of a constant.\nA value of a constant.\nA collection of basic block, instructions and values …\nA function can be called from other modules, and also can …\nA function body, which is not stored in salsa db to enable …\nRepresents function signature.\nA function can only be called within the same module.\nA function can be called from other modules, but can NOT …\nReturns class_name::fn_name if a function is a method else …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns an instruction result\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nReturns Some(local_name) if value is Value::Local.\nTracks order of basic blocks and instructions in a …\nReturns a type suffix if a generic function was …\nAccess to aggregate fields or elements.\nConstructs aggregate value, i.e. struct, tuple and array.\nBinary instruction.\nConditional branching instruction.\nThis is not a real instruction, just used to tag a …\n~ operator for bitwise inversion.\nUnconditional jump instruction.\nLoad a primitive value from a ptr\n- operator for negation.\nnot operator for logical inversion.\nA cast from a primitive type to a primitive type.\nUnary instruction.\nA cast from an enum type to its underlying type.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nA static array type definition.\nA user defined struct type definition.\nA user defined struct type definition.\nA user defined struct type definition.\nA map type definition.\nA user defined struct type definition.\nA tuple type definition.\nAn interned Id for ArrayDef.\nReturns an offset of the element of aggregate type.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nReturns size of the type in bytes.\nA constant value.\nAn immediate value.\nA local variable declared in a function body.\nA value resulted from an instruction.\nA singleton value representing Unit type.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\ntrue if a local is a function argument.\ntrue if a local is introduced in MIR.\nAn original name of a local variable.") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_parser/fe_parser-desc-0-.js b/compiler-docs/search.desc/fe_parser/fe_parser-desc-0-.js new file mode 100644 index 0000000000..5888c7c3ce --- /dev/null +++ b/compiler-docs/search.desc/fe_parser/fe_parser-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_parser", 0, "Contains the error value\nContains the success value\nParser maintains the parsing state, such as the token …\nReturns back tracking parser.\nAssert that the next token kind it matches the expected …\nThe diagnostics (errors and warnings) emitted during …\nReturns true if the parser has reached the end of the file.\nEnter a “block”, which is a brace-enclosed list of …\nEmit an error diagnostic, but don’t stop parsing\nIf the next token matches the expected kind, return it. …\nConsumes newlines and semicolons. Returns Ok if one or …\nLike Parser::expect, but with additional notes to be …\nEmit a “fancy” error diagnostic with any number of …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConvert into a [codespan_reporting::Diagnostic::Label]\nCreate a new parser for a source code string and …\nReturn the next token, or an error if we’ve reached the …\nIf the next token matches the expected kind, return it. …\nParse a Module from the file content string.\nTake a peek at the next token kind. Returns None if we’…\nTake a peek at the next token kind without consuming it, …\nCreate a primary label with the given message. This will …\nCreate a secondary label with the given message. This will …\nSplit the next token into two tokens, returning the first. …\nEmit an “unexpected token” error diagnostic with the …\nstruct or contract field, with optional ‘pub’ and ‘…\nRepresents a literal pattern. e.g., true.\nRepresents or pattern. e.g., EnumUnit | EnumTuple(_, _, _)\nRepresents unit variant pattern. e.g., Enum::Unit.\nRepresents struct or struct variant destructuring pattern. …\nRepresents tuple variant pattern. e.g., …\nRest pattern. e.g., ..\nA SmolStr is a string type that has the following …\nTuple variant. E.g., Baz(u32, i32) in\nRepresents tuple destructuring pattern. e.g., (x, y, z).\nUnit variant. E.g., Bar in\nEnum variant definition.\nEnum variant kind.\nRepresents a wildcard pattern _.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConstructs inline variant of SmolStr.\nParse a contract definition.\nParse call arguments\nParse an expression, starting with the next token.\nParse an expression, stopping if/when we reach an operator …\nParse an assert statement.\nParse a function definition. The optional pub qualifier …\nParse a function definition without a body. The optional …\nParse a for statement.\nParse a single generic function parameter (eg. T:SomeTrait …\nParse an angle-bracket-wrapped list of generic arguments …\nParse an if statement.\nParse a match statement.\nParse a return statement.\nParse a revert statement.\nParse a continue, break, pass, or revert statement.\nParse a function-level statement.\nParse an unsafe block.\nParse a while statement.\nParse a constant, e.g. const MAGIC_NUMBER: u256 = 4711.\nParse a Module.\nParse a ModuleStmt.\nParse a pragma <version-requirement> statement.\nParse a use statement.\nParse a use tree.\nParse a [ModuleStmt::Enum].\nParse a field for a struct or contract. The leading …\nParse an angle-bracket-wrapped list of generic arguments …\nParse an impl block.\nParse an optional qualifier (pub, const, or idx).\nReturns path and trailing :: token, if present.\nParse a [ModuleStmt::Struct].\nParse a trait definition.\nParse a type alias definition, e.g. …\nParse a type description, e.g. u8 or Map<address, u256>.\nParse a variant for a enum definition.\nReturn a user-friendly description of the token kind. E.g. …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCreate a new lexer with the given source code string.\nReturn the full source code string that’s being …\nAn exclusive span of byte offsets in a source file.\nA byte offset specifying the exclusive end of a span.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nA byte offset specifying the inclusive start of a span.") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_test_files/fe_test_files-desc-0-.js b/compiler-docs/search.desc/fe_test_files/fe_test_files-desc-0-.js new file mode 100644 index 0000000000..58e30443ce --- /dev/null +++ b/compiler-docs/search.desc/fe_test_files/fe_test_files-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_test_files", 0, "Returns (file_path, file_content)\nReturns (file_path, file_content)") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_test_runner/fe_test_runner-desc-0-.js b/compiler-docs/search.desc/fe_test_runner/fe_test_runner-desc-0-.js new file mode 100644 index 0000000000..e7447b352e --- /dev/null +++ b/compiler-docs/search.desc/fe_test_runner/fe_test_runner-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_test_runner", 0, "Returns the argument unchanged.\nCalls U::from(self).") \ No newline at end of file diff --git a/compiler-docs/search.desc/fe_yulc/fe_yulc-desc-0-.js b/compiler-docs/search.desc/fe_yulc/fe_yulc-desc-0-.js new file mode 100644 index 0000000000..aa537409c4 --- /dev/null +++ b/compiler-docs/search.desc/fe_yulc/fe_yulc-desc-0-.js @@ -0,0 +1 @@ +searchState.loadedDescShard("fe_yulc", 0, "Compile a map of Yul contracts to a map of bytecode …\nCompiles a single Yul contract to bytecode.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).") \ No newline at end of file diff --git a/compiler-docs/settings.html b/compiler-docs/settings.html new file mode 100644 index 0000000000..fd6fec8a66 --- /dev/null +++ b/compiler-docs/settings.html @@ -0,0 +1 @@ +Settings

Rustdoc settings

Back
\ No newline at end of file diff --git a/compiler-docs/src-files.js b/compiler-docs/src-files.js new file mode 100644 index 0000000000..583a4c339b --- /dev/null +++ b/compiler-docs/src-files.js @@ -0,0 +1,2 @@ +createSrcSidebar('[["fe",["",[["task",[],["build.rs","check.rs","mod.rs","new.rs"]]],["main.rs"]]],["fe_abi",["",[],["contract.rs","event.rs","function.rs","lib.rs","types.rs"]]],["fe_analyzer",["",[["db",[["queries",[],["contracts.rs","enums.rs","functions.rs","impls.rs","ingots.rs","module.rs","structs.rs","traits.rs","types.rs"]]],["queries.rs"]],["namespace",[],["items.rs","mod.rs","scopes.rs","types.rs"]],["traversal",[],["assignments.rs","borrowck.rs","call_args.rs","const_expr.rs","declarations.rs","expressions.rs","functions.rs","matching_anomaly.rs","mod.rs","pattern_analysis.rs","pragma.rs","types.rs","utils.rs"]]],["builtins.rs","constants.rs","context.rs","db.rs","display.rs","errors.rs","lib.rs","operations.rs"]]],["fe_codegen",["",[["db",[["queries",[],["abi.rs","constant.rs","contract.rs","function.rs","types.rs"]]],["queries.rs"]],["yul",[["isel",[],["context.rs","contract.rs","function.rs","inst_order.rs","mod.rs","test.rs"]],["legalize",[],["body.rs","critical_edge.rs","mod.rs","signature.rs"]],["runtime",[],["abi.rs","contract.rs","data.rs","emit.rs","mod.rs","revert.rs","safe_math.rs"]]],["mod.rs","slot_size.rs"]]],["db.rs","lib.rs"]]],["fe_common",["",[["utils",[],["dirs.rs","files.rs","git.rs","humanize.rs","keccak.rs","mod.rs","ron.rs"]]],["db.rs","diagnostics.rs","files.rs","lib.rs","numeric.rs","panic.rs","span.rs"]]],["fe_compiler_test_utils",["",[],["lib.rs"]]],["fe_compiler_tests",["",[],["lib.rs"]]],["fe_compiler_tests_legacy",["",[],["lib.rs"]]],["fe_driver",["",[],["lib.rs"]]],["fe_library",["",[],["lib.rs"]]],["fe_mir",["",[["analysis",[],["cfg.rs","domtree.rs","loop_tree.rs","mod.rs","post_domtree.rs"]],["db",[["queries",[],["constant.rs","contract.rs","enums.rs","function.rs","module.rs","structs.rs","types.rs"]]],["queries.rs"]],["graphviz",[],["block.rs","function.rs","mod.rs","module.rs"]],["ir",[],["basic_block.rs","body_builder.rs","body_cursor.rs","body_order.rs","constant.rs","function.rs","inst.rs","mod.rs","types.rs","value.rs"]],["lower",[["pattern_match",[],["decision_tree.rs","mod.rs","tree_vis.rs"]]],["function.rs","mod.rs","types.rs"]],["pretty_print",[],["inst.rs","mod.rs","types.rs","value.rs"]]],["db.rs","lib.rs"]]],["fe_parser",["",[["grammar",[],["contracts.rs","expressions.rs","functions.rs","module.rs","types.rs"]],["lexer",[],["token.rs"]]],["ast.rs","grammar.rs","lexer.rs","lib.rs","node.rs","parser.rs"]]],["fe_test_files",["",[],["lib.rs"]]],["fe_test_runner",["",[],["lib.rs"]]],["fe_yulc",["",[],["lib.rs"]]]]'); +//{"start":19,"fragment_lengths":[79,80,558,437,191,46,41,48,33,34,638,200,37,38,31]} \ No newline at end of file diff --git a/compiler-docs/src/fe/main.rs.html b/compiler-docs/src/fe/main.rs.html new file mode 100644 index 0000000000..93a0609783 --- /dev/null +++ b/compiler-docs/src/fe/main.rs.html @@ -0,0 +1,38 @@ +main.rs - source

fe/
main.rs

1mod task;
+2
+3use clap::Parser;
+4use fe_common::panic::install_panic_hook;
+5use task::Commands;
+6
+7#[derive(Parser)]
+8#[clap(author, version, about, long_about = None)]
+9struct FelangCli {
+10    #[clap(subcommand)]
+11    command: Commands,
+12}
+13
+14fn main() {
+15    install_panic_hook();
+16
+17    let cli = FelangCli::parse();
+18
+19    match cli.command {
+20        Commands::Build(arg) => {
+21            task::build(arg);
+22        }
+23        Commands::Check(arg) => {
+24            task::check(arg);
+25        }
+26        Commands::New(arg) => {
+27            task::create_new_project(arg);
+28        }
+29        #[cfg(feature = "solc-backend")]
+30        Commands::Verify(arg) => {
+31            task::verify(arg);
+32        }
+33        #[cfg(feature = "solc-backend")]
+34        Commands::Test(arg) => {
+35            task::test(arg);
+36        }
+37    }
+38}
\ No newline at end of file diff --git a/compiler-docs/src/fe/task/build.rs.html b/compiler-docs/src/fe/task/build.rs.html new file mode 100644 index 0000000000..5a28008d5f --- /dev/null +++ b/compiler-docs/src/fe/task/build.rs.html @@ -0,0 +1,278 @@ +build.rs - source

fe/task/
build.rs

1use std::fs;
+2use std::io::{Error, Write};
+3use std::path::Path;
+4
+5use clap::{ArgEnum, Args};
+6use fe_common::diagnostics::print_diagnostics;
+7use fe_common::files::SourceFileId;
+8use fe_common::utils::files::{get_project_root, BuildFiles, ProjectMode};
+9use fe_driver::CompiledModule;
+10
+11const DEFAULT_OUTPUT_DIR_NAME: &str = "output";
+12
+13#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ArgEnum, Debug)]
+14enum Emit {
+15    Abi,
+16    Ast,
+17    LoweredAst,
+18    Bytecode,
+19    RuntimeBytecode,
+20    Tokens,
+21    Yul,
+22}
+23
+24#[derive(Args)]
+25#[clap(about = "Build the current project")]
+26pub struct BuildArgs {
+27    #[clap(default_value_t = get_project_root().unwrap_or(".".to_string()))]
+28    input_path: String,
+29    #[clap(short, long, default_value = DEFAULT_OUTPUT_DIR_NAME)]
+30    output_dir: String,
+31    #[clap(
+32        arg_enum,
+33        use_value_delimiter = true,
+34        long,
+35        short,
+36        default_value = "abi,bytecode"
+37    )]
+38    emit: Vec<Emit>,
+39    #[clap(long)]
+40    mir: bool,
+41    #[clap(long)]
+42    overwrite: bool,
+43    #[clap(long, takes_value(true))]
+44    optimize: Option<bool>,
+45}
+46
+47fn build_single_file(compile_arg: &BuildArgs) -> (String, CompiledModule) {
+48    let emit = &compile_arg.emit;
+49    let with_bytecode = emit.contains(&Emit::Bytecode);
+50    let with_runtime_bytecode = emit.contains(&Emit::RuntimeBytecode);
+51    let input_path = &compile_arg.input_path;
+52    let optimize = compile_arg.optimize.unwrap_or(true);
+53
+54    let mut db = fe_driver::Db::default();
+55    let content = match std::fs::read_to_string(input_path) {
+56        Err(err) => {
+57            eprintln!("Failed to load file: `{input_path}`. Error: {err}");
+58            std::process::exit(1)
+59        }
+60        Ok(content) => content,
+61    };
+62
+63    let compiled_module = match fe_driver::compile_single_file(
+64        &mut db,
+65        input_path,
+66        &content,
+67        with_bytecode,
+68        with_runtime_bytecode,
+69        optimize,
+70    ) {
+71        Ok(module) => module,
+72        Err(error) => {
+73            eprintln!("Unable to compile {input_path}.");
+74            print_diagnostics(&db, &error.0);
+75            std::process::exit(1)
+76        }
+77    };
+78    (content, compiled_module)
+79}
+80
+81fn build_ingot(compile_arg: &BuildArgs) -> (String, CompiledModule) {
+82    let emit = &compile_arg.emit;
+83    let with_bytecode = emit.contains(&Emit::Bytecode);
+84    let with_runtime_bytecode = emit.contains(&Emit::RuntimeBytecode);
+85    let input_path = &compile_arg.input_path;
+86    let optimize = compile_arg.optimize.unwrap_or(true);
+87
+88    if !Path::new(input_path).exists() {
+89        eprintln!("Input directory does not exist: `{input_path}`.");
+90        std::process::exit(1)
+91    }
+92
+93    let build_files = match BuildFiles::load_fs(input_path) {
+94        Ok(files) => files,
+95        Err(err) => {
+96            eprintln!("Failed to load project files.\nError: {err}");
+97            std::process::exit(1)
+98        }
+99    };
+100
+101    if build_files.root_project_mode() == ProjectMode::Lib {
+102        eprintln!("Unable to compile {input_path}. No build targets in library mode.");
+103        eprintln!("Consider replacing `src/lib.fe` with `src/main.fe`.");
+104        std::process::exit(1)
+105    }
+106
+107    let mut db = fe_driver::Db::default();
+108    let compiled_module = match fe_driver::compile_ingot(
+109        &mut db,
+110        &build_files,
+111        with_bytecode,
+112        with_runtime_bytecode,
+113        optimize,
+114    ) {
+115        Ok(module) => module,
+116        Err(error) => {
+117            eprintln!("Unable to compile {input_path}.");
+118            print_diagnostics(&db, &error.0);
+119            std::process::exit(1)
+120        }
+121    };
+122
+123    // no file content for ingots
+124    ("".to_string(), compiled_module)
+125}
+126
+127pub fn build(compile_arg: BuildArgs) {
+128    let emit = &compile_arg.emit;
+129
+130    let input_path = &compile_arg.input_path;
+131
+132    if compile_arg.mir {
+133        return mir_dump(input_path);
+134    }
+135
+136    let _with_bytecode = emit.contains(&Emit::Bytecode);
+137    #[cfg(not(feature = "solc-backend"))]
+138    if _with_bytecode {
+139        eprintln!("Warning: bytecode output requires 'solc-backend' feature. Try `cargo build --release --features solc-backend`. Skipping.");
+140    }
+141
+142    let (content, compiled_module) = if Path::new(input_path).is_file() {
+143        build_single_file(&compile_arg)
+144    } else {
+145        build_ingot(&compile_arg)
+146    };
+147
+148    let output_dir = &compile_arg.output_dir;
+149    let overwrite = compile_arg.overwrite;
+150    match write_compiled_module(compiled_module, &content, emit, output_dir, overwrite) {
+151        Ok(_) => eprintln!("Compiled {input_path}. Outputs in `{output_dir}`"),
+152        Err(err) => {
+153            eprintln!("Failed to write output to directory: `{output_dir}`. Error: {err}");
+154            std::process::exit(1)
+155        }
+156    }
+157}
+158
+159fn write_compiled_module(
+160    mut module: CompiledModule,
+161    file_content: &str,
+162    targets: &[Emit],
+163    output_dir: &str,
+164    overwrite: bool,
+165) -> Result<(), String> {
+166    let output_dir = Path::new(output_dir);
+167    if output_dir.is_file() {
+168        return Err(format!(
+169            "A file exists at path `{}`, the location of the output directory. Refusing to overwrite.",
+170            output_dir.display()
+171        ));
+172    }
+173
+174    if !overwrite {
+175        verify_nonexistent_or_empty(output_dir)?;
+176    }
+177
+178    fs::create_dir_all(output_dir).map_err(ioerr_to_string)?;
+179
+180    if targets.contains(&Emit::Ast) {
+181        write_output(&output_dir.join("module.ast"), &module.src_ast)?;
+182    }
+183
+184    if targets.contains(&Emit::LoweredAst) {
+185        write_output(&output_dir.join("lowered_module.ast"), &module.lowered_ast)?;
+186    }
+187
+188    if targets.contains(&Emit::Tokens) {
+189        let tokens = {
+190            let lexer = fe_parser::lexer::Lexer::new(SourceFileId::dummy_file(), file_content);
+191            lexer.collect::<Vec<_>>()
+192        };
+193        write_output(&output_dir.join("module.tokens"), &format!("{tokens:#?}"))?;
+194    }
+195
+196    for (name, contract) in module.contracts.drain(0..) {
+197        let contract_output_dir = output_dir.join(&name);
+198        fs::create_dir_all(&contract_output_dir).map_err(ioerr_to_string)?;
+199
+200        if targets.contains(&Emit::Abi) {
+201            let file_name = format!("{}_abi.json", &name);
+202            write_output(&contract_output_dir.join(file_name), &contract.json_abi)?;
+203        }
+204
+205        if targets.contains(&Emit::Yul) {
+206            let file_name = format!("{}_ir.yul", &name);
+207            write_output(&contract_output_dir.join(file_name), &contract.yul)?;
+208        }
+209
+210        #[cfg(feature = "solc-backend")]
+211        if targets.contains(&Emit::Bytecode) {
+212            let file_name = format!("{}.bin", &name);
+213            write_output(&contract_output_dir.join(file_name), &contract.bytecode)?;
+214        }
+215        #[cfg(feature = "solc-backend")]
+216        if targets.contains(&Emit::RuntimeBytecode) {
+217            let file_name = format!("{}.runtime.bin", &name);
+218            write_output(
+219                &contract_output_dir.join(file_name),
+220                &contract.runtime_bytecode,
+221            )?;
+222        }
+223    }
+224
+225    Ok(())
+226}
+227
+228fn write_output(path: &Path, content: &str) -> Result<(), String> {
+229    let mut file = fs::OpenOptions::new()
+230        .write(true)
+231        .create(true)
+232        .truncate(true)
+233        .open(path)
+234        .map_err(ioerr_to_string)?;
+235    file.write_all(content.as_bytes())
+236        .map_err(ioerr_to_string)?;
+237    Ok(())
+238}
+239
+240fn ioerr_to_string(error: Error) -> String {
+241    format!("{error}")
+242}
+243
+244fn verify_nonexistent_or_empty(dir: &Path) -> Result<(), String> {
+245    if !dir.exists() || dir.read_dir().map_err(ioerr_to_string)?.next().is_none() {
+246        Ok(())
+247    } else {
+248        Err(format!(
+249            "Directory '{}' is not empty. Use --overwrite to overwrite.",
+250            dir.display()
+251        ))
+252    }
+253}
+254
+255fn mir_dump(input_path: &str) {
+256    let mut db = fe_driver::Db::default();
+257    if Path::new(input_path).is_file() {
+258        let content = match std::fs::read_to_string(input_path) {
+259            Err(err) => {
+260                eprintln!("Failed to load file: `{input_path}`. Error: {err}");
+261                std::process::exit(1)
+262            }
+263            Ok(content) => content,
+264        };
+265
+266        match fe_driver::dump_mir_single_file(&mut db, input_path, &content) {
+267            Ok(text) => println!("{text}"),
+268            Err(err) => {
+269                eprintln!("Unable to dump mir `{input_path}");
+270                print_diagnostics(&db, &err.0);
+271                std::process::exit(1)
+272            }
+273        }
+274    } else {
+275        eprintln!("dumping mir for ingot is not supported yet");
+276        std::process::exit(1)
+277    }
+278}
\ No newline at end of file diff --git a/compiler-docs/src/fe/task/check.rs.html b/compiler-docs/src/fe/task/check.rs.html new file mode 100644 index 0000000000..fa504e090c --- /dev/null +++ b/compiler-docs/src/fe/task/check.rs.html @@ -0,0 +1,59 @@ +check.rs - source

fe/task/
check.rs

1use std::path::Path;
+2
+3use clap::Args;
+4use fe_common::{
+5    diagnostics::{print_diagnostics, Diagnostic},
+6    utils::files::get_project_root,
+7    utils::files::BuildFiles,
+8};
+9use fe_driver::Db;
+10
+11#[derive(Args)]
+12#[clap(about = "Analyze the current project and report errors, but don't build artifacts")]
+13pub struct CheckArgs {
+14    #[clap(default_value_t = get_project_root().unwrap_or(".".to_string()))]
+15    input_path: String,
+16}
+17
+18fn check_single_file(db: &mut Db, input_path: &str) -> Vec<Diagnostic> {
+19    let content = match std::fs::read_to_string(input_path) {
+20        Err(err) => {
+21            eprintln!("Failed to load file: `{}`. Error: {}", &input_path, err);
+22            std::process::exit(1)
+23        }
+24        Ok(content) => content,
+25    };
+26
+27    fe_driver::check_single_file(db, input_path, &content)
+28}
+29
+30fn check_ingot(db: &mut Db, input_path: &str) -> Vec<Diagnostic> {
+31    let build_files = match BuildFiles::load_fs(input_path) {
+32        Ok(files) => files,
+33        Err(err) => {
+34            eprintln!("Failed to load project files.\nError: {err}");
+35            std::process::exit(1)
+36        }
+37    };
+38
+39    fe_driver::check_ingot(db, &build_files)
+40}
+41
+42pub fn check(args: CheckArgs) {
+43    let mut db = fe_driver::Db::default();
+44    let input_path = args.input_path;
+45
+46    // check project
+47    let diags = if Path::new(&input_path).is_file() {
+48        check_single_file(&mut db, &input_path)
+49    } else {
+50        check_ingot(&mut db, &input_path)
+51    };
+52
+53    if !diags.is_empty() {
+54        print_diagnostics(&db, &diags);
+55        std::process::exit(1);
+56    }
+57
+58    eprintln!("Finished");
+59}
\ No newline at end of file diff --git a/compiler-docs/src/fe/task/mod.rs.html b/compiler-docs/src/fe/task/mod.rs.html new file mode 100644 index 0000000000..8f63150c22 --- /dev/null +++ b/compiler-docs/src/fe/task/mod.rs.html @@ -0,0 +1,26 @@ +mod.rs - source

fe/task/
mod.rs

1mod build;
+2mod check;
+3mod new;
+4#[cfg(feature = "solc-backend")]
+5mod test;
+6mod verify;
+7
+8pub use build::{build, BuildArgs};
+9pub use check::{check, CheckArgs};
+10use clap::Subcommand;
+11pub use new::{create_new_project, NewProjectArgs};
+12#[cfg(feature = "solc-backend")]
+13pub use test::{test, TestArgs};
+14#[cfg(feature = "solc-backend")]
+15pub use verify::{verify, VerifyArgs};
+16
+17#[derive(Subcommand)]
+18pub enum Commands {
+19    Build(BuildArgs),
+20    Check(CheckArgs),
+21    New(NewProjectArgs),
+22    #[cfg(feature = "solc-backend")]
+23    Verify(VerifyArgs),
+24    #[cfg(feature = "solc-backend")]
+25    Test(TestArgs),
+26}
\ No newline at end of file diff --git a/compiler-docs/src/fe/task/new.rs.html b/compiler-docs/src/fe/task/new.rs.html new file mode 100644 index 0000000000..145f93e9ac --- /dev/null +++ b/compiler-docs/src/fe/task/new.rs.html @@ -0,0 +1,49 @@ +new.rs - source

fe/task/
new.rs

1use clap::Args;
+2use include_dir::{include_dir, Dir};
+3use std::{fs, path::Path};
+4
+5const SRC_TEMPLATE_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/src/template/src");
+6
+7#[derive(Args)]
+8#[clap(about = "Create new fe project")]
+9pub struct NewProjectArgs {
+10    name: String,
+11}
+12
+13fn create_project(name: &str, path: &Path) {
+14    for src_file in SRC_TEMPLATE_DIR.entries() {
+15        let file = src_file.as_file().unwrap();
+16        fs::write(path.join("src").join(file.path()), file.contents()).unwrap();
+17    }
+18
+19    let manifest_content = format!(
+20        "name = \"{name}\"
+21version = \"1.0\"
+22
+23[dependencies]
+24# my_lib = \"../my_lib\"
+25# my_lib = {{ path = \"../my_lib\", version = \"1.0\" }}"
+26    );
+27    fs::write(path.join("fe.toml"), manifest_content).unwrap();
+28}
+29
+30pub fn create_new_project(args: NewProjectArgs) {
+31    let project_path = Path::new(&args.name);
+32
+33    if project_path.exists() {
+34        eprintln!(
+35            "Error: destination directory {} already exists",
+36            project_path.canonicalize().unwrap().display(),
+37        );
+38        std::process::exit(1)
+39    }
+40
+41    match fs::create_dir_all(project_path.join("src")) {
+42        Ok(_) => create_project(&args.name, project_path),
+43        Err(err) => {
+44            eprintln!("{err}");
+45            std::process::exit(1);
+46        }
+47    }
+48    eprintln!("Created {}", project_path.display());
+49}
\ No newline at end of file diff --git a/compiler-docs/src/fe_abi/contract.rs.html b/compiler-docs/src/fe_abi/contract.rs.html new file mode 100644 index 0000000000..a4651d8c6b --- /dev/null +++ b/compiler-docs/src/fe_abi/contract.rs.html @@ -0,0 +1,33 @@ +contract.rs - source

fe_abi/
contract.rs

1use super::{event::AbiEvent, function::AbiFunction};
+2
+3use serde::{ser::SerializeSeq, Serialize, Serializer};
+4
+5#[derive(Debug, Clone, PartialEq, Eq)]
+6pub struct AbiContract {
+7    /// Public functions in the contract.
+8    funcs: Vec<AbiFunction>,
+9
+10    /// Events emitted from the contract.
+11    events: Vec<AbiEvent>,
+12}
+13
+14impl Serialize for AbiContract {
+15    fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
+16        let mut seq = s.serialize_seq(Some(self.funcs.len() + self.events.len()))?;
+17        for func in &self.funcs {
+18            seq.serialize_element(func)?;
+19        }
+20
+21        for event in &self.events {
+22            seq.serialize_element(event)?;
+23        }
+24
+25        seq.end()
+26    }
+27}
+28
+29impl AbiContract {
+30    pub fn new(funcs: Vec<AbiFunction>, events: Vec<AbiEvent>) -> Self {
+31        Self { funcs, events }
+32    }
+33}
\ No newline at end of file diff --git a/compiler-docs/src/fe_abi/event.rs.html b/compiler-docs/src/fe_abi/event.rs.html new file mode 100644 index 0000000000..8af29b798b --- /dev/null +++ b/compiler-docs/src/fe_abi/event.rs.html @@ -0,0 +1,148 @@ +event.rs - source

fe_abi/
event.rs

1use super::types::AbiType;
+2
+3use fe_common::utils::keccak;
+4use serde::Serialize;
+5
+6#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
+7pub struct AbiEvent {
+8    #[serde(rename = "type")]
+9    pub ty: &'static str,
+10    pub name: String,
+11    pub inputs: Vec<AbiEventField>,
+12    pub anonymous: bool,
+13}
+14
+15impl AbiEvent {
+16    pub fn new(name: String, fields: Vec<AbiEventField>, anonymous: bool) -> Self {
+17        Self {
+18            ty: "event",
+19            name,
+20            inputs: fields,
+21            anonymous,
+22        }
+23    }
+24
+25    pub fn signature(&self) -> AbiEventSignature {
+26        AbiEventSignature::new(self)
+27    }
+28}
+29
+30pub struct AbiEventSignature {
+31    sig: String,
+32}
+33
+34impl AbiEventSignature {
+35    pub fn signature(&self) -> &str {
+36        &self.sig
+37    }
+38
+39    pub fn hash_hex(&self) -> String {
+40        keccak::full(self.sig.as_bytes())
+41    }
+42
+43    pub fn hash_raw(&self) -> [u8; 32] {
+44        keccak::full_as_bytes(self.sig.as_bytes())
+45    }
+46
+47    fn new(event: &AbiEvent) -> Self {
+48        let sig = format!(
+49            "{}({})",
+50            event.name,
+51            event
+52                .inputs
+53                .iter()
+54                .map(|input| input.ty.selector_type_name())
+55                .collect::<Vec<_>>()
+56                .join(",")
+57        );
+58
+59        Self { sig }
+60    }
+61}
+62
+63#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
+64pub struct AbiEventField {
+65    pub name: String,
+66    #[serde(flatten)]
+67    pub ty: AbiType,
+68    pub indexed: bool,
+69}
+70
+71impl AbiEventField {
+72    pub fn new(name: String, ty: impl Into<AbiType>, indexed: bool) -> Self {
+73        Self {
+74            name,
+75            ty: ty.into(),
+76            indexed,
+77        }
+78    }
+79}
+80
+81#[cfg(test)]
+82mod tests {
+83    use super::*;
+84
+85    use serde_test::{assert_ser_tokens, Token};
+86
+87    fn test_event() -> AbiEvent {
+88        let i32_ty = AbiType::Int(32);
+89        let u32_ty = AbiType::UInt(32);
+90        let field1 = AbiEventField::new("x".into(), i32_ty, true);
+91        let field2 = AbiEventField::new("y".into(), u32_ty, false);
+92
+93        AbiEvent::new("MyEvent".into(), vec![field1, field2], false)
+94    }
+95
+96    #[test]
+97    fn serialize_event() {
+98        let event = test_event();
+99
+100        assert_ser_tokens(
+101            &event,
+102            &[
+103                Token::Struct {
+104                    name: "AbiEvent",
+105                    len: 4,
+106                },
+107                Token::Str("type"),
+108                Token::Str("event"),
+109                Token::String("name"),
+110                Token::String("MyEvent"),
+111                Token::Str("inputs"),
+112                Token::Seq { len: Some(2) },
+113                Token::Map { len: None },
+114                Token::String("name"),
+115                Token::String("x"),
+116                Token::String("type"),
+117                Token::String("int32"),
+118                Token::Str("indexed"),
+119                Token::Bool(true),
+120                Token::MapEnd,
+121                Token::Map { len: None },
+122                Token::String("name"),
+123                Token::String("y"),
+124                Token::String("type"),
+125                Token::String("uint32"),
+126                Token::Str("indexed"),
+127                Token::Bool(false),
+128                Token::MapEnd,
+129                Token::SeqEnd,
+130                Token::Str("anonymous"),
+131                Token::Bool(false),
+132                Token::StructEnd,
+133            ],
+134        )
+135    }
+136
+137    #[test]
+138    fn event_signature() {
+139        let event = test_event();
+140
+141        let sig = event.signature();
+142        debug_assert_eq!(sig.signature(), "MyEvent(int32,uint32)");
+143        debug_assert_eq!(
+144            sig.hash_hex(),
+145            "ec835d5150565cb216f72ba07d715e875b0738b1ac3f412e103839e5157b7ee6"
+146        );
+147    }
+148}
\ No newline at end of file diff --git a/compiler-docs/src/fe_abi/function.rs.html b/compiler-docs/src/fe_abi/function.rs.html new file mode 100644 index 0000000000..eb2ea0e01f --- /dev/null +++ b/compiler-docs/src/fe_abi/function.rs.html @@ -0,0 +1,307 @@ +function.rs - source

fe_abi/
function.rs

1use fe_common::utils::keccak;
+2
+3use serde::Serialize;
+4
+5use super::types::AbiType;
+6
+7/// The mutability of a public function.
+8#[derive(Serialize, Debug, PartialEq, Eq, Clone)]
+9#[serde(rename_all = "lowercase")]
+10pub enum StateMutability {
+11    Pure,
+12    View,
+13    Nonpayable,
+14    Payable,
+15}
+16
+17pub enum SelfParam {
+18    None,
+19    Imm,
+20    Mut,
+21}
+22pub enum CtxParam {
+23    None,
+24    Imm,
+25    Mut,
+26}
+27
+28impl StateMutability {
+29    pub fn from_self_and_ctx_params(self_: SelfParam, ctx: CtxParam) -> Self {
+30        // Check ABI conformity
+31        // See https://github.com/ethereum/fe/issues/558
+32        //
+33        //              no self   |   self   |  mut self  |
+34        //           ......................................
+35        // no ctx    :    pure    |   view    |  payable  |
+36        // ctx       :    view    |   view    |  payable  |
+37        // mut ctx   :   payable  |  payable  |  payable  |
+38
+39        match (self_, ctx) {
+40            (SelfParam::None, CtxParam::None) => StateMutability::Pure,
+41            (SelfParam::None, CtxParam::Imm) => StateMutability::View,
+42            (SelfParam::None, CtxParam::Mut) => StateMutability::Payable,
+43            (SelfParam::Imm, CtxParam::None) => StateMutability::View,
+44            (SelfParam::Imm, CtxParam::Imm) => StateMutability::View,
+45            (SelfParam::Imm, CtxParam::Mut) => StateMutability::Payable,
+46            (SelfParam::Mut, _) => StateMutability::Payable,
+47        }
+48    }
+49}
+50
+51#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
+52pub struct AbiFunction {
+53    #[serde(rename = "type")]
+54    func_type: AbiFunctionType,
+55    name: String,
+56    inputs: Vec<AbiFunctionParamInner>,
+57    outputs: Vec<AbiFunctionParamInner>,
+58    #[serde(rename = "stateMutability")]
+59    state_mutability: StateMutability,
+60}
+61
+62impl AbiFunction {
+63    pub fn new(
+64        func_type: AbiFunctionType,
+65        name: String,
+66        args: Vec<(String, AbiType)>,
+67        ret_ty: Option<AbiType>,
+68        state_mutability: StateMutability,
+69    ) -> Self {
+70        let inputs = args
+71            .into_iter()
+72            .map(|(arg_name, arg_ty)| AbiFunctionParamInner::new(arg_name, arg_ty))
+73            .collect();
+74        let outputs = ret_ty.map_or_else(Vec::new, |ret_ty| {
+75            vec![AbiFunctionParamInner::new("".into(), ret_ty)]
+76        });
+77
+78        Self {
+79            func_type,
+80            name,
+81            inputs,
+82            outputs,
+83            state_mutability,
+84        }
+85    }
+86
+87    pub fn selector(&self) -> AbiFunctionSelector {
+88        AbiFunctionSelector::new(self)
+89    }
+90}
+91
+92#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
+93#[serde(rename_all = "lowercase")]
+94pub enum AbiFunctionType {
+95    Function,
+96    Constructor,
+97    Receive,
+98    Payable,
+99    Fallback,
+100}
+101
+102pub struct AbiFunctionSelector {
+103    selector_sig: String,
+104}
+105
+106impl AbiFunctionSelector {
+107    fn new(func_sig: &AbiFunction) -> Self {
+108        let selector_sig = format!(
+109            "{}({})",
+110            func_sig.name,
+111            func_sig
+112                .inputs
+113                .iter()
+114                .map(|param| param.ty.selector_type_name())
+115                .collect::<Vec<_>>()
+116                .join(",")
+117        );
+118
+119        Self { selector_sig }
+120    }
+121
+122    pub fn selector_signature(&self) -> &str {
+123        &self.selector_sig
+124    }
+125
+126    pub fn selector_raw(&self) -> [u8; 4] {
+127        keccak::full_as_bytes(self.selector_sig.as_bytes())[..4]
+128            .try_into()
+129            .unwrap()
+130    }
+131
+132    /// Returns first 4 bytes of signature hash in hex.
+133    pub fn hex(&self) -> String {
+134        keccak::partial(self.selector_sig.as_bytes(), 4)
+135    }
+136}
+137
+138#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
+139struct AbiFunctionParamInner {
+140    name: String,
+141    #[serde(flatten)]
+142    ty: AbiType,
+143}
+144
+145impl AbiFunctionParamInner {
+146    fn new(name: String, ty: AbiType) -> Self {
+147        Self { name, ty }
+148    }
+149}
+150
+151#[cfg(test)]
+152mod tests {
+153    use crate::types::AbiTupleField;
+154
+155    use super::*;
+156    use serde_test::{assert_ser_tokens, Token};
+157
+158    fn simple_tuple() -> AbiType {
+159        let u16_ty = AbiType::UInt(16);
+160        let bool_ty = AbiType::Bool;
+161        let field1 = AbiTupleField::new("field1".into(), u16_ty);
+162        let field2 = AbiTupleField::new("field2".into(), bool_ty);
+163
+164        AbiType::Tuple(vec![field1, field2])
+165    }
+166
+167    fn test_func(state_mutability: StateMutability) -> AbiFunction {
+168        let i32_ty = AbiType::Int(32);
+169        let tuple_ty = simple_tuple();
+170        let u64_ty = AbiType::UInt(64);
+171
+172        AbiFunction::new(
+173            AbiFunctionType::Function,
+174            "test_func".into(),
+175            vec![("arg1".into(), i32_ty), ("arg2".into(), tuple_ty)],
+176            Some(u64_ty),
+177            state_mutability,
+178        )
+179    }
+180
+181    #[test]
+182    fn serialize_func() {
+183        let func = test_func(StateMutability::Payable);
+184
+185        assert_ser_tokens(
+186            &func,
+187            &[
+188                Token::Struct {
+189                    name: "AbiFunction",
+190                    len: 5,
+191                },
+192                Token::Str("type"),
+193                Token::UnitVariant {
+194                    name: "AbiFunctionType",
+195                    variant: "function",
+196                },
+197                Token::String("name"),
+198                Token::String("test_func"),
+199                Token::Str("inputs"),
+200                Token::Seq { len: Some(2) },
+201                Token::Map { len: None },
+202                Token::String("name"),
+203                Token::String("arg1"),
+204                Token::String("type"),
+205                Token::String("int32"),
+206                Token::MapEnd,
+207                Token::Map { len: None },
+208                Token::String("name"),
+209                Token::String("arg2"),
+210                Token::String("type"),
+211                Token::String("tuple"),
+212                Token::String("components"),
+213                Token::Seq { len: Some(2) },
+214                Token::Map { len: None },
+215                Token::String("name"),
+216                Token::String("field1"),
+217                Token::String("type"),
+218                Token::String("uint16"),
+219                Token::MapEnd,
+220                Token::Map { len: None },
+221                Token::String("name"),
+222                Token::String("field2"),
+223                Token::String("type"),
+224                Token::String("bool"),
+225                Token::MapEnd,
+226                Token::SeqEnd,
+227                Token::MapEnd,
+228                Token::SeqEnd,
+229                Token::Str("outputs"),
+230                Token::Seq { len: Some(1) },
+231                Token::Map { len: None },
+232                Token::String("name"),
+233                Token::String(""),
+234                Token::String("type"),
+235                Token::String("uint64"),
+236                Token::MapEnd,
+237                Token::SeqEnd,
+238                Token::Str("stateMutability"),
+239                Token::UnitVariant {
+240                    name: "StateMutability",
+241                    variant: "payable",
+242                },
+243                Token::StructEnd,
+244            ],
+245        )
+246    }
+247
+248    #[test]
+249    fn test_state_mutability() {
+250        assert_eq!(
+251            StateMutability::from_self_and_ctx_params(SelfParam::None, CtxParam::None),
+252            StateMutability::Pure
+253        );
+254        assert_eq!(
+255            StateMutability::from_self_and_ctx_params(SelfParam::None, CtxParam::Imm),
+256            StateMutability::View
+257        );
+258        assert_eq!(
+259            StateMutability::from_self_and_ctx_params(SelfParam::None, CtxParam::Mut),
+260            StateMutability::Payable
+261        );
+262
+263        assert_eq!(
+264            StateMutability::from_self_and_ctx_params(SelfParam::Imm, CtxParam::None),
+265            StateMutability::View
+266        );
+267        assert_eq!(
+268            StateMutability::from_self_and_ctx_params(SelfParam::Imm, CtxParam::Imm),
+269            StateMutability::View
+270        );
+271        assert_eq!(
+272            StateMutability::from_self_and_ctx_params(SelfParam::Imm, CtxParam::Mut),
+273            StateMutability::Payable
+274        );
+275
+276        assert_eq!(
+277            StateMutability::from_self_and_ctx_params(SelfParam::Mut, CtxParam::None),
+278            StateMutability::Payable
+279        );
+280        assert_eq!(
+281            StateMutability::from_self_and_ctx_params(SelfParam::Mut, CtxParam::Imm),
+282            StateMutability::Payable
+283        );
+284        assert_eq!(
+285            StateMutability::from_self_and_ctx_params(SelfParam::Mut, CtxParam::Mut),
+286            StateMutability::Payable
+287        );
+288
+289        let pure_func = test_func(StateMutability::Pure);
+290        assert_eq!(pure_func.state_mutability, StateMutability::Pure);
+291
+292        let impure_func = test_func(StateMutability::Payable);
+293        assert_eq!(impure_func.state_mutability, StateMutability::Payable);
+294    }
+295
+296    #[test]
+297    fn func_selector() {
+298        let func = test_func(StateMutability::Payable);
+299        let selector = func.selector();
+300
+301        debug_assert_eq!(
+302            selector.selector_signature(),
+303            "test_func(int32,(uint16,bool))"
+304        );
+305        debug_assert_eq!(selector.hex(), "79c3c8b2");
+306    }
+307}
\ No newline at end of file diff --git a/compiler-docs/src/fe_abi/lib.rs.html b/compiler-docs/src/fe_abi/lib.rs.html new file mode 100644 index 0000000000..7df2ca15e0 --- /dev/null +++ b/compiler-docs/src/fe_abi/lib.rs.html @@ -0,0 +1,4 @@ +lib.rs - source

fe_abi/
lib.rs

1pub mod contract;
+2pub mod event;
+3pub mod function;
+4pub mod types;
\ No newline at end of file diff --git a/compiler-docs/src/fe_abi/types.rs.html b/compiler-docs/src/fe_abi/types.rs.html new file mode 100644 index 0000000000..b4efbedf58 --- /dev/null +++ b/compiler-docs/src/fe_abi/types.rs.html @@ -0,0 +1,374 @@ +types.rs - source

fe_abi/
types.rs

1use serde::{ser::SerializeMap, Serialize, Serializer};
+2
+3#[derive(Debug, Clone, PartialEq, Eq)]
+4pub enum AbiType {
+5    UInt(usize),
+6    Int(usize),
+7    Address,
+8    Bool,
+9    Function,
+10    Array { elem_ty: Box<AbiType>, len: usize },
+11    Tuple(Vec<AbiTupleField>),
+12    Bytes,
+13    String,
+14}
+15
+16impl AbiType {
+17    pub fn selector_type_name(&self) -> String {
+18        match self {
+19            Self::UInt(bits) => format!("uint{bits}"),
+20            Self::Int(bits) => format!("int{bits}"),
+21            Self::Address => "address".to_string(),
+22            Self::Bool => "bool".to_string(),
+23            Self::Function => "function".to_string(),
+24            Self::Array { elem_ty, len } => {
+25                if elem_ty.as_ref() == &AbiType::UInt(8) {
+26                    "bytes".to_string()
+27                } else {
+28                    format!("{}[{}]", elem_ty.selector_type_name(), len)
+29                }
+30            }
+31            Self::Tuple(elems) => format!(
+32                "({})",
+33                elems
+34                    .iter()
+35                    .map(|component| component.ty.selector_type_name())
+36                    .collect::<Vec<_>>()
+37                    .join(",")
+38            ),
+39
+40            Self::Bytes => "bytes".to_string(),
+41            Self::String => "string".to_string(),
+42        }
+43    }
+44
+45    pub fn abi_type_name(&self) -> String {
+46        match self {
+47            Self::Tuple(_) => "tuple".to_string(),
+48            Self::Array { elem_ty, len } => {
+49                if elem_ty.as_ref() == &AbiType::UInt(8) {
+50                    "bytes".to_string()
+51                } else {
+52                    format!("{}[{}]", elem_ty.abi_type_name(), len)
+53                }
+54            }
+55            _ => self.selector_type_name(),
+56        }
+57    }
+58
+59    pub fn header_size(&self) -> usize {
+60        match self {
+61            Self::UInt(_) | Self::Int(_) | Self::Address | Self::Bool | Self::Function => 32,
+62
+63            Self::Array { elem_ty, len } if elem_ty.is_static() => elem_ty.header_size() * len,
+64            Self::Array { .. } => 32,
+65
+66            Self::Tuple(fields) if self.is_static() => fields
+67                .iter()
+68                .fold(0, |acc, field| field.ty.header_size() + acc),
+69            Self::Tuple(_) => 32,
+70
+71            Self::Bytes | Self::String => 32,
+72        }
+73    }
+74
+75    pub fn is_primitive(&self) -> bool {
+76        matches! {
+77            self,
+78            Self::UInt(_) | Self::Int(_) | Self::Address | Self::Bool
+79        }
+80    }
+81
+82    pub fn is_bytes(&self) -> bool {
+83        matches! {
+84            self,
+85            Self::Bytes,
+86        }
+87    }
+88
+89    pub fn is_string(&self) -> bool {
+90        matches! {
+91            self,
+92            Self::String
+93        }
+94    }
+95
+96    pub fn is_static(&self) -> bool {
+97        match self {
+98            Self::UInt(_) | Self::Int(_) | Self::Address | Self::Bool | Self::Function => true,
+99            Self::Array { elem_ty, .. } => elem_ty.is_static(),
+100            Self::Tuple(fields) => fields.iter().all(|field| field.ty.is_static()),
+101            Self::Bytes | Self::String => false,
+102        }
+103    }
+104
+105    /// Returns bytes size of the encoded type if the type is static.
+106    pub fn size(&self) -> Option<usize> {
+107        match self {
+108            Self::UInt(_) | Self::Int(_) | Self::Address | Self::Bool => Some(32),
+109            Self::Function => Some(24),
+110            Self::Array { elem_ty, len } => Some(elem_ty.size()? * len),
+111            Self::Tuple(fields) => {
+112                let mut size = 0;
+113                for field in fields.iter() {
+114                    size += field.ty.size()?;
+115                }
+116                Some(size)
+117            }
+118
+119            Self::Bytes | Self::String => None,
+120        }
+121    }
+122
+123    fn serialize_component<S: SerializeMap>(&self, s: &mut S) -> Result<(), S::Error> {
+124        match self {
+125            Self::Tuple(entry) => s.serialize_entry("components", entry),
+126            Self::Array { elem_ty, .. } => elem_ty.serialize_component(s),
+127            _ => Ok(()),
+128        }
+129    }
+130}
+131
+132impl Serialize for AbiType {
+133    fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
+134        let mut map = s.serialize_map(None)?;
+135        let type_name = self.abi_type_name();
+136
+137        map.serialize_entry("type", &type_name)?;
+138
+139        self.serialize_component(&mut map)?;
+140        map.end()
+141    }
+142}
+143
+144#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
+145pub struct AbiTupleField {
+146    pub name: String,
+147    #[serde(flatten)]
+148    pub ty: AbiType,
+149}
+150
+151impl AbiTupleField {
+152    pub fn new(name: String, ty: impl Into<AbiType>) -> Self {
+153        Self {
+154            name,
+155            ty: ty.into(),
+156        }
+157    }
+158}
+159
+160#[cfg(test)]
+161mod tests {
+162    use super::*;
+163
+164    use serde_test::{assert_ser_tokens, Token};
+165
+166    #[test]
+167    fn primitive() {
+168        let u32_ty = AbiType::UInt(32);
+169        assert_ser_tokens(
+170            &u32_ty,
+171            &[
+172                Token::Map { len: None },
+173                Token::String("type"),
+174                Token::String("uint32"),
+175                Token::MapEnd,
+176            ],
+177        )
+178    }
+179
+180    #[test]
+181    fn primitive_array() {
+182        let i32_ty = AbiType::Int(32);
+183        let array_i32 = AbiType::Array {
+184            elem_ty: i32_ty.into(),
+185            len: 10,
+186        };
+187
+188        assert_ser_tokens(
+189            &array_i32,
+190            &[
+191                Token::Map { len: None },
+192                Token::String("type"),
+193                Token::String("int32[10]"),
+194                Token::MapEnd,
+195            ],
+196        )
+197    }
+198
+199    #[test]
+200    fn tuple_array() {
+201        let u16_ty = AbiType::UInt(16);
+202        let bool_ty = AbiType::Bool;
+203        let array_bool = AbiType::Array {
+204            elem_ty: bool_ty.into(),
+205            len: 16,
+206        };
+207
+208        let field1 = AbiTupleField::new("field1".into(), u16_ty);
+209        let field2 = AbiTupleField::new("field2".into(), array_bool);
+210        let tuple_ty = AbiType::Tuple(vec![field1, field2]);
+211
+212        let tuple_array_ty = AbiType::Array {
+213            elem_ty: tuple_ty.into(),
+214            len: 16,
+215        };
+216
+217        assert_ser_tokens(
+218            &tuple_array_ty,
+219            &[
+220                Token::Map { len: None },
+221                Token::String("type"),
+222                Token::String("tuple[16]"),
+223                Token::String("components"),
+224                Token::Seq { len: Some(2) },
+225                // Field1.
+226                Token::Map { len: None },
+227                Token::String("name"),
+228                Token::String("field1"),
+229                Token::String("type"),
+230                Token::String("uint16"),
+231                Token::MapEnd,
+232                // Field2.
+233                Token::Map { len: None },
+234                Token::String("name"),
+235                Token::String("field2"),
+236                Token::String("type"),
+237                Token::String("bool[16]"),
+238                Token::MapEnd,
+239                Token::SeqEnd,
+240                Token::MapEnd,
+241            ],
+242        )
+243    }
+244
+245    #[test]
+246    fn simple_tuple() {
+247        let u16_ty = AbiType::UInt(16);
+248        let bool_ty = AbiType::Bool;
+249        let bool_array_ty = AbiType::Array {
+250            elem_ty: bool_ty.into(),
+251            len: 16,
+252        };
+253
+254        let field1 = AbiTupleField::new("field1".into(), u16_ty);
+255        let field2 = AbiTupleField::new("field2".into(), bool_array_ty);
+256        let tuple_ty = AbiType::Tuple(vec![field1, field2]);
+257
+258        assert_ser_tokens(
+259            &tuple_ty,
+260            &[
+261                Token::Map { len: None },
+262                Token::String("type"),
+263                Token::String("tuple"),
+264                Token::String("components"),
+265                Token::Seq { len: Some(2) },
+266                // Field1.
+267                Token::Map { len: None },
+268                Token::String("name"),
+269                Token::String("field1"),
+270                Token::String("type"),
+271                Token::String("uint16"),
+272                Token::MapEnd,
+273                // Field2.
+274                Token::Map { len: None },
+275                Token::String("name"),
+276                Token::String("field2"),
+277                Token::String("type"),
+278                Token::String("bool[16]"),
+279                Token::MapEnd,
+280                Token::SeqEnd,
+281                Token::MapEnd,
+282            ],
+283        )
+284    }
+285
+286    #[test]
+287    fn complex_tuple() {
+288        let u16_ty = AbiType::UInt(16);
+289        let bool_ty = AbiType::Bool;
+290
+291        let inner_field1 = AbiTupleField::new("inner_field1".into(), u16_ty);
+292        let inner_field2 = AbiTupleField::new("inner_field2".into(), bool_ty);
+293        let inner_tuple_ty = AbiType::Tuple(vec![inner_field1, inner_field2]);
+294
+295        let inner_tuple_array_ty = AbiType::Array {
+296            elem_ty: inner_tuple_ty.clone().into(),
+297            len: 16,
+298        };
+299
+300        let outer_field1 = AbiTupleField::new("outer_field1".into(), inner_tuple_array_ty);
+301        let outer_field2 = AbiTupleField::new("outer_field2".into(), inner_tuple_ty);
+302        let outer_tuple_ty = AbiType::Tuple(vec![outer_field1, outer_field2]);
+303
+304        assert_ser_tokens(
+305            &outer_tuple_ty,
+306            &[
+307                // Outer tuple start.
+308                Token::Map { len: None },
+309                Token::String("type"),
+310                Token::String("tuple"),
+311                // Outer tuple components start.
+312                Token::String("components"),
+313                Token::Seq { len: Some(2) },
+314                // Outer field1 start.
+315                Token::Map { len: None },
+316                Token::String("name"),
+317                Token::String("outer_field1"),
+318                Token::String("type"),
+319                Token::String("tuple[16]"),
+320                Token::String("components"),
+321                Token::Seq { len: Some(2) },
+322                // Inner field1 start.
+323                Token::Map { len: None },
+324                Token::String("name"),
+325                Token::String("inner_field1"),
+326                Token::String("type"),
+327                Token::String("uint16"),
+328                Token::MapEnd,
+329                // Inner field1 end.
+330                // Inner field2 start.
+331                Token::Map { len: None },
+332                Token::String("name"),
+333                Token::String("inner_field2"),
+334                Token::String("type"),
+335                Token::String("bool"),
+336                Token::MapEnd,
+337                // Inner field2 end.
+338                Token::SeqEnd,
+339                Token::MapEnd,
+340                // Outer field1 end.
+341                // Outer field2 start.
+342                Token::Map { len: None },
+343                Token::String("name"),
+344                Token::String("outer_field2"),
+345                Token::String("type"),
+346                Token::String("tuple"),
+347                Token::String("components"),
+348                Token::Seq { len: Some(2) },
+349                // Inner field1 start.
+350                Token::Map { len: None },
+351                Token::String("name"),
+352                Token::String("inner_field1"),
+353                Token::String("type"),
+354                Token::String("uint16"),
+355                Token::MapEnd,
+356                // Inner field1 end.
+357                // Inner field2 start.
+358                Token::Map { len: None },
+359                Token::String("name"),
+360                Token::String("inner_field2"),
+361                Token::String("type"),
+362                Token::String("bool"),
+363                Token::MapEnd,
+364                // Inner field2 end.
+365                Token::SeqEnd,
+366                Token::MapEnd,
+367                // Outer field2 end.
+368                Token::SeqEnd,
+369                // Outer tuple components end.
+370                Token::MapEnd,
+371            ],
+372        )
+373    }
+374}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/builtins.rs.html b/compiler-docs/src/fe_analyzer/builtins.rs.html new file mode 100644 index 0000000000..b65b1494a5 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/builtins.rs.html @@ -0,0 +1,154 @@ +builtins.rs - source

fe_analyzer/
builtins.rs

1use crate::namespace::types::Base;
+2use strum::{AsRefStr, EnumIter, EnumString};
+3
+4#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, EnumString, AsRefStr)]
+5#[strum(serialize_all = "snake_case")]
+6pub enum ValueMethod {
+7    ToMem,
+8    AbiEncode,
+9}
+10
+11#[derive(
+12    Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, EnumString, AsRefStr, EnumIter,
+13)]
+14#[strum(serialize_all = "snake_case")]
+15pub enum GlobalFunction {
+16    Keccak256,
+17}
+18
+19#[derive(Debug, Copy, Clone, PartialEq, Eq, EnumString, AsRefStr)]
+20#[strum(serialize_all = "snake_case")]
+21pub enum ContractTypeMethod {
+22    Create,
+23    Create2,
+24}
+25
+26impl ContractTypeMethod {
+27    pub fn arg_count(&self) -> usize {
+28        match self {
+29            ContractTypeMethod::Create => 2,
+30            ContractTypeMethod::Create2 => 3,
+31        }
+32    }
+33}
+34
+35/// The evm functions exposed by yul.
+36#[allow(non_camel_case_types)]
+37#[derive(
+38    Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, EnumString, AsRefStr, EnumIter,
+39)]
+40pub enum Intrinsic {
+41    __stop,           // () -> ()
+42    __add,            // (x, y)
+43    __sub,            // (x, y)
+44    __mul,            // (x, y)
+45    __div,            // (x, y)
+46    __sdiv,           // (x, y)
+47    __mod,            // (x, y)
+48    __smod,           // (x, y)
+49    __exp,            // (x, y)
+50    __not,            // (x)
+51    __lt,             // (x, y)
+52    __gt,             // (x, y)
+53    __slt,            // (x, y)
+54    __sgt,            // (x, y)
+55    __eq,             // (x, y)
+56    __iszero,         // (x)
+57    __and,            // (x, y)
+58    __or,             // (x, y)
+59    __xor,            // (x, y)
+60    __byte,           // (n, x)
+61    __shl,            // (x, y)
+62    __shr,            // (x, y)
+63    __sar,            // (x, y)
+64    __addmod,         // (x, y, m)
+65    __mulmod,         // (x, y, m)
+66    __signextend,     // (i, x)
+67    __keccak256,      // (p, n)
+68    __pc,             // ()
+69    __pop,            // (x) -> ()
+70    __mload,          // (p)
+71    __mstore,         // (p, v) -> ()
+72    __mstore8,        // (p, v) -> ()
+73    __sload,          // (p)
+74    __sstore,         // (p, v) -> ()
+75    __msize,          // ()
+76    __gas,            // ()
+77    __address,        // ()
+78    __balance,        // (a)
+79    __selfbalance,    // ()
+80    __caller,         // ()
+81    __callvalue,      // ()
+82    __calldataload,   // (p)
+83    __calldatasize,   // ()
+84    __calldatacopy,   // (t, f, s) -> ()
+85    __codesize,       // ()
+86    __codecopy,       // (t, f, s) -> ()
+87    __extcodesize,    // (a)
+88    __extcodecopy,    // (a, t, f, s) -> ()
+89    __returndatasize, // ()
+90    __returndatacopy, // (t, f, s) -> ()
+91    __extcodehash,    // (a)
+92    __create,         // (v, p, n)
+93    __create2,        // (v, p, n, s)
+94    __call,           // (g, a, v, in, insize, out, outsize)
+95    __callcode,       // (g, a, v, in, insize, out, outsize)
+96    __delegatecall,   // (g, a, in, insize, out, outsize)
+97    __staticcall,     // (g, a, in, insize, out, outsize)
+98    __return,         // (p, s) -> ()
+99    __revert,         // (p, s) -> ()
+100    __selfdestruct,   // (a) -> ()
+101    __invalid,        // () -> ()
+102    __log0,           // (p, s) -> ()
+103    __log1,           // (p, s, t1) -> ()
+104    __log2,           // (p, s, t1, t2) -> ()
+105    __log3,           // (p, s, t1, t2, t3) -> ()
+106    __log4,           // (p, s, t1, t2, t3, t4) -> ()
+107    __chainid,        // ()
+108    __basefee,        // ()
+109    __origin,         // ()
+110    __gasprice,       // ()
+111    __blockhash,      // (b)
+112    __coinbase,       // ()
+113    __timestamp,      // ()
+114    __number,         // ()
+115    __prevrandao,     // ()
+116    __gaslimit,       // ()
+117}
+118
+119impl Intrinsic {
+120    pub fn arg_count(&self) -> usize {
+121        use Intrinsic::*;
+122        match self {
+123            __stop | __basefee | __origin | __gasprice | __coinbase | __timestamp | __number
+124            | __prevrandao | __gaslimit | __pc | __msize | __gas | __address | __selfbalance
+125            | __caller | __callvalue | __calldatasize | __codesize | __returndatasize
+126            | __invalid | __chainid => 0,
+127
+128            __not | __iszero | __pop | __mload | __balance | __sload | __calldataload
+129            | __extcodesize | __extcodehash | __selfdestruct | __blockhash => 1,
+130
+131            __add | __sub | __mul | __div | __sdiv | __mod | __smod | __exp | __lt | __gt
+132            | __slt | __sgt | __eq | __and | __or | __xor | __byte | __shl | __shr | __sar
+133            | __signextend | __keccak256 | __mstore | __mstore8 | __sstore | __return
+134            | __revert | __log0 => 2,
+135
+136            __addmod | __mulmod | __calldatacopy | __codecopy | __returndatacopy | __create
+137            | __log1 => 3,
+138            __extcodecopy | __create2 | __log2 => 4,
+139            __log3 => 5,
+140            __delegatecall | __staticcall | __log4 => 6,
+141            __call | __callcode => 7,
+142        }
+143    }
+144
+145    pub fn return_type(&self) -> Base {
+146        use Intrinsic::*;
+147        match self {
+148            __stop | __pop | __mstore | __mstore8 | __sstore | __calldatacopy | __codecopy
+149            | __extcodecopy | __returndatacopy | __return | __revert | __selfdestruct
+150            | __invalid | __log0 | __log1 | __log2 | __log3 | __log4 => Base::Unit,
+151            _ => Base::u256(),
+152        }
+153    }
+154}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/constants.rs.html b/compiler-docs/src/fe_analyzer/constants.rs.html new file mode 100644 index 0000000000..40d2bfae47 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/constants.rs.html @@ -0,0 +1,4 @@ +constants.rs - source

fe_analyzer/
constants.rs

1pub const EMITTABLE_TRAIT_NAME: &str = "Emittable";
+2pub const EMIT_FN_NAME: &str = "emit";
+3pub const INDEXED: &str = "indexed";
+4pub const MAX_INDEXED_EVENT_FIELDS: usize = 3;
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/context.rs.html b/compiler-docs/src/fe_analyzer/context.rs.html new file mode 100644 index 0000000000..2f827859ed --- /dev/null +++ b/compiler-docs/src/fe_analyzer/context.rs.html @@ -0,0 +1,595 @@ +context.rs - source

fe_analyzer/
context.rs

1use crate::{
+2    display::Displayable,
+3    errors::FatalError,
+4    namespace::items::{EnumVariantId, TypeDef},
+5    pattern_analysis::PatternMatrix,
+6};
+7
+8use crate::namespace::items::{
+9    ContractId, DiagnosticSink, FunctionId, FunctionSigId, Item, TraitId,
+10};
+11use crate::namespace::types::{Generic, SelfDecl, Type, TypeId};
+12use crate::AnalyzerDb;
+13use crate::{
+14    builtins::{ContractTypeMethod, GlobalFunction, Intrinsic, ValueMethod},
+15    namespace::scopes::BlockScopeType,
+16};
+17use crate::{
+18    errors::{self, IncompleteItem, TypeError},
+19    namespace::items::ModuleId,
+20};
+21use fe_common::diagnostics::Diagnostic;
+22pub use fe_common::diagnostics::Label;
+23use fe_common::Span;
+24use fe_parser::ast;
+25use fe_parser::node::{Node, NodeId};
+26
+27use indexmap::IndexMap;
+28use num_bigint::BigInt;
+29use smol_str::SmolStr;
+30use std::fmt::{self, Debug};
+31use std::hash::Hash;
+32use std::marker::PhantomData;
+33use std::rc::Rc;
+34use std::{cell::RefCell, collections::HashMap};
+35
+36#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+37pub struct Analysis<T> {
+38    pub value: T,
+39    pub diagnostics: Rc<[Diagnostic]>,
+40}
+41impl<T> Analysis<T> {
+42    pub fn new(value: T, diagnostics: Rc<[Diagnostic]>) -> Self {
+43        Self { value, diagnostics }
+44    }
+45    pub fn sink_diagnostics(&self, sink: &mut impl DiagnosticSink) {
+46        self.diagnostics.iter().for_each(|diag| sink.push(diag))
+47    }
+48    pub fn has_diag(&self) -> bool {
+49        !self.diagnostics.is_empty()
+50    }
+51}
+52
+53pub trait AnalyzerContext {
+54    fn resolve_name(&self, name: &str, span: Span) -> Result<Option<NamedThing>, IncompleteItem>;
+55    /// Resolves the given path and registers all errors
+56    fn resolve_path(&self, path: &ast::Path, span: Span) -> Result<NamedThing, FatalError>;
+57    /// Resolves the given path only if it is visible. Does not register any errors
+58    fn resolve_visible_path(&self, path: &ast::Path) -> Option<NamedThing>;
+59    /// Resolves the given path. Does not register any errors
+60    fn resolve_any_path(&self, path: &ast::Path) -> Option<NamedThing>;
+61
+62    fn add_diagnostic(&self, diag: Diagnostic);
+63    fn db(&self) -> &dyn AnalyzerDb;
+64
+65    fn error(&self, message: &str, label_span: Span, label: &str) -> DiagnosticVoucher {
+66        self.register_diag(errors::error(message, label_span, label))
+67    }
+68
+69    /// Attribute contextual information to an expression node.
+70    ///
+71    /// # Panics
+72    ///
+73    /// Panics if an entry already exists for the node id.
+74    fn add_expression(&self, node: &Node<ast::Expr>, attributes: ExpressionAttributes);
+75
+76    /// Update the expression attributes.
+77    ///
+78    /// # Panics
+79    ///
+80    /// Panics if an entry does not already exist for the node id.
+81    fn update_expression(&self, node: &Node<ast::Expr>, f: &dyn Fn(&mut ExpressionAttributes));
+82
+83    /// Returns a type of an expression.
+84    ///
+85    /// # Panics
+86    ///
+87    /// Panics if type analysis is not performed for an `expr`.
+88    fn expr_typ(&self, expr: &Node<ast::Expr>) -> Type;
+89
+90    /// Add evaluated constant value in a constant declaration to the context.
+91    fn add_constant(&self, name: &Node<ast::SmolStr>, expr: &Node<ast::Expr>, value: Constant);
+92
+93    /// Returns constant value from variable name.
+94    fn constant_value_by_name(
+95        &self,
+96        name: &ast::SmolStr,
+97        span: Span,
+98    ) -> Result<Option<Constant>, IncompleteItem>;
+99
+100    /// Returns an item enclosing current context.
+101    ///
+102    /// # Example
+103    ///
+104    /// ```fe
+105    /// contract Foo:
+106    ///     fn foo():
+107    ///        if ...:
+108    ///            ...
+109    ///        else:
+110    ///            ...
+111    /// ```
+112    /// If the context is in `then` block, then this function returns
+113    /// `Item::Function(..)`.
+114    fn parent(&self) -> Item;
+115
+116    /// Returns the module enclosing current context.
+117    fn module(&self) -> ModuleId;
+118
+119    /// Returns a function id that encloses a context.
+120    ///
+121    /// # Panics
+122    ///
+123    /// Panics if a context is not in a function. Use [`Self::is_in_function`]
+124    /// to determine whether a context is in a function.
+125    fn parent_function(&self) -> FunctionId;
+126
+127    /// Returns a non-function item that encloses a context.
+128    ///
+129    /// # Example
+130    ///
+131    /// ```fe
+132    /// contract Foo:
+133    ///     fn foo():
+134    ///        if ...:
+135    ///            ...
+136    ///        else:
+137    ///            ...
+138    /// ```
+139    /// If the context is in `then` block, then this function returns
+140    /// `Item::Type(TypeDef::Contract(..))`.
+141    fn root_item(&self) -> Item {
+142        let mut item = self.parent();
+143        while let Item::Function(func_id) = item {
+144            item = func_id.parent(self.db());
+145        }
+146        item
+147    }
+148
+149    /// # Panics
+150    ///
+151    /// Panics if a context is not in a function. Use [`Self::is_in_function`]
+152    /// to determine whether a context is in a function.
+153    fn add_call(&self, node: &Node<ast::Expr>, call_type: CallType);
+154    fn get_call(&self, node: &Node<ast::Expr>) -> Option<CallType>;
+155
+156    /// Returns `true` if the context is in function scope.
+157    fn is_in_function(&self) -> bool;
+158
+159    /// Returns `true` if the scope or any of its parents is of the given type.
+160    fn inherits_type(&self, typ: BlockScopeType) -> bool;
+161
+162    /// Returns the `Context` type, if it is defined.
+163    fn get_context_type(&self) -> Option<TypeId>;
+164
+165    fn type_error(
+166        &self,
+167        message: &str,
+168        span: Span,
+169        expected: TypeId,
+170        actual: TypeId,
+171    ) -> DiagnosticVoucher {
+172        self.register_diag(errors::type_error(
+173            message,
+174            span,
+175            expected.display(self.db()),
+176            actual.display(self.db()),
+177        ))
+178    }
+179
+180    fn not_yet_implemented(&self, feature: &str, span: Span) -> DiagnosticVoucher {
+181        self.register_diag(errors::not_yet_implemented(feature, span))
+182    }
+183
+184    fn fancy_error(
+185        &self,
+186        message: &str,
+187        labels: Vec<Label>,
+188        notes: Vec<String>,
+189    ) -> DiagnosticVoucher {
+190        self.register_diag(errors::fancy_error(message, labels, notes))
+191    }
+192
+193    fn duplicate_name_error(
+194        &self,
+195        message: &str,
+196        name: &str,
+197        original: Span,
+198        duplicate: Span,
+199    ) -> DiagnosticVoucher {
+200        self.register_diag(errors::duplicate_name_error(
+201            message, name, original, duplicate,
+202        ))
+203    }
+204
+205    fn name_conflict_error(
+206        &self,
+207        name_kind: &str, // Eg "function parameter" or "variable name"
+208        name: &str,
+209        original: &NamedThing,
+210        original_span: Option<Span>,
+211        duplicate_span: Span,
+212    ) -> DiagnosticVoucher {
+213        self.register_diag(errors::name_conflict_error(
+214            name_kind,
+215            name,
+216            original,
+217            original_span,
+218            duplicate_span,
+219        ))
+220    }
+221
+222    fn register_diag(&self, diag: Diagnostic) -> DiagnosticVoucher {
+223        self.add_diagnostic(diag);
+224        DiagnosticVoucher(PhantomData)
+225    }
+226}
+227
+228#[derive(Clone, Debug, PartialEq, Eq)]
+229pub enum NamedThing {
+230    Item(Item),
+231    EnumVariant(EnumVariantId),
+232    SelfValue {
+233        /// Function `self` parameter.
+234        decl: Option<SelfDecl>,
+235
+236        /// The function's parent, if any. If `None`, `self` has been
+237        /// used in a module-level function.
+238        parent: Option<Item>,
+239        span: Option<Span>,
+240    },
+241    // SelfType // when/if we add a `Self` type keyword
+242    Variable {
+243        name: SmolStr,
+244        typ: Result<TypeId, TypeError>,
+245        is_const: bool,
+246        span: Span,
+247    },
+248}
+249
+250impl NamedThing {
+251    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+252        match self {
+253            NamedThing::Item(item) => item.name(db),
+254            NamedThing::EnumVariant(variant) => variant.name(db),
+255            NamedThing::SelfValue { .. } => "self".into(),
+256            NamedThing::Variable { name, .. } => name.clone(),
+257        }
+258    }
+259
+260    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Option<Span> {
+261        match self {
+262            NamedThing::Item(item) => item.name_span(db),
+263            NamedThing::EnumVariant(variant) => Some(variant.span(db)),
+264            NamedThing::SelfValue { span, .. } => *span,
+265            NamedThing::Variable { span, .. } => Some(*span),
+266        }
+267    }
+268
+269    pub fn is_builtin(&self) -> bool {
+270        match self {
+271            NamedThing::Item(item) => item.is_builtin(),
+272            NamedThing::EnumVariant(_)
+273            | NamedThing::Variable { .. }
+274            | NamedThing::SelfValue { .. } => false,
+275        }
+276    }
+277
+278    pub fn item_kind_display_name(&self) -> &str {
+279        match self {
+280            NamedThing::Item(item) => item.item_kind_display_name(),
+281            NamedThing::EnumVariant(_) => "enum variant",
+282            NamedThing::Variable { .. } => "variable",
+283            NamedThing::SelfValue { .. } => "value",
+284        }
+285    }
+286
+287    pub fn resolve_path_segment(
+288        &self,
+289        db: &dyn AnalyzerDb,
+290        segment: &SmolStr,
+291    ) -> Option<NamedThing> {
+292        if let Self::Item(Item::Type(TypeDef::Enum(enum_))) = self {
+293            if let Some(variant) = enum_.variant(db, segment) {
+294                return Some(NamedThing::EnumVariant(variant));
+295            }
+296        }
+297
+298        match self {
+299            Self::Item(item) => item
+300                .items(db)
+301                .get(segment)
+302                .map(|resolved| NamedThing::Item(*resolved)),
+303
+304            _ => None,
+305        }
+306    }
+307}
+308
+309/// This should only be created by [`AnalyzerContext`].
+310#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+311pub struct DiagnosticVoucher(PhantomData<()>);
+312
+313impl DiagnosticVoucher {
+314    pub fn assume_the_parser_handled_it() -> Self {
+315        Self(PhantomData)
+316    }
+317}
+318
+319#[derive(Default)]
+320pub struct TempContext {
+321    pub diagnostics: RefCell<Vec<Diagnostic>>,
+322}
+323impl AnalyzerContext for TempContext {
+324    fn db(&self) -> &dyn AnalyzerDb {
+325        panic!("TempContext has no analyzer db")
+326    }
+327
+328    fn resolve_name(&self, _name: &str, _span: Span) -> Result<Option<NamedThing>, IncompleteItem> {
+329        panic!("TempContext can't resolve names")
+330    }
+331
+332    fn resolve_path(&self, _path: &ast::Path, _span: Span) -> Result<NamedThing, FatalError> {
+333        panic!("TempContext can't resolve paths")
+334    }
+335
+336    fn resolve_visible_path(&self, _path: &ast::Path) -> Option<NamedThing> {
+337        panic!("TempContext can't resolve paths")
+338    }
+339
+340    fn resolve_any_path(&self, _path: &ast::Path) -> Option<NamedThing> {
+341        panic!("TempContext can't resolve paths")
+342    }
+343
+344    fn add_expression(&self, _node: &Node<ast::Expr>, _attributes: ExpressionAttributes) {
+345        panic!("TempContext can't store expression")
+346    }
+347
+348    fn update_expression(&self, _node: &Node<ast::Expr>, _f: &dyn Fn(&mut ExpressionAttributes)) {
+349        panic!("TempContext can't update expression");
+350    }
+351
+352    fn expr_typ(&self, _expr: &Node<ast::Expr>) -> Type {
+353        panic!("TempContext can't return expression type")
+354    }
+355
+356    fn add_constant(&self, _name: &Node<ast::SmolStr>, _expr: &Node<ast::Expr>, _value: Constant) {
+357        panic!("TempContext can't store constant")
+358    }
+359
+360    fn constant_value_by_name(
+361        &self,
+362        _name: &ast::SmolStr,
+363        _span: Span,
+364    ) -> Result<Option<Constant>, IncompleteItem> {
+365        Ok(None)
+366    }
+367
+368    fn parent(&self) -> Item {
+369        panic!("TempContext has no root item")
+370    }
+371
+372    fn module(&self) -> ModuleId {
+373        panic!("TempContext has no module")
+374    }
+375
+376    fn parent_function(&self) -> FunctionId {
+377        panic!("TempContext has no parent function")
+378    }
+379
+380    fn add_call(&self, _node: &Node<ast::Expr>, _call_type: CallType) {
+381        panic!("TempContext can't add call");
+382    }
+383
+384    fn get_call(&self, _node: &Node<ast::Expr>) -> Option<CallType> {
+385        panic!("TempContext can't have calls");
+386    }
+387
+388    fn is_in_function(&self) -> bool {
+389        false
+390    }
+391
+392    fn inherits_type(&self, _typ: BlockScopeType) -> bool {
+393        false
+394    }
+395
+396    fn add_diagnostic(&self, diag: Diagnostic) {
+397        self.diagnostics.borrow_mut().push(diag)
+398    }
+399
+400    fn get_context_type(&self) -> Option<TypeId> {
+401        panic!("TempContext can't resolve Context")
+402    }
+403}
+404
+405#[derive(Default, Clone, Debug, PartialEq, Eq)]
+406pub struct FunctionBody {
+407    pub expressions: IndexMap<NodeId, ExpressionAttributes>,
+408    // Map match statements to the corresponding [`PatternMatrix`]
+409    pub matches: IndexMap<NodeId, PatternMatrix>,
+410    // Map lhs of variable declaration to type.
+411    pub var_types: IndexMap<NodeId, TypeId>,
+412    pub calls: IndexMap<NodeId, CallType>,
+413    pub spans: HashMap<NodeId, Span>,
+414}
+415
+416/// Contains contextual information relating to an expression AST node.
+417#[derive(Clone, Debug, PartialEq, Eq)]
+418pub struct ExpressionAttributes {
+419    pub typ: TypeId,
+420    // Evaluated constant value of const local definition.
+421    pub const_value: Option<Constant>,
+422    pub type_adjustments: Vec<Adjustment>,
+423}
+424impl ExpressionAttributes {
+425    pub fn original_type(&self) -> TypeId {
+426        self.typ
+427    }
+428    pub fn adjusted_type(&self) -> TypeId {
+429        if let Some(adj) = self.type_adjustments.last() {
+430            adj.into
+431        } else {
+432            self.typ
+433        }
+434    }
+435}
+436
+437#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+438pub struct Adjustment {
+439    pub into: TypeId,
+440    pub kind: AdjustmentKind,
+441}
+442
+443#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+444pub enum AdjustmentKind {
+445    Copy,
+446    /// Load from storage ptr
+447    Load,
+448    IntSizeIncrease,
+449    StringSizeIncrease,
+450}
+451
+452impl ExpressionAttributes {
+453    pub fn new(typ: TypeId) -> Self {
+454        Self {
+455            typ,
+456            const_value: None,
+457            type_adjustments: vec![],
+458        }
+459    }
+460}
+461
+462impl crate::display::DisplayWithDb for ExpressionAttributes {
+463    fn format(&self, db: &dyn AnalyzerDb, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
+464        let ExpressionAttributes {
+465            typ,
+466            const_value,
+467            type_adjustments,
+468        } = self;
+469        write!(f, "{}", typ.display(db))?;
+470        if let Some(val) = &const_value {
+471            write!(f, " = {val:?}")?;
+472        }
+473        for adj in type_adjustments {
+474            write!(f, " -{:?}-> {}", adj.kind, adj.into.display(db))?;
+475        }
+476        Ok(())
+477    }
+478}
+479
+480/// The type of a function call.
+481#[derive(Clone, Debug, PartialEq, Eq)]
+482pub enum CallType {
+483    BuiltinFunction(GlobalFunction),
+484    Intrinsic(Intrinsic),
+485    BuiltinValueMethod {
+486        method: ValueMethod,
+487        typ: TypeId,
+488    },
+489
+490    // create, create2 (will be methods of the context struct soon)
+491    BuiltinAssociatedFunction {
+492        contract: ContractId,
+493        function: ContractTypeMethod,
+494    },
+495
+496    // MyStruct.foo() (soon MyStruct::foo())
+497    AssociatedFunction {
+498        typ: TypeId,
+499        function: FunctionId,
+500    },
+501    // some_struct_or_contract.foo()
+502    ValueMethod {
+503        typ: TypeId,
+504        method: FunctionId,
+505    },
+506    // some_trait.foo()
+507    // The reason this can not use `ValueMethod` is mainly because the trait might not have a
+508    // function implementation and even if it had it might not be the one that ends up getting
+509    // executed. An `impl` block will decide that.
+510    TraitValueMethod {
+511        trait_id: TraitId,
+512        method: FunctionSigId,
+513        // Traits can not directly be used as types but can act as bounds for generics. This is the
+514        // generic type that the method is called on.
+515        generic_type: Generic,
+516    },
+517    External {
+518        contract: ContractId,
+519        function: FunctionId,
+520    },
+521    Pure(FunctionId),
+522    TypeConstructor(TypeId),
+523    EnumConstructor(EnumVariantId),
+524}
+525
+526impl CallType {
+527    pub fn function(&self) -> Option<FunctionId> {
+528        use CallType::*;
+529        match self {
+530            BuiltinFunction(_)
+531            | BuiltinValueMethod { .. }
+532            | TypeConstructor(_)
+533            | EnumConstructor(_)
+534            | Intrinsic(_)
+535            | TraitValueMethod { .. }
+536            | BuiltinAssociatedFunction { .. } => None,
+537            AssociatedFunction { function: id, .. }
+538            | ValueMethod { method: id, .. }
+539            | External { function: id, .. }
+540            | Pure(id) => Some(*id),
+541        }
+542    }
+543
+544    pub fn function_name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+545        match self {
+546            CallType::BuiltinFunction(f) => f.as_ref().into(),
+547            CallType::Intrinsic(f) => f.as_ref().into(),
+548            CallType::BuiltinValueMethod { method, .. } => method.as_ref().into(),
+549            CallType::BuiltinAssociatedFunction { function, .. } => function.as_ref().into(),
+550            CallType::AssociatedFunction { function: id, .. }
+551            | CallType::ValueMethod { method: id, .. }
+552            | CallType::External { function: id, .. }
+553            | CallType::Pure(id) => id.name(db),
+554            CallType::TraitValueMethod { method: id, .. } => id.name(db),
+555            CallType::TypeConstructor(typ) => typ.display(db).to_string().into(),
+556            CallType::EnumConstructor(variant) => {
+557                let enum_name = variant.parent(db).name(db);
+558                let variant_name = variant.name(db);
+559                format!("{enum_name}::{variant_name}").into()
+560            }
+561        }
+562    }
+563
+564    pub fn is_unsafe(&self, db: &dyn AnalyzerDb) -> bool {
+565        if let CallType::Intrinsic(_) = self {
+566            true
+567        } else if let CallType::TypeConstructor(type_id) = self {
+568            // check that this is the `Context` struct defined in `std`
+569            // this should be deleted once associated functions are supported and we can
+570            // define unsafe constructors in Fe
+571            if let Type::Struct(struct_) = type_id.typ(db) {
+572                struct_.name(db) == "Context" && struct_.module(db).ingot(db).name(db) == "std"
+573            } else {
+574                false
+575            }
+576        } else {
+577            self.function().map(|id| id.is_unsafe(db)).unwrap_or(false)
+578        }
+579    }
+580}
+581
+582impl fmt::Display for CallType {
+583    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
+584        write!(f, "{self:?}")
+585    }
+586}
+587
+588/// Represents constant value.
+589#[derive(Debug, Clone, PartialEq, Eq)]
+590pub enum Constant {
+591    Int(BigInt),
+592    Address(BigInt),
+593    Bool(bool),
+594    Str(SmolStr),
+595}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db.rs.html b/compiler-docs/src/fe_analyzer/db.rs.html new file mode 100644 index 0000000000..48f5b7375a --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db.rs.html @@ -0,0 +1,238 @@ +db.rs - source

fe_analyzer/
db.rs

1#![allow(clippy::arc_with_non_send_sync)]
+2use crate::namespace::items::{
+3    self, AttributeId, ContractFieldId, ContractId, DepGraphWrapper, EnumVariantKind, FunctionId,
+4    FunctionSigId, ImplId, IngotId, Item, ModuleConstantId, ModuleId, StructFieldId, StructId,
+5    TraitId, TypeAliasId,
+6};
+7use crate::namespace::types::{self, Type, TypeId};
+8use crate::{
+9    context::{Analysis, Constant, FunctionBody},
+10    namespace::items::EnumId,
+11};
+12use crate::{
+13    errors::{ConstEvalError, TypeError},
+14    namespace::items::EnumVariantId,
+15};
+16use fe_common::db::{SourceDb, SourceDbStorage, Upcast, UpcastMut};
+17use fe_common::{SourceFileId, Span};
+18use fe_parser::ast;
+19use indexmap::map::IndexMap;
+20use smol_str::SmolStr;
+21use std::rc::Rc;
+22mod queries;
+23
+24#[salsa::query_group(AnalyzerDbStorage)]
+25pub trait AnalyzerDb: SourceDb + Upcast<dyn SourceDb> + UpcastMut<dyn SourceDb> {
+26    #[salsa::interned]
+27    fn intern_ingot(&self, data: Rc<items::Ingot>) -> IngotId;
+28    #[salsa::interned]
+29    fn intern_module(&self, data: Rc<items::Module>) -> ModuleId;
+30    #[salsa::interned]
+31    fn intern_module_const(&self, data: Rc<items::ModuleConstant>) -> ModuleConstantId;
+32    #[salsa::interned]
+33    fn intern_struct(&self, data: Rc<items::Struct>) -> StructId;
+34    #[salsa::interned]
+35    fn intern_struct_field(&self, data: Rc<items::StructField>) -> StructFieldId;
+36    #[salsa::interned]
+37    fn intern_enum(&self, data: Rc<items::Enum>) -> EnumId;
+38    #[salsa::interned]
+39    fn intern_attribute(&self, data: Rc<items::Attribute>) -> AttributeId;
+40    #[salsa::interned]
+41    fn intern_enum_variant(&self, data: Rc<items::EnumVariant>) -> EnumVariantId;
+42    #[salsa::interned]
+43    fn intern_trait(&self, data: Rc<items::Trait>) -> TraitId;
+44    #[salsa::interned]
+45    fn intern_impl(&self, data: Rc<items::Impl>) -> ImplId;
+46    #[salsa::interned]
+47    fn intern_type_alias(&self, data: Rc<items::TypeAlias>) -> TypeAliasId;
+48    #[salsa::interned]
+49    fn intern_contract(&self, data: Rc<items::Contract>) -> ContractId;
+50    #[salsa::interned]
+51    fn intern_contract_field(&self, data: Rc<items::ContractField>) -> ContractFieldId;
+52    #[salsa::interned]
+53    fn intern_function_sig(&self, data: Rc<items::FunctionSig>) -> FunctionSigId;
+54    #[salsa::interned]
+55    fn intern_function(&self, data: Rc<items::Function>) -> FunctionId;
+56    #[salsa::interned]
+57    fn intern_type(&self, data: Type) -> TypeId;
+58
+59    // Ingot
+60
+61    // These are inputs so that the (future) language server can add
+62    // and remove files/dependencies. Set via eg `db.set_ingot_files`.
+63    // If an input is used before it's set, salsa will panic.
+64    #[salsa::input]
+65    fn ingot_files(&self, ingot: IngotId) -> Rc<[SourceFileId]>;
+66    #[salsa::input]
+67    fn ingot_external_ingots(&self, ingot: IngotId) -> Rc<IndexMap<SmolStr, IngotId>>;
+68    // Having the root ingot available as a "global" might offend functional
+69    // programming purists but it makes for much nicer ergonomics in queries
+70    // that just need the global entrypoint
+71    #[salsa::input]
+72    fn root_ingot(&self) -> IngotId;
+73
+74    #[salsa::invoke(queries::ingots::ingot_modules)]
+75    fn ingot_modules(&self, ingot: IngotId) -> Rc<[ModuleId]>;
+76    #[salsa::invoke(queries::ingots::ingot_root_module)]
+77    fn ingot_root_module(&self, ingot: IngotId) -> Option<ModuleId>;
+78
+79    // Module
+80    #[salsa::invoke(queries::module::module_file_path)]
+81    fn module_file_path(&self, module: ModuleId) -> SmolStr;
+82    #[salsa::invoke(queries::module::module_parse)]
+83    fn module_parse(&self, module: ModuleId) -> Analysis<Rc<ast::Module>>;
+84    #[salsa::invoke(queries::module::module_is_incomplete)]
+85    fn module_is_incomplete(&self, module: ModuleId) -> bool;
+86    #[salsa::invoke(queries::module::module_all_items)]
+87    fn module_all_items(&self, module: ModuleId) -> Rc<[Item]>;
+88    #[salsa::invoke(queries::module::module_all_impls)]
+89    fn module_all_impls(&self, module: ModuleId) -> Analysis<Rc<[ImplId]>>;
+90    #[salsa::invoke(queries::module::module_item_map)]
+91    fn module_item_map(&self, module: ModuleId) -> Analysis<Rc<IndexMap<SmolStr, Item>>>;
+92    #[salsa::invoke(queries::module::module_impl_map)]
+93    fn module_impl_map(
+94        &self,
+95        module: ModuleId,
+96    ) -> Analysis<Rc<IndexMap<(TraitId, TypeId), ImplId>>>;
+97    #[salsa::invoke(queries::module::module_contracts)]
+98    fn module_contracts(&self, module: ModuleId) -> Rc<[ContractId]>;
+99    #[salsa::invoke(queries::module::module_structs)]
+100    fn module_structs(&self, module: ModuleId) -> Rc<[StructId]>;
+101    #[salsa::invoke(queries::module::module_constants)]
+102    fn module_constants(&self, module: ModuleId) -> Rc<Vec<ModuleConstantId>>;
+103    #[salsa::invoke(queries::module::module_used_item_map)]
+104    fn module_used_item_map(
+105        &self,
+106        module: ModuleId,
+107    ) -> Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>>;
+108    #[salsa::invoke(queries::module::module_parent_module)]
+109    fn module_parent_module(&self, module: ModuleId) -> Option<ModuleId>;
+110    #[salsa::invoke(queries::module::module_submodules)]
+111    fn module_submodules(&self, module: ModuleId) -> Rc<[ModuleId]>;
+112    #[salsa::invoke(queries::module::module_tests)]
+113    fn module_tests(&self, module: ModuleId) -> Vec<FunctionId>;
+114
+115    // Module Constant
+116    #[salsa::cycle(queries::module::module_constant_type_cycle)]
+117    #[salsa::invoke(queries::module::module_constant_type)]
+118    fn module_constant_type(&self, id: ModuleConstantId) -> Analysis<Result<TypeId, TypeError>>;
+119    #[salsa::cycle(queries::module::module_constant_value_cycle)]
+120    #[salsa::invoke(queries::module::module_constant_value)]
+121    fn module_constant_value(
+122        &self,
+123        id: ModuleConstantId,
+124    ) -> Analysis<Result<Constant, ConstEvalError>>;
+125
+126    // Contract
+127    #[salsa::invoke(queries::contracts::contract_all_functions)]
+128    fn contract_all_functions(&self, id: ContractId) -> Rc<[FunctionId]>;
+129    #[salsa::invoke(queries::contracts::contract_function_map)]
+130    fn contract_function_map(&self, id: ContractId) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>;
+131    #[salsa::invoke(queries::contracts::contract_public_function_map)]
+132    fn contract_public_function_map(&self, id: ContractId) -> Rc<IndexMap<SmolStr, FunctionId>>;
+133    #[salsa::invoke(queries::contracts::contract_init_function)]
+134    fn contract_init_function(&self, id: ContractId) -> Analysis<Option<FunctionId>>;
+135    #[salsa::invoke(queries::contracts::contract_call_function)]
+136    fn contract_call_function(&self, id: ContractId) -> Analysis<Option<FunctionId>>;
+137
+138    #[salsa::invoke(queries::contracts::contract_all_fields)]
+139    fn contract_all_fields(&self, id: ContractId) -> Rc<[ContractFieldId]>;
+140    #[salsa::invoke(queries::contracts::contract_field_map)]
+141    fn contract_field_map(
+142        &self,
+143        id: ContractId,
+144    ) -> Analysis<Rc<IndexMap<SmolStr, ContractFieldId>>>;
+145    #[salsa::invoke(queries::contracts::contract_field_type)]
+146    fn contract_field_type(&self, field: ContractFieldId) -> Analysis<Result<TypeId, TypeError>>;
+147    #[salsa::cycle(queries::contracts::contract_dependency_graph_cycle)]
+148    #[salsa::invoke(queries::contracts::contract_dependency_graph)]
+149    fn contract_dependency_graph(&self, id: ContractId) -> DepGraphWrapper;
+150    #[salsa::cycle(queries::contracts::contract_runtime_dependency_graph_cycle)]
+151    #[salsa::invoke(queries::contracts::contract_runtime_dependency_graph)]
+152    fn contract_runtime_dependency_graph(&self, id: ContractId) -> DepGraphWrapper;
+153
+154    // Function
+155    #[salsa::invoke(queries::functions::function_signature)]
+156    fn function_signature(&self, id: FunctionSigId) -> Analysis<Rc<types::FunctionSignature>>;
+157    #[salsa::invoke(queries::functions::function_body)]
+158    fn function_body(&self, id: FunctionId) -> Analysis<Rc<FunctionBody>>;
+159    #[salsa::cycle(queries::functions::function_dependency_graph_cycle)]
+160    #[salsa::invoke(queries::functions::function_dependency_graph)]
+161    fn function_dependency_graph(&self, id: FunctionId) -> DepGraphWrapper;
+162
+163    // Struct
+164    #[salsa::invoke(queries::structs::struct_all_fields)]
+165    fn struct_all_fields(&self, id: StructId) -> Rc<[StructFieldId]>;
+166    #[salsa::invoke(queries::structs::struct_field_map)]
+167    fn struct_field_map(&self, id: StructId) -> Analysis<Rc<IndexMap<SmolStr, StructFieldId>>>;
+168    #[salsa::invoke(queries::structs::struct_field_type)]
+169    fn struct_field_type(&self, field: StructFieldId) -> Analysis<Result<TypeId, TypeError>>;
+170    #[salsa::invoke(queries::structs::struct_all_functions)]
+171    fn struct_all_functions(&self, id: StructId) -> Rc<[FunctionId]>;
+172    #[salsa::invoke(queries::structs::struct_function_map)]
+173    fn struct_function_map(&self, id: StructId) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>;
+174    #[salsa::cycle(queries::structs::struct_cycle)]
+175    #[salsa::invoke(queries::structs::struct_dependency_graph)]
+176    fn struct_dependency_graph(&self, id: StructId) -> Analysis<DepGraphWrapper>;
+177
+178    // Enum
+179    #[salsa::invoke(queries::enums::enum_all_variants)]
+180    fn enum_all_variants(&self, id: EnumId) -> Rc<[EnumVariantId]>;
+181    #[salsa::invoke(queries::enums::enum_variant_map)]
+182    fn enum_variant_map(&self, id: EnumId) -> Analysis<Rc<IndexMap<SmolStr, EnumVariantId>>>;
+183    #[salsa::invoke(queries::enums::enum_all_functions)]
+184    fn enum_all_functions(&self, id: EnumId) -> Rc<[FunctionId]>;
+185    #[salsa::invoke(queries::enums::enum_function_map)]
+186    fn enum_function_map(&self, id: EnumId) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>;
+187    #[salsa::cycle(queries::enums::enum_cycle)]
+188    #[salsa::invoke(queries::enums::enum_dependency_graph)]
+189    fn enum_dependency_graph(&self, id: EnumId) -> Analysis<DepGraphWrapper>;
+190    #[salsa::invoke(queries::enums::enum_variant_kind)]
+191    fn enum_variant_kind(&self, id: EnumVariantId) -> Analysis<Result<EnumVariantKind, TypeError>>;
+192
+193    // Trait
+194    #[salsa::invoke(queries::traits::trait_all_functions)]
+195    fn trait_all_functions(&self, id: TraitId) -> Rc<[FunctionSigId]>;
+196    #[salsa::invoke(queries::traits::trait_function_map)]
+197    fn trait_function_map(&self, id: TraitId) -> Analysis<Rc<IndexMap<SmolStr, FunctionSigId>>>;
+198    #[salsa::invoke(queries::traits::trait_is_implemented_for)]
+199    fn trait_is_implemented_for(&self, id: TraitId, typ: TypeId) -> bool;
+200
+201    // Impl
+202    #[salsa::invoke(queries::impls::impl_all_functions)]
+203    fn impl_all_functions(&self, id: ImplId) -> Rc<[FunctionId]>;
+204    #[salsa::invoke(queries::impls::impl_function_map)]
+205    fn impl_function_map(&self, id: ImplId) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>>;
+206
+207    // Type
+208    #[salsa::invoke(queries::types::all_impls)]
+209    fn all_impls(&self, ty: TypeId) -> Rc<[ImplId]>;
+210    #[salsa::invoke(queries::types::impl_for)]
+211    fn impl_for(&self, ty: TypeId, treit: TraitId) -> Option<ImplId>;
+212    #[salsa::invoke(queries::types::function_sigs)]
+213    fn function_sigs(&self, ty: TypeId, name: SmolStr) -> Rc<[FunctionSigId]>;
+214
+215    // Type alias
+216    #[salsa::invoke(queries::types::type_alias_type)]
+217    #[salsa::cycle(queries::types::type_alias_type_cycle)]
+218    fn type_alias_type(&self, id: TypeAliasId) -> Analysis<Result<TypeId, TypeError>>;
+219}
+220
+221#[salsa::database(AnalyzerDbStorage, SourceDbStorage)]
+222#[derive(Default)]
+223pub struct TestDb {
+224    storage: salsa::Storage<TestDb>,
+225}
+226impl salsa::Database for TestDb {}
+227
+228impl Upcast<dyn SourceDb> for TestDb {
+229    fn upcast(&self) -> &(dyn SourceDb + 'static) {
+230        self
+231    }
+232}
+233
+234impl UpcastMut<dyn SourceDb> for TestDb {
+235    fn upcast_mut(&mut self) -> &mut (dyn SourceDb + 'static) {
+236        &mut *self
+237    }
+238}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries.rs.html b/compiler-docs/src/fe_analyzer/db/queries.rs.html new file mode 100644 index 0000000000..6e0e2953a5 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries.rs.html @@ -0,0 +1,9 @@ +queries.rs - source

fe_analyzer/db/
queries.rs

1pub mod contracts;
+2pub mod enums;
+3pub mod functions;
+4pub mod impls;
+5pub mod ingots;
+6pub mod module;
+7pub mod structs;
+8pub mod traits;
+9pub mod types;
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries/contracts.rs.html b/compiler-docs/src/fe_analyzer/db/queries/contracts.rs.html new file mode 100644 index 0000000000..b0762338dc --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries/contracts.rs.html @@ -0,0 +1,403 @@ +contracts.rs - source

fe_analyzer/db/queries/
contracts.rs

1use crate::context::AnalyzerContext;
+2use crate::db::{Analysis, AnalyzerDb};
+3use crate::errors;
+4use crate::namespace::items::{
+5    self, ContractFieldId, ContractId, DepGraph, DepGraphWrapper, DepLocality, FunctionId, Item,
+6    TypeDef,
+7};
+8use crate::namespace::scopes::ItemScope;
+9use crate::namespace::types::{self, Type};
+10use crate::traversal::types::type_desc;
+11use fe_common::diagnostics::Label;
+12use fe_parser::ast;
+13use indexmap::map::{Entry, IndexMap};
+14use smol_str::SmolStr;
+15use std::rc::Rc;
+16
+17/// A `Vec` of every function defined in the contract, including duplicates and
+18/// the init function.
+19pub fn contract_all_functions(db: &dyn AnalyzerDb, contract: ContractId) -> Rc<[FunctionId]> {
+20    let module = contract.module(db);
+21    let body = &contract.data(db).ast.kind.body;
+22    body.iter()
+23        .map(|stmt| match stmt {
+24            ast::ContractStmt::Function(node) => db.intern_function(Rc::new(items::Function::new(
+25                db,
+26                node,
+27                Some(Item::Type(TypeDef::Contract(contract))),
+28                module,
+29            ))),
+30        })
+31        .collect()
+32}
+33
+34pub fn contract_function_map(
+35    db: &dyn AnalyzerDb,
+36    contract: ContractId,
+37) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>> {
+38    let scope = ItemScope::new(db, contract.module(db));
+39    let mut map = IndexMap::<SmolStr, FunctionId>::new();
+40
+41    for func in db.contract_all_functions(contract).iter() {
+42        let def = &func.data(db).ast;
+43        let def_name = def.name();
+44        if def_name == "__init__" || def_name == "__call__" {
+45            continue;
+46        }
+47
+48        if let Ok(Some(named_item)) = scope.resolve_name(def_name, func.name_span(db)) {
+49            scope.name_conflict_error(
+50                "function",
+51                def_name,
+52                &named_item,
+53                named_item.name_span(db),
+54                def.kind.sig.kind.name.span,
+55            );
+56            continue;
+57        }
+58
+59        let func_sig = func.sig(db);
+60        if let Ok(ret_ty) = func_sig.signature(db).return_type {
+61            if func.is_public(db) && !ret_ty.is_encodable(db).unwrap_or(false) {
+62                scope.fancy_error(
+63                    "can't return unencodable type from public contract function",
+64                    vec![Label::primary(
+65                        func_sig
+66                            .data(db)
+67                            .ast
+68                            .kind
+69                            .return_type
+70                            .as_ref()
+71                            .unwrap()
+72                            .span,
+73                        format! {"can't return `{}` here", ret_ty.name(db)},
+74                    )],
+75                    vec![],
+76                );
+77            }
+78        }
+79        for (i, param) in func_sig.signature(db).params.iter().enumerate() {
+80            if let Ok(param_ty) = param.typ {
+81                if func.is_public(db) && !param_ty.is_encodable(db).unwrap_or(false) {
+82                    scope.fancy_error(
+83                        "can't use unencodable type as a public contract function argument",
+84                        vec![Label::primary(
+85                            func_sig.data(db).ast.kind.args[i].kind.typ_span().unwrap(),
+86                            format! {"can't use `{}` here", param_ty.name(db)},
+87                        )],
+88                        vec![],
+89                    );
+90                }
+91            }
+92        }
+93
+94        match map.entry(def.name().into()) {
+95            Entry::Occupied(entry) => {
+96                scope.duplicate_name_error(
+97                    &format!(
+98                        "duplicate function names in `contract {}`",
+99                        contract.name(db),
+100                    ),
+101                    entry.key(),
+102                    entry.get().data(db).ast.span,
+103                    def.span,
+104                );
+105            }
+106            Entry::Vacant(entry) => {
+107                entry.insert(*func);
+108            }
+109        }
+110    }
+111    Analysis {
+112        value: Rc::new(map),
+113        diagnostics: scope.diagnostics.take().into(),
+114    }
+115}
+116
+117pub fn contract_public_function_map(
+118    db: &dyn AnalyzerDb,
+119    contract: ContractId,
+120) -> Rc<IndexMap<SmolStr, FunctionId>> {
+121    Rc::new(
+122        contract
+123            .functions(db)
+124            .iter()
+125            .filter(|(_, func)| func.is_public(db))
+126            .map(|(name, func)| (name.clone(), *func))
+127            .collect(),
+128    )
+129}
+130
+131pub fn contract_init_function(
+132    db: &dyn AnalyzerDb,
+133    contract: ContractId,
+134) -> Analysis<Option<FunctionId>> {
+135    let all_fns = db.contract_all_functions(contract);
+136    let mut init_fns = all_fns.iter().filter_map(|func| {
+137        let def = &func.data(db).ast;
+138        (def.name() == "__init__").then_some((func, def.span))
+139    });
+140
+141    let mut diagnostics = vec![];
+142
+143    let first_def = init_fns.next();
+144    if let Some((_, dupe_span)) = init_fns.next() {
+145        let mut labels = vec![
+146            Label::primary(first_def.unwrap().1, "`__init__` first defined here"),
+147            Label::secondary(dupe_span, "`init` redefined here"),
+148        ];
+149        for (_, dupe_span) in init_fns {
+150            labels.push(Label::secondary(dupe_span, "`__init__` redefined here"));
+151        }
+152        diagnostics.push(errors::fancy_error(
+153            format!(
+154                "`fn __init__()` is defined multiple times in `contract {}`",
+155                contract.name(db),
+156            ),
+157            labels,
+158            vec![],
+159        ));
+160    }
+161
+162    if let Some((id, span)) = first_def {
+163        // `__init__` must be `pub`.
+164        // Return type is checked in `queries::functions::function_signature`.
+165        if !id.is_public(db) {
+166            diagnostics.push(errors::fancy_error(
+167                "`__init__` function is not public",
+168                vec![Label::primary(span, "`__init__` function must be public")],
+169                vec![
+170                    "Hint: Add the `pub` modifier.".to_string(),
+171                    "Example: `pub fn __init__():`".to_string(),
+172                ],
+173            ));
+174        }
+175    }
+176
+177    Analysis {
+178        value: first_def.map(|(id, _span)| *id),
+179        diagnostics: diagnostics.into(),
+180    }
+181}
+182
+183pub fn contract_call_function(
+184    db: &dyn AnalyzerDb,
+185    contract: ContractId,
+186) -> Analysis<Option<FunctionId>> {
+187    let all_fns = db.contract_all_functions(contract);
+188    let mut call_fns = all_fns.iter().filter_map(|func| {
+189        let def = &func.data(db).ast;
+190        (def.name() == "__call__").then_some((func, def.span))
+191    });
+192
+193    let mut diagnostics = vec![];
+194
+195    let first_def = call_fns.next();
+196    if let Some((_, dupe_span)) = call_fns.next() {
+197        let mut labels = vec![
+198            Label::primary(first_def.unwrap().1, "`__call__` first defined here"),
+199            Label::secondary(dupe_span, "`__call__` redefined here"),
+200        ];
+201        for (_, dupe_span) in call_fns {
+202            labels.push(Label::secondary(dupe_span, "`__call__` redefined here"));
+203        }
+204        diagnostics.push(errors::fancy_error(
+205            format!(
+206                "`fn __call__()` is defined multiple times in `contract {}`",
+207                contract.name(db),
+208            ),
+209            labels,
+210            vec![],
+211        ));
+212    }
+213
+214    if let Some((id, span)) = first_def {
+215        // `__call__` must be `pub`.
+216        // Return type is checked in `queries::functions::function_signature`.
+217        if !id.is_public(db) {
+218            diagnostics.push(errors::fancy_error(
+219                "`__call__` function is not public",
+220                vec![Label::primary(span, "`__call__` function must be public")],
+221                vec![
+222                    "Hint: Add the `pub` modifier.".to_string(),
+223                    "Example: `pub fn __call__():`".to_string(),
+224                ],
+225            ));
+226        }
+227    }
+228
+229    if let Some((_id, init_span)) = first_def {
+230        for func in all_fns.iter() {
+231            let name = func.name(db);
+232            if func.is_public(db) && name != "__init__" && name != "__call__" {
+233                diagnostics.push(errors::fancy_error(
+234                    "`pub` not allowed if `__call__` is defined",
+235                    vec![
+236                        Label::primary(func.name_span(db), format!("`{name}` can't be public")),
+237                        Label::secondary(init_span, "`__call__` defined here"),
+238                    ],
+239                    vec![
+240                        "The `__call__` function replaces the default function dispatcher, which makes `pub` modifiers obsolete.".to_string(),
+241                        "Hint: Remove the `pub` modifier or `__call__` function.".to_string(),
+242                    ],
+243                ));
+244            }
+245        }
+246    }
+247
+248    Analysis {
+249        value: first_def.map(|(id, _span)| *id),
+250        diagnostics: diagnostics.into(),
+251    }
+252}
+253
+254/// All field ids, including those with duplicate names
+255pub fn contract_all_fields(db: &dyn AnalyzerDb, contract: ContractId) -> Rc<[ContractFieldId]> {
+256    contract
+257        .data(db)
+258        .ast
+259        .kind
+260        .fields
+261        .iter()
+262        .map(|node| {
+263            db.intern_contract_field(Rc::new(items::ContractField {
+264                ast: node.clone(),
+265                parent: contract,
+266            }))
+267        })
+268        .collect()
+269}
+270
+271pub fn contract_field_map(
+272    db: &dyn AnalyzerDb,
+273    contract: ContractId,
+274) -> Analysis<Rc<IndexMap<SmolStr, ContractFieldId>>> {
+275    let scope = ItemScope::new(db, contract.module(db));
+276    let mut map = IndexMap::<SmolStr, ContractFieldId>::new();
+277
+278    let contract_name = contract.name(db);
+279    for field in db.contract_all_fields(contract).iter() {
+280        let node = &field.data(db).ast;
+281
+282        match map.entry(node.name().into()) {
+283            Entry::Occupied(entry) => {
+284                scope.duplicate_name_error(
+285                    &format!("duplicate field names in `contract {contract_name}`",),
+286                    entry.key(),
+287                    entry.get().data(db).ast.span,
+288                    node.span,
+289                );
+290            }
+291            Entry::Vacant(entry) => {
+292                entry.insert(*field);
+293            }
+294        }
+295    }
+296
+297    Analysis {
+298        value: Rc::new(map),
+299        diagnostics: scope.diagnostics.take().into(),
+300    }
+301}
+302
+303pub fn contract_field_type(
+304    db: &dyn AnalyzerDb,
+305    field: ContractFieldId,
+306) -> Analysis<Result<types::TypeId, errors::TypeError>> {
+307    let mut scope = ItemScope::new(db, field.data(db).parent.module(db));
+308    let self_ty = Some(field.data(db).parent.as_type(db).as_trait_or_type());
+309    let typ = type_desc(&mut scope, &field.data(db).ast.kind.typ, self_ty);
+310
+311    let node = &field.data(db).ast;
+312
+313    if node.kind.is_pub {
+314        scope.not_yet_implemented("contract `pub` fields", node.span);
+315    }
+316    if node.kind.is_const {
+317        scope.not_yet_implemented("contract `const` fields", node.span);
+318    }
+319    if let Some(value_node) = &node.kind.value {
+320        scope.not_yet_implemented("contract field initial value assignment", value_node.span);
+321    }
+322
+323    Analysis {
+324        value: typ,
+325        diagnostics: scope.diagnostics.take().into(),
+326    }
+327}
+328
+329pub fn contract_dependency_graph(db: &dyn AnalyzerDb, contract: ContractId) -> DepGraphWrapper {
+330    // A contract depends on the types of its fields, and the things those types
+331    // depend on. Note that this *does not* include the contract's public
+332    // function graph. (See `contract_runtime_dependency_graph` below)
+333
+334    let fields = contract.fields(db);
+335    let field_types = fields
+336        .values()
+337        .filter_map(|field| match field.typ(db).ok()?.typ(db) {
+338            Type::Contract(id) => Some(Item::Type(TypeDef::Contract(id))),
+339            Type::Struct(id) => Some(Item::Type(TypeDef::Struct(id))),
+340            // TODO: when tuples can contain non-primitive items,
+341            // we'll have to depend on tuple element types
+342            _ => None,
+343        })
+344        .collect::<Vec<_>>();
+345
+346    let root = Item::Type(TypeDef::Contract(contract));
+347    let mut graph = DepGraph::from_edges(
+348        field_types
+349            .iter()
+350            .map(|item| (root, *item, DepLocality::Local)),
+351    );
+352
+353    for item in field_types {
+354        if let Some(subgraph) = item.dependency_graph(db) {
+355            graph.extend(subgraph.all_edges())
+356        }
+357    }
+358    DepGraphWrapper(Rc::new(graph))
+359}
+360
+361pub fn contract_dependency_graph_cycle(
+362    _db: &dyn AnalyzerDb,
+363    _cycle: &[String],
+364    _contract: &ContractId,
+365) -> DepGraphWrapper {
+366    DepGraphWrapper(Rc::new(DepGraph::new()))
+367}
+368
+369pub fn contract_runtime_dependency_graph(
+370    db: &dyn AnalyzerDb,
+371    contract: ContractId,
+372) -> DepGraphWrapper {
+373    // This is the dependency graph of the (as yet imaginary) `__call__` function,
+374    // which dispatches to the contract's public functions. This should be used
+375    // when compiling the runtime object for a contract.
+376
+377    let root = Item::Type(TypeDef::Contract(contract));
+378    let root_fns = if let Some(call_id) = contract.call_function(db) {
+379        vec![call_id]
+380    } else {
+381        contract.public_functions(db).values().copied().collect()
+382    }
+383    .into_iter()
+384    .map(|fun| (root, Item::Function(fun), DepLocality::Local))
+385    .collect::<Vec<_>>();
+386
+387    let mut graph = DepGraph::from_edges(root_fns.iter());
+388
+389    for (_, item, _) in root_fns {
+390        if let Some(subgraph) = item.dependency_graph(db) {
+391            graph.extend(subgraph.all_edges())
+392        }
+393    }
+394    DepGraphWrapper(Rc::new(graph))
+395}
+396
+397pub fn contract_runtime_dependency_graph_cycle(
+398    _db: &dyn AnalyzerDb,
+399    _cycle: &[String],
+400    _contract: &ContractId,
+401) -> DepGraphWrapper {
+402    DepGraphWrapper(Rc::new(DepGraph::new()))
+403}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries/enums.rs.html b/compiler-docs/src/fe_analyzer/db/queries/enums.rs.html new file mode 100644 index 0000000000..0663a06d24 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries/enums.rs.html @@ -0,0 +1,241 @@ +enums.rs - source

fe_analyzer/db/queries/
enums.rs

1use std::{rc::Rc, str::FromStr};
+2
+3use fe_parser::ast;
+4use indexmap::{map::Entry, IndexMap};
+5use smallvec::SmallVec;
+6use smol_str::SmolStr;
+7
+8use crate::{
+9    builtins,
+10    context::{Analysis, AnalyzerContext},
+11    errors::TypeError,
+12    namespace::{
+13        items::{
+14            self, DepGraph, DepGraphWrapper, DepLocality, EnumId, EnumVariant, EnumVariantId,
+15            EnumVariantKind, FunctionId, Item, TypeDef,
+16        },
+17        scopes::ItemScope,
+18        types::Type,
+19    },
+20    traversal::types::type_desc,
+21    AnalyzerDb,
+22};
+23
+24pub fn enum_all_variants(db: &dyn AnalyzerDb, enum_: EnumId) -> Rc<[EnumVariantId]> {
+25    enum_
+26        .data(db)
+27        .ast
+28        .kind
+29        .variants
+30        .iter()
+31        .enumerate()
+32        .map(|(tag, variant)| {
+33            db.intern_enum_variant(Rc::new(EnumVariant {
+34                ast: variant.clone(),
+35                tag,
+36                parent: enum_,
+37            }))
+38        })
+39        .collect()
+40}
+41
+42pub fn enum_variant_map(
+43    db: &dyn AnalyzerDb,
+44    enum_: EnumId,
+45) -> Analysis<Rc<IndexMap<SmolStr, EnumVariantId>>> {
+46    let scope = ItemScope::new(db, enum_.module(db));
+47    let mut variants = IndexMap::<SmolStr, EnumVariantId>::new();
+48
+49    for &variant in db.enum_all_variants(enum_).iter() {
+50        let variant_name = variant.name(db);
+51
+52        match variants.entry(variant_name) {
+53            Entry::Occupied(entry) => {
+54                scope.duplicate_name_error(
+55                    &format!("duplicate variant names in `enum {}`", enum_.name(db)),
+56                    entry.key(),
+57                    entry.get().data(db).ast.span,
+58                    variant.span(db),
+59                );
+60            }
+61
+62            Entry::Vacant(entry) => {
+63                entry.insert(variant);
+64            }
+65        }
+66    }
+67
+68    Analysis::new(Rc::new(variants), scope.diagnostics.take().into())
+69}
+70
+71pub fn enum_variant_kind(
+72    db: &dyn AnalyzerDb,
+73    variant: EnumVariantId,
+74) -> Analysis<Result<EnumVariantKind, TypeError>> {
+75    let variant_data = variant.data(db);
+76    let mut scope = ItemScope::new(db, variant_data.parent.module(db));
+77    let self_ty = Some(variant.parent(db).as_type(db).as_trait_or_type());
+78    let kind = match &variant_data.ast.kind.kind {
+79        ast::VariantKind::Unit => Ok(EnumVariantKind::Unit),
+80        ast::VariantKind::Tuple(tuple) => {
+81            let elem_tys: Result<SmallVec<[_; 4]>, _> = tuple
+82                .iter()
+83                .map(
+84                    |ast_ty| match type_desc(&mut scope, ast_ty, self_ty.clone()) {
+85                        Ok(ty) if ty.has_fixed_size(db) => Ok(ty),
+86                        Ok(_) => Err(TypeError::new(scope.error(
+87                            "enum variant type must have a fixed size",
+88                            variant_data.ast.span,
+89                            "this can't be used as an struct field",
+90                        ))),
+91                        Err(err) => Err(err),
+92                    },
+93                )
+94                .collect();
+95            elem_tys.map(EnumVariantKind::Tuple)
+96        }
+97    };
+98
+99    Analysis::new(kind, scope.diagnostics.take().into())
+100}
+101
+102pub fn enum_all_functions(db: &dyn AnalyzerDb, enum_: EnumId) -> Rc<[FunctionId]> {
+103    let enum_data = enum_.data(db);
+104    enum_data
+105        .ast
+106        .kind
+107        .functions
+108        .iter()
+109        .map(|node| {
+110            db.intern_function(Rc::new(items::Function::new(
+111                db,
+112                node,
+113                Some(Item::Type(TypeDef::Enum(enum_))),
+114                enum_data.module,
+115            )))
+116        })
+117        .collect()
+118}
+119
+120pub fn enum_function_map(
+121    db: &dyn AnalyzerDb,
+122    enum_: EnumId,
+123) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>> {
+124    let scope = ItemScope::new(db, enum_.module(db));
+125    let mut map = IndexMap::<SmolStr, FunctionId>::new();
+126    let variant_map = enum_.variants(db);
+127
+128    for func in db.enum_all_functions(enum_).iter() {
+129        let def = &func.data(db).ast;
+130        let def_name = def.name();
+131
+132        if let Ok(Some(named_item)) = scope.resolve_name(def_name, func.name_span(db)) {
+133            scope.name_conflict_error(
+134                "function",
+135                def_name,
+136                &named_item,
+137                named_item.name_span(db),
+138                func.name_span(db),
+139            );
+140            continue;
+141        }
+142
+143        if builtins::ValueMethod::from_str(def_name).is_ok() {
+144            scope.error(
+145                &format!("function name `{def_name}` conflicts with built-in function"),
+146                func.name_span(db),
+147                &format!("`{def_name}` is a built-in function"),
+148            );
+149            continue;
+150        }
+151
+152        match map.entry(def_name.into()) {
+153            Entry::Occupied(entry) => {
+154                scope.duplicate_name_error(
+155                    &format!("duplicate function names in `struct {}`", enum_.name(db)),
+156                    entry.key(),
+157                    entry.get().data(db).ast.span,
+158                    def.span,
+159                );
+160            }
+161
+162            Entry::Vacant(entry) => {
+163                if let Some(variant) = variant_map.get(def_name) {
+164                    scope.duplicate_name_error(
+165                        &format!("function name `{def_name}` conflicts with enum variant"),
+166                        def_name,
+167                        variant.span(db),
+168                        func.name_span(db),
+169                    );
+170                    continue;
+171                }
+172                entry.insert(*func);
+173            }
+174        }
+175    }
+176    Analysis::new(Rc::new(map), scope.diagnostics.take().into())
+177}
+178
+179pub fn enum_dependency_graph(db: &dyn AnalyzerDb, enum_: EnumId) -> Analysis<DepGraphWrapper> {
+180    let scope = ItemScope::new(db, enum_.module(db));
+181    let root = Item::Type(TypeDef::Enum(enum_));
+182    let mut edges = vec![];
+183
+184    for variant in enum_.variants(db).values() {
+185        match variant.kind(db) {
+186            Ok(EnumVariantKind::Unit) | Err(_) => {}
+187            Ok(EnumVariantKind::Tuple(elts)) => {
+188                for ty in elts {
+189                    let edge = match ty.typ(db) {
+190                        Type::Contract(id) => (
+191                            root,
+192                            Item::Type(TypeDef::Contract(id)),
+193                            DepLocality::External,
+194                        ),
+195
+196                        Type::Struct(id) => {
+197                            (root, Item::Type(TypeDef::Struct(id)), DepLocality::Local)
+198                        }
+199
+200                        Type::Enum(id) => (root, Item::Type(TypeDef::Enum(id)), DepLocality::Local),
+201
+202                        _ => continue,
+203                    };
+204                    edges.push(edge);
+205                }
+206            }
+207        }
+208    }
+209
+210    let mut graph = DepGraph::from_edges(edges.iter());
+211    for (_, item, _) in edges {
+212        if let Some(subgraph) = item.dependency_graph(db) {
+213            graph.extend(subgraph.all_edges())
+214        }
+215    }
+216
+217    Analysis::new(
+218        DepGraphWrapper(Rc::new(graph)),
+219        scope.diagnostics.take().into(),
+220    )
+221}
+222
+223pub fn enum_cycle(
+224    db: &dyn AnalyzerDb,
+225    _cycle: &[String],
+226    enum_: &EnumId,
+227) -> Analysis<DepGraphWrapper> {
+228    let scope = ItemScope::new(db, enum_.module(db));
+229    let enum_name = enum_.name(db);
+230    let enum_span = enum_.span(db);
+231    scope.error(
+232        &format!("recursive enum `{enum_name}`"),
+233        enum_span,
+234        &format!("enum `{enum_name}` has infinite size due to recursive definition",),
+235    );
+236
+237    Analysis::new(
+238        DepGraphWrapper(Rc::new(DepGraph::new())),
+239        scope.diagnostics.take().into(),
+240    )
+241}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries/functions.rs.html b/compiler-docs/src/fe_analyzer/db/queries/functions.rs.html new file mode 100644 index 0000000000..9bec67e4fa --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries/functions.rs.html @@ -0,0 +1,501 @@ +functions.rs - source

fe_analyzer/db/queries/
functions.rs

1use crate::context::{AnalyzerContext, CallType, FunctionBody};
+2use crate::db::{Analysis, AnalyzerDb};
+3use crate::display::Displayable;
+4use crate::errors::TypeError;
+5use crate::namespace::items::{
+6    DepGraph, DepGraphWrapper, DepLocality, FunctionId, FunctionSigId, Item, TypeDef,
+7};
+8use crate::namespace::scopes::{BlockScope, BlockScopeType, FunctionScope, ItemScope};
+9use crate::namespace::types::{self, CtxDecl, Generic, SelfDecl, Type, TypeId};
+10use crate::traversal::functions::traverse_statements;
+11use crate::traversal::types::{type_desc, type_desc_to_trait};
+12use fe_common::diagnostics::Label;
+13use fe_parser::ast::{self, GenericParameter};
+14use fe_parser::node::Node;
+15use if_chain::if_chain;
+16use smol_str::SmolStr;
+17use std::collections::HashMap;
+18use std::rc::Rc;
+19
+20/// Gather context information for a function definition and check for type
+21/// errors. Does not inspect the function body.
+22pub fn function_signature(
+23    db: &dyn AnalyzerDb,
+24    function: FunctionSigId,
+25) -> Analysis<Rc<types::FunctionSignature>> {
+26    let def = &function.data(db).ast;
+27
+28    let mut scope = ItemScope::new(db, function.module(db));
+29    let fn_parent = function.parent(db);
+30
+31    let mut self_decl = None;
+32    let mut ctx_decl = None;
+33    let mut names = HashMap::new();
+34    let mut labels = HashMap::new();
+35
+36    let sig_ast = &function.data(db).ast.kind;
+37    sig_ast.generic_params.kind.iter().fold(
+38        HashMap::<SmolStr, Node<_>>::new(),
+39        |mut accum, param| {
+40            if let Some(previous) = accum.get(&param.name()) {
+41                scope.duplicate_name_error(
+42                    "duplicate generic parameter",
+43                    &param.name(),
+44                    previous.span,
+45                    param.name_node().span,
+46                );
+47            } else {
+48                accum.insert(param.name(), param.name_node());
+49            };
+50
+51            accum
+52        },
+53    );
+54
+55    if !matches!(fn_parent, Item::Type(TypeDef::Struct(_))) && function.is_generic(db) {
+56        scope.fancy_error(
+57            "generic function parameters aren't yet supported outside of struct functions",
+58            vec![Label::primary(
+59                function.data(db).ast.kind.generic_params.span,
+60                "this cannot appear here",
+61            )],
+62            vec!["Hint: Struct functions can have generic parameters".into()],
+63        );
+64    }
+65
+66    if function.is_generic(db) {
+67        for param in function.data(db).ast.kind.generic_params.kind.iter() {
+68            if let GenericParameter::Unbounded(val) = param {
+69                scope.fancy_error(
+70                    "unbounded generic parameters aren't yet supported",
+71                    vec![Label::primary(
+72                        val.span,
+73                        format!("`{}` needs to be bound by some trait", val.kind),
+74                    )],
+75                    vec![format!(
+76                        "Hint: Change `{}` to `{}: SomeTrait`",
+77                        val.kind, val.kind
+78                    )],
+79                );
+80            }
+81        }
+82    }
+83
+84    let params = def
+85        .kind
+86        .args
+87        .iter()
+88        .enumerate()
+89        .filter_map(|(index, arg)| match &arg.kind {
+90            ast::FunctionArg::Self_ { mut_ }=> {
+91                if matches!(fn_parent, Item::Module(_)) {
+92                    scope.error(
+93                        "`self` can only be used in contract, struct, trait or impl functions",
+94                        arg.span,
+95                        "not allowed in functions defined directly in a module",
+96                    );
+97                } else {
+98                    self_decl = Some(SelfDecl { span: arg.span, mut_: *mut_ });
+99                    if index != 0 {
+100                        scope.error(
+101                            "`self` is not the first parameter",
+102                            arg.span,
+103                            "`self` may only be used as the first parameter",
+104                        );
+105                    }
+106                }
+107                None
+108            }
+109            ast::FunctionArg::Regular { mut_, label, name, typ: typedesc } => {
+110                let typ = resolve_function_param_type(db, function, &mut scope, typedesc).and_then(|typ| match typ {
+111                    typ if typ.has_fixed_size(db) => {
+112                        if let Some(mut_span) = mut_ {
+113                            if typ.is_primitive(db) {
+114                                Err(TypeError::new(scope.error(
+115                                    "primitive type function parameters cannot be `mut`",
+116                                    *mut_span + typedesc.span,
+117                                    &format!("`{}` type can't be used as a `mut` function parameter",
+118                                             typ.display(db)))))
+119                            } else {
+120                                Ok(Type::Mut(typ).id(db))
+121                            }
+122                        } else {
+123                            Ok(typ)
+124                        }
+125                    }
+126                    _ => Err(TypeError::new(scope.error(
+127                        "function parameter types must have fixed size",
+128                        typedesc.span,
+129                        &format!("`{}` type can't be used as a function parameter", typ.display(db)),
+130                    ))),
+131                });
+132
+133                if let Some(context_type) = scope.get_context_type() {
+134                    if arg.name() == "ctx" &&  typ.as_ref().map(|val| val.deref(db)) != Ok(context_type) {
+135                        scope.error(
+136                            "`ctx` is reserved for instances of `Context`",
+137                            arg.span,
+138                            "`ctx` must be an instance of `Context`",
+139                        );
+140                    };
+141
+142                    if typ.as_ref().map(|val| val.deref(db)) == Ok(context_type) {
+143                        if arg.name() != "ctx" {
+144                            scope.error(
+145                                "invalid `Context` instance name",
+146                                arg.span,
+147                                "instances of `Context` must be named `ctx`",
+148                            );
+149                        } else if self_decl.is_some() && index != 1 {
+150                            scope.error(
+151                                "invalid parameter order",
+152                                arg.span,
+153                                "`ctx: Context` must be placed after the `self` parameter",
+154                            );
+155                        } else if self_decl.is_none() && index != 0 {
+156                            scope.error(
+157                                "invalid parameter order",
+158                                arg.span,
+159                                "`ctx: Context` must be the first parameter",
+160                            );
+161                        }
+162                        else {
+163                            ctx_decl = Some(CtxDecl {span: arg.span,  mut_: *mut_})
+164                        }
+165                    }
+166                }
+167
+168                if let Some(label) = &label {
+169                    if_chain! {
+170                        if label.kind != "_";
+171                        if let Some(dup_idx) = labels.get(&label.kind);
+172                        then {
+173                            let dup_arg: &Node<ast::FunctionArg> = &def.kind.args[*dup_idx];
+174                            scope.fancy_error(
+175                                &format!("duplicate parameter labels in function `{}`", def.kind.name.kind),
+176                                vec![
+177                                    Label::primary(dup_arg.span, "the label `{}` was first used here"),
+178                                    Label::primary(label.span, "label `{}` used again here"),
+179                                ], vec![]);
+180                            return None;
+181                        } else {
+182                            labels.insert(&label.kind, index);
+183                        }
+184                    }
+185                }
+186
+187                if let Ok(Some(named_item)) = scope.resolve_name(&name.kind, name.span) {
+188                    scope.name_conflict_error(
+189                        "function parameter",
+190                        &name.kind,
+191                        &named_item,
+192                        named_item.name_span(db),
+193                        name.span,
+194                    );
+195                    None
+196                } else if let Some(dup_idx) = names.get(&name.kind) {
+197                    let dup_arg: &Node<ast::FunctionArg> = &def.kind.args[*dup_idx];
+198                    scope.duplicate_name_error(
+199                        &format!("duplicate parameter names in function `{}`", function.name(db)),
+200                        &name.kind,
+201                        dup_arg.span,
+202                        arg.span,
+203                    );
+204                    None
+205                } else {
+206                    names.insert(&name.kind, index);
+207
+208                    Some(types::FunctionParam::new(
+209                        label.as_ref().map(|s| s.kind.as_str()),
+210                        &name.kind,
+211                        typ,
+212                    ))
+213                }
+214            }
+215        })
+216        .collect();
+217
+218    let return_type = def
+219        .kind
+220        .return_type
+221        .as_ref()
+222        .map(|type_node| {
+223            let fn_name = &function.name(db);
+224            if fn_name == "__init__" || fn_name == "__call__" {
+225                // `__init__` and `__call__` must not return any type other than `()`.
+226                if type_node.kind != ast::TypeDesc::Unit {
+227                    scope.fancy_error(
+228                        &format!("`{fn_name}` function has incorrect return type"),
+229                        vec![Label::primary(type_node.span, "return type should be `()`")],
+230                        vec![
+231                            "Hint: Remove the return type specification.".to_string(),
+232                            format!("Example: `pub fn {fn_name}():`"),
+233                        ],
+234                    );
+235                }
+236                Ok(TypeId::unit(scope.db()))
+237            } else {
+238                let self_ty = match function.parent(db) {
+239                    Item::Trait(id) => Some(id.as_trait_or_type()),
+240                    _ => function.self_type(db).map(|ty| ty.as_trait_or_type()),
+241                };
+242
+243                match type_desc(&mut scope, type_node, self_ty)? {
+244                    typ if typ.has_fixed_size(scope.db()) => Ok(typ),
+245                    _ => Err(TypeError::new(scope.error(
+246                        "function return type must have a fixed size",
+247                        type_node.span,
+248                        "this can't be returned from a function",
+249                    ))),
+250                }
+251            }
+252        })
+253        .unwrap_or_else(|| Ok(TypeId::unit(db)));
+254
+255    Analysis {
+256        value: Rc::new(types::FunctionSignature {
+257            self_decl,
+258            ctx_decl,
+259            params,
+260            return_type,
+261        }),
+262        diagnostics: scope.diagnostics.take().into(),
+263    }
+264}
+265
+266fn resolve_function_param_type(
+267    db: &dyn AnalyzerDb,
+268    function: FunctionSigId,
+269    context: &mut dyn AnalyzerContext,
+270    desc: &Node<ast::TypeDesc>,
+271) -> Result<TypeId, TypeError> {
+272    // First check if the param type is a local generic of the function. This won't
+273    // hold when in the future generics can appear on the contract, struct or
+274    // module level but it could be good enough for now.
+275    if let ast::TypeDesc::Base { base } = &desc.kind {
+276        if let Some(val) = function.generic_param(db, base) {
+277            let bounds = match val {
+278                ast::GenericParameter::Unbounded(_) => vec![].into(),
+279                ast::GenericParameter::Bounded { bound, .. } => {
+280                    vec![type_desc_to_trait(context, &bound)?].into()
+281                }
+282            };
+283
+284            return Ok(db.intern_type(Type::Generic(Generic {
+285                name: base.clone(),
+286                bounds,
+287            })));
+288        }
+289    }
+290
+291    let self_ty = if let Item::Trait(id) = function.parent(db) {
+292        Some(id.as_trait_or_type())
+293    } else {
+294        function.self_type(db).map(|ty| ty.as_trait_or_type())
+295    };
+296
+297    type_desc(context, desc, self_ty)
+298}
+299
+300/// Gather context information for a function body and check for type errors.
+301pub fn function_body(db: &dyn AnalyzerDb, function: FunctionId) -> Analysis<Rc<FunctionBody>> {
+302    let def = &function.data(db).ast.kind;
+303    let scope = FunctionScope::new(db, function);
+304
+305    // If the return type is unit, explicit return or no return (implicit) is valid,
+306    // so no scanning is necessary.
+307    // If the return type is anything else, we need to ensure that all code paths
+308    // return or revert.
+309    if let Ok(return_type) = &function.signature(db).return_type {
+310        if !return_type.typ(db).is_unit() && !all_paths_return_or_revert(&def.body) {
+311            scope.fancy_error(
+312                "function body is missing a return or revert statement",
+313                vec![
+314                    Label::primary(
+315                        function.name_span(db),
+316                        "all paths of this function must `return` or `revert`",
+317                    ),
+318                    Label::secondary(
+319                        def.sig.kind.return_type.as_ref().unwrap().span,
+320                        format!("expected function to return `{}`", return_type.display(db)),
+321                    ),
+322                ],
+323                vec![],
+324            );
+325        }
+326    }
+327
+328    let mut block_scope = BlockScope::new(
+329        &scope,
+330        if function.is_unsafe(db) {
+331            BlockScopeType::Unsafe
+332        } else {
+333            BlockScopeType::Function
+334        },
+335    );
+336
+337    // If `traverse_statements` fails, we can be confident that a diagnostic
+338    // has been emitted, either while analyzing this fn body or while analyzing
+339    // a type or fn used in this fn body, because of the `DiagnosticVoucher`
+340    // system. (See the definition of `FatalError`)
+341    let _ = traverse_statements(&mut block_scope, &def.body);
+342    Analysis {
+343        value: Rc::new(scope.body.into_inner()),
+344        diagnostics: scope.diagnostics.into_inner().into(),
+345    }
+346}
+347
+348fn all_paths_return_or_revert(block: &[Node<ast::FuncStmt>]) -> bool {
+349    for statement in block.iter().rev() {
+350        match &statement.kind {
+351            ast::FuncStmt::Return { .. } | ast::FuncStmt::Revert { .. } => return true,
+352            ast::FuncStmt::If {
+353                test: _,
+354                body,
+355                or_else,
+356            } => {
+357                let body_returns = all_paths_return_or_revert(body);
+358                let or_else_returns = all_paths_return_or_revert(or_else);
+359                if body_returns && or_else_returns {
+360                    return true;
+361                }
+362            }
+363
+364            ast::FuncStmt::Match { arms, .. } => {
+365                return arms
+366                    .iter()
+367                    .all(|arm| all_paths_return_or_revert(&arm.kind.body));
+368            }
+369
+370            ast::FuncStmt::Unsafe(body) => {
+371                if all_paths_return_or_revert(body) {
+372                    return true;
+373                }
+374            }
+375            _ => {}
+376        }
+377    }
+378
+379    false
+380}
+381
+382pub fn function_dependency_graph(db: &dyn AnalyzerDb, function: FunctionId) -> DepGraphWrapper {
+383    let root = Item::Function(function);
+384
+385    // Edges to direct dependencies.
+386    let mut directs = vec![];
+387
+388    let sig = function.signature(db);
+389    directs.extend(
+390        sig.return_type
+391            .clone()
+392            .into_iter()
+393            .chain(sig.params.iter().filter_map(|param| param.typ.clone().ok()))
+394            .filter_map(|id| match id.typ(db) {
+395                Type::Contract(id) => {
+396                    // Contract types that are taken as (non-self) args or returned are "external",
+397                    // meaning that they're addresses of other contracts, so we don't have direct
+398                    // access to their fields, etc.
+399                    Some((
+400                        root,
+401                        Item::Type(TypeDef::Contract(id)),
+402                        DepLocality::External,
+403                    ))
+404                }
+405                Type::Struct(id) => {
+406                    Some((root, Item::Type(TypeDef::Struct(id)), DepLocality::Local))
+407                }
+408                _ => None,
+409            }),
+410    );
+411    // A function that takes `self` depends on the type of `self`, so that any
+412    // relevant struct getters/setters are included when compiling.
+413    if !function.sig(db).is_module_fn(db) {
+414        directs.push((root, function.parent(db), DepLocality::Local));
+415    }
+416
+417    let body = function.body(db);
+418    for calltype in body.calls.values() {
+419        match calltype {
+420            CallType::Pure(function) | CallType::AssociatedFunction { function, .. } => {
+421                directs.push((root, Item::Function(*function), DepLocality::Local));
+422            }
+423            CallType::ValueMethod { method, .. } => {
+424                directs.push((root, Item::Function(*method), DepLocality::Local));
+425            }
+426            CallType::TraitValueMethod { trait_id, .. } => {
+427                directs.push((root, Item::Trait(*trait_id), DepLocality::Local));
+428            }
+429            CallType::External { contract, function } => {
+430                directs.push((root, Item::Function(*function), DepLocality::External));
+431                // Probably redundant:
+432                directs.push((
+433                    root,
+434                    Item::Type(TypeDef::Contract(*contract)),
+435                    DepLocality::External,
+436                ));
+437            }
+438            CallType::TypeConstructor(type_id) => match type_id.typ(db) {
+439                Type::Struct(id) => {
+440                    directs.push((root, Item::Type(TypeDef::Struct(id)), DepLocality::Local))
+441                }
+442                Type::Contract(id) => directs.push((
+443                    root,
+444                    Item::Type(TypeDef::Contract(id)),
+445                    DepLocality::External,
+446                )),
+447                _ => {}
+448            },
+449            CallType::EnumConstructor(variant) => directs.push((
+450                root,
+451                Item::Type(TypeDef::Enum(variant.parent(db))),
+452                DepLocality::Local,
+453            )),
+454            CallType::BuiltinAssociatedFunction { contract, .. } => {
+455                // create/create2 call. The contract type is "external" for dependency graph
+456                // purposes.
+457                directs.push((
+458                    root,
+459                    Item::Type(TypeDef::Contract(*contract)),
+460                    DepLocality::External,
+461                ));
+462            }
+463            // Builtin functions aren't part of the dependency graph yet.
+464            CallType::BuiltinFunction(_)
+465            | CallType::Intrinsic(_)
+466            | CallType::BuiltinValueMethod { .. } => {}
+467        }
+468    }
+469
+470    directs.extend(
+471        body.var_types
+472            .values()
+473            .filter_map(|typid| match typid.typ(db) {
+474                Type::Contract(id) => Some((
+475                    root,
+476                    Item::Type(TypeDef::Contract(id)),
+477                    DepLocality::External,
+478                )),
+479                Type::Struct(id) => {
+480                    Some((root, Item::Type(TypeDef::Struct(id)), DepLocality::Local))
+481                }
+482                _ => None,
+483            }),
+484    );
+485
+486    let mut graph = DepGraph::from_edges(directs.iter());
+487    for (_, item, _) in directs {
+488        if let Some(subgraph) = item.dependency_graph(db) {
+489            graph.extend(subgraph.all_edges())
+490        }
+491    }
+492    DepGraphWrapper(Rc::new(graph))
+493}
+494
+495pub fn function_dependency_graph_cycle(
+496    _db: &dyn AnalyzerDb,
+497    _cycle: &[String],
+498    _function: &FunctionId,
+499) -> DepGraphWrapper {
+500    DepGraphWrapper(Rc::new(DepGraph::new()))
+501}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries/impls.rs.html b/compiler-docs/src/fe_analyzer/db/queries/impls.rs.html new file mode 100644 index 0000000000..fc5c410f87 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries/impls.rs.html @@ -0,0 +1,54 @@ +impls.rs - source

fe_analyzer/db/queries/
impls.rs

1use indexmap::map::Entry;
+2use indexmap::IndexMap;
+3use smol_str::SmolStr;
+4
+5use crate::context::{Analysis, AnalyzerContext};
+6use crate::namespace::items::{Function, FunctionId, ImplId, Item};
+7use crate::namespace::scopes::ItemScope;
+8use crate::AnalyzerDb;
+9use std::rc::Rc;
+10
+11pub fn impl_all_functions(db: &dyn AnalyzerDb, impl_: ImplId) -> Rc<[FunctionId]> {
+12    let impl_data = impl_.data(db);
+13    impl_data
+14        .ast
+15        .kind
+16        .functions
+17        .iter()
+18        .map(|node| {
+19            db.intern_function(Rc::new(Function::new(
+20                db,
+21                node,
+22                Some(Item::Impl(impl_)),
+23                impl_data.module,
+24            )))
+25        })
+26        .collect()
+27}
+28
+29pub fn impl_function_map(
+30    db: &dyn AnalyzerDb,
+31    impl_: ImplId,
+32) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>> {
+33    let scope = ItemScope::new(db, impl_.module(db));
+34    let mut map = IndexMap::<SmolStr, FunctionId>::new();
+35
+36    for func in db.impl_all_functions(impl_).iter() {
+37        let def_name = func.name(db);
+38
+39        match map.entry(def_name) {
+40            Entry::Occupied(entry) => {
+41                scope.duplicate_name_error(
+42                    "duplicate function names in `impl` block",
+43                    entry.key(),
+44                    entry.get().name_span(db),
+45                    func.name_span(db),
+46                );
+47            }
+48            Entry::Vacant(entry) => {
+49                entry.insert(*func);
+50            }
+51        }
+52    }
+53    Analysis::new(Rc::new(map), scope.diagnostics.take().into())
+54}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries/ingots.rs.html b/compiler-docs/src/fe_analyzer/db/queries/ingots.rs.html new file mode 100644 index 0000000000..e5e62e44bd --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries/ingots.rs.html @@ -0,0 +1,83 @@ +ingots.rs - source

fe_analyzer/db/queries/
ingots.rs

1use crate::namespace::items::{IngotId, IngotMode, ModuleId, ModuleSource};
+2use crate::AnalyzerDb;
+3use fe_common::files::{SourceFileId, Utf8Path, Utf8PathBuf};
+4use indexmap::IndexSet;
+5use std::rc::Rc;
+6
+7pub fn ingot_modules(db: &dyn AnalyzerDb, ingot: IngotId) -> Rc<[ModuleId]> {
+8    let files: Vec<(SourceFileId, Rc<Utf8PathBuf>)> = db
+9        .ingot_files(ingot)
+10        .iter()
+11        .map(|f| (*f, f.path(db.upcast())))
+12        .collect();
+13
+14    // Create a module for every .fe source file.
+15    let file_mods = files
+16        .iter()
+17        .map(|(file, path)| {
+18            ModuleId::new(
+19                db,
+20                path.file_stem().unwrap(),
+21                ModuleSource::File(*file),
+22                ingot,
+23            )
+24        })
+25        .collect();
+26
+27    // We automatically build a module hierarchy that matches the directory
+28    // structure. We don't (yet?) require a .fe file for each directory like
+29    // rust does. (eg `a/b.fe` alongside `a/b/`), but we do allow it (the
+30    // module's items will be everything inside the .fe file, and the
+31    // submodules inside the dir).
+32    //
+33    // Collect the set of all directories in the file hierarchy
+34    // (after stripping the common prefix from all paths).
+35    // eg given ["src/lib.fe", "src/a/b/x.fe", "src/a/c/d/y.fe"],
+36    // the dir set is {"a", "a/b", "a/c", "a/c/d"}.
+37    let file_path_prefix = &ingot.data(db).src_dir;
+38    let dirs = files
+39        .iter()
+40        .flat_map(|(_file, path)| {
+41            path.strip_prefix(file_path_prefix.as_str())
+42                .unwrap_or(path)
+43                .ancestors()
+44                .skip(1) // first elem of .ancestors() is the path itself
+45        })
+46        .collect::<IndexSet<&Utf8Path>>();
+47
+48    let dir_mods = dirs
+49        // Skip the dirs that have an associated fe file; eg skip "a/b" if "a/b.fe" exists.
+50        .difference(
+51            &files
+52                .iter()
+53                .map(|(_file, path)| {
+54                    path.strip_prefix(file_path_prefix.as_str())
+55                        .unwrap_or(path)
+56                        .as_str()
+57                        .trim_end_matches(".fe")
+58                        .into()
+59                })
+60                .collect::<IndexSet<&Utf8Path>>(),
+61        )
+62        .filter_map(|dir| {
+63            dir.file_name()
+64                .map(|name| ModuleId::new(db, name, ModuleSource::Dir(dir.as_str().into()), ingot))
+65        })
+66        .collect::<Vec<_>>();
+67
+68    [file_mods, dir_mods].concat().into()
+69}
+70
+71pub fn ingot_root_module(db: &dyn AnalyzerDb, ingot: IngotId) -> Option<ModuleId> {
+72    let filename = match ingot.data(db).mode {
+73        IngotMode::Lib => "lib.fe",
+74        IngotMode::Main => "main.fe",
+75        IngotMode::StandaloneModule => return Some(ingot.all_modules(db)[0]),
+76    };
+77
+78    ingot
+79        .all_modules(db)
+80        .iter()
+81        .find(|modid| modid.file_path_relative_to_src_dir(db) == filename)
+82        .copied()
+83}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries/module.rs.html b/compiler-docs/src/fe_analyzer/db/queries/module.rs.html new file mode 100644 index 0000000000..526c51505b --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries/module.rs.html @@ -0,0 +1,762 @@ +module.rs - source

fe_analyzer/db/queries/
module.rs

1use crate::context::{Analysis, AnalyzerContext, Constant, NamedThing};
+2use crate::display::Displayable;
+3use crate::errors::{self, ConstEvalError, TypeError};
+4use crate::namespace::items::{
+5    Attribute, Contract, ContractId, Enum, Function, FunctionId, Impl, ImplId, Item,
+6    ModuleConstant, ModuleConstantId, ModuleId, ModuleSource, Struct, StructId, Trait, TraitId,
+7    TypeAlias, TypeDef,
+8};
+9use crate::namespace::scopes::ItemScope;
+10use crate::namespace::types::{self, TypeId};
+11use crate::traversal::{const_expr, expressions, types::type_desc};
+12use crate::AnalyzerDb;
+13use fe_common::diagnostics::Label;
+14use fe_common::files::Utf8Path;
+15use fe_common::Span;
+16use fe_parser::{ast, node::Node};
+17use indexmap::indexmap;
+18use indexmap::map::{Entry, IndexMap};
+19use smol_str::SmolStr;
+20use std::rc::Rc;
+21
+22pub fn module_file_path(db: &dyn AnalyzerDb, module: ModuleId) -> SmolStr {
+23    let full_path = match &module.data(db).source {
+24        ModuleSource::File(file) => file.path(db.upcast()).as_str().into(),
+25        ModuleSource::Dir(path) => path.clone(),
+26    };
+27
+28    let src_prefix = &module.ingot(db).data(db).src_dir;
+29
+30    Utf8Path::new(full_path.as_str())
+31        .strip_prefix(src_prefix.as_str())
+32        .map(|path| path.as_str().into())
+33        .unwrap_or(full_path)
+34}
+35
+36pub fn module_parse(db: &dyn AnalyzerDb, module: ModuleId) -> Analysis<Rc<ast::Module>> {
+37    let data = module.data(db);
+38    match data.source {
+39        ModuleSource::File(file) => {
+40            let (ast, diags) = fe_parser::parse_file(file, &file.content(db.upcast()));
+41            Analysis::new(ast.into(), diags.into())
+42        }
+43        ModuleSource::Dir(_) => {
+44            // Directory with no corresponding source file. Return empty ast.
+45            Analysis::new(ast::Module { body: vec![] }.into(), vec![].into())
+46        }
+47    }
+48}
+49
+50pub fn module_is_incomplete(db: &dyn AnalyzerDb, module: ModuleId) -> bool {
+51    if matches!(module.data(db).source, ModuleSource::File(_)) {
+52        let ast = module.ast(db);
+53        ast.body
+54            .last()
+55            .map(|stmt| matches!(stmt, ast::ModuleStmt::ParseError(_)))
+56            .unwrap_or(false)
+57    } else {
+58        false
+59    }
+60}
+61
+62pub fn module_all_items(db: &dyn AnalyzerDb, module: ModuleId) -> Rc<[Item]> {
+63    let body = &module.ast(db).body;
+64    body.iter()
+65        .filter_map(|stmt| match stmt {
+66            ast::ModuleStmt::TypeAlias(node) => Some(Item::Type(TypeDef::Alias(
+67                db.intern_type_alias(Rc::new(TypeAlias {
+68                    ast: node.clone(),
+69                    module,
+70                })),
+71            ))),
+72            ast::ModuleStmt::Contract(node) => Some(Item::Type(TypeDef::Contract(
+73                db.intern_contract(Rc::new(Contract {
+74                    name: node.name().into(),
+75                    ast: node.clone(),
+76                    module,
+77                })),
+78            ))),
+79            ast::ModuleStmt::Struct(node) => Some(Item::Type(TypeDef::Struct(db.intern_struct(
+80                Rc::new(Struct {
+81                    ast: node.clone(),
+82                    module,
+83                }),
+84            )))),
+85            ast::ModuleStmt::Enum(node) => {
+86                Some(Item::Type(TypeDef::Enum(db.intern_enum(Rc::new(Enum {
+87                    ast: node.clone(),
+88                    module,
+89                })))))
+90            }
+91            ast::ModuleStmt::Constant(node) => Some(Item::Constant(db.intern_module_const(
+92                Rc::new(ModuleConstant {
+93                    ast: node.clone(),
+94                    module,
+95                }),
+96            ))),
+97            ast::ModuleStmt::Function(node) => Some(Item::Function(
+98                db.intern_function(Rc::new(Function::new(db, node, None, module))),
+99            )),
+100            ast::ModuleStmt::Trait(node) => Some(Item::Trait(db.intern_trait(Rc::new(Trait {
+101                ast: node.clone(),
+102                module,
+103            })))),
+104            ast::ModuleStmt::Attribute(node) => {
+105                Some(Item::Attribute(db.intern_attribute(Rc::new(Attribute {
+106                    ast: node.clone(),
+107                    module,
+108                }))))
+109            }
+110            ast::ModuleStmt::Pragma(_) | ast::ModuleStmt::Use(_) | ast::ModuleStmt::Impl(_) => None,
+111            ast::ModuleStmt::ParseError(_) => None,
+112        })
+113        .collect()
+114}
+115
+116pub fn module_all_impls(db: &dyn AnalyzerDb, module: ModuleId) -> Analysis<Rc<[ImplId]>> {
+117    let body = &module.ast(db).body;
+118    let mut scope = ItemScope::new(db, module);
+119    let impls = body
+120        .iter()
+121        .filter_map(|stmt| match stmt {
+122            ast::ModuleStmt::Impl(impl_node) => {
+123                let treit = module
+124                    .items(db)
+125                    .get(&impl_node.kind.impl_trait.kind)
+126                    .cloned();
+127
+128                if let Ok(receiver_type) = type_desc(&mut scope, &impl_node.kind.receiver, None) {
+129                    if let Some(Item::Trait(val)) = treit {
+130                        Some(db.intern_impl(Rc::new(Impl {
+131                            trait_id: val,
+132                            receiver: receiver_type,
+133                            ast: impl_node.clone(),
+134                            module,
+135                        })))
+136                    } else {
+137                        None
+138                    }
+139                } else {
+140                    None
+141                }
+142            }
+143            _ => None,
+144        })
+145        .collect();
+146    Analysis {
+147        value: impls,
+148        diagnostics: scope.diagnostics.take().into(),
+149    }
+150}
+151
+152pub fn module_item_map(
+153    db: &dyn AnalyzerDb,
+154    module: ModuleId,
+155) -> Analysis<Rc<IndexMap<SmolStr, Item>>> {
+156    // we must check for conflicts with global item names
+157    let global_items = module.global_items(db);
+158
+159    // sub modules and used items are included in this map
+160    let submodules = module
+161        .submodules(db)
+162        .iter()
+163        .map(|id| (id.name(db), Item::Module(*id)))
+164        .collect::<IndexMap<_, _>>();
+165    let used_items = db.module_used_item_map(module);
+166
+167    let mut diagnostics = used_items.diagnostics.to_vec();
+168    let mut map = IndexMap::<SmolStr, Item>::new();
+169
+170    for item in module.all_items(db).iter() {
+171        if matches!(item, Item::Attribute(_)) {
+172            continue;
+173        }
+174
+175        if let Item::Function(function) = item {
+176            let sig_ast = &function.data(db).ast.kind.sig.kind;
+177            if function.is_test(db) {
+178                if !sig_ast.generic_params.kind.is_empty() {
+179                    diagnostics.push(errors::fancy_error(
+180                        "generic parameters are not supported on test functions",
+181                        vec![Label::primary(
+182                            sig_ast.generic_params.span,
+183                            "invalid generic parameters",
+184                        )],
+185                        vec!["Hint: remove the generic parameters".into()],
+186                    ));
+187                }
+188
+189                if let Some(arg) = sig_ast.args.first() {
+190                    if arg.name() != "ctx" {
+191                        diagnostics.push(errors::fancy_error(
+192                            "function parameters other than `ctx` are not supported on test functions",
+193                            vec![Label::primary(arg.span, "invalid function parameter")],
+194                            vec!["Hint: remove the parameter".into()],
+195                        ));
+196                    }
+197                }
+198
+199                for arg in sig_ast.args.iter().skip(1) {
+200                    if arg.name() != "ctx" {
+201                        diagnostics.push(errors::fancy_error(
+202                            "function parameters other than `ctx` are not supported on test functions",
+203                            vec![Label::primary(arg.span, "invalid function parameter")],
+204                            vec!["Hint: remove the parameter".into()],
+205                        ));
+206                    }
+207                }
+208            }
+209        }
+210
+211        let item_name = item.name(db);
+212        if let Some(global_item) = global_items.get(&item_name) {
+213            let kind = item.item_kind_display_name();
+214            let other_kind = global_item.item_kind_display_name();
+215            diagnostics.push(errors::error(
+216                format!("{kind} name conflicts with the {other_kind} named \"{item_name}\""),
+217                item.name_span(db)
+218                    .expect("user defined item is missing a name span"),
+219                format!("`{item_name}` is already defined"),
+220            ));
+221            continue;
+222        }
+223
+224        if let Some((used_item_name_span, used_item)) = used_items.value.get(&item_name) {
+225            diagnostics.push(errors::duplicate_name_error(
+226                &format!(
+227                    "a {} with the same name has already been imported",
+228                    used_item.item_kind_display_name()
+229                ),
+230                &item.name(db),
+231                *used_item_name_span,
+232                item.name_span(db).expect("missing name span"),
+233            ));
+234            continue;
+235        }
+236
+237        match map.entry(item_name.clone()) {
+238            Entry::Occupied(entry) => {
+239                if let Some(entry_name_span) = entry.get().name_span(db) {
+240                    diagnostics.push(errors::duplicate_name_error(
+241                        &format!(
+242                            "a {} named \"{}\" has already been defined",
+243                            entry.get().item_kind_display_name(),
+244                            item_name
+245                        ),
+246                        &item_name,
+247                        entry_name_span,
+248                        item.name_span(db)
+249                            .expect("used-defined item does not have name span"),
+250                    ));
+251                } else {
+252                    diagnostics.push(errors::fancy_error(
+253                        format!(
+254                            "a {} named \"{}\" has already been defined",
+255                            entry.get().item_kind_display_name(),
+256                            item_name
+257                        ),
+258                        vec![Label::primary(
+259                            item.name_span(db)
+260                                .expect("used-defined item does not have name span"),
+261                            format!("`{}` redefined here", entry.key()),
+262                        )],
+263                        vec![],
+264                    ));
+265                }
+266            }
+267            Entry::Vacant(entry) => {
+268                entry.insert(*item);
+269            }
+270        }
+271    }
+272    Analysis::new(
+273        map.into_iter()
+274            .chain(submodules)
+275            .chain(
+276                used_items
+277                    .value
+278                    .iter()
+279                    .map(|(name, (_, item))| (name.clone(), *item)),
+280            )
+281            .collect::<IndexMap<_, _>>()
+282            .into(),
+283        diagnostics.into(),
+284    )
+285}
+286
+287pub fn module_impl_map(
+288    db: &dyn AnalyzerDb,
+289    module: ModuleId,
+290) -> Analysis<Rc<IndexMap<(TraitId, TypeId), ImplId>>> {
+291    let scope = ItemScope::new(db, module);
+292    let mut map = IndexMap::<(TraitId, TypeId), ImplId>::new();
+293
+294    let module_all_impls = db.module_all_impls(module);
+295    for impl_ in module_all_impls.value.iter() {
+296        let key = &(impl_.trait_id(db), impl_.receiver(db));
+297
+298        match map.entry(*key) {
+299            Entry::Occupied(entry) => {
+300                scope.duplicate_name_error(
+301                    &format!(
+302                        "duplicate `impl` blocks for trait `{}` for type `{}`",
+303                        key.0.name(db),
+304                        key.1.display(db)
+305                    ),
+306                    "",
+307                    entry.get().ast(db).span,
+308                    impl_.ast(db).span,
+309                );
+310            }
+311            Entry::Vacant(entry) => {
+312                entry.insert(*impl_);
+313            }
+314        }
+315    }
+316
+317    Analysis::new(
+318        Rc::new(map),
+319        [
+320            module_all_impls.diagnostics,
+321            scope.diagnostics.take().into(),
+322        ]
+323        .concat()
+324        .into(),
+325    )
+326}
+327
+328pub fn module_contracts(db: &dyn AnalyzerDb, module: ModuleId) -> Rc<[ContractId]> {
+329    module
+330        .all_items(db)
+331        .iter()
+332        .filter_map(|item| match item {
+333            Item::Type(TypeDef::Contract(id)) => Some(*id),
+334            _ => None,
+335        })
+336        .collect()
+337}
+338
+339pub fn module_structs(db: &dyn AnalyzerDb, module: ModuleId) -> Rc<[StructId]> {
+340    module
+341        .all_items(db)
+342        .iter()
+343        .chain(module.used_items(db).values().map(|(_, item)| item))
+344        .filter_map(|item| match item {
+345            Item::Type(TypeDef::Struct(id)) => Some(*id),
+346            _ => None,
+347        })
+348        .collect()
+349}
+350
+351pub fn module_constants(db: &dyn AnalyzerDb, module: ModuleId) -> Rc<Vec<ModuleConstantId>> {
+352    Rc::new(
+353        module
+354            .all_items(db)
+355            .iter()
+356            .filter_map(|item| match item {
+357                Item::Constant(id) => Some(*id),
+358                _ => None,
+359            })
+360            .collect(),
+361    )
+362}
+363
+364pub fn module_constant_type(
+365    db: &dyn AnalyzerDb,
+366    constant: ModuleConstantId,
+367) -> Analysis<Result<types::TypeId, TypeError>> {
+368    let constant_data = constant.data(db);
+369    let mut scope = ItemScope::new(db, constant.data(db).module);
+370    let typ = type_desc(&mut scope, &constant_data.ast.kind.typ, None);
+371
+372    match &typ {
+373        Ok(typ) if !typ.is_primitive(db) => {
+374            scope.error(
+375                "Non-primitive types not yet supported for constants",
+376                constant.data(db).ast.kind.typ.span,
+377                &format!(
+378                    "this has type `{}`; expected a primitive type",
+379                    typ.display(db)
+380                ),
+381            );
+382        }
+383        Ok(typ) => {
+384            if let Ok(expr_attr) =
+385                expressions::expr(&mut scope, &constant_data.ast.kind.value, Some(*typ))
+386            {
+387                if typ != &expr_attr.typ {
+388                    scope.type_error(
+389                        "type mismatch",
+390                        constant_data.ast.kind.value.span,
+391                        *typ,
+392                        expr_attr.typ,
+393                    );
+394                }
+395            }
+396        }
+397        _ => {}
+398    }
+399
+400    Analysis::new(typ, scope.diagnostics.take().into())
+401}
+402
+403pub fn module_constant_type_cycle(
+404    db: &dyn AnalyzerDb,
+405    _cycle: &[String],
+406    constant: &ModuleConstantId,
+407) -> Analysis<Result<TypeId, TypeError>> {
+408    let context = ItemScope::new(db, constant.data(db).module);
+409    let err = Err(TypeError::new(context.error(
+410        "recursive constant value definition",
+411        constant.data(db).ast.span,
+412        "",
+413    )));
+414
+415    Analysis {
+416        value: err,
+417        diagnostics: context.diagnostics.take().into(),
+418    }
+419}
+420
+421pub fn module_constant_value(
+422    db: &dyn AnalyzerDb,
+423    constant: ModuleConstantId,
+424) -> Analysis<Result<Constant, ConstEvalError>> {
+425    let constant_data = constant.data(db);
+426
+427    // Create `ItemScope` to collect expression types for constant evaluation.
+428    // TODO: Consider whether it's better to run semantic analysis twice(first
+429    // analysis is already done in `module_constant_type`) or cache expression
+430    // types in salsa.
+431    let mut scope = ItemScope::new(db, constant.data(db).module);
+432    let typ = match type_desc(&mut scope, &constant_data.ast.kind.typ, None) {
+433        Ok(typ) => typ,
+434        // No need to emit diagnostics, it's already emitted in `module_constant_type`.
+435        Err(err) => {
+436            return Analysis {
+437                value: Err(err.into()),
+438                diagnostics: vec![].into(),
+439            };
+440        }
+441    };
+442
+443    if let Err(err) = expressions::expr(&mut scope, &constant_data.ast.kind.value, Some(typ)) {
+444        // No need to emit diagnostics, it's already emitted in `module_constant_type`.
+445        return Analysis {
+446            value: Err(err.into()),
+447            diagnostics: vec![].into(),
+448        };
+449    }
+450
+451    // Clear diagnostics emitted from `module_constant_type`.
+452    scope.diagnostics.borrow_mut().clear();
+453
+454    // Perform constant evaluation.
+455    let value = const_expr::eval_expr(&mut scope, &constant_data.ast.kind.value);
+456
+457    Analysis {
+458        value,
+459        diagnostics: scope.diagnostics.take().into(),
+460    }
+461}
+462
+463pub fn module_constant_value_cycle(
+464    db: &dyn AnalyzerDb,
+465    _cycle: &[String],
+466    constant: &ModuleConstantId,
+467) -> Analysis<Result<Constant, ConstEvalError>> {
+468    let context = ItemScope::new(db, constant.data(db).module);
+469    let err = Err(ConstEvalError::new(context.error(
+470        "recursive constant value definition",
+471        constant.data(db).ast.span,
+472        "",
+473    )));
+474
+475    Analysis {
+476        value: err,
+477        diagnostics: context.diagnostics.take().into(),
+478    }
+479}
+480
+481pub fn module_used_item_map(
+482    db: &dyn AnalyzerDb,
+483    module: ModuleId,
+484) -> Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>> {
+485    // we must check for conflicts with the global items map
+486    let global_items = module.global_items(db);
+487
+488    let mut diagnostics = vec![];
+489    let body = &module.ast(db).body;
+490
+491    let mut items = body
+492        .iter()
+493        .fold(indexmap! {}, |mut accum, stmt| {
+494            if let ast::ModuleStmt::Use(use_stmt) = stmt {
+495                let items = resolve_use_tree(db, module, &use_stmt.kind.tree, true);
+496                diagnostics.extend(items.diagnostics.iter().cloned());
+497
+498                for (name, (name_span, item)) in items.value.iter() {
+499                    if !item.is_public(db) {
+500                        diagnostics.push(errors::error(
+501                            format!("{} {} is private", item.item_kind_display_name(), name,),
+502                            *name_span,
+503                            name.as_str(),
+504                        ));
+505                    }
+506
+507                    if let Some((other_name_span, other_item)) =
+508                        accum.insert(name.clone(), (*name_span, *item))
+509                    {
+510                        diagnostics.push(errors::duplicate_name_error(
+511                            &format!(
+512                                "a {} with the same name has already been imported",
+513                                other_item.item_kind_display_name()
+514                            ),
+515                            name,
+516                            other_name_span,
+517                            *name_span,
+518                        ));
+519                    }
+520                }
+521            }
+522
+523            accum
+524        })
+525        .into_iter()
+526        .filter_map(|(name, (name_span, item))| {
+527            if let Some(global_item) = global_items.get(&name) {
+528                let other_kind = global_item.item_kind_display_name();
+529
+530                diagnostics.push(errors::error(
+531                    format!("import name conflicts with the {other_kind} named \"{name}\""),
+532                    name_span,
+533                    format!("`{name}` is already defined"),
+534                ));
+535
+536                None
+537            } else {
+538                Some((name, (name_span, item)))
+539            }
+540        })
+541        .collect::<IndexMap<_, _>>();
+542
+543    // Add `use std::prelude::*` to every module not in std
+544    if !module.is_in_std(db) {
+545        let prelude_items = resolve_use_tree(
+546            db,
+547            module,
+548            &Node::new(
+549                ast::UseTree::Glob {
+550                    prefix: ast::Path {
+551                        segments: vec![
+552                            Node::new("std".into(), Span::dummy()),
+553                            Node::new("prelude".into(), Span::dummy()),
+554                        ],
+555                    },
+556                },
+557                Span::dummy(),
+558            ),
+559            true,
+560        )
+561        .value;
+562
+563        items.extend(Rc::try_unwrap(prelude_items).unwrap());
+564    }
+565
+566    Analysis::new(Rc::new(items), diagnostics.into())
+567}
+568
+569pub fn module_parent_module(db: &dyn AnalyzerDb, module: ModuleId) -> Option<ModuleId> {
+570    module
+571        .ingot(db)
+572        .all_modules(db)
+573        .iter()
+574        .find(|&&id| id != module && id.submodules(db).iter().any(|&sub| sub == module))
+575        .copied()
+576}
+577
+578pub fn module_submodules(db: &dyn AnalyzerDb, module: ModuleId) -> Rc<[ModuleId]> {
+579    // The module tree is entirely based on the file hierarchy for now.
+580
+581    let ingot = module.ingot(db);
+582    if Some(module) == ingot.root_module(db) {
+583        ingot
+584            .all_modules(db)
+585            .iter()
+586            .copied()
+587            .filter(|&module_id| {
+588                module_id != module
+589                    && Utf8Path::new(module_id.file_path_relative_to_src_dir(db).as_str())
+590                        .components()
+591                        .take(2)
+592                        .count()
+593                        == 1
+594            })
+595            .collect()
+596    } else {
+597        let dir_path = match &module.data(db).source {
+598            ModuleSource::Dir(path) => path.as_str().into(),
+599            _ => {
+600                let file_path = module.file_path_relative_to_src_dir(db);
+601                let path = Utf8Path::new(file_path.as_str());
+602                path.parent()
+603                    .unwrap_or_else(|| Utf8Path::new(""))
+604                    .join(path.file_stem().expect("source file name with no stem"))
+605            }
+606        };
+607
+608        ingot
+609            .all_modules(db)
+610            .iter()
+611            .copied()
+612            .filter(|&module_id| {
+613                module_id != module
+614                    && Utf8Path::new(module_id.file_path_relative_to_src_dir(db).as_str())
+615                        .parent()
+616                        .unwrap_or_else(|| {
+617                            panic!(
+618                                "module file in ingot does not have parent path: `{}`",
+619                                module_id.file_path_relative_to_src_dir(db)
+620                            )
+621                        })
+622                        == dir_path
+623            })
+624            .collect()
+625    }
+626}
+627
+628/// Resolve a use tree entirely. We set internal to true if the first path item
+629/// is internal.
+630///
+631/// e.g. `foo::bar::{baz::bing}`
+632///       ---        ---
+633///        ^          ^ baz is not internal
+634///        foo is internal
+635fn resolve_use_tree(
+636    db: &dyn AnalyzerDb,
+637    module: ModuleId,
+638    tree: &Node<ast::UseTree>,
+639    internal: bool,
+640) -> Analysis<Rc<IndexMap<SmolStr, (Span, Item)>>> {
+641    let mut diagnostics = vec![];
+642
+643    // Again, the path resolution method we use depends on whether or not the first
+644    // item is internal.
+645    let resolve_path = |module: ModuleId, db: &dyn AnalyzerDb, path: &ast::Path| {
+646        if internal {
+647            module.resolve_path_non_used_internal(db, path)
+648        } else {
+649            module.resolve_path(db, path)
+650        }
+651    };
+652
+653    match &tree.kind {
+654        ast::UseTree::Glob { prefix } => {
+655            let prefix_module = resolve_path(module, db, prefix);
+656            diagnostics.extend(prefix_module.diagnostics.iter().cloned());
+657
+658            let items = match prefix_module.value {
+659                Some(NamedThing::Item(Item::Module(module))) => module
+660                    .items(db)
+661                    .iter()
+662                    .map(|(name, item)| (name.clone(), (tree.span, *item)))
+663                    .collect(),
+664                Some(named_thing) => {
+665                    diagnostics.push(errors::error(
+666                        format!(
+667                            "cannot glob import from {}",
+668                            named_thing.item_kind_display_name()
+669                        ),
+670                        prefix.segments.last().expect("path is empty").span,
+671                        "prefix item must be a module",
+672                    ));
+673                    indexmap! {}
+674                }
+675                None => indexmap! {},
+676            };
+677
+678            Analysis::new(items.into(), diagnostics.into())
+679        }
+680        ast::UseTree::Nested { prefix, children } => {
+681            let prefix_module = resolve_path(module, db, prefix);
+682            diagnostics.extend(prefix_module.diagnostics.iter().cloned());
+683
+684            let items = match prefix_module.value {
+685                Some(NamedThing::Item(Item::Module(module))) => {
+686                    children.iter().fold(indexmap! {}, |mut accum, node| {
+687                        let child_items = resolve_use_tree(db, module, node, false);
+688                        diagnostics.extend(child_items.diagnostics.iter().cloned());
+689
+690                        for (name, (name_span, item)) in child_items.value.iter() {
+691                            if let Some((other_name_span, other_item)) =
+692                                accum.insert(name.clone(), (*name_span, *item))
+693                            {
+694                                diagnostics.push(errors::duplicate_name_error(
+695                                    &format!(
+696                                        "a {} with the same name has already been imported",
+697                                        other_item.item_kind_display_name()
+698                                    ),
+699                                    name,
+700                                    other_name_span,
+701                                    *name_span,
+702                                ));
+703                            }
+704                        }
+705
+706                        accum
+707                    })
+708                }
+709                Some(item) => {
+710                    diagnostics.push(errors::error(
+711                        format!("cannot glob import from {}", item.item_kind_display_name()),
+712                        prefix.segments.last().unwrap().span,
+713                        "prefix item must be a module",
+714                    ));
+715                    indexmap! {}
+716                }
+717                None => indexmap! {},
+718            };
+719
+720            Analysis::new(items.into(), diagnostics.into())
+721        }
+722        ast::UseTree::Simple { path, rename } => {
+723            let item = resolve_path(module, db, path);
+724
+725            let items = match item.value {
+726                Some(NamedThing::Item(item)) => {
+727                    let (item_name, item_name_span) = if let Some(name) = rename {
+728                        (name.kind.clone(), name.span)
+729                    } else {
+730                        let name_segment_node = path.segments.last().expect("path is empty");
+731                        (name_segment_node.kind.clone(), name_segment_node.span)
+732                    };
+733
+734                    indexmap! { item_name => (item_name_span, item) }
+735                }
+736                Some(named_thing) => {
+737                    diagnostics.push(errors::error(
+738                        format!(
+739                            "cannot import non-item {}",
+740                            named_thing.item_kind_display_name(),
+741                        ),
+742                        tree.span,
+743                        format!("{} is not an item", named_thing.item_kind_display_name()),
+744                    ));
+745                    indexmap! {}
+746                }
+747                None => indexmap! {},
+748            };
+749
+750            Analysis::new(items.into(), item.diagnostics)
+751        }
+752    }
+753}
+754
+755pub fn module_tests(db: &dyn AnalyzerDb, ingot: ModuleId) -> Vec<FunctionId> {
+756    ingot
+757        .all_functions(db)
+758        .iter()
+759        .copied()
+760        .filter(|function| function.is_test(db))
+761        .collect()
+762}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries/structs.rs.html b/compiler-docs/src/fe_analyzer/db/queries/structs.rs.html new file mode 100644 index 0000000000..b746dd2b3e --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries/structs.rs.html @@ -0,0 +1,279 @@ +structs.rs - source

fe_analyzer/db/queries/
structs.rs

1use crate::builtins;
+2use crate::constants::MAX_INDEXED_EVENT_FIELDS;
+3use crate::context::AnalyzerContext;
+4use crate::db::Analysis;
+5use crate::errors::TypeError;
+6use crate::namespace::items::{
+7    self, DepGraph, DepGraphWrapper, DepLocality, FunctionId, Item, StructField, StructFieldId,
+8    StructId, TypeDef,
+9};
+10use crate::namespace::scopes::ItemScope;
+11use crate::namespace::types::{Type, TypeId};
+12use crate::traversal::types::type_desc;
+13use crate::AnalyzerDb;
+14use fe_common::utils::humanize::pluralize_conditionally;
+15use fe_parser::{ast, Label};
+16use indexmap::map::{Entry, IndexMap};
+17use smol_str::SmolStr;
+18use std::rc::Rc;
+19use std::str::FromStr;
+20
+21pub fn struct_all_fields(db: &dyn AnalyzerDb, struct_: StructId) -> Rc<[StructFieldId]> {
+22    struct_
+23        .data(db)
+24        .ast
+25        .kind
+26        .fields
+27        .iter()
+28        .map(|node| {
+29            db.intern_struct_field(Rc::new(StructField {
+30                ast: node.clone(),
+31                parent: struct_,
+32            }))
+33        })
+34        .collect()
+35}
+36
+37pub fn struct_field_map(
+38    db: &dyn AnalyzerDb,
+39    struct_: StructId,
+40) -> Analysis<Rc<IndexMap<SmolStr, StructFieldId>>> {
+41    let scope = ItemScope::new(db, struct_.module(db));
+42    let mut fields = IndexMap::<SmolStr, StructFieldId>::new();
+43
+44    let mut indexed_count = 0;
+45    let struct_name = struct_.name(db);
+46    for field in db.struct_all_fields(struct_).iter() {
+47        let node = &field.data(db).ast;
+48
+49        if field.is_indexed(db) {
+50            indexed_count += 1;
+51        }
+52
+53        // Multiple attributes are currently still rejected by the parser so we only
+54        // need to check the name here
+55        if !field.attributes(db).is_empty() && !field.is_indexed(db) {
+56            let span = field.data(db).ast.kind.attributes.first().unwrap().span;
+57            scope.error(
+58                "Invalid attribute",
+59                span,
+60                "illegal name. Only `indexed` supported.",
+61            );
+62        }
+63
+64        match fields.entry(node.name().into()) {
+65            Entry::Occupied(entry) => {
+66                scope.duplicate_name_error(
+67                    &format!("duplicate field names in `struct {struct_name}`",),
+68                    entry.key(),
+69                    entry.get().data(db).ast.span,
+70                    node.span,
+71                );
+72            }
+73            Entry::Vacant(entry) => {
+74                entry.insert(*field);
+75            }
+76        }
+77    }
+78
+79    if indexed_count > MAX_INDEXED_EVENT_FIELDS {
+80        let excess_count = indexed_count - MAX_INDEXED_EVENT_FIELDS;
+81
+82        let mut labels = fields
+83            .iter()
+84            .filter(|(_, field)| field.is_indexed(db))
+85            .map(|(_, field)| Label::primary(field.span(db), String::new()))
+86            .collect::<Vec<Label>>();
+87        labels.last_mut().unwrap().message = format!("{indexed_count} indexed fields");
+88
+89        scope.fancy_error(
+90            &format!(
+91                "more than three indexed fields in `event {}`",
+92                struct_.name(db)
+93            ),
+94            labels,
+95            vec![format!(
+96                "Note: Remove the `indexed` attribute from at least {} {}.",
+97                excess_count,
+98                pluralize_conditionally("field", excess_count)
+99            )],
+100        );
+101    }
+102
+103    Analysis::new(Rc::new(fields), scope.diagnostics.take().into())
+104}
+105
+106pub fn struct_field_type(
+107    db: &dyn AnalyzerDb,
+108    field: StructFieldId,
+109) -> Analysis<Result<TypeId, TypeError>> {
+110    let field_data = field.data(db);
+111    let mut scope = ItemScope::new(db, field_data.parent.module(db));
+112
+113    let ast::Field {
+114        attributes: _,
+115        is_pub: _,
+116        is_const,
+117        name: _,
+118        typ,
+119        value,
+120    } = &field_data.ast.kind;
+121
+122    if *is_const {
+123        scope.not_yet_implemented("struct `const` fields", field_data.ast.span);
+124    }
+125    if let Some(_node) = value {
+126        scope.not_yet_implemented("struct field initial value assignment", field_data.ast.span);
+127    }
+128    let typ = match type_desc(&mut scope, typ, None) {
+129        Ok(typ) => match typ.typ(db) {
+130            Type::Contract(_) => {
+131                scope.not_yet_implemented(
+132                    "contract types aren't yet supported as struct fields",
+133                    field_data.ast.span,
+134                );
+135                Ok(typ)
+136            }
+137            t if t.has_fixed_size(db) => Ok(typ),
+138            _ => Err(TypeError::new(scope.error(
+139                "struct field type must have a fixed size",
+140                field_data.ast.span,
+141                "this can't be used as an struct field",
+142            ))),
+143        },
+144        Err(err) => Err(err),
+145    };
+146
+147    Analysis::new(typ, scope.diagnostics.take().into())
+148}
+149
+150pub fn struct_all_functions(db: &dyn AnalyzerDb, struct_: StructId) -> Rc<[FunctionId]> {
+151    let struct_data = struct_.data(db);
+152    struct_data
+153        .ast
+154        .kind
+155        .functions
+156        .iter()
+157        .map(|node| {
+158            db.intern_function(Rc::new(items::Function::new(
+159                db,
+160                node,
+161                Some(Item::Type(TypeDef::Struct(struct_))),
+162                struct_data.module,
+163            )))
+164        })
+165        .collect()
+166}
+167
+168pub fn struct_function_map(
+169    db: &dyn AnalyzerDb,
+170    struct_: StructId,
+171) -> Analysis<Rc<IndexMap<SmolStr, FunctionId>>> {
+172    let scope = ItemScope::new(db, struct_.module(db));
+173    let mut map = IndexMap::<SmolStr, FunctionId>::new();
+174
+175    for func in db.struct_all_functions(struct_).iter() {
+176        let def = &func.data(db).ast;
+177        let def_name = def.name();
+178        if def_name == "__init__" {
+179            continue;
+180        }
+181
+182        if let Ok(Some(named_item)) = scope.resolve_name(def_name, func.name_span(db)) {
+183            scope.name_conflict_error(
+184                "function",
+185                def_name,
+186                &named_item,
+187                named_item.name_span(db),
+188                func.name_span(db),
+189            );
+190            continue;
+191        }
+192
+193        if builtins::ValueMethod::from_str(def_name).is_ok() {
+194            scope.error(
+195                &format!("function name `{def_name}` conflicts with built-in function"),
+196                func.name_span(db),
+197                &format!("`{def_name}` is a built-in function"),
+198            );
+199            continue;
+200        }
+201
+202        match map.entry(def_name.into()) {
+203            Entry::Occupied(entry) => {
+204                scope.duplicate_name_error(
+205                    &format!("duplicate function names in `struct {}`", struct_.name(db)),
+206                    entry.key(),
+207                    entry.get().data(db).ast.span,
+208                    def.span,
+209                );
+210            }
+211            Entry::Vacant(entry) => {
+212                entry.insert(*func);
+213            }
+214        }
+215    }
+216    Analysis::new(Rc::new(map), scope.diagnostics.take().into())
+217}
+218
+219pub fn struct_dependency_graph(
+220    db: &dyn AnalyzerDb,
+221    struct_: StructId,
+222) -> Analysis<DepGraphWrapper> {
+223    // A struct depends on the types of its fields and on everything they depend on.
+224    // It *does not* depend on its public functions; those will only be part of
+225    // the broader dependency graph if they're in the call graph of some public
+226    // contract function.
+227
+228    let scope = ItemScope::new(db, struct_.module(db));
+229    let root = Item::Type(TypeDef::Struct(struct_));
+230    let fields = struct_
+231        .fields(db)
+232        .values()
+233        .filter_map(|field| match field.typ(db).ok()?.typ(db) {
+234            Type::Contract(id) => Some((
+235                root,
+236                Item::Type(TypeDef::Contract(id)),
+237                DepLocality::External,
+238            )),
+239            // Not possible yet, but it will be soon
+240            Type::Struct(id) => Some((root, Item::Type(TypeDef::Struct(id)), DepLocality::Local)),
+241            Type::Enum(id) => Some((root, Item::Type(TypeDef::Enum(id)), DepLocality::Local)),
+242            _ => None,
+243        })
+244        .collect::<Vec<_>>();
+245
+246    let mut graph = DepGraph::from_edges(fields.iter());
+247    for (_, item, _) in fields {
+248        if let Some(subgraph) = item.dependency_graph(db) {
+249            graph.extend(subgraph.all_edges())
+250        }
+251    }
+252
+253    Analysis::new(
+254        DepGraphWrapper(Rc::new(graph)),
+255        scope.diagnostics.take().into(),
+256    )
+257}
+258
+259pub fn struct_cycle(
+260    db: &dyn AnalyzerDb,
+261    _cycle: &[String],
+262    struct_: &StructId,
+263) -> Analysis<DepGraphWrapper> {
+264    let scope = ItemScope::new(db, struct_.module(db));
+265    let struct_data = &struct_.data(db).ast;
+266    scope.error(
+267        &format!("recursive struct `{}`", struct_data.name()),
+268        struct_data.kind.name.span,
+269        &format!(
+270            "struct `{}` has infinite size due to recursive definition",
+271            struct_data.name(),
+272        ),
+273    );
+274
+275    Analysis::new(
+276        DepGraphWrapper(Rc::new(DepGraph::new())),
+277        scope.diagnostics.take().into(),
+278    )
+279}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries/traits.rs.html b/compiler-docs/src/fe_analyzer/db/queries/traits.rs.html new file mode 100644 index 0000000000..b05f5ba1b2 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries/traits.rs.html @@ -0,0 +1,62 @@ +traits.rs - source

fe_analyzer/db/queries/
traits.rs

1use indexmap::map::Entry;
+2use indexmap::IndexMap;
+3use smol_str::SmolStr;
+4
+5use crate::context::{Analysis, AnalyzerContext};
+6use crate::namespace::items::{FunctionSig, FunctionSigId, Item, TraitId};
+7use crate::namespace::scopes::ItemScope;
+8use crate::namespace::types::TypeId;
+9use crate::AnalyzerDb;
+10use std::rc::Rc;
+11
+12pub fn trait_all_functions(db: &dyn AnalyzerDb, trait_: TraitId) -> Rc<[FunctionSigId]> {
+13    let trait_data = trait_.data(db);
+14    trait_data
+15        .ast
+16        .kind
+17        .functions
+18        .iter()
+19        .map(|node| {
+20            db.intern_function_sig(Rc::new(FunctionSig {
+21                ast: node.clone(),
+22                module: trait_.module(db),
+23                parent: Some(Item::Trait(trait_)),
+24            }))
+25        })
+26        .collect()
+27}
+28
+29pub fn trait_function_map(
+30    db: &dyn AnalyzerDb,
+31    trait_: TraitId,
+32) -> Analysis<Rc<IndexMap<SmolStr, FunctionSigId>>> {
+33    let scope = ItemScope::new(db, trait_.module(db));
+34    let mut map = IndexMap::<SmolStr, FunctionSigId>::new();
+35
+36    for func in db.trait_all_functions(trait_).iter() {
+37        let def_name = func.name(db);
+38
+39        match map.entry(def_name) {
+40            Entry::Occupied(entry) => {
+41                scope.duplicate_name_error(
+42                    &format!("duplicate function names in `trait {}`", trait_.name(db)),
+43                    entry.key(),
+44                    entry.get().name_span(db),
+45                    func.name_span(db),
+46                );
+47            }
+48            Entry::Vacant(entry) => {
+49                entry.insert(*func);
+50            }
+51        }
+52    }
+53    Analysis::new(Rc::new(map), scope.diagnostics.take().into())
+54}
+55
+56pub fn trait_is_implemented_for(db: &dyn AnalyzerDb, trait_: TraitId, ty: TypeId) -> bool {
+57    trait_
+58        .module(db)
+59        .all_impls(db)
+60        .iter()
+61        .any(|val| val.trait_id(db) == trait_ && val.receiver(db) == ty)
+62}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/db/queries/types.rs.html b/compiler-docs/src/fe_analyzer/db/queries/types.rs.html new file mode 100644 index 0000000000..3e2ea0de85 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/db/queries/types.rs.html @@ -0,0 +1,73 @@ +types.rs - source

fe_analyzer/db/queries/
types.rs

1use std::rc::Rc;
+2
+3use smol_str::SmolStr;
+4
+5use crate::context::{AnalyzerContext, TempContext};
+6use crate::db::Analysis;
+7use crate::errors::TypeError;
+8use crate::namespace::items::{FunctionSigId, ImplId, TraitId, TypeAliasId};
+9use crate::namespace::scopes::ItemScope;
+10use crate::namespace::types::{self, TypeId};
+11use crate::traversal::types::type_desc;
+12use crate::AnalyzerDb;
+13
+14/// Returns all `impl` for the given type from the current ingot as well as
+15/// dependency ingots
+16pub fn all_impls(db: &dyn AnalyzerDb, ty: TypeId) -> Rc<[ImplId]> {
+17    let ty = ty.deref(db);
+18
+19    let ingot_modules = db
+20        .root_ingot()
+21        .all_modules(db)
+22        .iter()
+23        .flat_map(|module_id| module_id.all_impls(db).to_vec())
+24        .collect::<Vec<_>>();
+25    db.ingot_external_ingots(db.root_ingot())
+26        .values()
+27        .flat_map(|ingot| ingot.all_modules(db).to_vec())
+28        .flat_map(|module_id| module_id.all_impls(db).to_vec())
+29        .chain(ingot_modules)
+30        .filter(|val| val.receiver(db) == ty)
+31        .collect()
+32}
+33
+34pub fn impl_for(db: &dyn AnalyzerDb, ty: TypeId, treit: TraitId) -> Option<ImplId> {
+35    db.all_impls(ty)
+36        .iter()
+37        .find(|impl_| impl_.trait_id(db) == treit)
+38        .cloned()
+39}
+40
+41pub fn function_sigs(db: &dyn AnalyzerDb, ty: TypeId, name: SmolStr) -> Rc<[FunctionSigId]> {
+42    db.all_impls(ty)
+43        .iter()
+44        .filter_map(|impl_| impl_.function(db, &name))
+45        .map(|fun| fun.sig(db))
+46        .chain(ty.function_sig(db, &name).map_or(vec![], |fun| vec![fun]))
+47        .collect()
+48}
+49
+50pub fn type_alias_type(
+51    db: &dyn AnalyzerDb,
+52    alias: TypeAliasId,
+53) -> Analysis<Result<types::TypeId, TypeError>> {
+54    let mut scope = ItemScope::new(db, alias.data(db).module);
+55    let typ = type_desc(&mut scope, &alias.data(db).ast.kind.typ, None);
+56
+57    Analysis::new(typ, scope.diagnostics.take().into())
+58}
+59
+60pub fn type_alias_type_cycle(
+61    db: &dyn AnalyzerDb,
+62    _cycle: &[String],
+63    alias: &TypeAliasId,
+64) -> Analysis<Result<types::TypeId, TypeError>> {
+65    let context = TempContext::default();
+66    let err = Err(TypeError::new(context.error(
+67        "recursive type definition",
+68        alias.data(db).ast.span,
+69        "",
+70    )));
+71
+72    Analysis::new(err, context.diagnostics.take().into())
+73}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/display.rs.html b/compiler-docs/src/fe_analyzer/display.rs.html new file mode 100644 index 0000000000..3bdbed1fde --- /dev/null +++ b/compiler-docs/src/fe_analyzer/display.rs.html @@ -0,0 +1,41 @@ +display.rs - source

fe_analyzer/
display.rs

1use crate::AnalyzerDb;
+2use std::fmt;
+3
+4pub trait Displayable: DisplayWithDb {
+5    fn display<'a, 'b>(&'a self, db: &'b dyn AnalyzerDb) -> DisplayableWrapper<'b, &'a Self> {
+6        DisplayableWrapper::new(db, self)
+7    }
+8}
+9impl<T: DisplayWithDb> Displayable for T {}
+10
+11pub trait DisplayWithDb {
+12    fn format(&self, db: &dyn AnalyzerDb, f: &mut fmt::Formatter<'_>) -> fmt::Result;
+13}
+14
+15impl<T: ?Sized> DisplayWithDb for &T
+16where
+17    T: DisplayWithDb,
+18{
+19    fn format(&self, db: &dyn AnalyzerDb, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+20        (*self).format(db, f)
+21    }
+22}
+23
+24pub struct DisplayableWrapper<'a, T> {
+25    db: &'a dyn AnalyzerDb,
+26    inner: T,
+27}
+28impl<'a, T> DisplayableWrapper<'a, T> {
+29    pub fn new(db: &'a dyn AnalyzerDb, inner: T) -> Self {
+30        Self { db, inner }
+31    }
+32    pub fn child(&self, inner: T) -> Self {
+33        Self { db: self.db, inner }
+34    }
+35}
+36
+37impl<T: DisplayWithDb> fmt::Display for DisplayableWrapper<'_, T> {
+38    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+39        self.inner.format(self.db, f)
+40    }
+41}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/errors.rs.html b/compiler-docs/src/fe_analyzer/errors.rs.html new file mode 100644 index 0000000000..8f0c52d0e9 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/errors.rs.html @@ -0,0 +1,297 @@ +errors.rs - source

fe_analyzer/
errors.rs

1//! Semantic errors.
+2
+3use crate::context::{DiagnosticVoucher, NamedThing};
+4use fe_common::diagnostics::{Diagnostic, Label, Severity};
+5use fe_common::Span;
+6use std::fmt::Display;
+7
+8/// Error indicating that a type is invalid.
+9///
+10/// Note that the "type" of a thing (eg the type of a `FunctionParam`)
+11/// in [`crate::namespace::types`] is sometimes represented as a
+12/// `Result<Type, TypeError>`.
+13///
+14/// If, for example, a function parameter has an undefined type, we emit a [`Diagnostic`] message,
+15/// give that parameter a "type" of `Err(TypeError)`, and carry on. If/when that parameter is
+16/// used in the function body, we assume that a diagnostic message about the undefined type
+17/// has already been emitted, and halt the analysis of the function body.
+18///
+19/// To ensure that that assumption is sound, a diagnostic *must* be emitted before creating
+20/// a `TypeError`. So that the rust compiler can help us enforce this rule, a `TypeError`
+21/// cannot be constructed without providing a [`DiagnosticVoucher`]. A voucher can be obtained
+22/// by calling an error function on an [`AnalyzerContext`](crate::context::AnalyzerContext).
+23/// Please don't try to work around this restriction.
+24///
+25/// Example: `TypeError::new(context.error("something is wrong", some_span, "this thing"))`
+26#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+27pub struct TypeError(DiagnosticVoucher);
+28impl TypeError {
+29    // `Clone` is required because these are stored in a salsa db.
+30    // Please don't clone these manually.
+31    pub fn new(voucher: DiagnosticVoucher) -> Self {
+32        Self(voucher)
+33    }
+34}
+35
+36impl From<FatalError> for TypeError {
+37    fn from(err: FatalError) -> Self {
+38        Self(err.0)
+39    }
+40}
+41impl From<ConstEvalError> for TypeError {
+42    fn from(err: ConstEvalError) -> Self {
+43        Self(err.0)
+44    }
+45}
+46
+47/// Error to be returned when otherwise no meaningful information can be returned.
+48/// Can't be created unless a diagnostic has been emitted, and thus a [`DiagnosticVoucher`]
+49/// has been obtained. (See comment on [`TypeError`])
+50#[derive(Debug)]
+51pub struct FatalError(DiagnosticVoucher);
+52
+53impl FatalError {
+54    /// Create a `FatalError` instance, given a "voucher"
+55    /// obtained by emitting an error via an [`AnalyzerContext`](crate::context::AnalyzerContext).
+56    pub fn new(voucher: DiagnosticVoucher) -> Self {
+57        Self(voucher)
+58    }
+59}
+60
+61impl From<ConstEvalError> for FatalError {
+62    fn from(err: ConstEvalError) -> Self {
+63        Self(err.0)
+64    }
+65}
+66
+67impl From<AlreadyDefined> for FatalError {
+68    fn from(err: AlreadyDefined) -> Self {
+69        Self(err.0)
+70    }
+71}
+72
+73/// Error indicating constant evaluation failed.
+74///
+75/// This error emitted when
+76/// 1. an expression can't be evaluated in compilation time
+77/// 2. arithmetic overflow occurred during evaluation
+78/// 3. zero division is detected during evaluation
+79///
+80/// Can't be created unless a diagnostic has been emitted, and thus a [`DiagnosticVoucher`]
+81/// has been obtained. (See comment on [`TypeError`])
+82///
+83/// NOTE: `Clone` is required because these are stored in a salsa db.
+84/// Please don't clone these manually.
+85#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+86pub struct ConstEvalError(DiagnosticVoucher);
+87
+88impl ConstEvalError {
+89    pub fn new(voucher: DiagnosticVoucher) -> Self {
+90        Self(voucher)
+91    }
+92}
+93
+94impl From<TypeError> for ConstEvalError {
+95    fn from(err: TypeError) -> Self {
+96        Self(err.0)
+97    }
+98}
+99
+100impl From<FatalError> for ConstEvalError {
+101    fn from(err: FatalError) -> Self {
+102        Self(err.0)
+103    }
+104}
+105
+106impl From<IncompleteItem> for ConstEvalError {
+107    fn from(err: IncompleteItem) -> Self {
+108        Self(err.0)
+109    }
+110}
+111
+112/// Error returned by `ModuleId::resolve_name` if the name is not found, and parsing of the module
+113/// failed. In this case, emitting an error message about failure to resolve the name might be misleading,
+114/// because the file may in fact contain an item with the given name, somewhere after the syntax error that caused
+115/// parsing to fail.
+116#[derive(Debug)]
+117pub struct IncompleteItem(DiagnosticVoucher);
+118impl IncompleteItem {
+119    #[allow(clippy::new_without_default)]
+120    pub fn new() -> Self {
+121        Self(DiagnosticVoucher::assume_the_parser_handled_it())
+122    }
+123}
+124
+125/// Error to be returned from APIs that should reject duplicate definitions
+126#[derive(Debug)]
+127pub struct AlreadyDefined(DiagnosticVoucher);
+128impl AlreadyDefined {
+129    #[allow(clippy::new_without_default)]
+130    pub fn new(voucher: DiagnosticVoucher) -> Self {
+131        Self(voucher)
+132    }
+133}
+134
+135/// Errors that can result from indexing
+136#[derive(Debug, PartialEq, Eq)]
+137pub enum IndexingError {
+138    WrongIndexType,
+139    NotSubscriptable,
+140}
+141
+142/// Errors that can result from a binary operation
+143#[derive(Debug, PartialEq, Eq)]
+144pub enum BinaryOperationError {
+145    TypesNotCompatible,
+146    TypesNotNumeric,
+147    RightTooLarge,
+148    RightIsSigned,
+149    NotEqualAndUnsigned,
+150}
+151
+152/// Errors that can result from an implicit type coercion
+153#[derive(Debug, PartialEq, Eq)]
+154pub enum TypeCoercionError {
+155    /// Value is in storage and must be explicitly moved with .to_mem()
+156    RequiresToMem,
+157    /// Value type cannot be coerced to the expected type
+158    Incompatible,
+159    /// `self` contract used where an external contract value is expected
+160    SelfContractType,
+161}
+162
+163impl From<TypeError> for FatalError {
+164    fn from(err: TypeError) -> Self {
+165        Self::new(err.0)
+166    }
+167}
+168
+169impl From<IncompleteItem> for FatalError {
+170    fn from(err: IncompleteItem) -> Self {
+171        Self::new(err.0)
+172    }
+173}
+174
+175impl From<IncompleteItem> for TypeError {
+176    fn from(err: IncompleteItem) -> Self {
+177        Self::new(err.0)
+178    }
+179}
+180
+181pub fn error(message: impl Into<String>, label_span: Span, label: impl Into<String>) -> Diagnostic {
+182    fancy_error(message, vec![Label::primary(label_span, label)], vec![])
+183}
+184
+185pub fn fancy_error(
+186    message: impl Into<String>,
+187    labels: Vec<Label>,
+188    notes: Vec<String>,
+189) -> Diagnostic {
+190    Diagnostic {
+191        severity: Severity::Error,
+192        message: message.into(),
+193        labels,
+194        notes,
+195    }
+196}
+197
+198pub fn type_error(
+199    message: impl Into<String>,
+200    span: Span,
+201    expected: impl Display,
+202    actual: impl Display,
+203) -> Diagnostic {
+204    error(
+205        message,
+206        span,
+207        format!("this has type `{actual}`; expected type `{expected}`"),
+208    )
+209}
+210
+211pub fn not_yet_implemented(feature: impl Display, span: Span) -> Diagnostic {
+212    error(
+213        format!("feature not yet implemented: {feature}"),
+214        span,
+215        "not yet implemented",
+216    )
+217}
+218
+219pub fn duplicate_name_error(
+220    message: &str,
+221    name: &str,
+222    original: Span,
+223    duplicate: Span,
+224) -> Diagnostic {
+225    fancy_error(
+226        message,
+227        vec![
+228            Label::primary(original, format!("`{name}` first defined here")),
+229            Label::secondary(duplicate, format!("`{name}` redefined here")),
+230        ],
+231        vec![],
+232    )
+233}
+234
+235pub fn name_conflict_error(
+236    name_kind: &str, // Eg "function parameter" or "variable name"
+237    name: &str,
+238    original: &NamedThing,
+239    original_span: Option<Span>,
+240    duplicate_span: Span,
+241) -> Diagnostic {
+242    if let Some(original_span) = original_span {
+243        fancy_error(
+244            format!(
+245                "{} name `{}` conflicts with previously defined {}",
+246                name_kind,
+247                name,
+248                original.item_kind_display_name()
+249            ),
+250            vec![
+251                Label::primary(original_span, format!("`{name}` first defined here")),
+252                Label::secondary(duplicate_span, format!("`{name}` redefined here")),
+253            ],
+254            vec![],
+255        )
+256    } else {
+257        fancy_error(
+258            format!(
+259                "{} name `{}` conflicts with built-in {}",
+260                name_kind,
+261                name,
+262                original.item_kind_display_name()
+263            ),
+264            vec![Label::primary(
+265                duplicate_span,
+266                format!(
+267                    "`{}` is a built-in {}",
+268                    name,
+269                    original.item_kind_display_name()
+270                ),
+271            )],
+272            vec![],
+273        )
+274    }
+275}
+276
+277pub fn to_mem_error(span: Span) -> Diagnostic {
+278    fancy_error(
+279        "value must be copied to memory",
+280        vec![Label::primary(span, "this value is in storage")],
+281        vec![
+282            "Hint: values located in storage can be copied to memory using the `to_mem` function."
+283                .into(),
+284            "Example: `self.my_array.to_mem()`".into(),
+285        ],
+286    )
+287}
+288pub fn self_contract_type_error(span: Span, typ: &dyn Display) -> Diagnostic {
+289    fancy_error(
+290        format!("`self` can't be used where a contract of type `{typ}` is expected",),
+291        vec![Label::primary(span, "cannot use `self` here")],
+292        vec![format!(
+293            "Hint: Values of type `{typ}` represent external contracts.\n\
+294             To treat `self` as an external contract, use `{typ}(ctx.self_address())`."
+295        )],
+296    )
+297}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/lib.rs.html b/compiler-docs/src/fe_analyzer/lib.rs.html new file mode 100644 index 0000000000..0deca23be3 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/lib.rs.html @@ -0,0 +1,42 @@ +lib.rs - source

fe_analyzer/
lib.rs

1//! Fe semantic analysis.
+2//!
+3//! This library is used to analyze the semantics of a given Fe AST. It detects
+4//! any semantic errors within a given AST and produces a `Context` instance
+5//! that can be used to query contextual information attributed to AST nodes.
+6
+7pub mod builtins;
+8pub mod constants;
+9pub mod context;
+10pub mod db;
+11pub mod display;
+12pub mod errors;
+13pub mod namespace;
+14
+15mod operations;
+16mod traversal;
+17
+18pub use db::{AnalyzerDb, TestDb};
+19pub use traversal::pattern_analysis;
+20
+21use fe_common::diagnostics::Diagnostic;
+22use namespace::items::{IngotId, ModuleId};
+23
+24pub fn analyze_ingot(db: &dyn AnalyzerDb, ingot_id: IngotId) -> Result<(), Vec<Diagnostic>> {
+25    let diagnostics = ingot_id.diagnostics(db);
+26
+27    if diagnostics.is_empty() {
+28        Ok(())
+29    } else {
+30        Err(diagnostics)
+31    }
+32}
+33
+34pub fn analyze_module(db: &dyn AnalyzerDb, module_id: ModuleId) -> Result<(), Vec<Diagnostic>> {
+35    let diagnostics = module_id.diagnostics(db);
+36
+37    if diagnostics.is_empty() {
+38        Ok(())
+39    } else {
+40        Err(diagnostics)
+41    }
+42}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/namespace/items.rs.html b/compiler-docs/src/fe_analyzer/namespace/items.rs.html new file mode 100644 index 0000000000..e0c5c78d3f --- /dev/null +++ b/compiler-docs/src/fe_analyzer/namespace/items.rs.html @@ -0,0 +1,2167 @@ +items.rs - source

fe_analyzer/namespace/
items.rs

1use crate::constants::{EMITTABLE_TRAIT_NAME, INDEXED};
+2use crate::context::{self, Analysis, Constant, NamedThing};
+3use crate::display::{DisplayWithDb, Displayable};
+4use crate::errors::{self, IncompleteItem, TypeError};
+5use crate::namespace::types::{self, GenericType, Type, TypeId};
+6use crate::traversal::pragma::check_pragma_version;
+7use crate::AnalyzerDb;
+8use crate::{builtins, errors::ConstEvalError};
+9use fe_common::diagnostics::Diagnostic;
+10use fe_common::diagnostics::Label;
+11use fe_common::files::{common_prefix, Utf8Path};
+12use fe_common::utils::files::{BuildFiles, ProjectMode};
+13use fe_common::{impl_intern_key, FileKind, SourceFileId};
+14use fe_parser::ast::GenericParameter;
+15use fe_parser::node::{Node, Span};
+16use fe_parser::{ast, node::NodeId};
+17use indexmap::{indexmap, IndexMap};
+18use smallvec::SmallVec;
+19use smol_str::SmolStr;
+20use std::rc::Rc;
+21use std::{fmt, ops::Deref};
+22use strum::IntoEnumIterator;
+23
+24use super::types::TraitOrType;
+25
+26/// A named item. This does not include things inside of
+27/// a function body.
+28#[derive(Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Clone, Copy)]
+29pub enum Item {
+30    Ingot(IngotId),
+31    Module(ModuleId),
+32    Type(TypeDef),
+33    // GenericType probably shouldn't be a separate category.
+34    // Any of the items inside TypeDef (struct, alias, etc)
+35    // could be optionally generic.
+36    GenericType(GenericType),
+37    Trait(TraitId),
+38    Impl(ImplId),
+39    Function(FunctionId),
+40    Constant(ModuleConstantId),
+41    // Needed until we can represent keccak256 as a FunctionId.
+42    // We can't represent keccak256's arg type yet.
+43    BuiltinFunction(builtins::GlobalFunction),
+44    Intrinsic(builtins::Intrinsic),
+45    Attribute(AttributeId),
+46}
+47
+48impl Item {
+49    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+50        match self {
+51            Item::Type(id) => id.name(db),
+52            Item::Trait(id) => id.name(db),
+53            Item::Impl(id) => id.name(db),
+54            Item::GenericType(id) => id.name(),
+55            Item::Function(id) => id.name(db),
+56            Item::BuiltinFunction(id) => id.as_ref().into(),
+57            Item::Intrinsic(id) => id.as_ref().into(),
+58            Item::Constant(id) => id.name(db),
+59            Item::Ingot(id) => id.name(db),
+60            Item::Module(id) => id.name(db),
+61            Item::Attribute(id) => id.name(db),
+62        }
+63    }
+64
+65    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Option<Span> {
+66        match self {
+67            Item::Type(id) => id.name_span(db),
+68            Item::Trait(id) => Some(id.name_span(db)),
+69            Item::GenericType(_) => None,
+70            Item::Function(id) => Some(id.name_span(db)),
+71            Item::Constant(id) => Some(id.name_span(db)),
+72            Item::BuiltinFunction(_)
+73            | Item::Intrinsic(_)
+74            | Item::Ingot(_)
+75            | Item::Module(_)
+76            | Item::Impl(_)
+77            | Item::Attribute(_) => None,
+78        }
+79    }
+80
+81    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+82        match self {
+83            // TODO: Consider whether to allow `pub module`.
+84            Self::Ingot(_)
+85            | Self::Module(_)
+86            | Self::BuiltinFunction(_)
+87            | Self::Intrinsic(_)
+88            | Self::Impl(_)
+89            | Self::GenericType(_) => true,
+90            Self::Attribute(_) => false,
+91            Self::Type(id) => id.is_public(db),
+92            Self::Trait(id) => id.is_public(db),
+93            Self::Function(id) => id.is_public(db),
+94            Self::Constant(id) => id.is_public(db),
+95        }
+96    }
+97
+98    pub fn is_builtin(&self) -> bool {
+99        match self {
+100            Item::Type(TypeDef::Primitive(_))
+101            | Item::GenericType(_)
+102            | Item::BuiltinFunction(_)
+103            | Item::Intrinsic(_) => true,
+104            Item::Type(_)
+105            | Item::Trait(_)
+106            | Item::Impl(_)
+107            | Item::Function(_)
+108            | Item::Constant(_)
+109            | Item::Ingot(_)
+110            | Item::Attribute(_)
+111            | Item::Module(_) => false,
+112        }
+113    }
+114
+115    pub fn is_struct(&self, val: &StructId) -> bool {
+116        matches!(self, Item::Type(TypeDef::Struct(current)) if current == val)
+117    }
+118
+119    pub fn is_contract(&self) -> bool {
+120        matches!(self, Item::Type(TypeDef::Contract(_)))
+121    }
+122
+123    pub fn item_kind_display_name(&self) -> &'static str {
+124        match self {
+125            Item::Type(TypeDef::Struct(_)) => "struct",
+126            Item::Type(_) | Item::GenericType(_) => "type",
+127            Item::Trait(_) => "trait",
+128            Item::Impl(_) => "impl",
+129            Item::Function(_) | Item::BuiltinFunction(_) => "function",
+130            Item::Intrinsic(_) => "intrinsic function",
+131            Item::Constant(_) => "constant",
+132            Item::Ingot(_) => "ingot",
+133            Item::Module(_) => "module",
+134            Item::Attribute(_) => "attribute",
+135        }
+136    }
+137
+138    pub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>> {
+139        match self {
+140            Item::Ingot(ingot) => ingot.items(db),
+141            Item::Module(module) => module.items(db),
+142            Item::Type(val) => val.items(db),
+143            Item::GenericType(_)
+144            | Item::Trait(_)
+145            | Item::Impl(_)
+146            | Item::Function(_)
+147            | Item::Constant(_)
+148            | Item::BuiltinFunction(_)
+149            | Item::Attribute(_)
+150            | Item::Intrinsic(_) => Rc::new(indexmap! {}),
+151        }
+152    }
+153
+154    pub fn parent(&self, db: &dyn AnalyzerDb) -> Option<Item> {
+155        match self {
+156            Item::Type(id) => id.parent(db),
+157            Item::Trait(id) => Some(id.parent(db)),
+158            Item::Impl(id) => Some(id.parent(db)),
+159            Item::GenericType(_) => None,
+160            Item::Function(id) => Some(id.parent(db)),
+161            Item::Constant(id) => Some(id.parent(db)),
+162            Item::Module(id) => Some(id.parent(db)),
+163            Item::Attribute(id) => Some(id.parent(db)),
+164            Item::BuiltinFunction(_) | Item::Intrinsic(_) | Item::Ingot(_) => None,
+165        }
+166    }
+167
+168    pub fn module(&self, db: &dyn AnalyzerDb) -> Option<ModuleId> {
+169        if let Self::Module(id) = self {
+170            return Some(*id);
+171        }
+172
+173        let mut cur_item = *self;
+174        while let Some(item) = cur_item.parent(db) {
+175            if let Self::Module(id) = item {
+176                return Some(id);
+177            }
+178            cur_item = item;
+179        }
+180
+181        None
+182    }
+183
+184    pub fn path(&self, db: &dyn AnalyzerDb) -> Rc<[SmolStr]> {
+185        // The path is used to generate a yul identifier,
+186        // eg `foo::Bar::new` becomes `$$foo$Bar$new`.
+187        // Right now, the ingot name is the os path, so it could
+188        // be "my project/src".
+189        // For now, we'll just leave the ingot out of the path,
+190        // because we can only compile a single ingot anyway.
+191        match self.parent(db) {
+192            Some(Item::Ingot(_)) | None => [self.name(db)][..].into(),
+193            Some(parent) => {
+194                let mut path = parent.path(db).to_vec();
+195                path.push(self.name(db));
+196                path.into()
+197            }
+198        }
+199    }
+200
+201    pub fn dependency_graph(&self, db: &dyn AnalyzerDb) -> Option<Rc<DepGraph>> {
+202        match self {
+203            Item::Type(TypeDef::Contract(id)) => Some(id.dependency_graph(db)),
+204            Item::Type(TypeDef::Struct(id)) => Some(id.dependency_graph(db)),
+205            Item::Type(TypeDef::Enum(id)) => Some(id.dependency_graph(db)),
+206            Item::Function(id) => Some(id.dependency_graph(db)),
+207            _ => None,
+208        }
+209    }
+210
+211    pub fn resolve_path_segments(
+212        &self,
+213        db: &dyn AnalyzerDb,
+214        segments: &[Node<SmolStr>],
+215    ) -> Analysis<Option<NamedThing>> {
+216        let mut curr_item = NamedThing::Item(*self);
+217
+218        for node in segments {
+219            curr_item = match curr_item.resolve_path_segment(db, &node.kind) {
+220                Some(item) => item,
+221                None => {
+222                    return Analysis {
+223                        value: None,
+224                        diagnostics: Rc::new([errors::error(
+225                            "unresolved path item",
+226                            node.span,
+227                            "not found",
+228                        )]),
+229                    };
+230                }
+231            }
+232        }
+233
+234        Analysis {
+235            value: Some(curr_item),
+236            diagnostics: Rc::new([]),
+237        }
+238    }
+239
+240    pub fn function_sig(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionSigId> {
+241        match self {
+242            Item::Type(TypeDef::Contract(id)) => id.function(db, name).map(|fun| fun.sig(db)),
+243            Item::Type(TypeDef::Struct(id)) => id.function(db, name).map(|fun| fun.sig(db)),
+244            Item::Impl(id) => id.function(db, name).map(|fun| fun.sig(db)),
+245            Item::Trait(id) => id.function(db, name),
+246            _ => None,
+247        }
+248    }
+249
+250    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+251        match self {
+252            Item::Type(id) => id.sink_diagnostics(db, sink),
+253            Item::Trait(id) => id.sink_diagnostics(db, sink),
+254            Item::Impl(id) => id.sink_diagnostics(db, sink),
+255            Item::Function(id) => id.sink_diagnostics(db, sink),
+256            Item::GenericType(_)
+257            | Item::BuiltinFunction(_)
+258            | Item::Intrinsic(_)
+259            | Item::Attribute(_) => {}
+260            Item::Constant(id) => id.sink_diagnostics(db, sink),
+261            Item::Ingot(id) => id.sink_diagnostics(db, sink),
+262            Item::Module(id) => id.sink_diagnostics(db, sink),
+263        }
+264    }
+265
+266    pub fn attributes(&self, db: &dyn AnalyzerDb) -> Vec<AttributeId> {
+267        if let Some(Item::Module(module)) = self.parent(db) {
+268            let mut attributes = vec![];
+269            for item in module.all_items(db).iter() {
+270                if let Item::Attribute(attribute) = item {
+271                    attributes.push(*attribute);
+272                } else if item == self {
+273                    return attributes;
+274                } else {
+275                    attributes = vec![];
+276                }
+277            }
+278        }
+279
+280        vec![]
+281    }
+282}
+283
+284pub fn builtin_items() -> IndexMap<SmolStr, Item> {
+285    let mut items = indexmap! {
+286        SmolStr::new("bool") => Item::Type(TypeDef::Primitive(types::Base::Bool)),
+287        SmolStr::new("address") => Item::Type(TypeDef::Primitive(types::Base::Address)),
+288    };
+289    items.extend(types::Integer::iter().map(|typ| {
+290        (
+291            typ.as_ref().into(),
+292            Item::Type(TypeDef::Primitive(types::Base::Numeric(typ))),
+293        )
+294    }));
+295    items.extend(types::GenericType::iter().map(|typ| (typ.name(), Item::GenericType(typ))));
+296    items.extend(
+297        builtins::GlobalFunction::iter()
+298            .map(|fun| (fun.as_ref().into(), Item::BuiltinFunction(fun))),
+299    );
+300    items
+301        .extend(builtins::Intrinsic::iter().map(|fun| (fun.as_ref().into(), Item::Intrinsic(fun))));
+302    items
+303}
+304
+305#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
+306pub enum IngotMode {
+307    /// The target of compilation. Expected to have a main.fe file.
+308    Main,
+309    /// A library; expected to have a lib.fe file.
+310    Lib,
+311    /// A fake ingot, created to hold a single module with any filename.
+312    StandaloneModule,
+313}
+314
+315/// An `Ingot` is composed of a tree of `Module`s (set via
+316/// [`AnalyzerDb::set_ingot_module_tree`]), and doesn't have direct knowledge of
+317/// files.
+318#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+319pub struct Ingot {
+320    pub name: SmolStr,
+321    // pub version: SmolStr,
+322    pub mode: IngotMode,
+323    pub src_dir: SmolStr,
+324}
+325
+326#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+327pub struct IngotId(pub(crate) u32);
+328impl_intern_key!(IngotId);
+329impl IngotId {
+330    pub fn std_lib(db: &mut dyn AnalyzerDb) -> Self {
+331        let ingot = IngotId::from_files(
+332            db,
+333            "std",
+334            IngotMode::Lib,
+335            FileKind::Std,
+336            &fe_library::std_src_files(),
+337        );
+338        db.set_ingot_external_ingots(ingot, Rc::new(indexmap! {}));
+339        ingot
+340    }
+341
+342    pub fn from_build_files(db: &mut dyn AnalyzerDb, build_files: &BuildFiles) -> Self {
+343        let ingots: IndexMap<_, _> = build_files
+344            .project_files
+345            .iter()
+346            .map(|(project_path, project_files)| {
+347                let mode = match project_files.mode {
+348                    ProjectMode::Main => IngotMode::Main,
+349                    ProjectMode::Lib => IngotMode::Lib,
+350                };
+351                (
+352                    project_path,
+353                    IngotId::from_files(
+354                        db,
+355                        &project_files.name,
+356                        mode,
+357                        FileKind::Local,
+358                        &project_files.src,
+359                    ),
+360                )
+361            })
+362            .collect();
+363
+364        for (project_path, project_files) in &build_files.project_files {
+365            let mut deps = indexmap! {
+366                "std".into() => IngotId::std_lib(db)
+367            };
+368
+369            for dependency in &project_files.dependencies {
+370                deps.insert(
+371                    dependency.name.clone(),
+372                    ingots[&dependency.canonicalized_path],
+373                );
+374            }
+375
+376            db.set_ingot_external_ingots(ingots[&project_path], Rc::new(deps));
+377        }
+378
+379        let root_ingot = ingots[&build_files.root_project_path];
+380        db.set_root_ingot(root_ingot);
+381        root_ingot
+382    }
+383
+384    pub fn from_files(
+385        db: &mut dyn AnalyzerDb,
+386        name: &str,
+387        mode: IngotMode,
+388        file_kind: FileKind,
+389        files: &[(impl AsRef<str>, impl AsRef<str>)],
+390    ) -> Self {
+391        // The common prefix of all file paths will be stored as the ingot
+392        // src dir path, and all module file paths will be considered to be
+393        // relative to this prefix.
+394        let file_path_prefix = if files.len() == 1 {
+395            // If there's only one source file, the "common prefix" is everything
+396            // before the file name.
+397            Utf8Path::new(files[0].0.as_ref())
+398                .parent()
+399                .unwrap_or_else(|| "".into())
+400                .to_path_buf()
+401        } else {
+402            files
+403                .iter()
+404                .map(|(path, _)| Utf8Path::new(path).to_path_buf())
+405                .reduce(|pref, path| common_prefix(&pref, &path))
+406                .expect("`IngotId::from_files`: empty file list")
+407        };
+408
+409        let ingot = db.intern_ingot(Rc::new(Ingot {
+410            name: name.into(),
+411            mode,
+412            src_dir: file_path_prefix.as_str().into(),
+413        }));
+414
+415        // Intern the source files
+416        let file_ids = files
+417            .iter()
+418            .map(|(path, content)| {
+419                SourceFileId::new(
+420                    db.upcast_mut(),
+421                    file_kind,
+422                    path.as_ref(),
+423                    content.as_ref().into(),
+424                )
+425            })
+426            .collect();
+427
+428        db.set_ingot_files(ingot, file_ids);
+429        ingot
+430    }
+431
+432    pub fn external_ingots(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, IngotId>> {
+433        db.ingot_external_ingots(*self)
+434    }
+435
+436    pub fn all_modules(&self, db: &dyn AnalyzerDb) -> Rc<[ModuleId]> {
+437        db.ingot_modules(*self)
+438    }
+439
+440    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Ingot> {
+441        db.lookup_intern_ingot(*self)
+442    }
+443
+444    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+445        self.data(db).name.clone()
+446    }
+447
+448    /// Returns the `main.fe`, or `lib.fe` module, depending on the ingot "mode"
+449    /// (IngotMode).
+450    pub fn root_module(&self, db: &dyn AnalyzerDb) -> Option<ModuleId> {
+451        db.ingot_root_module(*self)
+452    }
+453
+454    pub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>> {
+455        self.root_module(db).expect("missing root module").items(db)
+456    }
+457
+458    pub fn diagnostics(&self, db: &dyn AnalyzerDb) -> Vec<Diagnostic> {
+459        let mut diagnostics = vec![];
+460        self.sink_diagnostics(db, &mut diagnostics);
+461        diagnostics
+462    }
+463
+464    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+465        if self.root_module(db).is_none() {
+466            let file_name = match self.data(db).mode {
+467                IngotMode::Lib => "lib",
+468                IngotMode::Main => "main",
+469                IngotMode::StandaloneModule => unreachable!(), // always has a root module
+470            };
+471            sink.push(&Diagnostic::error(format!(
+472                "The ingot named \"{}\" is missing a `{}` module. \
+473                 \nPlease add a `src/{}.fe` file to the base directory.",
+474                self.name(db),
+475                file_name,
+476                file_name,
+477            )));
+478        }
+479        for module in self.all_modules(db).iter() {
+480            module.sink_diagnostics(db, sink)
+481        }
+482    }
+483
+484    pub fn sink_external_ingot_diagnostics(
+485        &self,
+486        db: &dyn AnalyzerDb,
+487        sink: &mut impl DiagnosticSink,
+488    ) {
+489        for ingot in self.external_ingots(db).values() {
+490            ingot.sink_diagnostics(db, sink)
+491        }
+492    }
+493}
+494
+495#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+496pub enum ModuleSource {
+497    File(SourceFileId),
+498    /// For directory modules without a corresponding source file
+499    /// (which will soon not be allowed, and this variant can go away).
+500    Dir(SmolStr),
+501}
+502
+503#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+504pub struct Module {
+505    pub name: SmolStr,
+506    pub ingot: IngotId,
+507    pub source: ModuleSource,
+508}
+509
+510/// Id of a [`Module`], which corresponds to a single Fe source file.
+511#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+512pub struct ModuleId(pub(crate) u32);
+513impl_intern_key!(ModuleId);
+514impl ModuleId {
+515    pub fn new_standalone(db: &mut dyn AnalyzerDb, path: &str, content: &str) -> Self {
+516        let std = IngotId::std_lib(db);
+517        let ingot = IngotId::from_files(
+518            db,
+519            "",
+520            IngotMode::StandaloneModule,
+521            FileKind::Local,
+522            &[(path, content)],
+523        );
+524
+525        let deps = indexmap! { "std".into() => std };
+526        db.set_ingot_external_ingots(ingot, Rc::new(deps));
+527        db.set_root_ingot(ingot);
+528
+529        ingot
+530            .root_module(db)
+531            .expect("ModuleId::new_standalone ingot has no root module")
+532    }
+533
+534    pub fn new(db: &dyn AnalyzerDb, name: &str, source: ModuleSource, ingot: IngotId) -> Self {
+535        db.intern_module(
+536            Module {
+537                name: name.into(),
+538                ingot,
+539                source,
+540            }
+541            .into(),
+542        )
+543    }
+544
+545    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Module> {
+546        db.lookup_intern_module(*self)
+547    }
+548
+549    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+550        self.data(db).name.clone()
+551    }
+552
+553    pub fn file_path_relative_to_src_dir(&self, db: &dyn AnalyzerDb) -> SmolStr {
+554        db.module_file_path(*self)
+555    }
+556
+557    pub fn ast(&self, db: &dyn AnalyzerDb) -> Rc<ast::Module> {
+558        db.module_parse(*self).value
+559    }
+560
+561    pub fn ingot(&self, db: &dyn AnalyzerDb) -> IngotId {
+562        self.data(db).ingot
+563    }
+564
+565    pub fn is_incomplete(&self, db: &dyn AnalyzerDb) -> bool {
+566        db.module_is_incomplete(*self)
+567    }
+568
+569    pub fn is_in_std(&self, db: &dyn AnalyzerDb) -> bool {
+570        self.ingot(db).name(db) == "std"
+571    }
+572
+573    /// Includes duplicate names
+574    pub fn all_items(&self, db: &dyn AnalyzerDb) -> Rc<[Item]> {
+575        db.module_all_items(*self)
+576    }
+577
+578    /// Includes duplicate names
+579    pub fn all_impls(&self, db: &dyn AnalyzerDb) -> Rc<[ImplId]> {
+580        db.module_all_impls(*self).value
+581    }
+582
+583    pub fn impls(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<(TraitId, TypeId), ImplId>> {
+584        db.module_impl_map(*self).value
+585    }
+586
+587    /// Returns a map of the named items in the module
+588    pub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>> {
+589        db.module_item_map(*self).value
+590    }
+591
+592    /// Returns a `name -> (name_span, external_item)` map for all `use`
+593    /// statements in a module.
+594    pub fn used_items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, (Span, Item)>> {
+595        db.module_used_item_map(*self).value
+596    }
+597
+598    pub fn tests(&self, db: &dyn AnalyzerDb) -> Vec<FunctionId> {
+599        db.module_tests(*self)
+600    }
+601
+602    /// Returns `true` if the `item` is in scope of the module.
+603    pub fn is_in_scope(&self, db: &dyn AnalyzerDb, item: Item) -> bool {
+604        if let Some(val) = item.module(db) {
+605            if val == *self {
+606                return true;
+607            }
+608        }
+609
+610        if let Some((_, val)) = self.used_items(db).get(&item.name(db)) {
+611            if *val == item {
+612                return true;
+613            }
+614        }
+615        false
+616    }
+617
+618    /// Returns all of the internal items, except for `use`d items. This is used
+619    /// when resolving `use` statements, as it does not create a query
+620    /// cycle.
+621    pub fn non_used_internal_items(&self, db: &dyn AnalyzerDb) -> IndexMap<SmolStr, Item> {
+622        let global_items = self.global_items(db);
+623
+624        self.submodules(db)
+625            .iter()
+626            .map(|module| (module.name(db), Item::Module(*module)))
+627            .chain(global_items)
+628            .collect()
+629    }
+630
+631    /// Returns all of the internal items. Internal items refers to the set of
+632    /// items visible when inside of a module.
+633    pub fn internal_items(&self, db: &dyn AnalyzerDb) -> IndexMap<SmolStr, Item> {
+634        let global_items = self.global_items(db);
+635        let defined_items = self.items(db);
+636        self.submodules(db)
+637            .iter()
+638            .map(|module| (module.name(db), Item::Module(*module)))
+639            .chain(global_items)
+640            .chain(defined_items.deref().clone())
+641            .collect()
+642    }
+643
+644    /// Resolve a path that starts with an item defined in the module.
+645    pub fn resolve_path(
+646        &self,
+647        db: &dyn AnalyzerDb,
+648        path: &ast::Path,
+649    ) -> Analysis<Option<NamedThing>> {
+650        Item::Module(*self).resolve_path_segments(db, &path.segments)
+651    }
+652
+653    /// Resolve a path that starts with an internal item. We omit used items to
+654    /// avoid a query cycle.
+655    pub fn resolve_path_non_used_internal(
+656        &self,
+657        db: &dyn AnalyzerDb,
+658        path: &ast::Path,
+659    ) -> Analysis<Option<NamedThing>> {
+660        let segments = &path.segments;
+661        let first_segment = &segments[0];
+662
+663        if let Some(curr_item) = self.non_used_internal_items(db).get(&first_segment.kind) {
+664            curr_item.resolve_path_segments(db, &segments[1..])
+665        } else {
+666            Analysis {
+667                value: None,
+668                diagnostics: Rc::new([errors::error(
+669                    "unresolved path item",
+670                    first_segment.span,
+671                    "not found",
+672                )]),
+673            }
+674        }
+675    }
+676
+677    /// Resolve a path that starts with an internal item.
+678    pub fn resolve_path_internal(
+679        &self,
+680        db: &dyn AnalyzerDb,
+681        path: &ast::Path,
+682    ) -> Analysis<Option<NamedThing>> {
+683        let segments = &path.segments;
+684        let first_segment = &segments[0];
+685
+686        if let Some(curr_item) = self.internal_items(db).get(&first_segment.kind) {
+687            curr_item.resolve_path_segments(db, &segments[1..])
+688        } else {
+689            Analysis {
+690                value: None,
+691                diagnostics: Rc::new([errors::error(
+692                    "unresolved path item",
+693                    first_segment.span,
+694                    "not found",
+695                )]),
+696            }
+697        }
+698    }
+699
+700    /// Returns `Err(IncompleteItem)` if the name could not be resolved, and the
+701    /// module was not completely parsed (due to a syntax error).
+702    pub fn resolve_name(
+703        &self,
+704        db: &dyn AnalyzerDb,
+705        name: &str,
+706    ) -> Result<Option<NamedThing>, IncompleteItem> {
+707        if let Some(thing) = self.internal_items(db).get(name) {
+708            Ok(Some(NamedThing::Item(*thing)))
+709        } else if self.is_incomplete(db) {
+710            Err(IncompleteItem::new())
+711        } else {
+712            Ok(None)
+713        }
+714    }
+715
+716    pub fn resolve_constant(
+717        &self,
+718        db: &dyn AnalyzerDb,
+719        name: &str,
+720    ) -> Result<Option<ModuleConstantId>, IncompleteItem> {
+721        if let Some(constant) = self
+722            .all_constants(db)
+723            .iter()
+724            .find(|id| id.name(db) == name)
+725            .copied()
+726        {
+727            Ok(Some(constant))
+728        } else if self.is_incomplete(db) {
+729            Err(IncompleteItem::new())
+730        } else {
+731            Ok(None)
+732        }
+733    }
+734    pub fn submodules(&self, db: &dyn AnalyzerDb) -> Rc<[ModuleId]> {
+735        db.module_submodules(*self)
+736    }
+737
+738    pub fn parent(&self, db: &dyn AnalyzerDb) -> Item {
+739        self.parent_module(db)
+740            .map(Item::Module)
+741            .unwrap_or_else(|| Item::Ingot(self.ingot(db)))
+742    }
+743
+744    pub fn parent_module(&self, db: &dyn AnalyzerDb) -> Option<ModuleId> {
+745        db.module_parent_module(*self)
+746    }
+747
+748    /// All contracts, including from submodules and including duplicates
+749    pub fn all_contracts(&self, db: &dyn AnalyzerDb) -> Vec<ContractId> {
+750        self.submodules(db)
+751            .iter()
+752            .flat_map(|module| module.all_contracts(db))
+753            .chain((*db.module_contracts(*self)).to_vec())
+754            .collect::<Vec<_>>()
+755    }
+756
+757    /// All functions, including from submodules and including duplicates
+758    pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Vec<FunctionId> {
+759        self.items(db)
+760            .iter()
+761            .filter_map(|(_, item)| {
+762                if let Item::Function(function) = item {
+763                    Some(*function)
+764                } else {
+765                    None
+766                }
+767            })
+768            .collect()
+769    }
+770
+771    /// Returns the map of ingot deps, built-ins, and the ingot itself as
+772    /// "ingot".
+773    pub fn global_items(&self, db: &dyn AnalyzerDb) -> IndexMap<SmolStr, Item> {
+774        let ingot = self.ingot(db);
+775        let mut items = ingot
+776            .external_ingots(db)
+777            .iter()
+778            .map(|(name, ingot)| (name.clone(), Item::Ingot(*ingot)))
+779            .chain(builtin_items())
+780            .collect::<IndexMap<_, _>>();
+781
+782        if ingot.data(db).mode != IngotMode::StandaloneModule {
+783            items.insert("ingot".into(), Item::Ingot(ingot));
+784        }
+785        items
+786    }
+787
+788    /// All module constants.
+789    pub fn all_constants(&self, db: &dyn AnalyzerDb) -> Rc<Vec<ModuleConstantId>> {
+790        db.module_constants(*self)
+791    }
+792
+793    pub fn diagnostics(&self, db: &dyn AnalyzerDb) -> Vec<Diagnostic> {
+794        let mut diagnostics = vec![];
+795        self.sink_diagnostics(db, &mut diagnostics);
+796        diagnostics
+797    }
+798
+799    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+800        let data = self.data(db);
+801        if let ModuleSource::File(_) = data.source {
+802            sink.push_all(db.module_parse(*self).diagnostics.iter())
+803        }
+804        let ast = self.ast(db);
+805        for stmt in &ast.body {
+806            if let ast::ModuleStmt::Pragma(inner) = stmt {
+807                if let Some(diag) = check_pragma_version(inner) {
+808                    sink.push(&diag)
+809                }
+810            }
+811        }
+812
+813        // duplicate item name errors
+814        sink.push_all(db.module_item_map(*self).diagnostics.iter());
+815
+816        // duplicate impl errors
+817        sink.push_all(db.module_impl_map(*self).diagnostics.iter());
+818
+819        // errors for each item
+820        self.all_items(db)
+821            .iter()
+822            .for_each(|id| id.sink_diagnostics(db, sink));
+823
+824        self.all_impls(db)
+825            .iter()
+826            .for_each(|id| id.sink_diagnostics(db, sink));
+827    }
+828
+829    #[doc(hidden)]
+830    // DO NOT USE THIS METHOD except for testing purpose.
+831    pub fn from_raw_internal(raw: u32) -> Self {
+832        Self(raw)
+833    }
+834}
+835
+836#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+837pub struct ModuleConstant {
+838    pub ast: Node<ast::ConstantDecl>,
+839    pub module: ModuleId,
+840}
+841
+842#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+843pub struct ModuleConstantId(pub(crate) u32);
+844impl_intern_key!(ModuleConstantId);
+845
+846impl ModuleConstantId {
+847    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<ModuleConstant> {
+848        db.lookup_intern_module_const(*self)
+849    }
+850    pub fn span(&self, db: &dyn AnalyzerDb) -> Span {
+851        self.data(db).ast.span
+852    }
+853    pub fn typ(&self, db: &dyn AnalyzerDb) -> Result<types::TypeId, TypeError> {
+854        db.module_constant_type(*self).value
+855    }
+856
+857    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+858        self.data(db).ast.kind.name.kind.clone()
+859    }
+860
+861    pub fn constant_value(&self, db: &dyn AnalyzerDb) -> Result<Constant, ConstEvalError> {
+862        db.module_constant_value(*self).value
+863    }
+864
+865    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span {
+866        self.data(db).ast.kind.name.span
+867    }
+868
+869    pub fn value(&self, db: &dyn AnalyzerDb) -> ast::Expr {
+870        self.data(db).ast.kind.value.kind.clone()
+871    }
+872
+873    pub fn parent(&self, db: &dyn AnalyzerDb) -> Item {
+874        Item::Module(self.data(db).module)
+875    }
+876
+877    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+878        self.data(db).ast.kind.pub_qual.is_some()
+879    }
+880
+881    pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId {
+882        self.data(db).module
+883    }
+884
+885    pub fn node_id(&self, db: &dyn AnalyzerDb) -> NodeId {
+886        self.data(db).ast.id
+887    }
+888
+889    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+890        db.module_constant_type(*self)
+891            .diagnostics
+892            .iter()
+893            .for_each(|d| sink.push(d));
+894    }
+895}
+896
+897#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+898pub enum TypeDef {
+899    Alias(TypeAliasId),
+900    Struct(StructId),
+901    Enum(EnumId),
+902    Contract(ContractId),
+903    Primitive(types::Base),
+904}
+905
+906impl TypeDef {
+907    pub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>> {
+908        match self {
+909            TypeDef::Struct(val) => {
+910                // In the future we probably want to resolve instance methods as well. But this
+911                // would require the caller to pass an instance as the first
+912                // argument e.g. `Rectangle::can_hold(self_instance, other)`.
+913                // This isn't yet supported so for now path access to functions is limited to
+914                // static functions only.
+915                val.pure_functions_as_items(db)
+916            }
+917            TypeDef::Enum(val) => val.pure_functions_as_items(db),
+918            TypeDef::Contract(val) => val.pure_functions_as_items(db),
+919            _ => Rc::new(indexmap! {}),
+920        }
+921    }
+922
+923    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+924        match self {
+925            TypeDef::Alias(id) => id.name(db),
+926            TypeDef::Struct(id) => id.name(db),
+927            TypeDef::Enum(id) => id.name(db),
+928            TypeDef::Contract(id) => id.name(db),
+929            TypeDef::Primitive(typ) => typ.name(),
+930        }
+931    }
+932
+933    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Option<Span> {
+934        match self {
+935            TypeDef::Alias(id) => Some(id.name_span(db)),
+936            TypeDef::Struct(id) => Some(id.name_span(db)),
+937            TypeDef::Enum(id) => Some(id.name_span(db)),
+938            TypeDef::Contract(id) => Some(id.name_span(db)),
+939            TypeDef::Primitive(_) => None,
+940        }
+941    }
+942
+943    pub fn typ(&self, db: &dyn AnalyzerDb) -> Result<Type, TypeError> {
+944        match self {
+945            TypeDef::Alias(id) => Ok(id.type_id(db)?.typ(db)),
+946            TypeDef::Struct(id) => Ok(Type::Struct(*id)),
+947            TypeDef::Enum(id) => Ok(Type::Enum(*id)),
+948            TypeDef::Contract(id) => Ok(Type::Contract(*id)),
+949            TypeDef::Primitive(base) => Ok(Type::Base(*base)),
+950        }
+951    }
+952
+953    pub fn type_id(&self, db: &dyn AnalyzerDb) -> Result<TypeId, TypeError> {
+954        Ok(db.intern_type(self.typ(db)?))
+955    }
+956
+957    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+958        match self {
+959            Self::Alias(id) => id.is_public(db),
+960            Self::Struct(id) => id.is_public(db),
+961            Self::Enum(id) => id.is_public(db),
+962            Self::Contract(id) => id.is_public(db),
+963            Self::Primitive(_) => true,
+964        }
+965    }
+966
+967    pub fn parent(&self, db: &dyn AnalyzerDb) -> Option<Item> {
+968        match self {
+969            TypeDef::Alias(id) => Some(id.parent(db)),
+970            TypeDef::Struct(id) => Some(id.parent(db)),
+971            TypeDef::Enum(id) => Some(id.parent(db)),
+972            TypeDef::Contract(id) => Some(id.parent(db)),
+973            TypeDef::Primitive(_) => None,
+974        }
+975    }
+976
+977    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+978        match self {
+979            TypeDef::Alias(id) => id.sink_diagnostics(db, sink),
+980            TypeDef::Struct(id) => id.sink_diagnostics(db, sink),
+981            TypeDef::Enum(id) => id.sink_diagnostics(db, sink),
+982            TypeDef::Contract(id) => id.sink_diagnostics(db, sink),
+983            TypeDef::Primitive(_) => {}
+984        }
+985    }
+986}
+987
+988#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+989pub struct TypeAlias {
+990    pub ast: Node<ast::TypeAlias>,
+991    pub module: ModuleId,
+992}
+993
+994#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+995pub struct TypeAliasId(pub(crate) u32);
+996impl_intern_key!(TypeAliasId);
+997
+998impl TypeAliasId {
+999    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<TypeAlias> {
+1000        db.lookup_intern_type_alias(*self)
+1001    }
+1002    pub fn span(&self, db: &dyn AnalyzerDb) -> Span {
+1003        self.data(db).ast.span
+1004    }
+1005    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+1006        self.data(db).ast.name().into()
+1007    }
+1008    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span {
+1009        self.data(db).ast.kind.name.span
+1010    }
+1011    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+1012        self.data(db).ast.kind.pub_qual.is_some()
+1013    }
+1014    pub fn type_id(&self, db: &dyn AnalyzerDb) -> Result<types::TypeId, TypeError> {
+1015        db.type_alias_type(*self).value
+1016    }
+1017    pub fn parent(&self, db: &dyn AnalyzerDb) -> Item {
+1018        Item::Module(self.data(db).module)
+1019    }
+1020    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1021        db.type_alias_type(*self)
+1022            .diagnostics
+1023            .iter()
+1024            .for_each(|d| sink.push(d))
+1025    }
+1026}
+1027
+1028#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1029pub struct Contract {
+1030    pub name: SmolStr,
+1031    pub ast: Node<ast::Contract>,
+1032    pub module: ModuleId,
+1033}
+1034
+1035#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1036pub struct ContractId(pub(crate) u32);
+1037impl_intern_key!(ContractId);
+1038impl ContractId {
+1039    pub fn as_type(&self, db: &dyn AnalyzerDb) -> TypeId {
+1040        db.intern_type(Type::Contract(*self))
+1041    }
+1042    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Contract> {
+1043        db.lookup_intern_contract(*self)
+1044    }
+1045    pub fn span(&self, db: &dyn AnalyzerDb) -> Span {
+1046        self.data(db).ast.span
+1047    }
+1048    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+1049        self.data(db).ast.name().into()
+1050    }
+1051    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+1052        self.data(db).ast.kind.pub_qual.is_some()
+1053    }
+1054    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span {
+1055        self.data(db).ast.kind.name.span
+1056    }
+1057
+1058    pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId {
+1059        self.data(db).module
+1060    }
+1061
+1062    pub fn fields(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, ContractFieldId>> {
+1063        db.contract_field_map(*self).value
+1064    }
+1065
+1066    pub fn field_type(
+1067        &self,
+1068        db: &dyn AnalyzerDb,
+1069        name: &str,
+1070    ) -> Option<Result<types::TypeId, TypeError>> {
+1071        // Note: contract field types are wrapped in SPtr in `fn expr_attribute`
+1072        let fields = db.contract_field_map(*self).value;
+1073        Some(fields.get(name)?.typ(db))
+1074    }
+1075
+1076    pub fn resolve_name(
+1077        &self,
+1078        db: &dyn AnalyzerDb,
+1079        name: &str,
+1080    ) -> Result<Option<NamedThing>, IncompleteItem> {
+1081        if let Some(item) = self
+1082            .function(db, name)
+1083            .filter(|f| !f.takes_self(db))
+1084            .map(Item::Function)
+1085        {
+1086            Ok(Some(NamedThing::Item(item)))
+1087        } else {
+1088            self.module(db).resolve_name(db, name)
+1089        }
+1090    }
+1091
+1092    pub fn init_function(&self, db: &dyn AnalyzerDb) -> Option<FunctionId> {
+1093        db.contract_init_function(*self).value
+1094    }
+1095
+1096    pub fn call_function(&self, db: &dyn AnalyzerDb) -> Option<FunctionId> {
+1097        db.contract_call_function(*self).value
+1098    }
+1099
+1100    pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionId]> {
+1101        db.contract_all_functions(*self)
+1102    }
+1103
+1104    /// User functions, public and not. Excludes `__init__` and `__call__`.
+1105    pub fn functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionId>> {
+1106        db.contract_function_map(*self).value
+1107    }
+1108
+1109    /// Lookup a function by name. Searches all user functions, private or not.
+1110    /// Excludes `__init__` and `__call__`.
+1111    pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionId> {
+1112        self.functions(db).get(name).copied()
+1113    }
+1114
+1115    /// Excludes `__init__` and `__call__`.
+1116    pub fn public_functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionId>> {
+1117        db.contract_public_function_map(*self)
+1118    }
+1119
+1120    pub fn parent(&self, db: &dyn AnalyzerDb) -> Item {
+1121        Item::Module(self.data(db).module)
+1122    }
+1123
+1124    /// Dependency graph of the contract type, which consists of the field types
+1125    /// and the dependencies of those types.
+1126    ///
+1127    /// NOTE: Contract items should *only*
+1128    pub fn dependency_graph(&self, db: &dyn AnalyzerDb) -> Rc<DepGraph> {
+1129        db.contract_dependency_graph(*self).0
+1130    }
+1131
+1132    /// Dependency graph of the (imaginary) `__call__` function, which
+1133    /// dispatches to the contract's public functions.
+1134    pub fn runtime_dependency_graph(&self, db: &dyn AnalyzerDb) -> Rc<DepGraph> {
+1135        db.contract_runtime_dependency_graph(*self).0
+1136    }
+1137
+1138    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1139        // fields
+1140        db.contract_field_map(*self).sink_diagnostics(sink);
+1141        db.contract_all_fields(*self)
+1142            .iter()
+1143            .for_each(|field| field.sink_diagnostics(db, sink));
+1144
+1145        // functions
+1146        db.contract_init_function(*self).sink_diagnostics(sink);
+1147        db.contract_call_function(*self).sink_diagnostics(sink);
+1148        db.contract_function_map(*self).sink_diagnostics(sink);
+1149        db.contract_all_functions(*self)
+1150            .iter()
+1151            .for_each(|id| id.sink_diagnostics(db, sink));
+1152    }
+1153}
+1154
+1155#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1156pub struct ContractField {
+1157    pub ast: Node<ast::Field>,
+1158    pub parent: ContractId,
+1159}
+1160
+1161#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1162pub struct ContractFieldId(pub(crate) u32);
+1163impl_intern_key!(ContractFieldId);
+1164impl ContractFieldId {
+1165    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+1166        self.data(db).ast.name().into()
+1167    }
+1168    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<ContractField> {
+1169        db.lookup_intern_contract_field(*self)
+1170    }
+1171    pub fn typ(&self, db: &dyn AnalyzerDb) -> Result<types::TypeId, TypeError> {
+1172        db.contract_field_type(*self).value
+1173    }
+1174    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1175        sink.push_all(db.contract_field_type(*self).diagnostics.iter())
+1176    }
+1177}
+1178
+1179#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1180pub struct FunctionSig {
+1181    pub ast: Node<ast::FunctionSignature>,
+1182    pub parent: Option<Item>,
+1183    pub module: ModuleId,
+1184}
+1185
+1186#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1187pub struct FunctionSigId(pub(crate) u32);
+1188impl_intern_key!(FunctionSigId);
+1189
+1190impl FunctionSigId {
+1191    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<FunctionSig> {
+1192        db.lookup_intern_function_sig(*self)
+1193    }
+1194
+1195    pub fn takes_self(&self, db: &dyn AnalyzerDb) -> bool {
+1196        self.signature(db).self_decl.is_some()
+1197    }
+1198
+1199    pub fn self_type(&self, db: &dyn AnalyzerDb) -> Option<types::TypeId> {
+1200        match self.parent(db) {
+1201            Item::Type(TypeDef::Contract(cid)) => Some(types::Type::SelfContract(cid).id(db)),
+1202            Item::Type(TypeDef::Struct(sid)) => Some(types::Type::Struct(sid).id(db)),
+1203            Item::Type(TypeDef::Enum(sid)) => Some(types::Type::Enum(sid).id(db)),
+1204            Item::Impl(id) => Some(id.receiver(db)),
+1205            Item::Type(TypeDef::Primitive(ty)) => Some(db.intern_type(Type::Base(ty))),
+1206            _ => None,
+1207        }
+1208    }
+1209    pub fn self_span(&self, db: &dyn AnalyzerDb) -> Option<Span> {
+1210        Some(self.signature(db).self_decl?.span)
+1211    }
+1212    pub fn signature(&self, db: &dyn AnalyzerDb) -> Rc<types::FunctionSignature> {
+1213        db.function_signature(*self).value
+1214    }
+1215
+1216    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+1217        self.is_trait_fn(db) || self.is_impl_fn(db) || self.pub_span(db).is_some()
+1218    }
+1219    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+1220        self.data(db).ast.kind.name.kind.clone()
+1221    }
+1222    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span {
+1223        self.data(db).ast.kind.name.span
+1224    }
+1225    pub fn unsafe_span(&self, db: &dyn AnalyzerDb) -> Option<Span> {
+1226        self.data(db).ast.kind.unsafe_
+1227    }
+1228    pub fn is_constructor(&self, db: &dyn AnalyzerDb) -> bool {
+1229        self.name(db) == "__init__"
+1230    }
+1231    pub fn pub_span(&self, db: &dyn AnalyzerDb) -> Option<Span> {
+1232        self.data(db).ast.kind.pub_
+1233    }
+1234
+1235    pub fn self_item(&self, db: &dyn AnalyzerDb) -> Option<Item> {
+1236        let data = self.data(db);
+1237        data.parent
+1238    }
+1239
+1240    pub fn parent(&self, db: &dyn AnalyzerDb) -> Item {
+1241        self.self_item(db)
+1242            .unwrap_or_else(|| Item::Module(self.module(db)))
+1243    }
+1244
+1245    /// Looks up the `FunctionId` based on the parent of the function signature
+1246    pub fn function(&self, db: &dyn AnalyzerDb) -> Option<FunctionId> {
+1247        match self.parent(db) {
+1248            Item::Type(TypeDef::Struct(id)) => id.function(db, &self.name(db)),
+1249            Item::Type(TypeDef::Enum(id)) => id.function(db, &self.name(db)),
+1250            Item::Impl(id) => id.function(db, &self.name(db)),
+1251            Item::Type(TypeDef::Contract(id)) => id.function(db, &self.name(db)),
+1252            _ => None,
+1253        }
+1254    }
+1255
+1256    pub fn is_trait_fn(&self, db: &dyn AnalyzerDb) -> bool {
+1257        matches!(self.parent(db), Item::Trait(_))
+1258    }
+1259
+1260    pub fn is_module_fn(&self, db: &dyn AnalyzerDb) -> bool {
+1261        matches!(self.parent(db), Item::Module(_))
+1262    }
+1263
+1264    pub fn is_impl_fn(&self, db: &dyn AnalyzerDb) -> bool {
+1265        matches!(self.parent(db), Item::Impl(_))
+1266    }
+1267
+1268    pub fn is_generic(&self, db: &dyn AnalyzerDb) -> bool {
+1269        !self.data(db).ast.kind.generic_params.kind.is_empty()
+1270    }
+1271
+1272    pub fn generic_params(&self, db: &dyn AnalyzerDb) -> Vec<GenericParameter> {
+1273        self.data(db).ast.kind.generic_params.kind.clone()
+1274    }
+1275
+1276    pub fn generic_param(&self, db: &dyn AnalyzerDb, param_name: &str) -> Option<GenericParameter> {
+1277        self.generic_params(db)
+1278            .iter()
+1279            .find(|param| match param {
+1280                GenericParameter::Unbounded(name) if name.kind == param_name => true,
+1281                GenericParameter::Bounded { name, .. } if name.kind == param_name => true,
+1282                _ => false,
+1283            })
+1284            .cloned()
+1285    }
+1286
+1287    pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId {
+1288        self.data(db).module
+1289    }
+1290
+1291    pub fn is_contract_func(self, db: &dyn AnalyzerDb) -> bool {
+1292        matches! {self.parent(db), Item::Type(TypeDef::Contract(_))}
+1293    }
+1294
+1295    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1296        sink.push_all(db.function_signature(*self).diagnostics.iter());
+1297    }
+1298}
+1299
+1300#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1301pub struct Function {
+1302    pub ast: Node<ast::Function>,
+1303    pub sig: FunctionSigId,
+1304}
+1305
+1306impl Function {
+1307    pub fn new(
+1308        db: &dyn AnalyzerDb,
+1309        ast: &Node<ast::Function>,
+1310        parent: Option<Item>,
+1311        module: ModuleId,
+1312    ) -> Self {
+1313        let sig = db.intern_function_sig(Rc::new(FunctionSig {
+1314            ast: ast.kind.sig.clone(),
+1315            parent,
+1316            module,
+1317        }));
+1318        Function {
+1319            sig,
+1320            ast: ast.clone(),
+1321        }
+1322    }
+1323}
+1324
+1325#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1326pub struct FunctionId(pub(crate) u32);
+1327impl_intern_key!(FunctionId);
+1328impl FunctionId {
+1329    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Function> {
+1330        db.lookup_intern_function(*self)
+1331    }
+1332    pub fn span(&self, db: &dyn AnalyzerDb) -> Span {
+1333        self.data(db).ast.span
+1334    }
+1335    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+1336        self.sig(db).name(db)
+1337    }
+1338    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span {
+1339        self.sig(db).name_span(db)
+1340    }
+1341    pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId {
+1342        self.sig(db).module(db)
+1343    }
+1344    pub fn self_type(&self, db: &dyn AnalyzerDb) -> Option<types::TypeId> {
+1345        self.sig(db).self_type(db)
+1346    }
+1347    pub fn parent(&self, db: &dyn AnalyzerDb) -> Item {
+1348        self.sig(db).parent(db)
+1349    }
+1350
+1351    pub fn takes_self(&self, db: &dyn AnalyzerDb) -> bool {
+1352        self.sig(db).takes_self(db)
+1353    }
+1354    pub fn self_span(&self, db: &dyn AnalyzerDb) -> Option<Span> {
+1355        self.sig(db).self_span(db)
+1356    }
+1357    pub fn is_generic(&self, db: &dyn AnalyzerDb) -> bool {
+1358        self.sig(db).is_generic(db)
+1359    }
+1360    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+1361        self.sig(db).is_public(db)
+1362    }
+1363    pub fn is_constructor(&self, db: &dyn AnalyzerDb) -> bool {
+1364        self.sig(db).is_constructor(db)
+1365    }
+1366    pub fn is_unsafe(&self, db: &dyn AnalyzerDb) -> bool {
+1367        self.unsafe_span(db).is_some()
+1368    }
+1369    pub fn unsafe_span(&self, db: &dyn AnalyzerDb) -> Option<Span> {
+1370        self.sig(db).unsafe_span(db)
+1371    }
+1372    pub fn signature(&self, db: &dyn AnalyzerDb) -> Rc<types::FunctionSignature> {
+1373        db.function_signature(self.data(db).sig).value
+1374    }
+1375    pub fn sig(&self, db: &dyn AnalyzerDb) -> FunctionSigId {
+1376        self.data(db).sig
+1377    }
+1378    pub fn body(&self, db: &dyn AnalyzerDb) -> Rc<context::FunctionBody> {
+1379        db.function_body(*self).value
+1380    }
+1381    pub fn dependency_graph(&self, db: &dyn AnalyzerDb) -> Rc<DepGraph> {
+1382        db.function_dependency_graph(*self).0
+1383    }
+1384    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1385        sink.push_all(db.function_signature(self.data(db).sig).diagnostics.iter());
+1386        sink.push_all(db.function_body(*self).diagnostics.iter());
+1387    }
+1388    pub fn is_contract_func(self, db: &dyn AnalyzerDb) -> bool {
+1389        self.sig(db).is_contract_func(db)
+1390    }
+1391
+1392    pub fn is_test(&self, db: &dyn AnalyzerDb) -> bool {
+1393        Item::Function(*self)
+1394            .attributes(db)
+1395            .iter()
+1396            .any(|attribute| attribute.name(db) == "test")
+1397    }
+1398}
+1399
+1400trait FunctionsAsItems {
+1401    fn functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionId>>;
+1402
+1403    fn pure_functions_as_items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>> {
+1404        Rc::new(
+1405            self.functions(db)
+1406                .iter()
+1407                .filter_map(|(name, field)| {
+1408                    if field.takes_self(db) {
+1409                        None
+1410                    } else {
+1411                        Some((name.to_owned(), Item::Function(*field)))
+1412                    }
+1413                })
+1414                .collect(),
+1415        )
+1416    }
+1417}
+1418
+1419impl FunctionsAsItems for StructId {
+1420    fn functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionId>> {
+1421        self.functions(db)
+1422    }
+1423}
+1424
+1425impl FunctionsAsItems for EnumId {
+1426    fn functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionId>> {
+1427        self.functions(db)
+1428    }
+1429}
+1430
+1431impl FunctionsAsItems for ContractId {
+1432    fn functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionId>> {
+1433        self.functions(db)
+1434    }
+1435}
+1436
+1437#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1438pub struct Struct {
+1439    pub ast: Node<ast::Struct>,
+1440    pub module: ModuleId,
+1441}
+1442
+1443#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1444pub struct StructId(pub(crate) u32);
+1445impl_intern_key!(StructId);
+1446impl StructId {
+1447    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Struct> {
+1448        db.lookup_intern_struct(*self)
+1449    }
+1450    pub fn span(&self, db: &dyn AnalyzerDb) -> Span {
+1451        self.data(db).ast.span
+1452    }
+1453    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+1454        self.data(db).ast.name().into()
+1455    }
+1456    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span {
+1457        self.data(db).ast.kind.name.span
+1458    }
+1459
+1460    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+1461        self.data(db).ast.kind.pub_qual.is_some()
+1462    }
+1463
+1464    pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId {
+1465        self.data(db).module
+1466    }
+1467
+1468    pub fn as_type(&self, db: &dyn AnalyzerDb) -> TypeId {
+1469        db.intern_type(Type::Struct(*self))
+1470    }
+1471
+1472    pub fn has_private_field(&self, db: &dyn AnalyzerDb) -> bool {
+1473        self.fields(db).values().any(|field| !field.is_public(db))
+1474    }
+1475
+1476    pub fn field(&self, db: &dyn AnalyzerDb, name: &str) -> Option<StructFieldId> {
+1477        self.fields(db).get(name).copied()
+1478    }
+1479
+1480    pub fn fields(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, StructFieldId>> {
+1481        db.struct_field_map(*self).value
+1482    }
+1483
+1484    pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionId]> {
+1485        db.struct_all_functions(*self)
+1486    }
+1487
+1488    pub fn functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionId>> {
+1489        db.struct_function_map(*self).value
+1490    }
+1491    pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionId> {
+1492        self.functions(db).get(name).copied()
+1493    }
+1494    pub fn parent(&self, db: &dyn AnalyzerDb) -> Item {
+1495        Item::Module(self.data(db).module)
+1496    }
+1497    pub fn dependency_graph(&self, db: &dyn AnalyzerDb) -> Rc<DepGraph> {
+1498        db.struct_dependency_graph(*self).value.0
+1499    }
+1500    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1501        sink.push_all(db.struct_field_map(*self).diagnostics.iter());
+1502        sink.push_all(db.struct_dependency_graph(*self).diagnostics.iter());
+1503
+1504        db.struct_all_fields(*self)
+1505            .iter()
+1506            .for_each(|id| id.sink_diagnostics(db, sink));
+1507
+1508        db.struct_function_map(*self).sink_diagnostics(sink);
+1509        db.struct_all_functions(*self)
+1510            .iter()
+1511            .for_each(|id| id.sink_diagnostics(db, sink));
+1512    }
+1513}
+1514
+1515#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1516pub struct StructField {
+1517    pub ast: Node<ast::Field>,
+1518    pub parent: StructId,
+1519}
+1520
+1521#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1522pub struct StructFieldId(pub(crate) u32);
+1523impl_intern_key!(StructFieldId);
+1524impl StructFieldId {
+1525    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+1526        self.data(db).ast.name().into()
+1527    }
+1528    pub fn span(&self, db: &dyn AnalyzerDb) -> Span {
+1529        self.data(db).ast.span
+1530    }
+1531    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<StructField> {
+1532        db.lookup_intern_struct_field(*self)
+1533    }
+1534    pub fn attributes(&self, db: &dyn AnalyzerDb) -> Vec<SmolStr> {
+1535        self.data(db)
+1536            .ast
+1537            .kind
+1538            .attributes
+1539            .iter()
+1540            .map(|node| node.kind.clone())
+1541            .collect()
+1542    }
+1543
+1544    pub fn is_indexed(&self, db: &dyn AnalyzerDb) -> bool {
+1545        self.attributes(db).contains(&INDEXED.into())
+1546    }
+1547
+1548    pub fn typ(&self, db: &dyn AnalyzerDb) -> Result<types::TypeId, TypeError> {
+1549        db.struct_field_type(*self).value
+1550    }
+1551    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+1552        self.data(db).ast.kind.is_pub
+1553    }
+1554
+1555    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1556        db.struct_field_type(*self).sink_diagnostics(sink)
+1557    }
+1558}
+1559
+1560#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1561pub struct Attribute {
+1562    pub ast: Node<SmolStr>,
+1563    pub module: ModuleId,
+1564}
+1565#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1566pub struct AttributeId(pub(crate) u32);
+1567impl_intern_key!(AttributeId);
+1568
+1569impl AttributeId {
+1570    pub fn data(self, db: &dyn AnalyzerDb) -> Rc<Attribute> {
+1571        db.lookup_intern_attribute(self)
+1572    }
+1573    pub fn span(self, db: &dyn AnalyzerDb) -> Span {
+1574        self.data(db).ast.span
+1575    }
+1576    pub fn name(self, db: &dyn AnalyzerDb) -> SmolStr {
+1577        self.data(db).ast.kind.to_owned()
+1578    }
+1579
+1580    pub fn module(self, db: &dyn AnalyzerDb) -> ModuleId {
+1581        self.data(db).module
+1582    }
+1583
+1584    pub fn parent(self, db: &dyn AnalyzerDb) -> Item {
+1585        Item::Module(self.data(db).module)
+1586    }
+1587}
+1588
+1589#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1590pub struct Enum {
+1591    pub ast: Node<ast::Enum>,
+1592    pub module: ModuleId,
+1593}
+1594#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1595pub struct EnumId(pub(crate) u32);
+1596impl_intern_key!(EnumId);
+1597
+1598impl EnumId {
+1599    pub fn data(self, db: &dyn AnalyzerDb) -> Rc<Enum> {
+1600        db.lookup_intern_enum(self)
+1601    }
+1602    pub fn span(self, db: &dyn AnalyzerDb) -> Span {
+1603        self.data(db).ast.span
+1604    }
+1605    pub fn name(self, db: &dyn AnalyzerDb) -> SmolStr {
+1606        self.data(db).ast.name().into()
+1607    }
+1608    pub fn name_span(self, db: &dyn AnalyzerDb) -> Span {
+1609        self.data(db).ast.kind.name.span
+1610    }
+1611
+1612    pub fn as_type(self, db: &dyn AnalyzerDb) -> TypeId {
+1613        db.intern_type(Type::Enum(self))
+1614    }
+1615
+1616    pub fn is_public(self, db: &dyn AnalyzerDb) -> bool {
+1617        self.data(db).ast.kind.pub_qual.is_some()
+1618    }
+1619
+1620    pub fn variant(self, db: &dyn AnalyzerDb, name: &str) -> Option<EnumVariantId> {
+1621        self.variants(db).get(name).copied()
+1622    }
+1623
+1624    pub fn variants(self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, EnumVariantId>> {
+1625        db.enum_variant_map(self).value
+1626    }
+1627
+1628    pub fn module(self, db: &dyn AnalyzerDb) -> ModuleId {
+1629        self.data(db).module
+1630    }
+1631
+1632    pub fn parent(self, db: &dyn AnalyzerDb) -> Item {
+1633        Item::Module(self.data(db).module)
+1634    }
+1635
+1636    pub fn dependency_graph(self, db: &dyn AnalyzerDb) -> Rc<DepGraph> {
+1637        db.enum_dependency_graph(self).value.0
+1638    }
+1639
+1640    pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionId]> {
+1641        db.enum_all_functions(*self)
+1642    }
+1643
+1644    pub fn functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionId>> {
+1645        db.enum_function_map(*self).value
+1646    }
+1647
+1648    pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionId> {
+1649        self.functions(db).get(name).copied()
+1650    }
+1651
+1652    pub fn sink_diagnostics(self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1653        sink.push_all(db.enum_variant_map(self).diagnostics.iter());
+1654        sink.push_all(db.enum_dependency_graph(self).diagnostics.iter());
+1655
+1656        db.enum_all_variants(self)
+1657            .iter()
+1658            .for_each(|variant| variant.sink_diagnostics(db, sink));
+1659
+1660        db.enum_function_map(self).sink_diagnostics(sink);
+1661        db.enum_all_functions(self)
+1662            .iter()
+1663            .for_each(|id| id.sink_diagnostics(db, sink));
+1664    }
+1665}
+1666
+1667#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1668pub struct EnumVariant {
+1669    pub ast: Node<ast::Variant>,
+1670    pub tag: usize,
+1671    pub parent: EnumId,
+1672}
+1673
+1674#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1675pub struct EnumVariantId(pub(crate) u32);
+1676impl_intern_key!(EnumVariantId);
+1677impl EnumVariantId {
+1678    pub fn data(self, db: &dyn AnalyzerDb) -> Rc<EnumVariant> {
+1679        db.lookup_intern_enum_variant(self)
+1680    }
+1681    pub fn name(self, db: &dyn AnalyzerDb) -> SmolStr {
+1682        self.data(db).ast.name().into()
+1683    }
+1684    pub fn span(self, db: &dyn AnalyzerDb) -> Span {
+1685        self.data(db).ast.span
+1686    }
+1687    pub fn name_with_parent(self, db: &dyn AnalyzerDb) -> SmolStr {
+1688        let parent = self.parent(db);
+1689        format!("{}::{}", parent.name(db), self.name(db)).into()
+1690    }
+1691
+1692    pub fn kind(self, db: &dyn AnalyzerDb) -> Result<EnumVariantKind, TypeError> {
+1693        db.enum_variant_kind(self).value
+1694    }
+1695
+1696    pub fn disc(self, db: &dyn AnalyzerDb) -> usize {
+1697        self.data(db).tag
+1698    }
+1699
+1700    pub fn sink_diagnostics(self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1701        db.enum_variant_kind(self).sink_diagnostics(sink)
+1702    }
+1703
+1704    pub fn parent(self, db: &dyn AnalyzerDb) -> EnumId {
+1705        self.data(db).parent
+1706    }
+1707}
+1708
+1709#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1710pub enum EnumVariantKind {
+1711    Unit,
+1712    Tuple(SmallVec<[TypeId; 4]>),
+1713}
+1714
+1715impl EnumVariantKind {
+1716    pub fn display_name(&self) -> &'static str {
+1717        match self {
+1718            Self::Unit => "unit variant",
+1719            Self::Tuple(..) => "tuple variant",
+1720        }
+1721    }
+1722
+1723    pub fn field_len(&self) -> usize {
+1724        match self {
+1725            Self::Unit => 0,
+1726            Self::Tuple(elts) => elts.len(),
+1727        }
+1728    }
+1729
+1730    pub fn is_unit(&self) -> bool {
+1731        matches!(self, Self::Unit)
+1732    }
+1733}
+1734
+1735impl DisplayWithDb for EnumVariantKind {
+1736    fn format(&self, db: &dyn AnalyzerDb, f: &mut fmt::Formatter) -> fmt::Result {
+1737        match self {
+1738            Self::Unit => write!(f, "unit"),
+1739            Self::Tuple(elts) => {
+1740                write!(f, "(")?;
+1741                let mut delim = "";
+1742                for ty in elts {
+1743                    write!(f, "{delim}")?;
+1744                    ty.format(db, f)?;
+1745                    delim = ", ";
+1746                }
+1747                write!(f, ")")
+1748            }
+1749        }
+1750    }
+1751}
+1752
+1753#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+1754pub struct Impl {
+1755    pub trait_id: TraitId,
+1756    pub receiver: TypeId,
+1757    pub module: ModuleId,
+1758    pub ast: Node<ast::Impl>,
+1759}
+1760
+1761#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+1762pub struct ImplId(pub(crate) u32);
+1763impl_intern_key!(ImplId);
+1764impl ImplId {
+1765    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Impl> {
+1766        db.lookup_intern_impl(*self)
+1767    }
+1768    pub fn span(&self, db: &dyn AnalyzerDb) -> Span {
+1769        self.data(db).ast.span
+1770    }
+1771
+1772    pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId {
+1773        self.data(db).module
+1774    }
+1775
+1776    pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionId]> {
+1777        db.impl_all_functions(*self)
+1778    }
+1779
+1780    pub fn trait_id(&self, db: &dyn AnalyzerDb) -> TraitId {
+1781        self.data(db).trait_id
+1782    }
+1783
+1784    pub fn receiver(&self, db: &dyn AnalyzerDb) -> TypeId {
+1785        self.data(db).receiver
+1786    }
+1787
+1788    /// Returns `true` if `other` either is `Self` or the type of the receiver
+1789    pub fn is_receiver_type(&self, other: TypeId, db: &dyn AnalyzerDb) -> bool {
+1790        other == self.receiver(db)
+1791            || other == Type::SelfType(TraitOrType::TypeId(self.receiver(db))).id(db)
+1792    }
+1793
+1794    /// Returns `true` if the `type_in_impl` can stand in for the `type_in_trait` as a type used
+1795    /// for a parameter or as a return type
+1796    pub fn can_stand_in_for(
+1797        &self,
+1798        db: &dyn AnalyzerDb,
+1799        type_in_impl: TypeId,
+1800        type_in_trait: TypeId,
+1801    ) -> bool {
+1802        if type_in_impl == type_in_trait {
+1803            true
+1804        } else {
+1805            self.is_receiver_type(type_in_impl, db)
+1806                && (type_in_trait.is_self_ty(db) || type_in_trait == self.receiver(db))
+1807        }
+1808    }
+1809
+1810    pub fn ast(&self, db: &dyn AnalyzerDb) -> Node<ast::Impl> {
+1811        self.data(db).ast.clone()
+1812    }
+1813
+1814    pub fn functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionId>> {
+1815        db.impl_function_map(*self).value
+1816    }
+1817    pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionId> {
+1818        self.functions(db).get(name).copied()
+1819    }
+1820    pub fn parent(&self, db: &dyn AnalyzerDb) -> Item {
+1821        Item::Module(self.data(db).module)
+1822    }
+1823    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+1824        format!(
+1825            "{}_{}",
+1826            self.trait_id(db).name(db),
+1827            self.receiver(db).display(db)
+1828        )
+1829        .into()
+1830    }
+1831
+1832    fn validate_type_or_trait_is_in_ingot(
+1833        &self,
+1834        db: &dyn AnalyzerDb,
+1835        sink: &mut impl DiagnosticSink,
+1836        type_ingot: Option<IngotId>,
+1837    ) {
+1838        let impl_ingot = self.data(db).module.ingot(db);
+1839        let is_allowed = match type_ingot {
+1840            None => impl_ingot == self.data(db).trait_id.module(db).ingot(db),
+1841            Some(val) => {
+1842                val == impl_ingot || self.data(db).trait_id.module(db).ingot(db) == impl_ingot
+1843            }
+1844        };
+1845
+1846        if !is_allowed {
+1847            sink.push(&errors::fancy_error(
+1848                "illegal `impl`. Either type or trait must be in the same ingot as the `impl`",
+1849                vec![Label::primary(
+1850                    self.data(db).ast.span,
+1851                    format!(
+1852                        "Neither `{}` nor `{}` are in the ingot of the `impl` block",
+1853                        self.data(db).receiver.display(db),
+1854                        self.data(db).trait_id.name(db)
+1855                    ),
+1856                )],
+1857                vec![],
+1858            ))
+1859        }
+1860    }
+1861
+1862    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+1863        match &self.data(db).receiver.typ(db) {
+1864            Type::Contract(_)
+1865            | Type::Map(_)
+1866            | Type::SelfContract(_)
+1867            | Type::Generic(_)
+1868            | Type::SelfType(_) => sink.push(&errors::fancy_error(
+1869                format!(
+1870                    "`impl` blocks aren't allowed for {}",
+1871                    self.data(db).receiver.display(db)
+1872                ),
+1873                vec![Label::primary(
+1874                    self.data(db).ast.span,
+1875                    "illegal `impl` block",
+1876                )],
+1877                vec![],
+1878            )),
+1879            Type::Struct(id) => {
+1880                self.validate_type_or_trait_is_in_ingot(db, sink, Some(id.module(db).ingot(db)))
+1881            }
+1882            Type::Enum(id) => {
+1883                self.validate_type_or_trait_is_in_ingot(db, sink, Some(id.module(db).ingot(db)))
+1884            }
+1885            Type::Base(_) | Type::Array(_) | Type::Tuple(_) | Type::String(_) => {
+1886                self.validate_type_or_trait_is_in_ingot(db, sink, None)
+1887            }
+1888            Type::SPtr(_) | Type::Mut(_) => unreachable!(),
+1889        }
+1890
+1891        if !self.trait_id(db).is_public(db) && self.trait_id(db).module(db) != self.module(db) {
+1892            let trait_module_name = self.trait_id(db).module(db).name(db);
+1893            let trait_name = self.trait_id(db).name(db);
+1894            sink.push(&errors::fancy_error(
+1895                     format!(
+1896                         "the trait `{trait_name}` is private",
+1897                     ),
+1898                     vec![
+1899                         Label::primary(self.trait_id(db).data(db).ast.kind.name.span, "this trait is not `pub`"),
+1900                     ],
+1901                     vec![
+1902                         format!("`{trait_name}` can only be used within `{trait_module_name}`"),
+1903                         format!("Hint: use `pub trait {trait_name}` to make `{trait_name}` visible from outside of `{trait_module_name}`"),
+1904                     ],
+1905                 ));
+1906        }
+1907
+1908        for impl_fn in self.all_functions(db).iter() {
+1909            impl_fn.sink_diagnostics(db, sink);
+1910
+1911            if let Some(trait_fn) = self.trait_id(db).function(db, &impl_fn.name(db)) {
+1912                for (impl_param, trait_param) in impl_fn
+1913                    .signature(db)
+1914                    .params
+1915                    .iter()
+1916                    .zip(trait_fn.signature(db).params.iter())
+1917                {
+1918                    let impl_param_ty = impl_param.typ.clone().unwrap();
+1919                    let trait_param_ty = trait_param.typ.clone().unwrap();
+1920                    if self.can_stand_in_for(db, impl_param_ty, trait_param_ty) {
+1921                        continue;
+1922                    } else {
+1923                        sink.push(&errors::fancy_error(
+1924                            format!(
+1925                                "method `{}` has incompatible parameters for `{}` of trait `{}`",
+1926                                impl_fn.name(db),
+1927                                trait_fn.name(db),
+1928                                self.trait_id(db).name(db)
+1929                            ),
+1930                            vec![
+1931                                Label::primary(
+1932                                    impl_fn.data(db).ast.kind.sig.span,
+1933                                    "signature of method in `impl` block",
+1934                                ),
+1935                                Label::primary(
+1936                                    trait_fn.data(db).ast.span,
+1937                                    format!(
+1938                                        "signature of method in trait `{}`",
+1939                                        self.trait_id(db).name(db)
+1940                                    ),
+1941                                ),
+1942                            ],
+1943                            vec![],
+1944                        ));
+1945                        break;
+1946                    }
+1947                }
+1948
+1949                let impl_fn_return_ty = impl_fn.signature(db).return_type.clone().unwrap();
+1950                let trait_fn_return_ty = trait_fn.signature(db).return_type.clone().unwrap();
+1951
+1952                if !self.can_stand_in_for(db, impl_fn_return_ty, trait_fn_return_ty) {
+1953                    // TODO: This could be a nicer, more detailed report
+1954                    sink.push(&errors::fancy_error(
+1955                        format!(
+1956                            "method `{}` has an incompatible return type for `{}` of trait `{}`",
+1957                            impl_fn.name(db),
+1958                            trait_fn.name(db),
+1959                            self.trait_id(db).name(db)
+1960                        ),
+1961                        vec![
+1962                            Label::primary(
+1963                                impl_fn.data(db).ast.kind.sig.span,
+1964                                "signature of method in `impl` block",
+1965                            ),
+1966                            Label::primary(
+1967                                trait_fn.data(db).ast.span,
+1968                                format!(
+1969                                    "signature of method in trait `{}`",
+1970                                    self.trait_id(db).name(db)
+1971                                ),
+1972                            ),
+1973                        ],
+1974                        vec![],
+1975                    ));
+1976                }
+1977
+1978                if impl_fn.takes_self(db) != trait_fn.takes_self(db) {
+1979                    let ((selfy_thing, selfy_span), (non_selfy_thing, non_selfy_span)) =
+1980                        if impl_fn.takes_self(db) {
+1981                            (
+1982                                ("impl", impl_fn.name_span(db)),
+1983                                ("trait", trait_fn.name_span(db)),
+1984                            )
+1985                        } else {
+1986                            (
+1987                                ("trait", trait_fn.name_span(db)),
+1988                                ("impl", impl_fn.name_span(db)),
+1989                            )
+1990                        };
+1991                    sink.push(&errors::fancy_error(
+1992                        format!(
+1993                            "method `{}` has a `self` declaration in the {}, but not in the `{}`",
+1994                            impl_fn.name(db),
+1995                            selfy_thing,
+1996                            non_selfy_thing
+1997                        ),
+1998                        vec![
+1999                            Label::primary(
+2000                                selfy_span,
+2001                                format!("`self` declared on the `{selfy_thing}`"),
+2002                            ),
+2003                            Label::primary(
+2004                                non_selfy_span,
+2005                                format!("no `self` declared on the `{non_selfy_thing}`"),
+2006                            ),
+2007                        ],
+2008                        vec![],
+2009                    ));
+2010                }
+2011            } else {
+2012                sink.push(&errors::fancy_error(
+2013                    format!(
+2014                        "method `{}` is not a member of trait `{}`",
+2015                        impl_fn.name(db),
+2016                        self.trait_id(db).name(db)
+2017                    ),
+2018                    vec![Label::primary(
+2019                        impl_fn.data(db).ast.span,
+2020                        format!("not a member of trait `{}`", self.trait_id(db).name(db)),
+2021                    )],
+2022                    vec![],
+2023                ))
+2024            }
+2025        }
+2026
+2027        for trait_fn in self.trait_id(db).all_functions(db).iter() {
+2028            if self.function(db, &trait_fn.name(db)).is_none() {
+2029                sink.push(&errors::fancy_error(
+2030                    format!(
+2031                        "not all members of trait `{}` implemented, missing: `{}`",
+2032                        self.trait_id(db).name(db),
+2033                        trait_fn.name(db)
+2034                    ),
+2035                    vec![Label::primary(
+2036                        trait_fn.data(db).ast.span,
+2037                        "this trait function is missing in `impl` block",
+2038                    )],
+2039                    vec![],
+2040                ))
+2041            }
+2042        }
+2043    }
+2044}
+2045
+2046#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+2047pub struct Trait {
+2048    pub ast: Node<ast::Trait>,
+2049    pub module: ModuleId,
+2050}
+2051
+2052#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+2053pub struct TraitId(pub(crate) u32);
+2054impl_intern_key!(TraitId);
+2055impl TraitId {
+2056    pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Trait> {
+2057        db.lookup_intern_trait(*self)
+2058    }
+2059    pub fn span(&self, db: &dyn AnalyzerDb) -> Span {
+2060        self.data(db).ast.span
+2061    }
+2062    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+2063        self.data(db).ast.name().into()
+2064    }
+2065    pub fn name_span(&self, db: &dyn AnalyzerDb) -> Span {
+2066        self.data(db).ast.kind.name.span
+2067    }
+2068
+2069    pub fn is_public(&self, db: &dyn AnalyzerDb) -> bool {
+2070        self.data(db).ast.kind.pub_qual.is_some()
+2071    }
+2072
+2073    pub fn module(&self, db: &dyn AnalyzerDb) -> ModuleId {
+2074        self.data(db).module
+2075    }
+2076    pub fn as_trait_or_type(&self) -> TraitOrType {
+2077        TraitOrType::TraitId(*self)
+2078    }
+2079    pub fn is_implemented_for(&self, db: &dyn AnalyzerDb, ty: TypeId) -> bool {
+2080        // All encodable structs automagically implement the Emittable trait
+2081        // TODO: Remove this when we have the `Encode / Decode` trait.
+2082        if self.is_std_trait(db, EMITTABLE_TRAIT_NAME) && ty.is_emittable(db) {
+2083            return true;
+2084        }
+2085
+2086        db.all_impls(ty).iter().any(|val| &val.trait_id(db) == self)
+2087    }
+2088
+2089    pub fn is_in_std(&self, db: &dyn AnalyzerDb) -> bool {
+2090        self.module(db).is_in_std(db)
+2091    }
+2092
+2093    pub fn is_std_trait(&self, db: &dyn AnalyzerDb, name: &str) -> bool {
+2094        self.is_in_std(db) && self.name(db).to_lowercase() == name.to_lowercase()
+2095    }
+2096
+2097    pub fn parent(&self, db: &dyn AnalyzerDb) -> Item {
+2098        Item::Module(self.data(db).module)
+2099    }
+2100    pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Rc<[FunctionSigId]> {
+2101        db.trait_all_functions(*self)
+2102    }
+2103
+2104    pub fn functions(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, FunctionSigId>> {
+2105        db.trait_function_map(*self).value
+2106    }
+2107
+2108    pub fn function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionSigId> {
+2109        self.functions(db).get(name).copied()
+2110    }
+2111
+2112    pub fn sink_diagnostics(&self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink) {
+2113        db.trait_all_functions(*self)
+2114            .iter()
+2115            .for_each(|id| id.sink_diagnostics(db, sink));
+2116    }
+2117}
+2118
+2119pub trait DiagnosticSink {
+2120    fn push(&mut self, diag: &Diagnostic);
+2121    fn push_all<'a>(&mut self, iter: impl Iterator<Item = &'a Diagnostic>) {
+2122        iter.for_each(|diag| self.push(diag))
+2123    }
+2124}
+2125
+2126impl DiagnosticSink for Vec<Diagnostic> {
+2127    fn push(&mut self, diag: &Diagnostic) {
+2128        self.push(diag.clone())
+2129    }
+2130    fn push_all<'a>(&mut self, iter: impl Iterator<Item = &'a Diagnostic>) {
+2131        self.extend(iter.cloned())
+2132    }
+2133}
+2134
+2135pub type DepGraph = petgraph::graphmap::DiGraphMap<Item, DepLocality>;
+2136#[derive(Debug, Clone)]
+2137pub struct DepGraphWrapper(pub Rc<DepGraph>);
+2138impl PartialEq for DepGraphWrapper {
+2139    fn eq(&self, other: &DepGraphWrapper) -> bool {
+2140        self.0.all_edges().eq(other.0.all_edges()) && self.0.nodes().eq(other.0.nodes())
+2141    }
+2142}
+2143impl Eq for DepGraphWrapper {}
+2144
+2145/// [`DepGraph`] edge label. "Locality" refers to the deployed state;
+2146/// `Local` dependencies are those that will be compiled together, while
+2147/// `External` dependencies will only be reachable via an evm CALL* op.
+2148#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+2149pub enum DepLocality {
+2150    Local,
+2151    External,
+2152}
+2153
+2154pub fn walk_local_dependencies<F>(graph: &DepGraph, root: Item, mut fun: F)
+2155where
+2156    F: FnMut(Item),
+2157{
+2158    use petgraph::visit::{Bfs, EdgeFiltered};
+2159
+2160    let mut bfs = Bfs::new(
+2161        &EdgeFiltered::from_fn(graph, |(_, _, loc)| *loc == DepLocality::Local),
+2162        root,
+2163    );
+2164    while let Some(node) = bfs.next(graph) {
+2165        fun(node)
+2166    }
+2167}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/namespace/mod.rs.html b/compiler-docs/src/fe_analyzer/namespace/mod.rs.html new file mode 100644 index 0000000000..8d6d0727f3 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/namespace/mod.rs.html @@ -0,0 +1,3 @@ +mod.rs - source

fe_analyzer/namespace/
mod.rs

1pub mod items;
+2pub mod scopes;
+3pub mod types;
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/namespace/scopes.rs.html b/compiler-docs/src/fe_analyzer/namespace/scopes.rs.html new file mode 100644 index 0000000000..e475da40f7 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/namespace/scopes.rs.html @@ -0,0 +1,700 @@ +scopes.rs - source

fe_analyzer/namespace/
scopes.rs

1#![allow(unstable_name_collisions)] // expect_none, which ain't gonna be stabilized
+2
+3use crate::context::{
+4    AnalyzerContext, CallType, Constant, ExpressionAttributes, FunctionBody, NamedThing,
+5};
+6use crate::errors::{AlreadyDefined, FatalError, IncompleteItem, TypeError};
+7use crate::namespace::items::{FunctionId, ModuleId};
+8use crate::namespace::items::{Item, TypeDef};
+9use crate::namespace::types::{Type, TypeId};
+10use crate::pattern_analysis::PatternMatrix;
+11use crate::AnalyzerDb;
+12use fe_common::diagnostics::Diagnostic;
+13use fe_common::Span;
+14use fe_parser::{ast, node::NodeId, Label};
+15use fe_parser::{ast::Expr, node::Node};
+16use indexmap::IndexMap;
+17use std::cell::RefCell;
+18use std::collections::BTreeMap;
+19
+20pub struct ItemScope<'a> {
+21    db: &'a dyn AnalyzerDb,
+22    module: ModuleId,
+23    expressions: RefCell<IndexMap<NodeId, ExpressionAttributes>>,
+24    pub diagnostics: RefCell<Vec<Diagnostic>>,
+25}
+26impl<'a> ItemScope<'a> {
+27    pub fn new(db: &'a dyn AnalyzerDb, module: ModuleId) -> Self {
+28        Self {
+29            db,
+30            module,
+31            expressions: RefCell::new(IndexMap::default()),
+32            diagnostics: RefCell::new(vec![]),
+33        }
+34    }
+35}
+36
+37impl<'a> AnalyzerContext for ItemScope<'a> {
+38    fn db(&self) -> &dyn AnalyzerDb {
+39        self.db
+40    }
+41
+42    fn add_expression(&self, node: &Node<ast::Expr>, attributes: ExpressionAttributes) {
+43        self.expressions
+44            .borrow_mut()
+45            .insert(node.id, attributes)
+46            .expect_none("expression attributes already exist");
+47    }
+48
+49    fn update_expression(&self, node: &Node<ast::Expr>, f: &dyn Fn(&mut ExpressionAttributes)) {
+50        f(self.expressions.borrow_mut().get_mut(&node.id).unwrap())
+51    }
+52
+53    fn expr_typ(&self, expr: &Node<Expr>) -> Type {
+54        self.expressions
+55            .borrow()
+56            .get(&expr.id)
+57            .unwrap()
+58            .typ
+59            .typ(self.db())
+60    }
+61
+62    fn add_constant(
+63        &self,
+64        _name: &Node<ast::SmolStr>,
+65        _expr: &Node<ast::Expr>,
+66        _value: crate::context::Constant,
+67    ) {
+68        // We use salsa query to get constant. So no need to add constant
+69        // explicitly.
+70    }
+71
+72    fn constant_value_by_name(
+73        &self,
+74        name: &ast::SmolStr,
+75        _span: Span,
+76    ) -> Result<Option<Constant>, IncompleteItem> {
+77        if let Some(constant) = self.module.resolve_constant(self.db, name)? {
+78            // It's ok to ignore an error.
+79            // Diagnostics are already emitted when an error occurs.
+80            Ok(constant.constant_value(self.db).ok())
+81        } else {
+82            Ok(None)
+83        }
+84    }
+85
+86    fn parent(&self) -> Item {
+87        Item::Module(self.module)
+88    }
+89
+90    fn module(&self) -> ModuleId {
+91        self.module
+92    }
+93
+94    fn parent_function(&self) -> FunctionId {
+95        panic!("ItemContext has no parent function")
+96    }
+97
+98    fn add_call(&self, _node: &Node<ast::Expr>, _call_type: CallType) {
+99        unreachable!("Can't call function outside of function")
+100    }
+101    fn get_call(&self, _node: &Node<ast::Expr>) -> Option<CallType> {
+102        unreachable!("Can't call function outside of function")
+103    }
+104
+105    fn is_in_function(&self) -> bool {
+106        false
+107    }
+108
+109    fn inherits_type(&self, _typ: BlockScopeType) -> bool {
+110        false
+111    }
+112
+113    fn resolve_name(&self, name: &str, span: Span) -> Result<Option<NamedThing>, IncompleteItem> {
+114        let resolved = self.module.resolve_name(self.db, name)?;
+115
+116        if let Some(named_thing) = &resolved {
+117            check_visibility(self, named_thing, span);
+118        }
+119
+120        Ok(resolved)
+121    }
+122
+123    fn resolve_path(&self, path: &ast::Path, span: Span) -> Result<NamedThing, FatalError> {
+124        let resolved = self.module.resolve_path_internal(self.db(), path);
+125
+126        let mut err = None;
+127        for diagnostic in resolved.diagnostics.iter() {
+128            err = Some(self.register_diag(diagnostic.clone()));
+129        }
+130
+131        if let Some(err) = err {
+132            return Err(FatalError::new(err));
+133        }
+134
+135        if let Some(named_thing) = resolved.value {
+136            check_visibility(self, &named_thing, span);
+137            Ok(named_thing)
+138        } else {
+139            let err = self.error("unresolved path item", span, "not found");
+140            Err(FatalError::new(err))
+141        }
+142    }
+143
+144    fn resolve_visible_path(&self, path: &ast::Path) -> Option<NamedThing> {
+145        let resolved = self.module.resolve_path_internal(self.db(), path);
+146
+147        if resolved.diagnostics.len() > 0 {
+148            return None;
+149        }
+150
+151        let named_thing = resolved.value?;
+152        if is_visible(self, &named_thing) {
+153            Some(named_thing)
+154        } else {
+155            None
+156        }
+157    }
+158
+159    fn resolve_any_path(&self, path: &ast::Path) -> Option<NamedThing> {
+160        let resolved = self.module.resolve_path_internal(self.db(), path);
+161
+162        if resolved.diagnostics.len() > 0 {
+163            return None;
+164        }
+165
+166        resolved.value
+167    }
+168
+169    fn add_diagnostic(&self, diag: Diagnostic) {
+170        self.diagnostics.borrow_mut().push(diag)
+171    }
+172
+173    /// Gets `std::context::Context` if it exists
+174    fn get_context_type(&self) -> Option<TypeId> {
+175        if let Ok(Some(NamedThing::Item(Item::Type(TypeDef::Struct(id))))) =
+176            // `Context` is guaranteed to be public, so we can use `Span::dummy()` .
+177            self.resolve_name("Context", Span::dummy())
+178        {
+179            // we just assume that there is only one `Context` defined in `std`
+180            if id.module(self.db()).ingot(self.db()).name(self.db()) == "std" {
+181                return Some(self.db().intern_type(Type::Struct(id)));
+182            }
+183        }
+184
+185        None
+186    }
+187}
+188
+189pub struct FunctionScope<'a> {
+190    pub db: &'a dyn AnalyzerDb,
+191    pub function: FunctionId,
+192    pub body: RefCell<FunctionBody>,
+193    pub diagnostics: RefCell<Vec<Diagnostic>>,
+194}
+195
+196impl<'a> FunctionScope<'a> {
+197    pub fn new(db: &'a dyn AnalyzerDb, function: FunctionId) -> Self {
+198        Self {
+199            db,
+200            function,
+201            body: RefCell::new(FunctionBody::default()),
+202            diagnostics: RefCell::new(vec![]),
+203        }
+204    }
+205
+206    pub fn function_return_type(&self) -> Result<TypeId, TypeError> {
+207        self.function.signature(self.db).return_type.clone()
+208    }
+209
+210    pub fn map_variable_type<T>(&self, node: &Node<T>, typ: TypeId) {
+211        self.add_node(node);
+212        self.body
+213            .borrow_mut()
+214            .var_types
+215            .insert(node.id, typ)
+216            .expect_none("variable has already registered")
+217    }
+218
+219    pub fn map_pattern_matrix(&self, node: &Node<ast::FuncStmt>, matrix: PatternMatrix) {
+220        debug_assert!(matches!(node.kind, ast::FuncStmt::Match { .. }));
+221        self.body
+222            .borrow_mut()
+223            .matches
+224            .insert(node.id, matrix)
+225            .expect_none("match statement attributes already exists")
+226    }
+227
+228    fn add_node<T>(&self, node: &Node<T>) {
+229        self.body.borrow_mut().spans.insert(node.id, node.span);
+230    }
+231}
+232
+233impl<'a> AnalyzerContext for FunctionScope<'a> {
+234    fn db(&self) -> &dyn AnalyzerDb {
+235        self.db
+236    }
+237
+238    fn add_diagnostic(&self, diag: Diagnostic) {
+239        self.diagnostics.borrow_mut().push(diag)
+240    }
+241
+242    fn add_expression(&self, node: &Node<ast::Expr>, attributes: ExpressionAttributes) {
+243        self.add_node(node);
+244        self.body
+245            .borrow_mut()
+246            .expressions
+247            .insert(node.id, attributes)
+248            .expect_none("expression attributes already exist");
+249    }
+250
+251    fn update_expression(&self, node: &Node<ast::Expr>, f: &dyn Fn(&mut ExpressionAttributes)) {
+252        f(self
+253            .body
+254            .borrow_mut()
+255            .expressions
+256            .get_mut(&node.id)
+257            .unwrap())
+258    }
+259
+260    fn expr_typ(&self, expr: &Node<Expr>) -> Type {
+261        self.body
+262            .borrow()
+263            .expressions
+264            .get(&expr.id)
+265            .unwrap()
+266            .typ
+267            .typ(self.db())
+268    }
+269
+270    fn add_constant(&self, _name: &Node<ast::SmolStr>, expr: &Node<ast::Expr>, value: Constant) {
+271        self.body
+272            .borrow_mut()
+273            .expressions
+274            .get_mut(&expr.id)
+275            .expect("expression attributes must exist before adding constant value")
+276            .const_value = Some(value);
+277    }
+278
+279    fn constant_value_by_name(
+280        &self,
+281        _name: &ast::SmolStr,
+282        _span: Span,
+283    ) -> Result<Option<Constant>, IncompleteItem> {
+284        Ok(None)
+285    }
+286
+287    fn parent(&self) -> Item {
+288        self.function.parent(self.db())
+289    }
+290
+291    fn module(&self) -> ModuleId {
+292        self.function.module(self.db())
+293    }
+294
+295    fn parent_function(&self) -> FunctionId {
+296        self.function
+297    }
+298
+299    fn add_call(&self, node: &Node<ast::Expr>, call_type: CallType) {
+300        // TODO: should probably take the Expr::Call node, rather than the function node
+301        self.add_node(node);
+302        self.body
+303            .borrow_mut()
+304            .calls
+305            .insert(node.id, call_type)
+306            .expect_none("call attributes already exist");
+307    }
+308    fn get_call(&self, node: &Node<ast::Expr>) -> Option<CallType> {
+309        self.body.borrow().calls.get(&node.id).cloned()
+310    }
+311
+312    fn is_in_function(&self) -> bool {
+313        true
+314    }
+315
+316    fn inherits_type(&self, _typ: BlockScopeType) -> bool {
+317        false
+318    }
+319
+320    fn resolve_name(&self, name: &str, span: Span) -> Result<Option<NamedThing>, IncompleteItem> {
+321        let sig = self.function.signature(self.db);
+322
+323        if name == "self" {
+324            return Ok(Some(NamedThing::SelfValue {
+325                decl: sig.self_decl,
+326                parent: self.function.sig(self.db).self_item(self.db),
+327                span: self.function.self_span(self.db),
+328            }));
+329        }
+330
+331        // Getting param names and spans should be simpler
+332        let param = sig.params.iter().find_map(|param| {
+333            (param.name == name).then(|| {
+334                let span = self
+335                    .function
+336                    .data(self.db)
+337                    .ast
+338                    .kind
+339                    .sig
+340                    .kind
+341                    .args
+342                    .iter()
+343                    .find_map(|param| (param.name() == name).then(|| param.name_span()))
+344                    .expect("found param type but not span");
+345
+346                NamedThing::Variable {
+347                    name: name.into(),
+348                    typ: param.typ.clone(),
+349                    is_const: false,
+350                    span,
+351                }
+352            })
+353        });
+354
+355        if let Some(param) = param {
+356            Ok(Some(param))
+357        } else {
+358            let resolved =
+359                if let Item::Type(TypeDef::Contract(contract)) = self.function.parent(self.db) {
+360                    contract.resolve_name(self.db, name)
+361                } else {
+362                    self.function.module(self.db).resolve_name(self.db, name)
+363                }?;
+364
+365            if let Some(named_thing) = &resolved {
+366                check_visibility(self, named_thing, span);
+367            }
+368
+369            Ok(resolved)
+370        }
+371    }
+372
+373    fn resolve_path(&self, path: &ast::Path, span: Span) -> Result<NamedThing, FatalError> {
+374        let resolved = self
+375            .function
+376            .module(self.db())
+377            .resolve_path_internal(self.db(), path);
+378
+379        let mut err = None;
+380        for diagnostic in resolved.diagnostics.iter() {
+381            err = Some(self.register_diag(diagnostic.clone()));
+382        }
+383
+384        if let Some(err) = err {
+385            return Err(FatalError::new(err));
+386        }
+387
+388        if let Some(named_thing) = resolved.value {
+389            check_visibility(self, &named_thing, span);
+390            Ok(named_thing)
+391        } else {
+392            let err = self.error("unresolved path item", span, "not found");
+393            Err(FatalError::new(err))
+394        }
+395    }
+396
+397    fn resolve_visible_path(&self, path: &ast::Path) -> Option<NamedThing> {
+398        let resolved = self
+399            .function
+400            .module(self.db())
+401            .resolve_path_internal(self.db(), path);
+402
+403        if resolved.diagnostics.len() > 0 {
+404            return None;
+405        }
+406
+407        let named_thing = resolved.value?;
+408        if is_visible(self, &named_thing) {
+409            Some(named_thing)
+410        } else {
+411            None
+412        }
+413    }
+414
+415    fn resolve_any_path(&self, path: &ast::Path) -> Option<NamedThing> {
+416        let resolved = self
+417            .function
+418            .module(self.db())
+419            .resolve_path_internal(self.db(), path);
+420
+421        if resolved.diagnostics.len() > 0 {
+422            return None;
+423        }
+424
+425        resolved.value
+426    }
+427
+428    fn get_context_type(&self) -> Option<TypeId> {
+429        if let Ok(Some(NamedThing::Item(Item::Type(TypeDef::Struct(id))))) =
+430            self.resolve_name("Context", Span::dummy())
+431        {
+432            if id.module(self.db()).ingot(self.db()).name(self.db()) == "std" {
+433                return Some(self.db().intern_type(Type::Struct(id)));
+434            }
+435        }
+436
+437        None
+438    }
+439}
+440
+441pub struct BlockScope<'a, 'b> {
+442    pub root: &'a FunctionScope<'b>,
+443    pub parent: Option<&'a BlockScope<'a, 'b>>,
+444    /// Maps Name -> (Type, is_const, span)
+445    pub variable_defs: BTreeMap<String, (TypeId, bool, Span)>,
+446    pub constant_defs: RefCell<BTreeMap<String, Constant>>,
+447    pub typ: BlockScopeType,
+448}
+449
+450#[derive(Clone, Debug, PartialEq, Eq)]
+451pub enum BlockScopeType {
+452    Function,
+453    IfElse,
+454    Match,
+455    MatchArm,
+456    Loop,
+457    Unsafe,
+458}
+459
+460impl AnalyzerContext for BlockScope<'_, '_> {
+461    fn db(&self) -> &dyn AnalyzerDb {
+462        self.root.db
+463    }
+464
+465    fn resolve_name(&self, name: &str, span: Span) -> Result<Option<NamedThing>, IncompleteItem> {
+466        if let Some(var) =
+467            self.variable_defs
+468                .get(name)
+469                .map(|(typ, is_const, span)| NamedThing::Variable {
+470                    name: name.into(),
+471                    typ: Ok(*typ),
+472                    is_const: *is_const,
+473                    span: *span,
+474                })
+475        {
+476            Ok(Some(var))
+477        } else if let Some(parent) = self.parent {
+478            parent.resolve_name(name, span)
+479        } else {
+480            self.root.resolve_name(name, span)
+481        }
+482    }
+483
+484    fn add_expression(&self, node: &Node<ast::Expr>, attributes: ExpressionAttributes) {
+485        self.root.add_expression(node, attributes)
+486    }
+487
+488    fn update_expression(&self, node: &Node<ast::Expr>, f: &dyn Fn(&mut ExpressionAttributes)) {
+489        self.root.update_expression(node, f)
+490    }
+491
+492    fn expr_typ(&self, expr: &Node<Expr>) -> Type {
+493        self.root.expr_typ(expr)
+494    }
+495
+496    fn add_constant(&self, name: &Node<ast::SmolStr>, expr: &Node<ast::Expr>, value: Constant) {
+497        self.constant_defs
+498            .borrow_mut()
+499            .insert(name.kind.clone().to_string(), value.clone())
+500            .expect_none("expression attributes already exist");
+501
+502        self.root.add_constant(name, expr, value)
+503    }
+504
+505    fn constant_value_by_name(
+506        &self,
+507        name: &ast::SmolStr,
+508        span: Span,
+509    ) -> Result<Option<Constant>, IncompleteItem> {
+510        if let Some(constant) = self.constant_defs.borrow().get(name.as_str()) {
+511            Ok(Some(constant.clone()))
+512        } else if let Some(parent) = self.parent {
+513            parent.constant_value_by_name(name, span)
+514        } else {
+515            match self.resolve_name(name, span)? {
+516                Some(NamedThing::Item(Item::Constant(constant))) => {
+517                    Ok(constant.constant_value(self.db()).ok())
+518                }
+519                _ => Ok(None),
+520            }
+521        }
+522    }
+523
+524    fn parent(&self) -> Item {
+525        Item::Function(self.root.function)
+526    }
+527
+528    fn module(&self) -> ModuleId {
+529        self.root.module()
+530    }
+531
+532    fn parent_function(&self) -> FunctionId {
+533        self.root.function
+534    }
+535
+536    fn add_call(&self, node: &Node<ast::Expr>, call_type: CallType) {
+537        self.root.add_call(node, call_type)
+538    }
+539
+540    fn get_call(&self, node: &Node<ast::Expr>) -> Option<CallType> {
+541        self.root.get_call(node)
+542    }
+543
+544    fn is_in_function(&self) -> bool {
+545        true
+546    }
+547
+548    fn inherits_type(&self, typ: BlockScopeType) -> bool {
+549        self.typ == typ || self.parent.map_or(false, |scope| scope.inherits_type(typ))
+550    }
+551
+552    fn resolve_path(&self, path: &ast::Path, span: Span) -> Result<NamedThing, FatalError> {
+553        self.root.resolve_path(path, span)
+554    }
+555
+556    fn resolve_visible_path(&self, path: &ast::Path) -> Option<NamedThing> {
+557        self.root.resolve_visible_path(path)
+558    }
+559
+560    fn resolve_any_path(&self, path: &ast::Path) -> Option<NamedThing> {
+561        self.root.resolve_any_path(path)
+562    }
+563
+564    fn add_diagnostic(&self, diag: Diagnostic) {
+565        self.root.diagnostics.borrow_mut().push(diag)
+566    }
+567
+568    fn get_context_type(&self) -> Option<TypeId> {
+569        self.root.get_context_type()
+570    }
+571}
+572
+573impl<'a, 'b> BlockScope<'a, 'b> {
+574    pub fn new(root: &'a FunctionScope<'b>, typ: BlockScopeType) -> Self {
+575        BlockScope {
+576            root,
+577            parent: None,
+578            variable_defs: BTreeMap::new(),
+579            constant_defs: RefCell::new(BTreeMap::new()),
+580            typ,
+581        }
+582    }
+583
+584    pub fn new_child(&'a self, typ: BlockScopeType) -> Self {
+585        BlockScope {
+586            root: self.root,
+587            parent: Some(self),
+588            variable_defs: BTreeMap::new(),
+589            constant_defs: RefCell::new(BTreeMap::new()),
+590            typ,
+591        }
+592    }
+593
+594    /// Add a variable to the block scope.
+595    pub fn add_var(
+596        &mut self,
+597        name: &str,
+598        typ: TypeId,
+599        is_const: bool,
+600        span: Span,
+601    ) -> Result<(), AlreadyDefined> {
+602        match self.resolve_name(name, span) {
+603            Ok(Some(NamedThing::SelfValue { .. })) => {
+604                let err = self.error(
+605                    "`self` can't be used as a variable name",
+606                    span,
+607                    "expected a name, found keyword `self`",
+608                );
+609                Err(AlreadyDefined::new(err))
+610            }
+611
+612            Ok(Some(named_item)) => {
+613                if named_item.is_builtin() {
+614                    let err = self.error(
+615                        &format!(
+616                            "variable name conflicts with built-in {}",
+617                            named_item.item_kind_display_name(),
+618                        ),
+619                        span,
+620                        &format!(
+621                            "`{}` is a built-in {}",
+622                            name,
+623                            named_item.item_kind_display_name()
+624                        ),
+625                    );
+626                    Err(AlreadyDefined::new(err))
+627                } else {
+628                    // It's (currently) an error to shadow a variable in a nested scope
+629                    let err = self.duplicate_name_error(
+630                        &format!("duplicate definition of variable `{name}`"),
+631                        name,
+632                        named_item
+633                            .name_span(self.db())
+634                            .expect("missing name_span of non-builtin"),
+635                        span,
+636                    );
+637                    Err(AlreadyDefined::new(err))
+638                }
+639            }
+640            _ => {
+641                self.variable_defs
+642                    .insert(name.to_string(), (typ, is_const, span));
+643                Ok(())
+644            }
+645        }
+646    }
+647}
+648
+649/// temporary helper until `BTreeMap::try_insert` is stabilized
+650trait OptionExt {
+651    fn expect_none(self, msg: &str);
+652}
+653
+654impl<T> OptionExt for Option<T> {
+655    fn expect_none(self, msg: &str) {
+656        if self.is_some() {
+657            panic!("{}", msg)
+658        }
+659    }
+660}
+661
+662/// Check an item visibility and sink diagnostics if an item is invisible from
+663/// the scope.
+664pub fn check_visibility(context: &dyn AnalyzerContext, named_thing: &NamedThing, span: Span) {
+665    if let NamedThing::Item(item) = named_thing {
+666        let item_module = item
+667            .module(context.db())
+668            .unwrap_or_else(|| context.module());
+669        if !item.is_public(context.db()) && item_module != context.module() {
+670            let module_name = item_module.name(context.db());
+671            let item_name = item.name(context.db());
+672            let item_span = item.name_span(context.db()).unwrap_or(span);
+673            let item_kind_name = item.item_kind_display_name();
+674            context.fancy_error(
+675                &format!("the {item_kind_name} `{item_name}` is private",),
+676                vec![
+677                    Label::primary(span, format!("this {item_kind_name} is not `pub`")),
+678                    Label::secondary(item_span, format!("`{item_name}` is defined here")),
+679                ],
+680                vec![
+681                    format!("`{item_name}` can only be used within `{module_name}`"),
+682                    format!(
+683                        "Hint: use `pub` to make `{item_name}` visible from outside of `{module_name}`",
+684                    ),
+685                ],
+686            );
+687        }
+688    }
+689}
+690
+691fn is_visible(context: &dyn AnalyzerContext, named_thing: &NamedThing) -> bool {
+692    if let NamedThing::Item(item) = named_thing {
+693        let item_module = item
+694            .module(context.db())
+695            .unwrap_or_else(|| context.module());
+696        item.is_public(context.db()) || item_module == context.module()
+697    } else {
+698        true
+699    }
+700}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/namespace/types.rs.html b/compiler-docs/src/fe_analyzer/namespace/types.rs.html new file mode 100644 index 0000000000..bf82009d9c --- /dev/null +++ b/compiler-docs/src/fe_analyzer/namespace/types.rs.html @@ -0,0 +1,854 @@ +types.rs - source

fe_analyzer/namespace/
types.rs

1use crate::context::AnalyzerContext;
+2use crate::display::DisplayWithDb;
+3use crate::display::Displayable;
+4use crate::errors::TypeError;
+5use crate::namespace::items::{
+6    ContractId, EnumId, FunctionId, FunctionSigId, ImplId, Item, StructId, TraitId,
+7};
+8use crate::AnalyzerDb;
+9
+10use fe_common::impl_intern_key;
+11use fe_common::Span;
+12use num_bigint::BigInt;
+13use num_traits::ToPrimitive;
+14use smol_str::SmolStr;
+15use std::fmt;
+16use std::rc::Rc;
+17use std::str::FromStr;
+18use strum::{AsRefStr, EnumIter, EnumString};
+19
+20pub fn u256_min() -> BigInt {
+21    BigInt::from(0)
+22}
+23
+24pub fn u256_max() -> BigInt {
+25    BigInt::from(2).pow(256) - 1
+26}
+27
+28pub fn i256_max() -> BigInt {
+29    BigInt::from(2).pow(255) - 1
+30}
+31
+32pub fn i256_min() -> BigInt {
+33    BigInt::from(-2).pow(255)
+34}
+35
+36pub fn address_max() -> BigInt {
+37    BigInt::from(2).pow(160) - 1
+38}
+39
+40/// Names that can be used to build identifiers without collision.
+41pub trait SafeNames {
+42    /// Name in the lower snake format (e.g. lower_snake_case).
+43    fn lower_snake(&self) -> String;
+44}
+45
+46#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+47pub enum Type {
+48    Base(Base),
+49    Array(Array),
+50    Map(Map),
+51    Tuple(Tuple),
+52    String(FeString),
+53    /// An "external" contract. Effectively just a `newtype`d address.
+54    Contract(ContractId),
+55    /// The type of a contract while it's being executed. Ie. the type
+56    /// of `self` within a contract function.
+57    SelfContract(ContractId),
+58    // The type when `Self` is used within a trait or struct
+59    SelfType(TraitOrType),
+60    Struct(StructId),
+61    Enum(EnumId),
+62    Generic(Generic),
+63    SPtr(TypeId),
+64    Mut(TypeId),
+65}
+66
+67#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+68pub enum TraitOrType {
+69    TraitId(TraitId),
+70    TypeId(TypeId),
+71}
+72
+73type TraitFunctionLookup = (Vec<(FunctionId, ImplId)>, Vec<(FunctionId, ImplId)>);
+74
+75#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
+76pub struct TypeId(pub(crate) u32);
+77impl_intern_key!(TypeId);
+78impl TypeId {
+79    pub fn unit(db: &dyn AnalyzerDb) -> Self {
+80        db.intern_type(Type::unit())
+81    }
+82    pub fn bool(db: &dyn AnalyzerDb) -> Self {
+83        db.intern_type(Type::bool())
+84    }
+85    pub fn int(db: &dyn AnalyzerDb, int: Integer) -> Self {
+86        db.intern_type(Type::int(int))
+87    }
+88    pub fn address(db: &dyn AnalyzerDb) -> Self {
+89        db.intern_type(Type::Base(Base::Address))
+90    }
+91    pub fn base(db: &dyn AnalyzerDb, t: Base) -> Self {
+92        db.intern_type(Type::Base(t))
+93    }
+94    pub fn tuple(db: &dyn AnalyzerDb, items: &[TypeId]) -> Self {
+95        db.intern_type(Type::Tuple(Tuple {
+96            items: items.into(),
+97        }))
+98    }
+99
+100    pub fn typ(&self, db: &dyn AnalyzerDb) -> Type {
+101        db.lookup_intern_type(*self)
+102    }
+103    pub fn deref_typ(&self, db: &dyn AnalyzerDb) -> Type {
+104        self.deref(db).typ(db)
+105    }
+106    pub fn deref(self, db: &dyn AnalyzerDb) -> TypeId {
+107        match self.typ(db) {
+108            Type::SPtr(inner) => inner,
+109            Type::Mut(inner) => inner.deref(db),
+110            Type::SelfType(TraitOrType::TypeId(inner)) => inner,
+111            _ => self,
+112        }
+113    }
+114    pub fn make_sptr(self, db: &dyn AnalyzerDb) -> TypeId {
+115        Type::SPtr(self).id(db)
+116    }
+117
+118    pub fn has_fixed_size(&self, db: &dyn AnalyzerDb) -> bool {
+119        self.typ(db).has_fixed_size(db)
+120    }
+121
+122    /// `true` if Type::Base or Type::Contract (which is just an Address)
+123    pub fn is_primitive(&self, db: &dyn AnalyzerDb) -> bool {
+124        matches!(self.typ(db), Type::Base(_) | Type::Contract(_))
+125    }
+126    pub fn is_bool(&self, db: &dyn AnalyzerDb) -> bool {
+127        matches!(self.typ(db), Type::Base(Base::Bool))
+128    }
+129    pub fn is_contract(&self, db: &dyn AnalyzerDb) -> bool {
+130        matches!(self.typ(db), Type::Contract(_) | Type::SelfContract(_))
+131    }
+132    pub fn is_integer(&self, db: &dyn AnalyzerDb) -> bool {
+133        matches!(self.typ(db), Type::Base(Base::Numeric(_)))
+134    }
+135    pub fn is_map(&self, db: &dyn AnalyzerDb) -> bool {
+136        matches!(self.typ(db), Type::Map(_))
+137    }
+138    pub fn is_string(&self, db: &dyn AnalyzerDb) -> bool {
+139        matches!(self.typ(db), Type::String(_))
+140    }
+141    pub fn is_self_ty(&self, db: &dyn AnalyzerDb) -> bool {
+142        matches!(self.typ(db), Type::SelfType(_))
+143    }
+144    pub fn as_struct(&self, db: &dyn AnalyzerDb) -> Option<StructId> {
+145        if let Type::Struct(id) = self.typ(db) {
+146            Some(id)
+147        } else {
+148            None
+149        }
+150    }
+151    pub fn as_trait_or_type(&self) -> TraitOrType {
+152        TraitOrType::TypeId(*self)
+153    }
+154    pub fn is_struct(&self, db: &dyn AnalyzerDb) -> bool {
+155        matches!(self.typ(db), Type::Struct(_))
+156    }
+157    pub fn is_sptr(&self, db: &dyn AnalyzerDb) -> bool {
+158        match self.typ(db) {
+159            Type::SPtr(_) => true,
+160            Type::Mut(inner) => inner.is_sptr(db),
+161            _ => false,
+162        }
+163    }
+164    pub fn is_generic(&self, db: &dyn AnalyzerDb) -> bool {
+165        matches!(self.deref(db).typ(db), Type::Generic(_))
+166    }
+167
+168    pub fn is_mut(&self, db: &dyn AnalyzerDb) -> bool {
+169        matches!(self.typ(db), Type::Mut(_))
+170    }
+171
+172    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+173        self.typ(db).name(db)
+174    }
+175
+176    pub fn kind_display_name(&self, db: &dyn AnalyzerDb) -> &str {
+177        match self.typ(db) {
+178            Type::Contract(_) | Type::SelfContract(_) => "contract",
+179            Type::Struct(_) => "struct",
+180            Type::Array(_) => "array",
+181            Type::Tuple(_) => "tuple",
+182            _ => "type",
+183        }
+184    }
+185
+186    /// Return the `impl` for the given trait. There can only ever be a single
+187    /// implementation per concrete type and trait.
+188    pub fn get_impl_for(&self, db: &dyn AnalyzerDb, trait_: TraitId) -> Option<ImplId> {
+189        db.impl_for(*self, trait_)
+190    }
+191
+192    /// Looks up all possible candidates of the given function name that are implemented via traits.
+193    /// Groups results in two lists, the first contains all theoretical possible candidates and
+194    /// the second contains only those that are actually callable because the trait is in scope.
+195    pub fn trait_function_candidates(
+196        &self,
+197        context: &mut dyn AnalyzerContext,
+198        fn_name: &str,
+199    ) -> TraitFunctionLookup {
+200        let candidates = context
+201            .db()
+202            .all_impls(*self)
+203            .iter()
+204            .cloned()
+205            .filter_map(|_impl| {
+206                _impl
+207                    .function(context.db(), fn_name)
+208                    .map(|fun| (fun, _impl))
+209            })
+210            .collect::<Vec<_>>();
+211
+212        let in_scope_candidates = candidates
+213            .iter()
+214            .cloned()
+215            .filter(|(_, _impl)| {
+216                context
+217                    .module()
+218                    .is_in_scope(context.db(), Item::Trait(_impl.trait_id(context.db())))
+219            })
+220            .collect::<Vec<_>>();
+221
+222        (candidates, in_scope_candidates)
+223    }
+224
+225    /// Signature for the function with the given name defined directly on the type.
+226    /// Does not consider trait impls.
+227    pub fn function_sig(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionSigId> {
+228        match self.typ(db) {
+229            Type::SPtr(inner) => inner.function_sig(db, name),
+230            Type::Contract(id) => id.function(db, name).map(|fun| fun.sig(db)),
+231            Type::SelfContract(id) => id.function(db, name).map(|fun| fun.sig(db)),
+232            Type::Struct(id) => id.function(db, name).map(|fun| fun.sig(db)),
+233            Type::Enum(id) => id.function(db, name).map(|fun| fun.sig(db)),
+234            // TODO: This won't hold when we support multiple bounds
+235            Type::Generic(inner) => inner
+236                .bounds
+237                .first()
+238                .and_then(|bound| bound.function(db, name)),
+239            _ => None,
+240        }
+241    }
+242
+243    /// Like `function_sig` but returns a `Vec<FunctionSigId>` which not only
+244    /// considers functions natively implemented on the type but also those
+245    /// that are provided by implemented traits on the type.
+246    pub fn function_sigs(&self, db: &dyn AnalyzerDb, name: &str) -> Rc<[FunctionSigId]> {
+247        db.function_sigs(*self, name.into())
+248    }
+249
+250    pub fn self_function(&self, db: &dyn AnalyzerDb, name: &str) -> Option<FunctionSigId> {
+251        let fun = self.function_sig(db, name)?;
+252        fun.takes_self(db).then_some(fun)
+253    }
+254
+255    /// Returns `true` if the type qualifies to implement the `Emittable` trait
+256    /// TODO: This function should be removed when we add `Encode / Decode`
+257    /// trait
+258    pub fn is_emittable(self, db: &dyn AnalyzerDb) -> bool {
+259        matches!(self.typ(db), Type::Struct(_)) && self.is_encodable(db).unwrap_or(false)
+260    }
+261
+262    /// Returns `true` if the type is encodable in Solidity ABI.
+263    /// TODO: This function must be removed when we add `Encode`/`Decode` trait.
+264    pub fn is_encodable(self, db: &dyn AnalyzerDb) -> Result<bool, TypeError> {
+265        match self.typ(db) {
+266            Type::Base(_) | Type::String(_) | Type::Contract(_) => Ok(true),
+267            Type::Array(arr) => arr.inner.is_encodable(db),
+268            Type::Struct(sid) => {
+269                // Returns `false` if diagnostics is not empty.
+270                // The diagnostics is properly emitted in struct definition site, so there is no
+271                // need to emit the diagnostics here.
+272                if !db.struct_dependency_graph(sid).diagnostics.is_empty() {
+273                    return Ok(false);
+274                };
+275                let mut res = true;
+276                // We have to continue the iteration even if an item is NOT encodable so that we
+277                // could propagate an error which returned from `item.is_encodable()` for
+278                // keeping consistency.
+279                for (_, &fid) in sid.fields(db).iter() {
+280                    res &= fid.typ(db)?.is_encodable(db)?;
+281                }
+282                Ok(res)
+283            }
+284            Type::Tuple(tup) => {
+285                let mut res = true;
+286                // We have to continue the iteration even if an item is NOT encodable so that we
+287                // could propagate an error which returned from `item.is_encodable()` for
+288                // keeping consistency.
+289                for item in tup.items.iter() {
+290                    res &= item.is_encodable(db)?;
+291                }
+292                Ok(res)
+293            }
+294            Type::Mut(inner) => inner.is_encodable(db),
+295            Type::SelfType(id) => match id {
+296                TraitOrType::TraitId(_) => Ok(false),
+297                TraitOrType::TypeId(id) => id.is_encodable(db),
+298            },
+299            Type::Map(_)
+300            | Type::SelfContract(_)
+301            | Type::Generic(_)
+302            | Type::Enum(_)
+303            | Type::SPtr(_) => Ok(false),
+304        }
+305    }
+306}
+307
+308#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
+309pub enum Base {
+310    Numeric(Integer),
+311    Bool,
+312    Address,
+313    Unit,
+314}
+315
+316impl Base {
+317    pub fn name(&self) -> SmolStr {
+318        match self {
+319            Base::Numeric(num) => num.as_ref().into(),
+320            Base::Bool => "bool".into(),
+321            Base::Address => "address".into(),
+322            Base::Unit => "()".into(),
+323        }
+324    }
+325    pub fn u256() -> Base {
+326        Base::Numeric(Integer::U256)
+327    }
+328}
+329
+330#[derive(
+331    Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, AsRefStr, EnumString, EnumIter,
+332)]
+333#[strum(serialize_all = "snake_case")]
+334pub enum Integer {
+335    U256,
+336    U128,
+337    U64,
+338    U32,
+339    U16,
+340    U8,
+341    I256,
+342    I128,
+343    I64,
+344    I32,
+345    I16,
+346    I8,
+347}
+348
+349pub const U256: Base = Base::Numeric(Integer::U256);
+350
+351#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+352pub struct Array {
+353    pub size: usize,
+354    pub inner: TypeId,
+355}
+356
+357#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+358pub struct Map {
+359    pub key: TypeId,
+360    pub value: TypeId,
+361}
+362
+363#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
+364pub struct Generic {
+365    pub name: SmolStr,
+366    pub bounds: Rc<[TraitId]>,
+367}
+368
+369#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+370pub struct Tuple {
+371    pub items: Rc<[TypeId]>,
+372}
+373
+374#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)]
+375pub struct FeString {
+376    pub max_size: usize,
+377}
+378
+379#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+380pub struct FunctionSignature {
+381    pub self_decl: Option<SelfDecl>,
+382    pub ctx_decl: Option<CtxDecl>,
+383    pub params: Vec<FunctionParam>,
+384    pub return_type: Result<TypeId, TypeError>,
+385}
+386
+387#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
+388pub struct SelfDecl {
+389    pub span: Span,
+390    pub mut_: Option<Span>,
+391}
+392
+393impl SelfDecl {
+394    pub fn is_mut(&self) -> bool {
+395        self.mut_.is_some()
+396    }
+397}
+398
+399#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
+400pub struct CtxDecl {
+401    pub span: Span,
+402    pub mut_: Option<Span>,
+403}
+404
+405#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+406pub struct FunctionParam {
+407    label: Option<SmolStr>,
+408    pub name: SmolStr,
+409    pub typ: Result<TypeId, TypeError>,
+410}
+411impl FunctionParam {
+412    pub fn new(label: Option<&str>, name: &str, typ: Result<TypeId, TypeError>) -> Self {
+413        Self {
+414            label: label.map(SmolStr::new),
+415            name: name.into(),
+416            typ,
+417        }
+418    }
+419    pub fn label(&self) -> Option<&str> {
+420        match &self.label {
+421            Some(label) if label == "_" => None,
+422            Some(label) => Some(label),
+423            None => Some(&self.name),
+424        }
+425    }
+426}
+427
+428#[derive(
+429    Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, EnumString, AsRefStr, EnumIter,
+430)]
+431pub enum GenericType {
+432    Array,
+433    String,
+434    Map,
+435}
+436
+437impl GenericType {
+438    pub fn name(&self) -> SmolStr {
+439        self.as_ref().into()
+440    }
+441    pub fn params(&self) -> Vec<GenericParam> {
+442        match self {
+443            GenericType::String => vec![GenericParam {
+444                name: "max size".into(),
+445                kind: GenericParamKind::Int,
+446            }],
+447            GenericType::Map => vec![
+448                GenericParam {
+449                    name: "key".into(),
+450                    kind: GenericParamKind::PrimitiveType,
+451                },
+452                GenericParam {
+453                    name: "value".into(),
+454                    kind: GenericParamKind::AnyType,
+455                },
+456            ],
+457            GenericType::Array => vec![
+458                GenericParam {
+459                    name: "element type".into(),
+460                    kind: GenericParamKind::AnyType,
+461                },
+462                GenericParam {
+463                    name: "size".into(),
+464                    kind: GenericParamKind::Int,
+465                },
+466            ],
+467        }
+468    }
+469
+470    // see traversal::types::apply_generic_type_args for error checking
+471    pub fn apply(&self, db: &dyn AnalyzerDb, args: &[GenericArg]) -> Option<TypeId> {
+472        let typ = match self {
+473            GenericType::String => match args {
+474                [GenericArg::Int(max_size)] => Some(Type::String(FeString {
+475                    max_size: *max_size,
+476                })),
+477                _ => None,
+478            },
+479            GenericType::Map => match args {
+480                [GenericArg::Type(key), GenericArg::Type(value)] => Some(Type::Map(Map {
+481                    key: *key,
+482                    value: *value,
+483                })),
+484                _ => None,
+485            },
+486            GenericType::Array => match args {
+487                [GenericArg::Type(element), GenericArg::Int(size)] => Some(Type::Array(Array {
+488                    size: *size,
+489                    inner: *element,
+490                })),
+491                _ => None,
+492            },
+493        }?;
+494        Some(db.intern_type(typ))
+495    }
+496}
+497
+498pub struct GenericParam {
+499    pub name: SmolStr,
+500    pub kind: GenericParamKind,
+501}
+502
+503#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
+504pub enum GenericParamKind {
+505    Int,
+506
+507    // Ideally these would be represented as trait constraints.
+508    PrimitiveType,
+509    // FixedSizeType, // not needed yet
+510    AnyType,
+511}
+512
+513#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+514pub enum GenericArg {
+515    Int(usize),
+516    Type(TypeId),
+517}
+518
+519impl Integer {
+520    /// Returns `true` if the integer is signed, otherwise `false`
+521    pub fn is_signed(&self) -> bool {
+522        matches!(
+523            self,
+524            Integer::I256
+525                | Integer::I128
+526                | Integer::I64
+527                | Integer::I32
+528                | Integer::I16
+529                | Integer::I8
+530        )
+531    }
+532
+533    pub fn size(&self) -> usize {
+534        match self {
+535            Integer::U256 | Integer::I256 => 32,
+536            Integer::U128 | Integer::I128 => 16,
+537            Integer::U64 | Integer::I64 => 8,
+538            Integer::U32 | Integer::I32 => 4,
+539            Integer::U16 | Integer::I16 => 2,
+540            Integer::U8 | Integer::I8 => 1,
+541        }
+542    }
+543
+544    /// Returns size of integer type in bits.
+545    pub fn bits(&self) -> usize {
+546        self.size() * 8
+547    }
+548
+549    /// Returns `true` if the integer is at least the same size (or larger) than
+550    /// `other`
+551    pub fn can_hold(&self, other: Integer) -> bool {
+552        self.size() >= other.size()
+553    }
+554
+555    /// Returns `true` if `num` represents a number that fits the type
+556    pub fn fits(&self, num: BigInt) -> bool {
+557        match self {
+558            Integer::U8 => num.to_u8().is_some(),
+559            Integer::U16 => num.to_u16().is_some(),
+560            Integer::U32 => num.to_u32().is_some(),
+561            Integer::U64 => num.to_u64().is_some(),
+562            Integer::U128 => num.to_u128().is_some(),
+563            Integer::I8 => num.to_i8().is_some(),
+564            Integer::I16 => num.to_i16().is_some(),
+565            Integer::I32 => num.to_i32().is_some(),
+566            Integer::I64 => num.to_i64().is_some(),
+567            Integer::I128 => num.to_i128().is_some(),
+568            Integer::U256 => num >= u256_min() && num <= u256_max(),
+569            Integer::I256 => num >= i256_min() && num <= i256_max(),
+570        }
+571    }
+572
+573    /// Returns max value of the integer type.
+574    pub fn max_value(&self) -> BigInt {
+575        match self {
+576            Integer::U256 => u256_max(),
+577            Integer::U128 => u128::MAX.into(),
+578            Integer::U64 => u64::MAX.into(),
+579            Integer::U32 => u32::MAX.into(),
+580            Integer::U16 => u16::MAX.into(),
+581            Integer::U8 => u8::MAX.into(),
+582            Integer::I256 => i256_max(),
+583            Integer::I128 => i128::MAX.into(),
+584            Integer::I64 => i64::MAX.into(),
+585            Integer::I32 => i32::MAX.into(),
+586            Integer::I16 => i16::MAX.into(),
+587            Integer::I8 => i8::MAX.into(),
+588        }
+589    }
+590
+591    /// Returns min value of the integer type.
+592    pub fn min_value(&self) -> BigInt {
+593        match self {
+594            Integer::U256 => u256_min(),
+595            Integer::U128 => u128::MIN.into(),
+596            Integer::U64 => u64::MIN.into(),
+597            Integer::U32 => u32::MIN.into(),
+598            Integer::U16 => u16::MIN.into(),
+599            Integer::U8 => u8::MIN.into(),
+600            Integer::I256 => i256_min(),
+601            Integer::I128 => i128::MIN.into(),
+602            Integer::I64 => i64::MIN.into(),
+603            Integer::I32 => i32::MIN.into(),
+604            Integer::I16 => i16::MIN.into(),
+605            Integer::I8 => i8::MIN.into(),
+606        }
+607    }
+608}
+609
+610impl Type {
+611    pub fn id(&self, db: &dyn AnalyzerDb) -> TypeId {
+612        db.intern_type(self.clone())
+613    }
+614
+615    pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr {
+616        match self {
+617            Type::Base(inner) => inner.name(),
+618            _ => self.display(db).to_string().into(),
+619        }
+620    }
+621
+622    pub fn def_span(&self, context: &dyn AnalyzerContext) -> Option<Span> {
+623        match self {
+624            Self::Struct(id) => Some(id.span(context.db())),
+625            Self::Contract(id) | Self::SelfContract(id) => Some(id.span(context.db())),
+626            _ => None,
+627        }
+628    }
+629
+630    /// Creates an instance of bool.
+631    pub fn bool() -> Self {
+632        Type::Base(Base::Bool)
+633    }
+634
+635    /// Creates an instance of address.
+636    pub fn address() -> Self {
+637        Type::Base(Base::Address)
+638    }
+639
+640    /// Creates an instance of u256.
+641    pub fn u256() -> Self {
+642        Type::Base(Base::Numeric(Integer::U256))
+643    }
+644
+645    /// Creates an instance of u8.
+646    pub fn u8() -> Self {
+647        Type::Base(Base::Numeric(Integer::U8))
+648    }
+649
+650    /// Creates an instance of `()`.
+651    pub fn unit() -> Self {
+652        Type::Base(Base::Unit)
+653    }
+654
+655    pub fn is_unit(&self) -> bool {
+656        *self == Type::Base(Base::Unit)
+657    }
+658
+659    pub fn int(int_type: Integer) -> Self {
+660        Type::Base(Base::Numeric(int_type))
+661    }
+662
+663    pub fn has_fixed_size(&self, db: &dyn AnalyzerDb) -> bool {
+664        match self {
+665            Type::Base(_)
+666            | Type::Array(_)
+667            | Type::Tuple(_)
+668            | Type::String(_)
+669            | Type::Struct(_)
+670            | Type::Enum(_)
+671            | Type::Generic(_)
+672            | Type::Contract(_) => true,
+673            Type::Map(_) | Type::SelfContract(_) => false,
+674            Type::SelfType(inner) => match inner {
+675                TraitOrType::TraitId(_) => true,
+676                TraitOrType::TypeId(id) => id.has_fixed_size(db),
+677            },
+678            Type::SPtr(inner) | Type::Mut(inner) => inner.has_fixed_size(db),
+679        }
+680    }
+681}
+682
+683pub trait TypeDowncast {
+684    fn as_array(&self, db: &dyn AnalyzerDb) -> Option<Array>;
+685    fn as_tuple(&self, db: &dyn AnalyzerDb) -> Option<Tuple>;
+686    fn as_string(&self, db: &dyn AnalyzerDb) -> Option<FeString>;
+687    fn as_map(&self, db: &dyn AnalyzerDb) -> Option<Map>;
+688    fn as_int(&self, db: &dyn AnalyzerDb) -> Option<Integer>;
+689}
+690
+691impl TypeDowncast for TypeId {
+692    fn as_array(&self, db: &dyn AnalyzerDb) -> Option<Array> {
+693        match self.typ(db) {
+694            Type::Array(inner) => Some(inner),
+695            _ => None,
+696        }
+697    }
+698    fn as_tuple(&self, db: &dyn AnalyzerDb) -> Option<Tuple> {
+699        match self.typ(db) {
+700            Type::Tuple(inner) => Some(inner),
+701            _ => None,
+702        }
+703    }
+704    fn as_string(&self, db: &dyn AnalyzerDb) -> Option<FeString> {
+705        match self.typ(db) {
+706            Type::String(inner) => Some(inner),
+707            _ => None,
+708        }
+709    }
+710    fn as_map(&self, db: &dyn AnalyzerDb) -> Option<Map> {
+711        match self.typ(db) {
+712            Type::Map(inner) => Some(inner),
+713            _ => None,
+714        }
+715    }
+716    fn as_int(&self, db: &dyn AnalyzerDb) -> Option<Integer> {
+717        match self.typ(db) {
+718            Type::Base(Base::Numeric(int)) => Some(int),
+719            _ => None,
+720        }
+721    }
+722}
+723
+724impl From<Base> for Type {
+725    fn from(value: Base) -> Self {
+726        Type::Base(value)
+727    }
+728}
+729
+730impl DisplayWithDb for Type {
+731    fn format(&self, db: &dyn AnalyzerDb, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+732        use std::fmt::Display;
+733        match self {
+734            Type::Base(inner) => inner.fmt(f),
+735            Type::String(inner) => inner.fmt(f),
+736            Type::Array(arr) => {
+737                write!(f, "Array<{}, {}>", arr.inner.display(db), arr.size)
+738            }
+739            Type::Map(map) => {
+740                let Map { key, value } = map;
+741                write!(f, "Map<{}, {}>", key.display(db), value.display(db),)
+742            }
+743            Type::Tuple(id) => {
+744                write!(f, "(")?;
+745                let mut delim = "";
+746                for item in id.items.iter() {
+747                    write!(f, "{}{}", delim, item.display(db))?;
+748                    delim = ", ";
+749                }
+750                write!(f, ")")
+751            }
+752            Type::Contract(id) | Type::SelfContract(id) => write!(f, "{}", id.name(db)),
+753            Type::Struct(id) => write!(f, "{}", id.name(db)),
+754            Type::Enum(id) => write!(f, "{}", id.name(db)),
+755            Type::Generic(inner) => inner.fmt(f),
+756            Type::SPtr(inner) => write!(f, "SPtr<{}>", inner.display(db)),
+757            Type::Mut(inner) => write!(f, "mut {}", inner.display(db)),
+758            Type::SelfType(_) => write!(f, "Self"),
+759        }
+760    }
+761}
+762impl DisplayWithDb for TypeId {
+763    fn format(&self, db: &dyn AnalyzerDb, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+764        self.typ(db).format(db, f)
+765    }
+766}
+767
+768impl fmt::Display for Base {
+769    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+770        let name = match self {
+771            Base::Numeric(int) => return int.fmt(f),
+772            Base::Bool => "bool",
+773            Base::Address => "address",
+774            Base::Unit => "()",
+775        };
+776        write!(f, "{name}")
+777    }
+778}
+779
+780impl fmt::Display for Integer {
+781    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+782        let name = match self {
+783            Integer::U256 => "u256",
+784            Integer::U128 => "u128",
+785            Integer::U64 => "u64",
+786            Integer::U32 => "u32",
+787            Integer::U16 => "u16",
+788            Integer::U8 => "u8",
+789            Integer::I256 => "i256",
+790            Integer::I128 => "i128",
+791            Integer::I64 => "i64",
+792            Integer::I32 => "i32",
+793            Integer::I16 => "i16",
+794            Integer::I8 => "i8",
+795        };
+796        write!(f, "{name}")
+797    }
+798}
+799
+800impl fmt::Display for FeString {
+801    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+802        write!(f, "String<{}>", self.max_size)
+803    }
+804}
+805
+806impl DisplayWithDb for FunctionSignature {
+807    fn format(&self, db: &dyn AnalyzerDb, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+808        let FunctionSignature {
+809            self_decl,
+810            ctx_decl: _,
+811            params,
+812            return_type,
+813        } = self;
+814
+815        write!(f, "params: [")?;
+816        let mut delim = "";
+817        if let Some(s) = self_decl {
+818            write!(f, "{}self", if s.mut_.is_some() { "mut " } else { "" },)?;
+819            delim = ", ";
+820        }
+821
+822        for p in params {
+823            write!(
+824                f,
+825                "{}{{ label: {:?}, name: {}, typ: {} }}",
+826                delim,
+827                p.label,
+828                p.name,
+829                p.typ.as_ref().unwrap().display(db),
+830            )?;
+831            delim = ", ";
+832        }
+833        write!(f, "] -> {}", return_type.as_ref().unwrap().display(db))
+834    }
+835}
+836
+837impl fmt::Display for Generic {
+838    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+839        write!(f, "{}", self.name)
+840    }
+841}
+842
+843impl FromStr for Base {
+844    type Err = strum::ParseError;
+845
+846    fn from_str(s: &str) -> Result<Self, Self::Err> {
+847        match s {
+848            "bool" => Ok(Base::Bool),
+849            "address" => Ok(Base::Address),
+850            "()" => Ok(Base::Unit),
+851            _ => Ok(Base::Numeric(Integer::from_str(s)?)),
+852        }
+853    }
+854}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/operations.rs.html b/compiler-docs/src/fe_analyzer/operations.rs.html new file mode 100644 index 0000000000..0364a07575 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/operations.rs.html @@ -0,0 +1,179 @@ +operations.rs - source

fe_analyzer/
operations.rs

1use crate::context::AnalyzerContext;
+2use crate::errors::{BinaryOperationError, IndexingError};
+3use crate::namespace::types::{Array, Integer, Map, TraitOrType, Type, TypeDowncast, TypeId};
+4
+5use crate::traversal::types::{deref_type, try_coerce_type};
+6use fe_parser::{ast as fe, node::Node};
+7
+8/// Finds the type of an index operation and checks types.
+9///
+10/// e.g. `foo[42]`
+11pub fn index(
+12    context: &mut dyn AnalyzerContext,
+13    value: TypeId,
+14    indext: TypeId,
+15    index_expr: &Node<fe::Expr>,
+16) -> Result<TypeId, IndexingError> {
+17    match value.typ(context.db()) {
+18        Type::Array(array) => index_array(context, &array, indext, index_expr),
+19        Type::Map(map) => index_map(context, &map, indext, index_expr),
+20        Type::SPtr(inner) => {
+21            Ok(Type::SPtr(index(context, inner, indext, index_expr)?).id(context.db()))
+22        }
+23        Type::Mut(inner) => {
+24            Ok(Type::Mut(index(context, inner, indext, index_expr)?).id(context.db()))
+25        }
+26        Type::SelfType(id) => match id {
+27            TraitOrType::TypeId(inner) => index(context, inner, indext, index_expr),
+28            TraitOrType::TraitId(_) => Err(IndexingError::NotSubscriptable),
+29        },
+30        Type::Base(_)
+31        | Type::Tuple(_)
+32        | Type::String(_)
+33        | Type::Contract(_)
+34        | Type::SelfContract(_)
+35        | Type::Generic(_)
+36        | Type::Struct(_)
+37        | Type::Enum(_) => Err(IndexingError::NotSubscriptable),
+38    }
+39}
+40
+41pub fn expected_index_type(context: &mut dyn AnalyzerContext, obj: TypeId) -> Option<TypeId> {
+42    match obj.typ(context.db()) {
+43        Type::Array(_) => Some(Type::u256().id(context.db())),
+44        Type::Map(Map { key, .. }) => Some(key),
+45        Type::SPtr(inner) | Type::Mut(inner) => expected_index_type(context, inner),
+46        Type::SelfType(inner) => match inner {
+47            TraitOrType::TraitId(_) => None,
+48            TraitOrType::TypeId(id) => expected_index_type(context, id),
+49        },
+50        Type::Base(_)
+51        | Type::Tuple(_)
+52        | Type::String(_)
+53        | Type::Contract(_)
+54        | Type::SelfContract(_)
+55        | Type::Generic(_)
+56        | Type::Enum(_)
+57        | Type::Struct(_) => None,
+58    }
+59}
+60
+61fn index_array(
+62    context: &mut dyn AnalyzerContext,
+63    array: &Array,
+64    index: TypeId,
+65    index_expr: &Node<fe::Expr>,
+66) -> Result<TypeId, IndexingError> {
+67    let u256 = Type::u256().id(context.db());
+68    if try_coerce_type(context, Some(index_expr), index, u256, false).is_err() {
+69        return Err(IndexingError::WrongIndexType);
+70    }
+71
+72    Ok(array.inner)
+73}
+74
+75fn index_map(
+76    context: &mut dyn AnalyzerContext,
+77    map: &Map,
+78    index: TypeId,
+79    index_expr: &Node<fe::Expr>,
+80) -> Result<TypeId, IndexingError> {
+81    let Map { key, value } = map;
+82
+83    if try_coerce_type(context, Some(index_expr), index, *key, false).is_err() {
+84        return Err(IndexingError::WrongIndexType);
+85    }
+86    Ok(*value)
+87}
+88
+89/// Finds the type of a binary operation and checks types.
+90pub fn bin(
+91    context: &mut dyn AnalyzerContext,
+92    left: TypeId,
+93    left_expr: &Node<fe::Expr>,
+94    op: fe::BinOperator,
+95    right: TypeId,
+96    right_expr: &Node<fe::Expr>,
+97) -> Result<TypeId, BinaryOperationError> {
+98    // Add deref coercions, if necessary (this should always succeed).
+99    let left = deref_type(context, left_expr, left);
+100    let right = deref_type(context, right_expr, right);
+101
+102    if let (Some(left_int), Some(right_int)) =
+103        (left.as_int(context.db()), right.as_int(context.db()))
+104    {
+105        let int = match op {
+106            fe::BinOperator::Add
+107            | fe::BinOperator::Sub
+108            | fe::BinOperator::Mult
+109            | fe::BinOperator::Div
+110            | fe::BinOperator::Mod => {
+111                return bin_arithmetic(context, left, right, right_expr);
+112            }
+113            fe::BinOperator::Pow => bin_pow(left_int, right_int),
+114            fe::BinOperator::LShift | fe::BinOperator::RShift => bin_bit_shift(left_int, right_int),
+115            fe::BinOperator::BitOr | fe::BinOperator::BitXor | fe::BinOperator::BitAnd => {
+116                bin_bit(left_int, right_int)
+117            }
+118        }?;
+119        Ok(TypeId::int(context.db(), int))
+120    } else {
+121        Err(BinaryOperationError::TypesNotNumeric)
+122    }
+123}
+124
+125fn bin_arithmetic(
+126    context: &mut dyn AnalyzerContext,
+127    left: TypeId,
+128    right: TypeId,
+129    right_expr: &Node<fe::Expr>,
+130) -> Result<TypeId, BinaryOperationError> {
+131    // For now, we require that the types be numeric, have the same signedness,
+132    // and that left.size() >= right.size(). (The rules imposed by try_coerce_type)
+133    if try_coerce_type(context, Some(right_expr), right, left, false).is_ok() {
+134        // TODO: loosen up arightmetic type rules.
+135        // The rules should be:
+136        // - Any combination of numeric types can be operated on.
+137        // - If either number is signed, we return a signed type.
+138        // - The larger type is returned.
+139        Ok(left)
+140    } else {
+141        // The types are not equal. Again, there is no need to be this strict.
+142        Err(BinaryOperationError::TypesNotCompatible)
+143    }
+144}
+145
+146fn bin_pow(left: Integer, right: Integer) -> Result<Integer, BinaryOperationError> {
+147    // The exponent is not allowed to be a signed integer. To allow calculations
+148    // such as -2 ** 3 we allow the right hand side to be an unsigned integer
+149    // even if the left side is a signed integer. It is allowed as long as the
+150    // right side is the same size or smaller than the left side (e.g. i16 ** u16
+151    // but not i16 ** u32). The type of the result will be the type of the left
+152    // side and under/overflow checks are based on that type.
+153
+154    if right.is_signed() {
+155        Err(BinaryOperationError::RightIsSigned)
+156    } else if left.can_hold(right) {
+157        Ok(left)
+158    } else {
+159        Err(BinaryOperationError::RightTooLarge)
+160    }
+161}
+162
+163fn bin_bit_shift(left: Integer, right: Integer) -> Result<Integer, BinaryOperationError> {
+164    // The right side must be unsigned.
+165    if right.is_signed() {
+166        Err(BinaryOperationError::RightIsSigned)
+167    } else {
+168        Ok(left)
+169    }
+170}
+171
+172fn bin_bit(left: Integer, right: Integer) -> Result<Integer, BinaryOperationError> {
+173    // We require that both numbers be unsigned and equal in size.
+174    if !left.is_signed() && left == right {
+175        Ok(left)
+176    } else {
+177        Err(BinaryOperationError::NotEqualAndUnsigned)
+178    }
+179}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/assignments.rs.html b/compiler-docs/src/fe_analyzer/traversal/assignments.rs.html new file mode 100644 index 0000000000..fddc5afb45 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/assignments.rs.html @@ -0,0 +1,143 @@ +assignments.rs - source

fe_analyzer/traversal/
assignments.rs

1use crate::context::{AnalyzerContext, DiagnosticVoucher, NamedThing};
+2use crate::errors::FatalError;
+3use crate::namespace::scopes::BlockScope;
+4use crate::namespace::types::{Type, TypeId};
+5use crate::operations;
+6use crate::traversal::expressions;
+7use crate::traversal::utils::add_bin_operations_errors;
+8use fe_common::diagnostics::Label;
+9use fe_parser::ast as fe;
+10use fe_parser::node::{Node, Span};
+11use smol_str::SmolStr;
+12
+13/// Gather context information for assignments and check for type errors.
+14///
+15/// e.g. `foo[42] = "bar"`, `self.foo[42] = "bar"`, `foo = 42`
+16pub fn assign(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+17    let (target, value) = match &stmt.kind {
+18        fe::FuncStmt::Assign { target, value } => (target, value),
+19        _ => unreachable!(),
+20    };
+21    if is_valid_assign_target(scope, target)? {
+22        let lhs_type = assignment_lhs_type(scope, target)?;
+23        expressions::expect_expr_type(scope, value, lhs_type, true)?;
+24    }
+25    Ok(())
+26}
+27
+28/// Logs error if `target` type is not `Mut`.
+29/// Returns `target` type, with `Mut` stripped off.
+30fn assignment_lhs_type(
+31    scope: &mut BlockScope,
+32    target: &Node<fe::Expr>,
+33) -> Result<TypeId, FatalError> {
+34    let ty = expressions::expr_type(scope, target)?;
+35    match ty.typ(scope.db()) {
+36        Type::Mut(inner) => Ok(inner),
+37        _ => {
+38            let mut labels = vec![Label::primary(target.span, "not mutable")];
+39            if let Some((name, span)) = name_def_span(scope, target) {
+40                labels.push(Label::secondary(
+41                    span,
+42                    format!("consider changing this to be mutable: `mut {name}`"),
+43                ));
+44            }
+45            scope.fancy_error(
+46                &format!("cannot modify `{}`, as it is not mutable", &target.kind),
+47                labels,
+48                vec![],
+49            );
+50            Ok(ty)
+51        }
+52    }
+53}
+54
+55fn name_def_span(scope: &BlockScope, expr: &Node<fe::Expr>) -> Option<(SmolStr, Span)> {
+56    match &expr.kind {
+57        fe::Expr::Attribute { value, .. } | fe::Expr::Subscript { value, .. } => {
+58            name_def_span(scope, value)
+59        }
+60        fe::Expr::Name(name) => {
+61            let thing = scope.resolve_name(name, expr.span).ok()??;
+62            thing.name_span(scope.db()).map(|span| (name.clone(), span))
+63        }
+64        _ => None,
+65    }
+66}
+67
+68fn is_valid_assign_target(
+69    scope: &mut BlockScope,
+70    expr: &Node<fe::Expr>,
+71) -> Result<bool, FatalError> {
+72    use fe::Expr::*;
+73
+74    match &expr.kind {
+75        Attribute { .. } | Subscript { .. } => Ok(true),
+76        Tuple { elts } => {
+77            for elt in elts {
+78                if !is_valid_assign_target(scope, elt)? {
+79                    return Ok(false);
+80                }
+81            }
+82            Ok(true)
+83        }
+84
+85        Name(name) => match scope.resolve_name(name, expr.span) {
+86            Ok(Some(NamedThing::SelfValue { .. })) => Ok(true),
+87            Ok(Some(NamedThing::Item(_)) | Some(NamedThing::EnumVariant(_)) | None) => {
+88                bad_assign_target_error(scope, expr, "invalid assignment target");
+89                Ok(false)
+90            }
+91            Ok(Some(NamedThing::Variable { is_const, .. })) => {
+92                if is_const {
+93                    bad_assign_target_error(scope, expr, "cannot assign to a constant value");
+94                }
+95                Ok(!is_const)
+96            }
+97            Err(e) => Err(e.into()),
+98        },
+99        _ => {
+100            bad_assign_target_error(scope, expr, "invalid assignment target");
+101            Ok(false)
+102        }
+103    }
+104}
+105
+106fn bad_assign_target_error(
+107    scope: &mut BlockScope,
+108    expr: &Node<fe::Expr>,
+109    msg: &str,
+110) -> DiagnosticVoucher {
+111    scope.fancy_error(
+112        msg,
+113        vec![Label::primary(expr.span, "")],
+114        vec!["The left side of an assignment can be a variable name, attribute, subscript, or tuple.".into()]
+115    )
+116}
+117
+118/// Gather context information for assignments and check for type errors.
+119pub fn aug_assign(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+120    let (target, op, value) = match &stmt.kind {
+121        fe::FuncStmt::AugAssign { target, op, value } => (target, op, value),
+122        _ => unreachable!(),
+123    };
+124
+125    if is_valid_assign_target(scope, target)? {
+126        let lhs_ty = assignment_lhs_type(scope, target)?;
+127        let rhs = expressions::expr(scope, value, Some(lhs_ty))?;
+128
+129        if let Err(err) = operations::bin(scope, lhs_ty, target, op.kind, rhs.typ, value) {
+130            add_bin_operations_errors(
+131                scope,
+132                &op.kind,
+133                target.span,
+134                lhs_ty,
+135                value.span,
+136                rhs.typ,
+137                err,
+138            );
+139        }
+140    }
+141
+142    Ok(())
+143}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/borrowck.rs.html b/compiler-docs/src/fe_analyzer/traversal/borrowck.rs.html new file mode 100644 index 0000000000..51ef265d96 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/borrowck.rs.html @@ -0,0 +1,110 @@ +borrowck.rs - source

fe_analyzer/traversal/
borrowck.rs

1use super::call_args::LabeledParameter;
+2use crate::context::{AnalyzerContext, NamedThing};
+3use crate::namespace::types::{Type, TypeId};
+4use fe_common::diagnostics::Label;
+5use fe_parser::ast;
+6use fe_parser::node::{Node, Span};
+7use smallvec::{smallvec, SmallVec};
+8
+9// NOTE: This is a temporary solution to the only borrowing bug that's possible
+10// in the current semantics of Fe, namely passing a mutable reference to a
+11// non-primitive object into a fn call, and another reference to that same
+12// object (mutable or otherwise).
+13// This is an ugly brute force solution that will definitely not scale
+14// beyond this simple case, and doesn't do anything smart like allow
+15// disjoint partial borrows.
+16// This should be replaced with a proper borrow checker (presumably operating
+17// on MIR) when Fe gains some kind of reference/projection type.
+18pub fn check_fn_call_arg_borrows(
+19    context: &mut dyn AnalyzerContext,
+20    fn_name: &str,
+21    method_self: Option<(&Node<ast::Expr>, TypeId)>,
+22    args: &[Node<ast::CallArg>],
+23    params: &[impl LabeledParameter],
+24) {
+25    // Return early if there are no mut params.
+26    // This function doesn't attempt to be efficient.
+27    let mut_self = method_self
+28        .map(|(_, ty)| ty.is_mut(context.db()))
+29        .unwrap_or(false);
+30    if !mut_self
+31        && !params
+32            .iter()
+33            .any(|p| p.typ().map(|t| t.is_mut(context.db())).unwrap_or(false))
+34    {
+35        return;
+36    }
+37
+38    // Allocate a new Vec<(arg, ty)> including the method target (if present)
+39    let param_ty = params
+40        .iter()
+41        .map(|p| p.typ().unwrap_or_else(|_| Type::unit().id(context.db())));
+42    let mut args = args
+43        .iter()
+44        .map(|arg| &arg.kind.value)
+45        .zip(param_ty)
+46        .collect::<Vec<_>>();
+47    if let Some((target_expr, ty)) = method_self {
+48        args.insert(0, (target_expr, ty));
+49    }
+50
+51    for (idx, (arg, _)) in args
+52        .iter()
+53        .enumerate()
+54        .filter(|(_, (_, ty))| ty.is_mut(context.db()))
+55    {
+56        // Find the "root" var of the mut arg expr. Eg the root of a.b.c is `a`.
+57        // In the case of a ternary expr, there may be more than one.
+58        // Eg foo(a if x else (b if y else c))
+59        let vars = resolve_expr_root_vars(context, arg);
+60
+61        // Check all other non-primitive args for the same root var.
+62        for (_, (other, _)) in args
+63            .iter()
+64            .enumerate()
+65            .filter(|(i, (_, ty))| *i != idx && !ty.is_primitive(context.db()))
+66        {
+67            let other_vars = resolve_expr_root_vars(context, other);
+68            for (var, var_span) in &vars {
+69                if let Some((_, other_span)) = other_vars.iter().find(|(nt, _)| nt == var) {
+70                    let name = var.name(context.db());
+71                    context.fancy_error(
+72                        &format!("borrow conflict in call to fn `{fn_name}`"),
+73                        vec![
+74                            Label::primary(*var_span, format!("`{name}` is used mutably here")),
+75                            Label::secondary(*other_span, format!("`{name}` is used again here")),
+76                        ],
+77                        vec![],
+78                    );
+79                    return;
+80                }
+81            }
+82        }
+83    }
+84}
+85
+86fn resolve_expr_root_vars(
+87    context: &dyn AnalyzerContext,
+88    expr: &Node<ast::Expr>,
+89) -> SmallVec<[(NamedThing, Span); 2]> {
+90    match &expr.kind {
+91        ast::Expr::Name(name) => match context.resolve_name(name, expr.span) {
+92            Ok(
+93                Some(nt @ NamedThing::Variable { .. }) | Some(nt @ NamedThing::SelfValue { .. }),
+94            ) => smallvec![(nt, expr.span)],
+95            _ => smallvec![],
+96        },
+97
+98        ast::Expr::Attribute { value, .. } | ast::Expr::Subscript { value, .. } => {
+99            resolve_expr_root_vars(context, value)
+100        }
+101        ast::Expr::Ternary {
+102            if_expr, else_expr, ..
+103        } => {
+104            let mut left = resolve_expr_root_vars(context, if_expr);
+105            left.append(&mut resolve_expr_root_vars(context, else_expr));
+106            left
+107        }
+108        _ => smallvec![],
+109    }
+110}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/call_args.rs.html b/compiler-docs/src/fe_analyzer/traversal/call_args.rs.html new file mode 100644 index 0000000000..1761651d20 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/call_args.rs.html @@ -0,0 +1,228 @@ +call_args.rs - source

fe_analyzer/traversal/
call_args.rs

1use super::expressions::{expr, expr_type};
+2use super::types::try_coerce_type;
+3use crate::context::{AnalyzerContext, DiagnosticVoucher};
+4use crate::display::Displayable;
+5use crate::errors::{self, FatalError, TypeCoercionError, TypeError};
+6use crate::namespace::types::{FunctionParam, Generic, Type, TypeId};
+7use fe_common::{diagnostics::Label, utils::humanize::pluralize_conditionally};
+8use fe_common::{Span, Spanned};
+9use fe_parser::ast as fe;
+10use fe_parser::node::Node;
+11use smol_str::SmolStr;
+12
+13pub trait LabeledParameter {
+14    fn label(&self) -> Option<&str>;
+15    fn typ(&self) -> Result<TypeId, TypeError>;
+16    fn is_sink(&self) -> bool;
+17}
+18
+19impl LabeledParameter for FunctionParam {
+20    fn label(&self) -> Option<&str> {
+21        self.label()
+22    }
+23    fn typ(&self) -> Result<TypeId, TypeError> {
+24        self.typ.clone()
+25    }
+26    fn is_sink(&self) -> bool {
+27        false
+28    }
+29}
+30
+31impl LabeledParameter for (SmolStr, Result<TypeId, TypeError>, bool) {
+32    fn label(&self) -> Option<&str> {
+33        Some(&self.0)
+34    }
+35    fn typ(&self) -> Result<TypeId, TypeError> {
+36        self.1.clone()
+37    }
+38    fn is_sink(&self) -> bool {
+39        self.2
+40    }
+41}
+42
+43impl LabeledParameter for (Option<SmolStr>, Result<TypeId, TypeError>, bool) {
+44    fn label(&self) -> Option<&str> {
+45        self.0.as_ref().map(smol_str::SmolStr::as_str)
+46    }
+47    fn typ(&self) -> Result<TypeId, TypeError> {
+48        self.1.clone()
+49    }
+50    fn is_sink(&self) -> bool {
+51        self.2
+52    }
+53}
+54
+55pub fn validate_arg_count(
+56    context: &dyn AnalyzerContext,
+57    name: &str,
+58    name_span: Span,
+59    args: &Node<Vec<impl Spanned>>,
+60    param_count: usize,
+61    argument_word: &str,
+62) -> Option<DiagnosticVoucher> {
+63    if args.kind.len() == param_count {
+64        None
+65    } else {
+66        let mut labels = vec![Label::primary(
+67            name_span,
+68            format!(
+69                "expects {} {}",
+70                param_count,
+71                pluralize_conditionally(argument_word, param_count)
+72            ),
+73        )];
+74        if args.kind.is_empty() {
+75            labels.push(Label::secondary(args.span, "supplied 0 arguments"));
+76        } else {
+77            for arg in &args.kind {
+78                labels.push(Label::secondary(arg.span(), ""));
+79            }
+80            labels.last_mut().unwrap().message = format!(
+81                "supplied {} {}",
+82                args.kind.len(),
+83                pluralize_conditionally(argument_word, args.kind.len())
+84            );
+85        }
+86
+87        Some(context.fancy_error(
+88            &format!(
+89                "`{}` expects {} {}, but {} {} provided",
+90                name,
+91                param_count,
+92                pluralize_conditionally(argument_word, param_count),
+93                args.kind.len(),
+94                pluralize_conditionally(("was", "were"), args.kind.len())
+95            ),
+96            labels,
+97            vec![],
+98        ))
+99        // TODO: add `defined here` label (need span for definition)
+100    }
+101}
+102
+103// TODO: missing label error should suggest adding `_` to fn def
+104pub fn validate_named_args(
+105    context: &mut dyn AnalyzerContext,
+106    name: &str,
+107    name_span: Span,
+108    args: &Node<Vec<Node<fe::CallArg>>>,
+109    params: &[impl LabeledParameter],
+110) -> Result<(), FatalError> {
+111    validate_arg_count(context, name, name_span, args, params.len(), "argument");
+112    // TODO: if the first arg is missing, every other arg will get a label and type
+113    // error
+114
+115    for (index, (param, arg)) in params.iter().zip(args.kind.iter()).enumerate() {
+116        let expected_label = param.label();
+117        let arg_val = &arg.kind.value;
+118        match (expected_label, &arg.kind.label) {
+119            (Some(expected_label), Some(actual_label)) => {
+120                if expected_label != actual_label.kind {
+121                    let notes = if params
+122                        .iter()
+123                        .any(|param| param.label() == Some(actual_label.kind.as_str()))
+124                    {
+125                        vec!["Note: arguments must be provided in order.".into()]
+126                    } else {
+127                        vec![]
+128                    };
+129                    context.fancy_error(
+130                        "argument label mismatch",
+131                        vec![Label::primary(
+132                            actual_label.span,
+133                            format!("expected `{expected_label}`"),
+134                        )],
+135                        notes,
+136                    );
+137                }
+138            }
+139            (Some(expected_label), None) => match &arg_val.kind {
+140                fe::Expr::Name(var_name) if var_name == expected_label => {}
+141                _ => {
+142                    context.fancy_error(
+143                            "missing argument label",
+144                            vec![Label::primary(
+145                                Span::new(arg_val.span.file_id, arg_val.span.start, arg_val.span.start),
+146                                format!("add `{expected_label}:` here"),
+147                            )],
+148                            vec![format!(
+149                                "Note: this label is optional if the argument is a variable named `{expected_label}`."
+150                            )],
+151                        );
+152                }
+153            },
+154            (None, Some(actual_label)) => {
+155                context.error(
+156                    "argument should not be labeled",
+157                    actual_label.span,
+158                    "remove this label",
+159                );
+160            }
+161            (None, None) => {}
+162        }
+163
+164        let param_type = param.typ()?;
+165        // Check arg type
+166        let arg_type =
+167            if let Type::Generic(Generic { bounds, .. }) = param_type.deref_typ(context.db()) {
+168                let arg_type = expr_type(context, &arg.kind.value)?;
+169                for bound in bounds.iter() {
+170                    if !bound.is_implemented_for(context.db(), arg_type) {
+171                        context.error(
+172                            &format!(
+173                                "the trait bound `{}: {}` is not satisfied",
+174                                arg_type.display(context.db()),
+175                                bound.name(context.db())
+176                            ),
+177                            arg.span,
+178                            &format!(
+179                                "the trait `{}` is not implemented for `{}`",
+180                                bound.name(context.db()),
+181                                arg_type.display(context.db()),
+182                            ),
+183                        );
+184                    }
+185                }
+186                arg_type
+187            } else {
+188                let arg_attr = expr(context, &arg.kind.value, Some(param_type))?;
+189                match try_coerce_type(
+190                    context,
+191                    Some(&arg.kind.value),
+192                    arg_attr.typ,
+193                    param_type,
+194                    param.is_sink(),
+195                ) {
+196                    Err(TypeCoercionError::Incompatible) => {
+197                        let msg = if let Some(label) = param.label() {
+198                            format!("incorrect type for `{name}` argument `{label}`")
+199                        } else {
+200                            format!("incorrect type for `{name}` argument at position {index}")
+201                        };
+202                        context.type_error(&msg, arg.kind.value.span, param_type, arg_attr.typ);
+203                    }
+204                    Err(TypeCoercionError::RequiresToMem) => {
+205                        context.add_diagnostic(errors::to_mem_error(arg.span));
+206                    }
+207                    Err(TypeCoercionError::SelfContractType) => {
+208                        context.add_diagnostic(errors::self_contract_type_error(
+209                            arg.span,
+210                            &param_type.display(context.db()),
+211                        ));
+212                    }
+213                    Ok(_) => {}
+214                }
+215                arg_attr.typ
+216            };
+217
+218        if param_type.is_mut(context.db()) && !arg_type.is_mut(context.db()) {
+219            let msg = if let Some(label) = param.label() {
+220                format!("`{name}` argument `{label}` must be mutable")
+221            } else {
+222                format!("`{name}` argument at position {index} must be mutable")
+223            };
+224            context.error(&msg, arg.kind.value.span, "is not `mut`");
+225        }
+226    }
+227    Ok(())
+228}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/const_expr.rs.html b/compiler-docs/src/fe_analyzer/traversal/const_expr.rs.html new file mode 100644 index 0000000000..4ebabe1c64 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/const_expr.rs.html @@ -0,0 +1,370 @@ +const_expr.rs - source

fe_analyzer/traversal/
const_expr.rs

1//! This module provides evaluator for constant expression to resolve const
+2//! generics.
+3
+4use num_bigint::BigInt;
+5use num_traits::{One, ToPrimitive, Zero};
+6
+7use crate::{
+8    context::{AnalyzerContext, Constant},
+9    errors::ConstEvalError,
+10    namespace::types::{self, Base, Type},
+11};
+12
+13use fe_common::{numeric, Span};
+14use fe_parser::{
+15    ast::{self, BinOperator, BoolOperator, CompOperator, UnaryOperator},
+16    node::Node,
+17};
+18
+19/// Evaluate expression.
+20///
+21/// # Panics
+22///
+23/// 1. Panics if type analysis on an `expr` is not performed beforehand.
+24/// 2. Panics if an `expr` has an invalid type.
+25pub(crate) fn eval_expr(
+26    context: &mut dyn AnalyzerContext,
+27    expr: &Node<ast::Expr>,
+28) -> Result<Constant, ConstEvalError> {
+29    let typ = context.expr_typ(expr);
+30
+31    match &expr.kind {
+32        ast::Expr::Ternary {
+33            if_expr,
+34            test,
+35            else_expr,
+36        } => eval_ternary(context, if_expr, test, else_expr),
+37        ast::Expr::BoolOperation { left, op, right } => eval_bool_op(context, left, op, right),
+38        ast::Expr::BinOperation { left, op, right } => eval_bin_op(context, left, op, right, &typ),
+39        ast::Expr::UnaryOperation { op, operand } => eval_unary_op(context, op, operand),
+40        ast::Expr::CompOperation { left, op, right } => eval_comp_op(context, left, op, right),
+41        ast::Expr::Bool(val) => Ok(Constant::Bool(*val)),
+42        ast::Expr::Name(name) => match context.constant_value_by_name(name, expr.span)? {
+43            Some(const_value) => Ok(const_value),
+44            _ => Err(not_const_error(context, expr.span)),
+45        },
+46
+47        ast::Expr::Num(num) => {
+48            // We don't validate the string representing number here,
+49            // because we assume the string has been already validate in type analysis.
+50            let span = expr.span;
+51            Constant::from_num_str(context, num, &typ, span)
+52        }
+53
+54        ast::Expr::Str(s) => Ok(Constant::Str(s.clone())),
+55
+56        // TODO: Need to evaluate attribute getter, constant constructor and const fn call.
+57        ast::Expr::Subscript { .. }
+58        | ast::Expr::Path(_)
+59        | ast::Expr::Attribute { .. }
+60        | ast::Expr::Call { .. }
+61        | ast::Expr::List { .. }
+62        | ast::Expr::Repeat { .. }
+63        | ast::Expr::Tuple { .. }
+64        | ast::Expr::Unit => Err(not_const_error(context, expr.span)),
+65    }
+66}
+67
+68/// Evaluates ternary expression.
+69fn eval_ternary(
+70    context: &mut dyn AnalyzerContext,
+71    then_expr: &Node<ast::Expr>,
+72    cond: &Node<ast::Expr>,
+73    else_expr: &Node<ast::Expr>,
+74) -> Result<Constant, ConstEvalError> {
+75    // In constant evaluation, we don't apply short circuit property for safety.
+76    let then = eval_expr(context, then_expr)?;
+77    let cond = eval_expr(context, cond)?;
+78    let else_ = eval_expr(context, else_expr)?;
+79
+80    match cond {
+81        Constant::Bool(cond) => {
+82            if cond {
+83                Ok(then)
+84            } else {
+85                Ok(else_)
+86            }
+87        }
+88        _ => panic!("ternary condition is not a bool type"),
+89    }
+90}
+91
+92/// Evaluates logical expressions.
+93fn eval_bool_op(
+94    context: &mut dyn AnalyzerContext,
+95    lhs: &Node<ast::Expr>,
+96    op: &Node<ast::BoolOperator>,
+97    rhs: &Node<ast::Expr>,
+98) -> Result<Constant, ConstEvalError> {
+99    // In constant evaluation, we don't apply short circuit property for safety.
+100    let (lhs, rhs) = (eval_expr(context, lhs)?, eval_expr(context, rhs)?);
+101    let (lhs, rhs) = match (lhs, rhs) {
+102        (Constant::Bool(lhs), Constant::Bool(rhs)) => (lhs, rhs),
+103        _ => panic!("an argument of a logical expression is not bool type"),
+104    };
+105
+106    match op.kind {
+107        BoolOperator::And => Ok(Constant::Bool(lhs && rhs)),
+108        BoolOperator::Or => Ok(Constant::Bool(lhs || rhs)),
+109    }
+110}
+111
+112/// Evaluates binary expressions.
+113fn eval_bin_op(
+114    context: &mut dyn AnalyzerContext,
+115    lhs: &Node<ast::Expr>,
+116    op: &Node<ast::BinOperator>,
+117    rhs: &Node<ast::Expr>,
+118    typ: &Type,
+119) -> Result<Constant, ConstEvalError> {
+120    let span = lhs.span + rhs.span;
+121    let lhs_ty = extract_int_typ(&context.expr_typ(lhs));
+122
+123    let (lhs, rhs) = (eval_expr(context, lhs)?, eval_expr(context, rhs)?);
+124    let (lhs, rhs) = (lhs.extract_numeric(), rhs.extract_numeric());
+125
+126    let result = match op.kind {
+127        BinOperator::Add => lhs + rhs,
+128        BinOperator::Sub => lhs - rhs,
+129        BinOperator::Mult => lhs * rhs,
+130
+131        BinOperator::Div => {
+132            if rhs.is_zero() {
+133                return Err(zero_division_error(context, span));
+134            } else if lhs_ty.is_signed() && lhs == &(lhs_ty.min_value()) && rhs == &(-BigInt::one())
+135            {
+136                return Err(overflow_error(context, span));
+137            } else {
+138                lhs / rhs
+139            }
+140        }
+141
+142        BinOperator::Mod => {
+143            if rhs.is_zero() {
+144                return Err(zero_division_error(context, span));
+145            }
+146            lhs % rhs
+147        }
+148
+149        BinOperator::Pow => {
+150            // We assume `rhs` type is unsigned numeric.
+151            if let Some(exponent) = rhs.to_u32() {
+152                lhs.pow(exponent)
+153            } else if lhs.is_zero() {
+154                BigInt::zero()
+155            } else if lhs.is_one() {
+156                BigInt::one()
+157            } else {
+158                // Exponent is larger than u32::MAX and lhs is not zero nor one,
+159                // then this trivially causes overflow.
+160                return Err(overflow_error(context, span));
+161            }
+162        }
+163
+164        BinOperator::LShift => {
+165            if let Some(exponent) = rhs.to_usize() {
+166                let type_bits = lhs_ty.bits();
+167                // If rhs is larger than or equal to lhs type bits, then we emits overflow
+168                // error.
+169                if exponent >= type_bits {
+170                    return Err(overflow_error(context, span));
+171                } else {
+172                    let mask = make_mask(typ);
+173                    (lhs * BigInt::from(2_u8).pow(exponent as u32)) & mask
+174                }
+175            } else {
+176                // If exponent is larger than usize::MAX, it causes trivially overflow.
+177                return Err(overflow_error(context, span));
+178            }
+179        }
+180
+181        BinOperator::RShift => {
+182            if let Some(exponent) = rhs.to_usize() {
+183                let type_bits = lhs_ty.bits();
+184                // If rhs is larger than or equal to lhs type bits, then we emits overflow
+185                // error.
+186                if exponent >= type_bits {
+187                    return Err(overflow_error(context, span));
+188                } else {
+189                    let mask = make_mask(typ);
+190                    (lhs / BigInt::from(2_u8).pow(exponent as u32)) & mask
+191                }
+192            } else {
+193                // If exponent is larger than usize::MAX, it causes trivially overflow.
+194                return Err(overflow_error(context, span));
+195            }
+196        }
+197
+198        BinOperator::BitOr => lhs | rhs,
+199        BinOperator::BitXor => lhs ^ rhs,
+200        BinOperator::BitAnd => lhs & rhs,
+201    };
+202
+203    Constant::make_const_numeric_with_ty(context, result, typ, span)
+204}
+205
+206fn eval_unary_op(
+207    context: &mut dyn AnalyzerContext,
+208    op: &Node<ast::UnaryOperator>,
+209    arg: &Node<ast::Expr>,
+210) -> Result<Constant, ConstEvalError> {
+211    let arg = eval_expr(context, arg)?;
+212
+213    match op.kind {
+214        UnaryOperator::Invert => Ok(Constant::Int(!arg.extract_numeric())),
+215        UnaryOperator::Not => Ok(Constant::Bool(!arg.extract_bool())),
+216        UnaryOperator::USub => Ok(Constant::Int(-arg.extract_numeric())),
+217    }
+218}
+219
+220/// Evaluates comp operation.
+221fn eval_comp_op(
+222    context: &mut dyn AnalyzerContext,
+223    lhs: &Node<ast::Expr>,
+224    op: &Node<ast::CompOperator>,
+225    rhs: &Node<ast::Expr>,
+226) -> Result<Constant, ConstEvalError> {
+227    let (lhs, rhs) = (eval_expr(context, lhs)?, eval_expr(context, rhs)?);
+228
+229    let res = match (lhs, rhs) {
+230        (Constant::Int(lhs), Constant::Int(rhs)) => match op.kind {
+231            CompOperator::Eq => lhs == rhs,
+232            CompOperator::NotEq => lhs != rhs,
+233            CompOperator::Lt => lhs < rhs,
+234            CompOperator::LtE => lhs <= rhs,
+235            CompOperator::Gt => lhs > rhs,
+236            CompOperator::GtE => lhs >= rhs,
+237        },
+238
+239        (Constant::Bool(lhs), Constant::Bool(rhs)) => match op.kind {
+240            CompOperator::Eq => lhs == rhs,
+241            CompOperator::NotEq => lhs != rhs,
+242            CompOperator::Lt => !lhs & rhs,
+243            CompOperator::LtE => lhs <= rhs,
+244            CompOperator::Gt => lhs & !rhs,
+245            CompOperator::GtE => lhs >= rhs,
+246        },
+247
+248        _ => panic!("arguments of comp op have invalid type"),
+249    };
+250
+251    Ok(Constant::Bool(res))
+252}
+253
+254impl Constant {
+255    /// Returns constant from numeric literal represented by string.
+256    ///
+257    /// # Panics
+258    /// Panics if `s` is invalid string for numeric literal.
+259    pub fn from_num_str(
+260        context: &mut dyn AnalyzerContext,
+261        s: &str,
+262        typ: &Type,
+263        span: Span,
+264    ) -> Result<Self, ConstEvalError> {
+265        let literal = numeric::Literal::new(s);
+266        let num = literal.parse::<BigInt>().unwrap();
+267        match typ {
+268            Type::Base(Base::Numeric(_)) => {
+269                Self::make_const_numeric_with_ty(context, num, typ, span)
+270            }
+271            Type::Base(Base::Address) => {
+272                if num >= BigInt::zero() && num <= types::address_max() {
+273                    Ok(Constant::Address(num))
+274                } else {
+275                    Err(overflow_error(context, span))
+276                }
+277            }
+278            _ => unreachable!(),
+279        }
+280    }
+281
+282    /// Returns constant from numeric literal that fits type bits.
+283    /// If `val` doesn't fit type bits, then return `Err`.
+284    ///
+285    /// # Panics
+286    /// Panics if `typ` is invalid string for numeric literal.
+287    fn make_const_numeric_with_ty(
+288        context: &mut dyn AnalyzerContext,
+289        val: BigInt,
+290        typ: &Type,
+291        span: Span,
+292    ) -> Result<Self, ConstEvalError> {
+293        // Overflowing check.
+294        if extract_int_typ(typ).fits(val.clone()) {
+295            Ok(Constant::Int(val))
+296        } else {
+297            Err(overflow_error(context, span))
+298        }
+299    }
+300
+301    /// Extracts numeric value from a `Constant`.
+302    ///
+303    /// # Panics
+304    /// Panics if a `self` variant is not a numeric.
+305    fn extract_numeric(&self) -> &BigInt {
+306        match self {
+307            Constant::Int(val) => val,
+308            _ => panic!("can't extract numeric value from {self:?}"),
+309        }
+310    }
+311
+312    /// Extracts bool value from a `Constant`.
+313    ///
+314    /// # Panics
+315    /// Panics if a `self` variant is not a bool.
+316    fn extract_bool(&self) -> bool {
+317        match self {
+318            Constant::Bool(val) => *val,
+319            _ => panic!("can't extract bool value from {self:?}"),
+320        }
+321    }
+322}
+323
+324fn not_const_error(context: &mut dyn AnalyzerContext, span: Span) -> ConstEvalError {
+325    ConstEvalError::new(context.error(
+326        "expression is not a constant",
+327        span,
+328        "expression is required to be constant here",
+329    ))
+330}
+331
+332fn overflow_error(context: &mut dyn AnalyzerContext, span: Span) -> ConstEvalError {
+333    ConstEvalError::new(context.error(
+334        "overflow error",
+335        span,
+336        "overflow occurred during constant evaluation",
+337    ))
+338}
+339
+340fn zero_division_error(context: &mut dyn AnalyzerContext, span: Span) -> ConstEvalError {
+341    ConstEvalError::new(context.error(
+342        "zero division error",
+343        span,
+344        "zero division occurred during constant evaluation",
+345    ))
+346}
+347
+348/// Returns integer types embedded in `typ`.
+349///
+350/// # Panic
+351/// Panics if `typ` is not a numeric type.
+352fn extract_int_typ(typ: &Type) -> types::Integer {
+353    match typ {
+354        Type::Base(Base::Numeric(int_ty)) => *int_ty,
+355        _ => {
+356            panic!("invalid binop expression type")
+357        }
+358    }
+359}
+360
+361/// Returns bit mask corresponding to typ.
+362/// e.g. If type is `Type::Base(Base::Numeric(Integer::I32))`, then returns
+363/// `0xffff_ffff`.
+364///
+365/// # Panic
+366/// Panics if `typ` is not a numeric type.
+367fn make_mask(typ: &Type) -> BigInt {
+368    let bits = extract_int_typ(typ).bits();
+369    (BigInt::one() << bits) - 1
+370}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/declarations.rs.html b/compiler-docs/src/fe_analyzer/traversal/declarations.rs.html new file mode 100644 index 0000000000..614c4db1fc --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/declarations.rs.html @@ -0,0 +1,174 @@ +declarations.rs - source

fe_analyzer/traversal/
declarations.rs

1use crate::context::AnalyzerContext;
+2use crate::display::Displayable;
+3use crate::errors::{self, FatalError, TypeCoercionError};
+4use crate::namespace::scopes::BlockScope;
+5use crate::namespace::types::{Type, TypeId};
+6use crate::traversal::{const_expr, expressions, types};
+7use fe_common::{diagnostics::Label, utils::humanize::pluralize_conditionally};
+8use fe_parser::ast as fe;
+9use fe_parser::node::Node;
+10
+11/// Gather context information for var declarations and check for type errors.
+12pub fn var_decl(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+13    let (target, typ, value, mut_) = match &stmt.kind {
+14        fe::FuncStmt::VarDecl {
+15            target,
+16            typ,
+17            value,
+18            mut_,
+19        } => (target, typ, value, mut_),
+20        _ => unreachable!(),
+21    };
+22
+23    let self_ty = scope
+24        .parent_function()
+25        .clone()
+26        .self_type(scope.db())
+27        .map(|val| val.as_trait_or_type());
+28    let declared_type = types::type_desc(scope, typ, self_ty)?;
+29    if let Type::Map(_) = declared_type.typ(scope.db()) {
+30        return Err(FatalError::new(scope.error(
+31            "invalid variable type",
+32            typ.span,
+33            "`Map` type can only be used as a contract field",
+34        )));
+35    }
+36
+37    if let Some(value) = value {
+38        let rhs = expressions::expr(scope, value, Some(declared_type))?;
+39        let should_copy = mut_.is_some() || rhs.typ.is_mut(scope.db());
+40        match types::try_coerce_type(scope, Some(value), rhs.typ, declared_type, should_copy) {
+41            Err(TypeCoercionError::RequiresToMem) => {
+42                scope.add_diagnostic(errors::to_mem_error(value.span));
+43            }
+44            Err(TypeCoercionError::Incompatible) => {
+45                scope.type_error(
+46                    "type mismatch",
+47                    value.span,
+48                    declared_type,
+49                    rhs.typ.deref(scope.db()),
+50                );
+51            }
+52            Err(TypeCoercionError::SelfContractType) => {
+53                scope.add_diagnostic(errors::self_contract_type_error(
+54                    value.span,
+55                    &rhs.typ.display(scope.db()),
+56                ));
+57            }
+58            Ok(_) => {}
+59        }
+60    } else if matches!(
+61        declared_type.typ(scope.db()),
+62        Type::Array(_) | Type::Struct(_) | Type::Tuple(_)
+63    ) {
+64        scope.error(
+65            "uninitialized variable",
+66            target.span,
+67            &format!(
+68                "{} types must be initialized at declaration site",
+69                declared_type.kind_display_name(scope.db())
+70            ),
+71        );
+72    }
+73
+74    if mut_.is_some() {
+75        add_var(scope, target, Type::Mut(declared_type).id(scope.db()))?;
+76    } else {
+77        add_var(scope, target, declared_type)?;
+78    }
+79    Ok(())
+80}
+81
+82pub fn const_decl(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+83    if let fe::FuncStmt::ConstantDecl { name, typ, value } = &stmt.kind {
+84        let self_ty = scope
+85            .parent_function()
+86            .clone()
+87            .self_type(scope.db())
+88            .map(|val| val.as_trait_or_type());
+89
+90        let declared_type = match types::type_desc(scope, typ, self_ty) {
+91            Ok(typ) if typ.has_fixed_size(scope.db()) => typ,
+92            _ => {
+93                // If this conversion fails, the type must be a map (for now at least)
+94                return Err(FatalError::new(scope.error(
+95                    "invalid constant type",
+96                    typ.span,
+97                    "`Map` type can only be used as a contract field",
+98                )));
+99            }
+100        };
+101
+102        // Perform semantic analysis before const evaluation.
+103        let value_attributes = expressions::expr(scope, value, Some(declared_type))?;
+104
+105        if declared_type != value_attributes.typ {
+106            scope.type_error(
+107                "type mismatch",
+108                value.span,
+109                declared_type,
+110                value_attributes.typ,
+111            );
+112        }
+113
+114        // Perform constant evaluation.
+115        let const_value = const_expr::eval_expr(scope, value)?;
+116
+117        scope.root.map_variable_type(name, declared_type);
+118        // this logs a message on err, so it's safe to ignore here.
+119        let _ = scope.add_var(name.kind.as_str(), declared_type, true, name.span);
+120        scope.add_constant(name, value, const_value);
+121        return Ok(());
+122    }
+123
+124    unreachable!()
+125}
+126
+127/// Add declared variables to the scope.
+128fn add_var(
+129    scope: &mut BlockScope,
+130    target: &Node<fe::VarDeclTarget>,
+131    typ: TypeId,
+132) -> Result<(), FatalError> {
+133    match &target.kind {
+134        fe::VarDeclTarget::Name(name) => {
+135            scope.root.map_variable_type(target, typ);
+136            // this logs a message on err, so it's safe to ignore here.
+137            let _ = scope.add_var(name, typ, false, target.span);
+138            Ok(())
+139        }
+140        fe::VarDeclTarget::Tuple(items) => {
+141            match typ.typ(scope.db()) {
+142                Type::Tuple(items_ty) => {
+143                    let items_ty = items_ty.items;
+144                    let items_ty_len = items_ty.len();
+145                    if items.len() != items_ty_len {
+146                        return Err(FatalError::new(scope.fancy_error(
+147                            "invalid declaration",
+148                            vec![Label::primary(target.span, "")],
+149                            vec![format!(
+150                                "Tuple declaration has {} {} but the specified tuple type has {} {}",
+151                                items.len(),
+152                                pluralize_conditionally("item", items.len()),
+153                                items_ty_len,
+154                                pluralize_conditionally("item", items_ty_len),
+155                            )],
+156                        )));
+157                    }
+158                    for (item, item_ty) in items.iter().zip(items_ty.iter()) {
+159                        add_var(scope, item, *item_ty)?;
+160                    }
+161                    Ok(())
+162                }
+163                _ => Err(FatalError::new(scope.fancy_error(
+164                    "invalid declaration",
+165                    vec![Label::primary(target.span, "")],
+166                    vec![format!(
+167                        "Tuple declaration targets need to be declared with the tuple type but here the type is {}",
+168                        typ.display(scope.db())
+169                    )]
+170                )))
+171            }
+172        }
+173    }
+174}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/expressions.rs.html b/compiler-docs/src/fe_analyzer/traversal/expressions.rs.html new file mode 100644 index 0000000000..7e0f04f5d8 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/expressions.rs.html @@ -0,0 +1,2214 @@ +expressions.rs - source

fe_analyzer/traversal/
expressions.rs

1use super::borrowck;
+2use crate::builtins::{ContractTypeMethod, GlobalFunction, Intrinsic, ValueMethod};
+3use crate::context::{AnalyzerContext, CallType, Constant, ExpressionAttributes, NamedThing};
+4use crate::display::Displayable;
+5use crate::errors::{self, FatalError, IndexingError, TypeCoercionError};
+6use crate::namespace::items::{
+7    EnumVariantId, EnumVariantKind, FunctionId, FunctionSigId, ImplId, Item, StructId, TypeDef,
+8};
+9use crate::namespace::scopes::{check_visibility, BlockScopeType};
+10use crate::namespace::types::{
+11    self, Array, Base, FeString, Integer, TraitOrType, Tuple, Type, TypeDowncast, TypeId,
+12};
+13use crate::operations;
+14use crate::traversal::call_args::{validate_arg_count, validate_named_args};
+15use crate::traversal::const_expr::eval_expr;
+16use crate::traversal::types::{
+17    apply_generic_type_args, deref_type, try_cast_type, try_coerce_type,
+18};
+19use crate::traversal::utils::add_bin_operations_errors;
+20
+21use fe_common::diagnostics::Label;
+22use fe_common::{numeric, Span};
+23use fe_parser::ast as fe;
+24use fe_parser::ast::GenericArg;
+25use fe_parser::node::Node;
+26use num_bigint::BigInt;
+27use num_traits::{ToPrimitive, Zero};
+28use smol_str::SmolStr;
+29use std::ops::RangeInclusive;
+30use std::str::FromStr;
+31
+32// TODO: don't fail fatally if expected type is provided
+33
+34pub fn expr_type(
+35    context: &mut dyn AnalyzerContext,
+36    exp: &Node<fe::Expr>,
+37) -> Result<TypeId, FatalError> {
+38    expr(context, exp, None).map(|attr| attr.typ)
+39}
+40
+41pub fn expect_expr_type(
+42    context: &mut dyn AnalyzerContext,
+43    exp: &Node<fe::Expr>,
+44    expected: TypeId,
+45    sink: bool,
+46) -> Result<ExpressionAttributes, FatalError> {
+47    let attr = expr(context, exp, Some(expected))?;
+48
+49    match try_coerce_type(context, Some(exp), attr.typ, expected, sink) {
+50        Err(TypeCoercionError::RequiresToMem) => {
+51            context.add_diagnostic(errors::to_mem_error(exp.span));
+52        }
+53        Err(TypeCoercionError::Incompatible) => {
+54            context.type_error(
+55                "type mismatch",
+56                exp.span,
+57                expected.deref(context.db()),
+58                attr.typ.deref(context.db()),
+59            );
+60        }
+61        Err(TypeCoercionError::SelfContractType) => {
+62            context.add_diagnostic(errors::self_contract_type_error(
+63                exp.span,
+64                &attr.typ.display(context.db()),
+65            ));
+66        }
+67        Ok(_) => {}
+68    }
+69    Ok(attr)
+70}
+71
+72pub fn value_expr_type(
+73    context: &mut dyn AnalyzerContext,
+74    exp: &Node<fe::Expr>,
+75    expected: Option<TypeId>,
+76) -> Result<TypeId, FatalError> {
+77    let attr = expr(context, exp, expected)?;
+78    Ok(deref_type(context, exp, attr.typ))
+79}
+80
+81/// Gather context information for expressions and check for type errors.
+82pub fn expr(
+83    context: &mut dyn AnalyzerContext,
+84    exp: &Node<fe::Expr>,
+85    expected: Option<TypeId>,
+86) -> Result<ExpressionAttributes, FatalError> {
+87    let attr = match &exp.kind {
+88        fe::Expr::Name(_) => expr_name(context, exp, expected),
+89        fe::Expr::Path(_) => expr_path(context, exp, expected),
+90        fe::Expr::Num(_) => Ok(expr_num(context, exp, expected)),
+91
+92        fe::Expr::Subscript { .. } => expr_subscript(context, exp, expected),
+93        fe::Expr::Attribute { .. } => expr_attribute(context, exp, expected),
+94        fe::Expr::Ternary { .. } => expr_ternary(context, exp, expected),
+95        fe::Expr::BoolOperation { .. } => expr_bool_operation(context, exp),
+96        fe::Expr::BinOperation { .. } => expr_bin_operation(context, exp, expected),
+97        fe::Expr::UnaryOperation { .. } => expr_unary_operation(context, exp, expected),
+98        fe::Expr::CompOperation { .. } => expr_comp_operation(context, exp),
+99        fe::Expr::Call {
+100            func,
+101            generic_args,
+102            args,
+103        } => expr_call(context, func, generic_args, args, expected),
+104        fe::Expr::List { elts } => expr_list(context, elts, expected),
+105        fe::Expr::Repeat { .. } => expr_repeat(context, exp, expected),
+106        fe::Expr::Tuple { .. } => expr_tuple(context, exp, expected),
+107        fe::Expr::Str(_) => expr_str(context, exp, expected),
+108        fe::Expr::Bool(_) => Ok(ExpressionAttributes::new(TypeId::bool(context.db()))),
+109        fe::Expr::Unit => Ok(ExpressionAttributes::new(TypeId::unit(context.db()))),
+110    }?;
+111    context.add_expression(exp, attr.clone());
+112    Ok(attr)
+113}
+114
+115pub fn error_if_not_bool(
+116    context: &mut dyn AnalyzerContext,
+117    exp: &Node<fe::Expr>,
+118    msg: &str,
+119) -> Result<(), FatalError> {
+120    let bool_type = TypeId::bool(context.db());
+121    let attr = expr(context, exp, Some(bool_type))?;
+122    if try_coerce_type(context, Some(exp), attr.typ, bool_type, false).is_err() {
+123        context.type_error(msg, exp.span, bool_type, attr.typ);
+124    }
+125    Ok(())
+126}
+127
+128fn expr_list(
+129    context: &mut dyn AnalyzerContext,
+130    elts: &[Node<fe::Expr>],
+131    expected_type: Option<TypeId>,
+132) -> Result<ExpressionAttributes, FatalError> {
+133    let expected_inner = expected_type
+134        .and_then(|id| id.deref(context.db()).as_array(context.db()))
+135        .map(|arr| arr.inner);
+136
+137    if elts.is_empty() {
+138        return Ok(ExpressionAttributes::new(context.db().intern_type(
+139            Type::Array(Array {
+140                size: 0,
+141                inner: expected_inner.unwrap_or_else(|| TypeId::unit(context.db())),
+142            }),
+143        )));
+144    }
+145
+146    let inner_type = if let Some(inner) = expected_inner {
+147        for elt in elts {
+148            expect_expr_type(context, elt, inner, true)?;
+149        }
+150        inner
+151    } else {
+152        let first_attr = expr(context, &elts[0], None)?;
+153
+154        // Assuming every element attribute should match the attribute of 0th element
+155        // of list.
+156        for elt in &elts[1..] {
+157            let element_attributes = expr(context, elt, Some(first_attr.typ))?;
+158
+159            match try_coerce_type(
+160                context,
+161                Some(elt),
+162                element_attributes.typ,
+163                first_attr.typ,
+164                true,
+165            ) {
+166                Err(TypeCoercionError::RequiresToMem) => {
+167                    context.add_diagnostic(errors::to_mem_error(elt.span));
+168                }
+169                Err(TypeCoercionError::Incompatible) => {
+170                    context.fancy_error(
+171                        "array elements must have same type",
+172                        vec![
+173                            Label::primary(
+174                                elts[0].span,
+175                                format!("this has type `{}`", first_attr.typ.display(context.db())),
+176                            ),
+177                            Label::secondary(
+178                                elt.span,
+179                                format!(
+180                                    "this has type `{}`",
+181                                    element_attributes.typ.display(context.db())
+182                                ),
+183                            ),
+184                        ],
+185                        vec![],
+186                    );
+187                }
+188                Err(TypeCoercionError::SelfContractType) => {
+189                    context.add_diagnostic(errors::self_contract_type_error(
+190                        elt.span,
+191                        &first_attr.typ.display(context.db()),
+192                    ));
+193                }
+194                Ok(_) => {}
+195            }
+196        }
+197        first_attr.typ
+198    };
+199
+200    Ok(ExpressionAttributes::new(
+201        Type::Array(Array {
+202            size: elts.len(),
+203            inner: inner_type,
+204        })
+205        .id(context.db()),
+206    ))
+207}
+208
+209fn expr_repeat(
+210    context: &mut dyn AnalyzerContext,
+211    exp: &Node<fe::Expr>,
+212    expected_type: Option<TypeId>,
+213) -> Result<ExpressionAttributes, FatalError> {
+214    let (value, len) = match &exp.kind {
+215        fe::Expr::Repeat { value, len } => (value, len),
+216        _ => unreachable!(),
+217    };
+218
+219    let expected_inner = expected_type
+220        .and_then(|id| id.deref(context.db()).as_array(context.db()))
+221        .map(|arr| arr.inner);
+222
+223    let value = expr(context, value, expected_inner)?;
+224
+225    let size = match &len.kind {
+226        GenericArg::Int(size) => Ok(size.kind),
+227        GenericArg::TypeDesc(_) => Err(context.fancy_error(
+228            "expected a constant u256 value",
+229            vec![Label::primary(len.span, "Array length")],
+230            vec!["Note: Array length must be a constant u256".to_string()],
+231        )),
+232        GenericArg::ConstExpr(exp) => {
+233            expr(context, exp, None)?;
+234            if let Constant::Int(len) = eval_expr(context, exp)? {
+235                Ok(len.to_usize().unwrap())
+236            } else {
+237                Err(context.fancy_error(
+238                    "expected a constant u256 value",
+239                    vec![Label::primary(len.span, "Array length")],
+240                    vec!["Note: Array length must be a constant u256".to_string()],
+241                ))
+242            }
+243        }
+244    };
+245
+246    match size {
+247        Ok(size) => Ok(ExpressionAttributes::new(
+248            Type::Array(Array {
+249                size,
+250                inner: value.typ,
+251            })
+252            .id(context.db()),
+253        )),
+254
+255        Err(diag) => {
+256            if let Some(expected) = expected_type {
+257                Ok(ExpressionAttributes::new(expected))
+258            } else {
+259                Err(FatalError::new(diag))
+260            }
+261        }
+262    }
+263}
+264
+265fn expr_tuple(
+266    context: &mut dyn AnalyzerContext,
+267    exp: &Node<fe::Expr>,
+268    expected_type: Option<TypeId>,
+269) -> Result<ExpressionAttributes, FatalError> {
+270    let expected_items = expected_type.and_then(|id| {
+271        id.deref(context.db())
+272            .as_tuple(context.db())
+273            .map(|tup| tup.items)
+274    });
+275
+276    if let fe::Expr::Tuple { elts } = &exp.kind {
+277        let types = elts
+278            .iter()
+279            .enumerate()
+280            .map(|(idx, elt)| {
+281                let exp_type = expected_items
+282                    .as_ref()
+283                    .and_then(|items| items.get(idx).copied());
+284
+285                expr(context, elt, exp_type).map(|attributes| attributes.typ)
+286            })
+287            .collect::<Result<Vec<_>, _>>()?;
+288
+289        if !&types.iter().all(|id| id.has_fixed_size(context.db())) {
+290            // TODO: doesn't need to be fatal if expected.is_some()
+291            return Err(FatalError::new(context.error(
+292                "variable size types can not be part of tuples",
+293                exp.span,
+294                "",
+295            )));
+296        }
+297
+298        Ok(ExpressionAttributes::new(context.db().intern_type(
+299            Type::Tuple(Tuple {
+300                items: types.to_vec().into(),
+301            }),
+302        )))
+303    } else {
+304        unreachable!()
+305    }
+306}
+307
+308fn expr_name(
+309    context: &mut dyn AnalyzerContext,
+310    exp: &Node<fe::Expr>,
+311    expected_type: Option<TypeId>,
+312) -> Result<ExpressionAttributes, FatalError> {
+313    let name = match &exp.kind {
+314        fe::Expr::Name(name) => name,
+315        _ => unreachable!(),
+316    };
+317
+318    let name_thing = context.resolve_name(name, exp.span)?;
+319    expr_named_thing(context, exp, name_thing, expected_type)
+320}
+321
+322fn expr_path(
+323    context: &mut dyn AnalyzerContext,
+324    exp: &Node<fe::Expr>,
+325    expected_type: Option<TypeId>,
+326) -> Result<ExpressionAttributes, FatalError> {
+327    let path = match &exp.kind {
+328        fe::Expr::Path(path) => path,
+329        _ => unreachable!(),
+330    };
+331
+332    let named_thing = context.resolve_path(path, exp.span)?;
+333    expr_named_thing(context, exp, Some(named_thing), expected_type)
+334}
+335
+336fn expr_named_thing(
+337    context: &mut dyn AnalyzerContext,
+338    exp: &Node<fe::Expr>,
+339    named_thing: Option<NamedThing>,
+340    expected_type: Option<TypeId>,
+341) -> Result<ExpressionAttributes, FatalError> {
+342    let ty = match named_thing {
+343        Some(NamedThing::Variable { typ, .. }) => Ok(typ?),
+344        Some(NamedThing::SelfValue { decl, parent, .. }) => {
+345            if let Some(target) = parent {
+346                if decl.is_none() {
+347                    context.fancy_error(
+348                        "`self` is not defined",
+349                        vec![Label::primary(exp.span, "undefined value")],
+350                        if let Item::Function(func_id) = context.parent() {
+351                            vec![
+352                                "add `self` to the scope by including it in the function signature"
+353                                    .to_string(),
+354                                format!(
+355                                    "Example: `fn {}(self, foo: bool)`",
+356                                    func_id.name(context.db())
+357                                ),
+358                            ]
+359                        } else {
+360                            vec!["can't use `self` outside of function".to_string()]
+361                        },
+362                    );
+363                }
+364
+365                let mut self_typ = match target {
+366                    Item::Type(TypeDef::Struct(s)) => Type::Struct(s).id(context.db()),
+367                    Item::Type(TypeDef::Enum(e)) => Type::Enum(e).id(context.db()),
+368                    Item::Impl(id) => id.receiver(context.db()),
+369
+370                    // This can only happen when trait methods can implement a default body
+371                    Item::Trait(id) => {
+372                        return Err(FatalError::new(context.fancy_error(
+373                            &format!(
+374                                "`{}` is a trait, and can't be used as an expression",
+375                                exp.kind
+376                            ),
+377                            vec![
+378                                Label::primary(
+379                                    id.name_span(context.db()),
+380                                    format!("`{}` is defined here as a trait", exp.kind),
+381                                ),
+382                                Label::primary(
+383                                    exp.span,
+384                                    format!("`{}` is used here as a value", exp.kind),
+385                                ),
+386                            ],
+387                            vec![],
+388                        )))
+389                    }
+390                    Item::Type(TypeDef::Contract(c)) => Type::SelfContract(c).id(context.db()),
+391                    _ => unreachable!(),
+392                };
+393                // If there's no `self` param, let it be mut to avoid confusing errors
+394                if decl.map(|d| d.mut_.is_some()).unwrap_or(true) {
+395                    self_typ = Type::Mut(self_typ).id(context.db());
+396                }
+397                Ok(self_typ)
+398            } else {
+399                Err(context.fancy_error(
+400                    "`self` can only be used in contract, struct, trait or impl functions",
+401                    vec![Label::primary(
+402                        exp.span,
+403                        "not allowed in functions defined directly in a module",
+404                    )],
+405                    vec![],
+406                ))
+407            }
+408        }
+409        Some(NamedThing::Item(Item::Constant(id))) => {
+410            let typ = id.typ(context.db())?;
+411
+412            if !typ.has_fixed_size(context.db()) {
+413                panic!("const type must be fixed size")
+414            }
+415
+416            Ok(typ)
+417        }
+418        Some(NamedThing::EnumVariant(variant)) => {
+419            if let Ok(EnumVariantKind::Tuple(_)) = variant.kind(context.db()) {
+420                let name = variant.name_with_parent(context.db());
+421                context.fancy_error(
+422                    &format!(
+423                        "`{}` is not a unit variant",
+424                        variant.name_with_parent(context.db()),
+425                    ),
+426                    vec![
+427                        Label::primary(exp.span, format! {"`{name}` is not a unit variant"}),
+428                        Label::secondary(
+429                            variant.data(context.db()).ast.span,
+430                            format!("`{}` is defined here", variant.name(context.db())),
+431                        ),
+432                    ],
+433                    vec![],
+434                );
+435            }
+436
+437            Ok(variant.parent(context.db()).as_type(context.db()))
+438        }
+439
+440        Some(item) => {
+441            let item_kind = item.item_kind_display_name();
+442            let diag = if let Some(def_span) = item.name_span(context.db()) {
+443                context.fancy_error(
+444                    &format!(
+445                        "`{}` is a {} name, and can't be used as an expression",
+446                        exp.kind, item_kind
+447                    ),
+448                    vec![
+449                        Label::primary(
+450                            def_span,
+451                            format!("`{}` is defined here as a {}", exp.kind, item_kind),
+452                        ),
+453                        Label::primary(exp.span, format!("`{}` is used here as a value", exp.kind)),
+454                    ],
+455                    vec![],
+456                )
+457            } else {
+458                context.error(
+459                    &format!(
+460                        "`{}` is a built-in {} name, and can't be used as an expression",
+461                        exp.kind, item_kind
+462                    ),
+463                    exp.span,
+464                    &format!("`{}` is used here as a value", exp.kind),
+465                )
+466            };
+467            Err(diag)
+468        }
+469        None => Err(context.error(
+470            &format!("cannot find value `{}` in this scope", exp.kind),
+471            exp.span,
+472            "undefined",
+473        )),
+474    };
+475    match ty {
+476        Ok(ty) => Ok(ExpressionAttributes::new(ty)),
+477        Err(diag) => {
+478            if let Some(expected) = expected_type {
+479                Ok(ExpressionAttributes::new(expected))
+480            } else {
+481                Err(FatalError::new(diag))
+482            }
+483        }
+484    }
+485}
+486
+487fn expr_str(
+488    context: &mut dyn AnalyzerContext,
+489    exp: &Node<fe::Expr>,
+490    expected_type: Option<TypeId>,
+491) -> Result<ExpressionAttributes, FatalError> {
+492    if let fe::Expr::Str(string) = &exp.kind {
+493        if !is_valid_string(string) {
+494            context.error("String contains invalid byte sequence", exp.span, "");
+495        };
+496
+497        if !context.is_in_function() {
+498            context.fancy_error(
+499                "string literal can't be used outside function",
+500                vec![Label::primary(exp.span, "string type is used here")],
+501                vec!["Note: string literal can be used only inside function".into()],
+502            );
+503        }
+504
+505        let str_len = string.len();
+506        let expected_str_len = expected_type
+507            .and_then(|id| id.deref(context.db()).as_string(context.db()))
+508            .map(|s| s.max_size)
+509            .unwrap_or(str_len);
+510        // Use an expected string length if an expected length is larger than an actual
+511        // length.
+512        let max_size = if expected_str_len > str_len {
+513            expected_str_len
+514        } else {
+515            str_len
+516        };
+517
+518        return Ok(ExpressionAttributes::new(
+519            Type::String(FeString { max_size }).id(context.db()),
+520        ));
+521    }
+522
+523    unreachable!()
+524}
+525
+526fn is_valid_string(val: &str) -> bool {
+527    const ALLOWED_SPECIAL_CHARS: [u8; 3] = [
+528        9_u8,  // Tab
+529        10_u8, // Newline
+530        13_u8, // Carriage return
+531    ];
+532
+533    const PRINTABLE_ASCII: RangeInclusive<u8> = 32_u8..=126_u8;
+534
+535    for x in val.as_bytes() {
+536        if ALLOWED_SPECIAL_CHARS.contains(x) || PRINTABLE_ASCII.contains(x) {
+537            continue;
+538        } else {
+539            return false;
+540        }
+541    }
+542    true
+543}
+544
+545fn expr_num(
+546    context: &mut dyn AnalyzerContext,
+547    exp: &Node<fe::Expr>,
+548    expected_type: Option<TypeId>,
+549) -> ExpressionAttributes {
+550    let num = match &exp.kind {
+551        fe::Expr::Num(num) => num,
+552        _ => unreachable!(),
+553    };
+554
+555    let literal = numeric::Literal::new(num);
+556    let num = literal
+557        .parse::<BigInt>()
+558        .expect("the numeric literal contains a invalid digit");
+559
+560    if expected_type == Some(TypeId::address(context.db())) {
+561        if num < BigInt::zero() && num > types::address_max() {
+562            context.error(
+563                "literal out of range for `address` type",
+564                exp.span,
+565                "does not fit into type `address`",
+566            );
+567        }
+568        // TODO: error if literal.radix != Radix::Hexadecimal ?
+569        return ExpressionAttributes::new(TypeId::address(context.db()));
+570    }
+571
+572    let int_typ = expected_type
+573        .and_then(|id| id.deref(context.db()).as_int(context.db()))
+574        .unwrap_or(Integer::U256);
+575    validate_numeric_literal_fits_type(context, num, exp.span, int_typ);
+576    return ExpressionAttributes::new(TypeId::int(context.db(), int_typ));
+577}
+578
+579fn expr_subscript(
+580    context: &mut dyn AnalyzerContext,
+581    exp: &Node<fe::Expr>,
+582    expected_type: Option<TypeId>,
+583) -> Result<ExpressionAttributes, FatalError> {
+584    if let fe::Expr::Subscript { value, index } = &exp.kind {
+585        let value_ty = expr_type(context, value)?;
+586        let expected_index_ty = operations::expected_index_type(context, value_ty);
+587        let index_ty = expr(context, index, expected_index_ty)?.typ;
+588
+589        // performs type checking
+590        let typ = match operations::index(context, value_ty, index_ty, index) {
+591            Err(err) => {
+592                let diag = match err {
+593                    IndexingError::NotSubscriptable => context.fancy_error(
+594                        &format!(
+595                            "`{}` type is not subscriptable",
+596                            value_ty.display(context.db())
+597                        ),
+598                        vec![Label::primary(value.span, "unsubscriptable type")],
+599                        vec!["Note: Only arrays and maps are subscriptable".into()],
+600                    ),
+601                    IndexingError::WrongIndexType => context.fancy_error(
+602                        &format!(
+603                            "can not subscript {} with type {}",
+604                            value_ty.display(context.db()),
+605                            index_ty.display(context.db())
+606                        ),
+607                        vec![Label::primary(index.span, "wrong index type")],
+608                        vec![],
+609                    ),
+610                };
+611                if let Some(expected) = expected_type {
+612                    expected
+613                } else {
+614                    return Err(FatalError::new(diag));
+615                }
+616            }
+617            Ok(t) => t,
+618        };
+619
+620        return Ok(ExpressionAttributes::new(typ));
+621    }
+622
+623    unreachable!()
+624}
+625
+626fn expr_attribute(
+627    context: &mut dyn AnalyzerContext,
+628    exp: &Node<fe::Expr>,
+629    expected_type: Option<TypeId>,
+630) -> Result<ExpressionAttributes, FatalError> {
+631    let (target, field) = match &exp.kind {
+632        fe::Expr::Attribute { value, attr } => (value, attr),
+633        _ => unreachable!(),
+634    };
+635
+636    let attrs = expr(context, target, None)?;
+637    let typ = match field_type(context, attrs.typ, &field.kind, field.span) {
+638        Ok(t) => t,
+639        Err(err) => {
+640            if let Some(expected) = expected_type {
+641                expected
+642            } else {
+643                return Err(err);
+644            }
+645        }
+646    };
+647    Ok(ExpressionAttributes::new(typ))
+648}
+649
+650fn field_type(
+651    context: &mut dyn AnalyzerContext,
+652    obj: TypeId,
+653    field_name: &str,
+654    field_span: Span,
+655) -> Result<TypeId, FatalError> {
+656    match obj.typ(context.db()) {
+657        Type::Mut(inner) => {
+658            Ok(Type::Mut(field_type(context, inner, field_name, field_span)?).id(context.db()))
+659        }
+660        Type::SPtr(inner) => {
+661            Ok(Type::SPtr(field_type(context, inner, field_name, field_span)?).id(context.db()))
+662        }
+663        Type::SelfType(TraitOrType::TypeId(inner)) => Ok(Type::SelfType(TraitOrType::TypeId(
+664            field_type(context, inner, field_name, field_span)?,
+665        ))
+666        .id(context.db())),
+667        Type::SelfContract(id) => match id.field_type(context.db(), field_name) {
+668            Some(typ) => Ok(typ?.make_sptr(context.db())),
+669            None => Err(FatalError::new(context.fancy_error(
+670                &format!("No field `{field_name}` exists on this contract"),
+671                vec![Label::primary(field_span, "undefined field")],
+672                vec![],
+673            ))),
+674        },
+675
+676        Type::Struct(struct_) => {
+677            if let Some(struct_field) = struct_.field(context.db(), field_name) {
+678                if !context.root_item().is_struct(&struct_) && !struct_field.is_public(context.db())
+679                {
+680                    context.fancy_error(
+681                        &format!(
+682                            "Can not access private field `{}` on struct `{}`",
+683                            field_name,
+684                            struct_.name(context.db())
+685                        ),
+686                        vec![Label::primary(field_span, "private field")],
+687                        vec![],
+688                    );
+689                }
+690                Ok(struct_field.typ(context.db())?)
+691            } else {
+692                Err(FatalError::new(context.fancy_error(
+693                    &format!(
+694                        "No field `{}` exists on struct `{}`",
+695                        field_name,
+696                        struct_.name(context.db())
+697                    ),
+698                    vec![Label::primary(field_span, "undefined field")],
+699                    vec![],
+700                )))
+701            }
+702        }
+703        Type::Tuple(tuple) => {
+704            let item_index = tuple_item_index(field_name).ok_or_else(||
+705                    FatalError::new(context.fancy_error(
+706                        &format!("No field `{field_name}` exists on this tuple"),
+707                        vec![
+708                            Label::primary(
+709                                field_span,
+710                                "undefined field",
+711                            )
+712                        ],
+713                        vec!["Note: Tuple values are accessed via `itemN` properties such as `item0` or `item1`".into()],
+714                    )))?;
+715
+716            tuple.items.get(item_index).copied().ok_or_else(|| {
+717                FatalError::new(context.fancy_error(
+718                    &format!("No field `item{item_index}` exists on this tuple"),
+719                    vec![Label::primary(field_span, "unknown field")],
+720                    vec![format!(
+721                        "Note: The highest possible field for this tuple is `item{}`",
+722                        tuple.items.len() - 1
+723                    )],
+724                ))
+725            })
+726        }
+727        _ => Err(FatalError::new(context.fancy_error(
+728            &format!(
+729                "No field `{}` exists on type {}",
+730                field_name,
+731                obj.display(context.db())
+732            ),
+733            vec![Label::primary(field_span, "unknown field")],
+734            vec![],
+735        ))),
+736    }
+737}
+738
+739/// Pull the item index from the attribute string (e.g. "item4" -> "4").
+740fn tuple_item_index(item: &str) -> Option<usize> {
+741    if item.len() < 5 || &item[..4] != "item" || (item.len() > 5 && &item[4..5] == "0") {
+742        None
+743    } else {
+744        item[4..].parse::<usize>().ok()
+745    }
+746}
+747
+748fn expr_bin_operation(
+749    context: &mut dyn AnalyzerContext,
+750    exp: &Node<fe::Expr>,
+751    expected_type: Option<TypeId>,
+752) -> Result<ExpressionAttributes, FatalError> {
+753    let (left, op, right) = match &exp.kind {
+754        fe::Expr::BinOperation { left, op, right } => (left, op, right),
+755        _ => unreachable!(),
+756    };
+757
+758    let (left_expected, right_expected) = match &op.kind {
+759        // In shift operations, the right hand side may have a different type than the left hand
+760        // side because the right hand side needs to be unsigned. The type of the
+761        // entire expression is determined by the left hand side anyway so we don't
+762        // try to coerce the right hand side in this case.
+763        fe::BinOperator::LShift | fe::BinOperator::RShift => (expected_type, None),
+764        _ => (expected_type, expected_type),
+765    };
+766
+767    let left_attributes = expr(context, left, left_expected)?;
+768    let right_attributes = expr(context, right, right_expected)?;
+769
+770    match operations::bin(
+771        context,
+772        left_attributes.typ,
+773        left,
+774        op.kind,
+775        right_attributes.typ,
+776        right,
+777    ) {
+778        Err(err) => {
+779            let diag = add_bin_operations_errors(
+780                context,
+781                &op.kind,
+782                left.span,
+783                left_attributes.typ,
+784                right.span,
+785                right_attributes.typ,
+786                err,
+787            );
+788            if let Some(expected) = expected_type {
+789                Ok(ExpressionAttributes::new(expected))
+790            } else {
+791                Err(FatalError::new(diag))
+792            }
+793        }
+794        Ok(typ) => Ok(ExpressionAttributes::new(typ)),
+795    }
+796}
+797
+798fn expr_unary_operation(
+799    context: &mut dyn AnalyzerContext,
+800    exp: &Node<fe::Expr>,
+801    expected_type: Option<TypeId>,
+802) -> Result<ExpressionAttributes, FatalError> {
+803    let (op, operand) = match &exp.kind {
+804        fe::Expr::UnaryOperation { op, operand } => (op, operand),
+805        _ => unreachable!(),
+806    };
+807
+808    let operand_ty = value_expr_type(context, operand, None)?;
+809
+810    let emit_err = |context: &mut dyn AnalyzerContext, expected| {
+811        context.error(
+812            &format!(
+813                "cannot apply unary operator `{}` to type `{}`",
+814                op.kind,
+815                operand_ty.display(context.db())
+816            ),
+817            operand.span,
+818            &format!(
+819                "this has type `{}`; expected {}",
+820                operand_ty.display(context.db()),
+821                expected
+822            ),
+823        );
+824    };
+825
+826    return match op.kind {
+827        fe::UnaryOperator::USub => {
+828            let expected_int_type = expected_type
+829                .and_then(|id| id.as_int(context.db()))
+830                .unwrap_or(Integer::I256);
+831
+832            if operand_ty.is_integer(context.db()) {
+833                if let fe::Expr::Num(num_str) = &operand.kind {
+834                    let num = -to_bigint(num_str);
+835                    validate_numeric_literal_fits_type(context, num, exp.span, expected_int_type);
+836                }
+837                if !expected_int_type.is_signed() {
+838                    context.error(
+839                        "Can not apply unary operator",
+840                        op.span + operand.span,
+841                        &format!(
+842                            "Expected unsigned type `{expected_int_type}`. Unary operator `-` can not be used here.",
+843                        ),
+844                    );
+845                }
+846            } else {
+847                emit_err(context, "a numeric type")
+848            }
+849            Ok(ExpressionAttributes::new(TypeId::int(
+850                context.db(),
+851                expected_int_type,
+852            )))
+853        }
+854        fe::UnaryOperator::Not => {
+855            if !operand_ty.is_bool(context.db()) {
+856                emit_err(context, "type `bool`");
+857            }
+858            Ok(ExpressionAttributes::new(TypeId::bool(context.db())))
+859        }
+860        fe::UnaryOperator::Invert => {
+861            if !operand_ty.is_integer(context.db()) {
+862                emit_err(context, "a numeric type")
+863            }
+864
+865            Ok(ExpressionAttributes::new(operand_ty))
+866        }
+867    };
+868}
+869
+870fn expr_call(
+871    context: &mut dyn AnalyzerContext,
+872    func: &Node<fe::Expr>,
+873    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+874    args: &Node<Vec<Node<fe::CallArg>>>,
+875    expected_type: Option<TypeId>,
+876) -> Result<ExpressionAttributes, FatalError> {
+877    let (attributes, call_type) = match &func.kind {
+878        fe::Expr::Name(name) => expr_call_name(context, name, func, generic_args, args)?,
+879        fe::Expr::Path(path) => expr_call_path(context, path, func, generic_args, args)?,
+880        fe::Expr::Attribute { value, attr } => {
+881            // TODO: err if there are generic args
+882            expr_call_method(context, value, attr, generic_args, args)?
+883        }
+884        _ => {
+885            let expression = expr(context, func, None)?;
+886            let diag = context.fancy_error(
+887                &format!(
+888                    "`{}` type is not callable",
+889                    expression.typ.display(context.db())
+890                ),
+891                vec![Label::primary(
+892                    func.span,
+893                    format!("this has type `{}`", expression.typ.display(context.db())),
+894                )],
+895                vec![],
+896            );
+897            return if let Some(expected) = expected_type {
+898                Ok(ExpressionAttributes::new(expected))
+899            } else {
+900                Err(FatalError::new(diag))
+901            };
+902        }
+903    };
+904
+905    if !context.inherits_type(BlockScopeType::Unsafe) && call_type.is_unsafe(context.db()) {
+906        let mut labels = vec![Label::primary(func.span, "call to unsafe function")];
+907        let fn_name = call_type.function_name(context.db());
+908        if let Some(function) = call_type.function() {
+909            let def_name_span = function.name_span(context.db());
+910            let unsafe_span = function.unsafe_span(context.db());
+911            labels.push(Label::secondary(
+912                def_name_span + unsafe_span,
+913                format!("`{}` is defined here as unsafe", &fn_name),
+914            ))
+915        }
+916        context.fancy_error(
+917            &format!("unsafe function `{}` can only be called in an unsafe function or block",
+918                     &fn_name),
+919            labels,
+920            vec!["Hint: put this call in an `unsafe` block if you're confident that it's safe to use here".into()],
+921        );
+922    }
+923
+924    if context.is_in_function() {
+925        context.add_call(func, call_type);
+926    } else {
+927        context.error(
+928            "calling function outside function",
+929            func.span,
+930            "function can only be called inside function",
+931        );
+932    }
+933
+934    Ok(attributes)
+935}
+936
+937fn expr_call_name<T: std::fmt::Display>(
+938    context: &mut dyn AnalyzerContext,
+939    name: &str,
+940    func: &Node<T>,
+941    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+942    args: &Node<Vec<Node<fe::CallArg>>>,
+943) -> Result<(ExpressionAttributes, CallType), FatalError> {
+944    check_for_call_to_special_fns(context, name, func.span)?;
+945
+946    let named_thing = context.resolve_name(name, func.span)?.ok_or_else(|| {
+947        // Check for call to a fn in the current class that takes self.
+948        if context.is_in_function() {
+949            let func_id = context.parent_function();
+950            if let Some(function) = func_id
+951                .sig(context.db())
+952                .self_item(context.db())
+953                .and_then(|target| target.function_sig(context.db(), name))
+954                .filter(|fun| fun.takes_self(context.db()))
+955            {
+956                // TODO: this doesn't have to be fatal
+957                FatalError::new(context.fancy_error(
+958                    &format!("`{name}` must be called via `self`"),
+959                    vec![
+960                        Label::primary(
+961                            function.name_span(context.db()),
+962                            format!("`{name}` is defined here as a function that takes `self`"),
+963                        ),
+964                        Label::primary(
+965                            func.span,
+966                            format!("`{name}` is called here as a standalone function"),
+967                        ),
+968                    ],
+969                    vec![format!(
+970                        "Suggestion: use `self.{name}(...)` instead of `{name}(...)`"
+971                    )],
+972                ))
+973            } else {
+974                FatalError::new(context.error(
+975                    &format!("`{name}` is not defined"),
+976                    func.span,
+977                    &format!("`{name}` has not been defined in this context"),
+978                ))
+979            }
+980        } else {
+981            FatalError::new(context.error(
+982                "calling function outside function",
+983                func.span,
+984                "function can only be called inside function",
+985            ))
+986        }
+987    })?;
+988
+989    expr_call_named_thing(context, named_thing, func, generic_args, args)
+990}
+991
+992fn expr_call_path<T: std::fmt::Display>(
+993    context: &mut dyn AnalyzerContext,
+994    path: &fe::Path,
+995    func: &Node<T>,
+996    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+997    args: &Node<Vec<Node<fe::CallArg>>>,
+998) -> Result<(ExpressionAttributes, CallType), FatalError> {
+999    match context.resolve_visible_path(path) {
+1000        Some(named_thing) => {
+1001            check_visibility(context, &named_thing, func.span);
+1002            validate_has_no_conflicting_trait_in_scope(context, &named_thing, path, func)?;
+1003            expr_call_named_thing(context, named_thing, func, generic_args, args)
+1004        }
+1005        // If we we can't resolve a call to a path e.g. `foo::Bar::do_thing()` there is a chance that `do_thing`
+1006        // still exists as as a trait associated function for `foo::Bar`.
+1007        None => expr_call_trait_associated_function(context, path, func, generic_args, args),
+1008    }
+1009}
+1010
+1011fn validate_has_no_conflicting_trait_in_scope<T: std::fmt::Display>(
+1012    context: &mut dyn AnalyzerContext,
+1013    named_thing: &NamedThing,
+1014    path: &fe::Path,
+1015    func: &Node<T>,
+1016) -> Result<(), FatalError> {
+1017    let fn_name = &path.segments.last().unwrap().kind;
+1018    let parent_path = path.remove_last();
+1019    let parent_thing = context.resolve_path(&parent_path, func.span)?;
+1020
+1021    if let NamedThing::Item(Item::Type(val)) = parent_thing {
+1022        let type_id = val.type_id(context.db())?;
+1023        let (_, in_scope_candidates) = type_id.trait_function_candidates(context, fn_name);
+1024
+1025        if !in_scope_candidates.is_empty() {
+1026            let labels = vec![Label::primary(
+1027                named_thing.name_span(context.db()).unwrap(),
+1028                format!(
+1029                    "candidate 1 is defined here on the {}",
+1030                    parent_thing.item_kind_display_name(),
+1031                ),
+1032            )]
+1033            .into_iter()
+1034            .chain(
+1035                in_scope_candidates
+1036                    .iter()
+1037                    .enumerate()
+1038                    .map(|(idx, (fun, _impl))| {
+1039                        Label::primary(
+1040                            fun.name_span(context.db()),
+1041                            format!(
+1042                                "candidate #{} is defined here on trait `{}`",
+1043                                idx + 2,
+1044                                _impl.trait_id(context.db()).name(context.db())
+1045                            ),
+1046                        )
+1047                    }),
+1048            )
+1049            .collect::<Vec<_>>();
+1050
+1051            return Err(FatalError::new(context.fancy_error(
+1052                "multiple applicable items in scope",
+1053                labels,
+1054                vec![
+1055                    "Hint: Rename one of the methods or make sure only one of them is in scope"
+1056                        .into(),
+1057                ],
+1058            )));
+1059        }
+1060    }
+1061
+1062    Ok(())
+1063}
+1064
+1065fn expr_call_trait_associated_function<T: std::fmt::Display>(
+1066    context: &mut dyn AnalyzerContext,
+1067    path: &fe::Path,
+1068    func: &Node<T>,
+1069    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+1070    args: &Node<Vec<Node<fe::CallArg>>>,
+1071) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1072    let fn_name = &path.segments.last().unwrap().kind;
+1073    let parent_path = path.remove_last();
+1074    let parent_thing = context.resolve_path(&parent_path, func.span)?;
+1075
+1076    if let NamedThing::Item(Item::Type(val)) = parent_thing {
+1077        let type_id = val.type_id(context.db())?;
+1078
+1079        let (candidates, in_scope_candidates) = type_id.trait_function_candidates(context, fn_name);
+1080
+1081        if in_scope_candidates.len() > 1 {
+1082            context.fancy_error(
+1083                "multiple applicable items in scope",
+1084                in_scope_candidates
+1085                    .iter()
+1086                    .enumerate()
+1087                    .map(|(idx, (fun, _impl))| {
+1088                        Label::primary(
+1089                            fun.name_span(context.db()),
+1090                            format!(
+1091                                "candidate #{} is defined here on trait `{}`",
+1092                                idx + 1,
+1093                                _impl.trait_id(context.db()).name(context.db())
+1094                            ),
+1095                        )
+1096                    })
+1097                    .collect(),
+1098                vec![
+1099                    "Hint: Rename one of the methods or make sure only one of them is in scope"
+1100                        .into(),
+1101                ],
+1102            );
+1103            // We arbitrarily carry on with the first candidate since the error doesn't need to be fatal
+1104            let (fun, _) = in_scope_candidates[0];
+1105            return expr_call_pure(context, fun, func.span, generic_args, args);
+1106        } else if in_scope_candidates.is_empty() && !candidates.is_empty() {
+1107            context.fancy_error(
+1108                "Applicable items exist but are not in scope",
+1109                candidates.iter().enumerate().map(|(idx, (fun, _impl ))| {
+1110                    Label::primary(fun.name_span(context.db()), format!(
+1111                        "candidate #{} is defined here on trait `{}`",
+1112                        idx + 1,
+1113                        _impl.trait_id(context.db()).name(context.db())
+1114                    ))
+1115                }).collect(),
+1116                vec!["Hint: Bring one of these candidates in scope via `use module_name::trait_name`".into()],
+1117            );
+1118            // We arbitrarily carry on with an applicable candidate since the error doesn't need to be fatal
+1119            let (fun, _) = candidates[0];
+1120            return expr_call_pure(context, fun, func.span, generic_args, args);
+1121        } else if in_scope_candidates.len() == 1 {
+1122            let (fun, _) = in_scope_candidates[0];
+1123            return expr_call_pure(context, fun, func.span, generic_args, args);
+1124        }
+1125    }
+1126
+1127    // At this point, we will have an error so we run `resolve_path` to register any errors that we
+1128    // did not report yet
+1129    context.resolve_path(path, func.span)?;
+1130
+1131    Err(FatalError::new(context.error(
+1132        "unresolved path item",
+1133        func.span,
+1134        "not found",
+1135    )))
+1136}
+1137
+1138fn expr_call_named_thing<T: std::fmt::Display>(
+1139    context: &mut dyn AnalyzerContext,
+1140    named_thing: NamedThing,
+1141    func: &Node<T>,
+1142    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+1143    args: &Node<Vec<Node<fe::CallArg>>>,
+1144) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1145    match named_thing {
+1146        NamedThing::Item(Item::BuiltinFunction(function)) => {
+1147            expr_call_builtin_function(context, function, func.span, generic_args, args)
+1148        }
+1149        NamedThing::Item(Item::Intrinsic(function)) => {
+1150            expr_call_intrinsic(context, function, func.span, generic_args, args)
+1151        }
+1152        NamedThing::Item(Item::Function(function)) => {
+1153            expr_call_pure(context, function, func.span, generic_args, args)
+1154        }
+1155        NamedThing::Item(Item::Type(def)) => {
+1156            if let Some(args) = generic_args {
+1157                context.fancy_error(
+1158                    &format!("`{}` type is not generic", func.kind),
+1159                    vec![Label::primary(
+1160                        args.span,
+1161                        "unexpected generic argument list",
+1162                    )],
+1163                    vec![],
+1164                );
+1165            }
+1166            let typ = def.type_id(context.db())?;
+1167            expr_call_type_constructor(context, typ, func.span, args)
+1168        }
+1169        NamedThing::Item(Item::GenericType(generic)) => {
+1170            let concrete_type =
+1171                apply_generic_type_args(context, generic, func.span, generic_args.as_ref())?;
+1172            expr_call_type_constructor(context, concrete_type, func.span, args)
+1173        }
+1174        NamedThing::Item(Item::Constant(id)) => Err(FatalError::new(context.error(
+1175            &format!("`{}` is not callable", func.kind),
+1176            func.span,
+1177            &format!(
+1178                "`{}` is a constant of type `{}`, and can't be used as a function",
+1179                func.kind,
+1180                id.typ(context.db())?.display(context.db()),
+1181            ),
+1182        ))),
+1183        NamedThing::Item(Item::Trait(_)) => Err(FatalError::new(context.error(
+1184            &format!("`{}` is not callable", func.kind),
+1185            func.span,
+1186            &format!(
+1187                "`{}` is a trait, and can't be used as a function",
+1188                func.kind
+1189            ),
+1190        ))),
+1191        NamedThing::Item(Item::Impl(_)) => unreachable!(),
+1192        NamedThing::Item(Item::Attribute(_)) => unreachable!(),
+1193        NamedThing::Item(Item::Ingot(_)) => Err(FatalError::new(context.error(
+1194            &format!("`{}` is not callable", func.kind),
+1195            func.span,
+1196            &format!(
+1197                "`{}` is an ingot, and can't be used as a function",
+1198                func.kind
+1199            ),
+1200        ))),
+1201        NamedThing::Item(Item::Module(_)) => Err(FatalError::new(context.error(
+1202            &format!("`{}` is not callable", func.kind),
+1203            func.span,
+1204            &format!(
+1205                "`{}` is a module, and can't be used as a function",
+1206                func.kind
+1207            ),
+1208        ))),
+1209
+1210        NamedThing::EnumVariant(variant) => {
+1211            expr_call_enum_constructor(context, func.span, variant, args)
+1212        }
+1213
+1214        // Nothing else is callable (for now at least)
+1215        NamedThing::SelfValue { .. } => Err(FatalError::new(context.error(
+1216            "`self` is not callable",
+1217            func.span,
+1218            "can't be used as a function",
+1219        ))),
+1220
+1221        NamedThing::Variable { typ, span, .. } => Err(FatalError::new(context.fancy_error(
+1222            &format!("`{}` is not callable", func.kind),
+1223            vec![
+1224                Label::secondary(
+1225                    span,
+1226                    format!("`{}` has type `{}`", func.kind, typ?.display(context.db())),
+1227                ),
+1228                Label::primary(
+1229                    func.span,
+1230                    format!("`{}` can't be used as a function", func.kind),
+1231                ),
+1232            ],
+1233            vec![],
+1234        ))),
+1235    }
+1236}
+1237
+1238fn expr_call_builtin_function(
+1239    context: &mut dyn AnalyzerContext,
+1240    function: GlobalFunction,
+1241    name_span: Span,
+1242    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+1243    args: &Node<Vec<Node<fe::CallArg>>>,
+1244) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1245    if let Some(args) = generic_args {
+1246        context.error(
+1247            &format!(
+1248                "`{}` function does not expect generic arguments",
+1249                function.as_ref()
+1250            ),
+1251            args.span,
+1252            "unexpected generic argument list",
+1253        );
+1254    }
+1255
+1256    let argument_attributes = expr_call_args(context, args)?;
+1257
+1258    let attrs = match function {
+1259        GlobalFunction::Keccak256 => {
+1260            validate_arg_count(context, function.as_ref(), name_span, args, 1, "argument");
+1261            expect_no_label_on_arg(context, args, 0);
+1262
+1263            if let Some(arg_typ) = argument_attributes.first().map(|attr| &attr.typ) {
+1264                match arg_typ.typ(context.db()) {
+1265                    Type::Array(Array { inner, .. }) if inner.typ(context.db()) == Type::u8() => {}
+1266                    _ => {
+1267                        context.fancy_error(
+1268                            &format!(
+1269                                "`{}` can not be used as an argument to `{}`",
+1270                                arg_typ.display(context.db()),
+1271                                function.as_ref(),
+1272                            ),
+1273                            vec![Label::primary(args.span, "wrong type")],
+1274                            vec![format!(
+1275                                "Note: `{}` expects a byte array argument",
+1276                                function.as_ref()
+1277                            )],
+1278                        );
+1279                    }
+1280                }
+1281            };
+1282            ExpressionAttributes::new(TypeId::int(context.db(), Integer::U256))
+1283        }
+1284    };
+1285    Ok((attrs, CallType::BuiltinFunction(function)))
+1286}
+1287
+1288fn expr_call_intrinsic(
+1289    context: &mut dyn AnalyzerContext,
+1290    function: Intrinsic,
+1291    name_span: Span,
+1292    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+1293    args: &Node<Vec<Node<fe::CallArg>>>,
+1294) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1295    if let Some(args) = generic_args {
+1296        context.error(
+1297            &format!(
+1298                "`{}` function does not expect generic arguments",
+1299                function.as_ref()
+1300            ),
+1301            args.span,
+1302            "unexpected generic argument list",
+1303        );
+1304    }
+1305
+1306    let argument_attributes = expr_call_args(context, args)?;
+1307
+1308    validate_arg_count(
+1309        context,
+1310        function.as_ref(),
+1311        name_span,
+1312        args,
+1313        function.arg_count(),
+1314        "arguments",
+1315    );
+1316    for (idx, arg_attr) in argument_attributes.iter().enumerate() {
+1317        if arg_attr.typ.typ(context.db()) != Type::Base(Base::Numeric(Integer::U256)) {
+1318            context.type_error(
+1319                "arguments to intrinsic functions must be u256",
+1320                args.kind[idx].kind.value.span,
+1321                TypeId::int(context.db(), Integer::U256),
+1322                arg_attr.typ,
+1323            );
+1324        }
+1325    }
+1326
+1327    Ok((
+1328        ExpressionAttributes::new(TypeId::base(context.db(), function.return_type())),
+1329        CallType::Intrinsic(function),
+1330    ))
+1331}
+1332
+1333fn validate_visibility_of_called_fn(
+1334    context: &mut dyn AnalyzerContext,
+1335    call_span: Span,
+1336    called_fn: FunctionSigId,
+1337) {
+1338    let fn_parent = called_fn.parent(context.db());
+1339
+1340    // We don't need to validate `pub` if the called function is a module function
+1341    if let Item::Module(_) = fn_parent {
+1342        return;
+1343    }
+1344
+1345    let name = called_fn.name(context.db());
+1346    let parent_name = fn_parent.name(context.db());
+1347
+1348    let is_called_from_same_item = fn_parent == context.parent_function().parent(context.db());
+1349    if !called_fn.is_public(context.db()) && !is_called_from_same_item {
+1350        context.fancy_error(
+1351            &format!(
+1352                "the function `{}` on `{} {}` is private",
+1353                name,
+1354                fn_parent.item_kind_display_name(),
+1355                fn_parent.name(context.db())
+1356            ),
+1357            vec![
+1358                Label::primary(call_span, "this function is not `pub`"),
+1359                Label::secondary(
+1360                    called_fn.name_span(context.db()),
+1361                    format!("`{name}` is defined here"),
+1362                ),
+1363            ],
+1364            vec![
+1365                format!(
+1366                    "`{name}` can only be called from other functions within `{parent_name}`"
+1367                ),
+1368                format!(
+1369                    "Hint: use `pub fn {name}(..)` to make `{name}` callable from outside of `{parent_name}`"
+1370                ),
+1371            ],
+1372        );
+1373    }
+1374}
+1375
+1376fn expr_call_pure(
+1377    context: &mut dyn AnalyzerContext,
+1378    function: FunctionId,
+1379    call_span: Span,
+1380    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+1381    args: &Node<Vec<Node<fe::CallArg>>>,
+1382) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1383    let sig = function.sig(context.db());
+1384    validate_visibility_of_called_fn(context, call_span, sig);
+1385
+1386    let fn_name = function.name(context.db());
+1387    if let Some(args) = generic_args {
+1388        context.fancy_error(
+1389            &format!("`{fn_name}` function is not generic"),
+1390            vec![Label::primary(
+1391                args.span,
+1392                "unexpected generic argument list",
+1393            )],
+1394            vec![],
+1395        );
+1396    }
+1397
+1398    if function.is_test(context.db()) {
+1399        context.fancy_error(
+1400            &format!("`{fn_name}` is a test function"),
+1401            vec![Label::primary(call_span, "test functions are not callable")],
+1402            vec![],
+1403        );
+1404    }
+1405
+1406    let sig = function.signature(context.db());
+1407    let name_span = function.name_span(context.db());
+1408    validate_named_args(context, &fn_name, name_span, args, &sig.params)?;
+1409    borrowck::check_fn_call_arg_borrows(context, &fn_name, None, &args.kind, &sig.params);
+1410
+1411    let return_type = sig.return_type.clone()?;
+1412    Ok((
+1413        ExpressionAttributes::new(return_type),
+1414        CallType::Pure(function),
+1415    ))
+1416}
+1417
+1418fn expr_call_type_constructor(
+1419    context: &mut dyn AnalyzerContext,
+1420    into_type: TypeId,
+1421    into_span: Span,
+1422    args: &Node<Vec<Node<fe::CallArg>>>,
+1423) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1424    let typ = into_type.typ(context.db());
+1425    match typ {
+1426        Type::Struct(struct_type) => {
+1427            return expr_call_struct_constructor(context, into_span, struct_type, args)
+1428        }
+1429        Type::Base(Base::Bool)
+1430        | Type::Enum(_)
+1431        | Type::Array(_)
+1432        | Type::Map(_)
+1433        | Type::Generic(_) => {
+1434            return Err(FatalError::new(context.error(
+1435                &format!("`{}` type is not callable", typ.display(context.db())),
+1436                into_span,
+1437                "",
+1438            )))
+1439        }
+1440        Type::SPtr(_) => unreachable!(), // unnameable
+1441        _ => {}
+1442    }
+1443
+1444    // These all expect 1 arg, for now.
+1445    let type_name = typ.name(context.db());
+1446    validate_arg_count(context, &type_name, into_span, args, 1, "argument");
+1447    expect_no_label_on_arg(context, args, 0);
+1448
+1449    if let Some(arg) = args.kind.first() {
+1450        let expected = into_type.is_integer(context.db()).then_some(into_type);
+1451        let from_type = expr(context, &arg.kind.value, expected)?.typ;
+1452        try_cast_type(context, from_type, &arg.kind.value, into_type, into_span);
+1453    }
+1454    Ok((
+1455        ExpressionAttributes::new(into_type),
+1456        CallType::TypeConstructor(into_type),
+1457    ))
+1458}
+1459
+1460fn expr_call_struct_constructor(
+1461    context: &mut dyn AnalyzerContext,
+1462    name_span: Span,
+1463    struct_: StructId,
+1464    args: &Node<Vec<Node<fe::CallArg>>>,
+1465) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1466    let name = &struct_.name(context.db());
+1467    // Check visibility of struct.
+1468
+1469    if struct_.has_private_field(context.db()) && !context.root_item().is_struct(&struct_) {
+1470        let labels = struct_
+1471            .fields(context.db())
+1472            .iter()
+1473            .filter_map(|(name, field)| {
+1474                if !field.is_public(context.db()) {
+1475                    Some(Label::primary(
+1476                        field.span(context.db()),
+1477                        format!("Field `{name}` is private"),
+1478                    ))
+1479                } else {
+1480                    None
+1481                }
+1482            })
+1483            .collect();
+1484
+1485        context.fancy_error(
+1486            &format!(
+1487                "Can not call private constructor of struct `{name}` "
+1488            ),
+1489            labels,
+1490            vec![format!(
+1491                "Suggestion: implement a method `new(...)` on struct `{name}` to call the constructor and return the struct"
+1492            )],
+1493        );
+1494    }
+1495
+1496    let db = context.db();
+1497    let fields = struct_
+1498        .fields(db)
+1499        .iter()
+1500        .map(|(name, field)| (name.clone(), field.typ(db), true))
+1501        .collect::<Vec<_>>();
+1502
+1503    validate_named_args(context, name, name_span, args, &fields)?;
+1504
+1505    let struct_type = struct_.as_type(context.db());
+1506    Ok((
+1507        ExpressionAttributes::new(struct_type),
+1508        CallType::TypeConstructor(struct_type),
+1509    ))
+1510}
+1511
+1512fn expr_call_enum_constructor(
+1513    context: &mut dyn AnalyzerContext,
+1514    name_span: Span,
+1515    variant: EnumVariantId,
+1516    args: &Node<Vec<Node<fe::CallArg>>>,
+1517) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1518    let name = &variant.name_with_parent(context.db());
+1519    match variant.kind(context.db())? {
+1520        EnumVariantKind::Unit => {
+1521            let name = variant.name_with_parent(context.db());
+1522            let label = Label::primary(name_span, format! {"`{name}` is a unit variant"});
+1523            context.fancy_error(
+1524                &format!("Can not call a unit variant `{name}`",),
+1525                vec![label],
+1526                vec![format!(
+1527                    "Suggestion: remove the parentheses to construct the unit variant `{name}`",
+1528                )],
+1529            );
+1530        }
+1531        EnumVariantKind::Tuple(elts) => {
+1532            let params: Vec<_> = elts.iter().map(|ty| (None, Ok(*ty), true)).collect();
+1533            validate_named_args(context, name, name_span, args, &params)?;
+1534        }
+1535    }
+1536
+1537    Ok((
+1538        ExpressionAttributes::new(variant.parent(context.db()).as_type(context.db())),
+1539        CallType::EnumConstructor(variant),
+1540    ))
+1541}
+1542
+1543fn expr_call_method(
+1544    context: &mut dyn AnalyzerContext,
+1545    target: &Node<fe::Expr>,
+1546    field: &Node<SmolStr>,
+1547    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+1548    args: &Node<Vec<Node<fe::CallArg>>>,
+1549) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1550    // We need to check if the target is a type or a global object before calling
+1551    // `expr()`. When the type method call syntax is changed to `MyType::foo()`
+1552    // and the global objects are replaced by `Context`, we can remove this.
+1553    // All other `NamedThing`s will be handled correctly by `expr()`.
+1554    if let fe::Expr::Name(name) = &target.kind {
+1555        if let Ok(Some(NamedThing::Item(Item::Type(def)))) = context.resolve_name(name, target.span)
+1556        {
+1557            let typ = def.typ(context.db())?;
+1558            return expr_call_type_attribute(context, typ, target.span, field, generic_args, args);
+1559        }
+1560    }
+1561
+1562    let target_attributes = expr(context, target, None)?;
+1563
+1564    // Check built-in methods.
+1565    if let Ok(method) = ValueMethod::from_str(&field.kind) {
+1566        return expr_call_builtin_value_method(
+1567            context,
+1568            target_attributes,
+1569            target,
+1570            method,
+1571            field,
+1572            args,
+1573        );
+1574    }
+1575
+1576    let obj_type = target_attributes.typ.deref(context.db());
+1577    if obj_type.is_contract(context.db()) {
+1578        check_for_call_to_special_fns(context, &field.kind, field.span)?;
+1579    }
+1580
+1581    match obj_type.function_sigs(context.db(), &field.kind).as_ref() {
+1582        [] => Err(FatalError::new(context.fancy_error(
+1583            &format!(
+1584                "No function `{}` exists on type `{}`",
+1585                &field.kind,
+1586                obj_type.display(context.db())
+1587            ),
+1588            vec![Label::primary(field.span, "undefined function")],
+1589            vec![],
+1590        ))),
+1591        [method] => {
+1592            validate_visibility_of_called_fn(context, field.span, *method);
+1593
+1594            if !method.takes_self(context.db()) {
+1595                let prefix = if method.is_module_fn(context.db())
+1596                    && context.module() == method.module(context.db())
+1597                {
+1598                    "".into()
+1599                } else {
+1600                    format!("{}::", method.parent(context.db()).name(context.db()))
+1601                };
+1602
+1603                context.fancy_error(
+1604                    &format!("`{}` must be called without `self`", &field.kind),
+1605                    vec![Label::primary(field.span, "function does not take self")],
+1606                    vec![format!(
+1607                        "Suggestion: try `{}{}(...)` instead of `self.{}(...)`",
+1608                        prefix, &field.kind, &field.kind
+1609                    )],
+1610                );
+1611            }
+1612
+1613            let sig = method.signature(context.db());
+1614            let mut_self = matches!(sig.self_decl.map(|d| d.is_mut()), Some(true));
+1615            if mut_self && !target_attributes.typ.is_mut(context.db()) {
+1616                context.error(
+1617                    &format!("`{}` takes `mut self`", &field.kind),
+1618                    target.span,
+1619                    "this is not mutable",
+1620                );
+1621            }
+1622
+1623            validate_named_args(context, &field.kind, field.span, args, &sig.params)?;
+1624            borrowck::check_fn_call_arg_borrows(
+1625                context,
+1626                &field.kind,
+1627                Some((target, target_attributes.typ)),
+1628                &args.kind,
+1629                &sig.params,
+1630            );
+1631
+1632            let calltype = match obj_type.typ(context.db()) {
+1633                Type::Contract(contract) | Type::SelfContract(contract) => {
+1634                    let method = contract
+1635                        .function(context.db(), &method.name(context.db()))
+1636                        .unwrap();
+1637
+1638                    if is_self_value(target) {
+1639                        CallType::ValueMethod {
+1640                            typ: obj_type,
+1641                            method,
+1642                        }
+1643                    } else {
+1644                        // Contract address needs to be on the stack
+1645                        deref_type(context, target, target_attributes.typ);
+1646                        CallType::External {
+1647                            contract,
+1648                            function: method,
+1649                        }
+1650                    }
+1651                }
+1652                Type::Generic(inner) => CallType::TraitValueMethod {
+1653                    trait_id: *inner.bounds.first().expect("expected trait bound"),
+1654                    method: *method,
+1655                    generic_type: inner,
+1656                },
+1657                _ => {
+1658                    let method = method.function(context.db()).unwrap();
+1659                    if let Type::SPtr(inner) = target_attributes.typ.typ(context.db()) {
+1660                        if matches!(
+1661                            inner.typ(context.db()),
+1662                            Type::Struct(_) | Type::Tuple(_) | Type::Array(_)
+1663                        ) {
+1664                            let kind = obj_type.kind_display_name(context.db());
+1665                            context.fancy_error(
+1666                                &format!("{kind} functions can only be called on {kind} in memory"),
+1667                                vec![
+1668                                    Label::primary(target.span, "this value is in storage"),
+1669                                    Label::secondary(
+1670                                        field.span,
+1671                                        format!("hint: copy the {kind} to memory with `.to_mem()`"),
+1672                                    ),
+1673                                ],
+1674                                vec![],
+1675                            );
+1676                        }
+1677                    }
+1678
+1679                    if let Item::Impl(id) = method.parent(context.db()) {
+1680                        validate_trait_in_scope(context, field.span, method, id);
+1681                    }
+1682
+1683                    CallType::ValueMethod {
+1684                        typ: obj_type,
+1685                        method,
+1686                    }
+1687                }
+1688            };
+1689
+1690            let return_type = sig.return_type.clone()?;
+1691            Ok((ExpressionAttributes::new(return_type), calltype))
+1692        }
+1693        [first, second, ..] => {
+1694            context.fancy_error(
+1695                "multiple applicable items in scope",
+1696                vec![
+1697                    Label::primary(
+1698                        first.name_span(context.db()),
+1699                        format!(
+1700                            "candidate #1 is defined here on the `{}`",
+1701                            first.parent(context.db()).item_kind_display_name()
+1702                        ),
+1703                    ),
+1704                    Label::primary(
+1705                        second.name_span(context.db()),
+1706                        format!(
+1707                            "candidate #2 is defined here on the `{}`",
+1708                            second.parent(context.db()).item_kind_display_name()
+1709                        ),
+1710                    ),
+1711                ],
+1712                vec!["Hint: rename one of the methods to disambiguate".into()],
+1713            );
+1714            let return_type = first.signature(context.db()).return_type.clone()?;
+1715            return Ok((
+1716                ExpressionAttributes::new(return_type),
+1717                CallType::ValueMethod {
+1718                    typ: obj_type,
+1719                    method: first.function(context.db()).unwrap(),
+1720                },
+1721            ));
+1722        }
+1723    }
+1724}
+1725
+1726fn validate_trait_in_scope(
+1727    context: &mut dyn AnalyzerContext,
+1728    name_span: Span,
+1729    called_fn: FunctionId,
+1730    impl_: ImplId,
+1731) {
+1732    let treit = impl_.trait_id(context.db());
+1733    let type_name = impl_.receiver(context.db()).name(context.db());
+1734
+1735    if !context
+1736        .module()
+1737        .is_in_scope(context.db(), Item::Trait(treit))
+1738    {
+1739        context.fancy_error(
+1740            &format!(
+1741                "No method named `{}` found for type `{}` in the current scope",
+1742                called_fn.name(context.db()),
+1743                type_name
+1744            ),
+1745            vec![
+1746                Label::primary(name_span, format!("method not found in `{type_name}`")),
+1747                Label::secondary(called_fn.name_span(context.db()), format!("the method is available for `{type_name}` here"))
+1748            ],
+1749            vec![
+1750                "Hint: items from traits can only be used if the trait is in scope".into(),
+1751                format!("Hint: the following trait is implemented but not in scope; perhaps add a `use` for it: `trait {}`", treit.name(context.db()))
+1752            ],
+1753        );
+1754    }
+1755}
+1756
+1757fn expr_call_builtin_value_method(
+1758    context: &mut dyn AnalyzerContext,
+1759    mut value_attrs: ExpressionAttributes,
+1760    value: &Node<fe::Expr>,
+1761    method: ValueMethod,
+1762    method_name: &Node<SmolStr>,
+1763    args: &Node<Vec<Node<fe::CallArg>>>,
+1764) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1765    // for now all of these functions expect 0 arguments
+1766    validate_arg_count(
+1767        context,
+1768        &method_name.kind,
+1769        method_name.span,
+1770        args,
+1771        0,
+1772        "argument",
+1773    );
+1774
+1775    let ty = value_attrs.typ;
+1776    let calltype = CallType::BuiltinValueMethod {
+1777        method,
+1778        typ: value_attrs.typ,
+1779    };
+1780    match method {
+1781        ValueMethod::ToMem => {
+1782            if ty.is_sptr(context.db()) {
+1783                let inner = ty.deref(context.db());
+1784                if inner.is_primitive(context.db()) {
+1785                    context.fancy_error(
+1786                        "`to_mem()` called on primitive type",
+1787                        vec![
+1788                            Label::primary(
+1789                                value.span,
+1790                                "this value does not need to be explicitly copied to memory",
+1791                            ),
+1792                            Label::secondary(method_name.span, "hint: remove `.to_mem()`"),
+1793                        ],
+1794                        vec![],
+1795                    );
+1796                } else if inner.is_map(context.db()) {
+1797                    context.fancy_error(
+1798                        "`to_mem()` called on a Map",
+1799                        vec![
+1800                            Label::primary(value.span, "Maps can not be copied to memory"),
+1801                            Label::secondary(method_name.span, "hint: remove `.to_mem()`"),
+1802                        ],
+1803                        vec![],
+1804                    );
+1805
+1806                    // TODO: this restriction should be removed
+1807                } else if ty.is_generic(context.db()) {
+1808                    context.fancy_error(
+1809                        "`to_mem()` called on generic type",
+1810                        vec![
+1811                            Label::primary(value.span, "this value can not be copied to memory"),
+1812                            Label::secondary(method_name.span, "hint: remove `.to_mem()`"),
+1813                        ],
+1814                        vec![],
+1815                    );
+1816                }
+1817
+1818                value_attrs.typ = inner;
+1819                return Ok((value_attrs, calltype));
+1820            } else {
+1821                context.fancy_error(
+1822                    "`to_mem()` called on value in memory",
+1823                    vec![
+1824                        Label::primary(value.span, "this value is already in memory"),
+1825                        Label::secondary(
+1826                            method_name.span,
+1827                            "hint: to make a copy, use `.clone()` here",
+1828                        ),
+1829                    ],
+1830                    vec![],
+1831                );
+1832            }
+1833            Ok((value_attrs, calltype))
+1834        }
+1835        ValueMethod::AbiEncode => {
+1836            abi_encoded_type(context, value_attrs.typ, value.span).map(|attr| (attr, calltype))
+1837        }
+1838    }
+1839}
+1840
+1841fn abi_encoded_type(
+1842    context: &mut dyn AnalyzerContext,
+1843    ty: TypeId,
+1844    span: Span,
+1845) -> Result<ExpressionAttributes, FatalError> {
+1846    match ty.typ(context.db()) {
+1847        Type::SPtr(inner) => {
+1848            let res = abi_encoded_type(context, inner, span);
+1849            if res.is_ok() {
+1850                context.add_diagnostic(errors::to_mem_error(span));
+1851            }
+1852            res
+1853        }
+1854        Type::Struct(struct_) => Ok(ExpressionAttributes::new(
+1855            Type::Array(Array {
+1856                inner: Type::u8().id(context.db()),
+1857                size: struct_.fields(context.db()).len() * 32,
+1858            })
+1859            .id(context.db()),
+1860        )),
+1861        Type::Tuple(tuple) => Ok(ExpressionAttributes::new(
+1862            Type::Array(Array {
+1863                inner: context.db().intern_type(Type::u8()),
+1864                size: tuple.items.len() * 32,
+1865            })
+1866            .id(context.db()),
+1867        )),
+1868        _ => Err(FatalError::new(context.fancy_error(
+1869            &format!(
+1870                "value of type `{}` does not support `abi_encode()`",
+1871                ty.display(context.db())
+1872            ),
+1873            vec![Label::primary(
+1874                span,
+1875                "this value cannot be encoded using `abi_encode()`",
+1876            )],
+1877            vec![
+1878                "Hint: struct and tuple values can be encoded.".into(),
+1879                "Example: `(42,).abi_encode()`".into(),
+1880            ],
+1881        ))),
+1882    }
+1883}
+1884
+1885fn expr_call_type_attribute(
+1886    context: &mut dyn AnalyzerContext,
+1887    typ: Type,
+1888    target_span: Span,
+1889    field: &Node<SmolStr>,
+1890    generic_args: &Option<Node<Vec<fe::GenericArg>>>,
+1891    args: &Node<Vec<Node<fe::CallArg>>>,
+1892) -> Result<(ExpressionAttributes, CallType), FatalError> {
+1893    if let Some(generic_args) = generic_args {
+1894        context.error(
+1895            "unexpected generic argument list",
+1896            generic_args.span,
+1897            "unexpected",
+1898        );
+1899    }
+1900
+1901    let arg_attributes = expr_call_args(context, args)?;
+1902
+1903    let target_type = typ.id(context.db());
+1904    let target_name = typ.name(context.db());
+1905
+1906    if let Type::Contract(contract) = typ {
+1907        // Check for Foo.create/create2 (this will go away when the context object is
+1908        // ready)
+1909        if let Ok(function) = ContractTypeMethod::from_str(&field.kind) {
+1910            if context.root_item() == Item::Type(TypeDef::Contract(contract)) {
+1911                context.fancy_error(
+1912                        &format!("`{contract}.{}(...)` called within `{contract}` creates an illegal circular dependency", function.as_ref(), contract=&target_name),
+1913                        vec![Label::primary(field.span, "Contract creation")],
+1914                        vec![format!("Note: Consider using a dedicated factory contract to create instances of `{}`", &target_name)]);
+1915            }
+1916            let arg_count = function.arg_count();
+1917            validate_arg_count(
+1918                context,
+1919                &field.kind,
+1920                field.span,
+1921                args,
+1922                arg_count,
+1923                "argument",
+1924            );
+1925
+1926            for i in 0..arg_count {
+1927                if let Some(attrs) = arg_attributes.get(i) {
+1928                    if i == 0 {
+1929                        if let Some(ctx_type) = context.get_context_type() {
+1930                            if attrs.typ != Type::Mut(ctx_type).id(context.db()) {
+1931                                context.fancy_error(
+1932                                    &format!(
+1933                                        "incorrect type for argument to `{}.{}`",
+1934                                        &target_name,
+1935                                        function.as_ref()
+1936                                    ),
+1937                                    vec![Label::primary(
+1938                                        args.kind[i].span,
+1939                                        format!(
+1940                                            "this has type `{}`; expected `mut Context`",
+1941                                            &attrs.typ.display(context.db())
+1942                                        ),
+1943                                    )],
+1944                                    vec![],
+1945                                );
+1946                            }
+1947                        } else {
+1948                            context.fancy_error(
+1949                                "`Context` is not defined",
+1950                                vec![
+1951                                    Label::primary(
+1952                                        args.span,
+1953                                        "`ctx` must be passed into the function",
+1954                                    ),
+1955                                    Label::secondary(
+1956                                        context.parent_function().name_span(context.db()),
+1957                                        "Note: declare `ctx` in this function signature",
+1958                                    ),
+1959                                    Label::secondary(
+1960                                        context.parent_function().name_span(context.db()),
+1961                                        "Example: `pub fn foo(ctx: Context, ...)`",
+1962                                    ),
+1963                                ],
+1964                                vec!["Example: `MyContract.create(ctx, 0)`".into()],
+1965                            );
+1966                        }
+1967                    } else if !attrs.typ.is_integer(context.db()) {
+1968                        context.fancy_error(
+1969                            &format!(
+1970                                "incorrect type for argument to `{}.{}`",
+1971                                &target_name,
+1972                                function.as_ref()
+1973                            ),
+1974                            vec![Label::primary(
+1975                                args.kind[i].span,
+1976                                format!(
+1977                                    "this has type `{}`; expected a number",
+1978                                    &attrs.typ.display(context.db())
+1979                                ),
+1980                            )],
+1981                            vec![],
+1982                        );
+1983                    }
+1984                }
+1985            }
+1986            return Ok((
+1987                ExpressionAttributes::new(context.db().intern_type(typ)),
+1988                CallType::BuiltinAssociatedFunction { contract, function },
+1989            ));
+1990        }
+1991    }
+1992
+1993    if let Some(sig) = target_type.function_sig(context.db(), &field.kind) {
+1994        if sig.takes_self(context.db()) {
+1995            return Err(FatalError::new(context.fancy_error(
+1996                &format!(
+1997                    "`{}` function `{}` must be called on an instance of `{}`",
+1998                    &target_name, &field.kind, &target_name,
+1999                ),
+2000                vec![Label::primary(
+2001                    target_span,
+2002                    format!(
+2003                        "expected a value of type `{}`, found type name",
+2004                        &target_name
+2005                    ),
+2006                )],
+2007                vec![],
+2008            )));
+2009        } else {
+2010            context.fancy_error(
+2011                "Static functions need to be called with `::` not `.`",
+2012                vec![Label::primary(
+2013                    field.span,
+2014                    "This is a static function (doesn't take a `self` parameter)",
+2015                )],
+2016                vec![format!(
+2017                    "Try `{}::{}(...)` instead",
+2018                    &target_name, &field.kind
+2019                )],
+2020            );
+2021        }
+2022
+2023        validate_visibility_of_called_fn(context, field.span, sig);
+2024
+2025        let ret_type = sig.signature(context.db()).return_type.clone()?;
+2026
+2027        return Ok((
+2028            ExpressionAttributes::new(ret_type),
+2029            CallType::AssociatedFunction {
+2030                typ: target_type,
+2031                function: sig
+2032                    .function(context.db())
+2033                    .expect("expected function signature to have body"),
+2034            },
+2035        ));
+2036    }
+2037
+2038    Err(FatalError::new(context.fancy_error(
+2039        &format!(
+2040            "No function `{}` exists on type `{}`",
+2041            &field.kind,
+2042            typ.display(context.db())
+2043        ),
+2044        vec![Label::primary(field.span, "undefined function")],
+2045        vec![],
+2046    )))
+2047}
+2048
+2049fn expr_call_args(
+2050    context: &mut dyn AnalyzerContext,
+2051    args: &Node<Vec<Node<fe::CallArg>>>,
+2052) -> Result<Vec<ExpressionAttributes>, FatalError> {
+2053    args.kind
+2054        .iter()
+2055        .map(|arg| expr(context, &arg.kind.value, None))
+2056        .collect::<Result<Vec<_>, _>>()
+2057}
+2058
+2059fn expect_no_label_on_arg(
+2060    context: &mut dyn AnalyzerContext,
+2061    args: &Node<Vec<Node<fe::CallArg>>>,
+2062    arg_index: usize,
+2063) {
+2064    if let Some(label) = args
+2065        .kind
+2066        .get(arg_index)
+2067        .and_then(|arg| arg.kind.label.as_ref())
+2068    {
+2069        context.error(
+2070            "argument should not be labeled",
+2071            label.span,
+2072            "remove this label",
+2073        );
+2074    }
+2075}
+2076
+2077fn check_for_call_to_special_fns(
+2078    context: &mut dyn AnalyzerContext,
+2079    name: &str,
+2080    span: Span,
+2081) -> Result<(), FatalError> {
+2082    if name == "__init__" || name == "__call__" {
+2083        let label = if name == "__init__" {
+2084            "Note: `__init__` is the constructor function, and can't be called at runtime."
+2085        } else {
+2086            // TODO: add a hint label explaining how to call contracts directly
+2087            // with `Context` (not yet supported).
+2088            "Note: `__call__` is not part of the contract's interface, and can't be called."
+2089        };
+2090        Err(FatalError::new(context.fancy_error(
+2091            &format!("`{name}()` is not directly callable"),
+2092            vec![Label::primary(span, "")],
+2093            vec![label.into()],
+2094        )))
+2095    } else {
+2096        Ok(())
+2097    }
+2098}
+2099
+2100fn validate_numeric_literal_fits_type(
+2101    context: &mut dyn AnalyzerContext,
+2102    num: BigInt,
+2103    span: Span,
+2104    int_type: Integer,
+2105) {
+2106    if !int_type.fits(num) {
+2107        context.error(
+2108            &format!("literal out of range for `{int_type}`"),
+2109            span,
+2110            &format!("does not fit into type `{int_type}`"),
+2111        );
+2112    }
+2113}
+2114
+2115fn expr_comp_operation(
+2116    context: &mut dyn AnalyzerContext,
+2117    exp: &Node<fe::Expr>,
+2118) -> Result<ExpressionAttributes, FatalError> {
+2119    if let fe::Expr::CompOperation { left, op, right } = &exp.kind {
+2120        // comparison operands should be moved to the stack
+2121        let left_ty = value_expr_type(context, left, None)?;
+2122        if left_ty.is_primitive(context.db()) {
+2123            expect_expr_type(context, right, left_ty, false)?;
+2124        } else {
+2125            context.error(
+2126                &format!(
+2127                    "`{}` type can't be compared with the `{}` operator",
+2128                    left_ty.display(context.db()),
+2129                    op.kind
+2130                ),
+2131                exp.span,
+2132                "invalid comparison",
+2133            );
+2134        }
+2135        return Ok(ExpressionAttributes::new(TypeId::bool(context.db())));
+2136    }
+2137
+2138    unreachable!()
+2139}
+2140
+2141fn expr_ternary(
+2142    context: &mut dyn AnalyzerContext,
+2143    exp: &Node<fe::Expr>,
+2144    expected_type: Option<TypeId>,
+2145) -> Result<ExpressionAttributes, FatalError> {
+2146    if let fe::Expr::Ternary {
+2147        if_expr,
+2148        test,
+2149        else_expr,
+2150    } = &exp.kind
+2151    {
+2152        error_if_not_bool(context, test, "`if` test expression must be a `bool`")?;
+2153        let if_attr = expr(context, if_expr, expected_type)?;
+2154        let else_attr = expr(context, else_expr, expected_type.or(Some(if_attr.typ)))?;
+2155
+2156        // Should have the same return Type
+2157        if if_attr.typ != else_attr.typ {
+2158            let if_expr_ty = deref_type(context, exp, if_attr.typ);
+2159
+2160            if try_coerce_type(context, Some(else_expr), else_attr.typ, if_expr_ty, false).is_err()
+2161            {
+2162                context.fancy_error(
+2163                    "`if` and `else` values must have same type",
+2164                    vec![
+2165                        Label::primary(
+2166                            if_expr.span,
+2167                            format!("this has type `{}`", if_attr.typ.display(context.db())),
+2168                        ),
+2169                        Label::secondary(
+2170                            else_expr.span,
+2171                            format!("this has type `{}`", else_attr.typ.display(context.db())),
+2172                        ),
+2173                    ],
+2174                    vec![],
+2175                );
+2176            }
+2177        }
+2178
+2179        return Ok(ExpressionAttributes::new(if_attr.typ));
+2180    }
+2181    unreachable!()
+2182}
+2183
+2184fn expr_bool_operation(
+2185    context: &mut dyn AnalyzerContext,
+2186    exp: &Node<fe::Expr>,
+2187) -> Result<ExpressionAttributes, FatalError> {
+2188    if let fe::Expr::BoolOperation { left, op: _, right } = &exp.kind {
+2189        let bool_ty = TypeId::bool(context.db());
+2190        expect_expr_type(context, left, bool_ty, false)?;
+2191        expect_expr_type(context, right, bool_ty, false)?;
+2192        return Ok(ExpressionAttributes::new(bool_ty));
+2193    }
+2194
+2195    unreachable!()
+2196}
+2197
+2198/// Converts a input string to `BigInt`.
+2199///
+2200/// # Panics
+2201/// Panics if `num` contains invalid digit.
+2202fn to_bigint(num: &str) -> BigInt {
+2203    numeric::Literal::new(num)
+2204        .parse::<BigInt>()
+2205        .expect("the numeric literal contains a invalid digit")
+2206}
+2207
+2208fn is_self_value(expr: &Node<fe::Expr>) -> bool {
+2209    if let fe::Expr::Name(name) = &expr.kind {
+2210        name == "self"
+2211    } else {
+2212        false
+2213    }
+2214}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/functions.rs.html b/compiler-docs/src/fe_analyzer/traversal/functions.rs.html new file mode 100644 index 0000000000..1496c8e86d --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/functions.rs.html @@ -0,0 +1,753 @@ +functions.rs - source

fe_analyzer/traversal/
functions.rs

1use crate::context::{AnalyzerContext, ExpressionAttributes, NamedThing};
+2use crate::display::Displayable;
+3use crate::errors::{self, FatalError, TypeCoercionError};
+4use crate::namespace::items::{EnumVariantId, EnumVariantKind, Item, StructId, TypeDef};
+5use crate::namespace::scopes::{BlockScope, BlockScopeType};
+6use crate::namespace::types::{Type, TypeId};
+7use crate::pattern_analysis::PatternMatrix;
+8use crate::traversal::{assignments, declarations, expressions, types};
+9use fe_common::diagnostics::Label;
+10use fe_parser::ast::{self as fe, LiteralPattern, Pattern};
+11use fe_parser::node::{Node, Span};
+12use indexmap::map::Entry;
+13use indexmap::{IndexMap, IndexSet};
+14use smol_str::SmolStr;
+15
+16use super::matching_anomaly;
+17
+18pub fn traverse_statements(
+19    scope: &mut BlockScope,
+20    body: &[Node<fe::FuncStmt>],
+21) -> Result<(), FatalError> {
+22    for stmt in body.iter() {
+23        func_stmt(scope, stmt)?
+24    }
+25    Ok(())
+26}
+27
+28fn func_stmt(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+29    use fe::FuncStmt::*;
+30    match &stmt.kind {
+31        Return { .. } => func_return(scope, stmt),
+32        VarDecl { .. } => declarations::var_decl(scope, stmt),
+33        ConstantDecl { .. } => declarations::const_decl(scope, stmt),
+34        Assign { .. } => assignments::assign(scope, stmt),
+35        AugAssign { .. } => assignments::aug_assign(scope, stmt),
+36        For { .. } => for_loop(scope, stmt),
+37        While { .. } => while_loop(scope, stmt),
+38        If { .. } => if_statement(scope, stmt),
+39        Match { .. } => match_statement(scope, stmt),
+40        Unsafe { .. } => unsafe_block(scope, stmt),
+41        Assert { .. } => assert(scope, stmt),
+42        Expr { value } => expressions::expr(scope, value, None).map(|_| ()),
+43        Revert { .. } => revert(scope, stmt),
+44        Break | Continue => {
+45            loop_flow_statement(scope, stmt);
+46            Ok(())
+47        }
+48    }
+49}
+50
+51fn for_loop(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+52    match &stmt.kind {
+53        fe::FuncStmt::For { target, iter, body } => {
+54            // Make sure iter is in the function scope & it should be an array.
+55            let iter_type = expressions::expr(scope, iter, None)?.typ;
+56
+57            let target_type = match iter_type.deref(scope.db()).typ(scope.db()) {
+58                Type::Array(array) => {
+59                    if iter_type.is_sptr(scope.db()) {
+60                        scope.add_diagnostic(errors::to_mem_error(iter.span));
+61                    }
+62                    array.inner
+63                }
+64                _ => {
+65                    return Err(FatalError::new(scope.register_diag(errors::type_error(
+66                        "invalid `for` loop iterator type",
+67                        iter.span,
+68                        "array",
+69                        iter_type.display(scope.db()),
+70                    ))))
+71                }
+72            };
+73            scope.root.map_variable_type(target, target_type);
+74
+75            let mut body_scope = scope.new_child(BlockScopeType::Loop);
+76            // add_var emits a msg on err; we can ignore the Result.
+77            let _ = body_scope.add_var(&target.kind, target_type, false, target.span);
+78
+79            // Traverse the statements within the `for loop` body scope.
+80            traverse_statements(&mut body_scope, body)
+81        }
+82        _ => unreachable!(),
+83    }
+84}
+85
+86fn loop_flow_statement(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) {
+87    if !scope.inherits_type(BlockScopeType::Loop) {
+88        let stmt_name = match stmt.kind {
+89            fe::FuncStmt::Continue => "continue",
+90            fe::FuncStmt::Break => "break",
+91            _ => unreachable!(),
+92        };
+93        scope.error(
+94            &format!("`{stmt_name}` outside of a loop"),
+95            stmt.span,
+96            &format!("`{stmt_name}` can only be used inside of a `for` or `while` loop"),
+97        );
+98    }
+99}
+100
+101fn if_statement(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+102    match &stmt.kind {
+103        fe::FuncStmt::If {
+104            test,
+105            body,
+106            or_else,
+107        } => {
+108            expressions::error_if_not_bool(scope, test, "`if` statement condition is not bool")?;
+109            traverse_statements(&mut scope.new_child(BlockScopeType::IfElse), body)?;
+110            traverse_statements(&mut scope.new_child(BlockScopeType::IfElse), or_else)?;
+111            Ok(())
+112        }
+113        _ => unreachable!(),
+114    }
+115}
+116
+117fn match_statement(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+118    match &stmt.kind {
+119        fe::FuncStmt::Match { expr, arms } => {
+120            let expr_type = expressions::expr(scope, expr, None)?.typ.deref(scope.db());
+121
+122            let match_scope = scope.new_child(BlockScopeType::Match);
+123
+124            // Do type check on pattern, then do analysis on arm body.
+125            let mut err_in_pat_check = Ok(());
+126            for arm in arms {
+127                let mut arm_scope = match_scope.new_child(BlockScopeType::MatchArm);
+128
+129                // Collect binds in the pattern.
+130                let binds = match match_pattern(&mut arm_scope, &arm.kind.pat, expr_type) {
+131                    Ok(binds) => binds,
+132                    Err(err) => {
+133                        err_in_pat_check = Err(err);
+134                        continue;
+135                    }
+136                };
+137
+138                // Introduce binds into arm body scope.
+139                let mut is_add_var_ok = true;
+140                for (name, bind) in binds {
+141                    // We use a first bind span in `add_var` here if multiple binds appear in the
+142                    // same pattern.
+143                    is_add_var_ok &= arm_scope
+144                        .add_var(&name, bind.ty, false, bind.spans[0])
+145                        .is_ok();
+146                }
+147
+148                if is_add_var_ok {
+149                    traverse_statements(&mut arm_scope, &arm.kind.body).ok();
+150                }
+151            }
+152
+153            err_in_pat_check?;
+154            matching_anomaly::check_match_exhaustiveness(scope, arms, stmt.span, expr_type)?;
+155            matching_anomaly::check_unreachable_pattern(scope, arms, stmt.span, expr_type)?;
+156            let pattern_matrix = PatternMatrix::from_arms(scope, arms, expr_type);
+157            scope.root.map_pattern_matrix(stmt, pattern_matrix);
+158            Ok(())
+159        }
+160        _ => unreachable!(),
+161    }
+162}
+163
+164fn match_pattern(
+165    scope: &mut BlockScope,
+166    pat: &Node<Pattern>,
+167    expected_type: TypeId,
+168) -> Result<IndexMap<SmolStr, Bind>, FatalError> {
+169    match &pat.kind {
+170        Pattern::WildCard => Ok(IndexMap::new()),
+171
+172        Pattern::Rest => Err(FatalError::new(scope.error(
+173            "`..` is not allowed here",
+174            pat.span,
+175            "rest pattern is only allowed in tuple pattern",
+176        ))),
+177
+178        Pattern::Literal(lit_pat) => {
+179            let lit_ty = match lit_pat.kind {
+180                LiteralPattern::Bool(_) => TypeId::bool(scope.db()),
+181            };
+182            if expected_type == lit_ty {
+183                Ok(IndexMap::new())
+184            } else {
+185                let err = scope.type_error("", pat.span, expected_type, lit_ty);
+186                Err(FatalError::new(err))
+187            }
+188        }
+189
+190        Pattern::Tuple(elts) => {
+191            let expected_elts = if let Type::Tuple(tup) = expected_type.typ(scope.db()) {
+192                tup.items
+193            } else {
+194                let label_msg = format!(
+195                    "expected {}, but found tuple`",
+196                    expected_type.display(scope.db())
+197                );
+198                return Err(FatalError::new(scope.fancy_error(
+199                    "mismatched types",
+200                    vec![Label::primary(pat.span, label_msg)],
+201                    vec![],
+202                )));
+203            };
+204
+205            tuple_pattern(scope, elts, &expected_elts, pat.span, None)
+206        }
+207
+208        Pattern::Path(path) => match scope.resolve_visible_path(&path.kind) {
+209            Some(NamedThing::EnumVariant(variant)) => {
+210                let db = scope.db();
+211                let parent_type = variant.parent(db).as_type(db);
+212                let kind = variant.kind(db)?;
+213                if kind != EnumVariantKind::Unit {
+214                    let variant_kind_name = kind.display_name();
+215                    let err = scope.fancy_error(
+216                        "expected an unit variant",
+217                        vec![
+218                            Label::primary(
+219                                path.span,
+220                                format!("the variant is defined as {variant_kind_name}"),
+221                            ),
+222                            Label::secondary(
+223                                variant.span(scope.db()),
+224                                format! {"{} is defined here", variant.name(scope.db())},
+225                            ),
+226                        ],
+227                        vec![],
+228                    );
+229                    return Err(FatalError::new(err));
+230                }
+231
+232                if parent_type != expected_type {
+233                    let err = scope.type_error("", pat.span, expected_type, parent_type);
+234                    Err(FatalError::new(err))
+235                } else {
+236                    Ok(IndexMap::new())
+237                }
+238            }
+239
+240            Some(NamedThing::Variable { name, span, .. }) => {
+241                let err = scope.duplicate_name_error(
+242                    &format!("`{name}` is already defined"),
+243                    &name,
+244                    span,
+245                    pat.span,
+246                );
+247                Err(FatalError::new(err))
+248            }
+249
+250            None if path.kind.segments.len() == 1 => {
+251                let name = path.kind.segments[0].kind.clone();
+252                let bind = Bind::new(name.clone(), expected_type, pat.span);
+253                let mut binds = IndexMap::new();
+254                binds.insert(name, bind);
+255                Ok(binds)
+256            }
+257
+258            None => {
+259                let path = &path.kind;
+260                let err = scope.fancy_error(
+261                    &format! {"failed to resolve `{path}`"},
+262                    vec![Label::primary(
+263                        pat.span,
+264                        format!("use of undeclared type `{path}`"),
+265                    )],
+266                    vec![],
+267                );
+268                Err(FatalError::new(err))
+269            }
+270
+271            _ => {
+272                let err = scope.fancy_error(
+273                    "expected enum variant or variable",
+274                    vec![Label::primary(
+275                        pat.span,
+276                        format!("`{}` is not a enum variant or variable", path.kind),
+277                    )],
+278                    vec![],
+279                );
+280                Err(FatalError::new(err))
+281            }
+282        },
+283
+284        Pattern::PathTuple(path, pat_elts) => {
+285            let variant = match scope.resolve_path(&path.kind, path.span)? {
+286                NamedThing::EnumVariant(variant) => variant,
+287                _ => {
+288                    let err = scope.fancy_error(
+289                        "expected enum variant",
+290                        vec![Label::primary(path.span, "expected enum variant here")],
+291                        vec![],
+292                    );
+293                    return Err(FatalError::new(err));
+294                }
+295            };
+296
+297            let parent_type = variant.parent(scope.db()).as_type(scope.db());
+298            if parent_type != expected_type {
+299                let err = scope.type_error("", pat.span, expected_type, parent_type);
+300                return Err(FatalError::new(err));
+301            }
+302
+303            let variant_kind = variant.kind(scope.db())?;
+304            let ty_elts = match variant_kind {
+305                EnumVariantKind::Tuple(types) => types,
+306                EnumVariantKind::Unit => {
+307                    let variant_kind_name = variant_kind.display_name();
+308                    let err = scope.fancy_error(
+309                        "expected a tuple variant",
+310                        vec![
+311                            Label::primary(
+312                                path.span,
+313                                format!("the variant is defined as {variant_kind_name}"),
+314                            ),
+315                            Label::secondary(
+316                                variant.span(scope.db()),
+317                                format! {"{} is defined here", variant.name(scope.db())},
+318                            ),
+319                        ],
+320                        vec![],
+321                    );
+322                    return Err(FatalError::new(err));
+323                }
+324            };
+325
+326            tuple_pattern(scope, pat_elts, &ty_elts, pat.span, Some(variant))
+327        }
+328
+329        Pattern::PathStruct {
+330            path,
+331            fields,
+332            has_rest,
+333        } => {
+334            let (sid, ty) = match scope.resolve_path(&path.kind, path.span)? {
+335                NamedThing::Item(Item::Type(TypeDef::Struct(sid))) => {
+336                    (sid, sid.as_type(scope.db()))
+337                }
+338                _ => {
+339                    let err = scope.fancy_error(
+340                        "expected struct type",
+341                        vec![Label::primary(
+342                            pat.span,
+343                            format!("`{}` is not a struct name", path.kind),
+344                        )],
+345                        vec![],
+346                    );
+347                    return Err(FatalError::new(err));
+348                }
+349            };
+350
+351            if ty != expected_type {
+352                let err = scope.type_error("", pat.span, expected_type, ty);
+353                return Err(FatalError::new(err));
+354            }
+355
+356            struct_pattern(scope, fields, *has_rest, sid, pat.span)
+357        }
+358
+359        Pattern::Or(sub_pats) => {
+360            let mut subpat_binds = vec![];
+361            let mut all_variables = IndexSet::new();
+362
+363            // Collect binds and variable names in the all sub patterns.
+364            for sub_pat in sub_pats {
+365                let pattern = match_pattern(scope, sub_pat, expected_type)?;
+366                for var in pattern.keys() {
+367                    all_variables.insert(var.clone());
+368                }
+369
+370                subpat_binds.push((sub_pat, pattern));
+371            }
+372
+373            // Check all variables are defined in the all sub patterns.
+374            let mut err = None;
+375            for var in all_variables.iter() {
+376                for (subpat, binds) in subpat_binds.iter() {
+377                    if !binds.contains_key(var) {
+378                        err = Some(scope.fancy_error(
+379                            &format!("variable `{var}` is not bound in all sub patterns"),
+380                            vec![Label::primary(
+381                                subpat.span,
+382                                format!("variable `{var}` is not bound here"),
+383                            )],
+384                            vec![],
+385                        ));
+386                    }
+387                }
+388            }
+389            if let Some(err) = err {
+390                return Err(FatalError::new(err));
+391            }
+392
+393            // Check all variables has the same type.
+394            err = None;
+395            for var in all_variables.iter() {
+396                let first_bind = &subpat_binds.first().unwrap().1[var];
+397                let ty = first_bind.ty;
+398                for (_, binds) in subpat_binds.iter().skip(1) {
+399                    let bind = &binds[var];
+400                    if bind.ty != ty {
+401                        bind.spans.iter().for_each(|span| {
+402                            err = Some(scope.type_error(
+403                                &format! {"mismatched type for `{var}` between sub patterns"},
+404                                *span,
+405                                ty,
+406                                bind.ty,
+407                            ));
+408                        });
+409                    }
+410                }
+411            }
+412            if let Some(err) = err {
+413                return Err(FatalError::new(err));
+414            }
+415
+416            // Merge subpat binds.
+417            let mut result: IndexMap<SmolStr, Bind> = IndexMap::new();
+418            for (_, binds) in subpat_binds {
+419                for (name, bind) in binds {
+420                    result
+421                        .entry(name)
+422                        .and_modify(|entry| entry.spans.extend_from_slice(&bind.spans))
+423                        .or_insert(bind);
+424                }
+425            }
+426            Ok(result)
+427        }
+428    }
+429}
+430
+431fn struct_pattern(
+432    scope: &mut BlockScope,
+433    fields: &[(Node<SmolStr>, Node<Pattern>)],
+434    has_rest: bool,
+435    sid: StructId,
+436    pat_span: Span,
+437) -> Result<IndexMap<SmolStr, Bind>, FatalError> {
+438    let mut pat_fields: IndexMap<SmolStr, (Node<Pattern>, Span)> = IndexMap::new();
+439    let mut maybe_err = Ok(());
+440    for (name, pat) in fields.iter() {
+441        match pat_fields.entry(name.kind.clone()) {
+442            Entry::Occupied(entry) => {
+443                let err = scope.fancy_error(
+444                    &format!("duplicate field `{}` bound in the pattern", name.kind),
+445                    vec![
+446                        Label::primary(name.span, "multiple uses here"),
+447                        Label::secondary(entry.get().1, "first binding of the field"),
+448                    ],
+449                    vec![],
+450                );
+451                maybe_err = Err(FatalError::new(err));
+452            }
+453            Entry::Vacant(entry) => {
+454                entry.insert((pat.clone(), name.span));
+455            }
+456        }
+457    }
+458
+459    maybe_err?;
+460    let mut maybe_err = Ok(());
+461
+462    let fields_def = sid.fields(scope.db());
+463    let mut ordered_patterns = Vec::with_capacity(fields_def.len());
+464    let mut expected_types = Vec::with_capacity(fields_def.len());
+465
+466    for (f_name, field) in sid.fields(scope.db()).iter() {
+467        let ty = match field.typ(scope.db()) {
+468            Ok(ty) => ty,
+469            Err(err) => {
+470                maybe_err = Err(err.into());
+471                continue;
+472            }
+473        };
+474
+475        let pat = match pat_fields.remove(f_name) {
+476            Some((_, span)) if !field.is_public(scope.db()) => {
+477                let err = scope.fancy_error(
+478                    &format!("field `{f_name}` is not public field"),
+479                    vec![
+480                        Label::primary(span, format!("`{f_name}` is not public")),
+481                        Label::secondary(field.span(scope.db()), "field is defined here"),
+482                    ],
+483                    vec![],
+484                );
+485                maybe_err = Err(FatalError::new(err));
+486                continue;
+487            }
+488            Some((pat, _)) => pat,
+489            None => {
+490                if has_rest {
+491                    let dummy_span = Span::dummy();
+492                    Node::new(Pattern::WildCard, dummy_span)
+493                } else {
+494                    let err = scope.fancy_error(
+495                        &format!("missing field `{f_name}` in the pattern"),
+496                        vec![Label::primary(pat_span, "missing field")],
+497                        vec![],
+498                    );
+499                    maybe_err = Err(FatalError::new(err));
+500                    continue;
+501                }
+502            }
+503        };
+504
+505        ordered_patterns.push(pat);
+506        expected_types.push(ty);
+507    }
+508
+509    maybe_err?;
+510
+511    collect_binds_from_pat_vec(scope, &ordered_patterns, &expected_types)
+512}
+513
+514fn tuple_pattern(
+515    scope: &mut BlockScope,
+516    tuple_elts: &[Node<Pattern>],
+517    expected_tys: &[TypeId],
+518    pat_span: Span,
+519    variant: Option<EnumVariantId>,
+520) -> Result<IndexMap<SmolStr, Bind>, FatalError> {
+521    let mut rest_pat_pos: Option<(usize, Span)> = None;
+522    for (i, pat) in tuple_elts.iter().enumerate() {
+523        if pat.kind.is_rest() {
+524            if rest_pat_pos.is_some() {
+525                let err = scope.fancy_error(
+526                    "multiple rest patterns are not allowed",
+527                    vec![
+528                        Label::primary(pat.span, "multiple rest patterns are not allowed"),
+529                        Label::secondary(rest_pat_pos.unwrap().1, "first rest pattern is here"),
+530                    ],
+531                    vec![],
+532                );
+533                return Err(FatalError::new(err));
+534            } else {
+535                rest_pat_pos = Some((i, pat.span));
+536            }
+537        }
+538    }
+539
+540    let emit_len_error = |actual, expected| {
+541        let mut labels = vec![Label::primary(
+542            pat_span,
+543            format! {"expected {expected} elements, but {actual}"},
+544        )];
+545        if let Some(variant) = variant {
+546            labels.push(Label::secondary(
+547                variant.span(scope.db()),
+548                format! {"{} is defined here", variant.name(scope.db())},
+549            ));
+550        }
+551
+552        let err = scope.fancy_error("the number of tuple variant mismatch", labels, vec![]);
+553        Err(FatalError::new(err))
+554    };
+555
+556    if rest_pat_pos.is_some() && tuple_elts.len() - 1 > expected_tys.len() {
+557        return emit_len_error(tuple_elts.len() - 1, expected_tys.len());
+558    } else if rest_pat_pos.is_none() && tuple_elts.len() != expected_tys.len() {
+559        return emit_len_error(tuple_elts.len(), expected_tys.len());
+560    };
+561
+562    collect_binds_from_pat_vec(scope, tuple_elts, expected_tys)
+563}
+564
+565fn collect_binds_from_pat_vec(
+566    scope: &mut BlockScope,
+567    pats: &[Node<Pattern>],
+568    expected_types: &[TypeId],
+569) -> Result<IndexMap<SmolStr, Bind>, FatalError> {
+570    let mut binds: IndexMap<SmolStr, Bind> = IndexMap::new();
+571    let mut types_iter = expected_types.iter();
+572    for pat in pats.iter() {
+573        if pat.kind.is_rest() {
+574            let pat_num_in_rest = expected_types.len() - (pats.len() - 1);
+575            for _ in 0..pat_num_in_rest {
+576                types_iter.next();
+577            }
+578            continue;
+579        }
+580
+581        for (name, bind) in match_pattern(scope, pat, *types_iter.next().unwrap())?.into_iter() {
+582            match binds.entry(name) {
+583                Entry::Occupied(entry) => {
+584                    let original = entry.get();
+585                    let err = scope.fancy_error(
+586                        "same variable appears in the same pattern",
+587                        vec![
+588                            Label::primary(
+589                                bind.spans[0],
+590                                format! {"{} is already defined", bind.name },
+591                            ),
+592                            Label::secondary(
+593                                original.spans[0],
+594                                format! {"{} is originally defined here", original.name },
+595                            ),
+596                        ],
+597                        vec![],
+598                    );
+599                    return Err(FatalError::new(err));
+600                }
+601                Entry::Vacant(entry) => {
+602                    entry.insert(bind);
+603                }
+604            }
+605        }
+606    }
+607
+608    Ok(binds)
+609}
+610
+611#[derive(Clone, PartialEq, Eq, Hash)]
+612struct Bind {
+613    name: SmolStr,
+614    ty: TypeId,
+615    spans: Vec<Span>,
+616}
+617
+618impl Bind {
+619    fn new(name: SmolStr, ty: TypeId, span: Span) -> Self {
+620        Self {
+621            name,
+622            ty,
+623            spans: vec![span],
+624        }
+625    }
+626}
+627
+628fn unsafe_block(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+629    match &stmt.kind {
+630        fe::FuncStmt::Unsafe(body) => {
+631            if scope.inherits_type(BlockScopeType::Unsafe) {
+632                scope.error(
+633                    "unnecessary `unsafe` block",
+634                    stmt.span,
+635                    "this `unsafe` block is nested inside another `unsafe` context",
+636                );
+637            }
+638            traverse_statements(&mut scope.new_child(BlockScopeType::Unsafe), body)
+639        }
+640        _ => unreachable!(),
+641    }
+642}
+643
+644fn while_loop(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+645    match &stmt.kind {
+646        fe::FuncStmt::While { test, body } => {
+647            expressions::error_if_not_bool(scope, test, "`while` loop condition is not bool")?;
+648            traverse_statements(&mut scope.new_child(BlockScopeType::Loop), body)?;
+649            Ok(())
+650        }
+651        _ => unreachable!(),
+652    }
+653}
+654
+655fn assert(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+656    if let fe::FuncStmt::Assert { test, msg } = &stmt.kind {
+657        expressions::error_if_not_bool(scope, test, "`assert` condition is not bool")?;
+658
+659        if let Some(msg) = msg {
+660            let msg_attributes = expressions::expr(scope, msg, None)?;
+661            match msg_attributes.typ.typ(scope.db()) {
+662                Type::String(_) => {}
+663                Type::SPtr(inner) if matches!(inner.typ(scope.db()), Type::String(_)) => {
+664                    scope.add_diagnostic(errors::to_mem_error(msg.span));
+665                }
+666                _ => {
+667                    scope.error(
+668                        "`assert` reason must be a string",
+669                        msg.span,
+670                        &format!(
+671                            "this has type `{}`; expected a string",
+672                            msg_attributes.typ.display(scope.db())
+673                        ),
+674                    );
+675                }
+676            }
+677        }
+678
+679        return Ok(());
+680    }
+681
+682    unreachable!()
+683}
+684
+685fn revert(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+686    if let fe::FuncStmt::Revert { error } = &stmt.kind {
+687        if let Some(error_expr) = error {
+688            let error_attr = expressions::expr(scope, error_expr, None)?;
+689            if !error_attr.typ.deref(scope.db()).is_struct(scope.db()) {
+690                scope.error(
+691                    "`revert` error must be a struct",
+692                    error_expr.span,
+693                    &format!(
+694                        "this has type `{}`; expected a struct",
+695                        error_attr.typ.deref(scope.db()).display(scope.db())
+696                    ),
+697                );
+698            } else if error_attr.typ.is_sptr(scope.db()) {
+699                scope.fancy_error(
+700                    "`revert` value must be copied to memory",
+701                    vec![Label::primary(error_expr.span, "this value is in storage")],
+702                    vec!["Hint: values located in storage can be copied to memory using the `to_mem` function.".into(),
+703                         format!("Example: `{}.to_mem()`", error_expr.kind),
+704                    ],
+705                );
+706            }
+707        }
+708
+709        return Ok(());
+710    }
+711
+712    unreachable!()
+713}
+714
+715fn func_return(scope: &mut BlockScope, stmt: &Node<fe::FuncStmt>) -> Result<(), FatalError> {
+716    if let fe::FuncStmt::Return { value } = &stmt.kind {
+717        let expected_type = scope.root.function_return_type()?.deref(scope.db());
+718
+719        let value_attr = match value {
+720            Some(val) => expressions::expr(scope, val, Some(expected_type))?,
+721            None => ExpressionAttributes::new(TypeId::unit(scope.db())),
+722        };
+723
+724        match types::try_coerce_type(scope, value.as_ref(), value_attr.typ, expected_type, true) {
+725            Err(TypeCoercionError::RequiresToMem) => {
+726                let value = value.clone().expect("to_mem required on unit type?");
+727                scope.add_diagnostic(errors::to_mem_error(value.span));
+728            }
+729            Err(TypeCoercionError::Incompatible) => {
+730                scope.error(
+731                    &format!(
+732                        "expected function to return `{}` but was `{}`",
+733                        expected_type.display(scope.db()),
+734                        value_attr.typ.deref(scope.db()).display(scope.db())
+735                    ),
+736                    stmt.span,
+737                    "",
+738                );
+739            }
+740            Err(TypeCoercionError::SelfContractType) => {
+741                scope.add_diagnostic(errors::self_contract_type_error(
+742                    value.as_ref().unwrap().span,
+743                    &expected_type.display(scope.db()),
+744                ));
+745            }
+746            Ok(_) => {}
+747        }
+748
+749        return Ok(());
+750    }
+751
+752    unreachable!()
+753}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/matching_anomaly.rs.html b/compiler-docs/src/fe_analyzer/traversal/matching_anomaly.rs.html new file mode 100644 index 0000000000..5a280b16d0 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/matching_anomaly.rs.html @@ -0,0 +1,101 @@ +matching_anomaly.rs - source

fe_analyzer/traversal/
matching_anomaly.rs

1use std::fmt::Write;
+2
+3use fe_common::Span;
+4use fe_parser::{ast::MatchArm, node::Node, Label};
+5
+6use crate::{
+7    context::AnalyzerContext,
+8    display::Displayable,
+9    errors::FatalError,
+10    namespace::{scopes::BlockScope, types::TypeId},
+11    AnalyzerDb,
+12};
+13
+14use super::pattern_analysis::{PatternMatrix, SimplifiedPattern};
+15
+16pub(super) fn check_match_exhaustiveness(
+17    scope: &mut BlockScope,
+18    arms: &[Node<MatchArm>],
+19    match_span: Span,
+20    ty: TypeId,
+21) -> Result<(), FatalError> {
+22    if arms.is_empty() {
+23        let err = scope.fancy_error(
+24            "patterns is not exhaustive",
+25            vec![Label::primary(
+26                match_span,
+27                "expected at least one match arm here",
+28            )],
+29            vec![],
+30        );
+31        return Err(FatalError::new(err));
+32    }
+33
+34    let pattern_matrix = PatternMatrix::from_arms(scope, arms, ty);
+35    match pattern_matrix.find_non_exhaustiveness(scope.db()) {
+36        Some(pats) => {
+37            let err = scope.fancy_error(
+38                "patterns is not exhaustive",
+39                vec![Label::primary(
+40                    match_span,
+41                    format! {"`{}` not covered", display_non_exhaustive_patterns(scope.db(), &pats)},
+42                )],
+43                vec![],
+44            );
+45            Err(FatalError::new(err))
+46        }
+47        None => Ok(()),
+48    }
+49}
+50
+51pub(super) fn check_unreachable_pattern(
+52    scope: &mut BlockScope,
+53    arms: &[Node<MatchArm>],
+54    match_span: Span,
+55    ty: TypeId,
+56) -> Result<(), FatalError> {
+57    if arms.is_empty() {
+58        let err = scope.fancy_error(
+59            "patterns is not exhaustive",
+60            vec![Label::primary(
+61                match_span,
+62                "expected at least one match arm here",
+63            )],
+64            vec![],
+65        );
+66        return Err(FatalError::new(err));
+67    }
+68
+69    let pattern_matrix = PatternMatrix::from_arms(scope, arms, ty);
+70    let mut res = Ok(());
+71    for (i, arms) in arms.iter().enumerate() {
+72        if !pattern_matrix.is_row_useful(scope.db(), i) {
+73            let err = scope.fancy_error(
+74                "unreachable pattern ",
+75                vec![Label::primary(
+76                    arms.kind.pat.span,
+77                    "this arm is unreachable",
+78                )],
+79                vec![],
+80            );
+81            res = Err(FatalError::new(err));
+82        }
+83    }
+84    res
+85}
+86
+87fn display_non_exhaustive_patterns(db: &dyn AnalyzerDb, pats: &[SimplifiedPattern]) -> String {
+88    if pats.len() == 1 {
+89        format!("{}", pats[0].display(db))
+90    } else {
+91        let mut s = "(".to_string();
+92        let mut delim = "";
+93        for pat in pats {
+94            let pat = pat.display(db);
+95            write!(s, "{delim}{pat}").unwrap();
+96            delim = ", ";
+97        }
+98        s.push(')');
+99        s
+100    }
+101}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/mod.rs.html b/compiler-docs/src/fe_analyzer/traversal/mod.rs.html new file mode 100644 index 0000000000..440379c090 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/mod.rs.html @@ -0,0 +1,14 @@ +mod.rs - source

fe_analyzer/traversal/
mod.rs

1pub mod functions;
+2pub mod pattern_analysis;
+3pub mod pragma;
+4pub mod types;
+5
+6pub(crate) mod const_expr;
+7pub(crate) mod expressions;
+8
+9mod assignments;
+10mod borrowck;
+11mod call_args;
+12mod declarations;
+13mod matching_anomaly;
+14mod utils;
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/pattern_analysis.rs.html b/compiler-docs/src/fe_analyzer/traversal/pattern_analysis.rs.html new file mode 100644 index 0000000000..842bce7c47 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/pattern_analysis.rs.html @@ -0,0 +1,753 @@ +pattern_analysis.rs - source

fe_analyzer/traversal/
pattern_analysis.rs

1//! This module includes utility structs and its functions for pattern matching
+2//! analysis. The algorithm here is based on [Warnings for pattern matching](https://www.cambridge.org/core/journals/journal-of-functional-programming/article/warnings-for-pattern-matching/3165B75113781E2431E3856972940347)
+3//!
+4//! In this module, we assume all types are well-typed, so we can rely on the
+5//! type information without checking it.
+6
+7use std::fmt;
+8
+9use fe_parser::{
+10    ast::{LiteralPattern, MatchArm, Pattern},
+11    node::Node,
+12};
+13use indexmap::{IndexMap, IndexSet};
+14use smol_str::SmolStr;
+15
+16use crate::{
+17    context::{AnalyzerContext, NamedThing},
+18    display::{DisplayWithDb, Displayable},
+19    namespace::{
+20        items::{EnumVariantId, EnumVariantKind, Item, StructId, TypeDef},
+21        scopes::BlockScope,
+22        types::{Base, Type, TypeId},
+23    },
+24    AnalyzerDb,
+25};
+26
+27#[derive(Clone, Debug, PartialEq, Eq)]
+28pub struct PatternMatrix {
+29    rows: Vec<PatternRowVec>,
+30}
+31
+32impl PatternMatrix {
+33    pub fn new(rows: Vec<PatternRowVec>) -> Self {
+34        Self { rows }
+35    }
+36
+37    pub fn from_arms<'db>(
+38        scope: &'db BlockScope<'db, 'db>,
+39        arms: &[Node<MatchArm>],
+40        ty: TypeId,
+41    ) -> Self {
+42        let mut rows = Vec::with_capacity(arms.len());
+43        for (i, arm) in arms.iter().enumerate() {
+44            rows.push(PatternRowVec::new(vec![simplify_pattern(
+45                scope,
+46                &arm.kind.pat.kind,
+47                ty,
+48                i,
+49            )]));
+50        }
+51
+52        Self { rows }
+53    }
+54
+55    pub fn rows(&self) -> &[PatternRowVec] {
+56        &self.rows
+57    }
+58
+59    pub fn into_rows(self) -> Vec<PatternRowVec> {
+60        self.rows
+61    }
+62
+63    pub fn find_non_exhaustiveness(&self, db: &dyn AnalyzerDb) -> Option<Vec<SimplifiedPattern>> {
+64        if self.nrows() == 0 {
+65            // Non Exhaustive!
+66            return Some(vec![]);
+67        }
+68        if self.ncols() == 0 {
+69            return None;
+70        }
+71
+72        let ty = self.first_column_ty();
+73        let sigma_set = self.sigma_set();
+74        if sigma_set.is_complete(db) {
+75            for ctor in sigma_set.into_iter() {
+76                match self.phi_specialize(db, ctor).find_non_exhaustiveness(db) {
+77                    Some(vec) if vec.is_empty() => {
+78                        let pat_kind = SimplifiedPatternKind::Constructor {
+79                            kind: ctor,
+80                            fields: vec![],
+81                        };
+82                        let pat = SimplifiedPattern::new(pat_kind, ty);
+83
+84                        return Some(vec![pat]);
+85                    }
+86
+87                    Some(mut vec) => {
+88                        let field_num = ctor.arity(db);
+89                        debug_assert!(vec.len() >= field_num);
+90                        let rem = vec.split_off(field_num);
+91                        let pat_kind = SimplifiedPatternKind::Constructor {
+92                            kind: ctor,
+93                            fields: vec,
+94                        };
+95                        let pat = SimplifiedPattern::new(pat_kind, ty);
+96
+97                        let mut result = vec![pat];
+98                        result.extend_from_slice(&rem);
+99                        return Some(result);
+100                    }
+101
+102                    None => {}
+103                }
+104            }
+105
+106            None
+107        } else {
+108            self.d_specialize(db)
+109                .find_non_exhaustiveness(db)
+110                .map(|vec| {
+111                    let sigma_set = self.sigma_set();
+112                    let kind = if sigma_set.is_empty() {
+113                        SimplifiedPatternKind::WildCard(None)
+114                    } else {
+115                        let complete_sigma = SigmaSet::complete_sigma(db, ty);
+116                        SimplifiedPatternKind::Or(
+117                            complete_sigma
+118                                .difference(&sigma_set)
+119                                .into_iter()
+120                                .map(|ctor| {
+121                                    let kind =
+122                                        SimplifiedPatternKind::ctor_with_wild_card_fields(db, ctor);
+123                                    SimplifiedPattern::new(kind, ty)
+124                                })
+125                                .collect(),
+126                        )
+127                    };
+128
+129                    let mut result = vec![SimplifiedPattern::new(kind, ty)];
+130                    result.extend_from_slice(&vec);
+131
+132                    result
+133                })
+134        }
+135    }
+136
+137    pub fn is_row_useful(&self, db: &dyn AnalyzerDb, row: usize) -> bool {
+138        debug_assert!(self.nrows() > row);
+139
+140        Self {
+141            rows: self.rows[0..row].to_vec(),
+142        }
+143        .is_pattern_useful(db, &self.rows[row])
+144    }
+145
+146    pub fn nrows(&self) -> usize {
+147        self.rows.len()
+148    }
+149
+150    pub fn ncols(&self) -> usize {
+151        debug_assert_ne!(self.nrows(), 0);
+152        let ncols = self.rows[0].len();
+153        debug_assert!(self.rows.iter().all(|row| row.len() == ncols));
+154        ncols
+155    }
+156
+157    pub fn swap_col(&mut self, col1: usize, col2: usize) {
+158        for row in &mut self.rows {
+159            row.swap(col1, col2);
+160        }
+161    }
+162
+163    pub fn sigma_set(&self) -> SigmaSet {
+164        SigmaSet::from_rows(self.rows.iter(), 0)
+165    }
+166
+167    pub fn phi_specialize(&self, db: &dyn AnalyzerDb, ctor: ConstructorKind) -> Self {
+168        let mut new_cols = Vec::new();
+169        for col in &self.rows {
+170            new_cols.extend_from_slice(&col.phi_specialize(db, ctor));
+171        }
+172        Self { rows: new_cols }
+173    }
+174
+175    pub fn d_specialize(&self, db: &dyn AnalyzerDb) -> Self {
+176        let mut new_cols = Vec::new();
+177        for col in &self.rows {
+178            new_cols.extend_from_slice(&col.d_specialize(db));
+179        }
+180        Self { rows: new_cols }
+181    }
+182
+183    fn first_column_ty(&self) -> TypeId {
+184        debug_assert_ne!(self.ncols(), 0);
+185        self.rows[0].first_column_ty()
+186    }
+187
+188    fn is_pattern_useful(&self, db: &dyn AnalyzerDb, pat_vec: &PatternRowVec) -> bool {
+189        if self.nrows() == 0 {
+190            return true;
+191        }
+192
+193        if self.ncols() == 0 {
+194            return false;
+195        }
+196
+197        match &pat_vec.head().unwrap().kind {
+198            SimplifiedPatternKind::WildCard(_) => self
+199                .d_specialize(db)
+200                .is_pattern_useful(db, &pat_vec.d_specialize(db)[0]),
+201
+202            SimplifiedPatternKind::Constructor { kind, .. } => self
+203                .phi_specialize(db, *kind)
+204                .is_pattern_useful(db, &pat_vec.phi_specialize(db, *kind)[0]),
+205
+206            SimplifiedPatternKind::Or(pats) => {
+207                for pat in pats {
+208                    if self.is_pattern_useful(db, &PatternRowVec::new(vec![pat.clone()])) {
+209                        return true;
+210                    }
+211                }
+212                false
+213            }
+214        }
+215    }
+216}
+217
+218#[derive(Clone, Debug, PartialEq, Eq)]
+219pub struct SimplifiedPattern {
+220    pub kind: SimplifiedPatternKind,
+221    pub ty: TypeId,
+222}
+223
+224impl SimplifiedPattern {
+225    pub fn new(kind: SimplifiedPatternKind, ty: TypeId) -> Self {
+226        Self { kind, ty }
+227    }
+228
+229    pub fn wildcard(bind: Option<(SmolStr, usize)>, ty: TypeId) -> Self {
+230        Self::new(SimplifiedPatternKind::WildCard(bind), ty)
+231    }
+232
+233    pub fn is_wildcard(&self) -> bool {
+234        matches!(self.kind, SimplifiedPatternKind::WildCard(_))
+235    }
+236}
+237
+238impl DisplayWithDb for SimplifiedPattern {
+239    fn format(&self, db: &dyn AnalyzerDb, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+240        match &self.kind {
+241            SimplifiedPatternKind::WildCard(None) => write!(f, "_"),
+242            SimplifiedPatternKind::WildCard(Some((name, _))) => write!(f, "{name}"),
+243
+244            SimplifiedPatternKind::Constructor {
+245                kind: ConstructorKind::Enum(id),
+246                fields,
+247            } => {
+248                let ctor_name = id.name_with_parent(db);
+249                write!(f, "{ctor_name}")?;
+250                if !id.kind(db).unwrap().is_unit() {
+251                    write!(f, "(")?;
+252                    let mut delim = "";
+253                    for field in fields {
+254                        let displayable = field.display(db);
+255                        write!(f, "{delim}{displayable}")?;
+256                        delim = ", ";
+257                    }
+258                    write!(f, ")")
+259                } else {
+260                    Ok(())
+261                }
+262            }
+263
+264            SimplifiedPatternKind::Constructor {
+265                kind: ConstructorKind::Tuple(_),
+266                fields,
+267            } => {
+268                write!(f, "(")?;
+269                let mut delim = "";
+270                for field in fields {
+271                    let displayable = field.display(db);
+272                    write!(f, "{delim}{displayable}")?;
+273                    delim = ", ";
+274                }
+275                write!(f, ")")
+276            }
+277
+278            SimplifiedPatternKind::Constructor {
+279                kind: ConstructorKind::Struct(sid),
+280                fields,
+281            } => {
+282                let struct_name = sid.name(db);
+283                write!(f, "{struct_name} {{ ")?;
+284                let mut delim = "";
+285
+286                for (field_name, field_pat) in sid
+287                    .fields(db)
+288                    .iter()
+289                    .map(|(field_name, _)| field_name)
+290                    .zip(fields.iter())
+291                {
+292                    let displayable = field_pat.display(db);
+293                    write!(f, "{delim}{field_name}: {displayable}")?;
+294                    delim = ", ";
+295                }
+296                write!(f, "}}")
+297            }
+298
+299            SimplifiedPatternKind::Constructor {
+300                kind: ConstructorKind::Literal((lit, _)),
+301                ..
+302            } => {
+303                write!(f, "{lit}")
+304            }
+305
+306            SimplifiedPatternKind::Or(pats) => {
+307                let mut delim = "";
+308                for pat in pats {
+309                    let pat = pat.display(db);
+310                    write!(f, "{delim}{pat}")?;
+311                    delim = " | ";
+312                }
+313                Ok(())
+314            }
+315        }
+316    }
+317}
+318
+319#[derive(Clone, Debug, PartialEq, Eq)]
+320pub enum SimplifiedPatternKind {
+321    WildCard(Option<(SmolStr, usize)>),
+322    Constructor {
+323        kind: ConstructorKind,
+324        fields: Vec<SimplifiedPattern>,
+325    },
+326    Or(Vec<SimplifiedPattern>),
+327}
+328
+329impl SimplifiedPatternKind {
+330    pub fn collect_ctors(&self) -> Vec<ConstructorKind> {
+331        match self {
+332            Self::WildCard(_) => vec![],
+333            Self::Constructor { kind, .. } => vec![*kind],
+334            Self::Or(pats) => {
+335                let mut ctors = vec![];
+336                for pat in pats {
+337                    ctors.extend_from_slice(&pat.kind.collect_ctors());
+338                }
+339                ctors
+340            }
+341        }
+342    }
+343
+344    pub fn ctor_with_wild_card_fields(db: &dyn AnalyzerDb, kind: ConstructorKind) -> Self {
+345        let fields = kind
+346            .field_types(db)
+347            .into_iter()
+348            .map(|ty| SimplifiedPattern::wildcard(None, ty))
+349            .collect();
+350        Self::Constructor { kind, fields }
+351    }
+352}
+353
+354#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+355pub enum ConstructorKind {
+356    Enum(EnumVariantId),
+357    Tuple(TypeId),
+358    Struct(StructId),
+359    Literal((LiteralPattern, TypeId)),
+360}
+361
+362#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+363pub enum LiteralConstructor {
+364    Bool(bool),
+365}
+366
+367impl ConstructorKind {
+368    pub fn field_types(&self, db: &dyn AnalyzerDb) -> Vec<TypeId> {
+369        match self {
+370            Self::Enum(id) => match id.kind(db).unwrap() {
+371                EnumVariantKind::Unit => vec![],
+372                EnumVariantKind::Tuple(types) => types.to_vec(),
+373            },
+374            Self::Tuple(ty) => ty.tuple_elts(db),
+375            Self::Struct(sid) => sid
+376                .fields(db)
+377                .iter()
+378                .map(|(_, fid)| fid.typ(db).unwrap())
+379                .collect(),
+380            Self::Literal(_) => vec![],
+381        }
+382    }
+383
+384    pub fn arity(&self, db: &dyn AnalyzerDb) -> usize {
+385        match self {
+386            Self::Enum(id) => match id.kind(db).unwrap() {
+387                EnumVariantKind::Unit => 0,
+388                EnumVariantKind::Tuple(types) => types.len(),
+389            },
+390            Self::Tuple(ty) => ty.tuple_elts(db).len(),
+391            Self::Struct(sid) => sid.fields(db).len(),
+392            Self::Literal(_) => 0,
+393        }
+394    }
+395
+396    pub fn ty(&self, db: &dyn AnalyzerDb) -> TypeId {
+397        match self {
+398            Self::Enum(id) => id.parent(db).as_type(db),
+399            Self::Tuple(ty) => *ty,
+400            Self::Struct(sid) => sid.as_type(db),
+401            Self::Literal((_, ty)) => *ty,
+402        }
+403    }
+404}
+405
+406#[derive(Clone, Debug, PartialEq, Eq)]
+407pub struct SigmaSet(IndexSet<ConstructorKind>);
+408
+409impl SigmaSet {
+410    pub fn from_rows<'a>(rows: impl Iterator<Item = &'a PatternRowVec>, column: usize) -> Self {
+411        let mut ctor_set = IndexSet::new();
+412        for row in rows {
+413            for ctor in row.collect_column_ctors(column) {
+414                ctor_set.insert(ctor);
+415            }
+416        }
+417        Self(ctor_set)
+418    }
+419
+420    pub fn complete_sigma(db: &dyn AnalyzerDb, ty: TypeId) -> Self {
+421        let inner = match ty.typ(db) {
+422            Type::Enum(id) => id
+423                .variants(db)
+424                .values()
+425                .map(|id| ConstructorKind::Enum(*id))
+426                .collect(),
+427
+428            Type::Tuple(_) => [ConstructorKind::Tuple(ty)].into_iter().collect(),
+429
+430            Type::Base(Base::Bool) => [
+431                ConstructorKind::Literal((LiteralPattern::Bool(true), ty)),
+432                ConstructorKind::Literal((LiteralPattern::Bool(false), ty)),
+433            ]
+434            .into_iter()
+435            .collect(),
+436
+437            _ => {
+438                unimplemented!()
+439            }
+440        };
+441
+442        Self(inner)
+443    }
+444
+445    pub fn is_complete(&self, db: &dyn AnalyzerDb) -> bool {
+446        match self.0.first() {
+447            Some(ctor) => {
+448                let expected = ctor_variant_num(db, *ctor);
+449                debug_assert!(self.len() <= expected);
+450                self.len() == expected
+451            }
+452            None => false,
+453        }
+454    }
+455
+456    pub fn len(&self) -> usize {
+457        self.0.len()
+458    }
+459
+460    pub fn is_empty(&self) -> bool {
+461        self.0.is_empty()
+462    }
+463
+464    pub fn iter(&self) -> impl Iterator<Item = &ConstructorKind> {
+465        self.0.iter()
+466    }
+467
+468    pub fn difference(&self, other: &Self) -> Self {
+469        Self(self.0.difference(&other.0).cloned().collect())
+470    }
+471}
+472
+473impl IntoIterator for SigmaSet {
+474    type Item = ConstructorKind;
+475    type IntoIter = <IndexSet<ConstructorKind> as IntoIterator>::IntoIter;
+476
+477    fn into_iter(self) -> Self::IntoIter {
+478        self.0.into_iter()
+479    }
+480}
+481
+482#[derive(Clone, Debug, PartialEq, Eq)]
+483pub struct PatternRowVec {
+484    pub inner: Vec<SimplifiedPattern>,
+485}
+486
+487impl PatternRowVec {
+488    pub fn new(inner: Vec<SimplifiedPattern>) -> Self {
+489        Self { inner }
+490    }
+491
+492    pub fn len(&self) -> usize {
+493        self.inner.len()
+494    }
+495
+496    pub fn is_empty(&self) -> bool {
+497        self.inner.is_empty()
+498    }
+499
+500    pub fn pats(&self) -> &[SimplifiedPattern] {
+501        &self.inner
+502    }
+503
+504    pub fn head(&self) -> Option<&SimplifiedPattern> {
+505        self.inner.first()
+506    }
+507
+508    pub fn phi_specialize(&self, db: &dyn AnalyzerDb, ctor: ConstructorKind) -> Vec<Self> {
+509        debug_assert!(!self.inner.is_empty());
+510
+511        let first_pat = &self.inner[0];
+512        let ctor_fields = ctor.field_types(db);
+513        match &first_pat.kind {
+514            SimplifiedPatternKind::WildCard(bind) => {
+515                let mut inner = Vec::with_capacity(self.inner.len() + ctor_fields.len() - 1);
+516                for field_ty in ctor_fields {
+517                    inner.push(SimplifiedPattern::wildcard(bind.clone(), field_ty));
+518                }
+519                inner.extend_from_slice(&self.inner[1..]);
+520                vec![Self::new(inner)]
+521            }
+522
+523            SimplifiedPatternKind::Constructor { kind, fields } => {
+524                if *kind == ctor {
+525                    let mut inner = Vec::with_capacity(self.inner.len() + ctor_fields.len() - 1);
+526                    inner.extend_from_slice(fields);
+527                    inner.extend_from_slice(&self.inner[1..]);
+528                    vec![Self::new(inner)]
+529                } else {
+530                    vec![]
+531                }
+532            }
+533
+534            SimplifiedPatternKind::Or(pats) => {
+535                let mut result = vec![];
+536                for pat in pats {
+537                    let mut tmp_inner = Vec::with_capacity(self.inner.len());
+538                    tmp_inner.push(pat.clone());
+539                    tmp_inner.extend_from_slice(&self.inner[1..]);
+540                    let tmp = PatternRowVec::new(tmp_inner);
+541                    for v in tmp.phi_specialize(db, ctor) {
+542                        result.push(v);
+543                    }
+544                }
+545                result
+546            }
+547        }
+548    }
+549
+550    pub fn swap(&mut self, a: usize, b: usize) {
+551        self.inner.swap(a, b);
+552    }
+553
+554    pub fn d_specialize(&self, _db: &dyn AnalyzerDb) -> Vec<Self> {
+555        debug_assert!(!self.inner.is_empty());
+556
+557        let first_pat = &self.inner[0];
+558        match &first_pat.kind {
+559            SimplifiedPatternKind::WildCard(_) => {
+560                let inner = self.inner[1..].to_vec();
+561                vec![Self::new(inner)]
+562            }
+563
+564            SimplifiedPatternKind::Constructor { .. } => {
+565                vec![]
+566            }
+567
+568            SimplifiedPatternKind::Or(pats) => {
+569                let mut result = vec![];
+570                for pat in pats {
+571                    let mut tmp_inner = Vec::with_capacity(self.inner.len());
+572                    tmp_inner.push(pat.clone());
+573                    tmp_inner.extend_from_slice(&self.inner[1..]);
+574                    let tmp = PatternRowVec::new(tmp_inner);
+575                    for v in tmp.d_specialize(_db) {
+576                        result.push(v);
+577                    }
+578                }
+579                result
+580            }
+581        }
+582    }
+583
+584    pub fn collect_column_ctors(&self, column: usize) -> Vec<ConstructorKind> {
+585        debug_assert!(!self.inner.is_empty());
+586
+587        let first_pat = &self.inner[column];
+588        first_pat.kind.collect_ctors()
+589    }
+590
+591    fn first_column_ty(&self) -> TypeId {
+592        debug_assert!(!self.inner.is_empty());
+593
+594        self.inner[0].ty
+595    }
+596}
+597
+598fn ctor_variant_num(db: &dyn AnalyzerDb, ctor: ConstructorKind) -> usize {
+599    match ctor {
+600        ConstructorKind::Enum(variant) => {
+601            let enum_id = variant.parent(db);
+602            enum_id.variants(db).len()
+603        }
+604        ConstructorKind::Tuple(_) | ConstructorKind::Struct(_) => 1,
+605        ConstructorKind::Literal((LiteralPattern::Bool(_), _)) => 2,
+606    }
+607}
+608
+609fn simplify_pattern(
+610    scope: &BlockScope,
+611    pat: &Pattern,
+612    ty: TypeId,
+613    arm_idx: usize,
+614) -> SimplifiedPattern {
+615    let kind = match pat {
+616        Pattern::WildCard => SimplifiedPatternKind::WildCard(None),
+617
+618        Pattern::Rest => {
+619            // Rest is only allowed in the tuple pattern.
+620            unreachable!()
+621        }
+622
+623        Pattern::Literal(lit) => {
+624            let ctor_kind = ConstructorKind::Literal((lit.kind, ty));
+625            SimplifiedPatternKind::Constructor {
+626                kind: ctor_kind,
+627                fields: vec![],
+628            }
+629        }
+630
+631        Pattern::Tuple(elts) => {
+632            let ctor_kind = ConstructorKind::Tuple(ty);
+633            let elts_tys = ty.tuple_elts(scope.db());
+634
+635            SimplifiedPatternKind::Constructor {
+636                kind: ctor_kind,
+637                fields: simplify_tuple_pattern(scope, elts, &elts_tys, arm_idx),
+638            }
+639        }
+640
+641        Pattern::Path(path) => match scope.resolve_visible_path(&path.kind) {
+642            Some(NamedThing::EnumVariant(variant)) => SimplifiedPatternKind::Constructor {
+643                kind: ConstructorKind::Enum(variant),
+644                fields: vec![],
+645            },
+646            _ => {
+647                debug_assert!(path.kind.segments.len() == 1);
+648                SimplifiedPatternKind::WildCard(Some((path.kind.segments[0].kind.clone(), arm_idx)))
+649            }
+650        },
+651
+652        Pattern::PathTuple(path, elts) => {
+653            let variant = match scope.resolve_visible_path(&path.kind).unwrap() {
+654                NamedThing::EnumVariant(variant) => variant,
+655                _ => unreachable!(),
+656            };
+657            let ctor_kind = ConstructorKind::Enum(variant);
+658            let elts_tys = ctor_kind.field_types(scope.db());
+659
+660            SimplifiedPatternKind::Constructor {
+661                kind: ctor_kind,
+662                fields: simplify_tuple_pattern(scope, elts, &elts_tys, arm_idx),
+663            }
+664        }
+665
+666        Pattern::PathStruct {
+667            path,
+668            fields: pat_fields,
+669            ..
+670        } => {
+671            let (sid, ctor_kind) = match scope.resolve_visible_path(&path.kind).unwrap() {
+672                NamedThing::Item(Item::Type(TypeDef::Struct(sid))) => {
+673                    (sid, ConstructorKind::Struct(sid))
+674                }
+675                // Implement this when struct variant is supported.
+676                NamedThing::EnumVariant(_) => todo!(),
+677                _ => unreachable!(),
+678            };
+679
+680            // Canonicalize the fields order so that the order is the same as the
+681            // struct fields.
+682            let pat_fields: IndexMap<_, _> = pat_fields
+683                .iter()
+684                .map(|field_pat| (field_pat.0.kind.clone(), field_pat.1.clone()))
+685                .collect();
+686            let fields_def = sid.fields(scope.db());
+687            let mut canonicalized_fields = Vec::with_capacity(fields_def.len());
+688            for (field_name, fid) in fields_def.iter() {
+689                let field_ty = fid.typ(scope.db()).unwrap();
+690                if let Some(pat) = pat_fields.get(field_name) {
+691                    let pat = simplify_pattern(scope, &pat.kind, field_ty, arm_idx);
+692                    canonicalized_fields.push(pat);
+693                } else {
+694                    canonicalized_fields.push(SimplifiedPattern::wildcard(None, field_ty));
+695                }
+696            }
+697
+698            SimplifiedPatternKind::Constructor {
+699                kind: ctor_kind,
+700                fields: canonicalized_fields,
+701            }
+702        }
+703
+704        Pattern::Or(pats) => SimplifiedPatternKind::Or(
+705            pats.iter()
+706                .map(|pat| simplify_pattern(scope, &pat.kind, ty, arm_idx))
+707                .collect(),
+708        ),
+709    };
+710
+711    SimplifiedPattern::new(kind, ty)
+712}
+713
+714fn simplify_tuple_pattern(
+715    scope: &BlockScope,
+716    elts: &[Node<Pattern>],
+717    elts_tys: &[TypeId],
+718    arm_idx: usize,
+719) -> Vec<SimplifiedPattern> {
+720    let mut simplified_elts = vec![];
+721    let mut tys_iter = elts_tys.iter();
+722
+723    for pat in elts {
+724        if pat.kind.is_rest() {
+725            for _ in 0..(elts_tys.len() - (elts.len() - 1)) {
+726                let ty = tys_iter.next().unwrap();
+727                simplified_elts.push(SimplifiedPattern::new(
+728                    SimplifiedPatternKind::WildCard(None),
+729                    *ty,
+730                ));
+731            }
+732        } else {
+733            simplified_elts.push(simplify_pattern(
+734                scope,
+735                &pat.kind,
+736                *tys_iter.next().unwrap(),
+737                arm_idx,
+738            ));
+739        }
+740    }
+741
+742    debug_assert!(tys_iter.next().is_none());
+743    simplified_elts
+744}
+745
+746impl TypeId {
+747    fn tuple_elts(self, db: &dyn AnalyzerDb) -> Vec<TypeId> {
+748        match self.typ(db) {
+749            Type::Tuple(tup) => tup.items.to_vec(),
+750            _ => unreachable!(),
+751        }
+752    }
+753}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/pragma.rs.html b/compiler-docs/src/fe_analyzer/traversal/pragma.rs.html new file mode 100644 index 0000000000..989a7fd3c5 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/pragma.rs.html @@ -0,0 +1,31 @@ +pragma.rs - source

fe_analyzer/traversal/
pragma.rs

1use crate::errors;
+2use fe_common::diagnostics::{Diagnostic, Label};
+3use fe_parser::ast;
+4use fe_parser::node::Node;
+5use semver::{Version, VersionReq};
+6
+7pub fn check_pragma_version(stmt: &Node<ast::Pragma>) -> Option<Diagnostic> {
+8    let version_requirement = &stmt.kind.version_requirement;
+9    // This can't fail because the parser already validated it
+10    let requirement =
+11        VersionReq::parse(&version_requirement.kind).expect("Invalid version requirement");
+12    let actual_version =
+13        Version::parse(env!("CARGO_PKG_VERSION")).expect("Missing package version");
+14
+15    if requirement.matches(&actual_version) {
+16        None
+17    } else {
+18        Some(errors::fancy_error(
+19            format!(
+20                "The current compiler version {actual_version} doesn't match the specified requirement"
+21            ),
+22            vec![Label::primary(
+23                version_requirement.span,
+24                "The specified version requirement",
+25            )],
+26            vec![format!(
+27                "Note: Use `pragma {actual_version}` to make the code compile"
+28            )],
+29        ))
+30    }
+31}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/types.rs.html b/compiler-docs/src/fe_analyzer/traversal/types.rs.html new file mode 100644 index 0000000000..dd9d147804 --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/types.rs.html @@ -0,0 +1,654 @@ +types.rs - source

fe_analyzer/traversal/
types.rs

1use crate::builtins::ValueMethod;
+2use crate::context::{
+3    Adjustment, AdjustmentKind, AnalyzerContext, CallType, Constant, ExpressionAttributes,
+4    NamedThing,
+5};
+6use crate::display::Displayable;
+7use crate::errors::{TypeCoercionError, TypeError};
+8use crate::namespace::items::{Item, TraitId};
+9use crate::namespace::types::{
+10    Base, FeString, GenericArg, GenericParamKind, GenericType, Integer, TraitOrType, Tuple, Type,
+11    TypeId,
+12};
+13use crate::traversal::call_args::validate_arg_count;
+14use fe_common::diagnostics::Label;
+15use fe_common::utils::humanize::pluralize_conditionally;
+16use fe_common::Spanned;
+17use fe_parser::ast;
+18use fe_parser::node::{Node, Span};
+19use std::cmp::Ordering;
+20
+21/// Try to perform an explicit type cast, eg `u256(my_address)` or `address(my_contract)`.
+22/// Returns nothing. Emits an error if the cast fails; explicit cast failures are not fatal.
+23pub fn try_cast_type(
+24    context: &mut dyn AnalyzerContext,
+25    from: TypeId,
+26    from_expr: &Node<ast::Expr>,
+27    into: TypeId,
+28    into_span: Span,
+29) {
+30    if into == from {
+31        return;
+32    }
+33    match (from.typ(context.db()), into.typ(context.db())) {
+34        (Type::SPtr(inner), _) => {
+35            adjust_type(context, from_expr, inner, AdjustmentKind::Load);
+36            try_cast_type(context, inner, from_expr, into, into_span)
+37        }
+38
+39        (Type::Mut(inner), _) => try_cast_type(context, inner, from_expr, into, into_span),
+40        (Type::SelfType(TraitOrType::TypeId(inner)), _) => {
+41            try_cast_type(context, inner, from_expr, into, into_span)
+42        }
+43
+44        (Type::String(from_str), Type::String(into_str)) => {
+45            if from_str.max_size > into_str.max_size {
+46                context.error(
+47                    "string capacity exceeded",
+48                    from_expr.span,
+49                    &format!(
+50                        "this string has length {}; expected length <= {}",
+51                        from_str.max_size, into_str.max_size
+52                    ),
+53                );
+54            } else {
+55                adjust_type(context, from_expr, into, AdjustmentKind::StringSizeIncrease);
+56            }
+57        }
+58
+59        (Type::Base(Base::Address), Type::Contract(_)) => {}
+60        (Type::Contract(_), Type::Base(Base::Address)) => {}
+61
+62        (Type::Base(Base::Numeric(from_int)), Type::Base(Base::Numeric(into_int))) => {
+63            let sign_differs = from_int.is_signed() != into_int.is_signed();
+64            let size_differs = from_int.size() != into_int.size();
+65
+66            if sign_differs && size_differs {
+67                context.error(
+68                        "Casting between numeric values can change the sign or size but not both at once",
+69                        from_expr.span,
+70                        &format!("can not cast from `{}` to `{}` in a single step",
+71                                 from.display(context.db()),
+72                                 into.display(context.db())));
+73            }
+74        }
+75        (Type::Base(Base::Numeric(_)), Type::Base(Base::Address)) => {}
+76        (Type::Base(Base::Address), Type::Base(Base::Numeric(into))) => {
+77            if into != Integer::U256 {
+78                context.error(
+79                    &format!("can't cast `address` to `{into}`"),
+80                    into_span,
+81                    "try `u256` here",
+82                );
+83            }
+84        }
+85        (Type::SelfContract(_), Type::Base(Base::Address)) => {
+86            context.error(
+87                "`self` address must be retrieved via `Context` object",
+88                into_span + from_expr.span,
+89                "use `ctx.self_address()` here",
+90            );
+91        }
+92
+93        (_, Type::Base(Base::Unit)) => unreachable!(), // rejected in expr_call_type
+94        (_, Type::Base(Base::Bool)) => unreachable!(), // handled in expr_call_type_constructor
+95        (_, Type::Tuple(_)) => unreachable!(),         // rejected in expr_call_type
+96        (_, Type::Struct(_)) => unreachable!(),        // handled in expr_call_type_constructor
+97        (_, Type::Map(_)) => unreachable!(),           // handled in expr_call_type_constructor
+98        (_, Type::Array(_)) => unreachable!(),         // handled in expr_call_type_constructor
+99        (_, Type::Generic(_)) => unreachable!(),       // handled in expr_call_type_constructor
+100        (_, Type::SelfContract(_)) => unreachable!(),  // contract names become Contract
+101
+102        _ => {
+103            context.error(
+104                &format!(
+105                    "incorrect type for argument to `{}`",
+106                    into.display(context.db())
+107                ),
+108                from_expr.span,
+109                &format!(
+110                    "cannot cast type `{}` to type `{}`",
+111                    from.display(context.db()),
+112                    into.display(context.db()),
+113                ),
+114            );
+115        }
+116    };
+117}
+118
+119pub fn deref_type(context: &mut dyn AnalyzerContext, expr: &Node<ast::Expr>, ty: TypeId) -> TypeId {
+120    match ty.typ(context.db()) {
+121        Type::SPtr(inner) => adjust_type(context, expr, inner, AdjustmentKind::Load),
+122        Type::Mut(inner) => deref_type(context, expr, inner),
+123        Type::SelfType(TraitOrType::TypeId(inner)) => deref_type(context, expr, inner),
+124        _ => ty,
+125    }
+126}
+127
+128pub fn adjust_type(
+129    context: &mut dyn AnalyzerContext,
+130    expr: &Node<ast::Expr>,
+131    into: TypeId,
+132    kind: AdjustmentKind,
+133) -> TypeId {
+134    context.update_expression(expr, &|attr: &mut ExpressionAttributes| {
+135        attr.type_adjustments.push(Adjustment { into, kind });
+136    });
+137    into
+138}
+139
+140pub fn try_coerce_type(
+141    context: &mut dyn AnalyzerContext,
+142    from_expr: Option<&Node<ast::Expr>>,
+143    from: TypeId,
+144    into: TypeId,
+145    should_copy: bool,
+146) -> Result<TypeId, TypeCoercionError> {
+147    let chain = coerce(context, from_expr, from, into, should_copy, vec![])?;
+148    if let Some(expr) = from_expr {
+149        context.update_expression(expr, &|attr: &mut ExpressionAttributes| {
+150            attr.type_adjustments.extend(chain.iter())
+151        });
+152    }
+153    Ok(into)
+154}
+155
+156fn coerce(
+157    context: &mut dyn AnalyzerContext,
+158    from_expr: Option<&Node<ast::Expr>>,
+159    from: TypeId,
+160    into: TypeId,
+161    should_copy: bool,
+162    chain: Vec<Adjustment>,
+163) -> Result<Vec<Adjustment>, TypeCoercionError> {
+164    // Cut down on some obviously unnecessary copy operations,
+165    // because we don't currently optimize MIR.
+166    let should_copy = should_copy
+167        && !into.is_sptr(context.db())
+168        && !into.deref(context.db()).is_primitive(context.db())
+169        && !from_expr.map(|e| is_temporary(context, e)).unwrap_or(false);
+170
+171    if from == into {
+172        let chain = add_adjustment_if(
+173            should_copy,
+174            chain,
+175            from.deref(context.db()),
+176            AdjustmentKind::Copy,
+177        );
+178        return Ok(chain);
+179    }
+180
+181    match (from.typ(context.db()), into.typ(context.db())) {
+182        (Type::SPtr(from), Type::SPtr(into)) => {
+183            coerce(context, from_expr, from, into, false, chain)
+184        }
+185        // Strip off any `mut`s.
+186        // Fn call `mut` is checked in `fn validate_arg_type`.
+187        (Type::Mut(from), Type::Mut(into)) => {
+188            let chain = add_adjustment_if(should_copy, chain, into, AdjustmentKind::Copy);
+189            coerce(context, from_expr, from, into, false, chain)
+190        }
+191        (Type::Mut(from), _) => {
+192            let chain = add_adjustment_if(should_copy, chain, from, AdjustmentKind::Copy);
+193            coerce(context, from_expr, from, into, false, chain)
+194        }
+195        (_, Type::Mut(into)) => {
+196            let chain = add_adjustment_if(should_copy, chain, from, AdjustmentKind::Copy);
+197            coerce(context, from_expr, from, into, false, chain)
+198        }
+199        (Type::SelfType(TraitOrType::TypeId(from)), _) => {
+200            let chain = add_adjustment_if(should_copy, chain, from, AdjustmentKind::Copy);
+201            coerce(context, from_expr, from, into, false, chain)
+202        }
+203        (_, Type::SelfType(TraitOrType::TypeId(into))) => {
+204            let chain = add_adjustment_if(should_copy, chain, from, AdjustmentKind::Copy);
+205            coerce(context, from_expr, from, into, false, chain)
+206        }
+207
+208        // Primitive types can be moved from storage implicitly.
+209        // Contract type is also a primitive.
+210        (Type::SPtr(from_inner), Type::Base(_) | Type::Contract(_)) => coerce(
+211            context,
+212            from_expr,
+213            from_inner,
+214            into,
+215            false,
+216            add_adjustment(chain, from_inner, AdjustmentKind::Load),
+217        ),
+218
+219        // complex types require .to_mem()
+220        (Type::SPtr(from), _) => {
+221            // If the inner types are incompatible, report that error instead
+222            try_coerce_type(context, from_expr, from, into, false)?;
+223            Err(TypeCoercionError::RequiresToMem)
+224        }
+225
+226        // All types can be moved into storage implicitly.
+227        // Note that no `Adjustment` is added here.
+228        (_, Type::SPtr(into)) => coerce(context, from_expr, from, into, false, chain),
+229
+230        (
+231            Type::String(FeString { max_size: from_sz }),
+232            Type::String(FeString { max_size: into_sz }),
+233        ) => match into_sz.cmp(&from_sz) {
+234            Ordering::Equal => Ok(chain),
+235            Ordering::Greater => Ok(add_adjustment(
+236                chain,
+237                into,
+238                AdjustmentKind::StringSizeIncrease,
+239            )),
+240            Ordering::Less => Err(TypeCoercionError::Incompatible),
+241        },
+242        (Type::SelfContract(from), Type::Contract(into)) => {
+243            if from == into {
+244                Err(TypeCoercionError::SelfContractType)
+245            } else {
+246                Err(TypeCoercionError::Incompatible)
+247            }
+248        }
+249
+250        (Type::Tuple(ftup), Type::Tuple(itup)) => {
+251            // If the rhs is a tuple expr, each element gets its own coercion chain.
+252            // Else, we don't allow coercion (for now, at least).
+253            if let Some(Node {
+254                kind: ast::Expr::Tuple { elts },
+255                ..
+256            }) = &from_expr
+257            {
+258                if ftup.items.len() == itup.items.len()
+259                    && elts
+260                        .iter()
+261                        .zip(ftup.items.iter().zip(itup.items.iter()))
+262                        .map(|(elt, (from, into))| {
+263                            try_coerce_type(context, Some(elt), *from, *into, should_copy).is_ok()
+264                        })
+265                        .all(|x| x)
+266                {
+267                    // Update the type of the rhs tuple, because its elements
+268                    // have been coerced into the lhs element types.
+269                    context.update_expression(from_expr.unwrap(), &|attr| attr.typ = into);
+270                    return Ok(chain);
+271                }
+272            }
+273            Err(TypeCoercionError::Incompatible)
+274        }
+275
+276        (Type::Base(Base::Numeric(f)), Type::Base(Base::Numeric(i))) => {
+277            if f.is_signed() == i.is_signed() && i.size() > f.size() {
+278                Ok(add_adjustment(chain, into, AdjustmentKind::IntSizeIncrease))
+279            } else {
+280                Err(TypeCoercionError::Incompatible)
+281            }
+282        }
+283        (_, _) => Err(TypeCoercionError::Incompatible),
+284    }
+285}
+286
+287#[must_use]
+288fn add_adjustment(
+289    mut chain: Vec<Adjustment>,
+290    into: TypeId,
+291    kind: AdjustmentKind,
+292) -> Vec<Adjustment> {
+293    chain.push(Adjustment { into, kind });
+294    chain
+295}
+296
+297#[must_use]
+298fn add_adjustment_if(
+299    test: bool,
+300    mut chain: Vec<Adjustment>,
+301    into: TypeId,
+302    kind: AdjustmentKind,
+303) -> Vec<Adjustment> {
+304    if test {
+305        chain.push(Adjustment { into, kind });
+306    }
+307    chain
+308}
+309
+310fn is_temporary(context: &dyn AnalyzerContext, expr: &Node<ast::Expr>) -> bool {
+311    match &expr.kind {
+312        ast::Expr::Tuple { .. } | ast::Expr::List { .. } | ast::Expr::Repeat { .. } => true,
+313        ast::Expr::Path(path) => {
+314            matches!(
+315                context.resolve_path(path, expr.span),
+316                Ok(NamedThing::EnumVariant(_))
+317            )
+318        }
+319        ast::Expr::Call { func, .. } => matches!(
+320            context.get_call(func),
+321            Some(CallType::TypeConstructor(_))
+322                | Some(CallType::EnumConstructor(_))
+323                | Some(CallType::BuiltinValueMethod {
+324                    method: ValueMethod::ToMem | ValueMethod::AbiEncode,
+325                    ..
+326                })
+327        ),
+328        _ => false,
+329    }
+330}
+331
+332pub fn apply_generic_type_args(
+333    context: &mut dyn AnalyzerContext,
+334    generic: GenericType,
+335    name_span: Span,
+336    args: Option<&Node<Vec<ast::GenericArg>>>,
+337) -> Result<TypeId, TypeError> {
+338    let params = generic.params();
+339
+340    let args = args.ok_or_else(|| {
+341        TypeError::new(context.fancy_error(
+342            &format!(
+343                "missing generic {} for type `{}`",
+344                pluralize_conditionally("argument", params.len()),
+345                generic.name()
+346            ),
+347            vec![Label::primary(
+348                name_span,
+349                format!(
+350                    "expected {} generic {}",
+351                    params.len(),
+352                    pluralize_conditionally("argument", params.len())
+353                ),
+354            )],
+355            vec![friendly_generic_arg_example_string(generic)],
+356        ))
+357    })?;
+358
+359    if let Some(diag) = validate_arg_count(
+360        context,
+361        &generic.name(),
+362        name_span,
+363        args,
+364        params.len(),
+365        "generic argument",
+366    ) {
+367        return Err(TypeError::new(diag));
+368    }
+369
+370    let concrete_args = params
+371        .iter()
+372        .zip(args.kind.iter())
+373        .map(|(param, arg)| match (param.kind, arg) {
+374            (GenericParamKind::Int, ast::GenericArg::Int(int_node)) => {
+375                Ok(GenericArg::Int(int_node.kind))
+376            }
+377
+378            (GenericParamKind::Int, ast::GenericArg::TypeDesc(_)) => {
+379                Err(TypeError::new(context.fancy_error(
+380                    &format!("`{}` {} must be an integer", generic.name(), param.name),
+381                    vec![Label::primary(arg.span(), "expected an integer")],
+382                    vec![],
+383                )))
+384            }
+385
+386            (GenericParamKind::Int, ast::GenericArg::ConstExpr(expr)) => {
+387                // Performs semantic analysis on `expr`.
+388                super::expressions::expr(context, expr, None)?;
+389
+390                // Evaluates expression.
+391                let const_value = super::const_expr::eval_expr(context, expr)?;
+392
+393                // TODO: Fix me when `GenericArg` can represent literals not only `Int`.
+394                match const_value {
+395                    Constant::Int(val) => Ok(GenericArg::Int(val.try_into().unwrap())),
+396                    Constant::Address(_) | Constant::Bool(_) | Constant::Str(_) => {
+397                        Err(TypeError::new(context.not_yet_implemented(
+398                            "non numeric type const generics",
+399                            expr.span,
+400                        )))
+401                    }
+402                }
+403            }
+404
+405            (GenericParamKind::PrimitiveType, ast::GenericArg::TypeDesc(type_node)) => {
+406                let typ = type_desc(context, type_node, None)?;
+407                if typ.is_primitive(context.db()) {
+408                    Ok(GenericArg::Type(typ))
+409                } else {
+410                    Err(TypeError::new(context.error(
+411                        &format!(
+412                            "`{}` {} must be a primitive type",
+413                            generic.name(),
+414                            param.name
+415                        ),
+416                        type_node.span,
+417                        &format!(
+418                            "this has type `{}`; expected a primitive type",
+419                            typ.display(context.db())
+420                        ),
+421                    )))
+422                }
+423            }
+424
+425            (GenericParamKind::AnyType, ast::GenericArg::TypeDesc(type_node)) => {
+426                Ok(GenericArg::Type(type_desc(context, type_node, None)?))
+427            }
+428
+429            (
+430                GenericParamKind::PrimitiveType | GenericParamKind::AnyType,
+431                ast::GenericArg::Int(_) | ast::GenericArg::ConstExpr(_),
+432            ) => Err(TypeError::new(context.fancy_error(
+433                &format!("`{}` {} must be a type", generic.name(), param.name),
+434                vec![Label::primary(arg.span(), "expected a type name")],
+435                vec![],
+436            ))),
+437        })
+438        .collect::<Result<Vec<_>, _>>()?;
+439    Ok(generic
+440        .apply(context.db(), &concrete_args)
+441        .expect("failed to construct generic type after checking args"))
+442}
+443
+444fn friendly_generic_arg_example_string(generic: GenericType) -> String {
+445    let example_args = generic
+446        .params()
+447        .iter()
+448        .map(|param| match param.kind {
+449            GenericParamKind::Int => "32",
+450            GenericParamKind::PrimitiveType => "u64",
+451            GenericParamKind::AnyType => "String<32>",
+452        })
+453        .collect::<Vec<&'static str>>();
+454
+455    format!("Example: `{}<{}>`", generic.name(), example_args.join(", "))
+456}
+457
+458pub fn resolve_concrete_type_name<T: std::fmt::Display>(
+459    context: &mut dyn AnalyzerContext,
+460    name: &str,
+461    base_desc: &Node<T>,
+462    generic_args: Option<&Node<Vec<ast::GenericArg>>>,
+463) -> Result<TypeId, TypeError> {
+464    let named_thing = context.resolve_name(name, base_desc.span)?;
+465    resolve_concrete_type_named_thing(context, named_thing, base_desc, generic_args)
+466}
+467
+468pub fn resolve_concrete_type_path<T: std::fmt::Display>(
+469    context: &mut dyn AnalyzerContext,
+470    path: &ast::Path,
+471    base_desc: &Node<T>,
+472    generic_args: Option<&Node<Vec<ast::GenericArg>>>,
+473) -> Result<TypeId, TypeError> {
+474    let named_thing = context.resolve_path(path, base_desc.span)?;
+475    resolve_concrete_type_named_thing(context, Some(named_thing), base_desc, generic_args)
+476}
+477
+478pub fn resolve_concrete_type_named_thing<T: std::fmt::Display>(
+479    context: &mut dyn AnalyzerContext,
+480    named_thing: Option<NamedThing>,
+481    base_desc: &Node<T>,
+482    generic_args: Option<&Node<Vec<ast::GenericArg>>>,
+483) -> Result<TypeId, TypeError> {
+484    match named_thing {
+485        Some(NamedThing::Item(Item::Type(id))) => {
+486            if let Some(args) = generic_args {
+487                context.fancy_error(
+488                    &format!("`{}` type is not generic", base_desc.kind),
+489                    vec![Label::primary(
+490                        args.span,
+491                        "unexpected generic argument list",
+492                    )],
+493                    vec![],
+494                );
+495            }
+496            id.type_id(context.db())
+497        }
+498        Some(NamedThing::Item(Item::GenericType(generic))) => {
+499            apply_generic_type_args(context, generic, base_desc.span, generic_args)
+500        }
+501        Some(named_thing) => Err(TypeError::new(context.fancy_error(
+502            &format!("`{}` is not a type name", base_desc.kind),
+503            if let Some(def_span) = named_thing.name_span(context.db()) {
+504                vec![
+505                    Label::primary(
+506                        def_span,
+507                        format!(
+508                            "`{}` is defined here as a {}",
+509                            base_desc.kind,
+510                            named_thing.item_kind_display_name()
+511                        ),
+512                    ),
+513                    Label::primary(
+514                        base_desc.span,
+515                        format!("`{}` is used here as a type", base_desc.kind),
+516                    ),
+517                ]
+518            } else {
+519                vec![Label::primary(
+520                    base_desc.span,
+521                    format!(
+522                        "`{}` is a {}",
+523                        base_desc.kind,
+524                        named_thing.item_kind_display_name()
+525                    ),
+526                )]
+527            },
+528            vec![],
+529        ))),
+530        None => Err(TypeError::new(context.error(
+531            "undefined type",
+532            base_desc.span,
+533            &format!("`{}` has not been defined", base_desc.kind),
+534        ))),
+535    }
+536}
+537
+538/// Maps a type description node to an enum type.
+539pub fn type_desc(
+540    context: &mut dyn AnalyzerContext,
+541    desc: &Node<ast::TypeDesc>,
+542    self_type: Option<TraitOrType>,
+543) -> Result<TypeId, TypeError> {
+544    match &desc.kind {
+545        ast::TypeDesc::Base { base } => resolve_concrete_type_name(context, base, desc, None),
+546        ast::TypeDesc::Path(path) => resolve_concrete_type_path(context, path, desc, None),
+547        // generic will need to allow for paths too
+548        ast::TypeDesc::Generic { base, args } => {
+549            resolve_concrete_type_name(context, &base.kind, base, Some(args))
+550        }
+551        ast::TypeDesc::Tuple { items } => {
+552            let types = items
+553                .iter()
+554                .map(|typ| match type_desc(context, typ, self_type.clone()) {
+555                    Ok(typ) if typ.has_fixed_size(context.db()) => Ok(typ),
+556                    Err(e) => Err(e),
+557                    _ => Err(TypeError::new(context.error(
+558                        "tuple elements must have fixed size",
+559                        typ.span,
+560                        "this can't be stored in a tuple",
+561                    ))),
+562                })
+563                .collect::<Result<Vec<_>, _>>()?;
+564            Ok(context.db().intern_type(Type::Tuple(Tuple {
+565                items: types.into(),
+566            })))
+567        }
+568        ast::TypeDesc::Unit => Ok(TypeId::unit(context.db())),
+569        ast::TypeDesc::SelfType => {
+570            if let Some(val) = self_type {
+571                Ok(Type::SelfType(val).id(context.db()))
+572            } else {
+573                dbg!("Reporting error");
+574                Err(TypeError::new(context.error(
+575                    "`Self` can not be used here",
+576                    desc.span,
+577                    "",
+578                )))
+579            }
+580        }
+581    }
+582}
+583
+584/// Maps a type description node to a `TraitId`.
+585pub fn type_desc_to_trait(
+586    context: &mut dyn AnalyzerContext,
+587    desc: &Node<ast::TypeDesc>,
+588) -> Result<TraitId, TypeError> {
+589    match &desc.kind {
+590        ast::TypeDesc::Base { base } => {
+591            let named_thing = context.resolve_name(base, desc.span)?;
+592            resolve_concrete_trait_named_thing(context, named_thing, desc)
+593        }
+594        ast::TypeDesc::Path(path) => {
+595            let named_thing = context.resolve_path(path, desc.span)?;
+596            resolve_concrete_trait_named_thing(context, Some(named_thing), desc)
+597        }
+598        // generic will need to allow for paths too
+599        ast::TypeDesc::Generic { base, .. } => {
+600            let named_thing = context.resolve_name(&base.kind, desc.span)?;
+601            resolve_concrete_trait_named_thing(context, named_thing, desc)
+602        }
+603        _ => panic!("Should be rejected by parser"),
+604    }
+605}
+606
+607pub fn resolve_concrete_trait_named_thing<T: std::fmt::Display>(
+608    context: &mut dyn AnalyzerContext,
+609    val: Option<NamedThing>,
+610    base_desc: &Node<T>,
+611) -> Result<TraitId, TypeError> {
+612    match val {
+613        Some(NamedThing::Item(Item::Trait(treit))) => Ok(treit),
+614        Some(NamedThing::Item(Item::Type(ty))) => Err(TypeError::new(context.error(
+615            &format!("expected trait, found type `{}`", ty.name(context.db())),
+616            base_desc.span,
+617            "not a trait",
+618        ))),
+619        Some(named_thing) => Err(TypeError::new(context.fancy_error(
+620            &format!("`{}` is not a trait name", base_desc.kind),
+621            if let Some(def_span) = named_thing.name_span(context.db()) {
+622                vec![
+623                    Label::primary(
+624                        def_span,
+625                        format!(
+626                            "`{}` is defined here as a {}",
+627                            base_desc.kind,
+628                            named_thing.item_kind_display_name()
+629                        ),
+630                    ),
+631                    Label::primary(
+632                        base_desc.span,
+633                        format!("`{}` is used here as a trait", base_desc.kind),
+634                    ),
+635                ]
+636            } else {
+637                vec![Label::primary(
+638                    base_desc.span,
+639                    format!(
+640                        "`{}` is a {}",
+641                        base_desc.kind,
+642                        named_thing.item_kind_display_name()
+643                    ),
+644                )]
+645            },
+646            vec![],
+647        ))),
+648        None => Err(TypeError::new(context.error(
+649            "undefined trait",
+650            base_desc.span,
+651            &format!("`{}` has not been defined", base_desc.kind),
+652        ))),
+653    }
+654}
\ No newline at end of file diff --git a/compiler-docs/src/fe_analyzer/traversal/utils.rs.html b/compiler-docs/src/fe_analyzer/traversal/utils.rs.html new file mode 100644 index 0000000000..dbb8bcd78b --- /dev/null +++ b/compiler-docs/src/fe_analyzer/traversal/utils.rs.html @@ -0,0 +1,61 @@ +utils.rs - source

fe_analyzer/traversal/
utils.rs

1use fe_common::diagnostics::Label;
+2use fe_common::Span;
+3
+4use crate::context::{AnalyzerContext, DiagnosticVoucher};
+5use crate::display::Displayable;
+6use crate::errors::BinaryOperationError;
+7use crate::namespace::types::TypeId;
+8use crate::AnalyzerDb;
+9use std::fmt::Display;
+10
+11fn type_label(db: &dyn AnalyzerDb, span: Span, typ: TypeId) -> Label {
+12    Label::primary(span, format!("this has type `{}`", typ.display(db)))
+13}
+14
+15pub fn add_bin_operations_errors(
+16    context: &dyn AnalyzerContext,
+17    op: &dyn Display,
+18    lspan: Span,
+19    ltype: TypeId,
+20    rspan: Span,
+21    rtype: TypeId,
+22    error: BinaryOperationError,
+23) -> DiagnosticVoucher {
+24    let db = context.db();
+25    let ltype = ltype.deref(db);
+26    let rtype = rtype.deref(db);
+27
+28    match error {
+29        BinaryOperationError::NotEqualAndUnsigned => context.fancy_error(
+30            &format!("`{op}` operand types must be equal and unsigned"),
+31            vec![type_label(db, lspan, ltype), type_label(db, rspan, rtype)],
+32            vec![],
+33        ),
+34        BinaryOperationError::RightIsSigned => context.fancy_error(
+35            &format!("The right hand side of the `{op}` operation must be unsigned"),
+36            vec![Label::primary(
+37                rspan,
+38                format!("this has signed type `{}`", rtype.display(db)),
+39            )],
+40            vec![],
+41        ),
+42        BinaryOperationError::RightTooLarge => context.fancy_error(
+43            &format!("incompatible `{op}` operand types"),
+44            vec![type_label(db, lspan, ltype), type_label(db, rspan, rtype)],
+45            vec![format!(
+46                "The type of the right hand side cannot be larger than the left (`{}`)",
+47                ltype.display(db)
+48            )],
+49        ),
+50        BinaryOperationError::TypesNotCompatible => context.fancy_error(
+51            &format!("`{op}` operand types are not compatible"),
+52            vec![type_label(db, lspan, ltype), type_label(db, rspan, rtype)],
+53            vec![],
+54        ),
+55        BinaryOperationError::TypesNotNumeric => context.fancy_error(
+56            &format!("`{op}` operands must be numeric"),
+57            vec![type_label(db, lspan, ltype), type_label(db, rspan, rtype)],
+58            vec![],
+59        ),
+60    }
+61}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/db.rs.html b/compiler-docs/src/fe_codegen/db.rs.html new file mode 100644 index 0000000000..5c047a48f0 --- /dev/null +++ b/compiler-docs/src/fe_codegen/db.rs.html @@ -0,0 +1,100 @@ +db.rs - source

fe_codegen/
db.rs

1#![allow(clippy::arc_with_non_send_sync)]
+2use std::rc::Rc;
+3
+4use fe_abi::{contract::AbiContract, event::AbiEvent, function::AbiFunction, types::AbiType};
+5use fe_analyzer::{
+6    db::AnalyzerDbStorage,
+7    namespace::items::{ContractId, ModuleId},
+8    AnalyzerDb,
+9};
+10use fe_common::db::{SourceDb, SourceDbStorage, Upcast, UpcastMut};
+11use fe_mir::{
+12    db::{MirDb, MirDbStorage},
+13    ir::{FunctionBody, FunctionId, FunctionSignature, TypeId},
+14};
+15
+16mod queries;
+17
+18#[salsa::query_group(CodegenDbStorage)]
+19pub trait CodegenDb: MirDb + Upcast<dyn MirDb> + UpcastMut<dyn MirDb> {
+20    #[salsa::invoke(queries::function::legalized_signature)]
+21    fn codegen_legalized_signature(&self, function_id: FunctionId) -> Rc<FunctionSignature>;
+22    #[salsa::invoke(queries::function::legalized_body)]
+23    fn codegen_legalized_body(&self, function_id: FunctionId) -> Rc<FunctionBody>;
+24    #[salsa::invoke(queries::function::symbol_name)]
+25    fn codegen_function_symbol_name(&self, function_id: FunctionId) -> Rc<String>;
+26
+27    #[salsa::invoke(queries::types::legalized_type)]
+28    fn codegen_legalized_type(&self, ty: TypeId) -> TypeId;
+29
+30    #[salsa::invoke(queries::abi::abi_type)]
+31    fn codegen_abi_type(&self, ty: TypeId) -> AbiType;
+32    #[salsa::invoke(queries::abi::abi_function)]
+33    fn codegen_abi_function(&self, function_id: FunctionId) -> AbiFunction;
+34    #[salsa::invoke(queries::abi::abi_event)]
+35    fn codegen_abi_event(&self, ty: TypeId) -> AbiEvent;
+36    #[salsa::invoke(queries::abi::abi_contract)]
+37    fn codegen_abi_contract(&self, contract: ContractId) -> AbiContract;
+38    #[salsa::invoke(queries::abi::abi_module_events)]
+39    fn codegen_abi_module_events(&self, module: ModuleId) -> Vec<AbiEvent>;
+40    #[salsa::invoke(queries::abi::abi_type_maximum_size)]
+41    fn codegen_abi_type_maximum_size(&self, ty: TypeId) -> usize;
+42    #[salsa::invoke(queries::abi::abi_type_minimum_size)]
+43    fn codegen_abi_type_minimum_size(&self, ty: TypeId) -> usize;
+44    #[salsa::invoke(queries::abi::abi_function_argument_maximum_size)]
+45    fn codegen_abi_function_argument_maximum_size(&self, contract: FunctionId) -> usize;
+46    #[salsa::invoke(queries::abi::abi_function_return_maximum_size)]
+47    fn codegen_abi_function_return_maximum_size(&self, function: FunctionId) -> usize;
+48
+49    #[salsa::invoke(queries::contract::symbol_name)]
+50    fn codegen_contract_symbol_name(&self, contract: ContractId) -> Rc<String>;
+51    #[salsa::invoke(queries::contract::deployer_symbol_name)]
+52    fn codegen_contract_deployer_symbol_name(&self, contract: ContractId) -> Rc<String>;
+53
+54    #[salsa::invoke(queries::constant::string_symbol_name)]
+55    fn codegen_constant_string_symbol_name(&self, data: String) -> Rc<String>;
+56}
+57
+58// TODO: Move this to driver.
+59#[salsa::database(SourceDbStorage, AnalyzerDbStorage, MirDbStorage, CodegenDbStorage)]
+60#[derive(Default)]
+61pub struct Db {
+62    storage: salsa::Storage<Db>,
+63}
+64impl salsa::Database for Db {}
+65
+66impl Upcast<dyn MirDb> for Db {
+67    fn upcast(&self) -> &(dyn MirDb + 'static) {
+68        self
+69    }
+70}
+71
+72impl UpcastMut<dyn MirDb> for Db {
+73    fn upcast_mut(&mut self) -> &mut (dyn MirDb + 'static) {
+74        &mut *self
+75    }
+76}
+77
+78impl Upcast<dyn SourceDb> for Db {
+79    fn upcast(&self) -> &(dyn SourceDb + 'static) {
+80        self
+81    }
+82}
+83
+84impl UpcastMut<dyn SourceDb> for Db {
+85    fn upcast_mut(&mut self) -> &mut (dyn SourceDb + 'static) {
+86        &mut *self
+87    }
+88}
+89
+90impl Upcast<dyn AnalyzerDb> for Db {
+91    fn upcast(&self) -> &(dyn AnalyzerDb + 'static) {
+92        self
+93    }
+94}
+95
+96impl UpcastMut<dyn AnalyzerDb> for Db {
+97    fn upcast_mut(&mut self) -> &mut (dyn AnalyzerDb + 'static) {
+98        &mut *self
+99    }
+100}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/db/queries.rs.html b/compiler-docs/src/fe_codegen/db/queries.rs.html new file mode 100644 index 0000000000..9406ddeca4 --- /dev/null +++ b/compiler-docs/src/fe_codegen/db/queries.rs.html @@ -0,0 +1,5 @@ +queries.rs - source

fe_codegen/db/
queries.rs

1pub mod abi;
+2pub mod constant;
+3pub mod contract;
+4pub mod function;
+5pub mod types;
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/db/queries/abi.rs.html b/compiler-docs/src/fe_codegen/db/queries/abi.rs.html new file mode 100644 index 0000000000..d23d5ee235 --- /dev/null +++ b/compiler-docs/src/fe_codegen/db/queries/abi.rs.html @@ -0,0 +1,279 @@ +abi.rs - source

fe_codegen/db/queries/
abi.rs

1use fe_abi::{
+2    contract::AbiContract,
+3    event::{AbiEvent, AbiEventField},
+4    function::{AbiFunction, AbiFunctionType, CtxParam, SelfParam, StateMutability},
+5    types::{AbiTupleField, AbiType},
+6};
+7use fe_analyzer::{
+8    constants::INDEXED,
+9    namespace::{
+10        items::{ContractId, ModuleId},
+11        types::{CtxDecl, SelfDecl},
+12    },
+13};
+14use fe_mir::ir::{self, FunctionId, TypeId};
+15
+16use crate::db::CodegenDb;
+17
+18pub fn abi_contract(db: &dyn CodegenDb, contract: ContractId) -> AbiContract {
+19    let mut funcs = vec![];
+20
+21    if let Some(init) = contract.init_function(db.upcast()) {
+22        let init_func = db.mir_lowered_func_signature(init);
+23        let init_abi = db.codegen_abi_function(init_func);
+24        funcs.push(init_abi);
+25    }
+26
+27    for &func in contract.all_functions(db.upcast()).as_ref() {
+28        let mir_func = db.mir_lowered_func_signature(func);
+29        if mir_func.linkage(db.upcast()).is_exported() {
+30            let func_abi = db.codegen_abi_function(mir_func);
+31            funcs.push(func_abi);
+32        }
+33    }
+34
+35    let events = abi_module_events(db, contract.module(db.upcast()));
+36
+37    AbiContract::new(funcs, events)
+38}
+39
+40pub fn abi_module_events(db: &dyn CodegenDb, module: ModuleId) -> Vec<AbiEvent> {
+41    let mut events = vec![];
+42    for &s in db.module_structs(module).as_ref() {
+43        let struct_ty = s.as_type(db.upcast());
+44        // TODO: This is a hack to avoid generating an ABI for non-`emittable` structs.
+45        if struct_ty.is_emittable(db.upcast()) {
+46            let mir_event = db.mir_lowered_type(struct_ty);
+47            let event = db.codegen_abi_event(mir_event);
+48            events.push(event);
+49        }
+50    }
+51
+52    events
+53}
+54
+55pub fn abi_function(db: &dyn CodegenDb, function: FunctionId) -> AbiFunction {
+56    // We use a legalized signature.
+57    let sig = db.codegen_legalized_signature(function);
+58
+59    let name = function.name(db.upcast());
+60    let args = sig
+61        .params
+62        .iter()
+63        .map(|param| (param.name.to_string(), db.codegen_abi_type(param.ty)))
+64        .collect();
+65    let ret_ty = sig.return_type.map(|ty| db.codegen_abi_type(ty));
+66
+67    let func_type = if function.is_contract_init(db.upcast()) {
+68        AbiFunctionType::Constructor
+69    } else {
+70        AbiFunctionType::Function
+71    };
+72
+73    // The "stateMutability" field is derived from the presence & mutability of
+74    // `self` and `ctx` params in the analyzer fn sig.
+75    let analyzer_sig = sig.analyzer_func_id.signature(db.upcast());
+76    let self_param = match analyzer_sig.self_decl {
+77        None => SelfParam::None,
+78        Some(SelfDecl { mut_: None, .. }) => SelfParam::Imm,
+79        Some(SelfDecl { mut_: Some(_), .. }) => SelfParam::Mut,
+80    };
+81    let ctx_param = match analyzer_sig.ctx_decl {
+82        None => CtxParam::None,
+83        Some(CtxDecl { mut_: None, .. }) => CtxParam::Imm,
+84        Some(CtxDecl { mut_: Some(_), .. }) => CtxParam::Mut,
+85    };
+86
+87    let state_mutability = if name == "__init__" {
+88        StateMutability::Payable
+89    } else {
+90        StateMutability::from_self_and_ctx_params(self_param, ctx_param)
+91    };
+92
+93    AbiFunction::new(func_type, name.to_string(), args, ret_ty, state_mutability)
+94}
+95
+96pub fn abi_function_argument_maximum_size(db: &dyn CodegenDb, function: FunctionId) -> usize {
+97    let sig = db.codegen_legalized_signature(function);
+98    sig.params.iter().fold(0, |acc, param| {
+99        acc + db.codegen_abi_type_maximum_size(param.ty)
+100    })
+101}
+102
+103pub fn abi_function_return_maximum_size(db: &dyn CodegenDb, function: FunctionId) -> usize {
+104    let sig = db.codegen_legalized_signature(function);
+105    sig.return_type
+106        .map(|ty| db.codegen_abi_type_maximum_size(ty))
+107        .unwrap_or_default()
+108}
+109
+110pub fn abi_type_maximum_size(db: &dyn CodegenDb, ty: TypeId) -> usize {
+111    let abi_type = db.codegen_abi_type(ty);
+112    if abi_type.is_static() {
+113        abi_type.header_size()
+114    } else {
+115        match &ty.data(db.upcast()).kind {
+116            ir::TypeKind::Array(def) if def.elem_ty.data(db.upcast()).kind == ir::TypeKind::U8 => {
+117                debug_assert_eq!(abi_type, AbiType::Bytes);
+118                64 + ceil_32(def.len)
+119            }
+120
+121            ir::TypeKind::Array(def) => {
+122                db.codegen_abi_type_maximum_size(def.elem_ty) * def.len + 32
+123            }
+124
+125            ir::TypeKind::String(len) => abi_type.header_size() + 32 + ceil_32(*len),
+126            _ if ty.is_aggregate(db.upcast()) => {
+127                let mut maximum = 0;
+128                for i in 0..ty.aggregate_field_num(db.upcast()) {
+129                    let field_ty = ty.projection_ty_imm(db.upcast(), i);
+130                    maximum += db.codegen_abi_type_maximum_size(field_ty)
+131                }
+132                maximum + 32
+133            }
+134            ir::TypeKind::MPtr(ty) => abi_type_maximum_size(db, ty.deref(db.upcast())),
+135
+136            _ => unreachable!(),
+137        }
+138    }
+139}
+140
+141pub fn abi_type_minimum_size(db: &dyn CodegenDb, ty: TypeId) -> usize {
+142    let abi_type = db.codegen_abi_type(ty);
+143    if abi_type.is_static() {
+144        abi_type.header_size()
+145    } else {
+146        match &ty.data(db.upcast()).kind {
+147            ir::TypeKind::Array(def) if def.elem_ty.data(db.upcast()).kind == ir::TypeKind::U8 => {
+148                debug_assert_eq!(abi_type, AbiType::Bytes);
+149                64
+150            }
+151            ir::TypeKind::Array(def) => {
+152                db.codegen_abi_type_minimum_size(def.elem_ty) * def.len + 32
+153            }
+154
+155            ir::TypeKind::String(_) => abi_type.header_size() + 32,
+156
+157            _ if ty.is_aggregate(db.upcast()) => {
+158                let mut minimum = 0;
+159                for i in 0..ty.aggregate_field_num(db.upcast()) {
+160                    let field_ty = ty.projection_ty_imm(db.upcast(), i);
+161                    minimum += db.codegen_abi_type_minimum_size(field_ty)
+162                }
+163                minimum + 32
+164            }
+165            ir::TypeKind::MPtr(ty) => abi_type_minimum_size(db, ty.deref(db.upcast())),
+166            _ => unreachable!(),
+167        }
+168    }
+169}
+170
+171pub fn abi_type(db: &dyn CodegenDb, ty: TypeId) -> AbiType {
+172    let legalized_ty = db.codegen_legalized_type(ty);
+173
+174    if legalized_ty.is_zero_sized(db.upcast()) {
+175        unreachable!("zero-sized type must be removed in legalization");
+176    }
+177
+178    let ty_data = legalized_ty.data(db.upcast());
+179
+180    match &ty_data.kind {
+181        ir::TypeKind::I8 => AbiType::Int(8),
+182        ir::TypeKind::I16 => AbiType::Int(16),
+183        ir::TypeKind::I32 => AbiType::Int(32),
+184        ir::TypeKind::I64 => AbiType::Int(64),
+185        ir::TypeKind::I128 => AbiType::Int(128),
+186        ir::TypeKind::I256 => AbiType::Int(256),
+187        ir::TypeKind::U8 => AbiType::UInt(8),
+188        ir::TypeKind::U16 => AbiType::UInt(16),
+189        ir::TypeKind::U32 => AbiType::UInt(32),
+190        ir::TypeKind::U64 => AbiType::UInt(64),
+191        ir::TypeKind::U128 => AbiType::UInt(128),
+192        ir::TypeKind::U256 => AbiType::UInt(256),
+193        ir::TypeKind::Bool => AbiType::Bool,
+194        ir::TypeKind::Address => AbiType::Address,
+195        ir::TypeKind::String(_) => AbiType::String,
+196        ir::TypeKind::Unit => unreachable!("zero-sized type must be removed in legalization"),
+197        ir::TypeKind::Array(def) => {
+198            let elem_ty_data = &def.elem_ty.data(db.upcast());
+199            match &elem_ty_data.kind {
+200                ir::TypeKind::U8 => AbiType::Bytes,
+201                _ => {
+202                    let elem_ty = db.codegen_abi_type(def.elem_ty);
+203                    let len = def.len;
+204                    AbiType::Array {
+205                        elem_ty: elem_ty.into(),
+206                        len,
+207                    }
+208                }
+209            }
+210        }
+211        ir::TypeKind::Tuple(def) => {
+212            let fields = def
+213                .items
+214                .iter()
+215                .enumerate()
+216                .map(|(i, item)| {
+217                    let field_ty = db.codegen_abi_type(*item);
+218                    AbiTupleField::new(format!("{i}"), field_ty)
+219                })
+220                .collect();
+221
+222            AbiType::Tuple(fields)
+223        }
+224        ir::TypeKind::Struct(def) => {
+225            let fields = def
+226                .fields
+227                .iter()
+228                .map(|(name, ty)| {
+229                    let ty = db.codegen_abi_type(*ty);
+230                    AbiTupleField::new(name.to_string(), ty)
+231                })
+232                .collect();
+233
+234            AbiType::Tuple(fields)
+235        }
+236        ir::TypeKind::MPtr(inner) => db.codegen_abi_type(*inner),
+237
+238        ir::TypeKind::Contract(_)
+239        | ir::TypeKind::Map(_)
+240        | ir::TypeKind::Enum(_)
+241        | ir::TypeKind::SPtr(_) => unreachable!(),
+242    }
+243}
+244
+245pub fn abi_event(db: &dyn CodegenDb, ty: TypeId) -> AbiEvent {
+246    debug_assert!(ty.is_struct(db.upcast()));
+247
+248    let legalized_ty = db.codegen_legalized_type(ty);
+249    let analyzer_struct = ty
+250        .analyzer_ty(db.upcast())
+251        .and_then(|val| val.as_struct(db.upcast()))
+252        .unwrap();
+253    let legalized_ty_data = legalized_ty.data(db.upcast());
+254    let event_def = match &legalized_ty_data.kind {
+255        ir::TypeKind::Struct(def) => def,
+256        _ => unreachable!(),
+257    };
+258
+259    let fields = event_def
+260        .fields
+261        .iter()
+262        .map(|(name, ty)| {
+263            let attr = analyzer_struct
+264                .field(db.upcast(), name)
+265                .unwrap()
+266                .attributes(db.upcast());
+267
+268            let ty = db.codegen_abi_type(*ty);
+269            let indexed = attr.iter().any(|attr| attr == INDEXED);
+270            AbiEventField::new(name.to_string(), ty, indexed)
+271        })
+272        .collect();
+273
+274    AbiEvent::new(event_def.name.to_string(), fields, false)
+275}
+276
+277fn ceil_32(value: usize) -> usize {
+278    ((value + 31) / 32) * 32
+279}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/db/queries/constant.rs.html b/compiler-docs/src/fe_codegen/db/queries/constant.rs.html new file mode 100644 index 0000000000..f07a8f835a --- /dev/null +++ b/compiler-docs/src/fe_codegen/db/queries/constant.rs.html @@ -0,0 +1,12 @@ +constant.rs - source

fe_codegen/db/queries/
constant.rs

1use crate::db::CodegenDb;
+2use std::{
+3    collections::hash_map::DefaultHasher,
+4    hash::{Hash, Hasher},
+5    rc::Rc,
+6};
+7
+8pub fn string_symbol_name(_db: &dyn CodegenDb, data: String) -> Rc<String> {
+9    let mut hasher = DefaultHasher::new();
+10    data.hash(&mut hasher);
+11    format! {"{}", hasher.finish()}.into()
+12}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/db/queries/contract.rs.html b/compiler-docs/src/fe_codegen/db/queries/contract.rs.html new file mode 100644 index 0000000000..519e580a1a --- /dev/null +++ b/compiler-docs/src/fe_codegen/db/queries/contract.rs.html @@ -0,0 +1,20 @@ +contract.rs - source

fe_codegen/db/queries/
contract.rs

1use std::rc::Rc;
+2
+3use fe_analyzer::namespace::items::ContractId;
+4
+5use crate::db::CodegenDb;
+6
+7pub fn symbol_name(db: &dyn CodegenDb, contract: ContractId) -> Rc<String> {
+8    let module = contract.module(db.upcast());
+9
+10    format!(
+11        "{}${}",
+12        module.name(db.upcast()),
+13        contract.name(db.upcast())
+14    )
+15    .into()
+16}
+17
+18pub fn deployer_symbol_name(db: &dyn CodegenDb, contract: ContractId) -> Rc<String> {
+19    format!("deploy_{}", symbol_name(db, contract).as_ref()).into()
+20}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/db/queries/function.rs.html b/compiler-docs/src/fe_codegen/db/queries/function.rs.html new file mode 100644 index 0000000000..8b55aa2b74 --- /dev/null +++ b/compiler-docs/src/fe_codegen/db/queries/function.rs.html @@ -0,0 +1,76 @@ +function.rs - source

fe_codegen/db/queries/
function.rs

1use std::rc::Rc;
+2
+3use fe_analyzer::{
+4    display::Displayable,
+5    namespace::{
+6        items::Item,
+7        types::{Type, TypeId},
+8    },
+9};
+10use fe_mir::ir::{FunctionBody, FunctionId, FunctionSignature};
+11use salsa::InternKey;
+12use smol_str::SmolStr;
+13
+14use crate::{db::CodegenDb, yul::legalize};
+15
+16pub fn legalized_signature(db: &dyn CodegenDb, function: FunctionId) -> Rc<FunctionSignature> {
+17    let mut sig = function.signature(db.upcast()).as_ref().clone();
+18    legalize::legalize_func_signature(db, &mut sig);
+19    sig.into()
+20}
+21
+22pub fn legalized_body(db: &dyn CodegenDb, function: FunctionId) -> Rc<FunctionBody> {
+23    let mut body = function.body(db.upcast()).as_ref().clone();
+24    legalize::legalize_func_body(db, &mut body);
+25    body.into()
+26}
+27
+28pub fn symbol_name(db: &dyn CodegenDb, function: FunctionId) -> Rc<String> {
+29    let module = function.signature(db.upcast()).module_id;
+30    let module_name = module.name(db.upcast());
+31
+32    let analyzer_func = function.analyzer_func(db.upcast());
+33    let func_name = format!(
+34        "{}{}",
+35        analyzer_func.name(db.upcast()),
+36        type_suffix(function, db)
+37    );
+38
+39    let func_name = match analyzer_func.sig(db.upcast()).self_item(db.upcast()) {
+40        Some(Item::Impl(id)) => {
+41            let class_name = format!(
+42                "{}${}",
+43                id.trait_id(db.upcast()).name(db.upcast()),
+44                safe_name(db, id.receiver(db.upcast()))
+45            );
+46            format!("{class_name}${func_name}")
+47        }
+48        Some(class) => {
+49            let class_name = class.name(db.upcast());
+50            format!("{class_name}${func_name}")
+51        }
+52        _ => func_name,
+53    };
+54
+55    format!("{module_name}${func_name}").into()
+56}
+57
+58fn type_suffix(function: FunctionId, db: &dyn CodegenDb) -> SmolStr {
+59    function
+60        .signature(db.upcast())
+61        .resolved_generics
+62        .values()
+63        .fold(String::new(), |acc, param| {
+64            format!("{}_{}", acc, safe_name(db, *param))
+65        })
+66        .into()
+67}
+68
+69fn safe_name(db: &dyn CodegenDb, ty: TypeId) -> SmolStr {
+70    match ty.typ(db.upcast()) {
+71        // TODO: Would be nice to get more human friendly names here
+72        Type::Array(_) => format!("array_{:?}", ty.as_intern_id()).into(),
+73        Type::Tuple(_) => format!("tuple_{:?}", ty.as_intern_id()).into(),
+74        _ => format!("{}", ty.display(db.upcast())).into(),
+75    }
+76}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/db/queries/types.rs.html b/compiler-docs/src/fe_codegen/db/queries/types.rs.html new file mode 100644 index 0000000000..6061ee1af9 --- /dev/null +++ b/compiler-docs/src/fe_codegen/db/queries/types.rs.html @@ -0,0 +1,102 @@ +types.rs - source

fe_codegen/db/queries/
types.rs

1use fe_mir::ir::{
+2    types::{ArrayDef, MapDef, StructDef, TupleDef},
+3    Type, TypeId, TypeKind,
+4};
+5
+6use crate::db::CodegenDb;
+7
+8pub fn legalized_type(db: &dyn CodegenDb, ty: TypeId) -> TypeId {
+9    let ty_data = ty.data(db.upcast());
+10    let ty_kind = match &ty.data(db.upcast()).kind {
+11        TypeKind::Tuple(def) => {
+12            let items = def
+13                .items
+14                .iter()
+15                .filter_map(|item| {
+16                    if item.is_zero_sized(db.upcast()) {
+17                        None
+18                    } else {
+19                        Some(legalized_type(db, *item))
+20                    }
+21                })
+22                .collect();
+23            let new_def = TupleDef { items };
+24            TypeKind::Tuple(new_def)
+25        }
+26
+27        TypeKind::Array(def) => {
+28            let new_def = ArrayDef {
+29                elem_ty: legalized_type(db, def.elem_ty),
+30                len: def.len,
+31            };
+32            TypeKind::Array(new_def)
+33        }
+34
+35        TypeKind::Struct(def) => {
+36            let fields = def
+37                .fields
+38                .iter()
+39                .cloned()
+40                .filter_map(|(name, ty)| {
+41                    if ty.is_zero_sized(db.upcast()) {
+42                        None
+43                    } else {
+44                        Some((name, legalized_type(db, ty)))
+45                    }
+46                })
+47                .collect();
+48            let new_def = StructDef {
+49                name: def.name.clone(),
+50                fields,
+51                span: def.span,
+52                module_id: def.module_id,
+53            };
+54            TypeKind::Struct(new_def)
+55        }
+56
+57        TypeKind::Contract(def) => {
+58            let fields = def
+59                .fields
+60                .iter()
+61                .cloned()
+62                .filter_map(|(name, ty)| {
+63                    if ty.is_zero_sized(db.upcast()) {
+64                        None
+65                    } else {
+66                        Some((name, legalized_type(db, ty)))
+67                    }
+68                })
+69                .collect();
+70            let new_def = StructDef {
+71                name: def.name.clone(),
+72                fields,
+73                span: def.span,
+74                module_id: def.module_id,
+75            };
+76            TypeKind::Contract(new_def)
+77        }
+78
+79        TypeKind::Map(def) => {
+80            let new_def = MapDef {
+81                key_ty: legalized_type(db, def.key_ty),
+82                value_ty: legalized_type(db, def.value_ty),
+83            };
+84            TypeKind::Map(new_def)
+85        }
+86
+87        TypeKind::MPtr(ty) => {
+88            let new_ty = legalized_type(db, *ty);
+89            TypeKind::MPtr(new_ty)
+90        }
+91
+92        TypeKind::SPtr(ty) => {
+93            let new_ty = legalized_type(db, *ty);
+94            TypeKind::SPtr(new_ty)
+95        }
+96
+97        _ => return ty,
+98    };
+99
+100    let analyzer_ty = ty_data.analyzer_ty;
+101    db.mir_intern_type(Type::new(ty_kind, analyzer_ty).into())
+102}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/lib.rs.html b/compiler-docs/src/fe_codegen/lib.rs.html new file mode 100644 index 0000000000..c599377b64 --- /dev/null +++ b/compiler-docs/src/fe_codegen/lib.rs.html @@ -0,0 +1,2 @@ +lib.rs - source

fe_codegen/
lib.rs

1pub mod db;
+2pub mod yul;
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/isel/context.rs.html b/compiler-docs/src/fe_codegen/yul/isel/context.rs.html new file mode 100644 index 0000000000..794413bc91 --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/isel/context.rs.html @@ -0,0 +1,81 @@ +context.rs - source

fe_codegen/yul/isel/
context.rs

1use indexmap::IndexSet;
+2
+3use fe_analyzer::namespace::items::ContractId;
+4use fe_mir::ir::FunctionId;
+5use fxhash::FxHashSet;
+6use yultsur::yul;
+7
+8use crate::{
+9    db::CodegenDb,
+10    yul::runtime::{DefaultRuntimeProvider, RuntimeProvider},
+11};
+12
+13use super::{lower_contract_deployable, lower_function};
+14
+15pub struct Context {
+16    pub runtime: Box<dyn RuntimeProvider>,
+17    pub(super) contract_dependency: IndexSet<ContractId>,
+18    pub(super) function_dependency: IndexSet<FunctionId>,
+19    pub(super) string_constants: IndexSet<String>,
+20    pub(super) lowered_functions: FxHashSet<FunctionId>,
+21}
+22
+23// Currently, `clippy::derivable_impls` causes false positive result,
+24// see https://github.com/rust-lang/rust-clippy/issues/10158 for more details.
+25#[allow(clippy::derivable_impls)]
+26impl Default for Context {
+27    fn default() -> Self {
+28        Self {
+29            runtime: Box::<DefaultRuntimeProvider>::default(),
+30            contract_dependency: IndexSet::default(),
+31            function_dependency: IndexSet::default(),
+32            string_constants: IndexSet::default(),
+33            lowered_functions: FxHashSet::default(),
+34        }
+35    }
+36}
+37
+38impl Context {
+39    pub(super) fn resolve_function_dependency(
+40        &mut self,
+41        db: &dyn CodegenDb,
+42    ) -> Vec<yul::FunctionDefinition> {
+43        let mut funcs = vec![];
+44        loop {
+45            let dependencies = std::mem::take(&mut self.function_dependency);
+46            if dependencies.is_empty() {
+47                break;
+48            }
+49            for dependency in dependencies {
+50                if self.lowered_functions.contains(&dependency) {
+51                    // Ignore dependency if it's already lowered.
+52                    continue;
+53                } else {
+54                    funcs.push(lower_function(db, self, dependency))
+55                }
+56            }
+57        }
+58
+59        funcs
+60    }
+61
+62    pub(super) fn resolve_constant_dependency(&self, db: &dyn CodegenDb) -> Vec<yul::Data> {
+63        self.string_constants
+64            .iter()
+65            .map(|s| {
+66                let symbol = db.codegen_constant_string_symbol_name(s.to_string());
+67                yul::Data {
+68                    name: symbol.as_ref().clone(),
+69                    value: s.to_string(),
+70                }
+71            })
+72            .collect()
+73    }
+74
+75    pub(super) fn resolve_contract_dependency(&self, db: &dyn CodegenDb) -> Vec<yul::Object> {
+76        self.contract_dependency
+77            .iter()
+78            .map(|cid| lower_contract_deployable(db, *cid))
+79            .collect()
+80    }
+81}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/isel/contract.rs.html b/compiler-docs/src/fe_codegen/yul/isel/contract.rs.html new file mode 100644 index 0000000000..e10292650a --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/isel/contract.rs.html @@ -0,0 +1,289 @@ +contract.rs - source

fe_codegen/yul/isel/
contract.rs

1use fe_analyzer::namespace::items::ContractId;
+2use fe_mir::ir::{function::Linkage, FunctionId};
+3use yultsur::{yul, *};
+4
+5use crate::{
+6    db::CodegenDb,
+7    yul::{runtime::AbiSrcLocation, YulVariable},
+8};
+9
+10use super::context::Context;
+11
+12pub fn lower_contract_deployable(db: &dyn CodegenDb, contract: ContractId) -> yul::Object {
+13    let mut context = Context::default();
+14
+15    let constructor = if let Some(init) = contract.init_function(db.upcast()) {
+16        let init = db.mir_lowered_func_signature(init);
+17        make_init(db, &mut context, contract, init)
+18    } else {
+19        statements! {}
+20    };
+21
+22    let deploy_code = make_deploy(db, contract);
+23
+24    let dep_functions: Vec<_> = context
+25        .resolve_function_dependency(db)
+26        .into_iter()
+27        .map(yul::Statement::FunctionDefinition)
+28        .collect();
+29    let runtime_funcs: Vec<_> = context
+30        .runtime
+31        .collect_definitions()
+32        .into_iter()
+33        .map(yul::Statement::FunctionDefinition)
+34        .collect();
+35
+36    let deploy_block = block_statement! {
+37        [constructor...]
+38        [deploy_code...]
+39    };
+40
+41    let code = code! {
+42        [deploy_block]
+43        [dep_functions...]
+44        [runtime_funcs...]
+45    };
+46
+47    let mut dep_contracts = context.resolve_contract_dependency(db);
+48    dep_contracts.push(lower_contract(db, contract));
+49    let dep_constants = context.resolve_constant_dependency(db);
+50
+51    let name = identifier! {(
+52        db.codegen_contract_deployer_symbol_name(contract).as_ref()
+53    )};
+54    let object = yul::Object {
+55        name,
+56        code,
+57        objects: dep_contracts,
+58        data: dep_constants,
+59    };
+60
+61    normalize_object(object)
+62}
+63
+64pub fn lower_contract(db: &dyn CodegenDb, contract: ContractId) -> yul::Object {
+65    let exported_funcs: Vec<_> = db
+66        .mir_lower_contract_all_functions(contract)
+67        .iter()
+68        .filter_map(|fid| {
+69            if fid.signature(db.upcast()).linkage == Linkage::Export {
+70                Some(*fid)
+71            } else {
+72                None
+73            }
+74        })
+75        .collect();
+76
+77    let mut context = Context::default();
+78    let dispatcher = if let Some(call_fn) = contract.call_function(db.upcast()) {
+79        let call_fn = db.mir_lowered_func_signature(call_fn);
+80        context.function_dependency.insert(call_fn);
+81        let call_symbol = identifier! { (db.codegen_function_symbol_name(call_fn)) };
+82        statement! {
+83            ([call_symbol]())
+84        }
+85    } else {
+86        make_dispatcher(db, &mut context, &exported_funcs)
+87    };
+88
+89    let dep_functions: Vec<_> = context
+90        .resolve_function_dependency(db)
+91        .into_iter()
+92        .map(yul::Statement::FunctionDefinition)
+93        .collect();
+94    let runtime_funcs: Vec<_> = context
+95        .runtime
+96        .collect_definitions()
+97        .into_iter()
+98        .map(yul::Statement::FunctionDefinition)
+99        .collect();
+100
+101    let code = code! {
+102        ([dispatcher])
+103        [dep_functions...]
+104        [runtime_funcs...]
+105    };
+106
+107    // Lower dependant contracts.
+108    let dep_contracts = context.resolve_contract_dependency(db);
+109
+110    // Collect string constants.
+111    let dep_constants = context.resolve_constant_dependency(db);
+112    let contract_symbol = identifier! { (db.codegen_contract_symbol_name(contract)) };
+113
+114    yul::Object {
+115        name: contract_symbol,
+116        code,
+117        objects: dep_contracts,
+118        data: dep_constants,
+119    }
+120}
+121
+122fn make_dispatcher(
+123    db: &dyn CodegenDb,
+124    context: &mut Context,
+125    funcs: &[FunctionId],
+126) -> yul::Statement {
+127    let arms = funcs
+128        .iter()
+129        .map(|func| dispatch_arm(db, context, *func))
+130        .collect::<Vec<_>>();
+131
+132    if arms.is_empty() {
+133        statement! { return(0, 0) }
+134    } else {
+135        let selector = expression! {
+136            and((shr((sub(256, 32)), (calldataload(0)))), 0xffffffff)
+137        };
+138        switch! {
+139            switch ([selector])
+140            [arms...]
+141            (default { (return(0, 0)) })
+142        }
+143    }
+144}
+145
+146fn dispatch_arm(db: &dyn CodegenDb, context: &mut Context, func: FunctionId) -> yul::Case {
+147    context.function_dependency.insert(func);
+148    let func_sig = db.codegen_legalized_signature(func);
+149    let mut param_vars = Vec::with_capacity(func_sig.params.len());
+150    let mut param_tys = Vec::with_capacity(func_sig.params.len());
+151    func_sig.params.iter().for_each(|param| {
+152        param_vars.push(YulVariable::new(param.name.as_str()));
+153        param_tys.push(param.ty);
+154    });
+155
+156    let decode_params = if func_sig.params.is_empty() {
+157        statements! {}
+158    } else {
+159        let ident_params: Vec<_> = param_vars.iter().map(YulVariable::ident).collect();
+160        let param_size = YulVariable::new("param_size");
+161        statements! {
+162            (let [param_size.ident()] := sub((calldatasize()), 4))
+163            (let [ident_params...] := [context.runtime.abi_decode(db, expression! { 4 }, param_size.expr(), &param_tys, AbiSrcLocation::CallData)])
+164        }
+165    };
+166
+167    let call_and_encode_return = {
+168        let name = identifier! { (db.codegen_function_symbol_name(func)) };
+169        // we pass in a `0` for the expected `Context` argument
+170        let call = expression! {[name]([(param_vars.iter().map(YulVariable::expr).collect::<Vec<_>>())...])};
+171        if let Some(mut return_type) = func_sig.return_type {
+172            if return_type.is_aggregate(db.upcast()) {
+173                return_type = return_type.make_mptr(db.upcast());
+174            }
+175
+176            let ret = YulVariable::new("ret");
+177            let enc_start = YulVariable::new("enc_start");
+178            let enc_size = YulVariable::new("enc_size");
+179            let abi_encode = context.runtime.abi_encode_seq(
+180                db,
+181                &[ret.expr()],
+182                enc_start.expr(),
+183                &[return_type],
+184                false,
+185            );
+186            statements! {
+187                (let [ret.ident()] := [call])
+188                (let [enc_start.ident()] := [context.runtime.avail(db)])
+189                (let [enc_size.ident()] := [abi_encode])
+190                (return([enc_start.expr()], [enc_size.expr()]))
+191            }
+192        } else {
+193            statements! {
+194                ([yul::Statement::Expression(call)])
+195                (return(0, 0))
+196            }
+197        }
+198    };
+199
+200    let abi_sig = db.codegen_abi_function(func);
+201    let selector = literal! { (format!("0x{}", abi_sig.selector().hex())) };
+202    case! {
+203        case [selector] {
+204            [decode_params...]
+205            [call_and_encode_return...]
+206        }
+207    }
+208}
+209
+210fn make_init(
+211    db: &dyn CodegenDb,
+212    context: &mut Context,
+213    contract: ContractId,
+214    init: FunctionId,
+215) -> Vec<yul::Statement> {
+216    context.function_dependency.insert(init);
+217    let init_func_name = identifier! { (db.codegen_function_symbol_name(init)) };
+218    let contract_name = identifier_expression! { (format!{r#""{}""#, db.codegen_contract_deployer_symbol_name(contract)}) };
+219
+220    let func_sig = db.codegen_legalized_signature(init);
+221    let mut param_vars = Vec::with_capacity(func_sig.params.len());
+222    let mut param_tys = Vec::with_capacity(func_sig.params.len());
+223    let program_size = YulVariable::new("$program_size");
+224    let arg_size = YulVariable::new("$arg_size");
+225    let code_size = YulVariable::new("$code_size");
+226    let memory_data_offset = YulVariable::new("$memory_data_offset");
+227    func_sig.params.iter().for_each(|param| {
+228        param_vars.push(YulVariable::new(param.name.as_str()));
+229        param_tys.push(param.ty);
+230    });
+231
+232    let decode_params = if func_sig.params.is_empty() {
+233        statements! {}
+234    } else {
+235        let ident_params: Vec<_> = param_vars.iter().map(YulVariable::ident).collect();
+236        statements! {
+237            (let [ident_params...] := [context.runtime.abi_decode(db, memory_data_offset.expr(), arg_size.expr(), &param_tys, AbiSrcLocation::Memory)])
+238        }
+239    };
+240
+241    let call = expression! {[init_func_name]([(param_vars.iter().map(YulVariable::expr).collect::<Vec<_>>())...])};
+242    statements! {
+243        (let [program_size.ident()] := datasize([contract_name]))
+244        (let [code_size.ident()] := codesize())
+245        (let [arg_size.ident()] := sub([code_size.expr()], [program_size.expr()]))
+246        (let [memory_data_offset.ident()] := [context.runtime.alloc(db, arg_size.expr())])
+247        (codecopy([memory_data_offset.expr()], [program_size.expr()], [arg_size.expr()]))
+248        [decode_params...]
+249        ([yul::Statement::Expression(call)])
+250    }
+251}
+252
+253fn make_deploy(db: &dyn CodegenDb, contract: ContractId) -> Vec<yul::Statement> {
+254    let contract_symbol =
+255        identifier_expression! { (format!{r#""{}""#, db.codegen_contract_symbol_name(contract)}) };
+256    let size = YulVariable::new("$$size");
+257    statements! {
+258       (let [size.ident()] := (datasize([contract_symbol.clone()])))
+259       (datacopy(0, (dataoffset([contract_symbol])), [size.expr()]))
+260       (return (0, [size.expr()]))
+261    }
+262}
+263
+264fn normalize_object(obj: yul::Object) -> yul::Object {
+265    let data = obj
+266        .data
+267        .into_iter()
+268        .map(|data| yul::Data {
+269            name: data.name,
+270            value: data
+271                .value
+272                .replace('\\', "\\\\\\\\")
+273                .replace('\n', "\\\\n")
+274                .replace('"', "\\\\\"")
+275                .replace('\r', "\\\\r")
+276                .replace('\t', "\\\\t"),
+277        })
+278        .collect::<Vec<_>>();
+279    yul::Object {
+280        name: obj.name,
+281        code: obj.code,
+282        objects: obj
+283            .objects
+284            .into_iter()
+285            .map(normalize_object)
+286            .collect::<Vec<_>>(),
+287        data,
+288    }
+289}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/isel/function.rs.html b/compiler-docs/src/fe_codegen/yul/isel/function.rs.html new file mode 100644 index 0000000000..c6ca45427f --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/isel/function.rs.html @@ -0,0 +1,978 @@ +function.rs - source

fe_codegen/yul/isel/
function.rs

1#![allow(unused)]
+2use std::thread::Scope;
+3
+4use super::{context::Context, inst_order::InstSerializer};
+5use fe_common::numeric::to_hex_str;
+6
+7use fe_abi::function::{AbiFunction, AbiFunctionType};
+8use fe_common::db::Upcast;
+9use fe_mir::{
+10    ir::{
+11        self,
+12        constant::ConstantValue,
+13        inst::{BinOp, CallType, CastKind, InstKind, UnOp},
+14        value::AssignableValue,
+15        Constant, FunctionBody, FunctionId, FunctionSignature, InstId, Type, TypeId, TypeKind,
+16        Value, ValueId,
+17    },
+18    pretty_print::PrettyPrint,
+19};
+20use fxhash::FxHashMap;
+21use smol_str::SmolStr;
+22use yultsur::{
+23    yul::{self, Statement},
+24    *,
+25};
+26
+27use crate::{
+28    db::CodegenDb,
+29    yul::isel::inst_order::StructuralInst,
+30    yul::slot_size::{function_hash_type, yul_primitive_type, SLOT_SIZE},
+31    yul::{
+32        runtime::{self, RuntimeProvider},
+33        YulVariable,
+34    },
+35};
+36
+37pub fn lower_function(
+38    db: &dyn CodegenDb,
+39    ctx: &mut Context,
+40    function: FunctionId,
+41) -> yul::FunctionDefinition {
+42    debug_assert!(!ctx.lowered_functions.contains(&function));
+43    ctx.lowered_functions.insert(function);
+44    let sig = &db.codegen_legalized_signature(function);
+45    let body = &db.codegen_legalized_body(function);
+46    FuncLowerHelper::new(db, ctx, function, sig, body).lower_func()
+47}
+48
+49struct FuncLowerHelper<'db, 'a> {
+50    db: &'db dyn CodegenDb,
+51    ctx: &'a mut Context,
+52    value_map: ScopedValueMap,
+53    func: FunctionId,
+54    sig: &'a FunctionSignature,
+55    body: &'a FunctionBody,
+56    ret_value: Option<yul::Identifier>,
+57    sink: Vec<yul::Statement>,
+58}
+59
+60impl<'db, 'a> FuncLowerHelper<'db, 'a> {
+61    fn new(
+62        db: &'db dyn CodegenDb,
+63        ctx: &'a mut Context,
+64        func: FunctionId,
+65        sig: &'a FunctionSignature,
+66        body: &'a FunctionBody,
+67    ) -> Self {
+68        let mut value_map = ScopedValueMap::default();
+69        // Register arguments to value_map.
+70        for &value in body.store.locals() {
+71            match body.store.value_data(value) {
+72                Value::Local(local) if local.is_arg => {
+73                    let ident = YulVariable::new(local.name.as_str()).ident();
+74                    value_map.insert(value, ident);
+75                }
+76                _ => {}
+77            }
+78        }
+79
+80        let ret_value = if sig.return_type.is_some() {
+81            Some(YulVariable::new("$ret").ident())
+82        } else {
+83            None
+84        };
+85
+86        Self {
+87            db,
+88            ctx,
+89            value_map,
+90            func,
+91            sig,
+92            body,
+93            ret_value,
+94            sink: Vec::new(),
+95        }
+96    }
+97
+98    fn lower_func(mut self) -> yul::FunctionDefinition {
+99        let name = identifier! { (self.db.codegen_function_symbol_name(self.func)) };
+100
+101        let parameters = self
+102            .sig
+103            .params
+104            .iter()
+105            .map(|param| YulVariable::new(param.name.as_str()).ident())
+106            .collect();
+107
+108        let ret = self
+109            .ret_value
+110            .clone()
+111            .map(|value| vec![value])
+112            .unwrap_or_default();
+113
+114        let body = self.lower_body();
+115
+116        yul::FunctionDefinition {
+117            name,
+118            parameters,
+119            returns: ret,
+120            block: body,
+121        }
+122    }
+123
+124    fn lower_body(mut self) -> yul::Block {
+125        let inst_order = InstSerializer::new(self.body).serialize();
+126
+127        for inst in inst_order {
+128            self.lower_structural_inst(inst)
+129        }
+130
+131        yul::Block {
+132            statements: self.sink,
+133        }
+134    }
+135
+136    fn lower_structural_inst(&mut self, inst: StructuralInst) {
+137        match inst {
+138            StructuralInst::Inst(inst) => self.lower_inst(inst),
+139            StructuralInst::If { cond, then, else_ } => {
+140                let if_block = self.lower_if(cond, then, else_);
+141                self.sink.push(if_block)
+142            }
+143            StructuralInst::Switch {
+144                scrutinee,
+145                table,
+146                default,
+147            } => {
+148                let switch_block = self.lower_switch(scrutinee, table, default);
+149                self.sink.push(switch_block)
+150            }
+151            StructuralInst::For { body } => {
+152                let for_block = self.lower_for(body);
+153                self.sink.push(for_block)
+154            }
+155            StructuralInst::Break => self.sink.push(yul::Statement::Break),
+156            StructuralInst::Continue => self.sink.push(yul::Statement::Continue),
+157        };
+158    }
+159
+160    fn lower_inst(&mut self, inst: InstId) {
+161        if let Some(lhs) = self.body.store.inst_result(inst) {
+162            self.declare_assignable_value(lhs)
+163        }
+164
+165        match &self.body.store.inst_data(inst).kind {
+166            InstKind::Declare { local } => self.declare_value(*local),
+167
+168            InstKind::Unary { op, value } => {
+169                let inst_result = self.body.store.inst_result(inst).unwrap();
+170                let inst_result_ty = inst_result.ty(self.db.upcast(), &self.body.store);
+171                let result = self.lower_unary(*op, *value);
+172                self.assign_inst_result(inst, result, inst_result_ty.deref(self.db.upcast()))
+173            }
+174
+175            InstKind::Binary { op, lhs, rhs } => {
+176                let inst_result = self.body.store.inst_result(inst).unwrap();
+177                let inst_result_ty = inst_result.ty(self.db.upcast(), &self.body.store);
+178                let result = self.lower_binary(*op, *lhs, *rhs, inst);
+179                self.assign_inst_result(inst, result, inst_result_ty.deref(self.db.upcast()))
+180            }
+181
+182            InstKind::Cast { kind, value, to } => {
+183                let from_ty = self.body.store.value_ty(*value);
+184                let result = match kind {
+185                    CastKind::Primitive => {
+186                        debug_assert!(
+187                            from_ty.is_primitive(self.db.upcast())
+188                                && to.is_primitive(self.db.upcast())
+189                        );
+190                        let value = self.value_expr(*value);
+191                        self.ctx.runtime.primitive_cast(self.db, value, from_ty)
+192                    }
+193                    CastKind::Untag => {
+194                        let from_ty = from_ty.deref(self.db.upcast());
+195                        debug_assert!(from_ty.is_enum(self.db.upcast()));
+196                        let value = self.value_expr(*value);
+197                        let offset = literal_expression! {(from_ty.enum_data_offset(self.db.upcast(), SLOT_SIZE))};
+198                        expression! {add([value], [offset])}
+199                    }
+200                };
+201
+202                self.assign_inst_result(inst, result, *to)
+203            }
+204
+205            InstKind::AggregateConstruct { ty, args } => {
+206                let lhs = self.body.store.inst_result(inst).unwrap();
+207                let ptr = self.lower_assignable_value(lhs);
+208                let ptr_ty = lhs.ty(self.db.upcast(), &self.body.store);
+209                let arg_values = args.iter().map(|arg| self.value_expr(*arg)).collect();
+210                let arg_tys = args
+211                    .iter()
+212                    .map(|arg| self.body.store.value_ty(*arg))
+213                    .collect();
+214                self.sink.push(yul::Statement::Expression(
+215                    self.ctx
+216                        .runtime
+217                        .aggregate_init(self.db, ptr, arg_values, ptr_ty, arg_tys),
+218                ))
+219            }
+220
+221            InstKind::Bind { src } => {
+222                match self.body.store.value_data(*src) {
+223                    Value::Constant { constant, .. } => {
+224                        // Need special handling when rhs is the string literal because it needs ptr
+225                        // copy.
+226                        if let ConstantValue::Str(s) = &constant.data(self.db.upcast()).value {
+227                            self.ctx.string_constants.insert(s.to_string());
+228                            let size = self.value_ty_size_deref(*src);
+229                            let lhs = self.body.store.inst_result(inst).unwrap();
+230                            let ptr = self.lower_assignable_value(lhs);
+231                            let inst_result_ty = lhs.ty(self.db.upcast(), &self.body.store);
+232                            self.sink.push(yul::Statement::Expression(
+233                                self.ctx.runtime.string_copy(
+234                                    self.db,
+235                                    ptr,
+236                                    s,
+237                                    inst_result_ty.is_sptr(self.db.upcast()),
+238                                ),
+239                            ))
+240                        } else {
+241                            let src_ty = self.body.store.value_ty(*src);
+242                            let src = self.value_expr(*src);
+243                            self.assign_inst_result(inst, src, src_ty)
+244                        }
+245                    }
+246                    _ => {
+247                        let src_ty = self.body.store.value_ty(*src);
+248                        let src = self.value_expr(*src);
+249                        self.assign_inst_result(inst, src, src_ty)
+250                    }
+251                }
+252            }
+253
+254            InstKind::MemCopy { src } => {
+255                let lhs = self.body.store.inst_result(inst).unwrap();
+256                let dst_ptr = self.lower_assignable_value(lhs);
+257                let dst_ptr_ty = lhs.ty(self.db.upcast(), &self.body.store);
+258                let src_ptr = self.value_expr(*src);
+259                let src_ptr_ty = self.body.store.value_ty(*src);
+260                let ty_size = literal_expression! { (self.value_ty_size_deref(*src)) };
+261                self.sink
+262                    .push(yul::Statement::Expression(self.ctx.runtime.ptr_copy(
+263                        self.db,
+264                        src_ptr,
+265                        dst_ptr,
+266                        ty_size,
+267                        src_ptr_ty.is_sptr(self.db.upcast()),
+268                        dst_ptr_ty.is_sptr(self.db.upcast()),
+269                    )))
+270            }
+271
+272            InstKind::Load { src } => {
+273                let src_ty = self.body.store.value_ty(*src);
+274                let src = self.value_expr(*src);
+275                debug_assert!(src_ty.is_ptr(self.db.upcast()));
+276
+277                let result = self.body.store.inst_result(inst).unwrap();
+278                debug_assert!(!result
+279                    .ty(self.db.upcast(), &self.body.store)
+280                    .is_ptr(self.db.upcast()));
+281                self.assign_inst_result(inst, src, src_ty)
+282            }
+283
+284            InstKind::AggregateAccess { value, indices } => {
+285                let base = self.value_expr(*value);
+286                let mut ptr = base;
+287                let mut inner_ty = self.body.store.value_ty(*value);
+288                for &idx in indices {
+289                    ptr = self.aggregate_elem_ptr(ptr, idx, inner_ty.deref(self.db.upcast()));
+290                    inner_ty =
+291                        inner_ty.projection_ty(self.db.upcast(), self.body.store.value_data(idx));
+292                }
+293
+294                let result = self.body.store.inst_result(inst).unwrap();
+295                self.assign_inst_result(inst, ptr, inner_ty)
+296            }
+297
+298            InstKind::MapAccess { value, key } => {
+299                let map_ty = self.body.store.value_ty(*value).deref(self.db.upcast());
+300                let value_expr = self.value_expr(*value);
+301                let key_expr = self.value_expr(*key);
+302                let key_ty = self.body.store.value_ty(*key);
+303                let ptr = self
+304                    .ctx
+305                    .runtime
+306                    .map_value_ptr(self.db, value_expr, key_expr, key_ty);
+307                let value_ty = match &map_ty.data(self.db.upcast()).kind {
+308                    TypeKind::Map(def) => def.value_ty,
+309                    _ => unreachable!(),
+310                };
+311
+312                self.assign_inst_result(inst, ptr, value_ty.make_sptr(self.db.upcast()));
+313            }
+314
+315            InstKind::Call {
+316                func,
+317                args,
+318                call_type,
+319            } => {
+320                let args: Vec<_> = args.iter().map(|arg| self.value_expr(*arg)).collect();
+321                let result = match call_type {
+322                    CallType::Internal => {
+323                        self.ctx.function_dependency.insert(*func);
+324                        let func_name = identifier! {(self.db.codegen_function_symbol_name(*func))};
+325                        expression! {[func_name]([args...])}
+326                    }
+327                    CallType::External => self.ctx.runtime.external_call(self.db, *func, args),
+328                };
+329                match self.db.codegen_legalized_signature(*func).return_type {
+330                    Some(mut result_ty) => {
+331                        if result_ty.is_aggregate(self.db.upcast())
+332                            | result_ty.is_string(self.db.upcast())
+333                        {
+334                            result_ty = result_ty.make_mptr(self.db.upcast());
+335                        }
+336                        self.assign_inst_result(inst, result, result_ty)
+337                    }
+338                    _ => self.sink.push(Statement::Expression(result)),
+339                }
+340            }
+341
+342            InstKind::Revert { arg } => match arg {
+343                Some(arg) => {
+344                    let arg_ty = self.body.store.value_ty(*arg);
+345                    let deref_ty = arg_ty.deref(self.db.upcast());
+346                    let ty_data = deref_ty.data(self.db.upcast());
+347                    let arg_expr = if deref_ty.is_zero_sized(self.db.upcast()) {
+348                        None
+349                    } else {
+350                        Some(self.value_expr(*arg))
+351                    };
+352                    let name = match &ty_data.kind {
+353                        ir::TypeKind::Struct(def) => &def.name,
+354                        ir::TypeKind::String(def) => "Error",
+355                        _ => "Panic",
+356                    };
+357                    self.sink.push(yul::Statement::Expression(
+358                        self.ctx.runtime.revert(self.db, arg_expr, name, arg_ty),
+359                    ));
+360                }
+361                None => self.sink.push(statement! {revert(0, 0)}),
+362            },
+363
+364            InstKind::Emit { arg } => {
+365                let event = self.value_expr(*arg);
+366                let event_ty = self.body.store.value_ty(*arg);
+367                let result = self.ctx.runtime.emit(self.db, event, event_ty);
+368                let u256_ty = yul_primitive_type(self.db);
+369                self.assign_inst_result(inst, result, u256_ty);
+370            }
+371
+372            InstKind::Return { arg } => {
+373                if let Some(arg) = arg {
+374                    let arg = self.value_expr(*arg);
+375                    let ret_value = self.ret_value.clone().unwrap();
+376                    self.sink.push(statement! {[ret_value] := [arg]});
+377                }
+378                self.sink.push(yul::Statement::Leave)
+379            }
+380
+381            InstKind::Keccak256 { arg } => {
+382                let result = self.keccak256(*arg);
+383                let u256_ty = yul_primitive_type(self.db);
+384                self.assign_inst_result(inst, result, u256_ty);
+385            }
+386
+387            InstKind::AbiEncode { arg } => {
+388                let lhs = self.body.store.inst_result(inst).unwrap();
+389                let ptr = self.lower_assignable_value(lhs);
+390                let ptr_ty = lhs.ty(self.db.upcast(), &self.body.store);
+391                let src_expr = self.value_expr(*arg);
+392                let src_ty = self.body.store.value_ty(*arg);
+393
+394                let abi_encode = self.ctx.runtime.abi_encode(
+395                    self.db,
+396                    src_expr,
+397                    ptr,
+398                    src_ty,
+399                    ptr_ty.is_sptr(self.db.upcast()),
+400                );
+401                self.sink.push(statement! {
+402                    pop([abi_encode])
+403                });
+404            }
+405
+406            InstKind::Create { value, contract } => {
+407                self.ctx.contract_dependency.insert(*contract);
+408
+409                let value_expr = self.value_expr(*value);
+410                let result = self.ctx.runtime.create(self.db, *contract, value_expr);
+411                let u256_ty = yul_primitive_type(self.db);
+412                self.assign_inst_result(inst, result, u256_ty)
+413            }
+414
+415            InstKind::Create2 {
+416                value,
+417                salt,
+418                contract,
+419            } => {
+420                self.ctx.contract_dependency.insert(*contract);
+421
+422                let value_expr = self.value_expr(*value);
+423                let salt_expr = self.value_expr(*salt);
+424                let result = self
+425                    .ctx
+426                    .runtime
+427                    .create2(self.db, *contract, value_expr, salt_expr);
+428                let u256_ty = yul_primitive_type(self.db);
+429                self.assign_inst_result(inst, result, u256_ty)
+430            }
+431
+432            InstKind::YulIntrinsic { op, args } => {
+433                let args: Vec<_> = args.iter().map(|arg| self.value_expr(*arg)).collect();
+434                let op_name = identifier! { (format!("{op}").strip_prefix("__").unwrap()) };
+435                let result = expression! { [op_name]([args...]) };
+436                // Intrinsic operation never returns ptr type, so we can use u256_ty as a dummy
+437                // type for the result.
+438                let u256_ty = yul_primitive_type(self.db);
+439                self.assign_inst_result(inst, result, u256_ty)
+440            }
+441
+442            InstKind::Nop => {}
+443
+444            // These flow control instructions are already legalized.
+445            InstKind::Jump { .. } | InstKind::Branch { .. } | InstKind::Switch { .. } => {
+446                unreachable!()
+447            }
+448        }
+449    }
+450
+451    fn lower_if(
+452        &mut self,
+453        cond: ValueId,
+454        then: Vec<StructuralInst>,
+455        else_: Vec<StructuralInst>,
+456    ) -> yul::Statement {
+457        let cond = self.value_expr(cond);
+458
+459        self.enter_scope();
+460        let then_body = self.lower_branch_body(then);
+461        self.leave_scope();
+462
+463        self.enter_scope();
+464        let else_body = self.lower_branch_body(else_);
+465        self.leave_scope();
+466
+467        switch! {
+468            switch ([cond])
+469            (case 1 {[then_body...]})
+470            (case 0 {[else_body...]})
+471        }
+472    }
+473
+474    fn lower_switch(
+475        &mut self,
+476        scrutinee: ValueId,
+477        table: Vec<(ValueId, Vec<StructuralInst>)>,
+478        default: Option<Vec<StructuralInst>>,
+479    ) -> yul::Statement {
+480        let scrutinee = self.value_expr(scrutinee);
+481
+482        let mut cases = vec![];
+483        for (value, insts) in table {
+484            let value = self.value_expr(value);
+485            let value = match value {
+486                yul::Expression::Literal(lit) => lit,
+487                _ => panic!("switch table values must be literal"),
+488            };
+489
+490            self.enter_scope();
+491            let body = self.lower_branch_body(insts);
+492            self.leave_scope();
+493            cases.push(yul::Case {
+494                literal: Some(value),
+495                block: block! { [body...] },
+496            })
+497        }
+498
+499        if let Some(insts) = default {
+500            let block = self.lower_branch_body(insts);
+501            cases.push(case! {
+502                default {[block...]}
+503            });
+504        }
+505
+506        switch! {
+507            switch ([scrutinee])
+508            [cases...]
+509        }
+510    }
+511
+512    fn lower_branch_body(&mut self, insts: Vec<StructuralInst>) -> Vec<yul::Statement> {
+513        let mut body = vec![];
+514        std::mem::swap(&mut self.sink, &mut body);
+515        for inst in insts {
+516            self.lower_structural_inst(inst);
+517        }
+518        std::mem::swap(&mut self.sink, &mut body);
+519        body
+520    }
+521
+522    fn lower_for(&mut self, body: Vec<StructuralInst>) -> yul::Statement {
+523        let mut body_stmts = vec![];
+524        std::mem::swap(&mut self.sink, &mut body_stmts);
+525        for inst in body {
+526            self.lower_structural_inst(inst);
+527        }
+528        std::mem::swap(&mut self.sink, &mut body_stmts);
+529
+530        block_statement! {(
+531            for {} (1) {}
+532            {
+533                [body_stmts...]
+534            }
+535        )}
+536    }
+537
+538    fn lower_assign(&mut self, lhs: &AssignableValue, rhs: ValueId) -> yul::Statement {
+539        match lhs {
+540            AssignableValue::Value(value) => {
+541                let lhs = self.value_ident(*value);
+542                let rhs = self.value_expr(rhs);
+543                statement! { [lhs] := [rhs] }
+544            }
+545            AssignableValue::Aggregate { .. } | AssignableValue::Map { .. } => {
+546                let dst_ty = lhs.ty(self.db.upcast(), &self.body.store);
+547                let src_ty = self.body.store.value_ty(rhs);
+548                debug_assert_eq!(
+549                    dst_ty.deref(self.db.upcast()),
+550                    src_ty.deref(self.db.upcast())
+551                );
+552
+553                let dst = self.lower_assignable_value(lhs);
+554                let src = self.value_expr(rhs);
+555
+556                if src_ty.is_ptr(self.db.upcast()) {
+557                    let ty_size = literal_expression! { (self.value_ty_size_deref(rhs)) };
+558
+559                    let expr = self.ctx.runtime.ptr_copy(
+560                        self.db,
+561                        src,
+562                        dst,
+563                        ty_size,
+564                        src_ty.is_sptr(self.db.upcast()),
+565                        dst_ty.is_sptr(self.db.upcast()),
+566                    );
+567                    yul::Statement::Expression(expr)
+568                } else {
+569                    let expr = self.ctx.runtime.ptr_store(self.db, dst, src, dst_ty);
+570                    yul::Statement::Expression(expr)
+571                }
+572            }
+573        }
+574    }
+575
+576    fn lower_unary(&mut self, op: UnOp, value: ValueId) -> yul::Expression {
+577        let value_expr = self.value_expr(value);
+578        match op {
+579            UnOp::Not => expression! { iszero([value_expr])},
+580            UnOp::Neg => {
+581                let zero = literal_expression! {0};
+582                if self.body.store.value_data(value).is_imm() {
+583                    // Literals are checked at compile time (e.g. -128) so there's no point
+584                    // in adding a runtime check.
+585                    expression! {sub([zero], [value_expr])}
+586                } else {
+587                    let value_ty = self.body.store.value_ty(value);
+588                    self.ctx
+589                        .runtime
+590                        .safe_sub(self.db, zero, value_expr, value_ty)
+591                }
+592            }
+593            UnOp::Inv => expression! { not([value_expr])},
+594        }
+595    }
+596
+597    fn lower_binary(
+598        &mut self,
+599        op: BinOp,
+600        lhs: ValueId,
+601        rhs: ValueId,
+602        inst: InstId,
+603    ) -> yul::Expression {
+604        let lhs_expr = self.value_expr(lhs);
+605        let rhs_expr = self.value_expr(rhs);
+606        let is_result_signed = self
+607            .body
+608            .store
+609            .inst_result(inst)
+610            .map(|val| {
+611                let ty = val.ty(self.db.upcast(), &self.body.store);
+612                ty.is_signed(self.db.upcast())
+613            })
+614            .unwrap_or(false);
+615        let is_lhs_signed = self.body.store.value_ty(lhs).is_signed(self.db.upcast());
+616
+617        let inst_result = self.body.store.inst_result(inst).unwrap();
+618        let inst_result_ty = inst_result
+619            .ty(self.db.upcast(), &self.body.store)
+620            .deref(self.db.upcast());
+621        match op {
+622            BinOp::Add => self
+623                .ctx
+624                .runtime
+625                .safe_add(self.db, lhs_expr, rhs_expr, inst_result_ty),
+626            BinOp::Sub => self
+627                .ctx
+628                .runtime
+629                .safe_sub(self.db, lhs_expr, rhs_expr, inst_result_ty),
+630            BinOp::Mul => self
+631                .ctx
+632                .runtime
+633                .safe_mul(self.db, lhs_expr, rhs_expr, inst_result_ty),
+634            BinOp::Div => self
+635                .ctx
+636                .runtime
+637                .safe_div(self.db, lhs_expr, rhs_expr, inst_result_ty),
+638            BinOp::Mod => self
+639                .ctx
+640                .runtime
+641                .safe_mod(self.db, lhs_expr, rhs_expr, inst_result_ty),
+642            BinOp::Pow => self
+643                .ctx
+644                .runtime
+645                .safe_pow(self.db, lhs_expr, rhs_expr, inst_result_ty),
+646            BinOp::Shl => expression! {shl([rhs_expr], [lhs_expr])},
+647            BinOp::Shr if is_result_signed => expression! {sar([rhs_expr], [lhs_expr])},
+648            BinOp::Shr => expression! {shr([rhs_expr], [lhs_expr])},
+649            BinOp::BitOr | BinOp::LogicalOr => expression! {or([lhs_expr], [rhs_expr])},
+650            BinOp::BitXor => expression! {xor([lhs_expr], [rhs_expr])},
+651            BinOp::BitAnd | BinOp::LogicalAnd => expression! {and([lhs_expr], [rhs_expr])},
+652            BinOp::Eq => expression! {eq([lhs_expr], [rhs_expr])},
+653            BinOp::Ne => expression! {iszero((eq([lhs_expr], [rhs_expr])))},
+654            BinOp::Ge if is_lhs_signed => expression! {iszero((slt([lhs_expr], [rhs_expr])))},
+655            BinOp::Ge => expression! {iszero((lt([lhs_expr], [rhs_expr])))},
+656            BinOp::Gt if is_lhs_signed => expression! {sgt([lhs_expr], [rhs_expr])},
+657            BinOp::Gt => expression! {gt([lhs_expr], [rhs_expr])},
+658            BinOp::Le if is_lhs_signed => expression! {iszero((sgt([lhs_expr], [rhs_expr])))},
+659            BinOp::Le => expression! {iszero((gt([lhs_expr], [rhs_expr])))},
+660            BinOp::Lt if is_lhs_signed => expression! {slt([lhs_expr], [rhs_expr])},
+661            BinOp::Lt => expression! {lt([lhs_expr], [rhs_expr])},
+662        }
+663    }
+664
+665    fn lower_cast(&mut self, value: ValueId, to: TypeId) -> yul::Expression {
+666        let from_ty = self.body.store.value_ty(value);
+667        debug_assert!(from_ty.is_primitive(self.db.upcast()));
+668        debug_assert!(to.is_primitive(self.db.upcast()));
+669
+670        let value = self.value_expr(value);
+671        self.ctx.runtime.primitive_cast(self.db, value, from_ty)
+672    }
+673
+674    fn assign_inst_result(&mut self, inst: InstId, rhs: yul::Expression, rhs_ty: TypeId) {
+675        // NOTE: We don't have `deref` feature yet, so need a heuristics for an
+676        // assignment.
+677        let stmt = if let Some(result) = self.body.store.inst_result(inst) {
+678            let lhs = self.lower_assignable_value(result);
+679            let lhs_ty = result.ty(self.db.upcast(), &self.body.store);
+680            match result {
+681                AssignableValue::Value(value) => {
+682                    match (
+683                        lhs_ty.is_ptr(self.db.upcast()),
+684                        rhs_ty.is_ptr(self.db.upcast()),
+685                    ) {
+686                        (true, true) => {
+687                            if lhs_ty.is_mptr(self.db.upcast()) == rhs_ty.is_mptr(self.db.upcast())
+688                            {
+689                                let rhs = self.extend_value(rhs, lhs_ty);
+690                                let lhs_ident = self.value_ident(*value);
+691                                statement! { [lhs_ident] := [rhs] }
+692                            } else {
+693                                let ty_size = rhs_ty
+694                                    .deref(self.db.upcast())
+695                                    .size_of(self.db.upcast(), SLOT_SIZE);
+696                                yul::Statement::Expression(self.ctx.runtime.ptr_copy(
+697                                    self.db,
+698                                    rhs,
+699                                    lhs,
+700                                    literal_expression! { (ty_size) },
+701                                    rhs_ty.is_sptr(self.db.upcast()),
+702                                    lhs_ty.is_sptr(self.db.upcast()),
+703                                ))
+704                            }
+705                        }
+706                        (true, false) => yul::Statement::Expression(
+707                            self.ctx.runtime.ptr_store(self.db, lhs, rhs, lhs_ty),
+708                        ),
+709
+710                        (false, true) => {
+711                            let rhs = self.ctx.runtime.ptr_load(self.db, rhs, rhs_ty);
+712                            let rhs = self.extend_value(rhs, lhs_ty);
+713                            let lhs_ident = self.value_ident(*value);
+714                            statement! { [lhs_ident] := [rhs] }
+715                        }
+716                        (false, false) => {
+717                            let rhs = self.extend_value(rhs, lhs_ty);
+718                            let lhs_ident = self.value_ident(*value);
+719                            statement! { [lhs_ident] := [rhs] }
+720                        }
+721                    }
+722                }
+723                AssignableValue::Aggregate { .. } | AssignableValue::Map { .. } => {
+724                    let expr = if rhs_ty.is_ptr(self.db.upcast()) {
+725                        let ty_size = rhs_ty
+726                            .deref(self.db.upcast())
+727                            .size_of(self.db.upcast(), SLOT_SIZE);
+728                        self.ctx.runtime.ptr_copy(
+729                            self.db,
+730                            rhs,
+731                            lhs,
+732                            literal_expression! { (ty_size) },
+733                            rhs_ty.is_sptr(self.db.upcast()),
+734                            lhs_ty.is_sptr(self.db.upcast()),
+735                        )
+736                    } else {
+737                        self.ctx.runtime.ptr_store(self.db, lhs, rhs, lhs_ty)
+738                    };
+739                    yul::Statement::Expression(expr)
+740                }
+741            }
+742        } else {
+743            yul::Statement::Expression(rhs)
+744        };
+745
+746        self.sink.push(stmt);
+747    }
+748
+749    /// Extend a value to 256 bits.
+750    fn extend_value(&mut self, value: yul::Expression, ty: TypeId) -> yul::Expression {
+751        if ty.is_primitive(self.db.upcast()) {
+752            self.ctx.runtime.primitive_cast(self.db, value, ty)
+753        } else {
+754            value
+755        }
+756    }
+757
+758    fn declare_assignable_value(&mut self, value: &AssignableValue) {
+759        match value {
+760            AssignableValue::Value(value) if !self.value_map.contains(*value) => {
+761                self.declare_value(*value);
+762            }
+763            _ => {}
+764        }
+765    }
+766
+767    fn declare_value(&mut self, value: ValueId) {
+768        let var = YulVariable::new(format!("$tmp_{}", value.index()));
+769        self.value_map.insert(value, var.ident());
+770        let value_ty = self.body.store.value_ty(value);
+771
+772        // Allocate memory for a value if a value is a pointer type.
+773        let init = if value_ty.is_mptr(self.db.upcast()) {
+774            let deref_ty = value_ty.deref(self.db.upcast());
+775            let ty_size = deref_ty.size_of(self.db.upcast(), SLOT_SIZE);
+776            let size = literal_expression! { (ty_size) };
+777            Some(self.ctx.runtime.alloc(self.db, size))
+778        } else {
+779            None
+780        };
+781
+782        self.sink.push(yul::Statement::VariableDeclaration(
+783            yul::VariableDeclaration {
+784                identifiers: vec![var.ident()],
+785                expression: init,
+786            },
+787        ))
+788    }
+789
+790    fn value_expr(&mut self, value: ValueId) -> yul::Expression {
+791        match self.body.store.value_data(value) {
+792            Value::Local(_) | Value::Temporary { .. } => {
+793                let ident = self.value_map.lookup(value).unwrap();
+794                literal_expression! {(ident)}
+795            }
+796            Value::Immediate { imm, .. } => {
+797                literal_expression! {(imm)}
+798            }
+799            Value::Constant { constant, .. } => match &constant.data(self.db.upcast()).value {
+800                ConstantValue::Immediate(imm) => {
+801                    // YUL does not support representing negative integers with leading minus (e.g.
+802                    // `-1` in YUL would lead to an ICE). To mitigate that we
+803                    // convert all numeric values into hexadecimal representation.
+804                    literal_expression! {(to_hex_str(imm))}
+805                }
+806                ConstantValue::Str(s) => {
+807                    self.ctx.string_constants.insert(s.to_string());
+808                    self.ctx.runtime.string_construct(self.db, s, s.len())
+809                }
+810                ConstantValue::Bool(true) => {
+811                    literal_expression! {1}
+812                }
+813                ConstantValue::Bool(false) => {
+814                    literal_expression! {0}
+815                }
+816            },
+817            Value::Unit { .. } => unreachable!(),
+818        }
+819    }
+820
+821    fn value_ident(&self, value: ValueId) -> yul::Identifier {
+822        self.value_map.lookup(value).unwrap().clone()
+823    }
+824
+825    fn make_tmp(&mut self, tmp: ValueId) -> yul::Identifier {
+826        let ident = YulVariable::new(format! {"$tmp_{}", tmp.index()}).ident();
+827        self.value_map.insert(tmp, ident.clone());
+828        ident
+829    }
+830
+831    fn keccak256(&mut self, value: ValueId) -> yul::Expression {
+832        let value_ty = self.body.store.value_ty(value);
+833        debug_assert!(value_ty.is_mptr(self.db.upcast()));
+834
+835        let value_size = value_ty
+836            .deref(self.db.upcast())
+837            .size_of(self.db.upcast(), SLOT_SIZE);
+838        let value_size_expr = literal_expression! {(value_size)};
+839        let value_expr = self.value_expr(value);
+840        expression! {keccak256([value_expr], [value_size_expr])}
+841    }
+842
+843    fn lower_assignable_value(&mut self, value: &AssignableValue) -> yul::Expression {
+844        match value {
+845            AssignableValue::Value(value) => self.value_expr(*value),
+846
+847            AssignableValue::Aggregate { lhs, idx } => {
+848                let base_ptr = self.lower_assignable_value(lhs);
+849                let ty = lhs
+850                    .ty(self.db.upcast(), &self.body.store)
+851                    .deref(self.db.upcast());
+852                self.aggregate_elem_ptr(base_ptr, *idx, ty)
+853            }
+854            AssignableValue::Map { lhs, key } => {
+855                let map_ptr = self.lower_assignable_value(lhs);
+856                let key_ty = self.body.store.value_ty(*key);
+857                let key = self.value_expr(*key);
+858                self.ctx
+859                    .runtime
+860                    .map_value_ptr(self.db, map_ptr, key, key_ty)
+861            }
+862        }
+863    }
+864
+865    fn aggregate_elem_ptr(
+866        &mut self,
+867        base_ptr: yul::Expression,
+868        idx: ValueId,
+869        base_ty: TypeId,
+870    ) -> yul::Expression {
+871        debug_assert!(base_ty.is_aggregate(self.db.upcast()));
+872
+873        match &base_ty.data(self.db.upcast()).kind {
+874            TypeKind::Array(def) => {
+875                let elem_size =
+876                    literal_expression! {(base_ty.array_elem_size(self.db.upcast(), SLOT_SIZE))};
+877                self.validate_array_indexing(def.len, idx);
+878                let idx = self.value_expr(idx);
+879                let offset = expression! {mul([elem_size], [idx])};
+880                expression! { add([base_ptr], [offset]) }
+881            }
+882            _ => {
+883                let elem_idx = match self.body.store.value_data(idx) {
+884                    Value::Immediate { imm, .. } => imm,
+885                    _ => panic!("only array type can use dynamic value indexing"),
+886                };
+887                let offset = literal_expression! {(base_ty.aggregate_elem_offset(self.db.upcast(), elem_idx.clone(), SLOT_SIZE))};
+888                expression! {add([base_ptr], [offset])}
+889            }
+890        }
+891    }
+892
+893    fn validate_array_indexing(&mut self, array_len: usize, idx: ValueId) {
+894        const PANIC_OUT_OF_BOUNDS: usize = 0x32;
+895
+896        if let Value::Immediate { .. } = self.body.store.value_data(idx) {
+897            return;
+898        }
+899
+900        let idx = self.value_expr(idx);
+901        let max_idx = literal_expression! {(array_len - 1)};
+902        self.sink.push(statement!(if (gt([idx], [max_idx])) {
+903            ([runtime::panic_revert_numeric(
+904                self.ctx.runtime.as_mut(),
+905                self.db,
+906                literal_expression! {(PANIC_OUT_OF_BOUNDS)},
+907            )])
+908        }));
+909    }
+910
+911    fn value_ty_size(&self, value: ValueId) -> usize {
+912        self.body
+913            .store
+914            .value_ty(value)
+915            .size_of(self.db.upcast(), SLOT_SIZE)
+916    }
+917
+918    fn value_ty_size_deref(&self, value: ValueId) -> usize {
+919        self.body
+920            .store
+921            .value_ty(value)
+922            .deref(self.db.upcast())
+923            .size_of(self.db.upcast(), SLOT_SIZE)
+924    }
+925
+926    fn enter_scope(&mut self) {
+927        let value_map = std::mem::take(&mut self.value_map);
+928        self.value_map = ScopedValueMap::with_parent(value_map);
+929    }
+930
+931    fn leave_scope(&mut self) {
+932        let value_map = std::mem::take(&mut self.value_map);
+933        self.value_map = value_map.into_parent();
+934    }
+935}
+936
+937#[derive(Debug, Default)]
+938struct ScopedValueMap {
+939    parent: Option<Box<ScopedValueMap>>,
+940    map: FxHashMap<ValueId, yul::Identifier>,
+941}
+942
+943impl ScopedValueMap {
+944    fn lookup(&self, value: ValueId) -> Option<&yul::Identifier> {
+945        match self.map.get(&value) {
+946            Some(ident) => Some(ident),
+947            None => self.parent.as_ref().and_then(|p| p.lookup(value)),
+948        }
+949    }
+950
+951    fn with_parent(parent: ScopedValueMap) -> Self {
+952        Self {
+953            parent: Some(parent.into()),
+954            ..Self::default()
+955        }
+956    }
+957
+958    fn into_parent(self) -> Self {
+959        *self.parent.unwrap()
+960    }
+961
+962    fn insert(&mut self, value: ValueId, ident: yul::Identifier) {
+963        self.map.insert(value, ident);
+964    }
+965
+966    fn contains(&self, value: ValueId) -> bool {
+967        self.lookup(value).is_some()
+968    }
+969}
+970
+971fn bit_mask(byte_size: usize) -> usize {
+972    (1 << (byte_size * 8)) - 1
+973}
+974
+975fn bit_mask_expr(byte_size: usize) -> yul::Expression {
+976    let mask = format!("{:#x}", bit_mask(byte_size));
+977    literal_expression! {(mask)}
+978}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/isel/inst_order.rs.html b/compiler-docs/src/fe_codegen/yul/isel/inst_order.rs.html new file mode 100644 index 0000000000..0dec08eae0 --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/isel/inst_order.rs.html @@ -0,0 +1,1368 @@ +inst_order.rs - source

fe_codegen/yul/isel/
inst_order.rs

1use fe_mir::{
+2    analysis::{
+3        domtree::DFSet, loop_tree::LoopId, post_domtree::PostIDom, ControlFlowGraph, DomTree,
+4        LoopTree, PostDomTree,
+5    },
+6    ir::{
+7        inst::{BranchInfo, SwitchTable},
+8        BasicBlockId, FunctionBody, InstId, ValueId,
+9    },
+10};
+11use indexmap::{IndexMap, IndexSet};
+12
+13#[derive(Debug, Clone)]
+14pub(super) enum StructuralInst {
+15    Inst(InstId),
+16    If {
+17        cond: ValueId,
+18        then: Vec<StructuralInst>,
+19        else_: Vec<StructuralInst>,
+20    },
+21
+22    Switch {
+23        scrutinee: ValueId,
+24        table: Vec<(ValueId, Vec<StructuralInst>)>,
+25        default: Option<Vec<StructuralInst>>,
+26    },
+27
+28    For {
+29        body: Vec<StructuralInst>,
+30    },
+31
+32    Break,
+33
+34    Continue,
+35}
+36
+37pub(super) struct InstSerializer<'a> {
+38    body: &'a FunctionBody,
+39    cfg: ControlFlowGraph,
+40    loop_tree: LoopTree,
+41    df: DFSet,
+42    domtree: DomTree,
+43    pd_tree: PostDomTree,
+44    scope: Option<Scope>,
+45}
+46
+47impl<'a> InstSerializer<'a> {
+48    pub(super) fn new(body: &'a FunctionBody) -> Self {
+49        let cfg = ControlFlowGraph::compute(body);
+50        let domtree = DomTree::compute(&cfg);
+51        let df = domtree.compute_df(&cfg);
+52        let pd_tree = PostDomTree::compute(body);
+53        let loop_tree = LoopTree::compute(&cfg, &domtree);
+54
+55        Self {
+56            body,
+57            cfg,
+58            loop_tree,
+59            df,
+60            domtree,
+61            pd_tree,
+62            scope: None,
+63        }
+64    }
+65
+66    pub(super) fn serialize(&mut self) -> Vec<StructuralInst> {
+67        self.scope = None;
+68        let entry = self.cfg.entry();
+69        let mut order = vec![];
+70        self.serialize_block(entry, &mut order);
+71        order
+72    }
+73
+74    fn serialize_block(&mut self, block: BasicBlockId, order: &mut Vec<StructuralInst>) {
+75        match self.loop_tree.loop_of_block(block) {
+76            Some(lp)
+77                if block == self.loop_tree.loop_header(lp)
+78                    && Some(block) != self.scope.as_ref().and_then(Scope::loop_header) =>
+79            {
+80                let loop_exit = self.find_loop_exit(lp);
+81                self.enter_loop_scope(lp, block, loop_exit);
+82                let mut body = vec![];
+83                self.serialize_block(block, &mut body);
+84                self.exit_scope();
+85                order.push(StructuralInst::For { body });
+86
+87                match loop_exit {
+88                    Some(exit)
+89                        if self
+90                            .scope
+91                            .as_ref()
+92                            .map(|scope| scope.branch_merge_block() != Some(exit))
+93                            .unwrap_or(true) =>
+94                    {
+95                        self.serialize_block(exit, order);
+96                    }
+97                    _ => {}
+98                }
+99
+100                return;
+101            }
+102            _ => {}
+103        };
+104
+105        for inst in self.body.order.iter_inst(block) {
+106            if self.body.store.is_terminator(inst) {
+107                break;
+108            }
+109            if !self.body.store.is_nop(inst) {
+110                order.push(StructuralInst::Inst(inst));
+111            }
+112        }
+113
+114        let terminator = self.body.order.terminator(&self.body.store, block).unwrap();
+115        match self.analyze_terminator(terminator) {
+116            TerminatorInfo::If {
+117                cond,
+118                then,
+119                else_,
+120                merge_block,
+121            } => self.serialize_if_terminator(cond, *then, *else_, merge_block, order),
+122
+123            TerminatorInfo::Switch {
+124                scrutinee,
+125                table,
+126                default,
+127                merge_block,
+128            } => self.serialize_switch_terminator(
+129                scrutinee,
+130                table,
+131                default.map(|value| *value),
+132                merge_block,
+133                order,
+134            ),
+135
+136            TerminatorInfo::ToMergeBlock => {}
+137            TerminatorInfo::Continue => order.push(StructuralInst::Continue),
+138            TerminatorInfo::Break => order.push(StructuralInst::Break),
+139            TerminatorInfo::FallThrough(next) => self.serialize_block(next, order),
+140            TerminatorInfo::NormalInst(inst) => order.push(StructuralInst::Inst(inst)),
+141        }
+142    }
+143
+144    fn serialize_if_terminator(
+145        &mut self,
+146        cond: ValueId,
+147        then: TerminatorInfo,
+148        else_: TerminatorInfo,
+149        merge_block: Option<BasicBlockId>,
+150        order: &mut Vec<StructuralInst>,
+151    ) {
+152        let mut then_body = vec![];
+153        let mut else_body = vec![];
+154
+155        self.enter_branch_scope(merge_block);
+156        self.serialize_branch_dest(then, &mut then_body, merge_block);
+157        self.serialize_branch_dest(else_, &mut else_body, merge_block);
+158        self.exit_scope();
+159
+160        order.push(StructuralInst::If {
+161            cond,
+162            then: then_body,
+163            else_: else_body,
+164        });
+165        if let Some(merge_block) = merge_block {
+166            self.serialize_block(merge_block, order);
+167        }
+168    }
+169
+170    fn serialize_switch_terminator(
+171        &mut self,
+172        scrutinee: ValueId,
+173        table: Vec<(ValueId, TerminatorInfo)>,
+174        default: Option<TerminatorInfo>,
+175        merge_block: Option<BasicBlockId>,
+176        order: &mut Vec<StructuralInst>,
+177    ) {
+178        self.enter_branch_scope(merge_block);
+179
+180        let mut serialized_table = Vec::with_capacity(table.len());
+181        for (value, dest) in table {
+182            let mut body = vec![];
+183            self.serialize_branch_dest(dest, &mut body, merge_block);
+184            serialized_table.push((value, body));
+185        }
+186
+187        let serialized_default = default.map(|dest| {
+188            let mut body = vec![];
+189            self.serialize_branch_dest(dest, &mut body, merge_block);
+190            body
+191        });
+192
+193        order.push(StructuralInst::Switch {
+194            scrutinee,
+195            table: serialized_table,
+196            default: serialized_default,
+197        });
+198
+199        self.exit_scope();
+200
+201        if let Some(merge_block) = merge_block {
+202            self.serialize_block(merge_block, order);
+203        }
+204    }
+205
+206    fn serialize_branch_dest(
+207        &mut self,
+208        dest: TerminatorInfo,
+209        body: &mut Vec<StructuralInst>,
+210        merge_block: Option<BasicBlockId>,
+211    ) {
+212        match dest {
+213            TerminatorInfo::Break => body.push(StructuralInst::Break),
+214            TerminatorInfo::Continue => body.push(StructuralInst::Continue),
+215            TerminatorInfo::ToMergeBlock => {}
+216            TerminatorInfo::FallThrough(dest) => {
+217                if Some(dest) != merge_block {
+218                    self.serialize_block(dest, body);
+219                }
+220            }
+221            _ => unreachable!(),
+222        };
+223    }
+224
+225    fn enter_loop_scope(&mut self, lp: LoopId, header: BasicBlockId, exit: Option<BasicBlockId>) {
+226        let kind = ScopeKind::Loop { lp, header, exit };
+227        let current_scope = std::mem::take(&mut self.scope);
+228        self.scope = Some(Scope {
+229            kind,
+230            parent: current_scope.map(Into::into),
+231        });
+232    }
+233
+234    fn enter_branch_scope(&mut self, merge_block: Option<BasicBlockId>) {
+235        let kind = ScopeKind::Branch { merge_block };
+236        let current_scope = std::mem::take(&mut self.scope);
+237        self.scope = Some(Scope {
+238            kind,
+239            parent: current_scope.map(Into::into),
+240        });
+241    }
+242
+243    fn exit_scope(&mut self) {
+244        let current_scope = std::mem::take(&mut self.scope);
+245        self.scope = current_scope.unwrap().parent.map(|parent| *parent);
+246    }
+247
+248    // NOTE: We assume loop has at most one canonical loop exit.
+249    fn find_loop_exit(&self, lp: LoopId) -> Option<BasicBlockId> {
+250        let mut exit_candidates = vec![];
+251        for block_in_loop in self.loop_tree.iter_blocks_post_order(&self.cfg, lp) {
+252            for &succ in self.cfg.succs(block_in_loop) {
+253                if !self.loop_tree.is_block_in_loop(succ, lp) {
+254                    exit_candidates.push(succ);
+255                }
+256            }
+257        }
+258
+259        if exit_candidates.is_empty() {
+260            return None;
+261        }
+262
+263        if exit_candidates.len() == 1 {
+264            let candidate = exit_candidates[0];
+265            let exit = if let Some(mut df) = self.df.frontiers(candidate) {
+266                debug_assert_eq!(self.df.frontier_num(candidate), 1);
+267                df.next()
+268            } else {
+269                Some(candidate)
+270            };
+271            return exit;
+272        }
+273
+274        // If a candidate is a dominance frontier of all other nodes, then the candidate
+275        // is a loop exit.
+276        for &cand in &exit_candidates {
+277            if exit_candidates.iter().all(|&block| {
+278                if block == cand {
+279                    true
+280                } else if let Some(mut df) = self.df.frontiers(block) {
+281                    df.any(|frontier| frontier == cand)
+282                } else {
+283                    true
+284                }
+285            }) {
+286                return Some(cand);
+287            }
+288        }
+289
+290        // If all candidates have the same dominance frontier, then the frontier block
+291        // is the canonicalized loop exit.
+292        let mut frontier: IndexSet<_> = self
+293            .df
+294            .frontiers(exit_candidates.pop().unwrap())
+295            .map(std::iter::Iterator::collect)
+296            .unwrap_or_default();
+297        for cand in exit_candidates {
+298            for cand_frontier in self.df.frontiers(cand).unwrap() {
+299                if !frontier.contains(&cand_frontier) {
+300                    frontier.remove(&cand_frontier);
+301                }
+302            }
+303        }
+304        debug_assert!(frontier.len() < 2);
+305        frontier.iter().next().copied()
+306    }
+307
+308    fn analyze_terminator(&self, inst: InstId) -> TerminatorInfo {
+309        debug_assert!(self.body.store.is_terminator(inst));
+310
+311        let inst_block = self.body.order.inst_block(inst);
+312        match self.body.store.branch_info(inst) {
+313            BranchInfo::Jump(dest) => self.analyze_jump(dest),
+314
+315            BranchInfo::Branch(cond, then, else_) => self.analyze_if(inst_block, cond, then, else_),
+316
+317            BranchInfo::Switch(scrutinee, table, default) => {
+318                self.analyze_switch(inst_block, scrutinee, table, default)
+319            }
+320
+321            BranchInfo::NotBranch => TerminatorInfo::NormalInst(inst),
+322        }
+323    }
+324
+325    fn analyze_if(
+326        &self,
+327        block: BasicBlockId,
+328        cond: ValueId,
+329        then_bb: BasicBlockId,
+330        else_bb: BasicBlockId,
+331    ) -> TerminatorInfo {
+332        let then = Box::new(self.analyze_dest(then_bb));
+333        let else_ = Box::new(self.analyze_dest(else_bb));
+334
+335        let then_cands = self.find_merge_block_candidates(block, then_bb);
+336        let else_cands = self.find_merge_block_candidates(block, else_bb);
+337        debug_assert!(then_cands.len() < 2);
+338        debug_assert!(else_cands.len() < 2);
+339
+340        let merge_block = match (then_cands.as_slice(), else_cands.as_slice()) {
+341            (&[then_cand], &[else_cand]) => {
+342                if then_cand == else_cand {
+343                    Some(then_cand)
+344                } else {
+345                    None
+346                }
+347            }
+348
+349            (&[cand], []) => {
+350                if cand == else_bb {
+351                    Some(cand)
+352                } else {
+353                    None
+354                }
+355            }
+356
+357            ([], &[cand]) => {
+358                if cand == then_bb {
+359                    Some(cand)
+360                } else {
+361                    None
+362                }
+363            }
+364
+365            ([], []) => match self.pd_tree.post_idom(block) {
+366                PostIDom::Block(block) => {
+367                    if let Some(lp) = self.scope.as_ref().and_then(Scope::loop_recursive) {
+368                        if self.loop_tree.is_block_in_loop(block, lp) {
+369                            Some(block)
+370                        } else {
+371                            None
+372                        }
+373                    } else {
+374                        Some(block)
+375                    }
+376                }
+377                _ => None,
+378            },
+379
+380            (_, _) => unreachable!(),
+381        };
+382
+383        TerminatorInfo::If {
+384            cond,
+385            then,
+386            else_,
+387            merge_block,
+388        }
+389    }
+390
+391    fn analyze_switch(
+392        &self,
+393        block: BasicBlockId,
+394        scrutinee: ValueId,
+395        table: &SwitchTable,
+396        default: Option<BasicBlockId>,
+397    ) -> TerminatorInfo {
+398        let mut analyzed_table = Vec::with_capacity(table.len());
+399
+400        let mut merge_block_cands = IndexSet::default();
+401        for (value, dest) in table.iter() {
+402            analyzed_table.push((value, self.analyze_dest(dest)));
+403            merge_block_cands.extend(self.find_merge_block_candidates(block, dest));
+404        }
+405
+406        let analyzed_default = default.map(|dest| {
+407            merge_block_cands.extend(self.find_merge_block_candidates(block, dest));
+408            Box::new(self.analyze_dest(dest))
+409        });
+410
+411        TerminatorInfo::Switch {
+412            scrutinee,
+413            table: analyzed_table,
+414            default: analyzed_default,
+415            merge_block: self.select_switch_merge_block(
+416                &merge_block_cands,
+417                table.iter().map(|(_, d)| d).chain(default),
+418            ),
+419        }
+420    }
+421
+422    fn find_merge_block_candidates(
+423        &self,
+424        branch_inst_bb: BasicBlockId,
+425        branch_dest_bb: BasicBlockId,
+426    ) -> Vec<BasicBlockId> {
+427        if self.domtree.dominates(branch_dest_bb, branch_inst_bb) {
+428            return vec![];
+429        }
+430
+431        // a block `cand` can be a candidate of a `merge` block iff
+432        // 1. `cand` is a dominance frontier of `branch_dest_bb`.
+433        // 2. `cand` is NOT a dominator of `branch_dest_bb`.
+434        // 3. `cand` is NOT a "merge" block of parent `if` or `switch`.
+435        // 4. `cand` is NOT a "loop_exit" block of parent `loop`.
+436        match self.df.frontiers(branch_dest_bb) {
+437            Some(cands) => cands
+438                .filter(|cand| {
+439                    !self.domtree.dominates(*cand, branch_dest_bb)
+440                        && Some(*cand)
+441                            != self
+442                                .scope
+443                                .as_ref()
+444                                .and_then(Scope::branch_merge_block_recursive)
+445                        && Some(*cand) != self.scope.as_ref().and_then(Scope::loop_exit_recursive)
+446                })
+447                .collect(),
+448            None => vec![],
+449        }
+450    }
+451
+452    /// Each destination block of `switch` instruction could have multiple
+453    /// candidates for the merge block because arm bodies can have multiple
+454    /// predecessors, e.g., `default` arm.
+455    /// So we need a heuristic to select the merge block from candidates.
+456    ///
+457    /// First, if one of the dominance frontiers of switch dests is a parent
+458    /// merge block, then we stop searching the merge block because the parent
+459    /// merge block should be the subsequent codes after the switch in terms of
+460    /// high-level flow structure like Fe or yul.
+461    ///
+462    /// If no parent merge block is found, we start scoring the candidates by
+463    /// the following function.
+464    ///
+465    /// The scoring function `F` is defined as follows:
+466    /// 1. The initial score of each candidate('cand_bb`) is number of
+467    /// predecessors of the candidate.
+468    ///
+469    /// 2. Find the `top_cand` of each `cand_bb`. `top_cand` can be found by
+470    /// [`Self::try_find_top_cand`] method, see the method for details.
+471    ///
+472    /// 3. If `top_cand` is found, then add the `cand_bb` score to the
+473    /// `top_cand` score, then set 0 to the `cand_bb` score.
+474    ///
+475    /// After the scoring, the candidates with the highest score will be
+476    /// selected.
+477    fn select_switch_merge_block(
+478        &self,
+479        cands: &IndexSet<BasicBlockId>,
+480        dests: impl Iterator<Item = BasicBlockId>,
+481    ) -> Option<BasicBlockId> {
+482        let parent_merge = self
+483            .scope
+484            .as_ref()
+485            .and_then(Scope::branch_merge_block_recursive);
+486        for dest in dests {
+487            if self
+488                .df
+489                .frontiers(dest)
+490                .map(|mut frontieres| frontieres.any(|frontier| Some(frontier) == parent_merge))
+491                .unwrap_or_default()
+492            {
+493                return None;
+494            }
+495        }
+496
+497        let mut cands_with_score = cands
+498            .iter()
+499            .map(|cand| (*cand, self.cfg.preds(*cand).len()))
+500            .collect::<IndexMap<_, _>>();
+501
+502        for cand_bb in cands_with_score.keys().copied().collect::<Vec<_>>() {
+503            if let Some(top_cand) = self.try_find_top_cand(&cands_with_score, cand_bb) {
+504                let score = std::mem::take(cands_with_score.get_mut(&cand_bb).unwrap());
+505                *cands_with_score.get_mut(&top_cand).unwrap() += score;
+506            }
+507        }
+508
+509        cands_with_score
+510            .iter()
+511            .max_by_key(|(_, score)| *score)
+512            .map(|(&cand, _)| cand)
+513    }
+514
+515    /// Try to find the `top_cand` of the `cand_bb`.
+516    /// A `top_cand` can be found by the following rules:
+517    ///
+518    /// 1. Find the block which is contained in DF of `cand_bb` and in
+519    /// `cands_with_score`.
+520    ///
+521    /// 2. If a block is found in 1., and the score of the block is positive,
+522    /// then the block is `top_cand`.
+523    ///
+524    /// 2'. If a block is found in 1., and the score of the block is 0, then the
+525    /// `top_cand` of the block is `top_cand` of `cand_bb`.
+526    ///
+527    /// 2''. If a block is NOT found in 1., then there is no `top_cand` for
+528    /// `cand_bb`.
+529    fn try_find_top_cand(
+530        &self,
+531        cands_with_score: &IndexMap<BasicBlockId, usize>,
+532        cand_bb: BasicBlockId,
+533    ) -> Option<BasicBlockId> {
+534        let mut frontiers = match self.df.frontiers(cand_bb) {
+535            Some(frontiers) => frontiers,
+536            _ => return None,
+537        };
+538
+539        while let Some(frontier_bb) = frontiers.next() {
+540            if cands_with_score.contains_key(&frontier_bb) {
+541                debug_assert!(frontiers.all(|bb| !cands_with_score.contains_key(&bb)));
+542                if cands_with_score[&frontier_bb] != 0 {
+543                    return Some(frontier_bb);
+544                } else {
+545                    return self.try_find_top_cand(cands_with_score, frontier_bb);
+546                }
+547            }
+548        }
+549
+550        None
+551    }
+552
+553    fn analyze_jump(&self, dest: BasicBlockId) -> TerminatorInfo {
+554        self.analyze_dest(dest)
+555    }
+556
+557    fn analyze_dest(&self, dest: BasicBlockId) -> TerminatorInfo {
+558        match &self.scope {
+559            Some(scope) => {
+560                if Some(dest) == scope.loop_header_recursive() {
+561                    TerminatorInfo::Continue
+562                } else if Some(dest) == scope.loop_exit_recursive() {
+563                    TerminatorInfo::Break
+564                } else if Some(dest) == scope.branch_merge_block_recursive() {
+565                    TerminatorInfo::ToMergeBlock
+566                } else {
+567                    TerminatorInfo::FallThrough(dest)
+568                }
+569            }
+570
+571            None => TerminatorInfo::FallThrough(dest),
+572        }
+573    }
+574}
+575
+576struct Scope {
+577    kind: ScopeKind,
+578    parent: Option<Box<Scope>>,
+579}
+580
+581#[derive(Debug, Clone, Copy)]
+582enum ScopeKind {
+583    Loop {
+584        lp: LoopId,
+585        header: BasicBlockId,
+586        exit: Option<BasicBlockId>,
+587    },
+588    Branch {
+589        merge_block: Option<BasicBlockId>,
+590    },
+591}
+592
+593impl Scope {
+594    fn loop_recursive(&self) -> Option<LoopId> {
+595        match self.kind {
+596            ScopeKind::Loop { lp, .. } => Some(lp),
+597            _ => self.parent.as_ref()?.loop_recursive(),
+598        }
+599    }
+600
+601    fn loop_header(&self) -> Option<BasicBlockId> {
+602        match self.kind {
+603            ScopeKind::Loop { header, .. } => Some(header),
+604            _ => None,
+605        }
+606    }
+607
+608    fn loop_header_recursive(&self) -> Option<BasicBlockId> {
+609        match self.kind {
+610            ScopeKind::Loop { header, .. } => Some(header),
+611            _ => self.parent.as_ref()?.loop_header_recursive(),
+612        }
+613    }
+614
+615    fn loop_exit_recursive(&self) -> Option<BasicBlockId> {
+616        match self.kind {
+617            ScopeKind::Loop { exit, .. } => exit,
+618            _ => self.parent.as_ref()?.loop_exit_recursive(),
+619        }
+620    }
+621
+622    fn branch_merge_block(&self) -> Option<BasicBlockId> {
+623        match self.kind {
+624            ScopeKind::Branch { merge_block } => merge_block,
+625            _ => None,
+626        }
+627    }
+628
+629    fn branch_merge_block_recursive(&self) -> Option<BasicBlockId> {
+630        match self.kind {
+631            ScopeKind::Branch {
+632                merge_block: Some(merge_block),
+633            } => Some(merge_block),
+634            _ => self.parent.as_ref()?.branch_merge_block_recursive(),
+635        }
+636    }
+637}
+638
+639#[derive(Debug, Clone)]
+640enum TerminatorInfo {
+641    If {
+642        cond: ValueId,
+643        then: Box<TerminatorInfo>,
+644        else_: Box<TerminatorInfo>,
+645        merge_block: Option<BasicBlockId>,
+646    },
+647
+648    Switch {
+649        scrutinee: ValueId,
+650        table: Vec<(ValueId, TerminatorInfo)>,
+651        default: Option<Box<TerminatorInfo>>,
+652        merge_block: Option<BasicBlockId>,
+653    },
+654
+655    ToMergeBlock,
+656    Continue,
+657    Break,
+658    FallThrough(BasicBlockId),
+659    NormalInst(InstId),
+660}
+661
+662#[cfg(test)]
+663mod tests {
+664    use fe_mir::ir::{body_builder::BodyBuilder, inst::InstKind, FunctionId, SourceInfo, TypeId};
+665
+666    use super::*;
+667
+668    fn body_builder() -> BodyBuilder {
+669        BodyBuilder::new(FunctionId(0), SourceInfo::dummy())
+670    }
+671
+672    fn serialize_func_body(func: &mut FunctionBody) -> impl Iterator<Item = StructuralInst> {
+673        InstSerializer::new(func).serialize().into_iter()
+674    }
+675
+676    fn expect_if(
+677        insts: &mut impl Iterator<Item = StructuralInst>,
+678    ) -> (
+679        impl Iterator<Item = StructuralInst>,
+680        impl Iterator<Item = StructuralInst>,
+681    ) {
+682        match insts.next().unwrap() {
+683            StructuralInst::If { then, else_, .. } => (then.into_iter(), else_.into_iter()),
+684            _ => panic!("expect if inst"),
+685        }
+686    }
+687
+688    fn expect_switch(
+689        insts: &mut impl Iterator<Item = StructuralInst>,
+690    ) -> Vec<impl Iterator<Item = StructuralInst>> {
+691        match insts.next().unwrap() {
+692            StructuralInst::Switch { table, default, .. } => {
+693                let mut arms: Vec<_> = table
+694                    .into_iter()
+695                    .map(|(_, insts)| insts.into_iter())
+696                    .collect();
+697                if let Some(default) = default {
+698                    arms.push(default.into_iter());
+699                }
+700
+701                arms
+702            }
+703
+704            _ => panic!("expect if inst"),
+705        }
+706    }
+707
+708    fn expect_for(
+709        insts: &mut impl Iterator<Item = StructuralInst>,
+710    ) -> impl Iterator<Item = StructuralInst> {
+711        match insts.next().unwrap() {
+712            StructuralInst::For { body } => body.into_iter(),
+713            _ => panic!("expect if inst"),
+714        }
+715    }
+716
+717    fn expect_break(insts: &mut impl Iterator<Item = StructuralInst>) {
+718        assert!(matches!(insts.next().unwrap(), StructuralInst::Break))
+719    }
+720
+721    fn expect_continue(insts: &mut impl Iterator<Item = StructuralInst>) {
+722        assert!(matches!(insts.next().unwrap(), StructuralInst::Continue))
+723    }
+724
+725    fn expect_return(func: &FunctionBody, insts: &mut impl Iterator<Item = StructuralInst>) {
+726        let inst = insts.next().unwrap();
+727        match inst {
+728            StructuralInst::Inst(inst) => {
+729                assert!(matches!(
+730                    func.store.inst_data(inst).kind,
+731                    InstKind::Return { .. }
+732                ))
+733            }
+734            _ => panic!("expect return"),
+735        }
+736    }
+737
+738    fn expect_end(insts: &mut impl Iterator<Item = StructuralInst>) {
+739        assert!(insts.next().is_none())
+740    }
+741
+742    #[test]
+743    fn if_non_merge() {
+744        // +------+     +-------+
+745        // | then | <-- |  bb0  |
+746        // +------+     +-------+
+747        //                |
+748        //                |
+749        //                v
+750        //              +-------+
+751        //              | else_ |
+752        //              +-------+
+753        let mut builder = body_builder();
+754
+755        let then = builder.make_block();
+756        let else_ = builder.make_block();
+757
+758        let dummy_ty = TypeId(0);
+759        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+760        let unit = builder.make_unit(dummy_ty);
+761
+762        builder.branch(v0, then, else_, SourceInfo::dummy());
+763
+764        builder.move_to_block(then);
+765        builder.ret(unit, SourceInfo::dummy());
+766
+767        builder.move_to_block(else_);
+768        builder.ret(unit, SourceInfo::dummy());
+769
+770        let mut func = builder.build();
+771        let mut order = serialize_func_body(&mut func);
+772
+773        let (mut then, mut else_) = expect_if(&mut order);
+774        expect_return(&func, &mut then);
+775        expect_end(&mut then);
+776        expect_return(&func, &mut else_);
+777        expect_end(&mut else_);
+778
+779        expect_end(&mut order);
+780    }
+781
+782    #[test]
+783    fn if_merge() {
+784        // +------+     +-------+
+785        // | then | <-- |  bb0  |
+786        // +------+     +-------+
+787        //   |            |
+788        //   |            |
+789        //   |            v
+790        //   |          +-------+
+791        //   |          | else_ |
+792        //   |          +-------+
+793        //   |            |
+794        //   |            |
+795        //   |            v
+796        //   |          +-------+
+797        //   +--------> | merge |
+798        //              +-------+
+799        let mut builder = body_builder();
+800
+801        let then = builder.make_block();
+802        let else_ = builder.make_block();
+803        let merge = builder.make_block();
+804
+805        let dummy_ty = TypeId(0);
+806        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+807        let unit = builder.make_unit(dummy_ty);
+808
+809        builder.branch(v0, then, else_, SourceInfo::dummy());
+810
+811        builder.move_to_block(then);
+812        builder.jump(merge, SourceInfo::dummy());
+813
+814        builder.move_to_block(else_);
+815        builder.jump(merge, SourceInfo::dummy());
+816
+817        builder.move_to_block(merge);
+818        builder.ret(unit, SourceInfo::dummy());
+819
+820        let mut func = builder.build();
+821        let mut order = serialize_func_body(&mut func);
+822
+823        let (mut then, mut else_) = expect_if(&mut order);
+824        expect_end(&mut then);
+825        expect_end(&mut else_);
+826
+827        expect_return(&func, &mut order);
+828        expect_end(&mut order);
+829    }
+830
+831    #[test]
+832    fn nested_if() {
+833        //             +-----+
+834        //             | bb0 | -+
+835        //             +-----+  |
+836        //               |      |
+837        //               |      |
+838        //               v      |
+839        // +-----+     +-----+  |
+840        // | bb3 | <-- | bb1 |  |
+841        // +-----+     +-----+  |
+842        //               |      |
+843        //               |      |
+844        //               v      |
+845        //             +-----+  |
+846        //             | bb4 |  |
+847        //             +-----+  |
+848        //               |      |
+849        //               |      |
+850        //               v      |
+851        //             +-----+  |
+852        //             | bb2 | <+
+853        //             +-----+
+854        let mut builder = body_builder();
+855
+856        let bb1 = builder.make_block();
+857        let bb2 = builder.make_block();
+858        let bb3 = builder.make_block();
+859        let bb4 = builder.make_block();
+860
+861        let dummy_ty = TypeId(0);
+862        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+863        let unit = builder.make_unit(dummy_ty);
+864
+865        builder.branch(v0, bb1, bb2, SourceInfo::dummy());
+866
+867        builder.move_to_block(bb1);
+868        builder.branch(v0, bb3, bb4, SourceInfo::dummy());
+869
+870        builder.move_to_block(bb3);
+871        builder.ret(unit, SourceInfo::dummy());
+872
+873        builder.move_to_block(bb4);
+874        builder.jump(bb2, SourceInfo::dummy());
+875
+876        builder.move_to_block(bb2);
+877        builder.ret(unit, SourceInfo::dummy());
+878
+879        let mut func = builder.build();
+880        let mut order = serialize_func_body(&mut func);
+881
+882        let (mut then1, mut else2) = expect_if(&mut order);
+883        expect_end(&mut else2);
+884
+885        let (mut then3, mut else4) = expect_if(&mut then1);
+886        expect_end(&mut then1);
+887        expect_return(&func, &mut then3);
+888        expect_end(&mut then3);
+889        expect_end(&mut else4);
+890
+891        expect_return(&func, &mut order);
+892        expect_end(&mut order);
+893    }
+894
+895    #[test]
+896    fn simple_loop() {
+897        //    +--------+
+898        //    |  bb0   | -+
+899        //    +--------+  |
+900        //      |         |
+901        //      |         |
+902        //      v         |
+903        //    +--------+  |
+904        // +> | header |  |
+905        // |  +--------+  |
+906        // |    |         |
+907        // |    |         |
+908        // |    v         |
+909        // |  +--------+  |
+910        // +- | latch  |  |
+911        //    +--------+  |
+912        //      |         |
+913        //      |         |
+914        //      v         |
+915        //    +--------+  |
+916        //    |  exit  | <+
+917        //    +--------+
+918        let mut builder = body_builder();
+919
+920        let header = builder.make_block();
+921        let latch = builder.make_block();
+922        let exit = builder.make_block();
+923
+924        let dummy_ty = TypeId(0);
+925        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+926        let unit = builder.make_unit(dummy_ty);
+927
+928        builder.branch(v0, header, exit, SourceInfo::dummy());
+929
+930        builder.move_to_block(header);
+931        builder.jump(latch, SourceInfo::dummy());
+932
+933        builder.move_to_block(latch);
+934        builder.branch(v0, header, exit, SourceInfo::dummy());
+935
+936        builder.move_to_block(exit);
+937        builder.ret(unit, SourceInfo::dummy());
+938
+939        let mut func = builder.build();
+940        let mut order = serialize_func_body(&mut func);
+941
+942        let (mut lp, mut empty) = expect_if(&mut order);
+943
+944        let mut body = expect_for(&mut lp);
+945        let (mut continue_, mut break_) = expect_if(&mut body);
+946        expect_end(&mut body);
+947
+948        expect_continue(&mut continue_);
+949        expect_end(&mut continue_);
+950
+951        expect_break(&mut break_);
+952        expect_end(&mut break_);
+953
+954        expect_end(&mut empty);
+955
+956        expect_return(&func, &mut order);
+957        expect_end(&mut order);
+958    }
+959
+960    #[test]
+961    fn loop_with_continue() {
+962        //    +-----+
+963        // +- | bb0 |
+964        // |  +-----+
+965        // |    |
+966        // |    |
+967        // |    v
+968        // |  +---------------+     +-----+
+969        // |  |      bb1      | --> | bb3 |
+970        // |  +---------------+     +-----+
+971        // |    |      ^    ^         |
+972        // |    |      |    +---------+
+973        // |    v      |
+974        // |  +-----+  |
+975        // |  | bb4 | -+
+976        // |  +-----+
+977        // |    |
+978        // |    |
+979        // |    v
+980        // |  +-----+
+981        // +> | bb2 |
+982        //    +-----+
+983        let mut builder = body_builder();
+984
+985        let bb1 = builder.make_block();
+986        let bb2 = builder.make_block();
+987        let bb3 = builder.make_block();
+988        let bb4 = builder.make_block();
+989
+990        let dummy_ty = TypeId(0);
+991        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+992        let unit = builder.make_unit(dummy_ty);
+993
+994        builder.branch(v0, bb1, bb2, SourceInfo::dummy());
+995
+996        builder.move_to_block(bb1);
+997        builder.branch(v0, bb3, bb4, SourceInfo::dummy());
+998
+999        builder.move_to_block(bb3);
+1000        builder.jump(bb1, SourceInfo::dummy());
+1001
+1002        builder.move_to_block(bb4);
+1003        builder.branch(v0, bb1, bb2, SourceInfo::dummy());
+1004
+1005        builder.move_to_block(bb2);
+1006        builder.ret(unit, SourceInfo::dummy());
+1007
+1008        let mut func = builder.build();
+1009        let mut order = serialize_func_body(&mut func);
+1010
+1011        let (mut lp, mut empty) = expect_if(&mut order);
+1012        expect_end(&mut empty);
+1013
+1014        let mut body = expect_for(&mut lp);
+1015
+1016        let (mut continue_, mut empty) = expect_if(&mut body);
+1017        expect_continue(&mut continue_);
+1018        expect_end(&mut continue_);
+1019        expect_end(&mut empty);
+1020
+1021        let (mut continue_, mut break_) = expect_if(&mut body);
+1022        expect_continue(&mut continue_);
+1023        expect_end(&mut continue_);
+1024        expect_break(&mut break_);
+1025        expect_end(&mut break_);
+1026
+1027        expect_end(&mut body);
+1028        expect_end(&mut lp);
+1029
+1030        expect_return(&func, &mut order);
+1031        expect_end(&mut order);
+1032    }
+1033
+1034    #[test]
+1035    fn loop_with_break() {
+1036        //    +-----+
+1037        // +- | bb0 |
+1038        // |  +-----+
+1039        // |    |
+1040        // |    |           +---------+
+1041        // |    v           v         |
+1042        // |  +---------------+     +-----+
+1043        // |  |      bb1      | --> | bb4 |
+1044        // |  +---------------+     +-----+
+1045        // |    |                     |
+1046        // |    |                     |
+1047        // |    v                     |
+1048        // |  +-----+                 |
+1049        // |  | bb3 |                 |
+1050        // |  +-----+                 |
+1051        // |    |                     |
+1052        // |    |                     |
+1053        // |    v                     |
+1054        // |  +-----+                 |
+1055        // +> | bb2 | <---------------+
+1056        //    +-----+
+1057        let mut builder = body_builder();
+1058
+1059        let bb1 = builder.make_block();
+1060        let bb2 = builder.make_block();
+1061        let bb3 = builder.make_block();
+1062        let bb4 = builder.make_block();
+1063
+1064        let dummy_ty = TypeId(0);
+1065        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+1066        let unit = builder.make_unit(dummy_ty);
+1067
+1068        builder.branch(v0, bb1, bb2, SourceInfo::dummy());
+1069
+1070        builder.move_to_block(bb1);
+1071        builder.branch(v0, bb3, bb4, SourceInfo::dummy());
+1072
+1073        builder.move_to_block(bb3);
+1074        builder.jump(bb2, SourceInfo::dummy());
+1075
+1076        builder.move_to_block(bb4);
+1077        builder.branch(v0, bb1, bb2, SourceInfo::dummy());
+1078
+1079        builder.move_to_block(bb2);
+1080        builder.ret(unit, SourceInfo::dummy());
+1081
+1082        let mut func = builder.build();
+1083        let mut order = serialize_func_body(&mut func);
+1084
+1085        let (mut lp, mut empty) = expect_if(&mut order);
+1086        expect_end(&mut empty);
+1087
+1088        let mut body = expect_for(&mut lp);
+1089
+1090        let (mut break_, mut latch) = expect_if(&mut body);
+1091        expect_break(&mut break_);
+1092        expect_end(&mut break_);
+1093
+1094        let (mut continue_, mut break_) = expect_if(&mut latch);
+1095        expect_end(&mut latch);
+1096        expect_continue(&mut continue_);
+1097        expect_end(&mut continue_);
+1098        expect_break(&mut break_);
+1099        expect_end(&mut break_);
+1100
+1101        expect_end(&mut body);
+1102        expect_end(&mut lp);
+1103
+1104        expect_return(&func, &mut order);
+1105        expect_end(&mut order);
+1106    }
+1107
+1108    #[test]
+1109    fn loop_no_guard() {
+1110        // +-----+
+1111        // | bb0 |
+1112        // +-----+
+1113        //   |
+1114        //   |
+1115        //   v
+1116        // +-----+
+1117        // | bb1 | <+
+1118        // +-----+  |
+1119        //   |      |
+1120        //   |      |
+1121        //   v      |
+1122        // +-----+  |
+1123        // | bb2 | -+
+1124        // +-----+
+1125        //   |
+1126        //   |
+1127        //   v
+1128        // +-----+
+1129        // | bb3 |
+1130        // +-----+
+1131        let mut builder = body_builder();
+1132
+1133        let bb1 = builder.make_block();
+1134        let bb2 = builder.make_block();
+1135        let bb3 = builder.make_block();
+1136
+1137        let dummy_ty = TypeId(0);
+1138        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+1139        let unit = builder.make_unit(dummy_ty);
+1140
+1141        builder.jump(bb1, SourceInfo::dummy());
+1142
+1143        builder.move_to_block(bb1);
+1144        builder.jump(bb2, SourceInfo::dummy());
+1145
+1146        builder.move_to_block(bb2);
+1147        builder.branch(v0, bb1, bb3, SourceInfo::dummy());
+1148
+1149        builder.move_to_block(bb3);
+1150        builder.ret(unit, SourceInfo::dummy());
+1151
+1152        let mut func = builder.build();
+1153        let mut order = serialize_func_body(&mut func);
+1154
+1155        let mut body = expect_for(&mut order);
+1156        let (mut continue_, mut break_) = expect_if(&mut body);
+1157        expect_end(&mut body);
+1158
+1159        expect_continue(&mut continue_);
+1160        expect_end(&mut continue_);
+1161
+1162        expect_break(&mut break_);
+1163        expect_end(&mut break_);
+1164
+1165        expect_return(&func, &mut order);
+1166        expect_end(&mut order);
+1167    }
+1168
+1169    #[test]
+1170    fn infinite_loop() {
+1171        // +-----+
+1172        // | bb0 |
+1173        // +-----+
+1174        //   |
+1175        //   |
+1176        //   v
+1177        // +-----+
+1178        // | bb1 | <+
+1179        // +-----+  |
+1180        //   |      |
+1181        //   |      |
+1182        //   v      |
+1183        // +-----+  |
+1184        // | bb2 | -+
+1185        // +-----+
+1186        let mut builder = body_builder();
+1187
+1188        let bb1 = builder.make_block();
+1189        let bb2 = builder.make_block();
+1190
+1191        builder.jump(bb1, SourceInfo::dummy());
+1192
+1193        builder.move_to_block(bb1);
+1194        builder.jump(bb2, SourceInfo::dummy());
+1195
+1196        builder.move_to_block(bb2);
+1197        builder.jump(bb1, SourceInfo::dummy());
+1198
+1199        let mut func = builder.build();
+1200        let mut order = serialize_func_body(&mut func);
+1201
+1202        let mut body = expect_for(&mut order);
+1203        expect_continue(&mut body);
+1204        expect_end(&mut body);
+1205
+1206        expect_end(&mut order);
+1207    }
+1208
+1209    #[test]
+1210    fn switch_basic() {
+1211        // +-----+     +-------+     +-----+
+1212        // | bb2 | <-- |  bb0  | --> | bb3 |
+1213        // +-----+     +-------+     +-----+
+1214        //   |           |             |
+1215        //   |           |             |
+1216        //   |           v             |
+1217        //   |         +-------+       |
+1218        //   |         |  bb1  |       |
+1219        //   |         +-------+       |
+1220        //   |           |             |
+1221        //   |           |             |
+1222        //   |           v             |
+1223        //   |         +-------+       |
+1224        //   +-------> | merge | <-----+
+1225        //             +-------+
+1226        let mut builder = body_builder();
+1227        let dummy_ty = TypeId(0);
+1228        let dummy_value = builder.make_unit(dummy_ty);
+1229
+1230        let bb1 = builder.make_block();
+1231        let bb2 = builder.make_block();
+1232        let bb3 = builder.make_block();
+1233        let merge = builder.make_block();
+1234
+1235        let mut table = SwitchTable::default();
+1236        table.add_arm(dummy_value, bb1);
+1237        table.add_arm(dummy_value, bb2);
+1238        table.add_arm(dummy_value, bb3);
+1239        builder.switch(dummy_value, table, None, SourceInfo::dummy());
+1240
+1241        builder.move_to_block(bb1);
+1242        builder.jump(merge, SourceInfo::dummy());
+1243
+1244        builder.move_to_block(bb2);
+1245        builder.jump(merge, SourceInfo::dummy());
+1246        builder.move_to_block(bb3);
+1247        builder.jump(merge, SourceInfo::dummy());
+1248
+1249        builder.move_to_block(merge);
+1250        builder.ret(dummy_value, SourceInfo::dummy());
+1251
+1252        let mut func = builder.build();
+1253        let mut order = serialize_func_body(&mut func);
+1254
+1255        let arms = expect_switch(&mut order);
+1256        assert_eq!(arms.len(), 3);
+1257        for mut arm in arms {
+1258            expect_end(&mut arm);
+1259        }
+1260
+1261        expect_return(&func, &mut order);
+1262        expect_end(&mut order);
+1263    }
+1264
+1265    #[test]
+1266    fn switch_default() {
+1267        //      +-----------+
+1268        //      |           |
+1269        //      |           |
+1270        //      |      +----+--------+
+1271        //      v      |    |        |
+1272        //    +-----+  |  +-------+  |  +---------+
+1273        //    | bb2 | -+  |  bb0  | -+> |   bb3   |
+1274        //    +-----+     +-------+  |  +---------+
+1275        //      |           |        |    |
+1276        //      |           |        |    |
+1277        //      v           v        |    v
+1278        //    +-----+     +-------+  |  +---------+
+1279        //    | bb5 |  +- |  bb1  |  +> | default | <+
+1280        //    +-----+  |  +-------+     +---------+  |
+1281        //      |      |    |             |          |
+1282        //      |      |    |             |          |
+1283        //      |      |    v             |          |
+1284        //      |      |  +-------+       |          |
+1285        //      |      |  |  bb4  |       |          |
+1286        //      |      |  +-------+       |          |
+1287        //      |      |    |             |          |
+1288        // +----+------+    |             |          |
+1289        // |    |           v             |          |
+1290        // |    |         +-------+       |          |
+1291        // |    +-------> | merge | <-----+          |
+1292        // |              +-------+                  |
+1293        // |                                         |
+1294        // +-----------------------------------------+
+1295        let mut builder = body_builder();
+1296        let dummy_ty = TypeId(0);
+1297        let dummy_value = builder.make_unit(dummy_ty);
+1298
+1299        let bb1 = builder.make_block();
+1300        let bb2 = builder.make_block();
+1301        let bb3 = builder.make_block();
+1302        let bb4 = builder.make_block();
+1303        let bb5 = builder.make_block();
+1304        let default = builder.make_block();
+1305        let merge = builder.make_block();
+1306
+1307        let mut table = SwitchTable::default();
+1308        table.add_arm(dummy_value, bb1);
+1309        table.add_arm(dummy_value, bb2);
+1310        table.add_arm(dummy_value, bb3);
+1311        builder.switch(dummy_value, table, None, SourceInfo::dummy());
+1312
+1313        builder.move_to_block(bb1);
+1314        let mut table = SwitchTable::default();
+1315        table.add_arm(dummy_value, bb4);
+1316        table.add_arm(dummy_value, default);
+1317        builder.switch(dummy_value, table, None, SourceInfo::dummy());
+1318
+1319        builder.move_to_block(bb2);
+1320        let mut table = SwitchTable::default();
+1321        table.add_arm(dummy_value, bb5);
+1322        table.add_arm(dummy_value, default);
+1323        builder.switch(dummy_value, table, None, SourceInfo::dummy());
+1324
+1325        builder.move_to_block(bb3);
+1326        builder.jump(default, SourceInfo::dummy());
+1327
+1328        builder.move_to_block(bb4);
+1329        builder.jump(merge, SourceInfo::dummy());
+1330
+1331        builder.move_to_block(bb5);
+1332        builder.jump(merge, SourceInfo::dummy());
+1333
+1334        builder.move_to_block(default);
+1335        builder.jump(merge, SourceInfo::dummy());
+1336
+1337        builder.move_to_block(merge);
+1338        builder.ret(dummy_value, SourceInfo::dummy());
+1339
+1340        let mut func = builder.build();
+1341        let mut order = serialize_func_body(&mut func);
+1342
+1343        let mut arms = expect_switch(&mut order);
+1344        assert_eq!(arms.len(), 3);
+1345
+1346        let mut bb3_jump = arms.pop().unwrap();
+1347        expect_end(&mut bb3_jump);
+1348
+1349        let mut bb2_switch = arms.pop().unwrap();
+1350        let bb2_switch_arms = expect_switch(&mut bb2_switch);
+1351        assert_eq!(bb2_switch_arms.len(), 2);
+1352        for mut bb2_switch_arm in bb2_switch_arms {
+1353            expect_end(&mut bb2_switch_arm);
+1354        }
+1355        expect_end(&mut bb2_switch);
+1356
+1357        let mut bb1_switch = arms.pop().unwrap();
+1358        let bb1_switch_arms = expect_switch(&mut bb1_switch);
+1359        assert_eq!(bb1_switch_arms.len(), 2);
+1360        for mut bb1_switch_arm in bb1_switch_arms {
+1361            expect_end(&mut bb1_switch_arm);
+1362        }
+1363        expect_end(&mut bb1_switch);
+1364
+1365        expect_return(&func, &mut order);
+1366        expect_end(&mut order);
+1367    }
+1368}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/isel/mod.rs.html b/compiler-docs/src/fe_codegen/yul/isel/mod.rs.html new file mode 100644 index 0000000000..57b5bae43b --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/isel/mod.rs.html @@ -0,0 +1,9 @@ +mod.rs - source

fe_codegen/yul/isel/
mod.rs

1pub mod context;
+2mod contract;
+3mod function;
+4mod inst_order;
+5mod test;
+6
+7pub use contract::{lower_contract, lower_contract_deployable};
+8pub use function::lower_function;
+9pub use test::lower_test;
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/isel/test.rs.html b/compiler-docs/src/fe_codegen/yul/isel/test.rs.html new file mode 100644 index 0000000000..9149ae7844 --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/isel/test.rs.html @@ -0,0 +1,70 @@ +test.rs - source

fe_codegen/yul/isel/
test.rs

1use super::context::Context;
+2use crate::db::CodegenDb;
+3use fe_analyzer::namespace::items::FunctionId;
+4use yultsur::{yul, *};
+5
+6pub fn lower_test(db: &dyn CodegenDb, test: FunctionId) -> yul::Object {
+7    let mut context = Context::default();
+8    let test = db.mir_lowered_func_signature(test);
+9    context.function_dependency.insert(test);
+10
+11    let dep_functions: Vec<_> = context
+12        .resolve_function_dependency(db)
+13        .into_iter()
+14        .map(yul::Statement::FunctionDefinition)
+15        .collect();
+16    let dep_constants = context.resolve_constant_dependency(db);
+17    let dep_contracts = context.resolve_contract_dependency(db);
+18    let runtime_funcs: Vec<_> = context
+19        .runtime
+20        .collect_definitions()
+21        .into_iter()
+22        .map(yul::Statement::FunctionDefinition)
+23        .collect();
+24    let test_func_name = identifier! { (db.codegen_function_symbol_name(test)) };
+25    let call = function_call_statement! {[test_func_name]()};
+26
+27    let code = code! {
+28        [dep_functions...]
+29        [runtime_funcs...]
+30        [call]
+31        (stop())
+32    };
+33
+34    let name = identifier! { test };
+35    let object = yul::Object {
+36        name,
+37        code,
+38        objects: dep_contracts,
+39        data: dep_constants,
+40    };
+41
+42    normalize_object(object)
+43}
+44
+45fn normalize_object(obj: yul::Object) -> yul::Object {
+46    let data = obj
+47        .data
+48        .into_iter()
+49        .map(|data| yul::Data {
+50            name: data.name,
+51            value: data
+52                .value
+53                .replace('\\', "\\\\\\\\")
+54                .replace('\n', "\\\\n")
+55                .replace('"', "\\\\\"")
+56                .replace('\r', "\\\\r")
+57                .replace('\t', "\\\\t"),
+58        })
+59        .collect::<Vec<_>>();
+60    yul::Object {
+61        name: obj.name,
+62        code: obj.code,
+63        objects: obj
+64            .objects
+65            .into_iter()
+66            .map(normalize_object)
+67            .collect::<Vec<_>>(),
+68        data,
+69    }
+70}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/legalize/body.rs.html b/compiler-docs/src/fe_codegen/yul/legalize/body.rs.html new file mode 100644 index 0000000000..5e7d94a1e8 --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/legalize/body.rs.html @@ -0,0 +1,219 @@ +body.rs - source

fe_codegen/yul/legalize/
body.rs

1use fe_mir::ir::{
+2    body_cursor::{BodyCursor, CursorLocation},
+3    inst::InstKind,
+4    value::AssignableValue,
+5    FunctionBody, Inst, InstId, TypeId, TypeKind, Value, ValueId,
+6};
+7
+8use crate::db::CodegenDb;
+9
+10use super::critical_edge::CriticalEdgeSplitter;
+11
+12pub fn legalize_func_body(db: &dyn CodegenDb, body: &mut FunctionBody) {
+13    CriticalEdgeSplitter::new().run(body);
+14    legalize_func_arg(db, body);
+15
+16    let mut cursor = BodyCursor::new_at_entry(body);
+17    loop {
+18        match cursor.loc() {
+19            CursorLocation::BlockTop(_) | CursorLocation::BlockBottom(_) => cursor.proceed(),
+20            CursorLocation::Inst(inst) => {
+21                legalize_inst(db, &mut cursor, inst);
+22            }
+23            CursorLocation::NoWhere => break,
+24        }
+25    }
+26}
+27
+28fn legalize_func_arg(db: &dyn CodegenDb, body: &mut FunctionBody) {
+29    for value in body.store.func_args_mut() {
+30        let ty = value.ty();
+31        if ty.is_contract(db.upcast()) {
+32            let slot_ptr = make_storage_ptr(db, ty);
+33            *value = slot_ptr;
+34        } else if (ty.is_aggregate(db.upcast()) || ty.is_string(db.upcast()))
+35            && !ty.is_zero_sized(db.upcast())
+36        {
+37            change_ty(value, ty.make_mptr(db.upcast()))
+38        }
+39    }
+40}
+41
+42fn legalize_inst(db: &dyn CodegenDb, cursor: &mut BodyCursor, inst: InstId) {
+43    if legalize_unit_construct(db, cursor, inst) {
+44        return;
+45    }
+46    legalize_declared_ty(db, cursor.body_mut(), inst);
+47    legalize_inst_arg(db, cursor.body_mut(), inst);
+48    legalize_inst_result(db, cursor.body_mut(), inst);
+49    cursor.proceed();
+50}
+51
+52fn legalize_unit_construct(db: &dyn CodegenDb, cursor: &mut BodyCursor, inst: InstId) -> bool {
+53    let should_remove = match &cursor.body().store.inst_data(inst).kind {
+54        InstKind::Declare { local } => is_value_zst(db, cursor.body(), *local),
+55        InstKind::AggregateConstruct { ty, .. } => ty.deref(db.upcast()).is_zero_sized(db.upcast()),
+56        InstKind::AggregateAccess { .. } | InstKind::MapAccess { .. } | InstKind::Cast { .. } => {
+57            let result_value = cursor.body().store.inst_result(inst).unwrap();
+58            is_lvalue_zst(db, cursor.body(), result_value)
+59        }
+60
+61        _ => false,
+62    };
+63
+64    if should_remove {
+65        cursor.remove_inst()
+66    }
+67
+68    should_remove
+69}
+70
+71fn legalize_declared_ty(db: &dyn CodegenDb, body: &mut FunctionBody, inst_id: InstId) {
+72    let value = match &body.store.inst_data(inst_id).kind {
+73        InstKind::Declare { local } => *local,
+74        _ => return,
+75    };
+76
+77    let value_ty = body.store.value_ty(value);
+78    if value_ty.is_aggregate(db.upcast()) {
+79        let new_ty = value_ty.make_mptr(db.upcast());
+80        let value_data = body.store.value_data_mut(value);
+81        change_ty(value_data, new_ty)
+82    }
+83}
+84
+85fn legalize_inst_arg(db: &dyn CodegenDb, body: &mut FunctionBody, inst_id: InstId) {
+86    // Replace inst with dummy inst to avoid borrow checker complaining.
+87    let dummy_inst = Inst::nop();
+88    let mut inst = body.store.replace_inst(inst_id, dummy_inst);
+89
+90    for arg in inst.args() {
+91        let ty = body.store.value_ty(arg);
+92        if ty.is_string(db.upcast()) {
+93            let string_ptr = ty.make_mptr(db.upcast());
+94            change_ty(body.store.value_data_mut(arg), string_ptr)
+95        }
+96    }
+97
+98    match &mut inst.kind {
+99        InstKind::AggregateConstruct { args, .. } => {
+100            args.retain(|arg| !is_value_zst(db, body, *arg));
+101        }
+102
+103        InstKind::Call { args, .. } => {
+104            args.retain(|arg| !is_value_zst(db, body, *arg) && !is_value_contract(db, body, *arg))
+105        }
+106
+107        InstKind::Return { arg } => {
+108            if arg.map(|arg| is_value_zst(db, body, arg)).unwrap_or(false) {
+109                *arg = None;
+110            }
+111        }
+112
+113        InstKind::MapAccess { key: arg, .. } | InstKind::Emit { arg } => {
+114            let arg_ty = body.store.value_ty(*arg);
+115            if arg_ty.is_zero_sized(db.upcast()) {
+116                *arg = body.store.store_value(make_zst_ptr(db, arg_ty));
+117            }
+118        }
+119
+120        InstKind::Cast { value, to, .. } => {
+121            if to.is_aggregate(db.upcast()) && !to.is_zero_sized(db.upcast()) {
+122                let value_ty = body.store.value_ty(*value);
+123                if value_ty.is_mptr(db.upcast()) {
+124                    *to = to.make_mptr(db.upcast());
+125                } else if value_ty.is_sptr(db.upcast()) {
+126                    *to = to.make_sptr(db.upcast());
+127                } else {
+128                    unreachable!()
+129                }
+130            }
+131        }
+132
+133        _ => {}
+134    }
+135
+136    body.store.replace_inst(inst_id, inst);
+137}
+138
+139fn legalize_inst_result(db: &dyn CodegenDb, body: &mut FunctionBody, inst_id: InstId) {
+140    let result_value = if let Some(result) = body.store.inst_result(inst_id) {
+141        result
+142    } else {
+143        return;
+144    };
+145
+146    if is_lvalue_zst(db, body, result_value) {
+147        body.store.remove_inst_result(inst_id);
+148        return;
+149    };
+150
+151    let value_id = if let Some(value_id) = result_value.value_id() {
+152        value_id
+153    } else {
+154        return;
+155    };
+156    let result_ty = body.store.value_ty(value_id);
+157    let new_ty = if result_ty.is_aggregate(db.upcast()) || result_ty.is_string(db.upcast()) {
+158        match &body.store.inst_data(inst_id).kind {
+159            InstKind::AggregateAccess { value, .. } => {
+160                let value_ty = body.store.value_ty(*value);
+161                match &value_ty.data(db.upcast()).kind {
+162                    TypeKind::MPtr(..) => result_ty.make_mptr(db.upcast()),
+163                    // Note: All SPtr aggregate access results should be SPtr already
+164                    _ => unreachable!(),
+165                }
+166            }
+167            _ => result_ty.make_mptr(db.upcast()),
+168        }
+169    } else {
+170        return;
+171    };
+172
+173    let value = body.store.value_data_mut(value_id);
+174    change_ty(value, new_ty);
+175}
+176
+177fn change_ty(value: &mut Value, new_ty: TypeId) {
+178    match value {
+179        Value::Local(val) => val.ty = new_ty,
+180        Value::Immediate { ty, .. }
+181        | Value::Temporary { ty, .. }
+182        | Value::Unit { ty }
+183        | Value::Constant { ty, .. } => *ty = new_ty,
+184    }
+185}
+186
+187fn make_storage_ptr(db: &dyn CodegenDb, ty: TypeId) -> Value {
+188    debug_assert!(ty.is_contract(db.upcast()));
+189    let ty = ty.make_sptr(db.upcast());
+190
+191    Value::Immediate { imm: 0.into(), ty }
+192}
+193
+194fn make_zst_ptr(db: &dyn CodegenDb, ty: TypeId) -> Value {
+195    debug_assert!(ty.is_zero_sized(db.upcast()));
+196    let ty = ty.make_mptr(db.upcast());
+197
+198    Value::Immediate { imm: 0.into(), ty }
+199}
+200
+201/// Returns `true` if a value has a zero sized type.
+202fn is_value_zst(db: &dyn CodegenDb, body: &FunctionBody, value: ValueId) -> bool {
+203    body.store
+204        .value_ty(value)
+205        .deref(db.upcast())
+206        .is_zero_sized(db.upcast())
+207}
+208
+209fn is_value_contract(db: &dyn CodegenDb, body: &FunctionBody, value: ValueId) -> bool {
+210    let ty = body.store.value_ty(value);
+211    ty.deref(db.upcast()).is_contract(db.upcast())
+212}
+213
+214fn is_lvalue_zst(db: &dyn CodegenDb, body: &FunctionBody, lvalue: &AssignableValue) -> bool {
+215    lvalue
+216        .ty(db.upcast(), &body.store)
+217        .deref(db.upcast())
+218        .is_zero_sized(db.upcast())
+219}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/legalize/critical_edge.rs.html b/compiler-docs/src/fe_codegen/yul/legalize/critical_edge.rs.html new file mode 100644 index 0000000000..06f40680ec --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/legalize/critical_edge.rs.html @@ -0,0 +1,121 @@ +critical_edge.rs - source

fe_codegen/yul/legalize/
critical_edge.rs

1use fe_mir::{
+2    analysis::ControlFlowGraph,
+3    ir::{
+4        body_cursor::{BodyCursor, CursorLocation},
+5        inst::InstKind,
+6        BasicBlock, BasicBlockId, FunctionBody, Inst, InstId, SourceInfo,
+7    },
+8};
+9
+10#[derive(Debug)]
+11pub struct CriticalEdgeSplitter {
+12    critical_edges: Vec<CriticalEdge>,
+13}
+14
+15impl CriticalEdgeSplitter {
+16    pub fn new() -> Self {
+17        Self {
+18            critical_edges: Vec::default(),
+19        }
+20    }
+21
+22    pub fn run(&mut self, func: &mut FunctionBody) {
+23        let cfg = ControlFlowGraph::compute(func);
+24
+25        for block in cfg.post_order() {
+26            let terminator = func.order.terminator(&func.store, block).unwrap();
+27            self.add_critical_edges(terminator, func, &cfg);
+28        }
+29
+30        self.split_edges(func);
+31    }
+32
+33    fn add_critical_edges(
+34        &mut self,
+35        terminator: InstId,
+36        func: &FunctionBody,
+37        cfg: &ControlFlowGraph,
+38    ) {
+39        for to in func.store.branch_info(terminator).block_iter() {
+40            if cfg.preds(to).len() > 1 {
+41                self.critical_edges.push(CriticalEdge { terminator, to });
+42            }
+43        }
+44    }
+45
+46    fn split_edges(&mut self, func: &mut FunctionBody) {
+47        for edge in std::mem::take(&mut self.critical_edges) {
+48            let terminator = edge.terminator;
+49            let source_block = func.order.inst_block(terminator);
+50            let original_dest = edge.to;
+51
+52            // Create new block that contains only jump inst.
+53            let new_dest = func.store.store_block(BasicBlock {});
+54            let mut cursor = BodyCursor::new(func, CursorLocation::BlockTop(source_block));
+55            cursor.insert_block(new_dest);
+56            cursor.set_loc(CursorLocation::BlockTop(new_dest));
+57            cursor.store_and_insert_inst(Inst::new(
+58                InstKind::Jump {
+59                    dest: original_dest,
+60                },
+61                SourceInfo::dummy(),
+62            ));
+63
+64            // Rewrite branch destination to the new dest.
+65            func.store
+66                .rewrite_branch_dest(terminator, original_dest, new_dest);
+67        }
+68    }
+69}
+70
+71#[derive(Debug)]
+72struct CriticalEdge {
+73    terminator: InstId,
+74    to: BasicBlockId,
+75}
+76
+77#[cfg(test)]
+78mod tests {
+79    use fe_mir::ir::{body_builder::BodyBuilder, FunctionId, TypeId};
+80
+81    use super::*;
+82
+83    fn body_builder() -> BodyBuilder {
+84        BodyBuilder::new(FunctionId(0), SourceInfo::dummy())
+85    }
+86
+87    #[test]
+88    fn critical_edge_remove() {
+89        let mut builder = body_builder();
+90        let lp_header = builder.make_block();
+91        let lp_body = builder.make_block();
+92        let exit = builder.make_block();
+93
+94        let dummy_ty = TypeId(0);
+95        let v0 = builder.make_imm_from_bool(false, dummy_ty);
+96        builder.branch(v0, lp_header, exit, SourceInfo::dummy());
+97
+98        builder.move_to_block(lp_header);
+99        builder.jump(lp_body, SourceInfo::dummy());
+100
+101        builder.move_to_block(lp_body);
+102        builder.branch(v0, lp_header, exit, SourceInfo::dummy());
+103
+104        builder.move_to_block(exit);
+105        builder.ret(v0, SourceInfo::dummy());
+106
+107        let mut func = builder.build();
+108        CriticalEdgeSplitter::new().run(&mut func);
+109        let cfg = ControlFlowGraph::compute(&func);
+110
+111        for &header_pred in cfg.preds(lp_header) {
+112            debug_assert_eq!(cfg.succs(header_pred).len(), 1);
+113            debug_assert_eq!(cfg.succs(header_pred)[0], lp_header);
+114        }
+115
+116        for &exit_pred in cfg.preds(exit) {
+117            debug_assert_eq!(cfg.succs(exit_pred).len(), 1);
+118            debug_assert_eq!(cfg.succs(exit_pred)[0], exit);
+119        }
+120    }
+121}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/legalize/mod.rs.html b/compiler-docs/src/fe_codegen/yul/legalize/mod.rs.html new file mode 100644 index 0000000000..d2cd3954fa --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/legalize/mod.rs.html @@ -0,0 +1,6 @@ +mod.rs - source

fe_codegen/yul/legalize/
mod.rs

1mod body;
+2mod critical_edge;
+3mod signature;
+4
+5pub use body::legalize_func_body;
+6pub use signature::legalize_func_signature;
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/legalize/signature.rs.html b/compiler-docs/src/fe_codegen/yul/legalize/signature.rs.html new file mode 100644 index 0000000000..f905aaeb5b --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/legalize/signature.rs.html @@ -0,0 +1,27 @@ +signature.rs - source

fe_codegen/yul/legalize/
signature.rs

1use fe_mir::ir::{FunctionSignature, TypeKind};
+2
+3use crate::db::CodegenDb;
+4
+5pub fn legalize_func_signature(db: &dyn CodegenDb, sig: &mut FunctionSignature) {
+6    // Remove param if the type is contract or zero-sized.
+7    let params = &mut sig.params;
+8    params.retain(|param| match param.ty.data(db.upcast()).kind {
+9        TypeKind::Contract(_) => false,
+10        _ => !param.ty.deref(db.upcast()).is_zero_sized(db.upcast()),
+11    });
+12
+13    // Legalize param types.
+14    for param in params.iter_mut() {
+15        param.ty = db.codegen_legalized_type(param.ty);
+16    }
+17
+18    if let Some(ret_ty) = sig.return_type {
+19        // Remove return type  if the type is contract or zero-sized.
+20        if ret_ty.is_contract(db.upcast()) || ret_ty.deref(db.upcast()).is_zero_sized(db.upcast()) {
+21            sig.return_type = None;
+22        } else {
+23            // Legalize param types.
+24            sig.return_type = Some(db.codegen_legalized_type(ret_ty));
+25        }
+26    }
+27}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/mod.rs.html b/compiler-docs/src/fe_codegen/yul/mod.rs.html new file mode 100644 index 0000000000..b2de24120a --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/mod.rs.html @@ -0,0 +1,26 @@ +mod.rs - source

fe_codegen/yul/
mod.rs

1use std::borrow::Cow;
+2
+3pub mod isel;
+4pub mod legalize;
+5pub mod runtime;
+6
+7mod slot_size;
+8
+9use yultsur::*;
+10
+11/// A helper struct to abstract ident and expr.
+12struct YulVariable<'a>(Cow<'a, str>);
+13
+14impl<'a> YulVariable<'a> {
+15    fn expr(&self) -> yul::Expression {
+16        identifier_expression! {(format!{"${}", self.0})}
+17    }
+18
+19    fn ident(&self) -> yul::Identifier {
+20        identifier! {(format!{"${}", self.0})}
+21    }
+22
+23    fn new(name: impl Into<Cow<'a, str>>) -> Self {
+24        Self(name.into())
+25    }
+26}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/runtime/abi.rs.html b/compiler-docs/src/fe_codegen/yul/runtime/abi.rs.html new file mode 100644 index 0000000000..8955094478 --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/runtime/abi.rs.html @@ -0,0 +1,950 @@ +abi.rs - source

fe_codegen/yul/runtime/
abi.rs

1use crate::{
+2    db::CodegenDb,
+3    yul::{
+4        runtime::{error_revert_numeric, make_ptr},
+5        slot_size::{yul_primitive_type, SLOT_SIZE},
+6        YulVariable,
+7    },
+8};
+9
+10use super::{AbiSrcLocation, DefaultRuntimeProvider, RuntimeFunction, RuntimeProvider};
+11
+12use fe_abi::types::AbiType;
+13use fe_mir::ir::{self, types::ArrayDef, TypeId, TypeKind};
+14use yultsur::*;
+15
+16pub(super) fn make_abi_encode_primitive_type(
+17    provider: &mut DefaultRuntimeProvider,
+18    db: &dyn CodegenDb,
+19    func_name: &str,
+20    legalized_ty: TypeId,
+21    is_dst_storage: bool,
+22) -> RuntimeFunction {
+23    let func_name = YulVariable::new(func_name);
+24    let src = YulVariable::new("src");
+25    let dst = YulVariable::new("dst");
+26    let enc_size = YulVariable::new("enc_size");
+27    let func_def = function_definition! {
+28        function [func_name.ident()]([src.ident()], [dst.ident()]) ->  [enc_size.ident()] {
+29            ([src.ident()] := [provider.primitive_cast(db, src.expr(), legalized_ty)])
+30            ([yul::Statement::Expression(provider.ptr_store(
+31                db,
+32                dst.expr(),
+33                src.expr(),
+34                make_ptr(db, yul_primitive_type(db), is_dst_storage),
+35            ))])
+36            ([enc_size.ident()] := 32)
+37        }
+38    };
+39
+40    RuntimeFunction::from_statement(func_def)
+41}
+42
+43pub(super) fn make_abi_encode_static_array_type(
+44    provider: &mut DefaultRuntimeProvider,
+45    db: &dyn CodegenDb,
+46    func_name: &str,
+47    legalized_ty: TypeId,
+48) -> RuntimeFunction {
+49    let is_dst_storage = legalized_ty.is_sptr(db.upcast());
+50    let deref_ty = legalized_ty.deref(db.upcast());
+51    let (elem_ty, len) = match &deref_ty.data(db.upcast()).kind {
+52        ir::TypeKind::Array(def) => (def.elem_ty, def.len),
+53        _ => unreachable!(),
+54    };
+55    let elem_abi_ty = db.codegen_abi_type(elem_ty);
+56    let elem_ptr_ty = make_ptr(db, elem_ty, false);
+57    let elem_ty_size = deref_ty.array_elem_size(db.upcast(), SLOT_SIZE);
+58
+59    let func_name = YulVariable::new(func_name);
+60    let src = YulVariable::new("src");
+61    let dst = YulVariable::new("dst");
+62    let enc_size = YulVariable::new("enc_size");
+63    let header_size = elem_abi_ty.header_size();
+64    let iter_count = literal_expression! {(len)};
+65
+66    let func = function_definition! {
+67         function [func_name.ident()]([src.ident()], [dst.ident()]) -> [enc_size.ident()] {
+68             (for {(let i := 0)} (lt(i, [iter_count])) {(i := (add(i, 1)))}
+69             {
+70
+71                 (pop([provider.abi_encode(db, src.expr(), dst.expr(), elem_ptr_ty, is_dst_storage)]))
+72                 ([src.ident()] := add([src.expr()], [literal_expression!{(elem_ty_size)}]))
+73                 ([dst.ident()] := add([dst.expr()], [literal_expression!{(header_size)}]))
+74             })
+75             ([enc_size.ident()] := [literal_expression! {(header_size * len)}])
+76         }
+77    };
+78
+79    RuntimeFunction::from_statement(func)
+80}
+81
+82pub(super) fn make_abi_encode_dynamic_array_type(
+83    provider: &mut DefaultRuntimeProvider,
+84    db: &dyn CodegenDb,
+85    func_name: &str,
+86    legalized_ty: TypeId,
+87) -> RuntimeFunction {
+88    let is_dst_storage = legalized_ty.is_sptr(db.upcast());
+89    let deref_ty = legalized_ty.deref(db.upcast());
+90    let (elem_ty, len) = match &deref_ty.data(db.upcast()).kind {
+91        ir::TypeKind::Array(def) => (def.elem_ty, def.len),
+92        _ => unreachable!(),
+93    };
+94    let elem_header_size = 32;
+95    let total_header_size = elem_header_size * len;
+96    let elem_ptr_ty = make_ptr(db, elem_ty, false);
+97    let elem_ty_size = deref_ty.array_elem_size(db.upcast(), SLOT_SIZE);
+98    let header_ty = make_ptr(db, yul_primitive_type(db), is_dst_storage);
+99
+100    let func_name = YulVariable::new(func_name);
+101    let src = YulVariable::new("src");
+102    let dst = YulVariable::new("dst");
+103    let header_ptr = YulVariable::new("header_ptr");
+104    let data_ptr = YulVariable::new("data_ptr");
+105    let enc_size = YulVariable::new("enc_size");
+106    let iter_count = literal_expression! {(len)};
+107
+108    let func = function_definition! {
+109         function [func_name.ident()]([src.ident()], [dst.ident()]) -> [enc_size.ident()] {
+110             (let [header_ptr.ident()] := [dst.expr()])
+111             (let [data_ptr.ident()] := add([dst.expr()], [literal_expression!{(total_header_size)}]))
+112             ([enc_size.ident()] := [literal_expression!{(total_header_size)}])
+113             (for {(let i := 0)} (lt(i, [iter_count])) {(i := (add(i, 1)))}
+114             {
+115
+116                ([yul::Statement::Expression(provider.ptr_store(db, header_ptr.expr(), enc_size.expr(), header_ty))])
+117                ([enc_size.ident()] := add([provider.abi_encode(db, src.expr(), data_ptr.expr(), elem_ptr_ty, is_dst_storage)], [enc_size.expr()]))
+118                ([header_ptr.ident()] := add([header_ptr.expr()], [literal_expression!{(elem_header_size)}]))
+119                ([data_ptr.ident()] := add([dst.expr()], [enc_size.expr()]))
+120                ([src.ident()] := add([src.expr()], [literal_expression!{(elem_ty_size)}]))
+121             })
+122         }
+123    };
+124
+125    RuntimeFunction::from_statement(func)
+126}
+127
+128pub(super) fn make_abi_encode_static_aggregate_type(
+129    provider: &mut DefaultRuntimeProvider,
+130    db: &dyn CodegenDb,
+131    func_name: &str,
+132    legalized_ty: TypeId,
+133    is_dst_storage: bool,
+134) -> RuntimeFunction {
+135    let func_name = YulVariable::new(func_name);
+136    let deref_ty = legalized_ty.deref(db.upcast());
+137    let src = YulVariable::new("src");
+138    let dst = YulVariable::new("dst");
+139    let enc_size = YulVariable::new("enc_size");
+140    let field_enc_size = YulVariable::new("field_enc_size");
+141    let mut body = vec![
+142        statement! {[enc_size.ident()] := 0 },
+143        statement! {let [field_enc_size.ident()] := 0 },
+144    ];
+145    let field_num = deref_ty.aggregate_field_num(db.upcast());
+146
+147    for idx in 0..field_num {
+148        let field_ty = deref_ty.projection_ty_imm(db.upcast(), idx);
+149        let field_ty_ptr = make_ptr(db, field_ty, false);
+150        let field_offset = deref_ty.aggregate_elem_offset(db.upcast(), idx, SLOT_SIZE);
+151        let src_offset = expression! { add([src.expr()], [literal_expression!{(field_offset)}]) };
+152        body.push(statement!{
+153            [field_enc_size.ident()] := [provider.abi_encode(db, src_offset, dst.expr(), field_ty_ptr, is_dst_storage)]
+154        });
+155        body.push(statement! {
+156            [enc_size.ident()] := add([enc_size.expr()], [field_enc_size.expr()])
+157        });
+158
+159        if idx < field_num - 1 {
+160            body.push(assignment! {[dst.ident()] :=  add([dst.expr()], [field_enc_size.expr()])});
+161        }
+162    }
+163
+164    let func_def = yul::FunctionDefinition {
+165        name: func_name.ident(),
+166        parameters: vec![src.ident(), dst.ident()],
+167        returns: vec![enc_size.ident()],
+168        block: yul::Block { statements: body },
+169    };
+170
+171    RuntimeFunction(func_def)
+172}
+173
+174pub(super) fn make_abi_encode_dynamic_aggregate_type(
+175    provider: &mut DefaultRuntimeProvider,
+176    db: &dyn CodegenDb,
+177    func_name: &str,
+178    legalized_ty: TypeId,
+179    is_dst_storage: bool,
+180) -> RuntimeFunction {
+181    let func_name = YulVariable::new(func_name);
+182    let is_src_storage = legalized_ty.is_sptr(db.upcast());
+183    let deref_ty = legalized_ty.deref(db.upcast());
+184    let field_num = deref_ty.aggregate_field_num(db.upcast());
+185
+186    let src = YulVariable::new("src");
+187    let dst = YulVariable::new("dst");
+188    let header_ptr = YulVariable::new("header_ptr");
+189    let enc_size = YulVariable::new("enc_size");
+190    let data_ptr = YulVariable::new("data_ptr");
+191
+192    let total_header_size = literal_expression! { ((0..field_num).fold(0, |acc, idx| {
+193        let ty = deref_ty.projection_ty_imm(db.upcast(), idx);
+194        acc + db.codegen_abi_type(ty).header_size()
+195    })) };
+196    let mut body = statements! {
+197        (let [header_ptr.ident()] := [dst.expr()])
+198        ([enc_size.ident()] := [total_header_size])
+199        (let [data_ptr.ident()] := add([dst.expr()], [enc_size.expr()]))
+200    };
+201
+202    for idx in 0..field_num {
+203        let field_ty = deref_ty.projection_ty_imm(db.upcast(), idx);
+204        let field_abi_ty = db.codegen_abi_type(field_ty);
+205        let field_offset =
+206            literal_expression! { (deref_ty.aggregate_elem_offset(db.upcast(), idx, SLOT_SIZE)) };
+207        let field_ptr = expression! { add([src.expr()], [field_offset]) };
+208        let field_ptr_ty = make_ptr(db, field_ty, is_src_storage);
+209
+210        let stmts = if field_abi_ty.is_static() {
+211            statements! {
+212                (pop([provider.abi_encode(db, field_ptr, header_ptr.expr(), field_ptr_ty, is_dst_storage)]))
+213                ([header_ptr.ident()] := add([header_ptr.expr()], [literal_expression! {(field_abi_ty.header_size())}]))
+214            }
+215        } else {
+216            let header_ty = make_ptr(db, yul_primitive_type(db), is_dst_storage);
+217            statements! {
+218               ([yul::Statement::Expression(provider.ptr_store(db, header_ptr.expr(), enc_size.expr(), header_ty))])
+219               ([enc_size.ident()] := add([provider.abi_encode(db, field_ptr, data_ptr.expr(), field_ptr_ty, is_dst_storage)], [enc_size.expr()]))
+220               ([header_ptr.ident()] := add([header_ptr.expr()], 32))
+221               ([data_ptr.ident()] := add([dst.expr()], [enc_size.expr()]))
+222            }
+223        };
+224        body.extend_from_slice(&stmts);
+225    }
+226
+227    let func_def = yul::FunctionDefinition {
+228        name: func_name.ident(),
+229        parameters: vec![src.ident(), dst.ident()],
+230        returns: vec![enc_size.ident()],
+231        block: yul::Block { statements: body },
+232    };
+233
+234    RuntimeFunction(func_def)
+235}
+236
+237pub(super) fn make_abi_encode_string_type(
+238    provider: &mut DefaultRuntimeProvider,
+239    db: &dyn CodegenDb,
+240    func_name: &str,
+241    is_dst_storage: bool,
+242) -> RuntimeFunction {
+243    let func_name = YulVariable::new(func_name);
+244    let src = YulVariable::new("src");
+245    let dst = YulVariable::new("dst");
+246    let string_len = YulVariable::new("string_len");
+247    let enc_size = YulVariable::new("enc_size");
+248
+249    let func_def = function_definition! {
+250        function [func_name.ident()]([src.ident()], [dst.ident()]) -> [enc_size.ident()] {
+251            (let [string_len.ident()] := mload([src.expr()]))
+252            (let data_size := add(32, [string_len.expr()]))
+253            ([enc_size.ident()] := mul((div((add(data_size, 31)), 32)), 32))
+254            (let padding_word_ptr := add([dst.expr()], (sub([enc_size.expr()], 32))))
+255            (mstore(padding_word_ptr, 0))
+256            ([yul::Statement::Expression(provider.ptr_copy(db, src.expr(), dst.expr(), literal_expression!{data_size}, false, is_dst_storage))])
+257        }
+258    };
+259    RuntimeFunction::from_statement(func_def)
+260}
+261
+262pub(super) fn make_abi_encode_bytes_type(
+263    provider: &mut DefaultRuntimeProvider,
+264    db: &dyn CodegenDb,
+265    func_name: &str,
+266    len: usize,
+267    is_dst_storage: bool,
+268) -> RuntimeFunction {
+269    let func_name = YulVariable::new(func_name);
+270    let src = YulVariable::new("src");
+271    let dst = YulVariable::new("dst");
+272    let enc_size = YulVariable::new("enc_size");
+273    let dst_len_ty = make_ptr(db, yul_primitive_type(db), is_dst_storage);
+274
+275    let func_def = function_definition! {
+276        function [func_name.ident()]([src.ident()], [dst.ident()]) -> [enc_size.ident()] {
+277            ([enc_size.ident()] := [literal_expression!{ (ceil_32(32 + len)) }])
+278            (if (gt([enc_size.expr()], 0)) {
+279                (let padding_word_ptr := add([dst.expr()], (sub([enc_size.expr()], 32))))
+280                (mstore(padding_word_ptr, 0))
+281            })
+282            ([yul::Statement::Expression(provider.ptr_store(db, dst.expr(), literal_expression!{ (len) }, dst_len_ty))])
+283            ([dst.ident()] := add(32, [dst.expr()]))
+284            ([yul::Statement::Expression(provider.ptr_copy(db, src.expr(), dst.expr(), literal_expression!{(len)}, false, is_dst_storage))])
+285        }
+286    };
+287    RuntimeFunction::from_statement(func_def)
+288}
+289
+290pub(super) fn make_abi_encode_seq(
+291    provider: &mut DefaultRuntimeProvider,
+292    db: &dyn CodegenDb,
+293    func_name: &str,
+294    value_tys: &[TypeId],
+295    is_dst_storage: bool,
+296) -> RuntimeFunction {
+297    let func_name = YulVariable::new(func_name);
+298    let value_num = value_tys.len();
+299    let abi_tys: Vec<_> = value_tys
+300        .iter()
+301        .map(|ty| db.codegen_abi_type(ty.deref(db.upcast())))
+302        .collect();
+303    let dst = YulVariable::new("dst");
+304    let header_ptr = YulVariable::new("header_ptr");
+305    let enc_size = YulVariable::new("enc_size");
+306    let data_ptr = YulVariable::new("data_ptr");
+307    let values: Vec<_> = (0..value_num)
+308        .map(|idx| YulVariable::new(format!("value{idx}")))
+309        .collect();
+310
+311    let total_header_size =
+312        literal_expression! { (abi_tys.iter().fold(0, |acc, ty| acc + ty.header_size())) };
+313    let mut body = statements! {
+314        (let [header_ptr.ident()] := [dst.expr()])
+315        ([enc_size.ident()] := [total_header_size])
+316        (let [data_ptr.ident()] := add([dst.expr()], [enc_size.expr()]))
+317    };
+318
+319    for i in 0..value_num {
+320        let ty = value_tys[i];
+321        let abi_ty = &abi_tys[i];
+322        let value = &values[i];
+323        let stmts = if abi_ty.is_static() {
+324            statements! {
+325                (pop([provider.abi_encode(db, value.expr(), header_ptr.expr(), ty, is_dst_storage)]))
+326                ([header_ptr.ident()] := add([header_ptr.expr()], [literal_expression!{ (abi_ty.header_size()) }]))
+327            }
+328        } else {
+329            let header_ty = make_ptr(db, yul_primitive_type(db), is_dst_storage);
+330            statements! {
+331               ([yul::Statement::Expression(provider.ptr_store(db, header_ptr.expr(), enc_size.expr(), header_ty))])
+332               ([enc_size.ident()] := add([provider.abi_encode(db, value.expr(), data_ptr.expr(), ty, is_dst_storage)], [enc_size.expr()]))
+333               ([header_ptr.ident()] := add([header_ptr.expr()], 32))
+334               ([data_ptr.ident()] := add([dst.expr()], [enc_size.expr()]))
+335            }
+336        };
+337        body.extend_from_slice(&stmts);
+338    }
+339
+340    let mut parameters = vec![dst.ident()];
+341    for value in values {
+342        parameters.push(value.ident());
+343    }
+344
+345    let func_def = yul::FunctionDefinition {
+346        name: func_name.ident(),
+347        parameters,
+348        returns: vec![enc_size.ident()],
+349        block: yul::Block { statements: body },
+350    };
+351
+352    RuntimeFunction(func_def)
+353}
+354
+355pub(super) fn make_abi_decode(
+356    provider: &mut DefaultRuntimeProvider,
+357    db: &dyn CodegenDb,
+358    func_name: &str,
+359    types: &[TypeId],
+360    abi_loc: AbiSrcLocation,
+361) -> RuntimeFunction {
+362    let func_name = YulVariable::new(func_name);
+363    let header_size = types
+364        .iter()
+365        .fold(0, |acc, ty| acc + db.codegen_abi_type(*ty).header_size());
+366    let src = YulVariable::new("$src");
+367    let enc_size = YulVariable::new("$enc_size");
+368    let header_ptr = YulVariable::new("header_ptr");
+369    let data_offset = YulVariable::new("data_offset");
+370    let tmp_offset = YulVariable::new("tmp_offset");
+371    let returns: Vec<_> = (0..types.len())
+372        .map(|i| YulVariable::new(format!("$ret{i}")))
+373        .collect();
+374
+375    let abi_enc_size = abi_enc_size(db, types);
+376    let size_check = match abi_enc_size {
+377        AbiEncodingSize::Static(size) => statements! {
+378                (if (iszero((eq([enc_size.expr()], [literal_expression!{(size)}]))))
+379        {             [revert_with_invalid_abi_data(provider, db)]
+380                })
+381            },
+382        AbiEncodingSize::Bounded { min, max } => statements! {
+383            (if (or(
+384                (lt([enc_size.expr()], [literal_expression!{(min)}])),
+385                (gt([enc_size.expr()], [literal_expression!{(max)}]))
+386            )) {
+387                [revert_with_invalid_abi_data(provider, db)]
+388            })
+389        },
+390    };
+391
+392    let mut body = statements! {
+393        (let [header_ptr.ident()] := [src.expr()])
+394        (let [data_offset.ident()] :=  [literal_expression!{ (header_size) }])
+395        (let [tmp_offset.ident()] := 0)
+396    };
+397    for i in 0..returns.len() {
+398        let ret_value = &returns[i];
+399        let field_ty = types[i];
+400        let field_abi_ty = db.codegen_abi_type(field_ty.deref(db.upcast()));
+401        if field_abi_ty.is_static() {
+402            body.push(statement!{ [ret_value.ident()] := [provider.abi_decode_static(db, header_ptr.expr(), field_ty, abi_loc)] });
+403        } else {
+404            let identifiers = identifiers! {
+405                [ret_value.ident()]
+406                [tmp_offset.ident()]
+407            };
+408            body.push(yul::Statement::Assignment(yul::Assignment {
+409                identifiers,
+410                expression: provider.abi_decode_dynamic(
+411                    db,
+412                    expression! {add([src.expr()], [data_offset.expr()])},
+413                    field_ty,
+414                    abi_loc,
+415                ),
+416            }));
+417            body.push(statement! { ([data_offset.ident()] := add([data_offset.expr()], [tmp_offset.expr()])) });
+418        };
+419
+420        let field_header_size = literal_expression! { (field_abi_ty.header_size()) };
+421        body.push(
+422            statement! { [header_ptr.ident()] := add([header_ptr.expr()], [field_header_size]) },
+423        );
+424    }
+425
+426    let offset_check = match abi_enc_size {
+427        AbiEncodingSize::Static(_) => vec![],
+428        AbiEncodingSize::Bounded { .. } => statements! {
+429            (if (iszero((eq([enc_size.expr()], [data_offset.expr()])))) { [revert_with_invalid_abi_data(provider, db)] })
+430        },
+431    };
+432
+433    let returns: Vec<_> = returns.iter().map(YulVariable::ident).collect();
+434    let func_def = function_definition! {
+435        function [func_name.ident()]([src.ident()], [enc_size.ident()]) -> [returns...] {
+436            [size_check...]
+437            [body...]
+438            [offset_check...]
+439        }
+440    };
+441    RuntimeFunction::from_statement(func_def)
+442}
+443
+444impl DefaultRuntimeProvider {
+445    fn abi_decode_static(
+446        &mut self,
+447        db: &dyn CodegenDb,
+448        src: yul::Expression,
+449        ty: TypeId,
+450        abi_loc: AbiSrcLocation,
+451    ) -> yul::Expression {
+452        let ty = db.codegen_legalized_type(ty).deref(db.upcast());
+453        let abi_ty = db.codegen_abi_type(ty.deref(db.upcast()));
+454        debug_assert!(abi_ty.is_static());
+455
+456        let func_name_postfix = match abi_loc {
+457            AbiSrcLocation::CallData => "calldata",
+458            AbiSrcLocation::Memory => "memory",
+459        };
+460
+461        let args = vec![src];
+462        if ty.is_primitive(db.upcast()) {
+463            let name = format! {
+464                "$abi_decode_primitive_type_{}_from_{}",
+465                ty.0, func_name_postfix,
+466            };
+467            return self.create_then_call(&name, args, |provider| {
+468                make_abi_decode_primitive_type(provider, db, &name, ty, abi_loc)
+469            });
+470        }
+471
+472        let name = format! {
+473            "$abi_decode_static_aggregate_type_{}_from_{}",
+474            ty.0, func_name_postfix,
+475        };
+476        self.create_then_call(&name, args, |provider| {
+477            make_abi_decode_static_aggregate_type(provider, db, &name, ty, abi_loc)
+478        })
+479    }
+480
+481    fn abi_decode_dynamic(
+482        &mut self,
+483        db: &dyn CodegenDb,
+484        src: yul::Expression,
+485        ty: TypeId,
+486        abi_loc: AbiSrcLocation,
+487    ) -> yul::Expression {
+488        let ty = db.codegen_legalized_type(ty).deref(db.upcast());
+489        let abi_ty = db.codegen_abi_type(ty.deref(db.upcast()));
+490        debug_assert!(!abi_ty.is_static());
+491
+492        let func_name_postfix = match abi_loc {
+493            AbiSrcLocation::CallData => "calldata",
+494            AbiSrcLocation::Memory => "memory",
+495        };
+496
+497        let mut args = vec![src];
+498        match abi_ty {
+499            AbiType::String => {
+500                let len = match &ty.data(db.upcast()).kind {
+501                    TypeKind::String(len) => *len,
+502                    _ => unreachable!(),
+503                };
+504                args.push(literal_expression! {(len)});
+505                let name = format! {"$abi_decode_string_from_{func_name_postfix}"};
+506                self.create_then_call(&name, args, |provider| {
+507                    make_abi_decode_string_type(provider, db, &name, abi_loc)
+508                })
+509            }
+510
+511            AbiType::Bytes => {
+512                let len = match &ty.data(db.upcast()).kind {
+513                    TypeKind::Array(ArrayDef { len, .. }) => *len,
+514                    _ => unreachable!(),
+515                };
+516                args.push(literal_expression! {(len)});
+517                let name = format! {"$abi_decode_bytes_from_{func_name_postfix}"};
+518                self.create_then_call(&name, args, |provider| {
+519                    make_abi_decode_bytes_type(provider, db, &name, abi_loc)
+520                })
+521            }
+522
+523            AbiType::Array { .. } => {
+524                let name =
+525                    format! {"$abi_decode_dynamic_array_{}_from_{}", ty.0, func_name_postfix};
+526                self.create_then_call(&name, args, |provider| {
+527                    make_abi_decode_dynamic_elem_array_type(provider, db, &name, ty, abi_loc)
+528                })
+529            }
+530
+531            AbiType::Tuple(_) => {
+532                let name =
+533                    format! {"$abi_decode_dynamic_aggregate_{}_from_{}", ty.0, func_name_postfix};
+534                self.create_then_call(&name, args, |provider| {
+535                    make_abi_decode_dynamic_aggregate_type(provider, db, &name, ty, abi_loc)
+536                })
+537            }
+538
+539            _ => unreachable!(),
+540        }
+541    }
+542}
+543
+544fn make_abi_decode_primitive_type(
+545    provider: &mut DefaultRuntimeProvider,
+546    db: &dyn CodegenDb,
+547    func_name: &str,
+548    ty: TypeId,
+549    abi_loc: AbiSrcLocation,
+550) -> RuntimeFunction {
+551    debug_assert! {ty.is_primitive(db.upcast())}
+552    let func_name = YulVariable::new(func_name);
+553    let src = YulVariable::new("src");
+554    let ret = YulVariable::new("ret");
+555
+556    let decode = match abi_loc {
+557        AbiSrcLocation::CallData => {
+558            statement! { [ret.ident()] := calldataload([src.expr()]) }
+559        }
+560        AbiSrcLocation::Memory => {
+561            statement! { [ret.ident()] := mload([src.expr()]) }
+562        }
+563    };
+564
+565    let ty_size_bits = ty.size_of(db.upcast(), SLOT_SIZE) * 8;
+566    let validation = if ty_size_bits == 256 {
+567        statements! {}
+568    } else if ty.is_signed(db.upcast()) {
+569        let shift_num = literal_expression! { ( ty_size_bits - 1) };
+570        let tmp1 = YulVariable::new("tmp1");
+571        let tmp2 = YulVariable::new("tmp2");
+572        statements! {
+573            (let [tmp1.ident()] := iszero((shr([shift_num.clone()], [ret.expr()]))))
+574            (let [tmp2.ident()] := iszero((shr([shift_num], (not([ret.expr()]))))))
+575            (if (iszero((or([tmp1.expr()], [tmp2.expr()])))) {
+576                [revert_with_invalid_abi_data(provider, db)]
+577            })
+578        }
+579    } else {
+580        let shift_num = literal_expression! { ( ty_size_bits) };
+581        let tmp = YulVariable::new("tmp");
+582        statements! {
+583            (let [tmp.ident()] := iszero((shr([shift_num], [ret.expr()]))))
+584            (if (iszero([tmp.expr()])) {
+585                [revert_with_invalid_abi_data(provider, db)]
+586            })
+587        }
+588    };
+589
+590    let func = function_definition! {
+591            function [func_name.ident()]([src.ident()]) -> [ret.ident()] {
+592                ([decode])
+593                [validation...]
+594        }
+595    };
+596
+597    RuntimeFunction::from_statement(func)
+598}
+599
+600fn make_abi_decode_static_aggregate_type(
+601    provider: &mut DefaultRuntimeProvider,
+602    db: &dyn CodegenDb,
+603    func_name: &str,
+604    ty: TypeId,
+605    abi_loc: AbiSrcLocation,
+606) -> RuntimeFunction {
+607    debug_assert!(ty.is_aggregate(db.upcast()));
+608
+609    let func_name = YulVariable::new(func_name);
+610    let src = YulVariable::new("src");
+611    let ret = YulVariable::new("ret");
+612    let field_data = YulVariable::new("field_data");
+613    let type_size = literal_expression! { (ty.size_of(db.upcast(), SLOT_SIZE)) };
+614
+615    let mut body = statements! {
+616        (let [field_data.ident()] := 0)
+617        ([ret.ident()] := [provider.alloc(db, type_size)])
+618    };
+619
+620    let field_num = ty.aggregate_field_num(db.upcast());
+621    for idx in 0..field_num {
+622        let field_ty = ty.projection_ty_imm(db.upcast(), idx);
+623        let field_ty_size = field_ty.size_of(db.upcast(), SLOT_SIZE);
+624        body.push(statement! { [field_data.ident()] := [provider.abi_decode_static(db, src.expr(), field_ty, abi_loc)] });
+625
+626        let dst_offset =
+627            literal_expression! { (ty.aggregate_elem_offset(db.upcast(), idx, SLOT_SIZE)) };
+628        let field_ty_ptr = make_ptr(db, field_ty, false);
+629        if field_ty.is_primitive(db.upcast()) {
+630            body.push(yul::Statement::Expression(provider.ptr_store(
+631                db,
+632                expression! {add([ret.expr()], [dst_offset])},
+633                field_data.expr(),
+634                field_ty_ptr,
+635            )));
+636        } else {
+637            body.push(yul::Statement::Expression(provider.ptr_copy(
+638                db,
+639                field_data.expr(),
+640                expression! {add([ret.expr()], [dst_offset])},
+641                literal_expression! { (field_ty_size) },
+642                false,
+643                false,
+644            )));
+645        }
+646
+647        if idx < field_num - 1 {
+648            let abi_field_ty = db.codegen_abi_type(field_ty);
+649            let field_abi_ty_size = literal_expression! { (abi_field_ty.header_size()) };
+650            body.push(assignment! {[src.ident()] :=  add([src.expr()], [field_abi_ty_size])});
+651        }
+652    }
+653
+654    let func_def = yul::FunctionDefinition {
+655        name: func_name.ident(),
+656        parameters: vec![src.ident()],
+657        returns: vec![ret.ident()],
+658        block: yul::Block { statements: body },
+659    };
+660
+661    RuntimeFunction(func_def)
+662}
+663
+664fn make_abi_decode_string_type(
+665    provider: &mut DefaultRuntimeProvider,
+666    db: &dyn CodegenDb,
+667    func_name: &str,
+668    abi_loc: AbiSrcLocation,
+669) -> RuntimeFunction {
+670    let func_name = YulVariable::new(func_name);
+671    let src = YulVariable::new("src");
+672    let decoded_data = YulVariable::new("decoded_data");
+673    let decoded_size = YulVariable::new("decoded_size");
+674    let max_len = YulVariable::new("max_len");
+675    let string_size = YulVariable::new("string_size");
+676    let dst_size = YulVariable::new("dst_size");
+677    let end_word = YulVariable::new("end_word");
+678    let end_word_ptr = YulVariable::new("end_word_ptr");
+679    let padding_size_bits = YulVariable::new("padding_size_bits");
+680    let primitive_ty_ptr = make_ptr(db, yul_primitive_type(db), false);
+681
+682    let func = function_definition! {
+683        function [func_name.ident()]([src.ident()], [max_len.ident()]) -> [(vec![decoded_data.ident(), decoded_size.ident()])...] {
+684            (let string_len := [provider.abi_decode_static(db, src.expr(), primitive_ty_ptr, abi_loc)])
+685            (if (gt(string_len, [max_len.expr()])) { [revert_with_invalid_abi_data(provider, db)] } )
+686            (let [string_size.ident()] := add(string_len, 32))
+687            ([decoded_size.ident()] := mul((div((add([string_size.expr()], 31)), 32)), 32))
+688            (let [end_word_ptr.ident()] := sub((add([src.expr()], [decoded_size.expr()])), 32))
+689            (let [end_word.ident()] := [provider.abi_decode_static(db, end_word_ptr.expr(), primitive_ty_ptr, abi_loc)])
+690            (let [padding_size_bits.ident()] := mul((sub([decoded_size.expr()], [string_size.expr()])), 8))
+691            [(check_right_padding(provider, db, end_word.expr(), padding_size_bits.expr()))...]
+692            (let [dst_size.ident()] := add([max_len.expr()], 32))
+693            ([decoded_data.ident()] := [provider.alloc(db, dst_size.expr())])
+694            ([ptr_copy_decode(provider, db, src.expr(), decoded_data.expr(), string_size.expr(), abi_loc)])
+695        }
+696    };
+697
+698    RuntimeFunction::from_statement(func)
+699}
+700
+701fn make_abi_decode_bytes_type(
+702    provider: &mut DefaultRuntimeProvider,
+703    db: &dyn CodegenDb,
+704    func_name: &str,
+705    abi_loc: AbiSrcLocation,
+706) -> RuntimeFunction {
+707    let func_name = YulVariable::new(func_name);
+708    let src = YulVariable::new("src");
+709    let decoded_data = YulVariable::new("decoded_data");
+710    let decoded_size = YulVariable::new("decoded_size");
+711    let max_len = YulVariable::new("max_len");
+712    let bytes_size = YulVariable::new("bytes_size");
+713    let end_word = YulVariable::new("end_word");
+714    let end_word_ptr = YulVariable::new("end_word_ptr");
+715    let padding_size_bits = YulVariable::new("padding_size_bits");
+716    let primitive_ty_ptr = make_ptr(db, yul_primitive_type(db), false);
+717
+718    let func = function_definition! {
+719        function [func_name.ident()]([src.ident()], [max_len.ident()]) -> [(vec![decoded_data.ident(),decoded_size.ident()])...] {
+720            (let [bytes_size.ident()] := [provider.abi_decode_static(db, src.expr(), primitive_ty_ptr, abi_loc)])
+721            (if (iszero((eq([bytes_size.expr()], [max_len.expr()])))) { [revert_with_invalid_abi_data(provider, db)] } )
+722            ([src.ident()] := add([src.expr()], 32))
+723            (let padded_data_size := mul((div((add([bytes_size.expr()], 31)), 32)), 32))
+724            ([decoded_size.ident()] := add(padded_data_size, 32))
+725            (let [end_word_ptr.ident()] := sub((add([src.expr()], padded_data_size)), 32))
+726            (let [end_word.ident()] := [provider.abi_decode_static(db, end_word_ptr.expr(), primitive_ty_ptr, abi_loc)])
+727            (let [padding_size_bits.ident()] := mul((sub(padded_data_size, [bytes_size.expr()])), 8))
+728            [(check_right_padding(provider, db, end_word.expr(), padding_size_bits.expr()))...]
+729            ([decoded_data.ident()] := [provider.alloc(db, max_len.expr())])
+730            ([ptr_copy_decode(provider, db, src.expr(), decoded_data.expr(), bytes_size.expr(), abi_loc)])
+731        }
+732    };
+733
+734    RuntimeFunction::from_statement(func)
+735}
+736
+737fn make_abi_decode_dynamic_elem_array_type(
+738    provider: &mut DefaultRuntimeProvider,
+739    db: &dyn CodegenDb,
+740    func_name: &str,
+741    legalized_ty: TypeId,
+742    abi_loc: AbiSrcLocation,
+743) -> RuntimeFunction {
+744    let deref_ty = legalized_ty.deref(db.upcast());
+745    let (elem_ty, len) = match &deref_ty.data(db.upcast()).kind {
+746        ir::TypeKind::Array(def) => (def.elem_ty, def.len),
+747        _ => unreachable!(),
+748    };
+749    let elem_ty_size = literal_expression! { (deref_ty.array_elem_size(db.upcast(), SLOT_SIZE)) };
+750    let total_header_size = literal_expression! { (32 * len) };
+751    let iter_count = literal_expression! { (len) };
+752    let ret_size = literal_expression! { (deref_ty.size_of(db.upcast(), SLOT_SIZE)) };
+753
+754    let func_name = YulVariable::new(func_name);
+755    let src = YulVariable::new("src");
+756    let header_ptr = YulVariable::new("header_ptr");
+757    let data_ptr = YulVariable::new("data_ptr");
+758    let decoded_data = YulVariable::new("decoded_data");
+759    let decoded_size = YulVariable::new("decoded_size");
+760    let decoded_size_tmp = YulVariable::new("decoded_size_tmp");
+761    let ret_elem_ptr = YulVariable::new("ret_elem_ptr");
+762    let elem_data = YulVariable::new("elem_data");
+763
+764    let func = function_definition! {
+765        function [func_name.ident()]([src.ident()]) -> [decoded_data.ident()], [decoded_size.ident()] {
+766            ([decoded_data.ident()] := [provider.alloc(db, ret_size)])
+767            ([decoded_size.ident()] := [total_header_size])
+768            (let [decoded_size_tmp.ident()] := 0)
+769            (let [header_ptr.ident()] := [src.expr()])
+770            (let [data_ptr.ident()] := 0)
+771            (let [elem_data.ident()] := 0)
+772            (let [ret_elem_ptr.ident()] := [decoded_data.expr()])
+773
+774            (for {(let i := 0)} (lt(i, [iter_count])) {(i := (add(i, 1)))}
+775             {
+776                 ([data_ptr.ident()] := add([src.expr()], [provider.abi_decode_static(db, header_ptr.expr(), yul_primitive_type(db), abi_loc)]))
+777                 ([assignment! {[elem_data.ident()], [decoded_size_tmp.ident()] := [provider.abi_decode_dynamic(db, data_ptr.expr(), elem_ty, abi_loc)] }])
+778                 ([decoded_size.ident()] := add([decoded_size.expr()], [decoded_size_tmp.expr()]))
+779                 ([yul::Statement::Expression(provider.ptr_copy(db, elem_data.expr(), ret_elem_ptr.expr(), elem_ty_size.clone(), false, false))])
+780                 ([header_ptr.ident()] := add([header_ptr.expr()], 32))
+781                 ([ret_elem_ptr.ident()] := add([ret_elem_ptr.expr()], [elem_ty_size]))
+782             })
+783        }
+784    };
+785
+786    RuntimeFunction::from_statement(func)
+787}
+788
+789fn make_abi_decode_dynamic_aggregate_type(
+790    provider: &mut DefaultRuntimeProvider,
+791    db: &dyn CodegenDb,
+792    func_name: &str,
+793    legalized_ty: TypeId,
+794    abi_loc: AbiSrcLocation,
+795) -> RuntimeFunction {
+796    let deref_ty = legalized_ty.deref(db.upcast());
+797    let type_size = literal_expression! { (deref_ty.size_of(db.upcast(), SLOT_SIZE)) };
+798
+799    let func_name = YulVariable::new(func_name);
+800    let src = YulVariable::new("src");
+801    let header_ptr = YulVariable::new("header_ptr");
+802    let data_offset = YulVariable::new("data_offset");
+803    let decoded_data = YulVariable::new("decoded_data");
+804    let decoded_size = YulVariable::new("decoded_size");
+805    let decoded_size_tmp = YulVariable::new("decoded_size_tmp");
+806    let ret_field_ptr = YulVariable::new("ret_field_ptr");
+807    let field_data = YulVariable::new("field_data");
+808
+809    let mut body = statements! {
+810            ([decoded_data.ident()] := [provider.alloc(db, type_size)])
+811            ([decoded_size.ident()] := 0)
+812            (let [decoded_size_tmp.ident()] := 0)
+813            (let [header_ptr.ident()] := [src.expr()])
+814            (let [data_offset.ident()] := 0)
+815            (let [field_data.ident()] := 0)
+816            (let [ret_field_ptr.ident()] := 0)
+817    };
+818
+819    for i in 0..deref_ty.aggregate_field_num(db.upcast()) {
+820        let field_ty = deref_ty.projection_ty_imm(db.upcast(), i);
+821        let field_size = field_ty.size_of(db.upcast(), SLOT_SIZE);
+822        let field_abi_ty = db.codegen_abi_type(field_ty);
+823        let field_offset = deref_ty.aggregate_elem_offset(db.upcast(), i, SLOT_SIZE);
+824
+825        let decode_data = if field_abi_ty.is_static() {
+826            statements! {
+827                ([field_data.ident()] := [provider.abi_decode_static(db, header_ptr.expr(), field_ty, abi_loc)])
+828                ([decoded_size_tmp.ident()] := [literal_expression!{ (field_abi_ty.header_size()) }])
+829            }
+830        } else {
+831            statements! {
+832                ([data_offset.ident()] := [provider.abi_decode_static(db, header_ptr.expr(), yul_primitive_type(db), abi_loc)])
+833                ([assignment! {
+834                    [field_data.ident()], [decoded_size_tmp.ident()] :=
+835                    [provider.abi_decode_dynamic(
+836                        db,
+837                        expression!{ add([src.expr()], [data_offset.expr()]) },
+838                        field_ty,
+839                        abi_loc
+840                    )]
+841                }])
+842                ([decoded_size_tmp.ident()] := add([decoded_size_tmp.expr()], 32))
+843            }
+844        };
+845        body.extend_from_slice(&decode_data);
+846        body.push(assignment!{ [decoded_size.ident()] := add([decoded_size.expr()], [decoded_size_tmp.expr()]) });
+847
+848        body.push(assignment! { [ret_field_ptr.ident()] := add([decoded_data.expr()], [literal_expression!{ (field_offset) }])});
+849        let copy_to_ret = if field_ty.is_primitive(db.upcast()) {
+850            let field_ptr_ty = make_ptr(db, field_ty, false);
+851            yul::Statement::Expression(provider.ptr_store(
+852                db,
+853                ret_field_ptr.expr(),
+854                field_data.expr(),
+855                field_ptr_ty,
+856            ))
+857        } else {
+858            yul::Statement::Expression(provider.ptr_copy(
+859                db,
+860                field_data.expr(),
+861                ret_field_ptr.expr(),
+862                literal_expression! { (field_size) },
+863                false,
+864                false,
+865            ))
+866        };
+867        body.push(copy_to_ret);
+868
+869        let header_size = literal_expression! { (field_abi_ty.header_size()) };
+870        body.push(statement! {
+871            [header_ptr.ident()] := add([header_ptr.expr()], [header_size])
+872        });
+873    }
+874
+875    let func_def = yul::FunctionDefinition {
+876        name: func_name.ident(),
+877        parameters: vec![src.ident()],
+878        returns: vec![decoded_data.ident(), decoded_size.ident()],
+879        block: yul::Block { statements: body },
+880    };
+881
+882    RuntimeFunction(func_def)
+883}
+884
+885enum AbiEncodingSize {
+886    Static(usize),
+887    Bounded { min: usize, max: usize },
+888}
+889
+890fn abi_enc_size(db: &dyn CodegenDb, types: &[TypeId]) -> AbiEncodingSize {
+891    let mut min = 0;
+892    let mut max = 0;
+893    for &ty in types {
+894        let legalized_ty = db.codegen_legalized_type(ty);
+895        min += db.codegen_abi_type_minimum_size(legalized_ty);
+896        max += db.codegen_abi_type_maximum_size(legalized_ty);
+897    }
+898
+899    if min == max {
+900        AbiEncodingSize::Static(min)
+901    } else {
+902        AbiEncodingSize::Bounded { min, max }
+903    }
+904}
+905
+906fn revert_with_invalid_abi_data(
+907    provider: &mut dyn RuntimeProvider,
+908    db: &dyn CodegenDb,
+909) -> yul::Statement {
+910    const ERROR_INVALID_ABI_DATA: usize = 0x103;
+911    let error_code = literal_expression! { (ERROR_INVALID_ABI_DATA) };
+912    error_revert_numeric(provider, db, error_code)
+913}
+914
+915fn check_right_padding(
+916    provider: &mut dyn RuntimeProvider,
+917    db: &dyn CodegenDb,
+918    val: yul::Expression,
+919    size_bits: yul::Expression,
+920) -> Vec<yul::Statement> {
+921    statements! {
+922        (let bits_shifted := sub(256, [size_bits]))
+923        (let is_ok := iszero((shl(bits_shifted, [val]))))
+924        (if (iszero((is_ok))) {
+925            [revert_with_invalid_abi_data(provider, db)]
+926        })
+927    }
+928}
+929
+930fn ptr_copy_decode(
+931    provider: &mut DefaultRuntimeProvider,
+932    db: &dyn CodegenDb,
+933    src: yul::Expression,
+934    dst: yul::Expression,
+935    len: yul::Expression,
+936    loc: AbiSrcLocation,
+937) -> yul::Statement {
+938    match loc {
+939        AbiSrcLocation::CallData => {
+940            statement! { calldatacopy([dst], [src], [len]) }
+941        }
+942        AbiSrcLocation::Memory => {
+943            yul::Statement::Expression(provider.ptr_copy(db, src, dst, len, false, false))
+944        }
+945    }
+946}
+947
+948fn ceil_32(len: usize) -> usize {
+949    ((len + 31) / 32) * 32
+950}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/runtime/contract.rs.html b/compiler-docs/src/fe_codegen/yul/runtime/contract.rs.html new file mode 100644 index 0000000000..c46f011fb8 --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/runtime/contract.rs.html @@ -0,0 +1,127 @@ +contract.rs - source

fe_codegen/yul/runtime/
contract.rs

1use crate::{
+2    db::CodegenDb,
+3    yul::{runtime::AbiSrcLocation, YulVariable},
+4};
+5
+6use super::{DefaultRuntimeProvider, RuntimeFunction, RuntimeProvider};
+7
+8use fe_analyzer::namespace::items::ContractId;
+9use fe_mir::ir::{FunctionId, Type, TypeKind};
+10
+11use yultsur::*;
+12
+13pub(super) fn make_create(
+14    provider: &mut DefaultRuntimeProvider,
+15    db: &dyn CodegenDb,
+16    func_name: &str,
+17    contract: ContractId,
+18) -> RuntimeFunction {
+19    let func_name = YulVariable::new(func_name);
+20    let contract_symbol = literal_expression! {
+21        (format!(r#""{}""#, db.codegen_contract_deployer_symbol_name(contract)))
+22    };
+23
+24    let size = YulVariable::new("size");
+25    let value = YulVariable::new("value");
+26    let func = function_definition! {
+27        function [func_name.ident()]([value.ident()]) -> addr {
+28            (let [size.ident()] := datasize([contract_symbol.clone()]))
+29            (let mem_ptr := [provider.avail(db)])
+30            (let contract_ptr := dataoffset([contract_symbol]))
+31            (datacopy(mem_ptr, contract_ptr, [size.expr()]))
+32            (addr := create([value.expr()], mem_ptr, [size.expr()]))
+33        }
+34    };
+35
+36    RuntimeFunction::from_statement(func)
+37}
+38
+39pub(super) fn make_create2(
+40    provider: &mut DefaultRuntimeProvider,
+41    db: &dyn CodegenDb,
+42    func_name: &str,
+43    contract: ContractId,
+44) -> RuntimeFunction {
+45    let func_name = YulVariable::new(func_name);
+46    let contract_symbol = literal_expression! {
+47        (format!(r#""{}""#, db.codegen_contract_deployer_symbol_name(contract)))
+48    };
+49
+50    let size = YulVariable::new("size");
+51    let value = YulVariable::new("value");
+52    let func = function_definition! {
+53        function [func_name.ident()]([value.ident()], salt) -> addr {
+54            (let [size.ident()] := datasize([contract_symbol.clone()]))
+55            (let mem_ptr := [provider.avail(db)])
+56            (let contract_ptr := dataoffset([contract_symbol]))
+57            (datacopy(mem_ptr, contract_ptr, [size.expr()]))
+58            (addr := create2([value.expr()], mem_ptr, [size.expr()], salt))
+59        }
+60    };
+61
+62    RuntimeFunction::from_statement(func)
+63}
+64
+65pub(super) fn make_external_call(
+66    provider: &mut DefaultRuntimeProvider,
+67    db: &dyn CodegenDb,
+68    func_name: &str,
+69    function: FunctionId,
+70) -> RuntimeFunction {
+71    let func_name = YulVariable::new(func_name);
+72    let sig = db.codegen_legalized_signature(function);
+73    let param_num = sig.params.len();
+74
+75    let mut args = Vec::with_capacity(param_num);
+76    let mut arg_tys = Vec::with_capacity(param_num);
+77    for param in &sig.params {
+78        args.push(YulVariable::new(param.name.as_str()));
+79        arg_tys.push(param.ty);
+80    }
+81    let ret_ty = sig.return_type;
+82
+83    let func_addr = YulVariable::new("func_addr");
+84    let params: Vec<_> = args.iter().map(YulVariable::ident).collect();
+85    let params_expr: Vec<_> = args.iter().map(YulVariable::expr).collect();
+86    let input = YulVariable::new("input");
+87    let input_size = YulVariable::new("input_size");
+88    let output_size = YulVariable::new("output_size");
+89    let output = YulVariable::new("output");
+90
+91    let func_selector = literal_expression! { (format!{"0x{}", db.codegen_abi_function(function).selector().hex()}) };
+92    let selector_ty = db.mir_intern_type(Type::new(TypeKind::U32, None).into());
+93
+94    let mut body = statements! {
+95            (let [input.ident()] := [provider.avail(db)])
+96            [yul::Statement::Expression(provider.ptr_store(db, input.expr(), func_selector, selector_ty.make_mptr(db.upcast())))]
+97            (let [input_size.ident()] := add(4, [provider.abi_encode_seq(db, &params_expr, expression!{ add([input.expr()], 4) }, &arg_tys, false)]))
+98            (let [output.ident()] := add([provider.avail(db)], [input_size.expr()]))
+99            (let success := call((gas()), [func_addr.expr()], 0, [input.expr()], [input_size.expr()], 0, 0))
+100            (let [output_size.ident()] := returndatasize())
+101            (returndatacopy([output.expr()], 0, [output_size.expr()]))
+102            (if (iszero(success)) {
+103                (revert([output.expr()], [output_size.expr()]))
+104            })
+105    };
+106    let func = if let Some(ret_ty) = ret_ty {
+107        let ret = YulVariable::new("$ret");
+108        body.push(
+109            statement!{
+110                [ret.ident()] := [provider.abi_decode(db, output.expr(), output_size.expr(), &[ret_ty], AbiSrcLocation::Memory)]
+111            }
+112        );
+113        function_definition! {
+114            function [func_name.ident()]([func_addr.ident()], [params...]) -> [ret.ident()] {
+115                [body...]
+116            }
+117        }
+118    } else {
+119        function_definition! {
+120            function [func_name.ident()]([func_addr.ident()], [params...]) {
+121                [body...]
+122            }
+123        }
+124    };
+125
+126    RuntimeFunction::from_statement(func)
+127}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/runtime/data.rs.html b/compiler-docs/src/fe_codegen/yul/runtime/data.rs.html new file mode 100644 index 0000000000..655e203b2a --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/runtime/data.rs.html @@ -0,0 +1,461 @@ +data.rs - source

fe_codegen/yul/runtime/
data.rs

1use crate::{
+2    db::CodegenDb,
+3    yul::{
+4        runtime::{make_ptr, BitMask},
+5        slot_size::{yul_primitive_type, SLOT_SIZE},
+6        YulVariable,
+7    },
+8};
+9
+10use super::{DefaultRuntimeProvider, RuntimeFunction, RuntimeProvider};
+11
+12use fe_mir::ir::{types::TupleDef, Type, TypeId, TypeKind};
+13
+14use yultsur::*;
+15
+16const HASH_SCRATCH_SPACE_START: usize = 0x00;
+17const HASH_SCRATCH_SPACE_SIZE: usize = 64;
+18const FREE_MEMORY_ADDRESS_STORE: usize = HASH_SCRATCH_SPACE_START + HASH_SCRATCH_SPACE_SIZE;
+19const FREE_MEMORY_START: usize = FREE_MEMORY_ADDRESS_STORE + 32;
+20
+21pub(super) fn make_alloc(func_name: &str) -> RuntimeFunction {
+22    let func_name = YulVariable::new(func_name);
+23    let free_address_ptr = literal_expression! {(FREE_MEMORY_ADDRESS_STORE)};
+24    let free_memory_start = literal_expression! {(FREE_MEMORY_START)};
+25    let func = function_definition! {
+26        function [func_name.ident()](size) -> ptr {
+27            (ptr := mload([free_address_ptr.clone()]))
+28            (if (eq(ptr, 0x00)) { (ptr := [free_memory_start]) })
+29            (mstore([free_address_ptr], (add(ptr, size))))
+30        }
+31    };
+32
+33    RuntimeFunction::from_statement(func)
+34}
+35
+36pub(super) fn make_avail(func_name: &str) -> RuntimeFunction {
+37    let func_name = YulVariable::new(func_name);
+38    let free_address_ptr = literal_expression! {(FREE_MEMORY_ADDRESS_STORE)};
+39    let free_memory_start = literal_expression! {(FREE_MEMORY_START)};
+40    let func = function_definition! {
+41        function [func_name.ident()]() -> ptr {
+42            (ptr := mload([free_address_ptr]))
+43            (if (eq(ptr, 0x00)) { (ptr := [free_memory_start]) })
+44        }
+45    };
+46
+47    RuntimeFunction::from_statement(func)
+48}
+49
+50pub(super) fn make_mcopym(func_name: &str) -> RuntimeFunction {
+51    let func_name = YulVariable::new(func_name);
+52    let src = YulVariable::new("src");
+53    let dst = YulVariable::new("dst");
+54    let size = YulVariable::new("size");
+55
+56    let func = function_definition! {
+57        function [func_name.ident()]([src.ident()], [dst.ident()], [size.ident()]) {
+58            (let iter_count := div([size.expr()], 32))
+59            (let original_src := [src.expr()])
+60            (for {(let i := 0)} (lt(i, iter_count)) {(i := (add(i, 1)))}
+61            {
+62                (mstore([dst.expr()], (mload([src.expr()]))))
+63                ([src.ident()] := add([src.expr()], 32))
+64                ([dst.ident()] := add([dst.expr()], 32))
+65            })
+66
+67            (let rem := sub([size.expr()], (sub([src.expr()], original_src))))
+68            (if (gt(rem, 0)) {
+69                (let rem_bits := mul(rem, 8))
+70                (let dst_mask := sub((shl((sub(256, rem_bits)), 1)), 1))
+71                (let src_mask := not(dst_mask))
+72                (let src_value := and((mload([src.expr()])), src_mask))
+73                (let dst_value := and((mload([dst.expr()])), dst_mask))
+74                (mstore([dst.expr()], (or(src_value, dst_value))))
+75            })
+76        }
+77    };
+78
+79    RuntimeFunction::from_statement(func)
+80}
+81
+82pub(super) fn make_mcopys(func_name: &str) -> RuntimeFunction {
+83    let func_name = YulVariable::new(func_name);
+84    let src = YulVariable::new("src");
+85    let dst = YulVariable::new("dst");
+86    let size = YulVariable::new("size");
+87
+88    let func = function_definition! {
+89        function [func_name.ident()]([src.ident()], [dst.ident()], [size.ident()]) {
+90            ([dst.ident()] := div([dst.expr()], 32))
+91            (let iter_count := div([size.expr()], 32))
+92            (let original_src := [src.expr()])
+93            (for {(let i := 0)} (lt(i, iter_count)) {(i := (add(i, 1)))}
+94            {
+95                (sstore([dst.expr()], (mload([src.expr()]))))
+96                ([src.ident()] := add([src.expr()], 32))
+97                ([dst.ident()] := add([dst.expr()], 1))
+98            })
+99
+100            (let rem := sub([size.expr()], (sub([src.expr()], original_src))))
+101            (if (gt(rem, 0)) {
+102                (let rem_bits := mul(rem, 8))
+103                (let dst_mask := sub((shl((sub(256, rem_bits)), 1)), 1))
+104                (let src_mask := not(dst_mask))
+105                (let src_value := and((mload([src.expr()])), src_mask))
+106                (let dst_value := and((sload([dst.expr()])), dst_mask))
+107                (sstore([dst.expr()], (or(src_value, dst_value))))
+108            })
+109        }
+110    };
+111
+112    RuntimeFunction::from_statement(func)
+113}
+114
+115pub(super) fn make_scopym(func_name: &str) -> RuntimeFunction {
+116    let func_name = YulVariable::new(func_name);
+117    let src = YulVariable::new("src");
+118    let dst = YulVariable::new("dst");
+119    let size = YulVariable::new("size");
+120
+121    let func = function_definition! {
+122        function [func_name.ident()]([src.ident()], [dst.ident()], [size.ident()]) {
+123            ([src.ident()] := div([src.expr()], 32))
+124            (let iter_count := div([size.expr()], 32))
+125            (let original_dst := [dst.expr()])
+126            (for {(let i := 0)} (lt(i, iter_count)) {(i := (add(i, 1)))}
+127            {
+128                (mstore([dst.expr()], (sload([src.expr()]))))
+129                ([src.ident()] := add([src.expr()], 1))
+130                ([dst.ident()] := add([dst.expr()], 32))
+131            })
+132
+133            (let rem := sub([size.expr()], (sub([dst.expr()], original_dst))))
+134            (if (gt(rem, 0)) {
+135                (let rem_bits := mul(rem, 8))
+136                (let dst_mask := sub((shl((sub(256, rem_bits)), 1)), 1))
+137                (let src_mask := not(dst_mask))
+138                (let src_value := and((sload([src.expr()])), src_mask))
+139                (let dst_value := and((mload([dst.expr()])), dst_mask))
+140                (mstore([dst.expr()], (or(src_value, dst_value))))
+141            })
+142        }
+143    };
+144
+145    RuntimeFunction::from_statement(func)
+146}
+147
+148pub(super) fn make_scopys(func_name: &str) -> RuntimeFunction {
+149    let func_name = YulVariable::new(func_name);
+150    let src = YulVariable::new("src");
+151    let dst = YulVariable::new("dst");
+152    let size = YulVariable::new("size");
+153    let func = function_definition! {
+154        function [func_name.ident()]([src.ident()], [dst.ident()], [size.ident()]) {
+155            ([src.ident()] := div([src.expr()], 32))
+156            ([dst.ident()] := div([dst.expr()], 32))
+157            (let iter_count := div((add([size.expr()], 31)), 32))
+158            (for {(let i := 0)} (lt(i, iter_count)) {(i := (add(i, 1)))}
+159            {
+160                (sstore([dst.expr()], (sload([src.expr()]))))
+161                ([src.ident()] := add([src.expr()], 1))
+162                ([dst.ident()] := add([dst.expr()], 1))
+163            })
+164        }
+165    };
+166
+167    RuntimeFunction::from_statement(func)
+168}
+169
+170pub(super) fn make_sptr_store(func_name: &str) -> RuntimeFunction {
+171    let func_name = YulVariable::new(func_name);
+172    let func = function_definition! {
+173        function [func_name.ident()](ptr, value, size_bits) {
+174            (let rem_bits := mul((mod(ptr, 32)), 8))
+175            (let shift_bits := sub(256, (add(rem_bits, size_bits))))
+176            (let mask := (shl(shift_bits, (sub((shl(size_bits, 1)), 1)))))
+177            (let inv_mask := not(mask))
+178            (let slot := div(ptr, 32))
+179            (let new_value := or((and((sload(slot)), inv_mask)), (and((shl(shift_bits, value)), mask))))
+180            (sstore(slot, new_value))
+181        }
+182    };
+183
+184    RuntimeFunction::from_statement(func)
+185}
+186
+187pub(super) fn make_mptr_store(func_name: &str) -> RuntimeFunction {
+188    let func_name = YulVariable::new(func_name);
+189    let func = function_definition! {
+190        function [func_name.ident()](ptr, value, shift_num, mask) {
+191            (value := shl(shift_num, value))
+192            (let ptr_value := and((mload(ptr)), mask))
+193            (value := or(value, ptr_value))
+194            (mstore(ptr, value))
+195        }
+196    };
+197
+198    RuntimeFunction::from_statement(func)
+199}
+200
+201pub(super) fn make_sptr_load(func_name: &str) -> RuntimeFunction {
+202    let func_name = YulVariable::new(func_name);
+203    let func = function_definition! {
+204        function [func_name.ident()](ptr, size_bits) -> ret {
+205            (let rem_bits := mul((mod(ptr, 32)), 8))
+206            (let shift_num := sub(256, (add(rem_bits, size_bits))))
+207            (let slot := div(ptr, 32))
+208            (ret := shr(shift_num, (sload(slot))))
+209        }
+210    };
+211
+212    RuntimeFunction::from_statement(func)
+213}
+214
+215pub(super) fn make_mptr_load(func_name: &str) -> RuntimeFunction {
+216    let func_name = YulVariable::new(func_name);
+217    let func = function_definition! {
+218        function [func_name.ident()](ptr, shift_num) -> ret {
+219            (ret := shr(shift_num, (mload(ptr))))
+220        }
+221    };
+222
+223    RuntimeFunction::from_statement(func)
+224}
+225
+226// TODO: We can optimize aggregate initialization by combining multiple
+227// `ptr_store` operations into single `ptr_store` operation.
+228pub(super) fn make_aggregate_init(
+229    provider: &mut DefaultRuntimeProvider,
+230    db: &dyn CodegenDb,
+231    func_name: &str,
+232    legalized_ty: TypeId,
+233    arg_tys: Vec<TypeId>,
+234) -> RuntimeFunction {
+235    debug_assert!(legalized_ty.is_ptr(db.upcast()));
+236    let is_sptr = legalized_ty.is_sptr(db.upcast());
+237    let inner_ty = legalized_ty.deref(db.upcast());
+238    let ptr = YulVariable::new("ptr");
+239    let field_num = inner_ty.aggregate_field_num(db.upcast());
+240
+241    let iter_field_args = || (0..field_num).map(|i| YulVariable::new(format! {"arg{i}"}));
+242
+243    let mut body = vec![];
+244    for (idx, field_arg) in iter_field_args().enumerate() {
+245        let field_arg_ty = arg_tys[idx];
+246        let field_ty = inner_ty
+247            .projection_ty_imm(db.upcast(), idx)
+248            .deref(db.upcast());
+249        let field_ty_size = field_ty.size_of(db.upcast(), SLOT_SIZE);
+250        let field_ptr_ty = make_ptr(db, field_ty, is_sptr);
+251        let field_offset =
+252            literal_expression! {(inner_ty.aggregate_elem_offset(db.upcast(), idx, SLOT_SIZE))};
+253
+254        let field_ptr = expression! { add([ptr.expr()], [field_offset] )};
+255        let copy_expr = if field_ty.is_aggregate(db.upcast()) || field_ty.is_string(db.upcast()) {
+256            // Call ptr copy function if field type is aggregate.
+257            debug_assert!(field_arg_ty.is_ptr(db.upcast()));
+258            provider.ptr_copy(
+259                db,
+260                field_arg.expr(),
+261                field_ptr,
+262                literal_expression! {(field_ty_size)},
+263                field_arg_ty.is_sptr(db.upcast()),
+264                is_sptr,
+265            )
+266        } else {
+267            // Call store function if field type is not aggregate.
+268            provider.ptr_store(db, field_ptr, field_arg.expr(), field_ptr_ty)
+269        };
+270        body.push(yul::Statement::Expression(copy_expr));
+271    }
+272
+273    let func_name = identifier! {(func_name)};
+274    let parameters = std::iter::once(ptr)
+275        .chain(iter_field_args())
+276        .map(|var| var.ident())
+277        .collect();
+278    let func_def = yul::FunctionDefinition {
+279        name: func_name,
+280        parameters,
+281        returns: vec![],
+282        block: yul::Block { statements: body },
+283    };
+284
+285    RuntimeFunction(func_def)
+286}
+287
+288pub(super) fn make_enum_init(
+289    provider: &mut DefaultRuntimeProvider,
+290    db: &dyn CodegenDb,
+291    func_name: &str,
+292    legalized_ty: TypeId,
+293    arg_tys: Vec<TypeId>,
+294) -> RuntimeFunction {
+295    debug_assert!(arg_tys.len() > 1);
+296
+297    let func_name = YulVariable::new(func_name);
+298    let is_sptr = legalized_ty.is_sptr(db.upcast());
+299    let ptr = YulVariable::new("ptr");
+300    let disc = YulVariable::new("disc");
+301    let disc_ty = arg_tys[0];
+302    let enum_data = || (0..arg_tys.len() - 1).map(|i| YulVariable::new(format! {"arg{i}"}));
+303
+304    let tuple_def = TupleDef {
+305        items: arg_tys
+306            .iter()
+307            .map(|ty| ty.deref(db.upcast()))
+308            .skip(1)
+309            .collect(),
+310    };
+311    let tuple_ty = db.mir_intern_type(
+312        Type {
+313            kind: TypeKind::Tuple(tuple_def),
+314            analyzer_ty: None,
+315        }
+316        .into(),
+317    );
+318    let data_ptr_ty = make_ptr(db, tuple_ty, is_sptr);
+319    let data_offset = legalized_ty
+320        .deref(db.upcast())
+321        .enum_data_offset(db.upcast(), SLOT_SIZE);
+322    let enum_data_init = statements! {
+323        [statement! {[ptr.ident()] := add([ptr.expr()], [literal_expression!{(data_offset)}])}]
+324        [yul::Statement::Expression(provider.aggregate_init(
+325        db,
+326        ptr.expr(),
+327        enum_data().map(|arg| arg.expr()).collect(),
+328        data_ptr_ty, arg_tys.iter().skip(1).copied().collect()))]
+329    };
+330
+331    let enum_data_args: Vec<_> = enum_data().map(|var| var.ident()).collect();
+332    let func_def = function_definition! {
+333        function [func_name.ident()]([ptr.ident()], [disc.ident()], [enum_data_args...]) {
+334            [yul::Statement::Expression(provider.ptr_store(db, ptr.expr(), disc.expr(), make_ptr(db, disc_ty, is_sptr)))]
+335            [enum_data_init...]
+336        }
+337    };
+338    RuntimeFunction::from_statement(func_def)
+339}
+340
+341pub(super) fn make_string_copy(
+342    provider: &mut DefaultRuntimeProvider,
+343    db: &dyn CodegenDb,
+344    func_name: &str,
+345    data: &str,
+346    is_dst_storage: bool,
+347) -> RuntimeFunction {
+348    let func_name = YulVariable::new(func_name);
+349    let dst_ptr = YulVariable::new("dst_ptr");
+350    let symbol_name = literal_expression! { (format!(r#""{}""#, db.codegen_constant_string_symbol_name(data.to_string()))) };
+351
+352    let func = if is_dst_storage {
+353        let tmp_ptr = YulVariable::new("tmp_ptr");
+354        let data_size = YulVariable::new("data_size");
+355        function_definition! {
+356            function [func_name.ident()]([dst_ptr.ident()]) {
+357                (let [tmp_ptr.ident()] := [provider.avail(db)])
+358                (let data_offset := dataoffset([symbol_name.clone()]))
+359                (let [data_size.ident()] := datasize([symbol_name]))
+360                (let len_slot := div([dst_ptr.expr()], 32))
+361                (sstore(len_slot, [data_size.expr()]))
+362                (datacopy([tmp_ptr.expr()], data_offset, [data_size.expr()]))
+363                ([dst_ptr.ident()] := add([dst_ptr.expr()], 32))
+364                ([yul::Statement::Expression(
+365                    provider.ptr_copy(db, tmp_ptr.expr(), dst_ptr.expr(), data_size.expr(), false, true))
+366                ])
+367            }
+368        }
+369    } else {
+370        function_definition! {
+371            function [func_name.ident()]([dst_ptr.ident()]) {
+372                (let data_offset := dataoffset([symbol_name.clone()]))
+373                (let data_size := datasize([symbol_name]))
+374                (mstore([dst_ptr.expr()], data_size))
+375                ([dst_ptr.ident()] := add([dst_ptr.expr()], 32))
+376                (datacopy([dst_ptr.expr()], data_offset, data_size))
+377            }
+378        }
+379    };
+380
+381    RuntimeFunction::from_statement(func)
+382}
+383
+384pub(super) fn make_string_construct(
+385    provider: &mut DefaultRuntimeProvider,
+386    db: &dyn CodegenDb,
+387    func_name: &str,
+388    data: &str,
+389) -> RuntimeFunction {
+390    let func_name = YulVariable::new(func_name);
+391    let ptr_size = YulVariable::new("ptr_size");
+392    let string_ptr = YulVariable::new("string_ptr");
+393
+394    let func = function_definition! {
+395        function [func_name.ident()]([ptr_size.ident()]) -> [string_ptr.ident()] {
+396            ([string_ptr.ident()] := [provider.alloc(db, ptr_size.expr())])
+397            ([yul::Statement::Expression(provider.string_copy(db, string_ptr.expr(), data, false))])
+398        }
+399    };
+400
+401    RuntimeFunction::from_statement(func)
+402}
+403
+404pub(super) fn make_map_value_ptr_with_primitive_key(
+405    provider: &mut DefaultRuntimeProvider,
+406    db: &dyn CodegenDb,
+407    func_name: &str,
+408    key_ty: TypeId,
+409) -> RuntimeFunction {
+410    debug_assert!(key_ty.is_primitive(db.upcast()));
+411    let scratch_space = literal_expression! {(HASH_SCRATCH_SPACE_START)};
+412    let scratch_size = literal_expression! {(HASH_SCRATCH_SPACE_SIZE)};
+413    let func_name = YulVariable::new(func_name);
+414    let map_ptr = YulVariable::new("map_ptr");
+415    let key = YulVariable::new("key");
+416    let yul_primitive_type = yul_primitive_type(db);
+417
+418    let mask = BitMask::new(1).not();
+419
+420    let func = function_definition! {
+421        function [func_name.ident()]([map_ptr.ident()], [key.ident()]) -> ret {
+422        ([yul::Statement::Expression(provider.ptr_store(
+423            db,
+424            scratch_space.clone(),
+425            key.expr(),
+426            yul_primitive_type.make_mptr(db.upcast()),
+427        ))])
+428        ([yul::Statement::Expression(provider.ptr_store(
+429            db,
+430            expression!(add([scratch_space.clone()], 32)),
+431            map_ptr.expr(),
+432            yul_primitive_type.make_mptr(db.upcast()),
+433        ))])
+434        (ret := and([mask.as_expr()], (keccak256([scratch_space], [scratch_size]))))
+435    }};
+436
+437    RuntimeFunction::from_statement(func)
+438}
+439
+440pub(super) fn make_map_value_ptr_with_ptr_key(
+441    provider: &mut DefaultRuntimeProvider,
+442    db: &dyn CodegenDb,
+443    func_name: &str,
+444    key_ty: TypeId,
+445) -> RuntimeFunction {
+446    debug_assert!(key_ty.is_ptr(db.upcast()));
+447
+448    let func_name = YulVariable::new(func_name);
+449    let size = literal_expression! {(key_ty.deref(db.upcast()).size_of(db.upcast(), SLOT_SIZE))};
+450    let map_ptr = YulVariable::new("map_ptr");
+451    let key = YulVariable::new("key");
+452
+453    let key_hash = expression! { keccak256([key.expr()], [size]) };
+454    let u256_ty = yul_primitive_type(db);
+455    let def = function_definition! {
+456        function [func_name.ident()]([map_ptr.ident()], [key.ident()]) -> ret {
+457            (ret := [provider.map_value_ptr(db, map_ptr.expr(), key_hash, u256_ty)])
+458        }
+459    };
+460    RuntimeFunction::from_statement(def)
+461}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/runtime/emit.rs.html b/compiler-docs/src/fe_codegen/yul/runtime/emit.rs.html new file mode 100644 index 0000000000..5ba832877c --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/runtime/emit.rs.html @@ -0,0 +1,74 @@ +emit.rs - source

fe_codegen/yul/runtime/
emit.rs

1use crate::{
+2    db::CodegenDb,
+3    yul::{runtime::make_ptr, slot_size::SLOT_SIZE, YulVariable},
+4};
+5
+6use super::{DefaultRuntimeProvider, RuntimeFunction, RuntimeProvider};
+7
+8use fe_mir::ir::TypeId;
+9
+10use yultsur::*;
+11
+12pub(super) fn make_emit(
+13    provider: &mut DefaultRuntimeProvider,
+14    db: &dyn CodegenDb,
+15    func_name: &str,
+16    legalized_ty: TypeId,
+17) -> RuntimeFunction {
+18    let func_name = YulVariable::new(func_name);
+19    let event_ptr = YulVariable::new("event_ptr");
+20    let deref_ty = legalized_ty.deref(db.upcast());
+21
+22    let abi = db.codegen_abi_event(deref_ty);
+23    let mut topics = vec![literal_expression! {(format!("0x{}", abi.signature().hash_hex()))}];
+24    for (idx, field) in abi.inputs.iter().enumerate() {
+25        if !field.indexed {
+26            continue;
+27        }
+28        let field_ty = deref_ty.projection_ty_imm(db.upcast(), idx);
+29        let offset =
+30            literal_expression! {(deref_ty.aggregate_elem_offset(db.upcast(), idx, SLOT_SIZE))};
+31        let elem_ptr = expression! { add([event_ptr.expr()], [offset]) };
+32        let topic = if field_ty.is_aggregate(db.upcast()) {
+33            todo!()
+34        } else {
+35            let topic = provider.ptr_load(
+36                db,
+37                elem_ptr,
+38                make_ptr(db, field_ty, legalized_ty.is_sptr(db.upcast())),
+39            );
+40            provider.primitive_cast(db, topic, field_ty)
+41        };
+42
+43        topics.push(topic)
+44    }
+45
+46    let mut event_data_tys = vec![];
+47    let mut event_data_values = vec![];
+48    for (idx, field) in abi.inputs.iter().enumerate() {
+49        if field.indexed {
+50            continue;
+51        }
+52
+53        let field_ty = deref_ty.projection_ty_imm(db.upcast(), idx);
+54        let field_offset =
+55            literal_expression! { (deref_ty.aggregate_elem_offset(db.upcast(), idx, SLOT_SIZE)) };
+56        event_data_tys.push(make_ptr(db, field_ty, legalized_ty.is_sptr(db.upcast())));
+57        event_data_values.push(expression! { add([event_ptr.expr()], [field_offset]) });
+58    }
+59
+60    debug_assert!(topics.len() < 5);
+61    let log_func = identifier! { (format!("log{}", topics.len()))};
+62
+63    let event_data_ptr = YulVariable::new("event_data_ptr");
+64    let event_enc_size = YulVariable::new("event_enc_size");
+65    let func = function_definition! {
+66        function [func_name.ident()]([event_ptr.ident()]) {
+67            (let [event_data_ptr.ident()] := [provider.avail(db)])
+68            (let [event_enc_size.ident()] := [provider.abi_encode_seq(db, &event_data_values, event_data_ptr.expr(), &event_data_tys, false )])
+69            ([log_func]([event_data_ptr.expr()], [event_enc_size.expr()], [topics...]))
+70        }
+71    };
+72
+73    RuntimeFunction::from_statement(func)
+74}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/runtime/mod.rs.html b/compiler-docs/src/fe_codegen/yul/runtime/mod.rs.html new file mode 100644 index 0000000000..3a3916b292 --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/runtime/mod.rs.html @@ -0,0 +1,828 @@ +mod.rs - source

fe_codegen/yul/runtime/
mod.rs

1mod abi;
+2mod contract;
+3mod data;
+4mod emit;
+5mod revert;
+6mod safe_math;
+7
+8use std::fmt::Write;
+9
+10use fe_abi::types::AbiType;
+11use fe_analyzer::namespace::items::ContractId;
+12use fe_mir::ir::{types::ArrayDef, FunctionId, TypeId, TypeKind};
+13use indexmap::IndexMap;
+14use yultsur::*;
+15
+16use num_bigint::BigInt;
+17
+18use crate::{db::CodegenDb, yul::slot_size::SLOT_SIZE};
+19
+20use super::slot_size::yul_primitive_type;
+21
+22pub trait RuntimeProvider {
+23    fn collect_definitions(&self) -> Vec<yul::FunctionDefinition>;
+24
+25    fn alloc(&mut self, db: &dyn CodegenDb, size: yul::Expression) -> yul::Expression;
+26
+27    fn avail(&mut self, db: &dyn CodegenDb) -> yul::Expression;
+28
+29    fn create(
+30        &mut self,
+31        db: &dyn CodegenDb,
+32        contract: ContractId,
+33        value: yul::Expression,
+34    ) -> yul::Expression;
+35
+36    fn create2(
+37        &mut self,
+38        db: &dyn CodegenDb,
+39        contract: ContractId,
+40        value: yul::Expression,
+41        salt: yul::Expression,
+42    ) -> yul::Expression;
+43
+44    fn emit(
+45        &mut self,
+46        db: &dyn CodegenDb,
+47        event: yul::Expression,
+48        event_ty: TypeId,
+49    ) -> yul::Expression;
+50
+51    fn revert(
+52        &mut self,
+53        db: &dyn CodegenDb,
+54        arg: Option<yul::Expression>,
+55        arg_name: &str,
+56        arg_ty: TypeId,
+57    ) -> yul::Expression;
+58
+59    fn external_call(
+60        &mut self,
+61        db: &dyn CodegenDb,
+62        function: FunctionId,
+63        args: Vec<yul::Expression>,
+64    ) -> yul::Expression;
+65
+66    fn map_value_ptr(
+67        &mut self,
+68        db: &dyn CodegenDb,
+69        map_ptr: yul::Expression,
+70        key: yul::Expression,
+71        key_ty: TypeId,
+72    ) -> yul::Expression;
+73
+74    fn aggregate_init(
+75        &mut self,
+76        db: &dyn CodegenDb,
+77        ptr: yul::Expression,
+78        args: Vec<yul::Expression>,
+79        ptr_ty: TypeId,
+80        arg_tys: Vec<TypeId>,
+81    ) -> yul::Expression;
+82
+83    fn string_copy(
+84        &mut self,
+85        db: &dyn CodegenDb,
+86        dst: yul::Expression,
+87        data: &str,
+88        is_dst_storage: bool,
+89    ) -> yul::Expression;
+90
+91    fn string_construct(
+92        &mut self,
+93        db: &dyn CodegenDb,
+94        data: &str,
+95        string_len: usize,
+96    ) -> yul::Expression;
+97
+98    /// Copy data from `src` to `dst`.
+99    /// NOTE: src and dst must be aligned by 32 when a ptr is storage ptr.
+100    fn ptr_copy(
+101        &mut self,
+102        db: &dyn CodegenDb,
+103        src: yul::Expression,
+104        dst: yul::Expression,
+105        size: yul::Expression,
+106        is_src_storage: bool,
+107        is_dst_storage: bool,
+108    ) -> yul::Expression;
+109
+110    fn ptr_store(
+111        &mut self,
+112        db: &dyn CodegenDb,
+113        ptr: yul::Expression,
+114        imm: yul::Expression,
+115        ptr_ty: TypeId,
+116    ) -> yul::Expression;
+117
+118    fn ptr_load(
+119        &mut self,
+120        db: &dyn CodegenDb,
+121        ptr: yul::Expression,
+122        ptr_ty: TypeId,
+123    ) -> yul::Expression;
+124
+125    fn abi_encode(
+126        &mut self,
+127        db: &dyn CodegenDb,
+128        src: yul::Expression,
+129        dst: yul::Expression,
+130        src_ty: TypeId,
+131        is_dst_storage: bool,
+132    ) -> yul::Expression;
+133
+134    fn abi_encode_seq(
+135        &mut self,
+136        db: &dyn CodegenDb,
+137        src: &[yul::Expression],
+138        dst: yul::Expression,
+139        src_tys: &[TypeId],
+140        is_dst_storage: bool,
+141    ) -> yul::Expression;
+142
+143    fn abi_decode(
+144        &mut self,
+145        db: &dyn CodegenDb,
+146        src: yul::Expression,
+147        size: yul::Expression,
+148        types: &[TypeId],
+149        abi_loc: AbiSrcLocation,
+150    ) -> yul::Expression;
+151
+152    fn primitive_cast(
+153        &mut self,
+154        db: &dyn CodegenDb,
+155        value: yul::Expression,
+156        from_ty: TypeId,
+157    ) -> yul::Expression {
+158        debug_assert!(from_ty.is_primitive(db.upcast()));
+159        let from_size = from_ty.size_of(db.upcast(), SLOT_SIZE);
+160
+161        if from_ty.is_signed(db.upcast()) {
+162            let significant = literal_expression! {(from_size-1)};
+163            expression! { signextend([significant], [value]) }
+164        } else {
+165            let mask = BitMask::new(from_size);
+166            expression! { and([value], [mask.as_expr()]) }
+167        }
+168    }
+169
+170    // TODO: The all functions below will be reimplemented in `std`.
+171    fn safe_add(
+172        &mut self,
+173        db: &dyn CodegenDb,
+174        lhs: yul::Expression,
+175        rhs: yul::Expression,
+176        ty: TypeId,
+177    ) -> yul::Expression;
+178
+179    fn safe_sub(
+180        &mut self,
+181        db: &dyn CodegenDb,
+182        lhs: yul::Expression,
+183        rhs: yul::Expression,
+184        ty: TypeId,
+185    ) -> yul::Expression;
+186
+187    fn safe_mul(
+188        &mut self,
+189        db: &dyn CodegenDb,
+190        lhs: yul::Expression,
+191        rhs: yul::Expression,
+192        ty: TypeId,
+193    ) -> yul::Expression;
+194
+195    fn safe_div(
+196        &mut self,
+197        db: &dyn CodegenDb,
+198        lhs: yul::Expression,
+199        rhs: yul::Expression,
+200        ty: TypeId,
+201    ) -> yul::Expression;
+202
+203    fn safe_mod(
+204        &mut self,
+205        db: &dyn CodegenDb,
+206        lhs: yul::Expression,
+207        rhs: yul::Expression,
+208        ty: TypeId,
+209    ) -> yul::Expression;
+210
+211    fn safe_pow(
+212        &mut self,
+213        db: &dyn CodegenDb,
+214        lhs: yul::Expression,
+215        rhs: yul::Expression,
+216        ty: TypeId,
+217    ) -> yul::Expression;
+218}
+219
+220#[derive(Clone, Copy, Debug)]
+221pub enum AbiSrcLocation {
+222    CallData,
+223    Memory,
+224}
+225
+226#[derive(Debug, Default)]
+227pub struct DefaultRuntimeProvider {
+228    functions: IndexMap<String, RuntimeFunction>,
+229}
+230
+231impl DefaultRuntimeProvider {
+232    fn create_then_call<F>(
+233        &mut self,
+234        name: &str,
+235        args: Vec<yul::Expression>,
+236        func_builder: F,
+237    ) -> yul::Expression
+238    where
+239        F: FnOnce(&mut Self) -> RuntimeFunction,
+240    {
+241        if let Some(func) = self.functions.get(name) {
+242            func.call(args)
+243        } else {
+244            let func = func_builder(self);
+245            let result = func.call(args);
+246            self.functions.insert(name.to_string(), func);
+247            result
+248        }
+249    }
+250}
+251
+252impl RuntimeProvider for DefaultRuntimeProvider {
+253    fn collect_definitions(&self) -> Vec<yul::FunctionDefinition> {
+254        self.functions
+255            .values()
+256            .map(RuntimeFunction::definition)
+257            .collect()
+258    }
+259
+260    fn alloc(&mut self, _db: &dyn CodegenDb, bytes: yul::Expression) -> yul::Expression {
+261        let name = "$alloc";
+262        let arg = vec![bytes];
+263        self.create_then_call(name, arg, |_| data::make_alloc(name))
+264    }
+265
+266    fn avail(&mut self, _db: &dyn CodegenDb) -> yul::Expression {
+267        let name = "$avail";
+268        let arg = vec![];
+269        self.create_then_call(name, arg, |_| data::make_avail(name))
+270    }
+271
+272    fn create(
+273        &mut self,
+274        db: &dyn CodegenDb,
+275        contract: ContractId,
+276        value: yul::Expression,
+277    ) -> yul::Expression {
+278        let name = format!("$create_{}", db.codegen_contract_symbol_name(contract));
+279        let arg = vec![value];
+280        self.create_then_call(&name, arg, |provider| {
+281            contract::make_create(provider, db, &name, contract)
+282        })
+283    }
+284
+285    fn create2(
+286        &mut self,
+287        db: &dyn CodegenDb,
+288        contract: ContractId,
+289        value: yul::Expression,
+290        salt: yul::Expression,
+291    ) -> yul::Expression {
+292        let name = format!("$create2_{}", db.codegen_contract_symbol_name(contract));
+293        let arg = vec![value, salt];
+294        self.create_then_call(&name, arg, |provider| {
+295            contract::make_create2(provider, db, &name, contract)
+296        })
+297    }
+298
+299    fn emit(
+300        &mut self,
+301        db: &dyn CodegenDb,
+302        event: yul::Expression,
+303        event_ty: TypeId,
+304    ) -> yul::Expression {
+305        let name = format!("$emit_{}", event_ty.0);
+306        let legalized_ty = db.codegen_legalized_type(event_ty);
+307        self.create_then_call(&name, vec![event], |provider| {
+308            emit::make_emit(provider, db, &name, legalized_ty)
+309        })
+310    }
+311
+312    fn revert(
+313        &mut self,
+314        db: &dyn CodegenDb,
+315        arg: Option<yul::Expression>,
+316        arg_name: &str,
+317        arg_ty: TypeId,
+318    ) -> yul::Expression {
+319        let func_name = format! {"$revert_{}_{}", arg_name, arg_ty.0};
+320        let args = match arg {
+321            Some(arg) => vec![arg],
+322            None => vec![],
+323        };
+324        self.create_then_call(&func_name, args, |provider| {
+325            revert::make_revert(provider, db, &func_name, arg_name, arg_ty)
+326        })
+327    }
+328
+329    fn external_call(
+330        &mut self,
+331        db: &dyn CodegenDb,
+332        function: FunctionId,
+333        args: Vec<yul::Expression>,
+334    ) -> yul::Expression {
+335        let name = format!(
+336            "$call_external__{}",
+337            db.codegen_function_symbol_name(function)
+338        );
+339        self.create_then_call(&name, args, |provider| {
+340            contract::make_external_call(provider, db, &name, function)
+341        })
+342    }
+343
+344    fn map_value_ptr(
+345        &mut self,
+346        db: &dyn CodegenDb,
+347        map_ptr: yul::Expression,
+348        key: yul::Expression,
+349        key_ty: TypeId,
+350    ) -> yul::Expression {
+351        if key_ty.is_primitive(db.upcast()) {
+352            let name = "$map_value_ptr_with_primitive_key";
+353            self.create_then_call(name, vec![map_ptr, key], |provider| {
+354                data::make_map_value_ptr_with_primitive_key(provider, db, name, key_ty)
+355            })
+356        } else if key_ty.is_mptr(db.upcast()) {
+357            let name = "$map_value_ptr_with_ptr_key";
+358            self.create_then_call(name, vec![map_ptr, key], |provider| {
+359                data::make_map_value_ptr_with_ptr_key(provider, db, name, key_ty)
+360            })
+361        } else {
+362            unreachable!()
+363        }
+364    }
+365
+366    fn aggregate_init(
+367        &mut self,
+368        db: &dyn CodegenDb,
+369        ptr: yul::Expression,
+370        mut args: Vec<yul::Expression>,
+371        ptr_ty: TypeId,
+372        arg_tys: Vec<TypeId>,
+373    ) -> yul::Expression {
+374        debug_assert!(ptr_ty.is_ptr(db.upcast()));
+375        let deref_ty = ptr_ty.deref(db.upcast());
+376
+377        // Handle unit enum variant.
+378        if args.len() == 1 && deref_ty.is_enum(db.upcast()) {
+379            let tag = args.pop().unwrap();
+380            let tag_ty = arg_tys[0];
+381            let is_sptr = ptr_ty.is_sptr(db.upcast());
+382            return self.ptr_store(db, ptr, tag, make_ptr(db, tag_ty, is_sptr));
+383        }
+384
+385        let deref_ty = ptr_ty.deref(db.upcast());
+386        let args = std::iter::once(ptr).chain(args).collect();
+387        let legalized_ty = db.codegen_legalized_type(ptr_ty);
+388        if deref_ty.is_enum(db.upcast()) {
+389            let mut name = format!("enum_init_{}", ptr_ty.0);
+390            for ty in &arg_tys {
+391                write!(&mut name, "_{}", ty.0).unwrap();
+392            }
+393            self.create_then_call(&name, args, |provider| {
+394                data::make_enum_init(provider, db, &name, legalized_ty, arg_tys)
+395            })
+396        } else {
+397            let name = format!("$aggregate_init_{}", ptr_ty.0);
+398            self.create_then_call(&name, args, |provider| {
+399                data::make_aggregate_init(provider, db, &name, legalized_ty, arg_tys)
+400            })
+401        }
+402    }
+403
+404    fn string_copy(
+405        &mut self,
+406        db: &dyn CodegenDb,
+407        dst: yul::Expression,
+408        data: &str,
+409        is_dst_storage: bool,
+410    ) -> yul::Expression {
+411        debug_assert!(data.is_ascii());
+412        let symbol_name = db.codegen_constant_string_symbol_name(data.to_string());
+413
+414        let name = if is_dst_storage {
+415            format!("$string_copy_{symbol_name}_storage")
+416        } else {
+417            format!("$string_copy_{symbol_name}_memory")
+418        };
+419
+420        self.create_then_call(&name, vec![dst], |provider| {
+421            data::make_string_copy(provider, db, &name, data, is_dst_storage)
+422        })
+423    }
+424
+425    fn string_construct(
+426        &mut self,
+427        db: &dyn CodegenDb,
+428        data: &str,
+429        string_len: usize,
+430    ) -> yul::Expression {
+431        debug_assert!(data.is_ascii());
+432        debug_assert!(string_len >= data.len());
+433        let symbol_name = db.codegen_constant_string_symbol_name(data.to_string());
+434
+435        let name = format!("$string_construct_{symbol_name}");
+436        let arg = literal_expression!((32 + string_len));
+437        self.create_then_call(&name, vec![arg], |provider| {
+438            data::make_string_construct(provider, db, &name, data)
+439        })
+440    }
+441
+442    fn ptr_copy(
+443        &mut self,
+444        _db: &dyn CodegenDb,
+445        src: yul::Expression,
+446        dst: yul::Expression,
+447        size: yul::Expression,
+448        is_src_storage: bool,
+449        is_dst_storage: bool,
+450    ) -> yul::Expression {
+451        let args = vec![src, dst, size];
+452        match (is_src_storage, is_dst_storage) {
+453            (true, true) => {
+454                let name = "scopys";
+455                self.create_then_call(name, args, |_| data::make_scopys(name))
+456            }
+457            (true, false) => {
+458                let name = "scopym";
+459                self.create_then_call(name, args, |_| data::make_scopym(name))
+460            }
+461            (false, true) => {
+462                let name = "mcopys";
+463                self.create_then_call(name, args, |_| data::make_mcopys(name))
+464            }
+465            (false, false) => {
+466                let name = "mcopym";
+467                self.create_then_call(name, args, |_| data::make_mcopym(name))
+468            }
+469        }
+470    }
+471
+472    fn ptr_store(
+473        &mut self,
+474        db: &dyn CodegenDb,
+475        ptr: yul::Expression,
+476        imm: yul::Expression,
+477        ptr_ty: TypeId,
+478    ) -> yul::Expression {
+479        debug_assert!(ptr_ty.is_ptr(db.upcast()));
+480        let size = ptr_ty.deref(db.upcast()).size_of(db.upcast(), SLOT_SIZE);
+481        debug_assert!(size <= 32);
+482
+483        let size_bits = size * 8;
+484        if ptr_ty.is_sptr(db.upcast()) {
+485            let name = "$sptr_store";
+486            let args = vec![ptr, imm, literal_expression! {(size_bits)}];
+487            self.create_then_call(name, args, |_| data::make_sptr_store(name))
+488        } else if ptr_ty.is_mptr(db.upcast()) {
+489            let name = "$mptr_store";
+490            let shift_num = literal_expression! {(256 - size_bits)};
+491            let mask = BitMask::new(32 - size);
+492            let args = vec![ptr, imm, shift_num, mask.as_expr()];
+493            self.create_then_call(name, args, |_| data::make_mptr_store(name))
+494        } else {
+495            unreachable!()
+496        }
+497    }
+498
+499    fn ptr_load(
+500        &mut self,
+501        db: &dyn CodegenDb,
+502        ptr: yul::Expression,
+503        ptr_ty: TypeId,
+504    ) -> yul::Expression {
+505        debug_assert!(ptr_ty.is_ptr(db.upcast()));
+506        let size = ptr_ty.deref(db.upcast()).size_of(db.upcast(), SLOT_SIZE);
+507        debug_assert!(size <= 32);
+508
+509        let size_bits = size * 8;
+510        if ptr_ty.is_sptr(db.upcast()) {
+511            let name = "$sptr_load";
+512            let args = vec![ptr, literal_expression! {(size_bits)}];
+513            self.create_then_call(name, args, |_| data::make_sptr_load(name))
+514        } else if ptr_ty.is_mptr(db.upcast()) {
+515            let name = "$mptr_load";
+516            let shift_num = literal_expression! {(256 - size_bits)};
+517            let args = vec![ptr, shift_num];
+518            self.create_then_call(name, args, |_| data::make_mptr_load(name))
+519        } else {
+520            unreachable!()
+521        }
+522    }
+523
+524    fn abi_encode(
+525        &mut self,
+526        db: &dyn CodegenDb,
+527        src: yul::Expression,
+528        dst: yul::Expression,
+529        src_ty: TypeId,
+530        is_dst_storage: bool,
+531    ) -> yul::Expression {
+532        let legalized_ty = db.codegen_legalized_type(src_ty);
+533        let args = vec![src.clone(), dst.clone()];
+534
+535        let func_name_postfix = if is_dst_storage { "storage" } else { "memory" };
+536
+537        if legalized_ty.is_primitive(db.upcast()) {
+538            let name = format!(
+539                "$abi_encode_primitive_type_{}_to_{}",
+540                src_ty.0, func_name_postfix
+541            );
+542            return self.create_then_call(&name, args, |provider| {
+543                abi::make_abi_encode_primitive_type(
+544                    provider,
+545                    db,
+546                    &name,
+547                    legalized_ty,
+548                    is_dst_storage,
+549                )
+550            });
+551        }
+552
+553        let deref_ty = legalized_ty.deref(db.upcast());
+554        let abi_ty = db.codegen_abi_type(deref_ty);
+555        match abi_ty {
+556            AbiType::UInt(_) | AbiType::Int(_) | AbiType::Bool | AbiType::Address => {
+557                let value = self.ptr_load(db, src, src_ty);
+558                let extended_value = self.primitive_cast(db, value, deref_ty);
+559                self.abi_encode(db, extended_value, dst, deref_ty, is_dst_storage)
+560            }
+561            AbiType::Array { elem_ty, .. } => {
+562                if elem_ty.is_static() {
+563                    let name = format!(
+564                        "$abi_encode_static_array_type_{}_to_{}",
+565                        src_ty.0, func_name_postfix
+566                    );
+567                    self.create_then_call(&name, args, |provider| {
+568                        abi::make_abi_encode_static_array_type(provider, db, &name, legalized_ty)
+569                    })
+570                } else {
+571                    let name = format! {
+572                       "$abi_encode_dynamic_array_type{}_to_{}", src_ty.0, func_name_postfix
+573                    };
+574                    self.create_then_call(&name, args, |provider| {
+575                        abi::make_abi_encode_dynamic_array_type(provider, db, &name, legalized_ty)
+576                    })
+577                }
+578            }
+579            AbiType::Tuple(_) => {
+580                if abi_ty.is_static() {
+581                    let name = format!(
+582                        "$abi_encode_static_aggregate_type_{}_to_{}",
+583                        src_ty.0, func_name_postfix
+584                    );
+585                    self.create_then_call(&name, args, |provider| {
+586                        abi::make_abi_encode_static_aggregate_type(
+587                            provider,
+588                            db,
+589                            &name,
+590                            legalized_ty,
+591                            is_dst_storage,
+592                        )
+593                    })
+594                } else {
+595                    let name = format!(
+596                        "$abi_encode_dynamic_aggregate_type_{}_to_{}",
+597                        src_ty.0, func_name_postfix
+598                    );
+599                    self.create_then_call(&name, args, |provider| {
+600                        abi::make_abi_encode_dynamic_aggregate_type(
+601                            provider,
+602                            db,
+603                            &name,
+604                            legalized_ty,
+605                            is_dst_storage,
+606                        )
+607                    })
+608                }
+609            }
+610            AbiType::Bytes => {
+611                let len = match &deref_ty.data(db.upcast()).kind {
+612                    TypeKind::Array(ArrayDef { len, .. }) => *len,
+613                    _ => unreachable!(),
+614                };
+615                let name = format! {"$abi_encode_bytes{len}_type_to_{func_name_postfix}"};
+616                self.create_then_call(&name, args, |provider| {
+617                    abi::make_abi_encode_bytes_type(provider, db, &name, len, is_dst_storage)
+618                })
+619            }
+620            AbiType::String => {
+621                let name = format! {"$abi_encode_string_type_to_{func_name_postfix}"};
+622                self.create_then_call(&name, args, |provider| {
+623                    abi::make_abi_encode_string_type(provider, db, &name, is_dst_storage)
+624                })
+625            }
+626            AbiType::Function => unreachable!(),
+627        }
+628    }
+629
+630    fn abi_encode_seq(
+631        &mut self,
+632        db: &dyn CodegenDb,
+633        src: &[yul::Expression],
+634        dst: yul::Expression,
+635        src_tys: &[TypeId],
+636        is_dst_storage: bool,
+637    ) -> yul::Expression {
+638        let mut name = "$abi_encode_value_seq".to_string();
+639        for ty in src_tys {
+640            write!(&mut name, "_{}", ty.0).unwrap();
+641        }
+642
+643        let mut args = vec![dst];
+644        args.extend(src.iter().cloned());
+645        self.create_then_call(&name, args, |provider| {
+646            abi::make_abi_encode_seq(provider, db, &name, src_tys, is_dst_storage)
+647        })
+648    }
+649
+650    fn abi_decode(
+651        &mut self,
+652        db: &dyn CodegenDb,
+653        src: yul::Expression,
+654        size: yul::Expression,
+655        types: &[TypeId],
+656        abi_loc: AbiSrcLocation,
+657    ) -> yul::Expression {
+658        let mut name = "$abi_decode".to_string();
+659        for ty in types {
+660            write!(name, "_{}", ty.0).unwrap();
+661        }
+662
+663        match abi_loc {
+664            AbiSrcLocation::CallData => write!(name, "_from_calldata").unwrap(),
+665            AbiSrcLocation::Memory => write!(name, "_from_memory").unwrap(),
+666        };
+667
+668        self.create_then_call(&name, vec![src, size], |provider| {
+669            abi::make_abi_decode(provider, db, &name, types, abi_loc)
+670        })
+671    }
+672
+673    fn safe_add(
+674        &mut self,
+675        db: &dyn CodegenDb,
+676        lhs: yul::Expression,
+677        rhs: yul::Expression,
+678        ty: TypeId,
+679    ) -> yul::Expression {
+680        debug_assert!(ty.is_integral(db.upcast()));
+681        safe_math::dispatch_safe_add(self, db, lhs, rhs, ty)
+682    }
+683
+684    fn safe_sub(
+685        &mut self,
+686        db: &dyn CodegenDb,
+687        lhs: yul::Expression,
+688        rhs: yul::Expression,
+689        ty: TypeId,
+690    ) -> yul::Expression {
+691        debug_assert!(ty.is_integral(db.upcast()));
+692        safe_math::dispatch_safe_sub(self, db, lhs, rhs, ty)
+693    }
+694
+695    fn safe_mul(
+696        &mut self,
+697        db: &dyn CodegenDb,
+698        lhs: yul::Expression,
+699        rhs: yul::Expression,
+700        ty: TypeId,
+701    ) -> yul::Expression {
+702        debug_assert!(ty.is_integral(db.upcast()));
+703        safe_math::dispatch_safe_mul(self, db, lhs, rhs, ty)
+704    }
+705
+706    fn safe_div(
+707        &mut self,
+708        db: &dyn CodegenDb,
+709        lhs: yul::Expression,
+710        rhs: yul::Expression,
+711        ty: TypeId,
+712    ) -> yul::Expression {
+713        debug_assert!(ty.is_integral(db.upcast()));
+714        safe_math::dispatch_safe_div(self, db, lhs, rhs, ty)
+715    }
+716
+717    fn safe_mod(
+718        &mut self,
+719        db: &dyn CodegenDb,
+720        lhs: yul::Expression,
+721        rhs: yul::Expression,
+722        ty: TypeId,
+723    ) -> yul::Expression {
+724        debug_assert!(ty.is_integral(db.upcast()));
+725        safe_math::dispatch_safe_mod(self, db, lhs, rhs, ty)
+726    }
+727
+728    fn safe_pow(
+729        &mut self,
+730        db: &dyn CodegenDb,
+731        lhs: yul::Expression,
+732        rhs: yul::Expression,
+733        ty: TypeId,
+734    ) -> yul::Expression {
+735        debug_assert!(ty.is_integral(db.upcast()));
+736        safe_math::dispatch_safe_pow(self, db, lhs, rhs, ty)
+737    }
+738}
+739
+740#[derive(Debug)]
+741struct RuntimeFunction(yul::FunctionDefinition);
+742
+743impl RuntimeFunction {
+744    fn arg_num(&self) -> usize {
+745        self.0.parameters.len()
+746    }
+747
+748    fn definition(&self) -> yul::FunctionDefinition {
+749        self.0.clone()
+750    }
+751
+752    /// # Panics
+753    /// Panics if a number of arguments doesn't match the definition.
+754    fn call(&self, args: Vec<yul::Expression>) -> yul::Expression {
+755        debug_assert_eq!(self.arg_num(), args.len());
+756
+757        yul::Expression::FunctionCall(yul::FunctionCall {
+758            identifier: self.0.name.clone(),
+759            arguments: args,
+760        })
+761    }
+762
+763    /// Remove this when `yultsur::function_definition!` becomes to return
+764    /// `FunctionDefinition`.
+765    fn from_statement(func: yul::Statement) -> Self {
+766        match func {
+767            yul::Statement::FunctionDefinition(def) => Self(def),
+768            _ => unreachable!(),
+769        }
+770    }
+771}
+772
+773fn make_ptr(db: &dyn CodegenDb, inner: TypeId, is_sptr: bool) -> TypeId {
+774    if is_sptr {
+775        inner.make_sptr(db.upcast())
+776    } else {
+777        inner.make_mptr(db.upcast())
+778    }
+779}
+780
+781struct BitMask(BigInt);
+782
+783impl BitMask {
+784    fn new(byte_size: usize) -> Self {
+785        debug_assert!(byte_size <= 32);
+786        let one: BigInt = 1usize.into();
+787        Self((one << (byte_size * 8)) - 1)
+788    }
+789
+790    fn not(&self) -> Self {
+791        // Bigint is variable length integer, so we need special handling for `not`
+792        // operation.
+793        let one: BigInt = 1usize.into();
+794        let u256_max = (one << 256) - 1;
+795        Self(u256_max ^ &self.0)
+796    }
+797
+798    fn as_expr(&self) -> yul::Expression {
+799        let mask = format!("{:#x}", self.0);
+800        literal_expression! {(mask)}
+801    }
+802}
+803
+804pub(super) fn error_revert_numeric(
+805    provider: &mut dyn RuntimeProvider,
+806    db: &dyn CodegenDb,
+807    error_code: yul::Expression,
+808) -> yul::Statement {
+809    yul::Statement::Expression(provider.revert(
+810        db,
+811        Some(error_code),
+812        "Error",
+813        yul_primitive_type(db),
+814    ))
+815}
+816
+817pub(super) fn panic_revert_numeric(
+818    provider: &mut dyn RuntimeProvider,
+819    db: &dyn CodegenDb,
+820    error_code: yul::Expression,
+821) -> yul::Statement {
+822    yul::Statement::Expression(provider.revert(
+823        db,
+824        Some(error_code),
+825        "Panic",
+826        yul_primitive_type(db),
+827    ))
+828}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/runtime/revert.rs.html b/compiler-docs/src/fe_codegen/yul/runtime/revert.rs.html new file mode 100644 index 0000000000..999eacab98 --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/runtime/revert.rs.html @@ -0,0 +1,90 @@ +revert.rs - source

fe_codegen/yul/runtime/
revert.rs

1use crate::{
+2    db::CodegenDb,
+3    yul::{slot_size::function_hash_type, YulVariable},
+4};
+5
+6use super::{DefaultRuntimeProvider, RuntimeFunction, RuntimeProvider};
+7
+8use fe_abi::function::{AbiFunction, AbiFunctionType, StateMutability};
+9use fe_mir::ir::{self, TypeId};
+10use yultsur::*;
+11
+12pub(super) fn make_revert(
+13    provider: &mut DefaultRuntimeProvider,
+14    db: &dyn CodegenDb,
+15    func_name: &str,
+16    arg_name: &str,
+17    arg_ty: TypeId,
+18) -> RuntimeFunction {
+19    let func_name = YulVariable::new(func_name);
+20    let arg = YulVariable::new("arg");
+21
+22    let abi_size = YulVariable::new("abi_size");
+23    let abi_tmp_ptr = YulVariable::new("$abi_tmp_ptr");
+24    let signature = type_signature_for_revert(db, arg_name, arg_ty);
+25
+26    let signature_store = yul::Statement::Expression(provider.ptr_store(
+27        db,
+28        abi_tmp_ptr.expr(),
+29        signature,
+30        function_hash_type(db).make_mptr(db.upcast()),
+31    ));
+32
+33    let func = if arg_ty.deref(db.upcast()).is_zero_sized(db.upcast()) {
+34        function_definition! {
+35            function [func_name.ident()]() {
+36                (let [abi_tmp_ptr.ident()] := [provider.avail(db)])
+37                ([signature_store])
+38                (revert([abi_tmp_ptr.expr()], [literal_expression!{4}]))
+39            }
+40        }
+41    } else {
+42        let encode = provider.abi_encode_seq(
+43            db,
+44            &[arg.expr()],
+45            expression! { add([abi_tmp_ptr.expr()], 4) },
+46            &[arg_ty],
+47            false,
+48        );
+49
+50        function_definition! {
+51            function [func_name.ident()]([arg.ident()]) {
+52                (let [abi_tmp_ptr.ident()] := [provider.avail(db)])
+53                ([signature_store])
+54                (let [abi_size.ident()] := add([encode], 4))
+55                (revert([abi_tmp_ptr.expr()], [abi_size.expr()]))
+56            }
+57        }
+58    };
+59
+60    RuntimeFunction::from_statement(func)
+61}
+62
+63/// Returns signature hash of the type.
+64fn type_signature_for_revert(db: &dyn CodegenDb, name: &str, ty: TypeId) -> yul::Expression {
+65    let deref_ty = ty.deref(db.upcast());
+66    let ty_data = deref_ty.data(db.upcast());
+67    let args = match &ty_data.kind {
+68        ir::TypeKind::Struct(def) => def
+69            .fields
+70            .iter()
+71            .map(|(_, ty)| ("".to_string(), db.codegen_abi_type(*ty)))
+72            .collect(),
+73        _ => {
+74            let abi_ty = db.codegen_abi_type(deref_ty);
+75            vec![("_".to_string(), abi_ty)]
+76        }
+77    };
+78
+79    // selector and state mutability is independent we can set has_self and has_ctx any value.
+80    let selector = AbiFunction::new(
+81        AbiFunctionType::Function,
+82        name.to_string(),
+83        args,
+84        None,
+85        StateMutability::Pure,
+86    )
+87    .selector();
+88    let type_sig = selector.hex();
+89    literal_expression! {(format!{"0x{type_sig}" })}
+90}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/runtime/safe_math.rs.html b/compiler-docs/src/fe_codegen/yul/runtime/safe_math.rs.html new file mode 100644 index 0000000000..790e1eab49 --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/runtime/safe_math.rs.html @@ -0,0 +1,628 @@ +safe_math.rs - source

fe_codegen/yul/runtime/
safe_math.rs

1use crate::{db::CodegenDb, yul::YulVariable};
+2
+3use super::{DefaultRuntimeProvider, RuntimeFunction, RuntimeProvider};
+4
+5use fe_mir::ir::{TypeId, TypeKind};
+6
+7use yultsur::*;
+8
+9pub(super) fn dispatch_safe_add(
+10    provider: &mut DefaultRuntimeProvider,
+11    db: &dyn CodegenDb,
+12    lhs: yul::Expression,
+13    rhs: yul::Expression,
+14    ty: TypeId,
+15) -> yul::Expression {
+16    debug_assert!(ty.is_integral(db.upcast()));
+17    let min_value = get_min_value(db, ty);
+18    let max_value = get_max_value(db, ty);
+19
+20    if ty.is_signed(db.upcast()) {
+21        let name = "$safe_add_signed";
+22        let args = vec![lhs, rhs, min_value, max_value];
+23        provider.create_then_call(name, args, |provider| {
+24            make_safe_add_signed(provider, db, name)
+25        })
+26    } else {
+27        let name = "$safe_add_unsigned";
+28        let args = vec![lhs, rhs, max_value];
+29        provider.create_then_call(name, args, |provider| {
+30            make_safe_add_unsigned(provider, db, name)
+31        })
+32    }
+33}
+34
+35pub(super) fn dispatch_safe_sub(
+36    provider: &mut DefaultRuntimeProvider,
+37    db: &dyn CodegenDb,
+38    lhs: yul::Expression,
+39    rhs: yul::Expression,
+40    ty: TypeId,
+41) -> yul::Expression {
+42    debug_assert!(ty.is_integral(db.upcast()));
+43    let min_value = get_min_value(db, ty);
+44    let max_value = get_max_value(db, ty);
+45
+46    if ty.is_signed(db.upcast()) {
+47        let name = "$safe_sub_signed";
+48        let args = vec![lhs, rhs, min_value, max_value];
+49        provider.create_then_call(name, args, |provider| {
+50            make_safe_sub_signed(provider, db, name)
+51        })
+52    } else {
+53        let name = "$safe_sub_unsigned";
+54        let args = vec![lhs, rhs];
+55        provider.create_then_call(name, args, |provider| {
+56            make_safe_sub_unsigned(provider, db, name)
+57        })
+58    }
+59}
+60
+61pub(super) fn dispatch_safe_mul(
+62    provider: &mut DefaultRuntimeProvider,
+63    db: &dyn CodegenDb,
+64    lhs: yul::Expression,
+65    rhs: yul::Expression,
+66    ty: TypeId,
+67) -> yul::Expression {
+68    debug_assert!(ty.is_integral(db.upcast()));
+69    let min_value = get_min_value(db, ty);
+70    let max_value = get_max_value(db, ty);
+71
+72    if ty.is_signed(db.upcast()) {
+73        let name = "$safe_mul_signed";
+74        let args = vec![lhs, rhs, min_value, max_value];
+75        provider.create_then_call(name, args, |provider| {
+76            make_safe_mul_signed(provider, db, name)
+77        })
+78    } else {
+79        let name = "$safe_mul_unsigned";
+80        let args = vec![lhs, rhs, max_value];
+81        provider.create_then_call(name, args, |provider| {
+82            make_safe_mul_unsigned(provider, db, name)
+83        })
+84    }
+85}
+86
+87pub(super) fn dispatch_safe_div(
+88    provider: &mut DefaultRuntimeProvider,
+89    db: &dyn CodegenDb,
+90    lhs: yul::Expression,
+91    rhs: yul::Expression,
+92    ty: TypeId,
+93) -> yul::Expression {
+94    debug_assert!(ty.is_integral(db.upcast()));
+95    let min_value = get_min_value(db, ty);
+96
+97    if ty.is_signed(db.upcast()) {
+98        let name = "$safe_div_signed";
+99        let args = vec![lhs, rhs, min_value];
+100        provider.create_then_call(name, args, |provider| {
+101            make_safe_div_signed(provider, db, name)
+102        })
+103    } else {
+104        let name = "$safe_div_unsigned";
+105        let args = vec![lhs, rhs];
+106        provider.create_then_call(name, args, |provider| {
+107            make_safe_div_unsigned(provider, db, name)
+108        })
+109    }
+110}
+111
+112pub(super) fn dispatch_safe_mod(
+113    provider: &mut DefaultRuntimeProvider,
+114    db: &dyn CodegenDb,
+115    lhs: yul::Expression,
+116    rhs: yul::Expression,
+117    ty: TypeId,
+118) -> yul::Expression {
+119    debug_assert!(ty.is_integral(db.upcast()));
+120    if ty.is_signed(db.upcast()) {
+121        let name = "$safe_mod_signed";
+122        let args = vec![lhs, rhs];
+123        provider.create_then_call(name, args, |provider| {
+124            make_safe_mod_signed(provider, db, name)
+125        })
+126    } else {
+127        let name = "$safe_mod_unsigned";
+128        let args = vec![lhs, rhs];
+129        provider.create_then_call(name, args, |provider| {
+130            make_safe_mod_unsigned(provider, db, name)
+131        })
+132    }
+133}
+134
+135pub(super) fn dispatch_safe_pow(
+136    provider: &mut DefaultRuntimeProvider,
+137    db: &dyn CodegenDb,
+138    lhs: yul::Expression,
+139    rhs: yul::Expression,
+140    ty: TypeId,
+141) -> yul::Expression {
+142    debug_assert!(ty.is_integral(db.upcast()));
+143    let min_value = get_min_value(db, ty);
+144    let max_value = get_max_value(db, ty);
+145
+146    if ty.is_signed(db.upcast()) {
+147        let name = "$safe_pow_signed";
+148        let args = vec![lhs, rhs, min_value, max_value];
+149        provider.create_then_call(name, args, |provider| {
+150            make_safe_pow_signed(provider, db, name)
+151        })
+152    } else {
+153        let name = "$safe_pow_unsigned";
+154        let args = vec![lhs, rhs, max_value];
+155        provider.create_then_call(name, args, |provider| {
+156            make_safe_pow_unsigned(provider, db, name)
+157        })
+158    }
+159}
+160
+161fn make_safe_add_signed(
+162    provider: &mut DefaultRuntimeProvider,
+163    db: &dyn CodegenDb,
+164    func_name: &str,
+165) -> RuntimeFunction {
+166    let func_name = YulVariable::new(func_name);
+167    let lhs = YulVariable::new("$lhs");
+168    let rhs = YulVariable::new("$rhs");
+169    let min_value = YulVariable::new("$min_value");
+170    let max_value = YulVariable::new("$max_value");
+171    let ret = YulVariable::new("$ret");
+172
+173    let func = function_definition! {
+174        function [func_name.ident()]([lhs.ident()], [rhs.ident()], [min_value.ident()], [max_value.ident()]) -> [ret.ident()] {
+175            (if (and((iszero((slt([lhs.expr()], 0)))), (sgt([rhs.expr()], (sub([max_value.expr()], [lhs.expr()])))))) { [revert_with_overflow(provider, db)] })
+176            (if (and((slt([lhs.expr()], 0)), (slt([rhs.expr()], (sub([min_value.expr()], [lhs.expr()])))))) { [revert_with_overflow(provider, db)] })
+177            ([ret.ident()] := add([lhs.expr()], [rhs.expr()]))
+178        }
+179    };
+180    RuntimeFunction::from_statement(func)
+181}
+182
+183fn make_safe_add_unsigned(
+184    provider: &mut DefaultRuntimeProvider,
+185    db: &dyn CodegenDb,
+186    func_name: &str,
+187) -> RuntimeFunction {
+188    let func_name = YulVariable::new(func_name);
+189    let lhs = YulVariable::new("$lhs");
+190    let rhs = YulVariable::new("$rhs");
+191    let max_value = YulVariable::new("$max_value");
+192    let ret = YulVariable::new("$ret");
+193
+194    let func = function_definition! {
+195        function [func_name.ident()]([lhs.ident()], [rhs.ident()], [max_value.ident()]) -> [ret.ident()] {
+196            (if (gt([lhs.expr()], (sub([max_value.expr()], [rhs.expr()])))) { [revert_with_overflow(provider, db)] })
+197            ([ret.ident()] := add([lhs.expr()], [rhs.expr()]))
+198        }
+199    };
+200    RuntimeFunction::from_statement(func)
+201}
+202
+203fn make_safe_sub_signed(
+204    provider: &mut DefaultRuntimeProvider,
+205    db: &dyn CodegenDb,
+206    func_name: &str,
+207) -> RuntimeFunction {
+208    let func_name = YulVariable::new(func_name);
+209    let lhs = YulVariable::new("$lhs");
+210    let rhs = YulVariable::new("$rhs");
+211    let min_value = YulVariable::new("$min_value");
+212    let max_value = YulVariable::new("$max_value");
+213    let ret = YulVariable::new("$ret");
+214
+215    let func = function_definition! {
+216        function [func_name.ident()]([lhs.ident()], [rhs.ident()], [min_value.ident()], [max_value.ident()]) -> [ret.ident()] {
+217            (if (and((iszero((slt([rhs.expr()], 0)))), (slt([lhs.expr()], (add([min_value.expr()], [rhs.expr()])))))) { [revert_with_overflow(provider, db)] })
+218            (if (and((slt([rhs.expr()], 0)), (sgt([lhs.expr()], (add([max_value.expr()], [rhs.expr()])))))) { [revert_with_overflow(provider, db)] })
+219            ([ret.ident()] := sub([lhs.expr()], [rhs.expr()]))
+220        }
+221    };
+222    RuntimeFunction::from_statement(func)
+223}
+224
+225fn make_safe_sub_unsigned(
+226    provider: &mut DefaultRuntimeProvider,
+227    db: &dyn CodegenDb,
+228    func_name: &str,
+229) -> RuntimeFunction {
+230    let func_name = YulVariable::new(func_name);
+231    let lhs = YulVariable::new("$lhs");
+232    let rhs = YulVariable::new("$rhs");
+233    let ret = YulVariable::new("$ret");
+234
+235    let func = function_definition! {
+236        function [func_name.ident()]([lhs.ident()], [rhs.ident()]) -> [ret.ident()] {
+237            (if (lt([lhs.expr()], [rhs.expr()])) { [revert_with_overflow(provider, db)] })
+238            ([ret.ident()] := sub([lhs.expr()], [rhs.expr()]))
+239        }
+240    };
+241    RuntimeFunction::from_statement(func)
+242}
+243
+244fn make_safe_mul_signed(
+245    provider: &mut DefaultRuntimeProvider,
+246    db: &dyn CodegenDb,
+247    func_name: &str,
+248) -> RuntimeFunction {
+249    let func_name = YulVariable::new(func_name);
+250    let lhs = YulVariable::new("$lhs");
+251    let rhs = YulVariable::new("$rhs");
+252    let min_value = YulVariable::new("$min_value");
+253    let max_value = YulVariable::new("$max_value");
+254    let ret = YulVariable::new("$ret");
+255
+256    let func = function_definition! {
+257        function [func_name.ident()]([lhs.ident()], [rhs.ident()], [min_value.ident()], [max_value.ident()]) -> [ret.ident()] {
+258            // overflow, if lhs > 0, rhs > 0 and lhs > (max_value / rhs)
+259            (if (and((and((sgt([lhs.expr()], 0)), (sgt([rhs.expr()], 0)))), (gt([lhs.expr()], (div([max_value.expr()], [rhs.expr()])))))) { [revert_with_overflow(provider, db)] })
+260            // underflow, if lhs > 0, rhs < 0 and rhs < (min_value / lhs)
+261            (if (and((and((sgt([lhs.expr()], 0)), (slt([rhs.expr()], 0)))), (slt([rhs.expr()], (sdiv([min_value.expr()], [lhs.expr()])))))) { [revert_with_overflow(provider, db)] })
+262            // underflow, if lhs < 0, rhs > 0 and lhs < (min_value / rhs)
+263            (if (and((and((slt([lhs.expr()], 0)), (sgt([rhs.expr()], 0)))), (slt([lhs.expr()], (sdiv([min_value.expr()], [rhs.expr()])))))) { [revert_with_overflow(provider, db)] })
+264            // overflow, if lhs < 0, rhs < 0 and lhs < (max_value / rhs)
+265            (if (and((and((slt([lhs.expr()], 0)), (slt([rhs.expr()], 0)))), (slt([lhs.expr()], (sdiv([max_value.expr()], [rhs.expr()])))))) { [revert_with_overflow(provider, db)] })
+266            ([ret.ident()] := mul([lhs.expr()], [rhs.expr()]))
+267        }
+268    };
+269    RuntimeFunction::from_statement(func)
+270}
+271
+272fn make_safe_mul_unsigned(
+273    provider: &mut DefaultRuntimeProvider,
+274    db: &dyn CodegenDb,
+275    func_name: &str,
+276) -> RuntimeFunction {
+277    let func_name = YulVariable::new(func_name);
+278    let lhs = YulVariable::new("$lhs");
+279    let rhs = YulVariable::new("$rhs");
+280    let max_value = YulVariable::new("$max_value");
+281    let ret = YulVariable::new("$ret");
+282
+283    let func = function_definition! {
+284        function [func_name.ident()]([lhs.ident()], [rhs.ident()], [max_value.ident()]) -> [ret.ident()] {
+285            // overflow, if lhs != 0 and rhs > (max_value / lhs)
+286            (if (and((iszero((iszero([lhs.expr()])))), (gt([rhs.expr()], (div([max_value.expr()], [lhs.expr()])))))) { [revert_with_overflow(provider ,db)] })
+287            ([ret.ident()] := mul([lhs.expr()], [rhs.expr()]))
+288        }
+289    };
+290    RuntimeFunction::from_statement(func)
+291}
+292
+293fn make_safe_div_signed(
+294    provider: &mut DefaultRuntimeProvider,
+295    db: &dyn CodegenDb,
+296    func_name: &str,
+297) -> RuntimeFunction {
+298    let func_name = YulVariable::new(func_name);
+299    let lhs = YulVariable::new("$lhs");
+300    let rhs = YulVariable::new("$rhs");
+301    let min_value = YulVariable::new("$min_value");
+302    let ret = YulVariable::new("$ret");
+303
+304    let func = function_definition! {
+305        function [func_name.ident()]([lhs.ident()], [rhs.ident()], [min_value.ident()]) -> [ret.ident()] {
+306            (if (iszero([rhs.expr()])) { [revert_with_zero_division(provider, db)] })
+307            (if (and( (eq([lhs.expr()], [min_value.expr()])), (eq([rhs.expr()], (sub(0, 1))))) ) { [revert_with_overflow(provider, db)] })
+308            ([ret.ident()] := sdiv([lhs.expr()], [rhs.expr()]))
+309        }
+310    };
+311    RuntimeFunction::from_statement(func)
+312}
+313
+314fn make_safe_div_unsigned(
+315    provider: &mut DefaultRuntimeProvider,
+316    db: &dyn CodegenDb,
+317    func_name: &str,
+318) -> RuntimeFunction {
+319    let func_name = YulVariable::new(func_name);
+320    let lhs = YulVariable::new("$lhs");
+321    let rhs = YulVariable::new("$rhs");
+322    let ret = YulVariable::new("$ret");
+323
+324    let func = function_definition! {
+325        function [func_name.ident()]([lhs.ident()], [rhs.ident()]) -> [ret.ident()] {
+326            (if (iszero([rhs.expr()])) { [revert_with_zero_division(provider, db)] })
+327            ([ret.ident()] := div([lhs.expr()], [rhs.expr()]))
+328        }
+329    };
+330    RuntimeFunction::from_statement(func)
+331}
+332
+333fn make_safe_mod_signed(
+334    provider: &mut DefaultRuntimeProvider,
+335    db: &dyn CodegenDb,
+336    func_name: &str,
+337) -> RuntimeFunction {
+338    let func_name = YulVariable::new(func_name);
+339    let lhs = YulVariable::new("$lhs");
+340    let rhs = YulVariable::new("$rhs");
+341    let ret = YulVariable::new("$ret");
+342
+343    let func = function_definition! {
+344        function [func_name.ident()]([lhs.ident()], [rhs.ident()]) -> [ret.ident()] {
+345            (if (iszero([rhs.expr()])) { [revert_with_zero_division(provider, db)] })
+346            ([ret.ident()] := smod([lhs.expr()], [rhs.expr()]))
+347        }
+348    };
+349    RuntimeFunction::from_statement(func)
+350}
+351
+352fn make_safe_mod_unsigned(
+353    provider: &mut DefaultRuntimeProvider,
+354    db: &dyn CodegenDb,
+355    func_name: &str,
+356) -> RuntimeFunction {
+357    let func_name = YulVariable::new(func_name);
+358    let lhs = YulVariable::new("$lhs");
+359    let rhs = YulVariable::new("$rhs");
+360    let ret = YulVariable::new("$ret");
+361
+362    let func = function_definition! {
+363        function [func_name.ident()]([lhs.ident()], [rhs.ident()]) -> [ret.ident()] {
+364            (if (iszero([rhs.expr()])) { [revert_with_zero_division(provider, db)] })
+365            ([ret.ident()] := mod([lhs.expr()], [rhs.expr()]))
+366        }
+367    };
+368    RuntimeFunction::from_statement(func)
+369}
+370
+371const SAFE_POW_HELPER_NAME: &str = "safe_pow_helper";
+372
+373fn make_safe_pow_unsigned(
+374    provider: &mut DefaultRuntimeProvider,
+375    db: &dyn CodegenDb,
+376    func_name: &str,
+377) -> RuntimeFunction {
+378    let func_name = YulVariable::new(func_name);
+379    let base = YulVariable::new("base");
+380    let exponent = YulVariable::new("exponent");
+381    let max_value = YulVariable::new("max_value");
+382    let power = YulVariable::new("power");
+383
+384    let safe_pow_helper_call = yul::Statement::Assignment(yul::Assignment {
+385        identifiers: vec![base.ident(), power.ident()],
+386        expression: {
+387            let args = vec![
+388                base.expr(),
+389                exponent.expr(),
+390                literal_expression! {1},
+391                max_value.expr(),
+392            ];
+393            provider.create_then_call(SAFE_POW_HELPER_NAME, args, |provider| {
+394                make_safe_exp_helper(provider, db, SAFE_POW_HELPER_NAME)
+395            })
+396        },
+397    });
+398
+399    let func = function_definition! {
+400        function [func_name.ident()]([base.ident()], [exponent.ident()], [max_value.ident()]) -> [power.ident()] {
+401            // Currently, `leave` avoids this function being inlined.
+402            // YUL team is working on optimizer improvements to fix that.
+403
+404            // Note that 0**0 == 1
+405            (if (iszero([exponent.expr()])) {
+406                ([power.ident()] := 1 )
+407                (leave)
+408            })
+409            (if (iszero([base.expr()])) {
+410                ([power.ident()] := 0 )
+411                (leave)
+412            })
+413            // Specializations for small bases
+414            ([switch! {
+415                switch [base.expr()]
+416                // 0 is handled above
+417                (case 1 {
+418                    ([power.ident()] := 1 )
+419                    (leave)
+420                })
+421                (case 2 {
+422                    (if (gt([exponent.expr()], 255)) {
+423                        [revert_with_overflow(provider, db)]
+424                    })
+425                    ([power.ident()] := (exp(2, [exponent.expr()])))
+426                    (if (gt([power.expr()], [max_value.expr()])) {
+427                        [revert_with_overflow(provider, db)]
+428                    })
+429                    (leave)
+430                })
+431            }])
+432            (if (and((sgt([power.expr()], 0)), (gt([power.expr()], (div([max_value.expr()], [base.expr()])))))) { [revert_with_overflow(provider, db)] })
+433
+434            (if (or((and((lt([base.expr()], 11)), (lt([exponent.expr()], 78)))), (and((lt([base.expr()], 307)), (lt([exponent.expr()], 32)))))) {
+435                ([power.ident()] := (exp([base.expr()], [exponent.expr()])))
+436                (if (gt([power.expr()], [max_value.expr()])) {
+437                    [revert_with_overflow(provider, db)]
+438                })
+439                (leave)
+440            })
+441
+442            ([safe_pow_helper_call])
+443            (if (gt([power.expr()], (div([max_value.expr()], [base.expr()])))) {
+444                [revert_with_overflow(provider, db)]
+445            })
+446            ([power.ident()] := (mul([power.expr()], [base.expr()])))
+447        }
+448    };
+449    RuntimeFunction::from_statement(func)
+450}
+451
+452fn make_safe_pow_signed(
+453    provider: &mut DefaultRuntimeProvider,
+454    db: &dyn CodegenDb,
+455    func_name: &str,
+456) -> RuntimeFunction {
+457    let func_name = YulVariable::new(func_name);
+458    let base = YulVariable::new("base");
+459    let exponent = YulVariable::new("exponent");
+460    let min_value = YulVariable::new("min_value");
+461    let max_value = YulVariable::new("max_value");
+462    let power = YulVariable::new("power");
+463
+464    let safe_pow_helper_call = yul::Statement::Assignment(yul::Assignment {
+465        identifiers: vec![base.ident(), power.ident()],
+466        expression: {
+467            let args = vec![base.expr(), exponent.expr(), power.expr(), max_value.expr()];
+468            provider.create_then_call(SAFE_POW_HELPER_NAME, args, |provider| {
+469                make_safe_exp_helper(provider, db, SAFE_POW_HELPER_NAME)
+470            })
+471        },
+472    });
+473
+474    let func = function_definition! {
+475        function [func_name.ident()]([base.ident()], [exponent.ident()], [min_value.ident()], [max_value.ident()]) -> [power.ident()] {
+476            // Currently, `leave` avoids this function being inlined.
+477            // YUL team is working on optimizer improvements to fix that.
+478
+479            // Note that 0**0 == 1
+480            ([switch! {
+481                switch [exponent.expr()]
+482                (case 0 {
+483                    ([power.ident()] := 1 )
+484                    (leave)
+485                })
+486                (case 1 {
+487                    ([power.ident()] := [base.expr()] )
+488                    (leave)
+489                })
+490            }])
+491            (if (iszero([base.expr()])) {
+492                ([power.ident()] := 0 )
+493                (leave)
+494            })
+495            ([power.ident()] := 1 )
+496            // We pull out the first iteration because it is the only one in which
+497            // base can be negative.
+498            // Exponent is at least 2 here.
+499            // overflow check for base * base
+500            ([switch! {
+501                switch (sgt([base.expr()], 0))
+502                (case 1 {
+503                    (if (gt([base.expr()], (div([max_value.expr()], [base.expr()])))) {
+504                        [revert_with_overflow(provider, db)]
+505                    })
+506                })
+507                (case 0 {
+508                    (if (slt([base.expr()], (sdiv([max_value.expr()], [base.expr()])))) {
+509                        [revert_with_overflow(provider, db)]
+510                    })
+511                })
+512            }])
+513            (if (and([exponent.expr()], 1)) {
+514                ([power.ident()] := [base.expr()] )
+515            })
+516            ([base.ident()] := (mul([base.expr()], [base.expr()])))
+517            ([exponent.ident()] := shr(1, [exponent.expr()]))
+518            // // Below this point, base is always positive.
+519            ([safe_pow_helper_call]) // power = 1, base = 16 which is wrong
+520            (if (and((sgt([power.expr()], 0)), (gt([power.expr()], (div([max_value.expr()], [base.expr()])))))) { [revert_with_overflow(provider , db)] })
+521            (if (and((slt([power.expr()], 0)), (slt([power.expr()], (sdiv([min_value.expr()], [base.expr()])))))) { [revert_with_overflow(provider, db)] })
+522            ([power.ident()] := (mul([power.expr()], [base.expr()])))
+523        }
+524    };
+525    RuntimeFunction::from_statement(func)
+526}
+527
+528fn make_safe_exp_helper(
+529    provider: &mut DefaultRuntimeProvider,
+530    db: &dyn CodegenDb,
+531    func_name: &str,
+532) -> RuntimeFunction {
+533    let func_name = YulVariable::new(func_name);
+534    let base = YulVariable::new("base");
+535    let exponent = YulVariable::new("exponent");
+536    let power = YulVariable::new("power");
+537    let max_value = YulVariable::new("max_value");
+538    let ret_power = YulVariable::new("ret_power");
+539    let ret_base = YulVariable::new("ret_base");
+540
+541    let func = function_definition! {
+542        function [func_name.ident()]([base.ident()], [exponent.ident()], [power.ident()], [max_value.ident()])
+543            -> [(vec![ret_base.ident(), ret_power.ident()])...] {
+544            ([ret_base.ident()] := [base.expr()])
+545            ([ret_power.ident()] := [power.expr()])
+546            (for {} (gt([exponent.expr()], 1)) {}
+547                {
+548                    // overflow check for base * base
+549                    (if (gt([ret_base.expr()], (div([max_value.expr()], [ret_base.expr()])))) { [revert_with_overflow(provider, db)] })
+550                    (if (and([exponent.expr()], 1)) {
+551                        // No checks for power := mul(power, base) needed, because the check
+552                        // for base * base above is sufficient, since:
+553                        // |power| <= base (proof by induction) and thus:
+554                        // |power * base| <= base * base <= max <= |min| (for signed)
+555                        // (this is equally true for signed and unsigned exp)
+556                        ([ret_power.ident()] := (mul([ret_power.expr()], [ret_base.expr()])))
+557                    })
+558                    ([ret_base.ident()] := mul([ret_base.expr()], [ret_base.expr()]))
+559                    ([exponent.ident()] := shr(1, [exponent.expr()]))
+560                })
+561        }
+562    };
+563    RuntimeFunction::from_statement(func)
+564}
+565
+566fn revert_with_overflow(provider: &mut dyn RuntimeProvider, db: &dyn CodegenDb) -> yul::Statement {
+567    const PANIC_OVERFLOW: usize = 0x11;
+568
+569    super::panic_revert_numeric(provider, db, literal_expression! {(PANIC_OVERFLOW)})
+570}
+571
+572fn revert_with_zero_division(
+573    provider: &mut dyn RuntimeProvider,
+574    db: &dyn CodegenDb,
+575) -> yul::Statement {
+576    pub const PANIC_ZERO_DIVISION: usize = 0x12;
+577
+578    super::panic_revert_numeric(provider, db, literal_expression! {(PANIC_ZERO_DIVISION)})
+579}
+580
+581fn get_max_value(db: &dyn CodegenDb, ty: TypeId) -> yul::Expression {
+582    match &ty.data(db.upcast()).kind {
+583        TypeKind::I8 => literal_expression! {0x7f},
+584        TypeKind::I16 => literal_expression! {0x7fff},
+585        TypeKind::I32 => literal_expression! {0x7fffffff},
+586        TypeKind::I64 => literal_expression! {0x7fffffffffffffff},
+587        TypeKind::I128 => literal_expression! {0x7fffffffffffffffffffffffffffffff},
+588        TypeKind::I256 => {
+589            literal_expression! {0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff}
+590        }
+591        TypeKind::U8 => literal_expression! {0xff},
+592        TypeKind::U16 => literal_expression! {0xffff},
+593        TypeKind::U32 => literal_expression! {0xffffffff},
+594        TypeKind::U64 => literal_expression! {0xffffffffffffffff},
+595        TypeKind::U128 => literal_expression! {0xffffffffffffffffffffffffffffffff},
+596        TypeKind::U256 => {
+597            literal_expression! {0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff}
+598        }
+599        _ => unreachable!(),
+600    }
+601}
+602
+603fn get_min_value(db: &dyn CodegenDb, ty: TypeId) -> yul::Expression {
+604    debug_assert! {ty.is_integral(db.upcast())};
+605
+606    match &ty.data(db.upcast()).kind {
+607        TypeKind::I8 => {
+608            literal_expression! {0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80}
+609        }
+610        TypeKind::I16 => {
+611            literal_expression! {0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000}
+612        }
+613        TypeKind::I32 => {
+614            literal_expression! {0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000}
+615        }
+616        TypeKind::I64 => {
+617            literal_expression! {0xffffffffffffffffffffffffffffffffffffffffffffffff8000000000000000}
+618        }
+619        TypeKind::I128 => {
+620            literal_expression! {0xffffffffffffffffffffffffffffffff80000000000000000000000000000000}
+621        }
+622        TypeKind::I256 => {
+623            literal_expression! {0x8000000000000000000000000000000000000000000000000000000000000000}
+624        }
+625
+626        _ => literal_expression! {0x0},
+627    }
+628}
\ No newline at end of file diff --git a/compiler-docs/src/fe_codegen/yul/slot_size.rs.html b/compiler-docs/src/fe_codegen/yul/slot_size.rs.html new file mode 100644 index 0000000000..907c4b0a6a --- /dev/null +++ b/compiler-docs/src/fe_codegen/yul/slot_size.rs.html @@ -0,0 +1,16 @@ +slot_size.rs - source

fe_codegen/yul/
slot_size.rs

1use fe_mir::ir::{Type, TypeId, TypeKind};
+2
+3use crate::db::CodegenDb;
+4
+5// We use the same slot size between memory and storage to simplify the
+6// implementation and minimize gas consumption in memory <-> storage copy
+7// instructions.
+8pub(crate) const SLOT_SIZE: usize = 32;
+9
+10pub(crate) fn yul_primitive_type(db: &dyn CodegenDb) -> TypeId {
+11    db.mir_intern_type(Type::new(TypeKind::U256, None).into())
+12}
+13
+14pub(crate) fn function_hash_type(db: &dyn CodegenDb) -> TypeId {
+15    db.mir_intern_type(Type::new(TypeKind::U32, None).into())
+16}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/db.rs.html b/compiler-docs/src/fe_common/db.rs.html new file mode 100644 index 0000000000..df2391a346 --- /dev/null +++ b/compiler-docs/src/fe_common/db.rs.html @@ -0,0 +1,49 @@ +db.rs - source

fe_common/
db.rs

1#![allow(clippy::arc_with_non_send_sync)]
+2use crate::files::{File, SourceFileId, Utf8Path};
+3use codespan_reporting as cs;
+4use salsa;
+5use smol_str::SmolStr;
+6use std::rc::Rc;
+7
+8pub trait Upcast<T: ?Sized> {
+9    fn upcast(&self) -> &T;
+10}
+11
+12pub trait UpcastMut<T: ?Sized> {
+13    fn upcast_mut(&mut self) -> &mut T;
+14}
+15
+16#[salsa::query_group(SourceDbStorage)]
+17pub trait SourceDb {
+18    #[salsa::interned]
+19    fn intern_file(&self, file: File) -> SourceFileId;
+20
+21    /// Set with `fn set_file_content(&mut self, file: SourceFileId, content: Rc<str>)
+22    #[salsa::input]
+23    fn file_content(&self, file: SourceFileId) -> Rc<str>;
+24
+25    #[salsa::invoke(file_line_starts_query)]
+26    fn file_line_starts(&self, file: SourceFileId) -> Rc<[usize]>;
+27
+28    #[salsa::invoke(file_name_query)]
+29    fn file_name(&self, file: SourceFileId) -> SmolStr;
+30}
+31
+32fn file_line_starts_query(db: &dyn SourceDb, file: SourceFileId) -> Rc<[usize]> {
+33    cs::files::line_starts(&file.content(db)).collect()
+34}
+35
+36fn file_name_query(db: &dyn SourceDb, file: SourceFileId) -> SmolStr {
+37    let path = db.lookup_intern_file(file).path;
+38    Utf8Path::new(path.as_str())
+39        .file_name()
+40        .expect("path lacks file name")
+41        .into()
+42}
+43
+44#[salsa::database(SourceDbStorage)]
+45#[derive(Default)]
+46pub struct TestDb {
+47    storage: salsa::Storage<TestDb>,
+48}
+49impl salsa::Database for TestDb {}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/diagnostics.rs.html b/compiler-docs/src/fe_common/diagnostics.rs.html new file mode 100644 index 0000000000..02d0bbeead --- /dev/null +++ b/compiler-docs/src/fe_common/diagnostics.rs.html @@ -0,0 +1,145 @@ +diagnostics.rs - source

fe_common/
diagnostics.rs

1use crate::db::SourceDb;
+2use crate::files::{SourceFileId, Utf8PathBuf};
+3use crate::Span;
+4pub use codespan_reporting::diagnostic as cs;
+5use codespan_reporting::files::Error as CsError;
+6use codespan_reporting::term;
+7pub use cs::Severity;
+8use std::ops::Range;
+9use std::rc::Rc;
+10use term::termcolor::{BufferWriter, ColorChoice};
+11
+12#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+13pub struct Diagnostic {
+14    pub severity: Severity,
+15    pub message: String,
+16    pub labels: Vec<Label>,
+17    pub notes: Vec<String>,
+18}
+19impl Diagnostic {
+20    pub fn into_cs(self) -> cs::Diagnostic<SourceFileId> {
+21        cs::Diagnostic {
+22            severity: self.severity,
+23            code: None,
+24            message: self.message,
+25            labels: self.labels.into_iter().map(Label::into_cs_label).collect(),
+26            notes: self.notes,
+27        }
+28    }
+29    pub fn error(message: String) -> Self {
+30        Self {
+31            severity: Severity::Error,
+32            message,
+33            labels: vec![],
+34            notes: vec![],
+35        }
+36    }
+37}
+38
+39#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
+40pub enum LabelStyle {
+41    Primary,
+42    Secondary,
+43}
+44impl From<LabelStyle> for cs::LabelStyle {
+45    fn from(other: LabelStyle) -> cs::LabelStyle {
+46        match other {
+47            LabelStyle::Primary => cs::LabelStyle::Primary,
+48            LabelStyle::Secondary => cs::LabelStyle::Secondary,
+49        }
+50    }
+51}
+52
+53#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+54pub struct Label {
+55    pub style: LabelStyle,
+56    pub span: Span,
+57    pub message: String,
+58}
+59impl Label {
+60    /// Create a primary label with the given message. This will underline the
+61    /// given span with carets (`^^^^`).
+62    pub fn primary<S: Into<String>>(span: Span, message: S) -> Self {
+63        Label {
+64            style: LabelStyle::Primary,
+65            span,
+66            message: message.into(),
+67        }
+68    }
+69
+70    /// Create a secondary label with the given message. This will underline the
+71    /// given span with hyphens (`----`).
+72    pub fn secondary<S: Into<String>>(span: Span, message: S) -> Self {
+73        Label {
+74            style: LabelStyle::Secondary,
+75            span,
+76            message: message.into(),
+77        }
+78    }
+79
+80    /// Convert into a [`codespan_reporting::Diagnostic::Label`]
+81    pub fn into_cs_label(self) -> cs::Label<SourceFileId> {
+82        cs::Label {
+83            style: self.style.into(),
+84            file_id: self.span.file_id,
+85            range: self.span.into(),
+86            message: self.message,
+87        }
+88    }
+89}
+90
+91/// Print the given diagnostics to stderr.
+92pub fn print_diagnostics(db: &dyn SourceDb, diagnostics: &[Diagnostic]) {
+93    let writer = BufferWriter::stderr(ColorChoice::Auto);
+94    let mut buffer = writer.buffer();
+95    let config = term::Config::default();
+96    let files = SourceDbWrapper(db);
+97
+98    for diag in diagnostics {
+99        term::emit(&mut buffer, &config, &files, &diag.clone().into_cs()).unwrap();
+100    }
+101    // If we use `writer` here, the output won't be captured by rust's test system.
+102    eprintln!("{}", std::str::from_utf8(buffer.as_slice()).unwrap());
+103}
+104
+105/// Format the given diagnostics as a string.
+106pub fn diagnostics_string(db: &dyn SourceDb, diagnostics: &[Diagnostic]) -> String {
+107    let writer = BufferWriter::stderr(ColorChoice::Never);
+108    let mut buffer = writer.buffer();
+109    let config = term::Config::default();
+110    let files = SourceDbWrapper(db);
+111
+112    for diag in diagnostics {
+113        term::emit(&mut buffer, &config, &files, &diag.clone().into_cs())
+114            .expect("failed to emit diagnostic");
+115    }
+116    std::str::from_utf8(buffer.as_slice()).unwrap().to_string()
+117}
+118
+119struct SourceDbWrapper<'a>(pub &'a dyn SourceDb);
+120
+121impl<'a> codespan_reporting::files::Files<'_> for SourceDbWrapper<'a> {
+122    type FileId = SourceFileId;
+123    type Name = Rc<Utf8PathBuf>;
+124    type Source = Rc<str>;
+125
+126    fn name(&self, file: SourceFileId) -> Result<Self::Name, CsError> {
+127        Ok(file.path(self.0))
+128    }
+129
+130    fn source(&self, file: SourceFileId) -> Result<Self::Source, CsError> {
+131        Ok(file.content(self.0))
+132    }
+133
+134    fn line_index(&self, file: SourceFileId, byte_index: usize) -> Result<usize, CsError> {
+135        Ok(file.line_index(self.0, byte_index))
+136    }
+137
+138    fn line_range(&self, file: SourceFileId, line_index: usize) -> Result<Range<usize>, CsError> {
+139        file.line_range(self.0, line_index)
+140            .ok_or(CsError::LineTooLarge {
+141                given: line_index,
+142                max: self.0.file_line_starts(file).len() - 1,
+143            })
+144    }
+145}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/files.rs.html b/compiler-docs/src/fe_common/files.rs.html new file mode 100644 index 0000000000..d523d087d8 --- /dev/null +++ b/compiler-docs/src/fe_common/files.rs.html @@ -0,0 +1,132 @@ +files.rs - source

fe_common/
files.rs

1use crate::db::SourceDb;
+2pub use camino::{Utf8Component, Utf8Path, Utf8PathBuf};
+3pub use fe_library::include_dir;
+4use std::ops::Range;
+5use std::rc::Rc;
+6
+7// NOTE: all file paths are stored as utf8 strings.
+8//  Non-utf8 paths (for user code) should be reported
+9//  as an error.
+10//  If include_dir paths aren't utf8, we panic and fix
+11//  our stdlib/test-file path names.
+12
+13#[derive(Debug, PartialEq, Eq, Hash, Clone)]
+14pub struct File {
+15    /// Differentiates between local source files and fe std lib
+16    /// files, which may have the same path (for salsa's sake).
+17    pub kind: FileKind,
+18
+19    /// Path of the file. May include `src/` dir or longer prefix;
+20    /// this prefix will be stored in the `Ingot::src_path`, and stripped
+21    /// off as needed.
+22    pub path: Rc<Utf8PathBuf>,
+23}
+24
+25#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)]
+26pub enum FileKind {
+27    /// User file; either part of the target project or an imported ingot
+28    Local,
+29    /// File is part of the fe standard library
+30    Std,
+31}
+32
+33/// Returns the common *prefix* of two paths. If the paths are identical,
+34/// returns the path parent.
+35pub fn common_prefix(left: &Utf8Path, right: &Utf8Path) -> Utf8PathBuf {
+36    left.components()
+37        .zip(right.components())
+38        .take_while(|(l, r)| l == r)
+39        .map(|(l, _)| l)
+40        .collect()
+41}
+42
+43// from rust-analyzer {
+44#[macro_export]
+45macro_rules! impl_intern_key {
+46    ($name:ident) => {
+47        impl salsa::InternKey for $name {
+48            fn from_intern_id(v: salsa::InternId) -> Self {
+49                $name(v.as_u32())
+50            }
+51            fn as_intern_id(&self) -> salsa::InternId {
+52                salsa::InternId::from(self.0)
+53            }
+54        }
+55    };
+56}
+57// } from rust-analyzer
+58
+59// TODO: rename to FileId
+60#[derive(Debug, serde::Deserialize, PartialEq, Eq, Hash, Copy, Clone)]
+61pub struct SourceFileId(pub(crate) u32);
+62impl_intern_key!(SourceFileId);
+63
+64impl SourceFileId {
+65    pub fn new_local(db: &mut dyn SourceDb, path: &str, content: Rc<str>) -> Self {
+66        Self::new(db, FileKind::Std, path, content)
+67    }
+68
+69    pub fn new_std(db: &mut dyn SourceDb, path: &str, content: Rc<str>) -> Self {
+70        Self::new(db, FileKind::Std, path, content)
+71    }
+72
+73    pub fn new(db: &mut dyn SourceDb, kind: FileKind, path: &str, content: Rc<str>) -> Self {
+74        let id = db.intern_file(File {
+75            kind,
+76            path: Rc::new(path.into()),
+77        });
+78        db.set_file_content(id, content);
+79        id
+80    }
+81
+82    pub fn path(&self, db: &dyn SourceDb) -> Rc<Utf8PathBuf> {
+83        db.lookup_intern_file(*self).path
+84    }
+85
+86    pub fn content(&self, db: &dyn SourceDb) -> Rc<str> {
+87        db.file_content(*self)
+88    }
+89
+90    pub fn line_index(&self, db: &dyn SourceDb, byte_index: usize) -> usize {
+91        db.file_line_starts(*self)
+92            .binary_search(&byte_index)
+93            .unwrap_or_else(|next_line| next_line - 1)
+94    }
+95
+96    pub fn line_range(&self, db: &dyn SourceDb, line_index: usize) -> Option<Range<usize>> {
+97        let line_starts = db.file_line_starts(*self);
+98        let end = if line_index == line_starts.len() - 1 {
+99            self.content(db).len()
+100        } else {
+101            *line_starts.get(line_index + 1)?
+102        };
+103        Some(Range {
+104            start: *line_starts.get(line_index)?,
+105            end,
+106        })
+107    }
+108
+109    pub fn dummy_file() -> Self {
+110        // Used by unit tests and benchmarks
+111        Self(u32::MAX)
+112    }
+113    pub fn is_dummy(self) -> bool {
+114        self == Self::dummy_file()
+115    }
+116}
+117
+118#[test]
+119fn test_common_prefix() {
+120    assert_eq!(
+121        common_prefix(Utf8Path::new("a/b/c/d/e"), Utf8Path::new("a/b/d/e")),
+122        Utf8Path::new("a/b")
+123    );
+124    assert_eq!(
+125        common_prefix(Utf8Path::new("src/foo.x"), Utf8Path::new("tests/bar.fe")),
+126        Utf8Path::new("")
+127    );
+128    assert_eq!(
+129        common_prefix(Utf8Path::new("/src/foo.x"), Utf8Path::new("src/bar.fe")),
+130        Utf8Path::new("")
+131    );
+132}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/lib.rs.html b/compiler-docs/src/fe_common/lib.rs.html new file mode 100644 index 0000000000..5c599c8fd1 --- /dev/null +++ b/compiler-docs/src/fe_common/lib.rs.html @@ -0,0 +1,26 @@ +lib.rs - source

fe_common/
lib.rs

1pub mod db;
+2pub mod diagnostics;
+3pub mod files;
+4pub mod numeric;
+5pub mod panic;
+6mod span;
+7pub mod utils;
+8
+9pub use files::{File, FileKind, SourceFileId};
+10pub use span::{Span, Spanned};
+11
+12#[macro_export]
+13#[cfg(target_arch = "wasm32")]
+14macro_rules! assert_snapshot_wasm {
+15    ($path:expr, $actual:expr) => {
+16        let snap = include_str!($path);
+17        let expected = snap.splitn(3, "---\n").last().unwrap();
+18        pretty_assertions::assert_eq!($actual.trim(), expected.trim());
+19    };
+20}
+21
+22#[macro_export]
+23#[cfg(not(target_arch = "wasm32"))]
+24macro_rules! assert_snapshot_wasm {
+25    ($path:expr, $actual:expr) => {};
+26}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/numeric.rs.html b/compiler-docs/src/fe_common/numeric.rs.html new file mode 100644 index 0000000000..40d94a6aac --- /dev/null +++ b/compiler-docs/src/fe_common/numeric.rs.html @@ -0,0 +1,98 @@ +numeric.rs - source

fe_common/
numeric.rs

1use num_bigint::{BigInt, Sign};
+2
+3/// A type that represents the radix of a numeric literal.
+4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+5pub enum Radix {
+6    Hexadecimal,
+7    Decimal,
+8    Octal,
+9    Binary,
+10}
+11
+12impl Radix {
+13    /// Returns number representation of the radix.
+14    pub fn as_num(self) -> u32 {
+15        match self {
+16            Self::Hexadecimal => 16,
+17            Self::Decimal => 10,
+18            Self::Octal => 8,
+19            Self::Binary => 2,
+20        }
+21    }
+22}
+23
+24/// A helper type to interpret a numeric literal represented by string.
+25#[derive(Debug, Clone)]
+26pub struct Literal<'a> {
+27    /// The number part of the string.
+28    num: &'a str,
+29    /// The radix of the literal.
+30    radix: Radix,
+31}
+32
+33impl<'a> Literal<'a> {
+34    pub fn new(src: &'a str) -> Self {
+35        debug_assert!(!src.is_empty());
+36        debug_assert_ne!(src.chars().next(), Some('-'));
+37        let (radix, prefix) = if src.len() < 2 {
+38            (Radix::Decimal, None)
+39        } else {
+40            match &src[0..2] {
+41                "0x" | "0X" => (Radix::Hexadecimal, Some(&src[..2])),
+42                "0o" | "0O" => (Radix::Octal, Some(&src[..2])),
+43                "0b" | "0B" => (Radix::Binary, Some(&src[..2])),
+44                _ => (Radix::Decimal, None),
+45            }
+46        };
+47
+48        Self {
+49            num: &src[prefix.map_or(0, str::len)..],
+50            radix,
+51        }
+52    }
+53
+54    /// Parse the numeric literal to `T`.
+55    pub fn parse<T: num_traits::Num>(&self) -> Result<T, T::FromStrRadixErr> {
+56        T::from_str_radix(self.num, self.radix.as_num())
+57    }
+58
+59    /// Returns radix of the numeric literal.
+60    pub fn radix(&self) -> Radix {
+61        self.radix
+62    }
+63}
+64
+65// Converts any positive or negative `BigInt` into a hex str using 2s complement representation for negative values.
+66pub fn to_hex_str(val: &BigInt) -> String {
+67    format!(
+68        "0x{}",
+69        BigInt::from_bytes_be(Sign::Plus, &val.to_signed_bytes_be()).to_str_radix(16)
+70    )
+71}
+72
+73#[cfg(test)]
+74mod tests {
+75    use super::*;
+76
+77    #[test]
+78    fn test_radix() {
+79        assert_eq!(Literal::new("0XFF").radix(), Radix::Hexadecimal);
+80        assert_eq!(Literal::new("0xFF").radix(), Radix::Hexadecimal);
+81        assert_eq!(Literal::new("0O77").radix(), Radix::Octal);
+82        assert_eq!(Literal::new("0o77").radix(), Radix::Octal);
+83        assert_eq!(Literal::new("0B77").radix(), Radix::Binary);
+84        assert_eq!(Literal::new("0b77").radix(), Radix::Binary);
+85        assert_eq!(Literal::new("1").radix(), Radix::Decimal);
+86
+87        // Invalid radix is treated as `Decimal`.
+88        assert_eq!(Literal::new("0D15").radix(), Radix::Decimal);
+89    }
+90
+91    #[test]
+92    fn test_to_hex_str() {
+93        assert_eq!(to_hex_str(&BigInt::from(-1i8)), "0xff");
+94        assert_eq!(to_hex_str(&BigInt::from(-2i8)), "0xfe");
+95        assert_eq!(to_hex_str(&BigInt::from(1i8)), "0x1");
+96        assert_eq!(to_hex_str(&BigInt::from(2i8)), "0x2");
+97    }
+98}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/panic.rs.html b/compiler-docs/src/fe_common/panic.rs.html new file mode 100644 index 0000000000..58309e27fc --- /dev/null +++ b/compiler-docs/src/fe_common/panic.rs.html @@ -0,0 +1,24 @@ +panic.rs - source

fe_common/
panic.rs

1use once_cell::sync::Lazy;
+2use std::panic;
+3
+4const BUG_REPORT_URL: &str = "https://github.com/ethereum/fe/issues/new";
+5type PanicCallback = dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static;
+6static DEFAULT_PANIC_HOOK: Lazy<Box<PanicCallback>> = Lazy::new(|| {
+7    let hook = panic::take_hook();
+8    panic::set_hook(Box::new(report_ice));
+9    hook
+10});
+11
+12pub fn install_panic_hook() {
+13    Lazy::force(&DEFAULT_PANIC_HOOK);
+14}
+15fn report_ice(info: &panic::PanicInfo) {
+16    (*DEFAULT_PANIC_HOOK)(info);
+17
+18    eprintln!();
+19    eprintln!("You've hit an internal compiler error. This is a bug in the Fe compiler.");
+20    eprintln!("Fe is still under heavy development, and isn't yet ready for production use.");
+21    eprintln!();
+22    eprintln!("If you would, please report this bug at the following URL:");
+23    eprintln!("  {BUG_REPORT_URL}");
+24}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/span.rs.html b/compiler-docs/src/fe_common/span.rs.html new file mode 100644 index 0000000000..8d80a6fc9e --- /dev/null +++ b/compiler-docs/src/fe_common/span.rs.html @@ -0,0 +1,153 @@ +span.rs - source

fe_common/
span.rs

1use crate::files::SourceFileId;
+2use serde::{Deserialize, Serialize};
+3use std::cmp;
+4use std::fmt::{Debug, Formatter};
+5use std::ops::{Add, AddAssign, Range};
+6
+7/// An exclusive span of byte offsets in a source file.
+8#[derive(Serialize, Deserialize, PartialEq, Copy, Clone, Hash, Eq)]
+9pub struct Span {
+10    #[serde(skip_serializing)]
+11    pub file_id: SourceFileId,
+12    /// A byte offset specifying the inclusive start of a span.
+13    pub start: usize,
+14    /// A byte offset specifying the exclusive end of a span.
+15    pub end: usize,
+16}
+17
+18impl Span {
+19    pub fn new(file_id: SourceFileId, start: usize, end: usize) -> Self {
+20        Span {
+21            file_id,
+22            start: cmp::min(start, end),
+23            end: cmp::max(start, end),
+24        }
+25    }
+26
+27    pub fn zero(file_id: SourceFileId) -> Self {
+28        Span {
+29            file_id,
+30            start: 0,
+31            end: 0,
+32        }
+33    }
+34
+35    pub fn dummy() -> Self {
+36        Self {
+37            file_id: SourceFileId::dummy_file(),
+38            start: usize::MAX,
+39            end: usize::MAX,
+40        }
+41    }
+42
+43    pub fn is_dummy(&self) -> bool {
+44        self == &Self::dummy()
+45    }
+46
+47    pub fn from_pair<S, E>(start_elem: S, end_elem: E) -> Self
+48    where
+49        S: Into<Span>,
+50        E: Into<Span>,
+51    {
+52        let start_span: Span = start_elem.into();
+53        let end_span: Span = end_elem.into();
+54
+55        let file_id = if start_span.file_id == end_span.file_id {
+56            start_span.file_id
+57        } else {
+58            panic!("file ids are not equal")
+59        };
+60
+61        Self {
+62            file_id,
+63            start: start_span.start,
+64            end: end_span.end,
+65        }
+66    }
+67}
+68
+69impl Debug for Span {
+70    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+71        write!(f, "{:?}", Range::from(*self))
+72    }
+73}
+74
+75pub trait Spanned {
+76    fn span(&self) -> Span;
+77}
+78
+79impl Add for Span {
+80    type Output = Self;
+81
+82    fn add(self, other: Self) -> Self {
+83        use std::cmp::{max, min};
+84
+85        let file_id = if self.file_id == other.file_id {
+86            self.file_id
+87        } else {
+88            panic!("file ids are not equal")
+89        };
+90
+91        Self {
+92            file_id,
+93            start: min(self.start, other.start),
+94            end: max(self.end, other.end),
+95        }
+96    }
+97}
+98
+99impl Add<Option<Span>> for Span {
+100    type Output = Self;
+101
+102    fn add(self, other: Option<Span>) -> Self {
+103        if let Some(other) = other {
+104            self + other
+105        } else {
+106            self
+107        }
+108    }
+109}
+110
+111impl<'a, T> Add<Option<&'a T>> for Span
+112where
+113    Span: Add<&'a T, Output = Self>,
+114{
+115    type Output = Self;
+116
+117    fn add(self, other: Option<&'a T>) -> Self {
+118        if let Some(other) = other {
+119            self + other
+120        } else {
+121            self
+122        }
+123    }
+124}
+125
+126impl<'a, T> Add<&'a T> for Span
+127where
+128    T: Spanned,
+129{
+130    type Output = Self;
+131
+132    fn add(self, other: &'a T) -> Self {
+133        self + other.span()
+134    }
+135}
+136
+137impl<T> AddAssign<T> for Span
+138where
+139    Span: Add<T, Output = Self>,
+140{
+141    fn add_assign(&mut self, other: T) {
+142        *self = *self + other
+143    }
+144}
+145
+146impl From<Span> for Range<usize> {
+147    fn from(span: Span) -> Self {
+148        Range {
+149            start: span.start,
+150            end: span.end,
+151        }
+152    }
+153}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/utils/dirs.rs.html b/compiler-docs/src/fe_common/utils/dirs.rs.html new file mode 100644 index 0000000000..f25601b2bc --- /dev/null +++ b/compiler-docs/src/fe_common/utils/dirs.rs.html @@ -0,0 +1,26 @@ +dirs.rs - source

fe_common/utils/
dirs.rs

1use std::path::PathBuf;
+2
+3pub fn get_fe_home() -> PathBuf {
+4    let fe_home = std::env::var("FE_HOME")
+5        .map(PathBuf::from)
+6        .unwrap_or_else(|_| {
+7            dirs::home_dir()
+8                .expect("Failed to get home dir")
+9                .join(".fe")
+10        });
+11
+12    if !fe_home.exists() {
+13        std::fs::create_dir_all(&fe_home).expect("Failed to create FE_HOME");
+14    }
+15
+16    fe_home
+17}
+18
+19pub fn get_fe_deps() -> PathBuf {
+20    let fe_deps = get_fe_home().join("deps");
+21
+22    if !fe_deps.exists() {
+23        std::fs::create_dir_all(&fe_deps).expect("Failed to create FE_DEPS");
+24    }
+25    fe_deps
+26}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/utils/files.rs.html b/compiler-docs/src/fe_common/utils/files.rs.html new file mode 100644 index 0000000000..47bbeec3aa --- /dev/null +++ b/compiler-docs/src/fe_common/utils/files.rs.html @@ -0,0 +1,416 @@ +files.rs - source

fe_common/utils/
files.rs

1use serde::Deserialize;
+2use std::{fs, path::Path};
+3use toml::Table;
+4
+5use indexmap::{indexmap, IndexMap};
+6use path_clean::PathClean;
+7use smol_str::SmolStr;
+8use walkdir::WalkDir;
+9
+10use crate::utils::dirs::get_fe_deps;
+11use crate::utils::git;
+12
+13const FE_TOML: &str = "fe.toml";
+14
+15pub enum FileLoader {
+16    Static(Vec<(&'static str, &'static str)>),
+17    Fs,
+18}
+19
+20impl FileLoader {
+21    pub fn canonicalize_path(&self, path: &str) -> Result<SmolStr, String> {
+22        match self {
+23            FileLoader::Static(_) => Ok(SmolStr::new(
+24                Path::new(path).clean().to_str().expect("path clean failed"),
+25            )),
+26            FileLoader::Fs => Ok(SmolStr::new(
+27                fs::canonicalize(path)
+28                    .map_err(|err| {
+29                        format!("unable to canonicalize root project path {path}.\n{err}")
+30                    })?
+31                    .to_str()
+32                    .expect("could not convert path to string"),
+33            )),
+34        }
+35    }
+36
+37    pub fn fe_files(&self, path: &str) -> Result<Vec<(String, String)>, String> {
+38        match self {
+39            FileLoader::Static(files) => Ok(files
+40                .iter()
+41                .filter_map(|(file_path, content)| {
+42                    if file_path.starts_with(path) && file_path.ends_with(".fe") {
+43                        Some((file_path.to_string(), content.to_string()))
+44                    } else {
+45                        None
+46                    }
+47                })
+48                .collect()),
+49            FileLoader::Fs => {
+50                let entries = WalkDir::new(path);
+51                let mut files = vec![];
+52
+53                for entry in entries.into_iter() {
+54                    let entry =
+55                        entry.map_err(|err| format!("Error loading source files.\n{err}"))?;
+56                    let path = entry.path();
+57
+58                    if path.is_file()
+59                        && path.extension().and_then(std::ffi::OsStr::to_str) == Some("fe")
+60                    {
+61                        let content = std::fs::read_to_string(path)
+62                            .map_err(|err| format!("Unable to read src file.\n{err}"))?;
+63                        files.push((path.to_string_lossy().to_string(), content));
+64                    }
+65                }
+66
+67                Ok(files)
+68            }
+69        }
+70    }
+71
+72    pub fn file_content(&self, path: &str) -> Result<String, String> {
+73        match self {
+74            FileLoader::Static(files) => {
+75                match files.iter().find(|(file_path, _)| file_path == &path) {
+76                    Some((_, content)) => Ok(content.to_string()),
+77                    None => Err(format!("could not load static file {}", path)),
+78                }
+79            }
+80            FileLoader::Fs => {
+81                std::fs::read_to_string(path).map_err(|err| format!("Unable to read file.\n{err}"))
+82            }
+83        }
+84    }
+85}
+86
+87pub struct BuildFiles {
+88    pub root_project_path: SmolStr,
+89    pub project_files: IndexMap<SmolStr, ProjectFiles>,
+90}
+91
+92impl BuildFiles {
+93    pub fn root_project_mode(&self) -> ProjectMode {
+94        self.project_files[&self.root_project_path].mode
+95    }
+96
+97    /// Build files are loaded from the file system.
+98    pub fn load_fs(root_path: &str) -> Result<Self, String> {
+99        Self::load(&FileLoader::Fs, root_path)
+100    }
+101
+102    /// Build files are loaded from static file vector.
+103    pub fn load_static(
+104        files: Vec<(&'static str, &'static str)>,
+105        root_path: &str,
+106    ) -> Result<Self, String> {
+107        Self::load(&FileLoader::Static(files), root_path)
+108    }
+109
+110    fn load(loader: &FileLoader, root_project_path: &str) -> Result<Self, String> {
+111        let root_project_path = loader.canonicalize_path(root_project_path)?;
+112
+113        // Map containing canonicalized project paths and their files.
+114        let mut project_files = indexmap! {
+115            root_project_path.clone() => ProjectFiles::load(loader, &root_project_path)?
+116        };
+117
+118        // The root project is the first project to have unresolved dependencies.
+119        let mut unresolved_projects = vec![root_project_path.clone()];
+120
+121        while let Some(unresolved_project_path) = unresolved_projects.pop() {
+122            // Iterate over each of `unresolved_projects` dependencies.
+123            for dependency in project_files[&unresolved_project_path].dependencies.clone() {
+124                if !project_files.contains_key(&dependency.canonicalized_path) {
+125                    // The dependency is being encountered for the first time.
+126                    let dep_project = dependency.resolve(loader)?;
+127                    project_files.insert(dependency.canonicalized_path.clone(), dep_project);
+128                    unresolved_projects.push(dependency.canonicalized_path);
+129                };
+130            }
+131        }
+132
+133        Ok(Self {
+134            root_project_path,
+135            project_files,
+136        })
+137    }
+138}
+139
+140pub struct ProjectFiles {
+141    pub name: SmolStr,
+142    pub version: SmolStr,
+143    pub mode: ProjectMode,
+144    pub dependencies: Vec<Dependency>,
+145    pub src: Vec<(String, String)>,
+146}
+147
+148impl ProjectFiles {
+149    fn load(loader: &FileLoader, path: &str) -> Result<Self, String> {
+150        let manifest_path = Path::new(path)
+151            .join(FE_TOML)
+152            .to_str()
+153            .expect("unable to convert path to &str")
+154            .to_owned();
+155        let manifest = Manifest::load(loader, &manifest_path)?;
+156        let name = manifest.name;
+157        let version = manifest.version;
+158
+159        let mut dependencies = vec![];
+160        let mut errors = vec![];
+161
+162        if let Some(deps) = &manifest.dependencies {
+163            for (name, value) in deps {
+164                match Dependency::new(loader, name, path, value) {
+165                    Ok(dep) => dependencies.push(dep),
+166                    Err(dep_err) => {
+167                        errors.push(format!("Misconfigured dependency {name}:\n{dep_err}"))
+168                    }
+169                }
+170            }
+171        }
+172
+173        if !errors.is_empty() {
+174            return Err(errors.join("\n"));
+175        }
+176
+177        let src_path = Path::new(path)
+178            .join("src")
+179            .to_str()
+180            .expect("unable to convert path to &str")
+181            .to_owned();
+182        let src = loader.fe_files(&src_path)?;
+183
+184        let mode = if src
+185            .iter()
+186            .any(|(file_path, _)| file_path.ends_with("main.fe"))
+187        {
+188            ProjectMode::Main
+189        } else if src
+190            .iter()
+191            .any(|(file_path, _)| file_path.ends_with("lib.fe"))
+192        {
+193            ProjectMode::Lib
+194        } else {
+195            return Err(format!("Unable to determine mode of {}. Consider adding src/main.fe or src/lib.fe file to the project.", name));
+196        };
+197
+198        Ok(Self {
+199            name,
+200            version,
+201            mode,
+202            dependencies,
+203            src,
+204        })
+205    }
+206}
+207
+208#[derive(Clone, Copy, PartialEq, Eq)]
+209pub enum ProjectMode {
+210    Main,
+211    Lib,
+212}
+213
+214#[derive(Clone)]
+215pub struct Dependency {
+216    pub name: SmolStr,
+217    pub version: Option<SmolStr>,
+218    pub canonicalized_path: SmolStr,
+219    pub kind: DependencyKind,
+220}
+221
+222pub trait DependencyResolver {
+223    fn resolve(dep: &Dependency, loader: &FileLoader) -> Result<ProjectFiles, String>;
+224}
+225
+226#[derive(Clone)]
+227pub struct LocalDependency;
+228
+229impl DependencyResolver for LocalDependency {
+230    fn resolve(dep: &Dependency, loader: &FileLoader) -> Result<ProjectFiles, String> {
+231        let project = ProjectFiles::load(loader, &dep.canonicalized_path)?;
+232
+233        let mut errors = vec![];
+234
+235        if project.mode == ProjectMode::Main {
+236            errors.push(format!("{} is not a library", project.name));
+237        }
+238
+239        if project.name != dep.name {
+240            errors.push(format!("Name mismatch: {} =/= {}", project.name, dep.name));
+241        }
+242
+243        if let Some(version) = &dep.version {
+244            if version != &project.version {
+245                errors.push(format!(
+246                    "Version mismatch: {} =/= {}",
+247                    project.version, version
+248                ));
+249            }
+250        }
+251
+252        if errors.is_empty() {
+253            Ok(project)
+254        } else {
+255            Err(format!(
+256                "Unable to resolve {} at {} due to the following errors.\n{}",
+257                dep.name,
+258                dep.canonicalized_path,
+259                errors.join("\n")
+260            ))
+261        }
+262    }
+263}
+264
+265#[derive(Clone)]
+266pub struct GitDependency {
+267    source: String,
+268    rev: String,
+269}
+270
+271impl DependencyResolver for GitDependency {
+272    fn resolve(dep: &Dependency, loader: &FileLoader) -> Result<ProjectFiles, String> {
+273        if let DependencyKind::Git(GitDependency { source, rev }) = &dep.kind {
+274            if let Err(e) = git::fetch_and_checkout(source, dep.canonicalized_path.as_str(), rev) {
+275                return Err(format!(
+276                    "Unable to clone git dependency {}.\n{}",
+277                    dep.name, e
+278                ));
+279            }
+280
+281            // Load it like any local dependency which will include additional checks.
+282            return LocalDependency::resolve(dep, loader);
+283        }
+284        Err(format!("Could not resolve git dependency {}", dep.name))
+285    }
+286}
+287
+288#[derive(Clone)]
+289pub enum DependencyKind {
+290    Local(LocalDependency),
+291    Git(GitDependency),
+292}
+293
+294impl Dependency {
+295    fn new(
+296        loader: &FileLoader,
+297        name: &str,
+298        orig_path: &str,
+299        value: &toml::Value,
+300    ) -> Result<Self, String> {
+301        let join_path = |path: &str| {
+302            loader.canonicalize_path(
+303                Path::new(orig_path)
+304                    .join(path)
+305                    .to_str()
+306                    .expect("unable to convert path to &str"),
+307            )
+308        };
+309
+310        match value {
+311            toml::Value::String(dep_path) => Ok(Dependency {
+312                name: name.into(),
+313                version: None,
+314                kind: DependencyKind::Local(LocalDependency),
+315                canonicalized_path: join_path(dep_path)?,
+316            }),
+317            toml::Value::Table(table) => {
+318                let version = table
+319                    .get("version")
+320                    .map(|version| version.as_str().unwrap().into());
+321
+322                let return_local_dep = |path| {
+323                    Ok::<Dependency, String>(Dependency {
+324                        name: name.into(),
+325                        version: version.clone(),
+326                        canonicalized_path: join_path(path)?,
+327
+328                        kind: DependencyKind::Local(LocalDependency),
+329                    })
+330                };
+331
+332                match (table.get("source"), table.get("rev"), table.get("path")) {
+333                    (Some(toml::Value::String(source)), Some(toml::Value::String(rev)), None) => {
+334                        let dep_path = get_fe_deps().join(format!("{}-{}", name, rev));
+335                        if dep_path.exists() {
+336                            // Should we at least perform some kind of integrity check here? We currently treat an
+337                            // existing directory as a valid dependency no matter what.
+338                            return_local_dep(dep_path.to_str().unwrap())
+339                        } else {
+340                            fs::create_dir_all(&dep_path).unwrap();
+341                            Ok(Dependency {
+342                                name: name.into(),
+343                                version: version.clone(),
+344                                canonicalized_path: loader.canonicalize_path(
+345                                    Path::new(orig_path)
+346                                        .join(dep_path)
+347                                        .to_str()
+348                                        .expect("unable to convert path to &str"),
+349                                )?,
+350                                kind: DependencyKind::Git(GitDependency {
+351                                    source: source.into(),
+352                                    rev: rev.into(),
+353                                }),
+354                            })
+355                        }
+356                    }
+357                    (Some(_), Some(_), Some(_)) => {
+358                        Err("`path` can not be used together with `rev` and `source`".into())
+359                    }
+360                    (Some(_), None, _) => Err("`source` specified but no `rev` given".into()),
+361                    (None, Some(_), _) => Err("`rev` specified but no `source` given".into()),
+362                    (None, None, Some(toml::Value::String(path))) => return_local_dep(path),
+363                    _ => Err("Dependency isn't well formed".into()),
+364                }
+365            }
+366            _ => Err("unsupported toml type".into()),
+367        }
+368    }
+369
+370    fn resolve(&self, loader: &FileLoader) -> Result<ProjectFiles, String> {
+371        match &self.kind {
+372            DependencyKind::Local(_) => LocalDependency::resolve(self, loader),
+373            DependencyKind::Git(_) => GitDependency::resolve(self, loader),
+374        }
+375    }
+376}
+377
+378#[derive(Deserialize)]
+379struct Manifest {
+380    pub name: SmolStr,
+381    pub version: SmolStr,
+382    dependencies: Option<Table>,
+383}
+384
+385impl Manifest {
+386    pub fn load(loader: &FileLoader, path: &str) -> Result<Self, String> {
+387        let content = loader
+388            .file_content(path)
+389            .map_err(|err| format!("Failed to load manifest content from {path}.\n{err}"))?;
+390        let manifest: Manifest = toml::from_str(&content)
+391            .map_err(|err| format!("Failed to parse the content of {path}.\n{err}"))?;
+392
+393        Ok(manifest)
+394    }
+395}
+396
+397/// Returns the root path of the current Fe project
+398pub fn get_project_root() -> Option<String> {
+399    let current_dir = std::env::current_dir().expect("Unable to get current directory");
+400
+401    let mut current_path = current_dir.clone();
+402    loop {
+403        let fe_toml_path = current_path.join(FE_TOML);
+404        if fe_toml_path.is_file() {
+405            return fe_toml_path
+406                .parent()
+407                .map(|val| val.to_string_lossy().to_string());
+408        }
+409
+410        if !current_path.pop() {
+411            break;
+412        }
+413    }
+414
+415    None
+416}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/utils/git.rs.html b/compiler-docs/src/fe_common/utils/git.rs.html new file mode 100644 index 0000000000..b2b8b513da --- /dev/null +++ b/compiler-docs/src/fe_common/utils/git.rs.html @@ -0,0 +1,68 @@ +git.rs - source

fe_common/utils/
git.rs

1#[cfg(not(target_arch = "wasm32"))]
+2use git2::{FetchOptions, Oid, Repository};
+3use std::error::Error;
+4#[cfg(not(target_arch = "wasm32"))]
+5use std::path::Path;
+6
+7/// Fetch and checkout the specified refspec from the remote repository without
+8/// fetching any additional history.
+9#[cfg(not(target_arch = "wasm32"))]
+10pub fn fetch_and_checkout<P: AsRef<Path>>(
+11    remote: &str,
+12    target_directory: P,
+13    refspec: &str,
+14) -> Result<(), Box<dyn Error>> {
+15    // We initialize the repo here so that we can be sure that we created a directory that
+16    // needs to be clean up in case of an error. If the init fails, there won't be anything
+17    // to clean up.
+18    let repo = Repository::init(&target_directory)?;
+19    let res = _fetch_and_checkout(remote, repo, refspec);
+20    if res.is_err() {
+21        std::fs::remove_dir_all(target_directory).expect("Failed to clean up directory");
+22    }
+23
+24    res
+25}
+26
+27#[cfg(not(target_arch = "wasm32"))]
+28fn _fetch_and_checkout(
+29    remote: &str,
+30    repo: Repository,
+31    refspec: &str,
+32) -> Result<(), Box<dyn Error>> {
+33    let mut remote = repo.remote("origin", remote)?;
+34
+35    let mut fetch_options = FetchOptions::new();
+36
+37    fetch_options.depth(1);
+38
+39    // Fetch the specified SHA1 with depth 1
+40    if let Err(e) = remote.fetch(&[refspec], Some(&mut fetch_options), None) {
+41        if let (git2::ErrorClass::Net, git2::ErrorCode::GenericError) = (e.class(), e.code()) {
+42            // That's a pretty cryptic error for the common case of the refspec not existing.
+43            // We keep the cryptic error (because it might have other causes) but add a hint.
+44            return Err(format!("{}\nMake sure revision {} exists in remote", e, refspec).into());
+45        } else {
+46            return Err(e.into());
+47        }
+48    }
+49
+50    // Find the fetched commit by SHA1
+51    let oid = Oid::from_str(refspec)?;
+52    let commit = repo.find_commit(oid)?;
+53
+54    // Checkout the commit
+55    repo.checkout_tree(commit.as_object(), None)?;
+56    repo.set_head_detached(oid)?;
+57
+58    Ok(())
+59}
+60
+61#[cfg(target_arch = "wasm32")]
+62pub fn fetch_and_checkout(
+63    _remote: &str,
+64    _target_directory: &str,
+65    _refspec: &str,
+66) -> Result<(), Box<dyn Error>> {
+67    Err("Not supported on WASM".into())
+68}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/utils/humanize.rs.html b/compiler-docs/src/fe_common/utils/humanize.rs.html new file mode 100644 index 0000000000..d58160e8d5 --- /dev/null +++ b/compiler-docs/src/fe_common/utils/humanize.rs.html @@ -0,0 +1,44 @@ +humanize.rs - source

fe_common/utils/
humanize.rs

1/// A trait to derive plural or singular representations from
+2pub trait Pluralizable {
+3    fn to_plural(&self) -> String;
+4
+5    fn to_singular(&self) -> String;
+6}
+7
+8impl Pluralizable for &str {
+9    fn to_plural(&self) -> String {
+10        if self.ends_with('s') {
+11            self.to_string()
+12        } else {
+13            format!("{self}s")
+14        }
+15    }
+16
+17    fn to_singular(&self) -> String {
+18        if self.ends_with('s') {
+19            self[0..self.len() - 1].to_string()
+20        } else {
+21            self.to_string()
+22        }
+23    }
+24}
+25
+26// Impl Pluralizable for (singular, plural)
+27impl Pluralizable for (&str, &str) {
+28    fn to_plural(&self) -> String {
+29        self.1.to_string()
+30    }
+31
+32    fn to_singular(&self) -> String {
+33        self.0.to_string()
+34    }
+35}
+36
+37// Pluralize the given pluralizable if the `count` is greater than one.
+38pub fn pluralize_conditionally(pluralizable: impl Pluralizable, count: usize) -> String {
+39    if count == 1 {
+40        pluralizable.to_singular()
+41    } else {
+42        pluralizable.to_plural()
+43    }
+44}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/utils/keccak.rs.html b/compiler-docs/src/fe_common/utils/keccak.rs.html new file mode 100644 index 0000000000..89e4b26d8e --- /dev/null +++ b/compiler-docs/src/fe_common/utils/keccak.rs.html @@ -0,0 +1,36 @@ +keccak.rs - source

fe_common/utils/
keccak.rs

1use tiny_keccak::{Hasher, Keccak};
+2
+3/// Get the full 32 byte hash of the content.
+4pub fn full(content: &[u8]) -> String {
+5    partial(content, 32)
+6}
+7
+8/// Take the first `size` number of bytes of the hash and pad the right side
+9/// with zeros to 32 bytes.
+10pub fn partial_right_padded(content: &[u8], size: usize) -> String {
+11    let result = full_as_bytes(content);
+12    let padded_output: Vec<u8> = result
+13        .iter()
+14        .enumerate()
+15        .map(|(index, byte)| if index >= size { 0 } else { *byte })
+16        .collect();
+17
+18    hex::encode(padded_output)
+19}
+20
+21/// Take the first `size` number of bytes of the hash with no padding.
+22pub fn partial(content: &[u8], size: usize) -> String {
+23    let result = full_as_bytes(content);
+24    hex::encode(&result[0..size])
+25}
+26
+27/// Get the full 32 byte hash of the content as a byte array.
+28pub fn full_as_bytes(content: &[u8]) -> [u8; 32] {
+29    let mut keccak = Keccak::v256();
+30    let mut selector = [0_u8; 32];
+31
+32    keccak.update(content);
+33    keccak.finalize(&mut selector);
+34
+35    selector
+36}
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/utils/mod.rs.html b/compiler-docs/src/fe_common/utils/mod.rs.html new file mode 100644 index 0000000000..c74ae8e097 --- /dev/null +++ b/compiler-docs/src/fe_common/utils/mod.rs.html @@ -0,0 +1,6 @@ +mod.rs - source

fe_common/utils/
mod.rs

1pub mod dirs;
+2pub mod files;
+3pub mod git;
+4pub mod humanize;
+5pub mod keccak;
+6pub mod ron;
\ No newline at end of file diff --git a/compiler-docs/src/fe_common/utils/ron.rs.html b/compiler-docs/src/fe_common/utils/ron.rs.html new file mode 100644 index 0000000000..502912c337 --- /dev/null +++ b/compiler-docs/src/fe_common/utils/ron.rs.html @@ -0,0 +1,92 @@ +ron.rs - source

fe_common/utils/
ron.rs

1use difference::{Changeset, Difference};
+2use serde::Serialize;
+3use std::fmt;
+4
+5/// Return the lines of text in the string `lines` prefixed with the prefix in
+6/// the string `prefix`.
+7fn prefix_lines(prefix: &str, lines: &str) -> String {
+8    lines
+9        .lines()
+10        .map(|i| [prefix, i].concat())
+11        .collect::<Vec<String>>()
+12        .join("\n")
+13}
+14
+15/// Wrapper struct for formatting changesets from the `difference` package.
+16pub struct Diff(Changeset);
+17
+18impl Diff {
+19    pub fn new(left: &str, right: &str) -> Self {
+20        Self(Changeset::new(left, right, "\n"))
+21    }
+22}
+23
+24impl fmt::Display for Diff {
+25    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+26        for d in &self.0.diffs {
+27            match *d {
+28                Difference::Same(ref x) => {
+29                    write!(f, "{}{}", prefix_lines(" ", x), self.0.split)?;
+30                }
+31                Difference::Add(ref x) => {
+32                    write!(f, "\x1b[92m{}\x1b[0m{}", prefix_lines("+", x), self.0.split)?;
+33                }
+34                Difference::Rem(ref x) => {
+35                    write!(f, "\x1b[91m{}\x1b[0m{}", prefix_lines("-", x), self.0.split)?;
+36                }
+37            }
+38        }
+39        Ok(())
+40    }
+41}
+42
+43/// Compare the given strings and panic when not equal with a colorized line
+44/// diff.
+45#[macro_export]
+46macro_rules! assert_strings_eq {
+47    ($left:expr, $right:expr,) => {{
+48        assert_strings_eq!($left, $right)
+49    }};
+50    ($left:expr, $right:expr) => {{
+51        match (&($left), &($right)) {
+52            (left_val, right_val) => {
+53                if *left_val != *right_val {
+54                    panic!(
+55                        "assertion failed: `(left == right)`\ndiff:\n{}",
+56                        Diff::new(left_val, right_val),
+57                    )
+58                }
+59            }
+60        }
+61    }};
+62    ($left:expr, $right:expr, $($args:tt)*) => {{
+63        match (&($left), &($right)) {
+64            (left_val, right_val) => {
+65                if *left_val != *right_val {
+66                    panic!(
+67                        "assertion failed: `(left == right)`: {}\ndiff:\n{}",
+68                        format_args!($($args)*),
+69                        Diff::new(left_val, right_val),
+70                    )
+71                }
+72            }
+73        }
+74    }};
+75}
+76
+77/// Convenience function to serialize objects in RON format with custom pretty
+78/// printing config and struct names.
+79pub fn to_ron_string_pretty<T>(value: &T) -> ron::ser::Result<String>
+80where
+81    T: Serialize,
+82{
+83    let config = ron::ser::PrettyConfig {
+84        indentor: "  ".to_string(),
+85        ..Default::default()
+86    };
+87
+88    let mut serializer = ron::ser::Serializer::new(Some(config), true);
+89    value.serialize(&mut serializer)?;
+90
+91    Ok(serializer.into_output_string())
+92}
\ No newline at end of file diff --git a/compiler-docs/src/fe_compiler_test_utils/lib.rs.html b/compiler-docs/src/fe_compiler_test_utils/lib.rs.html new file mode 100644 index 0000000000..49a5dbd212 --- /dev/null +++ b/compiler-docs/src/fe_compiler_test_utils/lib.rs.html @@ -0,0 +1,901 @@ +lib.rs - source

fe_compiler_test_utils/
lib.rs

1use evm_runtime::{ExitReason, Handler};
+2use fe_common::diagnostics::print_diagnostics;
+3use fe_common::utils::keccak;
+4use fe_driver as driver;
+5use primitive_types::{H160, U256};
+6use std::cell::RefCell;
+7use std::collections::BTreeMap;
+8use std::fmt::{Display, Formatter};
+9use std::str::FromStr;
+10use yultsur::*;
+11
+12#[macro_export]
+13macro_rules! assert_harness_gas_report {
+14    ($harness: expr) => {
+15        assert_snapshot!(format!("{}", $harness.gas_reporter));
+16    };
+17
+18    ($harness: expr, $($expr:expr),*) => {
+19        let mut settings = insta::Settings::clone_current();
+20        let suffix = format!("{:?}", $($expr,)*).replace("\"", "");
+21        settings.set_snapshot_suffix(suffix);
+22        let _guard = settings.bind_to_scope();
+23        assert_snapshot!(format!("{}", $harness.gas_reporter));
+24    }
+25}
+26
+27#[derive(Default, Debug)]
+28pub struct GasReporter {
+29    records: RefCell<Vec<GasRecord>>,
+30}
+31
+32impl GasReporter {
+33    pub fn add_record(&self, description: &str, gas_used: u64) {
+34        self.records.borrow_mut().push(GasRecord {
+35            description: description.to_string(),
+36            gas_used,
+37        })
+38    }
+39
+40    pub fn add_func_call_record(&self, function: &str, input: &[ethabi::Token], gas_used: u64) {
+41        let description = format!("{function}({input:?})");
+42        self.add_record(&description, gas_used)
+43    }
+44}
+45
+46impl Display for GasReporter {
+47    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+48        for record in self.records.borrow().iter() {
+49            writeln!(f, "{} used {} gas", record.description, record.gas_used)?;
+50        }
+51
+52        Ok(())
+53    }
+54}
+55
+56#[derive(Debug)]
+57pub struct GasRecord {
+58    pub description: String,
+59    pub gas_used: u64,
+60}
+61
+62pub trait ToBeBytes {
+63    fn to_be_bytes(&self) -> [u8; 32];
+64}
+65
+66impl ToBeBytes for U256 {
+67    fn to_be_bytes(&self) -> [u8; 32] {
+68        let mut input_bytes: [u8; 32] = [0; 32];
+69        self.to_big_endian(&mut input_bytes);
+70        input_bytes
+71    }
+72}
+73
+74#[allow(dead_code)]
+75pub type Backend<'a> = evm::backend::MemoryBackend<'a>;
+76
+77#[allow(dead_code)]
+78pub type StackState<'a> = evm::executor::stack::MemoryStackState<'a, 'a, Backend<'a>>;
+79
+80#[allow(dead_code)]
+81pub type Executor<'a, 'b> = evm::executor::stack::StackExecutor<'a, 'b, StackState<'a>, ()>;
+82
+83#[allow(dead_code)]
+84pub const DEFAULT_CALLER: &str = "1000000000000000000000000000000000000001";
+85
+86#[allow(dead_code)]
+87pub struct ContractHarness {
+88    pub gas_reporter: GasReporter,
+89    pub address: H160,
+90    pub abi: ethabi::Contract,
+91    pub caller: H160,
+92    pub value: U256,
+93}
+94
+95#[allow(dead_code)]
+96impl ContractHarness {
+97    fn new(contract_address: H160, abi: ethabi::Contract) -> Self {
+98        let caller = address(DEFAULT_CALLER);
+99
+100        ContractHarness {
+101            gas_reporter: GasReporter::default(),
+102            address: contract_address,
+103            abi,
+104            caller,
+105            value: U256::zero(),
+106        }
+107    }
+108
+109    pub fn capture_call(
+110        &self,
+111        executor: &mut Executor,
+112        name: &str,
+113        input: &[ethabi::Token],
+114    ) -> evm::Capture<(evm::ExitReason, Vec<u8>), std::convert::Infallible> {
+115        let input = self.build_calldata(name, input);
+116        self.capture_call_raw_bytes(executor, input)
+117    }
+118
+119    pub fn build_calldata(&self, name: &str, input: &[ethabi::Token]) -> Vec<u8> {
+120        let function = &self.abi.functions[name][0];
+121        function
+122            .encode_input(input)
+123            .unwrap_or_else(|reason| panic!("Unable to encode input for {name}: {reason:?}"))
+124    }
+125
+126    pub fn capture_call_raw_bytes(
+127        &self,
+128        executor: &mut Executor,
+129        input: Vec<u8>,
+130    ) -> evm::Capture<(evm::ExitReason, Vec<u8>), std::convert::Infallible> {
+131        let context = evm::Context {
+132            address: self.address,
+133            caller: self.caller,
+134            apparent_value: self.value,
+135        };
+136
+137        executor.call(self.address, None, input, None, false, context)
+138    }
+139
+140    pub fn test_function(
+141        &self,
+142        executor: &mut Executor,
+143        name: &str,
+144        input: &[ethabi::Token],
+145        output: Option<&ethabi::Token>,
+146    ) {
+147        let actual_output = self.call_function(executor, name, input);
+148
+149        assert_eq!(
+150            output.map(ToOwned::to_owned),
+151            actual_output,
+152            "unexpected output from `fn {name}`"
+153        )
+154    }
+155
+156    pub fn call_function(
+157        &self,
+158        executor: &mut Executor,
+159        name: &str,
+160        input: &[ethabi::Token],
+161    ) -> Option<ethabi::Token> {
+162        let function = &self.abi.functions[name][0];
+163        let start_gas = executor.used_gas();
+164        let capture = self.capture_call(executor, name, input);
+165        let gas_used = executor.used_gas() - start_gas;
+166        self.gas_reporter
+167            .add_func_call_record(name, input, gas_used);
+168
+169        match capture {
+170            evm::Capture::Exit((ExitReason::Succeed(_), output)) => function
+171                .decode_output(&output)
+172                .unwrap_or_else(|_| panic!("unable to decode output of {}: {:?}", name, &output))
+173                .pop(),
+174            evm::Capture::Exit((reason, _)) => panic!("failed to run \"{name}\": {reason:?}"),
+175            evm::Capture::Trap(_) => panic!("trap"),
+176        }
+177    }
+178
+179    pub fn test_function_reverts(
+180        &self,
+181        executor: &mut Executor,
+182        name: &str,
+183        input: &[ethabi::Token],
+184        revert_data: &[u8],
+185    ) {
+186        validate_revert(self.capture_call(executor, name, input), revert_data)
+187    }
+188
+189    pub fn test_call_reverts(&self, executor: &mut Executor, input: Vec<u8>, revert_data: &[u8]) {
+190        validate_revert(self.capture_call_raw_bytes(executor, input), revert_data)
+191    }
+192
+193    pub fn test_function_returns(
+194        &self,
+195        executor: &mut Executor,
+196        name: &str,
+197        input: &[ethabi::Token],
+198        return_data: &[u8],
+199    ) {
+200        validate_return(self.capture_call(executor, name, input), return_data)
+201    }
+202
+203    pub fn test_call_returns(&self, executor: &mut Executor, input: Vec<u8>, return_data: &[u8]) {
+204        validate_return(self.capture_call_raw_bytes(executor, input), return_data)
+205    }
+206
+207    // Executor must be passed by value to get emitted events.
+208    pub fn events_emitted(&self, executor: Executor, events: &[(&str, &[ethabi::Token])]) {
+209        let raw_logs = executor
+210            .into_state()
+211            .deconstruct()
+212            .1
+213            .into_iter()
+214            .map(|log| ethabi::RawLog::from((log.topics, log.data)))
+215            .collect::<Vec<ethabi::RawLog>>();
+216
+217        for (name, expected_output) in events {
+218            let event = self
+219                .abi
+220                .events()
+221                .find(|event| event.name.eq(name))
+222                .expect("unable to find event for name");
+223
+224            let outputs_for_event = raw_logs
+225                .iter()
+226                .filter_map(|raw_log| event.parse_log(raw_log.clone()).ok())
+227                .map(|event_log| {
+228                    event_log
+229                        .params
+230                        .into_iter()
+231                        .map(|param| param.value)
+232                        .collect::<Vec<_>>()
+233                })
+234                .collect::<Vec<_>>();
+235
+236            if !outputs_for_event.iter().any(|v| v == expected_output) {
+237                println!("raw logs dump: {raw_logs:?}");
+238                panic!(
+239                    "no \"{name}\" logs matching: {expected_output:?}\nfound: {outputs_for_event:?}"
+240                )
+241            }
+242        }
+243    }
+244
+245    pub fn set_caller(&mut self, caller: H160) {
+246        self.caller = caller;
+247    }
+248}
+249
+250#[allow(dead_code)]
+251pub fn with_executor(test: &dyn Fn(Executor)) {
+252    let vicinity = evm::backend::MemoryVicinity {
+253        gas_price: U256::zero(),
+254        origin: H160::zero(),
+255        chain_id: U256::zero(),
+256        block_hashes: Vec::new(),
+257        block_number: U256::zero(),
+258        block_coinbase: H160::zero(),
+259        block_timestamp: U256::zero(),
+260        block_difficulty: U256::zero(),
+261        block_gas_limit: primitive_types::U256::MAX,
+262        block_base_fee_per_gas: U256::zero(),
+263    };
+264    let state: BTreeMap<primitive_types::H160, evm::backend::MemoryAccount> = BTreeMap::new();
+265    let backend = evm::backend::MemoryBackend::new(&vicinity, state);
+266
+267    with_executor_backend(backend, test)
+268}
+269
+270#[allow(dead_code)]
+271pub fn with_executor_backend(backend: Backend, test: &dyn Fn(Executor)) {
+272    let config = evm::Config::london();
+273    let stack_state = StackState::new(
+274        evm::executor::stack::StackSubstateMetadata::new(u64::MAX, &config),
+275        &backend,
+276    );
+277    let executor = Executor::new_with_precompiles(stack_state, &config, &());
+278
+279    test(executor)
+280}
+281
+282pub fn validate_revert(
+283    capture: evm::Capture<(evm::ExitReason, Vec<u8>), std::convert::Infallible>,
+284    expected_data: &[u8],
+285) {
+286    if let evm::Capture::Exit((evm::ExitReason::Revert(_), output)) = capture {
+287        assert_eq!(
+288            format!("0x{}", hex::encode(output)),
+289            format!("0x{}", hex::encode(expected_data))
+290        );
+291    } else {
+292        panic!("Method was expected to revert but didn't")
+293    };
+294}
+295
+296pub fn validate_return(
+297    capture: evm::Capture<(evm::ExitReason, Vec<u8>), std::convert::Infallible>,
+298    expected_data: &[u8],
+299) {
+300    if let evm::Capture::Exit((evm::ExitReason::Succeed(_), output)) = capture {
+301        assert_eq!(
+302            format!("0x{}", hex::encode(output)),
+303            format!("0x{}", hex::encode(expected_data))
+304        );
+305    } else {
+306        panic!("Method was expected to return but didn't")
+307    };
+308}
+309
+310pub fn encoded_panic_assert() -> Vec<u8> {
+311    encode_revert("Panic(uint256)", &[uint_token(0x01)])
+312}
+313
+314pub fn encoded_over_or_underflow() -> Vec<u8> {
+315    encode_revert("Panic(uint256)", &[uint_token(0x11)])
+316}
+317
+318pub fn encoded_panic_out_of_bounds() -> Vec<u8> {
+319    encode_revert("Panic(uint256)", &[uint_token(0x32)])
+320}
+321
+322pub fn encoded_div_or_mod_by_zero() -> Vec<u8> {
+323    encode_revert("Panic(uint256)", &[uint_token(0x12)])
+324}
+325
+326pub fn encoded_invalid_abi_data() -> Vec<u8> {
+327    encode_revert("Error(uint256)", &[uint_token(0x103)])
+328}
+329
+330#[allow(dead_code)]
+331#[cfg(feature = "solc-backend")]
+332pub fn deploy_contract(
+333    executor: &mut Executor,
+334    fixture: &str,
+335    contract_name: &str,
+336    init_params: &[ethabi::Token],
+337) -> ContractHarness {
+338    let mut db = driver::Db::default();
+339    let compiled_module = match driver::compile_single_file(
+340        &mut db,
+341        fixture,
+342        test_files::fixture(fixture),
+343        true,
+344        false,
+345        true,
+346    ) {
+347        Ok(module) => module,
+348        Err(error) => {
+349            fe_common::diagnostics::print_diagnostics(&db, &error.0);
+350            panic!("failed to compile module: {fixture}")
+351        }
+352    };
+353
+354    let compiled_contract = compiled_module
+355        .contracts
+356        .get(contract_name)
+357        .expect("could not find contract in fixture");
+358
+359    _deploy_contract(
+360        executor,
+361        &compiled_contract.bytecode,
+362        &compiled_contract.json_abi,
+363        init_params,
+364    )
+365}
+366
+367#[allow(dead_code)]
+368#[cfg(feature = "solc-backend")]
+369pub fn deploy_contract_from_ingot(
+370    executor: &mut Executor,
+371    path: &str,
+372    contract_name: &str,
+373    init_params: &[ethabi::Token],
+374) -> ContractHarness {
+375    use fe_common::utils::files::BuildFiles;
+376
+377    let files = test_files::fixture_dir_files("ingots");
+378    let build_files = BuildFiles::load_static(files, path).expect("failed to load build files");
+379    let mut db = driver::Db::default();
+380    let compiled_module = match driver::compile_ingot(&mut db, &build_files, true, false, true) {
+381        Ok(module) => module,
+382        Err(error) => {
+383            fe_common::diagnostics::print_diagnostics(&db, &error.0);
+384            panic!("failed to compile ingot: {path}")
+385        }
+386    };
+387
+388    let compiled_contract = compiled_module
+389        .contracts
+390        .get(contract_name)
+391        .expect("could not find contract in fixture");
+392
+393    _deploy_contract(
+394        executor,
+395        &compiled_contract.bytecode,
+396        &compiled_contract.json_abi,
+397        init_params,
+398    )
+399}
+400
+401#[allow(dead_code)]
+402#[cfg(feature = "solc-backend")]
+403pub fn deploy_solidity_contract(
+404    executor: &mut Executor,
+405    fixture: &str,
+406    contract_name: &str,
+407    init_params: &[ethabi::Token],
+408    optimized: bool,
+409) -> ContractHarness {
+410    let src = test_files::fixture(fixture)
+411        .replace('\n', "")
+412        .replace('"', "\\\"");
+413
+414    let (bytecode, abi) = compile_solidity_contract(contract_name, &src, optimized)
+415        .expect("Could not compile contract");
+416
+417    _deploy_contract(executor, &bytecode, &abi, init_params)
+418}
+419
+420#[allow(dead_code)]
+421pub fn encode_error_reason(reason: &str) -> Vec<u8> {
+422    encode_revert("Error(string)", &[string_token(reason)])
+423}
+424
+425#[allow(dead_code)]
+426pub fn encode_revert(selector: &str, input: &[ethabi::Token]) -> Vec<u8> {
+427    let mut data = String::new();
+428    for param in input {
+429        let encoded = match param {
+430            ethabi::Token::Uint(val) | ethabi::Token::Int(val) => {
+431                format!("{:0>64}", format!("{val:x}"))
+432            }
+433            ethabi::Token::Bool(val) => format!("{:0>64x}", *val as i32),
+434            ethabi::Token::String(val) => {
+435                const DATA_OFFSET: &str =
+436                    "0000000000000000000000000000000000000000000000000000000000000020";
+437
+438                // Length of the string padded to 32 bit hex
+439                let string_len = format!("{:0>64x}", val.len());
+440
+441                let mut string_bytes = val.as_bytes().to_vec();
+442                while string_bytes.len() % 32 != 0 {
+443                    string_bytes.push(0)
+444                }
+445                // The bytes of the string itself, right padded to consume a multiple of 32
+446                // bytes
+447                let string_bytes = hex::encode(&string_bytes);
+448
+449                format!("{DATA_OFFSET}{string_len}{string_bytes}")
+450            }
+451            _ => todo!("Other ABI types not supported yet"),
+452        };
+453        data.push_str(&encoded);
+454    }
+455
+456    let all = format!("{}{}", get_function_selector(selector), data);
+457    hex::decode(&all).unwrap_or_else(|_| panic!("No valid hex: {}", &all))
+458}
+459
+460fn get_function_selector(signature: &str) -> String {
+461    // Function selector (e.g first 4 bytes of keccak("Error(string)")
+462    hex::encode(&keccak::full_as_bytes(signature.as_bytes())[..4])
+463}
+464
+465fn _deploy_contract(
+466    executor: &mut Executor,
+467    bytecode: &str,
+468    abi: &str,
+469    init_params: &[ethabi::Token],
+470) -> ContractHarness {
+471    let abi = ethabi::Contract::load(abi.as_bytes()).expect("unable to load the ABI");
+472
+473    let mut bytecode = hex::decode(bytecode).expect("failed to decode bytecode");
+474
+475    if let Some(constructor) = &abi.constructor {
+476        bytecode = constructor.encode_input(bytecode, init_params).unwrap()
+477    }
+478
+479    if let evm::Capture::Exit(exit) = executor.create(
+480        address(DEFAULT_CALLER),
+481        evm_runtime::CreateScheme::Legacy {
+482            caller: address(DEFAULT_CALLER),
+483        },
+484        U256::zero(),
+485        bytecode,
+486        None,
+487    ) {
+488        return ContractHarness::new(
+489            exit.1
+490                .unwrap_or_else(|| panic!("Unable to retrieve contract address: {:?}", exit.0)),
+491            abi,
+492        );
+493    }
+494
+495    panic!("Failed to create contract")
+496}
+497
+498#[derive(Debug)]
+499pub struct SolidityCompileError(Vec<serde_json::Value>);
+500
+501impl std::fmt::Display for SolidityCompileError {
+502    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+503        write!(f, "{:?}", &self.0[..])
+504    }
+505}
+506
+507impl std::error::Error for SolidityCompileError {}
+508
+509#[cfg(feature = "solc-backend")]
+510pub fn compile_solidity_contract(
+511    name: &str,
+512    solidity_src: &str,
+513    optimized: bool,
+514) -> Result<(String, String), SolidityCompileError> {
+515    let solc_config = r#"
+516    {
+517        "language": "Solidity",
+518        "sources": { "input.sol": { "content": "{src}" } },
+519        "settings": {
+520          "optimizer": { "enabled": {optimizer_enabled} },
+521          "outputSelection": { "*": { "*": ["*"], "": [ "*" ] } }
+522        }
+523      }
+524    "#;
+525    let solc_config = solc_config
+526        .replace("{src}", solidity_src)
+527        .replace("{optimizer_enabled}", &optimized.to_string());
+528
+529    let raw_output = solc::compile(&solc_config);
+530
+531    let output: serde_json::Value =
+532        serde_json::from_str(&raw_output).expect("Unable to compile contract");
+533
+534    if output["errors"].is_array() {
+535        let severity: serde_json::Value =
+536            serde_json::to_value("error").expect("Unable to convert into serde value type");
+537        let errors: serde_json::Value = output["errors"]
+538            .as_array()
+539            .unwrap()
+540            .iter()
+541            .cloned()
+542            .filter_map(|err| {
+543                if err["severity"] == severity {
+544                    Some(err["formattedMessage"].clone())
+545                } else {
+546                    None
+547                }
+548            })
+549            .collect();
+550
+551        let errors_list = errors
+552            .as_array()
+553            .unwrap_or_else(|| panic!("Unable to parse error properly"));
+554        if !errors_list.is_empty() {
+555            return Err(SolidityCompileError(errors_list.clone()));
+556        }
+557    }
+558
+559    let bytecode = output["contracts"]["input.sol"][name]["evm"]["bytecode"]["object"]
+560        .to_string()
+561        .replace('"', "");
+562
+563    let abi = if let serde_json::Value::Array(data) = &output["contracts"]["input.sol"][name]["abi"]
+564    {
+565        data.iter()
+566            .filter(|val| {
+567                // ethabi doesn't yet support error types so we just filter them out for now
+568                // https://github.com/rust-ethereum/ethabi/issues/225
+569                val["type"] != "error"
+570            })
+571            .cloned()
+572            .collect::<Vec<_>>()
+573    } else {
+574        vec![]
+575    };
+576
+577    let abi = serde_json::Value::Array(abi).to_string();
+578
+579    if [&bytecode, &abi].iter().any(|val| val == &"null") {
+580        return Err(SolidityCompileError(vec![serde_json::Value::String(
+581            String::from("Bytecode not found"),
+582        )]));
+583    }
+584
+585    Ok((bytecode, abi))
+586}
+587
+588#[allow(dead_code)]
+589pub fn load_contract(address: H160, fixture: &str, contract_name: &str) -> ContractHarness {
+590    let mut db = driver::Db::default();
+591    let compiled_module = driver::compile_single_file(
+592        &mut db,
+593        fixture,
+594        test_files::fixture(fixture),
+595        true,
+596        false,
+597        true,
+598    )
+599    .unwrap_or_else(|err| {
+600        print_diagnostics(&db, &err.0);
+601        panic!("failed to compile fixture: {fixture}");
+602    });
+603    let compiled_contract = compiled_module
+604        .contracts
+605        .get(contract_name)
+606        .expect("could not find contract in fixture");
+607    let abi = ethabi::Contract::load(compiled_contract.json_abi.as_bytes())
+608        .expect("unable to load the ABI");
+609
+610    ContractHarness::new(address, abi)
+611}
+612pub struct Runtime {
+613    functions: Vec<yul::Statement>,
+614    test_statements: Vec<yul::Statement>,
+615    data: Vec<yul::Data>,
+616}
+617
+618impl Default for Runtime {
+619    fn default() -> Self {
+620        Self::new()
+621    }
+622}
+623
+624pub struct ExecutionOutput {
+625    exit_reason: ExitReason,
+626    data: Vec<u8>,
+627}
+628
+629#[allow(dead_code)]
+630impl Runtime {
+631    /// Create a new `Runtime` instance.
+632    pub fn new() -> Runtime {
+633        Runtime {
+634            functions: vec![],
+635            test_statements: vec![],
+636            data: vec![],
+637        }
+638    }
+639
+640    /// Add the given set of functions
+641    pub fn with_functions(self, fns: Vec<yul::Statement>) -> Runtime {
+642        Runtime {
+643            functions: fns,
+644            ..self
+645        }
+646    }
+647
+648    /// Add the given set of test statements
+649    pub fn with_test_statements(self, statements: Vec<yul::Statement>) -> Runtime {
+650        Runtime {
+651            test_statements: statements,
+652            ..self
+653        }
+654    }
+655
+656    // Add the given set of data
+657    pub fn with_data(self, data: Vec<yul::Data>) -> Runtime {
+658        Runtime { data, ..self }
+659    }
+660
+661    /// Generate the top level YUL object
+662    pub fn to_yul(&self) -> yul::Object {
+663        let all_statements = [self.functions.clone(), self.test_statements.clone()].concat();
+664        yul::Object {
+665            name: identifier! { Contract },
+666            code: code! { [all_statements...] },
+667            objects: vec![],
+668            data: self.data.clone(),
+669        }
+670    }
+671
+672    #[cfg(feature = "solc-backend")]
+673    pub fn execute(&self, executor: &mut Executor) -> ExecutionOutput {
+674        let (exit_reason, data) = execute_runtime_functions(executor, self);
+675        ExecutionOutput::new(exit_reason, data)
+676    }
+677}
+678
+679#[allow(dead_code)]
+680impl ExecutionOutput {
+681    /// Create an `ExecutionOutput` instance
+682    pub fn new(exit_reason: ExitReason, data: Vec<u8>) -> ExecutionOutput {
+683        ExecutionOutput { exit_reason, data }
+684    }
+685
+686    /// Panic if the execution did not succeed.
+687    pub fn expect_success(self) -> ExecutionOutput {
+688        if let ExecutionOutput {
+689            exit_reason: ExitReason::Succeed(_),
+690            ..
+691        } = &self
+692        {
+693            self
+694        } else {
+695            panic!("Execution did not succeed: {:?}", &self.exit_reason)
+696        }
+697    }
+698
+699    /// Panic if the execution did not revert.
+700    pub fn expect_revert(self) -> ExecutionOutput {
+701        if let ExecutionOutput {
+702            exit_reason: ExitReason::Revert(_),
+703            ..
+704        } = &self
+705        {
+706            self
+707        } else {
+708            panic!("Execution did not revert: {:?}", &self.exit_reason)
+709        }
+710    }
+711
+712    /// Panic if the output is not an encoded error reason of the given string.
+713    pub fn expect_revert_reason(self, reason: &str) -> ExecutionOutput {
+714        assert_eq!(self.data, encode_error_reason(reason));
+715        self
+716    }
+717}
+718
+719#[cfg(feature = "solc-backend")]
+720fn execute_runtime_functions(executor: &mut Executor, runtime: &Runtime) -> (ExitReason, Vec<u8>) {
+721    let yul_code = runtime.to_yul().to_string().replace('"', "\\\"");
+722    let contract_bytecode = fe_yulc::compile_single_contract("Contract", &yul_code, false, false)
+723        .expect("failed to compile Yul");
+724    let bytecode = hex::decode(contract_bytecode.bytecode).expect("failed to decode bytecode");
+725
+726    if let evm::Capture::Exit((reason, _, output)) = executor.create(
+727        address(DEFAULT_CALLER),
+728        evm_runtime::CreateScheme::Legacy {
+729            caller: address(DEFAULT_CALLER),
+730        },
+731        U256::zero(),
+732        bytecode,
+733        None,
+734    ) {
+735        (reason, output)
+736    } else {
+737        panic!("EVM trap during test")
+738    }
+739}
+740
+741#[allow(dead_code)]
+742pub fn uint_token(n: u64) -> ethabi::Token {
+743    ethabi::Token::Uint(U256::from(n))
+744}
+745
+746#[allow(dead_code)]
+747pub fn uint_token_from_dec_str(val: &str) -> ethabi::Token {
+748    ethabi::Token::Uint(U256::from_dec_str(val).expect("Not a valid dec string"))
+749}
+750
+751#[allow(dead_code)]
+752pub fn int_token(val: i64) -> ethabi::Token {
+753    ethabi::Token::Int(to_2s_complement(val))
+754}
+755
+756#[allow(dead_code)]
+757pub fn string_token(s: &str) -> ethabi::Token {
+758    ethabi::Token::String(s.to_string())
+759}
+760
+761#[allow(dead_code)]
+762pub fn address(s: &str) -> H160 {
+763    H160::from_str(s).unwrap_or_else(|_| panic!("couldn't create address from: {s}"))
+764}
+765
+766#[allow(dead_code)]
+767pub fn address_token(s: &str) -> ethabi::Token {
+768    // left pads to 40 characters
+769    ethabi::Token::Address(address(&format!("{s:0>40}")))
+770}
+771
+772#[allow(dead_code)]
+773pub fn bool_token(val: bool) -> ethabi::Token {
+774    ethabi::Token::Bool(val)
+775}
+776
+777#[allow(dead_code)]
+778pub fn bytes_token(s: &str) -> ethabi::Token {
+779    ethabi::Token::Bytes(ethabi::Bytes::from(s))
+780}
+781
+782#[allow(dead_code)]
+783pub fn uint_array_token(v: &[u64]) -> ethabi::Token {
+784    ethabi::Token::FixedArray(v.iter().map(|n| uint_token(*n)).collect())
+785}
+786
+787#[allow(dead_code)]
+788pub fn int_array_token(v: &[i64]) -> ethabi::Token {
+789    ethabi::Token::FixedArray(v.iter().map(|n| int_token(*n)).collect())
+790}
+791
+792#[allow(dead_code)]
+793pub fn address_array_token(v: &[&str]) -> ethabi::Token {
+794    ethabi::Token::FixedArray(v.iter().map(|s| address_token(s)).collect())
+795}
+796
+797#[allow(dead_code)]
+798pub fn tuple_token(tokens: &[ethabi::Token]) -> ethabi::Token {
+799    ethabi::Token::Tuple(tokens.to_owned())
+800}
+801
+802#[allow(dead_code)]
+803pub fn to_2s_complement(val: i64) -> U256 {
+804    // Since this API takes an `i64` we can be sure that the min and max values
+805    // will never be above what fits the `I256` type which has the same capacity
+806    // as U256 but splits it so that one half covers numbers above 0 and the
+807    // other half covers the numbers below 0.
+808
+809    // Conversion to Two's Complement: https://www.cs.cornell.edu/~tomf/notes/cps104/twoscomp.html
+810
+811    if val >= 0 {
+812        U256::from(val)
+813    } else {
+814        let positive_val = -val;
+815        get_2s_complement_for_negative(U256::from(positive_val))
+816    }
+817}
+818
+819/// To get the 2s complement value for e.g. -128 call
+820/// get_2s_complement_for_negative(128)
+821#[allow(dead_code)]
+822pub fn get_2s_complement_for_negative(assume_negative: U256) -> U256 {
+823    assume_negative.overflowing_neg().0
+824}
+825
+826#[allow(dead_code)]
+827pub struct NumericAbiTokenBounds {
+828    pub size: u64,
+829    pub u_min: ethabi::Token,
+830    pub i_min: ethabi::Token,
+831    pub u_max: ethabi::Token,
+832    pub i_max: ethabi::Token,
+833}
+834
+835impl NumericAbiTokenBounds {
+836    #[allow(dead_code)]
+837    pub fn get_all() -> [NumericAbiTokenBounds; 6] {
+838        let zero = uint_token(0);
+839        let u64_max = ethabi::Token::Uint(U256::from(2).pow(U256::from(64)) - 1);
+840        let i64_min = ethabi::Token::Int(get_2s_complement_for_negative(
+841            U256::from(2).pow(U256::from(63)),
+842        ));
+843
+844        let u128_max = ethabi::Token::Uint(U256::from(2).pow(U256::from(128)) - 1);
+845        let i128_max = ethabi::Token::Int(U256::from(2).pow(U256::from(127)) - 1);
+846        let i128_min = ethabi::Token::Int(get_2s_complement_for_negative(
+847            U256::from(2).pow(U256::from(127)),
+848        ));
+849
+850        let u256_max = ethabi::Token::Uint(U256::MAX);
+851        let i256_max = ethabi::Token::Int(U256::from(2).pow(U256::from(255)) - 1);
+852        let i256_min = ethabi::Token::Int(get_2s_complement_for_negative(
+853            U256::from(2).pow(U256::from(255)),
+854        ));
+855
+856        [
+857            NumericAbiTokenBounds {
+858                size: 8,
+859                u_min: zero.clone(),
+860                i_min: int_token(-128),
+861                u_max: uint_token(255),
+862                i_max: int_token(127),
+863            },
+864            NumericAbiTokenBounds {
+865                size: 16,
+866                u_min: zero.clone(),
+867                i_min: int_token(-32768),
+868                u_max: uint_token(65535),
+869                i_max: int_token(32767),
+870            },
+871            NumericAbiTokenBounds {
+872                size: 32,
+873                u_min: zero.clone(),
+874                i_min: int_token(-2147483648),
+875                u_max: uint_token(4294967295),
+876                i_max: int_token(2147483647),
+877            },
+878            NumericAbiTokenBounds {
+879                size: 64,
+880                u_min: zero.clone(),
+881                i_min: i64_min,
+882                u_max: u64_max,
+883                i_max: int_token(9223372036854775807),
+884            },
+885            NumericAbiTokenBounds {
+886                size: 128,
+887                u_min: zero.clone(),
+888                i_min: i128_min,
+889                u_max: u128_max,
+890                i_max: i128_max,
+891            },
+892            NumericAbiTokenBounds {
+893                size: 256,
+894                u_min: zero,
+895                i_min: i256_min,
+896                u_max: u256_max,
+897                i_max: i256_max,
+898            },
+899        ]
+900    }
+901}
\ No newline at end of file diff --git a/compiler-docs/src/fe_compiler_tests/lib.rs.html b/compiler-docs/src/fe_compiler_tests/lib.rs.html new file mode 100644 index 0000000000..053ff65cb3 --- /dev/null +++ b/compiler-docs/src/fe_compiler_tests/lib.rs.html @@ -0,0 +1,68 @@ +lib.rs - source

fe_compiler_tests/
lib.rs

1#![cfg(feature = "solc-backend")]
+2#![allow(dead_code)]
+3use std::path::Path;
+4
+5use dir_test::{dir_test, Fixture};
+6use fe_common::diagnostics::print_diagnostics;
+7use fe_common::utils::files::BuildFiles;
+8use fe_test_runner::TestSink;
+9
+10#[dir_test(dir: "$CARGO_MANIFEST_DIR/fixtures/files", glob: "*.fe")]
+11fn single_file_test_run(fixture: Fixture<&str>) {
+12    let mut db = fe_driver::Db::default();
+13    let tests = match fe_driver::compile_single_file_tests(
+14        &mut db,
+15        fixture.path(),
+16        fixture.content(),
+17        true,
+18    ) {
+19        Ok((_, tests)) => tests,
+20        Err(error) => {
+21            eprintln!("Unable to compile {}.", fixture.path());
+22            print_diagnostics(&db, &error.0);
+23            panic!("failed to compile tests")
+24        }
+25    };
+26
+27    let mut test_sink = TestSink::new(true);
+28
+29    for test in tests {
+30        test.execute(&mut test_sink);
+31    }
+32
+33    if test_sink.failure_count() != 0 {
+34        panic!("{}", test_sink)
+35    }
+36}
+37
+38#[dir_test(dir: "$CARGO_MANIFEST_DIR/fixtures/ingots/", glob: "**/fe.toml")]
+39fn ingot_test_run(fixture: Fixture<&str>) {
+40    let input_path = fixture.path().trim_end_matches("/fe.toml");
+41    let optimize = true;
+42
+43    if !Path::new(input_path).exists() {
+44        panic!("Input directory does not exist: `{input_path}`.");
+45    }
+46
+47    let build_files =
+48        BuildFiles::load_fs(input_path).expect("failed to load build files from file system");
+49
+50    let mut db = fe_driver::Db::default();
+51    match fe_driver::compile_ingot_tests(&mut db, &build_files, optimize) {
+52        Ok(test_batches) => {
+53            let mut sink = TestSink::new(true);
+54            for (_, tests) in test_batches {
+55                for test in tests {
+56                    test.execute(&mut sink);
+57                }
+58                if sink.failure_count() != 0 {
+59                    panic!("{}", sink)
+60                }
+61            }
+62        }
+63        Err(error) => {
+64            print_diagnostics(&db, &error.0);
+65            panic!("Unable to compile {input_path}.");
+66        }
+67    }
+68}
\ No newline at end of file diff --git a/compiler-docs/src/fe_compiler_tests_legacy/lib.rs.html b/compiler-docs/src/fe_compiler_tests_legacy/lib.rs.html new file mode 100644 index 0000000000..a595a4c002 --- /dev/null +++ b/compiler-docs/src/fe_compiler_tests_legacy/lib.rs.html @@ -0,0 +1,18 @@ +lib.rs - source

fe_compiler_tests_legacy/
lib.rs

1#[cfg(test)]
+2mod crashes;
+3#[cfg(test)]
+4mod demo_erc20;
+5#[cfg(test)]
+6mod demo_guestbook;
+7#[cfg(test)]
+8mod demo_simple_open_auction;
+9#[cfg(test)]
+10mod demo_uniswap;
+11#[cfg(test)]
+12mod differential;
+13#[cfg(test)]
+14mod features;
+15#[cfg(test)]
+16mod solidity;
+17#[cfg(test)]
+18mod stress;
\ No newline at end of file diff --git a/compiler-docs/src/fe_driver/lib.rs.html b/compiler-docs/src/fe_driver/lib.rs.html new file mode 100644 index 0000000000..daa1bf6785 --- /dev/null +++ b/compiler-docs/src/fe_driver/lib.rs.html @@ -0,0 +1,359 @@ +lib.rs - source

fe_driver/
lib.rs

1#![allow(unused_imports, dead_code)]
+2
+3use fe_abi::event::AbiEvent;
+4use fe_abi::types::{AbiTupleField, AbiType};
+5pub use fe_codegen::db::{CodegenDb, Db};
+6
+7use fe_analyzer::namespace::items::{ContractId, FunctionId, IngotId, IngotMode, ModuleId};
+8use fe_common::diagnostics::Diagnostic;
+9use fe_common::files::FileKind;
+10use fe_common::{db::Upcast, utils::files::BuildFiles};
+11use fe_parser::ast::SmolStr;
+12use fe_test_runner::ethabi::{Event, EventParam, ParamType};
+13use fe_test_runner::TestSink;
+14use indexmap::{indexmap, IndexMap};
+15use serde_json::Value;
+16use std::fmt::Display;
+17
+18/// The artifacts of a compiled module.
+19pub struct CompiledModule {
+20    pub src_ast: String,
+21    pub lowered_ast: String,
+22    pub contracts: IndexMap<String, CompiledContract>,
+23}
+24
+25/// The artifacts of a compiled contract.
+26pub struct CompiledContract {
+27    pub json_abi: String,
+28    pub yul: String,
+29    pub origin: ContractId,
+30    #[cfg(feature = "solc-backend")]
+31    pub bytecode: String,
+32    #[cfg(feature = "solc-backend")]
+33    pub runtime_bytecode: String,
+34}
+35
+36#[cfg(feature = "solc-backend")]
+37#[derive(Debug, Clone, PartialEq, Eq)]
+38pub struct CompiledTest {
+39    pub name: SmolStr,
+40    events: Vec<AbiEvent>,
+41    bytecode: String,
+42}
+43
+44#[cfg(feature = "solc-backend")]
+45impl CompiledTest {
+46    pub fn new(name: SmolStr, events: Vec<AbiEvent>, bytecode: String) -> Self {
+47        Self {
+48            name,
+49            events,
+50            bytecode,
+51        }
+52    }
+53
+54    pub fn execute(&self, sink: &mut TestSink) -> bool {
+55        let events = map_abi_events(&self.events);
+56        fe_test_runner::execute(&self.name, &events, &self.bytecode, sink)
+57    }
+58}
+59
+60fn map_abi_events(events: &[AbiEvent]) -> Vec<Event> {
+61    events.iter().map(map_abi_event).collect()
+62}
+63
+64fn map_abi_event(event: &AbiEvent) -> Event {
+65    let inputs = event
+66        .inputs
+67        .iter()
+68        .map(|input| {
+69            let kind = map_abi_type(&input.ty);
+70            EventParam {
+71                name: input.name.to_owned(),
+72                kind,
+73                indexed: input.indexed,
+74            }
+75        })
+76        .collect();
+77    Event {
+78        name: event.name.to_owned(),
+79        inputs,
+80        anonymous: event.anonymous,
+81    }
+82}
+83
+84fn map_abi_type(typ: &AbiType) -> ParamType {
+85    match typ {
+86        AbiType::UInt(value) => ParamType::Uint(*value),
+87        AbiType::Int(value) => ParamType::Int(*value),
+88        AbiType::Address => ParamType::Address,
+89        AbiType::Bool => ParamType::Bool,
+90        AbiType::Function => panic!("function cannot be mapped to an actual ABI value type"),
+91        AbiType::Array { elem_ty, len } => {
+92            ParamType::FixedArray(Box::new(map_abi_type(elem_ty)), *len)
+93        }
+94        AbiType::Tuple(params) => ParamType::Tuple(map_abi_types(params)),
+95        AbiType::Bytes => ParamType::Bytes,
+96        AbiType::String => ParamType::String,
+97    }
+98}
+99
+100fn map_abi_types(fields: &[AbiTupleField]) -> Vec<ParamType> {
+101    fields.iter().map(|field| map_abi_type(&field.ty)).collect()
+102}
+103
+104#[derive(Debug)]
+105pub struct CompileError(pub Vec<Diagnostic>);
+106
+107pub fn check_single_file(db: &mut Db, path: &str, src: &str) -> Vec<Diagnostic> {
+108    let module = ModuleId::new_standalone(db, path, src);
+109    module.diagnostics(db)
+110}
+111
+112pub fn compile_single_file(
+113    db: &mut Db,
+114    path: &str,
+115    src: &str,
+116    with_bytecode: bool,
+117    with_runtime_bytecode: bool,
+118    optimize: bool,
+119) -> Result<CompiledModule, CompileError> {
+120    let module = ModuleId::new_standalone(db, path, src);
+121    let diags = module.diagnostics(db);
+122
+123    if diags.is_empty() {
+124        compile_module(db, module, with_bytecode, with_runtime_bytecode, optimize)
+125    } else {
+126        Err(CompileError(diags))
+127    }
+128}
+129
+130#[cfg(feature = "solc-backend")]
+131pub fn compile_single_file_tests(
+132    db: &mut Db,
+133    path: &str,
+134    src: &str,
+135    optimize: bool,
+136) -> Result<(SmolStr, Vec<CompiledTest>), CompileError> {
+137    let module = ModuleId::new_standalone(db, path, src);
+138    let diags = module.diagnostics(db);
+139
+140    if diags.is_empty() {
+141        Ok((module.name(db), compile_module_tests(db, module, optimize)))
+142    } else {
+143        Err(CompileError(diags))
+144    }
+145}
+146
+147// Run analysis with ingot
+148// Return vector error,waring...
+149pub fn check_ingot(db: &mut Db, build_files: &BuildFiles) -> Vec<Diagnostic> {
+150    let ingot = IngotId::from_build_files(db, build_files);
+151
+152    let mut diags = ingot.diagnostics(db);
+153    ingot.sink_external_ingot_diagnostics(db, &mut diags);
+154    diags
+155}
+156
+157/// Compiles the main module of a project.
+158///
+159/// If `with_bytecode` is set to false, the compiler will skip the final Yul ->
+160/// Bytecode pass. This is useful when debugging invalid Yul code.
+161pub fn compile_ingot(
+162    db: &mut Db,
+163    build_files: &BuildFiles,
+164    with_bytecode: bool,
+165    with_runtime_bytecode: bool,
+166    optimize: bool,
+167) -> Result<CompiledModule, CompileError> {
+168    let ingot = IngotId::from_build_files(db, build_files);
+169
+170    let mut diags = ingot.diagnostics(db);
+171    ingot.sink_external_ingot_diagnostics(db, &mut diags);
+172    if !diags.is_empty() {
+173        return Err(CompileError(diags));
+174    }
+175    let main_module = ingot
+176        .root_module(db)
+177        .expect("missing root module, with no diagnostic");
+178    compile_module(
+179        db,
+180        main_module,
+181        with_bytecode,
+182        with_runtime_bytecode,
+183        optimize,
+184    )
+185}
+186
+187#[cfg(feature = "solc-backend")]
+188pub fn compile_ingot_tests(
+189    db: &mut Db,
+190    build_files: &BuildFiles,
+191    optimize: bool,
+192) -> Result<Vec<(SmolStr, Vec<CompiledTest>)>, CompileError> {
+193    let ingot = IngotId::from_build_files(db, build_files);
+194
+195    let mut diags = ingot.diagnostics(db);
+196    ingot.sink_external_ingot_diagnostics(db, &mut diags);
+197    if !diags.is_empty() {
+198        return Err(CompileError(diags));
+199    }
+200
+201    if diags.is_empty() {
+202        Ok(ingot
+203            .all_modules(db)
+204            .iter()
+205            .fold(vec![], |mut accum, module| {
+206                accum.push((module.name(db), compile_module_tests(db, *module, optimize)));
+207                accum
+208            }))
+209    } else {
+210        Err(CompileError(diags))
+211    }
+212}
+213
+214/// Returns graphviz string.
+215// TODO: This is temporary function for debugging.
+216pub fn dump_mir_single_file(db: &mut Db, path: &str, src: &str) -> Result<String, CompileError> {
+217    let module = ModuleId::new_standalone(db, path, src);
+218
+219    let diags = module.diagnostics(db);
+220    if !diags.is_empty() {
+221        return Err(CompileError(diags));
+222    }
+223
+224    let mut text = vec![];
+225    fe_mir::graphviz::write_mir_graphs(db, module, &mut text).unwrap();
+226    Ok(String::from_utf8(text).unwrap())
+227}
+228
+229#[cfg(feature = "solc-backend")]
+230fn compile_test(db: &mut Db, test: FunctionId, optimize: bool) -> CompiledTest {
+231    let yul_test = fe_codegen::yul::isel::lower_test(db, test)
+232        .to_string()
+233        .replace('"', "\\\"");
+234    let bytecode = compile_to_evm("test", &yul_test, optimize, false).bytecode;
+235    let events = db.codegen_abi_module_events(test.module(db));
+236    CompiledTest::new(test.name(db), events, bytecode)
+237}
+238
+239#[cfg(feature = "solc-backend")]
+240fn compile_module_tests(db: &mut Db, module_id: ModuleId, optimize: bool) -> Vec<CompiledTest> {
+241    module_id
+242        .tests(db)
+243        .iter()
+244        .map(|test| compile_test(db, *test, optimize))
+245        .collect()
+246}
+247
+248#[cfg(feature = "solc-backend")]
+249fn compile_module(
+250    db: &mut Db,
+251    module_id: ModuleId,
+252    with_bytecode: bool,
+253    with_runtime_bytecode: bool,
+254    optimize: bool,
+255) -> Result<CompiledModule, CompileError> {
+256    let mut contracts = IndexMap::default();
+257
+258    for contract in module_id.all_contracts(db.upcast()) {
+259        let name = &contract.data(db.upcast()).name;
+260        let abi = db.codegen_abi_contract(contract);
+261        let yul_contract = compile_to_yul(db, contract);
+262
+263        let (bytecode, runtime_bytecode) = if with_bytecode || with_runtime_bytecode {
+264            let deployable_name = db.codegen_contract_deployer_symbol_name(contract);
+265            let bytecode = compile_to_evm(
+266                deployable_name.as_str(),
+267                &yul_contract,
+268                optimize,
+269                with_runtime_bytecode,
+270            );
+271            (bytecode.bytecode, bytecode.runtime_bytecode)
+272        } else {
+273            ("".to_string(), "".to_string())
+274        };
+275
+276        contracts.insert(
+277            name.to_string(),
+278            // Maybe put the ContractID here so we can trace it back to the source file
+279            CompiledContract {
+280                json_abi: serde_json::to_string_pretty(&abi).unwrap(),
+281                yul: yul_contract,
+282                origin: contract,
+283                bytecode,
+284                runtime_bytecode,
+285            },
+286        );
+287    }
+288
+289    Ok(CompiledModule {
+290        src_ast: format!("{:#?}", module_id.ast(db)),
+291        lowered_ast: format!("{:#?}", module_id.ast(db)),
+292        contracts,
+293    })
+294}
+295
+296#[cfg(not(feature = "solc-backend"))]
+297fn compile_module(
+298    db: &mut Db,
+299    module_id: ModuleId,
+300    _with_bytecode: bool,
+301    _with_runtime_bytecode: bool,
+302    _optimize: bool,
+303) -> Result<CompiledModule, CompileError> {
+304    let mut contracts = IndexMap::default();
+305    for contract in module_id.all_contracts(db.upcast()) {
+306        let name = &contract.data(db.upcast()).name;
+307        let abi = db.codegen_abi_contract(contract);
+308        let yul_contract = compile_to_yul(db, contract);
+309
+310        contracts.insert(
+311            name.to_string(),
+312            CompiledContract {
+313                json_abi: serde_json::to_string_pretty(&abi).unwrap(),
+314                yul: yul_contract,
+315                origin: contract,
+316            },
+317        );
+318    }
+319
+320    Ok(CompiledModule {
+321        src_ast: format!("{:#?}", module_id.ast(db)),
+322        lowered_ast: format!("{:#?}", module_id.ast(db)),
+323        contracts,
+324    })
+325}
+326
+327fn compile_to_yul(db: &mut Db, contract: ContractId) -> String {
+328    let yul_contract = fe_codegen::yul::isel::lower_contract_deployable(db, contract);
+329    yul_contract.to_string().replace('"', "\\\"")
+330}
+331
+332#[cfg(feature = "solc-backend")]
+333fn compile_to_evm(
+334    name: &str,
+335    yul_object: &str,
+336    optimize: bool,
+337    verify_runtime_bytecode: bool,
+338) -> fe_yulc::ContractBytecode {
+339    match fe_yulc::compile_single_contract(name, yul_object, optimize, verify_runtime_bytecode) {
+340        Ok(bytecode) => bytecode,
+341
+342        Err(error) => {
+343            for error in serde_json::from_str::<Value>(&error.0)
+344                .expect("unable to deserialize json output")["errors"]
+345                .as_array()
+346                .expect("errors not an array")
+347            {
+348                eprintln!(
+349                    "Error: {}",
+350                    error["formattedMessage"]
+351                        .as_str()
+352                        .expect("error value not a string")
+353                        .replace("\\\n", "\n")
+354                )
+355            }
+356            panic!("Yul compilation failed with the above errors")
+357        }
+358    }
+359}
\ No newline at end of file diff --git a/compiler-docs/src/fe_library/lib.rs.html b/compiler-docs/src/fe_library/lib.rs.html new file mode 100644 index 0000000000..fa40b5592d --- /dev/null +++ b/compiler-docs/src/fe_library/lib.rs.html @@ -0,0 +1,27 @@ +lib.rs - source

fe_library/
lib.rs

1pub use ::include_dir;
+2use include_dir::{include_dir, Dir};
+3
+4pub const STD: Dir = include_dir!("$CARGO_MANIFEST_DIR/std");
+5
+6pub fn std_src_files() -> Vec<(&'static str, &'static str)> {
+7    static_dir_files(STD.get_dir("src").unwrap())
+8}
+9
+10pub fn static_dir_files(dir: &'static Dir) -> Vec<(&'static str, &'static str)> {
+11    fn add_files(dir: &'static Dir, accum: &mut Vec<(&'static str, &'static str)>) {
+12        accum.extend(dir.files().map(|file| {
+13            (
+14                file.path().to_str().unwrap(),
+15                file.contents_utf8().expect("non-utf8 static file"),
+16            )
+17        }));
+18
+19        for sub_dir in dir.dirs() {
+20            add_files(sub_dir, accum)
+21        }
+22    }
+23
+24    let mut files = vec![];
+25    add_files(dir, &mut files);
+26    files
+27}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/analysis/cfg.rs.html b/compiler-docs/src/fe_mir/analysis/cfg.rs.html new file mode 100644 index 0000000000..b40d1bb0ff --- /dev/null +++ b/compiler-docs/src/fe_mir/analysis/cfg.rs.html @@ -0,0 +1,164 @@ +cfg.rs - source

fe_mir/analysis/
cfg.rs

1use fxhash::FxHashMap;
+2
+3use crate::ir::{BasicBlockId, FunctionBody, InstId};
+4
+5#[derive(Debug, Clone, PartialEq, Eq)]
+6pub struct ControlFlowGraph {
+7    entry: BasicBlockId,
+8    blocks: FxHashMap<BasicBlockId, BlockNode>,
+9    pub(super) exits: Vec<BasicBlockId>,
+10}
+11
+12impl ControlFlowGraph {
+13    pub fn compute(func: &FunctionBody) -> Self {
+14        let entry = func.order.entry();
+15        let mut cfg = Self {
+16            entry,
+17            blocks: FxHashMap::default(),
+18            exits: vec![],
+19        };
+20
+21        for block in func.order.iter_block() {
+22            let terminator = func
+23                .order
+24                .terminator(&func.store, block)
+25                .expect("a block must have terminator");
+26            cfg.analyze_terminator(func, terminator);
+27        }
+28
+29        cfg
+30    }
+31
+32    pub fn entry(&self) -> BasicBlockId {
+33        self.entry
+34    }
+35
+36    pub fn preds(&self, block: BasicBlockId) -> &[BasicBlockId] {
+37        self.blocks[&block].preds()
+38    }
+39
+40    pub fn succs(&self, block: BasicBlockId) -> &[BasicBlockId] {
+41        self.blocks[&block].succs()
+42    }
+43
+44    pub fn post_order(&self) -> CfgPostOrder {
+45        CfgPostOrder::new(self)
+46    }
+47
+48    pub(super) fn add_edge(&mut self, from: BasicBlockId, to: BasicBlockId) {
+49        self.node_mut(to).push_pred(from);
+50        self.node_mut(from).push_succ(to);
+51    }
+52
+53    pub(super) fn reverse_edge(&mut self, new_entry: BasicBlockId, new_exits: Vec<BasicBlockId>) {
+54        for (_, block) in self.blocks.iter_mut() {
+55            block.reverse_edge()
+56        }
+57
+58        self.entry = new_entry;
+59        self.exits = new_exits;
+60    }
+61
+62    fn analyze_terminator(&mut self, func: &FunctionBody, terminator: InstId) {
+63        let block = func.order.inst_block(terminator);
+64        let branch_info = func.store.branch_info(terminator);
+65        if branch_info.is_not_a_branch() {
+66            self.node_mut(block);
+67            self.exits.push(block)
+68        } else {
+69            for dest in branch_info.block_iter() {
+70                self.add_edge(block, dest)
+71            }
+72        }
+73    }
+74
+75    fn node_mut(&mut self, block: BasicBlockId) -> &mut BlockNode {
+76        self.blocks.entry(block).or_default()
+77    }
+78}
+79
+80#[derive(Default, Clone, Debug, PartialEq, Eq)]
+81struct BlockNode {
+82    preds: Vec<BasicBlockId>,
+83    succs: Vec<BasicBlockId>,
+84}
+85
+86impl BlockNode {
+87    fn push_pred(&mut self, pred: BasicBlockId) {
+88        self.preds.push(pred);
+89    }
+90
+91    fn push_succ(&mut self, succ: BasicBlockId) {
+92        self.succs.push(succ);
+93    }
+94
+95    fn preds(&self) -> &[BasicBlockId] {
+96        &self.preds
+97    }
+98
+99    fn succs(&self) -> &[BasicBlockId] {
+100        &self.succs
+101    }
+102
+103    fn reverse_edge(&mut self) {
+104        std::mem::swap(&mut self.preds, &mut self.succs)
+105    }
+106}
+107
+108pub struct CfgPostOrder<'a> {
+109    cfg: &'a ControlFlowGraph,
+110    node_state: FxHashMap<BasicBlockId, NodeState>,
+111    stack: Vec<BasicBlockId>,
+112}
+113
+114impl<'a> CfgPostOrder<'a> {
+115    fn new(cfg: &'a ControlFlowGraph) -> Self {
+116        let stack = vec![cfg.entry()];
+117
+118        Self {
+119            cfg,
+120            node_state: FxHashMap::default(),
+121            stack,
+122        }
+123    }
+124}
+125
+126impl<'a> Iterator for CfgPostOrder<'a> {
+127    type Item = BasicBlockId;
+128
+129    fn next(&mut self) -> Option<BasicBlockId> {
+130        while let Some(&block) = self.stack.last() {
+131            let node_state = self.node_state.entry(block).or_default();
+132            if *node_state == NodeState::Unvisited {
+133                *node_state = NodeState::Visited;
+134                for &succ in self.cfg.succs(block) {
+135                    let pred_state = self.node_state.entry(succ).or_default();
+136                    if *pred_state == NodeState::Unvisited {
+137                        self.stack.push(succ);
+138                    }
+139                }
+140            } else {
+141                self.stack.pop().unwrap();
+142                if *node_state != NodeState::Finished {
+143                    *node_state = NodeState::Finished;
+144                    return Some(block);
+145                }
+146            }
+147        }
+148
+149        None
+150    }
+151}
+152
+153#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+154enum NodeState {
+155    Unvisited,
+156    Visited,
+157    Finished,
+158}
+159
+160impl Default for NodeState {
+161    fn default() -> Self {
+162        Self::Unvisited
+163    }
+164}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/analysis/domtree.rs.html b/compiler-docs/src/fe_mir/analysis/domtree.rs.html new file mode 100644 index 0000000000..ea703ff3c9 --- /dev/null +++ b/compiler-docs/src/fe_mir/analysis/domtree.rs.html @@ -0,0 +1,343 @@ +domtree.rs - source

fe_mir/analysis/
domtree.rs

1//! This module contains dominator tree related structs.
+2//!
+3//! The algorithm is based on Keith D. Cooper., Timothy J. Harvey., and Ken
+4//! Kennedy.: A Simple, Fast Dominance Algorithm: <https://www.cs.rice.edu/~keith/EMBED/dom.pdf>
+5
+6use std::collections::BTreeSet;
+7
+8use fxhash::FxHashMap;
+9
+10use crate::ir::BasicBlockId;
+11
+12use super::cfg::ControlFlowGraph;
+13
+14#[derive(Debug, Clone)]
+15pub struct DomTree {
+16    doms: FxHashMap<BasicBlockId, BasicBlockId>,
+17    /// CFG sorted in reverse post order.
+18    rpo: Vec<BasicBlockId>,
+19}
+20
+21impl DomTree {
+22    pub fn compute(cfg: &ControlFlowGraph) -> Self {
+23        let mut doms = FxHashMap::default();
+24        doms.insert(cfg.entry(), cfg.entry());
+25        let mut rpo: Vec<_> = cfg.post_order().collect();
+26        rpo.reverse();
+27
+28        let mut domtree = Self { doms, rpo };
+29
+30        let block_num = domtree.rpo.len();
+31
+32        let mut rpo_nums = FxHashMap::default();
+33        for (i, &block) in domtree.rpo.iter().enumerate() {
+34            rpo_nums.insert(block, (block_num - i) as u32);
+35        }
+36
+37        let mut changed = true;
+38        while changed {
+39            changed = false;
+40            for &block in domtree.rpo.iter().skip(1) {
+41                let processed_pred = match cfg
+42                    .preds(block)
+43                    .iter()
+44                    .find(|pred| domtree.doms.contains_key(pred))
+45                {
+46                    Some(pred) => *pred,
+47                    _ => continue,
+48                };
+49                let mut new_dom = processed_pred;
+50
+51                for &pred in cfg.preds(block) {
+52                    if pred != processed_pred && domtree.doms.contains_key(&pred) {
+53                        new_dom = domtree.intersect(new_dom, pred, &rpo_nums);
+54                    }
+55                }
+56                if Some(new_dom) != domtree.doms.get(&block).copied() {
+57                    changed = true;
+58                    domtree.doms.insert(block, new_dom);
+59                }
+60            }
+61        }
+62
+63        domtree
+64    }
+65
+66    /// Returns the immediate dominator of the `block`.
+67    /// Returns None if the `block` is unreachable from the entry block, or the
+68    /// `block` is the entry block itself.
+69    pub fn idom(&self, block: BasicBlockId) -> Option<BasicBlockId> {
+70        if self.rpo[0] == block {
+71            return None;
+72        }
+73        self.doms.get(&block).copied()
+74    }
+75
+76    /// Returns `true` if block1 strictly dominates block2.
+77    pub fn strictly_dominates(&self, block1: BasicBlockId, block2: BasicBlockId) -> bool {
+78        let mut current_block = block2;
+79        while let Some(block) = self.idom(current_block) {
+80            if block == block1 {
+81                return true;
+82            }
+83            current_block = block;
+84        }
+85
+86        false
+87    }
+88
+89    /// Returns `true` if block1 dominates block2.
+90    pub fn dominates(&self, block1: BasicBlockId, block2: BasicBlockId) -> bool {
+91        if block1 == block2 {
+92            return true;
+93        }
+94
+95        self.strictly_dominates(block1, block2)
+96    }
+97
+98    /// Returns `true` if block is reachable from the entry block.
+99    pub fn is_reachable(&self, block: BasicBlockId) -> bool {
+100        self.idom(block).is_some()
+101    }
+102
+103    /// Returns blocks in RPO.
+104    pub fn rpo(&self) -> &[BasicBlockId] {
+105        &self.rpo
+106    }
+107
+108    fn intersect(
+109        &self,
+110        mut b1: BasicBlockId,
+111        mut b2: BasicBlockId,
+112        rpo_nums: &FxHashMap<BasicBlockId, u32>,
+113    ) -> BasicBlockId {
+114        while b1 != b2 {
+115            while rpo_nums[&b1] < rpo_nums[&b2] {
+116                b1 = self.doms[&b1];
+117            }
+118            while rpo_nums[&b2] < rpo_nums[&b1] {
+119                b2 = self.doms[&b2]
+120            }
+121        }
+122
+123        b1
+124    }
+125
+126    /// Compute dominance frontiers of each blocks.
+127    pub fn compute_df(&self, cfg: &ControlFlowGraph) -> DFSet {
+128        let mut df = DFSet::default();
+129
+130        for &block in &self.rpo {
+131            let preds = cfg.preds(block);
+132            if preds.len() < 2 {
+133                continue;
+134            }
+135
+136            for pred in preds {
+137                let mut runner = *pred;
+138                while self.doms.get(&block) != Some(&runner) && self.is_reachable(runner) {
+139                    df.0.entry(runner).or_default().insert(block);
+140                    runner = self.doms[&runner];
+141                }
+142            }
+143        }
+144
+145        df
+146    }
+147}
+148
+149/// Dominance frontiers of each blocks.
+150#[derive(Default, Debug)]
+151pub struct DFSet(FxHashMap<BasicBlockId, BTreeSet<BasicBlockId>>);
+152
+153impl DFSet {
+154    /// Returns all dominance frontieres of a `block`.
+155    pub fn frontiers(
+156        &self,
+157        block: BasicBlockId,
+158    ) -> Option<impl Iterator<Item = BasicBlockId> + '_> {
+159        self.0.get(&block).map(|set| set.iter().copied())
+160    }
+161
+162    /// Returns number of frontier blocks of a `block`.
+163    pub fn frontier_num(&self, block: BasicBlockId) -> usize {
+164        self.0.get(&block).map(BTreeSet::len).unwrap_or(0)
+165    }
+166}
+167
+168#[cfg(test)]
+169mod tests {
+170    use super::*;
+171
+172    use crate::ir::{body_builder::BodyBuilder, FunctionBody, FunctionId, SourceInfo, TypeId};
+173
+174    fn calc_dom(func: &FunctionBody) -> (DomTree, DFSet) {
+175        let cfg = ControlFlowGraph::compute(func);
+176        let domtree = DomTree::compute(&cfg);
+177        let df = domtree.compute_df(&cfg);
+178        (domtree, df)
+179    }
+180
+181    fn body_builder() -> BodyBuilder {
+182        BodyBuilder::new(FunctionId(0), SourceInfo::dummy())
+183    }
+184
+185    #[test]
+186    fn dom_tree_if_else() {
+187        let mut builder = body_builder();
+188
+189        let then_block = builder.make_block();
+190        let else_block = builder.make_block();
+191        let merge_block = builder.make_block();
+192
+193        let dummy_ty = TypeId(0);
+194        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+195        builder.branch(v0, then_block, else_block, SourceInfo::dummy());
+196
+197        builder.move_to_block(then_block);
+198        builder.jump(merge_block, SourceInfo::dummy());
+199
+200        builder.move_to_block(else_block);
+201        builder.jump(merge_block, SourceInfo::dummy());
+202
+203        builder.move_to_block(merge_block);
+204        let dummy_value = builder.make_unit(dummy_ty);
+205        builder.ret(dummy_value, SourceInfo::dummy());
+206
+207        let func = builder.build();
+208
+209        let (dom_tree, df) = calc_dom(&func);
+210        let entry_block = func.order.entry();
+211        assert_eq!(dom_tree.idom(entry_block), None);
+212        assert_eq!(dom_tree.idom(then_block), Some(entry_block));
+213        assert_eq!(dom_tree.idom(else_block), Some(entry_block));
+214        assert_eq!(dom_tree.idom(merge_block), Some(entry_block));
+215
+216        assert_eq!(df.frontier_num(entry_block), 0);
+217        assert_eq!(df.frontier_num(then_block), 1);
+218        assert_eq!(
+219            df.frontiers(then_block).unwrap().next().unwrap(),
+220            merge_block
+221        );
+222        assert_eq!(
+223            df.frontiers(else_block).unwrap().next().unwrap(),
+224            merge_block
+225        );
+226        assert_eq!(df.frontier_num(merge_block), 0);
+227    }
+228
+229    #[test]
+230    fn unreachable_edge() {
+231        let mut builder = body_builder();
+232
+233        let block1 = builder.make_block();
+234        let block2 = builder.make_block();
+235        let block3 = builder.make_block();
+236        let block4 = builder.make_block();
+237
+238        let dummy_ty = TypeId(0);
+239        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+240        builder.branch(v0, block1, block2, SourceInfo::dummy());
+241
+242        builder.move_to_block(block1);
+243        builder.jump(block4, SourceInfo::dummy());
+244
+245        builder.move_to_block(block2);
+246        builder.jump(block4, SourceInfo::dummy());
+247
+248        builder.move_to_block(block3);
+249        builder.jump(block4, SourceInfo::dummy());
+250
+251        builder.move_to_block(block4);
+252        let dummy_value = builder.make_unit(dummy_ty);
+253        builder.ret(dummy_value, SourceInfo::dummy());
+254
+255        let func = builder.build();
+256
+257        let (dom_tree, _) = calc_dom(&func);
+258        let entry_block = func.order.entry();
+259        assert_eq!(dom_tree.idom(entry_block), None);
+260        assert_eq!(dom_tree.idom(block1), Some(entry_block));
+261        assert_eq!(dom_tree.idom(block2), Some(entry_block));
+262        assert_eq!(dom_tree.idom(block3), None);
+263        assert!(!dom_tree.is_reachable(block3));
+264        assert_eq!(dom_tree.idom(block4), Some(entry_block));
+265    }
+266
+267    #[test]
+268    fn dom_tree_complex() {
+269        let mut builder = body_builder();
+270
+271        let block1 = builder.make_block();
+272        let block2 = builder.make_block();
+273        let block3 = builder.make_block();
+274        let block4 = builder.make_block();
+275        let block5 = builder.make_block();
+276        let block6 = builder.make_block();
+277        let block7 = builder.make_block();
+278        let block8 = builder.make_block();
+279        let block9 = builder.make_block();
+280        let block10 = builder.make_block();
+281        let block11 = builder.make_block();
+282        let block12 = builder.make_block();
+283
+284        let dummy_ty = TypeId(0);
+285        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+286        builder.branch(v0, block2, block1, SourceInfo::dummy());
+287
+288        builder.move_to_block(block1);
+289        builder.branch(v0, block6, block3, SourceInfo::dummy());
+290
+291        builder.move_to_block(block2);
+292        builder.branch(v0, block7, block4, SourceInfo::dummy());
+293
+294        builder.move_to_block(block3);
+295        builder.branch(v0, block6, block5, SourceInfo::dummy());
+296
+297        builder.move_to_block(block4);
+298        builder.branch(v0, block7, block2, SourceInfo::dummy());
+299
+300        builder.move_to_block(block5);
+301        builder.branch(v0, block10, block8, SourceInfo::dummy());
+302
+303        builder.move_to_block(block6);
+304        builder.jump(block9, SourceInfo::dummy());
+305
+306        builder.move_to_block(block7);
+307        builder.jump(block12, SourceInfo::dummy());
+308
+309        builder.move_to_block(block8);
+310        builder.jump(block11, SourceInfo::dummy());
+311
+312        builder.move_to_block(block9);
+313        builder.jump(block8, SourceInfo::dummy());
+314
+315        builder.move_to_block(block10);
+316        builder.jump(block11, SourceInfo::dummy());
+317
+318        builder.move_to_block(block11);
+319        builder.branch(v0, block12, block2, SourceInfo::dummy());
+320
+321        builder.move_to_block(block12);
+322        let dummy_value = builder.make_unit(dummy_ty);
+323        builder.ret(dummy_value, SourceInfo::dummy());
+324
+325        let func = builder.build();
+326
+327        let (dom_tree, _) = calc_dom(&func);
+328        let entry_block = func.order.entry();
+329        assert_eq!(dom_tree.idom(entry_block), None);
+330        assert_eq!(dom_tree.idom(block1), Some(entry_block));
+331        assert_eq!(dom_tree.idom(block2), Some(entry_block));
+332        assert_eq!(dom_tree.idom(block3), Some(block1));
+333        assert_eq!(dom_tree.idom(block4), Some(block2));
+334        assert_eq!(dom_tree.idom(block5), Some(block3));
+335        assert_eq!(dom_tree.idom(block6), Some(block1));
+336        assert_eq!(dom_tree.idom(block7), Some(block2));
+337        assert_eq!(dom_tree.idom(block8), Some(block1));
+338        assert_eq!(dom_tree.idom(block9), Some(block6));
+339        assert_eq!(dom_tree.idom(block10), Some(block5));
+340        assert_eq!(dom_tree.idom(block11), Some(block1));
+341        assert_eq!(dom_tree.idom(block12), Some(entry_block));
+342    }
+343}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/analysis/loop_tree.rs.html b/compiler-docs/src/fe_mir/analysis/loop_tree.rs.html new file mode 100644 index 0000000000..85cb217bad --- /dev/null +++ b/compiler-docs/src/fe_mir/analysis/loop_tree.rs.html @@ -0,0 +1,347 @@ +loop_tree.rs - source

fe_mir/analysis/
loop_tree.rs

1use id_arena::{Arena, Id};
+2
+3use fxhash::FxHashMap;
+4
+5use super::{cfg::ControlFlowGraph, domtree::DomTree};
+6
+7use crate::ir::BasicBlockId;
+8
+9#[derive(Debug, Default, Clone)]
+10pub struct LoopTree {
+11    /// Stores loops.
+12    /// The index of an outer loops is guaranteed to be lower than its inner
+13    /// loops because loops are found in RPO.
+14    loops: Arena<Loop>,
+15
+16    /// Maps blocks to its contained loop.
+17    /// If the block is contained by multiple nested loops, then the block is
+18    /// mapped to the innermost loop.
+19    block_to_loop: FxHashMap<BasicBlockId, LoopId>,
+20}
+21
+22pub type LoopId = Id<Loop>;
+23
+24#[derive(Debug, Clone, PartialEq, Eq)]
+25pub struct Loop {
+26    /// A header of the loop.
+27    pub header: BasicBlockId,
+28
+29    /// A parent loop that includes the loop.
+30    pub parent: Option<LoopId>,
+31
+32    /// Child loops that the loop includes.
+33    pub children: Vec<LoopId>,
+34}
+35
+36impl LoopTree {
+37    pub fn compute(cfg: &ControlFlowGraph, domtree: &DomTree) -> Self {
+38        let mut tree = LoopTree::default();
+39
+40        // Find loop headers in RPO, this means outer loops are guaranteed to be
+41        // inserted first, then its inner loops are inserted.
+42        for &block in domtree.rpo() {
+43            for &pred in cfg.preds(block) {
+44                if domtree.dominates(block, pred) {
+45                    let loop_data = Loop {
+46                        header: block,
+47                        parent: None,
+48                        children: Vec::new(),
+49                    };
+50
+51                    tree.loops.alloc(loop_data);
+52                    break;
+53                }
+54            }
+55        }
+56
+57        tree.analyze_loops(cfg, domtree);
+58
+59        tree
+60    }
+61
+62    /// Returns all blocks in the loop.
+63    pub fn iter_blocks_post_order<'a, 'b>(
+64        &'a self,
+65        cfg: &'b ControlFlowGraph,
+66        lp: LoopId,
+67    ) -> BlocksInLoopPostOrder<'a, 'b> {
+68        BlocksInLoopPostOrder::new(self, cfg, lp)
+69    }
+70
+71    /// Returns all loops in a function body.
+72    /// An outer loop is guaranteed to be iterated before its inner loops.
+73    pub fn loops(&self) -> impl Iterator<Item = LoopId> + '_ {
+74        self.loops.iter().map(|(id, _)| id)
+75    }
+76
+77    /// Returns number of loops found.
+78    pub fn loop_num(&self) -> usize {
+79        self.loops.len()
+80    }
+81
+82    /// Returns `true` if the `block` is in the `lp`.
+83    pub fn is_block_in_loop(&self, block: BasicBlockId, lp: LoopId) -> bool {
+84        let mut loop_of_block = self.loop_of_block(block);
+85        while let Some(cur_lp) = loop_of_block {
+86            if lp == cur_lp {
+87                return true;
+88            }
+89            loop_of_block = self.parent_loop(cur_lp);
+90        }
+91        false
+92    }
+93
+94    /// Returns header block of the `lp`.
+95    pub fn loop_header(&self, lp: LoopId) -> BasicBlockId {
+96        self.loops[lp].header
+97    }
+98
+99    /// Get parent loop of the `lp` if exists.
+100    pub fn parent_loop(&self, lp: LoopId) -> Option<LoopId> {
+101        self.loops[lp].parent
+102    }
+103
+104    /// Returns the loop that the `block` belongs to.
+105    /// If the `block` belongs to multiple loops, then returns the innermost
+106    /// loop.
+107    pub fn loop_of_block(&self, block: BasicBlockId) -> Option<LoopId> {
+108        self.block_to_loop.get(&block).copied()
+109    }
+110
+111    /// Analyze loops. This method does
+112    /// 1. Mapping each blocks to its contained loop.
+113    /// 2. Setting parent and child of the loops.
+114    fn analyze_loops(&mut self, cfg: &ControlFlowGraph, domtree: &DomTree) {
+115        let mut worklist = vec![];
+116
+117        // Iterate loops reversely to ensure analyze inner loops first.
+118        let loops_rev: Vec<_> = self.loops.iter().rev().map(|(id, _)| id).collect();
+119        for cur_lp in loops_rev {
+120            let cur_lp_header = self.loop_header(cur_lp);
+121
+122            // Add predecessors of the loop header to worklist.
+123            for &block in cfg.preds(cur_lp_header) {
+124                if domtree.dominates(cur_lp_header, block) {
+125                    worklist.push(block);
+126                }
+127            }
+128
+129            while let Some(block) = worklist.pop() {
+130                match self.block_to_loop.get(&block).copied() {
+131                    Some(lp_of_block) => {
+132                        let outermost_parent = self.outermost_parent(lp_of_block);
+133
+134                        // If outermost parent is current loop, then the block is already visited.
+135                        if outermost_parent == cur_lp {
+136                            continue;
+137                        } else {
+138                            self.loops[cur_lp].children.push(outermost_parent);
+139                            self.loops[outermost_parent].parent = cur_lp.into();
+140
+141                            let lp_header_of_block = self.loop_header(lp_of_block);
+142                            worklist.extend(cfg.preds(lp_header_of_block));
+143                        }
+144                    }
+145
+146                    // If the block is not mapped to any loops, then map it to the loop.
+147                    None => {
+148                        self.map_block(block, cur_lp);
+149                        // If block is not loop header, then add its predecessors to the worklist.
+150                        if block != cur_lp_header {
+151                            worklist.extend(cfg.preds(block));
+152                        }
+153                    }
+154                }
+155            }
+156        }
+157    }
+158
+159    /// Returns the outermost parent loop of `lp`. If `lp` doesn't have any
+160    /// parent, then returns `lp` itself.
+161    fn outermost_parent(&self, mut lp: LoopId) -> LoopId {
+162        while let Some(parent) = self.parent_loop(lp) {
+163            lp = parent;
+164        }
+165        lp
+166    }
+167
+168    /// Map `block` to `lp`.
+169    fn map_block(&mut self, block: BasicBlockId, lp: LoopId) {
+170        self.block_to_loop.insert(block, lp);
+171    }
+172}
+173
+174pub struct BlocksInLoopPostOrder<'a, 'b> {
+175    lpt: &'a LoopTree,
+176    cfg: &'b ControlFlowGraph,
+177    lp: LoopId,
+178    stack: Vec<BasicBlockId>,
+179    block_state: FxHashMap<BasicBlockId, BlockState>,
+180}
+181
+182impl<'a, 'b> BlocksInLoopPostOrder<'a, 'b> {
+183    fn new(lpt: &'a LoopTree, cfg: &'b ControlFlowGraph, lp: LoopId) -> Self {
+184        let loop_header = lpt.loop_header(lp);
+185
+186        Self {
+187            lpt,
+188            cfg,
+189            lp,
+190            stack: vec![loop_header],
+191            block_state: FxHashMap::default(),
+192        }
+193    }
+194}
+195
+196impl<'a, 'b> Iterator for BlocksInLoopPostOrder<'a, 'b> {
+197    type Item = BasicBlockId;
+198
+199    fn next(&mut self) -> Option<Self::Item> {
+200        while let Some(&block) = self.stack.last() {
+201            match self.block_state.get(&block) {
+202                // The block is already visited, but not returned from the iterator,
+203                // so mark the block as `Finished` and return the block.
+204                Some(BlockState::Visited) => {
+205                    let block = self.stack.pop().unwrap();
+206                    self.block_state.insert(block, BlockState::Finished);
+207                    return Some(block);
+208                }
+209
+210                // The block is already returned, so just remove the block from the stack.
+211                Some(BlockState::Finished) => {
+212                    self.stack.pop().unwrap();
+213                }
+214
+215                // The block is not visited yet, so push its unvisited in-loop successors to the
+216                // stack and mark the block as `Visited`.
+217                None => {
+218                    self.block_state.insert(block, BlockState::Visited);
+219                    for &succ in self.cfg.succs(block) {
+220                        if !self.block_state.contains_key(&succ)
+221                            && self.lpt.is_block_in_loop(succ, self.lp)
+222                        {
+223                            self.stack.push(succ);
+224                        }
+225                    }
+226                }
+227            }
+228        }
+229
+230        None
+231    }
+232}
+233
+234enum BlockState {
+235    Visited,
+236    Finished,
+237}
+238
+239#[cfg(test)]
+240mod tests {
+241    use super::*;
+242
+243    use crate::ir::{body_builder::BodyBuilder, FunctionBody, FunctionId, SourceInfo, TypeId};
+244
+245    fn compute_loop(func: &FunctionBody) -> LoopTree {
+246        let cfg = ControlFlowGraph::compute(func);
+247        let domtree = DomTree::compute(&cfg);
+248        LoopTree::compute(&cfg, &domtree)
+249    }
+250
+251    fn body_builder() -> BodyBuilder {
+252        BodyBuilder::new(FunctionId(0), SourceInfo::dummy())
+253    }
+254
+255    #[test]
+256    fn simple_loop() {
+257        let mut builder = body_builder();
+258
+259        let entry = builder.current_block();
+260        let block1 = builder.make_block();
+261        let block2 = builder.make_block();
+262
+263        let dummy_ty = TypeId(0);
+264        let v0 = builder.make_imm_from_bool(false, dummy_ty);
+265        builder.branch(v0, block1, block2, SourceInfo::dummy());
+266
+267        builder.move_to_block(block1);
+268        builder.jump(entry, SourceInfo::dummy());
+269
+270        builder.move_to_block(block2);
+271        let dummy_value = builder.make_unit(dummy_ty);
+272        builder.ret(dummy_value, SourceInfo::dummy());
+273
+274        let func = builder.build();
+275
+276        let lpt = compute_loop(&func);
+277
+278        assert_eq!(lpt.loop_num(), 1);
+279        let lp = lpt.loops().next().unwrap();
+280
+281        assert!(lpt.is_block_in_loop(entry, lp));
+282        assert_eq!(lpt.loop_of_block(entry), Some(lp));
+283
+284        assert!(lpt.is_block_in_loop(block1, lp));
+285        assert_eq!(lpt.loop_of_block(block1), Some(lp));
+286
+287        assert!(!lpt.is_block_in_loop(block2, lp));
+288        assert!(lpt.loop_of_block(block2).is_none());
+289
+290        assert_eq!(lpt.loop_header(lp), entry);
+291    }
+292
+293    #[test]
+294    fn nested_loop() {
+295        let mut builder = body_builder();
+296
+297        let entry = builder.current_block();
+298        let block1 = builder.make_block();
+299        let block2 = builder.make_block();
+300        let block3 = builder.make_block();
+301
+302        let dummy_ty = TypeId(0);
+303        let v0 = builder.make_imm_from_bool(false, dummy_ty);
+304        builder.branch(v0, block1, block3, SourceInfo::dummy());
+305
+306        builder.move_to_block(block1);
+307        builder.branch(v0, entry, block2, SourceInfo::dummy());
+308
+309        builder.move_to_block(block2);
+310        builder.jump(block1, SourceInfo::dummy());
+311
+312        builder.move_to_block(block3);
+313        let dummy_value = builder.make_unit(dummy_ty);
+314        builder.ret(dummy_value, SourceInfo::dummy());
+315
+316        let func = builder.build();
+317
+318        let lpt = compute_loop(&func);
+319
+320        assert_eq!(lpt.loop_num(), 2);
+321        let mut loops = lpt.loops();
+322        let outer_lp = loops.next().unwrap();
+323        let inner_lp = loops.next().unwrap();
+324
+325        assert!(lpt.is_block_in_loop(entry, outer_lp));
+326        assert!(!lpt.is_block_in_loop(entry, inner_lp));
+327        assert_eq!(lpt.loop_of_block(entry), Some(outer_lp));
+328
+329        assert!(lpt.is_block_in_loop(block1, outer_lp));
+330        assert!(lpt.is_block_in_loop(block1, inner_lp));
+331        assert_eq!(lpt.loop_of_block(block1), Some(inner_lp));
+332
+333        assert!(lpt.is_block_in_loop(block2, outer_lp));
+334        assert!(lpt.is_block_in_loop(block2, inner_lp));
+335        assert_eq!(lpt.loop_of_block(block2), Some(inner_lp));
+336
+337        assert!(!lpt.is_block_in_loop(block3, outer_lp));
+338        assert!(!lpt.is_block_in_loop(block3, inner_lp));
+339        assert!(lpt.loop_of_block(block3).is_none());
+340
+341        assert!(lpt.parent_loop(outer_lp).is_none());
+342        assert_eq!(lpt.parent_loop(inner_lp), Some(outer_lp));
+343
+344        assert_eq!(lpt.loop_header(outer_lp), entry);
+345        assert_eq!(lpt.loop_header(inner_lp), block1);
+346    }
+347}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/analysis/mod.rs.html b/compiler-docs/src/fe_mir/analysis/mod.rs.html new file mode 100644 index 0000000000..dfa9ab367a --- /dev/null +++ b/compiler-docs/src/fe_mir/analysis/mod.rs.html @@ -0,0 +1,9 @@ +mod.rs - source

fe_mir/analysis/
mod.rs

1pub mod cfg;
+2pub mod domtree;
+3pub mod loop_tree;
+4pub mod post_domtree;
+5
+6pub use cfg::ControlFlowGraph;
+7pub use domtree::DomTree;
+8pub use loop_tree::LoopTree;
+9pub use post_domtree::PostDomTree;
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/analysis/post_domtree.rs.html b/compiler-docs/src/fe_mir/analysis/post_domtree.rs.html new file mode 100644 index 0000000000..d474ddd993 --- /dev/null +++ b/compiler-docs/src/fe_mir/analysis/post_domtree.rs.html @@ -0,0 +1,284 @@ +post_domtree.rs - source

fe_mir/analysis/
post_domtree.rs

1//! This module contains implementation of `Post Dominator Tree`.
+2
+3use id_arena::{ArenaBehavior, DefaultArenaBehavior};
+4
+5use super::{cfg::ControlFlowGraph, domtree::DomTree};
+6
+7use crate::ir::{BasicBlock, BasicBlockId, FunctionBody};
+8
+9#[derive(Debug)]
+10pub struct PostDomTree {
+11    /// Dummy entry block to calculate post dom tree.
+12    dummy_entry: BasicBlockId,
+13    /// Canonical dummy exit block to calculate post dom tree. All blocks ends
+14    /// with `return` has an edge to this block.
+15    dummy_exit: BasicBlockId,
+16
+17    /// Dominator tree of reverse control flow graph.
+18    domtree: DomTree,
+19}
+20
+21impl PostDomTree {
+22    pub fn compute(func: &FunctionBody) -> Self {
+23        let mut rcfg = ControlFlowGraph::compute(func);
+24
+25        let real_entry = rcfg.entry();
+26
+27        let dummy_entry = Self::make_dummy_block();
+28        let dummy_exit = Self::make_dummy_block();
+29        // Add edges from dummy entry block to real entry block and dummy exit block.
+30        rcfg.add_edge(dummy_entry, real_entry);
+31        rcfg.add_edge(dummy_entry, dummy_exit);
+32
+33        // Add edges from real exit blocks to dummy exit block.
+34        for exit in std::mem::take(&mut rcfg.exits) {
+35            rcfg.add_edge(exit, dummy_exit);
+36        }
+37
+38        rcfg.reverse_edge(dummy_exit, vec![dummy_entry]);
+39        let domtree = DomTree::compute(&rcfg);
+40
+41        Self {
+42            dummy_entry,
+43            dummy_exit,
+44            domtree,
+45        }
+46    }
+47
+48    pub fn post_idom(&self, block: BasicBlockId) -> PostIDom {
+49        match self.domtree.idom(block).unwrap() {
+50            block if block == self.dummy_entry => PostIDom::DummyEntry,
+51            block if block == self.dummy_exit => PostIDom::DummyExit,
+52            other => PostIDom::Block(other),
+53        }
+54    }
+55
+56    /// Returns `true` if block is reachable from the exit blocks.
+57    pub fn is_reachable(&self, block: BasicBlockId) -> bool {
+58        self.domtree.is_reachable(block)
+59    }
+60
+61    fn make_dummy_block() -> BasicBlockId {
+62        let arena_id = DefaultArenaBehavior::<BasicBlock>::new_arena_id();
+63        DefaultArenaBehavior::new_id(arena_id, 0)
+64    }
+65}
+66
+67#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+68pub enum PostIDom {
+69    DummyEntry,
+70    DummyExit,
+71    Block(BasicBlockId),
+72}
+73
+74#[cfg(test)]
+75mod tests {
+76    use super::*;
+77
+78    use crate::ir::{body_builder::BodyBuilder, FunctionId, SourceInfo, TypeId};
+79
+80    fn body_builder() -> BodyBuilder {
+81        BodyBuilder::new(FunctionId(0), SourceInfo::dummy())
+82    }
+83
+84    #[test]
+85    fn test_if_else_merge() {
+86        let mut builder = body_builder();
+87        let then_block = builder.make_block();
+88        let else_block = builder.make_block();
+89        let merge_block = builder.make_block();
+90
+91        let dummy_ty = TypeId(0);
+92        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+93        builder.branch(v0, then_block, else_block, SourceInfo::dummy());
+94
+95        builder.move_to_block(then_block);
+96        builder.jump(merge_block, SourceInfo::dummy());
+97
+98        builder.move_to_block(else_block);
+99        builder.jump(merge_block, SourceInfo::dummy());
+100
+101        builder.move_to_block(merge_block);
+102        let dummy_value = builder.make_unit(dummy_ty);
+103        builder.ret(dummy_value, SourceInfo::dummy());
+104
+105        let func = builder.build();
+106
+107        let post_dom_tree = PostDomTree::compute(&func);
+108        let entry_block = func.order.entry();
+109        assert_eq!(
+110            post_dom_tree.post_idom(entry_block),
+111            PostIDom::Block(merge_block)
+112        );
+113        assert_eq!(
+114            post_dom_tree.post_idom(then_block),
+115            PostIDom::Block(merge_block)
+116        );
+117        assert_eq!(
+118            post_dom_tree.post_idom(else_block),
+119            PostIDom::Block(merge_block)
+120        );
+121        assert_eq!(post_dom_tree.post_idom(merge_block), PostIDom::DummyExit);
+122    }
+123
+124    #[test]
+125    fn test_if_else_return() {
+126        let mut builder = body_builder();
+127        let then_block = builder.make_block();
+128        let else_block = builder.make_block();
+129        let merge_block = builder.make_block();
+130
+131        let dummy_ty = TypeId(0);
+132        let dummy_value = builder.make_unit(dummy_ty);
+133        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+134        builder.branch(v0, then_block, else_block, SourceInfo::dummy());
+135
+136        builder.move_to_block(then_block);
+137        builder.jump(merge_block, SourceInfo::dummy());
+138
+139        builder.move_to_block(else_block);
+140        builder.ret(dummy_value, SourceInfo::dummy());
+141
+142        builder.move_to_block(merge_block);
+143        builder.ret(dummy_value, SourceInfo::dummy());
+144
+145        let func = builder.build();
+146
+147        let post_dom_tree = PostDomTree::compute(&func);
+148        let entry_block = func.order.entry();
+149        assert_eq!(post_dom_tree.post_idom(entry_block), PostIDom::DummyExit,);
+150        assert_eq!(
+151            post_dom_tree.post_idom(then_block),
+152            PostIDom::Block(merge_block),
+153        );
+154        assert_eq!(post_dom_tree.post_idom(else_block), PostIDom::DummyExit);
+155        assert_eq!(post_dom_tree.post_idom(merge_block), PostIDom::DummyExit);
+156    }
+157
+158    #[test]
+159    fn test_if_non_else() {
+160        let mut builder = body_builder();
+161        let then_block = builder.make_block();
+162        let merge_block = builder.make_block();
+163
+164        let dummy_ty = TypeId(0);
+165        let dummy_value = builder.make_unit(dummy_ty);
+166        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+167        builder.branch(v0, then_block, merge_block, SourceInfo::dummy());
+168
+169        builder.move_to_block(then_block);
+170        builder.jump(merge_block, SourceInfo::dummy());
+171
+172        builder.move_to_block(merge_block);
+173        builder.ret(dummy_value, SourceInfo::dummy());
+174
+175        let func = builder.build();
+176
+177        let post_dom_tree = PostDomTree::compute(&func);
+178        let entry_block = func.order.entry();
+179        assert_eq!(
+180            post_dom_tree.post_idom(entry_block),
+181            PostIDom::Block(merge_block),
+182        );
+183        assert_eq!(
+184            post_dom_tree.post_idom(then_block),
+185            PostIDom::Block(merge_block),
+186        );
+187        assert_eq!(post_dom_tree.post_idom(merge_block), PostIDom::DummyExit);
+188    }
+189
+190    #[test]
+191    fn test_loop() {
+192        let mut builder = body_builder();
+193        let block1 = builder.make_block();
+194        let block2 = builder.make_block();
+195        let block3 = builder.make_block();
+196        let block4 = builder.make_block();
+197
+198        let dummy_ty = TypeId(0);
+199        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+200
+201        builder.branch(v0, block1, block2, SourceInfo::dummy());
+202
+203        builder.move_to_block(block1);
+204        builder.jump(block3, SourceInfo::dummy());
+205
+206        builder.move_to_block(block2);
+207        builder.branch(v0, block3, block4, SourceInfo::dummy());
+208
+209        builder.move_to_block(block3);
+210        let dummy_value = builder.make_unit(dummy_ty);
+211        builder.ret(dummy_value, SourceInfo::dummy());
+212
+213        builder.move_to_block(block4);
+214        builder.jump(block2, SourceInfo::dummy());
+215
+216        let func = builder.build();
+217
+218        let post_dom_tree = PostDomTree::compute(&func);
+219        let entry_block = func.order.entry();
+220        assert_eq!(
+221            post_dom_tree.post_idom(entry_block),
+222            PostIDom::Block(block3),
+223        );
+224        assert_eq!(post_dom_tree.post_idom(block1), PostIDom::Block(block3));
+225        assert_eq!(post_dom_tree.post_idom(block2), PostIDom::Block(block3));
+226        assert_eq!(post_dom_tree.post_idom(block3), PostIDom::DummyExit);
+227        assert_eq!(post_dom_tree.post_idom(block4), PostIDom::Block(block2));
+228    }
+229
+230    #[test]
+231    fn test_pd_complex() {
+232        let mut builder = body_builder();
+233        let block1 = builder.make_block();
+234        let block2 = builder.make_block();
+235        let block3 = builder.make_block();
+236        let block4 = builder.make_block();
+237        let block5 = builder.make_block();
+238        let block6 = builder.make_block();
+239        let block7 = builder.make_block();
+240
+241        let dummy_ty = TypeId(0);
+242        let v0 = builder.make_imm_from_bool(true, dummy_ty);
+243
+244        builder.branch(v0, block1, block2, SourceInfo::dummy());
+245
+246        builder.move_to_block(block1);
+247        builder.jump(block6, SourceInfo::dummy());
+248
+249        builder.move_to_block(block2);
+250        builder.branch(v0, block3, block4, SourceInfo::dummy());
+251
+252        builder.move_to_block(block3);
+253        builder.jump(block5, SourceInfo::dummy());
+254
+255        builder.move_to_block(block4);
+256        builder.jump(block5, SourceInfo::dummy());
+257
+258        builder.move_to_block(block5);
+259        builder.jump(block6, SourceInfo::dummy());
+260
+261        builder.move_to_block(block6);
+262        builder.jump(block7, SourceInfo::dummy());
+263
+264        builder.move_to_block(block7);
+265        let dummy_value = builder.make_unit(dummy_ty);
+266        builder.ret(dummy_value, SourceInfo::dummy());
+267
+268        let func = builder.build();
+269
+270        let post_dom_tree = PostDomTree::compute(&func);
+271        let entry_block = func.order.entry();
+272        assert_eq!(
+273            post_dom_tree.post_idom(entry_block),
+274            PostIDom::Block(block6),
+275        );
+276        assert_eq!(post_dom_tree.post_idom(block1), PostIDom::Block(block6));
+277        assert_eq!(post_dom_tree.post_idom(block2), PostIDom::Block(block5));
+278        assert_eq!(post_dom_tree.post_idom(block3), PostIDom::Block(block5));
+279        assert_eq!(post_dom_tree.post_idom(block4), PostIDom::Block(block5));
+280        assert_eq!(post_dom_tree.post_idom(block5), PostIDom::Block(block6));
+281        assert_eq!(post_dom_tree.post_idom(block6), PostIDom::Block(block7));
+282        assert_eq!(post_dom_tree.post_idom(block7), PostIDom::DummyExit);
+283    }
+284}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/db.rs.html b/compiler-docs/src/fe_mir/db.rs.html new file mode 100644 index 0000000000..5b06ba49d6 --- /dev/null +++ b/compiler-docs/src/fe_mir/db.rs.html @@ -0,0 +1,104 @@ +db.rs - source

fe_mir/
db.rs

1#![allow(clippy::arc_with_non_send_sync)]
+2use std::{collections::BTreeMap, rc::Rc};
+3
+4use fe_analyzer::{
+5    db::AnalyzerDbStorage,
+6    namespace::{items as analyzer_items, types as analyzer_types},
+7    AnalyzerDb,
+8};
+9use fe_common::db::{SourceDb, SourceDbStorage, Upcast, UpcastMut};
+10use smol_str::SmolStr;
+11
+12use crate::ir::{self, ConstantId, TypeId};
+13
+14mod queries;
+15
+16#[salsa::query_group(MirDbStorage)]
+17pub trait MirDb: AnalyzerDb + Upcast<dyn AnalyzerDb> + UpcastMut<dyn AnalyzerDb> {
+18    #[salsa::interned]
+19    fn mir_intern_const(&self, data: Rc<ir::Constant>) -> ir::ConstantId;
+20    #[salsa::interned]
+21    fn mir_intern_type(&self, data: Rc<ir::Type>) -> ir::TypeId;
+22    #[salsa::interned]
+23    fn mir_intern_function(&self, data: Rc<ir::FunctionSignature>) -> ir::FunctionId;
+24
+25    #[salsa::invoke(queries::module::mir_lower_module_all_functions)]
+26    fn mir_lower_module_all_functions(
+27        &self,
+28        module: analyzer_items::ModuleId,
+29    ) -> Rc<Vec<ir::FunctionId>>;
+30
+31    #[salsa::invoke(queries::contract::mir_lower_contract_all_functions)]
+32    fn mir_lower_contract_all_functions(
+33        &self,
+34        contract: analyzer_items::ContractId,
+35    ) -> Rc<Vec<ir::FunctionId>>;
+36
+37    #[salsa::invoke(queries::structs::mir_lower_struct_all_functions)]
+38    fn mir_lower_struct_all_functions(
+39        &self,
+40        struct_: analyzer_items::StructId,
+41    ) -> Rc<Vec<ir::FunctionId>>;
+42
+43    #[salsa::invoke(queries::enums::mir_lower_enum_all_functions)]
+44    fn mir_lower_enum_all_functions(
+45        &self,
+46        enum_: analyzer_items::EnumId,
+47    ) -> Rc<Vec<ir::FunctionId>>;
+48
+49    #[salsa::invoke(queries::types::mir_lowered_type)]
+50    fn mir_lowered_type(&self, analyzer_type: analyzer_types::TypeId) -> TypeId;
+51
+52    #[salsa::invoke(queries::constant::mir_lowered_constant)]
+53    fn mir_lowered_constant(&self, analyzer_const: analyzer_items::ModuleConstantId) -> ConstantId;
+54
+55    #[salsa::invoke(queries::function::mir_lowered_func_signature)]
+56    fn mir_lowered_func_signature(
+57        &self,
+58        analyzer_func: analyzer_items::FunctionId,
+59    ) -> ir::FunctionId;
+60    #[salsa::invoke(queries::function::mir_lowered_monomorphized_func_signature)]
+61    fn mir_lowered_monomorphized_func_signature(
+62        &self,
+63        analyzer_func: analyzer_items::FunctionId,
+64        resolved_generics: BTreeMap<SmolStr, analyzer_types::TypeId>,
+65    ) -> ir::FunctionId;
+66    #[salsa::invoke(queries::function::mir_lowered_pseudo_monomorphized_func_signature)]
+67    fn mir_lowered_pseudo_monomorphized_func_signature(
+68        &self,
+69        analyzer_func: analyzer_items::FunctionId,
+70    ) -> ir::FunctionId;
+71    #[salsa::invoke(queries::function::mir_lowered_func_body)]
+72    fn mir_lowered_func_body(&self, func: ir::FunctionId) -> Rc<ir::FunctionBody>;
+73}
+74
+75#[salsa::database(SourceDbStorage, AnalyzerDbStorage, MirDbStorage)]
+76#[derive(Default)]
+77pub struct NewDb {
+78    storage: salsa::Storage<NewDb>,
+79}
+80impl salsa::Database for NewDb {}
+81
+82impl Upcast<dyn SourceDb> for NewDb {
+83    fn upcast(&self) -> &(dyn SourceDb + 'static) {
+84        self
+85    }
+86}
+87
+88impl UpcastMut<dyn SourceDb> for NewDb {
+89    fn upcast_mut(&mut self) -> &mut (dyn SourceDb + 'static) {
+90        &mut *self
+91    }
+92}
+93
+94impl Upcast<dyn AnalyzerDb> for NewDb {
+95    fn upcast(&self) -> &(dyn AnalyzerDb + 'static) {
+96        self
+97    }
+98}
+99
+100impl UpcastMut<dyn AnalyzerDb> for NewDb {
+101    fn upcast_mut(&mut self) -> &mut (dyn AnalyzerDb + 'static) {
+102        &mut *self
+103    }
+104}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/db/queries.rs.html b/compiler-docs/src/fe_mir/db/queries.rs.html new file mode 100644 index 0000000000..b029476695 --- /dev/null +++ b/compiler-docs/src/fe_mir/db/queries.rs.html @@ -0,0 +1,7 @@ +queries.rs - source

fe_mir/db/
queries.rs

1pub mod constant;
+2pub mod contract;
+3pub mod enums;
+4pub mod function;
+5pub mod module;
+6pub mod structs;
+7pub mod types;
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/db/queries/constant.rs.html b/compiler-docs/src/fe_mir/db/queries/constant.rs.html new file mode 100644 index 0000000000..33327505c4 --- /dev/null +++ b/compiler-docs/src/fe_mir/db/queries/constant.rs.html @@ -0,0 +1,43 @@ +constant.rs - source

fe_mir/db/queries/
constant.rs

1use std::rc::Rc;
+2
+3use fe_analyzer::namespace::items as analyzer_items;
+4
+5use crate::{
+6    db::MirDb,
+7    ir::{Constant, ConstantId, SourceInfo, TypeId},
+8};
+9
+10pub fn mir_lowered_constant(
+11    db: &dyn MirDb,
+12    analyzer_const: analyzer_items::ModuleConstantId,
+13) -> ConstantId {
+14    let name = analyzer_const.name(db.upcast());
+15    let value = analyzer_const.constant_value(db.upcast()).unwrap();
+16    let ty = analyzer_const.typ(db.upcast()).unwrap();
+17    let module_id = analyzer_const.module(db.upcast());
+18    let span = analyzer_const.span(db.upcast());
+19    let id = analyzer_const.node_id(db.upcast());
+20
+21    let ty = db.mir_lowered_type(ty);
+22    let source = SourceInfo { span, id };
+23
+24    let constant = Constant {
+25        name,
+26        value: value.into(),
+27        ty,
+28        module_id,
+29        source,
+30    };
+31
+32    db.mir_intern_const(constant.into())
+33}
+34
+35impl ConstantId {
+36    pub fn data(self, db: &dyn MirDb) -> Rc<Constant> {
+37        db.lookup_mir_intern_const(self)
+38    }
+39
+40    pub fn ty(self, db: &dyn MirDb) -> TypeId {
+41        self.data(db).ty
+42    }
+43}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/db/queries/contract.rs.html b/compiler-docs/src/fe_mir/db/queries/contract.rs.html new file mode 100644 index 0000000000..f13344d10c --- /dev/null +++ b/compiler-docs/src/fe_mir/db/queries/contract.rs.html @@ -0,0 +1,17 @@ +contract.rs - source

fe_mir/db/queries/
contract.rs

1use std::rc::Rc;
+2
+3use fe_analyzer::namespace::items::{self as analyzer_items};
+4
+5use crate::{db::MirDb, ir::FunctionId};
+6
+7pub fn mir_lower_contract_all_functions(
+8    db: &dyn MirDb,
+9    contract: analyzer_items::ContractId,
+10) -> Rc<Vec<FunctionId>> {
+11    contract
+12        .all_functions(db.upcast())
+13        .iter()
+14        .map(|func| db.mir_lowered_func_signature(*func))
+15        .collect::<Vec<_>>()
+16        .into()
+17}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/db/queries/enums.rs.html b/compiler-docs/src/fe_mir/db/queries/enums.rs.html new file mode 100644 index 0000000000..8abc577843 --- /dev/null +++ b/compiler-docs/src/fe_mir/db/queries/enums.rs.html @@ -0,0 +1,17 @@ +enums.rs - source

fe_mir/db/queries/
enums.rs

1use std::rc::Rc;
+2
+3use fe_analyzer::namespace::items::{self as analyzer_items};
+4
+5use crate::{db::MirDb, ir::FunctionId};
+6
+7pub fn mir_lower_enum_all_functions(
+8    db: &dyn MirDb,
+9    enum_: analyzer_items::EnumId,
+10) -> Rc<Vec<FunctionId>> {
+11    enum_
+12        .all_functions(db.upcast())
+13        .iter()
+14        .map(|func| db.mir_lowered_func_signature(*func))
+15        .collect::<Vec<_>>()
+16        .into()
+17}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/db/queries/function.rs.html b/compiler-docs/src/fe_mir/db/queries/function.rs.html new file mode 100644 index 0000000000..aa82bc41ee --- /dev/null +++ b/compiler-docs/src/fe_mir/db/queries/function.rs.html @@ -0,0 +1,130 @@ +function.rs - source

fe_mir/db/queries/
function.rs

1use std::{collections::BTreeMap, rc::Rc};
+2
+3use fe_analyzer::display::Displayable;
+4use fe_analyzer::namespace::items as analyzer_items;
+5use fe_analyzer::namespace::items::Item;
+6use fe_analyzer::namespace::types as analyzer_types;
+7
+8use smol_str::SmolStr;
+9
+10use crate::{
+11    db::MirDb,
+12    ir::{self, function::Linkage, FunctionSignature, TypeId},
+13    lower::function::{lower_func_body, lower_func_signature, lower_monomorphized_func_signature},
+14};
+15
+16pub fn mir_lowered_func_signature(
+17    db: &dyn MirDb,
+18    analyzer_func: analyzer_items::FunctionId,
+19) -> ir::FunctionId {
+20    lower_func_signature(db, analyzer_func)
+21}
+22
+23pub fn mir_lowered_monomorphized_func_signature(
+24    db: &dyn MirDb,
+25    analyzer_func: analyzer_items::FunctionId,
+26    resolved_generics: BTreeMap<SmolStr, analyzer_types::TypeId>,
+27) -> ir::FunctionId {
+28    lower_monomorphized_func_signature(db, analyzer_func, resolved_generics)
+29}
+30
+31/// Generate MIR function and monomorphize generic parameters as if they were called with unit type
+32/// NOTE: THIS SHOULD ONLY BE USED IN TEST CODE
+33pub fn mir_lowered_pseudo_monomorphized_func_signature(
+34    db: &dyn MirDb,
+35    analyzer_func: analyzer_items::FunctionId,
+36) -> ir::FunctionId {
+37    let resolved_generics = analyzer_func
+38        .sig(db.upcast())
+39        .generic_params(db.upcast())
+40        .iter()
+41        .map(|generic| (generic.name(), analyzer_types::TypeId::unit(db.upcast())))
+42        .collect::<BTreeMap<_, _>>();
+43    lower_monomorphized_func_signature(db, analyzer_func, resolved_generics)
+44}
+45
+46pub fn mir_lowered_func_body(db: &dyn MirDb, func: ir::FunctionId) -> Rc<ir::FunctionBody> {
+47    lower_func_body(db, func)
+48}
+49
+50impl ir::FunctionId {
+51    pub fn signature(self, db: &dyn MirDb) -> Rc<FunctionSignature> {
+52        db.lookup_mir_intern_function(self)
+53    }
+54
+55    pub fn return_type(self, db: &dyn MirDb) -> Option<TypeId> {
+56        self.signature(db).return_type
+57    }
+58
+59    pub fn linkage(self, db: &dyn MirDb) -> Linkage {
+60        self.signature(db).linkage
+61    }
+62
+63    pub fn analyzer_func(self, db: &dyn MirDb) -> analyzer_items::FunctionId {
+64        self.signature(db).analyzer_func_id
+65    }
+66
+67    pub fn body(self, db: &dyn MirDb) -> Rc<ir::FunctionBody> {
+68        db.mir_lowered_func_body(self)
+69    }
+70
+71    pub fn module(self, db: &dyn MirDb) -> analyzer_items::ModuleId {
+72        let analyzer_func = self.analyzer_func(db);
+73        analyzer_func.module(db.upcast())
+74    }
+75
+76    pub fn is_contract_init(self, db: &dyn MirDb) -> bool {
+77        self.analyzer_func(db)
+78            .data(db.upcast())
+79            .sig
+80            .is_constructor(db.upcast())
+81    }
+82
+83    /// Returns a type suffix if a generic function was monomorphized
+84    pub fn type_suffix(&self, db: &dyn MirDb) -> SmolStr {
+85        self.signature(db)
+86            .resolved_generics
+87            .values()
+88            .fold(String::new(), |acc, param| {
+89                format!("{}_{}", acc, param.display(db.upcast()))
+90            })
+91            .into()
+92    }
+93
+94    pub fn name(&self, db: &dyn MirDb) -> SmolStr {
+95        let analyzer_func = self.analyzer_func(db);
+96        analyzer_func.name(db.upcast())
+97    }
+98
+99    /// Returns `class_name::fn_name` if a function is a method else `fn_name`.
+100    pub fn debug_name(self, db: &dyn MirDb) -> SmolStr {
+101        let analyzer_func = self.analyzer_func(db);
+102        let func_name = format!(
+103            "{}{}",
+104            analyzer_func.name(db.upcast()),
+105            self.type_suffix(db)
+106        );
+107
+108        match analyzer_func.sig(db.upcast()).self_item(db.upcast()) {
+109            Some(Item::Impl(id)) => {
+110                let class_name = format!(
+111                    "<{} as {}>",
+112                    id.receiver(db.upcast()).display(db.upcast()),
+113                    id.trait_id(db.upcast()).name(db.upcast())
+114                );
+115                format!("{class_name}::{func_name}").into()
+116            }
+117            Some(class) => {
+118                let class_name = class.name(db.upcast());
+119                format!("{class_name}::{func_name}").into()
+120            }
+121            _ => func_name.into(),
+122        }
+123    }
+124
+125    pub fn returns_aggregate(self, db: &dyn MirDb) -> bool {
+126        self.return_type(db)
+127            .map(|ty| ty.is_aggregate(db))
+128            .unwrap_or_default()
+129    }
+130}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/db/queries/module.rs.html b/compiler-docs/src/fe_mir/db/queries/module.rs.html new file mode 100644 index 0000000000..92cdd44c58 --- /dev/null +++ b/compiler-docs/src/fe_mir/db/queries/module.rs.html @@ -0,0 +1,35 @@ +module.rs - source

fe_mir/db/queries/
module.rs

1use std::rc::Rc;
+2
+3use fe_analyzer::namespace::items::{self as analyzer_items, TypeDef};
+4
+5use crate::{db::MirDb, ir::FunctionId};
+6
+7pub fn mir_lower_module_all_functions(
+8    db: &dyn MirDb,
+9    module: analyzer_items::ModuleId,
+10) -> Rc<Vec<FunctionId>> {
+11    let mut functions = vec![];
+12
+13    let items = module.all_items(db.upcast());
+14    items.iter().for_each(|item| match item {
+15        analyzer_items::Item::Function(func) => {
+16            functions.push(db.mir_lowered_func_signature(*func))
+17        }
+18
+19        analyzer_items::Item::Type(TypeDef::Contract(contract)) => {
+20            functions.extend_from_slice(&db.mir_lower_contract_all_functions(*contract))
+21        }
+22
+23        analyzer_items::Item::Type(TypeDef::Struct(struct_)) => {
+24            functions.extend_from_slice(&db.mir_lower_struct_all_functions(*struct_))
+25        }
+26
+27        analyzer_items::Item::Type(TypeDef::Enum(enum_)) => {
+28            functions.extend_from_slice(&db.mir_lower_enum_all_functions(*enum_))
+29        }
+30
+31        _ => {}
+32    });
+33
+34    functions.into()
+35}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/db/queries/structs.rs.html b/compiler-docs/src/fe_mir/db/queries/structs.rs.html new file mode 100644 index 0000000000..224248a59a --- /dev/null +++ b/compiler-docs/src/fe_mir/db/queries/structs.rs.html @@ -0,0 +1,17 @@ +structs.rs - source

fe_mir/db/queries/
structs.rs

1use std::rc::Rc;
+2
+3use fe_analyzer::namespace::items::{self as analyzer_items};
+4
+5use crate::{db::MirDb, ir::FunctionId};
+6
+7pub fn mir_lower_struct_all_functions(
+8    db: &dyn MirDb,
+9    struct_: analyzer_items::StructId,
+10) -> Rc<Vec<FunctionId>> {
+11    struct_
+12        .all_functions(db.upcast())
+13        .iter()
+14        .map(|func| db.mir_lowered_pseudo_monomorphized_func_signature(*func))
+15        .collect::<Vec<_>>()
+16        .into()
+17}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/db/queries/types.rs.html b/compiler-docs/src/fe_mir/db/queries/types.rs.html new file mode 100644 index 0000000000..528a92a5b8 --- /dev/null +++ b/compiler-docs/src/fe_mir/db/queries/types.rs.html @@ -0,0 +1,657 @@ +types.rs - source

fe_mir/db/queries/
types.rs

1use std::{fmt, rc::Rc, str::FromStr};
+2
+3use fe_analyzer::namespace::{items::EnumVariantId, types as analyzer_types};
+4
+5use num_bigint::BigInt;
+6use num_traits::ToPrimitive;
+7
+8use crate::{
+9    db::MirDb,
+10    ir::{
+11        types::{ArrayDef, TupleDef, TypeKind},
+12        Type, TypeId, Value,
+13    },
+14    lower::types::lower_type,
+15};
+16
+17pub fn mir_lowered_type(db: &dyn MirDb, analyzer_type: analyzer_types::TypeId) -> TypeId {
+18    lower_type(db, analyzer_type)
+19}
+20
+21impl TypeId {
+22    pub fn data(self, db: &dyn MirDb) -> Rc<Type> {
+23        db.lookup_mir_intern_type(self)
+24    }
+25
+26    pub fn analyzer_ty(self, db: &dyn MirDb) -> Option<analyzer_types::TypeId> {
+27        self.data(db).analyzer_ty
+28    }
+29
+30    pub fn projection_ty(self, db: &dyn MirDb, access: &Value) -> TypeId {
+31        let ty = self.deref(db);
+32        let pty = match &ty.data(db).kind {
+33            TypeKind::Array(ArrayDef { elem_ty, .. }) => *elem_ty,
+34            TypeKind::Tuple(def) => {
+35                let index = expect_projection_index(access);
+36                def.items[index]
+37            }
+38            TypeKind::Struct(def) | TypeKind::Contract(def) => {
+39                let index = expect_projection_index(access);
+40                def.fields[index].1
+41            }
+42            TypeKind::Enum(_) => {
+43                let index = expect_projection_index(access);
+44                debug_assert_eq!(index, 0);
+45                ty.projection_ty_imm(db, 0)
+46            }
+47            _ => panic!("{:?} can't project onto the `access`", self.as_string(db)),
+48        };
+49        match &self.data(db).kind {
+50            TypeKind::SPtr(_) | TypeKind::Contract(_) => pty.make_sptr(db),
+51            TypeKind::MPtr(_) => pty.make_mptr(db),
+52            _ => pty,
+53        }
+54    }
+55
+56    pub fn deref(self, db: &dyn MirDb) -> TypeId {
+57        match self.data(db).kind {
+58            TypeKind::SPtr(inner) => inner,
+59            TypeKind::MPtr(inner) => inner.deref(db),
+60            _ => self,
+61        }
+62    }
+63
+64    pub fn make_sptr(self, db: &dyn MirDb) -> TypeId {
+65        db.mir_intern_type(Type::new(TypeKind::SPtr(self), None).into())
+66    }
+67
+68    pub fn make_mptr(self, db: &dyn MirDb) -> TypeId {
+69        db.mir_intern_type(Type::new(TypeKind::MPtr(self), None).into())
+70    }
+71
+72    pub fn projection_ty_imm(self, db: &dyn MirDb, index: usize) -> TypeId {
+73        match &self.data(db).kind {
+74            TypeKind::Array(ArrayDef { elem_ty, .. }) => *elem_ty,
+75            TypeKind::Tuple(def) => def.items[index],
+76            TypeKind::Struct(def) | TypeKind::Contract(def) => def.fields[index].1,
+77            TypeKind::Enum(_) => {
+78                debug_assert_eq!(index, 0);
+79                self.enum_disc_type(db)
+80            }
+81            _ => panic!("{:?} can't project onto the `index`", self.as_string(db)),
+82        }
+83    }
+84
+85    pub fn aggregate_field_num(self, db: &dyn MirDb) -> usize {
+86        match &self.data(db).kind {
+87            TypeKind::Array(ArrayDef { len, .. }) => *len,
+88            TypeKind::Tuple(def) => def.items.len(),
+89            TypeKind::Struct(def) | TypeKind::Contract(def) => def.fields.len(),
+90            TypeKind::Enum(_) => 2,
+91            _ => unreachable!(),
+92        }
+93    }
+94
+95    pub fn enum_disc_type(self, db: &dyn MirDb) -> TypeId {
+96        let kind = match &self.deref(db).data(db).kind {
+97            TypeKind::Enum(def) => def.tag_type(),
+98            _ => unreachable!(),
+99        };
+100        let analyzer_type = match kind {
+101            TypeKind::U8 => Some(analyzer_types::Integer::U8),
+102            TypeKind::U16 => Some(analyzer_types::Integer::U16),
+103            TypeKind::U32 => Some(analyzer_types::Integer::U32),
+104            TypeKind::U64 => Some(analyzer_types::Integer::U64),
+105            TypeKind::U128 => Some(analyzer_types::Integer::U128),
+106            TypeKind::U256 => Some(analyzer_types::Integer::U256),
+107            _ => None,
+108        }
+109        .map(|int| analyzer_types::TypeId::int(db.upcast(), int));
+110
+111        db.mir_intern_type(Type::new(kind, analyzer_type).into())
+112    }
+113
+114    pub fn enum_data_offset(self, db: &dyn MirDb, slot_size: usize) -> usize {
+115        match &self.data(db).kind {
+116            TypeKind::Enum(def) => {
+117                let disc_size = self.enum_disc_type(db).size_of(db, slot_size);
+118                let mut align = 1;
+119                for variant in def.variants.iter() {
+120                    let variant_align = variant.ty.align_of(db, slot_size);
+121                    align = num_integer::lcm(align, variant_align);
+122                }
+123                round_up(disc_size, align)
+124            }
+125            _ => unreachable!(),
+126        }
+127    }
+128
+129    pub fn enum_variant_type(self, db: &dyn MirDb, variant_id: EnumVariantId) -> TypeId {
+130        let name = variant_id.name(db.upcast());
+131        match &self.deref(db).data(db).kind {
+132            TypeKind::Enum(def) => def
+133                .variants
+134                .iter()
+135                .find(|variant| variant.name == name)
+136                .map(|variant| variant.ty)
+137                .unwrap(),
+138            _ => unreachable!(),
+139        }
+140    }
+141
+142    pub fn index_from_fname(self, db: &dyn MirDb, fname: &str) -> BigInt {
+143        let ty = self.deref(db);
+144        match &ty.data(db).kind {
+145            TypeKind::Tuple(_) => {
+146                // TODO: Fix this when the syntax for tuple access changes.
+147                let index_str = &fname[4..];
+148                BigInt::from_str(index_str).unwrap()
+149            }
+150
+151            TypeKind::Struct(def) | TypeKind::Contract(def) => def
+152                .fields
+153                .iter()
+154                .enumerate()
+155                .find_map(|(i, field)| (field.0 == fname).then(|| i.into()))
+156                .unwrap(),
+157
+158            other => unreachable!("{:?} does not have fields", other),
+159        }
+160    }
+161
+162    pub fn is_primitive(self, db: &dyn MirDb) -> bool {
+163        matches!(
+164            &self.data(db).kind,
+165            TypeKind::I8
+166                | TypeKind::I16
+167                | TypeKind::I32
+168                | TypeKind::I64
+169                | TypeKind::I128
+170                | TypeKind::I256
+171                | TypeKind::U8
+172                | TypeKind::U16
+173                | TypeKind::U32
+174                | TypeKind::U64
+175                | TypeKind::U128
+176                | TypeKind::U256
+177                | TypeKind::Bool
+178                | TypeKind::Address
+179                | TypeKind::Unit
+180        )
+181    }
+182
+183    pub fn is_integral(self, db: &dyn MirDb) -> bool {
+184        matches!(
+185            &self.data(db).kind,
+186            TypeKind::I8
+187                | TypeKind::I16
+188                | TypeKind::I32
+189                | TypeKind::I64
+190                | TypeKind::I128
+191                | TypeKind::I256
+192                | TypeKind::U8
+193                | TypeKind::U16
+194                | TypeKind::U32
+195                | TypeKind::U64
+196                | TypeKind::U128
+197                | TypeKind::U256
+198        )
+199    }
+200
+201    pub fn is_address(self, db: &dyn MirDb) -> bool {
+202        matches!(&self.data(db).kind, TypeKind::Address)
+203    }
+204
+205    pub fn is_unit(self, db: &dyn MirDb) -> bool {
+206        matches!(&self.data(db).as_ref().kind, TypeKind::Unit)
+207    }
+208
+209    pub fn is_enum(self, db: &dyn MirDb) -> bool {
+210        matches!(&self.data(db).as_ref().kind, TypeKind::Enum(_))
+211    }
+212
+213    pub fn is_signed(self, db: &dyn MirDb) -> bool {
+214        matches!(
+215            &self.data(db).kind,
+216            TypeKind::I8
+217                | TypeKind::I16
+218                | TypeKind::I32
+219                | TypeKind::I64
+220                | TypeKind::I128
+221                | TypeKind::I256
+222        )
+223    }
+224
+225    /// Returns size of the type in bytes.
+226    pub fn size_of(self, db: &dyn MirDb, slot_size: usize) -> usize {
+227        match &self.data(db).kind {
+228            TypeKind::Bool | TypeKind::I8 | TypeKind::U8 => 1,
+229            TypeKind::I16 | TypeKind::U16 => 2,
+230            TypeKind::I32 | TypeKind::U32 => 4,
+231            TypeKind::I64 | TypeKind::U64 => 8,
+232            TypeKind::I128 | TypeKind::U128 => 16,
+233            TypeKind::String(len) => 32 + len,
+234            TypeKind::MPtr(..)
+235            | TypeKind::SPtr(..)
+236            | TypeKind::I256
+237            | TypeKind::U256
+238            | TypeKind::Map(_) => 32,
+239            TypeKind::Address => 20,
+240            TypeKind::Unit => 0,
+241
+242            TypeKind::Array(def) => array_elem_size_imp(db, def, slot_size) * def.len,
+243
+244            TypeKind::Tuple(def) => {
+245                if def.items.is_empty() {
+246                    return 0;
+247                }
+248                let last_idx = def.items.len() - 1;
+249                self.aggregate_elem_offset(db, last_idx, slot_size)
+250                    + def.items[last_idx].size_of(db, slot_size)
+251            }
+252
+253            TypeKind::Struct(def) | TypeKind::Contract(def) => {
+254                if def.fields.is_empty() {
+255                    return 0;
+256                }
+257                let last_idx = def.fields.len() - 1;
+258                self.aggregate_elem_offset(db, last_idx, slot_size)
+259                    + def.fields[last_idx].1.size_of(db, slot_size)
+260            }
+261
+262            TypeKind::Enum(def) => {
+263                let data_offset = self.enum_data_offset(db, slot_size);
+264                let maximum_data_size = def
+265                    .variants
+266                    .iter()
+267                    .map(|variant| variant.ty.size_of(db, slot_size))
+268                    .max()
+269                    .unwrap_or(0);
+270                data_offset + maximum_data_size
+271            }
+272        }
+273    }
+274
+275    pub fn is_zero_sized(self, db: &dyn MirDb) -> bool {
+276        // It's ok to use 1 as a slot size because slot size doesn't affect whether a
+277        // type is zero sized or not.
+278        self.size_of(db, 1) == 0
+279    }
+280
+281    pub fn align_of(self, db: &dyn MirDb, slot_size: usize) -> usize {
+282        if self.is_primitive(db) {
+283            1
+284        } else {
+285            // TODO: Too naive, we could implement more efficient layout for aggregate
+286            // types.
+287            slot_size
+288        }
+289    }
+290
+291    /// Returns an offset of the element of aggregate type.
+292    pub fn aggregate_elem_offset<T>(self, db: &dyn MirDb, elem_idx: T, slot_size: usize) -> usize
+293    where
+294        T: num_traits::ToPrimitive,
+295    {
+296        debug_assert!(self.is_aggregate(db));
+297        debug_assert!(elem_idx.to_usize().unwrap() < self.aggregate_field_num(db));
+298        let elem_idx = elem_idx.to_usize().unwrap();
+299
+300        if elem_idx == 0 {
+301            return 0;
+302        }
+303
+304        match &self.data(db).kind {
+305            TypeKind::Array(def) => array_elem_size_imp(db, def, slot_size) * elem_idx,
+306            TypeKind::Enum(_) => self.enum_data_offset(db, slot_size),
+307            _ => {
+308                let mut offset = self.aggregate_elem_offset(db, elem_idx - 1, slot_size)
+309                    + self
+310                        .projection_ty_imm(db, elem_idx - 1)
+311                        .size_of(db, slot_size);
+312
+313                let elem_ty = self.projection_ty_imm(db, elem_idx);
+314                if (offset % slot_size + elem_ty.size_of(db, slot_size)) > slot_size {
+315                    offset = round_up(offset, slot_size);
+316                }
+317
+318                round_up(offset, elem_ty.align_of(db, slot_size))
+319            }
+320        }
+321    }
+322
+323    pub fn is_aggregate(self, db: &dyn MirDb) -> bool {
+324        matches!(
+325            &self.data(db).kind,
+326            TypeKind::Array(_)
+327                | TypeKind::Tuple(_)
+328                | TypeKind::Struct(_)
+329                | TypeKind::Enum(_)
+330                | TypeKind::Contract(_)
+331        )
+332    }
+333
+334    pub fn is_struct(self, db: &dyn MirDb) -> bool {
+335        matches!(&self.data(db).as_ref().kind, TypeKind::Struct(_))
+336    }
+337
+338    pub fn is_array(self, db: &dyn MirDb) -> bool {
+339        matches!(&self.data(db).kind, TypeKind::Array(_))
+340    }
+341
+342    pub fn is_string(self, db: &dyn MirDb) -> bool {
+343        matches! {
+344            &self.data(db).kind,
+345            TypeKind::String(_)
+346        }
+347    }
+348
+349    pub fn is_ptr(self, db: &dyn MirDb) -> bool {
+350        self.is_mptr(db) || self.is_sptr(db)
+351    }
+352
+353    pub fn is_mptr(self, db: &dyn MirDb) -> bool {
+354        matches!(self.data(db).kind, TypeKind::MPtr(_))
+355    }
+356
+357    pub fn is_sptr(self, db: &dyn MirDb) -> bool {
+358        matches!(self.data(db).kind, TypeKind::SPtr(_))
+359    }
+360
+361    pub fn is_map(self, db: &dyn MirDb) -> bool {
+362        matches!(self.data(db).kind, TypeKind::Map(_))
+363    }
+364
+365    pub fn is_contract(self, db: &dyn MirDb) -> bool {
+366        matches!(self.data(db).kind, TypeKind::Contract(_))
+367    }
+368
+369    pub fn array_elem_size(self, db: &dyn MirDb, slot_size: usize) -> usize {
+370        let data = self.data(db);
+371        if let TypeKind::Array(def) = &data.kind {
+372            array_elem_size_imp(db, def, slot_size)
+373        } else {
+374            panic!("expected `Array` type; but got {:?}", data.as_ref())
+375        }
+376    }
+377
+378    pub fn print<W: fmt::Write>(&self, db: &dyn MirDb, w: &mut W) -> fmt::Result {
+379        match &self.data(db).kind {
+380            TypeKind::I8 => write!(w, "i8"),
+381            TypeKind::I16 => write!(w, "i16"),
+382            TypeKind::I32 => write!(w, "i32"),
+383            TypeKind::I64 => write!(w, "i64"),
+384            TypeKind::I128 => write!(w, "i128"),
+385            TypeKind::I256 => write!(w, "i256"),
+386            TypeKind::U8 => write!(w, "u8"),
+387            TypeKind::U16 => write!(w, "u16"),
+388            TypeKind::U32 => write!(w, "u32"),
+389            TypeKind::U64 => write!(w, "u64"),
+390            TypeKind::U128 => write!(w, "u128"),
+391            TypeKind::U256 => write!(w, "u256"),
+392            TypeKind::Bool => write!(w, "bool"),
+393            TypeKind::Address => write!(w, "address"),
+394            TypeKind::Unit => write!(w, "()"),
+395            TypeKind::String(size) => write!(w, "Str<{size}>"),
+396            TypeKind::Array(ArrayDef { elem_ty, len }) => {
+397                write!(w, "[")?;
+398                elem_ty.print(db, w)?;
+399                write!(w, "; {len}]")
+400            }
+401            TypeKind::Tuple(TupleDef { items }) => {
+402                write!(w, "(")?;
+403                if items.is_empty() {
+404                    return write!(w, ")");
+405                }
+406
+407                let len = items.len();
+408                for item in &items[0..len - 1] {
+409                    item.print(db, w)?;
+410                    write!(w, ", ")?;
+411                }
+412                items.last().unwrap().print(db, w)?;
+413                write!(w, ")")
+414            }
+415            TypeKind::Struct(def) => {
+416                write!(w, "{}", def.name)
+417            }
+418            TypeKind::Enum(def) => {
+419                write!(w, "{}", def.name)
+420            }
+421            TypeKind::Contract(def) => {
+422                write!(w, "{}", def.name)
+423            }
+424            TypeKind::Map(def) => {
+425                write!(w, "Map<")?;
+426                def.key_ty.print(db, w)?;
+427                write!(w, ",")?;
+428                def.value_ty.print(db, w)?;
+429                write!(w, ">")
+430            }
+431            TypeKind::MPtr(inner) => {
+432                write!(w, "*@m ")?;
+433                inner.print(db, w)
+434            }
+435            TypeKind::SPtr(inner) => {
+436                write!(w, "*@s ")?;
+437                inner.print(db, w)
+438            }
+439        }
+440    }
+441
+442    pub fn as_string(&self, db: &dyn MirDb) -> String {
+443        let mut s = String::new();
+444        self.print(db, &mut s).unwrap();
+445        s
+446    }
+447}
+448
+449fn array_elem_size_imp(db: &dyn MirDb, arr: &ArrayDef, slot_size: usize) -> usize {
+450    let elem_ty = arr.elem_ty;
+451    let elem = elem_ty.size_of(db, slot_size);
+452    let align = if elem_ty.is_address(db) {
+453        slot_size
+454    } else {
+455        elem_ty.align_of(db, slot_size)
+456    };
+457    round_up(elem, align)
+458}
+459
+460fn expect_projection_index(value: &Value) -> usize {
+461    match value {
+462        Value::Immediate { imm, .. } => imm.to_usize().unwrap(),
+463        _ => panic!("given `value` is not an immediate"),
+464    }
+465}
+466
+467fn round_up(value: usize, slot_size: usize) -> usize {
+468    ((value + slot_size - 1) / slot_size) * slot_size
+469}
+470
+471#[cfg(test)]
+472mod tests {
+473    use fe_analyzer::namespace::items::ModuleId;
+474    use fe_common::Span;
+475
+476    use super::*;
+477    use crate::{
+478        db::{MirDb, NewDb},
+479        ir::types::StructDef,
+480    };
+481
+482    #[test]
+483    fn test_primitive_type_info() {
+484        let db = NewDb::default();
+485        let i8 = db.mir_intern_type(Type::new(TypeKind::I8, None).into());
+486        let bool = db.mir_intern_type(Type::new(TypeKind::Bool, None).into());
+487
+488        debug_assert_eq!(i8.size_of(&db, 1), 1);
+489        debug_assert_eq!(i8.size_of(&db, 32), 1);
+490        debug_assert_eq!(i8.align_of(&db, 1), 1);
+491        debug_assert_eq!(i8.align_of(&db, 32), 1);
+492        debug_assert_eq!(bool.size_of(&db, 1), 1);
+493        debug_assert_eq!(bool.size_of(&db, 32), 1);
+494        debug_assert_eq!(i8.align_of(&db, 32), 1);
+495        debug_assert_eq!(i8.align_of(&db, 32), 1);
+496
+497        let u32 = db.mir_intern_type(Type::new(TypeKind::U32, None).into());
+498        debug_assert_eq!(u32.size_of(&db, 1), 4);
+499        debug_assert_eq!(u32.size_of(&db, 32), 4);
+500        debug_assert_eq!(u32.align_of(&db, 32), 1);
+501
+502        let address = db.mir_intern_type(Type::new(TypeKind::Address, None).into());
+503        debug_assert_eq!(address.size_of(&db, 1), 20);
+504        debug_assert_eq!(address.size_of(&db, 32), 20);
+505        debug_assert_eq!(address.align_of(&db, 32), 1);
+506    }
+507
+508    #[test]
+509    fn test_primitive_elem_array_type_info() {
+510        let db = NewDb::default();
+511        let i32 = db.mir_intern_type(Type::new(TypeKind::I32, None).into());
+512
+513        let array_len = 10;
+514        let array_def = ArrayDef {
+515            elem_ty: i32,
+516            len: array_len,
+517        };
+518        let array = db.mir_intern_type(Type::new(TypeKind::Array(array_def), None).into());
+519
+520        let elem_size = array.array_elem_size(&db, 1);
+521        debug_assert_eq!(elem_size, 4);
+522        debug_assert_eq!(array.array_elem_size(&db, 32), elem_size);
+523
+524        debug_assert_eq!(array.size_of(&db, 1), elem_size * array_len);
+525        debug_assert_eq!(array.size_of(&db, 32), elem_size * array_len);
+526        debug_assert_eq!(array.align_of(&db, 1), 1);
+527        debug_assert_eq!(array.align_of(&db, 32), 32);
+528
+529        debug_assert_eq!(array.aggregate_elem_offset(&db, 3, 32), elem_size * 3);
+530        debug_assert_eq!(array.aggregate_elem_offset(&db, 9, 1), elem_size * 9);
+531    }
+532
+533    #[test]
+534    fn test_aggregate_elem_array_type_info() {
+535        let db = NewDb::default();
+536        let i8 = db.mir_intern_type(Type::new(TypeKind::I8, None).into());
+537        let i64 = db.mir_intern_type(Type::new(TypeKind::I64, None).into());
+538        let i128 = db.mir_intern_type(Type::new(TypeKind::I128, None).into());
+539
+540        let fields = vec![
+541            ("".into(), i64),
+542            ("".into(), i64),
+543            ("".into(), i8),
+544            ("".into(), i128),
+545            ("".into(), i8),
+546        ];
+547
+548        let struct_def = StructDef {
+549            name: "".into(),
+550            fields,
+551            span: Span::dummy(),
+552            module_id: ModuleId::from_raw_internal(0),
+553        };
+554        let aggregate = db.mir_intern_type(Type::new(TypeKind::Struct(struct_def), None).into());
+555
+556        let array_len = 10;
+557        let array_def = ArrayDef {
+558            elem_ty: aggregate,
+559            len: array_len,
+560        };
+561        let array = db.mir_intern_type(Type::new(TypeKind::Array(array_def), None).into());
+562
+563        debug_assert_eq!(array.array_elem_size(&db, 1), 34);
+564        debug_assert_eq!(array.array_elem_size(&db, 32), 64);
+565
+566        debug_assert_eq!(array.size_of(&db, 1), 34 * array_len);
+567        debug_assert_eq!(array.size_of(&db, 32), 64 * array_len);
+568
+569        debug_assert_eq!(array.align_of(&db, 1), 1);
+570        debug_assert_eq!(array.align_of(&db, 32), 32);
+571
+572        debug_assert_eq!(array.aggregate_elem_offset(&db, 3, 1), 102);
+573        debug_assert_eq!(array.aggregate_elem_offset(&db, 3, 32), 192);
+574    }
+575
+576    #[test]
+577    fn test_primitive_elem_aggregate_type_info() {
+578        let db = NewDb::default();
+579        let i8 = db.mir_intern_type(Type::new(TypeKind::I8, None).into());
+580        let i64 = db.mir_intern_type(Type::new(TypeKind::I64, None).into());
+581        let i128 = db.mir_intern_type(Type::new(TypeKind::I128, None).into());
+582
+583        let fields = vec![
+584            ("".into(), i64),
+585            ("".into(), i64),
+586            ("".into(), i8),
+587            ("".into(), i128),
+588            ("".into(), i8),
+589        ];
+590
+591        let struct_def = StructDef {
+592            name: "".into(),
+593            fields,
+594            span: Span::dummy(),
+595            module_id: ModuleId::from_raw_internal(0),
+596        };
+597        let aggregate = db.mir_intern_type(Type::new(TypeKind::Struct(struct_def), None).into());
+598
+599        debug_assert_eq!(aggregate.size_of(&db, 1), 34);
+600        debug_assert_eq!(aggregate.size_of(&db, 32), 49);
+601
+602        debug_assert_eq!(aggregate.align_of(&db, 1), 1);
+603        debug_assert_eq!(aggregate.align_of(&db, 32), 32);
+604
+605        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 0, 1), 0);
+606        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 0, 32), 0);
+607        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 3, 1), 17);
+608        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 3, 32), 32);
+609        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 4, 1), 33);
+610        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 4, 32), 48);
+611    }
+612
+613    #[test]
+614    fn test_aggregate_elem_aggregate_type_info() {
+615        let db = NewDb::default();
+616        let i8 = db.mir_intern_type(Type::new(TypeKind::I8, None).into());
+617        let i64 = db.mir_intern_type(Type::new(TypeKind::I64, None).into());
+618        let i128 = db.mir_intern_type(Type::new(TypeKind::I128, None).into());
+619
+620        let fields_inner = vec![
+621            ("".into(), i64),
+622            ("".into(), i64),
+623            ("".into(), i8),
+624            ("".into(), i128),
+625            ("".into(), i8),
+626        ];
+627
+628        let struct_def_inner = StructDef {
+629            name: "".into(),
+630            fields: fields_inner,
+631            span: Span::dummy(),
+632            module_id: ModuleId::from_raw_internal(0),
+633        };
+634        let aggregate_inner =
+635            db.mir_intern_type(Type::new(TypeKind::Struct(struct_def_inner), None).into());
+636
+637        let fields = vec![("".into(), i8), ("".into(), aggregate_inner)];
+638        let struct_def = StructDef {
+639            name: "".into(),
+640            fields,
+641            span: Span::dummy(),
+642            module_id: ModuleId::from_raw_internal(0),
+643        };
+644        let aggregate = db.mir_intern_type(Type::new(TypeKind::Struct(struct_def), None).into());
+645
+646        debug_assert_eq!(aggregate.size_of(&db, 1), 35);
+647        debug_assert_eq!(aggregate.size_of(&db, 32), 81);
+648
+649        debug_assert_eq!(aggregate.align_of(&db, 1), 1);
+650        debug_assert_eq!(aggregate.align_of(&db, 32), 32);
+651
+652        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 0, 1), 0);
+653        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 0, 32), 0);
+654        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 1, 1), 1);
+655        debug_assert_eq!(aggregate.aggregate_elem_offset(&db, 1, 32), 32);
+656    }
+657}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/graphviz/block.rs.html b/compiler-docs/src/fe_mir/graphviz/block.rs.html new file mode 100644 index 0000000000..bf799116e1 --- /dev/null +++ b/compiler-docs/src/fe_mir/graphviz/block.rs.html @@ -0,0 +1,62 @@ +block.rs - source

fe_mir/graphviz/
block.rs

1use std::fmt::Write;
+2
+3use dot2::{label, Id};
+4
+5use crate::{
+6    analysis::ControlFlowGraph,
+7    db::MirDb,
+8    ir::{BasicBlockId, FunctionId},
+9    pretty_print::PrettyPrint,
+10};
+11
+12#[derive(Debug, Clone, Copy)]
+13pub(super) struct BlockNode {
+14    func: FunctionId,
+15    pub block: BasicBlockId,
+16}
+17
+18impl BlockNode {
+19    pub(super) fn new(func: FunctionId, block: BasicBlockId) -> Self {
+20        Self { func, block }
+21    }
+22    pub(super) fn id(self) -> dot2::Result<Id<'static>> {
+23        Id::new(format!("fn{}_bb{}", self.func.0, self.block.index()))
+24    }
+25
+26    pub(super) fn label(self, db: &dyn MirDb) -> label::Text<'static> {
+27        let mut label = r#"<table border="0" cellborder="1" cellspacing="0">"#.to_string();
+28
+29        // Write block header.
+30        write!(
+31            &mut label,
+32            r#"<tr><td bgcolor="gray" align="center" colspan="1">BB{}</td></tr>"#,
+33            self.block.index()
+34        )
+35        .unwrap();
+36
+37        // Write block body.
+38        let func_body = self.func.body(db);
+39        write!(label, r#"<tr><td align="left" balign="left">"#).unwrap();
+40        for inst in func_body.order.iter_inst(self.block) {
+41            let mut inst_string = String::new();
+42            inst.pretty_print(db, &func_body.store, &mut inst_string)
+43                .unwrap();
+44            write!(label, "{}", dot2::escape_html(&inst_string)).unwrap();
+45            write!(label, "<br/>").unwrap();
+46        }
+47        write!(label, r#"</td></tr>"#).unwrap();
+48
+49        write!(label, "</table>").unwrap();
+50
+51        label::Text::HtmlStr(label.into())
+52    }
+53
+54    pub(super) fn succs(self, db: &dyn MirDb) -> Vec<BlockNode> {
+55        let func_body = self.func.body(db);
+56        let cfg = ControlFlowGraph::compute(&func_body);
+57        cfg.succs(self.block)
+58            .iter()
+59            .map(|block| Self::new(self.func, *block))
+60            .collect()
+61    }
+62}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/graphviz/function.rs.html b/compiler-docs/src/fe_mir/graphviz/function.rs.html new file mode 100644 index 0000000000..5002661885 --- /dev/null +++ b/compiler-docs/src/fe_mir/graphviz/function.rs.html @@ -0,0 +1,78 @@ +function.rs - source

fe_mir/graphviz/
function.rs

1use std::fmt::Write;
+2
+3use dot2::{label, Id};
+4
+5use crate::{analysis::ControlFlowGraph, db::MirDb, ir::FunctionId, pretty_print::PrettyPrint};
+6
+7use super::block::BlockNode;
+8
+9#[derive(Debug, Clone, Copy)]
+10pub(super) struct FunctionNode {
+11    pub(super) func: FunctionId,
+12}
+13
+14impl FunctionNode {
+15    pub(super) fn new(func: FunctionId) -> Self {
+16        Self { func }
+17    }
+18
+19    pub(super) fn subgraph_id(self) -> Option<Id<'static>> {
+20        dot2::Id::new(format!("cluster_{}", self.func.0)).ok()
+21    }
+22
+23    pub(super) fn label(self, db: &dyn MirDb) -> label::Text<'static> {
+24        let mut label = self.signature(db);
+25        write!(label, r#"<br/><br align="left"/>"#).unwrap();
+26
+27        // Maps local value id to local name.
+28        let body = self.func.body(db);
+29        for local in body.store.locals() {
+30            local.pretty_print(db, &body.store, &mut label).unwrap();
+31            write!(
+32                label,
+33                r#" =&gt; {}<br align="left"/>"#,
+34                body.store.local_name(*local).unwrap()
+35            )
+36            .unwrap();
+37        }
+38
+39        label::Text::HtmlStr(label.into())
+40    }
+41
+42    pub(super) fn blocks(self, db: &dyn MirDb) -> Vec<BlockNode> {
+43        let body = self.func.body(db);
+44        // We use control flow graph to collect reachable blocks.
+45        let cfg = ControlFlowGraph::compute(&body);
+46        cfg.post_order()
+47            .map(|block| BlockNode::new(self.func, block))
+48            .collect()
+49    }
+50
+51    fn signature(self, db: &dyn MirDb) -> String {
+52        let body = self.func.body(db);
+53
+54        let sig_data = self.func.signature(db);
+55        let mut sig = format!("fn {}(", self.func.debug_name(db));
+56
+57        let params = &sig_data.params;
+58        let param_len = params.len();
+59        for (i, param) in params.iter().enumerate() {
+60            let name = &param.name;
+61            let ty = param.ty;
+62            write!(&mut sig, "{name}: ").unwrap();
+63            ty.pretty_print(db, &body.store, &mut sig).unwrap();
+64            if param_len - 1 != i {
+65                write!(sig, ", ").unwrap();
+66            }
+67        }
+68        write!(sig, ")").unwrap();
+69
+70        let ret_ty = self.func.return_type(db);
+71        if let Some(ret_ty) = ret_ty {
+72            write!(sig, " -> ").unwrap();
+73            ret_ty.pretty_print(db, &body.store, &mut sig).unwrap();
+74        }
+75
+76        dot2::escape_html(&sig)
+77    }
+78}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/graphviz/mod.rs.html b/compiler-docs/src/fe_mir/graphviz/mod.rs.html new file mode 100644 index 0000000000..e5a663daa8 --- /dev/null +++ b/compiler-docs/src/fe_mir/graphviz/mod.rs.html @@ -0,0 +1,22 @@ +mod.rs - source

fe_mir/graphviz/
mod.rs

1use std::io;
+2
+3use fe_analyzer::namespace::items::ModuleId;
+4
+5use crate::db::MirDb;
+6
+7mod block;
+8mod function;
+9mod module;
+10
+11/// Writes mir graphs of functions in a `module`.
+12pub fn write_mir_graphs<W: io::Write>(
+13    db: &dyn MirDb,
+14    module: ModuleId,
+15    w: &mut W,
+16) -> io::Result<()> {
+17    let module_graph = module::ModuleGraph::new(db, module);
+18    dot2::render(&module_graph, w).map_err(|err| match err {
+19        dot2::Error::Io(err) => err,
+20        _ => panic!("invalid graphviz id"),
+21    })
+22}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/graphviz/module.rs.html b/compiler-docs/src/fe_mir/graphviz/module.rs.html new file mode 100644 index 0000000000..a4ed39b9ba --- /dev/null +++ b/compiler-docs/src/fe_mir/graphviz/module.rs.html @@ -0,0 +1,158 @@ +module.rs - source

fe_mir/graphviz/
module.rs

1use dot2::{label::Text, GraphWalk, Id, Kind, Labeller};
+2use fe_analyzer::namespace::items::ModuleId;
+3
+4use crate::{
+5    db::MirDb,
+6    ir::{inst::BranchInfo, FunctionId},
+7    pretty_print::PrettyPrint,
+8};
+9
+10use super::{block::BlockNode, function::FunctionNode};
+11
+12pub(super) struct ModuleGraph<'db> {
+13    db: &'db dyn MirDb,
+14    module: ModuleId,
+15}
+16
+17impl<'db> ModuleGraph<'db> {
+18    pub(super) fn new(db: &'db dyn MirDb, module: ModuleId) -> Self {
+19        Self { db, module }
+20    }
+21}
+22
+23impl<'db> GraphWalk<'db> for ModuleGraph<'db> {
+24    type Node = BlockNode;
+25    type Edge = ModuleGraphEdge;
+26    type Subgraph = FunctionNode;
+27
+28    fn nodes(&self) -> dot2::Nodes<'db, Self::Node> {
+29        let mut nodes = Vec::new();
+30
+31        // Collect function nodes.
+32        for func in self
+33            .db
+34            .mir_lower_module_all_functions(self.module)
+35            .iter()
+36            .map(|id| FunctionNode::new(*id))
+37        {
+38            nodes.extend(func.blocks(self.db).into_iter())
+39        }
+40
+41        nodes.into()
+42    }
+43
+44    fn edges(&self) -> dot2::Edges<'db, Self::Edge> {
+45        let mut edges = vec![];
+46        for func in self.db.mir_lower_module_all_functions(self.module).iter() {
+47            for block in FunctionNode::new(*func).blocks(self.db) {
+48                for succ in block.succs(self.db) {
+49                    let edge = ModuleGraphEdge {
+50                        from: block,
+51                        to: succ,
+52                        func: *func,
+53                    };
+54                    edges.push(edge);
+55                }
+56            }
+57        }
+58
+59        edges.into()
+60    }
+61
+62    fn source(&self, edge: &Self::Edge) -> Self::Node {
+63        edge.from
+64    }
+65
+66    fn target(&self, edge: &Self::Edge) -> Self::Node {
+67        edge.to
+68    }
+69
+70    fn subgraphs(&self) -> dot2::Subgraphs<'db, Self::Subgraph> {
+71        self.db
+72            .mir_lower_module_all_functions(self.module)
+73            .iter()
+74            .map(|id| FunctionNode::new(*id))
+75            .collect::<Vec<_>>()
+76            .into()
+77    }
+78
+79    fn subgraph_nodes(&self, s: &Self::Subgraph) -> dot2::Nodes<'db, Self::Node> {
+80        s.blocks(self.db).into_iter().collect::<Vec<_>>().into()
+81    }
+82}
+83
+84impl<'db> Labeller<'db> for ModuleGraph<'db> {
+85    type Node = BlockNode;
+86    type Edge = ModuleGraphEdge;
+87    type Subgraph = FunctionNode;
+88
+89    fn graph_id(&self) -> dot2::Result<Id<'db>> {
+90        let module_name = self.module.name(self.db.upcast());
+91        dot2::Id::new(module_name.to_string())
+92    }
+93
+94    fn node_id(&self, n: &Self::Node) -> dot2::Result<Id<'db>> {
+95        n.id()
+96    }
+97
+98    fn node_shape(&self, _n: &Self::Node) -> Option<Text<'db>> {
+99        Some(Text::LabelStr("none".into()))
+100    }
+101
+102    fn node_label(&self, n: &Self::Node) -> dot2::Result<Text<'db>> {
+103        Ok(n.label(self.db))
+104    }
+105
+106    fn edge_label<'a>(&self, e: &Self::Edge) -> Text<'db> {
+107        Text::LabelStr(e.label(self.db).into())
+108    }
+109
+110    fn subgraph_id(&self, s: &Self::Subgraph) -> Option<Id<'db>> {
+111        s.subgraph_id()
+112    }
+113
+114    fn subgraph_label(&self, s: &Self::Subgraph) -> Text<'db> {
+115        s.label(self.db)
+116    }
+117
+118    fn kind(&self) -> Kind {
+119        Kind::Digraph
+120    }
+121}
+122
+123#[derive(Debug, Clone)]
+124pub(super) struct ModuleGraphEdge {
+125    from: BlockNode,
+126    to: BlockNode,
+127    func: FunctionId,
+128}
+129
+130impl ModuleGraphEdge {
+131    fn label(&self, db: &dyn MirDb) -> String {
+132        let body = self.func.body(db);
+133        let terminator = body.order.terminator(&body.store, self.from.block).unwrap();
+134        let to = self.to.block;
+135        match body.store.branch_info(terminator) {
+136            BranchInfo::NotBranch => unreachable!(),
+137            BranchInfo::Jump(_) => String::new(),
+138            BranchInfo::Branch(_, true_bb, _) => {
+139                format! {"{}", true_bb == to}
+140            }
+141            BranchInfo::Switch(_, table, default) => {
+142                if default == Some(to) {
+143                    return "*".to_string();
+144                }
+145
+146                for (value, bb) in table.iter() {
+147                    if bb == to {
+148                        let mut s = String::new();
+149                        value.pretty_print(db, &body.store, &mut s).unwrap();
+150                        return s;
+151                    }
+152                }
+153
+154                unreachable!()
+155            }
+156        }
+157    }
+158}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/basic_block.rs.html b/compiler-docs/src/fe_mir/ir/basic_block.rs.html new file mode 100644 index 0000000000..1d18d6be66 --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/basic_block.rs.html @@ -0,0 +1,6 @@ +basic_block.rs - source

fe_mir/ir/
basic_block.rs

1use id_arena::Id;
+2
+3pub type BasicBlockId = Id<BasicBlock>;
+4
+5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+6pub struct BasicBlock {}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/body_builder.rs.html b/compiler-docs/src/fe_mir/ir/body_builder.rs.html new file mode 100644 index 0000000000..a720a09181 --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/body_builder.rs.html @@ -0,0 +1,381 @@ +body_builder.rs - source

fe_mir/ir/
body_builder.rs

1use fe_analyzer::namespace::items::ContractId;
+2use num_bigint::BigInt;
+3
+4use crate::ir::{
+5    body_cursor::{BodyCursor, CursorLocation},
+6    inst::{BinOp, Inst, InstKind, UnOp},
+7    value::{AssignableValue, Local},
+8    BasicBlock, BasicBlockId, FunctionBody, FunctionId, InstId, SourceInfo, TypeId,
+9};
+10
+11use super::{
+12    inst::{CallType, CastKind, SwitchTable, YulIntrinsicOp},
+13    ConstantId, Value, ValueId,
+14};
+15
+16#[derive(Debug)]
+17pub struct BodyBuilder {
+18    pub body: FunctionBody,
+19    loc: CursorLocation,
+20}
+21
+22macro_rules! impl_unary_inst {
+23    ($name:ident, $code:path) => {
+24        pub fn $name(&mut self, value: ValueId, source: SourceInfo) -> InstId {
+25            let inst = Inst::unary($code, value, source);
+26            self.insert_inst(inst)
+27        }
+28    };
+29}
+30
+31macro_rules! impl_binary_inst {
+32    ($name:ident, $code:path) => {
+33        pub fn $name(&mut self, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> InstId {
+34            let inst = Inst::binary($code, lhs, rhs, source);
+35            self.insert_inst(inst)
+36        }
+37    };
+38}
+39
+40impl BodyBuilder {
+41    pub fn new(fid: FunctionId, source: SourceInfo) -> Self {
+42        let body = FunctionBody::new(fid, source);
+43        let entry_block = body.order.entry();
+44        Self {
+45            body,
+46            loc: CursorLocation::BlockTop(entry_block),
+47        }
+48    }
+49
+50    pub fn build(self) -> FunctionBody {
+51        self.body
+52    }
+53
+54    pub fn func_id(&self) -> FunctionId {
+55        self.body.fid
+56    }
+57
+58    pub fn make_block(&mut self) -> BasicBlockId {
+59        let block = BasicBlock {};
+60        let block_id = self.body.store.store_block(block);
+61        self.body.order.append_block(block_id);
+62        block_id
+63    }
+64
+65    pub fn make_value(&mut self, value: impl Into<Value>) -> ValueId {
+66        self.body.store.store_value(value.into())
+67    }
+68
+69    pub fn map_result(&mut self, inst: InstId, result: AssignableValue) {
+70        self.body.store.map_result(inst, result)
+71    }
+72
+73    pub fn inst_result(&mut self, inst: InstId) -> Option<&AssignableValue> {
+74        self.body.store.inst_result(inst)
+75    }
+76
+77    pub fn move_to_block(&mut self, block: BasicBlockId) {
+78        self.loc = CursorLocation::BlockBottom(block)
+79    }
+80
+81    pub fn move_to_block_top(&mut self, block: BasicBlockId) {
+82        self.loc = CursorLocation::BlockTop(block)
+83    }
+84
+85    pub fn make_unit(&mut self, unit_ty: TypeId) -> ValueId {
+86        self.body.store.store_value(Value::Unit { ty: unit_ty })
+87    }
+88
+89    pub fn make_imm(&mut self, imm: BigInt, ty: TypeId) -> ValueId {
+90        self.body.store.store_value(Value::Immediate { imm, ty })
+91    }
+92
+93    pub fn make_imm_from_bool(&mut self, imm: bool, ty: TypeId) -> ValueId {
+94        if imm {
+95            self.make_imm(1u8.into(), ty)
+96        } else {
+97            self.make_imm(0u8.into(), ty)
+98        }
+99    }
+100
+101    pub fn make_constant(&mut self, constant: ConstantId, ty: TypeId) -> ValueId {
+102        self.body
+103            .store
+104            .store_value(Value::Constant { constant, ty })
+105    }
+106
+107    pub fn declare(&mut self, local: Local) -> ValueId {
+108        let source = local.source.clone();
+109        let local_id = self.body.store.store_value(Value::Local(local));
+110
+111        let kind = InstKind::Declare { local: local_id };
+112        let inst = Inst::new(kind, source);
+113        self.insert_inst(inst);
+114        local_id
+115    }
+116
+117    pub fn store_func_arg(&mut self, local: Local) -> ValueId {
+118        self.body.store.store_value(Value::Local(local))
+119    }
+120
+121    impl_unary_inst!(not, UnOp::Not);
+122    impl_unary_inst!(neg, UnOp::Neg);
+123    impl_unary_inst!(inv, UnOp::Inv);
+124
+125    impl_binary_inst!(add, BinOp::Add);
+126    impl_binary_inst!(sub, BinOp::Sub);
+127    impl_binary_inst!(mul, BinOp::Mul);
+128    impl_binary_inst!(div, BinOp::Div);
+129    impl_binary_inst!(modulo, BinOp::Mod);
+130    impl_binary_inst!(pow, BinOp::Pow);
+131    impl_binary_inst!(shl, BinOp::Shl);
+132    impl_binary_inst!(shr, BinOp::Shr);
+133    impl_binary_inst!(bit_or, BinOp::BitOr);
+134    impl_binary_inst!(bit_xor, BinOp::BitXor);
+135    impl_binary_inst!(bit_and, BinOp::BitAnd);
+136    impl_binary_inst!(logical_and, BinOp::LogicalAnd);
+137    impl_binary_inst!(logical_or, BinOp::LogicalOr);
+138    impl_binary_inst!(eq, BinOp::Eq);
+139    impl_binary_inst!(ne, BinOp::Ne);
+140    impl_binary_inst!(ge, BinOp::Ge);
+141    impl_binary_inst!(gt, BinOp::Gt);
+142    impl_binary_inst!(le, BinOp::Le);
+143    impl_binary_inst!(lt, BinOp::Lt);
+144
+145    pub fn primitive_cast(
+146        &mut self,
+147        value: ValueId,
+148        result_ty: TypeId,
+149        source: SourceInfo,
+150    ) -> InstId {
+151        let kind = InstKind::Cast {
+152            kind: CastKind::Primitive,
+153            value,
+154            to: result_ty,
+155        };
+156        let inst = Inst::new(kind, source);
+157        self.insert_inst(inst)
+158    }
+159
+160    pub fn untag_cast(&mut self, value: ValueId, result_ty: TypeId, source: SourceInfo) -> InstId {
+161        let kind = InstKind::Cast {
+162            kind: CastKind::Untag,
+163            value,
+164            to: result_ty,
+165        };
+166        let inst = Inst::new(kind, source);
+167        self.insert_inst(inst)
+168    }
+169
+170    pub fn aggregate_construct(
+171        &mut self,
+172        ty: TypeId,
+173        args: Vec<ValueId>,
+174        source: SourceInfo,
+175    ) -> InstId {
+176        let kind = InstKind::AggregateConstruct { ty, args };
+177        let inst = Inst::new(kind, source);
+178        self.insert_inst(inst)
+179    }
+180
+181    pub fn bind(&mut self, src: ValueId, source: SourceInfo) -> InstId {
+182        let kind = InstKind::Bind { src };
+183        let inst = Inst::new(kind, source);
+184        self.insert_inst(inst)
+185    }
+186
+187    pub fn mem_copy(&mut self, src: ValueId, source: SourceInfo) -> InstId {
+188        let kind = InstKind::MemCopy { src };
+189        let inst = Inst::new(kind, source);
+190        self.insert_inst(inst)
+191    }
+192
+193    pub fn load(&mut self, src: ValueId, source: SourceInfo) -> InstId {
+194        let kind = InstKind::Load { src };
+195        let inst = Inst::new(kind, source);
+196        self.insert_inst(inst)
+197    }
+198
+199    pub fn aggregate_access(
+200        &mut self,
+201        value: ValueId,
+202        indices: Vec<ValueId>,
+203        source: SourceInfo,
+204    ) -> InstId {
+205        let kind = InstKind::AggregateAccess { value, indices };
+206        let inst = Inst::new(kind, source);
+207        self.insert_inst(inst)
+208    }
+209
+210    pub fn map_access(&mut self, value: ValueId, key: ValueId, source: SourceInfo) -> InstId {
+211        let kind = InstKind::MapAccess { value, key };
+212        let inst = Inst::new(kind, source);
+213        self.insert_inst(inst)
+214    }
+215
+216    pub fn call(
+217        &mut self,
+218        func: FunctionId,
+219        args: Vec<ValueId>,
+220        call_type: CallType,
+221        source: SourceInfo,
+222    ) -> InstId {
+223        let kind = InstKind::Call {
+224            func,
+225            args,
+226            call_type,
+227        };
+228        let inst = Inst::new(kind, source);
+229        self.insert_inst(inst)
+230    }
+231
+232    pub fn keccak256(&mut self, arg: ValueId, source: SourceInfo) -> InstId {
+233        let kind = InstKind::Keccak256 { arg };
+234        let inst = Inst::new(kind, source);
+235        self.insert_inst(inst)
+236    }
+237
+238    pub fn abi_encode(&mut self, arg: ValueId, source: SourceInfo) -> InstId {
+239        let kind = InstKind::AbiEncode { arg };
+240        let inst = Inst::new(kind, source);
+241        self.insert_inst(inst)
+242    }
+243
+244    pub fn create(&mut self, value: ValueId, contract: ContractId, source: SourceInfo) -> InstId {
+245        let kind = InstKind::Create { value, contract };
+246        let inst = Inst::new(kind, source);
+247        self.insert_inst(inst)
+248    }
+249
+250    pub fn create2(
+251        &mut self,
+252        value: ValueId,
+253        salt: ValueId,
+254        contract: ContractId,
+255        source: SourceInfo,
+256    ) -> InstId {
+257        let kind = InstKind::Create2 {
+258            value,
+259            salt,
+260            contract,
+261        };
+262        let inst = Inst::new(kind, source);
+263        self.insert_inst(inst)
+264    }
+265
+266    pub fn yul_intrinsic(
+267        &mut self,
+268        op: YulIntrinsicOp,
+269        args: Vec<ValueId>,
+270        source: SourceInfo,
+271    ) -> InstId {
+272        let inst = Inst::intrinsic(op, args, source);
+273        self.insert_inst(inst)
+274    }
+275
+276    pub fn jump(&mut self, dest: BasicBlockId, source: SourceInfo) -> InstId {
+277        let kind = InstKind::Jump { dest };
+278        let inst = Inst::new(kind, source);
+279        self.insert_inst(inst)
+280    }
+281
+282    pub fn branch(
+283        &mut self,
+284        cond: ValueId,
+285        then: BasicBlockId,
+286        else_: BasicBlockId,
+287        source: SourceInfo,
+288    ) -> InstId {
+289        let kind = InstKind::Branch { cond, then, else_ };
+290        let inst = Inst::new(kind, source);
+291        self.insert_inst(inst)
+292    }
+293
+294    pub fn switch(
+295        &mut self,
+296        disc: ValueId,
+297        table: SwitchTable,
+298        default: Option<BasicBlockId>,
+299        source: SourceInfo,
+300    ) -> InstId {
+301        let kind = InstKind::Switch {
+302            disc,
+303            table,
+304            default,
+305        };
+306        let inst = Inst::new(kind, source);
+307        self.insert_inst(inst)
+308    }
+309
+310    pub fn revert(&mut self, arg: Option<ValueId>, source: SourceInfo) -> InstId {
+311        let kind = InstKind::Revert { arg };
+312        let inst = Inst::new(kind, source);
+313        self.insert_inst(inst)
+314    }
+315
+316    pub fn emit(&mut self, arg: ValueId, source: SourceInfo) -> InstId {
+317        let kind = InstKind::Emit { arg };
+318        let inst = Inst::new(kind, source);
+319        self.insert_inst(inst)
+320    }
+321
+322    pub fn ret(&mut self, arg: ValueId, source: SourceInfo) -> InstId {
+323        let kind = InstKind::Return { arg: arg.into() };
+324        let inst = Inst::new(kind, source);
+325        self.insert_inst(inst)
+326    }
+327
+328    pub fn nop(&mut self, source: SourceInfo) -> InstId {
+329        let kind = InstKind::Nop;
+330        let inst = Inst::new(kind, source);
+331        self.insert_inst(inst)
+332    }
+333
+334    pub fn value_ty(&mut self, value: ValueId) -> TypeId {
+335        self.body.store.value_ty(value)
+336    }
+337
+338    pub fn value_data(&mut self, value: ValueId) -> &Value {
+339        self.body.store.value_data(value)
+340    }
+341
+342    /// Returns `true` if current block is terminated.
+343    pub fn is_block_terminated(&mut self, block: BasicBlockId) -> bool {
+344        self.body.order.is_terminated(&self.body.store, block)
+345    }
+346
+347    pub fn is_current_block_terminated(&mut self) -> bool {
+348        let current_block = self.current_block();
+349        self.is_block_terminated(current_block)
+350    }
+351
+352    pub fn current_block(&mut self) -> BasicBlockId {
+353        self.cursor().expect_block()
+354    }
+355
+356    pub fn remove_inst(&mut self, inst: InstId) {
+357        let mut cursor = BodyCursor::new(&mut self.body, CursorLocation::Inst(inst));
+358        if self.loc == cursor.loc() {
+359            self.loc = cursor.prev_loc();
+360        }
+361        cursor.remove_inst();
+362    }
+363
+364    pub fn inst_data(&self, inst: InstId) -> &Inst {
+365        self.body.store.inst_data(inst)
+366    }
+367
+368    fn insert_inst(&mut self, inst: Inst) -> InstId {
+369        let mut cursor = self.cursor();
+370        let inst_id = cursor.store_and_insert_inst(inst);
+371
+372        // Set cursor to the new inst.
+373        self.loc = CursorLocation::Inst(inst_id);
+374
+375        inst_id
+376    }
+377
+378    fn cursor(&mut self) -> BodyCursor {
+379        BodyCursor::new(&mut self.body, self.loc)
+380    }
+381}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/body_cursor.rs.html b/compiler-docs/src/fe_mir/ir/body_cursor.rs.html new file mode 100644 index 0000000000..695e29c678 --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/body_cursor.rs.html @@ -0,0 +1,231 @@ +body_cursor.rs - source

fe_mir/ir/
body_cursor.rs

1//! This module provides a collection of structs to modify function body
+2//! in-place.
+3// The design used here is greatly inspired by [`cranelift`](https://crates.io/crates/cranelift)
+4
+5use super::{
+6    value::AssignableValue, BasicBlock, BasicBlockId, FunctionBody, Inst, InstId, ValueId,
+7};
+8
+9/// Specify a current location of [`BodyCursor`]
+10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+11pub enum CursorLocation {
+12    Inst(InstId),
+13    BlockTop(BasicBlockId),
+14    BlockBottom(BasicBlockId),
+15    NoWhere,
+16}
+17
+18pub struct BodyCursor<'a> {
+19    body: &'a mut FunctionBody,
+20    loc: CursorLocation,
+21}
+22
+23impl<'a> BodyCursor<'a> {
+24    pub fn new(body: &'a mut FunctionBody, loc: CursorLocation) -> Self {
+25        Self { body, loc }
+26    }
+27
+28    pub fn new_at_entry(body: &'a mut FunctionBody) -> Self {
+29        let entry = body.order.entry();
+30        Self {
+31            body,
+32            loc: CursorLocation::BlockTop(entry),
+33        }
+34    }
+35    pub fn set_loc(&mut self, loc: CursorLocation) {
+36        self.loc = loc;
+37    }
+38
+39    pub fn loc(&self) -> CursorLocation {
+40        self.loc
+41    }
+42
+43    pub fn next_loc(&self) -> CursorLocation {
+44        match self.loc() {
+45            CursorLocation::Inst(inst) => self.body.order.next_inst(inst).map_or_else(
+46                || CursorLocation::BlockBottom(self.body.order.inst_block(inst)),
+47                CursorLocation::Inst,
+48            ),
+49            CursorLocation::BlockTop(block) => self
+50                .body
+51                .order
+52                .first_inst(block)
+53                .map_or_else(|| CursorLocation::BlockBottom(block), CursorLocation::Inst),
+54            CursorLocation::BlockBottom(block) => self
+55                .body()
+56                .order
+57                .next_block(block)
+58                .map_or(CursorLocation::NoWhere, |next_block| {
+59                    CursorLocation::BlockTop(next_block)
+60                }),
+61            CursorLocation::NoWhere => CursorLocation::NoWhere,
+62        }
+63    }
+64
+65    pub fn prev_loc(&self) -> CursorLocation {
+66        match self.loc() {
+67            CursorLocation::Inst(inst) => self.body.order.prev_inst(inst).map_or_else(
+68                || CursorLocation::BlockTop(self.body.order.inst_block(inst)),
+69                CursorLocation::Inst,
+70            ),
+71            CursorLocation::BlockTop(block) => self
+72                .body
+73                .order
+74                .prev_block(block)
+75                .map_or(CursorLocation::NoWhere, |prev_block| {
+76                    CursorLocation::BlockBottom(prev_block)
+77                }),
+78            CursorLocation::BlockBottom(block) => self
+79                .body
+80                .order
+81                .last_inst(block)
+82                .map_or_else(|| CursorLocation::BlockTop(block), CursorLocation::Inst),
+83            CursorLocation::NoWhere => CursorLocation::NoWhere,
+84        }
+85    }
+86
+87    pub fn next_block(&self) -> Option<BasicBlockId> {
+88        let block = self.expect_block();
+89        self.body.order.next_block(block)
+90    }
+91
+92    pub fn prev_block(&self) -> Option<BasicBlockId> {
+93        let block = self.expect_block();
+94        self.body.order.prev_block(block)
+95    }
+96
+97    pub fn proceed(&mut self) {
+98        self.set_loc(self.next_loc())
+99    }
+100
+101    pub fn back(&mut self) {
+102        self.set_loc(self.prev_loc());
+103    }
+104
+105    pub fn body(&self) -> &FunctionBody {
+106        self.body
+107    }
+108
+109    pub fn body_mut(&mut self) -> &mut FunctionBody {
+110        self.body
+111    }
+112
+113    /// Sets a cursor to an entry block.
+114    pub fn set_to_entry(&mut self) {
+115        let entry_bb = self.body().order.entry();
+116        let loc = CursorLocation::BlockTop(entry_bb);
+117        self.set_loc(loc);
+118    }
+119
+120    /// Insert [`InstId`] to a location where a cursor points.
+121    /// If you need to store and insert [`Inst`], use [`store_and_insert_inst`].
+122    ///
+123    /// # Panics
+124    /// Panics if a cursor points [`CursorLocation::NoWhere`].
+125    pub fn insert_inst(&mut self, inst: InstId) {
+126        match self.loc() {
+127            CursorLocation::Inst(at) => self.body.order.insert_inst_after(inst, at),
+128            CursorLocation::BlockTop(block) => self.body.order.prepend_inst(inst, block),
+129            CursorLocation::BlockBottom(block) => self.body.order.append_inst(inst, block),
+130            CursorLocation::NoWhere => panic!("cursor loc points to `NoWhere`"),
+131        }
+132    }
+133
+134    pub fn store_and_insert_inst(&mut self, data: Inst) -> InstId {
+135        let inst = self.body.store.store_inst(data);
+136        self.insert_inst(inst);
+137        inst
+138    }
+139
+140    /// Remove a current pointed [`Inst`] from a function body. A cursor
+141    /// proceeds to a next inst.
+142    ///
+143    /// # Panics
+144    /// Panics if a cursor doesn't point [`CursorLocation::Inst`].
+145    pub fn remove_inst(&mut self) {
+146        let inst = self.expect_inst();
+147        let next_loc = self.next_loc();
+148        self.body.order.remove_inst(inst);
+149        self.set_loc(next_loc);
+150    }
+151
+152    /// Remove a current pointed `block` and contained insts from a function
+153    /// body. A cursor proceeds to a next block.
+154    ///
+155    /// # Panics
+156    /// Panics if a cursor doesn't point [`CursorLocation::Inst`].
+157    pub fn remove_block(&mut self) {
+158        let block = match self.loc() {
+159            CursorLocation::Inst(inst) => self.body.order.inst_block(inst),
+160            CursorLocation::BlockTop(block) | CursorLocation::BlockBottom(block) => block,
+161            CursorLocation::NoWhere => panic!("cursor loc points `NoWhere`"),
+162        };
+163
+164        // Store next block of the current block for later use.
+165        let next_block = self.body.order.next_block(block);
+166
+167        // Remove all insts in the current block.
+168        if let Some(first_inst) = self.body.order.first_inst(block) {
+169            self.set_loc(CursorLocation::Inst(first_inst));
+170            while matches!(self.loc(), CursorLocation::Inst(..)) {
+171                self.remove_inst();
+172            }
+173        }
+174        // Remove current block.
+175        self.body.order.remove_block(block);
+176
+177        // Set cursor location to next block if exists.
+178        if let Some(next_block) = next_block {
+179            self.set_loc(CursorLocation::BlockTop(next_block))
+180        } else {
+181            self.set_loc(CursorLocation::NoWhere)
+182        }
+183    }
+184
+185    /// Insert [`BasicBlockId`] to a location where a cursor points.
+186    /// If you need to store and insert [`BasicBlock`], use
+187    /// [`store_and_insert_block`].
+188    ///
+189    /// # Panics
+190    /// Panics if a cursor points [`CursorLocation::NoWhere`].
+191    pub fn insert_block(&mut self, block: BasicBlockId) {
+192        let current = self.expect_block();
+193        self.body.order.insert_block_after_block(block, current)
+194    }
+195
+196    pub fn store_and_insert_block(&mut self, block: BasicBlock) -> BasicBlockId {
+197        let block_id = self.body.store.store_block(block);
+198        self.insert_block(block_id);
+199        block_id
+200    }
+201
+202    pub fn map_result(&mut self, result: AssignableValue) -> Option<ValueId> {
+203        let inst = self.expect_inst();
+204        let result_value = result.value_id();
+205        self.body.store.map_result(inst, result);
+206        result_value
+207    }
+208
+209    /// Returns current inst that cursor points.
+210    ///
+211    /// # Panics
+212    /// Panics if a cursor doesn't point [`CursorLocation::Inst`].
+213    pub fn expect_inst(&self) -> InstId {
+214        match self.loc {
+215            CursorLocation::Inst(inst) => inst,
+216            _ => panic!("Cursor doesn't point any inst."),
+217        }
+218    }
+219
+220    /// Returns current block that cursor points.
+221    ///
+222    /// # Panics
+223    /// Panics if a cursor points [`CursorLocation::NoWhere`].
+224    pub fn expect_block(&self) -> BasicBlockId {
+225        match self.loc {
+226            CursorLocation::Inst(inst) => self.body.order.inst_block(inst),
+227            CursorLocation::BlockTop(block) | CursorLocation::BlockBottom(block) => block,
+228            CursorLocation::NoWhere => panic!("cursor loc points `NoWhere`"),
+229        }
+230    }
+231}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/body_order.rs.html b/compiler-docs/src/fe_mir/ir/body_order.rs.html new file mode 100644 index 0000000000..e9a538b3a1 --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/body_order.rs.html @@ -0,0 +1,473 @@ +body_order.rs - source

fe_mir/ir/
body_order.rs

1use fxhash::FxHashMap;
+2
+3use super::{basic_block::BasicBlockId, function::BodyDataStore, inst::InstId};
+4
+5#[derive(Debug, Clone, PartialEq, Eq)]
+6/// Represents basic block order and instruction order.
+7pub struct BodyOrder {
+8    blocks: FxHashMap<BasicBlockId, BlockNode>,
+9    insts: FxHashMap<InstId, InstNode>,
+10    entry_block: BasicBlockId,
+11    last_block: BasicBlockId,
+12}
+13impl BodyOrder {
+14    pub fn new(entry_block: BasicBlockId) -> Self {
+15        let entry_block_node = BlockNode::default();
+16        let mut blocks = FxHashMap::default();
+17        blocks.insert(entry_block, entry_block_node);
+18
+19        Self {
+20            blocks,
+21            insts: FxHashMap::default(),
+22            entry_block,
+23            last_block: entry_block,
+24        }
+25    }
+26
+27    /// Returns an entry block of a function body.
+28    pub fn entry(&self) -> BasicBlockId {
+29        self.entry_block
+30    }
+31
+32    /// Returns a last block of a function body.
+33    pub fn last_block(&self) -> BasicBlockId {
+34        self.last_block
+35    }
+36
+37    /// Returns `true` if a block doesn't contain any block.
+38    pub fn is_block_empty(&self, block: BasicBlockId) -> bool {
+39        self.first_inst(block).is_none()
+40    }
+41
+42    /// Returns `true` if a function body contains a given `block`.
+43    pub fn is_block_inserted(&self, block: BasicBlockId) -> bool {
+44        self.blocks.contains_key(&block)
+45    }
+46
+47    /// Returns a number of block in a function.
+48    pub fn block_num(&self) -> usize {
+49        self.blocks.len()
+50    }
+51
+52    /// Returns a previous block of a given block.
+53    ///
+54    /// # Panics
+55    /// Panics if `block` is not inserted yet.
+56    pub fn prev_block(&self, block: BasicBlockId) -> Option<BasicBlockId> {
+57        self.blocks[&block].prev
+58    }
+59
+60    /// Returns a next block of a given block.
+61    ///
+62    /// # Panics
+63    /// Panics if `block` is not inserted yet.
+64    pub fn next_block(&self, block: BasicBlockId) -> Option<BasicBlockId> {
+65        self.blocks[&block].next
+66    }
+67
+68    /// Returns `true` is a given `inst` is inserted.
+69    pub fn is_inst_inserted(&self, inst: InstId) -> bool {
+70        self.insts.contains_key(&inst)
+71    }
+72
+73    /// Returns first instruction of a block if exists.
+74    ///
+75    /// # Panics
+76    /// Panics if `block` is not inserted yet.
+77    pub fn first_inst(&self, block: BasicBlockId) -> Option<InstId> {
+78        self.blocks[&block].first_inst
+79    }
+80
+81    /// Returns a terminator instruction of a block.
+82    ///
+83    /// # Panics
+84    /// Panics if
+85    /// 1. `block` is not inserted yet.
+86    pub fn terminator(&self, store: &BodyDataStore, block: BasicBlockId) -> Option<InstId> {
+87        let last_inst = self.last_inst(block)?;
+88        if store.is_terminator(last_inst) {
+89            Some(last_inst)
+90        } else {
+91            None
+92        }
+93    }
+94
+95    /// Returns `true` if a `block` is terminated.
+96    pub fn is_terminated(&self, store: &BodyDataStore, block: BasicBlockId) -> bool {
+97        self.terminator(store, block).is_some()
+98    }
+99
+100    /// Returns a last instruction of a block.
+101    ///
+102    /// # Panics
+103    /// Panics if `block` is not inserted yet.
+104    pub fn last_inst(&self, block: BasicBlockId) -> Option<InstId> {
+105        self.blocks[&block].last_inst
+106    }
+107
+108    /// Returns a previous instruction of a given `inst`.
+109    ///
+110    /// # Panics
+111    /// Panics if `inst` is not inserted yet.
+112    pub fn prev_inst(&self, inst: InstId) -> Option<InstId> {
+113        self.insts[&inst].prev
+114    }
+115
+116    /// Returns a next instruction of a given `inst`.
+117    ///
+118    /// # Panics
+119    /// Panics if `inst` is not inserted yet.
+120    pub fn next_inst(&self, inst: InstId) -> Option<InstId> {
+121        self.insts[&inst].next
+122    }
+123
+124    /// Returns a block to which a given `inst` belongs.
+125    ///
+126    /// # Panics
+127    /// Panics if `inst` is not inserted yet.
+128    pub fn inst_block(&self, inst: InstId) -> BasicBlockId {
+129        self.insts[&inst].block
+130    }
+131
+132    /// Returns an iterator which iterates all basic blocks in a function body
+133    /// in pre-order.
+134    pub fn iter_block(&self) -> impl Iterator<Item = BasicBlockId> + '_ {
+135        BlockIter {
+136            next: Some(self.entry_block),
+137            blocks: &self.blocks,
+138        }
+139    }
+140
+141    /// Returns an iterator which iterates all instruction in a given `block` in
+142    /// pre-order.
+143    ///
+144    /// # Panics
+145    /// Panics if `block` is not inserted yet.
+146    pub fn iter_inst(&self, block: BasicBlockId) -> impl Iterator<Item = InstId> + '_ {
+147        InstIter {
+148            next: self.blocks[&block].first_inst,
+149            insts: &self.insts,
+150        }
+151    }
+152
+153    /// Appends a given `block` to a function body.
+154    ///
+155    /// # Panics
+156    /// Panics if a given `block` is already inserted to a function.
+157    pub fn append_block(&mut self, block: BasicBlockId) {
+158        debug_assert!(!self.is_block_inserted(block));
+159
+160        let mut block_node = BlockNode::default();
+161        let last_block = self.last_block;
+162        let last_block_node = &mut self.block_mut(last_block);
+163        last_block_node.next = Some(block);
+164        block_node.prev = Some(last_block);
+165
+166        self.blocks.insert(block, block_node);
+167        self.last_block = block;
+168    }
+169
+170    /// Inserts a given `block` before a `before` block.
+171    ///
+172    /// # Panics
+173    /// Panics if
+174    /// 1. a given `block` is already inserted.
+175    /// 2. a given `before` block is NOTE inserted yet.
+176    pub fn insert_block_before_block(&mut self, block: BasicBlockId, before: BasicBlockId) {
+177        debug_assert!(self.is_block_inserted(before));
+178        debug_assert!(!self.is_block_inserted(block));
+179
+180        let mut block_node = BlockNode::default();
+181
+182        match self.blocks[&before].prev {
+183            Some(prev) => {
+184                block_node.prev = Some(prev);
+185                self.block_mut(prev).next = Some(block);
+186            }
+187            None => self.entry_block = block,
+188        }
+189
+190        block_node.next = Some(before);
+191        self.block_mut(before).prev = Some(block);
+192        self.blocks.insert(block, block_node);
+193    }
+194
+195    /// Inserts a given `block` after a `after` block.
+196    ///
+197    /// # Panics
+198    /// Panics if
+199    /// 1. a given `block` is already inserted.
+200    /// 2. a given `after` block is NOTE inserted yet.
+201    pub fn insert_block_after_block(&mut self, block: BasicBlockId, after: BasicBlockId) {
+202        debug_assert!(self.is_block_inserted(after));
+203        debug_assert!(!self.is_block_inserted(block));
+204
+205        let mut block_node = BlockNode::default();
+206
+207        match self.blocks[&after].next {
+208            Some(next) => {
+209                block_node.next = Some(next);
+210                self.block_mut(next).prev = Some(block);
+211            }
+212            None => self.last_block = block,
+213        }
+214        block_node.prev = Some(after);
+215        self.block_mut(after).next = Some(block);
+216        self.blocks.insert(block, block_node);
+217    }
+218
+219    /// Remove a given `block` from a function. All instructions in a block are
+220    /// also removed.
+221    ///
+222    /// # Panics
+223    /// Panics if
+224    /// 1. a given `block` is NOT inserted.
+225    /// 2. a `block` is the last one block in a function.
+226    pub fn remove_block(&mut self, block: BasicBlockId) {
+227        debug_assert!(self.is_block_inserted(block));
+228        debug_assert!(self.block_num() > 1);
+229
+230        // Remove all insts in a `block`.
+231        let mut next_inst = self.first_inst(block);
+232        while let Some(inst) = next_inst {
+233            next_inst = self.next_inst(inst);
+234            self.remove_inst(inst);
+235        }
+236
+237        // Remove `block`.
+238        let block_node = &self.blocks[&block];
+239        let prev_block = block_node.prev;
+240        let next_block = block_node.next;
+241        match (prev_block, next_block) {
+242            // `block` is in the middle of a function.
+243            (Some(prev), Some(next)) => {
+244                self.block_mut(prev).next = Some(next);
+245                self.block_mut(next).prev = Some(prev);
+246            }
+247            // `block` is the last block of a function.
+248            (Some(prev), None) => {
+249                self.block_mut(prev).next = None;
+250                self.last_block = prev;
+251            }
+252            // `block` is the first block of a function.
+253            (None, Some(next)) => {
+254                self.block_mut(next).prev = None;
+255                self.entry_block = next
+256            }
+257            (None, None) => {
+258                unreachable!()
+259            }
+260        }
+261
+262        self.blocks.remove(&block);
+263    }
+264
+265    /// Appends `inst` to the end of a `block`
+266    ///
+267    /// # Panics
+268    /// Panics if
+269    /// 1. a given `block` is NOT inserted.
+270    /// 2. a given `inst` is already inserted.
+271    pub fn append_inst(&mut self, inst: InstId, block: BasicBlockId) {
+272        debug_assert!(self.is_block_inserted(block));
+273        debug_assert!(!self.is_inst_inserted(inst));
+274
+275        let mut inst_node = InstNode::new(block);
+276
+277        if let Some(last_inst) = self.blocks[&block].last_inst {
+278            inst_node.prev = Some(last_inst);
+279            self.inst_mut(last_inst).next = Some(inst);
+280        } else {
+281            self.block_mut(block).first_inst = Some(inst);
+282        }
+283
+284        self.block_mut(block).last_inst = Some(inst);
+285        self.insts.insert(inst, inst_node);
+286    }
+287
+288    /// Prepends `inst` to the beginning of a `block`
+289    ///
+290    /// # Panics
+291    /// Panics if
+292    /// 1. a given `block` is NOT inserted.
+293    /// 2. a given `inst` is already inserted.
+294    pub fn prepend_inst(&mut self, inst: InstId, block: BasicBlockId) {
+295        debug_assert!(self.is_block_inserted(block));
+296        debug_assert!(!self.is_inst_inserted(inst));
+297
+298        let mut inst_node = InstNode::new(block);
+299
+300        if let Some(first_inst) = self.blocks[&block].first_inst {
+301            inst_node.next = Some(first_inst);
+302            self.inst_mut(first_inst).prev = Some(inst);
+303        } else {
+304            self.block_mut(block).last_inst = Some(inst);
+305        }
+306
+307        self.block_mut(block).first_inst = Some(inst);
+308        self.insts.insert(inst, inst_node);
+309    }
+310
+311    /// Insert `inst` before `before` inst.
+312    ///
+313    /// # Panics
+314    /// Panics if
+315    /// 1. a given `before` is NOT inserted.
+316    /// 2. a given `inst` is already inserted.
+317    pub fn insert_inst_before_inst(&mut self, inst: InstId, before: InstId) {
+318        debug_assert!(self.is_inst_inserted(before));
+319        debug_assert!(!self.is_inst_inserted(inst));
+320
+321        let before_inst_node = &self.insts[&before];
+322        let block = before_inst_node.block;
+323        let mut inst_node = InstNode::new(block);
+324
+325        match before_inst_node.prev {
+326            Some(prev) => {
+327                inst_node.prev = Some(prev);
+328                self.inst_mut(prev).next = Some(inst);
+329            }
+330            None => self.block_mut(block).first_inst = Some(inst),
+331        }
+332        inst_node.next = Some(before);
+333        self.inst_mut(before).prev = Some(inst);
+334        self.insts.insert(inst, inst_node);
+335    }
+336
+337    /// Insert `inst` after `after` inst.
+338    ///
+339    /// # Panics
+340    /// Panics if
+341    /// 1. a given `after` is NOT inserted.
+342    /// 2. a given `inst` is already inserted.
+343    pub fn insert_inst_after(&mut self, inst: InstId, after: InstId) {
+344        debug_assert!(self.is_inst_inserted(after));
+345        debug_assert!(!self.is_inst_inserted(inst));
+346
+347        let after_inst_node = &self.insts[&after];
+348        let block = after_inst_node.block;
+349        let mut inst_node = InstNode::new(block);
+350
+351        match after_inst_node.next {
+352            Some(next) => {
+353                inst_node.next = Some(next);
+354                self.inst_mut(next).prev = Some(inst);
+355            }
+356            None => self.block_mut(block).last_inst = Some(inst),
+357        }
+358        inst_node.prev = Some(after);
+359        self.inst_mut(after).next = Some(inst);
+360        self.insts.insert(inst, inst_node);
+361    }
+362
+363    /// Remove instruction from the function body.
+364    ///
+365    /// # Panics
+366    /// Panics if a given `inst` is not inserted.
+367    pub fn remove_inst(&mut self, inst: InstId) {
+368        debug_assert!(self.is_inst_inserted(inst));
+369
+370        let inst_node = &self.insts[&inst];
+371        let inst_block = inst_node.block;
+372        let prev_inst = inst_node.prev;
+373        let next_inst = inst_node.next;
+374        match (prev_inst, next_inst) {
+375            (Some(prev), Some(next)) => {
+376                self.inst_mut(prev).next = Some(next);
+377                self.inst_mut(next).prev = Some(prev);
+378            }
+379            (Some(prev), None) => {
+380                self.inst_mut(prev).next = None;
+381                self.block_mut(inst_block).last_inst = Some(prev);
+382            }
+383            (None, Some(next)) => {
+384                self.inst_mut(next).prev = None;
+385                self.block_mut(inst_block).first_inst = Some(next);
+386            }
+387            (None, None) => {
+388                let block_node = self.block_mut(inst_block);
+389                block_node.first_inst = None;
+390                block_node.last_inst = None;
+391            }
+392        }
+393
+394        self.insts.remove(&inst);
+395    }
+396
+397    fn block_mut(&mut self, block: BasicBlockId) -> &mut BlockNode {
+398        self.blocks.get_mut(&block).unwrap()
+399    }
+400
+401    fn inst_mut(&mut self, inst: InstId) -> &mut InstNode {
+402        self.insts.get_mut(&inst).unwrap()
+403    }
+404}
+405
+406struct BlockIter<'a> {
+407    next: Option<BasicBlockId>,
+408    blocks: &'a FxHashMap<BasicBlockId, BlockNode>,
+409}
+410
+411impl<'a> Iterator for BlockIter<'a> {
+412    type Item = BasicBlockId;
+413
+414    fn next(&mut self) -> Option<BasicBlockId> {
+415        let next = self.next?;
+416        self.next = self.blocks[&next].next;
+417        Some(next)
+418    }
+419}
+420
+421struct InstIter<'a> {
+422    next: Option<InstId>,
+423    insts: &'a FxHashMap<InstId, InstNode>,
+424}
+425
+426impl<'a> Iterator for InstIter<'a> {
+427    type Item = InstId;
+428
+429    fn next(&mut self) -> Option<InstId> {
+430        let next = self.next?;
+431        self.next = self.insts[&next].next;
+432        Some(next)
+433    }
+434}
+435
+436#[derive(Default, Debug, Clone, PartialEq, Eq)]
+437/// A helper struct to track a basic block order in a function body.
+438struct BlockNode {
+439    /// A previous block.
+440    prev: Option<BasicBlockId>,
+441
+442    /// A next block.
+443    next: Option<BasicBlockId>,
+444
+445    /// A first instruction of a block.
+446    first_inst: Option<InstId>,
+447
+448    /// A last instruction of a block.
+449    last_inst: Option<InstId>,
+450}
+451
+452#[derive(Debug, Clone, PartialEq, Eq)]
+453/// A helper struct to track a instruction order in a basic block.
+454struct InstNode {
+455    /// An block to which a inst belongs.
+456    block: BasicBlockId,
+457
+458    /// A previous instruction.
+459    prev: Option<InstId>,
+460
+461    /// A next instruction.
+462    next: Option<InstId>,
+463}
+464
+465impl InstNode {
+466    fn new(block: BasicBlockId) -> Self {
+467        Self {
+468            block,
+469            prev: None,
+470            next: None,
+471        }
+472    }
+473}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/constant.rs.html b/compiler-docs/src/fe_mir/ir/constant.rs.html new file mode 100644 index 0000000000..5af6083245 --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/constant.rs.html @@ -0,0 +1,47 @@ +constant.rs - source

fe_mir/ir/
constant.rs

1use fe_common::impl_intern_key;
+2use num_bigint::BigInt;
+3use smol_str::SmolStr;
+4
+5use fe_analyzer::{context, namespace::items as analyzer_items};
+6
+7use super::{SourceInfo, TypeId};
+8
+9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+10pub struct Constant {
+11    /// A name of a constant.
+12    pub name: SmolStr,
+13
+14    /// A value of a constant.
+15    pub value: ConstantValue,
+16
+17    /// A type of a constant.
+18    pub ty: TypeId,
+19
+20    /// A module where a constant is declared.
+21    pub module_id: analyzer_items::ModuleId,
+22
+23    /// A span where a constant is declared.
+24    pub source: SourceInfo,
+25}
+26
+27/// An interned Id for [`Constant`].
+28#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+29pub struct ConstantId(pub(crate) u32);
+30impl_intern_key!(ConstantId);
+31
+32#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+33pub enum ConstantValue {
+34    Immediate(BigInt),
+35    Str(SmolStr),
+36    Bool(bool),
+37}
+38
+39impl From<context::Constant> for ConstantValue {
+40    fn from(value: context::Constant) -> Self {
+41        match value {
+42            context::Constant::Int(num) | context::Constant::Address(num) => Self::Immediate(num),
+43            context::Constant::Str(s) => Self::Str(s),
+44            context::Constant::Bool(b) => Self::Bool(b),
+45        }
+46    }
+47}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/function.rs.html b/compiler-docs/src/fe_mir/ir/function.rs.html new file mode 100644 index 0000000000..79512819ed --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/function.rs.html @@ -0,0 +1,275 @@ +function.rs - source

fe_mir/ir/
function.rs

1use fe_analyzer::namespace::items as analyzer_items;
+2use fe_analyzer::namespace::types as analyzer_types;
+3use fe_common::impl_intern_key;
+4use fxhash::FxHashMap;
+5use id_arena::Arena;
+6use num_bigint::BigInt;
+7use smol_str::SmolStr;
+8use std::collections::BTreeMap;
+9
+10use super::{
+11    basic_block::BasicBlock,
+12    body_order::BodyOrder,
+13    inst::{BranchInfo, Inst, InstId, InstKind},
+14    types::TypeId,
+15    value::{AssignableValue, Local, Value, ValueId},
+16    BasicBlockId, SourceInfo,
+17};
+18
+19/// Represents function signature.
+20#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+21pub struct FunctionSignature {
+22    pub params: Vec<FunctionParam>,
+23    pub resolved_generics: BTreeMap<SmolStr, analyzer_types::TypeId>,
+24    pub return_type: Option<TypeId>,
+25    pub module_id: analyzer_items::ModuleId,
+26    pub analyzer_func_id: analyzer_items::FunctionId,
+27    pub linkage: Linkage,
+28}
+29
+30#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+31pub struct FunctionParam {
+32    pub name: SmolStr,
+33    pub ty: TypeId,
+34    pub source: SourceInfo,
+35}
+36
+37#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+38pub struct FunctionId(pub u32);
+39impl_intern_key!(FunctionId);
+40
+41#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+42pub enum Linkage {
+43    /// A function can only be called within the same module.
+44    Private,
+45
+46    /// A function can be called from other modules, but can NOT be called from
+47    /// other accounts and transactions.
+48    Public,
+49
+50    /// A function can be called from other modules, and also can be called from
+51    /// other accounts and transactions.
+52    Export,
+53}
+54
+55impl Linkage {
+56    pub fn is_exported(self) -> bool {
+57        self == Linkage::Export
+58    }
+59}
+60
+61/// A function body, which is not stored in salsa db to enable in-place
+62/// transformation.
+63#[derive(Debug, Clone, PartialEq, Eq)]
+64pub struct FunctionBody {
+65    pub fid: FunctionId,
+66
+67    pub store: BodyDataStore,
+68
+69    /// Tracks order of basic blocks and instructions in a function body.
+70    pub order: BodyOrder,
+71
+72    pub source: SourceInfo,
+73}
+74
+75impl FunctionBody {
+76    pub fn new(fid: FunctionId, source: SourceInfo) -> Self {
+77        let mut store = BodyDataStore::default();
+78        let entry_bb = store.store_block(BasicBlock {});
+79        Self {
+80            fid,
+81            store,
+82            order: BodyOrder::new(entry_bb),
+83            source,
+84        }
+85    }
+86}
+87
+88/// A collection of basic block, instructions and values appear in a function
+89/// body.
+90#[derive(Default, Debug, Clone, PartialEq, Eq)]
+91pub struct BodyDataStore {
+92    /// Instructions appear in a function body.
+93    insts: Arena<Inst>,
+94
+95    /// All values in a function.
+96    values: Arena<Value>,
+97
+98    blocks: Arena<BasicBlock>,
+99
+100    /// Maps an immediate to a value to ensure the same immediate results in the
+101    /// same value.
+102    immediates: FxHashMap<(BigInt, TypeId), ValueId>,
+103
+104    unit_value: Option<ValueId>,
+105
+106    /// Maps an instruction to a value.
+107    inst_results: FxHashMap<InstId, AssignableValue>,
+108
+109    /// All declared local variables in a function.
+110    locals: Vec<ValueId>,
+111}
+112
+113impl BodyDataStore {
+114    pub fn store_inst(&mut self, inst: Inst) -> InstId {
+115        self.insts.alloc(inst)
+116    }
+117
+118    pub fn inst_data(&self, inst: InstId) -> &Inst {
+119        &self.insts[inst]
+120    }
+121
+122    pub fn inst_data_mut(&mut self, inst: InstId) -> &mut Inst {
+123        &mut self.insts[inst]
+124    }
+125
+126    pub fn replace_inst(&mut self, inst: InstId, new: Inst) -> Inst {
+127        let old = &mut self.insts[inst];
+128        std::mem::replace(old, new)
+129    }
+130
+131    pub fn store_value(&mut self, value: Value) -> ValueId {
+132        match value {
+133            Value::Immediate { imm, ty } => self.store_immediate(imm, ty),
+134
+135            Value::Unit { .. } => {
+136                if let Some(unit_value) = self.unit_value {
+137                    unit_value
+138                } else {
+139                    let unit_value = self.values.alloc(value);
+140                    self.unit_value = Some(unit_value);
+141                    unit_value
+142                }
+143            }
+144
+145            Value::Local(ref local) => {
+146                let is_user_defined = !local.is_tmp;
+147                let value_id = self.values.alloc(value);
+148                if is_user_defined {
+149                    self.locals.push(value_id);
+150                }
+151                value_id
+152            }
+153
+154            _ => self.values.alloc(value),
+155        }
+156    }
+157
+158    pub fn is_nop(&self, inst: InstId) -> bool {
+159        matches!(&self.inst_data(inst).kind, InstKind::Nop)
+160    }
+161
+162    pub fn is_terminator(&self, inst: InstId) -> bool {
+163        self.inst_data(inst).is_terminator()
+164    }
+165
+166    pub fn branch_info(&self, inst: InstId) -> BranchInfo {
+167        self.inst_data(inst).branch_info()
+168    }
+169
+170    pub fn value_data(&self, value: ValueId) -> &Value {
+171        &self.values[value]
+172    }
+173
+174    pub fn value_data_mut(&mut self, value: ValueId) -> &mut Value {
+175        &mut self.values[value]
+176    }
+177
+178    pub fn values(&self) -> impl Iterator<Item = &Value> {
+179        self.values.iter().map(|(_, value_data)| value_data)
+180    }
+181
+182    pub fn values_mut(&mut self) -> impl Iterator<Item = &mut Value> {
+183        self.values.iter_mut().map(|(_, value_data)| value_data)
+184    }
+185
+186    pub fn store_block(&mut self, block: BasicBlock) -> BasicBlockId {
+187        self.blocks.alloc(block)
+188    }
+189
+190    /// Returns an instruction result
+191    pub fn inst_result(&self, inst: InstId) -> Option<&AssignableValue> {
+192        self.inst_results.get(&inst)
+193    }
+194
+195    pub fn map_result(&mut self, inst: InstId, result: AssignableValue) {
+196        self.inst_results.insert(inst, result);
+197    }
+198
+199    pub fn remove_inst_result(&mut self, inst: InstId) -> Option<AssignableValue> {
+200        self.inst_results.remove(&inst)
+201    }
+202
+203    pub fn rewrite_branch_dest(&mut self, inst: InstId, from: BasicBlockId, to: BasicBlockId) {
+204        match &mut self.inst_data_mut(inst).kind {
+205            InstKind::Jump { dest } => {
+206                if *dest == from {
+207                    *dest = to;
+208                }
+209            }
+210            InstKind::Branch { then, else_, .. } => {
+211                if *then == from {
+212                    *then = to;
+213                }
+214                if *else_ == from {
+215                    *else_ = to;
+216                }
+217            }
+218            _ => unreachable!("inst is not a branch"),
+219        }
+220    }
+221
+222    pub fn value_ty(&self, vid: ValueId) -> TypeId {
+223        self.values[vid].ty()
+224    }
+225
+226    pub fn locals(&self) -> &[ValueId] {
+227        &self.locals
+228    }
+229
+230    pub fn locals_mut(&mut self) -> &[ValueId] {
+231        &mut self.locals
+232    }
+233
+234    pub fn func_args(&self) -> impl Iterator<Item = ValueId> + '_ {
+235        self.locals()
+236            .iter()
+237            .filter(|value| match self.value_data(**value) {
+238                Value::Local(local) => local.is_arg,
+239                _ => unreachable!(),
+240            })
+241            .copied()
+242    }
+243
+244    pub fn func_args_mut(&mut self) -> impl Iterator<Item = &mut Value> {
+245        self.values_mut().filter(|value| match value {
+246            Value::Local(local) => local.is_arg,
+247            _ => false,
+248        })
+249    }
+250
+251    /// Returns Some(`local_name`) if value is `Value::Local`.
+252    pub fn local_name(&self, value: ValueId) -> Option<&str> {
+253        match self.value_data(value) {
+254            Value::Local(Local { name, .. }) => Some(name),
+255            _ => None,
+256        }
+257    }
+258
+259    pub fn replace_value(&mut self, value: ValueId, to: Value) -> Value {
+260        std::mem::replace(&mut self.values[value], to)
+261    }
+262
+263    fn store_immediate(&mut self, imm: BigInt, ty: TypeId) -> ValueId {
+264        if let Some(value) = self.immediates.get(&(imm.clone(), ty)) {
+265            *value
+266        } else {
+267            let id = self.values.alloc(Value::Immediate {
+268                imm: imm.clone(),
+269                ty,
+270            });
+271            self.immediates.insert((imm, ty), id);
+272            id
+273        }
+274    }
+275}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/inst.rs.html b/compiler-docs/src/fe_mir/ir/inst.rs.html new file mode 100644 index 0000000000..679a51b19e --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/inst.rs.html @@ -0,0 +1,764 @@ +inst.rs - source

fe_mir/ir/
inst.rs

1use std::fmt;
+2
+3use fe_analyzer::namespace::items::ContractId;
+4use id_arena::Id;
+5
+6use super::{basic_block::BasicBlockId, function::FunctionId, value::ValueId, SourceInfo, TypeId};
+7
+8pub type InstId = Id<Inst>;
+9
+10#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+11pub struct Inst {
+12    pub kind: InstKind,
+13    pub source: SourceInfo,
+14}
+15
+16#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+17pub enum InstKind {
+18    /// This is not a real instruction, just used to tag a position where a
+19    /// local is declared.
+20    Declare {
+21        local: ValueId,
+22    },
+23
+24    /// Unary instruction.
+25    Unary {
+26        op: UnOp,
+27        value: ValueId,
+28    },
+29
+30    /// Binary instruction.
+31    Binary {
+32        op: BinOp,
+33        lhs: ValueId,
+34        rhs: ValueId,
+35    },
+36
+37    Cast {
+38        kind: CastKind,
+39        value: ValueId,
+40        to: TypeId,
+41    },
+42
+43    /// Constructs aggregate value, i.e. struct, tuple and array.
+44    AggregateConstruct {
+45        ty: TypeId,
+46        args: Vec<ValueId>,
+47    },
+48
+49    Bind {
+50        src: ValueId,
+51    },
+52
+53    MemCopy {
+54        src: ValueId,
+55    },
+56
+57    /// Load a primitive value from a ptr
+58    Load {
+59        src: ValueId,
+60    },
+61
+62    /// Access to aggregate fields or elements.
+63    /// # Example
+64    ///
+65    /// ```fe
+66    /// struct Foo:
+67    ///     x: i32
+68    ///     y: Array<i32, 8>
+69    /// ```
+70    /// `foo.y` is lowered into `AggregateAccess(foo, [1])' for example.
+71    AggregateAccess {
+72        value: ValueId,
+73        indices: Vec<ValueId>,
+74    },
+75
+76    MapAccess {
+77        key: ValueId,
+78        value: ValueId,
+79    },
+80
+81    Call {
+82        func: FunctionId,
+83        args: Vec<ValueId>,
+84        call_type: CallType,
+85    },
+86
+87    /// Unconditional jump instruction.
+88    Jump {
+89        dest: BasicBlockId,
+90    },
+91
+92    /// Conditional branching instruction.
+93    Branch {
+94        cond: ValueId,
+95        then: BasicBlockId,
+96        else_: BasicBlockId,
+97    },
+98
+99    Switch {
+100        disc: ValueId,
+101        table: SwitchTable,
+102        default: Option<BasicBlockId>,
+103    },
+104
+105    Revert {
+106        arg: Option<ValueId>,
+107    },
+108
+109    Emit {
+110        arg: ValueId,
+111    },
+112
+113    Return {
+114        arg: Option<ValueId>,
+115    },
+116
+117    Keccak256 {
+118        arg: ValueId,
+119    },
+120
+121    AbiEncode {
+122        arg: ValueId,
+123    },
+124
+125    Nop,
+126
+127    Create {
+128        value: ValueId,
+129        contract: ContractId,
+130    },
+131
+132    Create2 {
+133        value: ValueId,
+134        salt: ValueId,
+135        contract: ContractId,
+136    },
+137
+138    YulIntrinsic {
+139        op: YulIntrinsicOp,
+140        args: Vec<ValueId>,
+141    },
+142}
+143
+144#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
+145pub struct SwitchTable {
+146    values: Vec<ValueId>,
+147    blocks: Vec<BasicBlockId>,
+148}
+149
+150impl SwitchTable {
+151    pub fn iter(&self) -> impl Iterator<Item = (ValueId, BasicBlockId)> + '_ {
+152        self.values.iter().copied().zip(self.blocks.iter().copied())
+153    }
+154
+155    pub fn len(&self) -> usize {
+156        debug_assert!(self.values.len() == self.blocks.len());
+157        self.values.len()
+158    }
+159
+160    pub fn is_empty(&self) -> bool {
+161        debug_assert!(self.values.len() == self.blocks.len());
+162        self.values.is_empty()
+163    }
+164
+165    pub fn add_arm(&mut self, value: ValueId, block: BasicBlockId) {
+166        self.values.push(value);
+167        self.blocks.push(block);
+168    }
+169}
+170
+171impl Inst {
+172    pub fn new(kind: InstKind, source: SourceInfo) -> Self {
+173        Self { kind, source }
+174    }
+175
+176    pub fn unary(op: UnOp, value: ValueId, source: SourceInfo) -> Self {
+177        let kind = InstKind::Unary { op, value };
+178        Self::new(kind, source)
+179    }
+180
+181    pub fn binary(op: BinOp, lhs: ValueId, rhs: ValueId, source: SourceInfo) -> Self {
+182        let kind = InstKind::Binary { op, lhs, rhs };
+183        Self::new(kind, source)
+184    }
+185
+186    pub fn intrinsic(op: YulIntrinsicOp, args: Vec<ValueId>, source: SourceInfo) -> Self {
+187        let kind = InstKind::YulIntrinsic { op, args };
+188        Self::new(kind, source)
+189    }
+190
+191    pub fn nop() -> Self {
+192        Self {
+193            kind: InstKind::Nop,
+194            source: SourceInfo::dummy(),
+195        }
+196    }
+197
+198    pub fn is_terminator(&self) -> bool {
+199        match self.kind {
+200            InstKind::Jump { .. }
+201            | InstKind::Branch { .. }
+202            | InstKind::Switch { .. }
+203            | InstKind::Revert { .. }
+204            | InstKind::Return { .. } => true,
+205            InstKind::YulIntrinsic { op, .. } => op.is_terminator(),
+206            _ => false,
+207        }
+208    }
+209
+210    pub fn branch_info(&self) -> BranchInfo {
+211        match self.kind {
+212            InstKind::Jump { dest } => BranchInfo::Jump(dest),
+213            InstKind::Branch { cond, then, else_ } => BranchInfo::Branch(cond, then, else_),
+214            InstKind::Switch {
+215                disc,
+216                ref table,
+217                default,
+218            } => BranchInfo::Switch(disc, table, default),
+219            _ => BranchInfo::NotBranch,
+220        }
+221    }
+222
+223    pub fn args(&self) -> ValueIter {
+224        use InstKind::*;
+225        match &self.kind {
+226            Declare { local: arg }
+227            | Bind { src: arg }
+228            | MemCopy { src: arg }
+229            | Load { src: arg }
+230            | Unary { value: arg, .. }
+231            | Cast { value: arg, .. }
+232            | Emit { arg }
+233            | Keccak256 { arg }
+234            | AbiEncode { arg }
+235            | Create { value: arg, .. }
+236            | Branch { cond: arg, .. } => ValueIter::one(*arg),
+237
+238            Switch { disc, table, .. } => {
+239                ValueIter::one(*disc).chain(ValueIter::Slice(table.values.iter()))
+240            }
+241
+242            Binary { lhs, rhs, .. }
+243            | MapAccess {
+244                value: lhs,
+245                key: rhs,
+246            }
+247            | Create2 {
+248                value: lhs,
+249                salt: rhs,
+250                ..
+251            } => ValueIter::one(*lhs).chain(ValueIter::one(*rhs)),
+252
+253            Revert { arg } | Return { arg } => ValueIter::One(*arg),
+254
+255            Nop | Jump { .. } => ValueIter::Zero,
+256
+257            AggregateAccess { value, indices } => {
+258                ValueIter::one(*value).chain(ValueIter::Slice(indices.iter()))
+259            }
+260
+261            AggregateConstruct { args, .. } | Call { args, .. } | YulIntrinsic { args, .. } => {
+262                ValueIter::Slice(args.iter())
+263            }
+264        }
+265    }
+266
+267    pub fn args_mut(&mut self) -> ValueIterMut {
+268        use InstKind::*;
+269        match &mut self.kind {
+270            Declare { local: arg }
+271            | Bind { src: arg }
+272            | MemCopy { src: arg }
+273            | Load { src: arg }
+274            | Unary { value: arg, .. }
+275            | Cast { value: arg, .. }
+276            | Emit { arg }
+277            | Keccak256 { arg }
+278            | AbiEncode { arg }
+279            | Create { value: arg, .. }
+280            | Branch { cond: arg, .. } => ValueIterMut::one(arg),
+281
+282            Switch { disc, table, .. } => {
+283                ValueIterMut::one(disc).chain(ValueIterMut::Slice(table.values.iter_mut()))
+284            }
+285
+286            Binary { lhs, rhs, .. }
+287            | MapAccess {
+288                value: lhs,
+289                key: rhs,
+290            }
+291            | Create2 {
+292                value: lhs,
+293                salt: rhs,
+294                ..
+295            } => ValueIterMut::one(lhs).chain(ValueIterMut::one(rhs)),
+296
+297            Revert { arg } | Return { arg } => ValueIterMut::One(arg.as_mut()),
+298
+299            Nop | Jump { .. } => ValueIterMut::Zero,
+300
+301            AggregateAccess { value, indices } => {
+302                ValueIterMut::one(value).chain(ValueIterMut::Slice(indices.iter_mut()))
+303            }
+304
+305            AggregateConstruct { args, .. } | Call { args, .. } | YulIntrinsic { args, .. } => {
+306                ValueIterMut::Slice(args.iter_mut())
+307            }
+308        }
+309    }
+310}
+311
+312#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+313pub enum UnOp {
+314    /// `not` operator for logical inversion.
+315    Not,
+316    /// `-` operator for negation.
+317    Neg,
+318    /// `~` operator for bitwise inversion.
+319    Inv,
+320}
+321
+322impl fmt::Display for UnOp {
+323    fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
+324        match self {
+325            Self::Not => write!(w, "not"),
+326            Self::Neg => write!(w, "-"),
+327            Self::Inv => write!(w, "~"),
+328        }
+329    }
+330}
+331
+332#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+333pub enum BinOp {
+334    Add,
+335    Sub,
+336    Mul,
+337    Div,
+338    Mod,
+339    Pow,
+340    Shl,
+341    Shr,
+342    BitOr,
+343    BitXor,
+344    BitAnd,
+345    LogicalAnd,
+346    LogicalOr,
+347    Eq,
+348    Ne,
+349    Ge,
+350    Gt,
+351    Le,
+352    Lt,
+353}
+354
+355impl fmt::Display for BinOp {
+356    fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
+357        match self {
+358            Self::Add => write!(w, "+"),
+359            Self::Sub => write!(w, "-"),
+360            Self::Mul => write!(w, "*"),
+361            Self::Div => write!(w, "/"),
+362            Self::Mod => write!(w, "%"),
+363            Self::Pow => write!(w, "**"),
+364            Self::Shl => write!(w, "<<"),
+365            Self::Shr => write!(w, ">>"),
+366            Self::BitOr => write!(w, "|"),
+367            Self::BitXor => write!(w, "^"),
+368            Self::BitAnd => write!(w, "&"),
+369            Self::LogicalAnd => write!(w, "and"),
+370            Self::LogicalOr => write!(w, "or"),
+371            Self::Eq => write!(w, "=="),
+372            Self::Ne => write!(w, "!="),
+373            Self::Ge => write!(w, ">="),
+374            Self::Gt => write!(w, ">"),
+375            Self::Le => write!(w, "<="),
+376            Self::Lt => write!(w, "<"),
+377        }
+378    }
+379}
+380
+381#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+382pub enum CallType {
+383    Internal,
+384    External,
+385}
+386
+387impl fmt::Display for CallType {
+388    fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
+389        match self {
+390            Self::Internal => write!(w, "internal"),
+391            Self::External => write!(w, "external"),
+392        }
+393    }
+394}
+395
+396#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+397pub enum CastKind {
+398    /// A cast from a primitive type to a primitive type.
+399    Primitive,
+400
+401    /// A cast from an enum type to its underlying type.
+402    Untag,
+403}
+404
+405// TODO: We don't need all yul intrinsics.
+406#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+407pub enum YulIntrinsicOp {
+408    Stop,
+409    Add,
+410    Sub,
+411    Mul,
+412    Div,
+413    Sdiv,
+414    Mod,
+415    Smod,
+416    Exp,
+417    Not,
+418    Lt,
+419    Gt,
+420    Slt,
+421    Sgt,
+422    Eq,
+423    Iszero,
+424    And,
+425    Or,
+426    Xor,
+427    Byte,
+428    Shl,
+429    Shr,
+430    Sar,
+431    Addmod,
+432    Mulmod,
+433    Signextend,
+434    Keccak256,
+435    Pc,
+436    Pop,
+437    Mload,
+438    Mstore,
+439    Mstore8,
+440    Sload,
+441    Sstore,
+442    Msize,
+443    Gas,
+444    Address,
+445    Balance,
+446    Selfbalance,
+447    Caller,
+448    Callvalue,
+449    Calldataload,
+450    Calldatasize,
+451    Calldatacopy,
+452    Codesize,
+453    Codecopy,
+454    Extcodesize,
+455    Extcodecopy,
+456    Returndatasize,
+457    Returndatacopy,
+458    Extcodehash,
+459    Create,
+460    Create2,
+461    Call,
+462    Callcode,
+463    Delegatecall,
+464    Staticcall,
+465    Return,
+466    Revert,
+467    Selfdestruct,
+468    Invalid,
+469    Log0,
+470    Log1,
+471    Log2,
+472    Log3,
+473    Log4,
+474    Chainid,
+475    Basefee,
+476    Origin,
+477    Gasprice,
+478    Blockhash,
+479    Coinbase,
+480    Timestamp,
+481    Number,
+482    Prevrandao,
+483    Gaslimit,
+484}
+485impl YulIntrinsicOp {
+486    pub fn is_terminator(self) -> bool {
+487        matches!(
+488            self,
+489            Self::Return | Self::Revert | Self::Selfdestruct | Self::Invalid
+490        )
+491    }
+492}
+493
+494impl fmt::Display for YulIntrinsicOp {
+495    fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
+496        let op = match self {
+497            Self::Stop => "__stop",
+498            Self::Add => "__add",
+499            Self::Sub => "__sub",
+500            Self::Mul => "__mul",
+501            Self::Div => "__div",
+502            Self::Sdiv => "__sdiv",
+503            Self::Mod => "__mod",
+504            Self::Smod => "__smod",
+505            Self::Exp => "__exp",
+506            Self::Not => "__not",
+507            Self::Lt => "__lt",
+508            Self::Gt => "__gt",
+509            Self::Slt => "__slt",
+510            Self::Sgt => "__sgt",
+511            Self::Eq => "__eq",
+512            Self::Iszero => "__iszero",
+513            Self::And => "__and",
+514            Self::Or => "__or",
+515            Self::Xor => "__xor",
+516            Self::Byte => "__byte",
+517            Self::Shl => "__shl",
+518            Self::Shr => "__shr",
+519            Self::Sar => "__sar",
+520            Self::Addmod => "__addmod",
+521            Self::Mulmod => "__mulmod",
+522            Self::Signextend => "__signextend",
+523            Self::Keccak256 => "__keccak256",
+524            Self::Pc => "__pc",
+525            Self::Pop => "__pop",
+526            Self::Mload => "__mload",
+527            Self::Mstore => "__mstore",
+528            Self::Mstore8 => "__mstore8",
+529            Self::Sload => "__sload",
+530            Self::Sstore => "__sstore",
+531            Self::Msize => "__msize",
+532            Self::Gas => "__gas",
+533            Self::Address => "__address",
+534            Self::Balance => "__balance",
+535            Self::Selfbalance => "__selfbalance",
+536            Self::Caller => "__caller",
+537            Self::Callvalue => "__callvalue",
+538            Self::Calldataload => "__calldataload",
+539            Self::Calldatasize => "__calldatasize",
+540            Self::Calldatacopy => "__calldatacopy",
+541            Self::Codesize => "__codesize",
+542            Self::Codecopy => "__codecopy",
+543            Self::Extcodesize => "__extcodesize",
+544            Self::Extcodecopy => "__extcodecopy",
+545            Self::Returndatasize => "__returndatasize",
+546            Self::Returndatacopy => "__returndatacopy",
+547            Self::Extcodehash => "__extcodehash",
+548            Self::Create => "__create",
+549            Self::Create2 => "__create2",
+550            Self::Call => "__call",
+551            Self::Callcode => "__callcode",
+552            Self::Delegatecall => "__delegatecall",
+553            Self::Staticcall => "__staticcall",
+554            Self::Return => "__return",
+555            Self::Revert => "__revert",
+556            Self::Selfdestruct => "__selfdestruct",
+557            Self::Invalid => "__invalid",
+558            Self::Log0 => "__log0",
+559            Self::Log1 => "__log1",
+560            Self::Log2 => "__log2",
+561            Self::Log3 => "__log3",
+562            Self::Log4 => "__log4",
+563            Self::Chainid => "__chainid",
+564            Self::Basefee => "__basefee",
+565            Self::Origin => "__origin",
+566            Self::Gasprice => "__gasprice",
+567            Self::Blockhash => "__blockhash",
+568            Self::Coinbase => "__coinbase",
+569            Self::Timestamp => "__timestamp",
+570            Self::Number => "__number",
+571            Self::Prevrandao => "__prevrandao",
+572            Self::Gaslimit => "__gaslimit",
+573        };
+574
+575        write!(w, "{op}")
+576    }
+577}
+578
+579impl From<fe_analyzer::builtins::Intrinsic> for YulIntrinsicOp {
+580    fn from(val: fe_analyzer::builtins::Intrinsic) -> Self {
+581        use fe_analyzer::builtins::Intrinsic;
+582        match val {
+583            Intrinsic::__stop => Self::Stop,
+584            Intrinsic::__add => Self::Add,
+585            Intrinsic::__sub => Self::Sub,
+586            Intrinsic::__mul => Self::Mul,
+587            Intrinsic::__div => Self::Div,
+588            Intrinsic::__sdiv => Self::Sdiv,
+589            Intrinsic::__mod => Self::Mod,
+590            Intrinsic::__smod => Self::Smod,
+591            Intrinsic::__exp => Self::Exp,
+592            Intrinsic::__not => Self::Not,
+593            Intrinsic::__lt => Self::Lt,
+594            Intrinsic::__gt => Self::Gt,
+595            Intrinsic::__slt => Self::Slt,
+596            Intrinsic::__sgt => Self::Sgt,
+597            Intrinsic::__eq => Self::Eq,
+598            Intrinsic::__iszero => Self::Iszero,
+599            Intrinsic::__and => Self::And,
+600            Intrinsic::__or => Self::Or,
+601            Intrinsic::__xor => Self::Xor,
+602            Intrinsic::__byte => Self::Byte,
+603            Intrinsic::__shl => Self::Shl,
+604            Intrinsic::__shr => Self::Shr,
+605            Intrinsic::__sar => Self::Sar,
+606            Intrinsic::__addmod => Self::Addmod,
+607            Intrinsic::__mulmod => Self::Mulmod,
+608            Intrinsic::__signextend => Self::Signextend,
+609            Intrinsic::__keccak256 => Self::Keccak256,
+610            Intrinsic::__pc => Self::Pc,
+611            Intrinsic::__pop => Self::Pop,
+612            Intrinsic::__mload => Self::Mload,
+613            Intrinsic::__mstore => Self::Mstore,
+614            Intrinsic::__mstore8 => Self::Mstore8,
+615            Intrinsic::__sload => Self::Sload,
+616            Intrinsic::__sstore => Self::Sstore,
+617            Intrinsic::__msize => Self::Msize,
+618            Intrinsic::__gas => Self::Gas,
+619            Intrinsic::__address => Self::Address,
+620            Intrinsic::__balance => Self::Balance,
+621            Intrinsic::__selfbalance => Self::Selfbalance,
+622            Intrinsic::__caller => Self::Caller,
+623            Intrinsic::__callvalue => Self::Callvalue,
+624            Intrinsic::__calldataload => Self::Calldataload,
+625            Intrinsic::__calldatasize => Self::Calldatasize,
+626            Intrinsic::__calldatacopy => Self::Calldatacopy,
+627            Intrinsic::__codesize => Self::Codesize,
+628            Intrinsic::__codecopy => Self::Codecopy,
+629            Intrinsic::__extcodesize => Self::Extcodesize,
+630            Intrinsic::__extcodecopy => Self::Extcodecopy,
+631            Intrinsic::__returndatasize => Self::Returndatasize,
+632            Intrinsic::__returndatacopy => Self::Returndatacopy,
+633            Intrinsic::__extcodehash => Self::Extcodehash,
+634            Intrinsic::__create => Self::Create,
+635            Intrinsic::__create2 => Self::Create2,
+636            Intrinsic::__call => Self::Call,
+637            Intrinsic::__callcode => Self::Callcode,
+638            Intrinsic::__delegatecall => Self::Delegatecall,
+639            Intrinsic::__staticcall => Self::Staticcall,
+640            Intrinsic::__return => Self::Return,
+641            Intrinsic::__revert => Self::Revert,
+642            Intrinsic::__selfdestruct => Self::Selfdestruct,
+643            Intrinsic::__invalid => Self::Invalid,
+644            Intrinsic::__log0 => Self::Log0,
+645            Intrinsic::__log1 => Self::Log1,
+646            Intrinsic::__log2 => Self::Log2,
+647            Intrinsic::__log3 => Self::Log3,
+648            Intrinsic::__log4 => Self::Log4,
+649            Intrinsic::__chainid => Self::Chainid,
+650            Intrinsic::__basefee => Self::Basefee,
+651            Intrinsic::__origin => Self::Origin,
+652            Intrinsic::__gasprice => Self::Gasprice,
+653            Intrinsic::__blockhash => Self::Blockhash,
+654            Intrinsic::__coinbase => Self::Coinbase,
+655            Intrinsic::__timestamp => Self::Timestamp,
+656            Intrinsic::__number => Self::Number,
+657            Intrinsic::__prevrandao => Self::Prevrandao,
+658            Intrinsic::__gaslimit => Self::Gaslimit,
+659        }
+660    }
+661}
+662
+663pub enum BranchInfo<'a> {
+664    NotBranch,
+665    Jump(BasicBlockId),
+666    Branch(ValueId, BasicBlockId, BasicBlockId),
+667    Switch(ValueId, &'a SwitchTable, Option<BasicBlockId>),
+668}
+669
+670impl<'a> BranchInfo<'a> {
+671    pub fn is_not_a_branch(&self) -> bool {
+672        matches!(self, BranchInfo::NotBranch)
+673    }
+674
+675    pub fn block_iter(&self) -> BlockIter {
+676        match self {
+677            Self::NotBranch => BlockIter::Zero,
+678            Self::Jump(block) => BlockIter::one(*block),
+679            Self::Branch(_, then, else_) => BlockIter::one(*then).chain(BlockIter::one(*else_)),
+680            Self::Switch(_, table, default) => {
+681                BlockIter::Slice(table.blocks.iter()).chain(BlockIter::One(*default))
+682            }
+683        }
+684    }
+685}
+686
+687pub type BlockIter<'a> = IterBase<'a, BasicBlockId>;
+688pub type ValueIter<'a> = IterBase<'a, ValueId>;
+689pub type ValueIterMut<'a> = IterMutBase<'a, ValueId>;
+690
+691pub enum IterBase<'a, T> {
+692    Zero,
+693    One(Option<T>),
+694    Slice(std::slice::Iter<'a, T>),
+695    Chain(Box<IterBase<'a, T>>, Box<IterBase<'a, T>>),
+696}
+697
+698impl<'a, T> IterBase<'a, T> {
+699    fn one(value: T) -> Self {
+700        Self::One(Some(value))
+701    }
+702
+703    fn chain(self, rhs: Self) -> Self {
+704        Self::Chain(self.into(), rhs.into())
+705    }
+706}
+707
+708impl<'a, T> Iterator for IterBase<'a, T>
+709where
+710    T: Copy,
+711{
+712    type Item = T;
+713
+714    fn next(&mut self) -> Option<Self::Item> {
+715        match self {
+716            Self::Zero => None,
+717            Self::One(value) => value.take(),
+718            Self::Slice(s) => s.next().copied(),
+719            Self::Chain(first, second) => {
+720                if let Some(value) = first.next() {
+721                    Some(value)
+722                } else {
+723                    second.next()
+724                }
+725            }
+726        }
+727    }
+728}
+729
+730pub enum IterMutBase<'a, T> {
+731    Zero,
+732    One(Option<&'a mut T>),
+733    Slice(std::slice::IterMut<'a, T>),
+734    Chain(Box<IterMutBase<'a, T>>, Box<IterMutBase<'a, T>>),
+735}
+736
+737impl<'a, T> IterMutBase<'a, T> {
+738    fn one(value: &'a mut T) -> Self {
+739        Self::One(Some(value))
+740    }
+741
+742    fn chain(self, rhs: Self) -> Self {
+743        Self::Chain(self.into(), rhs.into())
+744    }
+745}
+746
+747impl<'a, T> Iterator for IterMutBase<'a, T> {
+748    type Item = &'a mut T;
+749
+750    fn next(&mut self) -> Option<Self::Item> {
+751        match self {
+752            Self::Zero => None,
+753            Self::One(value) => value.take(),
+754            Self::Slice(s) => s.next(),
+755            Self::Chain(first, second) => {
+756                if let Some(value) = first.next() {
+757                    Some(value)
+758                } else {
+759                    second.next()
+760                }
+761            }
+762        }
+763    }
+764}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/mod.rs.html b/compiler-docs/src/fe_mir/ir/mod.rs.html new file mode 100644 index 0000000000..f3225aa0b8 --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/mod.rs.html @@ -0,0 +1,49 @@ +mod.rs - source

fe_mir/ir/
mod.rs

1use fe_common::Span;
+2use fe_parser::node::{Node, NodeId};
+3
+4pub mod basic_block;
+5pub mod body_builder;
+6pub mod body_cursor;
+7pub mod body_order;
+8pub mod constant;
+9pub mod function;
+10pub mod inst;
+11pub mod types;
+12pub mod value;
+13
+14pub use basic_block::{BasicBlock, BasicBlockId};
+15pub use constant::{Constant, ConstantId};
+16pub use function::{FunctionBody, FunctionId, FunctionParam, FunctionSignature};
+17pub use inst::{Inst, InstId};
+18pub use types::{Type, TypeId, TypeKind};
+19pub use value::{Value, ValueId};
+20
+21/// An original source information that indicates where `mir` entities derive
+22/// from. `SourceInfo` is mainly used for diagnostics.
+23#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+24pub struct SourceInfo {
+25    pub span: Span,
+26    pub id: NodeId,
+27}
+28
+29impl SourceInfo {
+30    pub fn dummy() -> Self {
+31        Self {
+32            span: Span::dummy(),
+33            id: NodeId::dummy(),
+34        }
+35    }
+36
+37    pub fn is_dummy(&self) -> bool {
+38        self == &Self::dummy()
+39    }
+40}
+41
+42impl<T> From<&Node<T>> for SourceInfo {
+43    fn from(node: &Node<T>) -> Self {
+44        Self {
+45            span: node.span,
+46            id: node.id,
+47        }
+48    }
+49}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/types.rs.html b/compiler-docs/src/fe_mir/ir/types.rs.html new file mode 100644 index 0000000000..733eec2e80 --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/types.rs.html @@ -0,0 +1,120 @@ +types.rs - source

fe_mir/ir/
types.rs

1use fe_analyzer::namespace::items as analyzer_items;
+2use fe_analyzer::namespace::types as analyzer_types;
+3use fe_common::{impl_intern_key, Span};
+4use smol_str::SmolStr;
+5
+6#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+7pub struct Type {
+8    pub kind: TypeKind,
+9    pub analyzer_ty: Option<analyzer_types::TypeId>,
+10}
+11
+12impl Type {
+13    pub fn new(kind: TypeKind, analyzer_ty: Option<analyzer_types::TypeId>) -> Self {
+14        Self { kind, analyzer_ty }
+15    }
+16}
+17
+18#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+19pub enum TypeKind {
+20    I8,
+21    I16,
+22    I32,
+23    I64,
+24    I128,
+25    I256,
+26    U8,
+27    U16,
+28    U32,
+29    U64,
+30    U128,
+31    U256,
+32    Bool,
+33    Address,
+34    Unit,
+35    Array(ArrayDef),
+36    // TODO: we should consider whether we really need `String` type.
+37    String(usize),
+38    Tuple(TupleDef),
+39    Struct(StructDef),
+40    Enum(EnumDef),
+41    Contract(StructDef),
+42    Map(MapDef),
+43    MPtr(TypeId),
+44    SPtr(TypeId),
+45}
+46
+47/// An interned Id for [`ArrayDef`].
+48#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+49pub struct TypeId(pub u32);
+50impl_intern_key!(TypeId);
+51
+52/// A static array type definition.
+53#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+54pub struct ArrayDef {
+55    pub elem_ty: TypeId,
+56    pub len: usize,
+57}
+58
+59/// A tuple type definition.
+60#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+61pub struct TupleDef {
+62    pub items: Vec<TypeId>,
+63}
+64
+65/// A user defined struct type definition.
+66#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+67pub struct StructDef {
+68    pub name: SmolStr,
+69    pub fields: Vec<(SmolStr, TypeId)>,
+70    pub span: Span,
+71    pub module_id: analyzer_items::ModuleId,
+72}
+73
+74/// A user defined struct type definition.
+75#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+76pub struct EnumDef {
+77    pub name: SmolStr,
+78    pub variants: Vec<EnumVariant>,
+79    pub span: Span,
+80    pub module_id: analyzer_items::ModuleId,
+81}
+82
+83impl EnumDef {
+84    pub fn tag_type(&self) -> TypeKind {
+85        let variant_num = self.variants.len() as u64;
+86        if variant_num <= u8::MAX as u64 {
+87            TypeKind::U8
+88        } else if variant_num <= u16::MAX as u64 {
+89            TypeKind::U16
+90        } else if variant_num <= u32::MAX as u64 {
+91            TypeKind::U32
+92        } else {
+93            TypeKind::U64
+94        }
+95    }
+96}
+97
+98/// A user defined struct type definition.
+99#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+100pub struct EnumVariant {
+101    pub name: SmolStr,
+102    pub span: Span,
+103    pub ty: TypeId,
+104}
+105
+106/// A user defined struct type definition.
+107#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+108pub struct EventDef {
+109    pub name: SmolStr,
+110    pub fields: Vec<(SmolStr, TypeId, bool)>,
+111    pub span: Span,
+112    pub module_id: analyzer_items::ModuleId,
+113}
+114
+115/// A map type definition.
+116#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+117pub struct MapDef {
+118    pub key_ty: TypeId,
+119    pub value_ty: TypeId,
+120}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/ir/value.rs.html b/compiler-docs/src/fe_mir/ir/value.rs.html new file mode 100644 index 0000000000..7d5e6fb3f5 --- /dev/null +++ b/compiler-docs/src/fe_mir/ir/value.rs.html @@ -0,0 +1,142 @@ +value.rs - source

fe_mir/ir/
value.rs

1use id_arena::Id;
+2use num_bigint::BigInt;
+3use smol_str::SmolStr;
+4
+5use crate::db::MirDb;
+6
+7use super::{
+8    constant::ConstantId,
+9    function::BodyDataStore,
+10    inst::InstId,
+11    types::{TypeId, TypeKind},
+12    SourceInfo,
+13};
+14
+15pub type ValueId = Id<Value>;
+16
+17#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+18pub enum Value {
+19    /// A value resulted from an instruction.
+20    Temporary { inst: InstId, ty: TypeId },
+21
+22    /// A local variable declared in a function body.
+23    Local(Local),
+24
+25    /// An immediate value.
+26    Immediate { imm: BigInt, ty: TypeId },
+27
+28    /// A constant value.
+29    Constant { constant: ConstantId, ty: TypeId },
+30
+31    /// A singleton value representing `Unit` type.
+32    Unit { ty: TypeId },
+33}
+34
+35impl Value {
+36    pub fn ty(&self) -> TypeId {
+37        match self {
+38            Self::Local(val) => val.ty,
+39            Self::Immediate { ty, .. }
+40            | Self::Temporary { ty, .. }
+41            | Self::Unit { ty }
+42            | Self::Constant { ty, .. } => *ty,
+43        }
+44    }
+45
+46    pub fn is_imm(&self) -> bool {
+47        matches!(self, Self::Immediate { .. })
+48    }
+49}
+50
+51#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+52pub enum AssignableValue {
+53    Value(ValueId),
+54    Aggregate {
+55        lhs: Box<AssignableValue>,
+56        idx: ValueId,
+57    },
+58    Map {
+59        lhs: Box<AssignableValue>,
+60        key: ValueId,
+61    },
+62}
+63
+64impl From<ValueId> for AssignableValue {
+65    fn from(value: ValueId) -> Self {
+66        Self::Value(value)
+67    }
+68}
+69
+70impl AssignableValue {
+71    pub fn ty(&self, db: &dyn MirDb, store: &BodyDataStore) -> TypeId {
+72        match self {
+73            Self::Value(value) => store.value_ty(*value),
+74            Self::Aggregate { lhs, idx } => {
+75                let lhs_ty = lhs.ty(db, store);
+76                lhs_ty.projection_ty(db, store.value_data(*idx))
+77            }
+78            Self::Map { lhs, .. } => {
+79                let lhs_ty = lhs.ty(db, store).deref(db);
+80                match lhs_ty.data(db).kind {
+81                    TypeKind::Map(def) => def.value_ty.make_sptr(db),
+82                    _ => unreachable!(),
+83                }
+84            }
+85        }
+86    }
+87
+88    pub fn value_id(&self) -> Option<ValueId> {
+89        match self {
+90            Self::Value(value) => Some(*value),
+91            _ => None,
+92        }
+93    }
+94}
+95
+96#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+97pub struct Local {
+98    /// An original name of a local variable.
+99    pub name: SmolStr,
+100
+101    pub ty: TypeId,
+102
+103    /// `true` if a local is a function argument.
+104    pub is_arg: bool,
+105
+106    /// `true` if a local is introduced in MIR.
+107    pub is_tmp: bool,
+108
+109    pub source: SourceInfo,
+110}
+111
+112impl Local {
+113    pub fn user_local(name: SmolStr, ty: TypeId, source: SourceInfo) -> Local {
+114        Self {
+115            name,
+116            ty,
+117            is_arg: false,
+118            is_tmp: false,
+119            source,
+120        }
+121    }
+122
+123    pub fn arg_local(name: SmolStr, ty: TypeId, source: SourceInfo) -> Local {
+124        Self {
+125            name,
+126            ty,
+127            is_arg: true,
+128            is_tmp: false,
+129            source,
+130        }
+131    }
+132
+133    pub fn tmp_local(name: SmolStr, ty: TypeId) -> Local {
+134        Self {
+135            name,
+136            ty,
+137            is_arg: false,
+138            is_tmp: true,
+139            source: SourceInfo::dummy(),
+140        }
+141    }
+142}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/lib.rs.html b/compiler-docs/src/fe_mir/lib.rs.html new file mode 100644 index 0000000000..221d212dd5 --- /dev/null +++ b/compiler-docs/src/fe_mir/lib.rs.html @@ -0,0 +1,7 @@ +lib.rs - source

fe_mir/
lib.rs

1pub mod analysis;
+2pub mod db;
+3pub mod graphviz;
+4pub mod ir;
+5pub mod pretty_print;
+6
+7mod lower;
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/lower/function.rs.html b/compiler-docs/src/fe_mir/lower/function.rs.html new file mode 100644 index 0000000000..5a29da44ff --- /dev/null +++ b/compiler-docs/src/fe_mir/lower/function.rs.html @@ -0,0 +1,1367 @@ +function.rs - source

fe_mir/lower/
function.rs

1use std::{collections::BTreeMap, rc::Rc, vec};
+2
+3use fe_analyzer::{
+4    builtins::{ContractTypeMethod, GlobalFunction, ValueMethod},
+5    constants::{EMITTABLE_TRAIT_NAME, EMIT_FN_NAME},
+6    context::{Adjustment, AdjustmentKind, CallType as AnalyzerCallType, NamedThing},
+7    namespace::{
+8        items as analyzer_items,
+9        types::{self as analyzer_types, Type},
+10    },
+11};
+12use fe_common::numeric::Literal;
+13use fe_parser::{ast, node::Node};
+14use fxhash::FxHashMap;
+15use id_arena::{Arena, Id};
+16use num_bigint::BigInt;
+17use smol_str::SmolStr;
+18
+19use crate::{
+20    db::MirDb,
+21    ir::{
+22        self,
+23        body_builder::BodyBuilder,
+24        constant::ConstantValue,
+25        function::Linkage,
+26        inst::{CallType, InstKind},
+27        value::{AssignableValue, Local},
+28        BasicBlockId, Constant, FunctionBody, FunctionId, FunctionParam, FunctionSignature, InstId,
+29        SourceInfo, TypeId, Value, ValueId,
+30    },
+31};
+32
+33type ScopeId = Id<Scope>;
+34
+35pub fn lower_func_signature(db: &dyn MirDb, func: analyzer_items::FunctionId) -> FunctionId {
+36    lower_monomorphized_func_signature(db, func, BTreeMap::new())
+37}
+38pub fn lower_monomorphized_func_signature(
+39    db: &dyn MirDb,
+40    func: analyzer_items::FunctionId,
+41    resolved_generics: BTreeMap<SmolStr, analyzer_types::TypeId>,
+42) -> FunctionId {
+43    // TODO: Remove this when an analyzer's function signature contains `self` type.
+44    let mut params = vec![];
+45
+46    if func.takes_self(db.upcast()) {
+47        let self_ty = func.self_type(db.upcast()).unwrap();
+48        let source = self_arg_source(db, func);
+49        params.push(make_param(db, "self", self_ty, source));
+50    }
+51    let analyzer_signature = func.signature(db.upcast());
+52
+53    for param in analyzer_signature.params.iter() {
+54        let source = arg_source(db, func, &param.name);
+55
+56        let param_type =
+57            if let Type::Generic(generic) = param.typ.clone().unwrap().deref_typ(db.upcast()) {
+58                *resolved_generics.get(&generic.name).unwrap()
+59            } else {
+60                param.typ.clone().unwrap()
+61            };
+62
+63        params.push(make_param(db, param.clone().name, param_type, source))
+64    }
+65
+66    let return_type = db.mir_lowered_type(analyzer_signature.return_type.clone().unwrap());
+67
+68    let linkage = if func.is_public(db.upcast()) {
+69        if func.is_contract_func(db.upcast()) && !func.is_constructor(db.upcast()) {
+70            Linkage::Export
+71        } else {
+72            Linkage::Public
+73        }
+74    } else {
+75        Linkage::Private
+76    };
+77
+78    let sig = FunctionSignature {
+79        params,
+80        resolved_generics,
+81        return_type: Some(return_type),
+82        module_id: func.module(db.upcast()),
+83        analyzer_func_id: func,
+84        linkage,
+85    };
+86
+87    db.mir_intern_function(sig.into())
+88}
+89
+90pub fn lower_func_body(db: &dyn MirDb, func: FunctionId) -> Rc<FunctionBody> {
+91    let analyzer_func = func.analyzer_func(db);
+92    let ast = &analyzer_func.data(db.upcast()).ast;
+93    let analyzer_body = analyzer_func.body(db.upcast());
+94
+95    BodyLowerHelper::new(db, func, ast, analyzer_body.as_ref())
+96        .lower()
+97        .into()
+98}
+99
+100pub(super) struct BodyLowerHelper<'db, 'a> {
+101    pub(super) db: &'db dyn MirDb,
+102    pub(super) builder: BodyBuilder,
+103    ast: &'a Node<ast::Function>,
+104    func: FunctionId,
+105    analyzer_body: &'a fe_analyzer::context::FunctionBody,
+106    scopes: Arena<Scope>,
+107    current_scope: ScopeId,
+108}
+109
+110impl<'db, 'a> BodyLowerHelper<'db, 'a> {
+111    pub(super) fn lower_stmt(&mut self, stmt: &Node<ast::FuncStmt>) {
+112        match &stmt.kind {
+113            ast::FuncStmt::Return { value } => {
+114                let value = if let Some(expr) = value {
+115                    self.lower_expr_to_value(expr)
+116                } else {
+117                    self.make_unit()
+118                };
+119                self.builder.ret(value, stmt.into());
+120                let next_block = self.builder.make_block();
+121                self.builder.move_to_block(next_block);
+122            }
+123
+124            ast::FuncStmt::VarDecl { target, value, .. } => {
+125                self.lower_var_decl(target, value.as_ref(), stmt.into());
+126            }
+127
+128            ast::FuncStmt::ConstantDecl { name, value, .. } => {
+129                let ty = self.lower_analyzer_type(self.analyzer_body.var_types[&name.id]);
+130
+131                let value = self.analyzer_body.expressions[&value.id]
+132                    .const_value
+133                    .clone()
+134                    .unwrap();
+135
+136                let constant =
+137                    self.make_local_constant(name.kind.clone(), ty, value.into(), stmt.into());
+138                self.scope_mut().declare_var(&name.kind, constant);
+139            }
+140
+141            ast::FuncStmt::Assign { target, value } => {
+142                let result = self.lower_assignable_value(target);
+143                let (expr, _ty) = self.lower_expr(value);
+144                self.builder.map_result(expr, result)
+145            }
+146
+147            ast::FuncStmt::AugAssign { target, op, value } => {
+148                let result = self.lower_assignable_value(target);
+149                let lhs = self.lower_expr_to_value(target);
+150                let rhs = self.lower_expr_to_value(value);
+151
+152                let inst = self.lower_binop(op.kind, lhs, rhs, stmt.into());
+153                self.builder.map_result(inst, result)
+154            }
+155
+156            ast::FuncStmt::For { target, iter, body } => self.lower_for_loop(target, iter, body),
+157
+158            ast::FuncStmt::While { test, body } => {
+159                let header_bb = self.builder.make_block();
+160                let exit_bb = self.builder.make_block();
+161
+162                let cond = self.lower_expr_to_value(test);
+163                self.builder
+164                    .branch(cond, header_bb, exit_bb, SourceInfo::dummy());
+165
+166                // Lower while body.
+167                self.builder.move_to_block(header_bb);
+168                self.enter_loop_scope(header_bb, exit_bb);
+169                for stmt in body {
+170                    self.lower_stmt(stmt);
+171                }
+172                let cond = self.lower_expr_to_value(test);
+173                self.builder
+174                    .branch(cond, header_bb, exit_bb, SourceInfo::dummy());
+175
+176                self.leave_scope();
+177
+178                // Move to while exit bb.
+179                self.builder.move_to_block(exit_bb);
+180            }
+181
+182            ast::FuncStmt::If {
+183                test,
+184                body,
+185                or_else,
+186            } => self.lower_if(test, body, or_else),
+187
+188            ast::FuncStmt::Match { expr, arms } => {
+189                let matrix = &self.analyzer_body.matches[&stmt.id];
+190                super::pattern_match::lower_match(self, matrix, expr, arms);
+191            }
+192
+193            ast::FuncStmt::Assert { test, msg } => {
+194                let then_bb = self.builder.make_block();
+195                let false_bb = self.builder.make_block();
+196
+197                let cond = self.lower_expr_to_value(test);
+198                self.builder
+199                    .branch(cond, then_bb, false_bb, SourceInfo::dummy());
+200
+201                self.builder.move_to_block(false_bb);
+202
+203                let msg = match msg {
+204                    Some(msg) => self.lower_expr_to_value(msg),
+205                    None => self.make_u256_imm(1),
+206                };
+207                self.builder.revert(Some(msg), stmt.into());
+208                self.builder.move_to_block(then_bb);
+209            }
+210
+211            ast::FuncStmt::Expr { value } => {
+212                self.lower_expr_to_value(value);
+213            }
+214
+215            ast::FuncStmt::Break => {
+216                let exit = self.scope().loop_exit(&self.scopes);
+217                self.builder.jump(exit, stmt.into());
+218                let next_block = self.builder.make_block();
+219                self.builder.move_to_block(next_block);
+220            }
+221
+222            ast::FuncStmt::Continue => {
+223                let entry = self.scope().loop_entry(&self.scopes);
+224                if let Some(loop_idx) = self.scope().loop_idx(&self.scopes) {
+225                    let imm_one = self.make_u256_imm(1u32);
+226                    let inc = self.builder.add(loop_idx, imm_one, SourceInfo::dummy());
+227                    self.builder.map_result(inc, loop_idx.into());
+228                    let maximum_iter_count = self.scope().maximum_iter_count(&self.scopes).unwrap();
+229                    let exit = self.scope().loop_exit(&self.scopes);
+230                    self.branch_eq(loop_idx, maximum_iter_count, exit, entry, stmt.into());
+231                } else {
+232                    self.builder.jump(entry, stmt.into());
+233                }
+234                let next_block = self.builder.make_block();
+235                self.builder.move_to_block(next_block);
+236            }
+237
+238            ast::FuncStmt::Revert { error } => {
+239                let error = error.as_ref().map(|err| self.lower_expr_to_value(err));
+240                self.builder.revert(error, stmt.into());
+241                let next_block = self.builder.make_block();
+242                self.builder.move_to_block(next_block);
+243            }
+244
+245            ast::FuncStmt::Unsafe(stmts) => {
+246                self.enter_scope();
+247                for stmt in stmts {
+248                    self.lower_stmt(stmt)
+249                }
+250                self.leave_scope()
+251            }
+252        }
+253    }
+254
+255    pub(super) fn lower_var_decl(
+256        &mut self,
+257        var: &Node<ast::VarDeclTarget>,
+258        init: Option<&Node<ast::Expr>>,
+259        source: SourceInfo,
+260    ) {
+261        match &var.kind {
+262            ast::VarDeclTarget::Name(name) => {
+263                let ty = self.lower_analyzer_type(self.analyzer_body.var_types[&var.id]);
+264                let value = self.declare_var(name, ty, var.into());
+265                if let Some(init) = init {
+266                    let (init, _init_ty) = self.lower_expr(init);
+267                    // debug_assert_eq!(ty.deref(self.db), init_ty, "vardecl init type mismatch: {} != {}",
+268                    //                  ty.as_string(self.db),
+269                    //                  init_ty.as_string(self.db));
+270                    self.builder.map_result(init, value.into());
+271                }
+272            }
+273
+274            ast::VarDeclTarget::Tuple(decls) => {
+275                if let Some(init) = init {
+276                    if let ast::Expr::Tuple { elts } = &init.kind {
+277                        debug_assert_eq!(decls.len(), elts.len());
+278                        for (decl, init_elem) in decls.iter().zip(elts.iter()) {
+279                            self.lower_var_decl(decl, Some(init_elem), source.clone());
+280                        }
+281                    } else {
+282                        let init_ty = self.expr_ty(init);
+283                        let init_value = self.lower_expr_to_value(init);
+284                        self.lower_var_decl_unpack(var, init_value, init_ty, source);
+285                    };
+286                } else {
+287                    for decl in decls {
+288                        self.lower_var_decl(decl, None, source.clone())
+289                    }
+290                }
+291            }
+292        }
+293    }
+294
+295    pub(super) fn declare_var(
+296        &mut self,
+297        name: &SmolStr,
+298        ty: TypeId,
+299        source: SourceInfo,
+300    ) -> ValueId {
+301        let local = Local::user_local(name.clone(), ty, source);
+302        let value = self.builder.declare(local);
+303        self.scope_mut().declare_var(name, value);
+304        value
+305    }
+306
+307    pub(super) fn lower_var_decl_unpack(
+308        &mut self,
+309        var: &Node<ast::VarDeclTarget>,
+310        init: ValueId,
+311        init_ty: TypeId,
+312        source: SourceInfo,
+313    ) {
+314        match &var.kind {
+315            ast::VarDeclTarget::Name(name) => {
+316                let ty = self.lower_analyzer_type(self.analyzer_body.var_types[&var.id]);
+317                let local = Local::user_local(name.clone(), ty, var.into());
+318
+319                let lhs = self.builder.declare(local);
+320                self.scope_mut().declare_var(name, lhs);
+321                let bind = self.builder.bind(init, source);
+322                self.builder.map_result(bind, lhs.into());
+323            }
+324
+325            ast::VarDeclTarget::Tuple(decls) => {
+326                for (index, decl) in decls.iter().enumerate() {
+327                    let elem_ty = init_ty.projection_ty_imm(self.db, index);
+328                    let index_value = self.make_u256_imm(index);
+329                    let elem_inst =
+330                        self.builder
+331                            .aggregate_access(init, vec![index_value], source.clone());
+332                    let elem_value = self.map_to_tmp(elem_inst, elem_ty);
+333                    self.lower_var_decl_unpack(decl, elem_value, elem_ty, source.clone())
+334                }
+335            }
+336        }
+337    }
+338
+339    pub(super) fn lower_expr(&mut self, expr: &Node<ast::Expr>) -> (InstId, TypeId) {
+340        let mut ty = self.expr_ty(expr);
+341        let mut inst = match &expr.kind {
+342            ast::Expr::Ternary {
+343                if_expr,
+344                test,
+345                else_expr,
+346            } => {
+347                let true_bb = self.builder.make_block();
+348                let false_bb = self.builder.make_block();
+349                let merge_bb = self.builder.make_block();
+350
+351                let tmp = self
+352                    .builder
+353                    .declare(Local::tmp_local("$ternary_tmp".into(), ty));
+354
+355                let cond = self.lower_expr_to_value(test);
+356                self.builder
+357                    .branch(cond, true_bb, false_bb, SourceInfo::dummy());
+358
+359                self.builder.move_to_block(true_bb);
+360                let (value, _) = self.lower_expr(if_expr);
+361                self.builder.map_result(value, tmp.into());
+362                self.builder.jump(merge_bb, SourceInfo::dummy());
+363
+364                self.builder.move_to_block(false_bb);
+365                let (value, _) = self.lower_expr(else_expr);
+366                self.builder.map_result(value, tmp.into());
+367                self.builder.jump(merge_bb, SourceInfo::dummy());
+368
+369                self.builder.move_to_block(merge_bb);
+370                self.builder.bind(tmp, SourceInfo::dummy())
+371            }
+372
+373            ast::Expr::BoolOperation { left, op, right } => {
+374                self.lower_bool_op(op.kind, left, right, ty)
+375            }
+376
+377            ast::Expr::BinOperation { left, op, right } => {
+378                let lhs = self.lower_expr_to_value(left);
+379                let rhs = self.lower_expr_to_value(right);
+380                self.lower_binop(op.kind, lhs, rhs, expr.into())
+381            }
+382
+383            ast::Expr::UnaryOperation { op, operand } => {
+384                let value = self.lower_expr_to_value(operand);
+385                match op.kind {
+386                    ast::UnaryOperator::Invert => self.builder.inv(value, expr.into()),
+387                    ast::UnaryOperator::Not => self.builder.not(value, expr.into()),
+388                    ast::UnaryOperator::USub => self.builder.neg(value, expr.into()),
+389                }
+390            }
+391
+392            ast::Expr::CompOperation { left, op, right } => {
+393                let lhs = self.lower_expr_to_value(left);
+394                let rhs = self.lower_expr_to_value(right);
+395                self.lower_comp_op(op.kind, lhs, rhs, expr.into())
+396            }
+397
+398            ast::Expr::Attribute { .. } => {
+399                let mut indices = vec![];
+400                let value = self.lower_aggregate_access(expr, &mut indices);
+401                self.builder.aggregate_access(value, indices, expr.into())
+402            }
+403
+404            ast::Expr::Subscript { value, index } => {
+405                let value_ty = self.expr_ty(value).deref(self.db);
+406                if value_ty.is_aggregate(self.db) {
+407                    let mut indices = vec![];
+408                    let value = self.lower_aggregate_access(expr, &mut indices);
+409                    self.builder.aggregate_access(value, indices, expr.into())
+410                } else if value_ty.is_map(self.db) {
+411                    let value = self.lower_expr_to_value(value);
+412                    let key = self.lower_expr_to_value(index);
+413                    self.builder.map_access(value, key, expr.into())
+414                } else {
+415                    unreachable!()
+416                }
+417            }
+418
+419            ast::Expr::Call {
+420                func,
+421                generic_args,
+422                args,
+423            } => {
+424                let ty = self.expr_ty(expr);
+425                self.lower_call(func, generic_args, &args.kind, ty, expr.into())
+426            }
+427
+428            ast::Expr::List { elts } | ast::Expr::Tuple { elts } => {
+429                let args = elts
+430                    .iter()
+431                    .map(|elem| self.lower_expr_to_value(elem))
+432                    .collect();
+433                let ty = self.expr_ty(expr);
+434                self.builder.aggregate_construct(ty, args, expr.into())
+435            }
+436
+437            ast::Expr::Repeat { value, len: _ } => {
+438                let array_type = if let Type::Array(array_type) = self.analyzer_body.expressions
+439                    [&expr.id]
+440                    .typ
+441                    .typ(self.db.upcast())
+442                {
+443                    array_type
+444                } else {
+445                    panic!("not an array");
+446                };
+447
+448                let args = vec![self.lower_expr_to_value(value); array_type.size];
+449                let ty = self.expr_ty(expr);
+450                self.builder.aggregate_construct(ty, args, expr.into())
+451            }
+452
+453            ast::Expr::Bool(b) => {
+454                let imm = self.builder.make_imm_from_bool(*b, ty);
+455                self.builder.bind(imm, expr.into())
+456            }
+457
+458            ast::Expr::Name(name) => {
+459                let value = self.resolve_name(name);
+460                self.builder.bind(value, expr.into())
+461            }
+462
+463            ast::Expr::Path(path) => {
+464                let value = self.resolve_path(path, expr.into());
+465                self.builder.bind(value, expr.into())
+466            }
+467
+468            ast::Expr::Num(num) => {
+469                let imm = Literal::new(num).parse().unwrap();
+470                let imm = self.builder.make_imm(imm, ty);
+471                self.builder.bind(imm, expr.into())
+472            }
+473
+474            ast::Expr::Str(s) => {
+475                let ty = self.expr_ty(expr);
+476                let const_value = self.make_local_constant(
+477                    "str_in_func".into(),
+478                    ty,
+479                    ConstantValue::Str(s.clone()),
+480                    expr.into(),
+481                );
+482                self.builder.bind(const_value, expr.into())
+483            }
+484
+485            ast::Expr::Unit => {
+486                let value = self.make_unit();
+487                self.builder.bind(value, expr.into())
+488            }
+489        };
+490
+491        for Adjustment { into, kind } in &self.analyzer_body.expressions[&expr.id].type_adjustments
+492        {
+493            let into_ty = self.lower_analyzer_type(*into);
+494
+495            match kind {
+496                AdjustmentKind::Copy => {
+497                    let val = self.inst_result_or_tmp(inst, ty);
+498                    inst = self.builder.mem_copy(val, expr.into());
+499                }
+500                AdjustmentKind::Load => {
+501                    let val = self.inst_result_or_tmp(inst, ty);
+502                    inst = self.builder.load(val, expr.into());
+503                }
+504                AdjustmentKind::IntSizeIncrease => {
+505                    let val = self.inst_result_or_tmp(inst, ty);
+506                    inst = self.builder.primitive_cast(val, into_ty, expr.into())
+507                }
+508                AdjustmentKind::StringSizeIncrease => {} // XXX
+509            }
+510            ty = into_ty;
+511        }
+512        (inst, ty)
+513    }
+514
+515    fn inst_result_or_tmp(&mut self, inst: InstId, ty: TypeId) -> ValueId {
+516        self.builder
+517            .inst_result(inst)
+518            .and_then(|r| r.value_id())
+519            .unwrap_or_else(|| self.map_to_tmp(inst, ty))
+520    }
+521
+522    pub(super) fn lower_expr_to_value(&mut self, expr: &Node<ast::Expr>) -> ValueId {
+523        let (inst, ty) = self.lower_expr(expr);
+524        self.map_to_tmp(inst, ty)
+525    }
+526
+527    pub(super) fn enter_scope(&mut self) {
+528        let new_scope = Scope::with_parent(self.current_scope);
+529        self.current_scope = self.scopes.alloc(new_scope);
+530    }
+531
+532    pub(super) fn leave_scope(&mut self) {
+533        self.current_scope = self.scopes[self.current_scope].parent.unwrap();
+534    }
+535
+536    pub(super) fn make_imm(&mut self, imm: impl Into<BigInt>, ty: TypeId) -> ValueId {
+537        self.builder.make_value(Value::Immediate {
+538            imm: imm.into(),
+539            ty,
+540        })
+541    }
+542
+543    pub(super) fn make_u256_imm(&mut self, value: impl Into<BigInt>) -> ValueId {
+544        let u256_ty = self.u256_ty();
+545        self.make_imm(value, u256_ty)
+546    }
+547
+548    pub(super) fn map_to_tmp(&mut self, inst: InstId, ty: TypeId) -> ValueId {
+549        match &self.builder.inst_data(inst).kind {
+550            InstKind::Bind { src } => {
+551                let value = *src;
+552                self.builder.remove_inst(inst);
+553                value
+554            }
+555            _ => {
+556                let tmp = Value::Temporary { inst, ty };
+557                let result = self.builder.make_value(tmp);
+558                self.builder.map_result(inst, result.into());
+559                result
+560            }
+561        }
+562    }
+563
+564    fn new(
+565        db: &'db dyn MirDb,
+566        func: FunctionId,
+567        ast: &'a Node<ast::Function>,
+568        analyzer_body: &'a fe_analyzer::context::FunctionBody,
+569    ) -> Self {
+570        let mut builder = BodyBuilder::new(func, ast.into());
+571        let mut scopes = Arena::new();
+572
+573        // Make a root scope. A root scope collects function parameters and module
+574        // constants.
+575        let root = Scope::root(db, func, &mut builder);
+576        let current_scope = scopes.alloc(root);
+577        Self {
+578            db,
+579            builder,
+580            ast,
+581            func,
+582            analyzer_body,
+583            scopes,
+584            current_scope,
+585        }
+586    }
+587
+588    fn lower_analyzer_type(&self, analyzer_ty: analyzer_types::TypeId) -> TypeId {
+589        // If the analyzer type is generic we first need to resolve it to its concrete
+590        // type before lowering to a MIR type
+591        if let analyzer_types::Type::Generic(generic) = analyzer_ty.deref_typ(self.db.upcast()) {
+592            let resolved_type = self
+593                .func
+594                .signature(self.db)
+595                .resolved_generics
+596                .get(&generic.name)
+597                .cloned()
+598                .expect("expected generic to be resolved");
+599
+600            return self.db.mir_lowered_type(resolved_type);
+601        }
+602
+603        self.db.mir_lowered_type(analyzer_ty)
+604    }
+605
+606    fn lower(mut self) -> FunctionBody {
+607        for stmt in &self.ast.kind.body {
+608            self.lower_stmt(stmt)
+609        }
+610
+611        let last_block = self.builder.current_block();
+612        if !self.builder.is_block_terminated(last_block) {
+613            let unit = self.make_unit();
+614            self.builder.ret(unit, SourceInfo::dummy());
+615        }
+616
+617        self.builder.build()
+618    }
+619
+620    fn branch_eq(
+621        &mut self,
+622        v1: ValueId,
+623        v2: ValueId,
+624        true_bb: BasicBlockId,
+625        false_bb: BasicBlockId,
+626        source: SourceInfo,
+627    ) {
+628        let cond = self.builder.eq(v1, v2, source.clone());
+629        let bool_ty = self.bool_ty();
+630        let cond = self.map_to_tmp(cond, bool_ty);
+631        self.builder.branch(cond, true_bb, false_bb, source);
+632    }
+633
+634    fn lower_if(
+635        &mut self,
+636        cond: &Node<ast::Expr>,
+637        then: &[Node<ast::FuncStmt>],
+638        else_: &[Node<ast::FuncStmt>],
+639    ) {
+640        let cond = self.lower_expr_to_value(cond);
+641
+642        if else_.is_empty() {
+643            let then_bb = self.builder.make_block();
+644            let merge_bb = self.builder.make_block();
+645
+646            self.builder
+647                .branch(cond, then_bb, merge_bb, SourceInfo::dummy());
+648
+649            // Lower then block.
+650            self.builder.move_to_block(then_bb);
+651            self.enter_scope();
+652            for stmt in then {
+653                self.lower_stmt(stmt);
+654            }
+655            self.builder.jump(merge_bb, SourceInfo::dummy());
+656            self.builder.move_to_block(merge_bb);
+657            self.leave_scope();
+658        } else {
+659            let then_bb = self.builder.make_block();
+660            let else_bb = self.builder.make_block();
+661
+662            self.builder
+663                .branch(cond, then_bb, else_bb, SourceInfo::dummy());
+664
+665            // Lower then block.
+666            self.builder.move_to_block(then_bb);
+667            self.enter_scope();
+668            for stmt in then {
+669                self.lower_stmt(stmt);
+670            }
+671            self.leave_scope();
+672            let then_block_end_bb = self.builder.current_block();
+673
+674            // Lower else_block.
+675            self.builder.move_to_block(else_bb);
+676            self.enter_scope();
+677            for stmt in else_ {
+678                self.lower_stmt(stmt);
+679            }
+680            self.leave_scope();
+681            let else_block_end_bb = self.builder.current_block();
+682
+683            let merge_bb = self.builder.make_block();
+684            if !self.builder.is_block_terminated(then_block_end_bb) {
+685                self.builder.move_to_block(then_block_end_bb);
+686                self.builder.jump(merge_bb, SourceInfo::dummy());
+687            }
+688            if !self.builder.is_block_terminated(else_block_end_bb) {
+689                self.builder.move_to_block(else_block_end_bb);
+690                self.builder.jump(merge_bb, SourceInfo::dummy());
+691            }
+692            self.builder.move_to_block(merge_bb);
+693        }
+694    }
+695
+696    // NOTE: we assume a type of `iter` is array.
+697    // TODO: Desugar to `loop` + `match` like rustc in HIR to generate better MIR.
+698    fn lower_for_loop(
+699        &mut self,
+700        loop_variable: &Node<SmolStr>,
+701        iter: &Node<ast::Expr>,
+702        body: &[Node<ast::FuncStmt>],
+703    ) {
+704        let preheader_bb = self.builder.make_block();
+705        let entry_bb = self.builder.make_block();
+706        let exit_bb = self.builder.make_block();
+707
+708        let iter_elem_ty = self.analyzer_body.var_types[&loop_variable.id];
+709        let iter_elem_ty = self.lower_analyzer_type(iter_elem_ty);
+710
+711        self.builder.jump(preheader_bb, SourceInfo::dummy());
+712
+713        // `For` has its scope from preheader block.
+714        self.enter_loop_scope(entry_bb, exit_bb);
+715
+716        /* Lower preheader. */
+717        self.builder.move_to_block(preheader_bb);
+718
+719        // Declare loop_variable.
+720        let loop_value = self.builder.declare(Local::user_local(
+721            loop_variable.kind.clone(),
+722            iter_elem_ty,
+723            loop_variable.into(),
+724        ));
+725        self.scope_mut()
+726            .declare_var(&loop_variable.kind, loop_value);
+727
+728        // Declare and initialize `loop_idx` to 0.
+729        let loop_idx = Local::tmp_local("$loop_idx_tmp".into(), self.u256_ty());
+730        let loop_idx = self.builder.declare(loop_idx);
+731        let imm_zero = self.make_u256_imm(0u32);
+732        let imm_zero = self.builder.bind(imm_zero, SourceInfo::dummy());
+733        self.builder.map_result(imm_zero, loop_idx.into());
+734
+735        // Evaluates loop variable.
+736        let iter_ty = self.expr_ty(iter);
+737        let iter = self.lower_expr_to_value(iter);
+738
+739        // Create maximum loop count.
+740        let maximum_iter_count = match &iter_ty.deref(self.db).data(self.db).kind {
+741            ir::TypeKind::Array(ir::types::ArrayDef { len, .. }) => *len,
+742            _ => unreachable!(),
+743        };
+744        let maximum_iter_count = self.make_u256_imm(maximum_iter_count);
+745        self.branch_eq(
+746            loop_idx,
+747            maximum_iter_count,
+748            exit_bb,
+749            entry_bb,
+750            SourceInfo::dummy(),
+751        );
+752        self.scope_mut().loop_idx = Some(loop_idx);
+753        self.scope_mut().maximum_iter_count = Some(maximum_iter_count);
+754
+755        /* Lower body. */
+756        self.builder.move_to_block(entry_bb);
+757
+758        // loop_variable = array[loop_idx]
+759        let iter_elem = self
+760            .builder
+761            .aggregate_access(iter, vec![loop_idx], SourceInfo::dummy());
+762        self.builder
+763            .map_result(iter_elem, AssignableValue::Value(loop_value));
+764
+765        for stmt in body {
+766            self.lower_stmt(stmt);
+767        }
+768
+769        // loop_idx += 1
+770        let imm_one = self.make_u256_imm(1u32);
+771        let inc = self.builder.add(loop_idx, imm_one, SourceInfo::dummy());
+772        self.builder
+773            .map_result(inc, AssignableValue::Value(loop_idx));
+774        self.branch_eq(
+775            loop_idx,
+776            maximum_iter_count,
+777            exit_bb,
+778            entry_bb,
+779            SourceInfo::dummy(),
+780        );
+781
+782        /* Move to exit bb */
+783        self.leave_scope();
+784        self.builder.move_to_block(exit_bb);
+785    }
+786
+787    fn lower_assignable_value(&mut self, expr: &Node<ast::Expr>) -> AssignableValue {
+788        match &expr.kind {
+789            ast::Expr::Attribute { value, attr } => {
+790                let idx = self.expr_ty(value).index_from_fname(self.db, &attr.kind);
+791                let idx = self.make_u256_imm(idx);
+792                let lhs = self.lower_assignable_value(value).into();
+793                AssignableValue::Aggregate { lhs, idx }
+794            }
+795            ast::Expr::Subscript { value, index } => {
+796                let lhs = self.lower_assignable_value(value).into();
+797                let attr = self.lower_expr_to_value(index);
+798                let value_ty = self.expr_ty(value).deref(self.db);
+799                if value_ty.is_aggregate(self.db) {
+800                    AssignableValue::Aggregate { lhs, idx: attr }
+801                } else if value_ty.is_map(self.db) {
+802                    AssignableValue::Map { lhs, key: attr }
+803                } else {
+804                    unreachable!()
+805                }
+806            }
+807            ast::Expr::Name(name) => self.resolve_name(name).into(),
+808            ast::Expr::Path(path) => self.resolve_path(path, expr.into()).into(),
+809            _ => self.lower_expr_to_value(expr).into(),
+810        }
+811    }
+812
+813    /// Returns the pre-adjustment type of the given `Expr`
+814    fn expr_ty(&self, expr: &Node<ast::Expr>) -> TypeId {
+815        let analyzer_ty = self.analyzer_body.expressions[&expr.id].typ;
+816        self.lower_analyzer_type(analyzer_ty)
+817    }
+818
+819    fn lower_bool_op(
+820        &mut self,
+821        op: ast::BoolOperator,
+822        lhs: &Node<ast::Expr>,
+823        rhs: &Node<ast::Expr>,
+824        ty: TypeId,
+825    ) -> InstId {
+826        let true_bb = self.builder.make_block();
+827        let false_bb = self.builder.make_block();
+828        let merge_bb = self.builder.make_block();
+829
+830        let lhs = self.lower_expr_to_value(lhs);
+831        let tmp = self
+832            .builder
+833            .declare(Local::tmp_local(format!("${op}_tmp").into(), ty));
+834
+835        match op {
+836            ast::BoolOperator::And => {
+837                self.builder
+838                    .branch(lhs, true_bb, false_bb, SourceInfo::dummy());
+839
+840                self.builder.move_to_block(true_bb);
+841                let (rhs, _rhs_ty) = self.lower_expr(rhs);
+842                self.builder.map_result(rhs, tmp.into());
+843                self.builder.jump(merge_bb, SourceInfo::dummy());
+844
+845                self.builder.move_to_block(false_bb);
+846                let false_imm = self.builder.make_imm_from_bool(false, ty);
+847                let false_imm_copy = self.builder.bind(false_imm, SourceInfo::dummy());
+848                self.builder.map_result(false_imm_copy, tmp.into());
+849                self.builder.jump(merge_bb, SourceInfo::dummy());
+850            }
+851
+852            ast::BoolOperator::Or => {
+853                self.builder
+854                    .branch(lhs, true_bb, false_bb, SourceInfo::dummy());
+855
+856                self.builder.move_to_block(true_bb);
+857                let true_imm = self.builder.make_imm_from_bool(true, ty);
+858                let true_imm_copy = self.builder.bind(true_imm, SourceInfo::dummy());
+859                self.builder.map_result(true_imm_copy, tmp.into());
+860                self.builder.jump(merge_bb, SourceInfo::dummy());
+861
+862                self.builder.move_to_block(false_bb);
+863                let (rhs, _rhs_ty) = self.lower_expr(rhs);
+864                self.builder.map_result(rhs, tmp.into());
+865                self.builder.jump(merge_bb, SourceInfo::dummy());
+866            }
+867        }
+868
+869        self.builder.move_to_block(merge_bb);
+870        self.builder.bind(tmp, SourceInfo::dummy())
+871    }
+872
+873    fn lower_binop(
+874        &mut self,
+875        op: ast::BinOperator,
+876        lhs: ValueId,
+877        rhs: ValueId,
+878        source: SourceInfo,
+879    ) -> InstId {
+880        match op {
+881            ast::BinOperator::Add => self.builder.add(lhs, rhs, source),
+882            ast::BinOperator::Sub => self.builder.sub(lhs, rhs, source),
+883            ast::BinOperator::Mult => self.builder.mul(lhs, rhs, source),
+884            ast::BinOperator::Div => self.builder.div(lhs, rhs, source),
+885            ast::BinOperator::Mod => self.builder.modulo(lhs, rhs, source),
+886            ast::BinOperator::Pow => self.builder.pow(lhs, rhs, source),
+887            ast::BinOperator::LShift => self.builder.shl(lhs, rhs, source),
+888            ast::BinOperator::RShift => self.builder.shr(lhs, rhs, source),
+889            ast::BinOperator::BitOr => self.builder.bit_or(lhs, rhs, source),
+890            ast::BinOperator::BitXor => self.builder.bit_xor(lhs, rhs, source),
+891            ast::BinOperator::BitAnd => self.builder.bit_and(lhs, rhs, source),
+892        }
+893    }
+894
+895    fn lower_comp_op(
+896        &mut self,
+897        op: ast::CompOperator,
+898        lhs: ValueId,
+899        rhs: ValueId,
+900        source: SourceInfo,
+901    ) -> InstId {
+902        match op {
+903            ast::CompOperator::Eq => self.builder.eq(lhs, rhs, source),
+904            ast::CompOperator::NotEq => self.builder.ne(lhs, rhs, source),
+905            ast::CompOperator::Lt => self.builder.lt(lhs, rhs, source),
+906            ast::CompOperator::LtE => self.builder.le(lhs, rhs, source),
+907            ast::CompOperator::Gt => self.builder.gt(lhs, rhs, source),
+908            ast::CompOperator::GtE => self.builder.ge(lhs, rhs, source),
+909        }
+910    }
+911
+912    fn resolve_generics_args(
+913        &mut self,
+914        method: &analyzer_items::FunctionId,
+915        args: &[Id<Value>],
+916    ) -> BTreeMap<SmolStr, analyzer_types::TypeId> {
+917        method
+918            .signature(self.db.upcast())
+919            .params
+920            .iter()
+921            .zip(args.iter().map(|val| {
+922                self.builder
+923                    .value_ty(*val)
+924                    .analyzer_ty(self.db)
+925                    .expect("invalid parameter")
+926            }))
+927            .filter_map(|(param, typ)| {
+928                if let Type::Generic(generic) =
+929                    param.typ.clone().unwrap().deref_typ(self.db.upcast())
+930                {
+931                    Some((generic.name, typ))
+932                } else {
+933                    None
+934                }
+935            })
+936            .collect::<BTreeMap<_, _>>()
+937    }
+938
+939    fn lower_function_id(
+940        &mut self,
+941        function: &analyzer_items::FunctionId,
+942        args: &[Id<Value>],
+943    ) -> FunctionId {
+944        let resolved_generics = self.resolve_generics_args(function, args);
+945        if function.is_generic(self.db.upcast()) {
+946            self.db
+947                .mir_lowered_monomorphized_func_signature(*function, resolved_generics)
+948        } else {
+949            self.db.mir_lowered_func_signature(*function)
+950        }
+951    }
+952
+953    fn lower_call(
+954        &mut self,
+955        func: &Node<ast::Expr>,
+956        _generic_args: &Option<Node<Vec<ast::GenericArg>>>,
+957        args: &[Node<ast::CallArg>],
+958        ty: TypeId,
+959        source: SourceInfo,
+960    ) -> InstId {
+961        let call_type = &self.analyzer_body.calls[&func.id];
+962
+963        let mut args: Vec<_> = args
+964            .iter()
+965            .map(|arg| self.lower_expr_to_value(&arg.kind.value))
+966            .collect();
+967
+968        match call_type {
+969            AnalyzerCallType::BuiltinFunction(GlobalFunction::Keccak256) => {
+970                self.builder.keccak256(args[0], source)
+971            }
+972
+973            AnalyzerCallType::Intrinsic(intrinsic) => {
+974                self.builder
+975                    .yul_intrinsic((*intrinsic).into(), args, source)
+976            }
+977
+978            AnalyzerCallType::BuiltinValueMethod { method, .. } => {
+979                let arg = self.lower_method_receiver(func);
+980                match method {
+981                    ValueMethod::ToMem => self.builder.mem_copy(arg, source),
+982                    ValueMethod::AbiEncode => self.builder.abi_encode(arg, source),
+983                }
+984            }
+985
+986            // We ignores `args[0]', which represents `context` and not used for now.
+987            AnalyzerCallType::BuiltinAssociatedFunction { contract, function } => match function {
+988                ContractTypeMethod::Create => self.builder.create(args[1], *contract, source),
+989                ContractTypeMethod::Create2 => {
+990                    self.builder.create2(args[1], args[2], *contract, source)
+991                }
+992            },
+993
+994            AnalyzerCallType::AssociatedFunction { function, .. }
+995            | AnalyzerCallType::Pure(function) => {
+996                let func_id = self.lower_function_id(function, &args);
+997                self.builder.call(func_id, args, CallType::Internal, source)
+998            }
+999
+1000            AnalyzerCallType::ValueMethod { method, .. } => {
+1001                let mut method_args = vec![self.lower_method_receiver(func)];
+1002                let func_id = self.lower_function_id(method, &args);
+1003
+1004                method_args.append(&mut args);
+1005
+1006                self.builder
+1007                    .call(func_id, method_args, CallType::Internal, source)
+1008            }
+1009            AnalyzerCallType::TraitValueMethod {
+1010                trait_id, method, ..
+1011            } if trait_id.is_std_trait(self.db.upcast(), EMITTABLE_TRAIT_NAME)
+1012                && method.name(self.db.upcast()) == EMIT_FN_NAME =>
+1013            {
+1014                let event = self.lower_method_receiver(func);
+1015                self.builder.emit(event, source)
+1016            }
+1017            AnalyzerCallType::TraitValueMethod {
+1018                method,
+1019                trait_id,
+1020                generic_type,
+1021                ..
+1022            } => {
+1023                let mut method_args = vec![self.lower_method_receiver(func)];
+1024                method_args.append(&mut args);
+1025
+1026                let concrete_type = self
+1027                    .func
+1028                    .signature(self.db)
+1029                    .resolved_generics
+1030                    .get(&generic_type.name)
+1031                    .cloned()
+1032                    .expect("unresolved generic type");
+1033
+1034                let impl_ = concrete_type
+1035                    .get_impl_for(self.db.upcast(), *trait_id)
+1036                    .expect("missing impl");
+1037
+1038                let function = impl_
+1039                    .function(self.db.upcast(), &method.name(self.db.upcast()))
+1040                    .expect("missing function");
+1041
+1042                let func_id = self.db.mir_lowered_func_signature(function);
+1043                self.builder
+1044                    .call(func_id, method_args, CallType::Internal, source)
+1045            }
+1046            AnalyzerCallType::External { function, .. } => {
+1047                let receiver = self.lower_method_receiver(func);
+1048                debug_assert!(self.builder.value_ty(receiver).is_address(self.db));
+1049
+1050                let mut method_args = vec![receiver];
+1051                method_args.append(&mut args);
+1052                let func_id = self.db.mir_lowered_func_signature(*function);
+1053                self.builder
+1054                    .call(func_id, method_args, CallType::External, source)
+1055            }
+1056
+1057            AnalyzerCallType::TypeConstructor(to_ty) => {
+1058                if to_ty.is_string(self.db.upcast()) {
+1059                    let arg = *args.last().unwrap();
+1060                    self.builder.mem_copy(arg, source)
+1061                } else if ty.is_primitive(self.db) {
+1062                    // TODO: Ignore `ctx` for now.
+1063                    let arg = *args.last().unwrap();
+1064                    let arg_ty = self.builder.value_ty(arg);
+1065                    if arg_ty == ty {
+1066                        self.builder.bind(arg, source)
+1067                    } else {
+1068                        debug_assert!(!arg_ty.is_ptr(self.db)); // Should be explicitly `Load`ed
+1069                        self.builder.primitive_cast(arg, ty, source)
+1070                    }
+1071                } else if ty.is_aggregate(self.db) {
+1072                    self.builder.aggregate_construct(ty, args, source)
+1073                } else {
+1074                    unreachable!()
+1075                }
+1076            }
+1077
+1078            AnalyzerCallType::EnumConstructor(variant) => {
+1079                let tag_type = ty.enum_disc_type(self.db);
+1080                let tag = self.make_imm(variant.disc(self.db.upcast()), tag_type);
+1081                let data_ty = ty.enum_variant_type(self.db, *variant);
+1082                let enum_args = if data_ty.is_unit(self.db) {
+1083                    vec![tag, self.make_unit()]
+1084                } else {
+1085                    std::iter::once(tag).chain(args).collect()
+1086                };
+1087                self.builder.aggregate_construct(ty, enum_args, source)
+1088            }
+1089        }
+1090    }
+1091
+1092    // FIXME: This is ugly hack to properly analyze method call. Remove this when  https://github.com/ethereum/fe/issues/670 is resolved.
+1093    fn lower_method_receiver(&mut self, receiver: &Node<ast::Expr>) -> ValueId {
+1094        match &receiver.kind {
+1095            ast::Expr::Attribute { value, .. } => self.lower_expr_to_value(value),
+1096            _ => unreachable!(),
+1097        }
+1098    }
+1099
+1100    fn lower_aggregate_access(
+1101        &mut self,
+1102        expr: &Node<ast::Expr>,
+1103        indices: &mut Vec<ValueId>,
+1104    ) -> ValueId {
+1105        match &expr.kind {
+1106            ast::Expr::Attribute { value, attr } => {
+1107                let index = self.expr_ty(value).index_from_fname(self.db, &attr.kind);
+1108                let value = self.lower_aggregate_access(value, indices);
+1109                indices.push(self.make_u256_imm(index));
+1110                value
+1111            }
+1112
+1113            ast::Expr::Subscript { value, index }
+1114                if self.expr_ty(value).deref(self.db).is_aggregate(self.db) =>
+1115            {
+1116                let value = self.lower_aggregate_access(value, indices);
+1117                indices.push(self.lower_expr_to_value(index));
+1118                value
+1119            }
+1120
+1121            _ => self.lower_expr_to_value(expr),
+1122        }
+1123    }
+1124
+1125    fn make_unit(&mut self) -> ValueId {
+1126        let unit_ty = analyzer_types::TypeId::unit(self.db.upcast());
+1127        let unit_ty = self.db.mir_lowered_type(unit_ty);
+1128        self.builder.make_unit(unit_ty)
+1129    }
+1130
+1131    fn make_local_constant(
+1132        &mut self,
+1133        name: SmolStr,
+1134        ty: TypeId,
+1135        value: ConstantValue,
+1136        source: SourceInfo,
+1137    ) -> ValueId {
+1138        let function_id = self.builder.func_id();
+1139        let constant = Constant {
+1140            name,
+1141            value,
+1142            ty,
+1143            module_id: function_id.module(self.db),
+1144            source,
+1145        };
+1146
+1147        let constant_id = self.db.mir_intern_const(constant.into());
+1148        self.builder.make_constant(constant_id, ty)
+1149    }
+1150
+1151    fn u256_ty(&mut self) -> TypeId {
+1152        self.db
+1153            .mir_intern_type(ir::Type::new(ir::TypeKind::U256, None).into())
+1154    }
+1155
+1156    fn bool_ty(&mut self) -> TypeId {
+1157        self.db
+1158            .mir_intern_type(ir::Type::new(ir::TypeKind::Bool, None).into())
+1159    }
+1160
+1161    fn enter_loop_scope(&mut self, entry: BasicBlockId, exit: BasicBlockId) {
+1162        let new_scope = Scope::loop_scope(self.current_scope, entry, exit);
+1163        self.current_scope = self.scopes.alloc(new_scope);
+1164    }
+1165
+1166    /// Resolve a name appeared in an expression.
+1167    /// NOTE: Don't call this to resolve method receiver.
+1168    fn resolve_name(&mut self, name: &str) -> ValueId {
+1169        if let Some(value) = self.scopes[self.current_scope].resolve_name(&self.scopes, name) {
+1170            // Name is defined in local.
+1171            value
+1172        } else {
+1173            // Name is defined in global.
+1174            let func_id = self.builder.func_id();
+1175            let module = func_id.module(self.db);
+1176            let constant = match module
+1177                .resolve_name(self.db.upcast(), name)
+1178                .unwrap()
+1179                .unwrap()
+1180            {
+1181                NamedThing::Item(analyzer_items::Item::Constant(id)) => {
+1182                    self.db.mir_lowered_constant(id)
+1183                }
+1184                _ => panic!("name defined in global must be constant"),
+1185            };
+1186            let ty = constant.ty(self.db);
+1187            self.builder.make_constant(constant, ty)
+1188        }
+1189    }
+1190
+1191    /// Resolve a path appeared in an expression.
+1192    /// NOTE: Don't call this to resolve method receiver.
+1193    fn resolve_path(&mut self, path: &ast::Path, source: SourceInfo) -> ValueId {
+1194        let func_id = self.builder.func_id();
+1195        let module = func_id.module(self.db);
+1196        match module.resolve_path(self.db.upcast(), path).value.unwrap() {
+1197            NamedThing::Item(analyzer_items::Item::Constant(id)) => {
+1198                let constant = self.db.mir_lowered_constant(id);
+1199                let ty = constant.ty(self.db);
+1200                self.builder.make_constant(constant, ty)
+1201            }
+1202            NamedThing::EnumVariant(variant) => {
+1203                let enum_ty = self
+1204                    .db
+1205                    .mir_lowered_type(variant.parent(self.db.upcast()).as_type(self.db.upcast()));
+1206                let tag_type = enum_ty.enum_disc_type(self.db);
+1207                let tag = self.make_imm(variant.disc(self.db.upcast()), tag_type);
+1208                let data = self.make_unit();
+1209                let enum_args = vec![tag, data];
+1210                let inst = self.builder.aggregate_construct(enum_ty, enum_args, source);
+1211                self.map_to_tmp(inst, enum_ty)
+1212            }
+1213            _ => panic!("path defined in global must be constant"),
+1214        }
+1215    }
+1216
+1217    fn scope(&self) -> &Scope {
+1218        &self.scopes[self.current_scope]
+1219    }
+1220
+1221    fn scope_mut(&mut self) -> &mut Scope {
+1222        &mut self.scopes[self.current_scope]
+1223    }
+1224}
+1225
+1226#[derive(Debug)]
+1227struct Scope {
+1228    parent: Option<ScopeId>,
+1229    loop_entry: Option<BasicBlockId>,
+1230    loop_exit: Option<BasicBlockId>,
+1231    variables: FxHashMap<SmolStr, ValueId>,
+1232    // TODO: Remove the below two fields when `for` loop desugaring is implemented.
+1233    loop_idx: Option<ValueId>,
+1234    maximum_iter_count: Option<ValueId>,
+1235}
+1236
+1237impl Scope {
+1238    fn root(db: &dyn MirDb, func: FunctionId, builder: &mut BodyBuilder) -> Self {
+1239        let mut root = Self {
+1240            parent: None,
+1241            loop_entry: None,
+1242            loop_exit: None,
+1243            variables: FxHashMap::default(),
+1244            loop_idx: None,
+1245            maximum_iter_count: None,
+1246        };
+1247
+1248        // Declare function parameters.
+1249        for param in &func.signature(db).params {
+1250            let local = Local::arg_local(param.name.clone(), param.ty, param.source.clone());
+1251            let value_id = builder.store_func_arg(local);
+1252            root.declare_var(&param.name, value_id)
+1253        }
+1254
+1255        root
+1256    }
+1257
+1258    fn with_parent(parent: ScopeId) -> Self {
+1259        Self {
+1260            parent: parent.into(),
+1261            loop_entry: None,
+1262            loop_exit: None,
+1263            variables: FxHashMap::default(),
+1264            loop_idx: None,
+1265            maximum_iter_count: None,
+1266        }
+1267    }
+1268
+1269    fn loop_scope(parent: ScopeId, loop_entry: BasicBlockId, loop_exit: BasicBlockId) -> Self {
+1270        Self {
+1271            parent: parent.into(),
+1272            loop_entry: loop_entry.into(),
+1273            loop_exit: loop_exit.into(),
+1274            variables: FxHashMap::default(),
+1275            loop_idx: None,
+1276            maximum_iter_count: None,
+1277        }
+1278    }
+1279
+1280    fn loop_entry(&self, scopes: &Arena<Scope>) -> BasicBlockId {
+1281        match self.loop_entry {
+1282            Some(entry) => entry,
+1283            None => scopes[self.parent.unwrap()].loop_entry(scopes),
+1284        }
+1285    }
+1286
+1287    fn loop_exit(&self, scopes: &Arena<Scope>) -> BasicBlockId {
+1288        match self.loop_exit {
+1289            Some(exit) => exit,
+1290            None => scopes[self.parent.unwrap()].loop_exit(scopes),
+1291        }
+1292    }
+1293
+1294    fn loop_idx(&self, scopes: &Arena<Scope>) -> Option<ValueId> {
+1295        match self.loop_idx {
+1296            Some(idx) => Some(idx),
+1297            None => scopes[self.parent?].loop_idx(scopes),
+1298        }
+1299    }
+1300
+1301    fn maximum_iter_count(&self, scopes: &Arena<Scope>) -> Option<ValueId> {
+1302        match self.maximum_iter_count {
+1303            Some(count) => Some(count),
+1304            None => scopes[self.parent?].maximum_iter_count(scopes),
+1305        }
+1306    }
+1307
+1308    fn declare_var(&mut self, name: &SmolStr, value: ValueId) {
+1309        debug_assert!(!self.variables.contains_key(name));
+1310
+1311        self.variables.insert(name.clone(), value);
+1312    }
+1313
+1314    fn resolve_name(&self, scopes: &Arena<Scope>, name: &str) -> Option<ValueId> {
+1315        match self.variables.get(name) {
+1316            Some(id) => Some(*id),
+1317            None => scopes[self.parent?].resolve_name(scopes, name),
+1318        }
+1319    }
+1320}
+1321
+1322fn self_arg_source(db: &dyn MirDb, func: analyzer_items::FunctionId) -> SourceInfo {
+1323    func.data(db.upcast())
+1324        .ast
+1325        .kind
+1326        .sig
+1327        .kind
+1328        .args
+1329        .iter()
+1330        .find(|arg| matches!(arg.kind, ast::FunctionArg::Self_ { .. }))
+1331        .unwrap()
+1332        .into()
+1333}
+1334
+1335fn arg_source(db: &dyn MirDb, func: analyzer_items::FunctionId, arg_name: &str) -> SourceInfo {
+1336    func.data(db.upcast())
+1337        .ast
+1338        .kind
+1339        .sig
+1340        .kind
+1341        .args
+1342        .iter()
+1343        .find_map(|arg| match &arg.kind {
+1344            ast::FunctionArg::Regular { name, .. } => {
+1345                if name.kind == arg_name {
+1346                    Some(name.into())
+1347                } else {
+1348                    None
+1349                }
+1350            }
+1351            ast::FunctionArg::Self_ { .. } => None,
+1352        })
+1353        .unwrap()
+1354}
+1355
+1356fn make_param(
+1357    db: &dyn MirDb,
+1358    name: impl Into<SmolStr>,
+1359    ty: analyzer_types::TypeId,
+1360    source: SourceInfo,
+1361) -> FunctionParam {
+1362    FunctionParam {
+1363        name: name.into(),
+1364        ty: db.mir_lowered_type(ty),
+1365        source,
+1366    }
+1367}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/lower/mod.rs.html b/compiler-docs/src/fe_mir/lower/mod.rs.html new file mode 100644 index 0000000000..da96068652 --- /dev/null +++ b/compiler-docs/src/fe_mir/lower/mod.rs.html @@ -0,0 +1,4 @@ +mod.rs - source

fe_mir/lower/
mod.rs

1pub mod function;
+2pub mod types;
+3
+4mod pattern_match;
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/lower/pattern_match/decision_tree.rs.html b/compiler-docs/src/fe_mir/lower/pattern_match/decision_tree.rs.html new file mode 100644 index 0000000000..32f1bbf19a --- /dev/null +++ b/compiler-docs/src/fe_mir/lower/pattern_match/decision_tree.rs.html @@ -0,0 +1,576 @@ +decision_tree.rs - source

fe_mir/lower/pattern_match/
decision_tree.rs

1//! This module contains the decision tree definition and its construction
+2//! function.
+3//! The algorithm for efficient decision tree construction is mainly based on [Compiling pattern matching to good decision trees](https://dl.acm.org/doi/10.1145/1411304.1411311).
+4use std::io;
+5
+6use fe_analyzer::{
+7    pattern_analysis::{
+8        ConstructorKind, PatternMatrix, PatternRowVec, SigmaSet, SimplifiedPattern,
+9        SimplifiedPatternKind,
+10    },
+11    AnalyzerDb,
+12};
+13use indexmap::IndexMap;
+14use smol_str::SmolStr;
+15
+16use super::tree_vis::TreeRenderer;
+17
+18pub fn build_decision_tree(
+19    db: &dyn AnalyzerDb,
+20    pattern_matrix: &PatternMatrix,
+21    policy: ColumnSelectionPolicy,
+22) -> DecisionTree {
+23    let builder = DecisionTreeBuilder::new(policy);
+24    let simplified_arms = SimplifiedArmMatrix::new(pattern_matrix);
+25
+26    builder.build(db, simplified_arms)
+27}
+28
+29#[derive(Debug)]
+30pub enum DecisionTree {
+31    Leaf(LeafNode),
+32    Switch(SwitchNode),
+33}
+34
+35impl DecisionTree {
+36    #[allow(unused)]
+37    pub fn dump_dot<W>(&self, db: &dyn AnalyzerDb, w: &mut W) -> io::Result<()>
+38    where
+39        W: io::Write,
+40    {
+41        let renderer = TreeRenderer::new(db, self);
+42        dot2::render(&renderer, w).map_err(|err| match err {
+43            dot2::Error::Io(err) => err,
+44            _ => panic!("invalid graphviz id"),
+45        })
+46    }
+47}
+48
+49#[derive(Debug)]
+50pub struct LeafNode {
+51    pub arm_idx: usize,
+52    pub binds: IndexMap<(SmolStr, usize), Occurrence>,
+53}
+54
+55impl LeafNode {
+56    fn new(arm: SimplifiedArm, occurrences: &[Occurrence]) -> Self {
+57        let arm_idx = arm.body;
+58        let binds = arm.finalize_binds(occurrences);
+59        Self { arm_idx, binds }
+60    }
+61}
+62
+63#[derive(Debug)]
+64pub struct SwitchNode {
+65    pub occurrence: Occurrence,
+66    pub arms: Vec<(Case, DecisionTree)>,
+67}
+68
+69#[derive(Debug, Clone, Copy)]
+70pub enum Case {
+71    Ctor(ConstructorKind),
+72    Default,
+73}
+74
+75#[derive(Debug, Clone, Default)]
+76pub struct ColumnSelectionPolicy(Vec<ColumnScoringFunction>);
+77
+78impl ColumnSelectionPolicy {
+79    /// The score of column i is the sum of the negation of the arities of
+80    /// constructors in sigma(i).
+81    pub fn arity(&mut self) -> &mut Self {
+82        self.add_heuristic(ColumnScoringFunction::Arity)
+83    }
+84
+85    /// The score is the negation of the cardinal of sigma(i), C(Sigma(i)).
+86    /// If sigma(i) is NOT complete, the resulting score is C(Sigma(i)) - 1.
+87    pub fn small_branching(&mut self) -> &mut Self {
+88        self.add_heuristic(ColumnScoringFunction::SmallBranching)
+89    }
+90
+91    /// The score is the number of needed rows of column i in the necessity
+92    /// matrix.
+93    #[allow(unused)]
+94    pub fn needed_column(&mut self) -> &mut Self {
+95        self.add_heuristic(ColumnScoringFunction::NeededColumn)
+96    }
+97
+98    /// The score is the larger row index j such that column i is needed for all
+99    /// rows j′; 1 ≤ j′ ≤ j.
+100    pub fn needed_prefix(&mut self) -> &mut Self {
+101        self.add_heuristic(ColumnScoringFunction::NeededPrefix)
+102    }
+103
+104    fn select_column(&self, db: &dyn AnalyzerDb, mat: &SimplifiedArmMatrix) -> usize {
+105        let mut candidates: Vec<_> = (0..mat.ncols()).collect();
+106
+107        for scoring_fn in &self.0 {
+108            let mut max_score = i32::MIN;
+109            for col in std::mem::take(&mut candidates) {
+110                let score = scoring_fn.score(db, mat, col);
+111                match score.cmp(&max_score) {
+112                    std::cmp::Ordering::Less => {}
+113                    std::cmp::Ordering::Equal => {
+114                        candidates.push(col);
+115                    }
+116                    std::cmp::Ordering::Greater => {
+117                        candidates = vec![col];
+118                        max_score = score;
+119                    }
+120                }
+121            }
+122
+123            if candidates.len() == 1 {
+124                return candidates.pop().unwrap();
+125            }
+126        }
+127
+128        // If there are more than one candidates remained, filter the columns with the
+129        // shortest occurrences among the candidates, then select the rightmost one.
+130        // This heuristics corresponds to the R pseudo heuristic in the paper.
+131        let mut shortest_occurrences = usize::MAX;
+132        for col in std::mem::take(&mut candidates) {
+133            let occurrences = mat.occurrences[col].len();
+134            match occurrences.cmp(&shortest_occurrences) {
+135                std::cmp::Ordering::Less => {
+136                    candidates = vec![col];
+137                    shortest_occurrences = occurrences;
+138                }
+139                std::cmp::Ordering::Equal => {
+140                    candidates.push(col);
+141                }
+142                std::cmp::Ordering::Greater => {}
+143            }
+144        }
+145
+146        candidates.pop().unwrap()
+147    }
+148
+149    fn add_heuristic(&mut self, heuristic: ColumnScoringFunction) -> &mut Self {
+150        debug_assert!(!self.0.contains(&heuristic));
+151        self.0.push(heuristic);
+152        self
+153    }
+154}
+155
+156#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+157pub struct Occurrence(Vec<usize>);
+158
+159impl Occurrence {
+160    pub fn new() -> Self {
+161        Self(vec![])
+162    }
+163
+164    pub fn iter(&self) -> impl Iterator<Item = &usize> {
+165        self.0.iter()
+166    }
+167
+168    pub fn parent(&self) -> Option<Occurrence> {
+169        let mut inner = self.0.clone();
+170        inner.pop().map(|_| Occurrence(inner))
+171    }
+172
+173    pub fn last_index(&self) -> Option<usize> {
+174        self.0.last().cloned()
+175    }
+176
+177    fn phi_specialize(&self, db: &dyn AnalyzerDb, ctor: ConstructorKind) -> Vec<Self> {
+178        let arity = ctor.arity(db);
+179        (0..arity)
+180            .map(|i| {
+181                let mut inner = self.0.clone();
+182                inner.push(i);
+183                Self(inner)
+184            })
+185            .collect()
+186    }
+187
+188    fn len(&self) -> usize {
+189        self.0.len()
+190    }
+191}
+192
+193struct DecisionTreeBuilder {
+194    policy: ColumnSelectionPolicy,
+195}
+196
+197impl DecisionTreeBuilder {
+198    fn new(policy: ColumnSelectionPolicy) -> Self {
+199        DecisionTreeBuilder { policy }
+200    }
+201
+202    fn build(&self, db: &dyn AnalyzerDb, mut mat: SimplifiedArmMatrix) -> DecisionTree {
+203        debug_assert!(mat.nrows() > 0, "unexhausted pattern matrix");
+204
+205        if mat.is_first_arm_satisfied() {
+206            mat.arms.truncate(1);
+207            return DecisionTree::Leaf(LeafNode::new(mat.arms.pop().unwrap(), &mat.occurrences));
+208        }
+209
+210        let col = self.policy.select_column(db, &mat);
+211        mat.swap(col);
+212
+213        let mut switch_arms = vec![];
+214        let occurrence = &mat.occurrences[0];
+215        let sigma_set = mat.sigma_set(0);
+216        for &ctor in sigma_set.iter() {
+217            let destructured_mat = mat.phi_specialize(db, ctor, occurrence);
+218            let subtree = self.build(db, destructured_mat);
+219            switch_arms.push((Case::Ctor(ctor), subtree));
+220        }
+221
+222        if !sigma_set.is_complete(db) {
+223            let destructured_mat = mat.d_specialize(db, occurrence);
+224            let subtree = self.build(db, destructured_mat);
+225            switch_arms.push((Case::Default, subtree));
+226        }
+227
+228        DecisionTree::Switch(SwitchNode {
+229            occurrence: occurrence.clone(),
+230            arms: switch_arms,
+231        })
+232    }
+233}
+234
+235#[derive(Clone, Debug)]
+236struct SimplifiedArmMatrix {
+237    arms: Vec<SimplifiedArm>,
+238    occurrences: Vec<Occurrence>,
+239}
+240
+241impl SimplifiedArmMatrix {
+242    fn new(mat: &PatternMatrix) -> Self {
+243        let cols = mat.ncols();
+244        let arms: Vec<_> = mat
+245            .rows()
+246            .iter()
+247            .enumerate()
+248            .map(|(body, pat)| SimplifiedArm::new(pat, body))
+249            .collect();
+250        let occurrences = vec![Occurrence::new(); cols];
+251
+252        SimplifiedArmMatrix { arms, occurrences }
+253    }
+254
+255    fn nrows(&self) -> usize {
+256        self.arms.len()
+257    }
+258
+259    fn ncols(&self) -> usize {
+260        self.arms[0].pat_vec.len()
+261    }
+262
+263    fn pat(&self, row: usize, col: usize) -> &SimplifiedPattern {
+264        self.arms[row].pat(col)
+265    }
+266
+267    fn necessity_matrix(&self, db: &dyn AnalyzerDb) -> NecessityMatrix {
+268        NecessityMatrix::from_mat(db, self)
+269    }
+270
+271    fn reduced_pat_mat(&self, col: usize) -> PatternMatrix {
+272        let mut rows = Vec::with_capacity(self.nrows());
+273        for arm in self.arms.iter() {
+274            let reduced_pat_vec = arm
+275                .pat_vec
+276                .pats()
+277                .iter()
+278                .enumerate()
+279                .filter(|(i, _)| (*i != col))
+280                .map(|(_, pat)| pat.clone())
+281                .collect();
+282            rows.push(PatternRowVec::new(reduced_pat_vec));
+283        }
+284
+285        PatternMatrix::new(rows)
+286    }
+287
+288    /// Returns the constructor set in the column i.
+289    fn sigma_set(&self, col: usize) -> SigmaSet {
+290        SigmaSet::from_rows(self.arms.iter().map(|arm| &arm.pat_vec), col)
+291    }
+292
+293    fn is_first_arm_satisfied(&self) -> bool {
+294        self.arms[0]
+295            .pat_vec
+296            .pats()
+297            .iter()
+298            .all(SimplifiedPattern::is_wildcard)
+299    }
+300
+301    fn phi_specialize(
+302        &self,
+303        db: &dyn AnalyzerDb,
+304        ctor: ConstructorKind,
+305        occurrence: &Occurrence,
+306    ) -> Self {
+307        let mut new_arms = Vec::new();
+308        for arm in &self.arms {
+309            new_arms.extend_from_slice(&arm.phi_specialize(db, ctor, occurrence));
+310        }
+311
+312        let mut new_occurrences = self.occurrences[0].phi_specialize(db, ctor);
+313        new_occurrences.extend_from_slice(&self.occurrences.as_slice()[1..]);
+314
+315        Self {
+316            arms: new_arms,
+317            occurrences: new_occurrences,
+318        }
+319    }
+320
+321    fn d_specialize(&self, db: &dyn AnalyzerDb, occurrence: &Occurrence) -> Self {
+322        let mut new_arms = Vec::new();
+323        for arm in &self.arms {
+324            new_arms.extend_from_slice(&arm.d_specialize(db, occurrence));
+325        }
+326
+327        Self {
+328            arms: new_arms,
+329            occurrences: self.occurrences.as_slice()[1..].to_vec(),
+330        }
+331    }
+332
+333    fn swap(&mut self, i: usize) {
+334        for arm in &mut self.arms {
+335            arm.swap(0, i)
+336        }
+337        self.occurrences.swap(0, i);
+338    }
+339}
+340
+341#[derive(Clone, Debug)]
+342struct SimplifiedArm {
+343    pat_vec: PatternRowVec,
+344    body: usize,
+345    binds: IndexMap<(SmolStr, usize), Occurrence>,
+346}
+347
+348impl SimplifiedArm {
+349    fn new(pat: &PatternRowVec, body: usize) -> Self {
+350        let pat = PatternRowVec::new(pat.inner.iter().map(generalize_pattern).collect());
+351        Self {
+352            pat_vec: pat,
+353            body,
+354            binds: IndexMap::new(),
+355        }
+356    }
+357
+358    fn len(&self) -> usize {
+359        self.pat_vec.len()
+360    }
+361
+362    fn pat(&self, col: usize) -> &SimplifiedPattern {
+363        &self.pat_vec.inner[col]
+364    }
+365
+366    fn phi_specialize(
+367        &self,
+368        db: &dyn AnalyzerDb,
+369        ctor: ConstructorKind,
+370        occurrence: &Occurrence,
+371    ) -> Vec<Self> {
+372        let body = self.body;
+373        let binds = self.new_binds(occurrence);
+374
+375        self.pat_vec
+376            .phi_specialize(db, ctor)
+377            .into_iter()
+378            .map(|pat| SimplifiedArm {
+379                pat_vec: pat,
+380                body,
+381                binds: binds.clone(),
+382            })
+383            .collect()
+384    }
+385
+386    fn d_specialize(&self, db: &dyn AnalyzerDb, occurrence: &Occurrence) -> Vec<Self> {
+387        let body = self.body;
+388        let binds = self.new_binds(occurrence);
+389
+390        self.pat_vec
+391            .d_specialize(db)
+392            .into_iter()
+393            .map(|pat| SimplifiedArm {
+394                pat_vec: pat,
+395                body,
+396                binds: binds.clone(),
+397            })
+398            .collect()
+399    }
+400
+401    fn new_binds(&self, occurrence: &Occurrence) -> IndexMap<(SmolStr, usize), Occurrence> {
+402        let mut binds = self.binds.clone();
+403        if let Some(SimplifiedPatternKind::WildCard(Some(bind))) =
+404            self.pat_vec.head().map(|pat| &pat.kind)
+405        {
+406            binds.entry(bind.clone()).or_insert(occurrence.clone());
+407        }
+408        binds
+409    }
+410
+411    fn finalize_binds(self, occurrences: &[Occurrence]) -> IndexMap<(SmolStr, usize), Occurrence> {
+412        debug_assert!(self.len() == occurrences.len());
+413
+414        let mut binds = self.binds;
+415        for (pat, occurrence) in self.pat_vec.pats().iter().zip(occurrences.iter()) {
+416            debug_assert!(pat.is_wildcard());
+417
+418            if let SimplifiedPatternKind::WildCard(Some(bind)) = &pat.kind {
+419                binds.entry(bind.clone()).or_insert(occurrence.clone());
+420            }
+421        }
+422
+423        binds
+424    }
+425
+426    fn swap(&mut self, i: usize, j: usize) {
+427        self.pat_vec.swap(i, j);
+428    }
+429}
+430
+431struct NecessityMatrix {
+432    data: Vec<bool>,
+433    ncol: usize,
+434    nrow: usize,
+435}
+436
+437impl NecessityMatrix {
+438    fn new(ncol: usize, nrow: usize) -> Self {
+439        let data = vec![false; ncol * nrow];
+440        Self { data, ncol, nrow }
+441    }
+442
+443    fn from_mat(db: &dyn AnalyzerDb, mat: &SimplifiedArmMatrix) -> Self {
+444        let nrow = mat.nrows();
+445        let ncol = mat.ncols();
+446        let mut necessity_mat = Self::new(ncol, nrow);
+447
+448        necessity_mat.compute(db, mat);
+449        necessity_mat
+450    }
+451
+452    fn compute(&mut self, db: &dyn AnalyzerDb, mat: &SimplifiedArmMatrix) {
+453        for row in 0..self.nrow {
+454            for col in 0..self.ncol {
+455                let pat = mat.pat(row, col);
+456                let pos = self.pos(row, col);
+457
+458                if !pat.is_wildcard() {
+459                    self.data[pos] = true;
+460                } else {
+461                    let reduced_pat_mat = mat.reduced_pat_mat(col);
+462                    self.data[pos] = !reduced_pat_mat.is_row_useful(db, row);
+463                }
+464            }
+465        }
+466    }
+467
+468    fn compute_needed_column_score(&self, col: usize) -> i32 {
+469        let mut num = 0;
+470        for i in 0..self.nrow {
+471            if self.data[self.pos(i, col)] {
+472                num += 1;
+473            }
+474        }
+475
+476        num
+477    }
+478
+479    fn compute_needed_prefix_score(&self, col: usize) -> i32 {
+480        let mut current_row = 0;
+481        for i in 0..self.nrow {
+482            if self.data[self.pos(i, col)] {
+483                current_row += 1;
+484            } else {
+485                return current_row;
+486            }
+487        }
+488
+489        current_row
+490    }
+491
+492    fn pos(&self, row: usize, col: usize) -> usize {
+493        self.ncol * row + col
+494    }
+495}
+496
+497#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+498enum ColumnScoringFunction {
+499    /// The score of column i is the sum of the negation of the arities of
+500    /// constructors in sigma(i).
+501    Arity,
+502
+503    /// The score is the negation of the cardinal of sigma(i), C(Sigma(i)).
+504    /// If sigma(i) is NOT complete, the resulting score is C(Sigma(i)) - 1.
+505    SmallBranching,
+506
+507    /// The score is the number of needed rows of column i in the necessity
+508    /// matrix.
+509    NeededColumn,
+510
+511    NeededPrefix,
+512}
+513
+514impl ColumnScoringFunction {
+515    fn score(&self, db: &dyn AnalyzerDb, mat: &SimplifiedArmMatrix, col: usize) -> i32 {
+516        match self {
+517            ColumnScoringFunction::Arity => mat
+518                .sigma_set(col)
+519                .iter()
+520                .map(|c| -(c.arity(db) as i32))
+521                .sum(),
+522
+523            ColumnScoringFunction::SmallBranching => {
+524                let sigma_set = mat.sigma_set(col);
+525                let score = -(mat.sigma_set(col).len() as i32);
+526                if sigma_set.is_complete(db) {
+527                    score
+528                } else {
+529                    score - 1
+530                }
+531            }
+532
+533            ColumnScoringFunction::NeededColumn => {
+534                mat.necessity_matrix(db).compute_needed_column_score(col)
+535            }
+536
+537            ColumnScoringFunction::NeededPrefix => {
+538                mat.necessity_matrix(db).compute_needed_prefix_score(col)
+539            }
+540        }
+541    }
+542}
+543
+544fn generalize_pattern(pat: &SimplifiedPattern) -> SimplifiedPattern {
+545    match &pat.kind {
+546        SimplifiedPatternKind::WildCard(_) => pat.clone(),
+547
+548        SimplifiedPatternKind::Constructor { kind, fields } => {
+549            let fields = fields.iter().map(generalize_pattern).collect();
+550            let kind = SimplifiedPatternKind::Constructor {
+551                kind: *kind,
+552                fields,
+553            };
+554            SimplifiedPattern::new(kind, pat.ty)
+555        }
+556
+557        SimplifiedPatternKind::Or(pats) => {
+558            let mut gen_pats = vec![];
+559            for pat in pats {
+560                let gen_pad = generalize_pattern(pat);
+561                if gen_pad.is_wildcard() {
+562                    gen_pats.push(gen_pad);
+563                    break;
+564                } else {
+565                    gen_pats.push(gen_pad);
+566                }
+567            }
+568
+569            if gen_pats.len() == 1 {
+570                gen_pats.pop().unwrap()
+571            } else {
+572                SimplifiedPattern::new(SimplifiedPatternKind::Or(gen_pats), pat.ty)
+573            }
+574        }
+575    }
+576}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/lower/pattern_match/mod.rs.html b/compiler-docs/src/fe_mir/lower/pattern_match/mod.rs.html new file mode 100644 index 0000000000..85765f29f3 --- /dev/null +++ b/compiler-docs/src/fe_mir/lower/pattern_match/mod.rs.html @@ -0,0 +1,326 @@ +mod.rs - source

fe_mir/lower/pattern_match/
mod.rs

1use fe_analyzer::pattern_analysis::{ConstructorKind, PatternMatrix};
+2use fe_parser::{
+3    ast::{Expr, LiteralPattern, MatchArm},
+4    node::Node,
+5};
+6use fxhash::FxHashMap;
+7use id_arena::{Arena, Id};
+8use smol_str::SmolStr;
+9
+10use crate::ir::{
+11    body_builder::BodyBuilder, inst::SwitchTable, BasicBlockId, SourceInfo, TypeId, ValueId,
+12};
+13
+14use self::decision_tree::{
+15    Case, ColumnSelectionPolicy, DecisionTree, LeafNode, Occurrence, SwitchNode,
+16};
+17
+18use super::function::BodyLowerHelper;
+19
+20pub mod decision_tree;
+21mod tree_vis;
+22
+23pub(super) fn lower_match<'b>(
+24    helper: &'b mut BodyLowerHelper<'_, '_>,
+25    mat: &PatternMatrix,
+26    scrutinee: &Node<Expr>,
+27    arms: &'b [Node<MatchArm>],
+28) {
+29    let mut policy = ColumnSelectionPolicy::default();
+30    // PBA heuristics described in the paper.
+31    policy.needed_prefix().small_branching().arity();
+32
+33    let scrutinee = helper.lower_expr_to_value(scrutinee);
+34    let decision_tree = decision_tree::build_decision_tree(helper.db.upcast(), mat, policy);
+35
+36    DecisionTreeLowerHelper::new(helper, scrutinee, arms).lower(decision_tree);
+37}
+38
+39struct DecisionTreeLowerHelper<'db, 'a, 'b> {
+40    helper: &'b mut BodyLowerHelper<'db, 'a>,
+41    scopes: Arena<Scope>,
+42    current_scope: ScopeId,
+43    root_block: BasicBlockId,
+44    declared_vars: FxHashMap<(SmolStr, usize), ValueId>,
+45    arms: &'b [Node<MatchArm>],
+46    lowered_arms: FxHashMap<usize, BasicBlockId>,
+47    match_exit: BasicBlockId,
+48}
+49
+50impl<'db, 'a, 'b> DecisionTreeLowerHelper<'db, 'a, 'b> {
+51    fn new(
+52        helper: &'b mut BodyLowerHelper<'db, 'a>,
+53        scrutinee: ValueId,
+54        arms: &'b [Node<MatchArm>],
+55    ) -> Self {
+56        let match_exit = helper.builder.make_block();
+57
+58        let mut scope = Scope::default();
+59        scope.register_occurrence(Occurrence::new(), scrutinee);
+60        let mut scopes = Arena::new();
+61        let current_scope = scopes.alloc(scope);
+62
+63        let root_block = helper.builder.current_block();
+64
+65        DecisionTreeLowerHelper {
+66            helper,
+67            scopes,
+68            current_scope,
+69            root_block,
+70            declared_vars: FxHashMap::default(),
+71            arms,
+72            lowered_arms: FxHashMap::default(),
+73            match_exit,
+74        }
+75    }
+76
+77    fn lower(&mut self, tree: DecisionTree) {
+78        self.lower_tree(tree);
+79
+80        let match_exit = self.match_exit;
+81        self.builder().move_to_block(match_exit);
+82    }
+83
+84    fn lower_tree(&mut self, tree: DecisionTree) {
+85        match tree {
+86            DecisionTree::Leaf(leaf) => self.lower_leaf(leaf),
+87            DecisionTree::Switch(switch) => self.lower_switch(switch),
+88        }
+89    }
+90
+91    fn lower_leaf(&mut self, leaf: LeafNode) {
+92        for (var, occurrence) in leaf.binds {
+93            let occurrence_value = self.resolve_occurrence(&occurrence);
+94            let ty = self.builder().value_ty(occurrence_value);
+95            let var_value = self.declare_or_use_var(&var, ty);
+96
+97            let inst = self.builder().bind(occurrence_value, SourceInfo::dummy());
+98            self.builder().map_result(inst, var_value.into());
+99        }
+100
+101        let arm_body = self.lower_arm_body(leaf.arm_idx);
+102        self.builder().jump(arm_body, SourceInfo::dummy());
+103    }
+104
+105    fn lower_switch(&mut self, mut switch: SwitchNode) {
+106        let current_bb = self.builder().current_block();
+107        let occurrence_value = self.resolve_occurrence(&switch.occurrence);
+108
+109        if switch.arms.len() == 1 {
+110            let arm = switch.arms.pop().unwrap();
+111            let arm_bb = self.enter_arm(&switch.occurrence, &arm.0);
+112            self.lower_tree(arm.1);
+113            self.builder().move_to_block(current_bb);
+114            self.builder().jump(arm_bb, SourceInfo::dummy());
+115            return;
+116        }
+117
+118        let mut table = SwitchTable::default();
+119        let mut default_arm = None;
+120        let occurrence_ty = self.builder().value_ty(occurrence_value);
+121
+122        for (case, tree) in switch.arms {
+123            let arm_bb = self.enter_arm(&switch.occurrence, &case);
+124            self.lower_tree(tree);
+125            self.leave_arm();
+126
+127            if let Some(disc) = self.case_to_disc(&case, occurrence_ty) {
+128                table.add_arm(disc, arm_bb);
+129            } else {
+130                debug_assert!(default_arm.is_none());
+131                default_arm = Some(arm_bb);
+132            }
+133        }
+134
+135        self.builder().move_to_block(current_bb);
+136        let disc = self.extract_disc(occurrence_value);
+137        self.builder()
+138            .switch(disc, table, default_arm, SourceInfo::dummy());
+139    }
+140
+141    fn lower_arm_body(&mut self, index: usize) -> BasicBlockId {
+142        if let Some(block) = self.lowered_arms.get(&index) {
+143            *block
+144        } else {
+145            let current_bb = self.builder().current_block();
+146            let body_bb = self.builder().make_block();
+147
+148            self.builder().move_to_block(body_bb);
+149            for stmt in &self.arms[index].kind.body {
+150                self.helper.lower_stmt(stmt);
+151            }
+152
+153            if !self.builder().is_current_block_terminated() {
+154                let match_exit = self.match_exit;
+155                self.builder().jump(match_exit, SourceInfo::dummy());
+156            }
+157
+158            self.lowered_arms.insert(index, body_bb);
+159            self.builder().move_to_block(current_bb);
+160            body_bb
+161        }
+162    }
+163
+164    fn enter_arm(&mut self, occurrence: &Occurrence, case: &Case) -> BasicBlockId {
+165        self.helper.enter_scope();
+166
+167        let bb = self.builder().make_block();
+168        self.builder().move_to_block(bb);
+169
+170        let scope = Scope::with_parent(self.current_scope);
+171        self.current_scope = self.scopes.alloc(scope);
+172
+173        self.update_occurrence(occurrence, case);
+174        bb
+175    }
+176
+177    fn leave_arm(&mut self) {
+178        self.current_scope = self.scopes[self.current_scope].parent.unwrap();
+179        self.helper.leave_scope();
+180    }
+181
+182    fn case_to_disc(&mut self, case: &Case, occurrence_ty: TypeId) -> Option<ValueId> {
+183        match case {
+184            Case::Ctor(ConstructorKind::Enum(variant)) => {
+185                let disc_ty = occurrence_ty.enum_disc_type(self.helper.db);
+186                let disc = variant.disc(self.helper.db.upcast());
+187                Some(self.helper.make_imm(disc, disc_ty))
+188            }
+189
+190            Case::Ctor(ConstructorKind::Literal((LiteralPattern::Bool(b), ty))) => {
+191                let ty = self.helper.db.mir_lowered_type(*ty);
+192                Some(self.builder().make_imm_from_bool(*b, ty))
+193            }
+194
+195            Case::Ctor(ConstructorKind::Tuple(_))
+196            | Case::Ctor(ConstructorKind::Struct(_))
+197            | Case::Default => None,
+198        }
+199    }
+200
+201    fn update_occurrence(&mut self, occurrence: &Occurrence, case: &Case) {
+202        let old_value = self.resolve_occurrence(occurrence);
+203        let old_ty = self.builder().value_ty(old_value);
+204
+205        match case {
+206            Case::Ctor(ConstructorKind::Enum(variant)) => {
+207                let new_ty = old_ty.enum_variant_type(self.helper.db, *variant);
+208                let cast = self
+209                    .builder()
+210                    .untag_cast(old_value, new_ty, SourceInfo::dummy());
+211                let value = self.helper.map_to_tmp(cast, new_ty);
+212                self.current_scope_mut()
+213                    .register_occurrence(occurrence.clone(), value)
+214            }
+215
+216            Case::Ctor(ConstructorKind::Literal((LiteralPattern::Bool(b), _))) => {
+217                let value = self.builder().make_imm_from_bool(*b, old_ty);
+218                self.current_scope_mut()
+219                    .register_occurrence(occurrence.clone(), value)
+220            }
+221
+222            Case::Ctor(ConstructorKind::Tuple(_))
+223            | Case::Ctor(ConstructorKind::Struct(_))
+224            | Case::Default => {}
+225        }
+226    }
+227
+228    fn extract_disc(&mut self, value: ValueId) -> ValueId {
+229        let value_ty = self.builder().value_ty(value);
+230        match value_ty {
+231            _ if value_ty.deref(self.helper.db).is_enum(self.helper.db) => {
+232                let disc_ty = value_ty.enum_disc_type(self.helper.db);
+233                let disc_index = self.helper.make_u256_imm(0);
+234                let inst =
+235                    self.builder()
+236                        .aggregate_access(value, vec![disc_index], SourceInfo::dummy());
+237                self.helper.map_to_tmp(inst, disc_ty)
+238            }
+239
+240            _ => value,
+241        }
+242    }
+243
+244    fn declare_or_use_var(&mut self, var: &(SmolStr, usize), ty: TypeId) -> ValueId {
+245        if let Some(value) = self.declared_vars.get(var) {
+246            *value
+247        } else {
+248            let current_block = self.builder().current_block();
+249            let root_block = self.root_block;
+250            self.builder().move_to_block_top(root_block);
+251            let value = self.helper.declare_var(&var.0, ty, SourceInfo::dummy());
+252            self.builder().move_to_block(current_block);
+253            self.declared_vars.insert(var.clone(), value);
+254            value
+255        }
+256    }
+257
+258    fn builder(&mut self) -> &mut BodyBuilder {
+259        &mut self.helper.builder
+260    }
+261
+262    fn resolve_occurrence(&mut self, occurrence: &Occurrence) -> ValueId {
+263        if let Some(value) = self
+264            .current_scope()
+265            .resolve_occurrence(&self.scopes, occurrence)
+266        {
+267            return value;
+268        }
+269
+270        let parent = occurrence.parent().unwrap();
+271        let parent_value = self.resolve_occurrence(&parent);
+272        let parent_value_ty = self.builder().value_ty(parent_value);
+273
+274        let index = occurrence.last_index().unwrap();
+275        let index_value = self.helper.make_u256_imm(occurrence.last_index().unwrap());
+276        let inst =
+277            self.builder()
+278                .aggregate_access(parent_value, vec![index_value], SourceInfo::dummy());
+279
+280        let ty = parent_value_ty.projection_ty_imm(self.helper.db, index);
+281        let value = self.helper.map_to_tmp(inst, ty);
+282        self.current_scope_mut()
+283            .register_occurrence(occurrence.clone(), value);
+284        value
+285    }
+286
+287    fn current_scope(&self) -> &Scope {
+288        self.scopes.get(self.current_scope).unwrap()
+289    }
+290
+291    fn current_scope_mut(&mut self) -> &mut Scope {
+292        self.scopes.get_mut(self.current_scope).unwrap()
+293    }
+294}
+295
+296type ScopeId = Id<Scope>;
+297
+298#[derive(Debug, Default)]
+299struct Scope {
+300    parent: Option<ScopeId>,
+301    occurrences: FxHashMap<Occurrence, ValueId>,
+302}
+303
+304impl Scope {
+305    pub fn with_parent(parent: ScopeId) -> Self {
+306        Self {
+307            parent: Some(parent),
+308            ..Default::default()
+309        }
+310    }
+311
+312    pub fn register_occurrence(&mut self, occurrence: Occurrence, value: ValueId) {
+313        self.occurrences.insert(occurrence, value);
+314    }
+315
+316    pub fn resolve_occurrence(
+317        &self,
+318        arena: &Arena<Scope>,
+319        occurrence: &Occurrence,
+320    ) -> Option<ValueId> {
+321        match self.occurrences.get(occurrence) {
+322            Some(value) => Some(*value),
+323            None => arena[self.parent?].resolve_occurrence(arena, occurrence),
+324        }
+325    }
+326}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/lower/pattern_match/tree_vis.rs.html b/compiler-docs/src/fe_mir/lower/pattern_match/tree_vis.rs.html new file mode 100644 index 0000000000..403dfcd549 --- /dev/null +++ b/compiler-docs/src/fe_mir/lower/pattern_match/tree_vis.rs.html @@ -0,0 +1,150 @@ +tree_vis.rs - source

fe_mir/lower/pattern_match/
tree_vis.rs

1use std::fmt::Write;
+2
+3use dot2::{label::Text, Id};
+4use fe_analyzer::{pattern_analysis::ConstructorKind, AnalyzerDb};
+5use fxhash::FxHashMap;
+6use indexmap::IndexMap;
+7use smol_str::SmolStr;
+8
+9use super::decision_tree::{Case, DecisionTree, LeafNode, Occurrence, SwitchNode};
+10
+11pub(super) struct TreeRenderer<'db> {
+12    nodes: Vec<Node>,
+13    edges: FxHashMap<(usize, usize), Case>,
+14    db: &'db dyn AnalyzerDb,
+15}
+16
+17impl<'db> TreeRenderer<'db> {
+18    #[allow(unused)]
+19    pub(super) fn new(db: &'db dyn AnalyzerDb, tree: &DecisionTree) -> Self {
+20        let mut renderer = Self {
+21            nodes: Vec::new(),
+22            edges: FxHashMap::default(),
+23            db,
+24        };
+25
+26        match tree {
+27            DecisionTree::Leaf(leaf) => {
+28                renderer.nodes.push(Node::from(leaf));
+29            }
+30            DecisionTree::Switch(switch) => {
+31                renderer.nodes.push(Node::from(switch));
+32                let node_id = renderer.nodes.len() - 1;
+33                for arm in &switch.arms {
+34                    renderer.switch_from(&arm.1, node_id, arm.0);
+35                }
+36            }
+37        }
+38        renderer
+39    }
+40
+41    fn switch_from(&mut self, tree: &DecisionTree, node_id: usize, case: Case) {
+42        match tree {
+43            DecisionTree::Leaf(leaf) => {
+44                self.nodes.push(Node::from(leaf));
+45                self.edges.insert((node_id, self.nodes.len() - 1), case);
+46            }
+47
+48            DecisionTree::Switch(switch) => {
+49                self.nodes.push(Node::from(switch));
+50                let switch_id = self.nodes.len() - 1;
+51                self.edges.insert((node_id, switch_id), case);
+52                for arm in &switch.arms {
+53                    self.switch_from(&arm.1, switch_id, arm.0);
+54                }
+55            }
+56        }
+57    }
+58}
+59
+60impl<'db> dot2::Labeller<'db> for TreeRenderer<'db> {
+61    type Node = usize;
+62    type Edge = (Self::Node, Self::Node);
+63    type Subgraph = ();
+64
+65    fn graph_id(&self) -> dot2::Result<Id<'db>> {
+66        dot2::Id::new("DecisionTree")
+67    }
+68
+69    fn node_id(&self, n: &Self::Node) -> dot2::Result<Id<'db>> {
+70        dot2::Id::new(format!("N{}", *n))
+71    }
+72
+73    fn node_label(&self, n: &Self::Node) -> dot2::Result<Text<'db>> {
+74        let node = &self.nodes[*n];
+75        let label = match node {
+76            Node::Leaf { arm_idx, .. } => {
+77                format!("arm_idx: {arm_idx}")
+78            }
+79            Node::Switch(occurrence) => {
+80                let mut s = "expr".to_string();
+81                for num in occurrence.iter() {
+82                    write!(&mut s, ".{num}").unwrap();
+83                }
+84                s
+85            }
+86        };
+87
+88        Ok(Text::LabelStr(label.into()))
+89    }
+90
+91    fn edge_label(&self, e: &Self::Edge) -> Text<'db> {
+92        let label = match &self.edges[e] {
+93            Case::Ctor(ConstructorKind::Enum(variant)) => {
+94                variant.name_with_parent(self.db).to_string()
+95            }
+96            Case::Ctor(ConstructorKind::Tuple(_)) => "()".to_string(),
+97            Case::Ctor(ConstructorKind::Struct(sid)) => sid.name(self.db).into(),
+98            Case::Ctor(ConstructorKind::Literal((lit, _))) => lit.to_string(),
+99            Case::Default => "_".into(),
+100        };
+101
+102        Text::LabelStr(label.into())
+103    }
+104}
+105
+106impl<'db> dot2::GraphWalk<'db> for TreeRenderer<'db> {
+107    type Node = usize;
+108    type Edge = (Self::Node, Self::Node);
+109    type Subgraph = ();
+110
+111    fn nodes(&self) -> dot2::Nodes<'db, Self::Node> {
+112        (0..self.nodes.len()).collect()
+113    }
+114
+115    fn edges(&self) -> dot2::Edges<'db, Self::Edge> {
+116        self.edges.keys().cloned().collect::<Vec<_>>().into()
+117    }
+118
+119    fn source(&self, e: &Self::Edge) -> Self::Node {
+120        e.0
+121    }
+122
+123    fn target(&self, e: &Self::Edge) -> Self::Node {
+124        e.1
+125    }
+126}
+127
+128enum Node {
+129    Leaf {
+130        arm_idx: usize,
+131        #[allow(unused)]
+132        binds: IndexMap<(SmolStr, usize), Occurrence>,
+133    },
+134    Switch(Occurrence),
+135}
+136
+137impl From<&LeafNode> for Node {
+138    fn from(node: &LeafNode) -> Self {
+139        Node::Leaf {
+140            arm_idx: node.arm_idx,
+141            binds: node.binds.clone(),
+142        }
+143    }
+144}
+145
+146impl From<&SwitchNode> for Node {
+147    fn from(node: &SwitchNode) -> Self {
+148        Node::Switch(node.occurrence.clone())
+149    }
+150}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/lower/types.rs.html b/compiler-docs/src/fe_mir/lower/types.rs.html new file mode 100644 index 0000000000..dab676fb43 --- /dev/null +++ b/compiler-docs/src/fe_mir/lower/types.rs.html @@ -0,0 +1,194 @@ +types.rs - source

fe_mir/lower/
types.rs

1use crate::{
+2    db::MirDb,
+3    ir::{
+4        types::{ArrayDef, EnumDef, EnumVariant, MapDef, StructDef, TupleDef},
+5        Type, TypeId, TypeKind,
+6    },
+7};
+8
+9use fe_analyzer::namespace::{
+10    items as analyzer_items,
+11    types::{self as analyzer_types, TraitOrType},
+12};
+13
+14pub fn lower_type(db: &dyn MirDb, analyzer_ty: analyzer_types::TypeId) -> TypeId {
+15    let ty_kind = match analyzer_ty.typ(db.upcast()) {
+16        analyzer_types::Type::SPtr(inner) => TypeKind::SPtr(lower_type(db, inner)),
+17
+18        // NOTE: this results in unexpected MIR TypeId inequalities
+19        //  (when different analyzer types map to the same MIR type).
+20        //  We could (should?) remove .analyzer_ty from Type.
+21        analyzer_types::Type::Mut(inner) => match inner.typ(db.upcast()) {
+22            analyzer_types::Type::SPtr(t) => TypeKind::SPtr(lower_type(db, t)),
+23            analyzer_types::Type::Base(t) => lower_base(t),
+24            analyzer_types::Type::Contract(_) => TypeKind::Address,
+25            _ => TypeKind::MPtr(lower_type(db, inner)),
+26        },
+27        analyzer_types::Type::SelfType(inner) => match inner {
+28            TraitOrType::TypeId(id) => return lower_type(db, id),
+29            TraitOrType::TraitId(_) => panic!("traits aren't lowered"),
+30        },
+31        analyzer_types::Type::Base(base) => lower_base(base),
+32        analyzer_types::Type::Array(arr) => lower_array(db, &arr),
+33        analyzer_types::Type::Map(map) => lower_map(db, &map),
+34        analyzer_types::Type::Tuple(tup) => lower_tuple(db, &tup),
+35        analyzer_types::Type::String(string) => TypeKind::String(string.max_size),
+36        analyzer_types::Type::Contract(_) => TypeKind::Address,
+37        analyzer_types::Type::SelfContract(contract) => lower_contract(db, contract),
+38        analyzer_types::Type::Struct(struct_) => lower_struct(db, struct_),
+39        analyzer_types::Type::Enum(enum_) => lower_enum(db, enum_),
+40        analyzer_types::Type::Generic(_) => {
+41            panic!("should be lowered in `lower_analyzer_type`")
+42        }
+43    };
+44
+45    intern_type(db, ty_kind, Some(analyzer_ty.deref(db.upcast())))
+46}
+47
+48fn lower_base(base: analyzer_types::Base) -> TypeKind {
+49    use analyzer_types::{Base, Integer};
+50
+51    match base {
+52        Base::Numeric(int_ty) => match int_ty {
+53            Integer::I8 => TypeKind::I8,
+54            Integer::I16 => TypeKind::I16,
+55            Integer::I32 => TypeKind::I32,
+56            Integer::I64 => TypeKind::I64,
+57            Integer::I128 => TypeKind::I128,
+58            Integer::I256 => TypeKind::I256,
+59            Integer::U8 => TypeKind::U8,
+60            Integer::U16 => TypeKind::U16,
+61            Integer::U32 => TypeKind::U32,
+62            Integer::U64 => TypeKind::U64,
+63            Integer::U128 => TypeKind::U128,
+64            Integer::U256 => TypeKind::U256,
+65        },
+66
+67        Base::Bool => TypeKind::Bool,
+68        Base::Address => TypeKind::Address,
+69        Base::Unit => TypeKind::Unit,
+70    }
+71}
+72
+73fn lower_array(db: &dyn MirDb, arr: &analyzer_types::Array) -> TypeKind {
+74    let len = arr.size;
+75    let elem_ty = db.mir_lowered_type(arr.inner);
+76
+77    let def = ArrayDef { elem_ty, len };
+78    TypeKind::Array(def)
+79}
+80
+81fn lower_map(db: &dyn MirDb, map: &analyzer_types::Map) -> TypeKind {
+82    let key_ty = db.mir_lowered_type(map.key);
+83    let value_ty = db.mir_lowered_type(map.value);
+84
+85    let def = MapDef { key_ty, value_ty };
+86    TypeKind::Map(def)
+87}
+88
+89fn lower_tuple(db: &dyn MirDb, tup: &analyzer_types::Tuple) -> TypeKind {
+90    let items = tup
+91        .items
+92        .iter()
+93        .map(|item| db.mir_lowered_type(*item))
+94        .collect();
+95
+96    let def = TupleDef { items };
+97    TypeKind::Tuple(def)
+98}
+99
+100fn lower_contract(db: &dyn MirDb, contract: analyzer_items::ContractId) -> TypeKind {
+101    let name = contract.name(db.upcast());
+102
+103    // Note: contract field types are wrapped in SPtr in TypeId::projection_ty
+104    let fields = contract
+105        .fields(db.upcast())
+106        .iter()
+107        .map(|(fname, fid)| {
+108            let analyzer_type = fid.typ(db.upcast()).unwrap();
+109            let ty = db.mir_lowered_type(analyzer_type);
+110            (fname.clone(), ty)
+111        })
+112        .collect();
+113
+114    // Obtain span.
+115    let span = contract.span(db.upcast());
+116
+117    let module_id = contract.module(db.upcast());
+118
+119    let def = StructDef {
+120        name,
+121        fields,
+122        span,
+123        module_id,
+124    };
+125    TypeKind::Contract(def)
+126}
+127
+128fn lower_struct(db: &dyn MirDb, id: analyzer_items::StructId) -> TypeKind {
+129    let name = id.name(db.upcast());
+130
+131    // Lower struct fields.
+132    let fields = id
+133        .fields(db.upcast())
+134        .iter()
+135        .map(|(fname, fid)| {
+136            let analyzer_types = fid.typ(db.upcast()).unwrap();
+137            let ty = db.mir_lowered_type(analyzer_types);
+138            (fname.clone(), ty)
+139        })
+140        .collect();
+141
+142    // obtain span.
+143    let span = id.span(db.upcast());
+144
+145    let module_id = id.module(db.upcast());
+146
+147    let def = StructDef {
+148        name,
+149        fields,
+150        span,
+151        module_id,
+152    };
+153    TypeKind::Struct(def)
+154}
+155
+156fn lower_enum(db: &dyn MirDb, id: analyzer_items::EnumId) -> TypeKind {
+157    let analyzer_variants = id.variants(db.upcast());
+158    let mut variants = Vec::with_capacity(analyzer_variants.len());
+159    for variant in analyzer_variants.values() {
+160        let variant_ty = match variant.kind(db.upcast()).unwrap() {
+161            analyzer_items::EnumVariantKind::Tuple(elts) => {
+162                let tuple_ty = analyzer_types::TypeId::tuple(db.upcast(), &elts);
+163                db.mir_lowered_type(tuple_ty)
+164            }
+165            analyzer_items::EnumVariantKind::Unit => {
+166                let unit_ty = analyzer_types::TypeId::unit(db.upcast());
+167                db.mir_lowered_type(unit_ty)
+168            }
+169        };
+170
+171        variants.push(EnumVariant {
+172            name: variant.name(db.upcast()),
+173            span: variant.span(db.upcast()),
+174            ty: variant_ty,
+175        });
+176    }
+177
+178    let def = EnumDef {
+179        name: id.name(db.upcast()),
+180        span: id.span(db.upcast()),
+181        variants,
+182        module_id: id.module(db.upcast()),
+183    };
+184
+185    TypeKind::Enum(def)
+186}
+187
+188fn intern_type(
+189    db: &dyn MirDb,
+190    ty_kind: TypeKind,
+191    analyzer_type: Option<analyzer_types::TypeId>,
+192) -> TypeId {
+193    db.mir_intern_type(Type::new(ty_kind, analyzer_type).into())
+194}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/pretty_print/inst.rs.html b/compiler-docs/src/fe_mir/pretty_print/inst.rs.html new file mode 100644 index 0000000000..48372c9de9 --- /dev/null +++ b/compiler-docs/src/fe_mir/pretty_print/inst.rs.html @@ -0,0 +1,206 @@ +inst.rs - source

fe_mir/pretty_print/
inst.rs

1use std::fmt::{self, Write};
+2
+3use crate::{
+4    db::MirDb,
+5    ir::{function::BodyDataStore, inst::InstKind, InstId},
+6};
+7
+8use super::PrettyPrint;
+9
+10impl PrettyPrint for InstId {
+11    fn pretty_print<W: Write>(
+12        &self,
+13        db: &dyn MirDb,
+14        store: &BodyDataStore,
+15        w: &mut W,
+16    ) -> fmt::Result {
+17        if let Some(result) = store.inst_result(*self) {
+18            result.pretty_print(db, store, w)?;
+19            write!(w, ": ")?;
+20
+21            let result_ty = result.ty(db, store);
+22            result_ty.pretty_print(db, store, w)?;
+23            write!(w, " = ")?;
+24        }
+25
+26        match &store.inst_data(*self).kind {
+27            InstKind::Declare { local } => {
+28                write!(w, "let ")?;
+29                local.pretty_print(db, store, w)?;
+30                write!(w, ": ")?;
+31                store.value_ty(*local).pretty_print(db, store, w)
+32            }
+33
+34            InstKind::Unary { op, value } => {
+35                write!(w, "{op}")?;
+36                value.pretty_print(db, store, w)
+37            }
+38
+39            InstKind::Binary { op, lhs, rhs } => {
+40                lhs.pretty_print(db, store, w)?;
+41                write!(w, " {op} ")?;
+42                rhs.pretty_print(db, store, w)
+43            }
+44
+45            InstKind::Cast { value, to, .. } => {
+46                value.pretty_print(db, store, w)?;
+47                write!(w, " as ")?;
+48                to.pretty_print(db, store, w)
+49            }
+50
+51            InstKind::AggregateConstruct { ty, args } => {
+52                ty.pretty_print(db, store, w)?;
+53                write!(w, "{{")?;
+54                if args.is_empty() {
+55                    return write!(w, "}}");
+56                }
+57
+58                let arg_len = args.len();
+59                for (arg_idx, arg) in args.iter().enumerate().take(arg_len - 1) {
+60                    write!(w, "<{arg_idx}>: ")?;
+61                    arg.pretty_print(db, store, w)?;
+62                    write!(w, ", ")?;
+63                }
+64                let arg = args[arg_len - 1];
+65                write!(w, "<{}>: ", arg_len - 1)?;
+66                arg.pretty_print(db, store, w)?;
+67                write!(w, "}}")
+68            }
+69
+70            InstKind::Bind { src } => {
+71                write!(w, "bind ")?;
+72                src.pretty_print(db, store, w)
+73            }
+74
+75            InstKind::MemCopy { src } => {
+76                write!(w, "memcopy ")?;
+77                src.pretty_print(db, store, w)
+78            }
+79
+80            InstKind::Load { src } => {
+81                write!(w, "load ")?;
+82                src.pretty_print(db, store, w)
+83            }
+84
+85            InstKind::AggregateAccess { value, indices } => {
+86                value.pretty_print(db, store, w)?;
+87                for index in indices {
+88                    write!(w, ".<")?;
+89                    index.pretty_print(db, store, w)?;
+90                    write!(w, ">")?
+91                }
+92                Ok(())
+93            }
+94
+95            InstKind::MapAccess { value, key } => {
+96                value.pretty_print(db, store, w)?;
+97                write!(w, "{{")?;
+98                key.pretty_print(db, store, w)?;
+99                write!(w, "}}")
+100            }
+101
+102            InstKind::Call {
+103                func,
+104                args,
+105                call_type,
+106            } => {
+107                let name = func.debug_name(db);
+108                write!(w, "{name}@{call_type}(")?;
+109                args.as_slice().pretty_print(db, store, w)?;
+110                write!(w, ")")
+111            }
+112
+113            InstKind::Jump { dest } => {
+114                write!(w, "jump BB{}", dest.index())
+115            }
+116
+117            InstKind::Branch { cond, then, else_ } => {
+118                write!(w, "branch ")?;
+119                cond.pretty_print(db, store, w)?;
+120                write!(w, " then: BB{} else: BB{}", then.index(), else_.index())
+121            }
+122
+123            InstKind::Switch {
+124                disc,
+125                table,
+126                default,
+127            } => {
+128                write!(w, "switch ")?;
+129                disc.pretty_print(db, store, w)?;
+130                for (value, block) in table.iter() {
+131                    write!(w, " ")?;
+132                    value.pretty_print(db, store, w)?;
+133                    write!(w, ": BB{}", block.index())?;
+134                }
+135
+136                if let Some(default) = default {
+137                    write!(w, " default: BB{}", default.index())
+138                } else {
+139                    Ok(())
+140                }
+141            }
+142
+143            InstKind::Revert { arg } => {
+144                write!(w, "revert ")?;
+145                if let Some(arg) = arg {
+146                    arg.pretty_print(db, store, w)?;
+147                }
+148                Ok(())
+149            }
+150
+151            InstKind::Emit { arg } => {
+152                write!(w, "emit ")?;
+153                arg.pretty_print(db, store, w)
+154            }
+155
+156            InstKind::Return { arg } => {
+157                if let Some(arg) = arg {
+158                    write!(w, "return ")?;
+159                    arg.pretty_print(db, store, w)
+160                } else {
+161                    write!(w, "return")
+162                }
+163            }
+164
+165            InstKind::Keccak256 { arg } => {
+166                write!(w, "keccak256 ")?;
+167                arg.pretty_print(db, store, w)
+168            }
+169
+170            InstKind::AbiEncode { arg } => {
+171                write!(w, "abi_encode ")?;
+172                arg.pretty_print(db, store, w)
+173            }
+174
+175            InstKind::Nop => {
+176                write!(w, "nop")
+177            }
+178
+179            InstKind::Create { value, contract } => {
+180                write!(w, "create ")?;
+181                let contract_name = contract.name(db.upcast());
+182                write!(w, "{contract_name} ")?;
+183                value.pretty_print(db, store, w)
+184            }
+185
+186            InstKind::Create2 {
+187                value,
+188                salt,
+189                contract,
+190            } => {
+191                write!(w, "create2 ")?;
+192                let contract_name = contract.name(db.upcast());
+193                write!(w, "{contract_name} ")?;
+194                value.pretty_print(db, store, w)?;
+195                write!(w, " ")?;
+196                salt.pretty_print(db, store, w)
+197            }
+198
+199            InstKind::YulIntrinsic { op, args } => {
+200                write!(w, "{op}(")?;
+201                args.as_slice().pretty_print(db, store, w)?;
+202                write!(w, ")")
+203            }
+204        }
+205    }
+206}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/pretty_print/mod.rs.html b/compiler-docs/src/fe_mir/pretty_print/mod.rs.html new file mode 100644 index 0000000000..cce97a3ea5 --- /dev/null +++ b/compiler-docs/src/fe_mir/pretty_print/mod.rs.html @@ -0,0 +1,22 @@ +mod.rs - source

fe_mir/pretty_print/
mod.rs

1use std::fmt;
+2
+3use crate::{db::MirDb, ir::function::BodyDataStore};
+4
+5mod inst;
+6mod types;
+7mod value;
+8
+9pub trait PrettyPrint {
+10    fn pretty_print<W: fmt::Write>(
+11        &self,
+12        db: &dyn MirDb,
+13        store: &BodyDataStore,
+14        w: &mut W,
+15    ) -> fmt::Result;
+16
+17    fn pretty_string(&self, db: &dyn MirDb, store: &BodyDataStore) -> String {
+18        let mut s = String::new();
+19        self.pretty_print(db, store, &mut s).unwrap();
+20        s
+21    }
+22}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/pretty_print/types.rs.html b/compiler-docs/src/fe_mir/pretty_print/types.rs.html new file mode 100644 index 0000000000..cc535f0e72 --- /dev/null +++ b/compiler-docs/src/fe_mir/pretty_print/types.rs.html @@ -0,0 +1,19 @@ +types.rs - source

fe_mir/pretty_print/
types.rs

1use std::fmt::{self, Write};
+2
+3use crate::{
+4    db::MirDb,
+5    ir::{function::BodyDataStore, TypeId},
+6};
+7
+8use super::PrettyPrint;
+9
+10impl PrettyPrint for TypeId {
+11    fn pretty_print<W: Write>(
+12        &self,
+13        db: &dyn MirDb,
+14        _store: &BodyDataStore,
+15        w: &mut W,
+16    ) -> fmt::Result {
+17        self.print(db, w)
+18    }
+19}
\ No newline at end of file diff --git a/compiler-docs/src/fe_mir/pretty_print/value.rs.html b/compiler-docs/src/fe_mir/pretty_print/value.rs.html new file mode 100644 index 0000000000..06cd8c2c53 --- /dev/null +++ b/compiler-docs/src/fe_mir/pretty_print/value.rs.html @@ -0,0 +1,81 @@ +value.rs - source

fe_mir/pretty_print/
value.rs

1use std::fmt::{self, Write};
+2
+3use crate::{
+4    db::MirDb,
+5    ir::{
+6        constant::ConstantValue, function::BodyDataStore, value::AssignableValue, Value, ValueId,
+7    },
+8};
+9
+10use super::PrettyPrint;
+11
+12impl PrettyPrint for ValueId {
+13    fn pretty_print<W: Write>(
+14        &self,
+15        db: &dyn MirDb,
+16        store: &BodyDataStore,
+17        w: &mut W,
+18    ) -> fmt::Result {
+19        match store.value_data(*self) {
+20            Value::Temporary { .. } | Value::Local(_) => write!(w, "_{}", self.index()),
+21            Value::Immediate { imm, .. } => write!(w, "{imm}"),
+22            Value::Constant { constant, .. } => {
+23                let const_value = constant.data(db);
+24                write!(w, "const ")?;
+25                match &const_value.value {
+26                    ConstantValue::Immediate(num) => write!(w, "{num}"),
+27                    ConstantValue::Str(s) => write!(w, r#""{s}""#),
+28                    ConstantValue::Bool(b) => write!(w, "{b}"),
+29                }
+30            }
+31            Value::Unit { .. } => write!(w, "()"),
+32        }
+33    }
+34}
+35
+36impl PrettyPrint for &[ValueId] {
+37    fn pretty_print<W: Write>(
+38        &self,
+39        db: &dyn MirDb,
+40        store: &BodyDataStore,
+41        w: &mut W,
+42    ) -> fmt::Result {
+43        if self.is_empty() {
+44            return Ok(());
+45        }
+46
+47        let arg_len = self.len();
+48        for arg in self.iter().take(arg_len - 1) {
+49            arg.pretty_print(db, store, w)?;
+50            write!(w, ", ")?;
+51        }
+52        let arg = self[arg_len - 1];
+53        arg.pretty_print(db, store, w)
+54    }
+55}
+56
+57impl PrettyPrint for AssignableValue {
+58    fn pretty_print<W: Write>(
+59        &self,
+60        db: &dyn MirDb,
+61        store: &BodyDataStore,
+62        w: &mut W,
+63    ) -> fmt::Result {
+64        match self {
+65            Self::Value(value) => value.pretty_print(db, store, w),
+66            Self::Aggregate { lhs, idx } => {
+67                lhs.pretty_print(db, store, w)?;
+68                write!(w, ".<")?;
+69                idx.pretty_print(db, store, w)?;
+70                write!(w, ">")
+71            }
+72
+73            Self::Map { lhs, key } => {
+74                lhs.pretty_print(db, store, w)?;
+75                write!(w, "{{")?;
+76                key.pretty_print(db, store, w)?;
+77                write!(w, "}}")
+78            }
+79        }
+80    }
+81}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/ast.rs.html b/compiler-docs/src/fe_parser/ast.rs.html new file mode 100644 index 0000000000..a0444a4788 --- /dev/null +++ b/compiler-docs/src/fe_parser/ast.rs.html @@ -0,0 +1,1421 @@ +ast.rs - source

fe_parser/
ast.rs

1use crate::node::Node;
+2use fe_common::{Span, Spanned};
+3use indenter::indented;
+4use serde::{Deserialize, Serialize};
+5pub use smol_str::SmolStr;
+6use std::fmt;
+7use std::fmt::Formatter;
+8use std::fmt::Write;
+9use vec1::Vec1;
+10
+11#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+12pub struct Module {
+13    pub body: Vec<ModuleStmt>,
+14}
+15
+16#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+17pub enum ModuleStmt {
+18    Pragma(Node<Pragma>),
+19    Use(Node<Use>),
+20    TypeAlias(Node<TypeAlias>),
+21    Contract(Node<Contract>),
+22    Constant(Node<ConstantDecl>),
+23    Struct(Node<Struct>),
+24    Enum(Node<Enum>),
+25    Trait(Node<Trait>),
+26    Impl(Node<Impl>),
+27    Function(Node<Function>),
+28    Attribute(Node<SmolStr>),
+29    ParseError(Span),
+30}
+31
+32#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+33pub struct Pragma {
+34    pub version_requirement: Node<SmolStr>,
+35}
+36
+37#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+38pub struct Path {
+39    pub segments: Vec<Node<SmolStr>>,
+40}
+41
+42impl Path {
+43    pub fn remove_last(&self) -> Path {
+44        Path {
+45            segments: self.segments[0..self.segments.len() - 1].to_vec(),
+46        }
+47    }
+48}
+49
+50#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+51pub struct Use {
+52    pub tree: Node<UseTree>,
+53}
+54
+55#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+56pub enum UseTree {
+57    Glob {
+58        prefix: Path,
+59    },
+60    Nested {
+61        prefix: Path,
+62        children: Vec<Node<UseTree>>,
+63    },
+64    Simple {
+65        path: Path,
+66        rename: Option<Node<SmolStr>>,
+67    },
+68}
+69
+70#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+71pub struct ConstantDecl {
+72    pub name: Node<SmolStr>,
+73    pub typ: Node<TypeDesc>,
+74    pub value: Node<Expr>,
+75    pub pub_qual: Option<Span>,
+76}
+77
+78#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+79pub struct TypeAlias {
+80    pub name: Node<SmolStr>,
+81    pub typ: Node<TypeDesc>,
+82    pub pub_qual: Option<Span>,
+83}
+84
+85#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+86pub struct Contract {
+87    pub name: Node<SmolStr>,
+88    pub fields: Vec<Node<Field>>,
+89    pub body: Vec<ContractStmt>,
+90    pub pub_qual: Option<Span>,
+91}
+92
+93#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+94pub struct Struct {
+95    pub name: Node<SmolStr>,
+96    pub fields: Vec<Node<Field>>,
+97    pub functions: Vec<Node<Function>>,
+98    pub pub_qual: Option<Span>,
+99}
+100
+101#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+102pub struct Enum {
+103    pub name: Node<SmolStr>,
+104    pub variants: Vec<Node<Variant>>,
+105    pub functions: Vec<Node<Function>>,
+106    pub pub_qual: Option<Span>,
+107}
+108
+109#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+110pub struct Trait {
+111    pub name: Node<SmolStr>,
+112    pub functions: Vec<Node<FunctionSignature>>,
+113    pub pub_qual: Option<Span>,
+114}
+115
+116#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+117pub struct Impl {
+118    pub impl_trait: Node<SmolStr>,
+119    pub receiver: Node<TypeDesc>,
+120    pub functions: Vec<Node<Function>>,
+121}
+122
+123#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+124pub enum TypeDesc {
+125    Unit,
+126    // TODO: replace with `Name(SmolStr)`, or eliminate in favor of `Path`?
+127    Base {
+128        base: SmolStr,
+129    },
+130    Path(Path),
+131    Tuple {
+132        items: Vec1<Node<TypeDesc>>,
+133    },
+134    Generic {
+135        // TODO: when we support user-defined generic types,
+136        // this will have to be a `Path`
+137        base: Node<SmolStr>,
+138        args: Node<Vec<GenericArg>>,
+139    },
+140    SelfType,
+141}
+142
+143#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+144pub enum GenericArg {
+145    TypeDesc(Node<TypeDesc>),
+146    Int(Node<usize>),
+147    ConstExpr(Node<Expr>),
+148}
+149
+150impl Spanned for GenericArg {
+151    fn span(&self) -> Span {
+152        match self {
+153            GenericArg::TypeDesc(node) => node.span,
+154            GenericArg::Int(node) => node.span,
+155            GenericArg::ConstExpr(node) => node.span,
+156        }
+157    }
+158}
+159
+160#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+161pub enum GenericParameter {
+162    Unbounded(Node<SmolStr>),
+163    Bounded {
+164        name: Node<SmolStr>,
+165        bound: Node<TypeDesc>,
+166    },
+167}
+168
+169impl GenericParameter {
+170    pub fn name(&self) -> SmolStr {
+171        self.name_node().kind
+172    }
+173
+174    pub fn name_node(&self) -> Node<SmolStr> {
+175        match self {
+176            GenericParameter::Unbounded(node) => node.clone(),
+177            GenericParameter::Bounded { name, .. } => name.clone(),
+178        }
+179    }
+180}
+181
+182impl Spanned for GenericParameter {
+183    fn span(&self) -> Span {
+184        match self {
+185            GenericParameter::Unbounded(node) => node.span,
+186            GenericParameter::Bounded { name, bound } => name.span + bound.span,
+187        }
+188    }
+189}
+190
+191/// struct or contract field, with optional 'pub' and 'const' qualifiers
+192#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+193pub struct Field {
+194    pub is_pub: bool,
+195    pub is_const: bool,
+196    pub attributes: Vec<Node<SmolStr>>,
+197    pub name: Node<SmolStr>,
+198    pub typ: Node<TypeDesc>,
+199    pub value: Option<Node<Expr>>,
+200}
+201
+202/// Enum variant definition.
+203#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+204pub struct Variant {
+205    pub name: Node<SmolStr>,
+206    pub kind: VariantKind,
+207}
+208
+209/// Enum variant kind.
+210#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+211pub enum VariantKind {
+212    /// Unit variant.
+213    /// E.g., `Bar` in
+214    ///
+215    /// ```fe
+216    /// enum Foo {
+217    ///     Bar
+218    ///     Baz(u32, i32)
+219    /// }
+220    /// ```
+221    Unit,
+222
+223    /// Tuple variant.
+224    /// E.g., `Baz(u32, i32)` in
+225    ///
+226    /// ```fe
+227    /// enum Foo {
+228    ///     Bar
+229    ///     Baz(u32, i32)
+230    /// }
+231    /// ```
+232    Tuple(Vec<Node<TypeDesc>>),
+233}
+234
+235#[allow(clippy::large_enum_variant)]
+236#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+237pub enum ContractStmt {
+238    Function(Node<Function>),
+239}
+240
+241#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+242pub struct FunctionSignature {
+243    // qualifier order: `pub unsafe fn`
+244    pub pub_: Option<Span>,
+245    pub unsafe_: Option<Span>,
+246    pub name: Node<SmolStr>,
+247    pub generic_params: Node<Vec<GenericParameter>>,
+248    pub args: Vec<Node<FunctionArg>>,
+249    pub return_type: Option<Node<TypeDesc>>,
+250}
+251
+252#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+253pub struct Function {
+254    pub sig: Node<FunctionSignature>,
+255    pub body: Vec<Node<FuncStmt>>,
+256}
+257
+258#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+259#[allow(clippy::large_enum_variant)]
+260pub enum FunctionArg {
+261    Regular {
+262        mut_: Option<Span>,
+263        label: Option<Node<SmolStr>>,
+264        name: Node<SmolStr>,
+265        typ: Node<TypeDesc>,
+266    },
+267    Self_ {
+268        mut_: Option<Span>,
+269    },
+270}
+271impl FunctionArg {
+272    pub fn label_span(&self) -> Option<Span> {
+273        match self {
+274            Self::Regular { label, .. } => label.as_ref().map(|label| label.span),
+275            Self::Self_ { .. } => None,
+276        }
+277    }
+278
+279    pub fn name_span(&self) -> Option<Span> {
+280        match self {
+281            Self::Regular { name, .. } => Some(name.span),
+282            Self::Self_ { .. } => None,
+283        }
+284    }
+285
+286    pub fn typ_span(&self) -> Option<Span> {
+287        match self {
+288            Self::Regular { typ, .. } => Some(typ.span),
+289            Self::Self_ { .. } => None,
+290        }
+291    }
+292}
+293
+294#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+295pub enum FuncStmt {
+296    Return {
+297        value: Option<Node<Expr>>,
+298    },
+299    VarDecl {
+300        mut_: Option<Span>,
+301        target: Node<VarDeclTarget>,
+302        typ: Node<TypeDesc>,
+303        value: Option<Node<Expr>>,
+304    },
+305    ConstantDecl {
+306        name: Node<SmolStr>,
+307        typ: Node<TypeDesc>,
+308        value: Node<Expr>,
+309    },
+310    Assign {
+311        target: Node<Expr>,
+312        value: Node<Expr>,
+313    },
+314    AugAssign {
+315        target: Node<Expr>,
+316        op: Node<BinOperator>,
+317        value: Node<Expr>,
+318    },
+319    For {
+320        target: Node<SmolStr>,
+321        iter: Node<Expr>,
+322        body: Vec<Node<FuncStmt>>,
+323    },
+324    While {
+325        test: Node<Expr>,
+326        body: Vec<Node<FuncStmt>>,
+327    },
+328    If {
+329        test: Node<Expr>,
+330        body: Vec<Node<FuncStmt>>,
+331        or_else: Vec<Node<FuncStmt>>,
+332    },
+333    Match {
+334        expr: Node<Expr>,
+335        arms: Vec<Node<MatchArm>>,
+336    },
+337    Assert {
+338        test: Node<Expr>,
+339        msg: Option<Node<Expr>>,
+340    },
+341    Expr {
+342        value: Node<Expr>,
+343    },
+344    Break,
+345    Continue,
+346    Revert {
+347        error: Option<Node<Expr>>,
+348    },
+349    Unsafe(Vec<Node<FuncStmt>>),
+350}
+351
+352#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+353pub struct MatchArm {
+354    pub pat: Node<Pattern>,
+355    pub body: Vec<Node<FuncStmt>>,
+356}
+357
+358#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+359pub enum Pattern {
+360    /// Represents a wildcard pattern `_`.
+361    WildCard,
+362    /// Rest pattern. e.g., `..`
+363    Rest,
+364    /// Represents a literal pattern. e.g., `true`.
+365    Literal(Node<LiteralPattern>),
+366    /// Represents tuple destructuring pattern. e.g., `(x, y, z)`.
+367    Tuple(Vec<Node<Pattern>>),
+368    /// Represents unit variant pattern. e.g., `Enum::Unit`.
+369    Path(Node<Path>),
+370    /// Represents tuple variant pattern. e.g., `Enum::Tuple(x, y, z)`.
+371    PathTuple(Node<Path>, Vec<Node<Pattern>>),
+372    /// Represents struct or struct variant destructuring pattern. e.g.,
+373    /// `MyStruct {x: pat1, y: pat2}}`.
+374    PathStruct {
+375        path: Node<Path>,
+376        fields: Vec<(Node<SmolStr>, Node<Pattern>)>,
+377        has_rest: bool,
+378    },
+379    /// Represents or pattern. e.g., `EnumUnit | EnumTuple(_, _, _)`
+380    Or(Vec<Node<Pattern>>),
+381}
+382
+383impl Pattern {
+384    pub fn is_rest(&self) -> bool {
+385        matches!(self, Pattern::Rest)
+386    }
+387}
+388
+389#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone, Copy)]
+390pub enum LiteralPattern {
+391    Bool(bool),
+392}
+393
+394#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+395pub enum VarDeclTarget {
+396    Name(SmolStr),
+397    Tuple(Vec<Node<VarDeclTarget>>),
+398}
+399
+400#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+401pub enum Expr {
+402    Ternary {
+403        if_expr: Box<Node<Expr>>,
+404        test: Box<Node<Expr>>,
+405        else_expr: Box<Node<Expr>>,
+406    },
+407    BoolOperation {
+408        left: Box<Node<Expr>>,
+409        op: Node<BoolOperator>,
+410        right: Box<Node<Expr>>,
+411    },
+412    BinOperation {
+413        left: Box<Node<Expr>>,
+414        op: Node<BinOperator>,
+415        right: Box<Node<Expr>>,
+416    },
+417    UnaryOperation {
+418        op: Node<UnaryOperator>,
+419        operand: Box<Node<Expr>>,
+420    },
+421    CompOperation {
+422        left: Box<Node<Expr>>,
+423        op: Node<CompOperator>,
+424        right: Box<Node<Expr>>,
+425    },
+426    Attribute {
+427        value: Box<Node<Expr>>,
+428        attr: Node<SmolStr>,
+429    },
+430    Subscript {
+431        value: Box<Node<Expr>>,
+432        index: Box<Node<Expr>>,
+433    },
+434    Call {
+435        func: Box<Node<Expr>>,
+436        generic_args: Option<Node<Vec<GenericArg>>>,
+437        args: Node<Vec<Node<CallArg>>>,
+438    },
+439    List {
+440        elts: Vec<Node<Expr>>,
+441    },
+442    Repeat {
+443        value: Box<Node<Expr>>,
+444        len: Box<Node<GenericArg>>,
+445    },
+446    Tuple {
+447        elts: Vec<Node<Expr>>,
+448    },
+449    Bool(bool),
+450    Name(SmolStr),
+451    Path(Path),
+452    Num(SmolStr),
+453    Str(SmolStr),
+454    Unit,
+455}
+456
+457#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+458pub struct CallArg {
+459    pub label: Option<Node<SmolStr>>,
+460    pub value: Node<Expr>,
+461}
+462
+463#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone, Copy)]
+464pub enum BoolOperator {
+465    And,
+466    Or,
+467}
+468
+469#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone, Copy)]
+470pub enum BinOperator {
+471    Add,
+472    Sub,
+473    Mult,
+474    Div,
+475    Mod,
+476    Pow,
+477    LShift,
+478    RShift,
+479    BitOr,
+480    BitXor,
+481    BitAnd,
+482}
+483
+484#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone, Copy)]
+485pub enum UnaryOperator {
+486    Invert,
+487    Not,
+488    USub,
+489}
+490
+491#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone, Copy)]
+492pub enum CompOperator {
+493    Eq,
+494    NotEq,
+495    Lt,
+496    LtE,
+497    Gt,
+498    GtE,
+499}
+500
+501impl Node<Contract> {
+502    pub fn name(&self) -> &str {
+503        &self.kind.name.kind
+504    }
+505}
+506
+507impl Node<Struct> {
+508    pub fn name(&self) -> &str {
+509        &self.kind.name.kind
+510    }
+511}
+512
+513impl Node<Enum> {
+514    pub fn name(&self) -> &str {
+515        &self.kind.name.kind
+516    }
+517}
+518
+519impl Node<Variant> {
+520    pub fn name(&self) -> &str {
+521        &self.kind.name.kind
+522    }
+523}
+524
+525impl Node<Trait> {
+526    pub fn name(&self) -> &str {
+527        &self.kind.name.kind
+528    }
+529}
+530
+531impl Node<Field> {
+532    pub fn name(&self) -> &str {
+533        &self.kind.name.kind
+534    }
+535}
+536
+537impl Node<Function> {
+538    pub fn name(&self) -> &str {
+539        &self.kind.sig.kind.name.kind
+540    }
+541}
+542
+543impl Node<FunctionArg> {
+544    pub fn name(&self) -> &str {
+545        match &self.kind {
+546            FunctionArg::Regular { name, .. } => &name.kind,
+547            FunctionArg::Self_ { .. } => "self",
+548        }
+549    }
+550
+551    pub fn name_span(&self) -> Span {
+552        match &self.kind {
+553            FunctionArg::Regular { name, .. } => name.span,
+554            FunctionArg::Self_ { .. } => self.span,
+555        }
+556    }
+557}
+558
+559impl Node<TypeAlias> {
+560    pub fn name(&self) -> &str {
+561        &self.kind.name.kind
+562    }
+563}
+564
+565impl Spanned for ModuleStmt {
+566    fn span(&self) -> Span {
+567        match self {
+568            ModuleStmt::Pragma(inner) => inner.span,
+569            ModuleStmt::Use(inner) => inner.span,
+570            ModuleStmt::Trait(inner) => inner.span,
+571            ModuleStmt::Impl(inner) => inner.span,
+572            ModuleStmt::TypeAlias(inner) => inner.span,
+573            ModuleStmt::Contract(inner) => inner.span,
+574            ModuleStmt::Constant(inner) => inner.span,
+575            ModuleStmt::Struct(inner) => inner.span,
+576            ModuleStmt::Enum(inner) => inner.span,
+577            ModuleStmt::Function(inner) => inner.span,
+578            ModuleStmt::Attribute(inner) => inner.span,
+579            ModuleStmt::ParseError(span) => *span,
+580        }
+581    }
+582}
+583
+584impl Spanned for ContractStmt {
+585    fn span(&self) -> Span {
+586        match self {
+587            ContractStmt::Function(inner) => inner.span,
+588        }
+589    }
+590}
+591
+592impl fmt::Display for Module {
+593    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+594        let (uses, rest): (Vec<&ModuleStmt>, Vec<&ModuleStmt>) = self
+595            .body
+596            .iter()
+597            .partition(|&stmt| matches!(stmt, ModuleStmt::Use(_) | ModuleStmt::Pragma(_)));
+598        for stmt in &uses {
+599            writeln!(f, "{stmt}")?;
+600        }
+601        if !uses.is_empty() && !rest.is_empty() {
+602            writeln!(f)?;
+603        }
+604        let mut delim = "";
+605        for stmt in rest {
+606            writeln!(f, "{delim}{stmt}")?;
+607            delim = "\n";
+608        }
+609        Ok(())
+610    }
+611}
+612
+613impl fmt::Display for ModuleStmt {
+614    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+615        match self {
+616            ModuleStmt::Pragma(node) => write!(f, "{}", node.kind),
+617            ModuleStmt::Use(node) => write!(f, "{}", node.kind),
+618            ModuleStmt::Trait(node) => write!(f, "{}", node.kind),
+619            ModuleStmt::Impl(node) => write!(f, "{}", node.kind),
+620            ModuleStmt::TypeAlias(node) => write!(f, "{}", node.kind),
+621            ModuleStmt::Contract(node) => write!(f, "{}", node.kind),
+622            ModuleStmt::Constant(node) => write!(f, "{}", node.kind),
+623            ModuleStmt::Struct(node) => write!(f, "{}", node.kind),
+624            ModuleStmt::Enum(node) => write!(f, "{}", node.kind),
+625            ModuleStmt::Function(node) => write!(f, "{}", node.kind),
+626            ModuleStmt::Attribute(node) => writeln!(f, "#{}", node.kind),
+627            ModuleStmt::ParseError(span) => {
+628                write!(f, "# PARSE ERROR: {}..{}", span.start, span.end)
+629            }
+630        }
+631    }
+632}
+633
+634impl fmt::Display for Pragma {
+635    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+636        write!(f, "pragma {}", self.version_requirement.kind)
+637    }
+638}
+639
+640impl fmt::Display for Use {
+641    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+642        // TODO pub use
+643        write!(f, "use {}", self.tree.kind)
+644    }
+645}
+646
+647impl fmt::Display for UseTree {
+648    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+649        match self {
+650            UseTree::Glob { prefix } => write!(f, "{prefix}::*"),
+651            UseTree::Simple { path, rename } => {
+652                if let Some(rename) = rename {
+653                    write!(f, "{} as {}", path, rename.kind)
+654                } else {
+655                    write!(f, "{path}")
+656                }
+657            }
+658            UseTree::Nested { prefix, children } => {
+659                write!(f, "{}::{{{}}}", prefix, node_comma_joined(children))
+660            }
+661        }
+662    }
+663}
+664
+665impl fmt::Display for Path {
+666    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+667        let joined_names = self
+668            .segments
+669            .iter()
+670            .map(|name| name.kind.as_ref())
+671            .collect::<Vec<_>>()
+672            .join("::");
+673        write!(f, "{joined_names}")?;
+674
+675        Ok(())
+676    }
+677}
+678
+679impl fmt::Display for ConstantDecl {
+680    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+681        let ConstantDecl {
+682            name,
+683            typ,
+684            value,
+685            pub_qual,
+686        } = self;
+687        if pub_qual.is_some() {
+688            write!(f, "pub ")?;
+689        }
+690        write!(f, "const {}: {} = {}", name.kind, typ.kind, value.kind)
+691    }
+692}
+693
+694impl fmt::Display for Trait {
+695    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+696        writeln!(f, "trait {}:", self.name.kind)?;
+697
+698        Ok(())
+699    }
+700}
+701
+702impl fmt::Display for Impl {
+703    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+704        writeln!(
+705            f,
+706            "impl {} for {}",
+707            self.impl_trait.kind, self.receiver.kind
+708        )?;
+709
+710        Ok(())
+711    }
+712}
+713
+714impl fmt::Display for TypeAlias {
+715    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+716        let TypeAlias {
+717            name,
+718            typ,
+719            pub_qual,
+720        } = self;
+721        if pub_qual.is_some() {
+722            write!(f, "pub ")?;
+723        }
+724        write!(f, "type {} = {}", name.kind, typ.kind)
+725    }
+726}
+727
+728impl fmt::Display for Contract {
+729    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+730        let Contract {
+731            name,
+732            fields,
+733            body,
+734            pub_qual,
+735        } = self;
+736
+737        if pub_qual.is_some() {
+738            write!(f, "pub ")?;
+739        }
+740        write!(f, "contract {} {{", name.kind)?;
+741
+742        if !fields.is_empty() {
+743            for field in fields {
+744                writeln!(f)?;
+745                write!(indented(f), "{}", field.kind)?;
+746            }
+747            writeln!(f)?;
+748        }
+749        if !body.is_empty() {
+750            writeln!(f)?;
+751            write!(indented(f), "{}", double_line_joined(body))?;
+752            writeln!(f)?;
+753        }
+754        write!(f, "}}")
+755    }
+756}
+757
+758impl fmt::Display for Struct {
+759    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+760        let Struct {
+761            name,
+762            fields,
+763            functions,
+764            pub_qual,
+765        } = self;
+766
+767        if pub_qual.is_some() {
+768            write!(f, "pub ")?;
+769        }
+770        write!(f, "struct {} ", name.kind)?;
+771        write!(f, "{{")?;
+772        write_nodes_line_wrapped(&mut indented(f), fields)?;
+773
+774        if !self.fields.is_empty() && !functions.is_empty() {
+775            writeln!(f)?;
+776        }
+777        if !functions.is_empty() {
+778            writeln!(indented(f), "{}", double_line_joined(functions))?;
+779        }
+780        write!(f, "}}")
+781    }
+782}
+783
+784impl fmt::Display for Enum {
+785    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+786        let Enum {
+787            name,
+788            variants,
+789            functions,
+790            pub_qual,
+791        } = self;
+792
+793        if pub_qual.is_some() {
+794            write!(f, "pub ")?;
+795        }
+796
+797        write!(f, "enum {} ", name.kind)?;
+798        write!(f, "{{")?;
+799        write_nodes_line_wrapped(&mut indented(f), variants)?;
+800
+801        if !functions.is_empty() {
+802            writeln!(indented(f), "{}", double_line_joined(functions))?;
+803        }
+804        write!(f, "}}")
+805    }
+806}
+807
+808impl fmt::Display for TypeDesc {
+809    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+810        match self {
+811            TypeDesc::Unit => write!(f, "()"),
+812            TypeDesc::Base { base } => write!(f, "{base}"),
+813            TypeDesc::Path(path) => write!(f, "{path}"),
+814            TypeDesc::Tuple { items } => {
+815                if items.len() == 1 {
+816                    write!(f, "({},)", items[0].kind)
+817                } else {
+818                    write!(f, "({})", node_comma_joined(items))
+819                }
+820            }
+821            TypeDesc::Generic { base, args } => {
+822                write!(f, "{}<{}>", base.kind, comma_joined(args.kind.iter()))
+823            }
+824            TypeDesc::SelfType => write!(f, "Self"),
+825        }
+826    }
+827}
+828
+829impl fmt::Display for GenericParameter {
+830    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+831        match self {
+832            GenericParameter::Unbounded(name) => write!(f, "{}", name.kind),
+833            GenericParameter::Bounded { name, bound } => write!(f, "{}: {}", name.kind, bound.kind),
+834        }
+835    }
+836}
+837
+838impl fmt::Display for GenericArg {
+839    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+840        match self {
+841            GenericArg::TypeDesc(node) => write!(f, "{}", node.kind),
+842            GenericArg::Int(node) => write!(f, "{}", node.kind),
+843            GenericArg::ConstExpr(node) => write!(f, "{{ {} }}", node.kind),
+844        }
+845    }
+846}
+847
+848impl fmt::Display for Field {
+849    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+850        if self.is_pub {
+851            write!(f, "pub ")?;
+852        }
+853        if self.is_const {
+854            write!(f, "const ")?;
+855        }
+856        write!(f, "{}: {}", self.name.kind, self.typ.kind)
+857    }
+858}
+859
+860impl fmt::Display for Variant {
+861    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+862        write!(f, "{}", self.name.kind)?;
+863        match &self.kind {
+864            VariantKind::Unit => Ok(()),
+865            VariantKind::Tuple(elts) => {
+866                write!(f, "({})", node_comma_joined(elts))
+867            }
+868        }
+869    }
+870}
+871
+872impl fmt::Display for ContractStmt {
+873    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+874        match self {
+875            ContractStmt::Function(node) => write!(f, "{}", node.kind),
+876        }
+877    }
+878}
+879
+880impl fmt::Display for Node<Function> {
+881    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+882        self.kind.fmt(f)
+883    }
+884}
+885
+886impl fmt::Display for Function {
+887    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+888        let FunctionSignature {
+889            pub_,
+890            unsafe_,
+891            name,
+892            generic_params,
+893            args,
+894            return_type,
+895        } = &self.sig.kind;
+896
+897        if pub_.is_some() {
+898            write!(f, "pub ")?;
+899        }
+900        if unsafe_.is_some() {
+901            write!(f, "unsafe ")?;
+902        }
+903        write!(f, "fn {}", name.kind)?;
+904        if !generic_params.kind.is_empty() {
+905            write!(f, "<{}>", comma_joined(generic_params.kind.iter()))?;
+906        }
+907        write!(f, "({})", node_comma_joined(args))?;
+908
+909        if let Some(return_type) = return_type.as_ref() {
+910            write!(f, " -> {}", return_type.kind)?;
+911        }
+912        write!(f, " {{")?;
+913        write_nodes_line_wrapped(&mut indented(f), &self.body)?;
+914        write!(f, "}}")
+915    }
+916}
+917
+918impl fmt::Display for FunctionArg {
+919    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+920        match self {
+921            FunctionArg::Regular {
+922                mut_,
+923                label,
+924                name,
+925                typ,
+926            } => {
+927                if mut_.is_some() {
+928                    write!(f, "mut ")?
+929                }
+930                if let Some(label) = label {
+931                    write!(f, "{} ", label.kind)?
+932                }
+933
+934                write!(f, "{}: {}", name.kind, typ.kind)
+935            }
+936            FunctionArg::Self_ { mut_ } => {
+937                if mut_.is_some() {
+938                    write!(f, "mut ")?;
+939                }
+940                write!(f, "self")
+941            }
+942        }
+943    }
+944}
+945
+946impl fmt::Display for FuncStmt {
+947    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+948        match self {
+949            FuncStmt::Return { value } => {
+950                if let Some(value) = value {
+951                    write!(f, "return {}", value.kind)
+952                } else {
+953                    write!(f, "return")
+954                }
+955            }
+956            FuncStmt::VarDecl {
+957                mut_,
+958                target,
+959                typ,
+960                value,
+961            } => {
+962                let mut_ = if mut_.is_some() { "mut " } else { "" };
+963                if let Some(value) = value {
+964                    write!(
+965                        f,
+966                        "let {}{}: {} = {}",
+967                        mut_, target.kind, typ.kind, value.kind
+968                    )
+969                } else {
+970                    write!(f, "let {}{}: {}", mut_, target.kind, typ.kind)
+971                }
+972            }
+973            FuncStmt::ConstantDecl { name, typ, value } => {
+974                write!(f, "const {}: {} = {}", name.kind, typ.kind, value.kind)
+975            }
+976            FuncStmt::Assign { target, value } => write!(f, "{} = {}", target.kind, value.kind),
+977            FuncStmt::AugAssign { target, op, value } => {
+978                write!(f, "{} {}= {}", target.kind, op.kind, value.kind)
+979            }
+980            FuncStmt::For { target, iter, body } => {
+981                write!(f, "for {} in {} {{", target.kind, iter.kind)?;
+982                write_nodes_line_wrapped(&mut indented(f), body)?;
+983                write!(f, "}}")
+984            }
+985            FuncStmt::While { test, body } => {
+986                write!(f, "while {} {{", test.kind)?;
+987                write_nodes_line_wrapped(&mut indented(f), body)?;
+988                write!(f, "}}")
+989            }
+990            FuncStmt::If {
+991                test,
+992                body,
+993                or_else,
+994            } => {
+995                write!(f, "if {} {{", test.kind)?;
+996                write_nodes_line_wrapped(&mut indented(f), body)?;
+997
+998                if or_else.is_empty() {
+999                    write!(f, "}}")
+1000                } else {
+1001                    if body.is_empty() {
+1002                        writeln!(f)?;
+1003                    }
+1004
+1005                    if matches!(
+1006                        &or_else[..],
+1007                        &[Node {
+1008                            kind: FuncStmt::If { .. },
+1009                            ..
+1010                        }]
+1011                    ) {
+1012                        write!(f, "}} else ")?;
+1013                        write!(f, "{}", or_else[0].kind)
+1014                    } else {
+1015                        write!(f, "}} else {{")?;
+1016                        write_nodes_line_wrapped(&mut indented(f), or_else)?;
+1017                        write!(f, "}}")
+1018                    }
+1019                }
+1020            }
+1021            FuncStmt::Match { expr, arms } => {
+1022                write!(f, "match {} {{", expr.kind)?;
+1023                write_nodes_line_wrapped(&mut indented(f), arms)?;
+1024                write!(f, "}}")
+1025            }
+1026            FuncStmt::Assert { test, msg } => {
+1027                if let Some(msg) = msg {
+1028                    write!(f, "assert {}, {}", test.kind, msg.kind)
+1029                } else {
+1030                    write!(f, "assert {}", test.kind)
+1031                }
+1032            }
+1033            FuncStmt::Expr { value } => write!(f, "{}", value.kind),
+1034            FuncStmt::Break => write!(f, "break"),
+1035            FuncStmt::Continue => write!(f, "continue"),
+1036            FuncStmt::Revert { error } => {
+1037                if let Some(error) = error {
+1038                    write!(f, "revert {}", error.kind)
+1039                } else {
+1040                    write!(f, "revert")
+1041                }
+1042            }
+1043            FuncStmt::Unsafe(body) => {
+1044                write!(f, "unsafe {{")?;
+1045                write_nodes_line_wrapped(&mut indented(f), body)?;
+1046                write!(f, "}}")
+1047            }
+1048        }
+1049    }
+1050}
+1051
+1052impl fmt::Display for VarDeclTarget {
+1053    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+1054        match self {
+1055            VarDeclTarget::Name(name) => write!(f, "{name}"),
+1056            VarDeclTarget::Tuple(elts) => {
+1057                if elts.len() == 1 {
+1058                    write!(f, "({},)", elts[0].kind)
+1059                } else {
+1060                    write!(f, "({})", node_comma_joined(elts))
+1061                }
+1062            }
+1063        }
+1064    }
+1065}
+1066
+1067impl fmt::Display for Expr {
+1068    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+1069        match self {
+1070            Expr::Ternary {
+1071                if_expr,
+1072                test,
+1073                else_expr,
+1074            } => write!(
+1075                f,
+1076                "{} if {} else {}",
+1077                if_expr.kind, test.kind, else_expr.kind
+1078            ),
+1079            Expr::BoolOperation { left, op, right } => {
+1080                let left = maybe_fmt_left_with_parens(&op.kind, &left.kind);
+1081                let right = maybe_fmt_right_with_parens(&op.kind, &right.kind);
+1082                write!(f, "{} {} {}", left, op.kind, right)
+1083            }
+1084            Expr::BinOperation { left, op, right } => {
+1085                let left = maybe_fmt_left_with_parens(&op.kind, &left.kind);
+1086                let right = maybe_fmt_right_with_parens(&op.kind, &right.kind);
+1087                write!(f, "{} {} {}", left, op.kind, right)
+1088            }
+1089            Expr::UnaryOperation { op, operand } => {
+1090                let operand = maybe_fmt_operand_with_parens(&op.kind, &operand.kind);
+1091                if op.kind == UnaryOperator::Not {
+1092                    write!(f, "{} {}", op.kind, operand)
+1093                } else {
+1094                    write!(f, "{}{}", op.kind, operand)
+1095                }
+1096            }
+1097            Expr::CompOperation { left, op, right } => {
+1098                let left = maybe_fmt_left_with_parens(&op.kind, &left.kind);
+1099                let right = maybe_fmt_right_with_parens(&op.kind, &right.kind);
+1100                write!(f, "{} {} {}", left, op.kind, right)
+1101            }
+1102            Expr::Attribute { value, attr } => write!(f, "{}.{}", value.kind, attr.kind),
+1103            Expr::Subscript { value, index } => write!(f, "{}[{}]", value.kind, index.kind),
+1104            Expr::Call {
+1105                func,
+1106                generic_args,
+1107                args,
+1108            } => {
+1109                write!(f, "{}", func.kind)?;
+1110                if let Some(generic_args) = generic_args {
+1111                    write!(f, "<{}>", comma_joined(generic_args.kind.iter()))?;
+1112                }
+1113                write!(f, "({})", node_comma_joined(&args.kind))
+1114            }
+1115            Expr::List { elts } => write!(f, "[{}]", node_comma_joined(elts)),
+1116            Expr::Repeat { value: elt, len } => write!(f, "[{}; {}]", elt.kind, len.kind),
+1117            Expr::Tuple { elts } => {
+1118                if elts.len() == 1 {
+1119                    write!(f, "({},)", elts[0].kind)
+1120                } else {
+1121                    write!(f, "({})", node_comma_joined(elts))
+1122                }
+1123            }
+1124            Expr::Bool(bool) => write!(f, "{bool}"),
+1125            Expr::Name(name) => write!(f, "{name}"),
+1126            Expr::Path(path) => write!(f, "{path}"),
+1127            Expr::Num(num) => write!(f, "{num}"),
+1128            Expr::Str(str) => write!(f, "\"{str}\""),
+1129            Expr::Unit => write!(f, "()"),
+1130        }
+1131    }
+1132}
+1133
+1134impl fmt::Display for CallArg {
+1135    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+1136        if let Some(label) = &self.label {
+1137            if let Expr::Name(var_name) = &self.value.kind {
+1138                if var_name == &label.kind {
+1139                    return write!(f, "{var_name}");
+1140                }
+1141            }
+1142            write!(f, "{}: {}", label.kind, self.value.kind)
+1143        } else {
+1144            write!(f, "{}", self.value.kind)
+1145        }
+1146    }
+1147}
+1148
+1149impl fmt::Display for BoolOperator {
+1150    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+1151        use BoolOperator::*;
+1152        match self {
+1153            And => write!(f, "and"),
+1154            Or => write!(f, "or"),
+1155        }
+1156    }
+1157}
+1158
+1159impl fmt::Display for BinOperator {
+1160    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+1161        use BinOperator::*;
+1162        match self {
+1163            Add => write!(f, "+"),
+1164            Sub => write!(f, "-"),
+1165            Mult => write!(f, "*"),
+1166            Div => write!(f, "/"),
+1167            Mod => write!(f, "%"),
+1168            Pow => write!(f, "**"),
+1169            LShift => write!(f, "<<"),
+1170            RShift => write!(f, ">>"),
+1171            BitOr => write!(f, "|"),
+1172            BitXor => write!(f, "^"),
+1173            BitAnd => write!(f, "&"),
+1174        }
+1175    }
+1176}
+1177
+1178impl fmt::Display for UnaryOperator {
+1179    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+1180        use UnaryOperator::*;
+1181        match self {
+1182            Invert => write!(f, "~"),
+1183            Not => write!(f, "not"),
+1184            USub => write!(f, "-"),
+1185        }
+1186    }
+1187}
+1188
+1189impl fmt::Display for CompOperator {
+1190    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+1191        use CompOperator::*;
+1192        match self {
+1193            Eq => write!(f, "=="),
+1194            NotEq => write!(f, "!="),
+1195            Lt => write!(f, "<"),
+1196            LtE => write!(f, "<="),
+1197            Gt => write!(f, ">"),
+1198            GtE => write!(f, ">="),
+1199        }
+1200    }
+1201}
+1202
+1203impl fmt::Display for MatchArm {
+1204    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+1205        write!(f, "{} => {{", self.pat.kind)?;
+1206        write_nodes_line_wrapped(&mut indented(f), &self.body)?;
+1207        write!(f, "}}")
+1208    }
+1209}
+1210
+1211impl fmt::Display for Pattern {
+1212    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+1213        match self {
+1214            Self::WildCard => write!(f, "_"),
+1215            Self::Rest => write!(f, ".."),
+1216            Self::Literal(pat) => write!(f, "{}", pat.kind),
+1217            Self::Path(path) => write!(f, "{}", path.kind),
+1218            Self::PathTuple(path, elts) => {
+1219                write!(f, "{}", path.kind)?;
+1220                write!(f, "({})", node_comma_joined(elts))
+1221            }
+1222            Self::Tuple(elts) => {
+1223                write!(f, "({})", node_comma_joined(elts))
+1224            }
+1225            Self::PathStruct {
+1226                path,
+1227                fields,
+1228                has_rest: is_rest,
+1229            } => {
+1230                write!(f, "{}", path.kind)?;
+1231                let fields = fields
+1232                    .iter()
+1233                    .map(|(name, pat)| format!("{}: {}", name.kind, pat.kind));
+1234                let fields = comma_joined(fields);
+1235                if *is_rest {
+1236                    write!(f, "{{{fields}, ..}}")
+1237                } else {
+1238                    write!(f, "{{{fields}}}")
+1239                }
+1240            }
+1241            Self::Or(pats) => {
+1242                write!(f, "{}", node_delim_joined(pats, "| "))
+1243            }
+1244        }
+1245    }
+1246}
+1247
+1248impl fmt::Display for LiteralPattern {
+1249    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+1250        match self {
+1251            Self::Bool(b) => write!(f, "{b}"),
+1252        }
+1253    }
+1254}
+1255
+1256fn node_comma_joined(nodes: &[Node<impl fmt::Display>]) -> String {
+1257    node_delim_joined(nodes, ", ")
+1258}
+1259
+1260fn node_delim_joined(nodes: &[Node<impl fmt::Display>], delim: &str) -> String {
+1261    delim_joined(nodes.iter().map(|node| &node.kind), delim)
+1262}
+1263
+1264fn comma_joined<T>(items: impl Iterator<Item = T>) -> String
+1265where
+1266    T: fmt::Display,
+1267{
+1268    delim_joined(items, ", ")
+1269}
+1270
+1271fn delim_joined<T>(items: impl Iterator<Item = T>, delim: &str) -> String
+1272where
+1273    T: fmt::Display,
+1274{
+1275    items
+1276        .map(|item| format!("{item}"))
+1277        .collect::<Vec<_>>()
+1278        .join(delim)
+1279}
+1280
+1281fn write_nodes_line_wrapped(f: &mut impl Write, nodes: &[Node<impl fmt::Display>]) -> fmt::Result {
+1282    if !nodes.is_empty() {
+1283        writeln!(f)?;
+1284    }
+1285    for n in nodes {
+1286        writeln!(f, "{}", n.kind)?;
+1287    }
+1288    Ok(())
+1289}
+1290
+1291fn double_line_joined(items: &[impl fmt::Display]) -> String {
+1292    items
+1293        .iter()
+1294        .map(|item| format!("{item}"))
+1295        .collect::<Vec<_>>()
+1296        .join("\n\n")
+1297}
+1298
+1299trait InfixBindingPower {
+1300    fn infix_binding_power(&self) -> (u8, u8);
+1301}
+1302
+1303trait PrefixBindingPower {
+1304    fn prefix_binding_power(&self) -> u8;
+1305}
+1306
+1307impl InfixBindingPower for BoolOperator {
+1308    fn infix_binding_power(&self) -> (u8, u8) {
+1309        use BoolOperator::*;
+1310
+1311        match self {
+1312            Or => (50, 51),
+1313            And => (60, 61),
+1314        }
+1315    }
+1316}
+1317
+1318impl InfixBindingPower for BinOperator {
+1319    fn infix_binding_power(&self) -> (u8, u8) {
+1320        use BinOperator::*;
+1321
+1322        match self {
+1323            Add | Sub => (120, 121),
+1324            Mult | Div | Mod => (130, 131),
+1325            Pow => (141, 140),
+1326            LShift | RShift => (110, 111),
+1327            BitOr => (80, 81),
+1328            BitXor => (90, 91),
+1329            BitAnd => (100, 101),
+1330        }
+1331    }
+1332}
+1333
+1334impl InfixBindingPower for CompOperator {
+1335    fn infix_binding_power(&self) -> (u8, u8) {
+1336        (70, 71)
+1337    }
+1338}
+1339
+1340impl PrefixBindingPower for UnaryOperator {
+1341    fn prefix_binding_power(&self) -> u8 {
+1342        use UnaryOperator::*;
+1343
+1344        match self {
+1345            Not => 65,
+1346            Invert | USub => 135,
+1347        }
+1348    }
+1349}
+1350
+1351fn maybe_fmt_left_with_parens(op: &impl InfixBindingPower, expr: &Expr) -> String {
+1352    if expr_right_binding_power(expr) < op.infix_binding_power().0 {
+1353        format!("({expr})")
+1354    } else {
+1355        format!("{expr}")
+1356    }
+1357}
+1358
+1359fn maybe_fmt_right_with_parens(op: &impl InfixBindingPower, expr: &Expr) -> String {
+1360    if op.infix_binding_power().1 > expr_left_binding_power(expr) {
+1361        format!("({expr})")
+1362    } else {
+1363        format!("{expr}")
+1364    }
+1365}
+1366
+1367fn maybe_fmt_operand_with_parens(op: &impl PrefixBindingPower, expr: &Expr) -> String {
+1368    if op.prefix_binding_power() > expr_left_binding_power(expr) {
+1369        format!("({expr})")
+1370    } else {
+1371        format!("{expr}")
+1372    }
+1373}
+1374
+1375fn expr_left_binding_power(expr: &Expr) -> u8 {
+1376    let max_power = u8::MAX;
+1377
+1378    match expr {
+1379        Expr::Ternary { .. } => max_power,
+1380        Expr::BoolOperation { op, .. } => op.kind.infix_binding_power().0,
+1381        Expr::BinOperation { op, .. } => op.kind.infix_binding_power().0,
+1382        Expr::UnaryOperation { op, .. } => op.kind.prefix_binding_power(),
+1383        Expr::CompOperation { op, .. } => op.kind.infix_binding_power().0,
+1384        Expr::Attribute { .. } => max_power,
+1385        Expr::Subscript { .. } => max_power,
+1386        Expr::Call { .. } => max_power,
+1387        Expr::List { .. } => max_power,
+1388        Expr::Repeat { .. } => max_power,
+1389        Expr::Tuple { .. } => max_power,
+1390        Expr::Bool(_) => max_power,
+1391        Expr::Name(_) => max_power,
+1392        Expr::Path(_) => max_power,
+1393        Expr::Num(_) => max_power,
+1394        Expr::Str(_) => max_power,
+1395        Expr::Unit => max_power,
+1396    }
+1397}
+1398
+1399fn expr_right_binding_power(expr: &Expr) -> u8 {
+1400    let max_power = u8::MAX;
+1401
+1402    match expr {
+1403        Expr::Ternary { .. } => max_power,
+1404        Expr::BoolOperation { op, .. } => op.kind.infix_binding_power().1,
+1405        Expr::BinOperation { op, .. } => op.kind.infix_binding_power().1,
+1406        Expr::UnaryOperation { op, .. } => op.kind.prefix_binding_power(),
+1407        Expr::CompOperation { op, .. } => op.kind.infix_binding_power().1,
+1408        Expr::Attribute { .. } => max_power,
+1409        Expr::Subscript { .. } => max_power,
+1410        Expr::Call { .. } => max_power,
+1411        Expr::List { .. } => max_power,
+1412        Expr::Repeat { .. } => max_power,
+1413        Expr::Tuple { .. } => max_power,
+1414        Expr::Bool(_) => max_power,
+1415        Expr::Name(_) => max_power,
+1416        Expr::Path(_) => max_power,
+1417        Expr::Num(_) => max_power,
+1418        Expr::Str(_) => max_power,
+1419        Expr::Unit => max_power,
+1420    }
+1421}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/grammar.rs.html b/compiler-docs/src/fe_parser/grammar.rs.html new file mode 100644 index 0000000000..c1426ad55f --- /dev/null +++ b/compiler-docs/src/fe_parser/grammar.rs.html @@ -0,0 +1,5 @@ +grammar.rs - source

fe_parser/
grammar.rs

1pub mod contracts;
+2pub mod expressions;
+3pub mod functions;
+4pub mod module;
+5pub mod types;
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/grammar/contracts.rs.html b/compiler-docs/src/fe_parser/grammar/contracts.rs.html new file mode 100644 index 0000000000..3bf030d9f2 --- /dev/null +++ b/compiler-docs/src/fe_parser/grammar/contracts.rs.html @@ -0,0 +1,91 @@ +contracts.rs - source

fe_parser/grammar/
contracts.rs

1use super::functions::parse_fn_def;
+2use super::types::{parse_field, parse_opt_qualifier};
+3
+4use crate::ast::{Contract, ContractStmt};
+5use crate::node::{Node, Span};
+6use crate::{ParseFailed, ParseResult, Parser, TokenKind};
+7
+8// Rule: all "statement" level parse functions consume their trailing
+9// newline(s), either directly or via a function they call.
+10// This is required to parse an `if` block, because we need to peek past the
+11// trailing newlines to check whether it's followed by an `else` block, and is
+12// done for all statements for consistency.
+13
+14/// Parse a contract definition.
+15/// # Panics
+16/// Panics if the next token isn't `contract`.
+17pub fn parse_contract_def(
+18    par: &mut Parser,
+19    contract_pub_qual: Option<Span>,
+20) -> ParseResult<Node<Contract>> {
+21    let contract_tok = par.assert(TokenKind::Contract);
+22    let contract_name = par.expect_with_notes(
+23        TokenKind::Name,
+24        "failed to parse contract definition",
+25        |_| vec!["Note: `contract` must be followed by a name, which must start with a letter and contain only letters, numbers, or underscores".into()],
+26    )?;
+27
+28    let mut span = contract_tok.span + contract_name.span;
+29    par.enter_block(span, "contract definition")?;
+30
+31    let mut fields = vec![];
+32    let mut defs = vec![];
+33
+34    loop {
+35        par.eat_newlines();
+36        let mut pub_qual = parse_opt_qualifier(par, TokenKind::Pub);
+37        let const_qual = parse_opt_qualifier(par, TokenKind::Const);
+38        if pub_qual.is_none() && const_qual.is_some() && par.peek() == Some(TokenKind::Pub) {
+39            pub_qual = parse_opt_qualifier(par, TokenKind::Pub);
+40            par.error(
+41                pub_qual.unwrap() + const_qual,
+42                "`const pub` should be written `pub const`",
+43            );
+44        }
+45
+46        match par.peek_or_err()? {
+47            TokenKind::Name => {
+48                let field = parse_field(par, vec![], pub_qual, const_qual)?;
+49                if !defs.is_empty() {
+50                    par.error(
+51                        field.span,
+52                        "contract field definitions must come before any function definitions",
+53                    );
+54                }
+55                fields.push(field);
+56            }
+57            TokenKind::Fn | TokenKind::Unsafe => {
+58                if let Some(span) = const_qual {
+59                    par.error(
+60                        span,
+61                        "`const` qualifier can't be used with function definitions",
+62                    );
+63                }
+64                defs.push(ContractStmt::Function(parse_fn_def(par, pub_qual)?));
+65            }
+66            TokenKind::BraceClose => {
+67                span += par.next()?.span;
+68                break;
+69            }
+70            _ => {
+71                let tok = par.next()?;
+72                par.unexpected_token_error(
+73                    &tok,
+74                    "failed to parse contract definition body",
+75                    vec![],
+76                );
+77                return Err(ParseFailed);
+78            }
+79        };
+80    }
+81
+82    Ok(Node::new(
+83        Contract {
+84            name: Node::new(contract_name.text.into(), contract_name.span),
+85            fields,
+86            body: defs,
+87            pub_qual: contract_pub_qual,
+88        },
+89        span,
+90    ))
+91}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/grammar/expressions.rs.html b/compiler-docs/src/fe_parser/grammar/expressions.rs.html new file mode 100644 index 0000000000..deb9c5aaa7 --- /dev/null +++ b/compiler-docs/src/fe_parser/grammar/expressions.rs.html @@ -0,0 +1,677 @@ +expressions.rs - source

fe_parser/grammar/
expressions.rs

1use crate::ast::{self, CallArg, Expr, GenericArg, Path};
+2use crate::node::Node;
+3use crate::{Label, ParseFailed, ParseResult, Parser, Token, TokenKind};
+4
+5use super::types::parse_generic_args;
+6
+7use if_chain::if_chain;
+8
+9// Expressions are parsed in Pratt's top-down operator precedence style.
+10// See this article for a nice explanation:
+11// <https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html>
+12
+13/// Parse an expression, starting with the next token.
+14pub fn parse_expr(par: &mut Parser) -> ParseResult<Node<Expr>> {
+15    parse_expr_with_min_bp(par, 0)
+16}
+17
+18/// Parse an expression, stopping if/when we reach an operator that binds less
+19/// tightly than given binding power.
+20pub fn parse_expr_with_min_bp(par: &mut Parser, min_bp: u8) -> ParseResult<Node<Expr>> {
+21    let mut expr_head = parse_expr_head(par)?;
+22
+23    while let Some(op) = par.peek() {
+24        if let Some(lbp) = postfix_binding_power(op) {
+25            if lbp < min_bp {
+26                break;
+27            }
+28
+29            expr_head = match op {
+30                TokenKind::ParenOpen => {
+31                    let args = parse_call_args(par)?;
+32                    let span = expr_head.span + args.span;
+33                    Node::new(
+34                        Expr::Call {
+35                            func: Box::new(expr_head),
+36                            generic_args: None,
+37                            args,
+38                        },
+39                        span,
+40                    )
+41                }
+42                TokenKind::BracketOpen => {
+43                    par.next()?;
+44                    let index = parse_expr(par)?;
+45                    let rbracket = par.expect(
+46                        TokenKind::BracketClose,
+47                        "failed to parse subscript expression",
+48                    )?;
+49                    let span = expr_head.span + rbracket.span;
+50                    Node::new(
+51                        Expr::Subscript {
+52                            value: Box::new(expr_head),
+53                            index: Box::new(index),
+54                        },
+55                        span,
+56                    )
+57                }
+58                TokenKind::If => {
+59                    par.next()?;
+60                    let test = parse_expr(par)?;
+61                    par.expect(
+62                        TokenKind::Else,
+63                        "failed to parse ternary `if-else` expression",
+64                    )?;
+65                    let else_val = parse_expr(par)?;
+66                    let span = expr_head.span + else_val.span;
+67                    Node::new(
+68                        Expr::Ternary {
+69                            if_expr: Box::new(expr_head),
+70                            test: Box::new(test),
+71                            else_expr: Box::new(else_val),
+72                        },
+73                        span,
+74                    )
+75                }
+76                _ => unreachable!(), // patterns above must match those in `postfix_binding_power`
+77            };
+78            continue;
+79        }
+80
+81        if matches!(op, TokenKind::Lt) {
+82            let mut bt_par = par.as_bt_parser();
+83            if_chain! {
+84                if let Ok(generic_args) = parse_generic_args(&mut bt_par);
+85                if matches!(bt_par.peek(), Some(TokenKind::ParenOpen));
+86                if let Ok(args) = parse_call_args(&mut bt_par);
+87                then {
+88                    let span = expr_head.span + args.span;
+89                    expr_head = Node::new(
+90                        Expr::Call {
+91                            func: Box::new(expr_head),
+92                            generic_args: Some(generic_args),
+93                            args,
+94                        },
+95                        span,
+96                    );
+97                    bt_par.accept();
+98                    continue;
+99                }
+100            }
+101        }
+102
+103        if let Some((lbp, rbp)) = infix_binding_power(op) {
+104            if lbp < min_bp {
+105                break;
+106            }
+107
+108            let op_tok = par.next()?;
+109            let rhs = parse_expr_with_min_bp(par, rbp)?;
+110            expr_head = infix_op(par, expr_head, &op_tok, rhs)?;
+111            continue;
+112        }
+113        break;
+114    }
+115
+116    Ok(expr_head)
+117}
+118
+119/// Parse call arguments
+120pub fn parse_call_args(par: &mut Parser) -> ParseResult<Node<Vec<Node<CallArg>>>> {
+121    use TokenKind::*;
+122    let lparen = par.assert(ParenOpen);
+123    let mut args = vec![];
+124    let mut span = lparen.span;
+125    loop {
+126        if par.peek_or_err()? == ParenClose {
+127            span += par.next()?.span;
+128            break;
+129        }
+130
+131        let arg = parse_expr(par)?;
+132        match par.peek_or_err()? {
+133            TokenKind::Eq => {
+134                let eq = par.next()?;
+135                if let Expr::Name(name) = arg.kind {
+136                    par.fancy_error(
+137                        "Syntax error in argument list",
+138                        vec![Label::primary(eq.span, "unexpected `=`".to_string())],
+139                        vec![
+140                            "Argument labels should be followed by `:`.".to_string(),
+141                            format!("Hint: try `{name}:`"),
+142                            "If this is a variable assignment, it must be a standalone statement."
+143                                .to_string(),
+144                        ],
+145                    );
+146                    let value = parse_expr(par)?;
+147                    let span = arg.span + value.span;
+148                    args.push(Node::new(
+149                        CallArg {
+150                            label: Some(Node::new(name, arg.span)),
+151                            value,
+152                        },
+153                        span,
+154                    ));
+155                } else {
+156                    par.fancy_error(
+157                        "Syntax error in argument list",
+158                        vec![Label::primary(eq.span, "unexpected `=`".to_string())],
+159                        vec![],
+160                    );
+161                }
+162            }
+163
+164            TokenKind::Colon => {
+165                let sep_tok = par.next()?;
+166                let value = parse_expr(par)?;
+167                if let Expr::Name(name) = arg.kind {
+168                    let span = arg.span + value.span;
+169                    args.push(Node::new(
+170                        CallArg {
+171                            label: Some(Node::new(name, arg.span)),
+172                            value,
+173                        },
+174                        span,
+175                    ));
+176                } else {
+177                    par.fancy_error(
+178                        "Syntax error in function call argument list",
+179                        vec![
+180                            Label::primary(
+181                                sep_tok.span,
+182                                "In a function call, `:` is used for named arguments".to_string(),
+183                            ),
+184                            Label::secondary(
+185                                arg.span,
+186                                "this should be a function parameter name".to_string(),
+187                            ),
+188                        ],
+189                        vec![],
+190                    );
+191                    return Err(ParseFailed);
+192                }
+193            }
+194            _ => {
+195                let span = arg.span;
+196                args.push(Node::new(
+197                    CallArg {
+198                        label: None,
+199                        value: arg,
+200                    },
+201                    span,
+202                ));
+203            }
+204        }
+205        if par.peek_or_err()? == Comma {
+206            par.next()?;
+207        } else {
+208            span += par
+209                .expect(ParenClose, "failed to parse function call argument list")?
+210                .span;
+211            break;
+212        }
+213    }
+214
+215    Ok(Node::new(args, span))
+216}
+217
+218/// Try to build an expression starting with the given token.
+219fn parse_expr_head(par: &mut Parser) -> ParseResult<Node<Expr>> {
+220    use TokenKind::*;
+221
+222    match par.peek_or_err()? {
+223        Name | SelfValue | Int | Hex | Octal | Binary | Text | True | False => {
+224            let tok = par.next()?;
+225            Ok(atom(par, &tok))
+226        }
+227        Plus | Minus | Not | Tilde => {
+228            let op = par.next()?;
+229            let operand = parse_expr_with_min_bp(par, prefix_binding_power(op.kind))?;
+230            unary_op(par, &op, operand)
+231        }
+232        ParenOpen => parse_group_or_tuple(par),
+233        BracketOpen => parse_list_or_repeat(par),
+234        _ => {
+235            let tok = par.next()?;
+236            par.unexpected_token_error(
+237                &tok,
+238                format!("Unexpected token while parsing expression: `{}`", tok.text),
+239                vec![],
+240            );
+241            Err(ParseFailed)
+242        }
+243    }
+244}
+245
+246/// Specifies how tightly a prefix unary operator binds to its operand.
+247fn prefix_binding_power(op: TokenKind) -> u8 {
+248    use TokenKind::*;
+249    match op {
+250        Not => 65,
+251        Plus | Minus | Tilde => 135,
+252        _ => panic!("Unexpected unary op token: {op:?}"),
+253    }
+254}
+255
+256/// Specifies how tightly does an infix operator bind to its left and right
+257/// operands. See https://docs.python.org/3/reference/expressions.html#operator-precedence
+258fn infix_binding_power(op: TokenKind) -> Option<(u8, u8)> {
+259    use TokenKind::*;
+260
+261    let bp = match op {
+262        // assignment expr `:=`?
+263        // lambda?
+264        // Comma => (40, 41),
+265        Or => (50, 51),
+266        And => (60, 61),
+267        // prefix Not => 65
+268
+269        // all comparisons are the same
+270        Lt | LtEq | Gt | GtEq | NotEq | EqEq => (70, 71),
+271
+272        Pipe => (80, 81),
+273        Hat => (90, 91),
+274        Amper => (100, 101),
+275        LtLt | GtGt => (110, 111),
+276        Plus | Minus => (120, 121),
+277        Star | Slash | Percent => (130, 131),
+278        // Prefix Plus | Minus | Tilde => 135
+279        StarStar => (141, 140),
+280        Dot => (150, 151),
+281        ColonColon => (160, 161),
+282        _ => return None,
+283    };
+284    Some(bp)
+285}
+286
+287/// Specifies how tightly a postfix operator binds to its operand.
+288/// We don't have any "real" postfix operators (like `?` in rust),
+289/// but we treat `[`, `(`, and ternary `if` as though they're postfix
+290/// operators.
+291fn postfix_binding_power(op: TokenKind) -> Option<u8> {
+292    use TokenKind::*;
+293    match op {
+294        If => Some(35), // ternary
+295        BracketOpen | ParenOpen => Some(150),
+296        _ => None,
+297    }
+298}
+299
+300/// Parse a square-bracket list expression, eg. `[1, 2, x]` or `[true; 42]`
+301fn parse_list_or_repeat(par: &mut Parser) -> ParseResult<Node<Expr>> {
+302    let lbracket = par.assert(TokenKind::BracketOpen);
+303    let elts = parse_expr_list(par, &[TokenKind::BracketClose, TokenKind::Semi], None)?;
+304
+305    if elts.len() == 1 {
+306        if par.peek() == Some(TokenKind::BracketClose) {
+307            let rbracket = par.assert(TokenKind::BracketClose);
+308            let span = lbracket.span + rbracket.span;
+309            Ok(Node::new(Expr::List { elts }, span))
+310        } else if par.peek() == Some(TokenKind::Semi) {
+311            par.assert(TokenKind::Semi);
+312
+313            let len = if par.peek() == Some(TokenKind::BraceOpen) {
+314                // handle `{ ... }` const expression
+315                let brace_open = par.next()?;
+316                let expr = parse_expr(par)?;
+317                if !matches!(par.peek(), Some(TokenKind::BraceClose)) {
+318                    par.error(brace_open.span, "missing closing delimiter `}`");
+319                    return Err(ParseFailed);
+320                }
+321                let brace_close = par.assert(TokenKind::BraceClose);
+322                let span = brace_open.span + brace_close.span;
+323                Box::new(Node::new(GenericArg::ConstExpr(expr), span))
+324            } else {
+325                // handle const expression without braces
+326                let expr = parse_expr(par)?;
+327                let span = expr.span;
+328                Box::new(Node::new(GenericArg::ConstExpr(expr), span))
+329            };
+330
+331            let rbracket = par.assert(TokenKind::BracketClose);
+332            let span = lbracket.span + rbracket.span;
+333            Ok(Node::new(
+334                Expr::Repeat {
+335                    value: Box::new(elts[0].clone()),
+336                    len,
+337                },
+338                span,
+339            ))
+340        } else {
+341            par.error(lbracket.span, "expected `]` or `;`");
+342            Err(ParseFailed)
+343        }
+344    } else {
+345        let rbracket = par.assert(TokenKind::BracketClose);
+346        let span = lbracket.span + rbracket.span;
+347        Ok(Node::new(Expr::List { elts }, span))
+348    }
+349}
+350
+351/// Parse a paren-wrapped expression, which might turn out to be a tuple
+352/// if it contains commas.
+353fn parse_group_or_tuple(par: &mut Parser) -> ParseResult<Node<Expr>> {
+354    use TokenKind::*;
+355    let lparen = par.assert(ParenOpen);
+356    if par.peek_or_err()? == ParenClose {
+357        let rparen = par.next()?;
+358        let span = lparen.span + rparen.span;
+359        return Ok(Node::new(Expr::Unit, span));
+360    }
+361
+362    let elem = parse_expr(par)?;
+363    match par.peek_or_err()? {
+364        ParenClose => {
+365            // expr wrapped in parens
+366            let rparen = par.next()?;
+367            let span = lparen.span + rparen.span;
+368            Ok(Node::new(elem.kind, span))
+369        }
+370        Comma => {
+371            // tuple
+372            par.next()?;
+373            let elts = parse_expr_list(par, &[ParenClose], Some(elem))?;
+374            let rparen = par.expect(ParenClose, "failed to parse tuple expression")?;
+375            let span = lparen.span + rparen.span;
+376            Ok(Node::new(Expr::Tuple { elts }, span))
+377        }
+378        _ => {
+379            let tok = par.next()?;
+380            par.unexpected_token_error(
+381                &tok,
+382                "Unexpected token while parsing expression in parentheses",
+383                vec![],
+384            );
+385            Err(ParseFailed)
+386        }
+387    }
+388}
+389
+390/// Parse some number of comma-separated expressions, until `end_marker` is
+391/// `peek()`ed.
+392fn parse_expr_list(
+393    par: &mut Parser,
+394    end_markers: &[TokenKind],
+395    head: Option<Node<Expr>>,
+396) -> ParseResult<Vec<Node<Expr>>> {
+397    let mut elts = vec![];
+398    if let Some(elem) = head {
+399        elts.push(elem);
+400    }
+401    loop {
+402        let next = par.peek_or_err()?;
+403        if end_markers.contains(&next) {
+404            break;
+405        }
+406        elts.push(parse_expr(par)?);
+407        match par.peek_or_err()? {
+408            TokenKind::Comma => {
+409                par.next()?;
+410            }
+411            tk if end_markers.contains(&tk) => break,
+412            _ => {
+413                let tok = par.next()?;
+414                par.unexpected_token_error(
+415                    &tok,
+416                    "Unexpected token while parsing list of expressions",
+417                    vec![],
+418                );
+419                return Err(ParseFailed);
+420            }
+421        }
+422    }
+423
+424    Ok(elts)
+425}
+426
+427/* node building utils */
+428
+429/// Create an "atom" expr from the given `Token` (`Name`, `Num`, `Bool`, etc)
+430fn atom(par: &mut Parser, tok: &Token) -> Node<Expr> {
+431    use TokenKind::*;
+432
+433    let expr = match tok.kind {
+434        Name | SelfValue => Expr::Name(tok.text.into()),
+435        Int | Hex | Octal | Binary => Expr::Num(tok.text.into()),
+436        True | False => Expr::Bool(tok.kind == True),
+437        Text => {
+438            if let Some(string) = unescape_string(tok.text) {
+439                Expr::Str(string.into())
+440            } else {
+441                par.error(tok.span, "String contains an invalid escape sequence");
+442                Expr::Str(tok.text.into())
+443            }
+444        }
+445        _ => panic!("Unexpected atom token: {tok:?}"),
+446    };
+447    Node::new(expr, tok.span)
+448}
+449
+450fn unescape_string(quoted_string: &str) -> Option<String> {
+451    let inner = &quoted_string[1..quoted_string.len() - 1];
+452    unescape::unescape(inner)
+453}
+454
+455/// Create an expr from the given infix operator and operands.
+456fn infix_op(
+457    par: &mut Parser,
+458    left: Node<Expr>,
+459    op: &Token,
+460    right: Node<Expr>,
+461) -> ParseResult<Node<Expr>> {
+462    use TokenKind::*;
+463    let expr = match op.kind {
+464        Or | And => bool_op(left, op, right),
+465
+466        Amper | Hat | Pipe | LtLt | GtGt | Plus | Minus | Star | Slash | Percent | StarStar => {
+467            bin_op(left, op, right)
+468        }
+469
+470        Lt | LtEq | Gt | GtEq | NotEq | EqEq => comp_op(left, op, right),
+471
+472        Dot => {
+473            let span = left.span + right.span;
+474            match right.kind {
+475                Expr::Name(name) => Node::new(
+476                    Expr::Attribute {
+477                        value: Box::new(left),
+478                        attr: Node::new(name, right.span),
+479                    },
+480                    span,
+481                ),
+482                Expr::Num(_num) => {
+483                    par.error(span, "floats not supported");
+484                    return Err(ParseFailed);
+485                }
+486                Expr::Call {
+487                    func,
+488                    generic_args,
+489                    args,
+490                } => {
+491                    let func_span = left.span + func.span;
+492                    let func = Box::new(Node::new(
+493                        Expr::Attribute {
+494                            value: Box::new(left),
+495                            attr: {
+496                                if let Expr::Name(name) = func.kind {
+497                                    Node::new(name, func.span)
+498                                } else {
+499                                    par.fancy_error(
+500                                        "failed to parse attribute expression",
+501                                        vec![Label::primary(func.span, "expected a name")],
+502                                        vec![],
+503                                    );
+504                                    return Err(ParseFailed);
+505                                }
+506                            },
+507                        },
+508                        func_span,
+509                    ));
+510
+511                    Node::new(
+512                        Expr::Call {
+513                            func,
+514                            generic_args,
+515                            args,
+516                        },
+517                        span,
+518                    )
+519                }
+520                _ => {
+521                    par.fancy_error(
+522                        "failed to parse attribute expression",
+523                        vec![Label::primary(right.span, "expected a name")],
+524                        vec![],
+525                    );
+526                    return Err(ParseFailed);
+527                }
+528            }
+529        }
+530        ColonColon => {
+531            let mut path = match left.kind {
+532                Expr::Name(name) => Path {
+533                    segments: vec![Node::new(name, left.span)],
+534                },
+535                Expr::Path(path) => path,
+536                _ => {
+537                    par.fancy_error(
+538                        "failed to parse path expression",
+539                        vec![
+540                            Label::secondary(op.span, "path delimiter".to_string()),
+541                            Label::primary(left.span, "expected a name"),
+542                        ],
+543                        vec![],
+544                    );
+545                    return Err(ParseFailed);
+546                }
+547            };
+548
+549            // `right` can't be a Path (rbp > lbp); only valid option is `Name`
+550            match right.kind {
+551                Expr::Name(name) => {
+552                    path.segments.push(Node::new(name, right.span));
+553                    Node::new(Expr::Path(path), left.span + right.span)
+554                }
+555                _ => {
+556                    par.fancy_error(
+557                        "failed to parse path expression",
+558                        vec![
+559                            Label::secondary(op.span, "path delimiter".to_string()),
+560                            Label::primary(right.span, "expected a name"),
+561                        ],
+562                        vec![],
+563                    );
+564                    return Err(ParseFailed);
+565                }
+566            }
+567        }
+568        _ => panic!("Unexpected infix op token: {op:?}"),
+569    };
+570    Ok(expr)
+571}
+572
+573/// Create an `Expr::BoolOperation` node for the given operator and operands.
+574fn bool_op(left: Node<Expr>, op: &Token, right: Node<Expr>) -> Node<Expr> {
+575    use TokenKind::*;
+576    let astop = match op.kind {
+577        And => ast::BoolOperator::And,
+578        Or => ast::BoolOperator::Or,
+579        _ => panic!(),
+580    };
+581
+582    let span = left.span + right.span;
+583    Node::new(
+584        Expr::BoolOperation {
+585            left: Box::new(left),
+586            op: Node::new(astop, op.span),
+587            right: Box::new(right),
+588        },
+589        span,
+590    )
+591}
+592
+593/// Create an `Expr::BinOperation` node for the given operator and operands.
+594fn bin_op(left: Node<Expr>, op: &Token, right: Node<Expr>) -> Node<Expr> {
+595    use ast::BinOperator::*;
+596    use TokenKind::*;
+597
+598    let astop = match op.kind {
+599        Amper => BitAnd,
+600        Hat => BitXor,
+601        Pipe => BitOr,
+602        LtLt => LShift,
+603        GtGt => RShift,
+604        Plus => Add,
+605        Minus => Sub,
+606        Star => Mult,
+607        Slash => Div,
+608        Percent => Mod,
+609        StarStar => Pow,
+610        _ => panic!(),
+611    };
+612
+613    let span = left.span + right.span;
+614    Node::new(
+615        Expr::BinOperation {
+616            left: Box::new(left),
+617            op: Node::new(astop, op.span),
+618            right: Box::new(right),
+619        },
+620        span,
+621    )
+622}
+623
+624/// Create an `Expr::UnaryOperation` node for the given operator and operands.
+625fn unary_op(par: &mut Parser, op: &Token, operand: Node<Expr>) -> ParseResult<Node<Expr>> {
+626    use ast::UnaryOperator;
+627    use TokenKind::*;
+628
+629    let astop = match op.kind {
+630        Tilde => UnaryOperator::Invert,
+631        Not => UnaryOperator::Not,
+632        Minus => UnaryOperator::USub,
+633        Plus => {
+634            par.fancy_error(
+635                "unary plus not supported",
+636                vec![Label::primary(op.span, "consider removing the '+'")],
+637                vec![],
+638            );
+639            return Err(ParseFailed);
+640        }
+641        _ => panic!(),
+642    };
+643
+644    let span = op.span + operand.span;
+645    Ok(Node::new(
+646        Expr::UnaryOperation {
+647            op: Node::new(astop, op.span),
+648            operand: Box::new(operand),
+649        },
+650        span,
+651    ))
+652}
+653
+654/// Create an `Expr::CompOperation` node for the given operator and operands.
+655fn comp_op(left: Node<Expr>, op: &Token, right: Node<Expr>) -> Node<Expr> {
+656    use ast::CompOperator;
+657    use TokenKind::*;
+658    let astop = match op.kind {
+659        In => todo!("in"), // CompOperator::In,
+660        Lt => CompOperator::Lt,
+661        LtEq => CompOperator::LtE,
+662        Gt => CompOperator::Gt,
+663        GtEq => CompOperator::GtE,
+664        NotEq => CompOperator::NotEq,
+665        EqEq => CompOperator::Eq,
+666        _ => panic!(),
+667    };
+668    let span = left.span + right.span;
+669    Node::new(
+670        Expr::CompOperation {
+671            left: Box::new(left),
+672            op: Node::new(astop, op.span),
+673            right: Box::new(right),
+674        },
+675        span,
+676    )
+677}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/grammar/functions.rs.html b/compiler-docs/src/fe_parser/grammar/functions.rs.html new file mode 100644 index 0000000000..c38edf9bf0 --- /dev/null +++ b/compiler-docs/src/fe_parser/grammar/functions.rs.html @@ -0,0 +1,914 @@ +functions.rs - source

fe_parser/grammar/
functions.rs

1use super::expressions::parse_expr;
+2use super::types::parse_type_desc;
+3
+4use crate::ast::{
+5    BinOperator, Expr, FuncStmt, Function, FunctionArg, FunctionSignature, GenericParameter,
+6    LiteralPattern, MatchArm, Path, Pattern, TypeDesc, VarDeclTarget,
+7};
+8use crate::node::{Node, Span};
+9use crate::{Label, ParseFailed, ParseResult, Parser, TokenKind};
+10
+11/// Parse a function definition without a body. The optional `pub` qualifier
+12/// must be parsed by the caller, and passed in. Next token must be `unsafe` or
+13/// `fn`.
+14pub fn parse_fn_sig(
+15    par: &mut Parser,
+16    mut pub_qual: Option<Span>,
+17) -> ParseResult<Node<FunctionSignature>> {
+18    let unsafe_qual = par.optional(TokenKind::Unsafe).map(|tok| tok.span);
+19    if let Some(pub_) = par.optional(TokenKind::Pub) {
+20        let unsafe_span =
+21            unsafe_qual.expect("caller must verify that next token is `unsafe` or `fn`");
+22
+23        par.fancy_error(
+24            "`pub` visibility modifier must come before `unsafe`",
+25            vec![Label::primary(
+26                unsafe_span + pub_.span,
+27                "use `pub unsafe` here",
+28            )],
+29            vec![],
+30        );
+31        pub_qual = pub_qual.or(Some(pub_.span));
+32    }
+33    let fn_tok = par.expect(TokenKind::Fn, "failed to parse function definition")?;
+34    let name = par.expect(TokenKind::Name, "failed to parse function definition")?;
+35
+36    let mut span = fn_tok.span + name.span + unsafe_qual + pub_qual;
+37
+38    let generic_params = if par.peek() == Some(TokenKind::Lt) {
+39        parse_generic_params(par)?
+40    } else {
+41        Node::new(vec![], name.span)
+42    };
+43
+44    let args = match par.peek_or_err()? {
+45        TokenKind::ParenOpen => {
+46            let node = parse_fn_param_list(par)?;
+47            span += node.span;
+48            node.kind
+49        }
+50        TokenKind::BraceOpen | TokenKind::Arrow => {
+51            par.fancy_error(
+52                "function definition requires a list of parameters",
+53                vec![Label::primary(
+54                    name.span,
+55                    "function name must be followed by `(`",
+56                )],
+57                vec![
+58                    format!(
+59                        "Note: if the function `{}` takes no parameters, use an empty set of parentheses.",
+60                        name.text
+61                    ),
+62                    format!("Example: fn {}()", name.text),
+63                    "Note: each parameter must have a name and a type.".into(),
+64                    format!("Example: fn {}(my_value: u256, x: bool)", name.text),
+65                ],
+66            );
+67            vec![]
+68        }
+69        _ => {
+70            let tok = par.next()?;
+71            par.unexpected_token_error(
+72                &tok,
+73                "failed to parse function definition",
+74                vec![
+75                    "function name must be followed by a list of parameters".into(),
+76                    "Example: `fn foo(x: address, y: u256)` or `fn f()`".into(),
+77                ],
+78            );
+79            return Err(ParseFailed);
+80        }
+81    };
+82    let return_type = if par.peek() == Some(TokenKind::Arrow) {
+83        par.next()?;
+84        let typ = parse_type_desc(par)?;
+85        span += typ.span;
+86        Some(typ)
+87    } else {
+88        None
+89    };
+90
+91    Ok(Node::new(
+92        FunctionSignature {
+93            pub_: pub_qual,
+94            unsafe_: unsafe_qual,
+95            name: name.into(),
+96            args,
+97            generic_params,
+98            return_type,
+99        },
+100        span,
+101    ))
+102}
+103
+104/// Parse a function definition. The optional `pub` qualifier must be parsed by
+105/// the caller, and passed in. Next token must be `unsafe` or `fn`.
+106pub fn parse_fn_def(par: &mut Parser, pub_qual: Option<Span>) -> ParseResult<Node<Function>> {
+107    let sig = parse_fn_sig(par, pub_qual)?;
+108
+109    // TODO: allow multi-line return type? `fn f()\n ->\n u8`
+110    par.enter_block(sig.span, "function definition")?;
+111    let body = parse_block_stmts(par)?;
+112    let rbrace = par.expect(TokenKind::BraceClose, "missing `}` in fn definition")?;
+113
+114    Ok(Node::new(
+115        Function {
+116            sig: sig.clone(),
+117            body,
+118        },
+119        sig.span + rbrace.span,
+120    ))
+121}
+122
+123/// Parse a single generic function parameter (eg. `T:SomeTrait` in `fn foo<T:
+124/// SomeTrait>(some_arg: u256) -> bool`). # Panics
+125/// Panics if the first token isn't `Name`.
+126pub fn parse_generic_param(par: &mut Parser) -> ParseResult<GenericParameter> {
+127    use TokenKind::*;
+128
+129    let name = par.assert(Name);
+130    match par.optional(Colon) {
+131        Some(_) => {
+132            let bound = par.expect(TokenKind::Name, "failed to parse generic bound")?;
+133            Ok(GenericParameter::Bounded {
+134                name: Node::new(name.text.into(), name.span),
+135                bound: Node::new(
+136                    TypeDesc::Base {
+137                        base: bound.text.into(),
+138                    },
+139                    bound.span,
+140                ),
+141            })
+142        }
+143        None => Ok(GenericParameter::Unbounded(Node::new(
+144            name.text.into(),
+145            name.span,
+146        ))),
+147    }
+148}
+149
+150/// Parse an angle-bracket-wrapped list of generic arguments (eg. `<T, R:
+151/// SomeTrait>` in `fn foo<T, R: SomeTrait>(some_arg: u256) -> bool`). # Panics
+152/// Panics if the first token isn't `<`.
+153pub fn parse_generic_params(par: &mut Parser) -> ParseResult<Node<Vec<GenericParameter>>> {
+154    use TokenKind::*;
+155    let mut span = par.assert(Lt).span;
+156
+157    let mut args = vec![];
+158
+159    let expect_end = |par: &mut Parser| {
+160        // If there's no comma, the next token must be `>`
+161        match par.peek_or_err()? {
+162            Gt => Ok(par.next()?.span),
+163            _ => {
+164                let tok = par.next()?;
+165                par.unexpected_token_error(
+166                    &tok,
+167                    "Unexpected token while parsing generic arg list",
+168                    vec!["Expected a `>` here".to_string()],
+169                );
+170                Err(ParseFailed)
+171            }
+172        }
+173    };
+174
+175    loop {
+176        match par.peek_or_err()? {
+177            Gt => {
+178                span += par.next()?.span;
+179                break;
+180            }
+181            Name => {
+182                let typ = parse_generic_param(par)?;
+183                args.push(typ);
+184                if par.peek() == Some(Comma) {
+185                    par.next()?;
+186                } else {
+187                    span += expect_end(par)?;
+188                    break;
+189                }
+190            }
+191
+192            // Invalid generic argument.
+193            _ => {
+194                let tok = par.next()?;
+195                par.unexpected_token_error(
+196                    &tok,
+197                    "failed to parse list of generic function parameters",
+198                    vec!["Expected a generic parameter name such as `T` here".to_string()],
+199                );
+200                return Err(ParseFailed);
+201            }
+202        }
+203    }
+204    Ok(Node::new(args, span))
+205}
+206
+207fn parse_fn_param_list(par: &mut Parser) -> ParseResult<Node<Vec<Node<FunctionArg>>>> {
+208    let mut span = par.assert(TokenKind::ParenOpen).span;
+209    let mut params = vec![];
+210    loop {
+211        match par.peek_or_err()? {
+212            TokenKind::ParenClose => {
+213                span += par.next()?.span;
+214                break;
+215            }
+216            TokenKind::Mut | TokenKind::Name | TokenKind::SelfValue => {
+217                params.push(parse_fn_param(par)?);
+218
+219                if par.peek() == Some(TokenKind::Comma) {
+220                    par.next()?;
+221                } else {
+222                    span += par
+223                        .expect(
+224                            TokenKind::ParenClose,
+225                            "unexpected token while parsing function parameter list",
+226                        )?
+227                        .span;
+228                    break;
+229                }
+230            }
+231            _ => {
+232                let tok = par.next()?;
+233                par.unexpected_token_error(&tok, "failed to parse function parameter list", vec![]);
+234                return Err(ParseFailed);
+235            }
+236        }
+237    }
+238    Ok(Node::new(params, span))
+239}
+240
+241fn parse_fn_param(par: &mut Parser) -> ParseResult<Node<FunctionArg>> {
+242    let mut_ = par.optional(TokenKind::Mut).map(|tok| tok.span);
+243
+244    match par.peek_or_err()? {
+245        TokenKind::SelfValue => Ok(Node::new(FunctionArg::Self_ { mut_ }, par.next()?.span)),
+246        TokenKind::Name => {
+247            let ident = par.next()?;
+248
+249            // Parameter can have an optional label specifier. Example:
+250            //     fn transfer(from sender: address, to recipient: address, _ val: u256)
+251            //     transfer(from: me, to: you, 100)
+252
+253            let (label, name) = match par.optional(TokenKind::Name) {
+254                Some(name) => (Some(ident), name),
+255                None => (None, ident),
+256            };
+257            par.expect_with_notes(
+258                TokenKind::Colon,
+259                "failed to parse function parameter",
+260                |_| {
+261                    vec![
+262                        "Note: parameter name must be followed by a colon and a type description"
+263                            .into(),
+264                        format!("Example: `{}: u256`", name.text),
+265                    ]
+266                },
+267            )?;
+268            let typ = parse_type_desc(par)?;
+269            let param_span = name.span + typ.span + mut_ + label.as_ref();
+270            Ok(Node::new(
+271                FunctionArg::Regular {
+272                    mut_,
+273                    label: label.map(Node::from),
+274                    name: name.into(),
+275                    typ,
+276                },
+277                param_span,
+278            ))
+279        }
+280        _ => {
+281            let tok = par.next()?;
+282            par.unexpected_token_error(&tok, "failed to parse function parameter list", vec![]);
+283            Err(ParseFailed)
+284        }
+285    }
+286}
+287
+288/// Parse (function) statements until a `}` or end-of-file is reached.
+289fn parse_block_stmts(par: &mut Parser) -> ParseResult<Vec<Node<FuncStmt>>> {
+290    let mut body = vec![];
+291    loop {
+292        par.eat_newlines();
+293        match par.peek_or_err()? {
+294            TokenKind::BraceClose => break,
+295            _ => body.push(parse_stmt(par)?),
+296        }
+297    }
+298    Ok(body)
+299}
+300
+301fn aug_assign_op(tk: TokenKind) -> Option<BinOperator> {
+302    use BinOperator::*;
+303    use TokenKind::*;
+304
+305    let op = match tk {
+306        PlusEq => Add,
+307        MinusEq => Sub,
+308        StarEq => Mult,
+309        SlashEq => Div,
+310        PercentEq => Mod,
+311        StarStarEq => Pow,
+312        LtLtEq => LShift,
+313        GtGtEq => RShift,
+314        PipeEq => BitOr,
+315        HatEq => BitXor,
+316        AmperEq => BitAnd,
+317        _ => return None,
+318    };
+319    Some(op)
+320}
+321
+322/// Parse a `continue`, `break`, `pass`, or `revert` statement.
+323///
+324/// # Panics
+325/// Panics if the next token isn't one of the above.
+326pub fn parse_single_word_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+327    let tok = par.next()?;
+328    par.expect_stmt_end(tok.kind.describe())?;
+329    let stmt = match tok.kind {
+330        TokenKind::Continue => FuncStmt::Continue,
+331        TokenKind::Break => FuncStmt::Break,
+332        _ => panic!(),
+333    };
+334    Ok(Node::new(stmt, tok.span))
+335}
+336
+337/// Parse a function-level statement.
+338pub fn parse_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+339    use TokenKind::*;
+340
+341    // rule: stmt parsing fns eat the trailing separator (newline, semi)
+342    match par.peek_or_err()? {
+343        For => parse_for_stmt(par),
+344        If => parse_if_stmt(par),
+345        Match => parse_match_stmt(par),
+346        While => parse_while_stmt(par),
+347        Return => parse_return_stmt(par),
+348        Assert => parse_assert_stmt(par),
+349        Revert => parse_revert_stmt(par),
+350        Continue | Break => parse_single_word_stmt(par),
+351        Let => parse_var_decl(par),
+352        Const => parse_const_decl(par),
+353        Unsafe => parse_unsafe_block(par),
+354        _ => parse_expr_stmt(par),
+355    }
+356}
+357
+358fn parse_var_decl(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+359    let let_tkn = par.assert(TokenKind::Let);
+360    let mut_ = par.optional(TokenKind::Mut).map(|t| t.span);
+361    let expr = parse_expr(par)?;
+362    let target = expr_to_vardecl_target(par, expr.clone())?;
+363    let node = match par.peek() {
+364        Some(TokenKind::Colon) => {
+365            par.next()?;
+366            let typ = parse_type_desc(par)?;
+367            let value = if par.peek() == Some(TokenKind::Eq) {
+368                par.next()?;
+369                Some(parse_expr(par)?)
+370            } else {
+371                None
+372            };
+373            let span = let_tkn.span + target.span + typ.span + value.as_ref();
+374            par.expect_stmt_end("variable declaration")?;
+375            Node::new(
+376                FuncStmt::VarDecl {
+377                    mut_,
+378                    target,
+379                    typ,
+380                    value,
+381                },
+382                span,
+383            )
+384        }
+385        _ => {
+386            par.fancy_error(
+387                "failed to parse variable declaration",
+388                vec![Label::primary(
+389                    expr.span,
+390                    "Must be followed by type annotation",
+391                )],
+392                vec!["Example: `let x: u8 = 1`".into()],
+393            );
+394            return Err(ParseFailed);
+395        }
+396    };
+397    Ok(node)
+398}
+399
+400fn parse_const_decl(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+401    let const_tok = par.assert(TokenKind::Const);
+402    let name = par.expect(TokenKind::Name, "failed to parse constant declaration")?;
+403    par.expect_with_notes(
+404        TokenKind::Colon,
+405        "failed to parse constant declaration",
+406        |_| {
+407            vec![
+408                "Note: constant name must be followed by a colon and a type description".into(),
+409                format!("Example: let `{}: u256 = 1000`", name.text),
+410            ]
+411        },
+412    )?;
+413    let typ = parse_type_desc(par)?;
+414    par.expect_with_notes(
+415        TokenKind::Eq,
+416        "failed to parse constant declaration",
+417        |_| {
+418            vec![
+419            "Note: the type of a constant must be followed by an equals sign and a value assignment"
+420                .into(),
+421                format!(
+422                    "Example: let `{}: u256 = 1000`",
+423                    name.text
+424                ),
+425        ]
+426        },
+427    )?;
+428
+429    let value = parse_expr(par)?;
+430    par.expect_stmt_end("variable declaration")?;
+431
+432    let span = const_tok.span + value.span;
+433    Ok(Node::new(
+434        FuncStmt::ConstantDecl {
+435            name: name.into(),
+436            typ,
+437            value,
+438        },
+439        span,
+440    ))
+441}
+442
+443/// Parse a (function) statement that begins with an expression. This might be
+444/// a `VarDecl`, `Assign`, or an expression.
+445fn parse_expr_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+446    use TokenKind::*;
+447    let expr = parse_expr(par)?;
+448    let node = match par.peek() {
+449        None | Some(Newline | Semi | BraceClose) => {
+450            let span = expr.span;
+451            Node::new(FuncStmt::Expr { value: expr }, span)
+452        }
+453        Some(Colon) => {
+454            par.fancy_error(
+455                "Variable declaration must begin with `let`",
+456                vec![Label::primary(expr.span, "invalid variable declaration")],
+457                vec!["Example: `let x: u8 = 1`".into()],
+458            );
+459            return Err(ParseFailed);
+460        }
+461        Some(Eq) => {
+462            par.next()?;
+463            let value = parse_expr(par)?;
+464            let span = expr.span + value.span;
+465            // TODO: should `x = y = z` be allowed?
+466            Node::new(
+467                FuncStmt::Assign {
+468                    target: expr,
+469                    value,
+470                },
+471                span,
+472            )
+473        }
+474        Some(tk) => {
+475            let tok = par.next()?;
+476            if let Some(op) = aug_assign_op(tk) {
+477                let value = parse_expr(par)?;
+478                let span = expr.span + value.span;
+479                Node::new(
+480                    FuncStmt::AugAssign {
+481                        target: expr,
+482                        op: Node::new(op, tok.span),
+483                        value,
+484                    },
+485                    span,
+486                )
+487            } else {
+488                par.unexpected_token_error(&tok, "invalid syntax in function body", vec![]);
+489                return Err(ParseFailed);
+490            }
+491        }
+492    };
+493    par.expect_stmt_end("statement")?;
+494    Ok(node)
+495}
+496
+497fn expr_to_vardecl_target(par: &mut Parser, expr: Node<Expr>) -> ParseResult<Node<VarDeclTarget>> {
+498    match expr.kind {
+499        Expr::Name(name) => Ok(Node::new(VarDeclTarget::Name(name), expr.span)),
+500        Expr::Tuple { elts } if !elts.is_empty() => Ok(Node::new(
+501            VarDeclTarget::Tuple(
+502                elts.into_iter()
+503                    .map(|elt| expr_to_vardecl_target(par, elt))
+504                    .collect::<ParseResult<Vec<_>>>()?,
+505            ),
+506            expr.span,
+507        )),
+508        _ => {
+509            par.fancy_error(
+510                "failed to parse variable declaration",
+511                vec![Label::primary(
+512                    expr.span,
+513                    "invalid variable declaration target",
+514                )],
+515                vec![
+516                    "The left side of a variable declaration can be either a name\nor a non-empty tuple."
+517                        .into(),
+518                ],
+519            );
+520            Err(ParseFailed)
+521        }
+522    }
+523}
+524
+525/// Parse an `if` statement.
+526///
+527/// # Panics
+528/// Panics if the next token isn't `if`.
+529pub fn parse_if_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+530    let if_tok = par.assert(TokenKind::If);
+531    let test = parse_expr(par)?;
+532    par.enter_block(if_tok.span + test.span, "`if` statement")?;
+533    let body = parse_block_stmts(par)?;
+534    par.expect(TokenKind::BraceClose, "`if` statement")?;
+535    par.eat_newlines();
+536
+537    let else_block = match par.peek() {
+538        Some(TokenKind::Else) => {
+539            let else_tok = par.next()?;
+540            if par.peek() == Some(TokenKind::If) {
+541                vec![parse_if_stmt(par)?]
+542            } else {
+543                par.enter_block(else_tok.span, "`if` statement `else` branch")?;
+544                let else_body = parse_block_stmts(par)?;
+545                par.expect(TokenKind::BraceClose, "`if` statement")?;
+546                else_body
+547            }
+548        }
+549        _ => vec![],
+550    };
+551
+552    let span = if_tok.span + test.span + body.last() + else_block.last();
+553    Ok(Node::new(
+554        FuncStmt::If {
+555            test,
+556            body,
+557            or_else: else_block,
+558        },
+559        span,
+560    ))
+561}
+562
+563/// Parse a `match` statement.
+564///
+565/// # Panics
+566/// Panics if the next token isn't `match`.
+567pub fn parse_match_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+568    let match_tok = par.assert(TokenKind::Match);
+569    let expr = parse_expr(par)?;
+570    par.enter_block(match_tok.span + expr.span, "`match` statement")?;
+571    let arms = parse_match_arms(par)?;
+572    let end = par.expect(TokenKind::BraceClose, "`match` statement")?;
+573
+574    let span = match_tok.span + end.span;
+575    Ok(Node::new(FuncStmt::Match { expr, arms }, span))
+576}
+577
+578pub fn parse_match_arms(par: &mut Parser) -> ParseResult<Vec<Node<MatchArm>>> {
+579    let mut arms = vec![];
+580    par.eat_newlines();
+581    while par.peek_or_err()? != TokenKind::BraceClose {
+582        let pat = parse_pattern(par)?;
+583
+584        par.expect(TokenKind::FatArrow, "`match arm`")?;
+585
+586        par.enter_block(pat.span, "`match` arm")?;
+587        let body = parse_block_stmts(par)?;
+588        let end = par.expect(TokenKind::BraceClose, "`match` arm")?;
+589
+590        let span = pat.span + end.span;
+591        arms.push(Node::new(MatchArm { pat, body }, span));
+592        par.eat_newlines();
+593    }
+594
+595    Ok(arms)
+596}
+597
+598pub fn parse_pattern(par: &mut Parser) -> ParseResult<Node<Pattern>> {
+599    let mut left_pat = parse_pattern_atom(par)?;
+600    let mut span = left_pat.span;
+601    while let Some(TokenKind::Pipe) = par.peek() {
+602        par.next().unwrap();
+603        let right_pat = parse_pattern_atom(par)?;
+604        span += right_pat.span;
+605        let patterns = match left_pat.kind {
+606            Pattern::Or(mut patterns) => {
+607                patterns.push(right_pat);
+608                patterns
+609            }
+610            _ => {
+611                vec![left_pat, right_pat]
+612            }
+613        };
+614        left_pat = Node::new(Pattern::Or(patterns), span);
+615    }
+616
+617    Ok(left_pat)
+618}
+619
+620/// Parse a `while` statement.
+621///
+622/// # Panics
+623/// Panics if the next token isn't `while`.
+624pub fn parse_while_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+625    let while_tok = par.assert(TokenKind::While);
+626
+627    let test = parse_expr(par)?;
+628    par.enter_block(while_tok.span + test.span, "`while` statement")?;
+629    let body = parse_block_stmts(par)?;
+630    let end = par.expect(TokenKind::BraceClose, "`while` statement")?;
+631    let span = while_tok.span + test.span + end.span;
+632
+633    Ok(Node::new(FuncStmt::While { test, body }, span))
+634}
+635
+636/// Parse a `for` statement.
+637///
+638/// # Panics
+639/// Panics if the next token isn't `for`.
+640pub fn parse_for_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+641    let for_tok = par.assert(TokenKind::For);
+642
+643    let target = par
+644        .expect(TokenKind::Name, "failed to parse `for` statement")?
+645        .into();
+646    par.expect(TokenKind::In, "failed to parse `for` statement")?;
+647    let iter = parse_expr(par)?;
+648    par.enter_block(for_tok.span + iter.span, "`for` statement")?;
+649    let body = parse_block_stmts(par)?;
+650    let end = par.expect(TokenKind::BraceClose, "`for` statement")?;
+651    par.expect_stmt_end("`for` statement")?;
+652    let span = for_tok.span + iter.span + end.span;
+653
+654    Ok(Node::new(FuncStmt::For { target, iter, body }, span))
+655}
+656
+657/// Parse a `return` statement.
+658///
+659/// # Panics
+660/// Panics if the next token isn't `return`.
+661pub fn parse_return_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+662    let ret = par.assert(TokenKind::Return);
+663    let value = match par.peek() {
+664        None | Some(TokenKind::Newline) => None,
+665        Some(_) => Some(parse_expr(par)?),
+666    };
+667    par.expect_stmt_end("return statement")?;
+668    let span = ret.span + value.as_ref();
+669    Ok(Node::new(FuncStmt::Return { value }, span))
+670}
+671
+672/// Parse an `assert` statement.
+673///
+674/// # Panics
+675/// Panics if the next token isn't `assert`.
+676pub fn parse_assert_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+677    let assert_tok = par.assert(TokenKind::Assert);
+678    let test = parse_expr(par)?;
+679    let msg = match par.peek() {
+680        None | Some(TokenKind::Newline) => None,
+681        Some(TokenKind::Comma) => {
+682            par.next()?;
+683            Some(parse_expr(par)?)
+684        }
+685        Some(_) => {
+686            let tok = par.next()?;
+687            par.unexpected_token_error(&tok, "failed to parse `assert` statement", vec![]);
+688            return Err(ParseFailed);
+689        }
+690    };
+691    par.expect_stmt_end("assert statement")?;
+692    let span = assert_tok.span + test.span + msg.as_ref();
+693    Ok(Node::new(FuncStmt::Assert { test, msg }, span))
+694}
+695
+696/// Parse a `revert` statement.
+697///
+698/// # Panics
+699/// Panics if the next token isn't `revert`.
+700pub fn parse_revert_stmt(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+701    let revert_tok = par.assert(TokenKind::Revert);
+702    let error = match par.peek() {
+703        None | Some(TokenKind::Newline) => None,
+704        Some(_) => Some(parse_expr(par)?),
+705    };
+706    par.expect_stmt_end("revert statement")?;
+707    let span = revert_tok.span + error.as_ref();
+708    Ok(Node::new(FuncStmt::Revert { error }, span))
+709}
+710
+711/// Parse an `unsafe` block.
+712///
+713/// # Panics
+714/// Panics if the next token isn't `unsafe`.
+715pub fn parse_unsafe_block(par: &mut Parser) -> ParseResult<Node<FuncStmt>> {
+716    let kw_tok = par.assert(TokenKind::Unsafe);
+717    par.enter_block(kw_tok.span, "`unsafe` block")?;
+718    let body = parse_block_stmts(par)?;
+719    let end = par.expect(TokenKind::BraceClose, "`unsafe` block")?;
+720    let span = kw_tok.span + end.span;
+721
+722    Ok(Node::new(FuncStmt::Unsafe(body), span))
+723}
+724
+725fn parse_pattern_atom(par: &mut Parser) -> ParseResult<Node<Pattern>> {
+726    match par.peek() {
+727        Some(TokenKind::ParenOpen) => return parse_tuple_pattern(par, None),
+728        Some(TokenKind::True) => {
+729            let span = par.next().unwrap().span;
+730            let literal_pat = Node::new(LiteralPattern::Bool(true), span);
+731            return Ok(Node::new(Pattern::Literal(literal_pat), span));
+732        }
+733        Some(TokenKind::False) => {
+734            let span = par.next().unwrap().span;
+735            let literal_pat = Node::new(LiteralPattern::Bool(false), span);
+736            return Ok(Node::new(Pattern::Literal(literal_pat), span));
+737        }
+738        Some(TokenKind::DotDot) => {
+739            let span = par.next().unwrap().span;
+740            return Ok(Node::new(Pattern::Rest, span));
+741        }
+742        _ => {}
+743    }
+744
+745    let mut pattern = parse_path_pattern_segment(par)?;
+746
+747    while let Some(TokenKind::ColonColon) = par.peek() {
+748        par.next().unwrap();
+749        let right = parse_path_pattern_segment(par)?;
+750        pattern = try_merge_path_pattern(par, pattern, right)?;
+751    }
+752
+753    if let Some(TokenKind::ParenOpen) = par.peek() {
+754        match pattern.kind {
+755            Pattern::Path(path) => parse_tuple_pattern(par, Some(path)),
+756            Pattern::WildCard => {
+757                invalid_pattern(par, "can't use wildcard with tuple pattern", pattern.span)
+758            }
+759            _ => unreachable!(),
+760        }
+761    } else if let Some(TokenKind::BraceOpen) = par.peek() {
+762        match pattern.kind {
+763            Pattern::Path(path) => parse_struct_pattern(par, path),
+764            Pattern::WildCard => {
+765                invalid_pattern(par, "can't use wildcard with struct pattern", pattern.span)
+766            }
+767            _ => unreachable!(),
+768        }
+769    } else {
+770        Ok(pattern)
+771    }
+772}
+773
+774fn parse_tuple_pattern(par: &mut Parser, path: Option<Node<Path>>) -> ParseResult<Node<Pattern>> {
+775    if let Some(TokenKind::ParenOpen) = par.peek() {
+776        par.eat_newlines();
+777        let paren_span = par.next().unwrap().span;
+778
+779        let (elts, last_span) = if let Some(TokenKind::ParenClose) = par.peek() {
+780            (vec![], par.next().unwrap().span)
+781        } else {
+782            par.eat_newlines();
+783            let mut elts = vec![parse_pattern(par)?];
+784            while let Some(TokenKind::Comma) = par.peek() {
+785                par.next().unwrap();
+786                elts.push(parse_pattern(par)?);
+787                par.eat_newlines();
+788            }
+789            let last_span = par.expect(TokenKind::ParenClose, "pattern")?.span;
+790            (elts, last_span)
+791        };
+792
+793        if let Some(path) = path {
+794            let span = path.span + last_span;
+795            Ok(Node::new(Pattern::PathTuple(path, elts), span))
+796        } else {
+797            let span = paren_span + last_span;
+798            Ok(Node::new(Pattern::Tuple(elts), span))
+799        }
+800    } else {
+801        unreachable!()
+802    }
+803}
+804
+805fn parse_struct_pattern(par: &mut Parser, path: Node<Path>) -> ParseResult<Node<Pattern>> {
+806    if let Some(TokenKind::BraceOpen) = par.peek() {
+807        par.eat_newlines();
+808        let mut span = par.next().unwrap().span;
+809
+810        let mut fields = vec![];
+811        let mut has_rest = false;
+812        loop {
+813            par.eat_newlines();
+814            match par.peek_or_err()? {
+815                TokenKind::Name => {
+816                    let name = par.next().unwrap();
+817                    let field_name = Node::new(name.text.into(), name.span);
+818                    par.expect(TokenKind::Colon, "failed to parse struct pattern")?;
+819                    let pat = parse_pattern(par)?;
+820                    fields.push((field_name, pat));
+821                    if par.peek() == Some(TokenKind::Comma) {
+822                        par.next()?;
+823                    } else {
+824                        span += par
+825                            .expect(TokenKind::BraceClose, "failed to parse struct pattern")?
+826                            .span;
+827                        break;
+828                    }
+829                }
+830
+831                TokenKind::DotDot => {
+832                    par.next().unwrap();
+833                    has_rest = true;
+834                    par.eat_newlines();
+835                    span += par
+836                        .expect(
+837                            TokenKind::BraceClose,
+838                            "`..` pattern should be the last position in the struct pattern",
+839                        )?
+840                        .span;
+841                    break;
+842                }
+843
+844                TokenKind::BraceClose => {
+845                    span += par.next().unwrap().span;
+846                    break;
+847                }
+848
+849                _ => {
+850                    let tok = par.next()?;
+851                    par.unexpected_token_error(&tok, "failed to parse struct pattern", vec![]);
+852                    return Err(ParseFailed);
+853                }
+854            }
+855        }
+856
+857        Ok(Node::new(
+858            Pattern::PathStruct {
+859                path,
+860                fields,
+861                has_rest,
+862            },
+863            span,
+864        ))
+865    } else {
+866        unreachable!()
+867    }
+868}
+869
+870fn try_merge_path_pattern(
+871    par: &mut Parser,
+872    left: Node<Pattern>,
+873    right: Node<Pattern>,
+874) -> ParseResult<Node<Pattern>> {
+875    let span = left.span + right.span;
+876
+877    match (left.kind, right.kind) {
+878        (Pattern::Path(mut left_path), Pattern::Path(right_path)) => {
+879            left_path
+880                .kind
+881                .segments
+882                .extend_from_slice(&right_path.kind.segments);
+883            left_path.span = span;
+884            let span = left.span + right.span;
+885            Ok(Node::new(Pattern::Path(left_path), span))
+886        }
+887        _ => invalid_pattern(par, "invalid pattern here", span),
+888    }
+889}
+890
+891fn parse_path_pattern_segment(par: &mut Parser) -> ParseResult<Node<Pattern>> {
+892    let tok = par.expect(TokenKind::Name, "failed to parse pattern")?;
+893    let text = tok.text;
+894    if text == "_" {
+895        Ok(Node::new(Pattern::WildCard, tok.span))
+896    } else {
+897        let path = Path {
+898            segments: vec![Node::new(text.into(), tok.span)],
+899        };
+900        Ok(Node::new(
+901            Pattern::Path(Node::new(path, tok.span)),
+902            tok.span,
+903        ))
+904    }
+905}
+906
+907fn invalid_pattern(par: &mut Parser, message: &str, span: Span) -> ParseResult<Node<Pattern>> {
+908    par.fancy_error(
+909        "invalid pattern",
+910        vec![Label::primary(span, message)],
+911        vec![],
+912    );
+913    Err(ParseFailed)
+914}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/grammar/module.rs.html b/compiler-docs/src/fe_parser/grammar/module.rs.html new file mode 100644 index 0000000000..15677e6072 --- /dev/null +++ b/compiler-docs/src/fe_parser/grammar/module.rs.html @@ -0,0 +1,281 @@ +module.rs - source

fe_parser/grammar/
module.rs

1use super::expressions::parse_expr;
+2use super::functions::parse_fn_def;
+3use super::types::{
+4    parse_impl_def, parse_path_tail, parse_struct_def, parse_trait_def, parse_type_alias,
+5    parse_type_desc,
+6};
+7use super::{contracts::parse_contract_def, types::parse_enum_def};
+8use crate::ast::{ConstantDecl, Module, ModuleStmt, Pragma, Use, UseTree};
+9use crate::node::{Node, Span};
+10use crate::{Label, ParseFailed, ParseResult, Parser, TokenKind};
+11
+12use semver::VersionReq;
+13
+14/// Parse a [`Module`].
+15pub fn parse_module(par: &mut Parser) -> Node<Module> {
+16    let mut body = vec![];
+17    loop {
+18        match par.peek() {
+19            Some(TokenKind::Newline) => {
+20                par.next().unwrap();
+21            }
+22            None => break,
+23            Some(_) => {
+24                match parse_module_stmt(par) {
+25                    Ok(stmt) => body.push(stmt),
+26                    Err(_) => {
+27                        // TODO: capture a real span here
+28                        body.push(ModuleStmt::ParseError(Span::zero(par.file_id)));
+29                        break;
+30                    }
+31                };
+32            }
+33        }
+34    }
+35    let span = Span::zero(par.file_id) + body.first() + body.last();
+36    Node::new(Module { body }, span)
+37}
+38
+39/// Parse a [`ModuleStmt`].
+40pub fn parse_module_stmt(par: &mut Parser) -> ParseResult<ModuleStmt> {
+41    let stmt = match par.peek_or_err()? {
+42        TokenKind::Pragma => ModuleStmt::Pragma(parse_pragma(par)?),
+43        TokenKind::Use => ModuleStmt::Use(parse_use(par)?),
+44        TokenKind::Contract => ModuleStmt::Contract(parse_contract_def(par, None)?),
+45        TokenKind::Struct => ModuleStmt::Struct(parse_struct_def(par, None)?),
+46        TokenKind::Enum => ModuleStmt::Enum(parse_enum_def(par, None)?),
+47        TokenKind::Trait => ModuleStmt::Trait(parse_trait_def(par, None)?),
+48        TokenKind::Impl => ModuleStmt::Impl(parse_impl_def(par)?),
+49        TokenKind::Type => ModuleStmt::TypeAlias(parse_type_alias(par, None)?),
+50        TokenKind::Const => ModuleStmt::Constant(parse_constant(par, None)?),
+51        TokenKind::Pub => {
+52            let pub_span = par.next()?.span;
+53            match par.peek_or_err()? {
+54                TokenKind::Fn | TokenKind::Unsafe => {
+55                    ModuleStmt::Function(parse_fn_def(par, Some(pub_span))?)
+56                }
+57                TokenKind::Struct => ModuleStmt::Struct(parse_struct_def(par, Some(pub_span))?),
+58                TokenKind::Enum => ModuleStmt::Enum(parse_enum_def(par, Some(pub_span))?),
+59                TokenKind::Trait => ModuleStmt::Trait(parse_trait_def(par, Some(pub_span))?),
+60                TokenKind::Type => ModuleStmt::TypeAlias(parse_type_alias(par, Some(pub_span))?),
+61                TokenKind::Const => ModuleStmt::Constant(parse_constant(par, Some(pub_span))?),
+62                TokenKind::Contract => {
+63                    ModuleStmt::Contract(parse_contract_def(par, Some(pub_span))?)
+64                }
+65                _ => {
+66                    let tok = par.next()?;
+67                    par.unexpected_token_error(
+68                        &tok,
+69                        "failed to parse module",
+70                        vec!["Note: expected `fn`".into()],
+71                    );
+72                    return Err(ParseFailed);
+73                }
+74            }
+75        }
+76        TokenKind::Fn | TokenKind::Unsafe => ModuleStmt::Function(parse_fn_def(par, None)?),
+77        TokenKind::Hash => {
+78            let attr = par.expect(TokenKind::Hash, "expected `#`")?;
+79            let attr_name = par.expect_with_notes(TokenKind::Name, "failed to parse attribute definition", |_|
+80                vec!["Note: an attribute name must start with a letter or underscore, and contain letters, numbers, or underscores".into()])?;
+81            ModuleStmt::Attribute(Node::new(attr_name.text.into(), attr.span + attr_name.span))
+82        }
+83        _ => {
+84            let tok = par.next()?;
+85            par.unexpected_token_error(
+86                &tok,
+87                "failed to parse module",
+88                vec!["Note: expected import, contract, struct, type or const".into()],
+89            );
+90            return Err(ParseFailed);
+91        }
+92    };
+93    Ok(stmt)
+94}
+95
+96/// Parse a constant, e.g. `const MAGIC_NUMBER: u256 = 4711`.
+97/// # Panics
+98/// Panics if the next token isn't `const`.
+99pub fn parse_constant(par: &mut Parser, pub_qual: Option<Span>) -> ParseResult<Node<ConstantDecl>> {
+100    let const_tok = par.assert(TokenKind::Const);
+101    let name = par.expect(TokenKind::Name, "failed to parse constant declaration")?;
+102    par.expect_with_notes(
+103        TokenKind::Colon,
+104        "failed to parse constant declaration",
+105        |_| {
+106            vec![
+107                "Note: constant name must be followed by a colon and a type description".into(),
+108                format!("Example: let `{}: u256 = 1000`", name.text),
+109            ]
+110        },
+111    )?;
+112    let typ = parse_type_desc(par)?;
+113    par.expect_with_notes(
+114        TokenKind::Eq,
+115        "failed to parse constant declaration",
+116        |_| {
+117            vec![
+118            "Note: the type of a constant must be followed by an equals sign and a value assignment"
+119                .into(),
+120                format!(
+121                    "Example: let `{}: u256 = 1000`",
+122                    name.text
+123                ),
+124        ]
+125        },
+126    )?;
+127
+128    let exp = parse_expr(par)?;
+129
+130    let span = const_tok.span + exp.span;
+131    Ok(Node::new(
+132        ConstantDecl {
+133            name: name.into(),
+134            typ,
+135            value: exp,
+136            pub_qual,
+137        },
+138        span,
+139    ))
+140}
+141
+142/// Parse a `use` statement.
+143/// # Panics
+144/// Panics if the next token isn't `use`.
+145pub fn parse_use(par: &mut Parser) -> ParseResult<Node<Use>> {
+146    let use_tok = par.assert(TokenKind::Use);
+147
+148    let tree = parse_use_tree(par)?;
+149    let tree_span = tree.span;
+150
+151    Ok(Node::new(Use { tree }, use_tok.span + tree_span))
+152}
+153
+154/// Parse a `use` tree.
+155pub fn parse_use_tree(par: &mut Parser) -> ParseResult<Node<UseTree>> {
+156    let (path, path_span, trailing_delim) = {
+157        let path_head =
+158            par.expect_with_notes(TokenKind::Name, "failed to parse `use` statement", |_| {
+159                vec![
+160                    "Note: `use` paths must start with a name".into(),
+161                    "Example: `use foo::bar`".into(),
+162                ]
+163            })?;
+164        parse_path_tail(par, path_head.into())
+165    };
+166
+167    if trailing_delim.is_some() {
+168        match par.peek() {
+169            Some(TokenKind::BraceOpen) => {
+170                par.next()?;
+171
+172                let mut children = vec![];
+173                let close_brace_span;
+174
+175                loop {
+176                    children.push(parse_use_tree(par)?);
+177                    let tok = par.next()?;
+178                    match tok.kind {
+179                        TokenKind::Comma => {
+180                            continue;
+181                        }
+182                        TokenKind::BraceClose => {
+183                            close_brace_span = tok.span;
+184                            break;
+185                        }
+186                        _ => {
+187                            par.unexpected_token_error(
+188                                &tok,
+189                                "failed to parse `use` tree",
+190                                vec!["Note: expected a `,` or `}` token".to_string()],
+191                            );
+192                            return Err(ParseFailed);
+193                        }
+194                    }
+195                }
+196
+197                Ok(Node::new(
+198                    UseTree::Nested {
+199                        prefix: path,
+200                        children,
+201                    },
+202                    close_brace_span,
+203                ))
+204            }
+205            Some(TokenKind::Star) => {
+206                par.next()?;
+207                Ok(Node::new(UseTree::Glob { prefix: path }, path_span))
+208            }
+209            _ => {
+210                let tok = par.next()?;
+211                par.unexpected_token_error(
+212                    &tok,
+213                    "failed to parse `use` tree",
+214                    vec!["Note: expected a `*`, `{` or name token".to_string()],
+215                );
+216                Err(ParseFailed)
+217            }
+218        }
+219    } else if par.peek() == Some(TokenKind::As) {
+220        par.next()?;
+221
+222        let rename_tok = par.expect(TokenKind::Name, "failed to parse `use` tree")?;
+223        let span = path_span + rename_tok.span;
+224        let rename = Some(rename_tok.into());
+225
+226        Ok(Node::new(UseTree::Simple { path, rename }, span))
+227    } else {
+228        Ok(Node::new(UseTree::Simple { path, rename: None }, path_span))
+229    }
+230}
+231
+232/// Parse a `pragma <version-requirement>` statement.
+233pub fn parse_pragma(par: &mut Parser) -> ParseResult<Node<Pragma>> {
+234    let tok = par.assert(TokenKind::Pragma);
+235    assert_eq!(tok.text, "pragma");
+236
+237    let mut version_string = String::new();
+238    let mut tokens = vec![];
+239    loop {
+240        match par.peek() {
+241            Some(TokenKind::Newline) => break,
+242            None => break,
+243            _ => {
+244                let tok = par.next()?;
+245                version_string.push_str(tok.text);
+246                tokens.push(tok);
+247            }
+248        }
+249    }
+250
+251    let version_requirement_span = match (tokens.first(), tokens.last()) {
+252        (Some(first), Some(last)) => first.span + last.span,
+253        _ => {
+254            par.error(
+255                tok.span,
+256                "failed to parse pragma statement: missing version requirement",
+257            );
+258            return Err(ParseFailed);
+259        }
+260    };
+261
+262    match VersionReq::parse(&version_string) {
+263        Ok(_) => Ok(Node::new(
+264            Pragma {
+265                version_requirement: Node::new(version_string.into(), version_requirement_span),
+266            },
+267            tok.span + version_requirement_span,
+268        )),
+269        Err(err) => {
+270            par.fancy_error(
+271                format!("failed to parse pragma statement: {err}"),
+272                vec![Label::primary(
+273                    version_requirement_span,
+274                    "Invalid version requirement",
+275                )],
+276                vec!["Example: `^0.5.0`".into()],
+277            );
+278            Err(ParseFailed)
+279        }
+280    }
+281}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/grammar/types.rs.html b/compiler-docs/src/fe_parser/grammar/types.rs.html new file mode 100644 index 0000000000..840c7a216e --- /dev/null +++ b/compiler-docs/src/fe_parser/grammar/types.rs.html @@ -0,0 +1,680 @@ +types.rs - source

fe_parser/grammar/
types.rs

1use crate::ast::{
+2    self, Enum, Field, GenericArg, Impl, Path, Trait, TypeAlias, TypeDesc, Variant, VariantKind,
+3};
+4use crate::grammar::expressions::parse_expr;
+5use crate::grammar::functions::{parse_fn_def, parse_fn_sig};
+6use crate::node::{Node, Span};
+7use crate::Token;
+8use crate::{ParseFailed, ParseResult, Parser, TokenKind};
+9use fe_common::diagnostics::Label;
+10use if_chain::if_chain;
+11use smol_str::SmolStr;
+12use vec1::Vec1;
+13
+14/// Parse a [`ModuleStmt::Struct`].
+15/// # Panics
+16/// Panics if the next token isn't `struct`.
+17pub fn parse_struct_def(
+18    par: &mut Parser,
+19    pub_qual: Option<Span>,
+20) -> ParseResult<Node<ast::Struct>> {
+21    let struct_tok = par.assert(TokenKind::Struct);
+22    let name = par.expect_with_notes(TokenKind::Name, "failed to parse struct definition", |_| {
+23        vec!["Note: a struct name must start with a letter or underscore, and contain letters, numbers, or underscores".into()]
+24    })?;
+25
+26    let mut span = struct_tok.span + name.span;
+27    let mut fields = vec![];
+28    let mut functions = vec![];
+29    par.enter_block(span, "struct body must start with `{`")?;
+30
+31    loop {
+32        par.eat_newlines();
+33
+34        let attributes = if let Some(attr) = par.optional(TokenKind::Hash) {
+35            let attr_name = par.expect_with_notes(TokenKind::Name, "failed to parse attribute definition", |_|
+36                vec!["Note: an attribute name must start with a letter or underscore, and contain letters, numbers, or underscores".into()])?;
+37            // This hints to a future where we would support multiple attributes per field. For now we don't need it.
+38            vec![Node::new(attr_name.text.into(), attr.span + attr_name.span)]
+39        } else {
+40            vec![]
+41        };
+42
+43        par.eat_newlines();
+44
+45        let pub_qual = par.optional(TokenKind::Pub).map(|tok| tok.span);
+46        match par.peek_or_err()? {
+47            TokenKind::Name => {
+48                let field = parse_field(par, attributes, pub_qual, None)?;
+49                if !functions.is_empty() {
+50                    par.error(
+51                        field.span,
+52                        "struct field definitions must come before any function definitions",
+53                    );
+54                }
+55                fields.push(field);
+56            }
+57            TokenKind::Fn | TokenKind::Unsafe => {
+58                functions.push(parse_fn_def(par, pub_qual)?);
+59            }
+60            TokenKind::BraceClose if pub_qual.is_none() => {
+61                span += par.next()?.span;
+62                break;
+63            }
+64            _ => {
+65                let tok = par.next()?;
+66                par.unexpected_token_error(&tok, "failed to parse struct definition", vec![]);
+67                return Err(ParseFailed);
+68            }
+69        }
+70    }
+71    Ok(Node::new(
+72        ast::Struct {
+73            name: name.into(),
+74            fields,
+75            functions,
+76            pub_qual,
+77        },
+78        span,
+79    ))
+80}
+81
+82#[allow(clippy::unnecessary_literal_unwrap)]
+83/// Parse a [`ModuleStmt::Enum`].
+84/// # Panics
+85/// Panics if the next token isn't [`TokenKind::Enum`].
+86pub fn parse_enum_def(par: &mut Parser, pub_qual: Option<Span>) -> ParseResult<Node<Enum>> {
+87    let enum_tok = par.assert(TokenKind::Enum);
+88    let name = par.expect_with_notes(
+89        TokenKind::Name,
+90        "failed to parse enum definition",
+91        |_| vec!["Note: `enum` must be followed by a name, which must start with a letter and contain only letters, numbers, or underscores".into()],
+92    )?;
+93
+94    let mut span = enum_tok.span + name.span;
+95    let mut variants = vec![];
+96    let mut functions = vec![];
+97
+98    par.enter_block(span, "enum definition")?;
+99    loop {
+100        par.eat_newlines();
+101        match par.peek_or_err()? {
+102            TokenKind::Name => {
+103                let variant = parse_variant(par)?;
+104                if !functions.is_empty() {
+105                    par.error(
+106                        variant.span,
+107                        "enum variant definitions must come before any function definitions",
+108                    );
+109                }
+110                variants.push(variant);
+111            }
+112
+113            TokenKind::Fn | TokenKind::Unsafe => {
+114                functions.push(parse_fn_def(par, None)?);
+115            }
+116
+117            TokenKind::Pub => {
+118                let pub_qual = Some(par.next().unwrap().span);
+119                match par.peek() {
+120                    Some(TokenKind::Fn | TokenKind::Unsafe) => {
+121                        functions.push(parse_fn_def(par, pub_qual)?);
+122                    }
+123
+124                    _ => {
+125                        par.error(
+126                            pub_qual.unwrap(),
+127                            "expected `fn` or `unsafe fn` after `pub`",
+128                        );
+129                    }
+130                }
+131            }
+132
+133            TokenKind::BraceClose => {
+134                span += par.next()?.span;
+135                break;
+136            }
+137
+138            _ => {
+139                let tok = par.next()?;
+140                par.unexpected_token_error(&tok, "failed to parse enum definition body", vec![]);
+141                return Err(ParseFailed);
+142            }
+143        };
+144    }
+145
+146    Ok(Node::new(
+147        ast::Enum {
+148            name: name.into(),
+149            variants,
+150            functions,
+151            pub_qual,
+152        },
+153        span,
+154    ))
+155}
+156
+157/// Parse a trait definition.
+158/// # Panics
+159/// Panics if the next token isn't `trait`.
+160pub fn parse_trait_def(par: &mut Parser, pub_qual: Option<Span>) -> ParseResult<Node<Trait>> {
+161    let trait_tok = par.assert(TokenKind::Trait);
+162
+163    // trait Event {}
+164    let trait_name = par.expect_with_notes(
+165        TokenKind::Name,
+166        "failed to parse trait definition",
+167        |_| vec!["Note: `trait` must be followed by a name, which must start with a letter and contain only letters, numbers, or underscores".into()],
+168    )?;
+169
+170    let header_span = trait_tok.span + trait_name.span;
+171    let mut functions = vec![];
+172    par.enter_block(header_span, "trait definition")?;
+173
+174    loop {
+175        match par.peek_or_err()? {
+176            TokenKind::Fn => {
+177                // TODO: Traits should also be allowed to have functions that do contain a body.
+178                functions.push(parse_fn_sig(par, None)?);
+179                par.expect_with_notes(
+180                    TokenKind::Semi,
+181                    "failed to parse trait definition",
+182                    |_| vec!["Note: trait functions must appear without body and followed by a semicolon.".into()],
+183                )?;
+184                par.eat_newlines();
+185            }
+186            TokenKind::BraceClose => {
+187                par.next()?;
+188                break;
+189            }
+190            _ => {
+191                let tok = par.next()?;
+192                par.unexpected_token_error(&tok, "failed to parse trait definition body", vec![]);
+193                return Err(ParseFailed);
+194            }
+195        };
+196    }
+197
+198    let span = header_span + pub_qual;
+199    Ok(Node::new(
+200        Trait {
+201            name: Node::new(trait_name.text.into(), trait_name.span),
+202            functions,
+203            pub_qual,
+204        },
+205        span,
+206    ))
+207}
+208
+209/// Parse an impl block.
+210/// # Panics
+211/// Panics if the next token isn't `impl`.
+212pub fn parse_impl_def(par: &mut Parser) -> ParseResult<Node<Impl>> {
+213    let impl_tok = par.assert(TokenKind::Impl);
+214
+215    // impl SomeTrait for SomeType {}
+216    let trait_name =
+217        par.expect_with_notes(TokenKind::Name, "failed to parse `impl` definition", |_| {
+218            vec!["Note: `impl` must be followed by the name of a trait".into()]
+219        })?;
+220
+221    let for_tok =
+222        par.expect_with_notes(TokenKind::For, "failed to parse `impl` definition", |_| {
+223            vec![format!(
+224                "Note: `impl {}` must be followed by the keyword `for`",
+225                trait_name.text
+226            )]
+227        })?;
+228
+229    let receiver = parse_type_desc(par)?;
+230    let mut functions = vec![];
+231
+232    let header_span = impl_tok.span + trait_name.span + for_tok.span + receiver.span;
+233
+234    par.enter_block(header_span, "impl definition")?;
+235
+236    loop {
+237        par.eat_newlines();
+238        match par.peek_or_err()? {
+239            TokenKind::Fn => {
+240                functions.push(parse_fn_def(par, None)?);
+241            }
+242            TokenKind::BraceClose => {
+243                par.next()?;
+244                break;
+245            }
+246            _ => {
+247                let tok = par.next()?;
+248                par.unexpected_token_error(&tok, "failed to parse `impl` definition body", vec![]);
+249                return Err(ParseFailed);
+250            }
+251        };
+252    }
+253
+254    Ok(Node::new(
+255        Impl {
+256            impl_trait: Node::new(trait_name.text.into(), trait_name.span),
+257            receiver,
+258            functions,
+259        },
+260        header_span,
+261    ))
+262}
+263
+264/// Parse a type alias definition, e.g. `type MyMap = Map<u8, address>`.
+265/// # Panics
+266/// Panics if the next token isn't `type`.
+267pub fn parse_type_alias(par: &mut Parser, pub_qual: Option<Span>) -> ParseResult<Node<TypeAlias>> {
+268    let type_tok = par.assert(TokenKind::Type);
+269    let name = par.expect(TokenKind::Name, "failed to parse type declaration")?;
+270    par.expect_with_notes(TokenKind::Eq, "failed to parse type declaration", |_| {
+271        vec![
+272            "Note: a type alias name must be followed by an equals sign and a type description"
+273                .into(),
+274            format!("Example: `type {} = Map<address, u64>`", name.text),
+275        ]
+276    })?;
+277    let typ = parse_type_desc(par)?;
+278    let span = type_tok.span + pub_qual + typ.span;
+279    Ok(Node::new(
+280        TypeAlias {
+281            name: name.into(),
+282            typ,
+283            pub_qual,
+284        },
+285        span,
+286    ))
+287}
+288
+289/// Parse a field for a struct or contract. The leading optional `pub` and
+290/// `const` qualifiers must be parsed by the caller, and passed in.
+291pub fn parse_field(
+292    par: &mut Parser,
+293    attributes: Vec<Node<SmolStr>>,
+294    pub_qual: Option<Span>,
+295    const_qual: Option<Span>,
+296) -> ParseResult<Node<Field>> {
+297    let name = par.expect(TokenKind::Name, "failed to parse field definition")?;
+298    par.expect_with_notes(
+299        TokenKind::Colon,
+300        "failed to parse field definition",
+301        |next| {
+302            let mut notes = vec![];
+303            if name.text == "def" && next.kind == TokenKind::Name {
+304                notes.push("Hint: use `fn` to define a function".into());
+305                notes.push(format!(
+306                    "Example: `{}fn {}( ...`",
+307                    if pub_qual.is_some() { "pub " } else { "" },
+308                    next.text
+309                ));
+310            }
+311            notes
+312                .push("Note: field name must be followed by a colon and a type description".into());
+313            notes.push(format!(
+314                "Example: {}{}{}: address",
+315                if pub_qual.is_some() { "pub " } else { "" },
+316                if const_qual.is_some() { "const " } else { "" },
+317                name.text
+318            ));
+319            notes
+320        },
+321    )?;
+322
+323    let typ = parse_type_desc(par)?;
+324    let value = if par.peek() == Some(TokenKind::Eq) {
+325        par.next()?;
+326        Some(parse_expr(par)?)
+327    } else {
+328        None
+329    };
+330    par.expect_stmt_end("field definition")?;
+331    let span = name.span + pub_qual + const_qual + &typ;
+332    Ok(Node::new(
+333        Field {
+334            is_pub: pub_qual.is_some(),
+335            is_const: const_qual.is_some(),
+336            attributes,
+337            name: name.into(),
+338            typ,
+339            value,
+340        },
+341        span,
+342    ))
+343}
+344
+345/// Parse a variant for a enum definition.
+346/// # Panics
+347/// Panics if the next token isn't [`TokenKind::Name`].
+348pub fn parse_variant(par: &mut Parser) -> ParseResult<Node<Variant>> {
+349    let name = par.expect(TokenKind::Name, "failed to parse enum variant")?;
+350    let mut span = name.span;
+351
+352    let kind = match par.peek_or_err()? {
+353        TokenKind::ParenOpen => {
+354            span += par.next().unwrap().span;
+355            let mut tys = vec![];
+356            loop {
+357                match par.peek_or_err()? {
+358                    TokenKind::ParenClose => {
+359                        span += par.next().unwrap().span;
+360                        break;
+361                    }
+362
+363                    _ => {
+364                        let ty = parse_type_desc(par)?;
+365                        span += ty.span;
+366                        tys.push(ty);
+367                        if par.peek_or_err()? == TokenKind::Comma {
+368                            par.next()?;
+369                        } else {
+370                            span += par
+371                                .expect(
+372                                    TokenKind::ParenClose,
+373                                    "unexpected token while parsing enum variant",
+374                                )?
+375                                .span;
+376                            break;
+377                        }
+378                    }
+379                }
+380            }
+381
+382            VariantKind::Tuple(tys)
+383        }
+384
+385        _ => VariantKind::Unit,
+386    };
+387
+388    par.expect_stmt_end("enum variant")?;
+389    Ok(Node::new(
+390        Variant {
+391            name: name.into(),
+392            kind,
+393        },
+394        span,
+395    ))
+396}
+397
+398/// Parse an optional qualifier (`pub`, `const`, or `idx`).
+399pub fn parse_opt_qualifier(par: &mut Parser, tk: TokenKind) -> Option<Span> {
+400    if par.peek() == Some(tk) {
+401        let tok = par.next().unwrap();
+402        Some(tok.span)
+403    } else {
+404        None
+405    }
+406}
+407
+408/// Parse an angle-bracket-wrapped list of generic arguments (eg. the tail end
+409/// of `Map<address, u256>`).
+410/// # Panics
+411/// Panics if the first token isn't `<`.
+412pub fn parse_generic_args(par: &mut Parser) -> ParseResult<Node<Vec<GenericArg>>> {
+413    use TokenKind::*;
+414    let mut span = par.assert(Lt).span;
+415
+416    let mut args = vec![];
+417
+418    let expect_end = |par: &mut Parser| {
+419        // If there's no comma, the next token must be `>`
+420        match par.peek_or_err()? {
+421            Gt => Ok(par.next()?.span),
+422            GtGt => Ok(par.split_next()?.span),
+423            _ => {
+424                let tok = par.next()?;
+425                par.unexpected_token_error(
+426                    &tok,
+427                    "Unexpected token while parsing generic arg list",
+428                    vec![],
+429                );
+430                Err(ParseFailed)
+431            }
+432        }
+433    };
+434
+435    loop {
+436        match par.peek_or_err()? {
+437            Gt => {
+438                span += par.next()?.span;
+439                break;
+440            }
+441            GtGt => {
+442                span += par.split_next()?.span;
+443                break;
+444            }
+445            // Parse non-constant generic argument.
+446            Name | ParenOpen => {
+447                let typ = parse_type_desc(par)?;
+448                args.push(GenericArg::TypeDesc(Node::new(typ.kind, typ.span)));
+449                if par.peek() == Some(Comma) {
+450                    par.next()?;
+451                } else {
+452                    span += expect_end(par)?;
+453                    break;
+454                }
+455            }
+456            // Parse literal-type constant generic argument.
+457            Int => {
+458                let tok = par.next()?;
+459                if let Ok(num) = tok.text.parse() {
+460                    args.push(GenericArg::Int(Node::new(num, tok.span)));
+461                    if par.peek() == Some(Comma) {
+462                        par.next()?;
+463                    } else {
+464                        span += expect_end(par)?;
+465                        break;
+466                    }
+467                } else {
+468                    par.error(tok.span, "failed to parse integer literal");
+469                    return Err(ParseFailed);
+470                }
+471            }
+472            // Parse expr-type constant generic argument.
+473            BraceOpen => {
+474                let brace_open = par.next()?;
+475                let expr = parse_expr(par)?;
+476                if !matches!(par.next()?.kind, BraceClose) {
+477                    par.error(brace_open.span, "missing closing delimiter `}`");
+478                    return Err(ParseFailed);
+479                }
+480
+481                args.push(GenericArg::ConstExpr(expr));
+482
+483                if par.peek() == Some(Comma) {
+484                    par.next()?;
+485                } else {
+486                    span += expect_end(par)?;
+487                    break;
+488                }
+489            }
+490
+491            // Invalid generic argument.
+492            _ => {
+493                let tok = par.next()?;
+494                par.unexpected_token_error(
+495                    &tok,
+496                    "failed to parse generic type argument list",
+497                    vec![],
+498                );
+499                return Err(ParseFailed);
+500            }
+501        }
+502    }
+503    Ok(Node::new(args, span))
+504}
+505
+506/// Returns path and trailing `::` token, if present.
+507pub fn parse_path_tail<'a>(
+508    par: &mut Parser<'a>,
+509    head: Node<SmolStr>,
+510) -> (Path, Span, Option<Token<'a>>) {
+511    let mut span = head.span;
+512    let mut segments = vec![head];
+513    while let Some(delim) = par.optional(TokenKind::ColonColon) {
+514        if let Some(name) = par.optional(TokenKind::Name) {
+515            span += name.span;
+516            segments.push(name.into());
+517        } else {
+518            return (Path { segments }, span, Some(delim));
+519        }
+520    }
+521    (Path { segments }, span, None)
+522}
+523
+524/// Parse a type description, e.g. `u8` or `Map<address, u256>`.
+525pub fn parse_type_desc(par: &mut Parser) -> ParseResult<Node<TypeDesc>> {
+526    use TokenKind::*;
+527    let mut typ = match par.peek_or_err()? {
+528        SelfType => {
+529            let _self = par.next()?;
+530            Node::new(TypeDesc::SelfType, _self.span)
+531        }
+532        Name => {
+533            let name = par.next()?;
+534            match par.peek() {
+535                Some(ColonColon) => {
+536                    let (path, span, trailing_delim) = parse_path_tail(par, name.into());
+537                    if let Some(colons) = trailing_delim {
+538                        let next = par.next()?;
+539                        par.fancy_error(
+540                            "failed to parse type description",
+541                            vec![
+542                                Label::secondary(colons.span, "path delimiter"),
+543                                Label::primary(next.span, "expected a name"),
+544                            ],
+545                            vec![],
+546                        );
+547                        return Err(ParseFailed);
+548                    }
+549                    Node::new(TypeDesc::Path(path), span)
+550                }
+551                Some(Lt) => {
+552                    let args = parse_generic_args(par)?;
+553                    let span = name.span + args.span;
+554                    Node::new(
+555                        TypeDesc::Generic {
+556                            base: name.into(),
+557                            args,
+558                        },
+559                        span,
+560                    )
+561                }
+562                _ => Node::new(
+563                    TypeDesc::Base {
+564                        base: name.text.into(),
+565                    },
+566                    name.span,
+567                ),
+568            }
+569        }
+570        ParenOpen => {
+571            let mut span = par.next()?.span;
+572            let mut items = vec![];
+573            loop {
+574                match par.peek_or_err()? {
+575                    ParenClose => {
+576                        span += par.next()?.span;
+577                        break;
+578                    }
+579
+580                    Name | ParenOpen => {
+581                        let item = parse_type_desc(par)?;
+582                        span += item.span;
+583                        items.push(item);
+584                        if par.peek_or_err()? == Comma {
+585                            par.next()?;
+586                        } else {
+587                            span += par
+588                                .expect(
+589                                    ParenClose,
+590                                    "Unexpected token while parsing tuple type description",
+591                                )?
+592                                .span;
+593                            break;
+594                        }
+595                    }
+596
+597                    _ => {
+598                        let tok = par.next()?;
+599                        par.unexpected_token_error(
+600                            &tok,
+601                            "failed to parse type description",
+602                            vec![],
+603                        );
+604                        return Err(ParseFailed);
+605                    }
+606                }
+607            }
+608            if items.is_empty() {
+609                Node::new(TypeDesc::Unit, span)
+610            } else {
+611                Node::new(
+612                    TypeDesc::Tuple {
+613                        items: Vec1::try_from_vec(items).expect("couldn't convert vec to vec1"),
+614                    },
+615                    span,
+616                )
+617            }
+618        }
+619        _ => {
+620            let tok = par.next()?;
+621            par.unexpected_token_error(&tok, "failed to parse type description", vec![]);
+622            return Err(ParseFailed);
+623        }
+624    };
+625
+626    while par.peek() == Some(BracketOpen) {
+627        let l_brack = par.next()?.span;
+628
+629        if_chain! {
+630            if let Some(size_token) = par.optional(TokenKind::Int);
+631            if let Ok(dimension) = size_token.text.parse::<usize>();
+632            if let Some(r_brack) = par.optional(TokenKind::BracketClose);
+633            then {
+634                let span = typ.span + l_brack + r_brack.span;
+635                par.fancy_error(
+636                    "Outdated array syntax",
+637                    vec![
+638                        Label::primary(
+639                            span,
+640                            ""
+641                        )
+642                    ],
+643                    vec![
+644                        format!("Hint: Use `Array<{}, {}>`", typ.kind, dimension)
+645                    ]
+646                );
+647                typ = Node::new(
+648                    TypeDesc::Generic {
+649                        base: Node::new("Array".into(), typ.span),
+650                        args: Node::new(vec![
+651                            GenericArg::TypeDesc(
+652                                Node::new(typ.kind, typ.span)
+653                            ),
+654                            GenericArg::Int(
+655                                Node::new(dimension, size_token.span)
+656                            )
+657                        ], span)
+658                    },
+659                    span,
+660                );
+661            } else {
+662                par.fancy_error(
+663                    "Unexpected token while parsing type description",
+664                    vec![
+665                        Label::primary(
+666                            l_brack,
+667                            "Unexpected token"
+668                        )
+669                    ],
+670                    vec![
+671                        format!("Hint: To define an array type use `Array<{}, 10>`", typ.kind)
+672                    ]
+673                );
+674                return Err(ParseFailed);
+675            }
+676        }
+677    }
+678
+679    Ok(typ)
+680}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/lexer.rs.html b/compiler-docs/src/fe_parser/lexer.rs.html new file mode 100644 index 0000000000..48b27adb7d --- /dev/null +++ b/compiler-docs/src/fe_parser/lexer.rs.html @@ -0,0 +1,102 @@ +lexer.rs - source

fe_parser/
lexer.rs

1mod token;
+2use crate::node::Span;
+3use fe_common::files::SourceFileId;
+4use logos::Logos;
+5pub use token::{Token, TokenKind};
+6
+7#[derive(Clone)]
+8pub struct Lexer<'a> {
+9    file_id: SourceFileId,
+10    inner: logos::Lexer<'a, TokenKind>,
+11}
+12
+13impl<'a> Lexer<'a> {
+14    /// Create a new lexer with the given source code string.
+15    pub fn new(file_id: SourceFileId, src: &'a str) -> Lexer {
+16        Lexer {
+17            file_id,
+18            inner: TokenKind::lexer(src),
+19        }
+20    }
+21
+22    /// Return the full source code string that's being tokenized.
+23    pub fn source(&self) -> &'a str {
+24        self.inner.source()
+25    }
+26}
+27
+28impl<'a> Iterator for Lexer<'a> {
+29    type Item = Token<'a>;
+30
+31    fn next(&mut self) -> Option<Self::Item> {
+32        let kind = self.inner.next()?;
+33        let text = self.inner.slice();
+34        let span = self.inner.span();
+35        Some(Token {
+36            kind,
+37            text,
+38            span: Span {
+39                file_id: self.file_id,
+40                start: span.start,
+41                end: span.end,
+42            },
+43        })
+44    }
+45}
+46
+47#[cfg(test)]
+48mod tests {
+49    use crate::lexer::{Lexer, TokenKind};
+50    use fe_common::files::SourceFileId;
+51    use TokenKind::*;
+52
+53    fn check(input: &str, expected: &[TokenKind]) {
+54        let lex = Lexer::new(SourceFileId::dummy_file(), input);
+55
+56        let actual = lex.map(|t| t.kind).collect::<Vec<_>>();
+57
+58        assert!(
+59            actual.iter().eq(expected.iter()),
+60            "\nexpected: {expected:?}\n  actual: {actual:?}"
+61        );
+62    }
+63
+64    #[test]
+65    fn basic() {
+66        check(
+67            "contract Foo:\n  x: u32\n  fn f() -> u32: not x",
+68            &[
+69                Contract, Name, Colon, Newline, Name, Colon, Name, Newline, Fn, Name, ParenOpen,
+70                ParenClose, Arrow, Name, Colon, Not, Name,
+71            ],
+72        );
+73    }
+74
+75    #[test]
+76    fn strings() {
+77        let rawstr = r#""string \t with \n escapes \" \"""#;
+78        let mut lex = Lexer::new(SourceFileId::dummy_file(), rawstr);
+79        let lexedstr = lex.next().unwrap();
+80        assert!(lexedstr.kind == Text);
+81        assert!(lexedstr.text == rawstr);
+82        assert!(lex.next().is_none());
+83    }
+84
+85    #[test]
+86    fn errors() {
+87        check(
+88            "contract Foo@ 5u8 \n  self.bar",
+89            &[
+90                Contract, Name, Error, Int, Name, Newline, SelfValue, Dot, Name,
+91            ],
+92        );
+93    }
+94
+95    #[test]
+96    fn tabs_and_comment() {
+97        check(
+98            "\n\t \tcontract\n\tFoo // hi mom!\n ",
+99            &[Newline, Contract, Newline, Name, Newline],
+100        );
+101    }
+102}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/lexer/token.rs.html b/compiler-docs/src/fe_parser/lexer/token.rs.html new file mode 100644 index 0000000000..ab74787082 --- /dev/null +++ b/compiler-docs/src/fe_parser/lexer/token.rs.html @@ -0,0 +1,316 @@ +token.rs - source

fe_parser/lexer/
token.rs

1use crate::node::Node;
+2use crate::node::Span;
+3use logos::Logos;
+4use smol_str::SmolStr;
+5use std::ops::Add;
+6
+7#[derive(Debug, PartialEq, Eq, Clone)]
+8pub struct Token<'a> {
+9    pub kind: TokenKind,
+10    pub text: &'a str,
+11    pub span: Span,
+12}
+13
+14impl<'a> From<Token<'a>> for Node<SmolStr> {
+15    fn from(tok: Token<'a>) -> Node<SmolStr> {
+16        Node::new(tok.text.into(), tok.span)
+17    }
+18}
+19
+20impl<'a> Add<&Token<'a>> for Span {
+21    type Output = Self;
+22
+23    fn add(self, other: &Token<'a>) -> Self {
+24        self + other.span
+25    }
+26}
+27
+28#[derive(Debug, Copy, Clone, PartialEq, Eq, Logos)]
+29pub enum TokenKind {
+30    // Ignoring comments and spaces/tabs for now.
+31    // If we implement an auto-formatting tool, we'll probably want to change this.
+32    #[regex(r"//[^\n]*", logos::skip)]
+33    #[regex("[ \t]+", logos::skip)]
+34    #[error]
+35    Error,
+36
+37    #[regex(r"\n[ \t]*")]
+38    Newline,
+39
+40    #[regex("[a-zA-Z_][a-zA-Z0-9_]*")]
+41    Name,
+42    #[regex("[0-9]+(?:_[0-9]+)*")]
+43    Int,
+44    #[regex("0[xX][0-9a-fA-F]+")]
+45    Hex,
+46    #[regex("0[oO][0-7]+")]
+47    Octal,
+48    #[regex("0[bB][0-1]+")]
+49    Binary,
+50    // Float,
+51    #[regex(r#""([^"\\]|\\.)*""#)]
+52    #[regex(r#"'([^'\\]|\\.)*'"#)]
+53    Text,
+54    #[token("true")]
+55    True,
+56    #[token("false")]
+57    False,
+58    // #[token("None")] // ?
+59    // None,
+60    #[token("assert")]
+61    Assert,
+62    #[token("break")]
+63    Break,
+64    #[token("continue")]
+65    Continue,
+66    #[token("contract")]
+67    Contract,
+68    #[token("fn")]
+69    Fn,
+70    #[token("const")]
+71    Const,
+72    #[token("else")]
+73    Else,
+74    #[token("idx")]
+75    Idx,
+76    #[token("if")]
+77    If,
+78    #[token("match")]
+79    Match,
+80    #[token("impl")]
+81    Impl,
+82    #[token("pragma")]
+83    Pragma,
+84    #[token("for")]
+85    For,
+86    #[token("pub")]
+87    Pub,
+88    #[token("return")]
+89    Return,
+90    #[token("revert")]
+91    Revert,
+92    #[token("Self")]
+93    SelfType,
+94    #[token("self")]
+95    SelfValue,
+96    #[token("struct")]
+97    Struct,
+98    #[token("enum")]
+99    Enum,
+100    #[token("trait")]
+101    Trait,
+102    #[token("type")]
+103    Type,
+104    #[token("unsafe")]
+105    Unsafe,
+106    #[token("while")]
+107    While,
+108
+109    #[token("and")]
+110    And,
+111    #[token("as")]
+112    As,
+113    #[token("in")]
+114    In,
+115    #[token("not")]
+116    Not,
+117    #[token("or")]
+118    Or,
+119    #[token("let")]
+120    Let,
+121    #[token("mut")]
+122    Mut,
+123    #[token("use")]
+124    Use,
+125    // Symbols
+126    #[token("(")]
+127    ParenOpen,
+128    #[token(")")]
+129    ParenClose,
+130    #[token("[")]
+131    BracketOpen,
+132    #[token("]")]
+133    BracketClose,
+134    #[token("{")]
+135    BraceOpen,
+136    #[token("}")]
+137    BraceClose,
+138    #[token(":")]
+139    Colon,
+140    #[token("::")]
+141    ColonColon,
+142    #[token(",")]
+143    Comma,
+144    #[token("#")]
+145    Hash,
+146    #[token(";")]
+147    Semi,
+148    #[token("+")]
+149    Plus,
+150    #[token("-")]
+151    Minus,
+152    #[token("*")]
+153    Star,
+154    #[token("/")]
+155    Slash,
+156    #[token("|")]
+157    Pipe,
+158    #[token("&")]
+159    Amper,
+160    #[token("<")]
+161    Lt,
+162    #[token("<<")]
+163    LtLt,
+164    #[token(">")]
+165    Gt,
+166    #[token(">>")]
+167    GtGt,
+168    #[token("=")]
+169    Eq,
+170    #[token(".")]
+171    Dot,
+172    #[token("..")]
+173    DotDot,
+174    #[token("%")]
+175    Percent,
+176    #[token("==")]
+177    EqEq,
+178    #[token("!=")]
+179    NotEq,
+180    #[token("<=")]
+181    LtEq,
+182    #[token(">=")]
+183    GtEq,
+184    #[token("~")]
+185    Tilde,
+186    #[token("^")]
+187    Hat,
+188    #[token("**")]
+189    StarStar,
+190    #[token("**=")]
+191    StarStarEq,
+192    #[token("+=")]
+193    PlusEq,
+194    #[token("-=")]
+195    MinusEq,
+196    #[token("*=")]
+197    StarEq,
+198    #[token("/=")]
+199    SlashEq,
+200    #[token("%=")]
+201    PercentEq,
+202    #[token("&=")]
+203    AmperEq,
+204    #[token("|=")]
+205    PipeEq,
+206    #[token("^=")]
+207    HatEq,
+208    #[token("<<=")]
+209    LtLtEq,
+210    #[token(">>=")]
+211    GtGtEq,
+212    #[token("->")]
+213    Arrow,
+214    #[token("=>")]
+215    FatArrow,
+216}
+217
+218impl TokenKind {
+219    /// Return a user-friendly description of the token kind. E.g.
+220    /// TokenKind::Newline => "a newline"
+221    /// TokenKind::Colon => "`:`"
+222    pub fn describe(&self) -> &str {
+223        use TokenKind::*;
+224        match self {
+225            Newline => "a newline",
+226            Name => "a name",
+227            Int => "a number",
+228            Hex => "a hexadecimal number",
+229            Octal => "an octal number",
+230            Binary => "a binary number",
+231            Text => "a string",
+232
+233            True => "keyword `true`",
+234            False => "keyword `false`",
+235            Assert => "keyword `assert`",
+236            Break => "keyword `break`",
+237            Continue => "keyword `continue`",
+238            Contract => "keyword `contract`",
+239            Fn => "keyword `fn`",
+240            Const => "keyword `const`",
+241            Let => "keyword `let`",
+242            Mut => "keyword `mut`",
+243            Else => "keyword `else`",
+244            Idx => "keyword `idx`",
+245            If => "keyword `if`",
+246            Match => "keyword `match`",
+247            Impl => "keyword `impl`",
+248            Pragma => "keyword `pragma`",
+249            For => "keyword `for`",
+250            Pub => "keyword `pub`",
+251            Return => "keyword `return`",
+252            Revert => "keyword `revert`",
+253            SelfType => "keyword `Self`",
+254            SelfValue => "keyword `self`",
+255            Struct => "keyword `struct`",
+256            Enum => "keyword `enum`",
+257            Trait => "keyword `trait`",
+258            Type => "keyword `type`",
+259            Unsafe => "keyword `unsafe`",
+260            While => "keyword `while`",
+261            And => "keyword `and`",
+262            As => "keyword `as`",
+263            In => "keyword `in`",
+264            Not => "keyword `not`",
+265            Or => "keyword `or`",
+266            Use => "keyword `use`",
+267            ParenOpen => "symbol `(`",
+268            ParenClose => "symbol `)`",
+269            BracketOpen => "symbol `[`",
+270            BracketClose => "symbol `]`",
+271            BraceOpen => "symbol `{`",
+272            BraceClose => "symbol `}`",
+273            Colon => "symbol `:`",
+274            ColonColon => "symbol `::`",
+275            Comma => "symbol `,`",
+276            Hash => "symbol `#`",
+277            Semi => "symbol `;`",
+278            Plus => "symbol `+`",
+279            Minus => "symbol `-`",
+280            Star => "symbol `*`",
+281            Slash => "symbol `/`",
+282            Pipe => "symbol `|`",
+283            Amper => "symbol `&`",
+284            Lt => "symbol `<`",
+285            LtLt => "symbol `<<`",
+286            Gt => "symbol `>`",
+287            GtGt => "symbol `>>`",
+288            Eq => "symbol `=`",
+289            Dot => "symbol `.`",
+290            DotDot => "symbol `..`",
+291            Percent => "symbol `%`",
+292            EqEq => "symbol `==`",
+293            NotEq => "symbol `!=`",
+294            LtEq => "symbol `<=`",
+295            GtEq => "symbol `>=`",
+296            Tilde => "symbol `~`",
+297            Hat => "symbol `^`",
+298            StarStar => "symbol `**`",
+299            StarStarEq => "symbol `**=`",
+300            PlusEq => "symbol `+=`",
+301            MinusEq => "symbol `-=`",
+302            StarEq => "symbol `*=`",
+303            SlashEq => "symbol `/=`",
+304            PercentEq => "symbol `%=`",
+305            AmperEq => "symbol `&=`",
+306            PipeEq => "symbol `|=`",
+307            HatEq => "symbol `^=`",
+308            LtLtEq => "symbol `<<=`",
+309            GtGtEq => "symbol `>>=`",
+310            Arrow => "symbol `->`",
+311            FatArrow => "symbol `=>`",
+312
+313            Error => unreachable!(), // TODO this is reachable
+314        }
+315    }
+316}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/lib.rs.html b/compiler-docs/src/fe_parser/lib.rs.html new file mode 100644 index 0000000000..16cc3ac5c0 --- /dev/null +++ b/compiler-docs/src/fe_parser/lib.rs.html @@ -0,0 +1,30 @@ +lib.rs - source

fe_parser/
lib.rs

1pub mod ast;
+2pub mod grammar;
+3pub mod lexer;
+4pub use lexer::{Token, TokenKind};
+5mod parser;
+6pub use parser::{Label, ParseFailed, ParseResult, Parser};
+7pub mod node;
+8
+9use ast::Module;
+10use fe_common::diagnostics::Diagnostic;
+11use fe_common::files::SourceFileId;
+12
+13/// Parse a [`Module`] from the file content string.
+14///
+15/// Returns a `Module` (which may be incomplete), and a vec of [`Diagnostic`]s
+16/// (which may be empty) to display to the user. If any of the returned
+17/// diagnostics are errors, the compilation of this file should ultimately fail.
+18///
+19/// If a fatal parse error occurred, the last element of the `Module::body` will
+20/// be a `ModuleStmt::ParseError`. The parser currently has very limited ability
+21/// to recover from syntax errors; this is just a first meager attempt at returning a
+22/// useful AST when there are syntax errors.
+23///
+24/// A [`SourceFileId`] is required to associate any diagnostics with the
+25/// underlying file.
+26pub fn parse_file(file_id: SourceFileId, src: &str) -> (Module, Vec<Diagnostic>) {
+27    let mut parser = Parser::new(file_id, src);
+28    let node = crate::grammar::module::parse_module(&mut parser);
+29    (node.kind, parser.diagnostics)
+30}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/node.rs.html b/compiler-docs/src/fe_parser/node.rs.html new file mode 100644 index 0000000000..678c3c3a80 --- /dev/null +++ b/compiler-docs/src/fe_parser/node.rs.html @@ -0,0 +1,66 @@ +node.rs - source

fe_parser/
node.rs

1pub use fe_common::{Span, Spanned};
+2use serde::{Deserialize, Serialize};
+3use std::sync::atomic::{AtomicU32, Ordering};
+4
+5#[derive(Debug, PartialEq, Copy, Clone, Hash, Eq, Default, PartialOrd, Ord)]
+6pub struct NodeId(u32);
+7
+8impl NodeId {
+9    pub fn create() -> Self {
+10        static NEXT_ID: AtomicU32 = AtomicU32::new(0);
+11        Self(NEXT_ID.fetch_add(1, Ordering::Relaxed))
+12    }
+13
+14    pub fn dummy() -> Self {
+15        Self(u32::MAX)
+16    }
+17
+18    pub fn is_dummy(self) -> bool {
+19        self == Self::dummy()
+20    }
+21}
+22
+23#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone)]
+24pub struct Node<T> {
+25    pub kind: T,
+26    #[serde(skip_serializing, skip_deserializing)]
+27    pub id: NodeId,
+28    pub span: Span,
+29}
+30
+31impl<T> Node<T> {
+32    pub fn new(kind: T, span: Span) -> Self {
+33        let id = NodeId::create();
+34        Self { kind, id, span }
+35    }
+36}
+37
+38impl<T> Spanned for Node<T> {
+39    fn span(&self) -> Span {
+40        self.span
+41    }
+42}
+43
+44impl<T> From<&Node<T>> for Span {
+45    fn from(node: &Node<T>) -> Self {
+46        node.span
+47    }
+48}
+49
+50impl<T> From<&Box<Node<T>>> for Span {
+51    fn from(node: &Box<Node<T>>) -> Self {
+52        node.span
+53    }
+54}
+55
+56impl<T> From<&Node<T>> for NodeId {
+57    fn from(node: &Node<T>) -> Self {
+58        node.id
+59    }
+60}
+61
+62impl<T> From<&Box<Node<T>>> for NodeId {
+63    fn from(node: &Box<Node<T>>) -> Self {
+64        node.id
+65    }
+66}
\ No newline at end of file diff --git a/compiler-docs/src/fe_parser/parser.rs.html b/compiler-docs/src/fe_parser/parser.rs.html new file mode 100644 index 0000000000..75ad52b979 --- /dev/null +++ b/compiler-docs/src/fe_parser/parser.rs.html @@ -0,0 +1,429 @@ +parser.rs - source

fe_parser/
parser.rs

1pub use fe_common::diagnostics::Label;
+2use fe_common::diagnostics::{Diagnostic, Severity};
+3use fe_common::files::SourceFileId;
+4
+5use crate::lexer::{Lexer, Token, TokenKind};
+6use crate::node::Span;
+7use std::{error, fmt};
+8
+9#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)]
+10pub struct ParseFailed;
+11impl fmt::Display for ParseFailed {
+12    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
+13        write!(fmt, "ParseFailed")
+14    }
+15}
+16impl error::Error for ParseFailed {}
+17
+18pub type ParseResult<T> = Result<T, ParseFailed>;
+19
+20/// `Parser` maintains the parsing state, such as the token stream,
+21/// "enclosure" (paren, brace, ..) stack, diagnostics, etc.
+22/// Syntax parsing logic is in the [`crate::grammar`] module.
+23///
+24/// See [`BTParser`] if you need backtrackable parser.
+25pub struct Parser<'a> {
+26    pub file_id: SourceFileId,
+27    lexer: Lexer<'a>,
+28
+29    /// Tokens that have been "peeked", or split from a larger token.
+30    /// Eg. `>>` may be split into two `>` tokens when parsing the end of a
+31    /// generic type parameter list (eg. `Map<u256, Map<u256, address>>`).
+32    buffered: Vec<Token<'a>>,
+33
+34    enclosure_stack: Vec<Enclosure>,
+35
+36    /// The diagnostics (errors and warnings) emitted during parsing.
+37    pub diagnostics: Vec<Diagnostic>,
+38}
+39
+40impl<'a> Parser<'a> {
+41    /// Create a new parser for a source code string and associated file id.
+42    pub fn new(file_id: SourceFileId, content: &'a str) -> Self {
+43        Parser {
+44            file_id,
+45            lexer: Lexer::new(file_id, content),
+46            buffered: vec![],
+47            enclosure_stack: vec![],
+48            diagnostics: vec![],
+49        }
+50    }
+51
+52    /// Returns back tracking parser.
+53    pub fn as_bt_parser<'b>(&'b mut self) -> BTParser<'a, 'b> {
+54        BTParser::new(self)
+55    }
+56
+57    /// Return the next token, or an error if we've reached the end of the file.
+58    #[allow(clippy::should_implement_trait)] // next() is a nice short name for a common task
+59    pub fn next(&mut self) -> ParseResult<Token<'a>> {
+60        self.eat_newlines_if_in_nonblock_enclosure();
+61        if let Some(tok) = self.next_raw() {
+62            if is_enclosure_open(tok.kind) {
+63                self.enclosure_stack
+64                    .push(Enclosure::non_block(tok.kind, tok.span));
+65            } else if is_enclosure_close(tok.kind) {
+66                if let Some(open) = self.enclosure_stack.pop() {
+67                    if !enclosure_tokens_match(open.token_kind, tok.kind) {
+68                        // TODO: we should search the enclosure_stack
+69                        //  for the last matching enclosure open token.
+70                        //  If any enclosures are unclosed, we should emit an
+71                        //  error, and somehow close their respective ast nodes.
+72                        //  We could synthesize the correct close token, or emit
+73                        //  a special TokenKind::UnclosedEnclosure or whatever.
+74                        todo!()
+75                    }
+76                } else {
+77                    self.error(tok.span, format!("Unmatched `{}`", tok.text));
+78                }
+79            }
+80            Ok(tok)
+81        } else {
+82            self.error(
+83                Span::new(
+84                    self.file_id,
+85                    self.lexer.source().len(),
+86                    self.lexer.source().len(),
+87                ),
+88                "unexpected end of file",
+89            );
+90            Err(ParseFailed)
+91        }
+92    }
+93
+94    fn next_raw(&mut self) -> Option<Token<'a>> {
+95        self.buffered.pop().or_else(|| self.lexer.next())
+96    }
+97
+98    /// Take a peek at the next token kind without consuming it, or return an
+99    /// error if we've reached the end of the file.
+100    pub fn peek_or_err(&mut self) -> ParseResult<TokenKind> {
+101        self.eat_newlines_if_in_nonblock_enclosure();
+102        if let Some(tk) = self.peek_raw() {
+103            Ok(tk)
+104        } else {
+105            let index = self.lexer.source().len();
+106            self.error(
+107                Span::new(self.file_id, index, index),
+108                "unexpected end of file",
+109            );
+110            Err(ParseFailed)
+111        }
+112    }
+113
+114    /// Take a peek at the next token kind. Returns `None` if we've reached the
+115    /// end of the file.
+116    pub fn peek(&mut self) -> Option<TokenKind> {
+117        self.eat_newlines_if_in_nonblock_enclosure();
+118        self.peek_raw()
+119    }
+120
+121    fn peek_raw(&mut self) -> Option<TokenKind> {
+122        if self.buffered.is_empty() {
+123            if let Some(tok) = self.lexer.next() {
+124                self.buffered.push(tok);
+125            } else {
+126                return None;
+127            }
+128        }
+129        Some(self.buffered.last().unwrap().kind)
+130    }
+131
+132    fn eat_newlines_if_in_nonblock_enclosure(&mut self) {
+133        // TODO: allow newlines inside angle brackets?
+134        //   eg `fn f(x: map\n <\n u8\n, ...`
+135        if let Some(enc) = self.enclosure_stack.last() {
+136            if !enc.is_block {
+137                self.eat_newlines();
+138            }
+139        }
+140    }
+141
+142    /// Split the next token into two tokens, returning the first. Only supports
+143    /// splitting the `>>` token into two `>` tokens, specifically for
+144    /// parsing the closing angle bracket of a generic type argument list
+145    /// (`Map<x, Map<y, z>>`).
+146    ///
+147    /// # Panics
+148    /// Panics if the next token isn't `>>`
+149    pub fn split_next(&mut self) -> ParseResult<Token<'a>> {
+150        let gtgt = self.next()?;
+151        assert_eq!(gtgt.kind, TokenKind::GtGt);
+152
+153        let (gt1, gt2) = gtgt.text.split_at(1);
+154        self.buffered.push(Token {
+155            kind: TokenKind::Gt,
+156            text: gt2,
+157            span: Span::new(self.file_id, gtgt.span.start + 1, gtgt.span.end),
+158        });
+159
+160        Ok(Token {
+161            kind: TokenKind::Gt,
+162            text: gt1,
+163            span: Span::new(self.file_id, gtgt.span.start, gtgt.span.end - 1),
+164        })
+165    }
+166
+167    /// Returns `true` if the parser has reached the end of the file.
+168    pub fn done(&mut self) -> bool {
+169        self.peek_raw().is_none()
+170    }
+171
+172    pub fn eat_newlines(&mut self) {
+173        while self.peek_raw() == Some(TokenKind::Newline) {
+174            self.next_raw();
+175        }
+176    }
+177
+178    /// Assert that the next token kind it matches the expected token
+179    /// kind, and return it. This should be used in cases where the next token
+180    /// kind is expected to have been checked already.
+181    ///
+182    /// # Panics
+183    /// Panics if the next token kind isn't `tk`.
+184    pub fn assert(&mut self, tk: TokenKind) -> Token<'a> {
+185        let tok = self.next().unwrap();
+186        assert_eq!(tok.kind, tk, "internal parser error");
+187        tok
+188    }
+189
+190    /// If the next token matches the expected kind, return it. Otherwise emit
+191    /// an error diagnostic with the given message and return an error.
+192    pub fn expect<S: Into<String>>(
+193        &mut self,
+194        expected: TokenKind,
+195        message: S,
+196    ) -> ParseResult<Token<'a>> {
+197        self.expect_with_notes(expected, message, |_| Vec::new())
+198    }
+199
+200    /// Like [`Parser::expect`], but with additional notes to be appended to the
+201    /// bottom of the diagnostic message. The notes are provided by a
+202    /// function that returns a `Vec<String>`, to avoid allocations in the
+203    /// case where the token is as expected.
+204    pub fn expect_with_notes<Str, NotesFn>(
+205        &mut self,
+206        expected: TokenKind,
+207        message: Str,
+208        notes_fn: NotesFn,
+209    ) -> ParseResult<Token<'a>>
+210    where
+211        Str: Into<String>,
+212        NotesFn: FnOnce(&Token) -> Vec<String>,
+213    {
+214        let tok = self.next()?;
+215        if tok.kind == expected {
+216            Ok(tok)
+217        } else {
+218            self.fancy_error(
+219                message.into(),
+220                vec![Label::primary(
+221                    tok.span,
+222                    format!(
+223                        "expected {}, found {}",
+224                        expected.describe(),
+225                        tok.kind.describe()
+226                    ),
+227                )],
+228                notes_fn(&tok),
+229            );
+230            Err(ParseFailed)
+231        }
+232    }
+233
+234    /// If the next token matches the expected kind, return it. Otherwise return
+235    /// None.
+236    pub fn optional(&mut self, kind: TokenKind) -> Option<Token<'a>> {
+237        if self.peek() == Some(kind) {
+238            Some(self.next().unwrap())
+239        } else {
+240            None
+241        }
+242    }
+243
+244    /// Emit an "unexpected token" error diagnostic with the given message.
+245    pub fn unexpected_token_error<S: Into<String>>(
+246        &mut self,
+247        tok: &Token,
+248        message: S,
+249        notes: Vec<String>,
+250    ) {
+251        self.fancy_error(
+252            message,
+253            vec![Label::primary(tok.span, "unexpected token")],
+254            notes,
+255        );
+256    }
+257
+258    /// Enter a "block", which is a brace-enclosed list of statements,
+259    /// separated by newlines and/or semicolons.
+260    /// This checks for and consumes the `{` that precedes the block.
+261    pub fn enter_block(&mut self, context_span: Span, context_name: &str) -> ParseResult<()> {
+262        if self.peek_raw() == Some(TokenKind::BraceOpen) {
+263            let tok = self.next_raw().unwrap();
+264            self.enclosure_stack.push(Enclosure::block(tok.span));
+265            self.eat_newlines();
+266            Ok(())
+267        } else {
+268            self.fancy_error(
+269                format!("{context_name} must start with `{{`"),
+270                vec![Label::primary(
+271                    Span::new(self.file_id, context_span.end, context_span.end),
+272                    "expected `{` here",
+273                )],
+274                vec![],
+275            );
+276            Err(ParseFailed)
+277        }
+278    }
+279
+280    /// Consumes newlines and semicolons. Returns Ok if one or more newlines or
+281    /// semicolons are consumed, or if the next token is a `}`.
+282    pub fn expect_stmt_end(&mut self, context_name: &str) -> ParseResult<()> {
+283        let mut newline = false;
+284        while matches!(self.peek_raw(), Some(TokenKind::Newline | TokenKind::Semi)) {
+285            newline = true;
+286            self.next_raw().unwrap();
+287        }
+288        if newline {
+289            return Ok(());
+290        }
+291        match self.peek_raw() {
+292            Some(TokenKind::BraceClose) => Ok(()),
+293            Some(_) => {
+294                let tok = self.next()?;
+295                self.unexpected_token_error(
+296                    &tok,
+297                    format!("unexpected token while parsing {context_name}"),
+298                    vec![format!(
+299                        "expected a newline; found {} instead",
+300                        tok.kind.describe()
+301                    )],
+302                );
+303                Err(ParseFailed)
+304            }
+305            None => Ok(()), // unexpect eof error will be generated be parent block
+306        }
+307    }
+308
+309    /// Emit an error diagnostic, but don't stop parsing
+310    pub fn error<S: Into<String>>(&mut self, span: Span, message: S) {
+311        self.diagnostics.push(Diagnostic {
+312            severity: Severity::Error,
+313            message: message.into(),
+314            labels: vec![Label::primary(span, "")],
+315            notes: vec![],
+316        })
+317    }
+318
+319    /// Emit a "fancy" error diagnostic with any number of labels and notes,
+320    /// but don't stop parsing.
+321    pub fn fancy_error<S: Into<String>>(
+322        &mut self,
+323        message: S,
+324        labels: Vec<Label>,
+325        notes: Vec<String>,
+326    ) {
+327        self.diagnostics.push(Diagnostic {
+328            severity: Severity::Error,
+329            message: message.into(),
+330            labels,
+331            notes,
+332        })
+333    }
+334}
+335
+336/// A thin wrapper that makes [`Parser`] backtrackable.
+337pub struct BTParser<'a, 'b> {
+338    snapshot: &'b mut Parser<'a>,
+339    parser: Parser<'a>,
+340}
+341
+342impl<'a, 'b> BTParser<'a, 'b> {
+343    pub fn new(snapshot: &'b mut Parser<'a>) -> Self {
+344        let parser = Parser {
+345            file_id: snapshot.file_id,
+346            lexer: snapshot.lexer.clone(),
+347            buffered: snapshot.buffered.clone(),
+348            enclosure_stack: snapshot.enclosure_stack.clone(),
+349            diagnostics: Vec::new(),
+350        };
+351        Self { snapshot, parser }
+352    }
+353
+354    pub fn accept(self) {
+355        self.snapshot.lexer = self.parser.lexer;
+356        self.snapshot.buffered = self.parser.buffered;
+357        self.snapshot.enclosure_stack = self.parser.enclosure_stack;
+358        self.snapshot.diagnostics.extend(self.parser.diagnostics);
+359    }
+360}
+361
+362impl<'a, 'b> std::ops::Deref for BTParser<'a, 'b> {
+363    type Target = Parser<'a>;
+364
+365    fn deref(&self) -> &Self::Target {
+366        &self.parser
+367    }
+368}
+369
+370impl<'a, 'b> std::ops::DerefMut for BTParser<'a, 'b> {
+371    fn deref_mut(&mut self) -> &mut Self::Target {
+372        &mut self.parser
+373    }
+374}
+375
+376/// The start position of a chunk of code enclosed by (), [], or {}.
+377/// (This has nothing to do with "closures".)
+378///
+379/// Note that <> isn't currently considered an enclosure, as `<` might be
+380/// a less-than operator, while the rest are unambiguous.
+381///
+382/// A `{}` enclosure may or may not be a block. A block contains a list of
+383/// statements, separated by newlines or semicolons (or both).
+384/// Semicolons and newlines are consumed by `par.expect_stmt_end()`.
+385///
+386/// Non-block enclosures contains zero or more expressions, maybe separated by
+387/// commas. When the top-most enclosure is a non-block, newlines are ignored
+388/// (by `par.next()`), and semicolons are just normal tokens that'll be
+389/// rejected by the parsing fns in grammar/.
+390#[derive(Clone, Debug)]
+391struct Enclosure {
+392    token_kind: TokenKind,
+393    _token_span: Span, // TODO: mark mismatched tokens
+394    is_block: bool,
+395}
+396impl Enclosure {
+397    pub fn block(token_span: Span) -> Self {
+398        Self {
+399            token_kind: TokenKind::BraceOpen,
+400            _token_span: token_span,
+401            is_block: true,
+402        }
+403    }
+404    pub fn non_block(token_kind: TokenKind, token_span: Span) -> Self {
+405        Self {
+406            token_kind,
+407            _token_span: token_span,
+408            is_block: false,
+409        }
+410    }
+411}
+412
+413fn is_enclosure_open(tk: TokenKind) -> bool {
+414    use TokenKind::*;
+415    matches!(tk, ParenOpen | BraceOpen | BracketOpen)
+416}
+417
+418fn is_enclosure_close(tk: TokenKind) -> bool {
+419    use TokenKind::*;
+420    matches!(tk, ParenClose | BraceClose | BracketClose)
+421}
+422
+423fn enclosure_tokens_match(open: TokenKind, close: TokenKind) -> bool {
+424    use TokenKind::*;
+425    matches!(
+426        (open, close),
+427        (ParenOpen, ParenClose) | (BraceOpen, BraceClose) | (BracketOpen, BracketClose)
+428    )
+429}
\ No newline at end of file diff --git a/compiler-docs/src/fe_test_files/lib.rs.html b/compiler-docs/src/fe_test_files/lib.rs.html new file mode 100644 index 0000000000..d2c6721052 --- /dev/null +++ b/compiler-docs/src/fe_test_files/lib.rs.html @@ -0,0 +1,44 @@ +lib.rs - source

fe_test_files/
lib.rs

1use include_dir::{include_dir, Dir};
+2
+3const FIXTURES: Dir = include_dir!("$CARGO_MANIFEST_DIR/fixtures");
+4
+5const NEW_FIXTURES: Dir = include_dir!("$CARGO_MANIFEST_DIR/../tests/fixtures");
+6
+7pub fn fixture(path: &str) -> &'static str {
+8    FIXTURES
+9        .get_file(path)
+10        .unwrap_or_else(|| panic!("bad fixture file path {path}"))
+11        .contents_utf8()
+12        .expect("fixture file isn't utf8")
+13}
+14
+15pub fn fixture_bytes(path: &str) -> &'static [u8] {
+16    FIXTURES
+17        .get_file(path)
+18        .unwrap_or_else(|| panic!("bad fixture file path {path}"))
+19        .contents()
+20}
+21
+22pub fn fixture_dir(path: &str) -> &Dir<'static> {
+23    FIXTURES
+24        .get_dir(path)
+25        .unwrap_or_else(|| panic!("no fixture dir named \"{path}\""))
+26}
+27
+28/// Returns `(file_path, file_content)`
+29pub fn fixture_dir_files(path: &str) -> Vec<(&'static str, &'static str)> {
+30    let dir = FIXTURES
+31        .get_dir(path)
+32        .unwrap_or_else(|| panic!("no fixture dir named \"{path}\""));
+33
+34    fe_library::static_dir_files(dir)
+35}
+36
+37/// Returns `(file_path, file_content)`
+38pub fn new_fixture_dir_files(path: &str) -> Vec<(&'static str, &'static str)> {
+39    let dir = NEW_FIXTURES
+40        .get_dir(path)
+41        .unwrap_or_else(|| panic!("no fixture dir named \"{path}\""));
+42
+43    fe_library::static_dir_files(dir)
+44}
\ No newline at end of file diff --git a/compiler-docs/src/fe_test_runner/lib.rs.html b/compiler-docs/src/fe_test_runner/lib.rs.html new file mode 100644 index 0000000000..3aa56b96a9 --- /dev/null +++ b/compiler-docs/src/fe_test_runner/lib.rs.html @@ -0,0 +1,191 @@ +lib.rs - source

fe_test_runner/
lib.rs

1use colored::Colorize;
+2use ethabi::{Event, Hash, RawLog};
+3use indexmap::IndexMap;
+4use revm::primitives::{
+5    AccountInfo, Address, Bytecode, Bytes, Env, ExecutionResult, TransactTo, B256, U256,
+6};
+7use std::{fmt::Display, str::FromStr};
+8
+9pub use ethabi;
+10
+11#[derive(Debug)]
+12pub struct TestSink {
+13    success_count: usize,
+14    failure_details: Vec<String>,
+15    logs_details: Vec<String>,
+16    collect_logs: bool,
+17}
+18
+19impl TestSink {
+20    pub fn new(collect_logs: bool) -> Self {
+21        Self {
+22            success_count: 0,
+23            failure_details: vec![],
+24            logs_details: vec![],
+25            collect_logs,
+26        }
+27    }
+28
+29    pub fn test_count(&self) -> usize {
+30        self.failure_count() + self.success_count()
+31    }
+32
+33    pub fn failure_count(&self) -> usize {
+34        self.failure_details.len()
+35    }
+36
+37    pub fn logs_count(&self) -> usize {
+38        self.logs_details.len()
+39    }
+40
+41    pub fn success_count(&self) -> usize {
+42        self.success_count
+43    }
+44
+45    pub fn insert_failure(&mut self, name: &str, reason: &str) {
+46        self.failure_details
+47            .push(format!("{}\n{}", name, reason.red()))
+48    }
+49
+50    pub fn insert_logs(&mut self, name: &str, logs: &str) {
+51        if self.collect_logs {
+52            self.logs_details.push(format!(
+53                "{} produced the following logs:\n{}\n",
+54                name,
+55                logs.bright_yellow()
+56            ))
+57        }
+58    }
+59
+60    pub fn inc_success_count(&mut self) {
+61        self.success_count += 1
+62    }
+63
+64    pub fn failure_details(&self) -> String {
+65        self.failure_details.join("\n")
+66    }
+67
+68    pub fn logs_details(&self) -> String {
+69        self.logs_details.join("\n")
+70    }
+71}
+72
+73impl Display for TestSink {
+74    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+75        if self.logs_count() != 0 {
+76            writeln!(f, "{}", self.logs_details())?;
+77            writeln!(f)?;
+78        }
+79
+80        if self.failure_count() != 0 {
+81            writeln!(f, "{}", self.failure_details())?;
+82            writeln!(f)?;
+83            if self.collect_logs {
+84                writeln!(f, "note: failed tests do not produce logs")?;
+85                writeln!(f)?;
+86            }
+87        }
+88
+89        let test_description = |n: usize, status: &dyn Display| -> String {
+90            if n == 1 {
+91                format!("1 test {status}")
+92            } else {
+93                format!("{n} tests {status}")
+94            }
+95        };
+96
+97        write!(
+98            f,
+99            "{}; ",
+100            test_description(self.success_count(), &"passed".green())
+101        )?;
+102        write!(
+103            f,
+104            "{}; ",
+105            test_description(self.failure_count(), &"failed".red())
+106        )?;
+107        write!(f, "{}", test_description(self.test_count(), &"executed"))
+108    }
+109}
+110
+111pub fn execute(name: &str, events: &[Event], bytecode: &str, sink: &mut TestSink) -> bool {
+112    let events: IndexMap<_, _> = events
+113        .iter()
+114        .map(|event| (event.signature(), event))
+115        .collect();
+116    let bytecode = Bytecode::new_raw(Bytes::copy_from_slice(&hex::decode(bytecode).unwrap()));
+117
+118    let mut database = revm::InMemoryDB::default();
+119    let test_address = Address::from_str("0000000000000000000000000000000000000042").unwrap();
+120    let test_info = AccountInfo::new(U256::ZERO, 0, B256::default(), bytecode);
+121    database.insert_account_info(test_address, test_info);
+122
+123    let mut env = Env::default();
+124    env.tx.transact_to = TransactTo::Call(test_address);
+125
+126    let builder = revm::EvmBuilder::default()
+127        .with_db(database)
+128        .with_env(Box::new(env));
+129    let mut evm = builder.build();
+130    let result = evm.transact_commit().expect("evm failure");
+131
+132    if let ExecutionResult::Success { logs, .. } = result {
+133        let logs: Vec<_> = logs
+134            .iter()
+135            .map(|log| {
+136                if let Some(Some(event)) = log
+137                    .topics()
+138                    .first()
+139                    .map(|sig| events.get(&Hash::from_slice(sig.as_slice())))
+140                {
+141                    let topics = log
+142                        .topics()
+143                        .iter()
+144                        .map(|topic| Hash::from_slice(topic.as_slice()))
+145                        .collect();
+146                    let data = log.data.data.clone().to_vec();
+147                    let raw_log = RawLog { topics, data };
+148                    if let Ok(parsed_event) = event.parse_log(raw_log) {
+149                        format!(
+150                            "  {} emitted by {} with the following parameters [{}]",
+151                            event.name,
+152                            log.address,
+153                            parsed_event
+154                                .params
+155                                .iter()
+156                                .map(|param| format!("{}: {}", param.name, param.value))
+157                                .collect::<Vec<String>>()
+158                                .join(", "),
+159                        )
+160                    } else {
+161                        format!("  {:?}", log)
+162                    }
+163                } else {
+164                    format!("  {:?}", log)
+165                }
+166            })
+167            .collect();
+168
+169        if !logs.is_empty() {
+170            sink.insert_logs(name, &logs.join("\n"))
+171        }
+172
+173        sink.inc_success_count();
+174        true
+175    } else if let ExecutionResult::Revert { output, .. } = result {
+176        sink.insert_failure(
+177            name,
+178            &if output.is_empty() {
+179                "  reverted".to_string()
+180            } else {
+181                format!(
+182                    "  reverted with the following output: {}",
+183                    hex::encode(output)
+184                )
+185            },
+186        );
+187        false
+188    } else {
+189        panic!("test halted")
+190    }
+191}
\ No newline at end of file diff --git a/compiler-docs/src/fe_yulc/lib.rs.html b/compiler-docs/src/fe_yulc/lib.rs.html new file mode 100644 index 0000000000..8ddea57cf9 --- /dev/null +++ b/compiler-docs/src/fe_yulc/lib.rs.html @@ -0,0 +1,96 @@ +lib.rs - source

fe_yulc/
lib.rs

1use indexmap::map::IndexMap;
+2
+3#[derive(Debug)]
+4pub struct YulcError(pub String);
+5
+6pub struct ContractBytecode {
+7    pub bytecode: String,
+8    pub runtime_bytecode: String,
+9}
+10
+11/// Compile a map of Yul contracts to a map of bytecode contracts.
+12///
+13/// Returns a `contract_name -> hex_encoded_bytecode` map.
+14pub fn compile(
+15    contracts: impl Iterator<Item = (impl AsRef<str>, impl AsRef<str>)>,
+16    optimize: bool,
+17) -> Result<IndexMap<String, ContractBytecode>, YulcError> {
+18    contracts
+19        .map(|(name, yul_src)| {
+20            compile_single_contract(name.as_ref(), yul_src.as_ref(), optimize, true)
+21                .map(|bytecode| (name.as_ref().to_string(), bytecode))
+22        })
+23        .collect()
+24}
+25
+26#[cfg(feature = "solc-backend")]
+27/// Compiles a single Yul contract to bytecode.
+28pub fn compile_single_contract(
+29    name: &str,
+30    yul_src: &str,
+31    optimize: bool,
+32    verify_runtime_bytecode: bool,
+33) -> Result<ContractBytecode, YulcError> {
+34    let solc_temp = include_str!("solc_temp.json");
+35    let input = solc_temp
+36        .replace("{optimizer_enabled}", &optimize.to_string())
+37        .replace("{src}", yul_src);
+38    let raw_output = solc::compile(&input);
+39    let output: serde_json::Value = serde_json::from_str(&raw_output)
+40        .map_err(|_| YulcError("JSON serialization error".into()))?;
+41
+42    let bytecode = output["contracts"]["input.yul"][name]["evm"]["bytecode"]["object"]
+43        .to_string()
+44        .replace('"', "");
+45
+46    let runtime_bytecode = output["contracts"]["input.yul"][name]["evm"]["deployedBytecode"]
+47        ["object"]
+48        .to_string()
+49        .replace('"', "");
+50
+51    if bytecode == "null" {
+52        return Err(YulcError(output.to_string()));
+53    }
+54    if verify_runtime_bytecode && runtime_bytecode == "null" {
+55        return Err(YulcError(output.to_string()));
+56    }
+57
+58    Ok(ContractBytecode {
+59        bytecode,
+60        runtime_bytecode,
+61    })
+62}
+63
+64#[cfg(not(feature = "solc-backend"))]
+65/// Compiles a single Yul contract to bytecode.
+66pub fn compile_single_contract(
+67    _name: &str,
+68    _yul_src: &str,
+69    _optimize: bool,
+70    _verify_runtime_bytecode: bool,
+71) -> Result<ContractBytecode, YulcError> {
+72    // This is ugly, but required (as far as I can tell) to make
+73    // `cargo test --workspace` work without solc.
+74    panic!("fe-yulc requires 'solc-backend' feature")
+75}
+76
+77#[cfg(feature = "solc-backend")]
+78#[test]
+79fn test_solc_sanity() {
+80    let yul_src = "{ sstore(0,0) }";
+81    let solc_temp = include_str!("solc_temp.json");
+82    let input = solc_temp
+83        .replace("{optimizer_enabled}", "false")
+84        .replace("{src}", yul_src);
+85
+86    let raw_output = solc::compile(&input);
+87    let output: serde_json::Value = serde_json::from_str(&raw_output).unwrap();
+88
+89    let bytecode = output["contracts"]["input.yul"]["object"]["evm"]["bytecode"]["object"]
+90        .to_string()
+91        .replace('"', "");
+92
+93    // solc 0.8.4: push1 0; push1 0; sstore  "6000600055"
+94    // solc 0.8.7: push1 0; dup1;    sstore  "60008055"
+95    assert_eq!(bytecode, "60008055", "incorrect bytecode",);
+96}
\ No newline at end of file diff --git a/compiler-docs/static.files/COPYRIGHT-7fb11f4e.txt b/compiler-docs/static.files/COPYRIGHT-7fb11f4e.txt new file mode 100644 index 0000000000..752dab0a34 --- /dev/null +++ b/compiler-docs/static.files/COPYRIGHT-7fb11f4e.txt @@ -0,0 +1,71 @@ +# REUSE-IgnoreStart + +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2, SourceSerif4-Semibold.ttf.woff2): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +* Nanum Barun Gothic Font (NanumBarunGothic.woff2) + + Copyright 2010, NAVER Corporation (http://www.nhncorp.com) + with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, + NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, + Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, + Naver NanumMyeongjoEco, NanumMyeongjoEco, Naver NanumGothicLight, + NanumGothicLight, NanumBarunGothic, Naver NanumBarunGothic. + + https://hangeul.naver.com/2017/nanum + https://github.com/hiun/NanumBarunGothic + + Licensed under the SIL Open Font License, Version 1.1. + See NanumBarunGothic-LICENSE.txt. + +* Rust logos (rust-logo.svg, favicon.svg, favicon-32x32.png) + + Copyright 2025 Rust Foundation. + Licensed under the Creative Commons Attribution license (CC-BY). + https://rustfoundation.org/policy/rust-trademark-policy/ + +This copyright file is intended to be distributed with rustdoc output. + +# REUSE-IgnoreEnd diff --git a/compiler-docs/static.files/FiraMono-Medium-86f75c8c.woff2 b/compiler-docs/static.files/FiraMono-Medium-86f75c8c.woff2 new file mode 100644 index 0000000000..610e9b2071 Binary files /dev/null and b/compiler-docs/static.files/FiraMono-Medium-86f75c8c.woff2 differ diff --git a/compiler-docs/static.files/FiraMono-Regular-87c26294.woff2 b/compiler-docs/static.files/FiraMono-Regular-87c26294.woff2 new file mode 100644 index 0000000000..9fa44b7cc2 Binary files /dev/null and b/compiler-docs/static.files/FiraMono-Regular-87c26294.woff2 differ diff --git a/compiler-docs/static.files/FiraSans-Italic-81dc35de.woff2 b/compiler-docs/static.files/FiraSans-Italic-81dc35de.woff2 new file mode 100644 index 0000000000..3f63664fee Binary files /dev/null and b/compiler-docs/static.files/FiraSans-Italic-81dc35de.woff2 differ diff --git a/compiler-docs/static.files/FiraSans-LICENSE-05ab6dbd.txt b/compiler-docs/static.files/FiraSans-LICENSE-05ab6dbd.txt new file mode 100644 index 0000000000..d7e9c149b7 --- /dev/null +++ b/compiler-docs/static.files/FiraSans-LICENSE-05ab6dbd.txt @@ -0,0 +1,98 @@ +// REUSE-IgnoreStart + +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/compiler-docs/static.files/FiraSans-Medium-e1aa3f0a.woff2 b/compiler-docs/static.files/FiraSans-Medium-e1aa3f0a.woff2 new file mode 100644 index 0000000000..7a1e5fc548 Binary files /dev/null and b/compiler-docs/static.files/FiraSans-Medium-e1aa3f0a.woff2 differ diff --git a/compiler-docs/static.files/FiraSans-MediumItalic-ccf7e434.woff2 b/compiler-docs/static.files/FiraSans-MediumItalic-ccf7e434.woff2 new file mode 100644 index 0000000000..2d08f9f7d4 Binary files /dev/null and b/compiler-docs/static.files/FiraSans-MediumItalic-ccf7e434.woff2 differ diff --git a/compiler-docs/static.files/FiraSans-Regular-0fe48ade.woff2 b/compiler-docs/static.files/FiraSans-Regular-0fe48ade.woff2 new file mode 100644 index 0000000000..e766e06ccb Binary files /dev/null and b/compiler-docs/static.files/FiraSans-Regular-0fe48ade.woff2 differ diff --git a/compiler-docs/static.files/LICENSE-APACHE-a60eea81.txt b/compiler-docs/static.files/LICENSE-APACHE-a60eea81.txt new file mode 100644 index 0000000000..16fe87b06e --- /dev/null +++ b/compiler-docs/static.files/LICENSE-APACHE-a60eea81.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. diff --git a/compiler-docs/static.files/LICENSE-MIT-23f18e03.txt b/compiler-docs/static.files/LICENSE-MIT-23f18e03.txt new file mode 100644 index 0000000000..31aa79387f --- /dev/null +++ b/compiler-docs/static.files/LICENSE-MIT-23f18e03.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/compiler-docs/static.files/NanumBarunGothic-13b3dcba.ttf.woff2 b/compiler-docs/static.files/NanumBarunGothic-13b3dcba.ttf.woff2 new file mode 100644 index 0000000000..1866ad4bce Binary files /dev/null and b/compiler-docs/static.files/NanumBarunGothic-13b3dcba.ttf.woff2 differ diff --git a/compiler-docs/static.files/NanumBarunGothic-LICENSE-a37d393b.txt b/compiler-docs/static.files/NanumBarunGothic-LICENSE-a37d393b.txt new file mode 100644 index 0000000000..4b3edc29eb --- /dev/null +++ b/compiler-docs/static.files/NanumBarunGothic-LICENSE-a37d393b.txt @@ -0,0 +1,103 @@ +// REUSE-IgnoreStart + +Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), + +with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, +NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, +Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, +NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, +Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/compiler-docs/static.files/SourceCodePro-It-fc8b9304.ttf.woff2 b/compiler-docs/static.files/SourceCodePro-It-fc8b9304.ttf.woff2 new file mode 100644 index 0000000000..462c34efcd Binary files /dev/null and b/compiler-docs/static.files/SourceCodePro-It-fc8b9304.ttf.woff2 differ diff --git a/compiler-docs/static.files/SourceCodePro-LICENSE-67f54ca7.txt b/compiler-docs/static.files/SourceCodePro-LICENSE-67f54ca7.txt new file mode 100644 index 0000000000..0d2941e148 --- /dev/null +++ b/compiler-docs/static.files/SourceCodePro-LICENSE-67f54ca7.txt @@ -0,0 +1,97 @@ +// REUSE-IgnoreStart + +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/compiler-docs/static.files/SourceCodePro-Regular-8badfe75.ttf.woff2 b/compiler-docs/static.files/SourceCodePro-Regular-8badfe75.ttf.woff2 new file mode 100644 index 0000000000..10b558e0b6 Binary files /dev/null and b/compiler-docs/static.files/SourceCodePro-Regular-8badfe75.ttf.woff2 differ diff --git a/compiler-docs/static.files/SourceCodePro-Semibold-aa29a496.ttf.woff2 b/compiler-docs/static.files/SourceCodePro-Semibold-aa29a496.ttf.woff2 new file mode 100644 index 0000000000..5ec64eef0e Binary files /dev/null and b/compiler-docs/static.files/SourceCodePro-Semibold-aa29a496.ttf.woff2 differ diff --git a/compiler-docs/static.files/SourceSerif4-Bold-6d4fd4c0.ttf.woff2 b/compiler-docs/static.files/SourceSerif4-Bold-6d4fd4c0.ttf.woff2 new file mode 100644 index 0000000000..181a07f63b Binary files /dev/null and b/compiler-docs/static.files/SourceSerif4-Bold-6d4fd4c0.ttf.woff2 differ diff --git a/compiler-docs/static.files/SourceSerif4-It-ca3b17ed.ttf.woff2 b/compiler-docs/static.files/SourceSerif4-It-ca3b17ed.ttf.woff2 new file mode 100644 index 0000000000..2ae08a7bed Binary files /dev/null and b/compiler-docs/static.files/SourceSerif4-It-ca3b17ed.ttf.woff2 differ diff --git a/compiler-docs/static.files/SourceSerif4-LICENSE-a2cfd9d5.md b/compiler-docs/static.files/SourceSerif4-LICENSE-a2cfd9d5.md new file mode 100644 index 0000000000..175fa4f47a --- /dev/null +++ b/compiler-docs/static.files/SourceSerif4-LICENSE-a2cfd9d5.md @@ -0,0 +1,98 @@ + + +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. +Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + + diff --git a/compiler-docs/static.files/SourceSerif4-Regular-6b053e98.ttf.woff2 b/compiler-docs/static.files/SourceSerif4-Regular-6b053e98.ttf.woff2 new file mode 100644 index 0000000000..0263fc3042 Binary files /dev/null and b/compiler-docs/static.files/SourceSerif4-Regular-6b053e98.ttf.woff2 differ diff --git a/compiler-docs/static.files/SourceSerif4-Semibold-457a13ac.ttf.woff2 b/compiler-docs/static.files/SourceSerif4-Semibold-457a13ac.ttf.woff2 new file mode 100644 index 0000000000..dd55f4e95e Binary files /dev/null and b/compiler-docs/static.files/SourceSerif4-Semibold-457a13ac.ttf.woff2 differ diff --git a/compiler-docs/static.files/favicon-044be391.svg b/compiler-docs/static.files/favicon-044be391.svg new file mode 100644 index 0000000000..8b34b51198 --- /dev/null +++ b/compiler-docs/static.files/favicon-044be391.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/compiler-docs/static.files/favicon-32x32-6580c154.png b/compiler-docs/static.files/favicon-32x32-6580c154.png new file mode 100644 index 0000000000..69b8613ce1 Binary files /dev/null and b/compiler-docs/static.files/favicon-32x32-6580c154.png differ diff --git a/compiler-docs/static.files/main-eebb9057.js b/compiler-docs/static.files/main-eebb9057.js new file mode 100644 index 0000000000..750010f4cc --- /dev/null +++ b/compiler-docs/static.files/main-eebb9057.js @@ -0,0 +1,11 @@ +"use strict";window.RUSTDOC_TOOLTIP_HOVER_MS=300;window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS=450;function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension;}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden");const toggle=document.getElementById("toggle-all-docs");if(toggle){toggle.setAttribute("disabled","disabled");}}function showMain(){const main=document.getElementById(MAIN_ID);if(!main){return;}removeClass(main,"hidden");const mainHeading=main.querySelector(".main-heading");if(mainHeading&&window.searchState.rustdocToolbar){if(window.searchState.rustdocToolbar.parentElement){window.searchState.rustdocToolbar.parentElement.removeChild(window.searchState.rustdocToolbar,);}mainHeading.appendChild(window.searchState.rustdocToolbar);}const toggle=document.getElementById("toggle-all-docs");if(toggle){toggle.removeAttribute("disabled");}}window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate");function setMobileTopbar(){const mobileTopbar=document.querySelector(".mobile-topbar");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileTopbar){const mobileTitle=document.createElement("h2");mobileTitle.className="location";if(hasClass(document.querySelector(".rustdoc"),"crate")){mobileTitle.innerHTML=`Crate ${window.currentCrate}`;}else if(locationTitle){mobileTitle.innerHTML=locationTitle.innerHTML;}mobileTopbar.appendChild(mobileTitle);}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key;}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape";}return String.fromCharCode(c);}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID);}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID);}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0];}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling);}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID));}return el;}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden");}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden");}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild);}if(elemToDisplay===null){addClass(el,"hidden");showMain();return;}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden");const mainHeading=elemToDisplay.querySelector(".main-heading");if(mainHeading&&window.searchState.rustdocToolbar){if(window.searchState.rustdocToolbar.parentElement){window.searchState.rustdocToolbar.parentElement.removeChild(window.searchState.rustdocToolbar,);}mainHeading.appendChild(window.searchState.rustdocToolbar);}}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function";}function preLoadCss(cssUrl){const link=document.createElement("link");link.href=cssUrl;link.rel="preload";link.as="style";document.getElementsByTagName("head")[0].appendChild(link);}(function(){const isHelpPage=window.location.pathname.endsWith("/help.html");function loadScript(url,errorCallback){const script=document.createElement("script");script.src=url;if(errorCallback!==undefined){script.onerror=errorCallback;}document.head.append(script);}const settingsButton=getSettingsButton();if(settingsButton){settingsButton.onclick=event=>{if(event.ctrlKey||event.altKey||event.metaKey){return;}window.hideAllModals(false);addClass(getSettingsButton(),"rotate");event.preventDefault();loadScript(getVar("static-root-path")+getVar("settings-js"));setTimeout(()=>{const themes=getVar("themes").split(",");for(const theme of themes){if(theme!==""){preLoadCss(getVar("root-path")+theme+".css");}}},0);};}window.searchState={rustdocToolbar:document.querySelector("rustdoc-toolbar"),loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el);}return el;},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(window.searchState.timeout!==null){clearTimeout(window.searchState.timeout);window.searchState.timeout=null;}},isDisplayed:()=>{const outputElement=window.searchState.outputElement();return!!outputElement&&!!outputElement.parentElement&&outputElement.parentElement.id===ALTERNATIVE_DISPLAY_ID;},focus:()=>{window.searchState.input&&window.searchState.input.focus();},defocus:()=>{window.searchState.input&&window.searchState.input.blur();},showResults:search=>{if(search===null||typeof search==="undefined"){search=window.searchState.outputElement();}switchDisplayedElement(search);document.title=window.searchState.title;},removeQueryParameters:()=>{document.title=window.searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.hash);}},hideResults:()=>{switchDisplayedElement(null);window.searchState.removeQueryParameters();},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=").map(x=>x.replace(/\+/g," "));params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1]);});return params;},setup:()=>{const search_input=window.searchState.input;if(!search_input){return;}let searchLoaded=false;function sendSearchForm(){document.getElementsByClassName("search-form")[0].submit();}function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(getVar("static-root-path")+getVar("search-js"),sendSearchForm);loadScript(resourcePath("search-index",".js"),sendSearchForm);}}search_input.addEventListener("focus",()=>{window.searchState.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch();});if(search_input.value!==""){loadSearch();}const params=window.searchState.getQueryStringParams();if(params.search!==undefined){window.searchState.setLoadingSearch();loadSearch();}},setLoadingSearch:()=>{const search=window.searchState.outputElement();if(!search){return;}search.innerHTML="

"+window.searchState.loadingText+"

";window.searchState.showResults(search);},descShards:new Map(),loadDesc:async function({descShard,descIndex}){if(descShard.promise===null){descShard.promise=new Promise((resolve,reject)=>{descShard.resolve=resolve;const ds=descShard;const fname=`${ds.crate}-desc-${ds.shard}-`;const url=resourcePath(`search.desc/${descShard.crate}/${fname}`,".js",);loadScript(url,reject);});}const list=await descShard.promise;return list[descIndex];},loadedDescShard:function(crate,shard,data){this.descShards.get(crate)[shard].resolve(data.split("\n"));},};const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&window.searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash);}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView();}}const pageId=window.location.hash.replace(/^#/,"");if(savedHash!==pageId){savedHash=pageId;if(pageId!==""){expandSection(pageId);}}if(savedHash.startsWith("impl-")){const splitAt=savedHash.indexOf("/");if(splitAt!==-1){const implId=savedHash.slice(0,splitAt);const assocId=savedHash.slice(splitAt+1);const implElems=document.querySelectorAll(`details > summary > section[id^="${implId}"]`,);onEachLazy(implElems,implElem=>{const numbered=/^(.+?)-([0-9]+)$/.exec(implElem.id);if(implElem.id!==implId&&(!numbered||numbered[1]!==implId)){return false;}return onEachLazy(implElem.parentElement.parentElement.querySelectorAll(`[id^="${assocId}"]`),item=>{const numbered=/^(.+?)-([0-9]+)$/.exec(item.id);if(item.id===assocId||(numbered&&numbered[1]===assocId)){openParentDetails(item);item.scrollIntoView();setTimeout(()=>{window.location.replace("#"+item.id);},0);return true;}},);});}}}function onHashChange(ev){hideSidebar();handleHashes(ev);}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true;}elem=elem.parentElement;}}function expandSection(id){openParentDetails(document.getElementById(id));}function handleEscape(ev){window.searchState.clearInputTimeout();window.searchState.hideResults();ev.preventDefault();window.searchState.defocus();window.hideAllModals(true);}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return;}if(document.activeElement&&document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"&&document.activeElement.type!=="radio"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":case"/":ev.preventDefault();window.searchState.focus();break;case"+":ev.preventDefault();expandAllDocs();break;case"-":ev.preventDefault();collapseAllDocs(false);break;case"_":ev.preventDefault();collapseAllDocs(true);break;case"?":showHelp();break;default:break;}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return;}const sidebar=document.getElementById("rustdoc-modnav");function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return;}const modpath=hasClass(document.querySelector(".rustdoc"),"mod")?"../":"";const h3=document.createElement("h3");h3.innerHTML=`${longty}`;const ul=document.createElement("ul");ul.className="block "+shortty;for(const name of filtered){let path;if(shortty==="mod"){path=`${modpath}${name}/index.html`;}else{path=`${modpath}${shortty}.${name}.html`;}let current_page=document.location.href.toString();if(current_page.endsWith("/")){current_page+="index.html";}const link=document.createElement("a");link.href=path;link.textContent=name;const li=document.createElement("li");if(link.href===current_page){li.classList.add("current");}li.appendChild(link);ul.appendChild(li);}sidebar.appendChild(h3);sidebar.appendChild(ul);}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Aliases");block("union","unions","Unions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("attr","attributes","Attribute Macros");block("derive","derives","Derive Macros");block("traitalias","trait-aliases","Trait Aliases");}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();const TEXT_IDX=0;const SYNTHETIC_IDX=1;const TYPES_IDX=2;if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return;}aliases.split(",").forEach(alias=>{inlined_types.add(alias);});});}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector(".main-heading h1 > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const script=document.querySelector("script[data-ignore-extern-crates]");const ignoreExternCrates=new Set((script?script.getAttribute("data-ignore-extern-crates"):"").split(","),);for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.has(lib)){continue;}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct[SYNTHETIC_IDX]?synthetic_implementors:implementors;if(struct[SYNTHETIC_IDX]){for(const struct_type of struct[TYPES_IDX]){if(inlined_types.has(struct_type)){continue struct_loop;}inlined_types.add(struct_type);}}const code=document.createElement("h3");code.innerHTML=struct[TEXT_IDX];addClass(code,"code-header");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href);}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1;}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors);}window.register_type_impls=imp=>{if(!imp||!imp[window.currentCrate]){return;}window.pending_type_impls=undefined;const idMap=new Map();let implementations=document.getElementById("implementations-list");let trait_implementations=document.getElementById("trait-implementations-list");let trait_implementations_header=document.getElementById("trait-implementations");const script=document.querySelector("script[data-self-path]");const selfPath=script?script.getAttribute("data-self-path"):null;const mainContent=document.querySelector("#main-content");const sidebarSection=document.querySelector(".sidebar section");let methods=document.querySelector(".sidebar .block.method");let associatedTypes=document.querySelector(".sidebar .block.associatedtype");let associatedConstants=document.querySelector(".sidebar .block.associatedconstant");let sidebarTraitList=document.querySelector(".sidebar .block.trait-implementation");for(const impList of imp[window.currentCrate]){const types=impList.slice(2);const text=impList[0];const isTrait=impList[1]!==0;const traitName=impList[1];if(types.indexOf(selfPath)===-1){continue;}let outputList=isTrait?trait_implementations:implementations;if(outputList===null){const outputListName=isTrait?"Trait Implementations":"Implementations";const outputListId=isTrait?"trait-implementations-list":"implementations-list";const outputListHeaderId=isTrait?"trait-implementations":"implementations";const outputListHeader=document.createElement("h2");outputListHeader.id=outputListHeaderId;outputListHeader.innerText=outputListName;outputList=document.createElement("div");outputList.id=outputListId;if(isTrait){const link=document.createElement("a");link.href=`#${outputListHeaderId}`;link.innerText="Trait Implementations";const h=document.createElement("h3");h.appendChild(link);trait_implementations=outputList;trait_implementations_header=outputListHeader;sidebarSection.appendChild(h);sidebarTraitList=document.createElement("ul");sidebarTraitList.className="block trait-implementation";sidebarSection.appendChild(sidebarTraitList);mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList);}else{implementations=outputList;if(trait_implementations){mainContent.insertBefore(outputListHeader,trait_implementations_header);mainContent.insertBefore(outputList,trait_implementations_header);}else{const mainContent=document.querySelector("#main-content");mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList);}}}const template=document.createElement("template");template.innerHTML=text;onEachLazy(template.content.querySelectorAll("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href);}});onEachLazy(template.content.querySelectorAll("[id]"),el=>{let i=0;if(idMap.has(el.id)){i=idMap.get(el.id);}else if(document.getElementById(el.id)){i=1;while(document.getElementById(`${el.id}-${2 * i}`)){i=2*i;}while(document.getElementById(`${el.id}-${i}`)){i+=1;}}if(i!==0){const oldHref=`#${el.id}`;const newHref=`#${el.id}-${i}`;el.id=`${el.id}-${i}`;onEachLazy(template.content.querySelectorAll("a[href]"),link=>{if(link.getAttribute("href")===oldHref){link.href=newHref;}});}idMap.set(el.id,i+1);});const templateAssocItems=template.content.querySelectorAll("section.tymethod, "+"section.method, section.associatedtype, section.associatedconstant");if(isTrait){const li=document.createElement("li");const a=document.createElement("a");a.href=`#${template.content.querySelector(".impl").id}`;a.textContent=traitName;li.appendChild(a);sidebarTraitList.append(li);}else{onEachLazy(templateAssocItems,item=>{let block=hasClass(item,"associatedtype")?associatedTypes:(hasClass(item,"associatedconstant")?associatedConstants:(methods));if(!block){const blockTitle=hasClass(item,"associatedtype")?"Associated Types":(hasClass(item,"associatedconstant")?"Associated Constants":("Methods"));const blockClass=hasClass(item,"associatedtype")?"associatedtype":(hasClass(item,"associatedconstant")?"associatedconstant":("method"));const blockHeader=document.createElement("h3");const blockLink=document.createElement("a");blockLink.href="#implementations";blockLink.innerText=blockTitle;blockHeader.appendChild(blockLink);block=document.createElement("ul");block.className=`block ${blockClass}`;const insertionReference=methods||sidebarTraitList;if(insertionReference){const insertionReferenceH=insertionReference.previousElementSibling;sidebarSection.insertBefore(blockHeader,insertionReferenceH);sidebarSection.insertBefore(block,insertionReferenceH);}else{sidebarSection.appendChild(blockHeader);sidebarSection.appendChild(block);}if(hasClass(item,"associatedtype")){associatedTypes=block;}else if(hasClass(item,"associatedconstant")){associatedConstants=block;}else{methods=block;}}const li=document.createElement("li");const a=document.createElement("a");a.innerText=item.id.split("-")[0].split(".")[1];a.href=`#${item.id}`;li.appendChild(a);block.appendChild(li);});}outputList.appendChild(template.content);}for(const list of[methods,associatedTypes,associatedConstants,sidebarTraitList]){if(!list){continue;}const newChildren=Array.prototype.slice.call(list.children);newChildren.sort((a,b)=>{const aI=a.innerText;const bI=b.innerText;return aIbI?1:0;});list.replaceChildren(...newChildren);}};if(window.pending_type_impls){window.register_type_impls(window.pending_type_impls);}function addSidebarCrates(){if(!window.ALL_CRATES){return;}const sidebarElems=document.getElementById("rustdoc-modnav");if(!sidebarElems){return;}const h3=document.createElement("h3");h3.innerHTML="Crates";const ul=document.createElement("ul");ul.className="block crate";for(const crate of window.ALL_CRATES){const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";link.textContent=crate;const li=document.createElement("li");if(window.rootPath!=="./"&&crate===window.currentCrate){li.className="current";}li.appendChild(link);ul.appendChild(li);}sidebarElems.appendChild(h3);sidebarElems.appendChild(ul);}function expandAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hasClass(e,"type-contents-toggle")&&!hasClass(e,"more-examples-toggle")){e.open=true;}});innerToggle.children[0].innerText="Summary";}function collapseAllDocs(collapseImpls){const innerToggle=document.getElementById(toggleAllDocsId);addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if((collapseImpls||e.parentNode.id!=="implementations-list")||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false;}});innerToggle.children[0].innerText="Show all";}function toggleAllDocs(ev){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return;}if(hasClass(innerToggle,"will-expand")){expandAllDocs();}else{collapseAllDocs(ev!==undefined&&ev.shiftKey);}}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs;}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open;});}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false);}onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true;}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false;}});}());window.rustdoc_add_line_numbers_to_examples=()=>{function generateLine(nb){return`${nb}`;}onEachLazy(document.querySelectorAll(".rustdoc:not(.src) :not(.scraped-example) > .example-wrap > pre > code",),code=>{if(hasClass(code.parentElement.parentElement,"hide-lines")){removeClass(code.parentElement.parentElement,"hide-lines");return;}const lines=code.innerHTML.split("\n");const digits=(lines.length+"").length;code.innerHTML=lines.map((line,index)=>generateLine(index+1)+line).join("\n");addClass(code.parentElement.parentElement,`digits-${digits}`);});};window.rustdoc_remove_line_numbers_from_examples=()=>{onEachLazy(document.querySelectorAll(".rustdoc:not(.src) :not(.scraped-example) > .example-wrap"),x=>addClass(x,"hide-lines"),);};if(getSettingValue("line-numbers")==="true"){window.rustdoc_add_line_numbers_to_examples();}function showSidebar(){window.hideAllModals(false);const sidebar=document.getElementsByClassName("sidebar")[0];addClass(sidebar,"shown");}function hideSidebar(){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown");}window.addEventListener("resize",()=>{if(window.CURRENT_TOOLTIP_ELEMENT){const base=window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE;const force_visible=base.TOOLTIP_FORCE_VISIBLE;hideTooltip(false);if(force_visible){showTooltip(base);base.TOOLTIP_FORCE_VISIBLE=true;}}});const mainElem=document.getElementById(MAIN_ID);if(mainElem){mainElem.addEventListener("click",hideSidebar);}onEachLazy(document.querySelectorAll("a[href^='#']"),el=>{el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar();});});onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(!e.target.matches("summary, a, a *")){e.preventDefault();}});});function showTooltip(e){const notable_ty=e.getAttribute("data-notable-ty");if(!window.NOTABLE_TRAITS&¬able_ty){const data=document.getElementById("notable-traits-data");if(data){window.NOTABLE_TRAITS=JSON.parse(data.innerText);}else{throw new Error("showTooltip() called with notable without any notable traits!");}}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE===e){clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);return;}window.hideAllModals(false);const wrapper=document.createElement("div");if(notable_ty){wrapper.innerHTML="
"+window.NOTABLE_TRAITS[notable_ty]+"
";}else{const ttl=e.getAttribute("title");if(ttl!==null){e.setAttribute("data-title",ttl);e.removeAttribute("title");}const dttl=e.getAttribute("data-title");if(dttl!==null){const titleContent=document.createElement("div");titleContent.className="content";titleContent.appendChild(document.createTextNode(dttl));wrapper.appendChild(titleContent);}}wrapper.className="tooltip popover";const focusCatcher=document.createElement("div");focusCatcher.setAttribute("tabindex","0");focusCatcher.onfocus=hideTooltip;wrapper.appendChild(focusCatcher);const pos=e.getBoundingClientRect();wrapper.style.top=(pos.top+window.scrollY+pos.height)+"px";wrapper.style.left=0;wrapper.style.right="auto";wrapper.style.visibility="hidden";document.body.appendChild(wrapper);const wrapperPos=wrapper.getBoundingClientRect();const finalPos=pos.left+window.scrollX-wrapperPos.width+24;if(finalPos>0){wrapper.style.left=finalPos+"px";}else{wrapper.style.setProperty("--popover-arrow-offset",(wrapperPos.right-pos.right+4)+"px",);}wrapper.style.visibility="";window.CURRENT_TOOLTIP_ELEMENT=wrapper;window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE=e;clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);wrapper.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return;}clearTooltipHoverTimeout(e);};wrapper.onpointerleave=ev=>{if(ev.pointerType!=="mouse"||!(ev.relatedTarget instanceof HTMLElement)){return;}if(!e.TOOLTIP_FORCE_VISIBLE&&!e.contains(ev.relatedTarget)){setTooltipHoverTimeout(e,false);addClass(wrapper,"fade-out");}};}function setTooltipHoverTimeout(element,show){clearTooltipHoverTimeout(element);if(!show&&!window.CURRENT_TOOLTIP_ELEMENT){return;}if(show&&window.CURRENT_TOOLTIP_ELEMENT){return;}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE!==element){return;}element.TOOLTIP_HOVER_TIMEOUT=setTimeout(()=>{if(show){showTooltip(element);}else if(!element.TOOLTIP_FORCE_VISIBLE){hideTooltip(false);}},show?window.RUSTDOC_TOOLTIP_HOVER_MS:window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS);}function clearTooltipHoverTimeout(element){if(element.TOOLTIP_HOVER_TIMEOUT!==undefined){removeClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out");clearTimeout(element.TOOLTIP_HOVER_TIMEOUT);delete element.TOOLTIP_HOVER_TIMEOUT;}}function tooltipBlurHandler(event){if(window.CURRENT_TOOLTIP_ELEMENT&&!window.CURRENT_TOOLTIP_ELEMENT.contains(document.activeElement)&&!window.CURRENT_TOOLTIP_ELEMENT.contains(event.relatedTarget)&&!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(document.activeElement)&&!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(event.relatedTarget)){setTimeout(()=>hideTooltip(false),0);}}function hideTooltip(focus){if(window.CURRENT_TOOLTIP_ELEMENT){if(window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE){if(focus){window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.focus();}window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE=false;}document.body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);window.CURRENT_TOOLTIP_ELEMENT=null;}}onEachLazy(document.getElementsByClassName("tooltip"),e=>{e.onclick=()=>{e.TOOLTIP_FORCE_VISIBLE=e.TOOLTIP_FORCE_VISIBLE?false:true;if(window.CURRENT_TOOLTIP_ELEMENT&&!e.TOOLTIP_FORCE_VISIBLE){hideTooltip(true);}else{showTooltip(e);window.CURRENT_TOOLTIP_ELEMENT.setAttribute("tabindex","0");window.CURRENT_TOOLTIP_ELEMENT.focus();window.CURRENT_TOOLTIP_ELEMENT.onblur=tooltipBlurHandler;}return false;};e.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return;}setTooltipHoverTimeout(e,true);};e.onpointermove=ev=>{if(ev.pointerType!=="mouse"){return;}setTooltipHoverTimeout(e,true);};e.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return;}if(!e.TOOLTIP_FORCE_VISIBLE&&window.CURRENT_TOOLTIP_ELEMENT&&!window.CURRENT_TOOLTIP_ELEMENT.contains(ev.relatedTarget)){setTooltipHoverTimeout(e,false);addClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out");}};});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){showSidebar();}else{hideSidebar();}});}function helpBlurHandler(event){if(!getHelpButton().contains(document.activeElement)&&!getHelpButton().contains(event.relatedTarget)&&!getSettingsButton().contains(document.activeElement)&&!getSettingsButton().contains(event.relatedTarget)){window.hidePopoverMenus();}}function buildHelpMenu(){const book_info=document.createElement("span");const drloChannel=`https://doc.rust-lang.org/${getVar("channel")}`;book_info.className="top";book_info.innerHTML=`You can find more information in \ +the rustdoc book.`;const shortcuts=[["?","Show this help dialog"],["S / /","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],["_","Collapse all sections, including impl blocks"],].map(x=>"
"+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
"+x[1]+"
").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";const infos=[`For a full list of all search features, take a look \ + here.`,"Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + -> vec or String, enum:Cow -> bool)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"",`Look for functions that accept or return \ + slices and \ + arrays by writing square \ + brackets (e.g., -> [u8] or [] -> Option)`,"Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

"+x+"

").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;const rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";const rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);const container=document.createElement("div");if(!isHelpPage){container.className="popover";}container.id="help";container.style.display="none";const side_by_side=document.createElement("div");side_by_side.className="side-by-side";side_by_side.appendChild(div_shortcuts);side_by_side.appendChild(div_infos);container.appendChild(book_info);container.appendChild(side_by_side);container.appendChild(rustdoc_version);if(isHelpPage){const help_section=document.createElement("section");help_section.appendChild(container);document.getElementById("main-content").appendChild(help_section);container.style.display="block";}else{const help_button=getHelpButton();help_button.appendChild(container);container.onblur=helpBlurHandler;help_button.onblur=helpBlurHandler;help_button.children[0].onblur=helpBlurHandler;}return container;}window.hideAllModals=switchFocus=>{hideSidebar();window.hidePopoverMenus();hideTooltip(switchFocus);};window.hidePopoverMenus=()=>{onEachLazy(document.querySelectorAll("rustdoc-toolbar .popover"),elem=>{elem.style.display="none";});const button=getHelpButton();if(button){removeClass(button,"help-open");}};function getHelpMenu(buildNeeded){let menu=getHelpButton().querySelector(".popover");if(!menu&&buildNeeded){menu=buildHelpMenu();}return menu;}function showHelp(){const button=getHelpButton();addClass(button,"help-open");button.querySelector("a").focus();const menu=getHelpMenu(true);if(menu.style.display==="none"){window.hideAllModals();menu.style.display="";}}const helpLink=document.querySelector(`#${HELP_BUTTON_ID} > a`);if(isHelpPage){buildHelpMenu();}else if(helpLink){helpLink.addEventListener("click",event=>{if(!helpLink.contains(helpLink)||event.ctrlKey||event.altKey||event.metaKey){return;}event.preventDefault();const menu=getHelpMenu(true);const shouldShowHelp=menu.style.display==="none";if(shouldShowHelp){showHelp();}else{window.hidePopoverMenus();}});}setMobileTopbar();addSidebarItems();addSidebarCrates();onHashChange(null);window.addEventListener("hashchange",onHashChange);window.searchState.setup();}());(function(){const SIDEBAR_MIN=100;const SIDEBAR_MAX=500;const RUSTDOC_MOBILE_BREAKPOINT=700;const BODY_MIN=400;const SIDEBAR_VANISH_THRESHOLD=SIDEBAR_MIN/2;const sidebarButton=document.getElementById("sidebar-button");if(sidebarButton){sidebarButton.addEventListener("click",e=>{removeClass(document.documentElement,"hide-sidebar");updateLocalStorage("hide-sidebar","false");if(document.querySelector(".rustdoc.src")){window.rustdocToggleSrcSidebar();}e.preventDefault();});}let currentPointerId=null;let desiredSidebarSize=null;let pendingSidebarResizingFrame=false;const resizer=document.querySelector(".sidebar-resizer");const sidebar=document.querySelector(".sidebar");if(!resizer||!sidebar){return;}const isSrcPage=hasClass(document.body,"src");const hideSidebar=function(){if(isSrcPage){window.rustdocCloseSourceSidebar();updateLocalStorage("src-sidebar-width",null);document.documentElement.style.removeProperty("--src-sidebar-width");sidebar.style.removeProperty("--src-sidebar-width");resizer.style.removeProperty("--src-sidebar-width");}else{addClass(document.documentElement,"hide-sidebar");updateLocalStorage("hide-sidebar","true");updateLocalStorage("desktop-sidebar-width",null);document.documentElement.style.removeProperty("--desktop-sidebar-width");sidebar.style.removeProperty("--desktop-sidebar-width");resizer.style.removeProperty("--desktop-sidebar-width");}};const showSidebar=function(){if(isSrcPage){window.rustdocShowSourceSidebar();}else{removeClass(document.documentElement,"hide-sidebar");updateLocalStorage("hide-sidebar","false");}};const changeSidebarSize=function(size){if(isSrcPage){updateLocalStorage("src-sidebar-width",size.toString());sidebar.style.setProperty("--src-sidebar-width",size+"px");resizer.style.setProperty("--src-sidebar-width",size+"px");}else{updateLocalStorage("desktop-sidebar-width",size.toString());sidebar.style.setProperty("--desktop-sidebar-width",size+"px");resizer.style.setProperty("--desktop-sidebar-width",size+"px");}};const isSidebarHidden=function(){return isSrcPage?!hasClass(document.documentElement,"src-sidebar-expanded"):hasClass(document.documentElement,"hide-sidebar");};const resize=function(e){if(currentPointerId===null||currentPointerId!==e.pointerId){return;}e.preventDefault();const pos=e.clientX-3;if(pos=SIDEBAR_MIN){if(isSidebarHidden()){showSidebar();}const constrainedPos=Math.min(pos,window.innerWidth-BODY_MIN,SIDEBAR_MAX);changeSidebarSize(constrainedPos);desiredSidebarSize=constrainedPos;if(pendingSidebarResizingFrame!==false){clearTimeout(pendingSidebarResizingFrame);}pendingSidebarResizingFrame=setTimeout(()=>{if(currentPointerId===null||pendingSidebarResizingFrame===false){return;}pendingSidebarResizingFrame=false;document.documentElement.style.setProperty("--resizing-sidebar-width",desiredSidebarSize+"px",);},100);}};window.addEventListener("resize",()=>{if(window.innerWidth=(window.innerWidth-BODY_MIN)){changeSidebarSize(window.innerWidth-BODY_MIN);}else if(desiredSidebarSize!==null&&desiredSidebarSize>SIDEBAR_MIN){changeSidebarSize(desiredSidebarSize);}});const stopResize=function(e){if(currentPointerId===null){return;}if(e){e.preventDefault();}desiredSidebarSize=sidebar.getBoundingClientRect().width;removeClass(resizer,"active");window.removeEventListener("pointermove",resize,false);window.removeEventListener("pointerup",stopResize,false);removeClass(document.documentElement,"sidebar-resizing");document.documentElement.style.removeProperty("--resizing-sidebar-width");if(resizer.releasePointerCapture){resizer.releasePointerCapture(currentPointerId);currentPointerId=null;}};const initResize=function(e){if(currentPointerId!==null||e.altKey||e.ctrlKey||e.metaKey||e.button!==0){return;}if(resizer.setPointerCapture){resizer.setPointerCapture(e.pointerId);if(!resizer.hasPointerCapture(e.pointerId)){resizer.releasePointerCapture(e.pointerId);return;}currentPointerId=e.pointerId;}window.hideAllModals(false);e.preventDefault();window.addEventListener("pointermove",resize,false);window.addEventListener("pointercancel",stopResize,false);window.addEventListener("pointerup",stopResize,false);addClass(resizer,"active");addClass(document.documentElement,"sidebar-resizing");const pos=e.clientX-sidebar.offsetLeft-3;document.documentElement.style.setProperty("--resizing-sidebar-width",pos+"px");desiredSidebarSize=null;};resizer.addEventListener("pointerdown",initResize,false);}());(function(){function copyContentToClipboard(content){if(content===null){return;}const el=document.createElement("textarea");el.value=content;el.setAttribute("readonly","");el.style.position="absolute";el.style.left="-9999px";document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);}function copyButtonAnimation(button){button.classList.add("clicked");if(button.reset_button_timeout!==undefined){clearTimeout(button.reset_button_timeout);}button.reset_button_timeout=setTimeout(()=>{button.reset_button_timeout=undefined;button.classList.remove("clicked");},1000);}const but=document.getElementById("copy-path");if(!but){return;}but.onclick=()=>{const titleElement=document.querySelector("title");const title=titleElement&&titleElement.textContent?titleElement.textContent.replace(" - Rust",""):"";const[item,module]=title.split(" in ");const path=[item];if(module!==undefined){path.unshift(module);}copyContentToClipboard(path.join("::"));copyButtonAnimation(but);};function copyCode(codeElem){if(!codeElem){return;}copyContentToClipboard(codeElem.textContent);}function getExampleWrap(event){const target=event.target;if(target instanceof HTMLElement){let elem=target;while(elem!==null&&!hasClass(elem,"example-wrap")){if(elem===document.body||elem.tagName==="A"||elem.tagName==="BUTTON"||hasClass(elem,"docblock")){return null;}elem=elem.parentElement;}return elem;}else{return null;}}function addCopyButton(event){const elem=getExampleWrap(event);if(elem===null){return;}elem.removeEventListener("mouseover",addCopyButton);const parent=document.createElement("div");parent.className="button-holder";const runButton=elem.querySelector(".test-arrow");if(runButton!==null){parent.appendChild(runButton);}elem.appendChild(parent);const copyButton=document.createElement("button");copyButton.className="copy-button";copyButton.title="Copy code to clipboard";copyButton.addEventListener("click",()=>{copyCode(elem.querySelector("pre > code"));copyButtonAnimation(copyButton);});parent.appendChild(copyButton);if(!elem.parentElement||!elem.parentElement.classList.contains("scraped-example")||!window.updateScrapedExample){return;}const scrapedWrapped=elem.parentElement;window.updateScrapedExample(scrapedWrapped,parent);}function showHideCodeExampleButtons(event){const elem=getExampleWrap(event);if(elem===null){return;}let buttons=elem.querySelector(".button-holder");if(buttons===null){addCopyButton(event);buttons=elem.querySelector(".button-holder");if(buttons===null){return;}}buttons.classList.toggle("keep-visible");}onEachLazy(document.querySelectorAll(".docblock .example-wrap"),elem=>{elem.addEventListener("mouseover",addCopyButton);elem.addEventListener("click",showHideCodeExampleButtons);});}());(function(){document.body.addEventListener("copy",event=>{let target=nonnull(event.target);let isInsideCode=false;while(target&&target!==document.body){if(target.tagName==="CODE"){isInsideCode=true;break;}target=target.parentElement;}if(!isInsideCode){return;}const selection=document.getSelection();nonnull(event.clipboardData).setData("text/plain",selection.toString());event.preventDefault();});}()); \ No newline at end of file diff --git a/compiler-docs/static.files/normalize-9960930a.css b/compiler-docs/static.files/normalize-9960930a.css new file mode 100644 index 0000000000..469959f137 --- /dev/null +++ b/compiler-docs/static.files/normalize-9960930a.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/compiler-docs/static.files/noscript-32bb7600.css b/compiler-docs/static.files/noscript-32bb7600.css new file mode 100644 index 0000000000..c228ec49bd --- /dev/null +++ b/compiler-docs/static.files/noscript-32bb7600.css @@ -0,0 +1 @@ + #main-content .attributes{margin-left:0 !important;}#copy-path,#sidebar-button,.sidebar-resizer{display:none !important;}nav.sub{display:none;}.src .sidebar{display:none;}.notable-traits{display:none;}:root,:root:not([data-theme]){--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--sidebar-border-color:#ddd;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--mobile-sidebar-menu-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--code-example-button-color:#7f7f7f;--code-example-button-hover-color:#595959;--settings-menu-filter:invert(50%);--settings-menu-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);--sidebar-resizer-hover:hsl(207,90%,66%);--sidebar-resizer-active:hsl(207,90%,54%);}@media (prefers-color-scheme:dark){:root,:root:not([data-theme]){--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--sidebar-border-color:#2A2A2A;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--code-example-button-color:#7f7f7f;--code-example-button-hover-color:#a5a5a5;--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--settings-menu-filter:invert(50%);--settings-menu-hover-filter:invert(65%);--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);--sidebar-resizer-hover:hsl(207,30%,54%);--sidebar-resizer-active:hsl(207,90%,54%);}} \ No newline at end of file diff --git a/compiler-docs/static.files/rust-logo-9a9549ea.svg b/compiler-docs/static.files/rust-logo-9a9549ea.svg new file mode 100644 index 0000000000..62424d8ffd --- /dev/null +++ b/compiler-docs/static.files/rust-logo-9a9549ea.svg @@ -0,0 +1,61 @@ + + + diff --git a/compiler-docs/static.files/rustdoc-aa0817cf.css b/compiler-docs/static.files/rustdoc-aa0817cf.css new file mode 100644 index 0000000000..5fa709d10c --- /dev/null +++ b/compiler-docs/static.files/rustdoc-aa0817cf.css @@ -0,0 +1,59 @@ + :root{--nav-sub-mobile-padding:8px;--search-typename-width:6.75rem;--desktop-sidebar-width:200px;--src-sidebar-width:300px;--desktop-sidebar-z-index:100;--sidebar-elems-left-padding:24px;--clipboard-image:url('data:image/svg+xml,\ +\ +\ +');--copy-path-height:34px;--copy-path-width:33px;--checkmark-image:url('data:image/svg+xml,\ +\ +');--button-left-margin:4px;--button-border-radius:2px;--toolbar-button-border-radius:6px;--code-block-border-radius:6px;--impl-items-indent:0.3em;--docblock-indent:24px;--font-family:"Source Serif 4",NanumBarunGothic,serif;--font-family-code:"Source Code Pro",monospace;--line-number-padding:4px;--line-number-right-margin:20px;--prev-arrow-image:url('data:image/svg+xml,');--next-arrow-image:url('data:image/svg+xml,');--expand-arrow-image:url('data:image/svg+xml,');--collapse-arrow-image:url('data:image/svg+xml,');--hamburger-image:url('data:image/svg+xml,\ + ');}:root.sans-serif{--font-family:"Fira Sans",sans-serif;--font-family-code:"Fira Mono",monospace;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular-0fe48ade.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:italic;font-weight:400;src:local('Fira Sans Italic'),url("FiraSans-Italic-81dc35de.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium-e1aa3f0a.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:italic;font-weight:500;src:local('Fira Sans Medium Italic'),url("FiraSans-MediumItalic-ccf7e434.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Mono';font-style:normal;font-weight:400;src:local('Fira Mono'),url("FiraMono-Regular-87c26294.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Mono';font-style:normal;font-weight:500;src:local('Fira Mono Medium'),url("FiraMono-Medium-86f75c8c.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular-6b053e98.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It-ca3b17ed.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:500;src:local('Source Serif 4 Semibold'),url("SourceSerif4-Semibold-457a13ac.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold-6d4fd4c0.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular-8badfe75.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It-fc8b9304.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold-aa29a496.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic-13b3dcba.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{box-sizing:border-box;}body{font:1rem/1.5 var(--font-family);margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:25px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}.docblock>h2:first-child,.docblock>h3:first-child,.docblock>h4:first-child,.docblock>h5:first-child,.docblock>h6:first-child{margin-top:0;}.main-heading h1{margin:0;padding:0;grid-area:main-heading-h1;overflow-wrap:break-word;overflow-wrap:anywhere;}.main-heading{position:relative;display:grid;grid-template-areas:"main-heading-breadcrumbs main-heading-breadcrumbs" "main-heading-h1 main-heading-toolbar" "main-heading-sub-heading main-heading-toolbar";grid-template-columns:minmax(105px,1fr) minmax(0,max-content);grid-template-rows:minmax(25px,min-content) min-content min-content;padding-bottom:6px;margin-bottom:15px;}.rustdoc-breadcrumbs{grid-area:main-heading-breadcrumbs;line-height:1.25;padding-top:5px;position:relative;z-index:1;}.rustdoc-breadcrumbs a{padding:5px 0 7px;}.content h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h1,h2{line-height:1.25;padding-top:3px;padding-bottom:9px;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;margin:0;padding:0;white-space:pre-wrap;}.structfield,.sub-variant-field{margin:0.6em 0;}#crate-search,h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,.search-input,.search-results .result-name,.item-table dt>a,.out-of-band,.sub-heading,span.since,a.src,rustdoc-toolbar,summary.hideme,.scraped-example-list,.rustdoc-breadcrumbs,ul.all-items{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}#toggle-all-docs,a.anchor,.section-header a,#src-sidebar a,.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,h1 a,.search-results a,.search-results li,.stab,.result-name i{color:var(--main-color);}span.enum,a.enum,span.struct,a.struct,span.union,a.union,span.primitive,a.primitive,span.type,a.type,span.foreigntype,a.foreigntype{color:var(--type-link-color);}span.trait,a.trait,span.traitalias,a.traitalias{color:var(--trait-link-color);}span.associatedtype,a.associatedtype,span.constant,a.constant,span.static,a.static{color:var(--assoc-item-link-color);}span.fn,a.fn,span.method,a.method,span.tymethod,a.tymethod{color:var(--function-link-color);}span.attr,a.attr,span.derive,a.derive,span.macro,a.macro{color:var(--macro-link-color);}span.mod,a.mod{color:var(--mod-link-color);}span.keyword,a.keyword{color:var(--keyword-link-color);}a{color:var(--link-color);text-decoration:none;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p,.docblock>.warning{margin:0 0 .75em 0;}p:last-child,.docblock>.warning:last-child{margin:0;}button{padding:1px 6px;cursor:pointer;}button#toggle-all-docs{padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.src main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}details:not(.toggle) summary{margin-bottom:.6em;}code,pre,.code-header,.type-signature{font-family:var(--font-family-code);}.docblock code,.item-table dd code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.item-table dd pre code{padding:0;}pre{padding:14px;line-height:1.5;}pre.item-decl{overflow-x:auto;}.item-decl .type-contents-toggle{contain:initial;}.src .content pre{padding:20px;padding-left:16px;}img{max-width:100%;}.logo-container{line-height:0;display:block;}.rust-logo{filter:var(--rust-logo-filter);}.sidebar{font-size:0.875rem;flex:0 0 var(--desktop-sidebar-width);width:var(--desktop-sidebar-width);overflow-y:scroll;overscroll-behavior:contain;position:sticky;height:100vh;top:0;left:0;z-index:var(--desktop-sidebar-z-index);border-right:solid 1px var(--sidebar-border-color);}.rustdoc.src .sidebar{flex-basis:50px;width:50px;overflow-x:hidden;overflow-y:hidden;}.hide-sidebar .sidebar,.hide-sidebar .sidebar-resizer{display:none;}.sidebar-resizer{touch-action:none;width:9px;cursor:ew-resize;z-index:calc(var(--desktop-sidebar-z-index) + 1);position:fixed;height:100%;left:var(--desktop-sidebar-width);display:flex;align-items:center;justify-content:flex-start;color:var(--right-side-color);}.sidebar-resizer::before{content:"";border-right:dotted 2px currentColor;width:2px;height:12px;}.sidebar-resizer::after{content:"";border-right:dotted 2px currentColor;width:2px;height:16px;}.rustdoc.src .sidebar-resizer{left:49px;}.src-sidebar-expanded .src .sidebar-resizer{left:var(--src-sidebar-width);}.sidebar-resizing{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;}.sidebar-resizing *{cursor:ew-resize !important;}.sidebar-resizing .sidebar{position:fixed;border-right:solid 2px var(--sidebar-resizer-active);}.sidebar-resizing>body{padding-left:var(--resizing-sidebar-width);}.sidebar-resizer:hover,.sidebar-resizer:active,.sidebar-resizer:focus,.sidebar-resizer.active{width:10px;margin:0;left:calc(var(--desktop-sidebar-width) - 1px);border-left:solid 1px var(--sidebar-resizer-hover);color:var(--sidebar-resizer-hover);}.src-sidebar-expanded .rustdoc.src .sidebar-resizer:hover,.src-sidebar-expanded .rustdoc.src .sidebar-resizer:active,.src-sidebar-expanded .rustdoc.src .sidebar-resizer:focus,.src-sidebar-expanded .rustdoc.src .sidebar-resizer.active{left:calc(var(--src-sidebar-width) - 1px);}@media (pointer:coarse){.sidebar-resizer{display:none !important;}.sidebar{border-right:none;}}.sidebar-resizer.active{padding:0 140px;width:calc(140px + 140px + 9px + 2px);margin-left:-140px;border-left:none;color:var(--sidebar-resizer-active);}.sidebar,.mobile-topbar,.sidebar-menu-toggle,#src-sidebar{background-color:var(--sidebar-background-color);}.src .sidebar>*{visibility:hidden;}.src-sidebar-expanded .src .sidebar{overflow-y:auto;flex-basis:var(--src-sidebar-width);width:var(--src-sidebar-width);}.src-sidebar-expanded .src .sidebar>*{visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.logo-container>img{height:48px;width:48px;}ul.block,.block li,.block ul{padding:0;margin:0;list-style:none;}.block ul a{padding-left:1rem;}.sidebar-elems a,.sidebar>h2 a{display:block;padding:0.25rem;margin-right:0.25rem;border-left:solid var(--sidebar-elems-left-padding) transparent;margin-left:calc(-0.25rem - var(--sidebar-elems-left-padding));background-clip:border-box;}.hide-toc #rustdoc-toc,.hide-toc .in-crate{display:none;}.hide-modnav #rustdoc-modnav{display:none;}.sidebar h2{text-wrap:balance;overflow-wrap:anywhere;padding:0;margin:0.7rem 0;}.sidebar h3{text-wrap:balance;overflow-wrap:anywhere;font-size:1.125rem;padding:0;margin:0;}.sidebar-elems,.sidebar>.version,.sidebar>h2{padding-left:var(--sidebar-elems-left-padding);}.sidebar a{color:var(--sidebar-link-color);}.sidebar .current,.sidebar .current a,.sidebar-crate a.logo-container:hover+h2 a,.sidebar a:hover:not(.logo-container){background-color:var(--sidebar-current-link-background-color);}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.sidebar-crate{display:flex;align-items:center;justify-content:center;margin:14px 32px 1rem;row-gap:10px;column-gap:32px;flex-wrap:wrap;}.sidebar-crate h2{flex-grow:1;margin:0 -8px;align-self:start;}.sidebar-crate .logo-container{margin:0 calc(-16px - var(--sidebar-elems-left-padding));padding:0 var(--sidebar-elems-left-padding);text-align:center;}.sidebar-crate .logo-container img{margin-top:-16px;border-top:solid 16px transparent;box-sizing:content-box;position:relative;background-clip:border-box;z-index:1;}.sidebar-crate h2 a{display:block;border-left:solid var(--sidebar-elems-left-padding) transparent;background-clip:border-box;margin:0 calc(-24px + 0.25rem) 0 calc(-0.2rem - var(--sidebar-elems-left-padding));padding:calc((16px - 0.57rem ) / 2 ) 0.25rem;padding-left:0.2rem;}.sidebar-crate h2 .version{display:block;font-weight:normal;font-size:1rem;overflow-wrap:break-word;}.sidebar-crate+.version{margin-top:-1rem;margin-bottom:1rem;}.mobile-topbar{display:none;}.rustdoc .example-wrap{display:flex;position:relative;margin-bottom:10px;}.rustdoc .example-wrap>pre,.rustdoc .scraped-example .src-line-numbers,.rustdoc .scraped-example .src-line-numbers>pre{border-radius:6px;}.rustdoc .scraped-example{position:relative;}.rustdoc .example-wrap:last-child{margin-bottom:0px;}.rustdoc .example-wrap pre{margin:0;flex-grow:1;}.scraped-example:not(.expanded) .example-wrap{max-height:calc(1.5em * 5 + 10px);}.more-scraped-examples .scraped-example:not(.expanded) .example-wrap{max-height:calc(1.5em * 10 + 10px);}.rustdoc:not(.src) .scraped-example:not(.expanded) .src-line-numbers,.rustdoc:not(.src) .scraped-example:not(.expanded) .src-line-numbers>pre,.rustdoc:not(.src) .scraped-example:not(.expanded) pre.rust{padding-bottom:0;overflow:auto hidden;}.rustdoc:not(.src) .scraped-example .src-line-numbers{padding-top:0;}.rustdoc:not(.src) .scraped-example.expanded .src-line-numbers{padding-bottom:0;}.rustdoc:not(.src) .example-wrap pre{overflow:auto;}.example-wrap code{position:relative;}.example-wrap pre code span{display:inline;}.example-wrap.digits-1{--example-wrap-digits-count:1ch;}.example-wrap.digits-2{--example-wrap-digits-count:2ch;}.example-wrap.digits-3{--example-wrap-digits-count:3ch;}.example-wrap.digits-4{--example-wrap-digits-count:4ch;}.example-wrap.digits-5{--example-wrap-digits-count:5ch;}.example-wrap.digits-6{--example-wrap-digits-count:6ch;}.example-wrap.digits-7{--example-wrap-digits-count:7ch;}.example-wrap.digits-8{--example-wrap-digits-count:8ch;}.example-wrap.digits-9{--example-wrap-digits-count:9ch;}.example-wrap [data-nosnippet]{width:calc(var(--example-wrap-digits-count) + var(--line-number-padding) * 2);}.example-wrap pre>code{padding-left:calc(var(--example-wrap-digits-count) + var(--line-number-padding) * 2 + var(--line-number-right-margin));}.example-wrap [data-nosnippet]{color:var(--src-line-numbers-span-color);text-align:right;display:inline-block;margin-right:var(--line-number-right-margin);-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;padding:0 var(--line-number-padding);position:absolute;left:0;}.example-wrap .line-highlighted[data-nosnippet]{background-color:var(--src-line-number-highlighted-background-color);}.example-wrap pre>code{position:relative;display:block;}:root.word-wrap-source-code .example-wrap pre>code{word-break:break-all;white-space:pre-wrap;}:root.word-wrap-source-code .example-wrap pre>code *{word-break:break-all;}.example-wrap [data-nosnippet]:target{border-right:none;}.example-wrap.hide-lines [data-nosnippet]{display:none;}.search-loading{text-align:center;}.item-table dd{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock :not(pre)>code,.item-table dd code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:var(--docblock-indent);position:relative;}.docblock>:not(.more-examples-toggle):not(.example-wrap){max-width:100%;overflow-x:auto;}.sub-heading{font-size:1rem;flex-grow:0;grid-area:main-heading-sub-heading;line-height:1.25;padding-bottom:4px;}.main-heading rustdoc-toolbar,.main-heading .out-of-band{grid-area:main-heading-toolbar;}rustdoc-toolbar{display:flex;flex-direction:row;flex-wrap:nowrap;min-height:60px;}.docblock code,.item-table dd code,pre,.rustdoc.src .example-wrap,.example-wrap .src-line-numbers{background-color:var(--code-block-background-color);border-radius:var(--code-block-border-radius);text-decoration:inherit;}#main-content{position:relative;}.docblock table{margin:.5em 0;border-collapse:collapse;}.docblock table td,.docblock table th{padding:.5em;border:1px solid var(--border-color);}.docblock table tbody tr:nth-child(2n){background:var(--table-alt-row-background-color);}.docblock .stab,.item-table dd .stab,.docblock p code{display:inline-block;}.docblock li{margin-bottom:.4em;}.docblock li p:not(:last-child){margin-bottom:.3em;}div.where{white-space:pre-wrap;font-size:0.875rem;}.item-info{display:block;margin-left:var(--docblock-indent);}.impl-items>.item-info{margin-left:calc(var(--docblock-indent) + var(--impl-items-indent));}.item-info code{font-size:0.875rem;}#main-content>.item-info{margin-left:0;}nav.sub{flex-grow:1;flex-flow:row nowrap;margin:4px 0 0 0;display:flex;align-items:center;}.search-form{position:relative;display:flex;height:34px;flex-grow:1;margin-bottom:4px;}.src nav.sub{margin:0 0 -10px 0;}.section-header{display:block;position:relative;}.section-header:hover>.anchor,.impl:hover>.anchor,.trait-impl:hover>.anchor,.variant:hover>.anchor{display:initial;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.section-header>.anchor{left:-15px;padding-right:8px;}h2.section-header>.anchor{padding-right:6px;}a.doc-anchor{color:var(--main-color);display:none;position:absolute;left:-17px;padding-right:10px;padding-left:3px;}*:hover>.doc-anchor{display:block;}.top-doc>.docblock>*:first-child>.doc-anchor{display:none !important;}.main-heading a:hover,.example-wrap .rust a:hover:not([data-nosnippet]),.all-items a:hover,.docblock a:not(.scrape-help):not(.tooltip):hover:not(.doc-anchor),.item-table dd a:not(.scrape-help):not(.tooltip):hover,.item-info a{text-decoration:underline;}.crate.block li.current a{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{padding:0;margin:0;width:100%;}.item-table>dt{padding-right:1.25rem;}.item-table>dd{margin-inline-start:0;margin-left:0;}.search-results-title{margin-top:0;white-space:nowrap;display:flex;align-items:baseline;}.search-results-title+.sub-heading{color:var(--main-color);display:flex;align-items:baseline;white-space:nowrap;}#crate-search-div{position:relative;min-width:0;}#crate-search{padding:0 23px 0 4px;max-width:100%;text-overflow:ellipsis;border:1px solid var(--border-color);border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;background-color:var(--main-background-color);color:inherit;line-height:1.5;font-weight:500;}#crate-search:hover,#crate-search:focus{border-color:var(--crate-search-hover-border);}#crate-search-div::after{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;content:"";background-repeat:no-repeat;background-size:20px;background-position:calc(100% - 2px) 56%;background-image:url('data:image/svg+xml, \ + ');filter:var(--crate-search-div-filter);}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:var(--crate-search-div-hover-filter);}#crate-search>option{font-size:1rem;}.search-input{-webkit-appearance:none;outline:none;border:1px solid var(--border-color);border-radius:2px;padding:8px;font-size:1rem;flex-grow:1;background-color:var(--button-background-color);color:var(--search-color);}.search-input:focus{border-color:var(--search-input-focused-border-color);}.search-results{display:none;}.search-results.active{display:block;margin:0;padding:0;}.search-results>a{display:grid;grid-template-areas:"search-result-name search-result-desc" "search-result-type-signature search-result-type-signature";grid-template-columns:.6fr .4fr;margin-left:2px;margin-right:2px;border-bottom:1px solid var(--search-result-border-color);column-gap:1em;}.search-results>a>div.desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;grid-area:search-result-desc;}.search-results a:hover,.search-results a:focus{background-color:var(--search-result-link-focus-background-color);}.search-results .result-name{display:flex;align-items:center;justify-content:start;grid-area:search-result-name;}.search-results .result-name .alias{color:var(--search-results-alias-color);}.search-results .result-name .grey{color:var(--search-results-grey-color);}.search-results .result-name .typename{color:var(--search-results-grey-color);font-size:0.875rem;width:var(--search-typename-width);}.search-results .result-name .path{word-break:break-all;max-width:calc(100% - var(--search-typename-width));display:inline-block;}.search-results .result-name .path>*{display:inline;}.search-results .type-signature{grid-area:search-result-type-signature;white-space:pre-wrap;}.popover{position:absolute;top:100%;right:0;z-index:calc(var(--desktop-sidebar-z-index) + 1);margin-top:7px;border-radius:3px;border:1px solid var(--border-color);background-color:var(--main-background-color);color:var(--main-color);--popover-arrow-offset:11px;}.popover::before{content:'';position:absolute;right:var(--popover-arrow-offset);border:solid var(--border-color);border-width:1px 1px 0 0;background-color:var(--main-background-color);padding:4px;transform:rotate(-45deg);top:-5px;}.setting-line{margin:1.2em 0.6em;}.setting-radio input,.setting-check input{margin-right:0.3em;height:1.2rem;width:1.2rem;border:2px solid var(--settings-input-border-color);outline:none;-webkit-appearance:none;cursor:pointer;}.setting-radio input{border-radius:50%;}.setting-radio span,.setting-check span{padding-bottom:1px;}.setting-radio{margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;display:inline-flex;align-items:center;cursor:pointer;}.setting-radio+.setting-radio{margin-left:0.5em;}.setting-check{margin-right:20px;display:flex;align-items:center;cursor:pointer;}.setting-check input{flex-shrink:0;}.setting-radio input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-check input:checked{background-color:var(--settings-input-color);border-width:1px;content:url('data:image/svg+xml,\ + \ + ');}.setting-radio input:focus,.setting-check input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-radio input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-radio input:hover,.setting-check input:hover{border-color:var(--settings-input-color) !important;}#settings.popover{--popover-arrow-offset:202px;top:calc(100% - 16px);}#help.popover{max-width:600px;--popover-arrow-offset:118px;top:calc(100% - 16px);}#help dt{float:left;clear:left;margin-right:0.5rem;}#help dd{margin-bottom:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;padding:0 0.5rem;text-wrap-style:balance;}#help span.top{margin:10px 0;border-bottom:1px solid var(--border-color);padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid var(--border-color);}.side-by-side{display:flex;margin-bottom:20px;}.side-by-side>div{width:50%;padding:0 20px 0 17px;}.item-info .stab{display:block;padding:3px;margin-bottom:5px;}.item-table dt .stab{margin-left:0.3125em;}.stab{padding:0 2px;font-size:0.875rem;font-weight:normal;color:var(--main-color);background-color:var(--stab-background-color);width:fit-content;white-space:pre-wrap;border-radius:3px;display:inline;vertical-align:baseline;}.stab.portability>code{background:none;color:var(--stab-code-color);}.stab .emoji,.item-info .stab::before{font-size:1.25rem;}.stab .emoji{margin-right:0.3rem;}.item-info .stab::before{content:"\0";width:0;display:inline-block;color:transparent;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;float:right;}.rightside:not(a),.out-of-band,.sub-heading,rustdoc-toolbar{color:var(--right-side-color);}pre.rust{tab-size:4;-moz-tab-size:4;}pre.rust .kw{color:var(--code-highlight-kw-color);}pre.rust .kw-2{color:var(--code-highlight-kw-2-color);}pre.rust .lifetime{color:var(--code-highlight-lifetime-color);}pre.rust .prelude-ty{color:var(--code-highlight-prelude-color);}pre.rust .prelude-val{color:var(--code-highlight-prelude-val-color);}pre.rust .string{color:var(--code-highlight-string-color);}pre.rust .number{color:var(--code-highlight-number-color);}pre.rust .bool-val{color:var(--code-highlight-literal-color);}pre.rust .self{color:var(--code-highlight-self-color);}pre.rust .attr{color:var(--code-highlight-attribute-color);}pre.rust .macro,pre.rust .macro-nonterminal{color:var(--code-highlight-macro-color);}pre.rust .question-mark{font-weight:bold;color:var(--code-highlight-question-mark-color);}pre.rust .comment{color:var(--code-highlight-comment-color);}pre.rust .doccomment{color:var(--code-highlight-doc-comment-color);}.rustdoc.src .example-wrap pre.rust a:not([data-nosnippet]){background:var(--codeblock-link-background);}.example-wrap.compile_fail,.example-wrap.should_panic{border-left:2px solid var(--codeblock-error-color);}.ignore.example-wrap{border-left:2px solid var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover,.example-wrap.should_panic:hover{border-left:2px solid var(--codeblock-error-hover-color);}.example-wrap.ignore:hover{border-left:2px solid var(--codeblock-ignore-hover-color);}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip{color:var(--codeblock-error-color);}.example-wrap.ignore .tooltip{color:var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover .tooltip,.example-wrap.should_panic:hover .tooltip{color:var(--codeblock-error-hover-color);}.example-wrap.ignore:hover .tooltip{color:var(--codeblock-ignore-hover-color);}.example-wrap .tooltip{position:absolute;display:block;left:-25px;top:5px;margin:0;line-height:1;}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip,.example-wrap.ignore .tooltip{font-weight:bold;font-size:1.25rem;}.content .docblock .warning{border-left:2px solid var(--warning-border-color);padding:14px;position:relative;overflow-x:visible !important;}.content .docblock .warning::before{color:var(--warning-border-color);content:"ⓘ";position:absolute;left:-25px;top:5px;font-weight:bold;font-size:1.25rem;}.top-doc>.docblock>.warning:first-child::before{top:20px;}.example-wrap>a.test-arrow,.example-wrap .button-holder{visibility:hidden;position:absolute;top:4px;right:4px;z-index:1;}a.test-arrow{height:var(--copy-path-height);padding:6px 4px 0 11px;}a.test-arrow::before{content:url('data:image/svg+xml,');}.example-wrap .button-holder{display:flex;}@media not (pointer:coarse){.example-wrap:hover>a.test-arrow,.example-wrap:hover>.button-holder{visibility:visible;}}.example-wrap .button-holder.keep-visible{visibility:visible;}.example-wrap .button-holder>*{background:var(--main-background-color);cursor:pointer;border-radius:var(--button-border-radius);height:var(--copy-path-height);width:var(--copy-path-width);border:0;color:var(--code-example-button-color);}.example-wrap .button-holder>*:hover{color:var(--code-example-button-hover-color);}.example-wrap .button-holder>*:not(:first-child){margin-left:var(--button-left-margin);}.example-wrap .button-holder .copy-button{padding:2px 0 0 4px;}.example-wrap .button-holder .copy-button::before,.example-wrap .test-arrow::before,.example-wrap .button-holder .prev::before,.example-wrap .button-holder .next::before,.example-wrap .button-holder .expand::before{filter:var(--copy-path-img-filter);}.example-wrap .button-holder .copy-button::before{content:var(--clipboard-image);}.example-wrap .button-holder .copy-button:hover::before,.example-wrap .test-arrow:hover::before{filter:var(--copy-path-img-hover-filter);}.example-wrap .button-holder .copy-button.clicked::before{content:var(--checkmark-image);padding-right:5px;}.example-wrap .button-holder .prev,.example-wrap .button-holder .next,.example-wrap .button-holder .expand{line-height:0px;}.example-wrap .button-holder .prev::before{content:var(--prev-arrow-image);}.example-wrap .button-holder .next::before{content:var(--next-arrow-image);}.example-wrap .button-holder .expand::before{content:var(--expand-arrow-image);}.example-wrap .button-holder .expand.collapse::before{content:var(--collapse-arrow-image);}.code-attribute{font-weight:300;color:var(--code-attribute-color);}.item-spacer{width:100%;height:12px;display:block;}.main-heading span.since::before{content:"Since ";}.sub-variant h4{font-size:1rem;font-weight:400;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}@keyframes targetfadein{from{background-color:var(--main-background-color);}10%{background-color:var(--target-border-color);}to{background-color:var(--target-background-color);}}:target:not([data-nosnippet]){background-color:var(--target-background-color);border-right:3px solid var(--target-border-color);}.code-header a.tooltip{color:inherit;margin-right:15px;position:relative;}.code-header a.tooltip:hover{color:var(--link-color);}a.tooltip:hover::after{position:absolute;top:calc(100% - 10px);left:-15px;right:-15px;height:20px;content:"\00a0";}@media not (prefers-reduced-motion){:target{animation:0.65s cubic-bezier(0,0,0.1,1.0) 0.1s targetfadein;}.fade-out{opacity:0;transition:opacity 0.45s cubic-bezier(0,0,0.1,1.0);}}.popover.tooltip .content{margin:0.25em 0.5em;}.popover.tooltip .content pre,.popover.tooltip .content code{background:transparent;margin:0;padding:0;font-size:1.25rem;white-space:pre-wrap;}.popover.tooltip .content>h3:first-child{margin:0 0 5px 0;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#search-tabs{margin-top:0.25rem;display:flex;flex-direction:row;gap:1px;margin-bottom:4px;}#search-tabs button{text-align:center;font-size:1.125rem;border:0;border-top:2px solid;flex:1;line-height:1.5;color:inherit;}#search-tabs button:not(.selected){background-color:var(--search-tab-button-not-selected-background);border-top-color:var(--search-tab-button-not-selected-border-top-color);}#search-tabs button:hover,#search-tabs button.selected{background-color:var(--search-tab-button-selected-background);border-top-color:var(--search-tab-button-selected-border-top-color);}#search-tabs .count{font-size:1rem;font-variant-numeric:tabular-nums;color:var(--search-tab-title-count-color);}#search .error code{border-radius:3px;background-color:var(--search-error-code-background-color);}.search-corrections{font-weight:normal;}#src-sidebar{width:100%;overflow:auto;}#src-sidebar div.files>a:hover,details.dir-entry summary:hover,#src-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:var(--src-sidebar-background-hover);}#src-sidebar div.files>a.selected{background-color:var(--src-sidebar-background-selected);}.src-sidebar-title{position:sticky;top:0;display:flex;padding:8px 8px 0 48px;margin-bottom:7px;background:var(--sidebar-background-color);border-bottom:1px solid var(--border-color);}#settings-menu,#help-button,button#toggle-all-docs{margin-left:var(--button-left-margin);display:flex;line-height:1.25;min-width:14px;}#sidebar-button{display:none;line-height:0;}.hide-sidebar #sidebar-button,.src #sidebar-button{display:flex;margin-right:4px;position:fixed;height:34px;width:34px;}.hide-sidebar #sidebar-button{left:6px;background-color:var(--main-background-color);z-index:1;}.src #sidebar-button{left:8px;z-index:calc(var(--desktop-sidebar-z-index) + 1);}.hide-sidebar .src #sidebar-button{position:static;}#settings-menu>a,#help-button>a,#sidebar-button>a,button#toggle-all-docs{display:flex;align-items:center;justify-content:center;flex-direction:column;}#settings-menu>a,#help-button>a,button#toggle-all-docs{border:1px solid transparent;border-radius:var(--button-border-radius);color:var(--main-color);}#settings-menu>a,#help-button>a,button#toggle-all-docs{width:80px;border-radius:var(--toolbar-button-border-radius);}#settings-menu>a,#help-button>a{min-width:0;}#sidebar-button>a{background-color:var(--sidebar-background-color);width:33px;}#sidebar-button>a:hover,#sidebar-button>a:focus-visible{background-color:var(--main-background-color);}#settings-menu>a:hover,#settings-menu>a:focus-visible,#help-button>a:hover,#help-button>a:focus-visible,button#toggle-all-docs:hover,button#toggle-all-docs:focus-visible{border-color:var(--settings-button-border-focus);text-decoration:none;}#settings-menu>a::before{content:url('data:image/svg+xml,\ + ');width:18px;height:18px;filter:var(--settings-menu-filter);}button#toggle-all-docs::before{content:url('data:image/svg+xml,\ + ');width:18px;height:18px;filter:var(--settings-menu-filter);}button#toggle-all-docs.will-expand::before{content:url('data:image/svg+xml,\ + ');}#help-button>a::before{content:url('data:image/svg+xml,\ + \ + ?');width:18px;height:18px;filter:var(--settings-menu-filter);}button#toggle-all-docs::before,#help-button>a::before,#settings-menu>a::before{filter:var(--settings-menu-filter);margin:8px;}@media not (pointer:coarse){button#toggle-all-docs:hover::before,#help-button>a:hover::before,#settings-menu>a:hover::before{filter:var(--settings-menu-hover-filter);}}button[disabled]#toggle-all-docs{opacity:0.25;border:solid 1px var(--main-background-color);background-size:cover;}button[disabled]#toggle-all-docs:hover{border:solid 1px var(--main-background-color);cursor:not-allowed;}rustdoc-toolbar span.label{font-size:1rem;flex-grow:1;padding-bottom:4px;}#sidebar-button>a::before{content:url('data:image/svg+xml,\ + \ + \ + ');width:22px;height:22px;}#copy-path{color:var(--copy-path-button-color);background:var(--main-background-color);height:var(--copy-path-height);width:var(--copy-path-width);margin-left:10px;padding:0;padding-left:2px;border:0;font-size:0;}#copy-path::before{filter:var(--copy-path-img-filter);content:var(--clipboard-image);}#copy-path:hover::before{filter:var(--copy-path-img-hover-filter);}#copy-path.clicked::before{content:var(--checkmark-image);}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px var(--border-color);border-radius:3px;color:var(--kbd-color);background-color:var(--kbd-background);box-shadow:inset 0 -1px 0 var(--kbd-box-shadow-color);}ul.all-items>li{list-style:none;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 -4px;padding:0 0 0 4px;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.toggle{contain:layout;position:relative;}details.big-toggle{contain:inline-size;}details.toggle>summary.hideme{cursor:pointer;font-size:1rem;}details.toggle>summary{list-style:none;outline:none;}details.toggle>summary::-webkit-details-marker,details.toggle>summary::marker{display:none;}details.toggle>summary.hideme>span{margin-left:9px;}details.toggle>summary::before{background:url('data:image/svg+xml,\ + ');content:"";cursor:pointer;width:16px;height:16px;display:inline-block;vertical-align:middle;opacity:.5;filter:var(--toggle-filter);}details.toggle>summary.hideme>span,.more-examples-toggle summary,.more-examples-toggle .hide-more{color:var(--toggles-color);}details.toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.toggle>summary.hideme::after{content:"";}details.toggle>summary:focus::before,details.toggle>summary:hover::before{opacity:1;}details.toggle>summary:focus-visible::before{outline:1px dotted #000;outline-offset:1px;}details.non-exhaustive{margin-bottom:8px;}details.toggle>summary.hideme::before{position:relative;}details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.toggle>summary:not(.hideme)::before,#main-content>.methods>details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}.impl-items>*:not(.item-info),.implementors-toggle>.docblock,#main-content>.methods>:not(.item-info),.impl>.item-info,.impl>.docblock,.impl+.docblock{margin-left:var(--impl-items-indent);}details.big-toggle>summary:not(.hideme)::before{left:-34px;top:9px;}details.toggle[open] >summary.hideme{position:absolute;}details.toggle[open] >summary.hideme>span{display:none;}details.toggle[open] >summary::before{background:url('data:image/svg+xml,\ + ');}details.toggle[open] >summary::after{content:"Collapse";}details.toggle:not([open])>summary .docblock{max-height:calc(1.5em + 0.75em);overflow-y:hidden;}details.toggle:not([open])>summary .docblock>:first-child{max-width:100%;overflow:hidden;width:fit-content;white-space:nowrap;position:relative;padding-right:1em;}details.toggle:not([open])>summary .docblock>:first-child::after{content:"…";position:absolute;right:0;top:0;bottom:0;z-index:1;background-color:var(--main-background-color);font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;padding-left:0.2em;}details.toggle:not([open])>summary .docblock>div:first-child::after{padding-top:calc(1.5em + 0.75em - 1.2rem);}details.toggle>summary .docblock{margin-top:0.75em;}.docblock summary>*{display:inline-block;}.docblock>.example-wrap:first-child .tooltip{margin-top:16px;}.src #sidebar-button>a::before,.sidebar-menu-toggle::before{content:var(--hamburger-image);opacity:0.75;filter:var(--mobile-sidebar-menu-filter);}.sidebar-menu-toggle:hover::before,.sidebar-menu-toggle:active::before,.sidebar-menu-toggle:focus::before{opacity:1;}@media (max-width:850px){#search-tabs .count{display:block;}.side-by-side{flex-direction:column-reverse;}.side-by-side>div{width:auto;}}@media (max-width:700px){:root{--impl-items-indent:0.7em;}*[id]{scroll-margin-top:45px;}#copy-path{width:0;visibility:hidden;}rustdoc-toolbar span.label{display:none;}#settings-menu>a,#help-button>a,button#toggle-all-docs{width:33px;}#settings.popover{--popover-arrow-offset:86px;}#help.popover{--popover-arrow-offset:48px;}.rustdoc{display:block;}main{padding-left:15px;padding-top:0px;}.sidebar .logo-container,.sidebar .location,.sidebar-resizer{display:none;}.sidebar{position:fixed;top:45px;left:-1000px;z-index:11;height:calc(100vh - 45px);border-right:none;width:100%;}.sidebar-elems .block li a{white-space:wrap;}.src main,.rustdoc.src .sidebar{top:0;padding:0;height:100vh;border:0;}.src .search-form{margin-left:40px;}.src .main-heading{margin-left:8px;}.hide-sidebar .search-form{margin-left:32px;}.hide-sidebar .src .search-form{margin-left:0;}.sidebar.shown,.src-sidebar-expanded .src .sidebar,.rustdoc:not(.src) .sidebar:focus-within{left:0;}.mobile-topbar h2{padding-bottom:0;margin:auto 0.5em auto auto;overflow:hidden;font-size:24px;white-space:nowrap;text-overflow:ellipsis;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin:5px 0 5px 20px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.hide-sidebar .mobile-topbar{display:none;}.sidebar-menu-toggle{width:45px;border:none;line-height:0;}.hide-sidebar .sidebar-menu-toggle{display:none;}.sidebar-elems{margin-top:1em;}.anchor{display:none !important;}#main-content>details.toggle>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}#sidebar-button>a::before{content:url('data:image/svg+xml,\ + \ + \ + ');width:22px;height:22px;}.sidebar-menu-toggle:hover{background:var(--main-background-color);}.search-results>a,.search-results>a>div{display:block;}.search-results>a{padding:5px 0px;}.search-results>a>div.desc,.item-table dd{padding-left:2em;}.search-results .result-name{display:block;}.search-results .result-name .typename{width:initial;margin-right:0;}.search-results .result-name .typename,.search-results .result-name .path{display:inline;}.src-sidebar-expanded .src .sidebar{position:fixed;max-width:100vw;width:100vw;}.src .src-sidebar-title{padding-top:0;}details.implementors-toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.toggle>summary:not(.hideme)::before,#main-content>.methods>details.toggle>summary:not(.hideme)::before{left:-20px;}summary>.item-info{margin-left:10px;}.impl-items>.item-info{margin-left:calc(var(--impl-items-indent) + 10px);}.src nav.sub{margin:0 0 -25px 0;padding:var(--nav-sub-mobile-padding);}html:not(.src-sidebar-expanded) .src #sidebar-button>a{background-color:var(--main-background-color);}html:not(.src-sidebar-expanded) .src #sidebar-button>a:hover,html:not(.src-sidebar-expanded) .src #sidebar-button>a:focus-visible{background-color:var(--sidebar-background-color);}}@media (min-width:701px){.scraped-example-title{position:absolute;z-index:10;background:var(--main-background-color);bottom:8px;right:5px;padding:2px 4px;box-shadow:0 0 4px var(--main-background-color);}.item-table:not(.reexports){display:grid;grid-template-columns:33% 67%;}.item-table>dt,.item-table>dd{overflow-wrap:anywhere;}.item-table>dt{grid-column-start:1;}.item-table>dd{grid-column-start:2;}}@media print{:root{--docblock-indent:0;}nav.sidebar,nav.sub,.out-of-band,a.src,#copy-path,details.toggle[open] >summary::before,details.toggle>summary::before,details.toggle.top-doc>summary{display:none;}main{padding:10px;}}@media (max-width:464px){:root{--docblock-indent:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}nav.sub{flex-direction:column;}.search-form{align-self:stretch;}}.variant,.implementors-toggle>summary,.impl,#implementors-list>.docblock,.impl-items>section,.impl-items>.toggle>summary,.methods>section,.methods>.toggle>summary{margin-bottom:0.75em;}.variants>.docblock,.implementors-toggle>.docblock,.impl-items>.toggle[open]:not(:last-child),.methods>.toggle[open]:not(:last-child),.implementors-toggle[open]:not(:last-child){margin-bottom:2em;}#trait-implementations-list .impl-items>.toggle:not(:last-child),#synthetic-implementations-list .impl-items>.toggle:not(:last-child),#blanket-implementations-list .impl-items>.toggle:not(:last-child){margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;border:1px solid var(--scrape-example-help-border-color);border-radius:50px;color:var(--scrape-example-help-color);}.scraped-example-list .scrape-help:hover{border-color:var(--scrape-example-help-hover-border-color);color:var(--scrape-example-help-hover-color);}.scraped-example:not(.expanded) .example-wrap::before,.scraped-example:not(.expanded) .example-wrap::after{content:" ";width:100%;height:5px;position:absolute;z-index:1;}.scraped-example:not(.expanded) .example-wrap::before{top:0;background:linear-gradient(to bottom,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example:not(.expanded) .example-wrap::after{bottom:0;background:linear-gradient(to top,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example:not(.expanded){width:100%;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded){overflow-x:hidden;}.scraped-example .rust span.highlight{background:var(--scrape-example-code-line-highlight);}.scraped-example .rust span.highlight.focus{background:var(--scrape-example-code-line-highlight-focus);}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;cursor:pointer;}.more-scraped-examples{margin-left:25px;position:relative;}.toggle-line{position:absolute;top:5px;bottom:0;right:calc(100% + 10px);padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;background:var(--scrape-example-toggle-line-background);}.toggle-line:hover .toggle-line-inner{background:var(--scrape-example-toggle-line-hover-background);}.more-scraped-examples .scraped-example,.example-links{margin-top:20px;}.more-scraped-examples .scraped-example:first-child{margin-top:5px;}.example-links ul{margin-bottom:0;}:root[data-theme="light"],:root:not([data-theme]){--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--sidebar-border-color:#ddd;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--mobile-sidebar-menu-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--code-example-button-color:#7f7f7f;--code-example-button-hover-color:#595959;--settings-menu-filter:invert(50%);--settings-menu-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);--sidebar-resizer-hover:hsl(207,90%,66%);--sidebar-resizer-active:hsl(207,90%,54%);}:root[data-theme="dark"]{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--sidebar-border-color:#999;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--code-example-button-color:#7f7f7f;--code-example-button-hover-color:#a5a5a5;--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--settings-menu-filter:invert(50%);--settings-menu-hover-filter:invert(65%);--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);--sidebar-resizer-hover:hsl(207,30%,54%);--sidebar-resizer-active:hsl(207,90%,54%);}:root[data-theme="ayu"]{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--settings-input-border-color:#999;--settings-button-color:#fff;--settings-button-border-focus:#e0e0e0;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--sidebar-border-color:#5c6773;--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;--border-color:#5c6773;--button-background-color:#141920;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#5c6773;--copy-path-button-color:#fff;--copy-path-img-filter:invert(70%);--copy-path-img-hover-filter:invert(100%);--code-example-button-color:#b2b2b2;--code-example-button-hover-color:#fff;--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ffa0a5;--trait-link-color:#39afd7;--assoc-item-link-color:#39afd7;--function-link-color:#fdd687;--macro-link-color:#a37acc;--keyword-link-color:#39afd7;--mod-link-color:#39afd7;--link-color:#39afd7;--sidebar-link-color:#53b1db;--sidebar-current-link-background-color:transparent;--search-result-link-focus-background-color:#3c3c3c;--search-result-border-color:#aaa3;--search-color:#fff;--search-error-code-background-color:#4f4c4c;--search-results-alias-color:#c5c5c5;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:none;--search-tab-button-not-selected-background:transparent !important;--search-tab-button-selected-border-top-color:none;--search-tab-button-selected-background:#141920 !important;--settings-menu-filter:invert(70%);--settings-menu-hover-filter:invert(100%);--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ff7733;--code-highlight-kw-2-color:#ff7733;--code-highlight-lifetime-color:#ff7733;--code-highlight-prelude-color:#69f2df;--code-highlight-prelude-val-color:#ff7733;--code-highlight-number-color:#b8cc52;--code-highlight-string-color:#b8cc52;--code-highlight-literal-color:#ff7733;--code-highlight-attribute-color:#e6e1cf;--code-highlight-self-color:#36a3d9;--code-highlight-macro-color:#a37acc;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#788797;--code-highlight-doc-comment-color:#a1ac88;--src-line-numbers-span-color:#5c6773;--src-line-number-highlighted-background-color:rgba(255,236,164,0.06);--target-background-color:rgba(255,236,164,0.06);--target-border-color:rgba(255,180,76,0.85);--kbd-color:#c5c5c5;--kbd-background:#314559;--kbd-box-shadow-color:#5c6773;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);--crate-search-div-hover-filter:invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%);--crate-search-hover-border:#e0e0e0;--src-sidebar-background-selected:#14191f;--src-sidebar-background-hover:#14191f;--table-alt-row-background-color:#191f26;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(15,20,25,1);--scrape-example-code-wrapper-background-end:rgba(15,20,25,0);--sidebar-resizer-hover:hsl(34,50%,33%);--sidebar-resizer-active:hsl(34,100%,66%);}:root[data-theme="ayu"] h1,:root[data-theme="ayu"] h2,:root[data-theme="ayu"] h3,:root[data-theme="ayu"] h4,:where(:root[data-theme="ayu"]) h1 a,:root[data-theme="ayu"] .sidebar h2 a,:root[data-theme="ayu"] .sidebar h3 a{color:#fff;}:root[data-theme="ayu"] .docblock code{color:#ffb454;}:root[data-theme="ayu"] .docblock a>code{color:#39AFD7 !important;}:root[data-theme="ayu"] .code-header,:root[data-theme="ayu"] .docblock pre>code,:root[data-theme="ayu"] pre,:root[data-theme="ayu"] pre>code,:root[data-theme="ayu"] .item-info code,:root[data-theme="ayu"] .rustdoc.source .example-wrap{color:#e6e1cf;}:root[data-theme="ayu"] .sidebar .current,:root[data-theme="ayu"] .sidebar .current a,:root[data-theme="ayu"] .sidebar a:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:hover,:root[data-theme="ayu"] details.dir-entry summary:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:focus,:root[data-theme="ayu"] details.dir-entry summary:focus,:root[data-theme="ayu"] #src-sidebar div.files>a.selected{color:#ffb44c;}:root[data-theme="ayu"] .sidebar-elems .location{color:#ff7733;}:root[data-theme="ayu"] a[data-nosnippet].line-highlighted{color:#708090;padding-right:7px;border-right:1px solid #ffb44c;}:root[data-theme="ayu"] .search-results a:hover,:root[data-theme="ayu"] .search-results a:focus{color:#fff !important;background-color:#3c3c3c;}:root[data-theme="ayu"] .search-results a{color:#0096cf;}:root[data-theme="ayu"] .search-results a div.desc{color:#c5c5c5;}:root[data-theme="ayu"] .result-name .primitive>i,:root[data-theme="ayu"] .result-name .keyword>i{color:#788797;}:root[data-theme="ayu"] #search-tabs>button.selected{border-bottom:1px solid #ffb44c !important;border-top:none;}:root[data-theme="ayu"] #search-tabs>button:not(.selected){border:none;background-color:transparent !important;}:root[data-theme="ayu"] #search-tabs>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}:root[data-theme="ayu"] #settings-menu>a img,:root[data-theme="ayu"] #sidebar-button>a::before{filter:invert(100);} \ No newline at end of file diff --git a/compiler-docs/static.files/scrape-examples-5e967b76.js b/compiler-docs/static.files/scrape-examples-5e967b76.js new file mode 100644 index 0000000000..40dfe842fd --- /dev/null +++ b/compiler-docs/static.files/scrape-examples-5e967b76.js @@ -0,0 +1 @@ +"use strict";(function(){const DEFAULT_MAX_LINES=5;const HIDDEN_MAX_LINES=10;function scrollToLoc(elt,loc,isHidden){const lines=elt.querySelectorAll("[data-nosnippet]");let scrollOffset;const maxLines=isHidden?HIDDEN_MAX_LINES:DEFAULT_MAX_LINES;if(loc[1]-loc[0]>maxLines){const line=Math.max(0,loc[0]-1);scrollOffset=lines[line].offsetTop;}else{const halfHeight=elt.offsetHeight/2;const offsetTop=lines[loc[0]].offsetTop;const lastLine=lines[loc[1]];const offsetBot=lastLine.offsetTop+lastLine.offsetHeight;const offsetMid=(offsetTop+offsetBot)/2;scrollOffset=offsetMid-halfHeight;}lines[0].parentElement.scrollTo(0,scrollOffset);elt.querySelector(".rust").scrollTo(0,scrollOffset);}function createScrapeButton(parent,className,content){const button=document.createElement("button");button.className=className;button.title=content;parent.insertBefore(button,parent.firstChild);return button;}window.updateScrapedExample=(example,buttonHolder)=>{let locIndex=0;const highlights=Array.prototype.slice.call(example.querySelectorAll(".highlight"));const link=example.querySelector(".scraped-example-title a");let expandButton=null;if(!example.classList.contains("expanded")){expandButton=createScrapeButton(buttonHolder,"expand","Show all");}const isHidden=example.parentElement.classList.contains("more-scraped-examples");const locs=example.locs;if(locs.length>1){const next=createScrapeButton(buttonHolder,"next","Next usage");const prev=createScrapeButton(buttonHolder,"prev","Previous usage");const onChangeLoc=changeIndex=>{removeClass(highlights[locIndex],"focus");changeIndex();scrollToLoc(example,locs[locIndex][0],isHidden);addClass(highlights[locIndex],"focus");const url=locs[locIndex][1];const title=locs[locIndex][2];link.href=url;link.innerHTML=title;};prev.addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex-1+locs.length)%locs.length;});});next.addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex+1)%locs.length;});});}if(expandButton){expandButton.addEventListener("click",()=>{if(hasClass(example,"expanded")){removeClass(example,"expanded");removeClass(expandButton,"collapse");expandButton.title="Show all";scrollToLoc(example,locs[0][0],isHidden);}else{addClass(example,"expanded");addClass(expandButton,"collapse");expandButton.title="Show single example";}});}};function setupLoc(example,isHidden){example.locs=JSON.parse(example.attributes.getNamedItem("data-locs").textContent);scrollToLoc(example,example.locs[0][0],isHidden);}const firstExamples=document.querySelectorAll(".scraped-example-list > .scraped-example");onEachLazy(firstExamples,el=>setupLoc(el,false));onEachLazy(document.querySelectorAll(".more-examples-toggle"),toggle=>{onEachLazy(toggle.querySelectorAll(".toggle-line, .hide-more"),button=>{button.addEventListener("click",()=>{toggle.open=false;});});const moreExamples=toggle.querySelectorAll(".scraped-example");toggle.querySelector("summary").addEventListener("click",()=>{setTimeout(()=>{onEachLazy(moreExamples,el=>setupLoc(el,true));});},{once:true});});})(); \ No newline at end of file diff --git a/compiler-docs/static.files/search-fa3e91e5.js b/compiler-docs/static.files/search-fa3e91e5.js new file mode 100644 index 0000000000..d4818b4fe6 --- /dev/null +++ b/compiler-docs/static.files/search-fa3e91e5.js @@ -0,0 +1,6 @@ +"use strict";if(!Array.prototype.toSpliced){Array.prototype.toSpliced=function(){const me=this.slice();Array.prototype.splice.apply(me,arguments);return me;};}function onEachBtwn(arr,func,funcBtwn){let skipped=true;for(const value of arr){if(!skipped){funcBtwn(value);}skipped=func(value);}}function undef2null(x){if(x!==undefined){return x;}return null;}const itemTypes=["keyword","primitive","mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","associatedtype","constant","associatedconstant","union","foreigntype","existential","attr","derive","traitalias","generic",];const TY_PRIMITIVE=itemTypes.indexOf("primitive");const TY_GENERIC=itemTypes.indexOf("generic");const TY_IMPORT=itemTypes.indexOf("import");const TY_TRAIT=itemTypes.indexOf("trait");const TY_FN=itemTypes.indexOf("fn");const TY_METHOD=itemTypes.indexOf("method");const TY_TYMETHOD=itemTypes.indexOf("tymethod");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";const UNBOXING_LIMIT=5;const REGEX_IDENT=/\p{ID_Start}\p{ID_Continue}*|_\p{ID_Continue}+/uy;const REGEX_INVALID_TYPE_FILTER=/[^a-z]/ui;const MAX_RESULTS=200;const NO_TYPE_FILTER=-1;const editDistanceState={current:[],prev:[],prevPrev:[],calculate:function calculate(a,b,limit){if(a.lengthlimit){return limit+1;}while(b.length>0&&b[0]===a[0]){a=a.substring(1);b=b.substring(1);}while(b.length>0&&b[b.length-1]===a[a.length-1]){a=a.substring(0,a.length-1);b=b.substring(0,b.length-1);}if(b.length===0){return minDist;}const aLength=a.length;const bLength=b.length;for(let i=0;i<=bLength;++i){this.current[i]=0;this.prev[i]=i;this.prevPrev[i]=Number.MAX_VALUE;}for(let i=1;i<=aLength;++i){this.current[0]=i;const aIdx=i-1;for(let j=1;j<=bLength;++j){const bIdx=j-1;const substitutionCost=a[aIdx]===b[bIdx]?0:1;this.current[j]=Math.min(this.prev[j]+1,this.current[j-1]+1,this.prev[j-1]+substitutionCost,);if((i>1)&&(j>1)&&(a[aIdx]===b[bIdx-1])&&(a[aIdx-1]===b[bIdx])){this.current[j]=Math.min(this.current[j],this.prevPrev[j-2]+1,);}}const prevPrevTmp=this.prevPrev;this.prevPrev=this.prev;this.prev=this.current;this.current=prevPrevTmp;}const distance=this.prev[bLength];return distance<=limit?distance:(limit+1);},};function editDistance(a,b,limit){return editDistanceState.calculate(a,b,limit);}function isEndCharacter(c){return"=,>-])".indexOf(c)!==-1;}function isFnLikeTy(ty){return ty===TY_FN||ty===TY_METHOD||ty===TY_TYMETHOD;}function isSeparatorCharacter(c){return c===","||c==="=";}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->";}function skipWhitespace(parserState){while(parserState.pos0){const c=parserState.userQuery[pos-1];if(c===lookingFor){return true;}else if(c!==" "){break;}pos-=1;}return false;}function isLastElemGeneric(elems,parserState){return(elems.length>0&&elems[elems.length-1].generics.length>0)||prevIs(parserState,">");}function getFilteredNextElem(query,parserState,elems,isInGenerics){const start=parserState.pos;if(parserState.userQuery[parserState.pos]===":"&&!isPathStart(parserState)){throw["Expected type filter before ",":"];}getNextElem(query,parserState,elems,isInGenerics);if(parserState.userQuery[parserState.pos]===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",];}if(elems.length===0){throw["Expected type filter before ",":"];}else if(query.literalSearch){throw["Cannot use quotes on type filter"];}const typeFilterElem=elems.pop();checkExtraTypeFilterCharacters(start,parserState);parserState.typeFilter=typeFilterElem.normalizedPathLast;parserState.pos+=1;parserState.totalElems-=1;query.literalSearch=false;getNextElem(query,parserState,elems,isInGenerics);}}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;let foundSeparator=false;const oldTypeFilter=parserState.typeFilter;parserState.typeFilter=null;const oldIsInBinding=parserState.isInBinding;parserState.isInBinding=null;let hofParameters=null;let extra="";if(endChar===">"){extra="<";}else if(endChar==="]"){extra="[";}else if(endChar===")"){extra="(";}else if(endChar===""){extra="->";}else{extra=endChar;}while(parserState.pos"," after ","="];}hofParameters=[...elems];elems.length=0;parserState.pos+=2;foundStopChar=true;foundSeparator=false;continue;}else if(c===" "){parserState.pos+=1;continue;}else if(isSeparatorCharacter(c)){parserState.pos+=1;foundStopChar=true;foundSeparator=true;continue;}else if(c===":"&&isPathStart(parserState)){throw["Unexpected ","::",": paths cannot start with ","::"];}else if(isEndCharacter(c)){throw["Unexpected ",c," after ",extra];}if(!foundStopChar){let extra=[];if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"];}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"];}if(endChar!==""){throw["Expected ",",",", ","=",", or ",endChar,...extra,", found ",c,];}throw["Expected ",","," or ","=",...extra,", found ",c,];}const posBefore=parserState.pos;getFilteredNextElem(query,parserState,elems,endChar!=="");if(endChar!==""&&parserState.pos>=parserState.length){throw["Unclosed ",extra];}if(posBefore===parserState.pos){parserState.pos+=1;}foundStopChar=false;}if(parserState.pos>=parserState.length&&endChar!==""){throw["Unclosed ",extra];}parserState.pos+=1;if(hofParameters){foundSeparator=false;if([...elems,...hofParameters].some(x=>x.bindingName)||parserState.isInBinding){throw["Unexpected ","="," within ","->"];}const hofElem=makePrimitiveElement("->",{generics:hofParameters,bindings:new Map([["output",[...elems]]]),typeFilter:null,});elems.length=0;elems[0]=hofElem;}parserState.typeFilter=oldTypeFilter;parserState.isInBinding=oldIsInBinding;return{foundSeparator};}function getNextElem(query,parserState,elems,isInGenerics){const generics=[];skipWhitespace(parserState);let start=parserState.pos;let end;if("[(".indexOf(parserState.userQuery[parserState.pos])!==-1){let endChar=")";let name="()";let friendlyName="tuple";if(parserState.userQuery[parserState.pos]==="["){endChar="]";name="[]";friendlyName="slice";}parserState.pos+=1;const{foundSeparator}=getItemsBefore(query,parserState,generics,endChar);const typeFilter=parserState.typeFilter;const bindingName=parserState.isInBinding;parserState.typeFilter=null;parserState.isInBinding=null;for(const gen of generics){if(gen.bindingName!==null){throw["Type parameter ","=",` cannot be within ${friendlyName} `,name];}}if(name==="()"&&!foundSeparator&&generics.length===1&&typeFilter===null){elems.push(generics[0]);}else if(name==="()"&&generics.length===1&&generics[0].name==="->"){generics[0].typeFilter=typeFilter;elems.push(generics[0]);}else{if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive ",name," and ",typeFilter," both specified",];}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1;}elems.push(makePrimitiveElement(name,{bindingName,generics}));}}else if(parserState.userQuery[parserState.pos]==="&"){if(parserState.typeFilter!==null&&parserState.typeFilter!=="primitive"){throw["Invalid search type: primitive ","&"," and ",parserState.typeFilter," both specified",];}parserState.typeFilter=null;parserState.pos+=1;let c=parserState.userQuery[parserState.pos];while(c===" "&&parserState.pos=end){throw["Found generics without a path"];}parserState.pos+=1;getItemsBefore(query,parserState,generics,">");}else if(parserState.pos=end){throw["Found generics without a path"];}if(parserState.isInBinding){throw["Unexpected ","("," after ","="];}parserState.pos+=1;const typeFilter=parserState.typeFilter;parserState.typeFilter=null;getItemsBefore(query,parserState,generics,")");skipWhitespace(parserState);if(isReturnArrow(parserState)){parserState.pos+=2;skipWhitespace(parserState);getFilteredNextElem(query,parserState,generics,isInGenerics);generics[generics.length-1].bindingName=makePrimitiveElement("output");}else{generics.push(makePrimitiveElement(null,{bindingName:makePrimitiveElement("output"),typeFilter:null,}));}parserState.typeFilter=typeFilter;}if(isStringElem){skipWhitespace(parserState);}if(start>=end&&generics.length===0){return;}if(parserState.userQuery[parserState.pos]==="="){if(parserState.isInBinding){throw["Cannot write ","="," twice in a binding"];}if(!isInGenerics){throw["Type parameter ","="," must be within generics list"];}const name=parserState.userQuery.slice(start,end).trim();if(name==="!"){throw["Type parameter ","="," key cannot be ","!"," never type"];}if(name.includes("!")){throw["Type parameter ","="," key cannot be ","!"," macro"];}if(name.includes("::")){throw["Type parameter ","="," key cannot contain ","::"," path"];}if(name.includes(":")){throw["Type parameter ","="," key cannot contain ",":"," type"];}parserState.isInBinding={name,generics};}else{elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics,),);}}}function checkExtraTypeFilterCharacters(start,parserState){const query=parserState.userQuery.slice(start,parserState.pos).trim();const match=query.match(REGEX_INVALID_TYPE_FILTER);if(match){throw["Unexpected ",match[0]," in type filter (before ",":",")",];}}function createQueryElement(query,parserState,name,generics,isInGenerics){const path=name.trim();if(path.length===0&&generics.length===0){throw["Unexpected ",parserState.userQuery[parserState.pos]];}if(query.literalSearch&&parserState.totalElems-parserState.genericsElems>0){throw["Cannot have more than one element if you use quotes"];}const typeFilter=parserState.typeFilter;parserState.typeFilter=null;if(name.trim()==="!"){if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive never type ","!"," and ",typeFilter," both specified",];}if(generics.length!==0){throw["Never type ","!"," does not accept generic parameters",];}const bindingName=parserState.isInBinding;parserState.isInBinding=null;return makePrimitiveElement("never",{bindingName});}const quadcolon=/::\s*::/.exec(path);if(path.startsWith("::")){throw["Paths cannot start with ","::"];}else if(quadcolon!==null){throw["Unexpected ",quadcolon[0]];}const pathSegments=path.split(/(?:::\s*)|(?:\s+(?:::\s*)?)/).map(x=>x.toLowerCase());if(pathSegments.length===0||(pathSegments.length===1&&pathSegments[0]==="")){if(generics.length>0||prevIs(parserState,">")){throw["Found generics without a path"];}else{throw["Unexpected ",parserState.userQuery[parserState.pos]];}}for(const[i,pathSegment]of pathSegments.entries()){if(pathSegment==="!"){if(i!==0){throw["Never type ","!"," is not associated item"];}pathSegments[i]="never";}}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1;}const bindingName=parserState.isInBinding;parserState.isInBinding=null;const bindings=new Map();const pathLast=pathSegments[pathSegments.length-1];return{name:name.trim(),id:null,fullPath:pathSegments,pathWithoutLast:pathSegments.slice(0,pathSegments.length-1),pathLast,normalizedPathLast:pathLast.replace(/_/g,""),generics:generics.filter(gen=>{if(gen.bindingName!==null&&gen.bindingName.name!==null){if(gen.name!==null){gen.bindingName.generics.unshift(gen);}bindings.set(gen.bindingName.name.toLowerCase().replace(/_/g,""),gen.bindingName.generics,);return false;}return true;}),bindings,typeFilter,bindingName,};}function makePrimitiveElement(name,extra){return Object.assign({name,id:null,fullPath:[name],pathWithoutLast:[],pathLast:name,normalizedPathLast:name,generics:[],bindings:new Map(),typeFilter:"primitive",bindingName:null,},extra);}function getStringElem(query,parserState,isInGenerics){if(isInGenerics){throw["Unexpected ","\""," in generics"];}else if(query.literalSearch){throw["Cannot have more than one literal search element"];}else if(parserState.totalElems-parserState.genericsElems>0){throw["Cannot use literal search when there is more than one element"];}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw["Unclosed ","\""];}else if(parserState.userQuery[end]!=="\""){throw["Unexpected ",parserState.userQuery[end]," in a string element"];}else if(start===end){throw["Cannot have empty string element"];}parserState.pos+=1;query.literalSearch=true;}function getIdentEndPosition(parserState){let afterIdent=consumeIdent(parserState);let end=parserState.pos;let macroExclamation=-1;while(parserState.pos0){throw["Unexpected ",c," after ",parserState.userQuery[parserState.pos-1]," (not a valid identifier)"];}else{throw["Unexpected ",c," (not a valid identifier)"];}parserState.pos+=1;afterIdent=consumeIdent(parserState);end=parserState.pos;}if(macroExclamation!==-1){if(parserState.typeFilter===null){parserState.typeFilter="macro";}else if(parserState.typeFilter!=="macro"){throw["Invalid search type: macro ","!"," and ",parserState.typeFilter," both specified",];}end=macroExclamation;}return end;}function isSpecialStartCharacter(c){return"<\"".indexOf(c)!==-1;}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::";}function consumeIdent(parserState){REGEX_IDENT.lastIndex=parserState.pos;const match=parserState.userQuery.match(REGEX_IDENT);if(match){parserState.pos+=match[0].length;return true;}return false;}function isPathSeparator(c){return c===":"||c===" ";}class VlqHexDecoder{constructor(string,cons){this.string=string;this.cons=cons;this.offset=0;this.backrefQueue=[];}decodeList(){let c=this.string.charCodeAt(this.offset);const ret=[];while(c!==125){ret.push(this.decode());c=this.string.charCodeAt(this.offset);}this.offset+=1;return ret;}decode(){let n=0;let c=this.string.charCodeAt(this.offset);if(c===123){this.offset+=1;return this.decodeList();}while(c<96){n=(n<<4)|(c&0xF);this.offset+=1;c=this.string.charCodeAt(this.offset);}n=(n<<4)|(c&0xF);const[sign,value]=[n&1,n>>1];this.offset+=1;return sign?-value:value;}next(){const c=this.string.charCodeAt(this.offset);if(c>=48&&c<64){this.offset+=1;return this.backrefQueue[c-48];}if(c===96){this.offset+=1;return this.cons(0);}const result=this.cons(this.decode());this.backrefQueue.unshift(result);if(this.backrefQueue.length>16){this.backrefQueue.pop();}return result;}}class RoaringBitmap{constructor(str){const strdecoded=atob(str);const u8array=new Uint8Array(strdecoded.length);for(let j=0;j=4){offsets=[];for(let j=0;j>3]&(1<<(j&0x7))){const runcount=(u8array[i]|(u8array[i+1]<<8));i+=2;this.containers.push(new RoaringBitmapRun(runcount,u8array.slice(i,i+(runcount*4)),));i+=runcount*4;}else if(this.cardinalities[j]>=4096){this.containers.push(new RoaringBitmapBits(u8array.slice(i,i+8192)));i+=8192;}else{const end=this.cardinalities[j]*2;this.containers.push(new RoaringBitmapArray(this.cardinalities[j],u8array.slice(i,i+end),));i+=end;}}}contains(keyvalue){const key=keyvalue>>16;const value=keyvalue&0xFFFF;let left=0;let right=this.keys.length-1;while(left<=right){const mid=Math.floor((left+right)/2);const x=this.keys[mid];if(xkey){right=mid-1;}else{return this.containers[mid].contains(value);}}return false;}}class RoaringBitmapRun{constructor(runcount,array){this.runcount=runcount;this.array=array;}contains(value){let left=0;let right=this.runcount-1;while(left<=right){const mid=Math.floor((left+right)/2);const i=mid*4;const start=this.array[i]|(this.array[i+1]<<8);const lenm1=this.array[i+2]|(this.array[i+3]<<8);if((start+lenm1)value){right=mid-1;}else{return true;}}return false;}}class RoaringBitmapArray{constructor(cardinality,array){this.cardinality=cardinality;this.array=array;}contains(value){let left=0;let right=this.cardinality-1;while(left<=right){const mid=Math.floor((left+right)/2);const i=mid*2;const x=this.array[i]|(this.array[i+1]<<8);if(xvalue){right=mid-1;}else{return true;}}return false;}}class RoaringBitmapBits{constructor(array){this.array=array;}contains(value){return!!(this.array[value>>3]&(1<<(value&7)));}}class NameTrie{constructor(){this.children=[];this.matches=[];}insert(name,id,tailTable){this.insertSubstring(name,0,id,tailTable);}insertSubstring(name,substart,id,tailTable){const l=name.length;if(substart===l){this.matches.push(id);}else{const sb=name.charCodeAt(substart);let child;if(this.children[sb]!==undefined){child=this.children[sb];}else{child=new NameTrie();this.children[sb]=child;let sste;if(substart>=2){const tail=name.substring(substart-2,substart+1);const entry=tailTable.get(tail);if(entry!==undefined){sste=entry;}else{sste=[];tailTable.set(tail,sste);}sste.push(child);}}child.insertSubstring(name,substart+1,id,tailTable);}}search(name,tailTable){const results=new Set();this.searchSubstringPrefix(name,0,results);if(results.size=3){const levParams=name.length>=6?new Lev2TParametricDescription(name.length):new Lev1TParametricDescription(name.length);this.searchLev(name,0,levParams,results);const tail=name.substring(0,3);const list=tailTable.get(tail);if(list!==undefined){for(const entry of list){entry.searchSubstringPrefix(name,3,results);}}}return[...results];}searchSubstringPrefix(name,substart,results){const l=name.length;if(substart===l){for(const match of this.matches){results.add(match);}let unprocessedChildren=[];for(const child of this.children){if(child){unprocessedChildren.push(child);}}let nextSet=[];while(unprocessedChildren.length!==0){const next=unprocessedChildren.pop();for(const child of next.children){if(child){nextSet.push(child);}}for(const match of next.matches){results.add(match);}if(unprocessedChildren.length===0){const tmp=unprocessedChildren;unprocessedChildren=nextSet;nextSet=tmp;}}}else{const sb=name.charCodeAt(substart);if(this.children[sb]!==undefined){this.children[sb].searchSubstringPrefix(name,substart+1,results);}}}searchLev(name,substart,levParams,results){const stack=[[this,0]];const n=levParams.n;while(stack.length!==0){const[trie,levState]=stack.pop();for(const[charCode,child]of trie.children.entries()){if(!child){continue;}const levPos=levParams.getPosition(levState);const vector=levParams.getVector(name,charCode,levPos,Math.min(name.length,levPos+(2*n)+1),);const newLevState=levParams.transition(levState,levPos,vector,);if(newLevState>=0){stack.push([child,newLevState]);if(levParams.isAccept(newLevState)){for(const match of child.matches){results.add(match);}}}}}}}class DocSearch{constructor(rawSearchIndex,rootPath,searchState){this.searchIndexDeprecated=new Map();this.searchIndexEmptyDesc=new Map();this.functionTypeFingerprint=new Uint32Array(0);this.typeNameIdMap=new Map();this.assocTypeIdNameMap=new Map();this.ALIASES=new Map();this.FOUND_ALIASES=new Set();this.rootPath=rootPath;this.searchState=searchState;this.typeNameIdOfArray=this.buildTypeMapIndex("array");this.typeNameIdOfSlice=this.buildTypeMapIndex("slice");this.typeNameIdOfArrayOrSlice=this.buildTypeMapIndex("[]");this.typeNameIdOfTuple=this.buildTypeMapIndex("tuple");this.typeNameIdOfUnit=this.buildTypeMapIndex("unit");this.typeNameIdOfTupleOrUnit=this.buildTypeMapIndex("()");this.typeNameIdOfFn=this.buildTypeMapIndex("fn");this.typeNameIdOfFnMut=this.buildTypeMapIndex("fnmut");this.typeNameIdOfFnOnce=this.buildTypeMapIndex("fnonce");this.typeNameIdOfHof=this.buildTypeMapIndex("->");this.typeNameIdOfOutput=this.buildTypeMapIndex("output",true);this.typeNameIdOfReference=this.buildTypeMapIndex("reference");this.EMPTY_BINDINGS_MAP=new Map();this.EMPTY_GENERICS_ARRAY=[];this.TYPES_POOL=new Map();this.nameTrie=new NameTrie();this.tailTable=new Map();this.searchIndex=this.buildIndex(rawSearchIndex);}buildTypeMapIndex(name,isAssocType){if(name===""||name===null){return null;}const obj=this.typeNameIdMap.get(name);if(obj!==undefined){obj.assocOnly=!!(isAssocType&&obj.assocOnly);return obj.id;}else{const id=this.typeNameIdMap.size;this.typeNameIdMap.set(name,{id,assocOnly:!!isAssocType});return id;}}buildItemSearchTypeAll(types,paths,lowercasePaths){return types&&types.length>0?types.map(type=>this.buildItemSearchType(type,paths,lowercasePaths)):this.EMPTY_GENERICS_ARRAY;}buildItemSearchType(type,paths,lowercasePaths,isAssocType){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;const BINDINGS_DATA=2;let pathIndex,generics,bindings;if(typeof type==="number"){pathIndex=type;generics=this.EMPTY_GENERICS_ARRAY;bindings=this.EMPTY_BINDINGS_MAP;}else{pathIndex=type[PATH_INDEX_DATA];generics=this.buildItemSearchTypeAll(type[GENERICS_DATA],paths,lowercasePaths,);if(type.length>BINDINGS_DATA&&type[BINDINGS_DATA].length>0){bindings=new Map(type[BINDINGS_DATA].map(binding=>{const[assocType,constraints]=binding;return[this.buildItemSearchType(assocType,paths,lowercasePaths,true).id,this.buildItemSearchTypeAll(constraints,paths,lowercasePaths),];}));}else{bindings=this.EMPTY_BINDINGS_MAP;}}let result;if(pathIndex<0){result={id:pathIndex,name:"",ty:TY_GENERIC,path:null,exactPath:null,generics,bindings,unboxFlag:true,};}else if(pathIndex===0){result={id:null,name:"",ty:null,path:null,exactPath:null,generics,bindings,unboxFlag:true,};}else{const item=lowercasePaths[pathIndex-1];const id=this.buildTypeMapIndex(item.name,isAssocType);if(isAssocType&&id!==null){this.assocTypeIdNameMap.set(id,paths[pathIndex-1].name);}result={id,name:paths[pathIndex-1].name,ty:item.ty,path:item.path,exactPath:item.exactPath,generics,bindings,unboxFlag:item.unboxFlag,};}const cr=this.TYPES_POOL.get(result.id);if(cr){if(cr.generics.length===result.generics.length&&cr.generics!==result.generics&&cr.generics.every((x,i)=>result.generics[i]===x)){result.generics=cr.generics;}if(cr.bindings.size===result.bindings.size&&cr.bindings!==result.bindings){let ok=true;for(const[k,v]of cr.bindings.entries()){const v2=result.bindings.get(v);if(!v2){ok=false;break;}if(v!==v2&&v.length===v2.length&&v.every((x,i)=>v2[i]===x)){result.bindings.set(k,v);}else if(v!==v2){ok=false;break;}}if(ok){result.bindings=cr.bindings;}}if(cr.ty===result.ty&&cr.path===result.path&&cr.bindings===result.bindings&&cr.generics===result.generics&&cr.ty===result.ty&&cr.name===result.name&&cr.unboxFlag===result.unboxFlag){return cr;}}this.TYPES_POOL.set(result.id,result);return result;}buildFunctionTypeFingerprint(type,output){let input=type.id;if(input===this.typeNameIdOfArray||input===this.typeNameIdOfSlice){input=this.typeNameIdOfArrayOrSlice;}if(input===this.typeNameIdOfTuple||input===this.typeNameIdOfUnit){input=this.typeNameIdOfTupleOrUnit;}if(input===this.typeNameIdOfFn||input===this.typeNameIdOfFnMut||input===this.typeNameIdOfFnOnce){input=this.typeNameIdOfHof;}const hashint1=k=>{k=(~~k+0x7ed55d16)+(k<<12);k=(k ^ 0xc761c23c)^(k>>>19);k=(~~k+0x165667b1)+(k<<5);k=(~~k+0xd3a2646c)^(k<<9);k=(~~k+0xfd7046c5)+(k<<3);return(k ^ 0xb55a4f09)^(k>>>16);};const hashint2=k=>{k=~k+(k<<15);k ^=k>>>12;k+=k<<2;k ^=k>>>4;k=Math.imul(k,2057);return k ^(k>>16);};if(input!==null){const h0a=hashint1(input);const h0b=hashint2(input);const h1a=~~(h0a+Math.imul(h0b,2));const h1b=~~(h0a+Math.imul(h0b,3));const h2a=~~(h0a+Math.imul(h0b,4));const h2b=~~(h0a+Math.imul(h0b,5));output[0]|=(1<<(h0a%32))|(1<<(h1b%32));output[1]|=(1<<(h1a%32))|(1<<(h2b%32));output[2]|=(1<<(h2a%32))|(1<<(h0b%32));output[3]+=1;}for(const g of type.generics){this.buildFunctionTypeFingerprint(g,output);}const fb={id:null,ty:0,generics:this.EMPTY_GENERICS_ARRAY,bindings:this.EMPTY_BINDINGS_MAP,};for(const[k,v]of type.bindings.entries()){fb.id=k;fb.generics=v;this.buildFunctionTypeFingerprint(fb,output);}}buildIndex(rawSearchIndex){const buildFunctionSearchTypeCallback=(paths,lowercasePaths)=>{const cb=functionSearchType=>{if(functionSearchType===0){return null;}const INPUTS_DATA=0;const OUTPUT_DATA=1;let inputs;let output;if(typeof functionSearchType[INPUTS_DATA]==="number"){inputs=[this.buildItemSearchType(functionSearchType[INPUTS_DATA],paths,lowercasePaths,),];}else{inputs=this.buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],paths,lowercasePaths,);}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){output=[this.buildItemSearchType(functionSearchType[OUTPUT_DATA],paths,lowercasePaths,),];}else{output=this.buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],paths,lowercasePaths,);}}else{output=[];}const where_clause=[];const l=functionSearchType.length;for(let i=2;i{const n=noop;return n;});let descShard={crate,shard:0,start:0,len:itemDescShardDecoder.next(),promise:null,resolve:null,};const descShardList=[descShard];this.searchIndexDeprecated.set(crate,new RoaringBitmap(crateCorpus.c));this.searchIndexEmptyDesc.set(crate,new RoaringBitmap(crateCorpus.e));let descIndex=0;let lastParamNames=[];let normalizedName=crate.indexOf("_")===-1?crate:crate.replace(/_/g,"");const crateRow={crate,ty:3,name:crate,path:"",descShard,descIndex,exactPath:"",desc:crateCorpus.doc,parent:undefined,type:null,paramNames:lastParamNames,id,word:crate,normalizedName,bitIndex:0,implDisambiguator:null,};this.nameTrie.insert(normalizedName,id,this.tailTable);id+=1;searchIndex.push(crateRow);currentIndex+=1;if(!this.searchIndexEmptyDesc.get(crate).contains(0)){descIndex+=1;}const itemTypes=crateCorpus.t;const itemNames=crateCorpus.n;const itemPaths=new Map(crateCorpus.q);const itemReexports=new Map(crateCorpus.r);const itemParentIdxDecoder=new VlqHexDecoder(crateCorpus.i,noop=>noop);const implDisambiguator=new Map(crateCorpus.b);const rawPaths=crateCorpus.p;const aliases=crateCorpus.a;const itemParamNames=new Map(crateCorpus.P);const lowercasePaths=[];const paths=[];const itemFunctionDecoder=new VlqHexDecoder(crateCorpus.f,buildFunctionSearchTypeCallback(paths,lowercasePaths),);let len=rawPaths.length;let lastPath=undef2null(itemPaths.get(0));for(let i=0;i{if(elem.length>idx&&elem[idx]!==undefined){const p=itemPaths.get(elem[idx]);if(p!==undefined){return p;}return if_not_found;}return if_null;};const path=elemPath(2,lastPath,null);const exactPath=elemPath(3,path,path);const unboxFlag=elem.length>4&&!!elem[4];lowercasePaths.push({ty,name:name.toLowerCase(),path,exactPath,unboxFlag});paths[i]={ty,name,path,exactPath,unboxFlag};}lastPath="";len=itemTypes.length;let lastName="";let lastWord="";for(let i=0;i=descShard.len&&!this.searchIndexEmptyDesc.get(crate).contains(bitIndex)){descShard={crate,shard:descShard.shard+1,start:descShard.start+descShard.len,len:itemDescShardDecoder.next(),promise:null,resolve:null,};descIndex=0;descShardList.push(descShard);}const name=itemNames[i]===""?lastName:itemNames[i];const word=itemNames[i]===""?lastWord:itemNames[i].toLowerCase();const pathU=itemPaths.get(i);const path=pathU!==undefined?pathU:lastPath;const paramNameString=itemParamNames.get(i);const paramNames=paramNameString!==undefined?paramNameString.split(","):lastParamNames;const type=itemFunctionDecoder.next();if(type!==null){if(type){const fp=this.functionTypeFingerprint.subarray(id*4,(id+1)*4);for(const t of type.inputs){this.buildFunctionTypeFingerprint(t,fp);}for(const t of type.output){this.buildFunctionTypeFingerprint(t,fp);}for(const w of type.where_clause){for(const t of w){this.buildFunctionTypeFingerprint(t,fp);}}}}const itemParentIdx=itemParentIdxDecoder.next();normalizedName=word.indexOf("_")===-1?word:word.replace(/_/g,"");const row={crate,ty:itemTypes.charCodeAt(i)-65,name,path,descShard,descIndex,exactPath:itemReexports.has(i)?itemPaths.get(itemReexports.get(i)):path,parent:itemParentIdx>0?paths[itemParentIdx-1]:undefined,type,paramNames,id,word,normalizedName,bitIndex,implDisambiguator:undef2null(implDisambiguator.get(i)),};this.nameTrie.insert(normalizedName,id,this.tailTable);id+=1;searchIndex.push(row);lastPath=row.path;lastParamNames=row.paramNames;if(!this.searchIndexEmptyDesc.get(crate).contains(bitIndex)){descIndex+=1;}lastName=name;lastWord=word;}if(aliases){allAliases.push([crate,aliases,currentIndex]);}currentIndex+=itemTypes.length;this.searchState.descShards.set(crate,descShardList);}for(const[crate,aliases,index]of allAliases){for(const[alias_name,alias_refs]of Object.entries(aliases)){if(!this.ALIASES.has(crate)){this.ALIASES.set(crate,new Map());}const word=alias_name.toLowerCase();const crate_alias_map=this.ALIASES.get(crate);if(!crate_alias_map.has(word)){crate_alias_map.set(word,[]);}const aliases_map=crate_alias_map.get(word);const normalizedName=word.indexOf("_")===-1?word:word.replace(/_/g,"");for(const alias of alias_refs){const originalIndex=alias+index;const original=searchIndex[originalIndex];const row={crate,name:alias_name,normalizedName,is_alias:true,ty:original.ty,type:original.type,paramNames:[],word,id,parent:undefined,original,path:"",implDisambiguator:original.implDisambiguator,descShard:original.descShard,descIndex:original.descIndex,bitIndex:original.bitIndex,};aliases_map.push(row);this.nameTrie.insert(normalizedName,id,this.tailTable);id+=1;searchIndex.push(row);}}}this.TYPES_POOL=new Map();return searchIndex;}static parseQuery(userQuery){function itemTypeFromName(typename){const index=itemTypes.findIndex(i=>i===typename);if(index<0){throw["Unknown type filter ",typename];}return index;}function convertTypeFilterOnElem(elem){if(typeof elem.typeFilter==="string"){let typeFilter=elem.typeFilter;if(typeFilter==="const"){typeFilter="constant";}elem.typeFilter=itemTypeFromName(typeFilter);}else{elem.typeFilter=NO_TYPE_FILTER;}for(const elem2 of elem.generics){convertTypeFilterOnElem(elem2);}for(const constraints of elem.bindings.values()){for(const constraint of constraints){convertTypeFilterOnElem(constraint);}}}function newParsedQuery(userQuery){return{userQuery,elems:[],returned:[],foundElems:0,totalElems:0,literalSearch:false,hasReturnArrow:false,error:null,correction:null,proposeCorrectionFrom:null,proposeCorrectionTo:null,typeFingerprint:new Uint32Array(4),};}function parseInput(query,parserState){let foundStopChar=true;while(parserState.pos"){if(isReturnArrow(parserState)){query.hasReturnArrow=true;break;}throw["Unexpected ",c," (did you mean ","->","?)"];}else if(parserState.pos>0){throw["Unexpected ",c," after ",parserState.userQuery[parserState.pos-1]];}throw["Unexpected ",c];}else if(c===" "){skipWhitespace(parserState);continue;}if(!foundStopChar){let extra=[];if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"];}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"];}if(parserState.typeFilter!==null){throw["Expected ",","," or ","->",...extra,", found ",c,];}throw["Expected ",",",", ",":"," or ","->",...extra,", found ",c,];}const before=query.elems.length;getFilteredNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1;}foundStopChar=false;}if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",];}while(parserState.postypeof elem==="string")){query.error=err;}else{throw err;}return query;}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1;}query.foundElems=query.elems.length+query.returned.length;query.totalElems=parserState.totalElems;return query;}async execQuery(origParsedQuery,filterCrates,currentCrate){const results_others=new Map(),results_in_args=new Map(),results_returned=new Map();const parsedQuery=origParsedQuery;const queryLen=parsedQuery.elems.reduce((acc,next)=>acc+next.pathLast.length,0)+parsedQuery.returned.reduce((acc,next)=>acc+next.pathLast.length,0);const maxEditDistance=Math.floor(queryLen/3);this.FOUND_ALIASES.clear();const genericSymbols=new Map();const convertNameToId=(elem,isAssocType)=>{const loweredName=elem.pathLast.toLowerCase();if(this.typeNameIdMap.has(loweredName)&&(isAssocType||!this.typeNameIdMap.get(loweredName).assocOnly)){elem.id=this.typeNameIdMap.get(loweredName).id;}else if(!parsedQuery.literalSearch){let match=null;let matchDist=maxEditDistance+1;let matchName="";for(const[name,{id,assocOnly}]of this.typeNameIdMap){const dist=Math.min(editDistance(name,loweredName,maxEditDistance),editDistance(name,elem.normalizedPathLast,maxEditDistance),);if(dist<=matchDist&&dist<=maxEditDistance&&(isAssocType||!assocOnly)){if(dist===matchDist&&matchName>name){continue;}match=id;matchDist=dist;matchName=name;}}if(match!==null){parsedQuery.correction=matchName;}elem.id=match;}if((elem.id===null&&parsedQuery.totalElems>1&&elem.typeFilter===-1&&elem.generics.length===0&&elem.bindings.size===0)||elem.typeFilter===TY_GENERIC){const id=genericSymbols.get(elem.normalizedPathLast);if(id!==undefined){elem.id=id;}else{elem.id=-(genericSymbols.size+1);genericSymbols.set(elem.normalizedPathLast,elem.id);}if(elem.typeFilter===-1&&elem.normalizedPathLast.length>=3){const maxPartDistance=Math.floor(elem.normalizedPathLast.length/3);let matchDist=maxPartDistance+1;let matchName="";for(const name of this.typeNameIdMap.keys()){const dist=editDistance(name,elem.normalizedPathLast,maxPartDistance,);if(dist<=matchDist&&dist<=maxPartDistance){if(dist===matchDist&&matchName>name){continue;}matchDist=dist;matchName=name;}}if(matchName!==""){parsedQuery.proposeCorrectionFrom=elem.name;parsedQuery.proposeCorrectionTo=matchName;}}elem.typeFilter=TY_GENERIC;}if(elem.generics.length>0&&elem.typeFilter===TY_GENERIC){parsedQuery.error=["Generic type parameter ",elem.name," does not accept generic parameters",];}for(const elem2 of elem.generics){convertNameToId(elem2);}elem.bindings=new Map(Array.from(elem.bindings.entries()).map(entry=>{const[name,constraints]=entry;if(!this.typeNameIdMap.has(name)){parsedQuery.error=["Type parameter ",name," does not exist",];return[0,[]];}for(const elem2 of constraints){convertNameToId(elem2,false);}return[this.typeNameIdMap.get(name).id,constraints];}),);};for(const elem of parsedQuery.elems){convertNameToId(elem,false);this.buildFunctionTypeFingerprint(elem,parsedQuery.typeFingerprint);}for(const elem of parsedQuery.returned){convertNameToId(elem,false);this.buildFunctionTypeFingerprint(elem,parsedQuery.typeFingerprint);}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,};}const buildHrefAndPath=item=>{let displayPath;let href;if(item.is_alias){this.FOUND_ALIASES.add(item.word);item=item.original;}const type=itemTypes[item.ty];const name=item.name;let path=item.path;let exactPath=item.exactPath;if(type==="mod"){displayPath=path+"::";href=this.rootPath+path.replace(/::/g,"/")+"/"+name+"/index.html";}else if(type==="import"){displayPath=item.path+"::";href=this.rootPath+item.path.replace(/::/g,"/")+"/index.html#reexport."+name;}else if(type==="primitive"||type==="keyword"){displayPath="";exactPath="";href=this.rootPath+path.replace(/::/g,"/")+"/"+type+"."+name+".html";}else if(type==="externcrate"){displayPath="";href=this.rootPath+name+"/index.html";}else if(item.parent!==undefined){const myparent=item.parent;let anchor=type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;exactPath=`${myparent.exactPath}::${myparent.name}`;if(parentType==="primitive"){displayPath=myparent.name+"::";exactPath=myparent.name;}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName;}else{displayPath=path+"::"+myparent.name+"::";}if(item.implDisambiguator!==null){anchor=item.implDisambiguator+"/"+anchor;}href=this.rootPath+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html#"+anchor;}else{displayPath=item.path+"::";href=this.rootPath+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html";}return[displayPath,href,`${exactPath}::${name}`];};function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6);}return tmp;}const transformResults=(results,typeInfo)=>{const duplicates=new Set();const out=[];for(const result of results){if(result.id!==-1){const res=buildHrefAndPath(this.searchIndex[result.id]);const obj=Object.assign({parent:result.parent,type:result.type,dist:result.dist,path_dist:result.path_dist,index:result.index,desc:result.desc,item:result.item,displayPath:pathSplitter(res[0]),fullPath:"",href:"",displayTypeSignature:null,},this.searchIndex[result.id]);obj.fullPath=res[2]+"|"+obj.ty;if(duplicates.has(obj.fullPath)){continue;}if(obj.ty===TY_IMPORT&&duplicates.has(res[2])){continue;}if(duplicates.has(res[2]+"|"+TY_IMPORT)){continue;}duplicates.add(obj.fullPath);duplicates.add(res[2]);if(typeInfo!==null){obj.displayTypeSignature=this.formatDisplayTypeSignature(obj,typeInfo);}obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break;}}}return out;};this.formatDisplayTypeSignature=async(obj,typeInfo)=>{const objType=obj.type;if(!objType){return{type:[],mappedNames:new Map(),whereClause:new Map()};}let fnInputs=null;let fnOutput=null;let mgens=null;if(typeInfo!=="elems"&&typeInfo!=="returned"){fnInputs=unifyFunctionTypes(objType.inputs,parsedQuery.elems,objType.where_clause,null,mgensScratch=>{fnOutput=unifyFunctionTypes(objType.output,parsedQuery.returned,objType.where_clause,mgensScratch,mgensOut=>{mgens=mgensOut;return true;},0,);return!!fnOutput;},0,);}else{const arr=typeInfo==="elems"?objType.inputs:objType.output;const highlighted=unifyFunctionTypes(arr,parsedQuery.elems,objType.where_clause,null,mgensOut=>{mgens=mgensOut;return true;},0,);if(typeInfo==="elems"){fnInputs=highlighted;}else{fnOutput=highlighted;}}if(!fnInputs){fnInputs=objType.inputs;}if(!fnOutput){fnOutput=objType.output;}const mappedNames=new Map();const whereClause=new Map();const fnParamNames=obj.paramNames||[];const queryParamNames=[];const remapQuery=queryElem=>{if(queryElem.id!==null&&queryElem.id<0){queryParamNames[-1-queryElem.id]=queryElem.name;}if(queryElem.generics.length>0){queryElem.generics.forEach(remapQuery);}if(queryElem.bindings.size>0){[...queryElem.bindings.values()].flat().forEach(remapQuery);}};parsedQuery.elems.forEach(remapQuery);parsedQuery.returned.forEach(remapQuery);const pushText=(fnType,result)=>{if(!!(result.length%2)===!!fnType.highlighted){result.push("");}else if(result.length===0&&!!fnType.highlighted){result.push("");result.push("");}result[result.length-1]+=fnType.name;};const writeHof=(fnType,result)=>{const hofOutput=fnType.bindings.get(this.typeNameIdOfOutput)||[];const hofInputs=fnType.generics;pushText(fnType,result);pushText({name:" (",highlighted:false},result);let needsComma=false;for(const fnType of hofInputs){if(needsComma){pushText({name:", ",highlighted:false},result);}needsComma=true;writeFn(fnType,result);}pushText({name:hofOutput.length===0?")":") -> ",highlighted:false,},result);if(hofOutput.length>1){pushText({name:"(",highlighted:false},result);}needsComma=false;for(const fnType of hofOutput){if(needsComma){pushText({name:", ",highlighted:false},result);}needsComma=true;writeFn(fnType,result);}if(hofOutput.length>1){pushText({name:")",highlighted:false},result);}};const writeSpecialPrimitive=(fnType,result)=>{if(fnType.id===this.typeNameIdOfArray||fnType.id===this.typeNameIdOfSlice||fnType.id===this.typeNameIdOfTuple||fnType.id===this.typeNameIdOfUnit){const[ob,sb]=fnType.id===this.typeNameIdOfArray||fnType.id===this.typeNameIdOfSlice?["[","]"]:["(",")"];pushText({name:ob,highlighted:fnType.highlighted},result);onEachBtwn(fnType.generics,nested=>writeFn(nested,result),()=>pushText({name:", ",highlighted:false},result),);pushText({name:sb,highlighted:fnType.highlighted},result);return true;}else if(fnType.id===this.typeNameIdOfReference){pushText({name:"&",highlighted:fnType.highlighted},result);let prevHighlighted=false;onEachBtwn(fnType.generics,value=>{prevHighlighted=!!value.highlighted;writeFn(value,result);},value=>pushText({name:" ",highlighted:prevHighlighted&&value.highlighted,},result),);return true;}else if(fnType.id===this.typeNameIdOfFn){writeHof(fnType,result);return true;}return false;};const writeFn=(fnType,result)=>{if(fnType.id!==null&&fnType.id<0){if(fnParamNames[-1-fnType.id]===""){const generics=fnType.generics.length>0?fnType.generics:objType.where_clause[-1-fnType.id];for(const nested of generics){writeFn(nested,result);}return;}else if(mgens){for(const[queryId,fnId]of mgens){if(fnId===fnType.id){mappedNames.set(queryParamNames[-1-queryId],fnParamNames[-1-fnType.id],);}}}pushText({name:fnParamNames[-1-fnType.id],highlighted:!!fnType.highlighted,},result);const where=[];onEachBtwn(fnType.generics,nested=>writeFn(nested,where),()=>pushText({name:" + ",highlighted:false},where),);if(where.length>0){whereClause.set(fnParamNames[-1-fnType.id],where);}}else{if(fnType.ty===TY_PRIMITIVE){if(writeSpecialPrimitive(fnType,result)){return;}}else if(fnType.ty===TY_TRAIT&&(fnType.id===this.typeNameIdOfFn||fnType.id===this.typeNameIdOfFnMut||fnType.id===this.typeNameIdOfFnOnce)){writeHof(fnType,result);return;}pushText(fnType,result);let hasBindings=false;if(fnType.bindings.size>0){onEachBtwn(fnType.bindings,([key,values])=>{const name=this.assocTypeIdNameMap.get(key);if(values.length===1&&values[0].id<0&&`${fnType.name}::${name}`===fnParamNames[-1-values[0].id]){for(const value of values){writeFn(value,[]);}return true;}if(!hasBindings){hasBindings=true;pushText({name:"<",highlighted:false},result);}pushText({name,highlighted:false},result);pushText({name:values.length!==1?"=(":"=",highlighted:false,},result);onEachBtwn(values||[],value=>writeFn(value,result),()=>pushText({name:" + ",highlighted:false},result),);if(values.length!==1){pushText({name:")",highlighted:false},result);}},()=>pushText({name:", ",highlighted:false},result),);}if(fnType.generics.length>0){pushText({name:hasBindings?", ":"<",highlighted:false},result);}onEachBtwn(fnType.generics,value=>writeFn(value,result),()=>pushText({name:", ",highlighted:false},result),);if(hasBindings||fnType.generics.length>0){pushText({name:">",highlighted:false},result);}}};const type=[];onEachBtwn(fnInputs,fnType=>writeFn(fnType,type),()=>pushText({name:", ",highlighted:false},type),);pushText({name:" -> ",highlighted:false},type);onEachBtwn(fnOutput,fnType=>writeFn(fnType,type),()=>pushText({name:", ",highlighted:false},type),);return{type,mappedNames,whereClause};};const sortResults=async(results,typeInfo,preferredCrate)=>{const userQuery=parsedQuery.userQuery;const normalizedUserQuery=parsedQuery.userQuery.toLowerCase();const isMixedCase=normalizedUserQuery!==userQuery;const result_list=[];const isReturnTypeQuery=parsedQuery.elems.length===0||typeInfo==="returned";for(const result of results.values()){result.item=this.searchIndex[result.id];result.word=this.searchIndex[result.id].word;if(isReturnTypeQuery){const resultItemType=result.item&&result.item.type;if(!resultItemType){continue;}const inputs=resultItemType.inputs;const where_clause=resultItemType.where_clause;if(containsTypeFromQuery(inputs,where_clause)){result.path_dist*=100;result.dist*=100;}}result_list.push(result);}result_list.sort((aaa,bbb)=>{let a;let b;if(isMixedCase){a=Number(aaa.item.name!==userQuery);b=Number(bbb.item.name!==userQuery);if(a!==b){return a-b;}}a=Number(aaa.word!==normalizedUserQuery);b=Number(bbb.word!==normalizedUserQuery);if(a!==b){return a-b;}a=Number(aaa.index<0);b=Number(bbb.index<0);if(a!==b){return a-b;}if(parsedQuery.hasReturnArrow){a=Number(!isFnLikeTy(aaa.item.ty));b=Number(!isFnLikeTy(bbb.item.ty));if(a!==b){return a-b;}}a=Number(aaa.path_dist);b=Number(bbb.path_dist);if(a!==b){return a-b;}a=Number(aaa.index);b=Number(bbb.index);if(a!==b){return a-b;}a=Number(aaa.dist);b=Number(bbb.dist);if(a!==b){return a-b;}a=Number(this.searchIndexDeprecated.get(aaa.item.crate).contains(aaa.item.bitIndex),);b=Number(this.searchIndexDeprecated.get(bbb.item.crate).contains(bbb.item.bitIndex),);if(a!==b){return a-b;}a=Number(aaa.item.crate!==preferredCrate);b=Number(bbb.item.crate!==preferredCrate);if(a!==b){return a-b;}a=Number(aaa.word.length);b=Number(bbb.word.length);if(a!==b){return a-b;}let aw=aaa.word;let bw=bbb.word;if(aw!==bw){return(aw>bw?+1:-1);}a=Number(this.searchIndexEmptyDesc.get(aaa.item.crate).contains(aaa.item.bitIndex),);b=Number(this.searchIndexEmptyDesc.get(bbb.item.crate).contains(bbb.item.bitIndex),);if(a!==b){return a-b;}a=Number(aaa.item.ty);b=Number(bbb.item.ty);if(a!==b){return a-b;}aw=aaa.item.path;bw=bbb.item.path;if(aw!==bw){return(aw>bw?+1:-1);}return 0;});return transformResults(result_list,typeInfo);};function unifyFunctionTypes(fnTypesIn,queryElems,whereClause,mgensIn,solutionCb,unboxingDepth,){if(unboxingDepth>=UNBOXING_LIMIT){return null;}const mgens=mgensIn===null?null:new Map(mgensIn);if(queryElems.length===0){return solutionCb(mgens)?fnTypesIn:null;}if(!fnTypesIn||fnTypesIn.length===0){return null;}const ql=queryElems.length;const fl=fnTypesIn.length;if(ql===1&&queryElems[0].generics.length===0&&queryElems[0].bindings.size===0){const queryElem=queryElems[0];for(const[i,fnType]of fnTypesIn.entries()){if(!unifyFunctionTypeIsMatchCandidate(fnType,queryElem,mgens)){continue;}if(fnType.id!==null&&fnType.id<0&&queryElem.id!==null&&queryElem.id<0){if(mgens&&mgens.has(queryElem.id)&&mgens.get(queryElem.id)!==fnType.id){continue;}const mgensScratch=new Map(mgens);mgensScratch.set(queryElem.id,fnType.id);if(!solutionCb||solutionCb(mgensScratch)){const highlighted=[...fnTypesIn];highlighted[i]=Object.assign({highlighted:true,},fnType,{generics:whereClause[-1-fnType.id],});return highlighted;}}else if(solutionCb(mgens?new Map(mgens):null)){const highlighted=[...fnTypesIn];highlighted[i]=Object.assign({highlighted:true,},fnType,{generics:unifyGenericTypes(fnType.generics,queryElem.generics,whereClause,mgens?new Map(mgens):null,solutionCb,unboxingDepth,)||fnType.generics,});return highlighted;}}for(const[i,fnType]of fnTypesIn.entries()){if(!unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth+1,)){continue;}if(fnType.id<0){const highlightedGenerics=unifyFunctionTypes(whereClause[(-fnType.id)-1],queryElems,whereClause,mgens,solutionCb,unboxingDepth+1,);if(highlightedGenerics){const highlighted=[...fnTypesIn];highlighted[i]=Object.assign({highlighted:true,},fnType,{generics:highlightedGenerics,});return highlighted;}}else{const highlightedGenerics=unifyFunctionTypes([...Array.from(fnType.bindings.values()).flat(),...fnType.generics],queryElems,whereClause,mgens?new Map(mgens):null,solutionCb,unboxingDepth+1,);if(highlightedGenerics){const highlighted=[...fnTypesIn];highlighted[i]=Object.assign({},fnType,{generics:highlightedGenerics,bindings:new Map([...fnType.bindings.entries()].map(([k,v])=>{return[k,highlightedGenerics.splice(0,v.length)];})),});return highlighted;}}}return null;}const fnTypes=fnTypesIn.slice();const flast=fl-1;const qlast=ql-1;const queryElem=queryElems[qlast];let queryElemsTmp=null;for(let i=flast;i>=0;i-=1){const fnType=fnTypes[i];if(!unifyFunctionTypeIsMatchCandidate(fnType,queryElem,mgens)){continue;}let mgensScratch;if(fnType.id!==null&&queryElem.id!==null&&fnType.id<0){mgensScratch=new Map(mgens);if(mgensScratch.has(queryElem.id)&&mgensScratch.get(queryElem.id)!==fnType.id){continue;}mgensScratch.set(queryElem.id,fnType.id);}else{mgensScratch=mgens;}fnTypes[i]=fnTypes[flast];fnTypes.length=flast;if(!queryElemsTmp){queryElemsTmp=queryElems.slice(0,qlast);}let unifiedGenerics=[];let unifiedGenericsMgens=null;const passesUnification=unifyFunctionTypes(fnTypes,queryElemsTmp,whereClause,mgensScratch,mgensScratch=>{if(fnType.generics.length===0&&queryElem.generics.length===0&&fnType.bindings.size===0&&queryElem.bindings.size===0){return solutionCb(mgensScratch);}const solution=unifyFunctionTypeCheckBindings(fnType,queryElem,whereClause,mgensScratch,unboxingDepth,);if(!solution){return false;}const simplifiedGenerics=solution.simplifiedGenerics;for(const simplifiedMgens of solution.mgens){unifiedGenerics=unifyGenericTypes(simplifiedGenerics,queryElem.generics,whereClause,simplifiedMgens,solutionCb,unboxingDepth,);if(unifiedGenerics!==null){unifiedGenericsMgens=simplifiedMgens;return true;}}return false;},unboxingDepth,);if(passesUnification){passesUnification.length=fl;passesUnification[flast]=passesUnification[i];passesUnification[i]=Object.assign({},fnType,{highlighted:true,generics:unifiedGenerics,bindings:new Map([...fnType.bindings.entries()].map(([k,v])=>{return[k,queryElem.bindings.has(k)?unifyFunctionTypes(v,queryElem.bindings.get(k),whereClause,unifiedGenericsMgens,solutionCb,unboxingDepth,):unifiedGenerics.splice(0,v.length)];})),});return passesUnification;}fnTypes[flast]=fnTypes[i];fnTypes[i]=fnType;fnTypes.length=fl;}for(let i=flast;i>=0;i-=1){const fnType=fnTypes[i];if(!unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth+1,)){continue;}const generics=fnType.id!==null&&fnType.id<0?whereClause[(-fnType.id)-1]:fnType.generics;const bindings=fnType.bindings?Array.from(fnType.bindings.values()).flat():[];const passesUnification=unifyFunctionTypes(fnTypes.toSpliced(i,1,...bindings,...generics),queryElems,whereClause,mgens,solutionCb,unboxingDepth+1,);if(passesUnification){const highlightedGenerics=passesUnification.slice(i,i+generics.length+bindings.length,);const highlightedFnType=Object.assign({},fnType,{generics:highlightedGenerics,bindings:new Map([...fnType.bindings.entries()].map(([k,v])=>{return[k,highlightedGenerics.splice(0,v.length)];})),});return passesUnification.toSpliced(i,generics.length+bindings.length,highlightedFnType,);}}return null;}function unifyGenericTypes(fnTypesIn,queryElems,whereClause,mgensIn,solutionCb,unboxingDepth,){if(unboxingDepth>=UNBOXING_LIMIT){return null;}const mgens=mgensIn===null?null:new Map(mgensIn);if(queryElems.length===0){return solutionCb(mgens)?fnTypesIn:null;}if(!fnTypesIn||fnTypesIn.length===0){return null;}const fnType=fnTypesIn[0];const queryElem=queryElems[0];if(unifyFunctionTypeIsMatchCandidate(fnType,queryElem,mgens)){if(fnType.id!==null&&fnType.id<0&&queryElem.id!==null&&queryElem.id<0){if(!mgens||!mgens.has(queryElem.id)||mgens.get(queryElem.id)===fnType.id){const mgensScratch=new Map(mgens);mgensScratch.set(queryElem.id,fnType.id);const fnTypesRemaining=unifyGenericTypes(fnTypesIn.slice(1),queryElems.slice(1),whereClause,mgensScratch,solutionCb,unboxingDepth,);if(fnTypesRemaining){const highlighted=[fnType,...fnTypesRemaining];highlighted[0]=Object.assign({highlighted:true,},fnType,{generics:whereClause[-1-fnType.id],});return highlighted;}}}else{let unifiedGenerics;const fnTypesRemaining=unifyGenericTypes(fnTypesIn.slice(1),queryElems.slice(1),whereClause,mgens,mgensScratch=>{const solution=unifyFunctionTypeCheckBindings(fnType,queryElem,whereClause,mgensScratch,unboxingDepth,);if(!solution){return false;}const simplifiedGenerics=solution.simplifiedGenerics;for(const simplifiedMgens of solution.mgens){unifiedGenerics=unifyGenericTypes(simplifiedGenerics,queryElem.generics,whereClause,simplifiedMgens,solutionCb,unboxingDepth,);if(unifiedGenerics!==null){return true;}}},unboxingDepth,);if(fnTypesRemaining){const highlighted=[fnType,...fnTypesRemaining];highlighted[0]=Object.assign({highlighted:true,},fnType,{generics:unifiedGenerics||fnType.generics,});return highlighted;}}}if(unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth+1,)){let highlightedRemaining;if(fnType.id!==null&&fnType.id<0){const highlightedGenerics=unifyFunctionTypes(whereClause[(-fnType.id)-1],[queryElem],whereClause,mgens,mgensScratch=>{const hl=unifyGenericTypes(fnTypesIn.slice(1),queryElems.slice(1),whereClause,mgensScratch,solutionCb,unboxingDepth,);if(hl){highlightedRemaining=hl;}return hl;},unboxingDepth+1,);if(highlightedGenerics){return[Object.assign({highlighted:true,},fnType,{generics:highlightedGenerics,}),...highlightedRemaining];}}else{const highlightedGenerics=unifyGenericTypes([...Array.from(fnType.bindings.values()).flat(),...fnType.generics,],[queryElem],whereClause,mgens,mgensScratch=>{const hl=unifyGenericTypes(fnTypesIn.slice(1),queryElems.slice(1),whereClause,mgensScratch,solutionCb,unboxingDepth,);if(hl){highlightedRemaining=hl;}return hl;},unboxingDepth+1,);if(highlightedGenerics){return[Object.assign({},fnType,{generics:highlightedGenerics,bindings:new Map([...fnType.bindings.entries()].map(([k,v])=>{return[k,highlightedGenerics.splice(0,v.length)];})),}),...highlightedRemaining];}}}return null;}const unifyFunctionTypeIsMatchCandidate=(fnType,queryElem,mgensIn)=>{if(!typePassesFilter(queryElem.typeFilter,fnType.ty)){return false;}if(fnType.id!==null&&fnType.id<0&&queryElem.id!==null&&queryElem.id<0){if(mgensIn&&mgensIn.has(queryElem.id)&&mgensIn.get(queryElem.id)!==fnType.id){return false;}return true;}else{if(queryElem.id===this.typeNameIdOfArrayOrSlice&&(fnType.id===this.typeNameIdOfSlice||fnType.id===this.typeNameIdOfArray)){}else if(queryElem.id===this.typeNameIdOfTupleOrUnit&&(fnType.id===this.typeNameIdOfTuple||fnType.id===this.typeNameIdOfUnit)){}else if(queryElem.id===this.typeNameIdOfHof&&(fnType.id===this.typeNameIdOfFn||fnType.id===this.typeNameIdOfFnMut||fnType.id===this.typeNameIdOfFnOnce)){}else if(fnType.id!==queryElem.id||queryElem.id===null){return false;}if((fnType.generics.length+fnType.bindings.size)===0&&queryElem.generics.length!==0){return false;}if(fnType.bindings.size0){const fnTypePath=fnType.path!==undefined&&fnType.path!==null?fnType.path.split("::"):[];if(queryElemPathLength>fnTypePath.length){return false;}let i=0;for(const path of fnTypePath){if(path===queryElem.pathWithoutLast[i]){i+=1;if(i>=queryElemPathLength){break;}}}if(i0){let mgensSolutionSet=[mgensIn];for(const[name,constraints]of queryElem.bindings.entries()){if(mgensSolutionSet.length===0){return false;}if(!fnType.bindings.has(name)){return false;}const fnTypeBindings=fnType.bindings.get(name);mgensSolutionSet=mgensSolutionSet.flatMap(mgens=>{const newSolutions=[];unifyFunctionTypes(fnTypeBindings,constraints,whereClause,mgens,newMgens=>{newSolutions.push(newMgens);return false;},unboxingDepth,);return newSolutions;});}if(mgensSolutionSet.length===0){return false;}const binds=Array.from(fnType.bindings.entries()).flatMap(entry=>{const[name,constraints]=entry;if(queryElem.bindings.has(name)){return[];}else{return constraints;}});if(simplifiedGenerics.length>0){simplifiedGenerics=[...binds,...simplifiedGenerics];}else{simplifiedGenerics=binds;}return{simplifiedGenerics,mgens:mgensSolutionSet};}return{simplifiedGenerics,mgens:[mgensIn]};}function unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth,){if(unboxingDepth>=UNBOXING_LIMIT){return false;}if(fnType.id!==null&&fnType.id<0){if(!whereClause){return false;}return checkIfInList(whereClause[(-fnType.id)-1],queryElem,whereClause,mgens,unboxingDepth,);}else if(fnType.unboxFlag&&(fnType.generics.length>0||fnType.bindings.size>0)){const simplifiedGenerics=[...fnType.generics,...Array.from(fnType.bindings.values()).flat(),];return checkIfInList(simplifiedGenerics,queryElem,whereClause,mgens,unboxingDepth,);}return false;}function containsTypeFromQuery(list,where_clause){if(!list)return false;for(const ty of parsedQuery.returned){if(ty.id!==null&&ty.id<0){continue;}if(checkIfInList(list,ty,where_clause,null,0)){return true;}}for(const ty of parsedQuery.elems){if(ty.id!==null&&ty.id<0){continue;}if(checkIfInList(list,ty,where_clause,null,0)){return true;}}return false;}function checkIfInList(list,elem,whereClause,mgens,unboxingDepth){for(const entry of list){if(checkType(entry,elem,whereClause,mgens,unboxingDepth)){return true;}}return false;}const checkType=(row,elem,whereClause,mgens,unboxingDepth)=>{if(unboxingDepth>=UNBOXING_LIMIT){return false;}if(row.id!==null&&elem.id!==null&&row.id>0&&elem.id>0&&elem.pathWithoutLast.length===0&&row.generics.length===0&&elem.generics.length===0&&row.bindings.size===0&&elem.bindings.size===0&&elem.id!==this.typeNameIdOfArrayOrSlice&&elem.id!==this.typeNameIdOfHof&&elem.id!==this.typeNameIdOfTupleOrUnit){return row.id===elem.id&&typePassesFilter(elem.typeFilter,row.ty);}else{return unifyFunctionTypes([row],[elem],whereClause,mgens,()=>true,unboxingDepth,);}};const checkTypeMgensForConflict=mgens=>{if(!mgens){return true;}const fnTypes=new Set();for(const[_qid,fid]of mgens){if(fnTypes.has(fid)){return false;}fnTypes.add(fid);}return true;};function checkPath(contains,ty){if(contains.length===0){return 0;}const maxPathEditDistance=Math.floor(contains.reduce((acc,next)=>acc+next.length,0)/3,);let ret_dist=maxPathEditDistance+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase());}const length=path.length;const clength=contains.length;pathiter:for(let i=length-clength;i>=0;i-=1){let dist_total=0;for(let x=0;xmaxPathEditDistance){continue pathiter;}dist_total+=dist;}}ret_dist=Math.min(ret_dist,Math.round(dist_total/clength));}return ret_dist>maxPathEditDistance?null:ret_dist;}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias";}return false;}const handleAliases=async(ret,query,filterCrates,currentCrate)=>{const lowerQuery=query.toLowerCase();if(this.FOUND_ALIASES.has(lowerQuery)){return;}this.FOUND_ALIASES.add(lowerQuery);const aliases=[];const crateAliases=[];if(filterCrates!==null){if(this.ALIASES.has(filterCrates)&&this.ALIASES.get(filterCrates).has(lowerQuery)){const query_aliases=this.ALIASES.get(filterCrates).get(lowerQuery);for(const alias of query_aliases){aliases.push(alias);}}}else{for(const[crate,crateAliasesIndex]of this.ALIASES){if(crateAliasesIndex.has(lowerQuery)){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=crateAliasesIndex.get(lowerQuery);for(const alias of query_aliases){pushTo.push(alias);}}}}const sortFunc=(aaa,bbb)=>{if(aaa.original.path{alias={...alias};const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop();}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc);};function addIntoResults(results,fullId,id,index,dist,path_dist,maxEditDistance){if(dist<=maxEditDistance||index!==-1){if(results.has(fullId)){const result=results.get(fullId);if(result===undefined||result.dontValidate||result.dist<=dist){return;}}results.set(fullId,{id:id,index:index,dontValidate:parsedQuery.literalSearch,dist:dist,path_dist:path_dist,});}}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return;}const rowType=row.type;if(!rowType){return;}const tfpDist=compareTypeFingerprints(row.id,parsedQuery.typeFingerprint,);if(tfpDist===null){return;}if(results.size>=MAX_RESULTS&&tfpDist>results.max_dist){return;}if(!unifyFunctionTypes(rowType.inputs,parsedQuery.elems,rowType.where_clause,null,mgens=>{return unifyFunctionTypes(rowType.output,parsedQuery.returned,rowType.where_clause,mgens,checkTypeMgensForConflict,0,);},0,)){return;}results.max_dist=Math.max(results.max_dist||0,tfpDist);addIntoResults(results,row.id,pos,0,tfpDist,0,Number.MAX_VALUE);}const compareTypeFingerprints=(fullId,queryFingerprint)=>{const fh0=this.functionTypeFingerprint[fullId*4];const fh1=this.functionTypeFingerprint[(fullId*4)+1];const fh2=this.functionTypeFingerprint[(fullId*4)+2];const[qh0,qh1,qh2]=queryFingerprint;const[in0,in1,in2]=[fh0&qh0,fh1&qh1,fh2&qh2];if((in0 ^ qh0)||(in1 ^ qh1)||(in2 ^ qh2)){return null;}return this.functionTypeFingerprint[(fullId*4)+3];};const innerRunQuery=()=>{if(parsedQuery.foundElems===1&&!parsedQuery.hasReturnArrow){const elem=parsedQuery.elems[0];const handleNameSearch=id=>{const row=this.searchIndex[id];if(!typePassesFilter(elem.typeFilter,row.ty)||(filterCrates!==null&&row.crate!==filterCrates)){return;}let pathDist=0;if(elem.fullPath.length>1){const maybePathDist=checkPath(elem.pathWithoutLast,row);if(maybePathDist===null){return;}pathDist=maybePathDist;}if(parsedQuery.literalSearch){if(row.word===elem.pathLast){addIntoResults(results_others,row.id,id,0,0,pathDist,0);}}else{addIntoResults(results_others,row.id,id,row.normalizedName.indexOf(elem.normalizedPathLast),editDistance(row.normalizedName,elem.normalizedPathLast,maxEditDistance,),pathDist,maxEditDistance,);}};if(elem.normalizedPathLast!==""){const last=elem.normalizedPathLast;for(const id of this.nameTrie.search(last,this.tailTable)){handleNameSearch(id);}}const length=this.searchIndex.length;for(let i=0,nSearchIndex=length;i0){const sortQ=(a,b)=>{const ag=a.generics.length===0&&a.bindings.size===0;const bg=b.generics.length===0&&b.bindings.size===0;if(ag!==bg){return+ag-+bg;}const ai=a.id!==null&&a.id>0;const bi=b.id!==null&&b.id>0;return+ai-+bi;};parsedQuery.elems.sort(sortQ);parsedQuery.returned.sort(sortQ);for(let i=0,nSearchIndex=this.searchIndex.length;i{const descs=await Promise.all(list.map(result=>{return this.searchIndexEmptyDesc.get(result.crate).contains(result.bitIndex)?"":this.searchState.loadDesc(result);}));for(const[i,result]of list.entries()){result.desc=descs[i];}}));if(parsedQuery.error!==null&&ret.others.length!==0){ret.query.error=null;}return ret;}}let rawSearchIndex;let docSearch;const longItemTypes=["keyword","primitive type","module","extern crate","re-export","struct","enum","function","type alias","static","trait","","trait method","method","struct field","enum variant","macro","assoc type","constant","assoc const","union","foreign type","existential type","attribute macro","derive macro","trait alias",];let currentResults;function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("search-tabs").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true;}else{removeClass(elem,"selected");}iter+=1;});const isTypeSearch=(nb>0||iter===1);iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true;}else{removeClass(elem,"active");}iter+=1;});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb;const correctionsElem=document.getElementsByClassName("search-corrections");if(isTypeSearch){removeClass(correctionsElem[0],"hidden");}else{addClass(correctionsElem[0],"hidden");}}else if(nb!==0){printTab(0);}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates);}return getNakedUrl()+extra+window.location.hash;}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="all crates"&&window.searchIndex.has(elem.value)){return elem.value;}return null;}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult();}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#search-tabs button").item(searchState.currentTab);searchState.focusedByTab[searchState.currentTab]=null;if(target){target.focus();}}async function addTab(array,query,display){const extraClass=display?" active":"";const output=document.createElement(array.length===0&&query.error===null?"div":"ul",);if(array.length>0){output.className="search-results "+extraClass;const lis=Promise.all(array.map(async item=>{const name=item.is_alias?item.original.name:item.name;const type=itemTypes[item.ty];const longType=longItemTypes[item.ty];const typeName=longType.length!==0?`${longType}`:"?";const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const resultName=document.createElement("span");resultName.className="result-name";resultName.insertAdjacentHTML("beforeend",`${typeName}`);link.appendChild(resultName);let alias=" ";if(item.is_alias){alias=`
\ +${item.name} - see \ +
`;}resultName.insertAdjacentHTML("beforeend",`
${alias}\ +${item.displayPath}${name}\ +
`);const description=document.createElement("div");description.className="desc";description.insertAdjacentHTML("beforeend",item.desc);if(item.displayTypeSignature){const{type,mappedNames,whereClause}=await item.displayTypeSignature;const displayType=document.createElement("div");type.forEach((value,index)=>{if(index%2!==0){const highlight=document.createElement("strong");highlight.appendChild(document.createTextNode(value));displayType.appendChild(highlight);}else{displayType.appendChild(document.createTextNode(value));}});if(mappedNames.size>0||whereClause.size>0){let addWhereLineFn=()=>{const line=document.createElement("div");line.className="where";line.appendChild(document.createTextNode("where"));displayType.appendChild(line);addWhereLineFn=()=>{};};for(const[qname,name]of mappedNames){if(name===qname){continue;}addWhereLineFn();const line=document.createElement("div");line.className="where";line.appendChild(document.createTextNode(` ${qname} matches `));const lineStrong=document.createElement("strong");lineStrong.appendChild(document.createTextNode(name));line.appendChild(lineStrong);displayType.appendChild(line);}for(const[name,innerType]of whereClause){if(innerType.length<=1){continue;}addWhereLineFn();const line=document.createElement("div");line.className="where";line.appendChild(document.createTextNode(` ${name}: `));innerType.forEach((value,index)=>{if(index%2!==0){const highlight=document.createElement("strong");highlight.appendChild(document.createTextNode(value));line.appendChild(highlight);}else{line.appendChild(document.createTextNode(value));}});displayType.appendChild(line);}}displayType.className="type-signature";link.appendChild(displayType);}link.appendChild(description);return link;}));lis.then(lis=>{for(const li of lis){output.appendChild(li);}});}else if(query.error===null){const dlroChannel=`https://doc.rust-lang.org/${getVar("channel")}`;output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:";}return output;}function makeTabHeader(tabNb,text,nbElems){const fmtNbElems=nbElems<10?`\u{2007}(${nbElems})\u{2007}\u{2007}`:nbElems<100?`\u{2007}(${nbElems})\u{2007}`:`\u{2007}(${nbElems})`;if(searchState.currentTab===tabNb){return"";}return"";}async function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true")){window.onunload=()=>{};searchState.removeQueryParameters();const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return;}if(results.query===undefined){results.query=DocSearch.parseQuery(searchState.input.value);}currentResults=results.query.userQuery;let currentTab=searchState.currentTab;if((currentTab===0&&results.others.length===0)||(currentTab===1&&results.in_args.length===0)||(currentTab===2&&results.returned.length===0)){if(results.others.length!==0){currentTab=0;}else if(results.in_args.length){currentTab=1;}else if(results.returned.length){currentTab=2;}}let crates="";if(rawSearchIndex.size>1){crates="
in 
"+"
";}let output=`
\ +

Results

${crates}
`;if(results.query.error!==null){const error=results.query.error;error.forEach((value,index)=>{value=value.split("<").join("<").split(">").join(">");if(index%2!==0){error[index]=`${value.replaceAll(" ", " ")}`;}else{error[index]=value;}});output+=`

Query parser error: "${error.join("")}".

`;output+="
"+makeTabHeader(0,"In Names",results.others.length)+"
";currentTab=0;}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",results.others.length)+makeTabHeader(1,"In Parameters",results.in_args.length)+makeTabHeader(2,"In Return Types",results.returned.length)+"
";}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,results.others.length)+"
";currentTab=0;}if(results.query.correction!==null){const orig=results.query.returned.length>0?results.query.returned[0].name:results.query.elems[0].name;output+="

"+`Type "${orig}" not found. `+"Showing results for closest type name "+`"${results.query.correction}" instead.

`;}if(results.query.proposeCorrectionFrom!==null){const orig=results.query.proposeCorrectionFrom;const targ=results.query.proposeCorrectionTo;output+="

"+`Type "${orig}" not found and used as generic parameter. `+`Consider searching for "${targ}" instead.

`;}const[ret_others,ret_in_args,ret_returned]=await Promise.all([addTab(results.others,results.query,currentTab===0),addTab(results.in_args,results.query,currentTab===1),addTab(results.returned,results.query,currentTab===2),]);const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others);resultsElem.appendChild(ret_in_args);resultsElem.appendChild(ret_returned);search.innerHTML=output;if(searchState.rustdocToolbar){search.querySelector(".main-heading").appendChild(searchState.rustdocToolbar);}const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate);}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("search-tabs").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1;}printTab(currentTab);}function updateSearchHistory(url){if(!browserSupportsHistoryApi()){return;}const params=searchState.getQueryStringParams();if(!history.state&&!params.search){history.pushState(null,"",url);}else{history.replaceState(null,"",url);}}async function search(forced){const query=DocSearch.parseQuery(searchState.input.value.trim());let filterCrates=getFilterCrates();if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch();}return;}searchState.setLoadingSearch();const params=searchState.getQueryStringParams();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"];}searchState.title="\""+query.userQuery+"\" Search - Rust";updateSearchHistory(buildUrl(query.userQuery,filterCrates));await showResults(await docSearch.execQuery(query,filterCrates,window.currentCrate),params.go_to_first,filterCrates);}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search();}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return;}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()));}document.title=searchState.title;}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||"";}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){searchState.hideResults();}else{searchState.timeout=setTimeout(search,500);}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return;}searchState.clearInputTimeout();setTimeout(search,0);};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return;}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus();}else{searchState.focus();}e.preventDefault();}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus();}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault();}});searchState.input.addEventListener("focus",()=>{putBackSearch();});searchState.input.addEventListener("blur",()=>{if(window.searchState.input){window.searchState.input.placeholder=window.searchState.origPlaceholder;}});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;e.preventDefault();search();}else{searchState.input.value="";searchState.hideResults();}});}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch;}search();};}function updateCrate(ev){if(ev.target.value==="all crates"){const query=searchState.input.value.trim();updateSearchHistory(buildUrl(query,null));}currentResults=null;search(true);}class ParametricDescription{constructor(w,n,minErrors){this.w=w;this.n=n;this.minErrors=minErrors;}isAccept(absState){const state=Math.floor(absState/(this.w+1));const offset=absState%(this.w+1);return this.w-offset+this.minErrors[state]<=this.n;}getPosition(absState){return absState%(this.w+1);}getVector(name,charCode,pos,end){let vector=0;for(let i=pos;i>5;const bitStart=bitLoc&31;if(bitStart+bitsPerValue<=32){return((data[dataLoc]>>bitStart)&this.MASKS[bitsPerValue-1]);}else{const part=32-bitStart;return ~~(((data[dataLoc]>>bitStart)&this.MASKS[part-1])+((data[1+dataLoc]&this.MASKS[bitsPerValue-part-1])<{const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true";}toggle.onchange=()=>{changeSetting(toggle.id,toggle.checked);};});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;let settingValue=getSettingValue(settingId);if(settingId==="theme"){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||settingValue===null){settingValue=useSystem==="false"?"light":"system preference";}}if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value;}elem.addEventListener("change",()=>{changeSetting(elem.name,elem.value);});},);}function buildSettingsPageSections(settings){let output="";for(const setting of settings){const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`\ +
+
${setting_name}
+
`;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";const full=`${js_data_name}-${option.replace(/ /g,"-")}`;output+=`\ + `;});output+=`\ +
+
`;}else{const checked=setting["default"]===true?" checked":"";output+=`\ +
\ + \ +
`;}}return output;}function buildSettingsPage(){const theme_list=getVar("themes");const theme_names=(theme_list===null?"":theme_list).split(",").filter(t=>t);theme_names.push("light","dark","ayu");const settings=[{"name":"Theme","js_name":"theme","default":"system preference","options":theme_names.concat("system preference"),},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":theme_names,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":theme_names,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Hide persistent navigation bar","js_name":"hide-sidebar","default":false,},{"name":"Hide table of contents","js_name":"hide-toc","default":false,},{"name":"Hide module navigation","js_name":"hide-modnav","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},{"name":"Use sans serif fonts","js_name":"sans-serif-fonts","default":false,},{"name":"Word wrap source code","js_name":"word-wrap-source-code","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
${buildSettingsPageSections(settings)}
`;const el=document.createElement(elementKind);el.id="settings";if(!isSettingsPage){el.className="popover";}el.innerHTML=innerHTML;if(isSettingsPage){const mainElem=document.getElementById(MAIN_ID);if(mainElem!==null){mainElem.appendChild(el);}}else{el.setAttribute("tabindex","-1");const settingsBtn=getSettingsButton();if(settingsBtn!==null){settingsBtn.appendChild(el);}}return el;}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display="";onEachLazy(settingsMenu.querySelectorAll("input[type='checkbox']"),el=>{const val=getSettingValue(el.id);const checked=val==="true";if(checked!==el.checked&&val!==null){el.checked=checked;}});}function settingsBlurHandler(event){const helpBtn=getHelpButton();const settingsBtn=getSettingsButton();const helpUnfocused=helpBtn===null||(!helpBtn.contains(document.activeElement)&&!elemContainsTarget(helpBtn,event.relatedTarget));const settingsUnfocused=settingsBtn===null||(!settingsBtn.contains(document.activeElement)&&!elemContainsTarget(settingsBtn,event.relatedTarget));if(helpUnfocused&&settingsUnfocused){window.hidePopoverMenus();}}if(!isSettingsPage){const settingsButton=nonnull(getSettingsButton());const settingsMenu=nonnull(document.getElementById("settings"));settingsButton.onclick=event=>{if(elemContainsTarget(settingsMenu,event.target)){return;}event.preventDefault();const shouldDisplaySettings=settingsMenu.style.display==="none";window.hideAllModals(false);if(shouldDisplaySettings){displaySettings();}};settingsButton.onblur=settingsBlurHandler;nonnull(settingsButton.querySelector("a")).onblur=settingsBlurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=settingsBlurHandler;});settingsMenu.onblur=settingsBlurHandler;}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings();}removeClass(getSettingsButton(),"rotate");},0);})(); \ No newline at end of file diff --git a/compiler-docs/static.files/src-script-813739b1.js b/compiler-docs/static.files/src-script-813739b1.js new file mode 100644 index 0000000000..bf546257ca --- /dev/null +++ b/compiler-docs/static.files/src-script-813739b1.js @@ -0,0 +1 @@ +"use strict";(function(){const rootPath=getVar("root-path");const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;const RUSTDOC_MOBILE_BREAKPOINT=700;function closeSidebarIfMobile(){if(window.innerWidth{removeClass(document.documentElement,"src-sidebar-expanded");updateLocalStorage("source-sidebar-show","false");};window.rustdocShowSourceSidebar=()=>{addClass(document.documentElement,"src-sidebar-expanded");updateLocalStorage("source-sidebar-show","true");};window.rustdocToggleSrcSidebar=()=>{if(document.documentElement.classList.contains("src-sidebar-expanded")){window.rustdocCloseSourceSidebar();}else{window.rustdocShowSourceSidebar();}};function createSrcSidebar(srcIndexStr){const container=nonnull(document.querySelector("nav.sidebar"));const sidebar=document.createElement("div");sidebar.id="src-sidebar";const srcIndex=new Map(JSON.parse(srcIndexStr));let hasFoundFile=false;for(const[key,source]of srcIndex){source[NAME_OFFSET]=key;hasFoundFile=createDirEntry(source,sidebar,"",hasFoundFile);}container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus();}}function highlightSrcLines(){const match=window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);if(!match){return;}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10);}if(to{removeClass(e,"line-highlighted");});for(let i=from;i<=to;++i){elem=document.getElementById(""+i);if(!elem){break;}addClass(elem,"line-highlighted");}}const handleSrcHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,"","#"+name);highlightSrcLines();}else{location.replace("#"+name);}window.scrollTo(x,y);};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)||ev.ctrlKey||ev.altKey||ev.metaKey){return;}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp;}set_fragment(prev_line_id+"-"+cur_line_id);}else{prev_line_id=cur_line_id;set_fragment(""+cur_line_id);}};}());window.addEventListener("hashchange",highlightSrcLines);onEachLazy(document.querySelectorAll("a[data-nosnippet]"),el=>{el.addEventListener("click",handleSrcHighlight);});highlightSrcLines();window.createSrcSidebar=createSrcSidebar;})(); \ No newline at end of file diff --git a/compiler-docs/static.files/storage-68b7e25d.js b/compiler-docs/static.files/storage-68b7e25d.js new file mode 100644 index 0000000000..5b18baa723 --- /dev/null +++ b/compiler-docs/static.files/storage-68b7e25d.js @@ -0,0 +1,25 @@ +"use strict";const builtinThemes=["light","dark","ayu"];const darkThemes=["dark","ayu"];window.currentTheme=(function(){const currentTheme=document.getElementById("themeStyle");return currentTheme instanceof HTMLLinkElement?currentTheme:null;})();const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");return settingsElement&&settingsElement.dataset?settingsElement.dataset:null;})();function nonnull(x,msg){if(x===null){throw(msg||"unexpected null value!");}else{return x;}}function nonundef(x,msg){if(x===undefined){throw(msg||"unexpected null value!");}else{return x;}}function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current===null&&settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def;}}return current;}const localStoredTheme=getSettingValue("theme");function hasClass(elem,className){return!!elem&&!!elem.classList&&elem.classList.contains(className);}function addClass(elem,className){if(elem&&elem.classList){elem.classList.add(className);}}function removeClass(elem,className){if(elem&&elem.classList){elem.classList.remove(className);}}function onEach(arr,func){for(const elem of arr){if(func(elem)){return true;}}return false;}function onEachLazy(lazyArray,func){return onEach(Array.prototype.slice.call(lazyArray),func);}function updateLocalStorage(name,value){try{if(value===null){window.localStorage.removeItem("rustdoc-"+name);}else{window.localStorage.setItem("rustdoc-"+name,value);}}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name);}catch(e){return null;}}function getVar(name){const el=document.querySelector("head > meta[name='rustdoc-vars']");return el?el.getAttribute("data-"+name):null;}function switchTheme(newThemeName,saveTheme){const themeNames=(getVar("themes")||"").split(",").filter(t=>t);themeNames.push(...builtinThemes);if(newThemeName===null||themeNames.indexOf(newThemeName)===-1){return;}if(saveTheme){updateLocalStorage("theme",newThemeName);}document.documentElement.setAttribute("data-theme",newThemeName);if(builtinThemes.indexOf(newThemeName)!==-1){if(window.currentTheme&&window.currentTheme.parentNode){window.currentTheme.parentNode.removeChild(window.currentTheme);window.currentTheme=null;}}else{const newHref=getVar("root-path")+encodeURIComponent(newThemeName)+getVar("resource-suffix")+".css";if(!window.currentTheme){if(document.readyState==="loading"){document.write(``);window.currentTheme=(function(){const currentTheme=document.getElementById("themeStyle");return currentTheme instanceof HTMLLinkElement?currentTheme:null;})();}else{window.currentTheme=document.createElement("link");window.currentTheme.rel="stylesheet";window.currentTheme.id="themeStyle";window.currentTheme.href=newHref;document.documentElement.appendChild(window.currentTheme);}}else if(newHref!==window.currentTheme.href){window.currentTheme.href=newHref;}}}const updateTheme=(function(){const mql=window.matchMedia("(prefers-color-scheme: dark)");function updateTheme(){if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";updateLocalStorage("use-system-theme","true");switchTheme(mql.matches?darkTheme:lightTheme,true);}else{switchTheme(getSettingValue("theme"),false);}}mql.addEventListener("change",updateTheme);return updateTheme;})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&localStoredTheme!==null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme);}}updateTheme();if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"src-sidebar-expanded");}if(getSettingValue("hide-sidebar")==="true"){addClass(document.documentElement,"hide-sidebar");}if(getSettingValue("hide-toc")==="true"){addClass(document.documentElement,"hide-toc");}if(getSettingValue("hide-modnav")==="true"){addClass(document.documentElement,"hide-modnav");}if(getSettingValue("sans-serif-fonts")==="true"){addClass(document.documentElement,"sans-serif");}if(getSettingValue("word-wrap-source-code")==="true"){addClass(document.documentElement,"word-wrap-source-code");}function updateSidebarWidth(){const desktopSidebarWidth=getSettingValue("desktop-sidebar-width");if(desktopSidebarWidth&&desktopSidebarWidth!=="null"){document.documentElement.style.setProperty("--desktop-sidebar-width",desktopSidebarWidth+"px",);}const srcSidebarWidth=getSettingValue("src-sidebar-width");if(srcSidebarWidth&&srcSidebarWidth!=="null"){document.documentElement.style.setProperty("--src-sidebar-width",srcSidebarWidth+"px",);}}updateSidebarWidth();window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(updateTheme,0);setTimeout(updateSidebarWidth,0);}});class RustdocSearchElement extends HTMLElement{constructor(){super();}connectedCallback(){const rootPath=getVar("root-path");const currentCrate=getVar("current-crate");this.innerHTML=``;}}window.customElements.define("rustdoc-search",RustdocSearchElement);class RustdocToolbarElement extends HTMLElement{constructor(){super();}connectedCallback(){if(this.firstElementChild){return;}const rootPath=getVar("root-path");this.innerHTML=` +
+ Settings +
+
+ Help +
+ `;}}window.customElements.define("rustdoc-toolbar",RustdocToolbarElement); \ No newline at end of file diff --git a/compiler-docs/trait.impl/clap/derive/trait.Args.js b/compiler-docs/trait.impl/clap/derive/trait.Args.js new file mode 100644 index 0000000000..02c122eeea --- /dev/null +++ b/compiler-docs/trait.impl/clap/derive/trait.Args.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Args for FelangCli"],["impl Args for BuildArgs"],["impl Args for CheckArgs"],["impl Args for NewProjectArgs"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[559]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/clap/derive/trait.CommandFactory.js b/compiler-docs/trait.impl/clap/derive/trait.CommandFactory.js new file mode 100644 index 0000000000..a6dabb2006 --- /dev/null +++ b/compiler-docs/trait.impl/clap/derive/trait.CommandFactory.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl CommandFactory for FelangCli"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[135]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/clap/derive/trait.FromArgMatches.js b/compiler-docs/trait.impl/clap/derive/trait.FromArgMatches.js new file mode 100644 index 0000000000..936c94ec85 --- /dev/null +++ b/compiler-docs/trait.impl/clap/derive/trait.FromArgMatches.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl FromArgMatches for Commands"],["impl FromArgMatches for FelangCli"],["impl FromArgMatches for BuildArgs"],["impl FromArgMatches for CheckArgs"],["impl FromArgMatches for NewProjectArgs"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[728]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/clap/derive/trait.Parser.js b/compiler-docs/trait.impl/clap/derive/trait.Parser.js new file mode 100644 index 0000000000..5a4c6e3934 --- /dev/null +++ b/compiler-docs/trait.impl/clap/derive/trait.Parser.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Parser for FelangCli"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[127]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/clap/derive/trait.Subcommand.js b/compiler-docs/trait.impl/clap/derive/trait.Subcommand.js new file mode 100644 index 0000000000..be8da5416f --- /dev/null +++ b/compiler-docs/trait.impl/clap/derive/trait.Subcommand.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Subcommand for Commands"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[133]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/clap/derive/trait.ValueEnum.js b/compiler-docs/trait.impl/clap/derive/trait.ValueEnum.js new file mode 100644 index 0000000000..f8a31218fa --- /dev/null +++ b/compiler-docs/trait.impl/clap/derive/trait.ValueEnum.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl ValueEnum for Emit"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[133]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/clone/trait.Clone.js b/compiler-docs/trait.impl/core/clone/trait.Clone.js new file mode 100644 index 0000000000..0c7f8553d5 --- /dev/null +++ b/compiler-docs/trait.impl/core/clone/trait.Clone.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Clone for Emit"]]],["fe_abi",[["impl Clone for AbiFunctionType"],["impl Clone for StateMutability"],["impl Clone for AbiType"],["impl Clone for AbiContract"],["impl Clone for AbiEvent"],["impl Clone for AbiEventField"],["impl Clone for AbiFunction"],["impl Clone for AbiTupleField"]]],["fe_analyzer",[["impl Clone for ContractTypeMethod"],["impl Clone for GlobalFunction"],["impl Clone for Intrinsic"],["impl Clone for ValueMethod"],["impl Clone for AdjustmentKind"],["impl Clone for CallType"],["impl Clone for Constant"],["impl Clone for NamedThing"],["impl Clone for DepLocality"],["impl Clone for EnumVariantKind"],["impl Clone for IngotMode"],["impl Clone for Item"],["impl Clone for ModuleSource"],["impl Clone for TypeDef"],["impl Clone for BlockScopeType"],["impl Clone for Base"],["impl Clone for GenericArg"],["impl Clone for GenericParamKind"],["impl Clone for GenericType"],["impl Clone for Integer"],["impl Clone for TraitOrType"],["impl Clone for Type"],["impl Clone for ConstructorKind"],["impl Clone for LiteralConstructor"],["impl Clone for SimplifiedPatternKind"],["impl Clone for GlobalFunctionIter"],["impl Clone for IntrinsicIter"],["impl Clone for Adjustment"],["impl Clone for DiagnosticVoucher"],["impl Clone for ExpressionAttributes"],["impl Clone for FunctionBody"],["impl Clone for ConstEvalError"],["impl Clone for TypeError"],["impl Clone for Attribute"],["impl Clone for AttributeId"],["impl Clone for Contract"],["impl Clone for ContractField"],["impl Clone for ContractFieldId"],["impl Clone for ContractId"],["impl Clone for DepGraphWrapper"],["impl Clone for Enum"],["impl Clone for EnumId"],["impl Clone for EnumVariant"],["impl Clone for EnumVariantId"],["impl Clone for Function"],["impl Clone for FunctionId"],["impl Clone for FunctionSig"],["impl Clone for FunctionSigId"],["impl Clone for Impl"],["impl Clone for ImplId"],["impl Clone for Ingot"],["impl Clone for IngotId"],["impl Clone for Module"],["impl Clone for ModuleConstant"],["impl Clone for ModuleConstantId"],["impl Clone for ModuleId"],["impl Clone for Struct"],["impl Clone for StructField"],["impl Clone for StructFieldId"],["impl Clone for StructId"],["impl Clone for Trait"],["impl Clone for TraitId"],["impl Clone for TypeAlias"],["impl Clone for TypeAliasId"],["impl Clone for Array"],["impl Clone for CtxDecl"],["impl Clone for FeString"],["impl Clone for FunctionParam"],["impl Clone for FunctionSignature"],["impl Clone for Generic"],["impl Clone for GenericTypeIter"],["impl Clone for IntegerIter"],["impl Clone for Map"],["impl Clone for SelfDecl"],["impl Clone for Tuple"],["impl Clone for TypeId"],["impl Clone for PatternMatrix"],["impl Clone for PatternRowVec"],["impl Clone for SigmaSet"],["impl Clone for SimplifiedPattern"],["impl<T: Clone> Clone for Analysis<T>"]]],["fe_codegen",[["impl Clone for AbiSrcLocation"]]],["fe_common",[["impl Clone for LabelStyle"],["impl Clone for FileKind"],["impl Clone for Radix"],["impl Clone for DependencyKind"],["impl Clone for ProjectMode"],["impl Clone for Diagnostic"],["impl Clone for Label"],["impl Clone for File"],["impl Clone for SourceFileId"],["impl Clone for Span"],["impl Clone for Dependency"],["impl Clone for GitDependency"],["impl Clone for LocalDependency"],["impl<'a> Clone for Literal<'a>"]]],["fe_mir",[["impl Clone for PostIDom"],["impl Clone for CursorLocation"],["impl Clone for ConstantValue"],["impl Clone for Linkage"],["impl Clone for BinOp"],["impl Clone for CallType"],["impl Clone for CastKind"],["impl Clone for InstKind"],["impl Clone for UnOp"],["impl Clone for YulIntrinsicOp"],["impl Clone for TypeKind"],["impl Clone for AssignableValue"],["impl Clone for Value"],["impl Clone for ControlFlowGraph"],["impl Clone for DomTree"],["impl Clone for Loop"],["impl Clone for LoopTree"],["impl Clone for BasicBlock"],["impl Clone for BodyOrder"],["impl Clone for Constant"],["impl Clone for ConstantId"],["impl Clone for BodyDataStore"],["impl Clone for FunctionBody"],["impl Clone for FunctionId"],["impl Clone for FunctionParam"],["impl Clone for FunctionSignature"],["impl Clone for Inst"],["impl Clone for SwitchTable"],["impl Clone for SourceInfo"],["impl Clone for ArrayDef"],["impl Clone for EnumDef"],["impl Clone for EnumVariant"],["impl Clone for EventDef"],["impl Clone for MapDef"],["impl Clone for StructDef"],["impl Clone for TupleDef"],["impl Clone for Type"],["impl Clone for TypeId"],["impl Clone for Local"]]],["fe_parser",[["impl Clone for BinOperator"],["impl Clone for BoolOperator"],["impl Clone for CompOperator"],["impl Clone for ContractStmt"],["impl Clone for Expr"],["impl Clone for FuncStmt"],["impl Clone for FunctionArg"],["impl Clone for GenericArg"],["impl Clone for GenericParameter"],["impl Clone for LiteralPattern"],["impl Clone for ModuleStmt"],["impl Clone for Pattern"],["impl Clone for TypeDesc"],["impl Clone for UnaryOperator"],["impl Clone for UseTree"],["impl Clone for VarDeclTarget"],["impl Clone for VariantKind"],["impl Clone for TokenKind"],["impl Clone for CallArg"],["impl Clone for ConstantDecl"],["impl Clone for Contract"],["impl Clone for Enum"],["impl Clone for Field"],["impl Clone for Function"],["impl Clone for FunctionSignature"],["impl Clone for Impl"],["impl Clone for MatchArm"],["impl Clone for Module"],["impl Clone for Path"],["impl Clone for Pragma"],["impl Clone for Struct"],["impl Clone for Trait"],["impl Clone for TypeAlias"],["impl Clone for Use"],["impl Clone for Variant"],["impl Clone for NodeId"],["impl Clone for ParseFailed"],["impl<'a> Clone for Lexer<'a>"],["impl<'a> Clone for Token<'a>"],["impl<T: Clone> Clone for Node<T>"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[257,2218,24253,314,3930,10770,10802]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/cmp/trait.Eq.js b/compiler-docs/trait.impl/core/cmp/trait.Eq.js new file mode 100644 index 0000000000..741f02b189 --- /dev/null +++ b/compiler-docs/trait.impl/core/cmp/trait.Eq.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Eq for Emit"]]],["fe_abi",[["impl Eq for AbiFunctionType"],["impl Eq for StateMutability"],["impl Eq for AbiType"],["impl Eq for AbiContract"],["impl Eq for AbiEvent"],["impl Eq for AbiEventField"],["impl Eq for AbiFunction"],["impl Eq for AbiTupleField"]]],["fe_analyzer",[["impl Eq for ContractTypeMethod"],["impl Eq for GlobalFunction"],["impl Eq for Intrinsic"],["impl Eq for ValueMethod"],["impl Eq for AdjustmentKind"],["impl Eq for CallType"],["impl Eq for Constant"],["impl Eq for NamedThing"],["impl Eq for BinaryOperationError"],["impl Eq for IndexingError"],["impl Eq for TypeCoercionError"],["impl Eq for DepLocality"],["impl Eq for EnumVariantKind"],["impl Eq for IngotMode"],["impl Eq for Item"],["impl Eq for ModuleSource"],["impl Eq for TypeDef"],["impl Eq for BlockScopeType"],["impl Eq for Base"],["impl Eq for GenericArg"],["impl Eq for GenericParamKind"],["impl Eq for GenericType"],["impl Eq for Integer"],["impl Eq for TraitOrType"],["impl Eq for Type"],["impl Eq for ConstructorKind"],["impl Eq for LiteralConstructor"],["impl Eq for SimplifiedPatternKind"],["impl Eq for Adjustment"],["impl Eq for DiagnosticVoucher"],["impl Eq for ExpressionAttributes"],["impl Eq for FunctionBody"],["impl Eq for ConstEvalError"],["impl Eq for TypeError"],["impl Eq for Attribute"],["impl Eq for AttributeId"],["impl Eq for Contract"],["impl Eq for ContractField"],["impl Eq for ContractFieldId"],["impl Eq for ContractId"],["impl Eq for DepGraphWrapper"],["impl Eq for Enum"],["impl Eq for EnumId"],["impl Eq for EnumVariant"],["impl Eq for EnumVariantId"],["impl Eq for Function"],["impl Eq for FunctionId"],["impl Eq for FunctionSig"],["impl Eq for FunctionSigId"],["impl Eq for Impl"],["impl Eq for ImplId"],["impl Eq for Ingot"],["impl Eq for IngotId"],["impl Eq for Module"],["impl Eq for ModuleConstant"],["impl Eq for ModuleConstantId"],["impl Eq for ModuleId"],["impl Eq for Struct"],["impl Eq for StructField"],["impl Eq for StructFieldId"],["impl Eq for StructId"],["impl Eq for Trait"],["impl Eq for TraitId"],["impl Eq for TypeAlias"],["impl Eq for TypeAliasId"],["impl Eq for Array"],["impl Eq for CtxDecl"],["impl Eq for FeString"],["impl Eq for FunctionParam"],["impl Eq for FunctionSignature"],["impl Eq for Generic"],["impl Eq for Map"],["impl Eq for SelfDecl"],["impl Eq for Tuple"],["impl Eq for TypeId"],["impl Eq for PatternMatrix"],["impl Eq for PatternRowVec"],["impl Eq for SigmaSet"],["impl Eq for SimplifiedPattern"],["impl<T: Eq> Eq for Analysis<T>"]]],["fe_common",[["impl Eq for LabelStyle"],["impl Eq for FileKind"],["impl Eq for Radix"],["impl Eq for ProjectMode"],["impl Eq for Diagnostic"],["impl Eq for Label"],["impl Eq for File"],["impl Eq for SourceFileId"],["impl Eq for Span"]]],["fe_mir",[["impl Eq for PostIDom"],["impl Eq for CursorLocation"],["impl Eq for ConstantValue"],["impl Eq for Linkage"],["impl Eq for BinOp"],["impl Eq for CallType"],["impl Eq for CastKind"],["impl Eq for InstKind"],["impl Eq for UnOp"],["impl Eq for YulIntrinsicOp"],["impl Eq for TypeKind"],["impl Eq for AssignableValue"],["impl Eq for Value"],["impl Eq for ControlFlowGraph"],["impl Eq for Loop"],["impl Eq for BasicBlock"],["impl Eq for BodyOrder"],["impl Eq for Constant"],["impl Eq for ConstantId"],["impl Eq for BodyDataStore"],["impl Eq for FunctionBody"],["impl Eq for FunctionId"],["impl Eq for FunctionParam"],["impl Eq for FunctionSignature"],["impl Eq for Inst"],["impl Eq for SwitchTable"],["impl Eq for SourceInfo"],["impl Eq for ArrayDef"],["impl Eq for EnumDef"],["impl Eq for EnumVariant"],["impl Eq for EventDef"],["impl Eq for MapDef"],["impl Eq for StructDef"],["impl Eq for TupleDef"],["impl Eq for Type"],["impl Eq for TypeId"],["impl Eq for Local"]]],["fe_parser",[["impl Eq for BinOperator"],["impl Eq for BoolOperator"],["impl Eq for CompOperator"],["impl Eq for ContractStmt"],["impl Eq for Expr"],["impl Eq for FuncStmt"],["impl Eq for FunctionArg"],["impl Eq for GenericArg"],["impl Eq for GenericParameter"],["impl Eq for LiteralPattern"],["impl Eq for ModuleStmt"],["impl Eq for Pattern"],["impl Eq for TypeDesc"],["impl Eq for UnaryOperator"],["impl Eq for UseTree"],["impl Eq for VarDeclTarget"],["impl Eq for VariantKind"],["impl Eq for TokenKind"],["impl Eq for CallArg"],["impl Eq for ConstantDecl"],["impl Eq for Contract"],["impl Eq for Enum"],["impl Eq for Field"],["impl Eq for Function"],["impl Eq for FunctionSignature"],["impl Eq for Impl"],["impl Eq for MatchArm"],["impl Eq for Module"],["impl Eq for Path"],["impl Eq for Pragma"],["impl Eq for Struct"],["impl Eq for Trait"],["impl Eq for TypeAlias"],["impl Eq for Use"],["impl Eq for Variant"],["impl Eq for NodeId"],["impl Eq for ParseFailed"],["impl<'a> Eq for Token<'a>"],["impl<T: Eq> Eq for Node<T>"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[244,2114,22863,2336,9714,10001]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/cmp/trait.Ord.js b/compiler-docs/trait.impl/core/cmp/trait.Ord.js new file mode 100644 index 0000000000..0dbbfdf42a --- /dev/null +++ b/compiler-docs/trait.impl/core/cmp/trait.Ord.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Ord for Emit"]]],["fe_analyzer",[["impl Ord for GlobalFunction"],["impl Ord for Intrinsic"],["impl Ord for Item"],["impl Ord for TypeDef"],["impl Ord for Base"],["impl Ord for GenericType"],["impl Ord for Integer"],["impl Ord for AttributeId"],["impl Ord for ContractFieldId"],["impl Ord for ContractId"],["impl Ord for EnumId"],["impl Ord for EnumVariantId"],["impl Ord for FunctionId"],["impl Ord for FunctionSigId"],["impl Ord for ImplId"],["impl Ord for IngotId"],["impl Ord for ModuleConstantId"],["impl Ord for ModuleId"],["impl Ord for StructFieldId"],["impl Ord for StructId"],["impl Ord for TraitId"],["impl Ord for TypeAliasId"],["impl Ord for FeString"],["impl Ord for Generic"],["impl Ord for TypeId"]]],["fe_mir",[["impl Ord for FunctionId"]]],["fe_parser",[["impl Ord for NodeId"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[247,7164,286,268]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/cmp/trait.PartialEq.js b/compiler-docs/trait.impl/core/cmp/trait.PartialEq.js new file mode 100644 index 0000000000..93d2099a6b --- /dev/null +++ b/compiler-docs/trait.impl/core/cmp/trait.PartialEq.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl PartialEq for Emit"]]],["fe_abi",[["impl PartialEq for AbiFunctionType"],["impl PartialEq for StateMutability"],["impl PartialEq for AbiType"],["impl PartialEq for AbiContract"],["impl PartialEq for AbiEvent"],["impl PartialEq for AbiEventField"],["impl PartialEq for AbiFunction"],["impl PartialEq for AbiTupleField"]]],["fe_analyzer",[["impl PartialEq for ContractTypeMethod"],["impl PartialEq for GlobalFunction"],["impl PartialEq for Intrinsic"],["impl PartialEq for ValueMethod"],["impl PartialEq for AdjustmentKind"],["impl PartialEq for CallType"],["impl PartialEq for Constant"],["impl PartialEq for NamedThing"],["impl PartialEq for BinaryOperationError"],["impl PartialEq for IndexingError"],["impl PartialEq for TypeCoercionError"],["impl PartialEq for DepLocality"],["impl PartialEq for EnumVariantKind"],["impl PartialEq for IngotMode"],["impl PartialEq for Item"],["impl PartialEq for ModuleSource"],["impl PartialEq for TypeDef"],["impl PartialEq for BlockScopeType"],["impl PartialEq for Base"],["impl PartialEq for GenericArg"],["impl PartialEq for GenericParamKind"],["impl PartialEq for GenericType"],["impl PartialEq for Integer"],["impl PartialEq for TraitOrType"],["impl PartialEq for Type"],["impl PartialEq for ConstructorKind"],["impl PartialEq for LiteralConstructor"],["impl PartialEq for SimplifiedPatternKind"],["impl PartialEq for Adjustment"],["impl PartialEq for DiagnosticVoucher"],["impl PartialEq for ExpressionAttributes"],["impl PartialEq for FunctionBody"],["impl PartialEq for ConstEvalError"],["impl PartialEq for TypeError"],["impl PartialEq for Attribute"],["impl PartialEq for AttributeId"],["impl PartialEq for Contract"],["impl PartialEq for ContractField"],["impl PartialEq for ContractFieldId"],["impl PartialEq for ContractId"],["impl PartialEq for DepGraphWrapper"],["impl PartialEq for Enum"],["impl PartialEq for EnumId"],["impl PartialEq for EnumVariant"],["impl PartialEq for EnumVariantId"],["impl PartialEq for Function"],["impl PartialEq for FunctionId"],["impl PartialEq for FunctionSig"],["impl PartialEq for FunctionSigId"],["impl PartialEq for Impl"],["impl PartialEq for ImplId"],["impl PartialEq for Ingot"],["impl PartialEq for IngotId"],["impl PartialEq for Module"],["impl PartialEq for ModuleConstant"],["impl PartialEq for ModuleConstantId"],["impl PartialEq for ModuleId"],["impl PartialEq for Struct"],["impl PartialEq for StructField"],["impl PartialEq for StructFieldId"],["impl PartialEq for StructId"],["impl PartialEq for Trait"],["impl PartialEq for TraitId"],["impl PartialEq for TypeAlias"],["impl PartialEq for TypeAliasId"],["impl PartialEq for Array"],["impl PartialEq for CtxDecl"],["impl PartialEq for FeString"],["impl PartialEq for FunctionParam"],["impl PartialEq for FunctionSignature"],["impl PartialEq for Generic"],["impl PartialEq for Map"],["impl PartialEq for SelfDecl"],["impl PartialEq for Tuple"],["impl PartialEq for TypeId"],["impl PartialEq for PatternMatrix"],["impl PartialEq for PatternRowVec"],["impl PartialEq for SigmaSet"],["impl PartialEq for SimplifiedPattern"],["impl<T: PartialEq> PartialEq for Analysis<T>"]]],["fe_common",[["impl PartialEq for LabelStyle"],["impl PartialEq for FileKind"],["impl PartialEq for Radix"],["impl PartialEq for ProjectMode"],["impl PartialEq for Diagnostic"],["impl PartialEq for Label"],["impl PartialEq for File"],["impl PartialEq for SourceFileId"],["impl PartialEq for Span"]]],["fe_mir",[["impl PartialEq for PostIDom"],["impl PartialEq for CursorLocation"],["impl PartialEq for ConstantValue"],["impl PartialEq for Linkage"],["impl PartialEq for BinOp"],["impl PartialEq for CallType"],["impl PartialEq for CastKind"],["impl PartialEq for InstKind"],["impl PartialEq for UnOp"],["impl PartialEq for YulIntrinsicOp"],["impl PartialEq for TypeKind"],["impl PartialEq for AssignableValue"],["impl PartialEq for Value"],["impl PartialEq for ControlFlowGraph"],["impl PartialEq for Loop"],["impl PartialEq for BasicBlock"],["impl PartialEq for BodyOrder"],["impl PartialEq for Constant"],["impl PartialEq for ConstantId"],["impl PartialEq for BodyDataStore"],["impl PartialEq for FunctionBody"],["impl PartialEq for FunctionId"],["impl PartialEq for FunctionParam"],["impl PartialEq for FunctionSignature"],["impl PartialEq for Inst"],["impl PartialEq for SwitchTable"],["impl PartialEq for SourceInfo"],["impl PartialEq for ArrayDef"],["impl PartialEq for EnumDef"],["impl PartialEq for EnumVariant"],["impl PartialEq for EventDef"],["impl PartialEq for MapDef"],["impl PartialEq for StructDef"],["impl PartialEq for TupleDef"],["impl PartialEq for Type"],["impl PartialEq for TypeId"],["impl PartialEq for Local"]]],["fe_parser",[["impl PartialEq for BinOperator"],["impl PartialEq for BoolOperator"],["impl PartialEq for CompOperator"],["impl PartialEq for ContractStmt"],["impl PartialEq for Expr"],["impl PartialEq for FuncStmt"],["impl PartialEq for FunctionArg"],["impl PartialEq for GenericArg"],["impl PartialEq for GenericParameter"],["impl PartialEq for LiteralPattern"],["impl PartialEq for ModuleStmt"],["impl PartialEq for Pattern"],["impl PartialEq for TypeDesc"],["impl PartialEq for UnaryOperator"],["impl PartialEq for UseTree"],["impl PartialEq for VarDeclTarget"],["impl PartialEq for VariantKind"],["impl PartialEq for TokenKind"],["impl PartialEq for CallArg"],["impl PartialEq for ConstantDecl"],["impl PartialEq for Contract"],["impl PartialEq for Enum"],["impl PartialEq for Field"],["impl PartialEq for Function"],["impl PartialEq for FunctionSignature"],["impl PartialEq for Impl"],["impl PartialEq for MatchArm"],["impl PartialEq for Module"],["impl PartialEq for Path"],["impl PartialEq for Pragma"],["impl PartialEq for Struct"],["impl PartialEq for Trait"],["impl PartialEq for TypeAlias"],["impl PartialEq for Use"],["impl PartialEq for Variant"],["impl PartialEq for NodeId"],["impl PartialEq for ParseFailed"],["impl<'a> PartialEq for Token<'a>"],["impl<T: PartialEq> PartialEq for Node<T>"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[265,2282,24564,2525,10491,10841]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/cmp/trait.PartialOrd.js b/compiler-docs/trait.impl/core/cmp/trait.PartialOrd.js new file mode 100644 index 0000000000..3fa21c2b52 --- /dev/null +++ b/compiler-docs/trait.impl/core/cmp/trait.PartialOrd.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl PartialOrd for Emit"]]],["fe_analyzer",[["impl PartialOrd for GlobalFunction"],["impl PartialOrd for Intrinsic"],["impl PartialOrd for Item"],["impl PartialOrd for TypeDef"],["impl PartialOrd for Base"],["impl PartialOrd for GenericType"],["impl PartialOrd for Integer"],["impl PartialOrd for AttributeId"],["impl PartialOrd for ContractFieldId"],["impl PartialOrd for ContractId"],["impl PartialOrd for EnumId"],["impl PartialOrd for EnumVariantId"],["impl PartialOrd for FunctionId"],["impl PartialOrd for FunctionSigId"],["impl PartialOrd for ImplId"],["impl PartialOrd for IngotId"],["impl PartialOrd for ModuleConstantId"],["impl PartialOrd for ModuleId"],["impl PartialOrd for StructFieldId"],["impl PartialOrd for StructId"],["impl PartialOrd for TraitId"],["impl PartialOrd for TypeAliasId"],["impl PartialOrd for FeString"],["impl PartialOrd for Generic"],["impl PartialOrd for TypeId"]]],["fe_mir",[["impl PartialOrd for FunctionId"]]],["fe_parser",[["impl PartialOrd for NodeId"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[268,7689,307,289]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/convert/trait.AsRef.js b/compiler-docs/trait.impl/core/convert/trait.AsRef.js new file mode 100644 index 0000000000..ffe77d3cda --- /dev/null +++ b/compiler-docs/trait.impl/core/convert/trait.AsRef.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl AsRef<str> for ContractTypeMethod"],["impl AsRef<str> for GlobalFunction"],["impl AsRef<str> for Intrinsic"],["impl AsRef<str> for ValueMethod"],["impl AsRef<str> for GenericType"],["impl AsRef<str> for Integer"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[2399]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/convert/trait.From.js b/compiler-docs/trait.impl/core/convert/trait.From.js new file mode 100644 index 0000000000..0fccd7528d --- /dev/null +++ b/compiler-docs/trait.impl/core/convert/trait.From.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl From<Base> for Type"],["impl From<AlreadyDefined> for FatalError"],["impl From<ConstEvalError> for FatalError"],["impl From<ConstEvalError> for TypeError"],["impl From<FatalError> for ConstEvalError"],["impl From<FatalError> for TypeError"],["impl From<IncompleteItem> for ConstEvalError"],["impl From<IncompleteItem> for FatalError"],["impl From<IncompleteItem> for TypeError"],["impl From<TypeError> for ConstEvalError"],["impl From<TypeError> for FatalError"]]],["fe_common",[["impl From<LabelStyle> for LabelStyle"],["impl From<Span> for Range<usize>"]]],["fe_mir",[["impl From<Constant> for ConstantValue"],["impl From<Id<Value>> for AssignableValue"],["impl From<Intrinsic> for YulIntrinsicOp"],["impl<T> From<&Node<T>> for SourceInfo"]]],["fe_parser",[["impl<'a> From<Token<'a>> for Node<SmolStr>"],["impl<T> From<&Node<T>> for NodeId"],["impl<T> From<&Node<T>> for Span"],["impl<T> From<&Box<Node<T>>> for NodeId"],["impl<T> From<&Box<Node<T>>> for Span"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[4775,954,1328,2413]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/convert/trait.TryFrom.js b/compiler-docs/trait.impl/core/convert/trait.TryFrom.js new file mode 100644 index 0000000000..01653698b6 --- /dev/null +++ b/compiler-docs/trait.impl/core/convert/trait.TryFrom.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl TryFrom<&str> for ContractTypeMethod"],["impl TryFrom<&str> for GlobalFunction"],["impl TryFrom<&str> for Intrinsic"],["impl TryFrom<&str> for ValueMethod"],["impl TryFrom<&str> for GenericType"],["impl TryFrom<&str> for Integer"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[2465]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/default/trait.Default.js b/compiler-docs/trait.impl/core/default/trait.Default.js new file mode 100644 index 0000000000..0ea01ffc27 --- /dev/null +++ b/compiler-docs/trait.impl/core/default/trait.Default.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl Default for FunctionBody"],["impl Default for TempContext"],["impl Default for AllImplsQuery"],["impl Default for ContractAllFieldsQuery"],["impl Default for ContractAllFunctionsQuery"],["impl Default for ContractCallFunctionQuery"],["impl Default for ContractDependencyGraphQuery"],["impl Default for ContractFieldMapQuery"],["impl Default for ContractFieldTypeQuery"],["impl Default for ContractFunctionMapQuery"],["impl Default for ContractInitFunctionQuery"],["impl Default for ContractPublicFunctionMapQuery"],["impl Default for ContractRuntimeDependencyGraphQuery"],["impl Default for EnumAllFunctionsQuery"],["impl Default for EnumAllVariantsQuery"],["impl Default for EnumDependencyGraphQuery"],["impl Default for EnumFunctionMapQuery"],["impl Default for EnumVariantKindQuery"],["impl Default for EnumVariantMapQuery"],["impl Default for FunctionBodyQuery"],["impl Default for FunctionDependencyGraphQuery"],["impl Default for FunctionSignatureQuery"],["impl Default for FunctionSigsQuery"],["impl Default for ImplAllFunctionsQuery"],["impl Default for ImplForQuery"],["impl Default for ImplFunctionMapQuery"],["impl Default for IngotExternalIngotsQuery"],["impl Default for IngotFilesQuery"],["impl Default for IngotModulesQuery"],["impl Default for IngotRootModuleQuery"],["impl Default for InternAttributeLookupQuery"],["impl Default for InternAttributeQuery"],["impl Default for InternContractFieldLookupQuery"],["impl Default for InternContractFieldQuery"],["impl Default for InternContractLookupQuery"],["impl Default for InternContractQuery"],["impl Default for InternEnumLookupQuery"],["impl Default for InternEnumQuery"],["impl Default for InternEnumVariantLookupQuery"],["impl Default for InternEnumVariantQuery"],["impl Default for InternFunctionLookupQuery"],["impl Default for InternFunctionQuery"],["impl Default for InternFunctionSigLookupQuery"],["impl Default for InternFunctionSigQuery"],["impl Default for InternImplLookupQuery"],["impl Default for InternImplQuery"],["impl Default for InternIngotLookupQuery"],["impl Default for InternIngotQuery"],["impl Default for InternModuleConstLookupQuery"],["impl Default for InternModuleConstQuery"],["impl Default for InternModuleLookupQuery"],["impl Default for InternModuleQuery"],["impl Default for InternStructFieldLookupQuery"],["impl Default for InternStructFieldQuery"],["impl Default for InternStructLookupQuery"],["impl Default for InternStructQuery"],["impl Default for InternTraitLookupQuery"],["impl Default for InternTraitQuery"],["impl Default for InternTypeAliasLookupQuery"],["impl Default for InternTypeAliasQuery"],["impl Default for InternTypeLookupQuery"],["impl Default for InternTypeQuery"],["impl Default for ModuleAllImplsQuery"],["impl Default for ModuleAllItemsQuery"],["impl Default for ModuleConstantTypeQuery"],["impl Default for ModuleConstantValueQuery"],["impl Default for ModuleConstantsQuery"],["impl Default for ModuleContractsQuery"],["impl Default for ModuleFilePathQuery"],["impl Default for ModuleImplMapQuery"],["impl Default for ModuleIsIncompleteQuery"],["impl Default for ModuleItemMapQuery"],["impl Default for ModuleParentModuleQuery"],["impl Default for ModuleParseQuery"],["impl Default for ModuleStructsQuery"],["impl Default for ModuleSubmodulesQuery"],["impl Default for ModuleTestsQuery"],["impl Default for ModuleUsedItemMapQuery"],["impl Default for RootIngotQuery"],["impl Default for StructAllFieldsQuery"],["impl Default for StructAllFunctionsQuery"],["impl Default for StructDependencyGraphQuery"],["impl Default for StructFieldMapQuery"],["impl Default for StructFieldTypeQuery"],["impl Default for StructFunctionMapQuery"],["impl Default for TestDb"],["impl Default for TraitAllFunctionsQuery"],["impl Default for TraitFunctionMapQuery"],["impl Default for TraitIsImplementedForQuery"],["impl Default for TypeAliasTypeQuery"],["impl Default for AttributeId"],["impl Default for EnumId"],["impl Default for ImplId"],["impl Default for StructId"],["impl Default for TraitId"],["impl Default for TypeId"]]],["fe_codegen",[["impl Default for CodegenAbiContractQuery"],["impl Default for CodegenAbiEventQuery"],["impl Default for CodegenAbiFunctionArgumentMaximumSizeQuery"],["impl Default for CodegenAbiFunctionQuery"],["impl Default for CodegenAbiFunctionReturnMaximumSizeQuery"],["impl Default for CodegenAbiModuleEventsQuery"],["impl Default for CodegenAbiTypeMaximumSizeQuery"],["impl Default for CodegenAbiTypeMinimumSizeQuery"],["impl Default for CodegenAbiTypeQuery"],["impl Default for CodegenConstantStringSymbolNameQuery"],["impl Default for CodegenContractDeployerSymbolNameQuery"],["impl Default for CodegenContractSymbolNameQuery"],["impl Default for CodegenFunctionSymbolNameQuery"],["impl Default for CodegenLegalizedBodyQuery"],["impl Default for CodegenLegalizedSignatureQuery"],["impl Default for CodegenLegalizedTypeQuery"],["impl Default for Db"],["impl Default for Context"],["impl Default for DefaultRuntimeProvider"]]],["fe_common",[["impl Default for FileContentQuery"],["impl Default for FileLineStartsQuery"],["impl Default for FileNameQuery"],["impl Default for InternFileLookupQuery"],["impl Default for InternFileQuery"],["impl Default for TestDb"]]],["fe_compiler_test_utils",[["impl Default for GasReporter"],["impl Default for Runtime"]]],["fe_mir",[["impl Default for DFSet"],["impl Default for LoopTree"],["impl Default for MirInternConstLookupQuery"],["impl Default for MirInternConstQuery"],["impl Default for MirInternFunctionLookupQuery"],["impl Default for MirInternFunctionQuery"],["impl Default for MirInternTypeLookupQuery"],["impl Default for MirInternTypeQuery"],["impl Default for MirLowerContractAllFunctionsQuery"],["impl Default for MirLowerEnumAllFunctionsQuery"],["impl Default for MirLowerModuleAllFunctionsQuery"],["impl Default for MirLowerStructAllFunctionsQuery"],["impl Default for MirLoweredConstantQuery"],["impl Default for MirLoweredFuncBodyQuery"],["impl Default for MirLoweredFuncSignatureQuery"],["impl Default for MirLoweredMonomorphizedFuncSignatureQuery"],["impl Default for MirLoweredPseudoMonomorphizedFuncSignatureQuery"],["impl Default for MirLoweredTypeQuery"],["impl Default for NewDb"],["impl Default for BodyDataStore"],["impl Default for SwitchTable"]]],["fe_parser",[["impl Default for NodeId"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[30367,6351,1786,621,6678,288]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/error/trait.Error.js b/compiler-docs/trait.impl/core/error/trait.Error.js new file mode 100644 index 0000000000..e03787f01d --- /dev/null +++ b/compiler-docs/trait.impl/core/error/trait.Error.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_compiler_test_utils",[["impl Error for SolidityCompileError"]]],["fe_parser",[["impl Error for ParseFailed"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[347,282]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/fmt/trait.Debug.js b/compiler-docs/trait.impl/core/fmt/trait.Debug.js new file mode 100644 index 0000000000..89a68b5186 --- /dev/null +++ b/compiler-docs/trait.impl/core/fmt/trait.Debug.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Debug for Emit"]]],["fe_abi",[["impl Debug for AbiFunctionType"],["impl Debug for StateMutability"],["impl Debug for AbiType"],["impl Debug for AbiContract"],["impl Debug for AbiEvent"],["impl Debug for AbiEventField"],["impl Debug for AbiFunction"],["impl Debug for AbiTupleField"]]],["fe_analyzer",[["impl Debug for ContractTypeMethod"],["impl Debug for GlobalFunction"],["impl Debug for Intrinsic"],["impl Debug for ValueMethod"],["impl Debug for AdjustmentKind"],["impl Debug for CallType"],["impl Debug for Constant"],["impl Debug for NamedThing"],["impl Debug for BinaryOperationError"],["impl Debug for IndexingError"],["impl Debug for TypeCoercionError"],["impl Debug for DepLocality"],["impl Debug for EnumVariantKind"],["impl Debug for IngotMode"],["impl Debug for Item"],["impl Debug for ModuleSource"],["impl Debug for TypeDef"],["impl Debug for BlockScopeType"],["impl Debug for Base"],["impl Debug for GenericArg"],["impl Debug for GenericParamKind"],["impl Debug for GenericType"],["impl Debug for Integer"],["impl Debug for TraitOrType"],["impl Debug for Type"],["impl Debug for ConstructorKind"],["impl Debug for LiteralConstructor"],["impl Debug for SimplifiedPatternKind"],["impl Debug for Adjustment"],["impl Debug for DiagnosticVoucher"],["impl Debug for ExpressionAttributes"],["impl Debug for FunctionBody"],["impl Debug for AllImplsQuery"],["impl Debug for ContractAllFieldsQuery"],["impl Debug for ContractAllFunctionsQuery"],["impl Debug for ContractCallFunctionQuery"],["impl Debug for ContractDependencyGraphQuery"],["impl Debug for ContractFieldMapQuery"],["impl Debug for ContractFieldTypeQuery"],["impl Debug for ContractFunctionMapQuery"],["impl Debug for ContractInitFunctionQuery"],["impl Debug for ContractPublicFunctionMapQuery"],["impl Debug for ContractRuntimeDependencyGraphQuery"],["impl Debug for EnumAllFunctionsQuery"],["impl Debug for EnumAllVariantsQuery"],["impl Debug for EnumDependencyGraphQuery"],["impl Debug for EnumFunctionMapQuery"],["impl Debug for EnumVariantKindQuery"],["impl Debug for EnumVariantMapQuery"],["impl Debug for FunctionBodyQuery"],["impl Debug for FunctionDependencyGraphQuery"],["impl Debug for FunctionSignatureQuery"],["impl Debug for FunctionSigsQuery"],["impl Debug for ImplAllFunctionsQuery"],["impl Debug for ImplForQuery"],["impl Debug for ImplFunctionMapQuery"],["impl Debug for IngotExternalIngotsQuery"],["impl Debug for IngotFilesQuery"],["impl Debug for IngotModulesQuery"],["impl Debug for IngotRootModuleQuery"],["impl Debug for InternAttributeLookupQuery"],["impl Debug for InternAttributeQuery"],["impl Debug for InternContractFieldLookupQuery"],["impl Debug for InternContractFieldQuery"],["impl Debug for InternContractLookupQuery"],["impl Debug for InternContractQuery"],["impl Debug for InternEnumLookupQuery"],["impl Debug for InternEnumQuery"],["impl Debug for InternEnumVariantLookupQuery"],["impl Debug for InternEnumVariantQuery"],["impl Debug for InternFunctionLookupQuery"],["impl Debug for InternFunctionQuery"],["impl Debug for InternFunctionSigLookupQuery"],["impl Debug for InternFunctionSigQuery"],["impl Debug for InternImplLookupQuery"],["impl Debug for InternImplQuery"],["impl Debug for InternIngotLookupQuery"],["impl Debug for InternIngotQuery"],["impl Debug for InternModuleConstLookupQuery"],["impl Debug for InternModuleConstQuery"],["impl Debug for InternModuleLookupQuery"],["impl Debug for InternModuleQuery"],["impl Debug for InternStructFieldLookupQuery"],["impl Debug for InternStructFieldQuery"],["impl Debug for InternStructLookupQuery"],["impl Debug for InternStructQuery"],["impl Debug for InternTraitLookupQuery"],["impl Debug for InternTraitQuery"],["impl Debug for InternTypeAliasLookupQuery"],["impl Debug for InternTypeAliasQuery"],["impl Debug for InternTypeLookupQuery"],["impl Debug for InternTypeQuery"],["impl Debug for ModuleAllImplsQuery"],["impl Debug for ModuleAllItemsQuery"],["impl Debug for ModuleConstantTypeQuery"],["impl Debug for ModuleConstantValueQuery"],["impl Debug for ModuleConstantsQuery"],["impl Debug for ModuleContractsQuery"],["impl Debug for ModuleFilePathQuery"],["impl Debug for ModuleImplMapQuery"],["impl Debug for ModuleIsIncompleteQuery"],["impl Debug for ModuleItemMapQuery"],["impl Debug for ModuleParentModuleQuery"],["impl Debug for ModuleParseQuery"],["impl Debug for ModuleStructsQuery"],["impl Debug for ModuleSubmodulesQuery"],["impl Debug for ModuleTestsQuery"],["impl Debug for ModuleUsedItemMapQuery"],["impl Debug for RootIngotQuery"],["impl Debug for StructAllFieldsQuery"],["impl Debug for StructAllFunctionsQuery"],["impl Debug for StructDependencyGraphQuery"],["impl Debug for StructFieldMapQuery"],["impl Debug for StructFieldTypeQuery"],["impl Debug for StructFunctionMapQuery"],["impl Debug for TraitAllFunctionsQuery"],["impl Debug for TraitFunctionMapQuery"],["impl Debug for TraitIsImplementedForQuery"],["impl Debug for TypeAliasTypeQuery"],["impl Debug for AlreadyDefined"],["impl Debug for ConstEvalError"],["impl Debug for FatalError"],["impl Debug for IncompleteItem"],["impl Debug for TypeError"],["impl Debug for Attribute"],["impl Debug for AttributeId"],["impl Debug for Contract"],["impl Debug for ContractField"],["impl Debug for ContractFieldId"],["impl Debug for ContractId"],["impl Debug for DepGraphWrapper"],["impl Debug for Enum"],["impl Debug for EnumId"],["impl Debug for EnumVariant"],["impl Debug for EnumVariantId"],["impl Debug for Function"],["impl Debug for FunctionId"],["impl Debug for FunctionSig"],["impl Debug for FunctionSigId"],["impl Debug for Impl"],["impl Debug for ImplId"],["impl Debug for Ingot"],["impl Debug for IngotId"],["impl Debug for Module"],["impl Debug for ModuleConstant"],["impl Debug for ModuleConstantId"],["impl Debug for ModuleId"],["impl Debug for Struct"],["impl Debug for StructField"],["impl Debug for StructFieldId"],["impl Debug for StructId"],["impl Debug for Trait"],["impl Debug for TraitId"],["impl Debug for TypeAlias"],["impl Debug for TypeAliasId"],["impl Debug for Array"],["impl Debug for CtxDecl"],["impl Debug for FeString"],["impl Debug for FunctionParam"],["impl Debug for FunctionSignature"],["impl Debug for Generic"],["impl Debug for Map"],["impl Debug for SelfDecl"],["impl Debug for Tuple"],["impl Debug for TypeId"],["impl Debug for PatternMatrix"],["impl Debug for PatternRowVec"],["impl Debug for SigmaSet"],["impl Debug for SimplifiedPattern"],["impl<T: Debug> Debug for Analysis<T>"]]],["fe_codegen",[["impl Debug for AbiSrcLocation"],["impl Debug for CodegenAbiContractQuery"],["impl Debug for CodegenAbiEventQuery"],["impl Debug for CodegenAbiFunctionArgumentMaximumSizeQuery"],["impl Debug for CodegenAbiFunctionQuery"],["impl Debug for CodegenAbiFunctionReturnMaximumSizeQuery"],["impl Debug for CodegenAbiModuleEventsQuery"],["impl Debug for CodegenAbiTypeMaximumSizeQuery"],["impl Debug for CodegenAbiTypeMinimumSizeQuery"],["impl Debug for CodegenAbiTypeQuery"],["impl Debug for CodegenConstantStringSymbolNameQuery"],["impl Debug for CodegenContractDeployerSymbolNameQuery"],["impl Debug for CodegenContractSymbolNameQuery"],["impl Debug for CodegenFunctionSymbolNameQuery"],["impl Debug for CodegenLegalizedBodyQuery"],["impl Debug for CodegenLegalizedSignatureQuery"],["impl Debug for CodegenLegalizedTypeQuery"],["impl Debug for DefaultRuntimeProvider"]]],["fe_common",[["impl Debug for LabelStyle"],["impl Debug for FileKind"],["impl Debug for Radix"],["impl Debug for FileContentQuery"],["impl Debug for FileLineStartsQuery"],["impl Debug for FileNameQuery"],["impl Debug for InternFileLookupQuery"],["impl Debug for InternFileQuery"],["impl Debug for Diagnostic"],["impl Debug for Label"],["impl Debug for File"],["impl Debug for SourceFileId"],["impl Debug for Span"],["impl<'a> Debug for Literal<'a>"]]],["fe_compiler_test_utils",[["impl Debug for GasRecord"],["impl Debug for GasReporter"],["impl Debug for SolidityCompileError"]]],["fe_driver",[["impl Debug for CompileError"]]],["fe_mir",[["impl Debug for PostIDom"],["impl Debug for CursorLocation"],["impl Debug for ConstantValue"],["impl Debug for Linkage"],["impl Debug for BinOp"],["impl Debug for CallType"],["impl Debug for CastKind"],["impl Debug for InstKind"],["impl Debug for UnOp"],["impl Debug for YulIntrinsicOp"],["impl Debug for TypeKind"],["impl Debug for AssignableValue"],["impl Debug for Value"],["impl Debug for ControlFlowGraph"],["impl Debug for DFSet"],["impl Debug for DomTree"],["impl Debug for Loop"],["impl Debug for LoopTree"],["impl Debug for PostDomTree"],["impl Debug for MirInternConstLookupQuery"],["impl Debug for MirInternConstQuery"],["impl Debug for MirInternFunctionLookupQuery"],["impl Debug for MirInternFunctionQuery"],["impl Debug for MirInternTypeLookupQuery"],["impl Debug for MirInternTypeQuery"],["impl Debug for MirLowerContractAllFunctionsQuery"],["impl Debug for MirLowerEnumAllFunctionsQuery"],["impl Debug for MirLowerModuleAllFunctionsQuery"],["impl Debug for MirLowerStructAllFunctionsQuery"],["impl Debug for MirLoweredConstantQuery"],["impl Debug for MirLoweredFuncBodyQuery"],["impl Debug for MirLoweredFuncSignatureQuery"],["impl Debug for MirLoweredMonomorphizedFuncSignatureQuery"],["impl Debug for MirLoweredPseudoMonomorphizedFuncSignatureQuery"],["impl Debug for MirLoweredTypeQuery"],["impl Debug for BasicBlock"],["impl Debug for BodyBuilder"],["impl Debug for BodyOrder"],["impl Debug for Constant"],["impl Debug for ConstantId"],["impl Debug for BodyDataStore"],["impl Debug for FunctionBody"],["impl Debug for FunctionId"],["impl Debug for FunctionParam"],["impl Debug for FunctionSignature"],["impl Debug for Inst"],["impl Debug for SwitchTable"],["impl Debug for SourceInfo"],["impl Debug for ArrayDef"],["impl Debug for EnumDef"],["impl Debug for EnumVariant"],["impl Debug for EventDef"],["impl Debug for MapDef"],["impl Debug for StructDef"],["impl Debug for TupleDef"],["impl Debug for Type"],["impl Debug for TypeId"],["impl Debug for Local"]]],["fe_parser",[["impl Debug for BinOperator"],["impl Debug for BoolOperator"],["impl Debug for CompOperator"],["impl Debug for ContractStmt"],["impl Debug for Expr"],["impl Debug for FuncStmt"],["impl Debug for FunctionArg"],["impl Debug for GenericArg"],["impl Debug for GenericParameter"],["impl Debug for LiteralPattern"],["impl Debug for ModuleStmt"],["impl Debug for Pattern"],["impl Debug for TypeDesc"],["impl Debug for UnaryOperator"],["impl Debug for UseTree"],["impl Debug for VarDeclTarget"],["impl Debug for VariantKind"],["impl Debug for TokenKind"],["impl Debug for CallArg"],["impl Debug for ConstantDecl"],["impl Debug for Contract"],["impl Debug for Enum"],["impl Debug for Field"],["impl Debug for Function"],["impl Debug for FunctionSignature"],["impl Debug for Impl"],["impl Debug for MatchArm"],["impl Debug for Module"],["impl Debug for Path"],["impl Debug for Pragma"],["impl Debug for Struct"],["impl Debug for Trait"],["impl Debug for TypeAlias"],["impl Debug for Use"],["impl Debug for Variant"],["impl Debug for NodeId"],["impl Debug for ParseFailed"],["impl<'a> Debug for Token<'a>"],["impl<T: Debug> Debug for Node<T>"]]],["fe_test_runner",[["impl Debug for TestSink"]]],["fe_yulc",[["impl Debug for YulcError"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[253,2186,50895,5845,3854,914,281,16483,10361,284,266]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/fmt/trait.Display.js b/compiler-docs/trait.impl/core/fmt/trait.Display.js new file mode 100644 index 0000000000..0b5a12a90a --- /dev/null +++ b/compiler-docs/trait.impl/core/fmt/trait.Display.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl Display for CallType"],["impl Display for Base"],["impl Display for Integer"],["impl Display for FeString"],["impl Display for Generic"],["impl<T: DisplayWithDb> Display for DisplayableWrapper<'_, T>"]]],["fe_common",[["impl Display for Diff"]]],["fe_compiler_test_utils",[["impl Display for GasReporter"],["impl Display for SolidityCompileError"]]],["fe_mir",[["impl Display for BinOp"],["impl Display for CallType"],["impl Display for UnOp"],["impl Display for YulIntrinsicOp"]]],["fe_parser",[["impl Display for BinOperator"],["impl Display for BoolOperator"],["impl Display for CompOperator"],["impl Display for ContractStmt"],["impl Display for Expr"],["impl Display for FuncStmt"],["impl Display for FunctionArg"],["impl Display for GenericArg"],["impl Display for GenericParameter"],["impl Display for LiteralPattern"],["impl Display for ModuleStmt"],["impl Display for Pattern"],["impl Display for TypeDesc"],["impl Display for UnaryOperator"],["impl Display for UseTree"],["impl Display for VarDeclTarget"],["impl Display for CallArg"],["impl Display for ConstantDecl"],["impl Display for Contract"],["impl Display for Enum"],["impl Display for Field"],["impl Display for Function"],["impl Display for Impl"],["impl Display for MatchArm"],["impl Display for Module"],["impl Display for Path"],["impl Display for Pragma"],["impl Display for Struct"],["impl Display for Trait"],["impl Display for TypeAlias"],["impl Display for Use"],["impl Display for Variant"],["impl Display for Node<Function>"],["impl Display for ParseFailed"]]],["fe_test_runner",[["impl Display for TestSink"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1925,285,644,1070,9190,290]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/hash/trait.Hash.js b/compiler-docs/trait.impl/core/hash/trait.Hash.js new file mode 100644 index 0000000000..412556a2df --- /dev/null +++ b/compiler-docs/trait.impl/core/hash/trait.Hash.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl Hash for GlobalFunction"],["impl Hash for Intrinsic"],["impl Hash for ValueMethod"],["impl Hash for EnumVariantKind"],["impl Hash for IngotMode"],["impl Hash for Item"],["impl Hash for ModuleSource"],["impl Hash for TypeDef"],["impl Hash for Base"],["impl Hash for GenericArg"],["impl Hash for GenericParamKind"],["impl Hash for GenericType"],["impl Hash for Integer"],["impl Hash for TraitOrType"],["impl Hash for Type"],["impl Hash for ConstructorKind"],["impl Hash for LiteralConstructor"],["impl Hash for DiagnosticVoucher"],["impl Hash for ConstEvalError"],["impl Hash for TypeError"],["impl Hash for Attribute"],["impl Hash for AttributeId"],["impl Hash for Contract"],["impl Hash for ContractField"],["impl Hash for ContractFieldId"],["impl Hash for ContractId"],["impl Hash for Enum"],["impl Hash for EnumId"],["impl Hash for EnumVariant"],["impl Hash for EnumVariantId"],["impl Hash for Function"],["impl Hash for FunctionId"],["impl Hash for FunctionSig"],["impl Hash for FunctionSigId"],["impl Hash for Impl"],["impl Hash for ImplId"],["impl Hash for Ingot"],["impl Hash for IngotId"],["impl Hash for Module"],["impl Hash for ModuleConstant"],["impl Hash for ModuleConstantId"],["impl Hash for ModuleId"],["impl Hash for Struct"],["impl Hash for StructField"],["impl Hash for StructFieldId"],["impl Hash for StructId"],["impl Hash for Trait"],["impl Hash for TraitId"],["impl Hash for TypeAlias"],["impl Hash for TypeAliasId"],["impl Hash for Array"],["impl Hash for CtxDecl"],["impl Hash for FeString"],["impl Hash for FunctionParam"],["impl Hash for FunctionSignature"],["impl Hash for Generic"],["impl Hash for Map"],["impl Hash for SelfDecl"],["impl Hash for Tuple"],["impl Hash for TypeId"],["impl<T: Hash> Hash for Analysis<T>"]]],["fe_common",[["impl Hash for LabelStyle"],["impl Hash for FileKind"],["impl Hash for Diagnostic"],["impl Hash for Label"],["impl Hash for File"],["impl Hash for SourceFileId"],["impl Hash for Span"]]],["fe_mir",[["impl Hash for ConstantValue"],["impl Hash for Linkage"],["impl Hash for BinOp"],["impl Hash for CallType"],["impl Hash for CastKind"],["impl Hash for InstKind"],["impl Hash for UnOp"],["impl Hash for YulIntrinsicOp"],["impl Hash for TypeKind"],["impl Hash for AssignableValue"],["impl Hash for Value"],["impl Hash for BasicBlock"],["impl Hash for Constant"],["impl Hash for ConstantId"],["impl Hash for FunctionId"],["impl Hash for FunctionParam"],["impl Hash for FunctionSignature"],["impl Hash for Inst"],["impl Hash for SwitchTable"],["impl Hash for SourceInfo"],["impl Hash for ArrayDef"],["impl Hash for EnumDef"],["impl Hash for EnumVariant"],["impl Hash for EventDef"],["impl Hash for MapDef"],["impl Hash for StructDef"],["impl Hash for TupleDef"],["impl Hash for Type"],["impl Hash for TypeId"],["impl Hash for Local"]]],["fe_parser",[["impl Hash for BinOperator"],["impl Hash for BoolOperator"],["impl Hash for CompOperator"],["impl Hash for ContractStmt"],["impl Hash for Expr"],["impl Hash for FuncStmt"],["impl Hash for FunctionArg"],["impl Hash for GenericArg"],["impl Hash for GenericParameter"],["impl Hash for LiteralPattern"],["impl Hash for ModuleStmt"],["impl Hash for Pattern"],["impl Hash for TypeDesc"],["impl Hash for UnaryOperator"],["impl Hash for UseTree"],["impl Hash for VarDeclTarget"],["impl Hash for VariantKind"],["impl Hash for CallArg"],["impl Hash for ConstantDecl"],["impl Hash for Contract"],["impl Hash for Enum"],["impl Hash for Field"],["impl Hash for Function"],["impl Hash for FunctionSignature"],["impl Hash for Impl"],["impl Hash for MatchArm"],["impl Hash for Module"],["impl Hash for Path"],["impl Hash for Pragma"],["impl Hash for Struct"],["impl Hash for Trait"],["impl Hash for TypeAlias"],["impl Hash for Use"],["impl Hash for Variant"],["impl Hash for NodeId"],["impl Hash for ParseFailed"],["impl<T: Hash> Hash for Node<T>"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[17920,1873,8012,9783]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/iter/traits/collect/trait.IntoIterator.js b/compiler-docs/trait.impl/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 0000000000..3d20b8b3e4 --- /dev/null +++ b/compiler-docs/trait.impl/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl IntoIterator for SigmaSet"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[364]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/iter/traits/double_ended/trait.DoubleEndedIterator.js b/compiler-docs/trait.impl/core/iter/traits/double_ended/trait.DoubleEndedIterator.js new file mode 100644 index 0000000000..0dbc47682d --- /dev/null +++ b/compiler-docs/trait.impl/core/iter/traits/double_ended/trait.DoubleEndedIterator.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl DoubleEndedIterator for GlobalFunctionIter"],["impl DoubleEndedIterator for IntrinsicIter"],["impl DoubleEndedIterator for GenericTypeIter"],["impl DoubleEndedIterator for IntegerIter"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1570]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/iter/traits/exact_size/trait.ExactSizeIterator.js b/compiler-docs/trait.impl/core/iter/traits/exact_size/trait.ExactSizeIterator.js new file mode 100644 index 0000000000..b803a61272 --- /dev/null +++ b/compiler-docs/trait.impl/core/iter/traits/exact_size/trait.ExactSizeIterator.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl ExactSizeIterator for GlobalFunctionIter"],["impl ExactSizeIterator for IntrinsicIter"],["impl ExactSizeIterator for GenericTypeIter"],["impl ExactSizeIterator for IntegerIter"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1530]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/iter/traits/iterator/trait.Iterator.js b/compiler-docs/trait.impl/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 0000000000..05081a2b2c --- /dev/null +++ b/compiler-docs/trait.impl/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl Iterator for GlobalFunctionIter"],["impl Iterator for IntrinsicIter"],["impl Iterator for GenericTypeIter"],["impl Iterator for IntegerIter"]]],["fe_mir",[["impl<'a> Iterator for CfgPostOrder<'a>"],["impl<'a, 'b> Iterator for BlocksInLoopPostOrder<'a, 'b>"],["impl<'a, T> Iterator for IterBase<'a, T>
where\n T: Copy,
"],["impl<'a, T> Iterator for IterMutBase<'a, T>"]]],["fe_parser",[["impl<'a> Iterator for Lexer<'a>"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1406,1607,338]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/marker/trait.Copy.js b/compiler-docs/trait.impl/core/marker/trait.Copy.js new file mode 100644 index 0000000000..ca4d19edf1 --- /dev/null +++ b/compiler-docs/trait.impl/core/marker/trait.Copy.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Copy for Emit"]]],["fe_abi",[["impl Copy for AbiFunctionType"]]],["fe_analyzer",[["impl Copy for ContractTypeMethod"],["impl Copy for GlobalFunction"],["impl Copy for Intrinsic"],["impl Copy for ValueMethod"],["impl Copy for AdjustmentKind"],["impl Copy for DepLocality"],["impl Copy for IngotMode"],["impl Copy for Item"],["impl Copy for TypeDef"],["impl Copy for Base"],["impl Copy for GenericParamKind"],["impl Copy for GenericType"],["impl Copy for Integer"],["impl Copy for ConstructorKind"],["impl Copy for LiteralConstructor"],["impl Copy for Adjustment"],["impl Copy for AttributeId"],["impl Copy for ContractFieldId"],["impl Copy for ContractId"],["impl Copy for EnumId"],["impl Copy for EnumVariantId"],["impl Copy for FunctionId"],["impl Copy for FunctionSigId"],["impl Copy for ImplId"],["impl Copy for IngotId"],["impl Copy for ModuleConstantId"],["impl Copy for ModuleId"],["impl Copy for StructFieldId"],["impl Copy for StructId"],["impl Copy for TraitId"],["impl Copy for TypeAliasId"],["impl Copy for Array"],["impl Copy for CtxDecl"],["impl Copy for FeString"],["impl Copy for SelfDecl"],["impl Copy for TypeId"]]],["fe_codegen",[["impl Copy for AbiSrcLocation"]]],["fe_common",[["impl Copy for LabelStyle"],["impl Copy for FileKind"],["impl Copy for Radix"],["impl Copy for ProjectMode"],["impl Copy for SourceFileId"],["impl Copy for Span"]]],["fe_mir",[["impl Copy for PostIDom"],["impl Copy for CursorLocation"],["impl Copy for Linkage"],["impl Copy for BinOp"],["impl Copy for CallType"],["impl Copy for UnOp"],["impl Copy for YulIntrinsicOp"],["impl Copy for BasicBlock"],["impl Copy for ConstantId"],["impl Copy for FunctionId"],["impl Copy for MapDef"],["impl Copy for TypeId"]]],["fe_parser",[["impl Copy for BinOperator"],["impl Copy for BoolOperator"],["impl Copy for CompOperator"],["impl Copy for LiteralPattern"],["impl Copy for UnaryOperator"],["impl Copy for TokenKind"],["impl Copy for NodeId"],["impl Copy for ParseFailed"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[256,297,10654,313,1628,3289,2169]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/marker/trait.Freeze.js b/compiler-docs/trait.impl/core/marker/trait.Freeze.js new file mode 100644 index 0000000000..33f2a6af3a --- /dev/null +++ b/compiler-docs/trait.impl/core/marker/trait.Freeze.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Freeze for Emit",1,["fe::task::build::Emit"]],["impl Freeze for Commands",1,["fe::task::Commands"]],["impl Freeze for FelangCli",1,["fe::FelangCli"]],["impl Freeze for BuildArgs",1,["fe::task::build::BuildArgs"]],["impl Freeze for CheckArgs",1,["fe::task::check::CheckArgs"]],["impl Freeze for NewProjectArgs",1,["fe::task::new::NewProjectArgs"]]]],["fe_abi",[["impl Freeze for AbiFunctionType",1,["fe_abi::function::AbiFunctionType"]],["impl Freeze for CtxParam",1,["fe_abi::function::CtxParam"]],["impl Freeze for SelfParam",1,["fe_abi::function::SelfParam"]],["impl Freeze for StateMutability",1,["fe_abi::function::StateMutability"]],["impl Freeze for AbiType",1,["fe_abi::types::AbiType"]],["impl Freeze for AbiContract",1,["fe_abi::contract::AbiContract"]],["impl Freeze for AbiEvent",1,["fe_abi::event::AbiEvent"]],["impl Freeze for AbiEventField",1,["fe_abi::event::AbiEventField"]],["impl Freeze for AbiEventSignature",1,["fe_abi::event::AbiEventSignature"]],["impl Freeze for AbiFunction",1,["fe_abi::function::AbiFunction"]],["impl Freeze for AbiFunctionSelector",1,["fe_abi::function::AbiFunctionSelector"]],["impl Freeze for AbiTupleField",1,["fe_abi::types::AbiTupleField"]]]],["fe_analyzer",[["impl !Freeze for TempContext",1,["fe_analyzer::context::TempContext"]],["impl !Freeze for TestDb",1,["fe_analyzer::db::TestDb"]],["impl Freeze for ContractTypeMethod",1,["fe_analyzer::builtins::ContractTypeMethod"]],["impl Freeze for GlobalFunction",1,["fe_analyzer::builtins::GlobalFunction"]],["impl Freeze for Intrinsic",1,["fe_analyzer::builtins::Intrinsic"]],["impl Freeze for ValueMethod",1,["fe_analyzer::builtins::ValueMethod"]],["impl Freeze for AdjustmentKind",1,["fe_analyzer::context::AdjustmentKind"]],["impl Freeze for CallType",1,["fe_analyzer::context::CallType"]],["impl Freeze for Constant",1,["fe_analyzer::context::Constant"]],["impl Freeze for NamedThing",1,["fe_analyzer::context::NamedThing"]],["impl Freeze for BinaryOperationError",1,["fe_analyzer::errors::BinaryOperationError"]],["impl Freeze for IndexingError",1,["fe_analyzer::errors::IndexingError"]],["impl Freeze for TypeCoercionError",1,["fe_analyzer::errors::TypeCoercionError"]],["impl Freeze for DepLocality",1,["fe_analyzer::namespace::items::DepLocality"]],["impl Freeze for EnumVariantKind",1,["fe_analyzer::namespace::items::EnumVariantKind"]],["impl Freeze for IngotMode",1,["fe_analyzer::namespace::items::IngotMode"]],["impl Freeze for Item",1,["fe_analyzer::namespace::items::Item"]],["impl Freeze for ModuleSource",1,["fe_analyzer::namespace::items::ModuleSource"]],["impl Freeze for TypeDef",1,["fe_analyzer::namespace::items::TypeDef"]],["impl Freeze for BlockScopeType",1,["fe_analyzer::namespace::scopes::BlockScopeType"]],["impl Freeze for Base",1,["fe_analyzer::namespace::types::Base"]],["impl Freeze for GenericArg",1,["fe_analyzer::namespace::types::GenericArg"]],["impl Freeze for GenericParamKind",1,["fe_analyzer::namespace::types::GenericParamKind"]],["impl Freeze for GenericType",1,["fe_analyzer::namespace::types::GenericType"]],["impl Freeze for Integer",1,["fe_analyzer::namespace::types::Integer"]],["impl Freeze for TraitOrType",1,["fe_analyzer::namespace::types::TraitOrType"]],["impl Freeze for Type",1,["fe_analyzer::namespace::types::Type"]],["impl Freeze for ConstructorKind",1,["fe_analyzer::traversal::pattern_analysis::ConstructorKind"]],["impl Freeze for LiteralConstructor",1,["fe_analyzer::traversal::pattern_analysis::LiteralConstructor"]],["impl Freeze for SimplifiedPatternKind",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPatternKind"]],["impl Freeze for GlobalFunctionIter",1,["fe_analyzer::builtins::GlobalFunctionIter"]],["impl Freeze for IntrinsicIter",1,["fe_analyzer::builtins::IntrinsicIter"]],["impl Freeze for Adjustment",1,["fe_analyzer::context::Adjustment"]],["impl Freeze for DiagnosticVoucher",1,["fe_analyzer::context::DiagnosticVoucher"]],["impl Freeze for ExpressionAttributes",1,["fe_analyzer::context::ExpressionAttributes"]],["impl Freeze for FunctionBody",1,["fe_analyzer::context::FunctionBody"]],["impl Freeze for AllImplsQuery",1,["fe_analyzer::db::AllImplsQuery"]],["impl Freeze for AnalyzerDbGroupStorage__",1,["fe_analyzer::db::AnalyzerDbGroupStorage__"]],["impl Freeze for AnalyzerDbStorage",1,["fe_analyzer::db::AnalyzerDbStorage"]],["impl Freeze for ContractAllFieldsQuery",1,["fe_analyzer::db::ContractAllFieldsQuery"]],["impl Freeze for ContractAllFunctionsQuery",1,["fe_analyzer::db::ContractAllFunctionsQuery"]],["impl Freeze for ContractCallFunctionQuery",1,["fe_analyzer::db::ContractCallFunctionQuery"]],["impl Freeze for ContractDependencyGraphQuery",1,["fe_analyzer::db::ContractDependencyGraphQuery"]],["impl Freeze for ContractFieldMapQuery",1,["fe_analyzer::db::ContractFieldMapQuery"]],["impl Freeze for ContractFieldTypeQuery",1,["fe_analyzer::db::ContractFieldTypeQuery"]],["impl Freeze for ContractFunctionMapQuery",1,["fe_analyzer::db::ContractFunctionMapQuery"]],["impl Freeze for ContractInitFunctionQuery",1,["fe_analyzer::db::ContractInitFunctionQuery"]],["impl Freeze for ContractPublicFunctionMapQuery",1,["fe_analyzer::db::ContractPublicFunctionMapQuery"]],["impl Freeze for ContractRuntimeDependencyGraphQuery",1,["fe_analyzer::db::ContractRuntimeDependencyGraphQuery"]],["impl Freeze for EnumAllFunctionsQuery",1,["fe_analyzer::db::EnumAllFunctionsQuery"]],["impl Freeze for EnumAllVariantsQuery",1,["fe_analyzer::db::EnumAllVariantsQuery"]],["impl Freeze for EnumDependencyGraphQuery",1,["fe_analyzer::db::EnumDependencyGraphQuery"]],["impl Freeze for EnumFunctionMapQuery",1,["fe_analyzer::db::EnumFunctionMapQuery"]],["impl Freeze for EnumVariantKindQuery",1,["fe_analyzer::db::EnumVariantKindQuery"]],["impl Freeze for EnumVariantMapQuery",1,["fe_analyzer::db::EnumVariantMapQuery"]],["impl Freeze for FunctionBodyQuery",1,["fe_analyzer::db::FunctionBodyQuery"]],["impl Freeze for FunctionDependencyGraphQuery",1,["fe_analyzer::db::FunctionDependencyGraphQuery"]],["impl Freeze for FunctionSignatureQuery",1,["fe_analyzer::db::FunctionSignatureQuery"]],["impl Freeze for FunctionSigsQuery",1,["fe_analyzer::db::FunctionSigsQuery"]],["impl Freeze for ImplAllFunctionsQuery",1,["fe_analyzer::db::ImplAllFunctionsQuery"]],["impl Freeze for ImplForQuery",1,["fe_analyzer::db::ImplForQuery"]],["impl Freeze for ImplFunctionMapQuery",1,["fe_analyzer::db::ImplFunctionMapQuery"]],["impl Freeze for IngotExternalIngotsQuery",1,["fe_analyzer::db::IngotExternalIngotsQuery"]],["impl Freeze for IngotFilesQuery",1,["fe_analyzer::db::IngotFilesQuery"]],["impl Freeze for IngotModulesQuery",1,["fe_analyzer::db::IngotModulesQuery"]],["impl Freeze for IngotRootModuleQuery",1,["fe_analyzer::db::IngotRootModuleQuery"]],["impl Freeze for InternAttributeLookupQuery",1,["fe_analyzer::db::InternAttributeLookupQuery"]],["impl Freeze for InternAttributeQuery",1,["fe_analyzer::db::InternAttributeQuery"]],["impl Freeze for InternContractFieldLookupQuery",1,["fe_analyzer::db::InternContractFieldLookupQuery"]],["impl Freeze for InternContractFieldQuery",1,["fe_analyzer::db::InternContractFieldQuery"]],["impl Freeze for InternContractLookupQuery",1,["fe_analyzer::db::InternContractLookupQuery"]],["impl Freeze for InternContractQuery",1,["fe_analyzer::db::InternContractQuery"]],["impl Freeze for InternEnumLookupQuery",1,["fe_analyzer::db::InternEnumLookupQuery"]],["impl Freeze for InternEnumQuery",1,["fe_analyzer::db::InternEnumQuery"]],["impl Freeze for InternEnumVariantLookupQuery",1,["fe_analyzer::db::InternEnumVariantLookupQuery"]],["impl Freeze for InternEnumVariantQuery",1,["fe_analyzer::db::InternEnumVariantQuery"]],["impl Freeze for InternFunctionLookupQuery",1,["fe_analyzer::db::InternFunctionLookupQuery"]],["impl Freeze for InternFunctionQuery",1,["fe_analyzer::db::InternFunctionQuery"]],["impl Freeze for InternFunctionSigLookupQuery",1,["fe_analyzer::db::InternFunctionSigLookupQuery"]],["impl Freeze for InternFunctionSigQuery",1,["fe_analyzer::db::InternFunctionSigQuery"]],["impl Freeze for InternImplLookupQuery",1,["fe_analyzer::db::InternImplLookupQuery"]],["impl Freeze for InternImplQuery",1,["fe_analyzer::db::InternImplQuery"]],["impl Freeze for InternIngotLookupQuery",1,["fe_analyzer::db::InternIngotLookupQuery"]],["impl Freeze for InternIngotQuery",1,["fe_analyzer::db::InternIngotQuery"]],["impl Freeze for InternModuleConstLookupQuery",1,["fe_analyzer::db::InternModuleConstLookupQuery"]],["impl Freeze for InternModuleConstQuery",1,["fe_analyzer::db::InternModuleConstQuery"]],["impl Freeze for InternModuleLookupQuery",1,["fe_analyzer::db::InternModuleLookupQuery"]],["impl Freeze for InternModuleQuery",1,["fe_analyzer::db::InternModuleQuery"]],["impl Freeze for InternStructFieldLookupQuery",1,["fe_analyzer::db::InternStructFieldLookupQuery"]],["impl Freeze for InternStructFieldQuery",1,["fe_analyzer::db::InternStructFieldQuery"]],["impl Freeze for InternStructLookupQuery",1,["fe_analyzer::db::InternStructLookupQuery"]],["impl Freeze for InternStructQuery",1,["fe_analyzer::db::InternStructQuery"]],["impl Freeze for InternTraitLookupQuery",1,["fe_analyzer::db::InternTraitLookupQuery"]],["impl Freeze for InternTraitQuery",1,["fe_analyzer::db::InternTraitQuery"]],["impl Freeze for InternTypeAliasLookupQuery",1,["fe_analyzer::db::InternTypeAliasLookupQuery"]],["impl Freeze for InternTypeAliasQuery",1,["fe_analyzer::db::InternTypeAliasQuery"]],["impl Freeze for InternTypeLookupQuery",1,["fe_analyzer::db::InternTypeLookupQuery"]],["impl Freeze for InternTypeQuery",1,["fe_analyzer::db::InternTypeQuery"]],["impl Freeze for ModuleAllImplsQuery",1,["fe_analyzer::db::ModuleAllImplsQuery"]],["impl Freeze for ModuleAllItemsQuery",1,["fe_analyzer::db::ModuleAllItemsQuery"]],["impl Freeze for ModuleConstantTypeQuery",1,["fe_analyzer::db::ModuleConstantTypeQuery"]],["impl Freeze for ModuleConstantValueQuery",1,["fe_analyzer::db::ModuleConstantValueQuery"]],["impl Freeze for ModuleConstantsQuery",1,["fe_analyzer::db::ModuleConstantsQuery"]],["impl Freeze for ModuleContractsQuery",1,["fe_analyzer::db::ModuleContractsQuery"]],["impl Freeze for ModuleFilePathQuery",1,["fe_analyzer::db::ModuleFilePathQuery"]],["impl Freeze for ModuleImplMapQuery",1,["fe_analyzer::db::ModuleImplMapQuery"]],["impl Freeze for ModuleIsIncompleteQuery",1,["fe_analyzer::db::ModuleIsIncompleteQuery"]],["impl Freeze for ModuleItemMapQuery",1,["fe_analyzer::db::ModuleItemMapQuery"]],["impl Freeze for ModuleParentModuleQuery",1,["fe_analyzer::db::ModuleParentModuleQuery"]],["impl Freeze for ModuleParseQuery",1,["fe_analyzer::db::ModuleParseQuery"]],["impl Freeze for ModuleStructsQuery",1,["fe_analyzer::db::ModuleStructsQuery"]],["impl Freeze for ModuleSubmodulesQuery",1,["fe_analyzer::db::ModuleSubmodulesQuery"]],["impl Freeze for ModuleTestsQuery",1,["fe_analyzer::db::ModuleTestsQuery"]],["impl Freeze for ModuleUsedItemMapQuery",1,["fe_analyzer::db::ModuleUsedItemMapQuery"]],["impl Freeze for RootIngotQuery",1,["fe_analyzer::db::RootIngotQuery"]],["impl Freeze for StructAllFieldsQuery",1,["fe_analyzer::db::StructAllFieldsQuery"]],["impl Freeze for StructAllFunctionsQuery",1,["fe_analyzer::db::StructAllFunctionsQuery"]],["impl Freeze for StructDependencyGraphQuery",1,["fe_analyzer::db::StructDependencyGraphQuery"]],["impl Freeze for StructFieldMapQuery",1,["fe_analyzer::db::StructFieldMapQuery"]],["impl Freeze for StructFieldTypeQuery",1,["fe_analyzer::db::StructFieldTypeQuery"]],["impl Freeze for StructFunctionMapQuery",1,["fe_analyzer::db::StructFunctionMapQuery"]],["impl Freeze for TraitAllFunctionsQuery",1,["fe_analyzer::db::TraitAllFunctionsQuery"]],["impl Freeze for TraitFunctionMapQuery",1,["fe_analyzer::db::TraitFunctionMapQuery"]],["impl Freeze for TraitIsImplementedForQuery",1,["fe_analyzer::db::TraitIsImplementedForQuery"]],["impl Freeze for TypeAliasTypeQuery",1,["fe_analyzer::db::TypeAliasTypeQuery"]],["impl Freeze for AlreadyDefined",1,["fe_analyzer::errors::AlreadyDefined"]],["impl Freeze for ConstEvalError",1,["fe_analyzer::errors::ConstEvalError"]],["impl Freeze for FatalError",1,["fe_analyzer::errors::FatalError"]],["impl Freeze for IncompleteItem",1,["fe_analyzer::errors::IncompleteItem"]],["impl Freeze for TypeError",1,["fe_analyzer::errors::TypeError"]],["impl Freeze for Attribute",1,["fe_analyzer::namespace::items::Attribute"]],["impl Freeze for AttributeId",1,["fe_analyzer::namespace::items::AttributeId"]],["impl Freeze for Contract",1,["fe_analyzer::namespace::items::Contract"]],["impl Freeze for ContractField",1,["fe_analyzer::namespace::items::ContractField"]],["impl Freeze for ContractFieldId",1,["fe_analyzer::namespace::items::ContractFieldId"]],["impl Freeze for ContractId",1,["fe_analyzer::namespace::items::ContractId"]],["impl Freeze for DepGraphWrapper",1,["fe_analyzer::namespace::items::DepGraphWrapper"]],["impl Freeze for Enum",1,["fe_analyzer::namespace::items::Enum"]],["impl Freeze for EnumId",1,["fe_analyzer::namespace::items::EnumId"]],["impl Freeze for EnumVariant",1,["fe_analyzer::namespace::items::EnumVariant"]],["impl Freeze for EnumVariantId",1,["fe_analyzer::namespace::items::EnumVariantId"]],["impl Freeze for Function",1,["fe_analyzer::namespace::items::Function"]],["impl Freeze for FunctionId",1,["fe_analyzer::namespace::items::FunctionId"]],["impl Freeze for FunctionSig",1,["fe_analyzer::namespace::items::FunctionSig"]],["impl Freeze for FunctionSigId",1,["fe_analyzer::namespace::items::FunctionSigId"]],["impl Freeze for Impl",1,["fe_analyzer::namespace::items::Impl"]],["impl Freeze for ImplId",1,["fe_analyzer::namespace::items::ImplId"]],["impl Freeze for Ingot",1,["fe_analyzer::namespace::items::Ingot"]],["impl Freeze for IngotId",1,["fe_analyzer::namespace::items::IngotId"]],["impl Freeze for Module",1,["fe_analyzer::namespace::items::Module"]],["impl Freeze for ModuleConstant",1,["fe_analyzer::namespace::items::ModuleConstant"]],["impl Freeze for ModuleConstantId",1,["fe_analyzer::namespace::items::ModuleConstantId"]],["impl Freeze for ModuleId",1,["fe_analyzer::namespace::items::ModuleId"]],["impl Freeze for Struct",1,["fe_analyzer::namespace::items::Struct"]],["impl Freeze for StructField",1,["fe_analyzer::namespace::items::StructField"]],["impl Freeze for StructFieldId",1,["fe_analyzer::namespace::items::StructFieldId"]],["impl Freeze for StructId",1,["fe_analyzer::namespace::items::StructId"]],["impl Freeze for Trait",1,["fe_analyzer::namespace::items::Trait"]],["impl Freeze for TraitId",1,["fe_analyzer::namespace::items::TraitId"]],["impl Freeze for TypeAlias",1,["fe_analyzer::namespace::items::TypeAlias"]],["impl Freeze for TypeAliasId",1,["fe_analyzer::namespace::items::TypeAliasId"]],["impl Freeze for Array",1,["fe_analyzer::namespace::types::Array"]],["impl Freeze for CtxDecl",1,["fe_analyzer::namespace::types::CtxDecl"]],["impl Freeze for FeString",1,["fe_analyzer::namespace::types::FeString"]],["impl Freeze for FunctionParam",1,["fe_analyzer::namespace::types::FunctionParam"]],["impl Freeze for FunctionSignature",1,["fe_analyzer::namespace::types::FunctionSignature"]],["impl Freeze for Generic",1,["fe_analyzer::namespace::types::Generic"]],["impl Freeze for GenericParam",1,["fe_analyzer::namespace::types::GenericParam"]],["impl Freeze for GenericTypeIter",1,["fe_analyzer::namespace::types::GenericTypeIter"]],["impl Freeze for IntegerIter",1,["fe_analyzer::namespace::types::IntegerIter"]],["impl Freeze for Map",1,["fe_analyzer::namespace::types::Map"]],["impl Freeze for SelfDecl",1,["fe_analyzer::namespace::types::SelfDecl"]],["impl Freeze for Tuple",1,["fe_analyzer::namespace::types::Tuple"]],["impl Freeze for TypeId",1,["fe_analyzer::namespace::types::TypeId"]],["impl Freeze for PatternMatrix",1,["fe_analyzer::traversal::pattern_analysis::PatternMatrix"]],["impl Freeze for PatternRowVec",1,["fe_analyzer::traversal::pattern_analysis::PatternRowVec"]],["impl Freeze for SigmaSet",1,["fe_analyzer::traversal::pattern_analysis::SigmaSet"]],["impl Freeze for SimplifiedPattern",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPattern"]],["impl<'a> !Freeze for FunctionScope<'a>",1,["fe_analyzer::namespace::scopes::FunctionScope"]],["impl<'a> !Freeze for ItemScope<'a>",1,["fe_analyzer::namespace::scopes::ItemScope"]],["impl<'a, 'b> !Freeze for BlockScope<'a, 'b>",1,["fe_analyzer::namespace::scopes::BlockScope"]],["impl<'a, T> Freeze for DisplayableWrapper<'a, T>
where\n T: Freeze,
",1,["fe_analyzer::display::DisplayableWrapper"]],["impl<T> Freeze for Analysis<T>
where\n T: Freeze,
",1,["fe_analyzer::context::Analysis"]]]],["fe_codegen",[["impl !Freeze for Db",1,["fe_codegen::db::Db"]],["impl Freeze for AbiSrcLocation",1,["fe_codegen::yul::runtime::AbiSrcLocation"]],["impl Freeze for CodegenAbiContractQuery",1,["fe_codegen::db::CodegenAbiContractQuery"]],["impl Freeze for CodegenAbiEventQuery",1,["fe_codegen::db::CodegenAbiEventQuery"]],["impl Freeze for CodegenAbiFunctionArgumentMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionArgumentMaximumSizeQuery"]],["impl Freeze for CodegenAbiFunctionQuery",1,["fe_codegen::db::CodegenAbiFunctionQuery"]],["impl Freeze for CodegenAbiFunctionReturnMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionReturnMaximumSizeQuery"]],["impl Freeze for CodegenAbiModuleEventsQuery",1,["fe_codegen::db::CodegenAbiModuleEventsQuery"]],["impl Freeze for CodegenAbiTypeMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMaximumSizeQuery"]],["impl Freeze for CodegenAbiTypeMinimumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMinimumSizeQuery"]],["impl Freeze for CodegenAbiTypeQuery",1,["fe_codegen::db::CodegenAbiTypeQuery"]],["impl Freeze for CodegenConstantStringSymbolNameQuery",1,["fe_codegen::db::CodegenConstantStringSymbolNameQuery"]],["impl Freeze for CodegenContractDeployerSymbolNameQuery",1,["fe_codegen::db::CodegenContractDeployerSymbolNameQuery"]],["impl Freeze for CodegenContractSymbolNameQuery",1,["fe_codegen::db::CodegenContractSymbolNameQuery"]],["impl Freeze for CodegenDbGroupStorage__",1,["fe_codegen::db::CodegenDbGroupStorage__"]],["impl Freeze for CodegenDbStorage",1,["fe_codegen::db::CodegenDbStorage"]],["impl Freeze for CodegenFunctionSymbolNameQuery",1,["fe_codegen::db::CodegenFunctionSymbolNameQuery"]],["impl Freeze for CodegenLegalizedBodyQuery",1,["fe_codegen::db::CodegenLegalizedBodyQuery"]],["impl Freeze for CodegenLegalizedSignatureQuery",1,["fe_codegen::db::CodegenLegalizedSignatureQuery"]],["impl Freeze for CodegenLegalizedTypeQuery",1,["fe_codegen::db::CodegenLegalizedTypeQuery"]],["impl Freeze for Context",1,["fe_codegen::yul::isel::context::Context"]],["impl Freeze for DefaultRuntimeProvider",1,["fe_codegen::yul::runtime::DefaultRuntimeProvider"]]]],["fe_common",[["impl !Freeze for TestDb",1,["fe_common::db::TestDb"]],["impl Freeze for LabelStyle",1,["fe_common::diagnostics::LabelStyle"]],["impl Freeze for FileKind",1,["fe_common::files::FileKind"]],["impl Freeze for Radix",1,["fe_common::numeric::Radix"]],["impl Freeze for DependencyKind",1,["fe_common::utils::files::DependencyKind"]],["impl Freeze for FileLoader",1,["fe_common::utils::files::FileLoader"]],["impl Freeze for ProjectMode",1,["fe_common::utils::files::ProjectMode"]],["impl Freeze for FileContentQuery",1,["fe_common::db::FileContentQuery"]],["impl Freeze for FileLineStartsQuery",1,["fe_common::db::FileLineStartsQuery"]],["impl Freeze for FileNameQuery",1,["fe_common::db::FileNameQuery"]],["impl Freeze for InternFileLookupQuery",1,["fe_common::db::InternFileLookupQuery"]],["impl Freeze for InternFileQuery",1,["fe_common::db::InternFileQuery"]],["impl Freeze for SourceDbGroupStorage__",1,["fe_common::db::SourceDbGroupStorage__"]],["impl Freeze for SourceDbStorage",1,["fe_common::db::SourceDbStorage"]],["impl Freeze for Diagnostic",1,["fe_common::diagnostics::Diagnostic"]],["impl Freeze for Label",1,["fe_common::diagnostics::Label"]],["impl Freeze for File",1,["fe_common::files::File"]],["impl Freeze for SourceFileId",1,["fe_common::files::SourceFileId"]],["impl Freeze for Span",1,["fe_common::span::Span"]],["impl Freeze for BuildFiles",1,["fe_common::utils::files::BuildFiles"]],["impl Freeze for Dependency",1,["fe_common::utils::files::Dependency"]],["impl Freeze for GitDependency",1,["fe_common::utils::files::GitDependency"]],["impl Freeze for LocalDependency",1,["fe_common::utils::files::LocalDependency"]],["impl Freeze for ProjectFiles",1,["fe_common::utils::files::ProjectFiles"]],["impl Freeze for Diff",1,["fe_common::utils::ron::Diff"]],["impl<'a> Freeze for Literal<'a>",1,["fe_common::numeric::Literal"]]]],["fe_compiler_test_utils",[["impl !Freeze for ContractHarness",1,["fe_compiler_test_utils::ContractHarness"]],["impl !Freeze for GasReporter",1,["fe_compiler_test_utils::GasReporter"]],["impl Freeze for ExecutionOutput",1,["fe_compiler_test_utils::ExecutionOutput"]],["impl Freeze for GasRecord",1,["fe_compiler_test_utils::GasRecord"]],["impl Freeze for NumericAbiTokenBounds",1,["fe_compiler_test_utils::NumericAbiTokenBounds"]],["impl Freeze for Runtime",1,["fe_compiler_test_utils::Runtime"]],["impl Freeze for SolidityCompileError",1,["fe_compiler_test_utils::SolidityCompileError"]]]],["fe_driver",[["impl Freeze for CompileError",1,["fe_driver::CompileError"]],["impl Freeze for CompiledContract",1,["fe_driver::CompiledContract"]],["impl Freeze for CompiledModule",1,["fe_driver::CompiledModule"]]]],["fe_mir",[["impl !Freeze for NewDb",1,["fe_mir::db::NewDb"]],["impl Freeze for PostIDom",1,["fe_mir::analysis::post_domtree::PostIDom"]],["impl Freeze for CursorLocation",1,["fe_mir::ir::body_cursor::CursorLocation"]],["impl Freeze for ConstantValue",1,["fe_mir::ir::constant::ConstantValue"]],["impl Freeze for Linkage",1,["fe_mir::ir::function::Linkage"]],["impl Freeze for BinOp",1,["fe_mir::ir::inst::BinOp"]],["impl Freeze for CallType",1,["fe_mir::ir::inst::CallType"]],["impl Freeze for CastKind",1,["fe_mir::ir::inst::CastKind"]],["impl Freeze for InstKind",1,["fe_mir::ir::inst::InstKind"]],["impl Freeze for UnOp",1,["fe_mir::ir::inst::UnOp"]],["impl Freeze for YulIntrinsicOp",1,["fe_mir::ir::inst::YulIntrinsicOp"]],["impl Freeze for TypeKind",1,["fe_mir::ir::types::TypeKind"]],["impl Freeze for AssignableValue",1,["fe_mir::ir::value::AssignableValue"]],["impl Freeze for Value",1,["fe_mir::ir::value::Value"]],["impl Freeze for ControlFlowGraph",1,["fe_mir::analysis::cfg::ControlFlowGraph"]],["impl Freeze for DFSet",1,["fe_mir::analysis::domtree::DFSet"]],["impl Freeze for DomTree",1,["fe_mir::analysis::domtree::DomTree"]],["impl Freeze for Loop",1,["fe_mir::analysis::loop_tree::Loop"]],["impl Freeze for LoopTree",1,["fe_mir::analysis::loop_tree::LoopTree"]],["impl Freeze for PostDomTree",1,["fe_mir::analysis::post_domtree::PostDomTree"]],["impl Freeze for MirDbGroupStorage__",1,["fe_mir::db::MirDbGroupStorage__"]],["impl Freeze for MirDbStorage",1,["fe_mir::db::MirDbStorage"]],["impl Freeze for MirInternConstLookupQuery",1,["fe_mir::db::MirInternConstLookupQuery"]],["impl Freeze for MirInternConstQuery",1,["fe_mir::db::MirInternConstQuery"]],["impl Freeze for MirInternFunctionLookupQuery",1,["fe_mir::db::MirInternFunctionLookupQuery"]],["impl Freeze for MirInternFunctionQuery",1,["fe_mir::db::MirInternFunctionQuery"]],["impl Freeze for MirInternTypeLookupQuery",1,["fe_mir::db::MirInternTypeLookupQuery"]],["impl Freeze for MirInternTypeQuery",1,["fe_mir::db::MirInternTypeQuery"]],["impl Freeze for MirLowerContractAllFunctionsQuery",1,["fe_mir::db::MirLowerContractAllFunctionsQuery"]],["impl Freeze for MirLowerEnumAllFunctionsQuery",1,["fe_mir::db::MirLowerEnumAllFunctionsQuery"]],["impl Freeze for MirLowerModuleAllFunctionsQuery",1,["fe_mir::db::MirLowerModuleAllFunctionsQuery"]],["impl Freeze for MirLowerStructAllFunctionsQuery",1,["fe_mir::db::MirLowerStructAllFunctionsQuery"]],["impl Freeze for MirLoweredConstantQuery",1,["fe_mir::db::MirLoweredConstantQuery"]],["impl Freeze for MirLoweredFuncBodyQuery",1,["fe_mir::db::MirLoweredFuncBodyQuery"]],["impl Freeze for MirLoweredFuncSignatureQuery",1,["fe_mir::db::MirLoweredFuncSignatureQuery"]],["impl Freeze for MirLoweredMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredMonomorphizedFuncSignatureQuery"]],["impl Freeze for MirLoweredPseudoMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredPseudoMonomorphizedFuncSignatureQuery"]],["impl Freeze for MirLoweredTypeQuery",1,["fe_mir::db::MirLoweredTypeQuery"]],["impl Freeze for BasicBlock",1,["fe_mir::ir::basic_block::BasicBlock"]],["impl Freeze for BodyBuilder",1,["fe_mir::ir::body_builder::BodyBuilder"]],["impl Freeze for BodyOrder",1,["fe_mir::ir::body_order::BodyOrder"]],["impl Freeze for Constant",1,["fe_mir::ir::constant::Constant"]],["impl Freeze for ConstantId",1,["fe_mir::ir::constant::ConstantId"]],["impl Freeze for BodyDataStore",1,["fe_mir::ir::function::BodyDataStore"]],["impl Freeze for FunctionBody",1,["fe_mir::ir::function::FunctionBody"]],["impl Freeze for FunctionId",1,["fe_mir::ir::function::FunctionId"]],["impl Freeze for FunctionParam",1,["fe_mir::ir::function::FunctionParam"]],["impl Freeze for FunctionSignature",1,["fe_mir::ir::function::FunctionSignature"]],["impl Freeze for Inst",1,["fe_mir::ir::inst::Inst"]],["impl Freeze for SwitchTable",1,["fe_mir::ir::inst::SwitchTable"]],["impl Freeze for SourceInfo",1,["fe_mir::ir::SourceInfo"]],["impl Freeze for ArrayDef",1,["fe_mir::ir::types::ArrayDef"]],["impl Freeze for EnumDef",1,["fe_mir::ir::types::EnumDef"]],["impl Freeze for EnumVariant",1,["fe_mir::ir::types::EnumVariant"]],["impl Freeze for EventDef",1,["fe_mir::ir::types::EventDef"]],["impl Freeze for MapDef",1,["fe_mir::ir::types::MapDef"]],["impl Freeze for StructDef",1,["fe_mir::ir::types::StructDef"]],["impl Freeze for TupleDef",1,["fe_mir::ir::types::TupleDef"]],["impl Freeze for Type",1,["fe_mir::ir::types::Type"]],["impl Freeze for TypeId",1,["fe_mir::ir::types::TypeId"]],["impl Freeze for Local",1,["fe_mir::ir::value::Local"]],["impl<'a> Freeze for BranchInfo<'a>",1,["fe_mir::ir::inst::BranchInfo"]],["impl<'a> Freeze for CfgPostOrder<'a>",1,["fe_mir::analysis::cfg::CfgPostOrder"]],["impl<'a> Freeze for BodyCursor<'a>",1,["fe_mir::ir::body_cursor::BodyCursor"]],["impl<'a, 'b> Freeze for BlocksInLoopPostOrder<'a, 'b>",1,["fe_mir::analysis::loop_tree::BlocksInLoopPostOrder"]],["impl<'a, T> Freeze for IterBase<'a, T>
where\n T: Freeze,
",1,["fe_mir::ir::inst::IterBase"]],["impl<'a, T> Freeze for IterMutBase<'a, T>",1,["fe_mir::ir::inst::IterMutBase"]]]],["fe_parser",[["impl Freeze for BinOperator",1,["fe_parser::ast::BinOperator"]],["impl Freeze for BoolOperator",1,["fe_parser::ast::BoolOperator"]],["impl Freeze for CompOperator",1,["fe_parser::ast::CompOperator"]],["impl Freeze for ContractStmt",1,["fe_parser::ast::ContractStmt"]],["impl Freeze for Expr",1,["fe_parser::ast::Expr"]],["impl Freeze for FuncStmt",1,["fe_parser::ast::FuncStmt"]],["impl Freeze for FunctionArg",1,["fe_parser::ast::FunctionArg"]],["impl Freeze for GenericArg",1,["fe_parser::ast::GenericArg"]],["impl Freeze for GenericParameter",1,["fe_parser::ast::GenericParameter"]],["impl Freeze for LiteralPattern",1,["fe_parser::ast::LiteralPattern"]],["impl Freeze for ModuleStmt",1,["fe_parser::ast::ModuleStmt"]],["impl Freeze for Pattern",1,["fe_parser::ast::Pattern"]],["impl Freeze for TypeDesc",1,["fe_parser::ast::TypeDesc"]],["impl Freeze for UnaryOperator",1,["fe_parser::ast::UnaryOperator"]],["impl Freeze for UseTree",1,["fe_parser::ast::UseTree"]],["impl Freeze for VarDeclTarget",1,["fe_parser::ast::VarDeclTarget"]],["impl Freeze for VariantKind",1,["fe_parser::ast::VariantKind"]],["impl Freeze for TokenKind",1,["fe_parser::lexer::token::TokenKind"]],["impl Freeze for CallArg",1,["fe_parser::ast::CallArg"]],["impl Freeze for ConstantDecl",1,["fe_parser::ast::ConstantDecl"]],["impl Freeze for Contract",1,["fe_parser::ast::Contract"]],["impl Freeze for Enum",1,["fe_parser::ast::Enum"]],["impl Freeze for Field",1,["fe_parser::ast::Field"]],["impl Freeze for Function",1,["fe_parser::ast::Function"]],["impl Freeze for FunctionSignature",1,["fe_parser::ast::FunctionSignature"]],["impl Freeze for Impl",1,["fe_parser::ast::Impl"]],["impl Freeze for MatchArm",1,["fe_parser::ast::MatchArm"]],["impl Freeze for Module",1,["fe_parser::ast::Module"]],["impl Freeze for Path",1,["fe_parser::ast::Path"]],["impl Freeze for Pragma",1,["fe_parser::ast::Pragma"]],["impl Freeze for Struct",1,["fe_parser::ast::Struct"]],["impl Freeze for Trait",1,["fe_parser::ast::Trait"]],["impl Freeze for TypeAlias",1,["fe_parser::ast::TypeAlias"]],["impl Freeze for Use",1,["fe_parser::ast::Use"]],["impl Freeze for Variant",1,["fe_parser::ast::Variant"]],["impl Freeze for NodeId",1,["fe_parser::node::NodeId"]],["impl Freeze for ParseFailed",1,["fe_parser::parser::ParseFailed"]],["impl<'a> Freeze for Lexer<'a>",1,["fe_parser::lexer::Lexer"]],["impl<'a> Freeze for Token<'a>",1,["fe_parser::lexer::token::Token"]],["impl<'a> Freeze for Parser<'a>",1,["fe_parser::parser::Parser"]],["impl<T> Freeze for Node<T>
where\n T: Freeze,
",1,["fe_parser::node::Node"]]]],["fe_test_runner",[["impl Freeze for TestSink",1,["fe_test_runner::TestSink"]]]],["fe_yulc",[["impl Freeze for ContractBytecode",1,["fe_yulc::ContractBytecode"]],["impl Freeze for YulcError",1,["fe_yulc::YulcError"]]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1777,3834,65195,8264,8495,2488,952,22550,12638,324,614]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/marker/trait.Send.js b/compiler-docs/trait.impl/core/marker/trait.Send.js new file mode 100644 index 0000000000..348822d448 --- /dev/null +++ b/compiler-docs/trait.impl/core/marker/trait.Send.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Send for Emit",1,["fe::task::build::Emit"]],["impl Send for Commands",1,["fe::task::Commands"]],["impl Send for FelangCli",1,["fe::FelangCli"]],["impl Send for BuildArgs",1,["fe::task::build::BuildArgs"]],["impl Send for CheckArgs",1,["fe::task::check::CheckArgs"]],["impl Send for NewProjectArgs",1,["fe::task::new::NewProjectArgs"]]]],["fe_abi",[["impl Send for AbiFunctionType",1,["fe_abi::function::AbiFunctionType"]],["impl Send for CtxParam",1,["fe_abi::function::CtxParam"]],["impl Send for SelfParam",1,["fe_abi::function::SelfParam"]],["impl Send for StateMutability",1,["fe_abi::function::StateMutability"]],["impl Send for AbiType",1,["fe_abi::types::AbiType"]],["impl Send for AbiContract",1,["fe_abi::contract::AbiContract"]],["impl Send for AbiEvent",1,["fe_abi::event::AbiEvent"]],["impl Send for AbiEventField",1,["fe_abi::event::AbiEventField"]],["impl Send for AbiEventSignature",1,["fe_abi::event::AbiEventSignature"]],["impl Send for AbiFunction",1,["fe_abi::function::AbiFunction"]],["impl Send for AbiFunctionSelector",1,["fe_abi::function::AbiFunctionSelector"]],["impl Send for AbiTupleField",1,["fe_abi::types::AbiTupleField"]]]],["fe_analyzer",[["impl !Send for CallType",1,["fe_analyzer::context::CallType"]],["impl !Send for Type",1,["fe_analyzer::namespace::types::Type"]],["impl !Send for FunctionBody",1,["fe_analyzer::context::FunctionBody"]],["impl !Send for AnalyzerDbGroupStorage__",1,["fe_analyzer::db::AnalyzerDbGroupStorage__"]],["impl !Send for TestDb",1,["fe_analyzer::db::TestDb"]],["impl !Send for DepGraphWrapper",1,["fe_analyzer::namespace::items::DepGraphWrapper"]],["impl !Send for Generic",1,["fe_analyzer::namespace::types::Generic"]],["impl !Send for Tuple",1,["fe_analyzer::namespace::types::Tuple"]],["impl Send for ContractTypeMethod",1,["fe_analyzer::builtins::ContractTypeMethod"]],["impl Send for GlobalFunction",1,["fe_analyzer::builtins::GlobalFunction"]],["impl Send for Intrinsic",1,["fe_analyzer::builtins::Intrinsic"]],["impl Send for ValueMethod",1,["fe_analyzer::builtins::ValueMethod"]],["impl Send for AdjustmentKind",1,["fe_analyzer::context::AdjustmentKind"]],["impl Send for Constant",1,["fe_analyzer::context::Constant"]],["impl Send for NamedThing",1,["fe_analyzer::context::NamedThing"]],["impl Send for BinaryOperationError",1,["fe_analyzer::errors::BinaryOperationError"]],["impl Send for IndexingError",1,["fe_analyzer::errors::IndexingError"]],["impl Send for TypeCoercionError",1,["fe_analyzer::errors::TypeCoercionError"]],["impl Send for DepLocality",1,["fe_analyzer::namespace::items::DepLocality"]],["impl Send for EnumVariantKind",1,["fe_analyzer::namespace::items::EnumVariantKind"]],["impl Send for IngotMode",1,["fe_analyzer::namespace::items::IngotMode"]],["impl Send for Item",1,["fe_analyzer::namespace::items::Item"]],["impl Send for ModuleSource",1,["fe_analyzer::namespace::items::ModuleSource"]],["impl Send for TypeDef",1,["fe_analyzer::namespace::items::TypeDef"]],["impl Send for BlockScopeType",1,["fe_analyzer::namespace::scopes::BlockScopeType"]],["impl Send for Base",1,["fe_analyzer::namespace::types::Base"]],["impl Send for GenericArg",1,["fe_analyzer::namespace::types::GenericArg"]],["impl Send for GenericParamKind",1,["fe_analyzer::namespace::types::GenericParamKind"]],["impl Send for GenericType",1,["fe_analyzer::namespace::types::GenericType"]],["impl Send for Integer",1,["fe_analyzer::namespace::types::Integer"]],["impl Send for TraitOrType",1,["fe_analyzer::namespace::types::TraitOrType"]],["impl Send for ConstructorKind",1,["fe_analyzer::traversal::pattern_analysis::ConstructorKind"]],["impl Send for LiteralConstructor",1,["fe_analyzer::traversal::pattern_analysis::LiteralConstructor"]],["impl Send for SimplifiedPatternKind",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPatternKind"]],["impl Send for GlobalFunctionIter",1,["fe_analyzer::builtins::GlobalFunctionIter"]],["impl Send for IntrinsicIter",1,["fe_analyzer::builtins::IntrinsicIter"]],["impl Send for Adjustment",1,["fe_analyzer::context::Adjustment"]],["impl Send for DiagnosticVoucher",1,["fe_analyzer::context::DiagnosticVoucher"]],["impl Send for ExpressionAttributes",1,["fe_analyzer::context::ExpressionAttributes"]],["impl Send for TempContext",1,["fe_analyzer::context::TempContext"]],["impl Send for AllImplsQuery",1,["fe_analyzer::db::AllImplsQuery"]],["impl Send for AnalyzerDbStorage",1,["fe_analyzer::db::AnalyzerDbStorage"]],["impl Send for ContractAllFieldsQuery",1,["fe_analyzer::db::ContractAllFieldsQuery"]],["impl Send for ContractAllFunctionsQuery",1,["fe_analyzer::db::ContractAllFunctionsQuery"]],["impl Send for ContractCallFunctionQuery",1,["fe_analyzer::db::ContractCallFunctionQuery"]],["impl Send for ContractDependencyGraphQuery",1,["fe_analyzer::db::ContractDependencyGraphQuery"]],["impl Send for ContractFieldMapQuery",1,["fe_analyzer::db::ContractFieldMapQuery"]],["impl Send for ContractFieldTypeQuery",1,["fe_analyzer::db::ContractFieldTypeQuery"]],["impl Send for ContractFunctionMapQuery",1,["fe_analyzer::db::ContractFunctionMapQuery"]],["impl Send for ContractInitFunctionQuery",1,["fe_analyzer::db::ContractInitFunctionQuery"]],["impl Send for ContractPublicFunctionMapQuery",1,["fe_analyzer::db::ContractPublicFunctionMapQuery"]],["impl Send for ContractRuntimeDependencyGraphQuery",1,["fe_analyzer::db::ContractRuntimeDependencyGraphQuery"]],["impl Send for EnumAllFunctionsQuery",1,["fe_analyzer::db::EnumAllFunctionsQuery"]],["impl Send for EnumAllVariantsQuery",1,["fe_analyzer::db::EnumAllVariantsQuery"]],["impl Send for EnumDependencyGraphQuery",1,["fe_analyzer::db::EnumDependencyGraphQuery"]],["impl Send for EnumFunctionMapQuery",1,["fe_analyzer::db::EnumFunctionMapQuery"]],["impl Send for EnumVariantKindQuery",1,["fe_analyzer::db::EnumVariantKindQuery"]],["impl Send for EnumVariantMapQuery",1,["fe_analyzer::db::EnumVariantMapQuery"]],["impl Send for FunctionBodyQuery",1,["fe_analyzer::db::FunctionBodyQuery"]],["impl Send for FunctionDependencyGraphQuery",1,["fe_analyzer::db::FunctionDependencyGraphQuery"]],["impl Send for FunctionSignatureQuery",1,["fe_analyzer::db::FunctionSignatureQuery"]],["impl Send for FunctionSigsQuery",1,["fe_analyzer::db::FunctionSigsQuery"]],["impl Send for ImplAllFunctionsQuery",1,["fe_analyzer::db::ImplAllFunctionsQuery"]],["impl Send for ImplForQuery",1,["fe_analyzer::db::ImplForQuery"]],["impl Send for ImplFunctionMapQuery",1,["fe_analyzer::db::ImplFunctionMapQuery"]],["impl Send for IngotExternalIngotsQuery",1,["fe_analyzer::db::IngotExternalIngotsQuery"]],["impl Send for IngotFilesQuery",1,["fe_analyzer::db::IngotFilesQuery"]],["impl Send for IngotModulesQuery",1,["fe_analyzer::db::IngotModulesQuery"]],["impl Send for IngotRootModuleQuery",1,["fe_analyzer::db::IngotRootModuleQuery"]],["impl Send for InternAttributeLookupQuery",1,["fe_analyzer::db::InternAttributeLookupQuery"]],["impl Send for InternAttributeQuery",1,["fe_analyzer::db::InternAttributeQuery"]],["impl Send for InternContractFieldLookupQuery",1,["fe_analyzer::db::InternContractFieldLookupQuery"]],["impl Send for InternContractFieldQuery",1,["fe_analyzer::db::InternContractFieldQuery"]],["impl Send for InternContractLookupQuery",1,["fe_analyzer::db::InternContractLookupQuery"]],["impl Send for InternContractQuery",1,["fe_analyzer::db::InternContractQuery"]],["impl Send for InternEnumLookupQuery",1,["fe_analyzer::db::InternEnumLookupQuery"]],["impl Send for InternEnumQuery",1,["fe_analyzer::db::InternEnumQuery"]],["impl Send for InternEnumVariantLookupQuery",1,["fe_analyzer::db::InternEnumVariantLookupQuery"]],["impl Send for InternEnumVariantQuery",1,["fe_analyzer::db::InternEnumVariantQuery"]],["impl Send for InternFunctionLookupQuery",1,["fe_analyzer::db::InternFunctionLookupQuery"]],["impl Send for InternFunctionQuery",1,["fe_analyzer::db::InternFunctionQuery"]],["impl Send for InternFunctionSigLookupQuery",1,["fe_analyzer::db::InternFunctionSigLookupQuery"]],["impl Send for InternFunctionSigQuery",1,["fe_analyzer::db::InternFunctionSigQuery"]],["impl Send for InternImplLookupQuery",1,["fe_analyzer::db::InternImplLookupQuery"]],["impl Send for InternImplQuery",1,["fe_analyzer::db::InternImplQuery"]],["impl Send for InternIngotLookupQuery",1,["fe_analyzer::db::InternIngotLookupQuery"]],["impl Send for InternIngotQuery",1,["fe_analyzer::db::InternIngotQuery"]],["impl Send for InternModuleConstLookupQuery",1,["fe_analyzer::db::InternModuleConstLookupQuery"]],["impl Send for InternModuleConstQuery",1,["fe_analyzer::db::InternModuleConstQuery"]],["impl Send for InternModuleLookupQuery",1,["fe_analyzer::db::InternModuleLookupQuery"]],["impl Send for InternModuleQuery",1,["fe_analyzer::db::InternModuleQuery"]],["impl Send for InternStructFieldLookupQuery",1,["fe_analyzer::db::InternStructFieldLookupQuery"]],["impl Send for InternStructFieldQuery",1,["fe_analyzer::db::InternStructFieldQuery"]],["impl Send for InternStructLookupQuery",1,["fe_analyzer::db::InternStructLookupQuery"]],["impl Send for InternStructQuery",1,["fe_analyzer::db::InternStructQuery"]],["impl Send for InternTraitLookupQuery",1,["fe_analyzer::db::InternTraitLookupQuery"]],["impl Send for InternTraitQuery",1,["fe_analyzer::db::InternTraitQuery"]],["impl Send for InternTypeAliasLookupQuery",1,["fe_analyzer::db::InternTypeAliasLookupQuery"]],["impl Send for InternTypeAliasQuery",1,["fe_analyzer::db::InternTypeAliasQuery"]],["impl Send for InternTypeLookupQuery",1,["fe_analyzer::db::InternTypeLookupQuery"]],["impl Send for InternTypeQuery",1,["fe_analyzer::db::InternTypeQuery"]],["impl Send for ModuleAllImplsQuery",1,["fe_analyzer::db::ModuleAllImplsQuery"]],["impl Send for ModuleAllItemsQuery",1,["fe_analyzer::db::ModuleAllItemsQuery"]],["impl Send for ModuleConstantTypeQuery",1,["fe_analyzer::db::ModuleConstantTypeQuery"]],["impl Send for ModuleConstantValueQuery",1,["fe_analyzer::db::ModuleConstantValueQuery"]],["impl Send for ModuleConstantsQuery",1,["fe_analyzer::db::ModuleConstantsQuery"]],["impl Send for ModuleContractsQuery",1,["fe_analyzer::db::ModuleContractsQuery"]],["impl Send for ModuleFilePathQuery",1,["fe_analyzer::db::ModuleFilePathQuery"]],["impl Send for ModuleImplMapQuery",1,["fe_analyzer::db::ModuleImplMapQuery"]],["impl Send for ModuleIsIncompleteQuery",1,["fe_analyzer::db::ModuleIsIncompleteQuery"]],["impl Send for ModuleItemMapQuery",1,["fe_analyzer::db::ModuleItemMapQuery"]],["impl Send for ModuleParentModuleQuery",1,["fe_analyzer::db::ModuleParentModuleQuery"]],["impl Send for ModuleParseQuery",1,["fe_analyzer::db::ModuleParseQuery"]],["impl Send for ModuleStructsQuery",1,["fe_analyzer::db::ModuleStructsQuery"]],["impl Send for ModuleSubmodulesQuery",1,["fe_analyzer::db::ModuleSubmodulesQuery"]],["impl Send for ModuleTestsQuery",1,["fe_analyzer::db::ModuleTestsQuery"]],["impl Send for ModuleUsedItemMapQuery",1,["fe_analyzer::db::ModuleUsedItemMapQuery"]],["impl Send for RootIngotQuery",1,["fe_analyzer::db::RootIngotQuery"]],["impl Send for StructAllFieldsQuery",1,["fe_analyzer::db::StructAllFieldsQuery"]],["impl Send for StructAllFunctionsQuery",1,["fe_analyzer::db::StructAllFunctionsQuery"]],["impl Send for StructDependencyGraphQuery",1,["fe_analyzer::db::StructDependencyGraphQuery"]],["impl Send for StructFieldMapQuery",1,["fe_analyzer::db::StructFieldMapQuery"]],["impl Send for StructFieldTypeQuery",1,["fe_analyzer::db::StructFieldTypeQuery"]],["impl Send for StructFunctionMapQuery",1,["fe_analyzer::db::StructFunctionMapQuery"]],["impl Send for TraitAllFunctionsQuery",1,["fe_analyzer::db::TraitAllFunctionsQuery"]],["impl Send for TraitFunctionMapQuery",1,["fe_analyzer::db::TraitFunctionMapQuery"]],["impl Send for TraitIsImplementedForQuery",1,["fe_analyzer::db::TraitIsImplementedForQuery"]],["impl Send for TypeAliasTypeQuery",1,["fe_analyzer::db::TypeAliasTypeQuery"]],["impl Send for AlreadyDefined",1,["fe_analyzer::errors::AlreadyDefined"]],["impl Send for ConstEvalError",1,["fe_analyzer::errors::ConstEvalError"]],["impl Send for FatalError",1,["fe_analyzer::errors::FatalError"]],["impl Send for IncompleteItem",1,["fe_analyzer::errors::IncompleteItem"]],["impl Send for TypeError",1,["fe_analyzer::errors::TypeError"]],["impl Send for Attribute",1,["fe_analyzer::namespace::items::Attribute"]],["impl Send for AttributeId",1,["fe_analyzer::namespace::items::AttributeId"]],["impl Send for Contract",1,["fe_analyzer::namespace::items::Contract"]],["impl Send for ContractField",1,["fe_analyzer::namespace::items::ContractField"]],["impl Send for ContractFieldId",1,["fe_analyzer::namespace::items::ContractFieldId"]],["impl Send for ContractId",1,["fe_analyzer::namespace::items::ContractId"]],["impl Send for Enum",1,["fe_analyzer::namespace::items::Enum"]],["impl Send for EnumId",1,["fe_analyzer::namespace::items::EnumId"]],["impl Send for EnumVariant",1,["fe_analyzer::namespace::items::EnumVariant"]],["impl Send for EnumVariantId",1,["fe_analyzer::namespace::items::EnumVariantId"]],["impl Send for Function",1,["fe_analyzer::namespace::items::Function"]],["impl Send for FunctionId",1,["fe_analyzer::namespace::items::FunctionId"]],["impl Send for FunctionSig",1,["fe_analyzer::namespace::items::FunctionSig"]],["impl Send for FunctionSigId",1,["fe_analyzer::namespace::items::FunctionSigId"]],["impl Send for Impl",1,["fe_analyzer::namespace::items::Impl"]],["impl Send for ImplId",1,["fe_analyzer::namespace::items::ImplId"]],["impl Send for Ingot",1,["fe_analyzer::namespace::items::Ingot"]],["impl Send for IngotId",1,["fe_analyzer::namespace::items::IngotId"]],["impl Send for Module",1,["fe_analyzer::namespace::items::Module"]],["impl Send for ModuleConstant",1,["fe_analyzer::namespace::items::ModuleConstant"]],["impl Send for ModuleConstantId",1,["fe_analyzer::namespace::items::ModuleConstantId"]],["impl Send for ModuleId",1,["fe_analyzer::namespace::items::ModuleId"]],["impl Send for Struct",1,["fe_analyzer::namespace::items::Struct"]],["impl Send for StructField",1,["fe_analyzer::namespace::items::StructField"]],["impl Send for StructFieldId",1,["fe_analyzer::namespace::items::StructFieldId"]],["impl Send for StructId",1,["fe_analyzer::namespace::items::StructId"]],["impl Send for Trait",1,["fe_analyzer::namespace::items::Trait"]],["impl Send for TraitId",1,["fe_analyzer::namespace::items::TraitId"]],["impl Send for TypeAlias",1,["fe_analyzer::namespace::items::TypeAlias"]],["impl Send for TypeAliasId",1,["fe_analyzer::namespace::items::TypeAliasId"]],["impl Send for Array",1,["fe_analyzer::namespace::types::Array"]],["impl Send for CtxDecl",1,["fe_analyzer::namespace::types::CtxDecl"]],["impl Send for FeString",1,["fe_analyzer::namespace::types::FeString"]],["impl Send for FunctionParam",1,["fe_analyzer::namespace::types::FunctionParam"]],["impl Send for FunctionSignature",1,["fe_analyzer::namespace::types::FunctionSignature"]],["impl Send for GenericParam",1,["fe_analyzer::namespace::types::GenericParam"]],["impl Send for GenericTypeIter",1,["fe_analyzer::namespace::types::GenericTypeIter"]],["impl Send for IntegerIter",1,["fe_analyzer::namespace::types::IntegerIter"]],["impl Send for Map",1,["fe_analyzer::namespace::types::Map"]],["impl Send for SelfDecl",1,["fe_analyzer::namespace::types::SelfDecl"]],["impl Send for TypeId",1,["fe_analyzer::namespace::types::TypeId"]],["impl Send for PatternMatrix",1,["fe_analyzer::traversal::pattern_analysis::PatternMatrix"]],["impl Send for PatternRowVec",1,["fe_analyzer::traversal::pattern_analysis::PatternRowVec"]],["impl Send for SigmaSet",1,["fe_analyzer::traversal::pattern_analysis::SigmaSet"]],["impl Send for SimplifiedPattern",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPattern"]],["impl<'a> !Send for FunctionScope<'a>",1,["fe_analyzer::namespace::scopes::FunctionScope"]],["impl<'a> !Send for ItemScope<'a>",1,["fe_analyzer::namespace::scopes::ItemScope"]],["impl<'a, 'b> !Send for BlockScope<'a, 'b>",1,["fe_analyzer::namespace::scopes::BlockScope"]],["impl<'a, T> !Send for DisplayableWrapper<'a, T>",1,["fe_analyzer::display::DisplayableWrapper"]],["impl<T> !Send for Analysis<T>",1,["fe_analyzer::context::Analysis"]]]],["fe_codegen",[["impl !Send for CodegenDbGroupStorage__",1,["fe_codegen::db::CodegenDbGroupStorage__"]],["impl !Send for Db",1,["fe_codegen::db::Db"]],["impl !Send for Context",1,["fe_codegen::yul::isel::context::Context"]],["impl Send for AbiSrcLocation",1,["fe_codegen::yul::runtime::AbiSrcLocation"]],["impl Send for CodegenAbiContractQuery",1,["fe_codegen::db::CodegenAbiContractQuery"]],["impl Send for CodegenAbiEventQuery",1,["fe_codegen::db::CodegenAbiEventQuery"]],["impl Send for CodegenAbiFunctionArgumentMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionArgumentMaximumSizeQuery"]],["impl Send for CodegenAbiFunctionQuery",1,["fe_codegen::db::CodegenAbiFunctionQuery"]],["impl Send for CodegenAbiFunctionReturnMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionReturnMaximumSizeQuery"]],["impl Send for CodegenAbiModuleEventsQuery",1,["fe_codegen::db::CodegenAbiModuleEventsQuery"]],["impl Send for CodegenAbiTypeMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMaximumSizeQuery"]],["impl Send for CodegenAbiTypeMinimumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMinimumSizeQuery"]],["impl Send for CodegenAbiTypeQuery",1,["fe_codegen::db::CodegenAbiTypeQuery"]],["impl Send for CodegenConstantStringSymbolNameQuery",1,["fe_codegen::db::CodegenConstantStringSymbolNameQuery"]],["impl Send for CodegenContractDeployerSymbolNameQuery",1,["fe_codegen::db::CodegenContractDeployerSymbolNameQuery"]],["impl Send for CodegenContractSymbolNameQuery",1,["fe_codegen::db::CodegenContractSymbolNameQuery"]],["impl Send for CodegenDbStorage",1,["fe_codegen::db::CodegenDbStorage"]],["impl Send for CodegenFunctionSymbolNameQuery",1,["fe_codegen::db::CodegenFunctionSymbolNameQuery"]],["impl Send for CodegenLegalizedBodyQuery",1,["fe_codegen::db::CodegenLegalizedBodyQuery"]],["impl Send for CodegenLegalizedSignatureQuery",1,["fe_codegen::db::CodegenLegalizedSignatureQuery"]],["impl Send for CodegenLegalizedTypeQuery",1,["fe_codegen::db::CodegenLegalizedTypeQuery"]],["impl Send for DefaultRuntimeProvider",1,["fe_codegen::yul::runtime::DefaultRuntimeProvider"]]]],["fe_common",[["impl !Send for SourceDbGroupStorage__",1,["fe_common::db::SourceDbGroupStorage__"]],["impl !Send for TestDb",1,["fe_common::db::TestDb"]],["impl !Send for File",1,["fe_common::files::File"]],["impl Send for LabelStyle",1,["fe_common::diagnostics::LabelStyle"]],["impl Send for FileKind",1,["fe_common::files::FileKind"]],["impl Send for Radix",1,["fe_common::numeric::Radix"]],["impl Send for DependencyKind",1,["fe_common::utils::files::DependencyKind"]],["impl Send for FileLoader",1,["fe_common::utils::files::FileLoader"]],["impl Send for ProjectMode",1,["fe_common::utils::files::ProjectMode"]],["impl Send for FileContentQuery",1,["fe_common::db::FileContentQuery"]],["impl Send for FileLineStartsQuery",1,["fe_common::db::FileLineStartsQuery"]],["impl Send for FileNameQuery",1,["fe_common::db::FileNameQuery"]],["impl Send for InternFileLookupQuery",1,["fe_common::db::InternFileLookupQuery"]],["impl Send for InternFileQuery",1,["fe_common::db::InternFileQuery"]],["impl Send for SourceDbStorage",1,["fe_common::db::SourceDbStorage"]],["impl Send for Diagnostic",1,["fe_common::diagnostics::Diagnostic"]],["impl Send for Label",1,["fe_common::diagnostics::Label"]],["impl Send for SourceFileId",1,["fe_common::files::SourceFileId"]],["impl Send for Span",1,["fe_common::span::Span"]],["impl Send for BuildFiles",1,["fe_common::utils::files::BuildFiles"]],["impl Send for Dependency",1,["fe_common::utils::files::Dependency"]],["impl Send for GitDependency",1,["fe_common::utils::files::GitDependency"]],["impl Send for LocalDependency",1,["fe_common::utils::files::LocalDependency"]],["impl Send for ProjectFiles",1,["fe_common::utils::files::ProjectFiles"]],["impl Send for Diff",1,["fe_common::utils::ron::Diff"]],["impl<'a> Send for Literal<'a>",1,["fe_common::numeric::Literal"]]]],["fe_compiler_test_utils",[["impl Send for ContractHarness",1,["fe_compiler_test_utils::ContractHarness"]],["impl Send for ExecutionOutput",1,["fe_compiler_test_utils::ExecutionOutput"]],["impl Send for GasRecord",1,["fe_compiler_test_utils::GasRecord"]],["impl Send for GasReporter",1,["fe_compiler_test_utils::GasReporter"]],["impl Send for NumericAbiTokenBounds",1,["fe_compiler_test_utils::NumericAbiTokenBounds"]],["impl Send for Runtime",1,["fe_compiler_test_utils::Runtime"]],["impl Send for SolidityCompileError",1,["fe_compiler_test_utils::SolidityCompileError"]]]],["fe_driver",[["impl Send for CompileError",1,["fe_driver::CompileError"]],["impl Send for CompiledContract",1,["fe_driver::CompiledContract"]],["impl Send for CompiledModule",1,["fe_driver::CompiledModule"]]]],["fe_mir",[["impl !Send for MirDbGroupStorage__",1,["fe_mir::db::MirDbGroupStorage__"]],["impl !Send for NewDb",1,["fe_mir::db::NewDb"]],["impl Send for PostIDom",1,["fe_mir::analysis::post_domtree::PostIDom"]],["impl Send for CursorLocation",1,["fe_mir::ir::body_cursor::CursorLocation"]],["impl Send for ConstantValue",1,["fe_mir::ir::constant::ConstantValue"]],["impl Send for Linkage",1,["fe_mir::ir::function::Linkage"]],["impl Send for BinOp",1,["fe_mir::ir::inst::BinOp"]],["impl Send for CallType",1,["fe_mir::ir::inst::CallType"]],["impl Send for CastKind",1,["fe_mir::ir::inst::CastKind"]],["impl Send for InstKind",1,["fe_mir::ir::inst::InstKind"]],["impl Send for UnOp",1,["fe_mir::ir::inst::UnOp"]],["impl Send for YulIntrinsicOp",1,["fe_mir::ir::inst::YulIntrinsicOp"]],["impl Send for TypeKind",1,["fe_mir::ir::types::TypeKind"]],["impl Send for AssignableValue",1,["fe_mir::ir::value::AssignableValue"]],["impl Send for Value",1,["fe_mir::ir::value::Value"]],["impl Send for ControlFlowGraph",1,["fe_mir::analysis::cfg::ControlFlowGraph"]],["impl Send for DFSet",1,["fe_mir::analysis::domtree::DFSet"]],["impl Send for DomTree",1,["fe_mir::analysis::domtree::DomTree"]],["impl Send for Loop",1,["fe_mir::analysis::loop_tree::Loop"]],["impl Send for LoopTree",1,["fe_mir::analysis::loop_tree::LoopTree"]],["impl Send for PostDomTree",1,["fe_mir::analysis::post_domtree::PostDomTree"]],["impl Send for MirDbStorage",1,["fe_mir::db::MirDbStorage"]],["impl Send for MirInternConstLookupQuery",1,["fe_mir::db::MirInternConstLookupQuery"]],["impl Send for MirInternConstQuery",1,["fe_mir::db::MirInternConstQuery"]],["impl Send for MirInternFunctionLookupQuery",1,["fe_mir::db::MirInternFunctionLookupQuery"]],["impl Send for MirInternFunctionQuery",1,["fe_mir::db::MirInternFunctionQuery"]],["impl Send for MirInternTypeLookupQuery",1,["fe_mir::db::MirInternTypeLookupQuery"]],["impl Send for MirInternTypeQuery",1,["fe_mir::db::MirInternTypeQuery"]],["impl Send for MirLowerContractAllFunctionsQuery",1,["fe_mir::db::MirLowerContractAllFunctionsQuery"]],["impl Send for MirLowerEnumAllFunctionsQuery",1,["fe_mir::db::MirLowerEnumAllFunctionsQuery"]],["impl Send for MirLowerModuleAllFunctionsQuery",1,["fe_mir::db::MirLowerModuleAllFunctionsQuery"]],["impl Send for MirLowerStructAllFunctionsQuery",1,["fe_mir::db::MirLowerStructAllFunctionsQuery"]],["impl Send for MirLoweredConstantQuery",1,["fe_mir::db::MirLoweredConstantQuery"]],["impl Send for MirLoweredFuncBodyQuery",1,["fe_mir::db::MirLoweredFuncBodyQuery"]],["impl Send for MirLoweredFuncSignatureQuery",1,["fe_mir::db::MirLoweredFuncSignatureQuery"]],["impl Send for MirLoweredMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredMonomorphizedFuncSignatureQuery"]],["impl Send for MirLoweredPseudoMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredPseudoMonomorphizedFuncSignatureQuery"]],["impl Send for MirLoweredTypeQuery",1,["fe_mir::db::MirLoweredTypeQuery"]],["impl Send for BasicBlock",1,["fe_mir::ir::basic_block::BasicBlock"]],["impl Send for BodyBuilder",1,["fe_mir::ir::body_builder::BodyBuilder"]],["impl Send for BodyOrder",1,["fe_mir::ir::body_order::BodyOrder"]],["impl Send for Constant",1,["fe_mir::ir::constant::Constant"]],["impl Send for ConstantId",1,["fe_mir::ir::constant::ConstantId"]],["impl Send for BodyDataStore",1,["fe_mir::ir::function::BodyDataStore"]],["impl Send for FunctionBody",1,["fe_mir::ir::function::FunctionBody"]],["impl Send for FunctionId",1,["fe_mir::ir::function::FunctionId"]],["impl Send for FunctionParam",1,["fe_mir::ir::function::FunctionParam"]],["impl Send for FunctionSignature",1,["fe_mir::ir::function::FunctionSignature"]],["impl Send for Inst",1,["fe_mir::ir::inst::Inst"]],["impl Send for SwitchTable",1,["fe_mir::ir::inst::SwitchTable"]],["impl Send for SourceInfo",1,["fe_mir::ir::SourceInfo"]],["impl Send for ArrayDef",1,["fe_mir::ir::types::ArrayDef"]],["impl Send for EnumDef",1,["fe_mir::ir::types::EnumDef"]],["impl Send for EnumVariant",1,["fe_mir::ir::types::EnumVariant"]],["impl Send for EventDef",1,["fe_mir::ir::types::EventDef"]],["impl Send for MapDef",1,["fe_mir::ir::types::MapDef"]],["impl Send for StructDef",1,["fe_mir::ir::types::StructDef"]],["impl Send for TupleDef",1,["fe_mir::ir::types::TupleDef"]],["impl Send for Type",1,["fe_mir::ir::types::Type"]],["impl Send for TypeId",1,["fe_mir::ir::types::TypeId"]],["impl Send for Local",1,["fe_mir::ir::value::Local"]],["impl<'a> Send for BranchInfo<'a>",1,["fe_mir::ir::inst::BranchInfo"]],["impl<'a> Send for CfgPostOrder<'a>",1,["fe_mir::analysis::cfg::CfgPostOrder"]],["impl<'a> Send for BodyCursor<'a>",1,["fe_mir::ir::body_cursor::BodyCursor"]],["impl<'a, 'b> Send for BlocksInLoopPostOrder<'a, 'b>",1,["fe_mir::analysis::loop_tree::BlocksInLoopPostOrder"]],["impl<'a, T> Send for IterBase<'a, T>
where\n T: Send + Sync,
",1,["fe_mir::ir::inst::IterBase"]],["impl<'a, T> Send for IterMutBase<'a, T>
where\n T: Send,
",1,["fe_mir::ir::inst::IterMutBase"]]]],["fe_parser",[["impl Send for BinOperator",1,["fe_parser::ast::BinOperator"]],["impl Send for BoolOperator",1,["fe_parser::ast::BoolOperator"]],["impl Send for CompOperator",1,["fe_parser::ast::CompOperator"]],["impl Send for ContractStmt",1,["fe_parser::ast::ContractStmt"]],["impl Send for Expr",1,["fe_parser::ast::Expr"]],["impl Send for FuncStmt",1,["fe_parser::ast::FuncStmt"]],["impl Send for FunctionArg",1,["fe_parser::ast::FunctionArg"]],["impl Send for GenericArg",1,["fe_parser::ast::GenericArg"]],["impl Send for GenericParameter",1,["fe_parser::ast::GenericParameter"]],["impl Send for LiteralPattern",1,["fe_parser::ast::LiteralPattern"]],["impl Send for ModuleStmt",1,["fe_parser::ast::ModuleStmt"]],["impl Send for Pattern",1,["fe_parser::ast::Pattern"]],["impl Send for TypeDesc",1,["fe_parser::ast::TypeDesc"]],["impl Send for UnaryOperator",1,["fe_parser::ast::UnaryOperator"]],["impl Send for UseTree",1,["fe_parser::ast::UseTree"]],["impl Send for VarDeclTarget",1,["fe_parser::ast::VarDeclTarget"]],["impl Send for VariantKind",1,["fe_parser::ast::VariantKind"]],["impl Send for TokenKind",1,["fe_parser::lexer::token::TokenKind"]],["impl Send for CallArg",1,["fe_parser::ast::CallArg"]],["impl Send for ConstantDecl",1,["fe_parser::ast::ConstantDecl"]],["impl Send for Contract",1,["fe_parser::ast::Contract"]],["impl Send for Enum",1,["fe_parser::ast::Enum"]],["impl Send for Field",1,["fe_parser::ast::Field"]],["impl Send for Function",1,["fe_parser::ast::Function"]],["impl Send for FunctionSignature",1,["fe_parser::ast::FunctionSignature"]],["impl Send for Impl",1,["fe_parser::ast::Impl"]],["impl Send for MatchArm",1,["fe_parser::ast::MatchArm"]],["impl Send for Module",1,["fe_parser::ast::Module"]],["impl Send for Path",1,["fe_parser::ast::Path"]],["impl Send for Pragma",1,["fe_parser::ast::Pragma"]],["impl Send for Struct",1,["fe_parser::ast::Struct"]],["impl Send for Trait",1,["fe_parser::ast::Trait"]],["impl Send for TypeAlias",1,["fe_parser::ast::TypeAlias"]],["impl Send for Use",1,["fe_parser::ast::Use"]],["impl Send for Variant",1,["fe_parser::ast::Variant"]],["impl Send for NodeId",1,["fe_parser::node::NodeId"]],["impl Send for ParseFailed",1,["fe_parser::parser::ParseFailed"]],["impl<'a> Send for Lexer<'a>",1,["fe_parser::lexer::Lexer"]],["impl<'a> Send for Token<'a>",1,["fe_parser::lexer::token::Token"]],["impl<'a> Send for Parser<'a>",1,["fe_parser::parser::Parser"]],["impl<T> Send for Node<T>
where\n T: Send,
",1,["fe_parser::node::Node"]]]],["fe_test_runner",[["impl Send for TestSink",1,["fe_test_runner::TestSink"]]]],["fe_yulc",[["impl Send for ContractBytecode",1,["fe_yulc::ContractBytecode"]],["impl Send for YulcError",1,["fe_yulc::YulcError"]]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1741,3762,63745,8134,8341,2444,934,22452,12386,318,602]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/marker/trait.StructuralPartialEq.js b/compiler-docs/trait.impl/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 0000000000..a89dde6e05 --- /dev/null +++ b/compiler-docs/trait.impl/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl StructuralPartialEq for Emit"]]],["fe_abi",[["impl StructuralPartialEq for AbiFunctionType"],["impl StructuralPartialEq for StateMutability"],["impl StructuralPartialEq for AbiType"],["impl StructuralPartialEq for AbiContract"],["impl StructuralPartialEq for AbiEvent"],["impl StructuralPartialEq for AbiEventField"],["impl StructuralPartialEq for AbiFunction"],["impl StructuralPartialEq for AbiTupleField"]]],["fe_analyzer",[["impl StructuralPartialEq for ContractTypeMethod"],["impl StructuralPartialEq for GlobalFunction"],["impl StructuralPartialEq for Intrinsic"],["impl StructuralPartialEq for ValueMethod"],["impl StructuralPartialEq for AdjustmentKind"],["impl StructuralPartialEq for CallType"],["impl StructuralPartialEq for Constant"],["impl StructuralPartialEq for NamedThing"],["impl StructuralPartialEq for BinaryOperationError"],["impl StructuralPartialEq for IndexingError"],["impl StructuralPartialEq for TypeCoercionError"],["impl StructuralPartialEq for DepLocality"],["impl StructuralPartialEq for EnumVariantKind"],["impl StructuralPartialEq for IngotMode"],["impl StructuralPartialEq for Item"],["impl StructuralPartialEq for ModuleSource"],["impl StructuralPartialEq for TypeDef"],["impl StructuralPartialEq for BlockScopeType"],["impl StructuralPartialEq for Base"],["impl StructuralPartialEq for GenericArg"],["impl StructuralPartialEq for GenericParamKind"],["impl StructuralPartialEq for GenericType"],["impl StructuralPartialEq for Integer"],["impl StructuralPartialEq for TraitOrType"],["impl StructuralPartialEq for Type"],["impl StructuralPartialEq for ConstructorKind"],["impl StructuralPartialEq for LiteralConstructor"],["impl StructuralPartialEq for SimplifiedPatternKind"],["impl StructuralPartialEq for Adjustment"],["impl StructuralPartialEq for DiagnosticVoucher"],["impl StructuralPartialEq for ExpressionAttributes"],["impl StructuralPartialEq for FunctionBody"],["impl StructuralPartialEq for ConstEvalError"],["impl StructuralPartialEq for TypeError"],["impl StructuralPartialEq for Attribute"],["impl StructuralPartialEq for AttributeId"],["impl StructuralPartialEq for Contract"],["impl StructuralPartialEq for ContractField"],["impl StructuralPartialEq for ContractFieldId"],["impl StructuralPartialEq for ContractId"],["impl StructuralPartialEq for Enum"],["impl StructuralPartialEq for EnumId"],["impl StructuralPartialEq for EnumVariant"],["impl StructuralPartialEq for EnumVariantId"],["impl StructuralPartialEq for Function"],["impl StructuralPartialEq for FunctionId"],["impl StructuralPartialEq for FunctionSig"],["impl StructuralPartialEq for FunctionSigId"],["impl StructuralPartialEq for Impl"],["impl StructuralPartialEq for ImplId"],["impl StructuralPartialEq for Ingot"],["impl StructuralPartialEq for IngotId"],["impl StructuralPartialEq for Module"],["impl StructuralPartialEq for ModuleConstant"],["impl StructuralPartialEq for ModuleConstantId"],["impl StructuralPartialEq for ModuleId"],["impl StructuralPartialEq for Struct"],["impl StructuralPartialEq for StructField"],["impl StructuralPartialEq for StructFieldId"],["impl StructuralPartialEq for StructId"],["impl StructuralPartialEq for Trait"],["impl StructuralPartialEq for TraitId"],["impl StructuralPartialEq for TypeAlias"],["impl StructuralPartialEq for TypeAliasId"],["impl StructuralPartialEq for Array"],["impl StructuralPartialEq for CtxDecl"],["impl StructuralPartialEq for FeString"],["impl StructuralPartialEq for FunctionParam"],["impl StructuralPartialEq for FunctionSignature"],["impl StructuralPartialEq for Generic"],["impl StructuralPartialEq for Map"],["impl StructuralPartialEq for SelfDecl"],["impl StructuralPartialEq for Tuple"],["impl StructuralPartialEq for TypeId"],["impl StructuralPartialEq for PatternMatrix"],["impl StructuralPartialEq for PatternRowVec"],["impl StructuralPartialEq for SigmaSet"],["impl StructuralPartialEq for SimplifiedPattern"],["impl<T> StructuralPartialEq for Analysis<T>"]]],["fe_common",[["impl StructuralPartialEq for LabelStyle"],["impl StructuralPartialEq for FileKind"],["impl StructuralPartialEq for Radix"],["impl StructuralPartialEq for ProjectMode"],["impl StructuralPartialEq for Diagnostic"],["impl StructuralPartialEq for Label"],["impl StructuralPartialEq for File"],["impl StructuralPartialEq for SourceFileId"],["impl StructuralPartialEq for Span"]]],["fe_mir",[["impl StructuralPartialEq for PostIDom"],["impl StructuralPartialEq for CursorLocation"],["impl StructuralPartialEq for ConstantValue"],["impl StructuralPartialEq for Linkage"],["impl StructuralPartialEq for BinOp"],["impl StructuralPartialEq for CallType"],["impl StructuralPartialEq for CastKind"],["impl StructuralPartialEq for InstKind"],["impl StructuralPartialEq for UnOp"],["impl StructuralPartialEq for YulIntrinsicOp"],["impl StructuralPartialEq for TypeKind"],["impl StructuralPartialEq for AssignableValue"],["impl StructuralPartialEq for Value"],["impl StructuralPartialEq for ControlFlowGraph"],["impl StructuralPartialEq for Loop"],["impl StructuralPartialEq for BasicBlock"],["impl StructuralPartialEq for BodyOrder"],["impl StructuralPartialEq for Constant"],["impl StructuralPartialEq for ConstantId"],["impl StructuralPartialEq for BodyDataStore"],["impl StructuralPartialEq for FunctionBody"],["impl StructuralPartialEq for FunctionId"],["impl StructuralPartialEq for FunctionParam"],["impl StructuralPartialEq for FunctionSignature"],["impl StructuralPartialEq for Inst"],["impl StructuralPartialEq for SwitchTable"],["impl StructuralPartialEq for SourceInfo"],["impl StructuralPartialEq for ArrayDef"],["impl StructuralPartialEq for EnumDef"],["impl StructuralPartialEq for EnumVariant"],["impl StructuralPartialEq for EventDef"],["impl StructuralPartialEq for MapDef"],["impl StructuralPartialEq for StructDef"],["impl StructuralPartialEq for TupleDef"],["impl StructuralPartialEq for Type"],["impl StructuralPartialEq for TypeId"],["impl StructuralPartialEq for Local"]]],["fe_parser",[["impl StructuralPartialEq for BinOperator"],["impl StructuralPartialEq for BoolOperator"],["impl StructuralPartialEq for CompOperator"],["impl StructuralPartialEq for ContractStmt"],["impl StructuralPartialEq for Expr"],["impl StructuralPartialEq for FuncStmt"],["impl StructuralPartialEq for FunctionArg"],["impl StructuralPartialEq for GenericArg"],["impl StructuralPartialEq for GenericParameter"],["impl StructuralPartialEq for LiteralPattern"],["impl StructuralPartialEq for ModuleStmt"],["impl StructuralPartialEq for Pattern"],["impl StructuralPartialEq for TypeDesc"],["impl StructuralPartialEq for UnaryOperator"],["impl StructuralPartialEq for UseTree"],["impl StructuralPartialEq for VarDeclTarget"],["impl StructuralPartialEq for VariantKind"],["impl StructuralPartialEq for TokenKind"],["impl StructuralPartialEq for CallArg"],["impl StructuralPartialEq for ConstantDecl"],["impl StructuralPartialEq for Contract"],["impl StructuralPartialEq for Enum"],["impl StructuralPartialEq for Field"],["impl StructuralPartialEq for Function"],["impl StructuralPartialEq for FunctionSignature"],["impl StructuralPartialEq for Impl"],["impl StructuralPartialEq for MatchArm"],["impl StructuralPartialEq for Module"],["impl StructuralPartialEq for Path"],["impl StructuralPartialEq for Pragma"],["impl StructuralPartialEq for Struct"],["impl StructuralPartialEq for Trait"],["impl StructuralPartialEq for TypeAlias"],["impl StructuralPartialEq for Use"],["impl StructuralPartialEq for Variant"],["impl StructuralPartialEq for NodeId"],["impl StructuralPartialEq for ParseFailed"],["impl<'a> StructuralPartialEq for Token<'a>"],["impl<T> StructuralPartialEq for Node<T>"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[301,2570,26941,2849,11823,12102]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/marker/trait.Sync.js b/compiler-docs/trait.impl/core/marker/trait.Sync.js new file mode 100644 index 0000000000..19e3e22095 --- /dev/null +++ b/compiler-docs/trait.impl/core/marker/trait.Sync.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Sync for Emit",1,["fe::task::build::Emit"]],["impl Sync for Commands",1,["fe::task::Commands"]],["impl Sync for FelangCli",1,["fe::FelangCli"]],["impl Sync for BuildArgs",1,["fe::task::build::BuildArgs"]],["impl Sync for CheckArgs",1,["fe::task::check::CheckArgs"]],["impl Sync for NewProjectArgs",1,["fe::task::new::NewProjectArgs"]]]],["fe_abi",[["impl Sync for AbiFunctionType",1,["fe_abi::function::AbiFunctionType"]],["impl Sync for CtxParam",1,["fe_abi::function::CtxParam"]],["impl Sync for SelfParam",1,["fe_abi::function::SelfParam"]],["impl Sync for StateMutability",1,["fe_abi::function::StateMutability"]],["impl Sync for AbiType",1,["fe_abi::types::AbiType"]],["impl Sync for AbiContract",1,["fe_abi::contract::AbiContract"]],["impl Sync for AbiEvent",1,["fe_abi::event::AbiEvent"]],["impl Sync for AbiEventField",1,["fe_abi::event::AbiEventField"]],["impl Sync for AbiEventSignature",1,["fe_abi::event::AbiEventSignature"]],["impl Sync for AbiFunction",1,["fe_abi::function::AbiFunction"]],["impl Sync for AbiFunctionSelector",1,["fe_abi::function::AbiFunctionSelector"]],["impl Sync for AbiTupleField",1,["fe_abi::types::AbiTupleField"]]]],["fe_analyzer",[["impl !Sync for CallType",1,["fe_analyzer::context::CallType"]],["impl !Sync for Type",1,["fe_analyzer::namespace::types::Type"]],["impl !Sync for FunctionBody",1,["fe_analyzer::context::FunctionBody"]],["impl !Sync for TempContext",1,["fe_analyzer::context::TempContext"]],["impl !Sync for AnalyzerDbGroupStorage__",1,["fe_analyzer::db::AnalyzerDbGroupStorage__"]],["impl !Sync for TestDb",1,["fe_analyzer::db::TestDb"]],["impl !Sync for DepGraphWrapper",1,["fe_analyzer::namespace::items::DepGraphWrapper"]],["impl !Sync for Generic",1,["fe_analyzer::namespace::types::Generic"]],["impl !Sync for Tuple",1,["fe_analyzer::namespace::types::Tuple"]],["impl Sync for ContractTypeMethod",1,["fe_analyzer::builtins::ContractTypeMethod"]],["impl Sync for GlobalFunction",1,["fe_analyzer::builtins::GlobalFunction"]],["impl Sync for Intrinsic",1,["fe_analyzer::builtins::Intrinsic"]],["impl Sync for ValueMethod",1,["fe_analyzer::builtins::ValueMethod"]],["impl Sync for AdjustmentKind",1,["fe_analyzer::context::AdjustmentKind"]],["impl Sync for Constant",1,["fe_analyzer::context::Constant"]],["impl Sync for NamedThing",1,["fe_analyzer::context::NamedThing"]],["impl Sync for BinaryOperationError",1,["fe_analyzer::errors::BinaryOperationError"]],["impl Sync for IndexingError",1,["fe_analyzer::errors::IndexingError"]],["impl Sync for TypeCoercionError",1,["fe_analyzer::errors::TypeCoercionError"]],["impl Sync for DepLocality",1,["fe_analyzer::namespace::items::DepLocality"]],["impl Sync for EnumVariantKind",1,["fe_analyzer::namespace::items::EnumVariantKind"]],["impl Sync for IngotMode",1,["fe_analyzer::namespace::items::IngotMode"]],["impl Sync for Item",1,["fe_analyzer::namespace::items::Item"]],["impl Sync for ModuleSource",1,["fe_analyzer::namespace::items::ModuleSource"]],["impl Sync for TypeDef",1,["fe_analyzer::namespace::items::TypeDef"]],["impl Sync for BlockScopeType",1,["fe_analyzer::namespace::scopes::BlockScopeType"]],["impl Sync for Base",1,["fe_analyzer::namespace::types::Base"]],["impl Sync for GenericArg",1,["fe_analyzer::namespace::types::GenericArg"]],["impl Sync for GenericParamKind",1,["fe_analyzer::namespace::types::GenericParamKind"]],["impl Sync for GenericType",1,["fe_analyzer::namespace::types::GenericType"]],["impl Sync for Integer",1,["fe_analyzer::namespace::types::Integer"]],["impl Sync for TraitOrType",1,["fe_analyzer::namespace::types::TraitOrType"]],["impl Sync for ConstructorKind",1,["fe_analyzer::traversal::pattern_analysis::ConstructorKind"]],["impl Sync for LiteralConstructor",1,["fe_analyzer::traversal::pattern_analysis::LiteralConstructor"]],["impl Sync for SimplifiedPatternKind",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPatternKind"]],["impl Sync for GlobalFunctionIter",1,["fe_analyzer::builtins::GlobalFunctionIter"]],["impl Sync for IntrinsicIter",1,["fe_analyzer::builtins::IntrinsicIter"]],["impl Sync for Adjustment",1,["fe_analyzer::context::Adjustment"]],["impl Sync for DiagnosticVoucher",1,["fe_analyzer::context::DiagnosticVoucher"]],["impl Sync for ExpressionAttributes",1,["fe_analyzer::context::ExpressionAttributes"]],["impl Sync for AllImplsQuery",1,["fe_analyzer::db::AllImplsQuery"]],["impl Sync for AnalyzerDbStorage",1,["fe_analyzer::db::AnalyzerDbStorage"]],["impl Sync for ContractAllFieldsQuery",1,["fe_analyzer::db::ContractAllFieldsQuery"]],["impl Sync for ContractAllFunctionsQuery",1,["fe_analyzer::db::ContractAllFunctionsQuery"]],["impl Sync for ContractCallFunctionQuery",1,["fe_analyzer::db::ContractCallFunctionQuery"]],["impl Sync for ContractDependencyGraphQuery",1,["fe_analyzer::db::ContractDependencyGraphQuery"]],["impl Sync for ContractFieldMapQuery",1,["fe_analyzer::db::ContractFieldMapQuery"]],["impl Sync for ContractFieldTypeQuery",1,["fe_analyzer::db::ContractFieldTypeQuery"]],["impl Sync for ContractFunctionMapQuery",1,["fe_analyzer::db::ContractFunctionMapQuery"]],["impl Sync for ContractInitFunctionQuery",1,["fe_analyzer::db::ContractInitFunctionQuery"]],["impl Sync for ContractPublicFunctionMapQuery",1,["fe_analyzer::db::ContractPublicFunctionMapQuery"]],["impl Sync for ContractRuntimeDependencyGraphQuery",1,["fe_analyzer::db::ContractRuntimeDependencyGraphQuery"]],["impl Sync for EnumAllFunctionsQuery",1,["fe_analyzer::db::EnumAllFunctionsQuery"]],["impl Sync for EnumAllVariantsQuery",1,["fe_analyzer::db::EnumAllVariantsQuery"]],["impl Sync for EnumDependencyGraphQuery",1,["fe_analyzer::db::EnumDependencyGraphQuery"]],["impl Sync for EnumFunctionMapQuery",1,["fe_analyzer::db::EnumFunctionMapQuery"]],["impl Sync for EnumVariantKindQuery",1,["fe_analyzer::db::EnumVariantKindQuery"]],["impl Sync for EnumVariantMapQuery",1,["fe_analyzer::db::EnumVariantMapQuery"]],["impl Sync for FunctionBodyQuery",1,["fe_analyzer::db::FunctionBodyQuery"]],["impl Sync for FunctionDependencyGraphQuery",1,["fe_analyzer::db::FunctionDependencyGraphQuery"]],["impl Sync for FunctionSignatureQuery",1,["fe_analyzer::db::FunctionSignatureQuery"]],["impl Sync for FunctionSigsQuery",1,["fe_analyzer::db::FunctionSigsQuery"]],["impl Sync for ImplAllFunctionsQuery",1,["fe_analyzer::db::ImplAllFunctionsQuery"]],["impl Sync for ImplForQuery",1,["fe_analyzer::db::ImplForQuery"]],["impl Sync for ImplFunctionMapQuery",1,["fe_analyzer::db::ImplFunctionMapQuery"]],["impl Sync for IngotExternalIngotsQuery",1,["fe_analyzer::db::IngotExternalIngotsQuery"]],["impl Sync for IngotFilesQuery",1,["fe_analyzer::db::IngotFilesQuery"]],["impl Sync for IngotModulesQuery",1,["fe_analyzer::db::IngotModulesQuery"]],["impl Sync for IngotRootModuleQuery",1,["fe_analyzer::db::IngotRootModuleQuery"]],["impl Sync for InternAttributeLookupQuery",1,["fe_analyzer::db::InternAttributeLookupQuery"]],["impl Sync for InternAttributeQuery",1,["fe_analyzer::db::InternAttributeQuery"]],["impl Sync for InternContractFieldLookupQuery",1,["fe_analyzer::db::InternContractFieldLookupQuery"]],["impl Sync for InternContractFieldQuery",1,["fe_analyzer::db::InternContractFieldQuery"]],["impl Sync for InternContractLookupQuery",1,["fe_analyzer::db::InternContractLookupQuery"]],["impl Sync for InternContractQuery",1,["fe_analyzer::db::InternContractQuery"]],["impl Sync for InternEnumLookupQuery",1,["fe_analyzer::db::InternEnumLookupQuery"]],["impl Sync for InternEnumQuery",1,["fe_analyzer::db::InternEnumQuery"]],["impl Sync for InternEnumVariantLookupQuery",1,["fe_analyzer::db::InternEnumVariantLookupQuery"]],["impl Sync for InternEnumVariantQuery",1,["fe_analyzer::db::InternEnumVariantQuery"]],["impl Sync for InternFunctionLookupQuery",1,["fe_analyzer::db::InternFunctionLookupQuery"]],["impl Sync for InternFunctionQuery",1,["fe_analyzer::db::InternFunctionQuery"]],["impl Sync for InternFunctionSigLookupQuery",1,["fe_analyzer::db::InternFunctionSigLookupQuery"]],["impl Sync for InternFunctionSigQuery",1,["fe_analyzer::db::InternFunctionSigQuery"]],["impl Sync for InternImplLookupQuery",1,["fe_analyzer::db::InternImplLookupQuery"]],["impl Sync for InternImplQuery",1,["fe_analyzer::db::InternImplQuery"]],["impl Sync for InternIngotLookupQuery",1,["fe_analyzer::db::InternIngotLookupQuery"]],["impl Sync for InternIngotQuery",1,["fe_analyzer::db::InternIngotQuery"]],["impl Sync for InternModuleConstLookupQuery",1,["fe_analyzer::db::InternModuleConstLookupQuery"]],["impl Sync for InternModuleConstQuery",1,["fe_analyzer::db::InternModuleConstQuery"]],["impl Sync for InternModuleLookupQuery",1,["fe_analyzer::db::InternModuleLookupQuery"]],["impl Sync for InternModuleQuery",1,["fe_analyzer::db::InternModuleQuery"]],["impl Sync for InternStructFieldLookupQuery",1,["fe_analyzer::db::InternStructFieldLookupQuery"]],["impl Sync for InternStructFieldQuery",1,["fe_analyzer::db::InternStructFieldQuery"]],["impl Sync for InternStructLookupQuery",1,["fe_analyzer::db::InternStructLookupQuery"]],["impl Sync for InternStructQuery",1,["fe_analyzer::db::InternStructQuery"]],["impl Sync for InternTraitLookupQuery",1,["fe_analyzer::db::InternTraitLookupQuery"]],["impl Sync for InternTraitQuery",1,["fe_analyzer::db::InternTraitQuery"]],["impl Sync for InternTypeAliasLookupQuery",1,["fe_analyzer::db::InternTypeAliasLookupQuery"]],["impl Sync for InternTypeAliasQuery",1,["fe_analyzer::db::InternTypeAliasQuery"]],["impl Sync for InternTypeLookupQuery",1,["fe_analyzer::db::InternTypeLookupQuery"]],["impl Sync for InternTypeQuery",1,["fe_analyzer::db::InternTypeQuery"]],["impl Sync for ModuleAllImplsQuery",1,["fe_analyzer::db::ModuleAllImplsQuery"]],["impl Sync for ModuleAllItemsQuery",1,["fe_analyzer::db::ModuleAllItemsQuery"]],["impl Sync for ModuleConstantTypeQuery",1,["fe_analyzer::db::ModuleConstantTypeQuery"]],["impl Sync for ModuleConstantValueQuery",1,["fe_analyzer::db::ModuleConstantValueQuery"]],["impl Sync for ModuleConstantsQuery",1,["fe_analyzer::db::ModuleConstantsQuery"]],["impl Sync for ModuleContractsQuery",1,["fe_analyzer::db::ModuleContractsQuery"]],["impl Sync for ModuleFilePathQuery",1,["fe_analyzer::db::ModuleFilePathQuery"]],["impl Sync for ModuleImplMapQuery",1,["fe_analyzer::db::ModuleImplMapQuery"]],["impl Sync for ModuleIsIncompleteQuery",1,["fe_analyzer::db::ModuleIsIncompleteQuery"]],["impl Sync for ModuleItemMapQuery",1,["fe_analyzer::db::ModuleItemMapQuery"]],["impl Sync for ModuleParentModuleQuery",1,["fe_analyzer::db::ModuleParentModuleQuery"]],["impl Sync for ModuleParseQuery",1,["fe_analyzer::db::ModuleParseQuery"]],["impl Sync for ModuleStructsQuery",1,["fe_analyzer::db::ModuleStructsQuery"]],["impl Sync for ModuleSubmodulesQuery",1,["fe_analyzer::db::ModuleSubmodulesQuery"]],["impl Sync for ModuleTestsQuery",1,["fe_analyzer::db::ModuleTestsQuery"]],["impl Sync for ModuleUsedItemMapQuery",1,["fe_analyzer::db::ModuleUsedItemMapQuery"]],["impl Sync for RootIngotQuery",1,["fe_analyzer::db::RootIngotQuery"]],["impl Sync for StructAllFieldsQuery",1,["fe_analyzer::db::StructAllFieldsQuery"]],["impl Sync for StructAllFunctionsQuery",1,["fe_analyzer::db::StructAllFunctionsQuery"]],["impl Sync for StructDependencyGraphQuery",1,["fe_analyzer::db::StructDependencyGraphQuery"]],["impl Sync for StructFieldMapQuery",1,["fe_analyzer::db::StructFieldMapQuery"]],["impl Sync for StructFieldTypeQuery",1,["fe_analyzer::db::StructFieldTypeQuery"]],["impl Sync for StructFunctionMapQuery",1,["fe_analyzer::db::StructFunctionMapQuery"]],["impl Sync for TraitAllFunctionsQuery",1,["fe_analyzer::db::TraitAllFunctionsQuery"]],["impl Sync for TraitFunctionMapQuery",1,["fe_analyzer::db::TraitFunctionMapQuery"]],["impl Sync for TraitIsImplementedForQuery",1,["fe_analyzer::db::TraitIsImplementedForQuery"]],["impl Sync for TypeAliasTypeQuery",1,["fe_analyzer::db::TypeAliasTypeQuery"]],["impl Sync for AlreadyDefined",1,["fe_analyzer::errors::AlreadyDefined"]],["impl Sync for ConstEvalError",1,["fe_analyzer::errors::ConstEvalError"]],["impl Sync for FatalError",1,["fe_analyzer::errors::FatalError"]],["impl Sync for IncompleteItem",1,["fe_analyzer::errors::IncompleteItem"]],["impl Sync for TypeError",1,["fe_analyzer::errors::TypeError"]],["impl Sync for Attribute",1,["fe_analyzer::namespace::items::Attribute"]],["impl Sync for AttributeId",1,["fe_analyzer::namespace::items::AttributeId"]],["impl Sync for Contract",1,["fe_analyzer::namespace::items::Contract"]],["impl Sync for ContractField",1,["fe_analyzer::namespace::items::ContractField"]],["impl Sync for ContractFieldId",1,["fe_analyzer::namespace::items::ContractFieldId"]],["impl Sync for ContractId",1,["fe_analyzer::namespace::items::ContractId"]],["impl Sync for Enum",1,["fe_analyzer::namespace::items::Enum"]],["impl Sync for EnumId",1,["fe_analyzer::namespace::items::EnumId"]],["impl Sync for EnumVariant",1,["fe_analyzer::namespace::items::EnumVariant"]],["impl Sync for EnumVariantId",1,["fe_analyzer::namespace::items::EnumVariantId"]],["impl Sync for Function",1,["fe_analyzer::namespace::items::Function"]],["impl Sync for FunctionId",1,["fe_analyzer::namespace::items::FunctionId"]],["impl Sync for FunctionSig",1,["fe_analyzer::namespace::items::FunctionSig"]],["impl Sync for FunctionSigId",1,["fe_analyzer::namespace::items::FunctionSigId"]],["impl Sync for Impl",1,["fe_analyzer::namespace::items::Impl"]],["impl Sync for ImplId",1,["fe_analyzer::namespace::items::ImplId"]],["impl Sync for Ingot",1,["fe_analyzer::namespace::items::Ingot"]],["impl Sync for IngotId",1,["fe_analyzer::namespace::items::IngotId"]],["impl Sync for Module",1,["fe_analyzer::namespace::items::Module"]],["impl Sync for ModuleConstant",1,["fe_analyzer::namespace::items::ModuleConstant"]],["impl Sync for ModuleConstantId",1,["fe_analyzer::namespace::items::ModuleConstantId"]],["impl Sync for ModuleId",1,["fe_analyzer::namespace::items::ModuleId"]],["impl Sync for Struct",1,["fe_analyzer::namespace::items::Struct"]],["impl Sync for StructField",1,["fe_analyzer::namespace::items::StructField"]],["impl Sync for StructFieldId",1,["fe_analyzer::namespace::items::StructFieldId"]],["impl Sync for StructId",1,["fe_analyzer::namespace::items::StructId"]],["impl Sync for Trait",1,["fe_analyzer::namespace::items::Trait"]],["impl Sync for TraitId",1,["fe_analyzer::namespace::items::TraitId"]],["impl Sync for TypeAlias",1,["fe_analyzer::namespace::items::TypeAlias"]],["impl Sync for TypeAliasId",1,["fe_analyzer::namespace::items::TypeAliasId"]],["impl Sync for Array",1,["fe_analyzer::namespace::types::Array"]],["impl Sync for CtxDecl",1,["fe_analyzer::namespace::types::CtxDecl"]],["impl Sync for FeString",1,["fe_analyzer::namespace::types::FeString"]],["impl Sync for FunctionParam",1,["fe_analyzer::namespace::types::FunctionParam"]],["impl Sync for FunctionSignature",1,["fe_analyzer::namespace::types::FunctionSignature"]],["impl Sync for GenericParam",1,["fe_analyzer::namespace::types::GenericParam"]],["impl Sync for GenericTypeIter",1,["fe_analyzer::namespace::types::GenericTypeIter"]],["impl Sync for IntegerIter",1,["fe_analyzer::namespace::types::IntegerIter"]],["impl Sync for Map",1,["fe_analyzer::namespace::types::Map"]],["impl Sync for SelfDecl",1,["fe_analyzer::namespace::types::SelfDecl"]],["impl Sync for TypeId",1,["fe_analyzer::namespace::types::TypeId"]],["impl Sync for PatternMatrix",1,["fe_analyzer::traversal::pattern_analysis::PatternMatrix"]],["impl Sync for PatternRowVec",1,["fe_analyzer::traversal::pattern_analysis::PatternRowVec"]],["impl Sync for SigmaSet",1,["fe_analyzer::traversal::pattern_analysis::SigmaSet"]],["impl Sync for SimplifiedPattern",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPattern"]],["impl<'a> !Sync for FunctionScope<'a>",1,["fe_analyzer::namespace::scopes::FunctionScope"]],["impl<'a> !Sync for ItemScope<'a>",1,["fe_analyzer::namespace::scopes::ItemScope"]],["impl<'a, 'b> !Sync for BlockScope<'a, 'b>",1,["fe_analyzer::namespace::scopes::BlockScope"]],["impl<'a, T> !Sync for DisplayableWrapper<'a, T>",1,["fe_analyzer::display::DisplayableWrapper"]],["impl<T> !Sync for Analysis<T>",1,["fe_analyzer::context::Analysis"]]]],["fe_codegen",[["impl !Sync for CodegenDbGroupStorage__",1,["fe_codegen::db::CodegenDbGroupStorage__"]],["impl !Sync for Db",1,["fe_codegen::db::Db"]],["impl !Sync for Context",1,["fe_codegen::yul::isel::context::Context"]],["impl Sync for AbiSrcLocation",1,["fe_codegen::yul::runtime::AbiSrcLocation"]],["impl Sync for CodegenAbiContractQuery",1,["fe_codegen::db::CodegenAbiContractQuery"]],["impl Sync for CodegenAbiEventQuery",1,["fe_codegen::db::CodegenAbiEventQuery"]],["impl Sync for CodegenAbiFunctionArgumentMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionArgumentMaximumSizeQuery"]],["impl Sync for CodegenAbiFunctionQuery",1,["fe_codegen::db::CodegenAbiFunctionQuery"]],["impl Sync for CodegenAbiFunctionReturnMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionReturnMaximumSizeQuery"]],["impl Sync for CodegenAbiModuleEventsQuery",1,["fe_codegen::db::CodegenAbiModuleEventsQuery"]],["impl Sync for CodegenAbiTypeMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMaximumSizeQuery"]],["impl Sync for CodegenAbiTypeMinimumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMinimumSizeQuery"]],["impl Sync for CodegenAbiTypeQuery",1,["fe_codegen::db::CodegenAbiTypeQuery"]],["impl Sync for CodegenConstantStringSymbolNameQuery",1,["fe_codegen::db::CodegenConstantStringSymbolNameQuery"]],["impl Sync for CodegenContractDeployerSymbolNameQuery",1,["fe_codegen::db::CodegenContractDeployerSymbolNameQuery"]],["impl Sync for CodegenContractSymbolNameQuery",1,["fe_codegen::db::CodegenContractSymbolNameQuery"]],["impl Sync for CodegenDbStorage",1,["fe_codegen::db::CodegenDbStorage"]],["impl Sync for CodegenFunctionSymbolNameQuery",1,["fe_codegen::db::CodegenFunctionSymbolNameQuery"]],["impl Sync for CodegenLegalizedBodyQuery",1,["fe_codegen::db::CodegenLegalizedBodyQuery"]],["impl Sync for CodegenLegalizedSignatureQuery",1,["fe_codegen::db::CodegenLegalizedSignatureQuery"]],["impl Sync for CodegenLegalizedTypeQuery",1,["fe_codegen::db::CodegenLegalizedTypeQuery"]],["impl Sync for DefaultRuntimeProvider",1,["fe_codegen::yul::runtime::DefaultRuntimeProvider"]]]],["fe_common",[["impl !Sync for SourceDbGroupStorage__",1,["fe_common::db::SourceDbGroupStorage__"]],["impl !Sync for TestDb",1,["fe_common::db::TestDb"]],["impl !Sync for File",1,["fe_common::files::File"]],["impl Sync for LabelStyle",1,["fe_common::diagnostics::LabelStyle"]],["impl Sync for FileKind",1,["fe_common::files::FileKind"]],["impl Sync for Radix",1,["fe_common::numeric::Radix"]],["impl Sync for DependencyKind",1,["fe_common::utils::files::DependencyKind"]],["impl Sync for FileLoader",1,["fe_common::utils::files::FileLoader"]],["impl Sync for ProjectMode",1,["fe_common::utils::files::ProjectMode"]],["impl Sync for FileContentQuery",1,["fe_common::db::FileContentQuery"]],["impl Sync for FileLineStartsQuery",1,["fe_common::db::FileLineStartsQuery"]],["impl Sync for FileNameQuery",1,["fe_common::db::FileNameQuery"]],["impl Sync for InternFileLookupQuery",1,["fe_common::db::InternFileLookupQuery"]],["impl Sync for InternFileQuery",1,["fe_common::db::InternFileQuery"]],["impl Sync for SourceDbStorage",1,["fe_common::db::SourceDbStorage"]],["impl Sync for Diagnostic",1,["fe_common::diagnostics::Diagnostic"]],["impl Sync for Label",1,["fe_common::diagnostics::Label"]],["impl Sync for SourceFileId",1,["fe_common::files::SourceFileId"]],["impl Sync for Span",1,["fe_common::span::Span"]],["impl Sync for BuildFiles",1,["fe_common::utils::files::BuildFiles"]],["impl Sync for Dependency",1,["fe_common::utils::files::Dependency"]],["impl Sync for GitDependency",1,["fe_common::utils::files::GitDependency"]],["impl Sync for LocalDependency",1,["fe_common::utils::files::LocalDependency"]],["impl Sync for ProjectFiles",1,["fe_common::utils::files::ProjectFiles"]],["impl Sync for Diff",1,["fe_common::utils::ron::Diff"]],["impl<'a> Sync for Literal<'a>",1,["fe_common::numeric::Literal"]]]],["fe_compiler_test_utils",[["impl !Sync for ContractHarness",1,["fe_compiler_test_utils::ContractHarness"]],["impl !Sync for GasReporter",1,["fe_compiler_test_utils::GasReporter"]],["impl Sync for ExecutionOutput",1,["fe_compiler_test_utils::ExecutionOutput"]],["impl Sync for GasRecord",1,["fe_compiler_test_utils::GasRecord"]],["impl Sync for NumericAbiTokenBounds",1,["fe_compiler_test_utils::NumericAbiTokenBounds"]],["impl Sync for Runtime",1,["fe_compiler_test_utils::Runtime"]],["impl Sync for SolidityCompileError",1,["fe_compiler_test_utils::SolidityCompileError"]]]],["fe_driver",[["impl Sync for CompileError",1,["fe_driver::CompileError"]],["impl Sync for CompiledContract",1,["fe_driver::CompiledContract"]],["impl Sync for CompiledModule",1,["fe_driver::CompiledModule"]]]],["fe_mir",[["impl !Sync for MirDbGroupStorage__",1,["fe_mir::db::MirDbGroupStorage__"]],["impl !Sync for NewDb",1,["fe_mir::db::NewDb"]],["impl Sync for PostIDom",1,["fe_mir::analysis::post_domtree::PostIDom"]],["impl Sync for CursorLocation",1,["fe_mir::ir::body_cursor::CursorLocation"]],["impl Sync for ConstantValue",1,["fe_mir::ir::constant::ConstantValue"]],["impl Sync for Linkage",1,["fe_mir::ir::function::Linkage"]],["impl Sync for BinOp",1,["fe_mir::ir::inst::BinOp"]],["impl Sync for CallType",1,["fe_mir::ir::inst::CallType"]],["impl Sync for CastKind",1,["fe_mir::ir::inst::CastKind"]],["impl Sync for InstKind",1,["fe_mir::ir::inst::InstKind"]],["impl Sync for UnOp",1,["fe_mir::ir::inst::UnOp"]],["impl Sync for YulIntrinsicOp",1,["fe_mir::ir::inst::YulIntrinsicOp"]],["impl Sync for TypeKind",1,["fe_mir::ir::types::TypeKind"]],["impl Sync for AssignableValue",1,["fe_mir::ir::value::AssignableValue"]],["impl Sync for Value",1,["fe_mir::ir::value::Value"]],["impl Sync for ControlFlowGraph",1,["fe_mir::analysis::cfg::ControlFlowGraph"]],["impl Sync for DFSet",1,["fe_mir::analysis::domtree::DFSet"]],["impl Sync for DomTree",1,["fe_mir::analysis::domtree::DomTree"]],["impl Sync for Loop",1,["fe_mir::analysis::loop_tree::Loop"]],["impl Sync for LoopTree",1,["fe_mir::analysis::loop_tree::LoopTree"]],["impl Sync for PostDomTree",1,["fe_mir::analysis::post_domtree::PostDomTree"]],["impl Sync for MirDbStorage",1,["fe_mir::db::MirDbStorage"]],["impl Sync for MirInternConstLookupQuery",1,["fe_mir::db::MirInternConstLookupQuery"]],["impl Sync for MirInternConstQuery",1,["fe_mir::db::MirInternConstQuery"]],["impl Sync for MirInternFunctionLookupQuery",1,["fe_mir::db::MirInternFunctionLookupQuery"]],["impl Sync for MirInternFunctionQuery",1,["fe_mir::db::MirInternFunctionQuery"]],["impl Sync for MirInternTypeLookupQuery",1,["fe_mir::db::MirInternTypeLookupQuery"]],["impl Sync for MirInternTypeQuery",1,["fe_mir::db::MirInternTypeQuery"]],["impl Sync for MirLowerContractAllFunctionsQuery",1,["fe_mir::db::MirLowerContractAllFunctionsQuery"]],["impl Sync for MirLowerEnumAllFunctionsQuery",1,["fe_mir::db::MirLowerEnumAllFunctionsQuery"]],["impl Sync for MirLowerModuleAllFunctionsQuery",1,["fe_mir::db::MirLowerModuleAllFunctionsQuery"]],["impl Sync for MirLowerStructAllFunctionsQuery",1,["fe_mir::db::MirLowerStructAllFunctionsQuery"]],["impl Sync for MirLoweredConstantQuery",1,["fe_mir::db::MirLoweredConstantQuery"]],["impl Sync for MirLoweredFuncBodyQuery",1,["fe_mir::db::MirLoweredFuncBodyQuery"]],["impl Sync for MirLoweredFuncSignatureQuery",1,["fe_mir::db::MirLoweredFuncSignatureQuery"]],["impl Sync for MirLoweredMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredMonomorphizedFuncSignatureQuery"]],["impl Sync for MirLoweredPseudoMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredPseudoMonomorphizedFuncSignatureQuery"]],["impl Sync for MirLoweredTypeQuery",1,["fe_mir::db::MirLoweredTypeQuery"]],["impl Sync for BasicBlock",1,["fe_mir::ir::basic_block::BasicBlock"]],["impl Sync for BodyBuilder",1,["fe_mir::ir::body_builder::BodyBuilder"]],["impl Sync for BodyOrder",1,["fe_mir::ir::body_order::BodyOrder"]],["impl Sync for Constant",1,["fe_mir::ir::constant::Constant"]],["impl Sync for ConstantId",1,["fe_mir::ir::constant::ConstantId"]],["impl Sync for BodyDataStore",1,["fe_mir::ir::function::BodyDataStore"]],["impl Sync for FunctionBody",1,["fe_mir::ir::function::FunctionBody"]],["impl Sync for FunctionId",1,["fe_mir::ir::function::FunctionId"]],["impl Sync for FunctionParam",1,["fe_mir::ir::function::FunctionParam"]],["impl Sync for FunctionSignature",1,["fe_mir::ir::function::FunctionSignature"]],["impl Sync for Inst",1,["fe_mir::ir::inst::Inst"]],["impl Sync for SwitchTable",1,["fe_mir::ir::inst::SwitchTable"]],["impl Sync for SourceInfo",1,["fe_mir::ir::SourceInfo"]],["impl Sync for ArrayDef",1,["fe_mir::ir::types::ArrayDef"]],["impl Sync for EnumDef",1,["fe_mir::ir::types::EnumDef"]],["impl Sync for EnumVariant",1,["fe_mir::ir::types::EnumVariant"]],["impl Sync for EventDef",1,["fe_mir::ir::types::EventDef"]],["impl Sync for MapDef",1,["fe_mir::ir::types::MapDef"]],["impl Sync for StructDef",1,["fe_mir::ir::types::StructDef"]],["impl Sync for TupleDef",1,["fe_mir::ir::types::TupleDef"]],["impl Sync for Type",1,["fe_mir::ir::types::Type"]],["impl Sync for TypeId",1,["fe_mir::ir::types::TypeId"]],["impl Sync for Local",1,["fe_mir::ir::value::Local"]],["impl<'a> Sync for BranchInfo<'a>",1,["fe_mir::ir::inst::BranchInfo"]],["impl<'a> Sync for CfgPostOrder<'a>",1,["fe_mir::analysis::cfg::CfgPostOrder"]],["impl<'a> Sync for BodyCursor<'a>",1,["fe_mir::ir::body_cursor::BodyCursor"]],["impl<'a, 'b> Sync for BlocksInLoopPostOrder<'a, 'b>",1,["fe_mir::analysis::loop_tree::BlocksInLoopPostOrder"]],["impl<'a, T> Sync for IterBase<'a, T>
where\n T: Sync,
",1,["fe_mir::ir::inst::IterBase"]],["impl<'a, T> Sync for IterMutBase<'a, T>
where\n T: Sync,
",1,["fe_mir::ir::inst::IterMutBase"]]]],["fe_parser",[["impl Sync for BinOperator",1,["fe_parser::ast::BinOperator"]],["impl Sync for BoolOperator",1,["fe_parser::ast::BoolOperator"]],["impl Sync for CompOperator",1,["fe_parser::ast::CompOperator"]],["impl Sync for ContractStmt",1,["fe_parser::ast::ContractStmt"]],["impl Sync for Expr",1,["fe_parser::ast::Expr"]],["impl Sync for FuncStmt",1,["fe_parser::ast::FuncStmt"]],["impl Sync for FunctionArg",1,["fe_parser::ast::FunctionArg"]],["impl Sync for GenericArg",1,["fe_parser::ast::GenericArg"]],["impl Sync for GenericParameter",1,["fe_parser::ast::GenericParameter"]],["impl Sync for LiteralPattern",1,["fe_parser::ast::LiteralPattern"]],["impl Sync for ModuleStmt",1,["fe_parser::ast::ModuleStmt"]],["impl Sync for Pattern",1,["fe_parser::ast::Pattern"]],["impl Sync for TypeDesc",1,["fe_parser::ast::TypeDesc"]],["impl Sync for UnaryOperator",1,["fe_parser::ast::UnaryOperator"]],["impl Sync for UseTree",1,["fe_parser::ast::UseTree"]],["impl Sync for VarDeclTarget",1,["fe_parser::ast::VarDeclTarget"]],["impl Sync for VariantKind",1,["fe_parser::ast::VariantKind"]],["impl Sync for TokenKind",1,["fe_parser::lexer::token::TokenKind"]],["impl Sync for CallArg",1,["fe_parser::ast::CallArg"]],["impl Sync for ConstantDecl",1,["fe_parser::ast::ConstantDecl"]],["impl Sync for Contract",1,["fe_parser::ast::Contract"]],["impl Sync for Enum",1,["fe_parser::ast::Enum"]],["impl Sync for Field",1,["fe_parser::ast::Field"]],["impl Sync for Function",1,["fe_parser::ast::Function"]],["impl Sync for FunctionSignature",1,["fe_parser::ast::FunctionSignature"]],["impl Sync for Impl",1,["fe_parser::ast::Impl"]],["impl Sync for MatchArm",1,["fe_parser::ast::MatchArm"]],["impl Sync for Module",1,["fe_parser::ast::Module"]],["impl Sync for Path",1,["fe_parser::ast::Path"]],["impl Sync for Pragma",1,["fe_parser::ast::Pragma"]],["impl Sync for Struct",1,["fe_parser::ast::Struct"]],["impl Sync for Trait",1,["fe_parser::ast::Trait"]],["impl Sync for TypeAlias",1,["fe_parser::ast::TypeAlias"]],["impl Sync for Use",1,["fe_parser::ast::Use"]],["impl Sync for Variant",1,["fe_parser::ast::Variant"]],["impl Sync for NodeId",1,["fe_parser::node::NodeId"]],["impl Sync for ParseFailed",1,["fe_parser::parser::ParseFailed"]],["impl<'a> Sync for Lexer<'a>",1,["fe_parser::lexer::Lexer"]],["impl<'a> Sync for Token<'a>",1,["fe_parser::lexer::token::Token"]],["impl<'a> Sync for Parser<'a>",1,["fe_parser::parser::Parser"]],["impl<T> Sync for Node<T>
where\n T: Sync,
",1,["fe_parser::node::Node"]]]],["fe_test_runner",[["impl Sync for TestSink",1,["fe_test_runner::TestSink"]]]],["fe_yulc",[["impl Sync for ContractBytecode",1,["fe_yulc::ContractBytecode"]],["impl Sync for YulcError",1,["fe_yulc::YulcError"]]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1741,3762,63746,8134,8341,2446,934,22317,12386,318,602]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/marker/trait.Unpin.js b/compiler-docs/trait.impl/core/marker/trait.Unpin.js new file mode 100644 index 0000000000..515df376c5 --- /dev/null +++ b/compiler-docs/trait.impl/core/marker/trait.Unpin.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl Unpin for Emit",1,["fe::task::build::Emit"]],["impl Unpin for Commands",1,["fe::task::Commands"]],["impl Unpin for FelangCli",1,["fe::FelangCli"]],["impl Unpin for BuildArgs",1,["fe::task::build::BuildArgs"]],["impl Unpin for CheckArgs",1,["fe::task::check::CheckArgs"]],["impl Unpin for NewProjectArgs",1,["fe::task::new::NewProjectArgs"]]]],["fe_abi",[["impl Unpin for AbiFunctionType",1,["fe_abi::function::AbiFunctionType"]],["impl Unpin for CtxParam",1,["fe_abi::function::CtxParam"]],["impl Unpin for SelfParam",1,["fe_abi::function::SelfParam"]],["impl Unpin for StateMutability",1,["fe_abi::function::StateMutability"]],["impl Unpin for AbiType",1,["fe_abi::types::AbiType"]],["impl Unpin for AbiContract",1,["fe_abi::contract::AbiContract"]],["impl Unpin for AbiEvent",1,["fe_abi::event::AbiEvent"]],["impl Unpin for AbiEventField",1,["fe_abi::event::AbiEventField"]],["impl Unpin for AbiEventSignature",1,["fe_abi::event::AbiEventSignature"]],["impl Unpin for AbiFunction",1,["fe_abi::function::AbiFunction"]],["impl Unpin for AbiFunctionSelector",1,["fe_abi::function::AbiFunctionSelector"]],["impl Unpin for AbiTupleField",1,["fe_abi::types::AbiTupleField"]]]],["fe_analyzer",[["impl Unpin for ContractTypeMethod",1,["fe_analyzer::builtins::ContractTypeMethod"]],["impl Unpin for GlobalFunction",1,["fe_analyzer::builtins::GlobalFunction"]],["impl Unpin for Intrinsic",1,["fe_analyzer::builtins::Intrinsic"]],["impl Unpin for ValueMethod",1,["fe_analyzer::builtins::ValueMethod"]],["impl Unpin for AdjustmentKind",1,["fe_analyzer::context::AdjustmentKind"]],["impl Unpin for CallType",1,["fe_analyzer::context::CallType"]],["impl Unpin for Constant",1,["fe_analyzer::context::Constant"]],["impl Unpin for NamedThing",1,["fe_analyzer::context::NamedThing"]],["impl Unpin for BinaryOperationError",1,["fe_analyzer::errors::BinaryOperationError"]],["impl Unpin for IndexingError",1,["fe_analyzer::errors::IndexingError"]],["impl Unpin for TypeCoercionError",1,["fe_analyzer::errors::TypeCoercionError"]],["impl Unpin for DepLocality",1,["fe_analyzer::namespace::items::DepLocality"]],["impl Unpin for EnumVariantKind",1,["fe_analyzer::namespace::items::EnumVariantKind"]],["impl Unpin for IngotMode",1,["fe_analyzer::namespace::items::IngotMode"]],["impl Unpin for Item",1,["fe_analyzer::namespace::items::Item"]],["impl Unpin for ModuleSource",1,["fe_analyzer::namespace::items::ModuleSource"]],["impl Unpin for TypeDef",1,["fe_analyzer::namespace::items::TypeDef"]],["impl Unpin for BlockScopeType",1,["fe_analyzer::namespace::scopes::BlockScopeType"]],["impl Unpin for Base",1,["fe_analyzer::namespace::types::Base"]],["impl Unpin for GenericArg",1,["fe_analyzer::namespace::types::GenericArg"]],["impl Unpin for GenericParamKind",1,["fe_analyzer::namespace::types::GenericParamKind"]],["impl Unpin for GenericType",1,["fe_analyzer::namespace::types::GenericType"]],["impl Unpin for Integer",1,["fe_analyzer::namespace::types::Integer"]],["impl Unpin for TraitOrType",1,["fe_analyzer::namespace::types::TraitOrType"]],["impl Unpin for Type",1,["fe_analyzer::namespace::types::Type"]],["impl Unpin for ConstructorKind",1,["fe_analyzer::traversal::pattern_analysis::ConstructorKind"]],["impl Unpin for LiteralConstructor",1,["fe_analyzer::traversal::pattern_analysis::LiteralConstructor"]],["impl Unpin for SimplifiedPatternKind",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPatternKind"]],["impl Unpin for GlobalFunctionIter",1,["fe_analyzer::builtins::GlobalFunctionIter"]],["impl Unpin for IntrinsicIter",1,["fe_analyzer::builtins::IntrinsicIter"]],["impl Unpin for Adjustment",1,["fe_analyzer::context::Adjustment"]],["impl Unpin for DiagnosticVoucher",1,["fe_analyzer::context::DiagnosticVoucher"]],["impl Unpin for ExpressionAttributes",1,["fe_analyzer::context::ExpressionAttributes"]],["impl Unpin for FunctionBody",1,["fe_analyzer::context::FunctionBody"]],["impl Unpin for TempContext",1,["fe_analyzer::context::TempContext"]],["impl Unpin for AllImplsQuery",1,["fe_analyzer::db::AllImplsQuery"]],["impl Unpin for AnalyzerDbGroupStorage__",1,["fe_analyzer::db::AnalyzerDbGroupStorage__"]],["impl Unpin for AnalyzerDbStorage",1,["fe_analyzer::db::AnalyzerDbStorage"]],["impl Unpin for ContractAllFieldsQuery",1,["fe_analyzer::db::ContractAllFieldsQuery"]],["impl Unpin for ContractAllFunctionsQuery",1,["fe_analyzer::db::ContractAllFunctionsQuery"]],["impl Unpin for ContractCallFunctionQuery",1,["fe_analyzer::db::ContractCallFunctionQuery"]],["impl Unpin for ContractDependencyGraphQuery",1,["fe_analyzer::db::ContractDependencyGraphQuery"]],["impl Unpin for ContractFieldMapQuery",1,["fe_analyzer::db::ContractFieldMapQuery"]],["impl Unpin for ContractFieldTypeQuery",1,["fe_analyzer::db::ContractFieldTypeQuery"]],["impl Unpin for ContractFunctionMapQuery",1,["fe_analyzer::db::ContractFunctionMapQuery"]],["impl Unpin for ContractInitFunctionQuery",1,["fe_analyzer::db::ContractInitFunctionQuery"]],["impl Unpin for ContractPublicFunctionMapQuery",1,["fe_analyzer::db::ContractPublicFunctionMapQuery"]],["impl Unpin for ContractRuntimeDependencyGraphQuery",1,["fe_analyzer::db::ContractRuntimeDependencyGraphQuery"]],["impl Unpin for EnumAllFunctionsQuery",1,["fe_analyzer::db::EnumAllFunctionsQuery"]],["impl Unpin for EnumAllVariantsQuery",1,["fe_analyzer::db::EnumAllVariantsQuery"]],["impl Unpin for EnumDependencyGraphQuery",1,["fe_analyzer::db::EnumDependencyGraphQuery"]],["impl Unpin for EnumFunctionMapQuery",1,["fe_analyzer::db::EnumFunctionMapQuery"]],["impl Unpin for EnumVariantKindQuery",1,["fe_analyzer::db::EnumVariantKindQuery"]],["impl Unpin for EnumVariantMapQuery",1,["fe_analyzer::db::EnumVariantMapQuery"]],["impl Unpin for FunctionBodyQuery",1,["fe_analyzer::db::FunctionBodyQuery"]],["impl Unpin for FunctionDependencyGraphQuery",1,["fe_analyzer::db::FunctionDependencyGraphQuery"]],["impl Unpin for FunctionSignatureQuery",1,["fe_analyzer::db::FunctionSignatureQuery"]],["impl Unpin for FunctionSigsQuery",1,["fe_analyzer::db::FunctionSigsQuery"]],["impl Unpin for ImplAllFunctionsQuery",1,["fe_analyzer::db::ImplAllFunctionsQuery"]],["impl Unpin for ImplForQuery",1,["fe_analyzer::db::ImplForQuery"]],["impl Unpin for ImplFunctionMapQuery",1,["fe_analyzer::db::ImplFunctionMapQuery"]],["impl Unpin for IngotExternalIngotsQuery",1,["fe_analyzer::db::IngotExternalIngotsQuery"]],["impl Unpin for IngotFilesQuery",1,["fe_analyzer::db::IngotFilesQuery"]],["impl Unpin for IngotModulesQuery",1,["fe_analyzer::db::IngotModulesQuery"]],["impl Unpin for IngotRootModuleQuery",1,["fe_analyzer::db::IngotRootModuleQuery"]],["impl Unpin for InternAttributeLookupQuery",1,["fe_analyzer::db::InternAttributeLookupQuery"]],["impl Unpin for InternAttributeQuery",1,["fe_analyzer::db::InternAttributeQuery"]],["impl Unpin for InternContractFieldLookupQuery",1,["fe_analyzer::db::InternContractFieldLookupQuery"]],["impl Unpin for InternContractFieldQuery",1,["fe_analyzer::db::InternContractFieldQuery"]],["impl Unpin for InternContractLookupQuery",1,["fe_analyzer::db::InternContractLookupQuery"]],["impl Unpin for InternContractQuery",1,["fe_analyzer::db::InternContractQuery"]],["impl Unpin for InternEnumLookupQuery",1,["fe_analyzer::db::InternEnumLookupQuery"]],["impl Unpin for InternEnumQuery",1,["fe_analyzer::db::InternEnumQuery"]],["impl Unpin for InternEnumVariantLookupQuery",1,["fe_analyzer::db::InternEnumVariantLookupQuery"]],["impl Unpin for InternEnumVariantQuery",1,["fe_analyzer::db::InternEnumVariantQuery"]],["impl Unpin for InternFunctionLookupQuery",1,["fe_analyzer::db::InternFunctionLookupQuery"]],["impl Unpin for InternFunctionQuery",1,["fe_analyzer::db::InternFunctionQuery"]],["impl Unpin for InternFunctionSigLookupQuery",1,["fe_analyzer::db::InternFunctionSigLookupQuery"]],["impl Unpin for InternFunctionSigQuery",1,["fe_analyzer::db::InternFunctionSigQuery"]],["impl Unpin for InternImplLookupQuery",1,["fe_analyzer::db::InternImplLookupQuery"]],["impl Unpin for InternImplQuery",1,["fe_analyzer::db::InternImplQuery"]],["impl Unpin for InternIngotLookupQuery",1,["fe_analyzer::db::InternIngotLookupQuery"]],["impl Unpin for InternIngotQuery",1,["fe_analyzer::db::InternIngotQuery"]],["impl Unpin for InternModuleConstLookupQuery",1,["fe_analyzer::db::InternModuleConstLookupQuery"]],["impl Unpin for InternModuleConstQuery",1,["fe_analyzer::db::InternModuleConstQuery"]],["impl Unpin for InternModuleLookupQuery",1,["fe_analyzer::db::InternModuleLookupQuery"]],["impl Unpin for InternModuleQuery",1,["fe_analyzer::db::InternModuleQuery"]],["impl Unpin for InternStructFieldLookupQuery",1,["fe_analyzer::db::InternStructFieldLookupQuery"]],["impl Unpin for InternStructFieldQuery",1,["fe_analyzer::db::InternStructFieldQuery"]],["impl Unpin for InternStructLookupQuery",1,["fe_analyzer::db::InternStructLookupQuery"]],["impl Unpin for InternStructQuery",1,["fe_analyzer::db::InternStructQuery"]],["impl Unpin for InternTraitLookupQuery",1,["fe_analyzer::db::InternTraitLookupQuery"]],["impl Unpin for InternTraitQuery",1,["fe_analyzer::db::InternTraitQuery"]],["impl Unpin for InternTypeAliasLookupQuery",1,["fe_analyzer::db::InternTypeAliasLookupQuery"]],["impl Unpin for InternTypeAliasQuery",1,["fe_analyzer::db::InternTypeAliasQuery"]],["impl Unpin for InternTypeLookupQuery",1,["fe_analyzer::db::InternTypeLookupQuery"]],["impl Unpin for InternTypeQuery",1,["fe_analyzer::db::InternTypeQuery"]],["impl Unpin for ModuleAllImplsQuery",1,["fe_analyzer::db::ModuleAllImplsQuery"]],["impl Unpin for ModuleAllItemsQuery",1,["fe_analyzer::db::ModuleAllItemsQuery"]],["impl Unpin for ModuleConstantTypeQuery",1,["fe_analyzer::db::ModuleConstantTypeQuery"]],["impl Unpin for ModuleConstantValueQuery",1,["fe_analyzer::db::ModuleConstantValueQuery"]],["impl Unpin for ModuleConstantsQuery",1,["fe_analyzer::db::ModuleConstantsQuery"]],["impl Unpin for ModuleContractsQuery",1,["fe_analyzer::db::ModuleContractsQuery"]],["impl Unpin for ModuleFilePathQuery",1,["fe_analyzer::db::ModuleFilePathQuery"]],["impl Unpin for ModuleImplMapQuery",1,["fe_analyzer::db::ModuleImplMapQuery"]],["impl Unpin for ModuleIsIncompleteQuery",1,["fe_analyzer::db::ModuleIsIncompleteQuery"]],["impl Unpin for ModuleItemMapQuery",1,["fe_analyzer::db::ModuleItemMapQuery"]],["impl Unpin for ModuleParentModuleQuery",1,["fe_analyzer::db::ModuleParentModuleQuery"]],["impl Unpin for ModuleParseQuery",1,["fe_analyzer::db::ModuleParseQuery"]],["impl Unpin for ModuleStructsQuery",1,["fe_analyzer::db::ModuleStructsQuery"]],["impl Unpin for ModuleSubmodulesQuery",1,["fe_analyzer::db::ModuleSubmodulesQuery"]],["impl Unpin for ModuleTestsQuery",1,["fe_analyzer::db::ModuleTestsQuery"]],["impl Unpin for ModuleUsedItemMapQuery",1,["fe_analyzer::db::ModuleUsedItemMapQuery"]],["impl Unpin for RootIngotQuery",1,["fe_analyzer::db::RootIngotQuery"]],["impl Unpin for StructAllFieldsQuery",1,["fe_analyzer::db::StructAllFieldsQuery"]],["impl Unpin for StructAllFunctionsQuery",1,["fe_analyzer::db::StructAllFunctionsQuery"]],["impl Unpin for StructDependencyGraphQuery",1,["fe_analyzer::db::StructDependencyGraphQuery"]],["impl Unpin for StructFieldMapQuery",1,["fe_analyzer::db::StructFieldMapQuery"]],["impl Unpin for StructFieldTypeQuery",1,["fe_analyzer::db::StructFieldTypeQuery"]],["impl Unpin for StructFunctionMapQuery",1,["fe_analyzer::db::StructFunctionMapQuery"]],["impl Unpin for TestDb",1,["fe_analyzer::db::TestDb"]],["impl Unpin for TraitAllFunctionsQuery",1,["fe_analyzer::db::TraitAllFunctionsQuery"]],["impl Unpin for TraitFunctionMapQuery",1,["fe_analyzer::db::TraitFunctionMapQuery"]],["impl Unpin for TraitIsImplementedForQuery",1,["fe_analyzer::db::TraitIsImplementedForQuery"]],["impl Unpin for TypeAliasTypeQuery",1,["fe_analyzer::db::TypeAliasTypeQuery"]],["impl Unpin for AlreadyDefined",1,["fe_analyzer::errors::AlreadyDefined"]],["impl Unpin for ConstEvalError",1,["fe_analyzer::errors::ConstEvalError"]],["impl Unpin for FatalError",1,["fe_analyzer::errors::FatalError"]],["impl Unpin for IncompleteItem",1,["fe_analyzer::errors::IncompleteItem"]],["impl Unpin for TypeError",1,["fe_analyzer::errors::TypeError"]],["impl Unpin for Attribute",1,["fe_analyzer::namespace::items::Attribute"]],["impl Unpin for AttributeId",1,["fe_analyzer::namespace::items::AttributeId"]],["impl Unpin for Contract",1,["fe_analyzer::namespace::items::Contract"]],["impl Unpin for ContractField",1,["fe_analyzer::namespace::items::ContractField"]],["impl Unpin for ContractFieldId",1,["fe_analyzer::namespace::items::ContractFieldId"]],["impl Unpin for ContractId",1,["fe_analyzer::namespace::items::ContractId"]],["impl Unpin for DepGraphWrapper",1,["fe_analyzer::namespace::items::DepGraphWrapper"]],["impl Unpin for Enum",1,["fe_analyzer::namespace::items::Enum"]],["impl Unpin for EnumId",1,["fe_analyzer::namespace::items::EnumId"]],["impl Unpin for EnumVariant",1,["fe_analyzer::namespace::items::EnumVariant"]],["impl Unpin for EnumVariantId",1,["fe_analyzer::namespace::items::EnumVariantId"]],["impl Unpin for Function",1,["fe_analyzer::namespace::items::Function"]],["impl Unpin for FunctionId",1,["fe_analyzer::namespace::items::FunctionId"]],["impl Unpin for FunctionSig",1,["fe_analyzer::namespace::items::FunctionSig"]],["impl Unpin for FunctionSigId",1,["fe_analyzer::namespace::items::FunctionSigId"]],["impl Unpin for Impl",1,["fe_analyzer::namespace::items::Impl"]],["impl Unpin for ImplId",1,["fe_analyzer::namespace::items::ImplId"]],["impl Unpin for Ingot",1,["fe_analyzer::namespace::items::Ingot"]],["impl Unpin for IngotId",1,["fe_analyzer::namespace::items::IngotId"]],["impl Unpin for Module",1,["fe_analyzer::namespace::items::Module"]],["impl Unpin for ModuleConstant",1,["fe_analyzer::namespace::items::ModuleConstant"]],["impl Unpin for ModuleConstantId",1,["fe_analyzer::namespace::items::ModuleConstantId"]],["impl Unpin for ModuleId",1,["fe_analyzer::namespace::items::ModuleId"]],["impl Unpin for Struct",1,["fe_analyzer::namespace::items::Struct"]],["impl Unpin for StructField",1,["fe_analyzer::namespace::items::StructField"]],["impl Unpin for StructFieldId",1,["fe_analyzer::namespace::items::StructFieldId"]],["impl Unpin for StructId",1,["fe_analyzer::namespace::items::StructId"]],["impl Unpin for Trait",1,["fe_analyzer::namespace::items::Trait"]],["impl Unpin for TraitId",1,["fe_analyzer::namespace::items::TraitId"]],["impl Unpin for TypeAlias",1,["fe_analyzer::namespace::items::TypeAlias"]],["impl Unpin for TypeAliasId",1,["fe_analyzer::namespace::items::TypeAliasId"]],["impl Unpin for Array",1,["fe_analyzer::namespace::types::Array"]],["impl Unpin for CtxDecl",1,["fe_analyzer::namespace::types::CtxDecl"]],["impl Unpin for FeString",1,["fe_analyzer::namespace::types::FeString"]],["impl Unpin for FunctionParam",1,["fe_analyzer::namespace::types::FunctionParam"]],["impl Unpin for FunctionSignature",1,["fe_analyzer::namespace::types::FunctionSignature"]],["impl Unpin for Generic",1,["fe_analyzer::namespace::types::Generic"]],["impl Unpin for GenericParam",1,["fe_analyzer::namespace::types::GenericParam"]],["impl Unpin for GenericTypeIter",1,["fe_analyzer::namespace::types::GenericTypeIter"]],["impl Unpin for IntegerIter",1,["fe_analyzer::namespace::types::IntegerIter"]],["impl Unpin for Map",1,["fe_analyzer::namespace::types::Map"]],["impl Unpin for SelfDecl",1,["fe_analyzer::namespace::types::SelfDecl"]],["impl Unpin for Tuple",1,["fe_analyzer::namespace::types::Tuple"]],["impl Unpin for TypeId",1,["fe_analyzer::namespace::types::TypeId"]],["impl Unpin for PatternMatrix",1,["fe_analyzer::traversal::pattern_analysis::PatternMatrix"]],["impl Unpin for PatternRowVec",1,["fe_analyzer::traversal::pattern_analysis::PatternRowVec"]],["impl Unpin for SigmaSet",1,["fe_analyzer::traversal::pattern_analysis::SigmaSet"]],["impl Unpin for SimplifiedPattern",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPattern"]],["impl<'a> Unpin for FunctionScope<'a>",1,["fe_analyzer::namespace::scopes::FunctionScope"]],["impl<'a> Unpin for ItemScope<'a>",1,["fe_analyzer::namespace::scopes::ItemScope"]],["impl<'a, 'b> Unpin for BlockScope<'a, 'b>",1,["fe_analyzer::namespace::scopes::BlockScope"]],["impl<'a, T> Unpin for DisplayableWrapper<'a, T>
where\n T: Unpin,
",1,["fe_analyzer::display::DisplayableWrapper"]],["impl<T> Unpin for Analysis<T>
where\n T: Unpin,
",1,["fe_analyzer::context::Analysis"]]]],["fe_codegen",[["impl Unpin for AbiSrcLocation",1,["fe_codegen::yul::runtime::AbiSrcLocation"]],["impl Unpin for CodegenAbiContractQuery",1,["fe_codegen::db::CodegenAbiContractQuery"]],["impl Unpin for CodegenAbiEventQuery",1,["fe_codegen::db::CodegenAbiEventQuery"]],["impl Unpin for CodegenAbiFunctionArgumentMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionArgumentMaximumSizeQuery"]],["impl Unpin for CodegenAbiFunctionQuery",1,["fe_codegen::db::CodegenAbiFunctionQuery"]],["impl Unpin for CodegenAbiFunctionReturnMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionReturnMaximumSizeQuery"]],["impl Unpin for CodegenAbiModuleEventsQuery",1,["fe_codegen::db::CodegenAbiModuleEventsQuery"]],["impl Unpin for CodegenAbiTypeMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMaximumSizeQuery"]],["impl Unpin for CodegenAbiTypeMinimumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMinimumSizeQuery"]],["impl Unpin for CodegenAbiTypeQuery",1,["fe_codegen::db::CodegenAbiTypeQuery"]],["impl Unpin for CodegenConstantStringSymbolNameQuery",1,["fe_codegen::db::CodegenConstantStringSymbolNameQuery"]],["impl Unpin for CodegenContractDeployerSymbolNameQuery",1,["fe_codegen::db::CodegenContractDeployerSymbolNameQuery"]],["impl Unpin for CodegenContractSymbolNameQuery",1,["fe_codegen::db::CodegenContractSymbolNameQuery"]],["impl Unpin for CodegenDbGroupStorage__",1,["fe_codegen::db::CodegenDbGroupStorage__"]],["impl Unpin for CodegenDbStorage",1,["fe_codegen::db::CodegenDbStorage"]],["impl Unpin for CodegenFunctionSymbolNameQuery",1,["fe_codegen::db::CodegenFunctionSymbolNameQuery"]],["impl Unpin for CodegenLegalizedBodyQuery",1,["fe_codegen::db::CodegenLegalizedBodyQuery"]],["impl Unpin for CodegenLegalizedSignatureQuery",1,["fe_codegen::db::CodegenLegalizedSignatureQuery"]],["impl Unpin for CodegenLegalizedTypeQuery",1,["fe_codegen::db::CodegenLegalizedTypeQuery"]],["impl Unpin for Db",1,["fe_codegen::db::Db"]],["impl Unpin for Context",1,["fe_codegen::yul::isel::context::Context"]],["impl Unpin for DefaultRuntimeProvider",1,["fe_codegen::yul::runtime::DefaultRuntimeProvider"]]]],["fe_common",[["impl Unpin for LabelStyle",1,["fe_common::diagnostics::LabelStyle"]],["impl Unpin for FileKind",1,["fe_common::files::FileKind"]],["impl Unpin for Radix",1,["fe_common::numeric::Radix"]],["impl Unpin for DependencyKind",1,["fe_common::utils::files::DependencyKind"]],["impl Unpin for FileLoader",1,["fe_common::utils::files::FileLoader"]],["impl Unpin for ProjectMode",1,["fe_common::utils::files::ProjectMode"]],["impl Unpin for FileContentQuery",1,["fe_common::db::FileContentQuery"]],["impl Unpin for FileLineStartsQuery",1,["fe_common::db::FileLineStartsQuery"]],["impl Unpin for FileNameQuery",1,["fe_common::db::FileNameQuery"]],["impl Unpin for InternFileLookupQuery",1,["fe_common::db::InternFileLookupQuery"]],["impl Unpin for InternFileQuery",1,["fe_common::db::InternFileQuery"]],["impl Unpin for SourceDbGroupStorage__",1,["fe_common::db::SourceDbGroupStorage__"]],["impl Unpin for SourceDbStorage",1,["fe_common::db::SourceDbStorage"]],["impl Unpin for TestDb",1,["fe_common::db::TestDb"]],["impl Unpin for Diagnostic",1,["fe_common::diagnostics::Diagnostic"]],["impl Unpin for Label",1,["fe_common::diagnostics::Label"]],["impl Unpin for File",1,["fe_common::files::File"]],["impl Unpin for SourceFileId",1,["fe_common::files::SourceFileId"]],["impl Unpin for Span",1,["fe_common::span::Span"]],["impl Unpin for BuildFiles",1,["fe_common::utils::files::BuildFiles"]],["impl Unpin for Dependency",1,["fe_common::utils::files::Dependency"]],["impl Unpin for GitDependency",1,["fe_common::utils::files::GitDependency"]],["impl Unpin for LocalDependency",1,["fe_common::utils::files::LocalDependency"]],["impl Unpin for ProjectFiles",1,["fe_common::utils::files::ProjectFiles"]],["impl Unpin for Diff",1,["fe_common::utils::ron::Diff"]],["impl<'a> Unpin for Literal<'a>",1,["fe_common::numeric::Literal"]]]],["fe_compiler_test_utils",[["impl Unpin for ContractHarness",1,["fe_compiler_test_utils::ContractHarness"]],["impl Unpin for ExecutionOutput",1,["fe_compiler_test_utils::ExecutionOutput"]],["impl Unpin for GasRecord",1,["fe_compiler_test_utils::GasRecord"]],["impl Unpin for GasReporter",1,["fe_compiler_test_utils::GasReporter"]],["impl Unpin for NumericAbiTokenBounds",1,["fe_compiler_test_utils::NumericAbiTokenBounds"]],["impl Unpin for Runtime",1,["fe_compiler_test_utils::Runtime"]],["impl Unpin for SolidityCompileError",1,["fe_compiler_test_utils::SolidityCompileError"]]]],["fe_driver",[["impl Unpin for CompileError",1,["fe_driver::CompileError"]],["impl Unpin for CompiledContract",1,["fe_driver::CompiledContract"]],["impl Unpin for CompiledModule",1,["fe_driver::CompiledModule"]]]],["fe_mir",[["impl Unpin for PostIDom",1,["fe_mir::analysis::post_domtree::PostIDom"]],["impl Unpin for CursorLocation",1,["fe_mir::ir::body_cursor::CursorLocation"]],["impl Unpin for ConstantValue",1,["fe_mir::ir::constant::ConstantValue"]],["impl Unpin for Linkage",1,["fe_mir::ir::function::Linkage"]],["impl Unpin for BinOp",1,["fe_mir::ir::inst::BinOp"]],["impl Unpin for CallType",1,["fe_mir::ir::inst::CallType"]],["impl Unpin for CastKind",1,["fe_mir::ir::inst::CastKind"]],["impl Unpin for InstKind",1,["fe_mir::ir::inst::InstKind"]],["impl Unpin for UnOp",1,["fe_mir::ir::inst::UnOp"]],["impl Unpin for YulIntrinsicOp",1,["fe_mir::ir::inst::YulIntrinsicOp"]],["impl Unpin for TypeKind",1,["fe_mir::ir::types::TypeKind"]],["impl Unpin for AssignableValue",1,["fe_mir::ir::value::AssignableValue"]],["impl Unpin for Value",1,["fe_mir::ir::value::Value"]],["impl Unpin for ControlFlowGraph",1,["fe_mir::analysis::cfg::ControlFlowGraph"]],["impl Unpin for DFSet",1,["fe_mir::analysis::domtree::DFSet"]],["impl Unpin for DomTree",1,["fe_mir::analysis::domtree::DomTree"]],["impl Unpin for Loop",1,["fe_mir::analysis::loop_tree::Loop"]],["impl Unpin for LoopTree",1,["fe_mir::analysis::loop_tree::LoopTree"]],["impl Unpin for PostDomTree",1,["fe_mir::analysis::post_domtree::PostDomTree"]],["impl Unpin for MirDbGroupStorage__",1,["fe_mir::db::MirDbGroupStorage__"]],["impl Unpin for MirDbStorage",1,["fe_mir::db::MirDbStorage"]],["impl Unpin for MirInternConstLookupQuery",1,["fe_mir::db::MirInternConstLookupQuery"]],["impl Unpin for MirInternConstQuery",1,["fe_mir::db::MirInternConstQuery"]],["impl Unpin for MirInternFunctionLookupQuery",1,["fe_mir::db::MirInternFunctionLookupQuery"]],["impl Unpin for MirInternFunctionQuery",1,["fe_mir::db::MirInternFunctionQuery"]],["impl Unpin for MirInternTypeLookupQuery",1,["fe_mir::db::MirInternTypeLookupQuery"]],["impl Unpin for MirInternTypeQuery",1,["fe_mir::db::MirInternTypeQuery"]],["impl Unpin for MirLowerContractAllFunctionsQuery",1,["fe_mir::db::MirLowerContractAllFunctionsQuery"]],["impl Unpin for MirLowerEnumAllFunctionsQuery",1,["fe_mir::db::MirLowerEnumAllFunctionsQuery"]],["impl Unpin for MirLowerModuleAllFunctionsQuery",1,["fe_mir::db::MirLowerModuleAllFunctionsQuery"]],["impl Unpin for MirLowerStructAllFunctionsQuery",1,["fe_mir::db::MirLowerStructAllFunctionsQuery"]],["impl Unpin for MirLoweredConstantQuery",1,["fe_mir::db::MirLoweredConstantQuery"]],["impl Unpin for MirLoweredFuncBodyQuery",1,["fe_mir::db::MirLoweredFuncBodyQuery"]],["impl Unpin for MirLoweredFuncSignatureQuery",1,["fe_mir::db::MirLoweredFuncSignatureQuery"]],["impl Unpin for MirLoweredMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredMonomorphizedFuncSignatureQuery"]],["impl Unpin for MirLoweredPseudoMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredPseudoMonomorphizedFuncSignatureQuery"]],["impl Unpin for MirLoweredTypeQuery",1,["fe_mir::db::MirLoweredTypeQuery"]],["impl Unpin for NewDb",1,["fe_mir::db::NewDb"]],["impl Unpin for BasicBlock",1,["fe_mir::ir::basic_block::BasicBlock"]],["impl Unpin for BodyBuilder",1,["fe_mir::ir::body_builder::BodyBuilder"]],["impl Unpin for BodyOrder",1,["fe_mir::ir::body_order::BodyOrder"]],["impl Unpin for Constant",1,["fe_mir::ir::constant::Constant"]],["impl Unpin for ConstantId",1,["fe_mir::ir::constant::ConstantId"]],["impl Unpin for BodyDataStore",1,["fe_mir::ir::function::BodyDataStore"]],["impl Unpin for FunctionBody",1,["fe_mir::ir::function::FunctionBody"]],["impl Unpin for FunctionId",1,["fe_mir::ir::function::FunctionId"]],["impl Unpin for FunctionParam",1,["fe_mir::ir::function::FunctionParam"]],["impl Unpin for FunctionSignature",1,["fe_mir::ir::function::FunctionSignature"]],["impl Unpin for Inst",1,["fe_mir::ir::inst::Inst"]],["impl Unpin for SwitchTable",1,["fe_mir::ir::inst::SwitchTable"]],["impl Unpin for SourceInfo",1,["fe_mir::ir::SourceInfo"]],["impl Unpin for ArrayDef",1,["fe_mir::ir::types::ArrayDef"]],["impl Unpin for EnumDef",1,["fe_mir::ir::types::EnumDef"]],["impl Unpin for EnumVariant",1,["fe_mir::ir::types::EnumVariant"]],["impl Unpin for EventDef",1,["fe_mir::ir::types::EventDef"]],["impl Unpin for MapDef",1,["fe_mir::ir::types::MapDef"]],["impl Unpin for StructDef",1,["fe_mir::ir::types::StructDef"]],["impl Unpin for TupleDef",1,["fe_mir::ir::types::TupleDef"]],["impl Unpin for Type",1,["fe_mir::ir::types::Type"]],["impl Unpin for TypeId",1,["fe_mir::ir::types::TypeId"]],["impl Unpin for Local",1,["fe_mir::ir::value::Local"]],["impl<'a> Unpin for BranchInfo<'a>",1,["fe_mir::ir::inst::BranchInfo"]],["impl<'a> Unpin for CfgPostOrder<'a>",1,["fe_mir::analysis::cfg::CfgPostOrder"]],["impl<'a> Unpin for BodyCursor<'a>",1,["fe_mir::ir::body_cursor::BodyCursor"]],["impl<'a, 'b> Unpin for BlocksInLoopPostOrder<'a, 'b>",1,["fe_mir::analysis::loop_tree::BlocksInLoopPostOrder"]],["impl<'a, T> Unpin for IterBase<'a, T>
where\n T: Unpin,
",1,["fe_mir::ir::inst::IterBase"]],["impl<'a, T> Unpin for IterMutBase<'a, T>",1,["fe_mir::ir::inst::IterMutBase"]]]],["fe_parser",[["impl Unpin for BinOperator",1,["fe_parser::ast::BinOperator"]],["impl Unpin for BoolOperator",1,["fe_parser::ast::BoolOperator"]],["impl Unpin for CompOperator",1,["fe_parser::ast::CompOperator"]],["impl Unpin for ContractStmt",1,["fe_parser::ast::ContractStmt"]],["impl Unpin for Expr",1,["fe_parser::ast::Expr"]],["impl Unpin for FuncStmt",1,["fe_parser::ast::FuncStmt"]],["impl Unpin for FunctionArg",1,["fe_parser::ast::FunctionArg"]],["impl Unpin for GenericArg",1,["fe_parser::ast::GenericArg"]],["impl Unpin for GenericParameter",1,["fe_parser::ast::GenericParameter"]],["impl Unpin for LiteralPattern",1,["fe_parser::ast::LiteralPattern"]],["impl Unpin for ModuleStmt",1,["fe_parser::ast::ModuleStmt"]],["impl Unpin for Pattern",1,["fe_parser::ast::Pattern"]],["impl Unpin for TypeDesc",1,["fe_parser::ast::TypeDesc"]],["impl Unpin for UnaryOperator",1,["fe_parser::ast::UnaryOperator"]],["impl Unpin for UseTree",1,["fe_parser::ast::UseTree"]],["impl Unpin for VarDeclTarget",1,["fe_parser::ast::VarDeclTarget"]],["impl Unpin for VariantKind",1,["fe_parser::ast::VariantKind"]],["impl Unpin for TokenKind",1,["fe_parser::lexer::token::TokenKind"]],["impl Unpin for CallArg",1,["fe_parser::ast::CallArg"]],["impl Unpin for ConstantDecl",1,["fe_parser::ast::ConstantDecl"]],["impl Unpin for Contract",1,["fe_parser::ast::Contract"]],["impl Unpin for Enum",1,["fe_parser::ast::Enum"]],["impl Unpin for Field",1,["fe_parser::ast::Field"]],["impl Unpin for Function",1,["fe_parser::ast::Function"]],["impl Unpin for FunctionSignature",1,["fe_parser::ast::FunctionSignature"]],["impl Unpin for Impl",1,["fe_parser::ast::Impl"]],["impl Unpin for MatchArm",1,["fe_parser::ast::MatchArm"]],["impl Unpin for Module",1,["fe_parser::ast::Module"]],["impl Unpin for Path",1,["fe_parser::ast::Path"]],["impl Unpin for Pragma",1,["fe_parser::ast::Pragma"]],["impl Unpin for Struct",1,["fe_parser::ast::Struct"]],["impl Unpin for Trait",1,["fe_parser::ast::Trait"]],["impl Unpin for TypeAlias",1,["fe_parser::ast::TypeAlias"]],["impl Unpin for Use",1,["fe_parser::ast::Use"]],["impl Unpin for Variant",1,["fe_parser::ast::Variant"]],["impl Unpin for NodeId",1,["fe_parser::node::NodeId"]],["impl Unpin for ParseFailed",1,["fe_parser::parser::ParseFailed"]],["impl<'a> Unpin for Lexer<'a>",1,["fe_parser::lexer::Lexer"]],["impl<'a> Unpin for Token<'a>",1,["fe_parser::lexer::token::Token"]],["impl<'a> Unpin for Parser<'a>",1,["fe_parser::parser::Parser"]],["impl<T> Unpin for Node<T>
where\n T: Unpin,
",1,["fe_parser::node::Node"]]]],["fe_test_runner",[["impl Unpin for TestSink",1,["fe_test_runner::TestSink"]]]],["fe_yulc",[["impl Unpin for ContractBytecode",1,["fe_yulc::ContractBytecode"]],["impl Unpin for YulcError",1,["fe_yulc::YulcError"]]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1759,3798,64635,8197,8416,2465,943,22345,12512,321,608]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/marker/trait.UnsafeUnpin.js b/compiler-docs/trait.impl/core/marker/trait.UnsafeUnpin.js new file mode 100644 index 0000000000..797395f188 --- /dev/null +++ b/compiler-docs/trait.impl/core/marker/trait.UnsafeUnpin.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl UnsafeUnpin for Emit",1,["fe::task::build::Emit"]],["impl UnsafeUnpin for Commands",1,["fe::task::Commands"]],["impl UnsafeUnpin for FelangCli",1,["fe::FelangCli"]],["impl UnsafeUnpin for BuildArgs",1,["fe::task::build::BuildArgs"]],["impl UnsafeUnpin for CheckArgs",1,["fe::task::check::CheckArgs"]],["impl UnsafeUnpin for NewProjectArgs",1,["fe::task::new::NewProjectArgs"]]]],["fe_abi",[["impl UnsafeUnpin for AbiFunctionType",1,["fe_abi::function::AbiFunctionType"]],["impl UnsafeUnpin for CtxParam",1,["fe_abi::function::CtxParam"]],["impl UnsafeUnpin for SelfParam",1,["fe_abi::function::SelfParam"]],["impl UnsafeUnpin for StateMutability",1,["fe_abi::function::StateMutability"]],["impl UnsafeUnpin for AbiType",1,["fe_abi::types::AbiType"]],["impl UnsafeUnpin for AbiContract",1,["fe_abi::contract::AbiContract"]],["impl UnsafeUnpin for AbiEvent",1,["fe_abi::event::AbiEvent"]],["impl UnsafeUnpin for AbiEventField",1,["fe_abi::event::AbiEventField"]],["impl UnsafeUnpin for AbiEventSignature",1,["fe_abi::event::AbiEventSignature"]],["impl UnsafeUnpin for AbiFunction",1,["fe_abi::function::AbiFunction"]],["impl UnsafeUnpin for AbiFunctionSelector",1,["fe_abi::function::AbiFunctionSelector"]],["impl UnsafeUnpin for AbiTupleField",1,["fe_abi::types::AbiTupleField"]]]],["fe_analyzer",[["impl UnsafeUnpin for ContractTypeMethod",1,["fe_analyzer::builtins::ContractTypeMethod"]],["impl UnsafeUnpin for GlobalFunction",1,["fe_analyzer::builtins::GlobalFunction"]],["impl UnsafeUnpin for Intrinsic",1,["fe_analyzer::builtins::Intrinsic"]],["impl UnsafeUnpin for ValueMethod",1,["fe_analyzer::builtins::ValueMethod"]],["impl UnsafeUnpin for AdjustmentKind",1,["fe_analyzer::context::AdjustmentKind"]],["impl UnsafeUnpin for CallType",1,["fe_analyzer::context::CallType"]],["impl UnsafeUnpin for Constant",1,["fe_analyzer::context::Constant"]],["impl UnsafeUnpin for NamedThing",1,["fe_analyzer::context::NamedThing"]],["impl UnsafeUnpin for BinaryOperationError",1,["fe_analyzer::errors::BinaryOperationError"]],["impl UnsafeUnpin for IndexingError",1,["fe_analyzer::errors::IndexingError"]],["impl UnsafeUnpin for TypeCoercionError",1,["fe_analyzer::errors::TypeCoercionError"]],["impl UnsafeUnpin for DepLocality",1,["fe_analyzer::namespace::items::DepLocality"]],["impl UnsafeUnpin for EnumVariantKind",1,["fe_analyzer::namespace::items::EnumVariantKind"]],["impl UnsafeUnpin for IngotMode",1,["fe_analyzer::namespace::items::IngotMode"]],["impl UnsafeUnpin for Item",1,["fe_analyzer::namespace::items::Item"]],["impl UnsafeUnpin for ModuleSource",1,["fe_analyzer::namespace::items::ModuleSource"]],["impl UnsafeUnpin for TypeDef",1,["fe_analyzer::namespace::items::TypeDef"]],["impl UnsafeUnpin for BlockScopeType",1,["fe_analyzer::namespace::scopes::BlockScopeType"]],["impl UnsafeUnpin for Base",1,["fe_analyzer::namespace::types::Base"]],["impl UnsafeUnpin for GenericArg",1,["fe_analyzer::namespace::types::GenericArg"]],["impl UnsafeUnpin for GenericParamKind",1,["fe_analyzer::namespace::types::GenericParamKind"]],["impl UnsafeUnpin for GenericType",1,["fe_analyzer::namespace::types::GenericType"]],["impl UnsafeUnpin for Integer",1,["fe_analyzer::namespace::types::Integer"]],["impl UnsafeUnpin for TraitOrType",1,["fe_analyzer::namespace::types::TraitOrType"]],["impl UnsafeUnpin for Type",1,["fe_analyzer::namespace::types::Type"]],["impl UnsafeUnpin for ConstructorKind",1,["fe_analyzer::traversal::pattern_analysis::ConstructorKind"]],["impl UnsafeUnpin for LiteralConstructor",1,["fe_analyzer::traversal::pattern_analysis::LiteralConstructor"]],["impl UnsafeUnpin for SimplifiedPatternKind",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPatternKind"]],["impl UnsafeUnpin for GlobalFunctionIter",1,["fe_analyzer::builtins::GlobalFunctionIter"]],["impl UnsafeUnpin for IntrinsicIter",1,["fe_analyzer::builtins::IntrinsicIter"]],["impl UnsafeUnpin for Adjustment",1,["fe_analyzer::context::Adjustment"]],["impl UnsafeUnpin for DiagnosticVoucher",1,["fe_analyzer::context::DiagnosticVoucher"]],["impl UnsafeUnpin for ExpressionAttributes",1,["fe_analyzer::context::ExpressionAttributes"]],["impl UnsafeUnpin for FunctionBody",1,["fe_analyzer::context::FunctionBody"]],["impl UnsafeUnpin for TempContext",1,["fe_analyzer::context::TempContext"]],["impl UnsafeUnpin for AllImplsQuery",1,["fe_analyzer::db::AllImplsQuery"]],["impl UnsafeUnpin for AnalyzerDbGroupStorage__",1,["fe_analyzer::db::AnalyzerDbGroupStorage__"]],["impl UnsafeUnpin for AnalyzerDbStorage",1,["fe_analyzer::db::AnalyzerDbStorage"]],["impl UnsafeUnpin for ContractAllFieldsQuery",1,["fe_analyzer::db::ContractAllFieldsQuery"]],["impl UnsafeUnpin for ContractAllFunctionsQuery",1,["fe_analyzer::db::ContractAllFunctionsQuery"]],["impl UnsafeUnpin for ContractCallFunctionQuery",1,["fe_analyzer::db::ContractCallFunctionQuery"]],["impl UnsafeUnpin for ContractDependencyGraphQuery",1,["fe_analyzer::db::ContractDependencyGraphQuery"]],["impl UnsafeUnpin for ContractFieldMapQuery",1,["fe_analyzer::db::ContractFieldMapQuery"]],["impl UnsafeUnpin for ContractFieldTypeQuery",1,["fe_analyzer::db::ContractFieldTypeQuery"]],["impl UnsafeUnpin for ContractFunctionMapQuery",1,["fe_analyzer::db::ContractFunctionMapQuery"]],["impl UnsafeUnpin for ContractInitFunctionQuery",1,["fe_analyzer::db::ContractInitFunctionQuery"]],["impl UnsafeUnpin for ContractPublicFunctionMapQuery",1,["fe_analyzer::db::ContractPublicFunctionMapQuery"]],["impl UnsafeUnpin for ContractRuntimeDependencyGraphQuery",1,["fe_analyzer::db::ContractRuntimeDependencyGraphQuery"]],["impl UnsafeUnpin for EnumAllFunctionsQuery",1,["fe_analyzer::db::EnumAllFunctionsQuery"]],["impl UnsafeUnpin for EnumAllVariantsQuery",1,["fe_analyzer::db::EnumAllVariantsQuery"]],["impl UnsafeUnpin for EnumDependencyGraphQuery",1,["fe_analyzer::db::EnumDependencyGraphQuery"]],["impl UnsafeUnpin for EnumFunctionMapQuery",1,["fe_analyzer::db::EnumFunctionMapQuery"]],["impl UnsafeUnpin for EnumVariantKindQuery",1,["fe_analyzer::db::EnumVariantKindQuery"]],["impl UnsafeUnpin for EnumVariantMapQuery",1,["fe_analyzer::db::EnumVariantMapQuery"]],["impl UnsafeUnpin for FunctionBodyQuery",1,["fe_analyzer::db::FunctionBodyQuery"]],["impl UnsafeUnpin for FunctionDependencyGraphQuery",1,["fe_analyzer::db::FunctionDependencyGraphQuery"]],["impl UnsafeUnpin for FunctionSignatureQuery",1,["fe_analyzer::db::FunctionSignatureQuery"]],["impl UnsafeUnpin for FunctionSigsQuery",1,["fe_analyzer::db::FunctionSigsQuery"]],["impl UnsafeUnpin for ImplAllFunctionsQuery",1,["fe_analyzer::db::ImplAllFunctionsQuery"]],["impl UnsafeUnpin for ImplForQuery",1,["fe_analyzer::db::ImplForQuery"]],["impl UnsafeUnpin for ImplFunctionMapQuery",1,["fe_analyzer::db::ImplFunctionMapQuery"]],["impl UnsafeUnpin for IngotExternalIngotsQuery",1,["fe_analyzer::db::IngotExternalIngotsQuery"]],["impl UnsafeUnpin for IngotFilesQuery",1,["fe_analyzer::db::IngotFilesQuery"]],["impl UnsafeUnpin for IngotModulesQuery",1,["fe_analyzer::db::IngotModulesQuery"]],["impl UnsafeUnpin for IngotRootModuleQuery",1,["fe_analyzer::db::IngotRootModuleQuery"]],["impl UnsafeUnpin for InternAttributeLookupQuery",1,["fe_analyzer::db::InternAttributeLookupQuery"]],["impl UnsafeUnpin for InternAttributeQuery",1,["fe_analyzer::db::InternAttributeQuery"]],["impl UnsafeUnpin for InternContractFieldLookupQuery",1,["fe_analyzer::db::InternContractFieldLookupQuery"]],["impl UnsafeUnpin for InternContractFieldQuery",1,["fe_analyzer::db::InternContractFieldQuery"]],["impl UnsafeUnpin for InternContractLookupQuery",1,["fe_analyzer::db::InternContractLookupQuery"]],["impl UnsafeUnpin for InternContractQuery",1,["fe_analyzer::db::InternContractQuery"]],["impl UnsafeUnpin for InternEnumLookupQuery",1,["fe_analyzer::db::InternEnumLookupQuery"]],["impl UnsafeUnpin for InternEnumQuery",1,["fe_analyzer::db::InternEnumQuery"]],["impl UnsafeUnpin for InternEnumVariantLookupQuery",1,["fe_analyzer::db::InternEnumVariantLookupQuery"]],["impl UnsafeUnpin for InternEnumVariantQuery",1,["fe_analyzer::db::InternEnumVariantQuery"]],["impl UnsafeUnpin for InternFunctionLookupQuery",1,["fe_analyzer::db::InternFunctionLookupQuery"]],["impl UnsafeUnpin for InternFunctionQuery",1,["fe_analyzer::db::InternFunctionQuery"]],["impl UnsafeUnpin for InternFunctionSigLookupQuery",1,["fe_analyzer::db::InternFunctionSigLookupQuery"]],["impl UnsafeUnpin for InternFunctionSigQuery",1,["fe_analyzer::db::InternFunctionSigQuery"]],["impl UnsafeUnpin for InternImplLookupQuery",1,["fe_analyzer::db::InternImplLookupQuery"]],["impl UnsafeUnpin for InternImplQuery",1,["fe_analyzer::db::InternImplQuery"]],["impl UnsafeUnpin for InternIngotLookupQuery",1,["fe_analyzer::db::InternIngotLookupQuery"]],["impl UnsafeUnpin for InternIngotQuery",1,["fe_analyzer::db::InternIngotQuery"]],["impl UnsafeUnpin for InternModuleConstLookupQuery",1,["fe_analyzer::db::InternModuleConstLookupQuery"]],["impl UnsafeUnpin for InternModuleConstQuery",1,["fe_analyzer::db::InternModuleConstQuery"]],["impl UnsafeUnpin for InternModuleLookupQuery",1,["fe_analyzer::db::InternModuleLookupQuery"]],["impl UnsafeUnpin for InternModuleQuery",1,["fe_analyzer::db::InternModuleQuery"]],["impl UnsafeUnpin for InternStructFieldLookupQuery",1,["fe_analyzer::db::InternStructFieldLookupQuery"]],["impl UnsafeUnpin for InternStructFieldQuery",1,["fe_analyzer::db::InternStructFieldQuery"]],["impl UnsafeUnpin for InternStructLookupQuery",1,["fe_analyzer::db::InternStructLookupQuery"]],["impl UnsafeUnpin for InternStructQuery",1,["fe_analyzer::db::InternStructQuery"]],["impl UnsafeUnpin for InternTraitLookupQuery",1,["fe_analyzer::db::InternTraitLookupQuery"]],["impl UnsafeUnpin for InternTraitQuery",1,["fe_analyzer::db::InternTraitQuery"]],["impl UnsafeUnpin for InternTypeAliasLookupQuery",1,["fe_analyzer::db::InternTypeAliasLookupQuery"]],["impl UnsafeUnpin for InternTypeAliasQuery",1,["fe_analyzer::db::InternTypeAliasQuery"]],["impl UnsafeUnpin for InternTypeLookupQuery",1,["fe_analyzer::db::InternTypeLookupQuery"]],["impl UnsafeUnpin for InternTypeQuery",1,["fe_analyzer::db::InternTypeQuery"]],["impl UnsafeUnpin for ModuleAllImplsQuery",1,["fe_analyzer::db::ModuleAllImplsQuery"]],["impl UnsafeUnpin for ModuleAllItemsQuery",1,["fe_analyzer::db::ModuleAllItemsQuery"]],["impl UnsafeUnpin for ModuleConstantTypeQuery",1,["fe_analyzer::db::ModuleConstantTypeQuery"]],["impl UnsafeUnpin for ModuleConstantValueQuery",1,["fe_analyzer::db::ModuleConstantValueQuery"]],["impl UnsafeUnpin for ModuleConstantsQuery",1,["fe_analyzer::db::ModuleConstantsQuery"]],["impl UnsafeUnpin for ModuleContractsQuery",1,["fe_analyzer::db::ModuleContractsQuery"]],["impl UnsafeUnpin for ModuleFilePathQuery",1,["fe_analyzer::db::ModuleFilePathQuery"]],["impl UnsafeUnpin for ModuleImplMapQuery",1,["fe_analyzer::db::ModuleImplMapQuery"]],["impl UnsafeUnpin for ModuleIsIncompleteQuery",1,["fe_analyzer::db::ModuleIsIncompleteQuery"]],["impl UnsafeUnpin for ModuleItemMapQuery",1,["fe_analyzer::db::ModuleItemMapQuery"]],["impl UnsafeUnpin for ModuleParentModuleQuery",1,["fe_analyzer::db::ModuleParentModuleQuery"]],["impl UnsafeUnpin for ModuleParseQuery",1,["fe_analyzer::db::ModuleParseQuery"]],["impl UnsafeUnpin for ModuleStructsQuery",1,["fe_analyzer::db::ModuleStructsQuery"]],["impl UnsafeUnpin for ModuleSubmodulesQuery",1,["fe_analyzer::db::ModuleSubmodulesQuery"]],["impl UnsafeUnpin for ModuleTestsQuery",1,["fe_analyzer::db::ModuleTestsQuery"]],["impl UnsafeUnpin for ModuleUsedItemMapQuery",1,["fe_analyzer::db::ModuleUsedItemMapQuery"]],["impl UnsafeUnpin for RootIngotQuery",1,["fe_analyzer::db::RootIngotQuery"]],["impl UnsafeUnpin for StructAllFieldsQuery",1,["fe_analyzer::db::StructAllFieldsQuery"]],["impl UnsafeUnpin for StructAllFunctionsQuery",1,["fe_analyzer::db::StructAllFunctionsQuery"]],["impl UnsafeUnpin for StructDependencyGraphQuery",1,["fe_analyzer::db::StructDependencyGraphQuery"]],["impl UnsafeUnpin for StructFieldMapQuery",1,["fe_analyzer::db::StructFieldMapQuery"]],["impl UnsafeUnpin for StructFieldTypeQuery",1,["fe_analyzer::db::StructFieldTypeQuery"]],["impl UnsafeUnpin for StructFunctionMapQuery",1,["fe_analyzer::db::StructFunctionMapQuery"]],["impl UnsafeUnpin for TestDb",1,["fe_analyzer::db::TestDb"]],["impl UnsafeUnpin for TraitAllFunctionsQuery",1,["fe_analyzer::db::TraitAllFunctionsQuery"]],["impl UnsafeUnpin for TraitFunctionMapQuery",1,["fe_analyzer::db::TraitFunctionMapQuery"]],["impl UnsafeUnpin for TraitIsImplementedForQuery",1,["fe_analyzer::db::TraitIsImplementedForQuery"]],["impl UnsafeUnpin for TypeAliasTypeQuery",1,["fe_analyzer::db::TypeAliasTypeQuery"]],["impl UnsafeUnpin for AlreadyDefined",1,["fe_analyzer::errors::AlreadyDefined"]],["impl UnsafeUnpin for ConstEvalError",1,["fe_analyzer::errors::ConstEvalError"]],["impl UnsafeUnpin for FatalError",1,["fe_analyzer::errors::FatalError"]],["impl UnsafeUnpin for IncompleteItem",1,["fe_analyzer::errors::IncompleteItem"]],["impl UnsafeUnpin for TypeError",1,["fe_analyzer::errors::TypeError"]],["impl UnsafeUnpin for Attribute",1,["fe_analyzer::namespace::items::Attribute"]],["impl UnsafeUnpin for AttributeId",1,["fe_analyzer::namespace::items::AttributeId"]],["impl UnsafeUnpin for Contract",1,["fe_analyzer::namespace::items::Contract"]],["impl UnsafeUnpin for ContractField",1,["fe_analyzer::namespace::items::ContractField"]],["impl UnsafeUnpin for ContractFieldId",1,["fe_analyzer::namespace::items::ContractFieldId"]],["impl UnsafeUnpin for ContractId",1,["fe_analyzer::namespace::items::ContractId"]],["impl UnsafeUnpin for DepGraphWrapper",1,["fe_analyzer::namespace::items::DepGraphWrapper"]],["impl UnsafeUnpin for Enum",1,["fe_analyzer::namespace::items::Enum"]],["impl UnsafeUnpin for EnumId",1,["fe_analyzer::namespace::items::EnumId"]],["impl UnsafeUnpin for EnumVariant",1,["fe_analyzer::namespace::items::EnumVariant"]],["impl UnsafeUnpin for EnumVariantId",1,["fe_analyzer::namespace::items::EnumVariantId"]],["impl UnsafeUnpin for Function",1,["fe_analyzer::namespace::items::Function"]],["impl UnsafeUnpin for FunctionId",1,["fe_analyzer::namespace::items::FunctionId"]],["impl UnsafeUnpin for FunctionSig",1,["fe_analyzer::namespace::items::FunctionSig"]],["impl UnsafeUnpin for FunctionSigId",1,["fe_analyzer::namespace::items::FunctionSigId"]],["impl UnsafeUnpin for Impl",1,["fe_analyzer::namespace::items::Impl"]],["impl UnsafeUnpin for ImplId",1,["fe_analyzer::namespace::items::ImplId"]],["impl UnsafeUnpin for Ingot",1,["fe_analyzer::namespace::items::Ingot"]],["impl UnsafeUnpin for IngotId",1,["fe_analyzer::namespace::items::IngotId"]],["impl UnsafeUnpin for Module",1,["fe_analyzer::namespace::items::Module"]],["impl UnsafeUnpin for ModuleConstant",1,["fe_analyzer::namespace::items::ModuleConstant"]],["impl UnsafeUnpin for ModuleConstantId",1,["fe_analyzer::namespace::items::ModuleConstantId"]],["impl UnsafeUnpin for ModuleId",1,["fe_analyzer::namespace::items::ModuleId"]],["impl UnsafeUnpin for Struct",1,["fe_analyzer::namespace::items::Struct"]],["impl UnsafeUnpin for StructField",1,["fe_analyzer::namespace::items::StructField"]],["impl UnsafeUnpin for StructFieldId",1,["fe_analyzer::namespace::items::StructFieldId"]],["impl UnsafeUnpin for StructId",1,["fe_analyzer::namespace::items::StructId"]],["impl UnsafeUnpin for Trait",1,["fe_analyzer::namespace::items::Trait"]],["impl UnsafeUnpin for TraitId",1,["fe_analyzer::namespace::items::TraitId"]],["impl UnsafeUnpin for TypeAlias",1,["fe_analyzer::namespace::items::TypeAlias"]],["impl UnsafeUnpin for TypeAliasId",1,["fe_analyzer::namespace::items::TypeAliasId"]],["impl UnsafeUnpin for Array",1,["fe_analyzer::namespace::types::Array"]],["impl UnsafeUnpin for CtxDecl",1,["fe_analyzer::namespace::types::CtxDecl"]],["impl UnsafeUnpin for FeString",1,["fe_analyzer::namespace::types::FeString"]],["impl UnsafeUnpin for FunctionParam",1,["fe_analyzer::namespace::types::FunctionParam"]],["impl UnsafeUnpin for FunctionSignature",1,["fe_analyzer::namespace::types::FunctionSignature"]],["impl UnsafeUnpin for Generic",1,["fe_analyzer::namespace::types::Generic"]],["impl UnsafeUnpin for GenericParam",1,["fe_analyzer::namespace::types::GenericParam"]],["impl UnsafeUnpin for GenericTypeIter",1,["fe_analyzer::namespace::types::GenericTypeIter"]],["impl UnsafeUnpin for IntegerIter",1,["fe_analyzer::namespace::types::IntegerIter"]],["impl UnsafeUnpin for Map",1,["fe_analyzer::namespace::types::Map"]],["impl UnsafeUnpin for SelfDecl",1,["fe_analyzer::namespace::types::SelfDecl"]],["impl UnsafeUnpin for Tuple",1,["fe_analyzer::namespace::types::Tuple"]],["impl UnsafeUnpin for TypeId",1,["fe_analyzer::namespace::types::TypeId"]],["impl UnsafeUnpin for PatternMatrix",1,["fe_analyzer::traversal::pattern_analysis::PatternMatrix"]],["impl UnsafeUnpin for PatternRowVec",1,["fe_analyzer::traversal::pattern_analysis::PatternRowVec"]],["impl UnsafeUnpin for SigmaSet",1,["fe_analyzer::traversal::pattern_analysis::SigmaSet"]],["impl UnsafeUnpin for SimplifiedPattern",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPattern"]],["impl<'a> UnsafeUnpin for FunctionScope<'a>",1,["fe_analyzer::namespace::scopes::FunctionScope"]],["impl<'a> UnsafeUnpin for ItemScope<'a>",1,["fe_analyzer::namespace::scopes::ItemScope"]],["impl<'a, 'b> UnsafeUnpin for BlockScope<'a, 'b>",1,["fe_analyzer::namespace::scopes::BlockScope"]],["impl<'a, T> UnsafeUnpin for DisplayableWrapper<'a, T>
where\n T: UnsafeUnpin,
",1,["fe_analyzer::display::DisplayableWrapper"]],["impl<T> UnsafeUnpin for Analysis<T>
where\n T: UnsafeUnpin,
",1,["fe_analyzer::context::Analysis"]]]],["fe_codegen",[["impl UnsafeUnpin for AbiSrcLocation",1,["fe_codegen::yul::runtime::AbiSrcLocation"]],["impl UnsafeUnpin for CodegenAbiContractQuery",1,["fe_codegen::db::CodegenAbiContractQuery"]],["impl UnsafeUnpin for CodegenAbiEventQuery",1,["fe_codegen::db::CodegenAbiEventQuery"]],["impl UnsafeUnpin for CodegenAbiFunctionArgumentMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionArgumentMaximumSizeQuery"]],["impl UnsafeUnpin for CodegenAbiFunctionQuery",1,["fe_codegen::db::CodegenAbiFunctionQuery"]],["impl UnsafeUnpin for CodegenAbiFunctionReturnMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionReturnMaximumSizeQuery"]],["impl UnsafeUnpin for CodegenAbiModuleEventsQuery",1,["fe_codegen::db::CodegenAbiModuleEventsQuery"]],["impl UnsafeUnpin for CodegenAbiTypeMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMaximumSizeQuery"]],["impl UnsafeUnpin for CodegenAbiTypeMinimumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMinimumSizeQuery"]],["impl UnsafeUnpin for CodegenAbiTypeQuery",1,["fe_codegen::db::CodegenAbiTypeQuery"]],["impl UnsafeUnpin for CodegenConstantStringSymbolNameQuery",1,["fe_codegen::db::CodegenConstantStringSymbolNameQuery"]],["impl UnsafeUnpin for CodegenContractDeployerSymbolNameQuery",1,["fe_codegen::db::CodegenContractDeployerSymbolNameQuery"]],["impl UnsafeUnpin for CodegenContractSymbolNameQuery",1,["fe_codegen::db::CodegenContractSymbolNameQuery"]],["impl UnsafeUnpin for CodegenDbGroupStorage__",1,["fe_codegen::db::CodegenDbGroupStorage__"]],["impl UnsafeUnpin for CodegenDbStorage",1,["fe_codegen::db::CodegenDbStorage"]],["impl UnsafeUnpin for CodegenFunctionSymbolNameQuery",1,["fe_codegen::db::CodegenFunctionSymbolNameQuery"]],["impl UnsafeUnpin for CodegenLegalizedBodyQuery",1,["fe_codegen::db::CodegenLegalizedBodyQuery"]],["impl UnsafeUnpin for CodegenLegalizedSignatureQuery",1,["fe_codegen::db::CodegenLegalizedSignatureQuery"]],["impl UnsafeUnpin for CodegenLegalizedTypeQuery",1,["fe_codegen::db::CodegenLegalizedTypeQuery"]],["impl UnsafeUnpin for Db",1,["fe_codegen::db::Db"]],["impl UnsafeUnpin for Context",1,["fe_codegen::yul::isel::context::Context"]],["impl UnsafeUnpin for DefaultRuntimeProvider",1,["fe_codegen::yul::runtime::DefaultRuntimeProvider"]]]],["fe_common",[["impl UnsafeUnpin for LabelStyle",1,["fe_common::diagnostics::LabelStyle"]],["impl UnsafeUnpin for FileKind",1,["fe_common::files::FileKind"]],["impl UnsafeUnpin for Radix",1,["fe_common::numeric::Radix"]],["impl UnsafeUnpin for DependencyKind",1,["fe_common::utils::files::DependencyKind"]],["impl UnsafeUnpin for FileLoader",1,["fe_common::utils::files::FileLoader"]],["impl UnsafeUnpin for ProjectMode",1,["fe_common::utils::files::ProjectMode"]],["impl UnsafeUnpin for FileContentQuery",1,["fe_common::db::FileContentQuery"]],["impl UnsafeUnpin for FileLineStartsQuery",1,["fe_common::db::FileLineStartsQuery"]],["impl UnsafeUnpin for FileNameQuery",1,["fe_common::db::FileNameQuery"]],["impl UnsafeUnpin for InternFileLookupQuery",1,["fe_common::db::InternFileLookupQuery"]],["impl UnsafeUnpin for InternFileQuery",1,["fe_common::db::InternFileQuery"]],["impl UnsafeUnpin for SourceDbGroupStorage__",1,["fe_common::db::SourceDbGroupStorage__"]],["impl UnsafeUnpin for SourceDbStorage",1,["fe_common::db::SourceDbStorage"]],["impl UnsafeUnpin for TestDb",1,["fe_common::db::TestDb"]],["impl UnsafeUnpin for Diagnostic",1,["fe_common::diagnostics::Diagnostic"]],["impl UnsafeUnpin for Label",1,["fe_common::diagnostics::Label"]],["impl UnsafeUnpin for File",1,["fe_common::files::File"]],["impl UnsafeUnpin for SourceFileId",1,["fe_common::files::SourceFileId"]],["impl UnsafeUnpin for Span",1,["fe_common::span::Span"]],["impl UnsafeUnpin for BuildFiles",1,["fe_common::utils::files::BuildFiles"]],["impl UnsafeUnpin for Dependency",1,["fe_common::utils::files::Dependency"]],["impl UnsafeUnpin for GitDependency",1,["fe_common::utils::files::GitDependency"]],["impl UnsafeUnpin for LocalDependency",1,["fe_common::utils::files::LocalDependency"]],["impl UnsafeUnpin for ProjectFiles",1,["fe_common::utils::files::ProjectFiles"]],["impl UnsafeUnpin for Diff",1,["fe_common::utils::ron::Diff"]],["impl<'a> UnsafeUnpin for Literal<'a>",1,["fe_common::numeric::Literal"]]]],["fe_compiler_test_utils",[["impl UnsafeUnpin for ContractHarness",1,["fe_compiler_test_utils::ContractHarness"]],["impl UnsafeUnpin for ExecutionOutput",1,["fe_compiler_test_utils::ExecutionOutput"]],["impl UnsafeUnpin for GasRecord",1,["fe_compiler_test_utils::GasRecord"]],["impl UnsafeUnpin for GasReporter",1,["fe_compiler_test_utils::GasReporter"]],["impl UnsafeUnpin for NumericAbiTokenBounds",1,["fe_compiler_test_utils::NumericAbiTokenBounds"]],["impl UnsafeUnpin for Runtime",1,["fe_compiler_test_utils::Runtime"]],["impl UnsafeUnpin for SolidityCompileError",1,["fe_compiler_test_utils::SolidityCompileError"]]]],["fe_driver",[["impl UnsafeUnpin for CompileError",1,["fe_driver::CompileError"]],["impl UnsafeUnpin for CompiledContract",1,["fe_driver::CompiledContract"]],["impl UnsafeUnpin for CompiledModule",1,["fe_driver::CompiledModule"]]]],["fe_mir",[["impl UnsafeUnpin for PostIDom",1,["fe_mir::analysis::post_domtree::PostIDom"]],["impl UnsafeUnpin for CursorLocation",1,["fe_mir::ir::body_cursor::CursorLocation"]],["impl UnsafeUnpin for ConstantValue",1,["fe_mir::ir::constant::ConstantValue"]],["impl UnsafeUnpin for Linkage",1,["fe_mir::ir::function::Linkage"]],["impl UnsafeUnpin for BinOp",1,["fe_mir::ir::inst::BinOp"]],["impl UnsafeUnpin for CallType",1,["fe_mir::ir::inst::CallType"]],["impl UnsafeUnpin for CastKind",1,["fe_mir::ir::inst::CastKind"]],["impl UnsafeUnpin for InstKind",1,["fe_mir::ir::inst::InstKind"]],["impl UnsafeUnpin for UnOp",1,["fe_mir::ir::inst::UnOp"]],["impl UnsafeUnpin for YulIntrinsicOp",1,["fe_mir::ir::inst::YulIntrinsicOp"]],["impl UnsafeUnpin for TypeKind",1,["fe_mir::ir::types::TypeKind"]],["impl UnsafeUnpin for AssignableValue",1,["fe_mir::ir::value::AssignableValue"]],["impl UnsafeUnpin for Value",1,["fe_mir::ir::value::Value"]],["impl UnsafeUnpin for ControlFlowGraph",1,["fe_mir::analysis::cfg::ControlFlowGraph"]],["impl UnsafeUnpin for DFSet",1,["fe_mir::analysis::domtree::DFSet"]],["impl UnsafeUnpin for DomTree",1,["fe_mir::analysis::domtree::DomTree"]],["impl UnsafeUnpin for Loop",1,["fe_mir::analysis::loop_tree::Loop"]],["impl UnsafeUnpin for LoopTree",1,["fe_mir::analysis::loop_tree::LoopTree"]],["impl UnsafeUnpin for PostDomTree",1,["fe_mir::analysis::post_domtree::PostDomTree"]],["impl UnsafeUnpin for MirDbGroupStorage__",1,["fe_mir::db::MirDbGroupStorage__"]],["impl UnsafeUnpin for MirDbStorage",1,["fe_mir::db::MirDbStorage"]],["impl UnsafeUnpin for MirInternConstLookupQuery",1,["fe_mir::db::MirInternConstLookupQuery"]],["impl UnsafeUnpin for MirInternConstQuery",1,["fe_mir::db::MirInternConstQuery"]],["impl UnsafeUnpin for MirInternFunctionLookupQuery",1,["fe_mir::db::MirInternFunctionLookupQuery"]],["impl UnsafeUnpin for MirInternFunctionQuery",1,["fe_mir::db::MirInternFunctionQuery"]],["impl UnsafeUnpin for MirInternTypeLookupQuery",1,["fe_mir::db::MirInternTypeLookupQuery"]],["impl UnsafeUnpin for MirInternTypeQuery",1,["fe_mir::db::MirInternTypeQuery"]],["impl UnsafeUnpin for MirLowerContractAllFunctionsQuery",1,["fe_mir::db::MirLowerContractAllFunctionsQuery"]],["impl UnsafeUnpin for MirLowerEnumAllFunctionsQuery",1,["fe_mir::db::MirLowerEnumAllFunctionsQuery"]],["impl UnsafeUnpin for MirLowerModuleAllFunctionsQuery",1,["fe_mir::db::MirLowerModuleAllFunctionsQuery"]],["impl UnsafeUnpin for MirLowerStructAllFunctionsQuery",1,["fe_mir::db::MirLowerStructAllFunctionsQuery"]],["impl UnsafeUnpin for MirLoweredConstantQuery",1,["fe_mir::db::MirLoweredConstantQuery"]],["impl UnsafeUnpin for MirLoweredFuncBodyQuery",1,["fe_mir::db::MirLoweredFuncBodyQuery"]],["impl UnsafeUnpin for MirLoweredFuncSignatureQuery",1,["fe_mir::db::MirLoweredFuncSignatureQuery"]],["impl UnsafeUnpin for MirLoweredMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredMonomorphizedFuncSignatureQuery"]],["impl UnsafeUnpin for MirLoweredPseudoMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredPseudoMonomorphizedFuncSignatureQuery"]],["impl UnsafeUnpin for MirLoweredTypeQuery",1,["fe_mir::db::MirLoweredTypeQuery"]],["impl UnsafeUnpin for NewDb",1,["fe_mir::db::NewDb"]],["impl UnsafeUnpin for BasicBlock",1,["fe_mir::ir::basic_block::BasicBlock"]],["impl UnsafeUnpin for BodyBuilder",1,["fe_mir::ir::body_builder::BodyBuilder"]],["impl UnsafeUnpin for BodyOrder",1,["fe_mir::ir::body_order::BodyOrder"]],["impl UnsafeUnpin for Constant",1,["fe_mir::ir::constant::Constant"]],["impl UnsafeUnpin for ConstantId",1,["fe_mir::ir::constant::ConstantId"]],["impl UnsafeUnpin for BodyDataStore",1,["fe_mir::ir::function::BodyDataStore"]],["impl UnsafeUnpin for FunctionBody",1,["fe_mir::ir::function::FunctionBody"]],["impl UnsafeUnpin for FunctionId",1,["fe_mir::ir::function::FunctionId"]],["impl UnsafeUnpin for FunctionParam",1,["fe_mir::ir::function::FunctionParam"]],["impl UnsafeUnpin for FunctionSignature",1,["fe_mir::ir::function::FunctionSignature"]],["impl UnsafeUnpin for Inst",1,["fe_mir::ir::inst::Inst"]],["impl UnsafeUnpin for SwitchTable",1,["fe_mir::ir::inst::SwitchTable"]],["impl UnsafeUnpin for SourceInfo",1,["fe_mir::ir::SourceInfo"]],["impl UnsafeUnpin for ArrayDef",1,["fe_mir::ir::types::ArrayDef"]],["impl UnsafeUnpin for EnumDef",1,["fe_mir::ir::types::EnumDef"]],["impl UnsafeUnpin for EnumVariant",1,["fe_mir::ir::types::EnumVariant"]],["impl UnsafeUnpin for EventDef",1,["fe_mir::ir::types::EventDef"]],["impl UnsafeUnpin for MapDef",1,["fe_mir::ir::types::MapDef"]],["impl UnsafeUnpin for StructDef",1,["fe_mir::ir::types::StructDef"]],["impl UnsafeUnpin for TupleDef",1,["fe_mir::ir::types::TupleDef"]],["impl UnsafeUnpin for Type",1,["fe_mir::ir::types::Type"]],["impl UnsafeUnpin for TypeId",1,["fe_mir::ir::types::TypeId"]],["impl UnsafeUnpin for Local",1,["fe_mir::ir::value::Local"]],["impl<'a> UnsafeUnpin for BranchInfo<'a>",1,["fe_mir::ir::inst::BranchInfo"]],["impl<'a> UnsafeUnpin for CfgPostOrder<'a>",1,["fe_mir::analysis::cfg::CfgPostOrder"]],["impl<'a> UnsafeUnpin for BodyCursor<'a>",1,["fe_mir::ir::body_cursor::BodyCursor"]],["impl<'a, 'b> UnsafeUnpin for BlocksInLoopPostOrder<'a, 'b>",1,["fe_mir::analysis::loop_tree::BlocksInLoopPostOrder"]],["impl<'a, T> UnsafeUnpin for IterBase<'a, T>
where\n T: UnsafeUnpin,
",1,["fe_mir::ir::inst::IterBase"]],["impl<'a, T> UnsafeUnpin for IterMutBase<'a, T>",1,["fe_mir::ir::inst::IterMutBase"]]]],["fe_parser",[["impl UnsafeUnpin for BinOperator",1,["fe_parser::ast::BinOperator"]],["impl UnsafeUnpin for BoolOperator",1,["fe_parser::ast::BoolOperator"]],["impl UnsafeUnpin for CompOperator",1,["fe_parser::ast::CompOperator"]],["impl UnsafeUnpin for ContractStmt",1,["fe_parser::ast::ContractStmt"]],["impl UnsafeUnpin for Expr",1,["fe_parser::ast::Expr"]],["impl UnsafeUnpin for FuncStmt",1,["fe_parser::ast::FuncStmt"]],["impl UnsafeUnpin for FunctionArg",1,["fe_parser::ast::FunctionArg"]],["impl UnsafeUnpin for GenericArg",1,["fe_parser::ast::GenericArg"]],["impl UnsafeUnpin for GenericParameter",1,["fe_parser::ast::GenericParameter"]],["impl UnsafeUnpin for LiteralPattern",1,["fe_parser::ast::LiteralPattern"]],["impl UnsafeUnpin for ModuleStmt",1,["fe_parser::ast::ModuleStmt"]],["impl UnsafeUnpin for Pattern",1,["fe_parser::ast::Pattern"]],["impl UnsafeUnpin for TypeDesc",1,["fe_parser::ast::TypeDesc"]],["impl UnsafeUnpin for UnaryOperator",1,["fe_parser::ast::UnaryOperator"]],["impl UnsafeUnpin for UseTree",1,["fe_parser::ast::UseTree"]],["impl UnsafeUnpin for VarDeclTarget",1,["fe_parser::ast::VarDeclTarget"]],["impl UnsafeUnpin for VariantKind",1,["fe_parser::ast::VariantKind"]],["impl UnsafeUnpin for TokenKind",1,["fe_parser::lexer::token::TokenKind"]],["impl UnsafeUnpin for CallArg",1,["fe_parser::ast::CallArg"]],["impl UnsafeUnpin for ConstantDecl",1,["fe_parser::ast::ConstantDecl"]],["impl UnsafeUnpin for Contract",1,["fe_parser::ast::Contract"]],["impl UnsafeUnpin for Enum",1,["fe_parser::ast::Enum"]],["impl UnsafeUnpin for Field",1,["fe_parser::ast::Field"]],["impl UnsafeUnpin for Function",1,["fe_parser::ast::Function"]],["impl UnsafeUnpin for FunctionSignature",1,["fe_parser::ast::FunctionSignature"]],["impl UnsafeUnpin for Impl",1,["fe_parser::ast::Impl"]],["impl UnsafeUnpin for MatchArm",1,["fe_parser::ast::MatchArm"]],["impl UnsafeUnpin for Module",1,["fe_parser::ast::Module"]],["impl UnsafeUnpin for Path",1,["fe_parser::ast::Path"]],["impl UnsafeUnpin for Pragma",1,["fe_parser::ast::Pragma"]],["impl UnsafeUnpin for Struct",1,["fe_parser::ast::Struct"]],["impl UnsafeUnpin for Trait",1,["fe_parser::ast::Trait"]],["impl UnsafeUnpin for TypeAlias",1,["fe_parser::ast::TypeAlias"]],["impl UnsafeUnpin for Use",1,["fe_parser::ast::Use"]],["impl UnsafeUnpin for Variant",1,["fe_parser::ast::Variant"]],["impl UnsafeUnpin for NodeId",1,["fe_parser::node::NodeId"]],["impl UnsafeUnpin for ParseFailed",1,["fe_parser::parser::ParseFailed"]],["impl<'a> UnsafeUnpin for Lexer<'a>",1,["fe_parser::lexer::Lexer"]],["impl<'a> UnsafeUnpin for Token<'a>",1,["fe_parser::lexer::token::Token"]],["impl<'a> UnsafeUnpin for Parser<'a>",1,["fe_parser::parser::Parser"]],["impl<T> UnsafeUnpin for Node<T>
where\n T: UnsafeUnpin,
",1,["fe_parser::node::Node"]]]],["fe_test_runner",[["impl UnsafeUnpin for TestSink",1,["fe_test_runner::TestSink"]]]],["fe_yulc",[["impl UnsafeUnpin for ContractBytecode",1,["fe_yulc::ContractBytecode"]],["impl UnsafeUnpin for YulcError",1,["fe_yulc::YulcError"]]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1867,2310,41695,5469,5192,1597,571,13913,7304,197,360]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/ops/arith/trait.Add.js b/compiler-docs/trait.impl/core/ops/arith/trait.Add.js new file mode 100644 index 0000000000..ee6b14cfac --- /dev/null +++ b/compiler-docs/trait.impl/core/ops/arith/trait.Add.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_common",[["impl Add for Span"],["impl Add<Option<Span>> for Span"],["impl<'a, T> Add<Option<&'a T>> for Span
where\n Span: Add<&'a T, Output = Self>,
"],["impl<'a, T> Add<&'a T> for Span
where\n T: Spanned,
"]]],["fe_parser",[["impl<'a> Add<&Token<'a>> for Span"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[2203,421]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/ops/arith/trait.AddAssign.js b/compiler-docs/trait.impl/core/ops/arith/trait.AddAssign.js new file mode 100644 index 0000000000..ab0821f016 --- /dev/null +++ b/compiler-docs/trait.impl/core/ops/arith/trait.AddAssign.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_common",[["impl<T> AddAssign<T> for Span
where\n Span: Add<T, Output = Self>,
"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[597]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js b/compiler-docs/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 0000000000..1a374bc61f --- /dev/null +++ b/compiler-docs/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl RefUnwindSafe for Emit",1,["fe::task::build::Emit"]],["impl RefUnwindSafe for Commands",1,["fe::task::Commands"]],["impl RefUnwindSafe for FelangCli",1,["fe::FelangCli"]],["impl RefUnwindSafe for BuildArgs",1,["fe::task::build::BuildArgs"]],["impl RefUnwindSafe for CheckArgs",1,["fe::task::check::CheckArgs"]],["impl RefUnwindSafe for NewProjectArgs",1,["fe::task::new::NewProjectArgs"]]]],["fe_abi",[["impl RefUnwindSafe for AbiFunctionType",1,["fe_abi::function::AbiFunctionType"]],["impl RefUnwindSafe for CtxParam",1,["fe_abi::function::CtxParam"]],["impl RefUnwindSafe for SelfParam",1,["fe_abi::function::SelfParam"]],["impl RefUnwindSafe for StateMutability",1,["fe_abi::function::StateMutability"]],["impl RefUnwindSafe for AbiType",1,["fe_abi::types::AbiType"]],["impl RefUnwindSafe for AbiContract",1,["fe_abi::contract::AbiContract"]],["impl RefUnwindSafe for AbiEvent",1,["fe_abi::event::AbiEvent"]],["impl RefUnwindSafe for AbiEventField",1,["fe_abi::event::AbiEventField"]],["impl RefUnwindSafe for AbiEventSignature",1,["fe_abi::event::AbiEventSignature"]],["impl RefUnwindSafe for AbiFunction",1,["fe_abi::function::AbiFunction"]],["impl RefUnwindSafe for AbiFunctionSelector",1,["fe_abi::function::AbiFunctionSelector"]],["impl RefUnwindSafe for AbiTupleField",1,["fe_abi::types::AbiTupleField"]]]],["fe_analyzer",[["impl !RefUnwindSafe for TempContext",1,["fe_analyzer::context::TempContext"]],["impl RefUnwindSafe for ContractTypeMethod",1,["fe_analyzer::builtins::ContractTypeMethod"]],["impl RefUnwindSafe for GlobalFunction",1,["fe_analyzer::builtins::GlobalFunction"]],["impl RefUnwindSafe for Intrinsic",1,["fe_analyzer::builtins::Intrinsic"]],["impl RefUnwindSafe for ValueMethod",1,["fe_analyzer::builtins::ValueMethod"]],["impl RefUnwindSafe for AdjustmentKind",1,["fe_analyzer::context::AdjustmentKind"]],["impl RefUnwindSafe for CallType",1,["fe_analyzer::context::CallType"]],["impl RefUnwindSafe for Constant",1,["fe_analyzer::context::Constant"]],["impl RefUnwindSafe for NamedThing",1,["fe_analyzer::context::NamedThing"]],["impl RefUnwindSafe for BinaryOperationError",1,["fe_analyzer::errors::BinaryOperationError"]],["impl RefUnwindSafe for IndexingError",1,["fe_analyzer::errors::IndexingError"]],["impl RefUnwindSafe for TypeCoercionError",1,["fe_analyzer::errors::TypeCoercionError"]],["impl RefUnwindSafe for DepLocality",1,["fe_analyzer::namespace::items::DepLocality"]],["impl RefUnwindSafe for EnumVariantKind",1,["fe_analyzer::namespace::items::EnumVariantKind"]],["impl RefUnwindSafe for IngotMode",1,["fe_analyzer::namespace::items::IngotMode"]],["impl RefUnwindSafe for Item",1,["fe_analyzer::namespace::items::Item"]],["impl RefUnwindSafe for ModuleSource",1,["fe_analyzer::namespace::items::ModuleSource"]],["impl RefUnwindSafe for TypeDef",1,["fe_analyzer::namespace::items::TypeDef"]],["impl RefUnwindSafe for BlockScopeType",1,["fe_analyzer::namespace::scopes::BlockScopeType"]],["impl RefUnwindSafe for Base",1,["fe_analyzer::namespace::types::Base"]],["impl RefUnwindSafe for GenericArg",1,["fe_analyzer::namespace::types::GenericArg"]],["impl RefUnwindSafe for GenericParamKind",1,["fe_analyzer::namespace::types::GenericParamKind"]],["impl RefUnwindSafe for GenericType",1,["fe_analyzer::namespace::types::GenericType"]],["impl RefUnwindSafe for Integer",1,["fe_analyzer::namespace::types::Integer"]],["impl RefUnwindSafe for TraitOrType",1,["fe_analyzer::namespace::types::TraitOrType"]],["impl RefUnwindSafe for Type",1,["fe_analyzer::namespace::types::Type"]],["impl RefUnwindSafe for ConstructorKind",1,["fe_analyzer::traversal::pattern_analysis::ConstructorKind"]],["impl RefUnwindSafe for LiteralConstructor",1,["fe_analyzer::traversal::pattern_analysis::LiteralConstructor"]],["impl RefUnwindSafe for SimplifiedPatternKind",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPatternKind"]],["impl RefUnwindSafe for GlobalFunctionIter",1,["fe_analyzer::builtins::GlobalFunctionIter"]],["impl RefUnwindSafe for IntrinsicIter",1,["fe_analyzer::builtins::IntrinsicIter"]],["impl RefUnwindSafe for Adjustment",1,["fe_analyzer::context::Adjustment"]],["impl RefUnwindSafe for DiagnosticVoucher",1,["fe_analyzer::context::DiagnosticVoucher"]],["impl RefUnwindSafe for ExpressionAttributes",1,["fe_analyzer::context::ExpressionAttributes"]],["impl RefUnwindSafe for FunctionBody",1,["fe_analyzer::context::FunctionBody"]],["impl RefUnwindSafe for AllImplsQuery",1,["fe_analyzer::db::AllImplsQuery"]],["impl RefUnwindSafe for AnalyzerDbGroupStorage__",1,["fe_analyzer::db::AnalyzerDbGroupStorage__"]],["impl RefUnwindSafe for AnalyzerDbStorage",1,["fe_analyzer::db::AnalyzerDbStorage"]],["impl RefUnwindSafe for ContractAllFieldsQuery",1,["fe_analyzer::db::ContractAllFieldsQuery"]],["impl RefUnwindSafe for ContractAllFunctionsQuery",1,["fe_analyzer::db::ContractAllFunctionsQuery"]],["impl RefUnwindSafe for ContractCallFunctionQuery",1,["fe_analyzer::db::ContractCallFunctionQuery"]],["impl RefUnwindSafe for ContractDependencyGraphQuery",1,["fe_analyzer::db::ContractDependencyGraphQuery"]],["impl RefUnwindSafe for ContractFieldMapQuery",1,["fe_analyzer::db::ContractFieldMapQuery"]],["impl RefUnwindSafe for ContractFieldTypeQuery",1,["fe_analyzer::db::ContractFieldTypeQuery"]],["impl RefUnwindSafe for ContractFunctionMapQuery",1,["fe_analyzer::db::ContractFunctionMapQuery"]],["impl RefUnwindSafe for ContractInitFunctionQuery",1,["fe_analyzer::db::ContractInitFunctionQuery"]],["impl RefUnwindSafe for ContractPublicFunctionMapQuery",1,["fe_analyzer::db::ContractPublicFunctionMapQuery"]],["impl RefUnwindSafe for ContractRuntimeDependencyGraphQuery",1,["fe_analyzer::db::ContractRuntimeDependencyGraphQuery"]],["impl RefUnwindSafe for EnumAllFunctionsQuery",1,["fe_analyzer::db::EnumAllFunctionsQuery"]],["impl RefUnwindSafe for EnumAllVariantsQuery",1,["fe_analyzer::db::EnumAllVariantsQuery"]],["impl RefUnwindSafe for EnumDependencyGraphQuery",1,["fe_analyzer::db::EnumDependencyGraphQuery"]],["impl RefUnwindSafe for EnumFunctionMapQuery",1,["fe_analyzer::db::EnumFunctionMapQuery"]],["impl RefUnwindSafe for EnumVariantKindQuery",1,["fe_analyzer::db::EnumVariantKindQuery"]],["impl RefUnwindSafe for EnumVariantMapQuery",1,["fe_analyzer::db::EnumVariantMapQuery"]],["impl RefUnwindSafe for FunctionBodyQuery",1,["fe_analyzer::db::FunctionBodyQuery"]],["impl RefUnwindSafe for FunctionDependencyGraphQuery",1,["fe_analyzer::db::FunctionDependencyGraphQuery"]],["impl RefUnwindSafe for FunctionSignatureQuery",1,["fe_analyzer::db::FunctionSignatureQuery"]],["impl RefUnwindSafe for FunctionSigsQuery",1,["fe_analyzer::db::FunctionSigsQuery"]],["impl RefUnwindSafe for ImplAllFunctionsQuery",1,["fe_analyzer::db::ImplAllFunctionsQuery"]],["impl RefUnwindSafe for ImplForQuery",1,["fe_analyzer::db::ImplForQuery"]],["impl RefUnwindSafe for ImplFunctionMapQuery",1,["fe_analyzer::db::ImplFunctionMapQuery"]],["impl RefUnwindSafe for IngotExternalIngotsQuery",1,["fe_analyzer::db::IngotExternalIngotsQuery"]],["impl RefUnwindSafe for IngotFilesQuery",1,["fe_analyzer::db::IngotFilesQuery"]],["impl RefUnwindSafe for IngotModulesQuery",1,["fe_analyzer::db::IngotModulesQuery"]],["impl RefUnwindSafe for IngotRootModuleQuery",1,["fe_analyzer::db::IngotRootModuleQuery"]],["impl RefUnwindSafe for InternAttributeLookupQuery",1,["fe_analyzer::db::InternAttributeLookupQuery"]],["impl RefUnwindSafe for InternAttributeQuery",1,["fe_analyzer::db::InternAttributeQuery"]],["impl RefUnwindSafe for InternContractFieldLookupQuery",1,["fe_analyzer::db::InternContractFieldLookupQuery"]],["impl RefUnwindSafe for InternContractFieldQuery",1,["fe_analyzer::db::InternContractFieldQuery"]],["impl RefUnwindSafe for InternContractLookupQuery",1,["fe_analyzer::db::InternContractLookupQuery"]],["impl RefUnwindSafe for InternContractQuery",1,["fe_analyzer::db::InternContractQuery"]],["impl RefUnwindSafe for InternEnumLookupQuery",1,["fe_analyzer::db::InternEnumLookupQuery"]],["impl RefUnwindSafe for InternEnumQuery",1,["fe_analyzer::db::InternEnumQuery"]],["impl RefUnwindSafe for InternEnumVariantLookupQuery",1,["fe_analyzer::db::InternEnumVariantLookupQuery"]],["impl RefUnwindSafe for InternEnumVariantQuery",1,["fe_analyzer::db::InternEnumVariantQuery"]],["impl RefUnwindSafe for InternFunctionLookupQuery",1,["fe_analyzer::db::InternFunctionLookupQuery"]],["impl RefUnwindSafe for InternFunctionQuery",1,["fe_analyzer::db::InternFunctionQuery"]],["impl RefUnwindSafe for InternFunctionSigLookupQuery",1,["fe_analyzer::db::InternFunctionSigLookupQuery"]],["impl RefUnwindSafe for InternFunctionSigQuery",1,["fe_analyzer::db::InternFunctionSigQuery"]],["impl RefUnwindSafe for InternImplLookupQuery",1,["fe_analyzer::db::InternImplLookupQuery"]],["impl RefUnwindSafe for InternImplQuery",1,["fe_analyzer::db::InternImplQuery"]],["impl RefUnwindSafe for InternIngotLookupQuery",1,["fe_analyzer::db::InternIngotLookupQuery"]],["impl RefUnwindSafe for InternIngotQuery",1,["fe_analyzer::db::InternIngotQuery"]],["impl RefUnwindSafe for InternModuleConstLookupQuery",1,["fe_analyzer::db::InternModuleConstLookupQuery"]],["impl RefUnwindSafe for InternModuleConstQuery",1,["fe_analyzer::db::InternModuleConstQuery"]],["impl RefUnwindSafe for InternModuleLookupQuery",1,["fe_analyzer::db::InternModuleLookupQuery"]],["impl RefUnwindSafe for InternModuleQuery",1,["fe_analyzer::db::InternModuleQuery"]],["impl RefUnwindSafe for InternStructFieldLookupQuery",1,["fe_analyzer::db::InternStructFieldLookupQuery"]],["impl RefUnwindSafe for InternStructFieldQuery",1,["fe_analyzer::db::InternStructFieldQuery"]],["impl RefUnwindSafe for InternStructLookupQuery",1,["fe_analyzer::db::InternStructLookupQuery"]],["impl RefUnwindSafe for InternStructQuery",1,["fe_analyzer::db::InternStructQuery"]],["impl RefUnwindSafe for InternTraitLookupQuery",1,["fe_analyzer::db::InternTraitLookupQuery"]],["impl RefUnwindSafe for InternTraitQuery",1,["fe_analyzer::db::InternTraitQuery"]],["impl RefUnwindSafe for InternTypeAliasLookupQuery",1,["fe_analyzer::db::InternTypeAliasLookupQuery"]],["impl RefUnwindSafe for InternTypeAliasQuery",1,["fe_analyzer::db::InternTypeAliasQuery"]],["impl RefUnwindSafe for InternTypeLookupQuery",1,["fe_analyzer::db::InternTypeLookupQuery"]],["impl RefUnwindSafe for InternTypeQuery",1,["fe_analyzer::db::InternTypeQuery"]],["impl RefUnwindSafe for ModuleAllImplsQuery",1,["fe_analyzer::db::ModuleAllImplsQuery"]],["impl RefUnwindSafe for ModuleAllItemsQuery",1,["fe_analyzer::db::ModuleAllItemsQuery"]],["impl RefUnwindSafe for ModuleConstantTypeQuery",1,["fe_analyzer::db::ModuleConstantTypeQuery"]],["impl RefUnwindSafe for ModuleConstantValueQuery",1,["fe_analyzer::db::ModuleConstantValueQuery"]],["impl RefUnwindSafe for ModuleConstantsQuery",1,["fe_analyzer::db::ModuleConstantsQuery"]],["impl RefUnwindSafe for ModuleContractsQuery",1,["fe_analyzer::db::ModuleContractsQuery"]],["impl RefUnwindSafe for ModuleFilePathQuery",1,["fe_analyzer::db::ModuleFilePathQuery"]],["impl RefUnwindSafe for ModuleImplMapQuery",1,["fe_analyzer::db::ModuleImplMapQuery"]],["impl RefUnwindSafe for ModuleIsIncompleteQuery",1,["fe_analyzer::db::ModuleIsIncompleteQuery"]],["impl RefUnwindSafe for ModuleItemMapQuery",1,["fe_analyzer::db::ModuleItemMapQuery"]],["impl RefUnwindSafe for ModuleParentModuleQuery",1,["fe_analyzer::db::ModuleParentModuleQuery"]],["impl RefUnwindSafe for ModuleParseQuery",1,["fe_analyzer::db::ModuleParseQuery"]],["impl RefUnwindSafe for ModuleStructsQuery",1,["fe_analyzer::db::ModuleStructsQuery"]],["impl RefUnwindSafe for ModuleSubmodulesQuery",1,["fe_analyzer::db::ModuleSubmodulesQuery"]],["impl RefUnwindSafe for ModuleTestsQuery",1,["fe_analyzer::db::ModuleTestsQuery"]],["impl RefUnwindSafe for ModuleUsedItemMapQuery",1,["fe_analyzer::db::ModuleUsedItemMapQuery"]],["impl RefUnwindSafe for RootIngotQuery",1,["fe_analyzer::db::RootIngotQuery"]],["impl RefUnwindSafe for StructAllFieldsQuery",1,["fe_analyzer::db::StructAllFieldsQuery"]],["impl RefUnwindSafe for StructAllFunctionsQuery",1,["fe_analyzer::db::StructAllFunctionsQuery"]],["impl RefUnwindSafe for StructDependencyGraphQuery",1,["fe_analyzer::db::StructDependencyGraphQuery"]],["impl RefUnwindSafe for StructFieldMapQuery",1,["fe_analyzer::db::StructFieldMapQuery"]],["impl RefUnwindSafe for StructFieldTypeQuery",1,["fe_analyzer::db::StructFieldTypeQuery"]],["impl RefUnwindSafe for StructFunctionMapQuery",1,["fe_analyzer::db::StructFunctionMapQuery"]],["impl RefUnwindSafe for TestDb",1,["fe_analyzer::db::TestDb"]],["impl RefUnwindSafe for TraitAllFunctionsQuery",1,["fe_analyzer::db::TraitAllFunctionsQuery"]],["impl RefUnwindSafe for TraitFunctionMapQuery",1,["fe_analyzer::db::TraitFunctionMapQuery"]],["impl RefUnwindSafe for TraitIsImplementedForQuery",1,["fe_analyzer::db::TraitIsImplementedForQuery"]],["impl RefUnwindSafe for TypeAliasTypeQuery",1,["fe_analyzer::db::TypeAliasTypeQuery"]],["impl RefUnwindSafe for AlreadyDefined",1,["fe_analyzer::errors::AlreadyDefined"]],["impl RefUnwindSafe for ConstEvalError",1,["fe_analyzer::errors::ConstEvalError"]],["impl RefUnwindSafe for FatalError",1,["fe_analyzer::errors::FatalError"]],["impl RefUnwindSafe for IncompleteItem",1,["fe_analyzer::errors::IncompleteItem"]],["impl RefUnwindSafe for TypeError",1,["fe_analyzer::errors::TypeError"]],["impl RefUnwindSafe for Attribute",1,["fe_analyzer::namespace::items::Attribute"]],["impl RefUnwindSafe for AttributeId",1,["fe_analyzer::namespace::items::AttributeId"]],["impl RefUnwindSafe for Contract",1,["fe_analyzer::namespace::items::Contract"]],["impl RefUnwindSafe for ContractField",1,["fe_analyzer::namespace::items::ContractField"]],["impl RefUnwindSafe for ContractFieldId",1,["fe_analyzer::namespace::items::ContractFieldId"]],["impl RefUnwindSafe for ContractId",1,["fe_analyzer::namespace::items::ContractId"]],["impl RefUnwindSafe for DepGraphWrapper",1,["fe_analyzer::namespace::items::DepGraphWrapper"]],["impl RefUnwindSafe for Enum",1,["fe_analyzer::namespace::items::Enum"]],["impl RefUnwindSafe for EnumId",1,["fe_analyzer::namespace::items::EnumId"]],["impl RefUnwindSafe for EnumVariant",1,["fe_analyzer::namespace::items::EnumVariant"]],["impl RefUnwindSafe for EnumVariantId",1,["fe_analyzer::namespace::items::EnumVariantId"]],["impl RefUnwindSafe for Function",1,["fe_analyzer::namespace::items::Function"]],["impl RefUnwindSafe for FunctionId",1,["fe_analyzer::namespace::items::FunctionId"]],["impl RefUnwindSafe for FunctionSig",1,["fe_analyzer::namespace::items::FunctionSig"]],["impl RefUnwindSafe for FunctionSigId",1,["fe_analyzer::namespace::items::FunctionSigId"]],["impl RefUnwindSafe for Impl",1,["fe_analyzer::namespace::items::Impl"]],["impl RefUnwindSafe for ImplId",1,["fe_analyzer::namespace::items::ImplId"]],["impl RefUnwindSafe for Ingot",1,["fe_analyzer::namespace::items::Ingot"]],["impl RefUnwindSafe for IngotId",1,["fe_analyzer::namespace::items::IngotId"]],["impl RefUnwindSafe for Module",1,["fe_analyzer::namespace::items::Module"]],["impl RefUnwindSafe for ModuleConstant",1,["fe_analyzer::namespace::items::ModuleConstant"]],["impl RefUnwindSafe for ModuleConstantId",1,["fe_analyzer::namespace::items::ModuleConstantId"]],["impl RefUnwindSafe for ModuleId",1,["fe_analyzer::namespace::items::ModuleId"]],["impl RefUnwindSafe for Struct",1,["fe_analyzer::namespace::items::Struct"]],["impl RefUnwindSafe for StructField",1,["fe_analyzer::namespace::items::StructField"]],["impl RefUnwindSafe for StructFieldId",1,["fe_analyzer::namespace::items::StructFieldId"]],["impl RefUnwindSafe for StructId",1,["fe_analyzer::namespace::items::StructId"]],["impl RefUnwindSafe for Trait",1,["fe_analyzer::namespace::items::Trait"]],["impl RefUnwindSafe for TraitId",1,["fe_analyzer::namespace::items::TraitId"]],["impl RefUnwindSafe for TypeAlias",1,["fe_analyzer::namespace::items::TypeAlias"]],["impl RefUnwindSafe for TypeAliasId",1,["fe_analyzer::namespace::items::TypeAliasId"]],["impl RefUnwindSafe for Array",1,["fe_analyzer::namespace::types::Array"]],["impl RefUnwindSafe for CtxDecl",1,["fe_analyzer::namespace::types::CtxDecl"]],["impl RefUnwindSafe for FeString",1,["fe_analyzer::namespace::types::FeString"]],["impl RefUnwindSafe for FunctionParam",1,["fe_analyzer::namespace::types::FunctionParam"]],["impl RefUnwindSafe for FunctionSignature",1,["fe_analyzer::namespace::types::FunctionSignature"]],["impl RefUnwindSafe for Generic",1,["fe_analyzer::namespace::types::Generic"]],["impl RefUnwindSafe for GenericParam",1,["fe_analyzer::namespace::types::GenericParam"]],["impl RefUnwindSafe for GenericTypeIter",1,["fe_analyzer::namespace::types::GenericTypeIter"]],["impl RefUnwindSafe for IntegerIter",1,["fe_analyzer::namespace::types::IntegerIter"]],["impl RefUnwindSafe for Map",1,["fe_analyzer::namespace::types::Map"]],["impl RefUnwindSafe for SelfDecl",1,["fe_analyzer::namespace::types::SelfDecl"]],["impl RefUnwindSafe for Tuple",1,["fe_analyzer::namespace::types::Tuple"]],["impl RefUnwindSafe for TypeId",1,["fe_analyzer::namespace::types::TypeId"]],["impl RefUnwindSafe for PatternMatrix",1,["fe_analyzer::traversal::pattern_analysis::PatternMatrix"]],["impl RefUnwindSafe for PatternRowVec",1,["fe_analyzer::traversal::pattern_analysis::PatternRowVec"]],["impl RefUnwindSafe for SigmaSet",1,["fe_analyzer::traversal::pattern_analysis::SigmaSet"]],["impl RefUnwindSafe for SimplifiedPattern",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPattern"]],["impl<'a> !RefUnwindSafe for FunctionScope<'a>",1,["fe_analyzer::namespace::scopes::FunctionScope"]],["impl<'a> !RefUnwindSafe for ItemScope<'a>",1,["fe_analyzer::namespace::scopes::ItemScope"]],["impl<'a, 'b> !RefUnwindSafe for BlockScope<'a, 'b>",1,["fe_analyzer::namespace::scopes::BlockScope"]],["impl<'a, T> !RefUnwindSafe for DisplayableWrapper<'a, T>",1,["fe_analyzer::display::DisplayableWrapper"]],["impl<T> RefUnwindSafe for Analysis<T>
where\n T: RefUnwindSafe,
",1,["fe_analyzer::context::Analysis"]]]],["fe_codegen",[["impl !RefUnwindSafe for Context",1,["fe_codegen::yul::isel::context::Context"]],["impl RefUnwindSafe for AbiSrcLocation",1,["fe_codegen::yul::runtime::AbiSrcLocation"]],["impl RefUnwindSafe for CodegenAbiContractQuery",1,["fe_codegen::db::CodegenAbiContractQuery"]],["impl RefUnwindSafe for CodegenAbiEventQuery",1,["fe_codegen::db::CodegenAbiEventQuery"]],["impl RefUnwindSafe for CodegenAbiFunctionArgumentMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionArgumentMaximumSizeQuery"]],["impl RefUnwindSafe for CodegenAbiFunctionQuery",1,["fe_codegen::db::CodegenAbiFunctionQuery"]],["impl RefUnwindSafe for CodegenAbiFunctionReturnMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionReturnMaximumSizeQuery"]],["impl RefUnwindSafe for CodegenAbiModuleEventsQuery",1,["fe_codegen::db::CodegenAbiModuleEventsQuery"]],["impl RefUnwindSafe for CodegenAbiTypeMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMaximumSizeQuery"]],["impl RefUnwindSafe for CodegenAbiTypeMinimumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMinimumSizeQuery"]],["impl RefUnwindSafe for CodegenAbiTypeQuery",1,["fe_codegen::db::CodegenAbiTypeQuery"]],["impl RefUnwindSafe for CodegenConstantStringSymbolNameQuery",1,["fe_codegen::db::CodegenConstantStringSymbolNameQuery"]],["impl RefUnwindSafe for CodegenContractDeployerSymbolNameQuery",1,["fe_codegen::db::CodegenContractDeployerSymbolNameQuery"]],["impl RefUnwindSafe for CodegenContractSymbolNameQuery",1,["fe_codegen::db::CodegenContractSymbolNameQuery"]],["impl RefUnwindSafe for CodegenDbGroupStorage__",1,["fe_codegen::db::CodegenDbGroupStorage__"]],["impl RefUnwindSafe for CodegenDbStorage",1,["fe_codegen::db::CodegenDbStorage"]],["impl RefUnwindSafe for CodegenFunctionSymbolNameQuery",1,["fe_codegen::db::CodegenFunctionSymbolNameQuery"]],["impl RefUnwindSafe for CodegenLegalizedBodyQuery",1,["fe_codegen::db::CodegenLegalizedBodyQuery"]],["impl RefUnwindSafe for CodegenLegalizedSignatureQuery",1,["fe_codegen::db::CodegenLegalizedSignatureQuery"]],["impl RefUnwindSafe for CodegenLegalizedTypeQuery",1,["fe_codegen::db::CodegenLegalizedTypeQuery"]],["impl RefUnwindSafe for Db",1,["fe_codegen::db::Db"]],["impl RefUnwindSafe for DefaultRuntimeProvider",1,["fe_codegen::yul::runtime::DefaultRuntimeProvider"]]]],["fe_common",[["impl RefUnwindSafe for LabelStyle",1,["fe_common::diagnostics::LabelStyle"]],["impl RefUnwindSafe for FileKind",1,["fe_common::files::FileKind"]],["impl RefUnwindSafe for Radix",1,["fe_common::numeric::Radix"]],["impl RefUnwindSafe for DependencyKind",1,["fe_common::utils::files::DependencyKind"]],["impl RefUnwindSafe for FileLoader",1,["fe_common::utils::files::FileLoader"]],["impl RefUnwindSafe for ProjectMode",1,["fe_common::utils::files::ProjectMode"]],["impl RefUnwindSafe for FileContentQuery",1,["fe_common::db::FileContentQuery"]],["impl RefUnwindSafe for FileLineStartsQuery",1,["fe_common::db::FileLineStartsQuery"]],["impl RefUnwindSafe for FileNameQuery",1,["fe_common::db::FileNameQuery"]],["impl RefUnwindSafe for InternFileLookupQuery",1,["fe_common::db::InternFileLookupQuery"]],["impl RefUnwindSafe for InternFileQuery",1,["fe_common::db::InternFileQuery"]],["impl RefUnwindSafe for SourceDbGroupStorage__",1,["fe_common::db::SourceDbGroupStorage__"]],["impl RefUnwindSafe for SourceDbStorage",1,["fe_common::db::SourceDbStorage"]],["impl RefUnwindSafe for TestDb",1,["fe_common::db::TestDb"]],["impl RefUnwindSafe for Diagnostic",1,["fe_common::diagnostics::Diagnostic"]],["impl RefUnwindSafe for Label",1,["fe_common::diagnostics::Label"]],["impl RefUnwindSafe for File",1,["fe_common::files::File"]],["impl RefUnwindSafe for SourceFileId",1,["fe_common::files::SourceFileId"]],["impl RefUnwindSafe for Span",1,["fe_common::span::Span"]],["impl RefUnwindSafe for BuildFiles",1,["fe_common::utils::files::BuildFiles"]],["impl RefUnwindSafe for Dependency",1,["fe_common::utils::files::Dependency"]],["impl RefUnwindSafe for GitDependency",1,["fe_common::utils::files::GitDependency"]],["impl RefUnwindSafe for LocalDependency",1,["fe_common::utils::files::LocalDependency"]],["impl RefUnwindSafe for ProjectFiles",1,["fe_common::utils::files::ProjectFiles"]],["impl RefUnwindSafe for Diff",1,["fe_common::utils::ron::Diff"]],["impl<'a> RefUnwindSafe for Literal<'a>",1,["fe_common::numeric::Literal"]]]],["fe_compiler_test_utils",[["impl !RefUnwindSafe for ContractHarness",1,["fe_compiler_test_utils::ContractHarness"]],["impl !RefUnwindSafe for GasReporter",1,["fe_compiler_test_utils::GasReporter"]],["impl RefUnwindSafe for ExecutionOutput",1,["fe_compiler_test_utils::ExecutionOutput"]],["impl RefUnwindSafe for GasRecord",1,["fe_compiler_test_utils::GasRecord"]],["impl RefUnwindSafe for NumericAbiTokenBounds",1,["fe_compiler_test_utils::NumericAbiTokenBounds"]],["impl RefUnwindSafe for Runtime",1,["fe_compiler_test_utils::Runtime"]],["impl RefUnwindSafe for SolidityCompileError",1,["fe_compiler_test_utils::SolidityCompileError"]]]],["fe_driver",[["impl RefUnwindSafe for CompileError",1,["fe_driver::CompileError"]],["impl RefUnwindSafe for CompiledContract",1,["fe_driver::CompiledContract"]],["impl RefUnwindSafe for CompiledModule",1,["fe_driver::CompiledModule"]]]],["fe_mir",[["impl RefUnwindSafe for PostIDom",1,["fe_mir::analysis::post_domtree::PostIDom"]],["impl RefUnwindSafe for CursorLocation",1,["fe_mir::ir::body_cursor::CursorLocation"]],["impl RefUnwindSafe for ConstantValue",1,["fe_mir::ir::constant::ConstantValue"]],["impl RefUnwindSafe for Linkage",1,["fe_mir::ir::function::Linkage"]],["impl RefUnwindSafe for BinOp",1,["fe_mir::ir::inst::BinOp"]],["impl RefUnwindSafe for CallType",1,["fe_mir::ir::inst::CallType"]],["impl RefUnwindSafe for CastKind",1,["fe_mir::ir::inst::CastKind"]],["impl RefUnwindSafe for InstKind",1,["fe_mir::ir::inst::InstKind"]],["impl RefUnwindSafe for UnOp",1,["fe_mir::ir::inst::UnOp"]],["impl RefUnwindSafe for YulIntrinsicOp",1,["fe_mir::ir::inst::YulIntrinsicOp"]],["impl RefUnwindSafe for TypeKind",1,["fe_mir::ir::types::TypeKind"]],["impl RefUnwindSafe for AssignableValue",1,["fe_mir::ir::value::AssignableValue"]],["impl RefUnwindSafe for Value",1,["fe_mir::ir::value::Value"]],["impl RefUnwindSafe for ControlFlowGraph",1,["fe_mir::analysis::cfg::ControlFlowGraph"]],["impl RefUnwindSafe for DFSet",1,["fe_mir::analysis::domtree::DFSet"]],["impl RefUnwindSafe for DomTree",1,["fe_mir::analysis::domtree::DomTree"]],["impl RefUnwindSafe for Loop",1,["fe_mir::analysis::loop_tree::Loop"]],["impl RefUnwindSafe for LoopTree",1,["fe_mir::analysis::loop_tree::LoopTree"]],["impl RefUnwindSafe for PostDomTree",1,["fe_mir::analysis::post_domtree::PostDomTree"]],["impl RefUnwindSafe for MirDbGroupStorage__",1,["fe_mir::db::MirDbGroupStorage__"]],["impl RefUnwindSafe for MirDbStorage",1,["fe_mir::db::MirDbStorage"]],["impl RefUnwindSafe for MirInternConstLookupQuery",1,["fe_mir::db::MirInternConstLookupQuery"]],["impl RefUnwindSafe for MirInternConstQuery",1,["fe_mir::db::MirInternConstQuery"]],["impl RefUnwindSafe for MirInternFunctionLookupQuery",1,["fe_mir::db::MirInternFunctionLookupQuery"]],["impl RefUnwindSafe for MirInternFunctionQuery",1,["fe_mir::db::MirInternFunctionQuery"]],["impl RefUnwindSafe for MirInternTypeLookupQuery",1,["fe_mir::db::MirInternTypeLookupQuery"]],["impl RefUnwindSafe for MirInternTypeQuery",1,["fe_mir::db::MirInternTypeQuery"]],["impl RefUnwindSafe for MirLowerContractAllFunctionsQuery",1,["fe_mir::db::MirLowerContractAllFunctionsQuery"]],["impl RefUnwindSafe for MirLowerEnumAllFunctionsQuery",1,["fe_mir::db::MirLowerEnumAllFunctionsQuery"]],["impl RefUnwindSafe for MirLowerModuleAllFunctionsQuery",1,["fe_mir::db::MirLowerModuleAllFunctionsQuery"]],["impl RefUnwindSafe for MirLowerStructAllFunctionsQuery",1,["fe_mir::db::MirLowerStructAllFunctionsQuery"]],["impl RefUnwindSafe for MirLoweredConstantQuery",1,["fe_mir::db::MirLoweredConstantQuery"]],["impl RefUnwindSafe for MirLoweredFuncBodyQuery",1,["fe_mir::db::MirLoweredFuncBodyQuery"]],["impl RefUnwindSafe for MirLoweredFuncSignatureQuery",1,["fe_mir::db::MirLoweredFuncSignatureQuery"]],["impl RefUnwindSafe for MirLoweredMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredMonomorphizedFuncSignatureQuery"]],["impl RefUnwindSafe for MirLoweredPseudoMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredPseudoMonomorphizedFuncSignatureQuery"]],["impl RefUnwindSafe for MirLoweredTypeQuery",1,["fe_mir::db::MirLoweredTypeQuery"]],["impl RefUnwindSafe for NewDb",1,["fe_mir::db::NewDb"]],["impl RefUnwindSafe for BasicBlock",1,["fe_mir::ir::basic_block::BasicBlock"]],["impl RefUnwindSafe for BodyBuilder",1,["fe_mir::ir::body_builder::BodyBuilder"]],["impl RefUnwindSafe for BodyOrder",1,["fe_mir::ir::body_order::BodyOrder"]],["impl RefUnwindSafe for Constant",1,["fe_mir::ir::constant::Constant"]],["impl RefUnwindSafe for ConstantId",1,["fe_mir::ir::constant::ConstantId"]],["impl RefUnwindSafe for BodyDataStore",1,["fe_mir::ir::function::BodyDataStore"]],["impl RefUnwindSafe for FunctionBody",1,["fe_mir::ir::function::FunctionBody"]],["impl RefUnwindSafe for FunctionId",1,["fe_mir::ir::function::FunctionId"]],["impl RefUnwindSafe for FunctionParam",1,["fe_mir::ir::function::FunctionParam"]],["impl RefUnwindSafe for FunctionSignature",1,["fe_mir::ir::function::FunctionSignature"]],["impl RefUnwindSafe for Inst",1,["fe_mir::ir::inst::Inst"]],["impl RefUnwindSafe for SwitchTable",1,["fe_mir::ir::inst::SwitchTable"]],["impl RefUnwindSafe for SourceInfo",1,["fe_mir::ir::SourceInfo"]],["impl RefUnwindSafe for ArrayDef",1,["fe_mir::ir::types::ArrayDef"]],["impl RefUnwindSafe for EnumDef",1,["fe_mir::ir::types::EnumDef"]],["impl RefUnwindSafe for EnumVariant",1,["fe_mir::ir::types::EnumVariant"]],["impl RefUnwindSafe for EventDef",1,["fe_mir::ir::types::EventDef"]],["impl RefUnwindSafe for MapDef",1,["fe_mir::ir::types::MapDef"]],["impl RefUnwindSafe for StructDef",1,["fe_mir::ir::types::StructDef"]],["impl RefUnwindSafe for TupleDef",1,["fe_mir::ir::types::TupleDef"]],["impl RefUnwindSafe for Type",1,["fe_mir::ir::types::Type"]],["impl RefUnwindSafe for TypeId",1,["fe_mir::ir::types::TypeId"]],["impl RefUnwindSafe for Local",1,["fe_mir::ir::value::Local"]],["impl<'a> RefUnwindSafe for BranchInfo<'a>",1,["fe_mir::ir::inst::BranchInfo"]],["impl<'a> RefUnwindSafe for CfgPostOrder<'a>",1,["fe_mir::analysis::cfg::CfgPostOrder"]],["impl<'a> RefUnwindSafe for BodyCursor<'a>",1,["fe_mir::ir::body_cursor::BodyCursor"]],["impl<'a, 'b> RefUnwindSafe for BlocksInLoopPostOrder<'a, 'b>",1,["fe_mir::analysis::loop_tree::BlocksInLoopPostOrder"]],["impl<'a, T> RefUnwindSafe for IterBase<'a, T>
where\n T: RefUnwindSafe,
",1,["fe_mir::ir::inst::IterBase"]],["impl<'a, T> RefUnwindSafe for IterMutBase<'a, T>
where\n T: RefUnwindSafe,
",1,["fe_mir::ir::inst::IterMutBase"]]]],["fe_parser",[["impl RefUnwindSafe for BinOperator",1,["fe_parser::ast::BinOperator"]],["impl RefUnwindSafe for BoolOperator",1,["fe_parser::ast::BoolOperator"]],["impl RefUnwindSafe for CompOperator",1,["fe_parser::ast::CompOperator"]],["impl RefUnwindSafe for ContractStmt",1,["fe_parser::ast::ContractStmt"]],["impl RefUnwindSafe for Expr",1,["fe_parser::ast::Expr"]],["impl RefUnwindSafe for FuncStmt",1,["fe_parser::ast::FuncStmt"]],["impl RefUnwindSafe for FunctionArg",1,["fe_parser::ast::FunctionArg"]],["impl RefUnwindSafe for GenericArg",1,["fe_parser::ast::GenericArg"]],["impl RefUnwindSafe for GenericParameter",1,["fe_parser::ast::GenericParameter"]],["impl RefUnwindSafe for LiteralPattern",1,["fe_parser::ast::LiteralPattern"]],["impl RefUnwindSafe for ModuleStmt",1,["fe_parser::ast::ModuleStmt"]],["impl RefUnwindSafe for Pattern",1,["fe_parser::ast::Pattern"]],["impl RefUnwindSafe for TypeDesc",1,["fe_parser::ast::TypeDesc"]],["impl RefUnwindSafe for UnaryOperator",1,["fe_parser::ast::UnaryOperator"]],["impl RefUnwindSafe for UseTree",1,["fe_parser::ast::UseTree"]],["impl RefUnwindSafe for VarDeclTarget",1,["fe_parser::ast::VarDeclTarget"]],["impl RefUnwindSafe for VariantKind",1,["fe_parser::ast::VariantKind"]],["impl RefUnwindSafe for TokenKind",1,["fe_parser::lexer::token::TokenKind"]],["impl RefUnwindSafe for CallArg",1,["fe_parser::ast::CallArg"]],["impl RefUnwindSafe for ConstantDecl",1,["fe_parser::ast::ConstantDecl"]],["impl RefUnwindSafe for Contract",1,["fe_parser::ast::Contract"]],["impl RefUnwindSafe for Enum",1,["fe_parser::ast::Enum"]],["impl RefUnwindSafe for Field",1,["fe_parser::ast::Field"]],["impl RefUnwindSafe for Function",1,["fe_parser::ast::Function"]],["impl RefUnwindSafe for FunctionSignature",1,["fe_parser::ast::FunctionSignature"]],["impl RefUnwindSafe for Impl",1,["fe_parser::ast::Impl"]],["impl RefUnwindSafe for MatchArm",1,["fe_parser::ast::MatchArm"]],["impl RefUnwindSafe for Module",1,["fe_parser::ast::Module"]],["impl RefUnwindSafe for Path",1,["fe_parser::ast::Path"]],["impl RefUnwindSafe for Pragma",1,["fe_parser::ast::Pragma"]],["impl RefUnwindSafe for Struct",1,["fe_parser::ast::Struct"]],["impl RefUnwindSafe for Trait",1,["fe_parser::ast::Trait"]],["impl RefUnwindSafe for TypeAlias",1,["fe_parser::ast::TypeAlias"]],["impl RefUnwindSafe for Use",1,["fe_parser::ast::Use"]],["impl RefUnwindSafe for Variant",1,["fe_parser::ast::Variant"]],["impl RefUnwindSafe for NodeId",1,["fe_parser::node::NodeId"]],["impl RefUnwindSafe for ParseFailed",1,["fe_parser::parser::ParseFailed"]],["impl<'a> RefUnwindSafe for Lexer<'a>",1,["fe_parser::lexer::Lexer"]],["impl<'a> RefUnwindSafe for Token<'a>",1,["fe_parser::lexer::token::Token"]],["impl<'a> RefUnwindSafe for Parser<'a>",1,["fe_parser::parser::Parser"]],["impl<T> RefUnwindSafe for Node<T>
where\n T: RefUnwindSafe,
",1,["fe_parser::node::Node"]]]],["fe_test_runner",[["impl RefUnwindSafe for TestSink",1,["fe_test_runner::TestSink"]]]],["fe_yulc",[["impl RefUnwindSafe for ContractBytecode",1,["fe_yulc::ContractBytecode"]],["impl RefUnwindSafe for YulcError",1,["fe_yulc::YulcError"]]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[2041,4362,73111,9232,9638,2796,1084,25765,14486,368,702]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js b/compiler-docs/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 0000000000..f1ab27f973 --- /dev/null +++ b/compiler-docs/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe",[["impl UnwindSafe for Emit",1,["fe::task::build::Emit"]],["impl UnwindSafe for Commands",1,["fe::task::Commands"]],["impl UnwindSafe for FelangCli",1,["fe::FelangCli"]],["impl UnwindSafe for BuildArgs",1,["fe::task::build::BuildArgs"]],["impl UnwindSafe for CheckArgs",1,["fe::task::check::CheckArgs"]],["impl UnwindSafe for NewProjectArgs",1,["fe::task::new::NewProjectArgs"]]]],["fe_abi",[["impl UnwindSafe for AbiFunctionType",1,["fe_abi::function::AbiFunctionType"]],["impl UnwindSafe for CtxParam",1,["fe_abi::function::CtxParam"]],["impl UnwindSafe for SelfParam",1,["fe_abi::function::SelfParam"]],["impl UnwindSafe for StateMutability",1,["fe_abi::function::StateMutability"]],["impl UnwindSafe for AbiType",1,["fe_abi::types::AbiType"]],["impl UnwindSafe for AbiContract",1,["fe_abi::contract::AbiContract"]],["impl UnwindSafe for AbiEvent",1,["fe_abi::event::AbiEvent"]],["impl UnwindSafe for AbiEventField",1,["fe_abi::event::AbiEventField"]],["impl UnwindSafe for AbiEventSignature",1,["fe_abi::event::AbiEventSignature"]],["impl UnwindSafe for AbiFunction",1,["fe_abi::function::AbiFunction"]],["impl UnwindSafe for AbiFunctionSelector",1,["fe_abi::function::AbiFunctionSelector"]],["impl UnwindSafe for AbiTupleField",1,["fe_abi::types::AbiTupleField"]]]],["fe_analyzer",[["impl UnwindSafe for ContractTypeMethod",1,["fe_analyzer::builtins::ContractTypeMethod"]],["impl UnwindSafe for GlobalFunction",1,["fe_analyzer::builtins::GlobalFunction"]],["impl UnwindSafe for Intrinsic",1,["fe_analyzer::builtins::Intrinsic"]],["impl UnwindSafe for ValueMethod",1,["fe_analyzer::builtins::ValueMethod"]],["impl UnwindSafe for AdjustmentKind",1,["fe_analyzer::context::AdjustmentKind"]],["impl UnwindSafe for CallType",1,["fe_analyzer::context::CallType"]],["impl UnwindSafe for Constant",1,["fe_analyzer::context::Constant"]],["impl UnwindSafe for NamedThing",1,["fe_analyzer::context::NamedThing"]],["impl UnwindSafe for BinaryOperationError",1,["fe_analyzer::errors::BinaryOperationError"]],["impl UnwindSafe for IndexingError",1,["fe_analyzer::errors::IndexingError"]],["impl UnwindSafe for TypeCoercionError",1,["fe_analyzer::errors::TypeCoercionError"]],["impl UnwindSafe for DepLocality",1,["fe_analyzer::namespace::items::DepLocality"]],["impl UnwindSafe for EnumVariantKind",1,["fe_analyzer::namespace::items::EnumVariantKind"]],["impl UnwindSafe for IngotMode",1,["fe_analyzer::namespace::items::IngotMode"]],["impl UnwindSafe for Item",1,["fe_analyzer::namespace::items::Item"]],["impl UnwindSafe for ModuleSource",1,["fe_analyzer::namespace::items::ModuleSource"]],["impl UnwindSafe for TypeDef",1,["fe_analyzer::namespace::items::TypeDef"]],["impl UnwindSafe for BlockScopeType",1,["fe_analyzer::namespace::scopes::BlockScopeType"]],["impl UnwindSafe for Base",1,["fe_analyzer::namespace::types::Base"]],["impl UnwindSafe for GenericArg",1,["fe_analyzer::namespace::types::GenericArg"]],["impl UnwindSafe for GenericParamKind",1,["fe_analyzer::namespace::types::GenericParamKind"]],["impl UnwindSafe for GenericType",1,["fe_analyzer::namespace::types::GenericType"]],["impl UnwindSafe for Integer",1,["fe_analyzer::namespace::types::Integer"]],["impl UnwindSafe for TraitOrType",1,["fe_analyzer::namespace::types::TraitOrType"]],["impl UnwindSafe for Type",1,["fe_analyzer::namespace::types::Type"]],["impl UnwindSafe for ConstructorKind",1,["fe_analyzer::traversal::pattern_analysis::ConstructorKind"]],["impl UnwindSafe for LiteralConstructor",1,["fe_analyzer::traversal::pattern_analysis::LiteralConstructor"]],["impl UnwindSafe for SimplifiedPatternKind",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPatternKind"]],["impl UnwindSafe for GlobalFunctionIter",1,["fe_analyzer::builtins::GlobalFunctionIter"]],["impl UnwindSafe for IntrinsicIter",1,["fe_analyzer::builtins::IntrinsicIter"]],["impl UnwindSafe for Adjustment",1,["fe_analyzer::context::Adjustment"]],["impl UnwindSafe for DiagnosticVoucher",1,["fe_analyzer::context::DiagnosticVoucher"]],["impl UnwindSafe for ExpressionAttributes",1,["fe_analyzer::context::ExpressionAttributes"]],["impl UnwindSafe for FunctionBody",1,["fe_analyzer::context::FunctionBody"]],["impl UnwindSafe for TempContext",1,["fe_analyzer::context::TempContext"]],["impl UnwindSafe for AllImplsQuery",1,["fe_analyzer::db::AllImplsQuery"]],["impl UnwindSafe for AnalyzerDbGroupStorage__",1,["fe_analyzer::db::AnalyzerDbGroupStorage__"]],["impl UnwindSafe for AnalyzerDbStorage",1,["fe_analyzer::db::AnalyzerDbStorage"]],["impl UnwindSafe for ContractAllFieldsQuery",1,["fe_analyzer::db::ContractAllFieldsQuery"]],["impl UnwindSafe for ContractAllFunctionsQuery",1,["fe_analyzer::db::ContractAllFunctionsQuery"]],["impl UnwindSafe for ContractCallFunctionQuery",1,["fe_analyzer::db::ContractCallFunctionQuery"]],["impl UnwindSafe for ContractDependencyGraphQuery",1,["fe_analyzer::db::ContractDependencyGraphQuery"]],["impl UnwindSafe for ContractFieldMapQuery",1,["fe_analyzer::db::ContractFieldMapQuery"]],["impl UnwindSafe for ContractFieldTypeQuery",1,["fe_analyzer::db::ContractFieldTypeQuery"]],["impl UnwindSafe for ContractFunctionMapQuery",1,["fe_analyzer::db::ContractFunctionMapQuery"]],["impl UnwindSafe for ContractInitFunctionQuery",1,["fe_analyzer::db::ContractInitFunctionQuery"]],["impl UnwindSafe for ContractPublicFunctionMapQuery",1,["fe_analyzer::db::ContractPublicFunctionMapQuery"]],["impl UnwindSafe for ContractRuntimeDependencyGraphQuery",1,["fe_analyzer::db::ContractRuntimeDependencyGraphQuery"]],["impl UnwindSafe for EnumAllFunctionsQuery",1,["fe_analyzer::db::EnumAllFunctionsQuery"]],["impl UnwindSafe for EnumAllVariantsQuery",1,["fe_analyzer::db::EnumAllVariantsQuery"]],["impl UnwindSafe for EnumDependencyGraphQuery",1,["fe_analyzer::db::EnumDependencyGraphQuery"]],["impl UnwindSafe for EnumFunctionMapQuery",1,["fe_analyzer::db::EnumFunctionMapQuery"]],["impl UnwindSafe for EnumVariantKindQuery",1,["fe_analyzer::db::EnumVariantKindQuery"]],["impl UnwindSafe for EnumVariantMapQuery",1,["fe_analyzer::db::EnumVariantMapQuery"]],["impl UnwindSafe for FunctionBodyQuery",1,["fe_analyzer::db::FunctionBodyQuery"]],["impl UnwindSafe for FunctionDependencyGraphQuery",1,["fe_analyzer::db::FunctionDependencyGraphQuery"]],["impl UnwindSafe for FunctionSignatureQuery",1,["fe_analyzer::db::FunctionSignatureQuery"]],["impl UnwindSafe for FunctionSigsQuery",1,["fe_analyzer::db::FunctionSigsQuery"]],["impl UnwindSafe for ImplAllFunctionsQuery",1,["fe_analyzer::db::ImplAllFunctionsQuery"]],["impl UnwindSafe for ImplForQuery",1,["fe_analyzer::db::ImplForQuery"]],["impl UnwindSafe for ImplFunctionMapQuery",1,["fe_analyzer::db::ImplFunctionMapQuery"]],["impl UnwindSafe for IngotExternalIngotsQuery",1,["fe_analyzer::db::IngotExternalIngotsQuery"]],["impl UnwindSafe for IngotFilesQuery",1,["fe_analyzer::db::IngotFilesQuery"]],["impl UnwindSafe for IngotModulesQuery",1,["fe_analyzer::db::IngotModulesQuery"]],["impl UnwindSafe for IngotRootModuleQuery",1,["fe_analyzer::db::IngotRootModuleQuery"]],["impl UnwindSafe for InternAttributeLookupQuery",1,["fe_analyzer::db::InternAttributeLookupQuery"]],["impl UnwindSafe for InternAttributeQuery",1,["fe_analyzer::db::InternAttributeQuery"]],["impl UnwindSafe for InternContractFieldLookupQuery",1,["fe_analyzer::db::InternContractFieldLookupQuery"]],["impl UnwindSafe for InternContractFieldQuery",1,["fe_analyzer::db::InternContractFieldQuery"]],["impl UnwindSafe for InternContractLookupQuery",1,["fe_analyzer::db::InternContractLookupQuery"]],["impl UnwindSafe for InternContractQuery",1,["fe_analyzer::db::InternContractQuery"]],["impl UnwindSafe for InternEnumLookupQuery",1,["fe_analyzer::db::InternEnumLookupQuery"]],["impl UnwindSafe for InternEnumQuery",1,["fe_analyzer::db::InternEnumQuery"]],["impl UnwindSafe for InternEnumVariantLookupQuery",1,["fe_analyzer::db::InternEnumVariantLookupQuery"]],["impl UnwindSafe for InternEnumVariantQuery",1,["fe_analyzer::db::InternEnumVariantQuery"]],["impl UnwindSafe for InternFunctionLookupQuery",1,["fe_analyzer::db::InternFunctionLookupQuery"]],["impl UnwindSafe for InternFunctionQuery",1,["fe_analyzer::db::InternFunctionQuery"]],["impl UnwindSafe for InternFunctionSigLookupQuery",1,["fe_analyzer::db::InternFunctionSigLookupQuery"]],["impl UnwindSafe for InternFunctionSigQuery",1,["fe_analyzer::db::InternFunctionSigQuery"]],["impl UnwindSafe for InternImplLookupQuery",1,["fe_analyzer::db::InternImplLookupQuery"]],["impl UnwindSafe for InternImplQuery",1,["fe_analyzer::db::InternImplQuery"]],["impl UnwindSafe for InternIngotLookupQuery",1,["fe_analyzer::db::InternIngotLookupQuery"]],["impl UnwindSafe for InternIngotQuery",1,["fe_analyzer::db::InternIngotQuery"]],["impl UnwindSafe for InternModuleConstLookupQuery",1,["fe_analyzer::db::InternModuleConstLookupQuery"]],["impl UnwindSafe for InternModuleConstQuery",1,["fe_analyzer::db::InternModuleConstQuery"]],["impl UnwindSafe for InternModuleLookupQuery",1,["fe_analyzer::db::InternModuleLookupQuery"]],["impl UnwindSafe for InternModuleQuery",1,["fe_analyzer::db::InternModuleQuery"]],["impl UnwindSafe for InternStructFieldLookupQuery",1,["fe_analyzer::db::InternStructFieldLookupQuery"]],["impl UnwindSafe for InternStructFieldQuery",1,["fe_analyzer::db::InternStructFieldQuery"]],["impl UnwindSafe for InternStructLookupQuery",1,["fe_analyzer::db::InternStructLookupQuery"]],["impl UnwindSafe for InternStructQuery",1,["fe_analyzer::db::InternStructQuery"]],["impl UnwindSafe for InternTraitLookupQuery",1,["fe_analyzer::db::InternTraitLookupQuery"]],["impl UnwindSafe for InternTraitQuery",1,["fe_analyzer::db::InternTraitQuery"]],["impl UnwindSafe for InternTypeAliasLookupQuery",1,["fe_analyzer::db::InternTypeAliasLookupQuery"]],["impl UnwindSafe for InternTypeAliasQuery",1,["fe_analyzer::db::InternTypeAliasQuery"]],["impl UnwindSafe for InternTypeLookupQuery",1,["fe_analyzer::db::InternTypeLookupQuery"]],["impl UnwindSafe for InternTypeQuery",1,["fe_analyzer::db::InternTypeQuery"]],["impl UnwindSafe for ModuleAllImplsQuery",1,["fe_analyzer::db::ModuleAllImplsQuery"]],["impl UnwindSafe for ModuleAllItemsQuery",1,["fe_analyzer::db::ModuleAllItemsQuery"]],["impl UnwindSafe for ModuleConstantTypeQuery",1,["fe_analyzer::db::ModuleConstantTypeQuery"]],["impl UnwindSafe for ModuleConstantValueQuery",1,["fe_analyzer::db::ModuleConstantValueQuery"]],["impl UnwindSafe for ModuleConstantsQuery",1,["fe_analyzer::db::ModuleConstantsQuery"]],["impl UnwindSafe for ModuleContractsQuery",1,["fe_analyzer::db::ModuleContractsQuery"]],["impl UnwindSafe for ModuleFilePathQuery",1,["fe_analyzer::db::ModuleFilePathQuery"]],["impl UnwindSafe for ModuleImplMapQuery",1,["fe_analyzer::db::ModuleImplMapQuery"]],["impl UnwindSafe for ModuleIsIncompleteQuery",1,["fe_analyzer::db::ModuleIsIncompleteQuery"]],["impl UnwindSafe for ModuleItemMapQuery",1,["fe_analyzer::db::ModuleItemMapQuery"]],["impl UnwindSafe for ModuleParentModuleQuery",1,["fe_analyzer::db::ModuleParentModuleQuery"]],["impl UnwindSafe for ModuleParseQuery",1,["fe_analyzer::db::ModuleParseQuery"]],["impl UnwindSafe for ModuleStructsQuery",1,["fe_analyzer::db::ModuleStructsQuery"]],["impl UnwindSafe for ModuleSubmodulesQuery",1,["fe_analyzer::db::ModuleSubmodulesQuery"]],["impl UnwindSafe for ModuleTestsQuery",1,["fe_analyzer::db::ModuleTestsQuery"]],["impl UnwindSafe for ModuleUsedItemMapQuery",1,["fe_analyzer::db::ModuleUsedItemMapQuery"]],["impl UnwindSafe for RootIngotQuery",1,["fe_analyzer::db::RootIngotQuery"]],["impl UnwindSafe for StructAllFieldsQuery",1,["fe_analyzer::db::StructAllFieldsQuery"]],["impl UnwindSafe for StructAllFunctionsQuery",1,["fe_analyzer::db::StructAllFunctionsQuery"]],["impl UnwindSafe for StructDependencyGraphQuery",1,["fe_analyzer::db::StructDependencyGraphQuery"]],["impl UnwindSafe for StructFieldMapQuery",1,["fe_analyzer::db::StructFieldMapQuery"]],["impl UnwindSafe for StructFieldTypeQuery",1,["fe_analyzer::db::StructFieldTypeQuery"]],["impl UnwindSafe for StructFunctionMapQuery",1,["fe_analyzer::db::StructFunctionMapQuery"]],["impl UnwindSafe for TestDb",1,["fe_analyzer::db::TestDb"]],["impl UnwindSafe for TraitAllFunctionsQuery",1,["fe_analyzer::db::TraitAllFunctionsQuery"]],["impl UnwindSafe for TraitFunctionMapQuery",1,["fe_analyzer::db::TraitFunctionMapQuery"]],["impl UnwindSafe for TraitIsImplementedForQuery",1,["fe_analyzer::db::TraitIsImplementedForQuery"]],["impl UnwindSafe for TypeAliasTypeQuery",1,["fe_analyzer::db::TypeAliasTypeQuery"]],["impl UnwindSafe for AlreadyDefined",1,["fe_analyzer::errors::AlreadyDefined"]],["impl UnwindSafe for ConstEvalError",1,["fe_analyzer::errors::ConstEvalError"]],["impl UnwindSafe for FatalError",1,["fe_analyzer::errors::FatalError"]],["impl UnwindSafe for IncompleteItem",1,["fe_analyzer::errors::IncompleteItem"]],["impl UnwindSafe for TypeError",1,["fe_analyzer::errors::TypeError"]],["impl UnwindSafe for Attribute",1,["fe_analyzer::namespace::items::Attribute"]],["impl UnwindSafe for AttributeId",1,["fe_analyzer::namespace::items::AttributeId"]],["impl UnwindSafe for Contract",1,["fe_analyzer::namespace::items::Contract"]],["impl UnwindSafe for ContractField",1,["fe_analyzer::namespace::items::ContractField"]],["impl UnwindSafe for ContractFieldId",1,["fe_analyzer::namespace::items::ContractFieldId"]],["impl UnwindSafe for ContractId",1,["fe_analyzer::namespace::items::ContractId"]],["impl UnwindSafe for DepGraphWrapper",1,["fe_analyzer::namespace::items::DepGraphWrapper"]],["impl UnwindSafe for Enum",1,["fe_analyzer::namespace::items::Enum"]],["impl UnwindSafe for EnumId",1,["fe_analyzer::namespace::items::EnumId"]],["impl UnwindSafe for EnumVariant",1,["fe_analyzer::namespace::items::EnumVariant"]],["impl UnwindSafe for EnumVariantId",1,["fe_analyzer::namespace::items::EnumVariantId"]],["impl UnwindSafe for Function",1,["fe_analyzer::namespace::items::Function"]],["impl UnwindSafe for FunctionId",1,["fe_analyzer::namespace::items::FunctionId"]],["impl UnwindSafe for FunctionSig",1,["fe_analyzer::namespace::items::FunctionSig"]],["impl UnwindSafe for FunctionSigId",1,["fe_analyzer::namespace::items::FunctionSigId"]],["impl UnwindSafe for Impl",1,["fe_analyzer::namespace::items::Impl"]],["impl UnwindSafe for ImplId",1,["fe_analyzer::namespace::items::ImplId"]],["impl UnwindSafe for Ingot",1,["fe_analyzer::namespace::items::Ingot"]],["impl UnwindSafe for IngotId",1,["fe_analyzer::namespace::items::IngotId"]],["impl UnwindSafe for Module",1,["fe_analyzer::namespace::items::Module"]],["impl UnwindSafe for ModuleConstant",1,["fe_analyzer::namespace::items::ModuleConstant"]],["impl UnwindSafe for ModuleConstantId",1,["fe_analyzer::namespace::items::ModuleConstantId"]],["impl UnwindSafe for ModuleId",1,["fe_analyzer::namespace::items::ModuleId"]],["impl UnwindSafe for Struct",1,["fe_analyzer::namespace::items::Struct"]],["impl UnwindSafe for StructField",1,["fe_analyzer::namespace::items::StructField"]],["impl UnwindSafe for StructFieldId",1,["fe_analyzer::namespace::items::StructFieldId"]],["impl UnwindSafe for StructId",1,["fe_analyzer::namespace::items::StructId"]],["impl UnwindSafe for Trait",1,["fe_analyzer::namespace::items::Trait"]],["impl UnwindSafe for TraitId",1,["fe_analyzer::namespace::items::TraitId"]],["impl UnwindSafe for TypeAlias",1,["fe_analyzer::namespace::items::TypeAlias"]],["impl UnwindSafe for TypeAliasId",1,["fe_analyzer::namespace::items::TypeAliasId"]],["impl UnwindSafe for Array",1,["fe_analyzer::namespace::types::Array"]],["impl UnwindSafe for CtxDecl",1,["fe_analyzer::namespace::types::CtxDecl"]],["impl UnwindSafe for FeString",1,["fe_analyzer::namespace::types::FeString"]],["impl UnwindSafe for FunctionParam",1,["fe_analyzer::namespace::types::FunctionParam"]],["impl UnwindSafe for FunctionSignature",1,["fe_analyzer::namespace::types::FunctionSignature"]],["impl UnwindSafe for Generic",1,["fe_analyzer::namespace::types::Generic"]],["impl UnwindSafe for GenericParam",1,["fe_analyzer::namespace::types::GenericParam"]],["impl UnwindSafe for GenericTypeIter",1,["fe_analyzer::namespace::types::GenericTypeIter"]],["impl UnwindSafe for IntegerIter",1,["fe_analyzer::namespace::types::IntegerIter"]],["impl UnwindSafe for Map",1,["fe_analyzer::namespace::types::Map"]],["impl UnwindSafe for SelfDecl",1,["fe_analyzer::namespace::types::SelfDecl"]],["impl UnwindSafe for Tuple",1,["fe_analyzer::namespace::types::Tuple"]],["impl UnwindSafe for TypeId",1,["fe_analyzer::namespace::types::TypeId"]],["impl UnwindSafe for PatternMatrix",1,["fe_analyzer::traversal::pattern_analysis::PatternMatrix"]],["impl UnwindSafe for PatternRowVec",1,["fe_analyzer::traversal::pattern_analysis::PatternRowVec"]],["impl UnwindSafe for SigmaSet",1,["fe_analyzer::traversal::pattern_analysis::SigmaSet"]],["impl UnwindSafe for SimplifiedPattern",1,["fe_analyzer::traversal::pattern_analysis::SimplifiedPattern"]],["impl<'a> !UnwindSafe for FunctionScope<'a>",1,["fe_analyzer::namespace::scopes::FunctionScope"]],["impl<'a> !UnwindSafe for ItemScope<'a>",1,["fe_analyzer::namespace::scopes::ItemScope"]],["impl<'a, 'b> !UnwindSafe for BlockScope<'a, 'b>",1,["fe_analyzer::namespace::scopes::BlockScope"]],["impl<'a, T> !UnwindSafe for DisplayableWrapper<'a, T>",1,["fe_analyzer::display::DisplayableWrapper"]],["impl<T> UnwindSafe for Analysis<T>
where\n T: UnwindSafe,
",1,["fe_analyzer::context::Analysis"]]]],["fe_codegen",[["impl !UnwindSafe for Context",1,["fe_codegen::yul::isel::context::Context"]],["impl UnwindSafe for AbiSrcLocation",1,["fe_codegen::yul::runtime::AbiSrcLocation"]],["impl UnwindSafe for CodegenAbiContractQuery",1,["fe_codegen::db::CodegenAbiContractQuery"]],["impl UnwindSafe for CodegenAbiEventQuery",1,["fe_codegen::db::CodegenAbiEventQuery"]],["impl UnwindSafe for CodegenAbiFunctionArgumentMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionArgumentMaximumSizeQuery"]],["impl UnwindSafe for CodegenAbiFunctionQuery",1,["fe_codegen::db::CodegenAbiFunctionQuery"]],["impl UnwindSafe for CodegenAbiFunctionReturnMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiFunctionReturnMaximumSizeQuery"]],["impl UnwindSafe for CodegenAbiModuleEventsQuery",1,["fe_codegen::db::CodegenAbiModuleEventsQuery"]],["impl UnwindSafe for CodegenAbiTypeMaximumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMaximumSizeQuery"]],["impl UnwindSafe for CodegenAbiTypeMinimumSizeQuery",1,["fe_codegen::db::CodegenAbiTypeMinimumSizeQuery"]],["impl UnwindSafe for CodegenAbiTypeQuery",1,["fe_codegen::db::CodegenAbiTypeQuery"]],["impl UnwindSafe for CodegenConstantStringSymbolNameQuery",1,["fe_codegen::db::CodegenConstantStringSymbolNameQuery"]],["impl UnwindSafe for CodegenContractDeployerSymbolNameQuery",1,["fe_codegen::db::CodegenContractDeployerSymbolNameQuery"]],["impl UnwindSafe for CodegenContractSymbolNameQuery",1,["fe_codegen::db::CodegenContractSymbolNameQuery"]],["impl UnwindSafe for CodegenDbGroupStorage__",1,["fe_codegen::db::CodegenDbGroupStorage__"]],["impl UnwindSafe for CodegenDbStorage",1,["fe_codegen::db::CodegenDbStorage"]],["impl UnwindSafe for CodegenFunctionSymbolNameQuery",1,["fe_codegen::db::CodegenFunctionSymbolNameQuery"]],["impl UnwindSafe for CodegenLegalizedBodyQuery",1,["fe_codegen::db::CodegenLegalizedBodyQuery"]],["impl UnwindSafe for CodegenLegalizedSignatureQuery",1,["fe_codegen::db::CodegenLegalizedSignatureQuery"]],["impl UnwindSafe for CodegenLegalizedTypeQuery",1,["fe_codegen::db::CodegenLegalizedTypeQuery"]],["impl UnwindSafe for Db",1,["fe_codegen::db::Db"]],["impl UnwindSafe for DefaultRuntimeProvider",1,["fe_codegen::yul::runtime::DefaultRuntimeProvider"]]]],["fe_common",[["impl UnwindSafe for LabelStyle",1,["fe_common::diagnostics::LabelStyle"]],["impl UnwindSafe for FileKind",1,["fe_common::files::FileKind"]],["impl UnwindSafe for Radix",1,["fe_common::numeric::Radix"]],["impl UnwindSafe for DependencyKind",1,["fe_common::utils::files::DependencyKind"]],["impl UnwindSafe for FileLoader",1,["fe_common::utils::files::FileLoader"]],["impl UnwindSafe for ProjectMode",1,["fe_common::utils::files::ProjectMode"]],["impl UnwindSafe for FileContentQuery",1,["fe_common::db::FileContentQuery"]],["impl UnwindSafe for FileLineStartsQuery",1,["fe_common::db::FileLineStartsQuery"]],["impl UnwindSafe for FileNameQuery",1,["fe_common::db::FileNameQuery"]],["impl UnwindSafe for InternFileLookupQuery",1,["fe_common::db::InternFileLookupQuery"]],["impl UnwindSafe for InternFileQuery",1,["fe_common::db::InternFileQuery"]],["impl UnwindSafe for SourceDbGroupStorage__",1,["fe_common::db::SourceDbGroupStorage__"]],["impl UnwindSafe for SourceDbStorage",1,["fe_common::db::SourceDbStorage"]],["impl UnwindSafe for TestDb",1,["fe_common::db::TestDb"]],["impl UnwindSafe for Diagnostic",1,["fe_common::diagnostics::Diagnostic"]],["impl UnwindSafe for Label",1,["fe_common::diagnostics::Label"]],["impl UnwindSafe for File",1,["fe_common::files::File"]],["impl UnwindSafe for SourceFileId",1,["fe_common::files::SourceFileId"]],["impl UnwindSafe for Span",1,["fe_common::span::Span"]],["impl UnwindSafe for BuildFiles",1,["fe_common::utils::files::BuildFiles"]],["impl UnwindSafe for Dependency",1,["fe_common::utils::files::Dependency"]],["impl UnwindSafe for GitDependency",1,["fe_common::utils::files::GitDependency"]],["impl UnwindSafe for LocalDependency",1,["fe_common::utils::files::LocalDependency"]],["impl UnwindSafe for ProjectFiles",1,["fe_common::utils::files::ProjectFiles"]],["impl UnwindSafe for Diff",1,["fe_common::utils::ron::Diff"]],["impl<'a> UnwindSafe for Literal<'a>",1,["fe_common::numeric::Literal"]]]],["fe_compiler_test_utils",[["impl UnwindSafe for ContractHarness",1,["fe_compiler_test_utils::ContractHarness"]],["impl UnwindSafe for ExecutionOutput",1,["fe_compiler_test_utils::ExecutionOutput"]],["impl UnwindSafe for GasRecord",1,["fe_compiler_test_utils::GasRecord"]],["impl UnwindSafe for GasReporter",1,["fe_compiler_test_utils::GasReporter"]],["impl UnwindSafe for NumericAbiTokenBounds",1,["fe_compiler_test_utils::NumericAbiTokenBounds"]],["impl UnwindSafe for Runtime",1,["fe_compiler_test_utils::Runtime"]],["impl UnwindSafe for SolidityCompileError",1,["fe_compiler_test_utils::SolidityCompileError"]]]],["fe_driver",[["impl UnwindSafe for CompileError",1,["fe_driver::CompileError"]],["impl UnwindSafe for CompiledContract",1,["fe_driver::CompiledContract"]],["impl UnwindSafe for CompiledModule",1,["fe_driver::CompiledModule"]]]],["fe_mir",[["impl UnwindSafe for PostIDom",1,["fe_mir::analysis::post_domtree::PostIDom"]],["impl UnwindSafe for CursorLocation",1,["fe_mir::ir::body_cursor::CursorLocation"]],["impl UnwindSafe for ConstantValue",1,["fe_mir::ir::constant::ConstantValue"]],["impl UnwindSafe for Linkage",1,["fe_mir::ir::function::Linkage"]],["impl UnwindSafe for BinOp",1,["fe_mir::ir::inst::BinOp"]],["impl UnwindSafe for CallType",1,["fe_mir::ir::inst::CallType"]],["impl UnwindSafe for CastKind",1,["fe_mir::ir::inst::CastKind"]],["impl UnwindSafe for InstKind",1,["fe_mir::ir::inst::InstKind"]],["impl UnwindSafe for UnOp",1,["fe_mir::ir::inst::UnOp"]],["impl UnwindSafe for YulIntrinsicOp",1,["fe_mir::ir::inst::YulIntrinsicOp"]],["impl UnwindSafe for TypeKind",1,["fe_mir::ir::types::TypeKind"]],["impl UnwindSafe for AssignableValue",1,["fe_mir::ir::value::AssignableValue"]],["impl UnwindSafe for Value",1,["fe_mir::ir::value::Value"]],["impl UnwindSafe for ControlFlowGraph",1,["fe_mir::analysis::cfg::ControlFlowGraph"]],["impl UnwindSafe for DFSet",1,["fe_mir::analysis::domtree::DFSet"]],["impl UnwindSafe for DomTree",1,["fe_mir::analysis::domtree::DomTree"]],["impl UnwindSafe for Loop",1,["fe_mir::analysis::loop_tree::Loop"]],["impl UnwindSafe for LoopTree",1,["fe_mir::analysis::loop_tree::LoopTree"]],["impl UnwindSafe for PostDomTree",1,["fe_mir::analysis::post_domtree::PostDomTree"]],["impl UnwindSafe for MirDbGroupStorage__",1,["fe_mir::db::MirDbGroupStorage__"]],["impl UnwindSafe for MirDbStorage",1,["fe_mir::db::MirDbStorage"]],["impl UnwindSafe for MirInternConstLookupQuery",1,["fe_mir::db::MirInternConstLookupQuery"]],["impl UnwindSafe for MirInternConstQuery",1,["fe_mir::db::MirInternConstQuery"]],["impl UnwindSafe for MirInternFunctionLookupQuery",1,["fe_mir::db::MirInternFunctionLookupQuery"]],["impl UnwindSafe for MirInternFunctionQuery",1,["fe_mir::db::MirInternFunctionQuery"]],["impl UnwindSafe for MirInternTypeLookupQuery",1,["fe_mir::db::MirInternTypeLookupQuery"]],["impl UnwindSafe for MirInternTypeQuery",1,["fe_mir::db::MirInternTypeQuery"]],["impl UnwindSafe for MirLowerContractAllFunctionsQuery",1,["fe_mir::db::MirLowerContractAllFunctionsQuery"]],["impl UnwindSafe for MirLowerEnumAllFunctionsQuery",1,["fe_mir::db::MirLowerEnumAllFunctionsQuery"]],["impl UnwindSafe for MirLowerModuleAllFunctionsQuery",1,["fe_mir::db::MirLowerModuleAllFunctionsQuery"]],["impl UnwindSafe for MirLowerStructAllFunctionsQuery",1,["fe_mir::db::MirLowerStructAllFunctionsQuery"]],["impl UnwindSafe for MirLoweredConstantQuery",1,["fe_mir::db::MirLoweredConstantQuery"]],["impl UnwindSafe for MirLoweredFuncBodyQuery",1,["fe_mir::db::MirLoweredFuncBodyQuery"]],["impl UnwindSafe for MirLoweredFuncSignatureQuery",1,["fe_mir::db::MirLoweredFuncSignatureQuery"]],["impl UnwindSafe for MirLoweredMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredMonomorphizedFuncSignatureQuery"]],["impl UnwindSafe for MirLoweredPseudoMonomorphizedFuncSignatureQuery",1,["fe_mir::db::MirLoweredPseudoMonomorphizedFuncSignatureQuery"]],["impl UnwindSafe for MirLoweredTypeQuery",1,["fe_mir::db::MirLoweredTypeQuery"]],["impl UnwindSafe for NewDb",1,["fe_mir::db::NewDb"]],["impl UnwindSafe for BasicBlock",1,["fe_mir::ir::basic_block::BasicBlock"]],["impl UnwindSafe for BodyBuilder",1,["fe_mir::ir::body_builder::BodyBuilder"]],["impl UnwindSafe for BodyOrder",1,["fe_mir::ir::body_order::BodyOrder"]],["impl UnwindSafe for Constant",1,["fe_mir::ir::constant::Constant"]],["impl UnwindSafe for ConstantId",1,["fe_mir::ir::constant::ConstantId"]],["impl UnwindSafe for BodyDataStore",1,["fe_mir::ir::function::BodyDataStore"]],["impl UnwindSafe for FunctionBody",1,["fe_mir::ir::function::FunctionBody"]],["impl UnwindSafe for FunctionId",1,["fe_mir::ir::function::FunctionId"]],["impl UnwindSafe for FunctionParam",1,["fe_mir::ir::function::FunctionParam"]],["impl UnwindSafe for FunctionSignature",1,["fe_mir::ir::function::FunctionSignature"]],["impl UnwindSafe for Inst",1,["fe_mir::ir::inst::Inst"]],["impl UnwindSafe for SwitchTable",1,["fe_mir::ir::inst::SwitchTable"]],["impl UnwindSafe for SourceInfo",1,["fe_mir::ir::SourceInfo"]],["impl UnwindSafe for ArrayDef",1,["fe_mir::ir::types::ArrayDef"]],["impl UnwindSafe for EnumDef",1,["fe_mir::ir::types::EnumDef"]],["impl UnwindSafe for EnumVariant",1,["fe_mir::ir::types::EnumVariant"]],["impl UnwindSafe for EventDef",1,["fe_mir::ir::types::EventDef"]],["impl UnwindSafe for MapDef",1,["fe_mir::ir::types::MapDef"]],["impl UnwindSafe for StructDef",1,["fe_mir::ir::types::StructDef"]],["impl UnwindSafe for TupleDef",1,["fe_mir::ir::types::TupleDef"]],["impl UnwindSafe for Type",1,["fe_mir::ir::types::Type"]],["impl UnwindSafe for TypeId",1,["fe_mir::ir::types::TypeId"]],["impl UnwindSafe for Local",1,["fe_mir::ir::value::Local"]],["impl<'a> !UnwindSafe for BodyCursor<'a>",1,["fe_mir::ir::body_cursor::BodyCursor"]],["impl<'a> UnwindSafe for BranchInfo<'a>",1,["fe_mir::ir::inst::BranchInfo"]],["impl<'a> UnwindSafe for CfgPostOrder<'a>",1,["fe_mir::analysis::cfg::CfgPostOrder"]],["impl<'a, 'b> UnwindSafe for BlocksInLoopPostOrder<'a, 'b>",1,["fe_mir::analysis::loop_tree::BlocksInLoopPostOrder"]],["impl<'a, T> !UnwindSafe for IterMutBase<'a, T>",1,["fe_mir::ir::inst::IterMutBase"]],["impl<'a, T> UnwindSafe for IterBase<'a, T>",1,["fe_mir::ir::inst::IterBase"]]]],["fe_parser",[["impl UnwindSafe for BinOperator",1,["fe_parser::ast::BinOperator"]],["impl UnwindSafe for BoolOperator",1,["fe_parser::ast::BoolOperator"]],["impl UnwindSafe for CompOperator",1,["fe_parser::ast::CompOperator"]],["impl UnwindSafe for ContractStmt",1,["fe_parser::ast::ContractStmt"]],["impl UnwindSafe for Expr",1,["fe_parser::ast::Expr"]],["impl UnwindSafe for FuncStmt",1,["fe_parser::ast::FuncStmt"]],["impl UnwindSafe for FunctionArg",1,["fe_parser::ast::FunctionArg"]],["impl UnwindSafe for GenericArg",1,["fe_parser::ast::GenericArg"]],["impl UnwindSafe for GenericParameter",1,["fe_parser::ast::GenericParameter"]],["impl UnwindSafe for LiteralPattern",1,["fe_parser::ast::LiteralPattern"]],["impl UnwindSafe for ModuleStmt",1,["fe_parser::ast::ModuleStmt"]],["impl UnwindSafe for Pattern",1,["fe_parser::ast::Pattern"]],["impl UnwindSafe for TypeDesc",1,["fe_parser::ast::TypeDesc"]],["impl UnwindSafe for UnaryOperator",1,["fe_parser::ast::UnaryOperator"]],["impl UnwindSafe for UseTree",1,["fe_parser::ast::UseTree"]],["impl UnwindSafe for VarDeclTarget",1,["fe_parser::ast::VarDeclTarget"]],["impl UnwindSafe for VariantKind",1,["fe_parser::ast::VariantKind"]],["impl UnwindSafe for TokenKind",1,["fe_parser::lexer::token::TokenKind"]],["impl UnwindSafe for CallArg",1,["fe_parser::ast::CallArg"]],["impl UnwindSafe for ConstantDecl",1,["fe_parser::ast::ConstantDecl"]],["impl UnwindSafe for Contract",1,["fe_parser::ast::Contract"]],["impl UnwindSafe for Enum",1,["fe_parser::ast::Enum"]],["impl UnwindSafe for Field",1,["fe_parser::ast::Field"]],["impl UnwindSafe for Function",1,["fe_parser::ast::Function"]],["impl UnwindSafe for FunctionSignature",1,["fe_parser::ast::FunctionSignature"]],["impl UnwindSafe for Impl",1,["fe_parser::ast::Impl"]],["impl UnwindSafe for MatchArm",1,["fe_parser::ast::MatchArm"]],["impl UnwindSafe for Module",1,["fe_parser::ast::Module"]],["impl UnwindSafe for Path",1,["fe_parser::ast::Path"]],["impl UnwindSafe for Pragma",1,["fe_parser::ast::Pragma"]],["impl UnwindSafe for Struct",1,["fe_parser::ast::Struct"]],["impl UnwindSafe for Trait",1,["fe_parser::ast::Trait"]],["impl UnwindSafe for TypeAlias",1,["fe_parser::ast::TypeAlias"]],["impl UnwindSafe for Use",1,["fe_parser::ast::Use"]],["impl UnwindSafe for Variant",1,["fe_parser::ast::Variant"]],["impl UnwindSafe for NodeId",1,["fe_parser::node::NodeId"]],["impl UnwindSafe for ParseFailed",1,["fe_parser::parser::ParseFailed"]],["impl<'a> UnwindSafe for Lexer<'a>",1,["fe_parser::lexer::Lexer"]],["impl<'a> UnwindSafe for Token<'a>",1,["fe_parser::lexer::token::Token"]],["impl<'a> UnwindSafe for Parser<'a>",1,["fe_parser::parser::Parser"]],["impl<T> UnwindSafe for Node<T>
where\n T: UnwindSafe,
",1,["fe_parser::node::Node"]]]],["fe_test_runner",[["impl UnwindSafe for TestSink",1,["fe_test_runner::TestSink"]]]],["fe_yulc",[["impl UnwindSafe for ContractBytecode",1,["fe_yulc::ContractBytecode"]],["impl UnwindSafe for YulcError",1,["fe_yulc::YulcError"]]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1987,4254,71454,9034,9404,2731,1057,25116,14108,359,684]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/core/str/traits/trait.FromStr.js b/compiler-docs/trait.impl/core/str/traits/trait.FromStr.js new file mode 100644 index 0000000000..98b38c489e --- /dev/null +++ b/compiler-docs/trait.impl/core/str/traits/trait.FromStr.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl FromStr for ContractTypeMethod"],["impl FromStr for GlobalFunction"],["impl FromStr for Intrinsic"],["impl FromStr for ValueMethod"],["impl FromStr for Base"],["impl FromStr for GenericType"],["impl FromStr for Integer"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[2153]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_analyzer/context/trait.AnalyzerContext.js b/compiler-docs/trait.impl/fe_analyzer/context/trait.AnalyzerContext.js new file mode 100644 index 0000000000..c053db89e8 --- /dev/null +++ b/compiler-docs/trait.impl/fe_analyzer/context/trait.AnalyzerContext.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[18]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_analyzer/db/trait.AnalyzerDb.js b/compiler-docs/trait.impl/fe_analyzer/db/trait.AnalyzerDb.js new file mode 100644 index 0000000000..c053db89e8 --- /dev/null +++ b/compiler-docs/trait.impl/fe_analyzer/db/trait.AnalyzerDb.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[18]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_analyzer/display/trait.DisplayWithDb.js b/compiler-docs/trait.impl/fe_analyzer/display/trait.DisplayWithDb.js new file mode 100644 index 0000000000..c053db89e8 --- /dev/null +++ b/compiler-docs/trait.impl/fe_analyzer/display/trait.DisplayWithDb.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[18]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_analyzer/display/trait.Displayable.js b/compiler-docs/trait.impl/fe_analyzer/display/trait.Displayable.js new file mode 100644 index 0000000000..c053db89e8 --- /dev/null +++ b/compiler-docs/trait.impl/fe_analyzer/display/trait.Displayable.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[18]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_analyzer/namespace/items/trait.DiagnosticSink.js b/compiler-docs/trait.impl/fe_analyzer/namespace/items/trait.DiagnosticSink.js new file mode 100644 index 0000000000..c053db89e8 --- /dev/null +++ b/compiler-docs/trait.impl/fe_analyzer/namespace/items/trait.DiagnosticSink.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[18]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_analyzer/namespace/types/trait.TypeDowncast.js b/compiler-docs/trait.impl/fe_analyzer/namespace/types/trait.TypeDowncast.js new file mode 100644 index 0000000000..c053db89e8 --- /dev/null +++ b/compiler-docs/trait.impl/fe_analyzer/namespace/types/trait.TypeDowncast.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[18]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_codegen/db/trait.CodegenDb.js b/compiler-docs/trait.impl/fe_codegen/db/trait.CodegenDb.js new file mode 100644 index 0000000000..897df81853 --- /dev/null +++ b/compiler-docs/trait.impl/fe_codegen/db/trait.CodegenDb.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_codegen",[]],["fe_driver",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[17,17]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_codegen/yul/runtime/trait.RuntimeProvider.js b/compiler-docs/trait.impl/fe_codegen/yul/runtime/trait.RuntimeProvider.js new file mode 100644 index 0000000000..cb3e71a2f3 --- /dev/null +++ b/compiler-docs/trait.impl/fe_codegen/yul/runtime/trait.RuntimeProvider.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_codegen",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[17]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_common/db/trait.SourceDb.js b/compiler-docs/trait.impl/fe_common/db/trait.SourceDb.js new file mode 100644 index 0000000000..187398caea --- /dev/null +++ b/compiler-docs/trait.impl/fe_common/db/trait.SourceDb.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_common",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[16]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_common/db/trait.Upcast.js b/compiler-docs/trait.impl/fe_common/db/trait.Upcast.js new file mode 100644 index 0000000000..7712c94f41 --- /dev/null +++ b/compiler-docs/trait.impl/fe_common/db/trait.Upcast.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl Upcast<dyn SourceDb> for TestDb"]]],["fe_codegen",[["impl Upcast<dyn SourceDb> for Db"],["impl Upcast<dyn MirDb> for Db"],["impl Upcast<dyn AnalyzerDb> for Db"]]],["fe_mir",[["impl Upcast<dyn AnalyzerDb> for NewDb"],["impl Upcast<dyn SourceDb> for NewDb"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[378,940,299]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_common/db/trait.UpcastMut.js b/compiler-docs/trait.impl/fe_common/db/trait.UpcastMut.js new file mode 100644 index 0000000000..461c741975 --- /dev/null +++ b/compiler-docs/trait.impl/fe_common/db/trait.UpcastMut.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl UpcastMut<dyn SourceDb> for TestDb"]]],["fe_codegen",[["impl UpcastMut<dyn SourceDb> for Db"],["impl UpcastMut<dyn MirDb> for Db"],["impl UpcastMut<dyn AnalyzerDb> for Db"]]],["fe_mir",[["impl UpcastMut<dyn AnalyzerDb> for NewDb"],["impl UpcastMut<dyn SourceDb> for NewDb"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[387,967,305]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_common/span/trait.Spanned.js b/compiler-docs/trait.impl/fe_common/span/trait.Spanned.js new file mode 100644 index 0000000000..06c1666b74 --- /dev/null +++ b/compiler-docs/trait.impl/fe_common/span/trait.Spanned.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_parser",[["impl Spanned for ContractStmt"],["impl Spanned for GenericArg"],["impl Spanned for GenericParameter"],["impl Spanned for ModuleStmt"],["impl<T> Spanned for Node<T>"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[1282]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_common/utils/files/trait.DependencyResolver.js b/compiler-docs/trait.impl/fe_common/utils/files/trait.DependencyResolver.js new file mode 100644 index 0000000000..187398caea --- /dev/null +++ b/compiler-docs/trait.impl/fe_common/utils/files/trait.DependencyResolver.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_common",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[16]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_common/utils/humanize/trait.Pluralizable.js b/compiler-docs/trait.impl/fe_common/utils/humanize/trait.Pluralizable.js new file mode 100644 index 0000000000..187398caea --- /dev/null +++ b/compiler-docs/trait.impl/fe_common/utils/humanize/trait.Pluralizable.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_common",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[16]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_compiler_test_utils/trait.ToBeBytes.js b/compiler-docs/trait.impl/fe_compiler_test_utils/trait.ToBeBytes.js new file mode 100644 index 0000000000..f82a3c94fe --- /dev/null +++ b/compiler-docs/trait.impl/fe_compiler_test_utils/trait.ToBeBytes.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_compiler_test_utils",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[29]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_mir/db/trait.MirDb.js b/compiler-docs/trait.impl/fe_mir/db/trait.MirDb.js new file mode 100644 index 0000000000..9b3bc41fa5 --- /dev/null +++ b/compiler-docs/trait.impl/fe_mir/db/trait.MirDb.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_mir",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[13]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/fe_mir/pretty_print/trait.PrettyPrint.js b/compiler-docs/trait.impl/fe_mir/pretty_print/trait.PrettyPrint.js new file mode 100644 index 0000000000..9b3bc41fa5 --- /dev/null +++ b/compiler-docs/trait.impl/fe_mir/pretty_print/trait.PrettyPrint.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_mir",[]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[13]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/logos/trait.Logos.js b/compiler-docs/trait.impl/logos/trait.Logos.js new file mode 100644 index 0000000000..1d8bba7869 --- /dev/null +++ b/compiler-docs/trait.impl/logos/trait.Logos.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_parser",[["impl<'s> Logos<'s> for TokenKind"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[174]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/salsa/interned/trait.InternKey.js b/compiler-docs/trait.impl/salsa/interned/trait.InternKey.js new file mode 100644 index 0000000000..916d5613ec --- /dev/null +++ b/compiler-docs/trait.impl/salsa/interned/trait.InternKey.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl InternKey for AttributeId"],["impl InternKey for ContractFieldId"],["impl InternKey for ContractId"],["impl InternKey for EnumId"],["impl InternKey for EnumVariantId"],["impl InternKey for FunctionId"],["impl InternKey for FunctionSigId"],["impl InternKey for ImplId"],["impl InternKey for IngotId"],["impl InternKey for ModuleConstantId"],["impl InternKey for ModuleId"],["impl InternKey for StructFieldId"],["impl InternKey for StructId"],["impl InternKey for TraitId"],["impl InternKey for TypeAliasId"],["impl InternKey for TypeId"]]],["fe_common",[["impl InternKey for SourceFileId"]]],["fe_mir",[["impl InternKey for ConstantId"],["impl InternKey for FunctionId"],["impl InternKey for TypeId"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[2849,174,472]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/salsa/plumbing/trait.DatabaseOps.js b/compiler-docs/trait.impl/salsa/plumbing/trait.DatabaseOps.js new file mode 100644 index 0000000000..8986c29d92 --- /dev/null +++ b/compiler-docs/trait.impl/salsa/plumbing/trait.DatabaseOps.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl DatabaseOps for TestDb"]]],["fe_codegen",[["impl DatabaseOps for Db"]]],["fe_common",[["impl DatabaseOps for TestDb"]]],["fe_mir",[["impl DatabaseOps for NewDb"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[157,143,152,140]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/salsa/plumbing/trait.DatabaseStorageTypes.js b/compiler-docs/trait.impl/salsa/plumbing/trait.DatabaseStorageTypes.js new file mode 100644 index 0000000000..48982de73b --- /dev/null +++ b/compiler-docs/trait.impl/salsa/plumbing/trait.DatabaseStorageTypes.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl DatabaseStorageTypes for TestDb"]]],["fe_codegen",[["impl DatabaseStorageTypes for Db"]]],["fe_common",[["impl DatabaseStorageTypes for TestDb"]]],["fe_mir",[["impl DatabaseStorageTypes for NewDb"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[166,152,161,149]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/salsa/plumbing/trait.HasQueryGroup.js b/compiler-docs/trait.impl/salsa/plumbing/trait.HasQueryGroup.js new file mode 100644 index 0000000000..49efd8078d --- /dev/null +++ b/compiler-docs/trait.impl/salsa/plumbing/trait.HasQueryGroup.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl HasQueryGroup<AnalyzerDbStorage> for TestDb"],["impl HasQueryGroup<SourceDbStorage> for TestDb"]]],["fe_codegen",[["impl HasQueryGroup<CodegenDbStorage> for Db"],["impl HasQueryGroup<SourceDbStorage> for Db"],["impl HasQueryGroup<MirDbStorage> for Db"],["impl HasQueryGroup<AnalyzerDbStorage> for Db"]]],["fe_common",[["impl HasQueryGroup<SourceDbStorage> for TestDb"]]],["fe_mir",[["impl HasQueryGroup<MirDbStorage> for NewDb"],["impl HasQueryGroup<AnalyzerDbStorage> for NewDb"],["impl HasQueryGroup<SourceDbStorage> for NewDb"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[601,979,299,578]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/salsa/plumbing/trait.QueryFunction.js b/compiler-docs/trait.impl/salsa/plumbing/trait.QueryFunction.js new file mode 100644 index 0000000000..0383a25e51 --- /dev/null +++ b/compiler-docs/trait.impl/salsa/plumbing/trait.QueryFunction.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl QueryFunction for AllImplsQuery"],["impl QueryFunction for ContractAllFieldsQuery"],["impl QueryFunction for ContractAllFunctionsQuery"],["impl QueryFunction for ContractCallFunctionQuery"],["impl QueryFunction for ContractDependencyGraphQuery"],["impl QueryFunction for ContractFieldMapQuery"],["impl QueryFunction for ContractFieldTypeQuery"],["impl QueryFunction for ContractFunctionMapQuery"],["impl QueryFunction for ContractInitFunctionQuery"],["impl QueryFunction for ContractPublicFunctionMapQuery"],["impl QueryFunction for ContractRuntimeDependencyGraphQuery"],["impl QueryFunction for EnumAllFunctionsQuery"],["impl QueryFunction for EnumAllVariantsQuery"],["impl QueryFunction for EnumDependencyGraphQuery"],["impl QueryFunction for EnumFunctionMapQuery"],["impl QueryFunction for EnumVariantKindQuery"],["impl QueryFunction for EnumVariantMapQuery"],["impl QueryFunction for FunctionBodyQuery"],["impl QueryFunction for FunctionDependencyGraphQuery"],["impl QueryFunction for FunctionSignatureQuery"],["impl QueryFunction for FunctionSigsQuery"],["impl QueryFunction for ImplAllFunctionsQuery"],["impl QueryFunction for ImplForQuery"],["impl QueryFunction for ImplFunctionMapQuery"],["impl QueryFunction for IngotModulesQuery"],["impl QueryFunction for IngotRootModuleQuery"],["impl QueryFunction for ModuleAllImplsQuery"],["impl QueryFunction for ModuleAllItemsQuery"],["impl QueryFunction for ModuleConstantTypeQuery"],["impl QueryFunction for ModuleConstantValueQuery"],["impl QueryFunction for ModuleConstantsQuery"],["impl QueryFunction for ModuleContractsQuery"],["impl QueryFunction for ModuleFilePathQuery"],["impl QueryFunction for ModuleImplMapQuery"],["impl QueryFunction for ModuleIsIncompleteQuery"],["impl QueryFunction for ModuleItemMapQuery"],["impl QueryFunction for ModuleParentModuleQuery"],["impl QueryFunction for ModuleParseQuery"],["impl QueryFunction for ModuleStructsQuery"],["impl QueryFunction for ModuleSubmodulesQuery"],["impl QueryFunction for ModuleTestsQuery"],["impl QueryFunction for ModuleUsedItemMapQuery"],["impl QueryFunction for StructAllFieldsQuery"],["impl QueryFunction for StructAllFunctionsQuery"],["impl QueryFunction for StructDependencyGraphQuery"],["impl QueryFunction for StructFieldMapQuery"],["impl QueryFunction for StructFieldTypeQuery"],["impl QueryFunction for StructFunctionMapQuery"],["impl QueryFunction for TraitAllFunctionsQuery"],["impl QueryFunction for TraitFunctionMapQuery"],["impl QueryFunction for TraitIsImplementedForQuery"],["impl QueryFunction for TypeAliasTypeQuery"]]],["fe_codegen",[["impl QueryFunction for CodegenAbiContractQuery"],["impl QueryFunction for CodegenAbiEventQuery"],["impl QueryFunction for CodegenAbiFunctionArgumentMaximumSizeQuery"],["impl QueryFunction for CodegenAbiFunctionQuery"],["impl QueryFunction for CodegenAbiFunctionReturnMaximumSizeQuery"],["impl QueryFunction for CodegenAbiModuleEventsQuery"],["impl QueryFunction for CodegenAbiTypeMaximumSizeQuery"],["impl QueryFunction for CodegenAbiTypeMinimumSizeQuery"],["impl QueryFunction for CodegenAbiTypeQuery"],["impl QueryFunction for CodegenConstantStringSymbolNameQuery"],["impl QueryFunction for CodegenContractDeployerSymbolNameQuery"],["impl QueryFunction for CodegenContractSymbolNameQuery"],["impl QueryFunction for CodegenFunctionSymbolNameQuery"],["impl QueryFunction for CodegenLegalizedBodyQuery"],["impl QueryFunction for CodegenLegalizedSignatureQuery"],["impl QueryFunction for CodegenLegalizedTypeQuery"]]],["fe_common",[["impl QueryFunction for FileLineStartsQuery"],["impl QueryFunction for FileNameQuery"]]],["fe_mir",[["impl QueryFunction for MirLowerContractAllFunctionsQuery"],["impl QueryFunction for MirLowerEnumAllFunctionsQuery"],["impl QueryFunction for MirLowerModuleAllFunctionsQuery"],["impl QueryFunction for MirLowerStructAllFunctionsQuery"],["impl QueryFunction for MirLoweredConstantQuery"],["impl QueryFunction for MirLoweredFuncBodyQuery"],["impl QueryFunction for MirLoweredFuncSignatureQuery"],["impl QueryFunction for MirLoweredMonomorphizedFuncSignatureQuery"],["impl QueryFunction for MirLoweredPseudoMonomorphizedFuncSignatureQuery"],["impl QueryFunction for MirLoweredTypeQuery"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[9777,3373,352,2068]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/salsa/plumbing/trait.QueryGroup.js b/compiler-docs/trait.impl/salsa/plumbing/trait.QueryGroup.js new file mode 100644 index 0000000000..701404f2c8 --- /dev/null +++ b/compiler-docs/trait.impl/salsa/plumbing/trait.QueryGroup.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl QueryGroup for AnalyzerDbStorage"]]],["fe_codegen",[["impl QueryGroup for CodegenDbStorage"]]],["fe_common",[["impl QueryGroup for SourceDbStorage"]]],["fe_mir",[["impl QueryGroup for MirDbStorage"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[189,184,178,160]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/salsa/trait.Database.js b/compiler-docs/trait.impl/salsa/trait.Database.js new file mode 100644 index 0000000000..9d979f48e8 --- /dev/null +++ b/compiler-docs/trait.impl/salsa/trait.Database.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl Database for TestDb"]]],["fe_codegen",[["impl Database for Db"]]],["fe_common",[["impl Database for TestDb"]]],["fe_mir",[["impl Database for NewDb"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[154,140,149,137]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/salsa/trait.Query.js b/compiler-docs/trait.impl/salsa/trait.Query.js new file mode 100644 index 0000000000..20b262e023 --- /dev/null +++ b/compiler-docs/trait.impl/salsa/trait.Query.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl Query for AllImplsQuery"],["impl Query for ContractAllFieldsQuery"],["impl Query for ContractAllFunctionsQuery"],["impl Query for ContractCallFunctionQuery"],["impl Query for ContractDependencyGraphQuery"],["impl Query for ContractFieldMapQuery"],["impl Query for ContractFieldTypeQuery"],["impl Query for ContractFunctionMapQuery"],["impl Query for ContractInitFunctionQuery"],["impl Query for ContractPublicFunctionMapQuery"],["impl Query for ContractRuntimeDependencyGraphQuery"],["impl Query for EnumAllFunctionsQuery"],["impl Query for EnumAllVariantsQuery"],["impl Query for EnumDependencyGraphQuery"],["impl Query for EnumFunctionMapQuery"],["impl Query for EnumVariantKindQuery"],["impl Query for EnumVariantMapQuery"],["impl Query for FunctionBodyQuery"],["impl Query for FunctionDependencyGraphQuery"],["impl Query for FunctionSignatureQuery"],["impl Query for FunctionSigsQuery"],["impl Query for ImplAllFunctionsQuery"],["impl Query for ImplForQuery"],["impl Query for ImplFunctionMapQuery"],["impl Query for IngotExternalIngotsQuery"],["impl Query for IngotFilesQuery"],["impl Query for IngotModulesQuery"],["impl Query for IngotRootModuleQuery"],["impl Query for InternAttributeLookupQuery"],["impl Query for InternAttributeQuery"],["impl Query for InternContractFieldLookupQuery"],["impl Query for InternContractFieldQuery"],["impl Query for InternContractLookupQuery"],["impl Query for InternContractQuery"],["impl Query for InternEnumLookupQuery"],["impl Query for InternEnumQuery"],["impl Query for InternEnumVariantLookupQuery"],["impl Query for InternEnumVariantQuery"],["impl Query for InternFunctionLookupQuery"],["impl Query for InternFunctionQuery"],["impl Query for InternFunctionSigLookupQuery"],["impl Query for InternFunctionSigQuery"],["impl Query for InternImplLookupQuery"],["impl Query for InternImplQuery"],["impl Query for InternIngotLookupQuery"],["impl Query for InternIngotQuery"],["impl Query for InternModuleConstLookupQuery"],["impl Query for InternModuleConstQuery"],["impl Query for InternModuleLookupQuery"],["impl Query for InternModuleQuery"],["impl Query for InternStructFieldLookupQuery"],["impl Query for InternStructFieldQuery"],["impl Query for InternStructLookupQuery"],["impl Query for InternStructQuery"],["impl Query for InternTraitLookupQuery"],["impl Query for InternTraitQuery"],["impl Query for InternTypeAliasLookupQuery"],["impl Query for InternTypeAliasQuery"],["impl Query for InternTypeLookupQuery"],["impl Query for InternTypeQuery"],["impl Query for ModuleAllImplsQuery"],["impl Query for ModuleAllItemsQuery"],["impl Query for ModuleConstantTypeQuery"],["impl Query for ModuleConstantValueQuery"],["impl Query for ModuleConstantsQuery"],["impl Query for ModuleContractsQuery"],["impl Query for ModuleFilePathQuery"],["impl Query for ModuleImplMapQuery"],["impl Query for ModuleIsIncompleteQuery"],["impl Query for ModuleItemMapQuery"],["impl Query for ModuleParentModuleQuery"],["impl Query for ModuleParseQuery"],["impl Query for ModuleStructsQuery"],["impl Query for ModuleSubmodulesQuery"],["impl Query for ModuleTestsQuery"],["impl Query for ModuleUsedItemMapQuery"],["impl Query for RootIngotQuery"],["impl Query for StructAllFieldsQuery"],["impl Query for StructAllFunctionsQuery"],["impl Query for StructDependencyGraphQuery"],["impl Query for StructFieldMapQuery"],["impl Query for StructFieldTypeQuery"],["impl Query for StructFunctionMapQuery"],["impl Query for TraitAllFunctionsQuery"],["impl Query for TraitFunctionMapQuery"],["impl Query for TraitIsImplementedForQuery"],["impl Query for TypeAliasTypeQuery"]]],["fe_codegen",[["impl Query for CodegenAbiContractQuery"],["impl Query for CodegenAbiEventQuery"],["impl Query for CodegenAbiFunctionArgumentMaximumSizeQuery"],["impl Query for CodegenAbiFunctionQuery"],["impl Query for CodegenAbiFunctionReturnMaximumSizeQuery"],["impl Query for CodegenAbiModuleEventsQuery"],["impl Query for CodegenAbiTypeMaximumSizeQuery"],["impl Query for CodegenAbiTypeMinimumSizeQuery"],["impl Query for CodegenAbiTypeQuery"],["impl Query for CodegenConstantStringSymbolNameQuery"],["impl Query for CodegenContractDeployerSymbolNameQuery"],["impl Query for CodegenContractSymbolNameQuery"],["impl Query for CodegenFunctionSymbolNameQuery"],["impl Query for CodegenLegalizedBodyQuery"],["impl Query for CodegenLegalizedSignatureQuery"],["impl Query for CodegenLegalizedTypeQuery"]]],["fe_common",[["impl Query for FileContentQuery"],["impl Query for FileLineStartsQuery"],["impl Query for FileNameQuery"],["impl Query for InternFileLookupQuery"],["impl Query for InternFileQuery"]]],["fe_mir",[["impl Query for MirInternConstLookupQuery"],["impl Query for MirInternConstQuery"],["impl Query for MirInternFunctionLookupQuery"],["impl Query for MirInternFunctionQuery"],["impl Query for MirInternTypeLookupQuery"],["impl Query for MirInternTypeQuery"],["impl Query for MirLowerContractAllFunctionsQuery"],["impl Query for MirLowerEnumAllFunctionsQuery"],["impl Query for MirLowerModuleAllFunctionsQuery"],["impl Query for MirLowerStructAllFunctionsQuery"],["impl Query for MirLoweredConstantQuery"],["impl Query for MirLoweredFuncBodyQuery"],["impl Query for MirLoweredFuncSignatureQuery"],["impl Query for MirLoweredMonomorphizedFuncSignatureQuery"],["impl Query for MirLoweredPseudoMonomorphizedFuncSignatureQuery"],["impl Query for MirLoweredTypeQuery"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[15674,3245,828,3032]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/salsa/trait.QueryDb.js b/compiler-docs/trait.impl/salsa/trait.QueryDb.js new file mode 100644 index 0000000000..68b28559ab --- /dev/null +++ b/compiler-docs/trait.impl/salsa/trait.QueryDb.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl<'d> QueryDb<'d> for AllImplsQuery"],["impl<'d> QueryDb<'d> for ContractAllFieldsQuery"],["impl<'d> QueryDb<'d> for ContractAllFunctionsQuery"],["impl<'d> QueryDb<'d> for ContractCallFunctionQuery"],["impl<'d> QueryDb<'d> for ContractDependencyGraphQuery"],["impl<'d> QueryDb<'d> for ContractFieldMapQuery"],["impl<'d> QueryDb<'d> for ContractFieldTypeQuery"],["impl<'d> QueryDb<'d> for ContractFunctionMapQuery"],["impl<'d> QueryDb<'d> for ContractInitFunctionQuery"],["impl<'d> QueryDb<'d> for ContractPublicFunctionMapQuery"],["impl<'d> QueryDb<'d> for ContractRuntimeDependencyGraphQuery"],["impl<'d> QueryDb<'d> for EnumAllFunctionsQuery"],["impl<'d> QueryDb<'d> for EnumAllVariantsQuery"],["impl<'d> QueryDb<'d> for EnumDependencyGraphQuery"],["impl<'d> QueryDb<'d> for EnumFunctionMapQuery"],["impl<'d> QueryDb<'d> for EnumVariantKindQuery"],["impl<'d> QueryDb<'d> for EnumVariantMapQuery"],["impl<'d> QueryDb<'d> for FunctionBodyQuery"],["impl<'d> QueryDb<'d> for FunctionDependencyGraphQuery"],["impl<'d> QueryDb<'d> for FunctionSignatureQuery"],["impl<'d> QueryDb<'d> for FunctionSigsQuery"],["impl<'d> QueryDb<'d> for ImplAllFunctionsQuery"],["impl<'d> QueryDb<'d> for ImplForQuery"],["impl<'d> QueryDb<'d> for ImplFunctionMapQuery"],["impl<'d> QueryDb<'d> for IngotExternalIngotsQuery"],["impl<'d> QueryDb<'d> for IngotFilesQuery"],["impl<'d> QueryDb<'d> for IngotModulesQuery"],["impl<'d> QueryDb<'d> for IngotRootModuleQuery"],["impl<'d> QueryDb<'d> for InternAttributeLookupQuery"],["impl<'d> QueryDb<'d> for InternAttributeQuery"],["impl<'d> QueryDb<'d> for InternContractFieldLookupQuery"],["impl<'d> QueryDb<'d> for InternContractFieldQuery"],["impl<'d> QueryDb<'d> for InternContractLookupQuery"],["impl<'d> QueryDb<'d> for InternContractQuery"],["impl<'d> QueryDb<'d> for InternEnumLookupQuery"],["impl<'d> QueryDb<'d> for InternEnumQuery"],["impl<'d> QueryDb<'d> for InternEnumVariantLookupQuery"],["impl<'d> QueryDb<'d> for InternEnumVariantQuery"],["impl<'d> QueryDb<'d> for InternFunctionLookupQuery"],["impl<'d> QueryDb<'d> for InternFunctionQuery"],["impl<'d> QueryDb<'d> for InternFunctionSigLookupQuery"],["impl<'d> QueryDb<'d> for InternFunctionSigQuery"],["impl<'d> QueryDb<'d> for InternImplLookupQuery"],["impl<'d> QueryDb<'d> for InternImplQuery"],["impl<'d> QueryDb<'d> for InternIngotLookupQuery"],["impl<'d> QueryDb<'d> for InternIngotQuery"],["impl<'d> QueryDb<'d> for InternModuleConstLookupQuery"],["impl<'d> QueryDb<'d> for InternModuleConstQuery"],["impl<'d> QueryDb<'d> for InternModuleLookupQuery"],["impl<'d> QueryDb<'d> for InternModuleQuery"],["impl<'d> QueryDb<'d> for InternStructFieldLookupQuery"],["impl<'d> QueryDb<'d> for InternStructFieldQuery"],["impl<'d> QueryDb<'d> for InternStructLookupQuery"],["impl<'d> QueryDb<'d> for InternStructQuery"],["impl<'d> QueryDb<'d> for InternTraitLookupQuery"],["impl<'d> QueryDb<'d> for InternTraitQuery"],["impl<'d> QueryDb<'d> for InternTypeAliasLookupQuery"],["impl<'d> QueryDb<'d> for InternTypeAliasQuery"],["impl<'d> QueryDb<'d> for InternTypeLookupQuery"],["impl<'d> QueryDb<'d> for InternTypeQuery"],["impl<'d> QueryDb<'d> for ModuleAllImplsQuery"],["impl<'d> QueryDb<'d> for ModuleAllItemsQuery"],["impl<'d> QueryDb<'d> for ModuleConstantTypeQuery"],["impl<'d> QueryDb<'d> for ModuleConstantValueQuery"],["impl<'d> QueryDb<'d> for ModuleConstantsQuery"],["impl<'d> QueryDb<'d> for ModuleContractsQuery"],["impl<'d> QueryDb<'d> for ModuleFilePathQuery"],["impl<'d> QueryDb<'d> for ModuleImplMapQuery"],["impl<'d> QueryDb<'d> for ModuleIsIncompleteQuery"],["impl<'d> QueryDb<'d> for ModuleItemMapQuery"],["impl<'d> QueryDb<'d> for ModuleParentModuleQuery"],["impl<'d> QueryDb<'d> for ModuleParseQuery"],["impl<'d> QueryDb<'d> for ModuleStructsQuery"],["impl<'d> QueryDb<'d> for ModuleSubmodulesQuery"],["impl<'d> QueryDb<'d> for ModuleTestsQuery"],["impl<'d> QueryDb<'d> for ModuleUsedItemMapQuery"],["impl<'d> QueryDb<'d> for RootIngotQuery"],["impl<'d> QueryDb<'d> for StructAllFieldsQuery"],["impl<'d> QueryDb<'d> for StructAllFunctionsQuery"],["impl<'d> QueryDb<'d> for StructDependencyGraphQuery"],["impl<'d> QueryDb<'d> for StructFieldMapQuery"],["impl<'d> QueryDb<'d> for StructFieldTypeQuery"],["impl<'d> QueryDb<'d> for StructFunctionMapQuery"],["impl<'d> QueryDb<'d> for TraitAllFunctionsQuery"],["impl<'d> QueryDb<'d> for TraitFunctionMapQuery"],["impl<'d> QueryDb<'d> for TraitIsImplementedForQuery"],["impl<'d> QueryDb<'d> for TypeAliasTypeQuery"]]],["fe_codegen",[["impl<'d> QueryDb<'d> for CodegenAbiContractQuery"],["impl<'d> QueryDb<'d> for CodegenAbiEventQuery"],["impl<'d> QueryDb<'d> for CodegenAbiFunctionArgumentMaximumSizeQuery"],["impl<'d> QueryDb<'d> for CodegenAbiFunctionQuery"],["impl<'d> QueryDb<'d> for CodegenAbiFunctionReturnMaximumSizeQuery"],["impl<'d> QueryDb<'d> for CodegenAbiModuleEventsQuery"],["impl<'d> QueryDb<'d> for CodegenAbiTypeMaximumSizeQuery"],["impl<'d> QueryDb<'d> for CodegenAbiTypeMinimumSizeQuery"],["impl<'d> QueryDb<'d> for CodegenAbiTypeQuery"],["impl<'d> QueryDb<'d> for CodegenConstantStringSymbolNameQuery"],["impl<'d> QueryDb<'d> for CodegenContractDeployerSymbolNameQuery"],["impl<'d> QueryDb<'d> for CodegenContractSymbolNameQuery"],["impl<'d> QueryDb<'d> for CodegenFunctionSymbolNameQuery"],["impl<'d> QueryDb<'d> for CodegenLegalizedBodyQuery"],["impl<'d> QueryDb<'d> for CodegenLegalizedSignatureQuery"],["impl<'d> QueryDb<'d> for CodegenLegalizedTypeQuery"]]],["fe_common",[["impl<'d> QueryDb<'d> for FileContentQuery"],["impl<'d> QueryDb<'d> for FileLineStartsQuery"],["impl<'d> QueryDb<'d> for FileNameQuery"],["impl<'d> QueryDb<'d> for InternFileLookupQuery"],["impl<'d> QueryDb<'d> for InternFileQuery"]]],["fe_mir",[["impl<'d> QueryDb<'d> for MirInternConstLookupQuery"],["impl<'d> QueryDb<'d> for MirInternConstQuery"],["impl<'d> QueryDb<'d> for MirInternFunctionLookupQuery"],["impl<'d> QueryDb<'d> for MirInternFunctionQuery"],["impl<'d> QueryDb<'d> for MirInternTypeLookupQuery"],["impl<'d> QueryDb<'d> for MirInternTypeQuery"],["impl<'d> QueryDb<'d> for MirLowerContractAllFunctionsQuery"],["impl<'d> QueryDb<'d> for MirLowerEnumAllFunctionsQuery"],["impl<'d> QueryDb<'d> for MirLowerModuleAllFunctionsQuery"],["impl<'d> QueryDb<'d> for MirLowerStructAllFunctionsQuery"],["impl<'d> QueryDb<'d> for MirLoweredConstantQuery"],["impl<'d> QueryDb<'d> for MirLoweredFuncBodyQuery"],["impl<'d> QueryDb<'d> for MirLoweredFuncSignatureQuery"],["impl<'d> QueryDb<'d> for MirLoweredMonomorphizedFuncSignatureQuery"],["impl<'d> QueryDb<'d> for MirLoweredPseudoMonomorphizedFuncSignatureQuery"],["impl<'d> QueryDb<'d> for MirLoweredTypeQuery"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[17588,3597,938,3384]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/serde/de/trait.Deserialize.js b/compiler-docs/trait.impl/serde/de/trait.Deserialize.js new file mode 100644 index 0000000000..33626d588d --- /dev/null +++ b/compiler-docs/trait.impl/serde/de/trait.Deserialize.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_common",[["impl<'de> Deserialize<'de> for SourceFileId"],["impl<'de> Deserialize<'de> for Span"]]],["fe_parser",[["impl<'de> Deserialize<'de> for BinOperator"],["impl<'de> Deserialize<'de> for BoolOperator"],["impl<'de> Deserialize<'de> for CompOperator"],["impl<'de> Deserialize<'de> for ContractStmt"],["impl<'de> Deserialize<'de> for Expr"],["impl<'de> Deserialize<'de> for FuncStmt"],["impl<'de> Deserialize<'de> for FunctionArg"],["impl<'de> Deserialize<'de> for GenericArg"],["impl<'de> Deserialize<'de> for GenericParameter"],["impl<'de> Deserialize<'de> for LiteralPattern"],["impl<'de> Deserialize<'de> for ModuleStmt"],["impl<'de> Deserialize<'de> for Pattern"],["impl<'de> Deserialize<'de> for TypeDesc"],["impl<'de> Deserialize<'de> for UnaryOperator"],["impl<'de> Deserialize<'de> for UseTree"],["impl<'de> Deserialize<'de> for VarDeclTarget"],["impl<'de> Deserialize<'de> for VariantKind"],["impl<'de> Deserialize<'de> for CallArg"],["impl<'de> Deserialize<'de> for ConstantDecl"],["impl<'de> Deserialize<'de> for Contract"],["impl<'de> Deserialize<'de> for Enum"],["impl<'de> Deserialize<'de> for Field"],["impl<'de> Deserialize<'de> for Function"],["impl<'de> Deserialize<'de> for FunctionSignature"],["impl<'de> Deserialize<'de> for Impl"],["impl<'de> Deserialize<'de> for MatchArm"],["impl<'de> Deserialize<'de> for Module"],["impl<'de> Deserialize<'de> for Path"],["impl<'de> Deserialize<'de> for Pragma"],["impl<'de> Deserialize<'de> for Struct"],["impl<'de> Deserialize<'de> for Trait"],["impl<'de> Deserialize<'de> for TypeAlias"],["impl<'de> Deserialize<'de> for Use"],["impl<'de> Deserialize<'de> for Variant"],["impl<'de, T> Deserialize<'de> for Node<T>
where\n T: Deserialize<'de>,
"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[608,10656]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/serde/ser/trait.Serialize.js b/compiler-docs/trait.impl/serde/ser/trait.Serialize.js new file mode 100644 index 0000000000..61028f8102 --- /dev/null +++ b/compiler-docs/trait.impl/serde/ser/trait.Serialize.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_abi",[["impl Serialize for AbiFunctionType"],["impl Serialize for StateMutability"],["impl Serialize for AbiType"],["impl Serialize for AbiContract"],["impl Serialize for AbiEvent"],["impl Serialize for AbiEventField"],["impl Serialize for AbiFunction"],["impl Serialize for AbiTupleField"]]],["fe_common",[["impl Serialize for Span"]]],["fe_parser",[["impl Serialize for BinOperator"],["impl Serialize for BoolOperator"],["impl Serialize for CompOperator"],["impl Serialize for ContractStmt"],["impl Serialize for Expr"],["impl Serialize for FuncStmt"],["impl Serialize for FunctionArg"],["impl Serialize for GenericArg"],["impl Serialize for GenericParameter"],["impl Serialize for LiteralPattern"],["impl Serialize for ModuleStmt"],["impl Serialize for Pattern"],["impl Serialize for TypeDesc"],["impl Serialize for UnaryOperator"],["impl Serialize for UseTree"],["impl Serialize for VarDeclTarget"],["impl Serialize for VariantKind"],["impl Serialize for CallArg"],["impl Serialize for ConstantDecl"],["impl Serialize for Contract"],["impl Serialize for Enum"],["impl Serialize for Field"],["impl Serialize for Function"],["impl Serialize for FunctionSignature"],["impl Serialize for Impl"],["impl Serialize for MatchArm"],["impl Serialize for Module"],["impl Serialize for Path"],["impl Serialize for Pragma"],["impl Serialize for Struct"],["impl Serialize for Trait"],["impl Serialize for TypeAlias"],["impl Serialize for Use"],["impl Serialize for Variant"],["impl<T> Serialize for Node<T>
where\n T: Serialize,
"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[2273,268,9737]} \ No newline at end of file diff --git a/compiler-docs/trait.impl/strum/trait.IntoEnumIterator.js b/compiler-docs/trait.impl/strum/trait.IntoEnumIterator.js new file mode 100644 index 0000000000..87c57ca65b --- /dev/null +++ b/compiler-docs/trait.impl/strum/trait.IntoEnumIterator.js @@ -0,0 +1,9 @@ +(function() { + var implementors = Object.fromEntries([["fe_analyzer",[["impl IntoEnumIterator for GlobalFunction"],["impl IntoEnumIterator for Intrinsic"],["impl IntoEnumIterator for GenericType"],["impl IntoEnumIterator for Integer"]]]]); + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } +})() +//{"start":57,"fragment_lengths":[702]} \ No newline at end of file diff --git a/compiler-docs/type.impl/core/result/enum.Result.js b/compiler-docs/type.impl/core/result/enum.Result.js new file mode 100644 index 0000000000..4d956f9ddf --- /dev/null +++ b/compiler-docs/type.impl/core/result/enum.Result.js @@ -0,0 +1,9 @@ +(function() { + var type_impls = Object.fromEntries([["fe_parser",[["
1.0.0 · Source§

impl<T, E> Clone for Result<T, E>
where\n T: Clone,\n E: Clone,

Source§

fn clone(&self) -> Result<T, E>

Returns a duplicate of the value. Read more
Source§

fn clone_from(&mut self, source: &Result<T, E>)

Performs copy-assignment from source. Read more
","Clone","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<T, E> Debug for Result<T, E>
where\n T: Debug,\n E: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","fe_parser::parser::ParseResult"],["
Source§

impl<'de, T, E> Deserialize<'de> for Result<T, E>
where\n T: Deserialize<'de>,\n E: Deserialize<'de>,

Source§

fn deserialize<D>(\n deserializer: D,\n) -> Result<Result<T, E>, <D as Deserializer<'de>>::Error>
where\n D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
","Deserialize<'de>","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<A, E, V> FromIterator<Result<A, E>> for Result<V, E>
where\n V: FromIterator<A>,

Source§

fn from_iter<I>(iter: I) -> Result<V, E>
where\n I: IntoIterator<Item = Result<A, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err occur, a\ncontainer with the values of each Result is returned.

\n

Here is an example which increments every integer in a vector,\nchecking for overflow:

\n\n
let v = vec![1, 2];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_add(1).ok_or(\"Overflow!\")\n).collect();\nassert_eq!(res, Ok(vec![2, 3]));
\n

Here is another example that tries to subtract one from another list\nof integers, this time checking for underflow:

\n\n
let v = vec![1, 2, 0];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_sub(1).ok_or(\"Underflow!\")\n).collect();\nassert_eq!(res, Err(\"Underflow!\"));
\n

Here is a variation on the previous example, showing that no\nfurther elements are taken from iter after the first Err.

\n\n
let v = vec![3, 2, 1, 10];\nlet mut shared = 0;\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32| {\n    shared += x;\n    x.checked_sub(2).ok_or(\"Underflow!\")\n}).collect();\nassert_eq!(res, Err(\"Underflow!\"));\nassert_eq!(shared, 6);
\n

Since the third element caused an underflow, no further elements were taken,\nso the final value of shared is 6 (= 3 + 2 + 1), not 16.

\n
","FromIterator>","fe_parser::parser::ParseResult"],["
Source§

impl<T, E, F> FromResidual<Result<Infallible, E>> for Result<T, F>
where\n F: From<E>,

Source§

fn from_residual(residual: Result<Infallible, E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","fe_parser::parser::ParseResult"],["
Source§

impl<T, E, F> FromResidual<Yeet<E>> for Result<T, F>
where\n F: From<E>,

Source§

fn from_residual(_: Yeet<E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<T, E> Hash for Result<T, E>
where\n T: Hash,\n E: Hash,

Source§

fn hash<__H>(&self, state: &mut __H)
where\n __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where\n H: Hasher,\n Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
","Hash","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<T, E> IntoIterator for Result<T, E>

Source§

fn into_iter(self) -> IntoIter<T>

Returns a consuming iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(5);\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, [5]);\n\nlet x: Result<u32, &str> = Err(\"nothing!\");\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, []);
\n
Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
","IntoIterator","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<T, E> Ord for Result<T, E>
where\n T: Ord,\n E: Ord,

Source§

fn cmp(&self, other: &Result<T, E>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where\n Self: Sized,

Restrict a value to a certain interval. Read more
","Ord","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<T, E> PartialEq for Result<T, E>
where\n T: PartialEq,\n E: PartialEq,

Source§

fn eq(&self, other: &Result<T, E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient,\nand should not be overridden without very good reason.
","PartialEq","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<T, E> PartialOrd for Result<T, E>
where\n T: PartialOrd,\n E: PartialOrd,

Source§

fn partial_cmp(&self, other: &Result<T, E>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the\n<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the >\noperator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by\nthe >= operator. Read more
","PartialOrd","fe_parser::parser::ParseResult"],["
1.16.0 · Source§

impl<T, U, E> Product<Result<U, E>> for Result<T, E>
where\n T: Product<U>,

Source§

fn product<I>(iter: I) -> Result<T, E>
where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the product of all elements is returned.

\n
§Examples
\n

This multiplies each number in a vector of strings,\nif a string could not be parsed the operation returns Err:

\n\n
let nums = vec![\"5\", \"10\", \"1\", \"2\"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert_eq!(total, Ok(100));\nlet nums = vec![\"5\", \"10\", \"one\", \"2\"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert!(total.is_err());
\n
","Product>","fe_parser::parser::ParseResult"],["
Source§

impl<T, E> Residual<T> for Result<Infallible, E>

Source§

type TryType = Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2_residual)
The “return” type of this meta-function.
","Residual","fe_parser::parser::ParseResult"],["
Source§

impl<T, E> Result<&T, E>

1.59.0 (const: 1.83.0) · Source

pub const fn copied(self) -> Result<T, E>
where\n T: Copy,

Maps a Result<&T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
§Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · Source

pub fn cloned(self) -> Result<T, E>
where\n T: Clone,

Maps a Result<&T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
§Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"fe_parser::parser::ParseResult"],["
Source§

impl<T, E> Result<&mut T, E>

1.59.0 (const: 1.83.0) · Source

pub const fn copied(self) -> Result<T, E>
where\n T: Copy,

Maps a Result<&mut T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
§Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · Source

pub fn cloned(self) -> Result<T, E>
where\n T: Clone,

Maps a Result<&mut T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
§Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"fe_parser::parser::ParseResult"],["
Source§

impl<T, E> Result<Option<T>, E>

1.33.0 (const: 1.83.0) · Source

pub const fn transpose(self) -> Option<Result<T, E>>

Transposes a Result of an Option into an Option of a Result.

\n

Ok(None) will be mapped to None.\nOk(Some(_)) and Err(_) will be mapped to Some(Ok(_)) and Some(Err(_)).

\n
§Examples
\n
#[derive(Debug, Eq, PartialEq)]\nstruct SomeErr;\n\nlet x: Result<Option<i32>, SomeErr> = Ok(Some(5));\nlet y: Option<Result<i32, SomeErr>> = Some(Ok(5));\nassert_eq!(x.transpose(), y);
\n
",0,"fe_parser::parser::ParseResult"],["
Source§

impl<T, E> Result<Result<T, E>, E>

1.89.0 (const: 1.89.0) · Source

pub const fn flatten(self) -> Result<T, E>

Converts from Result<Result<T, E>, E> to Result<T, E>

\n
§Examples
\n
let x: Result<Result<&'static str, u32>, u32> = Ok(Ok(\"hello\"));\nassert_eq!(Ok(\"hello\"), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Err(6));\nassert_eq!(Err(6), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Err(6);\nassert_eq!(Err(6), x.flatten());
\n

Flattening only removes one level of nesting at a time:

\n\n
let x: Result<Result<Result<&'static str, u32>, u32>, u32> = Ok(Ok(Ok(\"hello\")));\nassert_eq!(Ok(Ok(\"hello\")), x.flatten());\nassert_eq!(Ok(\"hello\"), x.flatten().flatten());
\n
",0,"fe_parser::parser::ParseResult"],["
Source§

impl<T, E> Result<T, E>

1.0.0 (const: 1.48.0) · Source

pub const fn is_ok(&self) -> bool

Returns true if the result is Ok.

\n
§Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_ok(), true);\n\nlet x: Result<i32, &str> = Err(\"Some error message\");\nassert_eq!(x.is_ok(), false);
\n
1.70.0 · Source

pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool

Returns true if the result is Ok and the value inside of it matches a predicate.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.is_ok_and(|x| x > 1), true);\n\nlet x: Result<u32, &str> = Ok(0);\nassert_eq!(x.is_ok_and(|x| x > 1), false);\n\nlet x: Result<u32, &str> = Err(\"hey\");\nassert_eq!(x.is_ok_and(|x| x > 1), false);\n\nlet x: Result<String, &str> = Ok(\"ownership\".to_string());\nassert_eq!(x.as_ref().is_ok_and(|x| x.len() > 1), true);\nprintln!(\"still alive {:?}\", x);
\n
1.0.0 (const: 1.48.0) · Source

pub const fn is_err(&self) -> bool

Returns true if the result is Err.

\n
§Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_err(), false);\n\nlet x: Result<i32, &str> = Err(\"Some error message\");\nassert_eq!(x.is_err(), true);
\n
1.70.0 · Source

pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool

Returns true if the result is Err and the value inside of it matches a predicate.

\n
§Examples
\n
use std::io::{Error, ErrorKind};\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, \"!\"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), true);\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::PermissionDenied, \"!\"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);\n\nlet x: Result<u32, Error> = Ok(123);\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);\n\nlet x: Result<u32, String> = Err(\"ownership\".to_string());\nassert_eq!(x.as_ref().is_err_and(|x| x.len() > 1), true);\nprintln!(\"still alive {:?}\", x);
\n
1.0.0 · Source

pub fn ok(self) -> Option<T>

Converts from Result<T, E> to Option<T>.

\n

Converts self into an Option<T>, consuming self,\nand discarding the error, if any.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.ok(), Some(2));\n\nlet x: Result<u32, &str> = Err(\"Nothing here\");\nassert_eq!(x.ok(), None);
\n
1.0.0 · Source

pub fn err(self) -> Option<E>

Converts from Result<T, E> to Option<E>.

\n

Converts self into an Option<E>, consuming self,\nand discarding the success value, if any.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.err(), None);\n\nlet x: Result<u32, &str> = Err(\"Nothing here\");\nassert_eq!(x.err(), Some(\"Nothing here\"));
\n
1.0.0 (const: 1.48.0) · Source

pub const fn as_ref(&self) -> Result<&T, &E>

Converts from &Result<T, E> to Result<&T, &E>.

\n

Produces a new Result, containing a reference\ninto the original, leaving the original in place.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.as_ref(), Ok(&2));\n\nlet x: Result<u32, &str> = Err(\"Error\");\nassert_eq!(x.as_ref(), Err(&\"Error\"));
\n
1.0.0 (const: 1.83.0) · Source

pub const fn as_mut(&mut self) -> Result<&mut T, &mut E>

Converts from &mut Result<T, E> to Result<&mut T, &mut E>.

\n
§Examples
\n
fn mutate(r: &mut Result<i32, i32>) {\n    match r.as_mut() {\n        Ok(v) => *v = 42,\n        Err(e) => *e = 0,\n    }\n}\n\nlet mut x: Result<i32, i32> = Ok(2);\nmutate(&mut x);\nassert_eq!(x.unwrap(), 42);\n\nlet mut x: Result<i32, i32> = Err(13);\nmutate(&mut x);\nassert_eq!(x.unwrap_err(), 0);
\n
1.0.0 · Source

pub fn map<U, F>(self, op: F) -> Result<U, E>
where\n F: FnOnce(T) -> U,

Maps a Result<T, E> to Result<U, E> by applying a function to a\ncontained Ok value, leaving an Err value untouched.

\n

This function can be used to compose the results of two functions.

\n
§Examples
\n

Print the numbers on each line of a string multiplied by two.

\n\n
let line = \"1\\n2\\n3\\n4\\n\";\n\nfor num in line.lines() {\n    match num.parse::<i32>().map(|i| i * 2) {\n        Ok(n) => println!(\"{n}\"),\n        Err(..) => {}\n    }\n}
\n
1.41.0 · Source

pub fn map_or<U, F>(self, default: U, f: F) -> U
where\n F: FnOnce(T) -> U,

Returns the provided default (if Err), or\napplies a function to the contained value (if Ok).

\n

Arguments passed to map_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use map_or_else,\nwhich is lazily evaluated.

\n
§Examples
\n
let x: Result<_, &str> = Ok(\"foo\");\nassert_eq!(x.map_or(42, |v| v.len()), 3);\n\nlet x: Result<&str, _> = Err(\"bar\");\nassert_eq!(x.map_or(42, |v| v.len()), 42);
\n
1.41.0 · Source

pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U
where\n D: FnOnce(E) -> U,\n F: FnOnce(T) -> U,

Maps a Result<T, E> to U by applying fallback function default to\na contained Err value, or function f to a contained Ok value.

\n

This function can be used to unpack a successful result\nwhile handling an error.

\n
§Examples
\n
let k = 21;\n\nlet x : Result<_, &str> = Ok(\"foo\");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);\n\nlet x : Result<&str, _> = Err(\"bar\");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
\n
Source

pub fn map_or_default<U, F>(self, f: F) -> U
where\n U: Default,\n F: FnOnce(T) -> U,

🔬This is a nightly-only experimental API. (result_option_map_or_default)

Maps a Result<T, E> to a U by applying function f to the contained\nvalue if the result is Ok, otherwise if Err, returns the\ndefault value for the type U.

\n
§Examples
\n
#![feature(result_option_map_or_default)]\n\nlet x: Result<_, &str> = Ok(\"foo\");\nlet y: Result<&str, _> = Err(\"bar\");\n\nassert_eq!(x.map_or_default(|x| x.len()), 3);\nassert_eq!(y.map_or_default(|y| y.len()), 0);
\n
1.0.0 · Source

pub fn map_err<F, O>(self, op: O) -> Result<T, F>
where\n O: FnOnce(E) -> F,

Maps a Result<T, E> to Result<T, F> by applying a function to a\ncontained Err value, leaving an Ok value untouched.

\n

This function can be used to pass through a successful result while handling\nan error.

\n
§Examples
\n
fn stringify(x: u32) -> String { format!(\"error code: {x}\") }\n\nlet x: Result<u32, u32> = Ok(2);\nassert_eq!(x.map_err(stringify), Ok(2));\n\nlet x: Result<u32, u32> = Err(13);\nassert_eq!(x.map_err(stringify), Err(\"error code: 13\".to_string()));
\n
1.76.0 · Source

pub fn inspect<F>(self, f: F) -> Result<T, E>
where\n F: FnOnce(&T),

Calls a function with a reference to the contained value if Ok.

\n

Returns the original result.

\n
§Examples
\n
let x: u8 = \"4\"\n    .parse::<u8>()\n    .inspect(|x| println!(\"original: {x}\"))\n    .map(|x| x.pow(3))\n    .expect(\"failed to parse number\");
\n
1.76.0 · Source

pub fn inspect_err<F>(self, f: F) -> Result<T, E>
where\n F: FnOnce(&E),

Calls a function with a reference to the contained value if Err.

\n

Returns the original result.

\n
§Examples
\n
use std::{fs, io};\n\nfn read() -> io::Result<String> {\n    fs::read_to_string(\"address.txt\")\n        .inspect_err(|e| eprintln!(\"failed to read file: {e}\"))\n}
\n
1.47.0 · Source

pub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E>
where\n T: Deref,

Converts from Result<T, E> (or &Result<T, E>) to Result<&<T as Deref>::Target, &E>.

\n

Coerces the Ok variant of the original Result via Deref\nand returns the new Result.

\n
§Examples
\n
let x: Result<String, u32> = Ok(\"hello\".to_string());\nlet y: Result<&str, &u32> = Ok(\"hello\");\nassert_eq!(x.as_deref(), y);\n\nlet x: Result<String, u32> = Err(42);\nlet y: Result<&str, &u32> = Err(&42);\nassert_eq!(x.as_deref(), y);
\n
1.47.0 · Source

pub fn as_deref_mut(&mut self) -> Result<&mut <T as Deref>::Target, &mut E>
where\n T: DerefMut,

Converts from Result<T, E> (or &mut Result<T, E>) to Result<&mut <T as DerefMut>::Target, &mut E>.

\n

Coerces the Ok variant of the original Result via DerefMut\nand returns the new Result.

\n
§Examples
\n
let mut s = \"HELLO\".to_string();\nlet mut x: Result<String, u32> = Ok(\"hello\".to_string());\nlet y: Result<&mut str, &mut u32> = Ok(&mut s);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);\n\nlet mut i = 42;\nlet mut x: Result<String, u32> = Err(42);\nlet y: Result<&mut str, &mut u32> = Err(&mut i);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
\n
1.0.0 · Source

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(7);\nassert_eq!(x.iter().next(), Some(&7));\n\nlet x: Result<u32, &str> = Err(\"nothing!\");\nassert_eq!(x.iter().next(), None);
\n
1.0.0 · Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns a mutable iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
§Examples
\n
let mut x: Result<u32, &str> = Ok(7);\nmatch x.iter_mut().next() {\n    Some(v) => *v = 40,\n    None => {},\n}\nassert_eq!(x, Ok(40));\n\nlet mut x: Result<u32, &str> = Err(\"nothing!\");\nassert_eq!(x.iter_mut().next(), None);
\n
1.4.0 · Source

pub fn expect(self, msg: &str) -> T
where\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err\ncase explicitly, or call unwrap_or, unwrap_or_else, or\nunwrap_or_default.

\n
§Panics
\n

Panics if the value is an Err, with a panic message including the\npassed message, and the content of the Err.

\n
§Examples
\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nx.expect(\"Testing expect\"); // panics with `Testing expect: emergency failure`
\n
§Recommended Message Style
\n

We recommend that expect messages are used to describe the reason you\nexpect the Result should be Ok.

\n\n
let path = std::env::var(\"IMPORTANT_PATH\")\n    .expect(\"env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`\");
\n

Hint: If you’re having trouble remembering how to phrase expect\nerror messages remember to focus on the word “should” as in “env\nvariable should be set by blah” or “the given binary should be available\nand executable by the current user”.

\n

For more detail on expect message styles and the reasoning behind our recommendation please\nrefer to the section on “Common Message\nStyles” in the\nstd::error module docs.

\n
1.0.0 · Source

pub fn unwrap(self) -> T
where\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nPanics are meant for unrecoverable errors, and\nmay abort the entire program.

\n

Instead, prefer to use the ? (try) operator, or pattern matching\nto handle the Err case explicitly, or call unwrap_or,\nunwrap_or_else, or unwrap_or_default.

\n
§Panics
\n

Panics if the value is an Err, with a panic message provided by the\nErr’s value.

\n
§Examples
\n

Basic usage:

\n\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.unwrap(), 2);
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nx.unwrap(); // panics with `emergency failure`
\n
1.16.0 · Source

pub fn unwrap_or_default(self) -> T
where\n T: Default,

Returns the contained Ok value or a default

\n

Consumes the self argument then, if Ok, returns the contained\nvalue, otherwise if Err, returns the default value for that\ntype.

\n
§Examples
\n

Converts a string to an integer, turning poorly-formed strings\ninto 0 (the default value for integers). parse converts\na string to any other type that implements FromStr, returning an\nErr on error.

\n\n
let good_year_from_input = \"1909\";\nlet bad_year_from_input = \"190blarg\";\nlet good_year = good_year_from_input.parse().unwrap_or_default();\nlet bad_year = bad_year_from_input.parse().unwrap_or_default();\n\nassert_eq!(1909, good_year);\nassert_eq!(0, bad_year);
\n
1.17.0 · Source

pub fn expect_err(self, msg: &str) -> E
where\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
§Panics
\n

Panics if the value is an Ok, with a panic message including the\npassed message, and the content of the Ok.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(10);\nx.expect_err(\"Testing expect_err\"); // panics with `Testing expect_err: 10`
\n
1.0.0 · Source

pub fn unwrap_err(self) -> E
where\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
§Panics
\n

Panics if the value is an Ok, with a custom panic message provided\nby the Ok’s value.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nx.unwrap_err(); // panics with `2`
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nassert_eq!(x.unwrap_err(), \"emergency failure\");
\n
Source

pub const fn into_ok(self) -> T
where\n E: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Ok value, but never panics.

\n

Unlike unwrap, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap as a maintainability safeguard that will fail\nto compile if the error type of the Result is later changed\nto an error that can actually occur.

\n
§Examples
\n
\nfn only_good_news() -> Result<String, !> {\n    Ok(\"this is fine\".into())\n}\n\nlet s: String = only_good_news().into_ok();\nprintln!(\"{s}\");
\n
Source

pub const fn into_err(self) -> E
where\n T: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Err value, but never panics.

\n

Unlike unwrap_err, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap_err as a maintainability safeguard that will fail\nto compile if the ok type of the Result is later changed\nto a type that can actually occur.

\n
§Examples
\n
\nfn only_bad_news() -> Result<!, String> {\n    Err(\"Oops, it failed\".into())\n}\n\nlet error: String = only_bad_news().into_err();\nprintln!(\"{error}\");
\n
1.0.0 · Source

pub fn and<U>(self, res: Result<U, E>) -> Result<U, E>

Returns res if the result is Ok, otherwise returns the Err value of self.

\n

Arguments passed to and are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use and_then, which is\nlazily evaluated.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Err(\"late error\");\nassert_eq!(x.and(y), Err(\"late error\"));\n\nlet x: Result<u32, &str> = Err(\"early error\");\nlet y: Result<&str, &str> = Ok(\"foo\");\nassert_eq!(x.and(y), Err(\"early error\"));\n\nlet x: Result<u32, &str> = Err(\"not a 2\");\nlet y: Result<&str, &str> = Err(\"late error\");\nassert_eq!(x.and(y), Err(\"not a 2\"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Ok(\"different result type\");\nassert_eq!(x.and(y), Ok(\"different result type\"));
\n
1.0.0 · Source

pub fn and_then<U, F>(self, op: F) -> Result<U, E>
where\n F: FnOnce(T) -> Result<U, E>,

Calls op if the result is Ok, otherwise returns the Err value of self.

\n

This function can be used for control flow based on Result values.

\n
§Examples
\n
fn sq_then_to_string(x: u32) -> Result<String, &'static str> {\n    x.checked_mul(x).map(|sq| sq.to_string()).ok_or(\"overflowed\")\n}\n\nassert_eq!(Ok(2).and_then(sq_then_to_string), Ok(4.to_string()));\nassert_eq!(Ok(1_000_000).and_then(sq_then_to_string), Err(\"overflowed\"));\nassert_eq!(Err(\"not a number\").and_then(sq_then_to_string), Err(\"not a number\"));
\n

Often used to chain fallible operations that may return Err.

\n\n
use std::{io::ErrorKind, path::Path};\n\n// Note: on Windows \"/\" maps to \"C:\\\"\nlet root_modified_time = Path::new(\"/\").metadata().and_then(|md| md.modified());\nassert!(root_modified_time.is_ok());\n\nlet should_fail = Path::new(\"/bad/path\").metadata().and_then(|md| md.modified());\nassert!(should_fail.is_err());\nassert_eq!(should_fail.unwrap_err().kind(), ErrorKind::NotFound);
\n
1.0.0 · Source

pub fn or<F>(self, res: Result<T, F>) -> Result<T, F>

Returns res if the result is Err, otherwise returns the Ok value of self.

\n

Arguments passed to or are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use or_else, which is\nlazily evaluated.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Err(\"late error\");\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err(\"early error\");\nlet y: Result<u32, &str> = Ok(2);\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err(\"not a 2\");\nlet y: Result<u32, &str> = Err(\"late error\");\nassert_eq!(x.or(y), Err(\"late error\"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Ok(100);\nassert_eq!(x.or(y), Ok(2));
\n
1.0.0 · Source

pub fn or_else<F, O>(self, op: O) -> Result<T, F>
where\n O: FnOnce(E) -> Result<T, F>,

Calls op if the result is Err, otherwise returns the Ok value of self.

\n

This function can be used for control flow based on result values.

\n
§Examples
\n
fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }\nfn err(x: u32) -> Result<u32, u32> { Err(x) }\n\nassert_eq!(Ok(2).or_else(sq).or_else(sq), Ok(2));\nassert_eq!(Ok(2).or_else(err).or_else(sq), Ok(2));\nassert_eq!(Err(3).or_else(sq).or_else(err), Ok(9));\nassert_eq!(Err(3).or_else(err).or_else(err), Err(3));
\n
1.0.0 · Source

pub fn unwrap_or(self, default: T) -> T

Returns the contained Ok value or a provided default.

\n

Arguments passed to unwrap_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use unwrap_or_else,\nwhich is lazily evaluated.

\n
§Examples
\n
let default = 2;\nlet x: Result<u32, &str> = Ok(9);\nassert_eq!(x.unwrap_or(default), 9);\n\nlet x: Result<u32, &str> = Err(\"error\");\nassert_eq!(x.unwrap_or(default), default);
\n
1.0.0 · Source

pub fn unwrap_or_else<F>(self, op: F) -> T
where\n F: FnOnce(E) -> T,

Returns the contained Ok value or computes it from a closure.

\n
§Examples
\n
fn count(x: &str) -> usize { x.len() }\n\nassert_eq!(Ok(2).unwrap_or_else(count), 2);\nassert_eq!(Err(\"foo\").unwrap_or_else(count), 3);
\n
1.58.0 · Source

pub unsafe fn unwrap_unchecked(self) -> T

Returns the contained Ok value, consuming the self value,\nwithout checking that the value is not an Err.

\n
§Safety
\n

Calling this method on an Err is undefined behavior.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(unsafe { x.unwrap_unchecked() }, 2);
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nunsafe { x.unwrap_unchecked(); } // Undefined behavior!
\n
1.58.0 · Source

pub unsafe fn unwrap_err_unchecked(self) -> E

Returns the contained Err value, consuming the self value,\nwithout checking that the value is not an Ok.

\n
§Safety
\n

Calling this method on an Ok is undefined behavior.

\n
§Examples
\n
let x: Result<u32, &str> = Ok(2);\nunsafe { x.unwrap_err_unchecked() }; // Undefined behavior!
\n\n
let x: Result<u32, &str> = Err(\"emergency failure\");\nassert_eq!(unsafe { x.unwrap_err_unchecked() }, \"emergency failure\");
\n
",0,"fe_parser::parser::ParseResult"],["
Source§

impl<T, E> Serialize for Result<T, E>
where\n T: Serialize,\n E: Serialize,

Source§

fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where\n S: Serializer,

Serialize this value into the given Serde serializer. Read more
","Serialize","fe_parser::parser::ParseResult"],["
1.16.0 · Source§

impl<T, U, E> Sum<Result<U, E>> for Result<T, E>
where\n T: Sum<U>,

Source§

fn sum<I>(iter: I) -> Result<T, E>
where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the sum of all elements is returned.

\n
§Examples
\n

This sums up every integer in a vector, rejecting the sum if a negative\nelement is encountered:

\n\n
let f = |&x: &i32| if x < 0 { Err(\"Negative element found\") } else { Ok(x) };\nlet v = vec![1, 2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Ok(3));\nlet v = vec![1, -2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Err(\"Negative element found\"));
\n
","Sum>","fe_parser::parser::ParseResult"],["
1.61.0 · Source§

impl<T, E> Termination for Result<T, E>
where\n T: Termination,\n E: Debug,

Source§

fn report(self) -> ExitCode

Is called to get the representation of the value as status code.\nThis status code is returned to the operating system.
","Termination","fe_parser::parser::ParseResult"],["
Source§

impl<T, E> Try for Result<T, E>

Source§

type Output = T

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
Source§

type Residual = Result<Infallible, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value passed to FromResidual::from_residual\nas part of ? when short-circuiting. Read more
Source§

fn from_output(output: <Result<T, E> as Try>::Output) -> Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from its Output type. Read more
Source§

fn branch(\n self,\n) -> ControlFlow<<Result<T, E> as Try>::Residual, <Result<T, E> as Try>::Output>

🔬This is a nightly-only experimental API. (try_trait_v2)
Used in ? to decide whether the operator should produce a value\n(because this returned ControlFlow::Continue)\nor propagate a value back to the caller\n(because this returned ControlFlow::Break). Read more
","Try","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<T, E> Copy for Result<T, E>
where\n T: Copy,\n E: Copy,

","Copy","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<T, E> Eq for Result<T, E>
where\n T: Eq,\n E: Eq,

","Eq","fe_parser::parser::ParseResult"],["
1.0.0 · Source§

impl<T, E> StructuralPartialEq for Result<T, E>

","StructuralPartialEq","fe_parser::parser::ParseResult"],["
Source§

impl<T, E> UseCloned for Result<T, E>
where\n T: UseCloned,\n E: UseCloned,

","UseCloned","fe_parser::parser::ParseResult"]]]]); + if (window.register_type_impls) { + window.register_type_impls(type_impls); + } else { + window.pending_type_impls = type_impls; + } +})() +//{"start":55,"fragment_lengths":[169651]} \ No newline at end of file diff --git a/compiler-docs/type.impl/evm/backend/memory/struct.MemoryBackend.js b/compiler-docs/type.impl/evm/backend/memory/struct.MemoryBackend.js new file mode 100644 index 0000000000..2a9ee96c83 --- /dev/null +++ b/compiler-docs/type.impl/evm/backend/memory/struct.MemoryBackend.js @@ -0,0 +1,9 @@ +(function() { + var type_impls = Object.fromEntries([["fe_compiler_test_utils",[["
§

impl<'vicinity> ApplyBackend for MemoryBackend<'vicinity>

§

fn apply<A, I, L>(&mut self, values: A, logs: L, delete_empty: bool)
where\n A: IntoIterator<Item = Apply<I>>,\n I: IntoIterator<Item = (H256, H256)>,\n L: IntoIterator<Item = Log>,

Apply given values and logs at backend.
","ApplyBackend","fe_compiler_test_utils::Backend"],["
§

impl<'vicinity> Backend for MemoryBackend<'vicinity>

§

fn gas_price(&self) -> U256

Gas price. Unused for London.
§

fn origin(&self) -> H160

Origin.
§

fn block_hash(&self, number: U256) -> H256

Environmental block hash.
§

fn block_number(&self) -> U256

Environmental block number.
§

fn block_coinbase(&self) -> H160

Environmental coinbase.
§

fn block_timestamp(&self) -> U256

Environmental block timestamp.
§

fn block_difficulty(&self) -> U256

Environmental block difficulty.
§

fn block_gas_limit(&self) -> U256

Environmental block gas limit.
§

fn block_base_fee_per_gas(&self) -> U256

Environmental block base fee.
§

fn chain_id(&self) -> U256

Environmental chain ID.
§

fn exists(&self, address: H160) -> bool

Whether account at address exists.
§

fn basic(&self, address: H160) -> Basic

Get basic account information.
§

fn code(&self, address: H160) -> Vec<u8>

Get account code.
§

fn storage(&self, address: H160, index: H256) -> H256

Get storage value of address at index.
§

fn original_storage(&self, address: H160, index: H256) -> Option<H256>

Get original storage value of address at index, if available.
","Backend","fe_compiler_test_utils::Backend"],["
§

impl<'vicinity> Clone for MemoryBackend<'vicinity>

§

fn clone(&self) -> MemoryBackend<'vicinity>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
","Clone","fe_compiler_test_utils::Backend"],["
§

impl<'vicinity> Debug for MemoryBackend<'vicinity>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","fe_compiler_test_utils::Backend"],["
§

impl<'vicinity> MemoryBackend<'vicinity>

pub fn new(\n vicinity: &'vicinity MemoryVicinity,\n state: BTreeMap<H160, MemoryAccount>,\n) -> MemoryBackend<'vicinity>

Create a new memory backend.

\n

pub fn state(&self) -> &BTreeMap<H160, MemoryAccount>

Get the underlying BTreeMap storing the state.

\n

pub fn state_mut(&mut self) -> &mut BTreeMap<H160, MemoryAccount>

Get a mutable reference to the underlying BTreeMap storing the state.

\n
",0,"fe_compiler_test_utils::Backend"]]]]); + if (window.register_type_impls) { + window.register_type_impls(type_impls); + } else { + window.pending_type_impls = type_impls; + } +})() +//{"start":55,"fragment_lengths":[13399]} \ No newline at end of file diff --git a/compiler-docs/type.impl/evm/executor/stack/executor/struct.StackExecutor.js b/compiler-docs/type.impl/evm/executor/stack/executor/struct.StackExecutor.js new file mode 100644 index 0000000000..617b65c448 --- /dev/null +++ b/compiler-docs/type.impl/evm/executor/stack/executor/struct.StackExecutor.js @@ -0,0 +1,9 @@ +(function() { + var type_impls = Object.fromEntries([["fe_compiler_test_utils",[["
§

impl<'config, 'precompiles, S, P> Handler for StackExecutor<'config, 'precompiles, S, P>
where\n S: StackState<'config>,\n P: PrecompileSet,

§

type CreateInterrupt = Infallible

Type of CREATE interrupt.
§

type CreateFeedback = Infallible

Feedback value for CREATE interrupt.
§

type CallInterrupt = Infallible

Type of CALL interrupt.
§

type CallFeedback = Infallible

Feedback value of CALL interrupt.
§

fn balance(&self, address: H160) -> U256

Get balance of address.
§

fn code_size(&self, address: H160) -> U256

Get code size of address.
§

fn code_hash(&self, address: H160) -> H256

Get code hash of address.
§

fn code(&self, address: H160) -> Vec<u8>

Get code of address.
§

fn storage(&self, address: H160, index: H256) -> H256

Get storage value of address at index.
§

fn original_storage(&self, address: H160, index: H256) -> H256

Get original storage value of address at index.
§

fn exists(&self, address: H160) -> bool

Check whether an address exists.
§

fn is_cold(&self, address: H160, maybe_index: Option<H256>) -> bool

Checks if the address or (address, index) pair has been previously accessed\n(or set in accessed_addresses / accessed_storage_keys via an access list\ntransaction).\nReferences: Read more
§

fn gas_left(&self) -> U256

Get the gas left value.
§

fn gas_price(&self) -> U256

Get the gas price value.
§

fn origin(&self) -> H160

Get execution origin.
§

fn block_hash(&self, number: U256) -> H256

Get environmental block hash.
§

fn block_number(&self) -> U256

Get environmental block number.
§

fn block_coinbase(&self) -> H160

Get environmental coinbase.
§

fn block_timestamp(&self) -> U256

Get environmental block timestamp.
§

fn block_difficulty(&self) -> U256

Get environmental block difficulty.
§

fn block_gas_limit(&self) -> U256

Get environmental gas limit.
§

fn block_base_fee_per_gas(&self) -> U256

Environmental block base fee.
§

fn chain_id(&self) -> U256

Get environmental chain ID.
§

fn deleted(&self, address: H160) -> bool

Check whether an address has already been deleted.
§

fn set_storage(\n &mut self,\n address: H160,\n index: H256,\n value: H256,\n) -> Result<(), ExitError>

Set storage value of address at index.
§

fn log(\n &mut self,\n address: H160,\n topics: Vec<H256>,\n data: Vec<u8>,\n) -> Result<(), ExitError>

Create a log owned by address with given topics and data.
§

fn mark_delete(&mut self, address: H160, target: H160) -> Result<(), ExitError>

Mark an address to be deleted, with funds transferred to target.
§

fn create(\n &mut self,\n caller: H160,\n scheme: CreateScheme,\n value: U256,\n init_code: Vec<u8>,\n target_gas: Option<u64>,\n) -> Capture<(ExitReason, Option<H160>, Vec<u8>), <StackExecutor<'config, 'precompiles, S, P> as Handler>::CreateInterrupt>

Invoke a create operation.
§

fn call(\n &mut self,\n code_address: H160,\n transfer: Option<Transfer>,\n input: Vec<u8>,\n target_gas: Option<u64>,\n is_static: bool,\n context: Context,\n) -> Capture<(ExitReason, Vec<u8>), <StackExecutor<'config, 'precompiles, S, P> as Handler>::CallInterrupt>

Invoke a call operation.
§

fn pre_validate(\n &mut self,\n context: &Context,\n opcode: Opcode,\n stack: &Stack,\n) -> Result<(), ExitError>

Pre-validation step for the runtime.
§

fn create_feedback(\n &mut self,\n _feedback: Self::CreateFeedback,\n) -> Result<(), ExitError>

Feed in create feedback.
§

fn call_feedback(\n &mut self,\n _feedback: Self::CallFeedback,\n) -> Result<(), ExitError>

Feed in call feedback.
§

fn other(\n &mut self,\n opcode: Opcode,\n _stack: &mut Machine,\n) -> Result<(), ExitError>

Handle other unknown external opcodes.
","Handler","fe_compiler_test_utils::Executor"],["
§

impl<'config, 'precompiles, S, P> StackExecutor<'config, 'precompiles, S, P>
where\n S: StackState<'config>,\n P: PrecompileSet,

pub fn config(&self) -> &'config Config

Return a reference of the Config.

\n

pub fn precompiles(&self) -> &'precompiles P

Return a reference to the precompile set.

\n

pub fn new_with_precompiles(\n state: S,\n config: &'config Config,\n precompile_set: &'precompiles P,\n) -> StackExecutor<'config, 'precompiles, S, P>

Create a new stack-based executor with given precompiles.

\n

pub fn state(&self) -> &S

pub fn state_mut(&mut self) -> &mut S

pub fn into_state(self) -> S

pub fn enter_substate(&mut self, gas_limit: u64, is_static: bool)

Create a substate executor from the current executor.

\n

pub fn exit_substate(&mut self, kind: StackExitKind) -> Result<(), ExitError>

Exit a substate. Panic if it results an empty substate stack.

\n

pub fn execute(&mut self, runtime: &mut Runtime<'_>) -> ExitReason

Execute the runtime until it returns.

\n

pub fn gas(&self) -> u64

Get remaining gas.

\n

pub fn transact_create(\n &mut self,\n caller: H160,\n value: U256,\n init_code: Vec<u8>,\n gas_limit: u64,\n access_list: Vec<(H160, Vec<H256>)>,\n) -> (ExitReason, Vec<u8>)

Execute a CREATE transaction.

\n

pub fn transact_create2(\n &mut self,\n caller: H160,\n value: U256,\n init_code: Vec<u8>,\n salt: H256,\n gas_limit: u64,\n access_list: Vec<(H160, Vec<H256>)>,\n) -> (ExitReason, Vec<u8>)

Execute a CREATE2 transaction.

\n

pub fn transact_call(\n &mut self,\n caller: H160,\n address: H160,\n value: U256,\n data: Vec<u8>,\n gas_limit: u64,\n access_list: Vec<(H160, Vec<H256>)>,\n) -> (ExitReason, Vec<u8>)

Execute a CALL transaction with a given caller, address, value and\ngas limit and data.

\n

Takes in an additional access_list parameter for EIP-2930 which was\nintroduced in the Ethereum Berlin hard fork. If you do not wish to use\nthis functionality, just pass in an empty vector.

\n

pub fn used_gas(&self) -> u64

Get used gas for the current executor, given the price.

\n

pub fn fee(&self, price: U256) -> U256

Get fee needed for the current executor, given the price.

\n

pub fn nonce(&self, address: H160) -> U256

Get account nonce.

\n

pub fn create_address(&self, scheme: CreateScheme) -> H160

Get the create address from given scheme.

\n

pub fn initialize_with_access_list(\n &mut self,\n access_list: Vec<(H160, Vec<H256>)>,\n)

",0,"fe_compiler_test_utils::Executor"]]]]); + if (window.register_type_impls) { + window.register_type_impls(type_impls); + } else { + window.pending_type_impls = type_impls; + } +})() +//{"start":55,"fragment_lengths":[28839]} \ No newline at end of file diff --git a/compiler-docs/type.impl/evm/executor/stack/memory/struct.MemoryStackState.js b/compiler-docs/type.impl/evm/executor/stack/memory/struct.MemoryStackState.js new file mode 100644 index 0000000000..3055e552dc --- /dev/null +++ b/compiler-docs/type.impl/evm/executor/stack/memory/struct.MemoryStackState.js @@ -0,0 +1,9 @@ +(function() { + var type_impls = Object.fromEntries([["fe_compiler_test_utils",[["
§

impl<'backend, 'config, B> Backend for MemoryStackState<'backend, 'config, B>
where\n B: Backend,

§

fn gas_price(&self) -> U256

Gas price. Unused for London.
§

fn origin(&self) -> H160

Origin.
§

fn block_hash(&self, number: U256) -> H256

Environmental block hash.
§

fn block_number(&self) -> U256

Environmental block number.
§

fn block_coinbase(&self) -> H160

Environmental coinbase.
§

fn block_timestamp(&self) -> U256

Environmental block timestamp.
§

fn block_difficulty(&self) -> U256

Environmental block difficulty.
§

fn block_gas_limit(&self) -> U256

Environmental block gas limit.
§

fn block_base_fee_per_gas(&self) -> U256

Environmental block base fee.
§

fn chain_id(&self) -> U256

Environmental chain ID.
§

fn exists(&self, address: H160) -> bool

Whether account at address exists.
§

fn basic(&self, address: H160) -> Basic

Get basic account information.
§

fn code(&self, address: H160) -> Vec<u8>

Get account code.
§

fn storage(&self, address: H160, key: H256) -> H256

Get storage value of address at index.
§

fn original_storage(&self, address: H160, key: H256) -> Option<H256>

Get original storage value of address at index, if available.
","Backend","fe_compiler_test_utils::StackState"],["
§

impl<'backend, 'config, B> Clone for MemoryStackState<'backend, 'config, B>
where\n B: Clone,

§

fn clone(&self) -> MemoryStackState<'backend, 'config, B>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
","Clone","fe_compiler_test_utils::StackState"],["
§

impl<'backend, 'config, B> Debug for MemoryStackState<'backend, 'config, B>
where\n B: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","fe_compiler_test_utils::StackState"],["
§

impl<'backend, 'config, B> MemoryStackState<'backend, 'config, B>
where\n B: Backend,

pub fn new(\n metadata: StackSubstateMetadata<'config>,\n backend: &'backend B,\n) -> MemoryStackState<'backend, 'config, B>

pub fn account_mut(&mut self, address: H160) -> &mut MemoryStackAccount

Returns a mutable reference to an account given its address

\n

pub fn deconstruct(\n self,\n) -> (impl IntoIterator<Item = Apply<impl IntoIterator<Item = (H256, H256)>>>, impl IntoIterator<Item = Log>)

pub fn withdraw(&mut self, address: H160, value: U256) -> Result<(), ExitError>

pub fn deposit(&mut self, address: H160, value: U256)

",0,"fe_compiler_test_utils::StackState"],["
§

impl<'backend, 'config, B> StackState<'config> for MemoryStackState<'backend, 'config, B>
where\n B: Backend,

§

fn metadata(&self) -> &StackSubstateMetadata<'config>

§

fn metadata_mut(&mut self) -> &mut StackSubstateMetadata<'config>

§

fn enter(&mut self, gas_limit: u64, is_static: bool)

§

fn exit_commit(&mut self) -> Result<(), ExitError>

§

fn exit_revert(&mut self) -> Result<(), ExitError>

§

fn exit_discard(&mut self) -> Result<(), ExitError>

§

fn is_empty(&self, address: H160) -> bool

§

fn deleted(&self, address: H160) -> bool

§

fn is_cold(&self, address: H160) -> bool

§

fn is_storage_cold(&self, address: H160, key: H256) -> bool

§

fn inc_nonce(&mut self, address: H160)

§

fn set_storage(&mut self, address: H160, key: H256, value: H256)

§

fn reset_storage(&mut self, address: H160)

§

fn log(&mut self, address: H160, topics: Vec<H256>, data: Vec<u8>)

§

fn set_deleted(&mut self, address: H160)

§

fn set_code(&mut self, address: H160, code: Vec<u8>)

§

fn transfer(&mut self, transfer: Transfer) -> Result<(), ExitError>

§

fn reset_balance(&mut self, address: H160)

§

fn touch(&mut self, address: H160)

","StackState<'config>","fe_compiler_test_utils::StackState"]]]]); + if (window.register_type_impls) { + window.register_type_impls(type_impls); + } else { + window.pending_type_impls = type_impls; + } +})() +//{"start":55,"fragment_lengths":[19968]} \ No newline at end of file diff --git a/compiler-docs/type.impl/fe_mir/ir/inst/enum.IterBase.js b/compiler-docs/type.impl/fe_mir/ir/inst/enum.IterBase.js new file mode 100644 index 0000000000..3bf04605e4 --- /dev/null +++ b/compiler-docs/type.impl/fe_mir/ir/inst/enum.IterBase.js @@ -0,0 +1,9 @@ +(function() { + var type_impls = Object.fromEntries([["fe_mir",[["
Source§

impl<'a, T> Iterator for IterBase<'a, T>
where\n T: Copy,

Source§

type Item = T

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
Source§

fn next_chunk<const N: usize>(\n &mut self,\n) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · Source§

fn count(self) -> usize
where\n Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where\n Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · Source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where\n Self: Sized,

Creates an iterator starting at the same point, but stepping by\nthe given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where\n Self: Sized,\n U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where\n Self: Sized,\n U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where\n Self: Sized,\n Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent\nitems of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where\n Self: Sized,\n G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator\nbetween adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where\n Self: Sized,\n F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each\nelement. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where\n Self: Sized,\n F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element\nshould be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where\n Self: Sized,

Creates an iterator which gives the current iteration count as well as\nthe next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where\n Self: Sized,

Creates an iterator which can use the peek and peek_mut methods\nto look at the next element of the iterator without consuming it. See\ntheir documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where\n Self: Sized,\n P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where\n Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where\n Self: Sized,

Creates an iterator that yields the first n elements, or fewer\nif the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where\n Self: Sized,\n F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but\nunlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where\n Self: Sized,\n U: IntoIterator,\n F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.29.0 · Source§

fn flatten(self) -> Flatten<Self>
where\n Self: Sized,\n Self::Item: IntoIterator,

Creates an iterator that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where\n Self: Sized,\n F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over\nself and returns an iterator over the outputs of f. Like slice::windows(),\nthe windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where\n Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where\n Self: Sized,\n F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where\n Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where\n B: FromIterator<Self::Item>,\n Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn try_collect<B>(\n &mut self,\n) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
where\n Self: Sized,\n Self::Item: Try,\n <Self::Item as Try>::Residual: Residual<B>,\n B: FromIterator<<Self::Item as Try>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect)
Fallibly transforms an iterator into a collection, short circuiting if\na failure is encountered. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where\n E: Extend<Self::Item>,\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where\n Self: Sized,\n B: Default + Extend<Self::Item>,\n F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate,\nsuch that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> R,\n R: Try<Output = B>,

An iterator method that applies a function as long as it returns\nsuccessfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where\n Self: Sized,\n F: FnMut(Self::Item) -> R,\n R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the\niterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation,\nreturning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing\noperation. Read more
Source§

fn try_reduce<R>(\n &mut self,\n f: impl FnMut(Self::Item, Self::Item) -> R,\n) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where\n Self: Sized,\n R: Try<Output = Self::Item>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the\nclosure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns\nthe first non-none result. Read more
Source§

fn try_find<R>(\n &mut self,\n f: impl FnMut(&Self::Item) -> R,\n) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where\n Self: Sized,\n R: Try<Output = bool>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns\nthe first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where\n Self: Sized,\n Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where\n Self: Sized,\n Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the\nspecified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the\nspecified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the\nspecified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the\nspecified comparison function. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where\n FromA: Default + Extend<A>,\n FromB: Default + Extend<B>,\n Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where\n T: Copy + 'a,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where\n T: Clone + 'a,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where\n Self: Sized,\n S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where\n Self: Sized,\n P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where\n I: IntoIterator<Item = Self::Item>,\n Self::Item: Ord,\n Self: Sized,

Lexicographically compares the elements of this Iterator with those\nof another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Lexicographically compares the PartialOrd elements of\nthis Iterator with those of another. The comparison works like short-circuit\nevaluation, returning a result without comparing the remaining elements.\nAs soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are equal to those of\nanother. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of\nanother with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are not equal to those of\nanother. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where\n Self: Sized,\n Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> K,\n K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction\nfunction. Read more
","Iterator","fe_mir::ir::inst::BlockIter","fe_mir::ir::inst::ValueIter"]]]]); + if (window.register_type_impls) { + window.register_type_impls(type_impls); + } else { + window.pending_type_impls = type_impls; + } +})() +//{"start":55,"fragment_lengths":[136579]} \ No newline at end of file diff --git a/compiler-docs/type.impl/fe_mir/ir/inst/enum.IterMutBase.js b/compiler-docs/type.impl/fe_mir/ir/inst/enum.IterMutBase.js new file mode 100644 index 0000000000..0db44dc298 --- /dev/null +++ b/compiler-docs/type.impl/fe_mir/ir/inst/enum.IterMutBase.js @@ -0,0 +1,9 @@ +(function() { + var type_impls = Object.fromEntries([["fe_mir",[["
Source§

impl<'a, T> Iterator for IterMutBase<'a, T>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
Source§

fn next_chunk<const N: usize>(\n &mut self,\n) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · Source§

fn count(self) -> usize
where\n Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where\n Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · Source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where\n Self: Sized,

Creates an iterator starting at the same point, but stepping by\nthe given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where\n Self: Sized,\n U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where\n Self: Sized,\n U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where\n Self: Sized,\n Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent\nitems of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where\n Self: Sized,\n G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator\nbetween adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where\n Self: Sized,\n F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each\nelement. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where\n Self: Sized,\n F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element\nshould be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where\n Self: Sized,

Creates an iterator which gives the current iteration count as well as\nthe next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where\n Self: Sized,

Creates an iterator which can use the peek and peek_mut methods\nto look at the next element of the iterator without consuming it. See\ntheir documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where\n Self: Sized,\n P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where\n Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where\n Self: Sized,

Creates an iterator that yields the first n elements, or fewer\nif the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where\n Self: Sized,\n F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but\nunlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where\n Self: Sized,\n U: IntoIterator,\n F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.29.0 · Source§

fn flatten(self) -> Flatten<Self>
where\n Self: Sized,\n Self::Item: IntoIterator,

Creates an iterator that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where\n Self: Sized,\n F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over\nself and returns an iterator over the outputs of f. Like slice::windows(),\nthe windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where\n Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where\n Self: Sized,\n F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where\n Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where\n B: FromIterator<Self::Item>,\n Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn try_collect<B>(\n &mut self,\n) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
where\n Self: Sized,\n Self::Item: Try,\n <Self::Item as Try>::Residual: Residual<B>,\n B: FromIterator<<Self::Item as Try>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect)
Fallibly transforms an iterator into a collection, short circuiting if\na failure is encountered. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where\n E: Extend<Self::Item>,\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where\n Self: Sized,\n B: Default + Extend<Self::Item>,\n F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate,\nsuch that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> R,\n R: Try<Output = B>,

An iterator method that applies a function as long as it returns\nsuccessfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where\n Self: Sized,\n F: FnMut(Self::Item) -> R,\n R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the\niterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation,\nreturning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing\noperation. Read more
Source§

fn try_reduce<R>(\n &mut self,\n f: impl FnMut(Self::Item, Self::Item) -> R,\n) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where\n Self: Sized,\n R: Try<Output = Self::Item>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the\nclosure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns\nthe first non-none result. Read more
Source§

fn try_find<R>(\n &mut self,\n f: impl FnMut(&Self::Item) -> R,\n) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where\n Self: Sized,\n R: Try<Output = bool>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns\nthe first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where\n Self: Sized,\n Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where\n Self: Sized,\n Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the\nspecified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the\nspecified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the\nspecified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the\nspecified comparison function. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where\n FromA: Default + Extend<A>,\n FromB: Default + Extend<B>,\n Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where\n T: Copy + 'a,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where\n T: Clone + 'a,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where\n Self: Sized,\n S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where\n Self: Sized,\n P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where\n I: IntoIterator<Item = Self::Item>,\n Self::Item: Ord,\n Self: Sized,

Lexicographically compares the elements of this Iterator with those\nof another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Lexicographically compares the PartialOrd elements of\nthis Iterator with those of another. The comparison works like short-circuit\nevaluation, returning a result without comparing the remaining elements.\nAs soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are equal to those of\nanother. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of\nanother with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are not equal to those of\nanother. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where\n Self: Sized,\n Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> K,\n K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction\nfunction. Read more
","Iterator","fe_mir::ir::inst::ValueIterMut"]]]]); + if (window.register_type_impls) { + window.register_type_impls(type_impls); + } else { + window.pending_type_impls = type_impls; + } +})() +//{"start":55,"fragment_lengths":[136503]} \ No newline at end of file diff --git a/compiler-docs/type.impl/id_arena/struct.Id.js b/compiler-docs/type.impl/id_arena/struct.Id.js new file mode 100644 index 0000000000..34a903bd96 --- /dev/null +++ b/compiler-docs/type.impl/id_arena/struct.Id.js @@ -0,0 +1,9 @@ +(function() { + var type_impls = Object.fromEntries([["fe_mir",[["
§

impl<T> Clone for Id<T>

§

fn clone(&self) -> Id<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
","Clone","fe_mir::analysis::loop_tree::LoopId","fe_mir::ir::basic_block::BasicBlockId","fe_mir::ir::inst::InstId","fe_mir::ir::value::ValueId"],["
§

impl<T> Debug for Id<T>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","fe_mir::analysis::loop_tree::LoopId","fe_mir::ir::basic_block::BasicBlockId","fe_mir::ir::inst::InstId","fe_mir::ir::value::ValueId"],["
§

impl<T> Hash for Id<T>

§

fn hash<H>(&self, h: &mut H)
where\n H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where\n H: Hasher,\n Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
","Hash","fe_mir::analysis::loop_tree::LoopId","fe_mir::ir::basic_block::BasicBlockId","fe_mir::ir::inst::InstId","fe_mir::ir::value::ValueId"],["
§

impl<T> Id<T>

pub fn index(&self) -> usize

Get the index within the arena that this id refers to.

\n
",0,"fe_mir::analysis::loop_tree::LoopId","fe_mir::ir::basic_block::BasicBlockId","fe_mir::ir::inst::InstId","fe_mir::ir::value::ValueId"],["
§

impl<T> Ord for Id<T>

§

fn cmp(&self, rhs: &Id<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where\n Self: Sized,

Restrict a value to a certain interval. Read more
","Ord","fe_mir::analysis::loop_tree::LoopId","fe_mir::ir::basic_block::BasicBlockId","fe_mir::ir::inst::InstId","fe_mir::ir::value::ValueId"],["
§

impl<T> PartialEq for Id<T>

§

fn eq(&self, rhs: &Id<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient,\nand should not be overridden without very good reason.
","PartialEq","fe_mir::analysis::loop_tree::LoopId","fe_mir::ir::basic_block::BasicBlockId","fe_mir::ir::inst::InstId","fe_mir::ir::value::ValueId"],["
§

impl<T> PartialOrd for Id<T>

§

fn partial_cmp(&self, rhs: &Id<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the\n<= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the >\noperator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by\nthe >= operator. Read more
","PartialOrd","fe_mir::analysis::loop_tree::LoopId","fe_mir::ir::basic_block::BasicBlockId","fe_mir::ir::inst::InstId","fe_mir::ir::value::ValueId"],["
§

impl<T> Copy for Id<T>

","Copy","fe_mir::analysis::loop_tree::LoopId","fe_mir::ir::basic_block::BasicBlockId","fe_mir::ir::inst::InstId","fe_mir::ir::value::ValueId"],["
§

impl<T> Eq for Id<T>

","Eq","fe_mir::analysis::loop_tree::LoopId","fe_mir::ir::basic_block::BasicBlockId","fe_mir::ir::inst::InstId","fe_mir::ir::value::ValueId"]]]]); + if (window.register_type_impls) { + window.register_type_impls(type_impls); + } else { + window.pending_type_impls = type_impls; + } +})() +//{"start":55,"fragment_lengths":[19913]} \ No newline at end of file diff --git a/compiler-docs/type.impl/petgraph/graphmap/type.DiGraphMap.js b/compiler-docs/type.impl/petgraph/graphmap/type.DiGraphMap.js new file mode 100644 index 0000000000..52ccb596fe --- /dev/null +++ b/compiler-docs/type.impl/petgraph/graphmap/type.DiGraphMap.js @@ -0,0 +1,9 @@ +(function() { + var type_impls = Object.fromEntries([["fe_analyzer",[]]]); + if (window.register_type_impls) { + window.register_type_impls(type_impls); + } else { + window.pending_type_impls = type_impls; + } +})() +//{"start":55,"fragment_lengths":[18]} \ No newline at end of file diff --git a/crates/bench/Cargo.toml b/crates/bench/Cargo.toml deleted file mode 100644 index 474f8c8f83..0000000000 --- a/crates/bench/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "fe-bench" -version = "26.2.0" -edition.workspace = true - -[dev-dependencies] -criterion = "0.5" -walkdir = "2.4" -tempfile = "3.23" - -[dependencies] -driver.workspace = true -parser.workspace = true -common.workspace = true -hir.workspace = true -semantic-indexing.workspace = true -camino.workspace = true -url.workspace = true -tracing.workspace = true -tempfile = "3.23" - -[[bench]] -name = "analysis" -harness = false - -[[bench]] -name = "scip_regen" -harness = false diff --git a/crates/bench/benches/analysis.rs b/crates/bench/benches/analysis.rs deleted file mode 100644 index bfa4f9704e..0000000000 --- a/crates/bench/benches/analysis.rs +++ /dev/null @@ -1,88 +0,0 @@ -use camino::{Utf8Path, Utf8PathBuf}; -use common::{ - InputDb, - stdlib::{HasBuiltinCore, HasBuiltinStd}, -}; -use criterion::{Criterion, SamplingMode, criterion_group, criterion_main}; -use driver::DriverDataBase; -use url::Url; -use walkdir::WalkDir; - -use parser::{RecoveryMode, parse_source_file}; - -fn diagnostics(c: &mut Criterion) { - let mut g = c.benchmark_group("analysis"); - g.sampling_mode(SamplingMode::Flat); - - g.bench_function("analyze corelib", |b| { - b.iter_with_large_drop(|| { - let db = DriverDataBase::default(); - let core = db.builtin_core(); - db.run_on_ingot(core); - db - }); - }); - - g.bench_function("analyze stdlib", |b| { - b.iter_with_large_drop(|| { - let db = DriverDataBase::default(); - let std_ingot = db.builtin_std(); - db.run_on_ingot(std_ingot); - db - }); - }); - - let files = test_files("../uitest/fixtures/".into()); - - g.bench_function("uitest parsing", |b| { - b.iter(|| { - for (_, content) in &files { - parse_source_file(content, RecoveryMode::Recover); - } - }) - }); - - g.bench_function("uitest diagnostics", |b| { - b.iter_with_large_drop(|| { - let mut db = DriverDataBase::default(); - for (path, content) in &files { - let ingot = db - .workspace() - .touch( - &mut db, - Url::from_file_path(path).unwrap(), - Some(content.clone()), - ) - .containing_ingot(&db) - .expect("standalone ingot should exist"); - let file = ingot.root_file(&db).expect("root file should exist"); - let top_mod = db.top_mod(file); - - db.run_on_top_mod(top_mod); - } - db - }); - }); - - g.finish(); -} - -fn test_files(path: &Utf8Path) -> Vec<(Utf8PathBuf, String)> { - let manifest_dir = env!("CARGO_MANIFEST_DIR"); - - let test_dir = Utf8Path::new(manifest_dir).join(path); - - WalkDir::new(test_dir) - .into_iter() - .filter_map(|e| e.ok()) - .filter(|e| e.path().extension().is_some_and(|ext| ext == "fe")) - .map(|e| { - let path = Utf8PathBuf::from_path_buf(e.into_path()).unwrap(); - let content = std::fs::read_to_string(&path).unwrap(); - (path, content) - }) - .collect() -} - -criterion_group!(benches, diagnostics); -criterion_main!(benches); diff --git a/crates/bench/benches/scip_regen.rs b/crates/bench/benches/scip_regen.rs deleted file mode 100644 index 0ee237bd16..0000000000 --- a/crates/bench/benches/scip_regen.rs +++ /dev/null @@ -1,112 +0,0 @@ -use common::InputDb; -use criterion::{Criterion, SamplingMode, criterion_group, criterion_main}; -use driver::DriverDataBase; -use url::Url; - -const SAMPLE_CODE: &str = r#" -struct Point { - pub x: i32 - pub y: i32 -} - -impl Point { - pub fn new(x: i32, y: i32) -> Point { - Point { x, y } - } - - pub fn distance(self, other: Point) -> i32 { - let dx = self.x - other.x - let dy = self.y - other.y - dx * dx + dy * dy - } - - pub fn translate(self, dx: i32, dy: i32) -> Point { - Point::new(self.x + dx, self.y + dy) - } -} - -pub fn origin() -> Point { - Point::new(0, 0) -} - -pub fn midpoint(a: Point, b: Point) -> Point { - Point::new((a.x + b.x) / 2, (a.y + b.y) / 2) -} -"#; - -const EDITED_CODE: &str = r#" -struct Point { - pub x: i32 - pub y: i32 -} - -impl Point { - pub fn new(x: i32, y: i32) -> Point { - Point { x, y } - } - - pub fn distance(self, other: Point) -> i32 { - let dx = self.x - other.x - let dy = self.y - other.y - dx * dx + dy * dy - } - - pub fn translate(self, dx: i32, dy: i32) -> Point { - Point::new(self.x + dx, self.y + dy) - } - - pub fn scale(self, factor: i32) -> Point { - Point::new(self.x * factor, self.y * factor) - } -} - -pub fn zero() -> Point { - Point::new(0, 0) -} - -pub fn midpoint(a: Point, b: Point) -> Point { - Point::new((a.x + b.x) / 2, (a.y + b.y) / 2) -} -"#; - -fn scip_regen(c: &mut Criterion) { - let mut g = c.benchmark_group("scip_regen"); - g.sampling_mode(SamplingMode::Flat); - g.sample_size(10); - - let temp = tempfile::tempdir().expect("create temp dir"); - let file_path = temp.path().join("main.fe"); - let file_url = Url::from_file_path(&file_path).unwrap(); - let ingot_url = Url::from_directory_path(temp.path()).unwrap(); - - let mut db = DriverDataBase::default(); - db.workspace() - .touch(&mut db, file_url.clone(), Some(SAMPLE_CODE.to_string())); - - // Warm the salsa cache with initial analysis - let ingot = db - .workspace() - .containing_ingot(&db, file_url.clone()) - .expect("ingot"); - db.run_on_ingot(ingot); - - // Warm the SCIP generation cache (first call is cold) - let _ = semantic_indexing::scip_batch::generate_scip(&db, &ingot_url); - - // Benchmark: warm SCIP regen after edit (salsa-cached path) - g.bench_function("warm_edit_scip", |b| { - b.iter(|| { - db.workspace() - .update(&mut db, file_url.clone(), EDITED_CODE.to_string()); - let result = semantic_indexing::scip_batch::generate_scip(&db, &ingot_url); - db.workspace() - .update(&mut db, file_url.clone(), SAMPLE_CODE.to_string()); - result - }); - }); - - g.finish(); -} - -criterion_group!(benches, scip_regen); -criterion_main!(benches); diff --git a/crates/bench/src/main.rs b/crates/bench/src/main.rs deleted file mode 100644 index 933fe4285e..0000000000 --- a/crates/bench/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -use tracing::error; - -fn main() { - error!("run `cargo bench`"); -} diff --git a/crates/codegen/Cargo.toml b/crates/codegen/Cargo.toml deleted file mode 100644 index 4ac3b1bbce..0000000000 --- a/crates/codegen/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "fe-codegen" -version = "26.2.0" -edition.workspace = true - -[dependencies] -driver = { path = "../driver", package = "fe-driver" } -mir = { path = "../mir", package = "fe-mir" } -hir.workspace = true -common.workspace = true -hex = "0.4" -num-bigint.workspace = true -rustc-hash.workspace = true -sonatina-ir.workspace = true -sonatina-triple.workspace = true -sonatina-codegen.workspace = true -sonatina-verifier.workspace = true -smallvec.workspace = true -smallvec1.workspace = true -tracing.workspace = true - -[dev-dependencies] -dir-test.workspace = true -test-utils.workspace = true -url.workspace = true -hir = { workspace = true, features = ["testutils"] } diff --git a/crates/codegen/build.rs b/crates/codegen/build.rs deleted file mode 100644 index e9985927ac..0000000000 --- a/crates/codegen/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("cargo:rerun-if-changed=tests/fixtures"); -} diff --git a/crates/codegen/src/backend.rs b/crates/codegen/src/backend.rs deleted file mode 100644 index 91a5ed6a5a..0000000000 --- a/crates/codegen/src/backend.rs +++ /dev/null @@ -1,164 +0,0 @@ -use std::fmt; - -use driver::DriverDataBase; -use hir::hir_def::TopLevelMod; - -use crate::TargetDataLayout; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum OptLevel { - O0, - O1, - Os, - #[default] - O2, -} - -impl std::str::FromStr for OptLevel { - type Err = String; - - fn from_str(s: &str) -> Result { - match s { - "0" => Ok(OptLevel::O0), - "1" => Ok(OptLevel::O1), - "s" => Ok(OptLevel::Os), - "2" => Ok(OptLevel::O2), - _ => Err(format!( - "unknown optimization level: {s} (expected '0', '1', '2', or 's')" - )), - } - } -} - -impl fmt::Display for OptLevel { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - OptLevel::O0 => write!(f, "0"), - OptLevel::O1 => write!(f, "1"), - OptLevel::Os => write!(f, "s"), - OptLevel::O2 => write!(f, "2"), - } - } -} - -#[derive(Debug, Clone)] -pub enum BackendOutput { - Bytecode(Vec), -} - -impl BackendOutput { - pub fn as_bytecode(&self) -> Option<&[u8]> { - match self { - BackendOutput::Bytecode(bytes) => Some(bytes), - } - } - - pub fn into_bytecode(self) -> Option> { - match self { - BackendOutput::Bytecode(bytes) => Some(bytes), - } - } -} - -#[derive(Debug)] -pub enum BackendError { - RuntimeLower(mir::LowerError), - Sonatina(String), -} - -impl fmt::Display for BackendError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - BackendError::RuntimeLower(err) => write!(f, "{err}"), - BackendError::Sonatina(message) => write!(f, "sonatina error: {message}"), - } - } -} - -impl std::error::Error for BackendError {} - -impl From for BackendError { - fn from(err: mir::LowerError) -> Self { - BackendError::RuntimeLower(err) - } -} - -impl From for BackendError { - fn from(err: crate::sonatina::LowerError) -> Self { - BackendError::Sonatina(err.to_string()) - } -} - -pub trait Backend { - fn name(&self) -> &'static str; - - fn compile( - &self, - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, - layout: TargetDataLayout, - opt_level: OptLevel, - ) -> Result; -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum BackendKind { - #[default] - Sonatina, -} - -impl BackendKind { - pub fn name(&self) -> &'static str { - match self { - BackendKind::Sonatina => "sonatina", - } - } - - pub fn create(&self) -> Box { - match self { - BackendKind::Sonatina => Box::new(SonatinaBackend), - } - } -} - -impl std::str::FromStr for BackendKind { - type Err = String; - - fn from_str(s: &str) -> Result { - match s.to_lowercase().as_str() { - "sonatina" => Ok(BackendKind::Sonatina), - _ => Err(format!("unknown backend: {s} (expected 'sonatina')")), - } - } -} - -#[derive(Debug, Clone, Copy, Default)] -pub struct SonatinaBackend; - -impl Backend for SonatinaBackend { - fn name(&self) -> &'static str { - "sonatina" - } - - fn compile( - &self, - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, - layout: TargetDataLayout, - opt_level: OptLevel, - ) -> Result { - let package = mir::build_runtime_package(db, top_mod)?; - let artifacts = crate::sonatina::emit_runtime_package_sonatina_bytecode( - db, &package, layout, opt_level, - )?; - let object = package - .primary_object(db) - .or_else(|| package.root_objects(db).first().copied()) - .ok_or_else(|| BackendError::Sonatina("no root objects to compile".to_string()))?; - let object_name = object.name(db).clone(); - let contract = artifacts.get(&object_name).ok_or_else(|| { - BackendError::Sonatina(format!("missing bytecode for `{object_name}`")) - })?; - Ok(BackendOutput::Bytecode(contract.runtime.clone())) - } -} diff --git a/crates/codegen/src/function_symbols.rs b/crates/codegen/src/function_symbols.rs deleted file mode 100644 index dbeb13b107..0000000000 --- a/crates/codegen/src/function_symbols.rs +++ /dev/null @@ -1,399 +0,0 @@ -use driver::DriverDataBase; -use hir::analysis::{ - semantic::SemanticInstance, - ty::{ - ty_check::BodyOwner, - ty_def::{TyBase, TyData, TyId}, - }, -}; -use mir::{ - RuntimeFunctionOwner, - runtime::stable_key::{ - generic_args_identity, ingot_component_for_scope, module_path_components_for_scope, - semantic_owner_context_identity, stable_identity_hash, - }, -}; -use rustc_hash::FxHashSet; -use std::collections::BTreeMap; - -const GENERIC_SUFFIX_HASH_LEN: usize = 4; -const OWNER_CONTEXT_HASH_LEN: usize = 4; -const CONFLICT_SUFFIX_HASH_LEN: usize = 4; - -struct OwnerContextCandidates { - primary: Option, - fallback: Option, -} - -pub(crate) struct FunctionSymbolStyle { - pub segment_separator: &'static str, - pub variant_separator: &'static str, - pub fallback_separator: &'static str, - pub sanitize_segment: fn(&str) -> String, - pub namespace_key: fn(&str) -> String, -} - -pub(crate) struct FunctionSymbolInput<'db> { - pub owner: RuntimeFunctionOwner<'db>, - pub fallback_symbol: String, - pub variant_suffix: String, - pub disambiguator: String, -} - -pub(crate) fn assign_function_symbols<'db>( - db: &'db DriverDataBase, - inputs: &[FunctionSymbolInput<'db>], - style: &FunctionSymbolStyle, -) -> Vec { - let candidates = inputs - .iter() - .map(|input| function_symbol_candidates(db, input, style)) - .collect::>(); - let mut selected = vec![0usize; candidates.len()]; - - loop { - let conflicts = symbol_conflicts(&candidates, &selected, style); - if conflicts.values().all(|group| group.len() == 1) { - break; - } - - let mut changed = false; - for group in conflicts.values().filter(|group| group.len() > 1) { - for &idx in group { - if selected[idx] + 1 < candidates[idx].len() { - selected[idx] += 1; - changed = true; - } - } - } - - if !changed { - break; - } - } - - let mut symbols = candidates - .iter() - .zip(selected) - .map(|(candidates, selected)| candidates[selected].clone()) - .collect::>(); - uniquify_function_symbols(&mut symbols, style, &candidates, inputs); - symbols -} - -fn function_symbol_candidates<'db>( - db: &'db DriverDataBase, - input: &FunctionSymbolInput<'db>, - style: &FunctionSymbolStyle, -) -> Vec { - match &input.owner { - RuntimeFunctionOwner::Semantic(semantic) => { - semantic_function_symbol_candidates(db, *semantic, &input.variant_suffix, style) - } - RuntimeFunctionOwner::Synthetic(_) => { - vec![render_raw_symbol( - &input.fallback_symbol, - &input.variant_suffix, - style, - )] - } - } -} - -fn semantic_function_symbol_candidates<'db>( - db: &'db DriverDataBase, - semantic: SemanticInstance<'db>, - variant_suffix: &str, - style: &FunctionSymbolStyle, -) -> Vec { - let owner = semantic.key(db).owner(db); - let leaf = semantic_leaf_component(db, owner); - let generic = generic_component(db, semantic.key(db).subst(db).generic_args(db)); - let owner_context = semantic_owner_context_candidates(db, owner); - let module_path = module_path_components_for_scope(db, owner.scope()); - let ingot = ingot_component_for_scope(db, owner.scope()); - - let mut candidates = Vec::new(); - push_symbol_candidate(&mut candidates, vec![leaf.clone()], variant_suffix, style); - if let Some(generic) = &generic { - push_symbol_candidate( - &mut candidates, - vec![leaf.clone(), generic.clone()], - variant_suffix, - style, - ); - } - - let mut scoped_leaf = vec![leaf]; - if let Some(generic) = generic { - scoped_leaf.push(generic); - } - - if let Some(owner_context) = &owner_context.primary { - let mut parts = vec![owner_context.clone()]; - parts.extend(scoped_leaf.clone()); - push_symbol_candidate(&mut candidates, parts, variant_suffix, style); - } - - let mut module_parts = module_path.clone(); - if let Some(owner_context) = &owner_context.primary { - module_parts.push(owner_context.clone()); - } - module_parts.extend(scoped_leaf.clone()); - push_symbol_candidate(&mut candidates, module_parts.clone(), variant_suffix, style); - - let mut ingot_parts = vec![ingot]; - ingot_parts.extend(module_parts.clone()); - push_symbol_candidate(&mut candidates, ingot_parts, variant_suffix, style); - - if let Some(fallback_context) = &owner_context.fallback { - let mut parts = vec![fallback_context.clone()]; - parts.extend(scoped_leaf.clone()); - push_symbol_candidate(&mut candidates, parts, variant_suffix, style); - - let mut module_parts = module_path; - module_parts.push(fallback_context.clone()); - module_parts.extend(scoped_leaf.clone()); - push_symbol_candidate(&mut candidates, module_parts.clone(), variant_suffix, style); - - let mut ingot_parts = vec![ingot_component_for_scope(db, owner.scope())]; - ingot_parts.extend(module_parts); - push_symbol_candidate(&mut candidates, ingot_parts, variant_suffix, style); - } - candidates -} - -fn push_symbol_candidate( - candidates: &mut Vec, - parts: Vec, - variant_suffix: &str, - style: &FunctionSymbolStyle, -) { - let symbol = render_symbol(parts, variant_suffix, style); - let emitted = (style.namespace_key)(&symbol); - if candidates - .iter() - .all(|candidate| (style.namespace_key)(candidate) != emitted) - { - candidates.push(symbol); - } -} - -fn render_symbol(parts: Vec, variant_suffix: &str, style: &FunctionSymbolStyle) -> String { - let mut symbol = parts - .into_iter() - .filter(|part| !part.is_empty()) - .map(|part| (style.sanitize_segment)(&part)) - .filter(|part| !part.is_empty()) - .collect::>() - .join(style.segment_separator); - if symbol.is_empty() { - symbol = (style.sanitize_segment)("symbol"); - } - if !variant_suffix.is_empty() { - symbol.push_str(style.variant_separator); - symbol.push_str(&(style.sanitize_segment)(variant_suffix)); - } - symbol -} - -fn render_raw_symbol(symbol: &str, variant_suffix: &str, style: &FunctionSymbolStyle) -> String { - render_symbol(vec![symbol.to_string()], variant_suffix, style) -} - -fn symbol_conflicts( - candidates: &[Vec], - selected: &[usize], - style: &FunctionSymbolStyle, -) -> BTreeMap> { - selected - .iter() - .enumerate() - .fold(BTreeMap::new(), |mut conflicts, (idx, selected)| { - conflicts - .entry((style.namespace_key)(&candidates[idx][*selected])) - .or_insert_with(Vec::new) - .push(idx); - conflicts - }) -} - -fn uniquify_function_symbols( - symbols: &mut [String], - style: &FunctionSymbolStyle, - candidates: &[Vec], - inputs: &[FunctionSymbolInput<'_>], -) { - let conflicts = symbols.iter().enumerate().fold( - BTreeMap::>::new(), - |mut conflicts, (idx, symbol)| { - conflicts - .entry((style.namespace_key)(symbol)) - .or_default() - .push(idx); - conflicts - }, - ); - let mut used = conflicts - .iter() - .filter(|(_, group)| group.len() == 1) - .map(|(symbol, _)| symbol.clone()) - .collect::>(); - for group in conflicts.values().filter(|group| group.len() > 1) { - let mut group = group.clone(); - group.sort_by(|lhs, rhs| { - candidates[*lhs] - .cmp(&candidates[*rhs]) - .then_with(|| inputs[*lhs].disambiguator.cmp(&inputs[*rhs].disambiguator)) - .then_with(|| lhs.cmp(rhs)) - }); - for idx in group { - let base = symbols[idx].clone(); - let hash = stable_identity_hash(&inputs[idx].disambiguator); - let candidate = format!( - "{base}{}{}", - style.fallback_separator, - &hash[..CONFLICT_SUFFIX_HASH_LEN] - ); - if used.insert((style.namespace_key)(&candidate)) { - symbols[idx] = candidate; - continue; - } - for suffix in 0.. { - let candidate = format!( - "{base}{}{}{}{suffix}", - style.fallback_separator, - &hash[..CONFLICT_SUFFIX_HASH_LEN], - style.fallback_separator - ); - if used.insert((style.namespace_key)(&candidate)) { - symbols[idx] = candidate; - break; - } - } - } - } -} - -fn semantic_leaf_component<'db>(db: &'db DriverDataBase, owner: BodyOwner<'db>) -> String { - match owner { - BodyOwner::Func(func) => func - .name(db) - .to_opt() - .map(|name| name.data(db).to_string()) - .unwrap_or_else(|| "__anon".to_string()), - BodyOwner::Const(const_) => const_ - .name(db) - .to_opt() - .map(|name| name.data(db).to_string()) - .unwrap_or_else(|| "__const".to_string()), - BodyOwner::AnonConstBody { .. } => "__anon_const".to_string(), - BodyOwner::ContractInit { contract } => format!( - "__{}_init", - contract - .name(db) - .to_opt() - .map(|name| name.data(db).to_string()) - .unwrap_or_else(|| "contract".to_string()) - ), - BodyOwner::ContractRecvArm { - contract, - recv_idx, - arm_idx, - } => format!( - "__{}_recv_{}_{}", - contract - .name(db) - .to_opt() - .map(|name| name.data(db).to_string()) - .unwrap_or_else(|| "contract".to_string()), - recv_idx, - arm_idx - ), - } -} - -fn semantic_owner_context_candidates<'db>( - db: &'db DriverDataBase, - owner: BodyOwner<'db>, -) -> OwnerContextCandidates { - let stable = semantic_owner_context_identity(db, owner); - let readable = readable_owner_context(db, owner); - let primary = readable - .clone() - .or_else(|| stable.clone().map(shorten_owner_context_hash)); - let fallback = readable - .zip(stable.as_deref().and_then(short_owner_context_hash)) - .map(|(readable, hash)| format!("{readable}${hash}")) - .filter(|fallback| Some(fallback) != primary.as_ref()); - - OwnerContextCandidates { primary, fallback } -} - -fn readable_owner_context<'db>(db: &'db DriverDataBase, owner: BodyOwner<'db>) -> Option { - let BodyOwner::Func(func) = owner else { - return None; - }; - - if let Some(impl_) = func.containing_impl(db) { - return readable_type_component(db, impl_.ty(db)).map(|ty| format!("impl${ty}")); - } - - if let Some(impl_trait) = func.containing_impl_trait(db) { - return readable_type_component(db, impl_trait.ty(db)).map(|ty| format!("impl_trait${ty}")); - } - - None -} - -fn readable_type_component<'db>(db: &'db DriverDataBase, ty: TyId<'db>) -> Option { - let base = ty.base_ty(db); - match base.data(db) { - TyData::TyBase(TyBase::Adt(adt)) => adt - .adt_ref(db) - .name(db) - .map(|name| name.data(db).to_string()), - TyData::TyBase(TyBase::Contract(contract)) => contract - .name(db) - .to_opt() - .map(|name| name.data(db).to_string()), - TyData::TyBase(TyBase::Prim(_) | TyBase::Func(_)) - | TyData::TyParam(_) - | TyData::QualifiedTy(_) => { - let component = base.pretty_print(db).to_string(); - (!component.is_empty()).then_some(component) - } - TyData::AssocTy(_) - | TyData::ConstTy(_) - | TyData::Never - | TyData::TyVar(_) - | TyData::Invalid(_) - | TyData::TyApp(..) => None, - } -} - -fn shorten_owner_context_hash(context: String) -> String { - if let Some(hash) = short_owner_context_hash(&context) - && let Some((kind, _)) = context.split_once('$') - { - return format!("{kind}${hash}"); - } - context -} - -fn short_owner_context_hash(context: &str) -> Option<&str> { - if let Some((kind, hash)) = context.split_once('$') - && matches!(kind, "impl" | "impl_trait") - && hash.len() > OWNER_CONTEXT_HASH_LEN - { - return Some(&hash[..OWNER_CONTEXT_HASH_LEN]); - } - None -} - -fn generic_component<'db>(db: &'db DriverDataBase, args: &[TyId<'db>]) -> Option { - (!args.is_empty()).then(|| { - let hash = stable_identity_hash(&generic_args_identity(db, args)); - format!("g{}", &hash[..GENERIC_SUFFIX_HASH_LEN]) - }) -} diff --git a/crates/codegen/src/layout.rs b/crates/codegen/src/layout.rs deleted file mode 100644 index d63889822d..0000000000 --- a/crates/codegen/src/layout.rs +++ /dev/null @@ -1 +0,0 @@ -pub use common::layout::{DISCRIMINANT_SIZE_BYTES, EVM_LAYOUT, TargetDataLayout, WORD_SIZE_BYTES}; diff --git a/crates/codegen/src/lib.rs b/crates/codegen/src/lib.rs deleted file mode 100644 index 8ac56245ba..0000000000 --- a/crates/codegen/src/lib.rs +++ /dev/null @@ -1,17 +0,0 @@ -mod backend; -mod function_symbols; -mod layout; -mod runtime_package; -mod sonatina; -mod test_output; - -pub use backend::{Backend, BackendError, BackendKind, BackendOutput, OptLevel, SonatinaBackend}; -pub use layout::{DISCRIMINANT_SIZE_BYTES, EVM_LAYOUT, TargetDataLayout, WORD_SIZE_BYTES}; -pub use sonatina::{ - LowerError, SonatinaContractBytecode, SonatinaTestOptions, emit_ingot_sonatina_bytecode, - emit_ingot_sonatina_ir, emit_ingot_sonatina_ir_optimized, emit_module_sonatina_bytecode, - emit_module_sonatina_ir, emit_module_sonatina_ir_optimized, emit_runtime_package_sonatina_ir, - emit_runtime_package_sonatina_ir_optimized, emit_test_ingot_sonatina, - emit_test_module_sonatina, validate_module_sonatina_ir, -}; -pub use test_output::{ExpectedRevert, TestMetadata, TestModuleOutput, parse_expected_revert}; diff --git a/crates/codegen/src/runtime_package.rs b/crates/codegen/src/runtime_package.rs deleted file mode 100644 index 3ad42997ed..0000000000 --- a/crates/codegen/src/runtime_package.rs +++ /dev/null @@ -1,15 +0,0 @@ -use driver::DriverDataBase; -use mir::RuntimePackage; - -pub(crate) fn ensure_runtime_package_has_roots( - db: &DriverDataBase, - package: &RuntimePackage<'_>, - artifact: &str, -) -> Result<(), mir::LowerError> { - if package.root_objects(db).is_empty() { - return Err(mir::LowerError::Unsupported(format!( - "runtime package has no root objects; refusing to emit target-only {artifact}" - ))); - } - Ok(()) -} diff --git a/crates/codegen/src/sonatina/lower_runtime.rs b/crates/codegen/src/sonatina/lower_runtime.rs deleted file mode 100644 index 84464aea41..0000000000 --- a/crates/codegen/src/sonatina/lower_runtime.rs +++ /dev/null @@ -1,4889 +0,0 @@ -use std::collections::hash_map::DefaultHasher; -use std::hash::{Hash, Hasher}; - -use driver::DriverDataBase; -use hir::{ - analysis::{ - semantic::FieldIndex, - ty::{ - ty_check::BodyOwner, - ty_def::{PrimTy, TyBase, TyData, TyId}, - }, - }, - hir_def::{ArithBinOp, BinOp, CompBinOp, LogicalBinOp, UnOp}, - projection::IndexSource, -}; -use mir::runtime::RefKind; -use mir::{ - AddressSpaceKind, ConstNode, ConstRegionId, ConstScalar, IntrinsicArithBinOp, Layout, LayoutId, - RBlockId, RExpr, RLocalId, RStmt, RTerminator, ResolvedPlaceElem, ResolvedPlaceRootKind, - RuntimeBody, RuntimeBuiltin, RuntimeClass, RuntimeFunction, RuntimeInlineHint, RuntimeInstance, - RuntimeLinkage, RuntimeLocalRoot, RuntimePackage, RuntimePlace, SaturatingBinOp, ScalarClass, - ScalarRepr, VariantId, instance::RuntimeInstanceSource, resolve_runtime_place, -}; -use rustc_hash::{FxHashMap, FxHashSet}; -use smallvec1::{SmallVec, smallvec}; -use sonatina_ir::{ - BlockId, GlobalVariableData, GlobalVariableRef, I256, Immediate, Linkage, Module, Signature, - Type, Value, ValueId, - builder::{FunctionBuilder, ModuleBuilder, ObjectBuilder, Variable}, - func_cursor::InstInserter, - inst::{ - arith::{Add, Mul, Neg, Sar, Shl, Shr, Sub}, - cast::{Bitcast, IntToPtr, PtrToInt, Sext, Trunc, Zext}, - cmp::{Eq, Gt, IsZero, Lt, Ne, Slt}, - control_flow::{Br, BrTable, Call, Jump, Phi, Return, Unreachable}, - data::{ - Alloca, ConstIndex, ConstLoad, ConstProj, ConstRef, EnumAssertVariant, - EnumAssertVariantRef, EnumExtract, EnumGetTag, EnumIsVariant, EnumMake, EnumProj, - EnumSetTag, EnumTag, EnumWriteVariant, InsertValue, Mload, Mstore, ObjAlloc, ObjIndex, - ObjInitConst, ObjLoad, ObjProj, ObjStore, SymAddr, SymSize, SymbolRef, - }, - evm::{ - EvmAddMod, EvmAddress, EvmBalance, EvmBaseFee, EvmBlobBaseFee, EvmBlobHash, - EvmBlockHash, EvmByte, EvmCall, EvmCallValue, EvmCalldataCopy, EvmCalldataLoad, - EvmCalldataSize, EvmCaller, EvmChainId, EvmCodeCopy, EvmCodeSize, EvmCoinBase, - EvmCreate, EvmCreate2, EvmDelegateCall, EvmExp, EvmExtCodeCopy, EvmExtCodeHash, - EvmExtCodeSize, EvmGas, EvmGasLimit, EvmGasPrice, EvmInvalid, EvmKeccak256, EvmLog0, - EvmLog1, EvmLog2, EvmLog3, EvmLog4, EvmMalloc, EvmMcopy, EvmMsize, EvmMstore8, - EvmMulMod, EvmNumber, EvmOrigin, EvmPrevRandao, EvmReturn, EvmReturnDataCopy, - EvmReturnDataSize, EvmRevert, EvmSdiv, EvmSelfBalance, EvmSelfDestruct, EvmSignExtend, - EvmSload, EvmSmod, EvmSstore, EvmStaticCall, EvmStop, EvmTimestamp, EvmTload, - EvmTstore, EvmUdiv, EvmUmod, inst_set::EvmInstSet, - }, - logic::{And, Not, Or, Xor}, - }, - isa::Isa, - module::FuncRef, - object::EmbedSymbol, - types::{CompoundType, EnumReprHint, EnumVariantRef, VariantData}, -}; - -use super::{LowerError, create_module_ctx}; -use crate::{ - TargetDataLayout, - function_symbols::{FunctionSymbolInput, FunctionSymbolStyle, assign_function_symbols}, -}; - -const PANIC_OVERFLOW: u64 = 0x11; -const PANIC_DIVISION_BY_ZERO: u64 = 0x12; - -pub(super) fn compile_runtime_package_sonatina( - db: &DriverDataBase, - package: &RuntimePackage<'_>, - layout: TargetDataLayout, -) -> Result { - let _ = layout; - let builder = ModuleBuilder::new(create_module_ctx()); - let isa = super::create_evm_isa(); - let mut lowerer = ModuleLowerer::new(db, builder, &isa, package); - lowerer.declare_functions()?; - lowerer.lower_const_regions()?; - lowerer.lower_bodies()?; - lowerer.declare_objects()?; - Ok(lowerer.finish()) -} - -struct ModuleLowerer<'db, 'a> { - db: &'db DriverDataBase, - builder: ModuleBuilder, - isa: &'a sonatina_ir::isa::evm::Evm, - package: &'a RuntimePackage<'db>, - func_map: FxHashMap, FuncRef>, - func_symbols: FxHashMap, String>, - section_membership: FxHashMap, Vec>>, - type_cache: FxHashMap, Type>, - layout_names: FxHashMap, String>, - const_globals: FxHashMap, GlobalVariableRef>, - const_names: FxHashMap, String>, - explicit_code_region_sections: FxHashSet<(mir::RuntimeObject<'db>, mir::RuntimeSectionName)>, -} - -impl<'db, 'a> ModuleLowerer<'db, 'a> { - fn new( - db: &'db DriverDataBase, - builder: ModuleBuilder, - isa: &'a sonatina_ir::isa::evm::Evm, - package: &'a RuntimePackage<'db>, - ) -> Self { - Self { - db, - builder, - isa, - package, - func_map: FxHashMap::default(), - func_symbols: assign_sonatina_function_symbols(db, package), - section_membership: compute_section_membership(db, package), - type_cache: FxHashMap::default(), - layout_names: FxHashMap::default(), - const_globals: FxHashMap::default(), - const_names: FxHashMap::default(), - explicit_code_region_sections: FxHashSet::default(), - } - } - - fn finish(self) -> Module { - self.builder.build() - } - - fn inst_set(&self) -> &'static EvmInstSet { - self.isa.inst_set() - } - - fn function_symbol(&self, instance: RuntimeInstance<'db>) -> String { - self.func_symbols - .get(&instance) - .cloned() - .or_else(|| { - self.package - .functions(self.db) - .into_iter() - .find(|function| function.instance(self.db) == instance) - .map(|function| function.symbol(self.db).clone()) - }) - .unwrap_or_else(|| format!("{:?}", instance.key(self.db))) - } - - fn sections_for_function( - &self, - instance: RuntimeInstance<'db>, - ) -> &[mir::RuntimeSectionRef<'db>] { - self.section_membership - .get(&instance) - .map(Vec::as_slice) - .unwrap_or(&[]) - } - - fn declare_functions(&mut self) -> Result<(), LowerError> { - for function in self.package.functions(self.db) { - if runtime_intrinsic(self.db, function.instance(self.db)).is_some() { - continue; - } - let signature = self.lower_signature(function)?; - let func_ref = self.builder.declare_function(signature).map_err(|err| { - LowerError::Internal(format!("failed to declare function: {err}")) - })?; - self.apply_inline_hint(func_ref, function.inline_hint(self.db)); - self.func_map.insert(function.instance(self.db), func_ref); - } - Ok(()) - } - - fn lower_signature(&mut self, function: RuntimeFunction<'db>) -> Result { - let body = function.instance(self.db).body(self.db); - let args = body - .signature - .params - .iter() - .map(|param| self.ty_for_class(¶m.class)) - .collect::, _>>()?; - let ret = body - .signature - .ret - .as_ref() - .map(|class| self.ty_for_class(class)) - .transpose()?; - let symbol = self.function_symbol(function.instance(self.db)); - Ok(match ret { - Some(ret) => Signature::new_single( - &symbol, - linkage_for_runtime(function.linkage(self.db)), - &args, - ret, - ), - None => Signature::new_unit( - &symbol, - linkage_for_runtime(function.linkage(self.db)), - &args, - ), - }) - } - - fn apply_inline_hint(&self, func_ref: FuncRef, hint: RuntimeInlineHint) { - let hint = match hint { - RuntimeInlineHint::Auto => sonatina_ir::InlineHint::Auto, - RuntimeInlineHint::Hint => sonatina_ir::InlineHint::Inline, - RuntimeInlineHint::Always => sonatina_ir::InlineHint::Always, - RuntimeInlineHint::Never => sonatina_ir::InlineHint::Never, - }; - self.builder.ctx.set_inline_hint(func_ref, hint); - } - - fn lower_const_regions(&mut self) -> Result<(), LowerError> { - for region in self.package.const_regions(self.db) { - self.lower_const_region(region)?; - } - Ok(()) - } - - fn lower_const_region( - &mut self, - region: ConstRegionId<'db>, - ) -> Result { - if let Some(&existing) = self.const_globals.get(®ion) { - return Ok(existing); - } - - let ty = self.ty_for_layout(region.layout(self.db))?; - let init = self.gv_initializer_for_const(region.value(self.db).clone())?; - let name = self.const_name(region); - let gv = self.builder.declare_gv(GlobalVariableData::constant( - name, - ty, - Linkage::Private, - init, - )); - self.const_globals.insert(region, gv); - Ok(gv) - } - - fn gv_initializer_for_const( - &mut self, - node: ConstNode<'db>, - ) -> Result { - Ok(match node { - ConstNode::Scalar(scalar) => sonatina_ir::global_variable::GvInitializer::make_imm( - self.immediate_for_const(&scalar, None)?, - ), - ConstNode::Aggregate { layout, fields } => { - let ty = self.ty_for_layout(layout)?; - let compound = ty.resolve_compound(&self.builder.ctx).ok_or_else(|| { - LowerError::Internal(format!("const aggregate type `{ty:?}` is not compound")) - })?; - match compound { - CompoundType::Array { .. } => { - sonatina_ir::global_variable::GvInitializer::make_array( - fields - .iter() - .cloned() - .map(|field| self.gv_initializer_for_const(field)) - .collect::, _>>()?, - ) - } - CompoundType::Struct(_) => { - sonatina_ir::global_variable::GvInitializer::make_struct( - fields - .iter() - .cloned() - .map(|field| self.gv_initializer_for_const(field)) - .collect::, _>>()?, - ) - } - CompoundType::Enum(_) => { - return Err(LowerError::Unsupported( - "enum const globals are not yet supported by Sonatina object data encoding" - .to_string(), - )); - } - CompoundType::Ptr(_) - | CompoundType::ObjRef(_) - | CompoundType::ConstRef(_) - | CompoundType::Func { .. } => { - return Err(LowerError::Unsupported( - "reference/function const globals are not supported".to_string(), - )); - } - } - } - }) - } - - fn lower_bodies(&mut self) -> Result<(), LowerError> { - for function in self.package.functions(self.db) { - if runtime_intrinsic(self.db, function.instance(self.db)).is_some() { - continue; - } - let body = function.instance(self.db).body(self.db); - let func_ref = self.func_ref(function.instance(self.db))?; - let ctx = FunctionLowerer::new(self, body, func_ref)?; - ctx.lower()?; - } - Ok(()) - } - - fn declare_objects(&mut self) -> Result<(), LowerError> { - for object in self.package.objects(self.db) { - let mut object_builder = ObjectBuilder::new(object.name(self.db).clone()); - for section in object.sections(self.db) { - let section_builder = - object_builder.section(super::section_name_for_runtime(§ion.name)); - section_builder.entry(self.func_ref(section.entry.instance(self.db))?); - if self.section_needs_const_data(object, §ion.name) { - for region in §ion.const_regions { - section_builder.data(self.lower_const_region(*region)?); - } - } - for embed in §ion.embeds { - match &embed.source { - mir::RuntimeSectionRef::Local { object: _, section } => { - section_builder.embed_local( - super::section_name_for_runtime(section), - EmbedSymbol::from(embed.as_symbol.clone()), - ); - } - mir::RuntimeSectionRef::External { object, section } => { - section_builder.embed_external( - object.name(self.db).clone(), - super::section_name_for_runtime(section), - EmbedSymbol::from(embed.as_symbol.clone()), - ); - } - } - } - } - object_builder - .declare(&mut self.builder) - .map_err(|err| LowerError::Internal(format!("failed to declare object: {err}")))?; - } - Ok(()) - } - - fn section_needs_const_data( - &self, - object: mir::RuntimeObject<'db>, - section: &mir::RuntimeSectionName, - ) -> bool { - matches!(section, mir::RuntimeSectionName::CodeRegion(_)) - || self - .explicit_code_region_sections - .contains(&(object, section.clone())) - } - - fn mark_explicit_code_region(&mut self, region: mir::RuntimeCodeRegion<'db>) { - let Some(resolved) = self - .package - .code_regions(self.db) - .into_iter() - .find(|resolved| resolved.region(self.db) == region) - else { - return; - }; - match resolved.source(self.db) { - mir::RuntimeSectionRef::Local { object, section } - | mir::RuntimeSectionRef::External { object, section } => { - self.explicit_code_region_sections - .insert((object, section.clone())); - } - } - } - - fn func_ref(&self, instance: mir::RuntimeInstance<'db>) -> Result { - self.func_map.get(&instance).copied().ok_or_else(|| { - let declared = self - .package - .functions(self.db) - .iter() - .map(|func| describe_runtime_instance(self.db, func.instance(self.db))) - .collect::>(); - LowerError::Internal(format!( - "missing declared function for {instance:?}: {}; declared={declared:?}", - describe_runtime_instance(self.db, instance), - )) - }) - } - - fn ty_for_layout(&mut self, layout: LayoutId<'db>) -> Result { - if let Some(&existing) = self.type_cache.get(&layout) { - return Ok(existing); - } - - let ty = match layout.data(self.db) { - Layout::Struct(data) => { - let fields = data - .fields - .iter() - .map(|field| self.ty_for_class(field)) - .collect::, _>>()?; - let name = self.layout_name(layout); - self.builder.declare_struct_type(&name, &fields, false) - } - Layout::Array(data) => { - let elem = self.ty_for_class(&data.elem)?; - self.builder.declare_array_type(elem, data.len as usize) - } - Layout::Enum(data) => { - let variants = data - .variants - .iter() - .map(|variant| { - Ok(VariantData { - name: variant.name.clone(), - explicit_discriminant: None, - fields: variant - .fields - .iter() - .map(|field| self.ty_for_class(field)) - .collect::, LowerError>>()?, - }) - }) - .collect::, LowerError>>()?; - let name = self.layout_name(layout); - self.builder - .declare_enum_type(&name, &variants, EnumReprHint::Default) - } - }; - self.type_cache.insert(layout, ty); - Ok(ty) - } - - fn const_name(&mut self, region: ConstRegionId<'db>) -> String { - if let Some(name) = self.const_names.get(®ion) { - return name.clone(); - } - let name = format!("const_region_{}", self.const_names.len()); - self.const_names.insert(region, name.clone()); - name - } - - fn layout_name(&mut self, layout: LayoutId<'db>) -> String { - if let Some(name) = self.layout_names.get(&layout) { - return name.clone(); - } - let name = format!("layout_{}", self.layout_names.len()); - self.layout_names.insert(layout, name.clone()); - name - } - - fn ty_for_class(&mut self, class: &RuntimeClass<'db>) -> Result { - Ok(match class { - RuntimeClass::Scalar(scalar) => self.scalar_ty(scalar)?, - RuntimeClass::AggregateValue { layout } => self.ty_for_layout(*layout)?, - RuntimeClass::Ref { pointee, kind, .. } => match kind { - RefKind::Const => { - let pointee_ty = self.ty_for_class(pointee)?; - self.builder.constref_type(pointee_ty) - } - RefKind::Object => { - let pointee_ty = self.ty_for_class(pointee)?; - self.builder.objref_type(pointee_ty) - } - RefKind::Provider { - space: AddressSpaceKind::Memory, - .. - } => { - let pointee_ty = self.ty_for_class(pointee)?; - self.builder.objref_type(pointee_ty) - } - RefKind::Provider { .. } => Type::I256, - }, - RuntimeClass::RawAddr { .. } => Type::I256, - }) - } - - fn scalar_ty(&mut self, scalar: &ScalarClass<'db>) -> Result { - Ok(match scalar.role { - mir::ScalarRole::EnumTag { enum_layout } => self.enum_tag_ty(enum_layout)?, - _ => scalar_ty(scalar), - }) - } - - fn enum_tag_ty(&mut self, enum_layout: LayoutId<'db>) -> Result { - let Type::Compound(enum_ty) = self.ty_for_layout(enum_layout)? else { - return Err(LowerError::Internal(format!( - "enum layout `{enum_layout:?}` should lower to a compound type" - ))); - }; - Ok(Type::EnumTag(enum_ty)) - } - - fn immediate_for_const( - &mut self, - scalar: &ConstScalar, - class: Option<&RuntimeClass<'db>>, - ) -> Result { - if let Some(RuntimeClass::Scalar(ScalarClass { - role: mir::ScalarRole::EnumTag { enum_layout }, - .. - })) = class - { - let ConstScalar::Int { words, .. } = scalar else { - return Err(LowerError::Internal(format!( - "enum tag constant should be integer-backed, found `{scalar:?}`" - ))); - }; - let Type::EnumTag(enum_ty) = self.enum_tag_ty(*enum_layout)? else { - unreachable!("enum tag layouts should lower to enum tag types"); - }; - return Ok(Immediate::EnumTag { - enum_ty, - value: bytes_to_i256(words, false), - }); - } - Ok(match scalar { - ConstScalar::Bool(value) => Immediate::from(*value), - ConstScalar::Int { - bits, - signed, - words, - } => Immediate::from_i256(bytes_to_i256(words, *signed), int_ty(*bits)), - ConstScalar::FixedBytes(bytes) => Immediate::from_i256( - bytes_to_i256(bytes, false), - fixed_bytes_ty(bytes.len() as u16), - ), - ConstScalar::Address { bytes, .. } => { - Immediate::from_i256(bytes_to_i256(bytes, false), Type::I256) - } - }) - } - - fn enum_tag_immediate( - &mut self, - enum_layout: LayoutId<'db>, - value: u16, - ) -> Result { - let Type::EnumTag(enum_ty) = self.enum_tag_ty(enum_layout)? else { - unreachable!("enum tag layouts should lower to enum tag types"); - }; - Ok(Immediate::EnumTag { - enum_ty, - value: I256::from(value as u64), - }) - } -} - -const SONATINA_FUNCTION_SYMBOL_STYLE: FunctionSymbolStyle = FunctionSymbolStyle { - segment_separator: "__", - variant_separator: "_", - fallback_separator: "_", - sanitize_segment: sanitize_sonatina_ident_segment, - namespace_key: sonatina_symbol_namespace_key, -}; - -fn assign_sonatina_function_symbols<'db>( - db: &'db DriverDataBase, - package: &RuntimePackage<'db>, -) -> FxHashMap, String> { - let functions = package - .functions(db) - .into_iter() - .filter(|function| runtime_intrinsic(db, function.instance(db)).is_none()) - .collect::>(); - let inputs = functions - .iter() - .map(|function| FunctionSymbolInput { - owner: function.owner(db).clone(), - fallback_symbol: function.symbol(db).clone(), - variant_suffix: String::new(), - disambiguator: mir::runtime_instance_symbol_key(db, function.instance(db)), - }) - .collect::>(); - functions - .into_iter() - .zip(assign_function_symbols( - db, - &inputs, - &SONATINA_FUNCTION_SYMBOL_STYLE, - )) - .map(|(function, symbol)| (function.instance(db), symbol)) - .collect() -} - -fn sanitize_sonatina_ident_segment(value: &str) -> String { - let sanitized = value - .chars() - .map(|ch| { - if ch.is_ascii_alphanumeric() || ch == '_' { - ch - } else { - '_' - } - }) - .collect::(); - if sanitized - .chars() - .next() - .is_some_and(|ch| ch.is_ascii_alphabetic() || ch == '_') - { - sanitized - } else { - format!("_{sanitized}") - } -} - -fn sonatina_symbol_namespace_key(symbol: &str) -> String { - symbol.to_string() -} - -fn describe_runtime_instance<'db>( - db: &DriverDataBase, - instance: mir::RuntimeInstance<'db>, -) -> String { - let key = instance.key(db); - match key.source(db) { - RuntimeInstanceSource::Semantic(semantic) => { - let owner = semantic.key(db).owner(db); - let owner_desc = match owner { - BodyOwner::Func(func) => func - .name(db) - .to_opt() - .map(|name| format!("func {}", name.data(db))) - .unwrap_or_else(|| format!("func {func:?}")), - BodyOwner::Const(const_) => format!("const {const_:?}"), - BodyOwner::AnonConstBody { .. } => format!("{owner:?}"), - BodyOwner::ContractInit { contract } => contract - .name(db) - .to_opt() - .map(|name| format!("contract-init {}", name.data(db))) - .unwrap_or_else(|| format!("{owner:?}")), - BodyOwner::ContractRecvArm { contract, .. } => contract - .name(db) - .to_opt() - .map(|name| format!("contract-recv {}", name.data(db))) - .unwrap_or_else(|| format!("{owner:?}")), - }; - format!("semantic owner={owner_desc} params={:?}", key.params(db)) - } - RuntimeInstanceSource::Synthetic(spec) => { - format!( - "synthetic spec={:?} params={:?}", - spec.spec(db), - key.params(db) - ) - } - } -} - -#[derive(Clone, Copy)] -enum RuntimeIntrinsic<'db> { - Alloc, - GenericSaturating { - op: GenericSaturatingOp, - ty: TyId<'db>, - }, - Numeric { - op: NumericIntrinsicOp, - prim: PrimTy, - }, -} - -#[derive(Clone, Copy)] -enum GenericSaturatingOp { - Add, - Sub, - Mul, -} - -#[derive(Clone, Copy)] -enum NumericIntrinsicOp { - Add, - Sub, - Mul, - Div, - Rem, - Pow, - Shl, - Shr, - BitAnd, - BitOr, - BitXor, - Eq, - Ne, - Lt, - Le, - Gt, - Ge, - BitNot, - Not, - Neg, -} - -const INTRINSIC_SUFFIX_TYPES: &[(&str, PrimTy)] = &[ - ("_u8", PrimTy::U8), - ("_u16", PrimTy::U16), - ("_u32", PrimTy::U32), - ("_u64", PrimTy::U64), - ("_u128", PrimTy::U128), - ("_u256", PrimTy::U256), - ("_usize", PrimTy::Usize), - ("_i8", PrimTy::I8), - ("_i16", PrimTy::I16), - ("_i32", PrimTy::I32), - ("_i64", PrimTy::I64), - ("_i128", PrimTy::I128), - ("_i256", PrimTy::I256), - ("_isize", PrimTy::Isize), - ("_bool", PrimTy::Bool), -]; - -fn runtime_intrinsic<'db>( - db: &'db DriverDataBase, - instance: mir::RuntimeInstance<'db>, -) -> Option> { - let semantic = instance.key(db).semantic(db)?; - let hir::analysis::ty::ty_check::BodyOwner::Func(func) = semantic.key(db).owner(db) else { - return None; - }; - if func.body(db).is_some() { - return None; - } - let name = func.name(db).to_opt()?.data(db); - if name == "alloc" { - return Some(RuntimeIntrinsic::Alloc); - } - if let Some(op) = match name.as_str() { - "__saturating_add" => Some(GenericSaturatingOp::Add), - "__saturating_sub" => Some(GenericSaturatingOp::Sub), - "__saturating_mul" => Some(GenericSaturatingOp::Mul), - _ => None, - } { - let ty = *semantic.key(db).subst(db).generic_args(db).first()?; - return Some(RuntimeIntrinsic::GenericSaturating { op, ty }); - } - let (op, prim) = intrinsic_name_parts(name.as_str())?; - Some(RuntimeIntrinsic::Numeric { - op: match op { - "add" => NumericIntrinsicOp::Add, - "sub" => NumericIntrinsicOp::Sub, - "mul" => NumericIntrinsicOp::Mul, - "div" => NumericIntrinsicOp::Div, - "rem" => NumericIntrinsicOp::Rem, - "pow" => NumericIntrinsicOp::Pow, - "shl" => NumericIntrinsicOp::Shl, - "shr" => NumericIntrinsicOp::Shr, - "bitand" => NumericIntrinsicOp::BitAnd, - "bitor" => NumericIntrinsicOp::BitOr, - "bitxor" => NumericIntrinsicOp::BitXor, - "eq" => NumericIntrinsicOp::Eq, - "ne" => NumericIntrinsicOp::Ne, - "lt" => NumericIntrinsicOp::Lt, - "le" => NumericIntrinsicOp::Le, - "gt" => NumericIntrinsicOp::Gt, - "ge" => NumericIntrinsicOp::Ge, - "bitnot" => NumericIntrinsicOp::BitNot, - "not" => NumericIntrinsicOp::Not, - "neg" => NumericIntrinsicOp::Neg, - _ => return None, - }, - prim, - }) -} - -fn intrinsic_name_parts(callee_name: &str) -> Option<(&str, PrimTy)> { - INTRINSIC_SUFFIX_TYPES.iter().find_map(|(suffix, prim)| { - callee_name - .strip_suffix(suffix) - .and_then(|prefix| prefix.strip_prefix("__")) - .map(|op| (op, *prim)) - }) -} - -#[derive(Clone, Copy)] -enum SlotRoot { - Ptr(ValueId, Type), - Object(ValueId, Type), -} - -enum PlaceTerminal<'db> { - Ptr { - addr: ValueId, - space: AddressSpaceKind, - class: RuntimeClass<'db>, - }, - Object { - value: ValueId, - class: RuntimeClass<'db>, - }, - Const { - value: ValueId, - class: RuntimeClass<'db>, - }, -} - -enum Lowered { - Value(T), - Terminated, -} - -#[derive(Clone)] -enum CopySource<'db> { - Value { - value: ValueId, - class: RuntimeClass<'db>, - }, - Object { - value: ValueId, - class: RuntimeClass<'db>, - }, - Const { - value: ValueId, - class: RuntimeClass<'db>, - }, - Ptr { - addr: ValueId, - space: AddressSpaceKind, - class: RuntimeClass<'db>, - }, -} - -struct FunctionLowerer<'ctx, 'db, 'a> { - module: &'ctx mut ModuleLowerer<'db, 'a>, - body: RuntimeBody<'db>, - current_sections: Vec>, - fb: FunctionBuilder, - prologue_block: BlockId, - block_map: Vec>, - reachable_blocks: Vec, - vars: FxHashMap, - slot_roots: FxHashMap, - pending_enum_proof: Option>, - empty_revert_block: Option, - overflow_panic_block: Option, - division_by_zero_panic_block: Option, -} - -#[derive(Clone, Copy)] -struct PendingEnumProof<'db> { - // Sonatina proves value-enum extracts on a specific SSA value, so when the - // runtime IR emits `EnumAssertVariant` as a standalone statement we must - // reuse that exact materialization for the immediately following extract. - local: RLocalId, - variant: VariantId<'db>, - value: ValueId, -} - -impl<'ctx, 'db, 'a> FunctionLowerer<'ctx, 'db, 'a> { - fn new( - module: &'ctx mut ModuleLowerer<'db, 'a>, - body: RuntimeBody<'db>, - func_ref: FuncRef, - ) -> Result { - let current_sections = module.sections_for_function(body.owner).to_vec(); - let mut fb = module.builder.func_builder::(func_ref); - let prologue_block = fb.append_block(); - let reachable_blocks = compute_reachable_blocks(&body); - let block_map = reachable_blocks - .iter() - .map(|reachable| reachable.then(|| fb.append_block())) - .collect::>(); - let vars = body - .locals - .iter() - .enumerate() - .filter_map(|(idx, local)| match local.root { - RuntimeLocalRoot::Slot(_) => None, - RuntimeLocalRoot::None - | RuntimeLocalRoot::Ref(_) - | RuntimeLocalRoot::Ptr { .. } => match &local.carrier { - mir::RuntimeCarrier::Value(class) => Some( - module - .ty_for_class(class) - .map(|ty| (RLocalId::from_u32(idx as u32), fb.declare_var(ty))), - ), - mir::RuntimeCarrier::Erased => None, - }, - }) - .collect::, _>>()?; - Ok(Self { - module, - body, - current_sections, - fb, - prologue_block, - block_map, - reachable_blocks, - vars, - slot_roots: FxHashMap::default(), - pending_enum_proof: None, - empty_revert_block: None, - overflow_panic_block: None, - division_by_zero_panic_block: None, - }) - } - - fn lower(mut self) -> Result<(), LowerError> { - let entry_block = self.block_id(RBlockId::from_u32(0))?; - self.fb.switch_to_block(self.prologue_block); - self.initialize_locals().map_err(|err| { - self.with_body_context( - format!( - "while initializing locals for `{}`", - self.module.function_symbol(self.body.owner) - ), - None, - None, - ) - .wrap(err) - })?; - self.fb - .insert_inst_no_result(Jump::new(self.module.inst_set(), entry_block)); - let blocks = self.body.blocks.clone(); - for (idx, block) in blocks.iter().enumerate() { - if !self.reachable_blocks[idx] { - continue; - } - self.fb - .switch_to_block(self.block_id(RBlockId::from_u32(idx as u32))?); - let mut terminated = false; - for (stmt_idx, stmt) in block.stmts.iter().enumerate() { - if matches!( - self.lower_stmt(stmt).map_err(|err| { - self.with_body_context( - format!( - "while lowering `{}` at bb{idx}[{stmt_idx}]", - self.module.function_symbol(self.body.owner) - ), - Some(RBlockId::from_u32(idx as u32)), - Some(stmt_idx), - ) - .wrap(err) - })?, - Lowered::Terminated - ) { - self.pending_enum_proof = None; - terminated = true; - break; - } - } - if terminated { - continue; - } - self.pending_enum_proof = None; - self.lower_terminator(&block.terminator).map_err(|err| { - self.with_body_context( - format!( - "while lowering `{}` terminator at bb{idx}", - self.module.function_symbol(self.body.owner) - ), - Some(RBlockId::from_u32(idx as u32)), - None, - ) - .wrap(err) - })?; - } - self.fb.seal_all(); - self.fb.finish(); - Ok(()) - } - - fn block_id(&self, block: RBlockId) -> Result { - self.block_map - .get(block.as_u32() as usize) - .copied() - .flatten() - .ok_or_else(|| { - LowerError::Internal(format!( - "reachable runtime block {block:?} was not assigned a Sonatina block" - )) - }) - } - - fn with_body_context( - &self, - context: String, - block: Option, - stmt: Option, - ) -> LowerBodyContext<'_, 'db> { - LowerBodyContext { - db: self.module.db, - body: &self.body, - context, - block, - stmt, - } - } - - fn initialize_locals(&mut self) -> Result<(), LowerError> { - let locals = self.body.locals.clone(); - for (idx, local) in locals.iter().enumerate() { - let local_id = RLocalId::from_u32(idx as u32); - match &local.root { - RuntimeLocalRoot::None - | RuntimeLocalRoot::Ref(_) - | RuntimeLocalRoot::Ptr { .. } => {} - RuntimeLocalRoot::Slot(class) => { - let class_ty = self.module.ty_for_class(class)?; - let root = match class { - RuntimeClass::AggregateValue { .. } => SlotRoot::Object( - self.fb.insert_inst( - ObjAlloc::new(self.module.inst_set(), class_ty), - self.fb.module_builder.objref_type(class_ty), - ), - class_ty, - ), - RuntimeClass::Scalar(_) - | RuntimeClass::Ref { .. } - | RuntimeClass::RawAddr { .. } => SlotRoot::Ptr( - { - let ptr_ty = self.fb.ptr_type(class_ty); - self.fb.insert_inst( - Alloca::new(self.module.inst_set(), class_ty), - ptr_ty, - ) - }, - class_ty, - ), - }; - self.slot_roots.insert(local_id, root); - } - } - } - - let params = self.body.signature.params.clone(); - for (idx, param) in params.iter().enumerate() { - let local = param.local; - let arg = self.body_signature_arg(idx)?; - if self.slot_roots.contains_key(&local) { - self.store_whole_local(local, arg)?; - } else if let Some(&var) = self.vars.get(&local) { - self.fb.def_var(var, arg); - } - } - Ok(()) - } - - fn body_signature_arg(&self, idx: usize) -> Result { - self.fb - .func - .arg_values - .get(idx) - .copied() - .ok_or_else(|| LowerError::Internal(format!("missing arg value {idx}"))) - } - - fn lower_stmt(&mut self, stmt: &RStmt<'db>) -> Result, LowerError> { - match stmt { - RStmt::Assign { dst, expr } => { - let Lowered::Value(value) = self.lower_expr(expr, Some(*dst))? else { - self.pending_enum_proof = None; - return Ok(Lowered::Terminated); - }; - self.assign_local(*dst, value)?; - self.pending_enum_proof = None; - } - RStmt::EnumAssertVariant { value, variant } => { - let materialized = self.local_value(*value)?; - self.fb.insert_inst_no_result(EnumAssertVariant::new( - self.module.inst_set(), - materialized, - self.variant_ref(*variant)?, - )); - self.pending_enum_proof = Some(PendingEnumProof { - local: *value, - variant: *variant, - value: materialized, - }); - } - RStmt::Store { dst, src } => { - let src = self.local_value(*src)?; - if matches!(self.store_to_place(dst, src)?, Lowered::Terminated) { - self.pending_enum_proof = None; - return Ok(Lowered::Terminated); - } - self.pending_enum_proof = None; - } - RStmt::CopyInto { dst, src } => { - if matches!(self.copy_into_place(dst, *src)?, Lowered::Terminated) { - self.pending_enum_proof = None; - return Ok(Lowered::Terminated); - } - self.pending_enum_proof = None; - } - RStmt::EnumSetTag { root, variant } => { - let object = self.local_value(*root)?; - self.fb.insert_inst_no_result(EnumSetTag::new( - self.module.inst_set(), - object, - self.variant_ref(*variant)?, - )); - self.pending_enum_proof = None; - } - RStmt::EnumWriteVariant { - root, - variant, - fields, - } => { - let object = self.local_value(*root)?; - let values = fields - .iter() - .map(|value| self.local_value(*value)) - .collect::, _>>()?; - self.fb.insert_inst_no_result(EnumWriteVariant::new( - self.module.inst_set(), - object, - self.variant_ref(*variant)?, - values, - )); - self.pending_enum_proof = None; - } - } - Ok(Lowered::Value(())) - } - - fn lower_expr( - &mut self, - expr: &RExpr<'db>, - dst: Option, - ) -> Result, LowerError> { - let value = match expr { - RExpr::Use(value) => self.local_value(*value)?, - RExpr::ConstScalar(value) => self.fb.make_imm_value( - self.module - .immediate_for_const(value, dst.and_then(|dst| self.body.value_class(dst)))?, - ), - RExpr::Placeholder { class } => { - zero_for_type(&mut self.fb, self.module.ty_for_class(class)?) - } - RExpr::Builtin(builtin) => { - let value = self.lower_builtin(builtin)?; - self.coerce_to_dst(value, dst)? - } - RExpr::Unary { op, value } => { - let value = self.local_value(*value)?; - let dst_class = dst - .and_then(|dst| self.body.value_class(dst).cloned()) - .ok_or_else(|| { - LowerError::Internal("unary expr missing destination class".to_string()) - })?; - self.lower_unary(*op, value, &dst_class)? - } - RExpr::Binary { op, lhs, rhs } => { - let lhs_class = self.body.value_class(*lhs).cloned().ok_or_else(|| { - LowerError::Internal("binary lhs missing runtime class".to_string()) - })?; - let lhs = self.local_value(*lhs)?; - let rhs = self.local_value(*rhs)?; - self.lower_binary(*op, lhs, rhs, &lhs_class)? - } - RExpr::Cast { value, to } => { - let signed = self - .body - .value_class(*value) - .is_some_and(RuntimeClass::is_signed_scalar); - let value = self.local_value(*value)?; - self.cast_scalar_with_signedness(value, scalar_ty(to), signed)? - } - RExpr::ConstRef { region, .. } => { - let gv = self.module.lower_const_region(*region)?; - let gv_ty = gv.ty(&self.fb.module_builder.ctx); - self.fb.insert_inst( - ConstRef::new(self.module.inst_set(), gv.into()), - self.fb.module_builder.constref_type(gv_ty), - ) - } - RExpr::AllocObject { layout } => { - let layout_ty = self.module.ty_for_layout(*layout)?; - self.fb.insert_inst( - ObjAlloc::new(self.module.inst_set(), layout_ty), - self.fb.module_builder.objref_type(layout_ty), - ) - } - RExpr::MaterializeToObject { src } => { - let src_value = self.local_value(*src)?; - let dst_local = dst.ok_or_else(|| { - LowerError::Internal("materialize-to-object missing destination".to_string()) - })?; - let class = self.body.value_class(dst_local).ok_or_else(|| { - LowerError::Internal( - "materialize-to-object missing destination class".to_string(), - ) - })?; - let RuntimeClass::Ref { - pointee, - kind: RefKind::Object, - .. - } = class - else { - return Err(LowerError::Internal( - "materialize-to-object destination is not an object ref".to_string(), - )); - }; - let RuntimeClass::AggregateValue { layout } = **pointee else { - return Err(LowerError::Internal( - "materialize-to-object destination is not aggregate-backed".to_string(), - )); - }; - let layout_ty = self.module.ty_for_layout(layout)?; - let object = self.fb.insert_inst( - ObjAlloc::new(self.module.inst_set(), layout_ty), - self.fb.module_builder.objref_type(layout_ty), - ); - let source = self.copy_source_for_local(*src, src_value)?; - self.copy_source_into_object( - source, - &RuntimeClass::AggregateValue { layout }, - object, - )?; - object - } - RExpr::MaterializePlaceToObject { place } => { - return self.materialize_place_to_object(place, dst); - } - RExpr::ProviderFromRaw { raw, space, .. } => { - let value = self.local_value(*raw)?; - if *space == AddressSpaceKind::Memory { - return Err(LowerError::Unsupported( - "memory provider reconstruction from raw addresses is not supported" - .to_string(), - )); - } - value - } - RExpr::WordToRawAddr { value, .. } => self.local_value(*value)?, - RExpr::ProviderToRaw { value } => self.local_value(*value)?, - RExpr::RetagRef { value } => self.local_value(*value)?, - RExpr::AddrOf { place } => return self.addr_of_place(place, dst), - RExpr::Load { place } => return self.load_from_place(place), - RExpr::AggregateExtract { value, index } => { - let value = self.local_value(*value)?; - let dst_local = dst.ok_or_else(|| { - LowerError::Internal("aggregate extract missing destination".to_string()) - })?; - let class = self.body.value_class(dst_local).cloned().ok_or_else(|| { - LowerError::Internal("aggregate extract missing destination class".to_string()) - })?; - self.extract_aggregate_field(value, *index as usize, &class)? - } - RExpr::AggregateMake { layout, fields } => { - self.make_aggregate_value(*layout, fields)? - } - RExpr::Call { callee, args } => { - if let Some(value) = self.lower_intrinsic_call(*callee, args, dst)? { - return Ok(Lowered::Value(value)); - } - let callee_ref = self.module.func_ref(*callee)?; - let args = args - .iter() - .map(|arg| self.local_value(*arg)) - .collect::, _>>()?; - let ret = callee.body(self.module.db).signature.ret.clone(); - match ret { - Some(class) => { - let ret_ty = self.module.ty_for_class(&class)?; - let value = self.fb.insert_inst( - Call::new(self.module.inst_set(), callee_ref, args), - ret_ty, - ); - self.coerce_to_dst(value, dst)? - } - None => { - self.fb.insert_inst_no_result(Call::new( - self.module.inst_set(), - callee_ref, - args, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - } - } - RExpr::EnumMake { - layout, - variant, - fields, - } => { - let values = fields - .iter() - .map(|field| self.local_value(*field)) - .collect::, _>>()?; - self.fb.insert_inst( - EnumMake::new( - self.module.inst_set(), - self.module.ty_for_layout(*layout)?, - self.variant_ref(*variant)?, - values, - ), - self.module.ty_for_layout(*layout)?, - ) - } - RExpr::EnumTagOfValue { value } => { - let enum_value = self.local_value(*value)?; - let ty = dst - .and_then(|dst| self.body.value_class(dst)) - .map(|class| self.module.ty_for_class(class)) - .transpose()? - .unwrap_or(Type::I256); - self.fb - .insert_inst(EnumTag::new(self.module.inst_set(), enum_value), ty) - } - RExpr::EnumIsVariant { value, variant } => { - let value = self.local_value(*value)?; - let variant = self.variant_ref(*variant)?; - self.fb.insert_inst( - EnumIsVariant::new(self.module.inst_set(), value, variant), - Type::I1, - ) - } - RExpr::EnumExtract { - value, - variant, - field, - } => { - let value = self - .pending_enum_proof - .and_then(|proof| { - (proof.local == *value && proof.variant == *variant).then_some(proof.value) - }) - .map(Ok) - .unwrap_or_else(|| self.local_value(*value))?; - let variant = self.variant_ref(*variant)?; - let field = self.index_value(field.0.into()); - let dst = dst.ok_or_else(|| { - LowerError::Internal("enum extract missing destination".to_string()) - })?; - let ty = self.local_ty(dst)?; - self.fb.insert_inst( - EnumExtract::new(self.module.inst_set(), value, variant, field), - ty, - ) - } - RExpr::EnumGetTag { root } => { - let root = self.local_value(*root)?; - let dst = dst.ok_or_else(|| { - LowerError::Internal("enum get-tag missing destination".to_string()) - })?; - let ty = self.local_ty(dst)?; - self.fb - .insert_inst(EnumGetTag::new(self.module.inst_set(), root), ty) - } - RExpr::EnumAssertVariantRef { root, variant } => { - let root = self.local_value(*root)?; - let variant = self.variant_ref(*variant)?; - let dst = dst.ok_or_else(|| { - LowerError::Internal("enum assert missing destination".to_string()) - })?; - let ty = self.local_ty(dst)?; - self.fb.insert_inst( - EnumAssertVariantRef::new(self.module.inst_set(), root, variant), - ty, - ) - } - }; - Ok(Lowered::Value(value)) - } - - fn lower_builtin(&mut self, builtin: &RuntimeBuiltin<'db>) -> Result { - Ok(match builtin { - RuntimeBuiltin::Mload { addr } => { - let addr = self.local_value(*addr)?; - self.fb.insert_inst( - Mload::new(self.module.inst_set(), addr, Type::I256), - Type::I256, - ) - } - RuntimeBuiltin::Mstore { addr, value } => { - let addr = self.local_value(*addr)?; - let value = self.local_value(*value)?; - self.fb.insert_inst_no_result(Mstore::new( - self.module.inst_set(), - addr, - value, - Type::I256, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::Mstore8 { addr, value } => { - let addr = self.local_value(*addr)?; - let value = self.local_value(*value)?; - let value = self.cast_scalar(value, Type::I8)?; - self.fb - .insert_inst_no_result(EvmMstore8::new(self.module.inst_set(), addr, value)); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::Mcopy { dst, src, len } => { - let dst = self.local_value(*dst)?; - let src = self.local_value(*src)?; - let len = self.local_value(*len)?; - self.fb - .insert_inst_no_result(EvmMcopy::new(self.module.inst_set(), dst, src, len)); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::Msize => self - .fb - .insert_inst(EvmMsize::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::Sload { slot } => { - let slot = self.local_value(*slot)?; - self.fb - .insert_inst(EvmSload::new(self.module.inst_set(), slot), Type::I256) - } - RuntimeBuiltin::Sstore { slot, value } => { - let slot = self.local_value(*slot)?; - let value = self.local_value(*value)?; - self.fb - .insert_inst_no_result(EvmSstore::new(self.module.inst_set(), slot, value)); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::CallValue => self - .fb - .insert_inst(EvmCallValue::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::ReturnDataSize => self - .fb - .insert_inst(EvmReturnDataSize::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::CallDataSize => self - .fb - .insert_inst(EvmCalldataSize::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::CallDataLoad { offset } => { - let offset = self.local_value(*offset)?; - self.fb.insert_inst( - EvmCalldataLoad::new(self.module.inst_set(), offset), - Type::I256, - ) - } - RuntimeBuiltin::ReturnDataCopy { dst, offset, len } => { - let dst = self.local_value(*dst)?; - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - self.fb.insert_inst_no_result(EvmReturnDataCopy::new( - self.module.inst_set(), - dst, - offset, - len, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::CallDataCopy { dst, offset, len } => { - let dst = self.local_value(*dst)?; - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - self.fb.insert_inst_no_result(EvmCalldataCopy::new( - self.module.inst_set(), - dst, - offset, - len, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::CodeSize => self - .fb - .insert_inst(EvmCodeSize::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::CodeCopy { dst, offset, len } => { - let dst = self.local_value(*dst)?; - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - self.fb.insert_inst_no_result(EvmCodeCopy::new( - self.module.inst_set(), - dst, - offset, - len, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::ExtCodeSize { addr } => { - let addr = self.local_value(*addr)?; - self.fb.insert_inst( - EvmExtCodeSize::new(self.module.inst_set(), addr), - Type::I256, - ) - } - RuntimeBuiltin::ExtCodeCopy { - addr, - dst, - offset, - len, - } => { - let addr = self.local_value(*addr)?; - let dst = self.local_value(*dst)?; - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - self.fb.insert_inst_no_result(EvmExtCodeCopy::new( - self.module.inst_set(), - addr, - dst, - offset, - len, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::ExtCodeHash { addr } => { - let addr = self.local_value(*addr)?; - self.fb.insert_inst( - EvmExtCodeHash::new(self.module.inst_set(), addr), - Type::I256, - ) - } - RuntimeBuiltin::Keccak256 { offset, len } => { - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - self.fb.insert_inst( - EvmKeccak256::new(self.module.inst_set(), offset, len), - Type::I256, - ) - } - RuntimeBuiltin::AddMod { lhs, rhs, modulus } => { - let lhs = self.local_value(*lhs)?; - let rhs = self.local_value(*rhs)?; - let modulus = self.local_value(*modulus)?; - self.fb.insert_inst( - EvmAddMod::new(self.module.inst_set(), lhs, rhs, modulus), - Type::I256, - ) - } - RuntimeBuiltin::MulMod { lhs, rhs, modulus } => { - let lhs = self.local_value(*lhs)?; - let rhs = self.local_value(*rhs)?; - let modulus = self.local_value(*modulus)?; - self.fb.insert_inst( - EvmMulMod::new(self.module.inst_set(), lhs, rhs, modulus), - Type::I256, - ) - } - RuntimeBuiltin::Byte { pos, value } => { - let pos = self.local_value(*pos)?; - let value = self.local_value(*value)?; - self.fb - .insert_inst(EvmByte::new(self.module.inst_set(), pos, value), Type::I256) - } - RuntimeBuiltin::SignExtend { byte, value } => { - let byte = self.local_value(*byte)?; - let value = self.local_value(*value)?; - self.fb.insert_inst( - EvmSignExtend::new(self.module.inst_set(), byte, value), - Type::I256, - ) - } - RuntimeBuiltin::IntrinsicArith { - op, - checked, - lhs, - rhs, - class, - } => self.lower_intrinsic_arith_builtin(*op, *checked, *lhs, *rhs, class)?, - RuntimeBuiltin::Saturating { - op, - lhs, - rhs, - class, - } => { - let lhs = self.local_value(*lhs)?; - let rhs = self.local_value(*rhs)?; - let lhs = self.cast_scalar(lhs, scalar_ty(class))?; - let rhs = self.cast_scalar(rhs, scalar_ty(class))?; - let signed = class.is_signed_int(); - match (op, signed) { - (SaturatingBinOp::Add, true) => self.fb.insert_saddsat(lhs, rhs), - (SaturatingBinOp::Add, false) => self.fb.insert_uaddsat(lhs, rhs), - (SaturatingBinOp::Sub, true) => self.fb.insert_ssubsat(lhs, rhs), - (SaturatingBinOp::Sub, false) => self.fb.insert_usubsat(lhs, rhs), - (SaturatingBinOp::Mul, true) => self.fb.insert_smulsat(lhs, rhs), - (SaturatingBinOp::Mul, false) => self.fb.insert_umulsat(lhs, rhs), - } - } - RuntimeBuiltin::Address => self - .fb - .insert_inst(EvmAddress::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::Caller => self - .fb - .insert_inst(EvmCaller::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::Origin => self - .fb - .insert_inst(EvmOrigin::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::GasPrice => self - .fb - .insert_inst(EvmGasPrice::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::CoinBase => self - .fb - .insert_inst(EvmCoinBase::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::Balance { addr } => { - let addr = self.local_value(*addr)?; - self.fb - .insert_inst(EvmBalance::new(self.module.inst_set(), addr), Type::I256) - } - RuntimeBuiltin::Timestamp => self - .fb - .insert_inst(EvmTimestamp::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::Number => self - .fb - .insert_inst(EvmNumber::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::PrevRandao => self - .fb - .insert_inst(EvmPrevRandao::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::GasLimit => self - .fb - .insert_inst(EvmGasLimit::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::ChainId => self - .fb - .insert_inst(EvmChainId::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::BaseFee => self - .fb - .insert_inst(EvmBaseFee::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::SelfBalance => self - .fb - .insert_inst(EvmSelfBalance::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::BlockHash { block } => { - let block = self.local_value(*block)?; - self.fb - .insert_inst(EvmBlockHash::new(self.module.inst_set(), block), Type::I256) - } - RuntimeBuiltin::BlobHash { index } => { - let index = self.local_value(*index)?; - self.fb - .insert_inst(EvmBlobHash::new(self.module.inst_set(), index), Type::I256) - } - RuntimeBuiltin::BlobBaseFee => self - .fb - .insert_inst(EvmBlobBaseFee::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::Gas => self - .fb - .insert_inst(EvmGas::new(self.module.inst_set()), Type::I256), - RuntimeBuiltin::CurrentCodeRegionLen => self.fb.insert_inst( - SymSize::new(self.module.inst_set(), SymbolRef::CurrentSection), - Type::I256, - ), - RuntimeBuiltin::CodeRegionOffset { region } => { - let symbol = self.code_region_symbol_ref(*region); - self.fb - .insert_inst(SymAddr::new(self.module.inst_set(), symbol), Type::I256) - } - RuntimeBuiltin::CodeRegionLen { region } => { - let symbol = self.code_region_symbol_ref(*region); - self.fb - .insert_inst(SymSize::new(self.module.inst_set(), symbol), Type::I256) - } - RuntimeBuiltin::Malloc { size } => { - let size = self.local_value(*size)?; - let ptr_ty = self.fb.ptr_type(Type::I8); - self.fb - .insert_inst(EvmMalloc::new(self.module.inst_set(), size), ptr_ty) - } - RuntimeBuiltin::Call { - gas, - addr, - value, - args_offset, - args_len, - ret_offset, - ret_len, - } => { - let gas = self.local_value(*gas)?; - let addr = self.local_value(*addr)?; - let value = self.local_value(*value)?; - let args_offset = self.local_value(*args_offset)?; - let args_len = self.local_value(*args_len)?; - let ret_offset = self.local_value(*ret_offset)?; - let ret_len = self.local_value(*ret_len)?; - self.fb.insert_inst( - EvmCall::new( - self.module.inst_set(), - gas, - addr, - value, - args_offset, - args_len, - ret_offset, - ret_len, - ), - Type::I256, - ) - } - RuntimeBuiltin::StaticCall { - gas, - addr, - args_offset, - args_len, - ret_offset, - ret_len, - } => { - let gas = self.local_value(*gas)?; - let addr = self.local_value(*addr)?; - let args_offset = self.local_value(*args_offset)?; - let args_len = self.local_value(*args_len)?; - let ret_offset = self.local_value(*ret_offset)?; - let ret_len = self.local_value(*ret_len)?; - self.fb.insert_inst( - EvmStaticCall::new( - self.module.inst_set(), - gas, - addr, - args_offset, - args_len, - ret_offset, - ret_len, - ), - Type::I256, - ) - } - RuntimeBuiltin::DelegateCall { - gas, - addr, - args_offset, - args_len, - ret_offset, - ret_len, - } => { - let gas = self.local_value(*gas)?; - let addr = self.local_value(*addr)?; - let args_offset = self.local_value(*args_offset)?; - let args_len = self.local_value(*args_len)?; - let ret_offset = self.local_value(*ret_offset)?; - let ret_len = self.local_value(*ret_len)?; - self.fb.insert_inst( - EvmDelegateCall::new( - self.module.inst_set(), - gas, - addr, - args_offset, - args_len, - ret_offset, - ret_len, - ), - Type::I256, - ) - } - RuntimeBuiltin::Create { value, offset, len } => { - let value = self.local_value(*value)?; - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - self.fb.insert_inst( - EvmCreate::new(self.module.inst_set(), value, offset, len), - Type::I256, - ) - } - RuntimeBuiltin::Create2 { - value, - offset, - len, - salt, - } => { - let value = self.local_value(*value)?; - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - let salt = self.local_value(*salt)?; - self.fb.insert_inst( - EvmCreate2::new(self.module.inst_set(), value, offset, len, salt), - Type::I256, - ) - } - RuntimeBuiltin::Log0 { offset, len } => { - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - self.fb - .insert_inst_no_result(EvmLog0::new(self.module.inst_set(), offset, len)); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::Log1 { - offset, - len, - topic0, - } => { - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - let topic0 = self.local_value(*topic0)?; - self.fb.insert_inst_no_result(EvmLog1::new( - self.module.inst_set(), - offset, - len, - topic0, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::Log2 { - offset, - len, - topic0, - topic1, - } => { - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - let topic0 = self.local_value(*topic0)?; - let topic1 = self.local_value(*topic1)?; - self.fb.insert_inst_no_result(EvmLog2::new( - self.module.inst_set(), - offset, - len, - topic0, - topic1, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::Log3 { - offset, - len, - topic0, - topic1, - topic2, - } => { - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - let topic0 = self.local_value(*topic0)?; - let topic1 = self.local_value(*topic1)?; - let topic2 = self.local_value(*topic2)?; - self.fb.insert_inst_no_result(EvmLog3::new( - self.module.inst_set(), - offset, - len, - topic0, - topic1, - topic2, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::Log4 { - offset, - len, - topic0, - topic1, - topic2, - topic3, - } => { - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - let topic0 = self.local_value(*topic0)?; - let topic1 = self.local_value(*topic1)?; - let topic2 = self.local_value(*topic2)?; - let topic3 = self.local_value(*topic3)?; - self.fb.insert_inst_no_result(EvmLog4::new( - self.module.inst_set(), - offset, - len, - topic0, - topic1, - topic2, - topic3, - )); - zero_for_type(&mut self.fb, Type::Unit) - } - RuntimeBuiltin::CallDataSelector => { - let zero = self.fb.make_imm_value(I256::zero()); - let word = self.fb.insert_inst( - EvmCalldataLoad::new(self.module.inst_set(), zero), - Type::I256, - ); - let shift = self.fb.make_imm_value(I256::from(224u64)); - self.fb - .insert_inst(Shr::new(self.module.inst_set(), shift, word), Type::I256) - } - RuntimeBuiltin::MakeContractFieldRef { slot, class, .. } => { - match class { - RuntimeClass::Ref { - pointee, - kind: - RefKind::Provider { - space: AddressSpaceKind::Memory, - .. - }, - .. - } => { - // Init-time immutable contract fields are represented as memory-backed - // providers, which lower to object references in Sonatina. Allocate a - // fresh object for the field and let the init wrapper serialize its - // final contents into the returned runtime bytecode. - let pointee_ty = self.module.ty_for_class(pointee)?; - let objref_ty = self.fb.module_builder.objref_type(pointee_ty); - self.fb.insert_inst( - ObjAlloc::new(self.module.inst_set(), pointee_ty), - objref_ty, - ) - } - RuntimeClass::Ref { - kind: - RefKind::Provider { - space: AddressSpaceKind::Code, - .. - }, - .. - } => { - // Code-backed contract fields are stored in a tail data section appended - // to the deployed runtime bytecode, so the runtime absolute offset is - // `codesize + slot`. - let mir::ContractFieldSlot::CodeTailBytes(tail_offset) = slot else { - return Err(LowerError::Internal(format!( - "code-backed contract field ref should carry a code-tail slot, got {slot}" - ))); - }; - let code_size = self - .fb - .insert_inst(EvmCodeSize::new(self.module.inst_set()), Type::I256); - let offset = self.fb.make_imm_value(I256::from(*tail_offset)); - self.fb.insert_inst( - Add::new(self.module.inst_set(), code_size, offset), - Type::I256, - ) - } - _ => { - let mir::ContractFieldSlot::Words(words) = slot else { - return Err(LowerError::Internal(format!( - "contract field ref should carry a word slot, got {slot}" - ))); - }; - self.fb.make_imm_value(I256::from(*words)) - } - } - } - }) - } - - fn code_region_symbol_ref(&mut self, region: mir::RuntimeCodeRegion<'db>) -> SymbolRef { - self.module.mark_explicit_code_region(region); - if !self.current_sections.is_empty() - && self - .module - .package - .code_regions(self.module.db) - .iter() - .find(|resolved| resolved.region(self.module.db) == region) - .is_some_and(|resolved| { - self.current_sections.iter().all(|current_section| { - runtime_section_refs_match( - self.module.db, - &resolved.source(self.module.db), - current_section, - ) - }) - }) - { - SymbolRef::CurrentSection - } else { - SymbolRef::Embed(EmbedSymbol::from(code_region_symbol( - self.module.db, - self.module.package, - region, - ))) - } - } - - fn lower_intrinsic_call( - &mut self, - callee: mir::RuntimeInstance<'db>, - args: &[RLocalId], - dst: Option, - ) -> Result, LowerError> { - let Some(intrinsic) = runtime_intrinsic(self.module.db, callee) else { - return Ok(None); - }; - let value = match intrinsic { - RuntimeIntrinsic::Alloc => { - let [size] = args else { - return Err(LowerError::Internal( - "alloc requires 1 argument".to_string(), - )); - }; - let size = self.local_value(*size)?; - let ptr_ty = self.fb.ptr_type(Type::I8); - self.fb - .insert_inst(EvmMalloc::new(self.module.inst_set(), size), ptr_ty) - } - RuntimeIntrinsic::GenericSaturating { op, ty } => { - let prim = intrinsic_prim_from_ty(self.module.db, ty)?; - let op_ty = intrinsic_value_type(prim); - let signed = prim.is_signed_int(); - let (lhs, rhs) = intrinsic_binary_args(self, args)?; - let lhs = - lower_intrinsic_operand(&mut self.fb, self.module.inst_set(), lhs, prim, op_ty); - let rhs = - lower_intrinsic_operand(&mut self.fb, self.module.inst_set(), rhs, prim, op_ty); - match (op, signed) { - (GenericSaturatingOp::Add, true) => self.fb.insert_saddsat(lhs, rhs), - (GenericSaturatingOp::Add, false) => self.fb.insert_uaddsat(lhs, rhs), - (GenericSaturatingOp::Sub, true) => self.fb.insert_ssubsat(lhs, rhs), - (GenericSaturatingOp::Sub, false) => self.fb.insert_usubsat(lhs, rhs), - (GenericSaturatingOp::Mul, true) => self.fb.insert_smulsat(lhs, rhs), - (GenericSaturatingOp::Mul, false) => self.fb.insert_umulsat(lhs, rhs), - } - } - RuntimeIntrinsic::Numeric { op, prim } => { - self.lower_numeric_intrinsic_call(op, prim, args)? - } - }; - Ok(Some(self.coerce_to_dst(value, dst)?)) - } - - fn lower_numeric_intrinsic_call( - &mut self, - op: NumericIntrinsicOp, - prim: PrimTy, - args: &[RLocalId], - ) -> Result { - let op_ty = intrinsic_value_type(prim); - let signed = prim.is_signed_int(); - Ok(match op { - NumericIntrinsicOp::Eq - | NumericIntrinsicOp::Ne - | NumericIntrinsicOp::Lt - | NumericIntrinsicOp::Le - | NumericIntrinsicOp::Gt - | NumericIntrinsicOp::Ge => { - let (lhs, rhs) = intrinsic_binary_args(self, args)?; - let lhs = - lower_intrinsic_operand(&mut self.fb, self.module.inst_set(), lhs, prim, op_ty); - let rhs = - lower_intrinsic_operand(&mut self.fb, self.module.inst_set(), rhs, prim, op_ty); - match op { - NumericIntrinsicOp::Eq => self - .fb - .insert_inst(Eq::new(self.module.inst_set(), lhs, rhs), Type::I1), - NumericIntrinsicOp::Ne => { - let eq = self - .fb - .insert_inst(Eq::new(self.module.inst_set(), lhs, rhs), Type::I1); - self.fb - .insert_inst(IsZero::new(self.module.inst_set(), eq), Type::I1) - } - NumericIntrinsicOp::Lt => { - if signed { - self.fb - .insert_inst(Slt::new(self.module.inst_set(), lhs, rhs), Type::I1) - } else { - self.fb - .insert_inst(Lt::new(self.module.inst_set(), lhs, rhs), Type::I1) - } - } - NumericIntrinsicOp::Le => { - let gt = if signed { - self.fb - .insert_inst(Slt::new(self.module.inst_set(), rhs, lhs), Type::I1) - } else { - self.fb - .insert_inst(Gt::new(self.module.inst_set(), lhs, rhs), Type::I1) - }; - self.fb - .insert_inst(IsZero::new(self.module.inst_set(), gt), Type::I1) - } - NumericIntrinsicOp::Gt => { - if signed { - self.fb - .insert_inst(Slt::new(self.module.inst_set(), rhs, lhs), Type::I1) - } else { - self.fb - .insert_inst(Gt::new(self.module.inst_set(), lhs, rhs), Type::I1) - } - } - NumericIntrinsicOp::Ge => { - let lt = if signed { - self.fb - .insert_inst(Slt::new(self.module.inst_set(), lhs, rhs), Type::I1) - } else { - self.fb - .insert_inst(Lt::new(self.module.inst_set(), lhs, rhs), Type::I1) - }; - self.fb - .insert_inst(IsZero::new(self.module.inst_set(), lt), Type::I1) - } - _ => unreachable!(), - } - } - NumericIntrinsicOp::Add - | NumericIntrinsicOp::Sub - | NumericIntrinsicOp::Mul - | NumericIntrinsicOp::Pow - | NumericIntrinsicOp::Shl - | NumericIntrinsicOp::Shr - | NumericIntrinsicOp::BitAnd - | NumericIntrinsicOp::BitOr - | NumericIntrinsicOp::BitXor - | NumericIntrinsicOp::Div - | NumericIntrinsicOp::Rem => { - let (lhs, rhs) = intrinsic_binary_args(self, args)?; - let lhs = - lower_intrinsic_operand(&mut self.fb, self.module.inst_set(), lhs, prim, op_ty); - let rhs = - lower_intrinsic_operand(&mut self.fb, self.module.inst_set(), rhs, prim, op_ty); - match op { - NumericIntrinsicOp::Add => self - .fb - .insert_inst(Add::new(self.module.inst_set(), lhs, rhs), op_ty), - NumericIntrinsicOp::Sub => self - .fb - .insert_inst(Sub::new(self.module.inst_set(), lhs, rhs), op_ty), - NumericIntrinsicOp::Mul => self - .fb - .insert_inst(Mul::new(self.module.inst_set(), lhs, rhs), op_ty), - NumericIntrinsicOp::Pow => self - .fb - .insert_inst(EvmExp::new(self.module.inst_set(), lhs, rhs), op_ty), - NumericIntrinsicOp::Shl => self - .fb - .insert_inst(Shl::new(self.module.inst_set(), rhs, lhs), op_ty), - NumericIntrinsicOp::Shr => { - if signed { - self.fb - .insert_inst(Sar::new(self.module.inst_set(), rhs, lhs), op_ty) - } else { - self.fb - .insert_inst(Shr::new(self.module.inst_set(), rhs, lhs), op_ty) - } - } - NumericIntrinsicOp::BitAnd => self - .fb - .insert_inst(And::new(self.module.inst_set(), lhs, rhs), op_ty), - NumericIntrinsicOp::BitOr => self - .fb - .insert_inst(Or::new(self.module.inst_set(), lhs, rhs), op_ty), - NumericIntrinsicOp::BitXor => self - .fb - .insert_inst(Xor::new(self.module.inst_set(), lhs, rhs), op_ty), - NumericIntrinsicOp::Div => { - let [raw, _overflow] = if signed { - self.fb.insert_evm_sdivo(lhs, rhs) - } else { - self.fb.insert_evm_udivo(lhs, rhs) - }; - raw - } - NumericIntrinsicOp::Rem => { - let [raw, _overflow] = if signed { - self.fb.insert_evm_smodo(lhs, rhs) - } else { - self.fb.insert_evm_umodo(lhs, rhs) - }; - raw - } - _ => unreachable!(), - } - } - NumericIntrinsicOp::BitNot | NumericIntrinsicOp::Not | NumericIntrinsicOp::Neg => { - let value = intrinsic_unary_arg(self, args)?; - let value = lower_intrinsic_operand( - &mut self.fb, - self.module.inst_set(), - value, - prim, - op_ty, - ); - match op { - NumericIntrinsicOp::BitNot => self - .fb - .insert_inst(Not::new(self.module.inst_set(), value), op_ty), - NumericIntrinsicOp::Not => self - .fb - .insert_inst(IsZero::new(self.module.inst_set(), value), Type::I1), - NumericIntrinsicOp::Neg => self - .fb - .insert_inst(Neg::new(self.module.inst_set(), value), op_ty), - _ => unreachable!(), - } - } - }) - } - - fn lower_terminator(&mut self, terminator: &RTerminator<'db>) -> Result<(), LowerError> { - match terminator { - RTerminator::Goto(block) => { - self.fb.insert_inst_no_result(Jump::new( - self.module.inst_set(), - self.block_id(*block)?, - )); - } - RTerminator::Branch { - cond, - then_bb, - else_bb, - } => { - let cond = self.local_value(*cond)?; - let cond = condition_to_i1(&mut self.fb, cond, self.module.inst_set()); - self.fb.insert_inst_no_result(Br::new( - self.module.inst_set(), - cond, - self.block_id(*then_bb)?, - self.block_id(*else_bb)?, - )); - } - RTerminator::SwitchScalar { - discr, - cases, - default, - } => { - let discr = self.local_value(*discr)?; - let table = cases - .iter() - .map(|(value, block)| { - Ok(( - self.fb - .make_imm_value(self.module.immediate_for_const(value, None)?), - self.block_id(*block)?, - )) - }) - .collect::, LowerError>>()?; - self.fb.insert_inst_no_result(BrTable::new( - self.module.inst_set(), - discr, - Some(self.block_id(*default)?), - table, - )); - } - RTerminator::MatchEnumTag { cases, default, .. } => { - let (tag, enum_layout) = match terminator { - RTerminator::MatchEnumTag { - tag, enum_layout, .. - } => (self.local_value(*tag)?, *enum_layout), - _ => unreachable!(), - }; - let table = cases - .iter() - .map(|(variant, block)| { - Ok(( - self.fb.make_imm_value( - self.module.enum_tag_immediate(enum_layout, variant.index)?, - ), - self.block_id(*block)?, - )) - }) - .collect::, LowerError>>()?; - self.fb.insert_inst_no_result(BrTable::new( - self.module.inst_set(), - tag, - default.map(|block| self.block_id(block)).transpose()?, - table, - )); - } - RTerminator::TerminalCall { callee, args } => { - let args = args - .iter() - .map(|arg| self.local_value(*arg)) - .collect::, _>>()?; - self.fb.insert_inst_no_result(Call::new( - self.module.inst_set(), - self.module.func_ref(*callee)?, - args, - )); - self.fb - .insert_inst_no_result(Unreachable::new_unchecked(self.module.inst_set())); - } - RTerminator::ReturnData { offset, len } => { - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - self.fb - .insert_inst_no_result(EvmReturn::new(self.module.inst_set(), offset, len)); - } - RTerminator::Revert { offset, len } => { - let offset = self.local_value(*offset)?; - let len = self.local_value(*len)?; - self.fb - .insert_inst_no_result(EvmRevert::new(self.module.inst_set(), offset, len)); - } - RTerminator::SelfDestruct { beneficiary } => { - let beneficiary = self.local_value(*beneficiary)?; - self.fb.insert_inst_no_result(EvmSelfDestruct::new( - self.module.inst_set(), - beneficiary, - )); - } - RTerminator::Trap => { - self.fb - .insert_inst_no_result(EvmInvalid::new(self.module.inst_set())); - } - RTerminator::Return(value) => match value { - Some(value) => { - let value = self.local_value(*value)?; - self.fb - .insert_inst_no_result(Return::new_single(self.module.inst_set(), value)) - } - None => self - .fb - .insert_inst_no_result(Return::new_unit(self.module.inst_set())), - }, - RTerminator::Stop => { - self.fb - .insert_inst_no_result(EvmStop::new(self.module.inst_set())); - } - } - Ok(()) - } - - fn assign_local(&mut self, local: RLocalId, value: ValueId) -> Result<(), LowerError> { - if self.slot_roots.contains_key(&local) { - self.store_whole_local(local, value) - } else if let Some(&var) = self.vars.get(&local) { - let var_ty = self - .body - .value_class(local) - .map(|class| self.module.ty_for_class(class)) - .transpose()? - .ok_or_else(|| { - LowerError::Internal(format!("missing runtime class for {local:?}")) - })?; - let value = self.coerce_value_to_ty(value, var_ty)?; - self.fb.def_var(var, value); - Ok(()) - } else { - Ok(()) - } - } - - fn store_whole_local(&mut self, local: RLocalId, value: ValueId) -> Result<(), LowerError> { - match self.slot_roots.get(&local).copied() { - Some(SlotRoot::Ptr(ptr, ty)) => { - let value = self.coerce_value_to_ty(value, ty)?; - self.fb - .insert_inst_no_result(Mstore::new(self.module.inst_set(), ptr, value, ty)); - Ok(()) - } - Some(SlotRoot::Object(object, _)) => { - let class = self.body.value_class(local).cloned().ok_or_else(|| { - LowerError::Internal(format!("missing runtime class for {local:?}")) - })?; - self.copy_source_into_object( - CopySource::Value { - value, - class: class.clone(), - }, - &class, - object, - ) - } - None => Err(LowerError::Internal(format!( - "missing slot root for {local:?}" - ))), - } - } - - fn local_value(&mut self, local: RLocalId) -> Result { - if let Some(root) = self.slot_roots.get(&local) { - return match root { - SlotRoot::Ptr(ptr, ty) => Ok(self - .fb - .insert_inst(Mload::new(self.module.inst_set(), *ptr, *ty), *ty)), - SlotRoot::Object(object, ty) => Ok(self - .fb - .insert_inst(ObjLoad::new(self.module.inst_set(), *object), *ty)), - }; - } - let var = self - .vars - .get(&local) - .copied() - .ok_or_else(|| LowerError::Internal(format!("missing variable for {local:?}")))?; - Ok(self.fb.use_var(var)) - } - - fn local_ty(&mut self, local: RLocalId) -> Result { - let class = self - .body - .value_class(local) - .ok_or_else(|| LowerError::Internal(format!("erased local {local:?} has no type")))?; - self.module.ty_for_class(class) - } - - fn place_terminal_for_carrier( - &mut self, - value: RLocalId, - carrier_class: RuntimeClass<'db>, - class: RuntimeClass<'db>, - allow_value_carrier: bool, - root_kind: &str, - ) -> Result, LowerError> { - match carrier_class { - RuntimeClass::Ref { - kind: RefKind::Const, - .. - } => Ok(PlaceTerminal::Const { - value: self.local_value(value)?, - class, - }), - RuntimeClass::Ref { - kind: RefKind::Object, - .. - } - | RuntimeClass::Ref { - kind: - RefKind::Provider { - space: AddressSpaceKind::Memory, - .. - }, - .. - } => Ok(PlaceTerminal::Object { - value: self.local_value(value)?, - class, - }), - RuntimeClass::Ref { - kind: RefKind::Provider { space, .. }, - .. - } => Ok(PlaceTerminal::Ptr { - addr: self.local_value(value)?, - space, - class, - }), - RuntimeClass::AggregateValue { .. } if allow_value_carrier => { - Ok(PlaceTerminal::Object { - value: self.local_value(value)?, - class, - }) - } - RuntimeClass::RawAddr { space, .. } if allow_value_carrier => Ok(PlaceTerminal::Ptr { - addr: self.local_value(value)?, - space, - class, - }), - RuntimeClass::Scalar(_) - | RuntimeClass::AggregateValue { .. } - | RuntimeClass::RawAddr { .. } => Err(LowerError::Internal(format!( - "{root_kind} root did not lower to a supported place carrier" - ))), - } - } - - fn place_terminal_from_loaded_carrier( - &mut self, - value: ValueId, - carrier_class: &RuntimeClass<'db>, - ) -> Result, LowerError> { - match carrier_class { - RuntimeClass::Ref { - kind: RefKind::Const, - pointee, - .. - } => { - let RuntimeClass::AggregateValue { .. } = &**pointee else { - return Err(LowerError::Internal( - "const carrier follow requires aggregate pointee".to_string(), - )); - }; - Ok(PlaceTerminal::Const { - value, - class: (**pointee).clone(), - }) - } - RuntimeClass::Ref { - kind: RefKind::Object, - pointee, - .. - } - | RuntimeClass::Ref { - kind: - RefKind::Provider { - space: AddressSpaceKind::Memory, - .. - }, - pointee, - .. - } => Ok(PlaceTerminal::Object { - value, - class: (**pointee).clone(), - }), - RuntimeClass::Ref { - kind: RefKind::Provider { space, .. }, - pointee, - .. - } => Ok(PlaceTerminal::Ptr { - addr: value, - space: *space, - class: (**pointee).clone(), - }), - RuntimeClass::RawAddr { - space, - target: Some(layout), - } => Ok(PlaceTerminal::Ptr { - addr: value, - space: *space, - class: RuntimeClass::AggregateValue { layout: *layout }, - }), - RuntimeClass::RawAddr { target: None, .. } => Err(LowerError::Unsupported( - "cannot continue projection through an opaque raw-address carrier".to_string(), - )), - RuntimeClass::Scalar(_) | RuntimeClass::AggregateValue { .. } => { - Err(LowerError::Internal( - "attempted to follow a non-carrier projected field".to_string(), - )) - } - } - } - - fn load_terminal_value( - &mut self, - terminal: &PlaceTerminal<'db>, - class: &RuntimeClass<'db>, - ) -> Result { - match terminal { - PlaceTerminal::Object { value, .. } => Ok(self.fb.insert_inst( - ObjLoad::new(self.module.inst_set(), *value), - self.module.ty_for_class(class)?, - )), - PlaceTerminal::Const { value, .. } => Ok(self.fb.insert_inst( - ConstLoad::new(self.module.inst_set(), *value), - self.module.ty_for_class(class)?, - )), - PlaceTerminal::Ptr { addr, space, .. } => self.load_from_ptr(*addr, *space, class), - } - } - - fn resolve_place( - &mut self, - place: &RuntimePlace<'db>, - ) -> Result>, LowerError> { - let program = self.module.db as &dyn mir::MirDb; - let resolved = resolve_runtime_place(self.module.db, &program, &self.body, place) - .map_err(|err| LowerError::Internal(format!("invalid runtime place: {err:?}")))?; - let mut terminal = match resolved.root_kind { - ResolvedPlaceRootKind::Slot { local, class } => { - match self.slot_roots.get(&local).ok_or_else(|| { - LowerError::Internal(format!("missing slot root for {local:?}")) - })? { - SlotRoot::Ptr(ptr, _) => PlaceTerminal::Ptr { - addr: *ptr, - space: AddressSpaceKind::Memory, - class, - }, - SlotRoot::Object(value, _) => PlaceTerminal::Object { - value: *value, - class, - }, - } - } - ResolvedPlaceRootKind::Ref { value, class } => self.place_terminal_for_carrier( - value, - self.body - .value_class(value) - .cloned() - .ok_or_else(|| LowerError::Internal(format!("erased handle root {value:?}")))?, - class, - false, - "ref", - )?, - ResolvedPlaceRootKind::Provider { - value, - provider_class, - class, - .. - } => self.place_terminal_for_carrier(value, provider_class, class, true, "provider")?, - ResolvedPlaceRootKind::Ptr { addr, space, class } => PlaceTerminal::Ptr { - addr: self.local_value(addr)?, - space, - class, - }, - }; - - for elem in resolved.path.iter() { - terminal = match (terminal, elem) { - ( - PlaceTerminal::Object { value, .. }, - ResolvedPlaceElem::Field { field, class }, - ) => { - let idx = self.index_value(field.0.into()); - PlaceTerminal::Object { - value: self.fb.insert_inst( - ObjProj::new(self.module.inst_set(), smallvec![value, idx]), - self.module.ty_for_object_projection(class)?, - ), - class: class.clone(), - } - } - ( - PlaceTerminal::Object { - value, - class: base_class, - }, - ResolvedPlaceElem::Index { index, class }, - ) => { - let Lowered::Value(index) = self.checked_index_value(&base_class, index)? - else { - return Ok(Lowered::Terminated); - }; - PlaceTerminal::Object { - value: self.fb.insert_inst( - ObjIndex::new(self.module.inst_set(), value, index), - self.module.ty_for_object_projection(class)?, - ), - class: class.clone(), - } - } - ( - PlaceTerminal::Object { value, .. }, - ResolvedPlaceElem::VariantField { - variant, - field, - class, - }, - ) => { - let variant_ref = self.variant_ref(*variant)?; - let field = self.index_value(field.0.into()); - let value = self.fb.insert_inst( - EnumAssertVariantRef::new(self.module.inst_set(), value, variant_ref), - self.fb.type_of(value), - ); - PlaceTerminal::Object { - value: self.fb.insert_inst( - EnumProj::new(self.module.inst_set(), value, variant_ref, field), - self.module.ty_for_object_projection(class)?, - ), - class: class.clone(), - } - } - (PlaceTerminal::Const { value, .. }, ResolvedPlaceElem::Field { field, class }) => { - let idx = self.index_value(field.0.into()); - PlaceTerminal::Const { - value: self.fb.insert_inst( - ConstProj::new(self.module.inst_set(), smallvec![value, idx]), - self.module.ty_for_const_projection(class)?, - ), - class: class.clone(), - } - } - ( - PlaceTerminal::Const { - value, - class: base_class, - }, - ResolvedPlaceElem::Index { index, class }, - ) => { - let Lowered::Value(index) = self.checked_index_value(&base_class, index)? - else { - return Ok(Lowered::Terminated); - }; - PlaceTerminal::Const { - value: self.fb.insert_inst( - ConstIndex::new(self.module.inst_set(), value, index), - self.module.ty_for_const_projection(class)?, - ), - class: class.clone(), - } - } - ( - PlaceTerminal::Ptr { - addr, - space, - class: base_class, - }, - ResolvedPlaceElem::Field { field, class }, - ) => { - let offset = base_class - .field_offset_words(self.module.db, *field) - .ok_or_else(|| { - LowerError::Internal("field projection on non-struct class".to_string()) - })?; - PlaceTerminal::Ptr { - addr: self.offset_address(addr, offset, space)?, - space, - class: class.clone(), - } - } - ( - PlaceTerminal::Ptr { - addr, - space, - class: base_class, - }, - ResolvedPlaceElem::Index { index, class }, - ) => { - let span = base_class - .index_stride_words(self.module.db) - .ok_or_else(|| { - LowerError::Internal("index projection on non-array class".to_string()) - })?; - let Lowered::Value(idx) = self.checked_index_value(&base_class, index)? else { - return Ok(Lowered::Terminated); - }; - let scale = self.scale_for_space(space, span); - let scaled = if scale == 1 { - idx - } else { - let scale = self.index_value(scale); - self.fb - .insert_inst(Mul::new(self.module.inst_set(), idx, scale), Type::I256) - }; - PlaceTerminal::Ptr { - addr: self.fb.insert_inst( - Add::new(self.module.inst_set(), addr, scaled), - Type::I256, - ), - space, - class: class.clone(), - } - } - ( - PlaceTerminal::Ptr { addr, space, .. }, - ResolvedPlaceElem::VariantField { - variant, - field, - class, - }, - ) => PlaceTerminal::Ptr { - addr: self.offset_address( - addr, - variant - .field_offset_words(self.module.db, *field) - .ok_or_else(|| { - LowerError::Internal("variant field layout missing".to_string()) - })?, - space, - )?, - space, - class: class.clone(), - }, - (terminal, ResolvedPlaceElem::Deref { carrier_class, .. }) => { - let value = self.load_terminal_value(&terminal, carrier_class)?; - self.place_terminal_from_loaded_carrier(value, carrier_class)? - } - (terminal, elem) => { - return Err(LowerError::Unsupported(format!( - "unsupported place projection terminal `{terminal_kind}` with `{elem:?}`", - terminal_kind = match terminal { - PlaceTerminal::Ptr { .. } => "ptr", - PlaceTerminal::Object { .. } => "object", - PlaceTerminal::Const { .. } => "const", - } - ))); - } - }; - } - Ok(Lowered::Value(terminal)) - } - - fn load_from_place( - &mut self, - place: &RuntimePlace<'db>, - ) -> Result, LowerError> { - let program = self.module.db as &dyn mir::MirDb; - let class = resolve_runtime_place(self.module.db, &program, &self.body, place) - .map_err(|err| LowerError::Internal(format!("invalid runtime place: {err:?}")))? - .result_class; - let Lowered::Value(terminal) = self.resolve_place(place)? else { - return Ok(Lowered::Terminated); - }; - Ok(Lowered::Value(match terminal { - PlaceTerminal::Object { value, .. } => self.fb.insert_inst( - ObjLoad::new(self.module.inst_set(), value), - self.module.ty_for_class(&class)?, - ), - PlaceTerminal::Const { value, class } if class.aggregate_layout().is_some() => { - let layout = class.aggregate_layout().expect("const aggregate layout"); - let layout_ty = self.module.ty_for_layout(layout)?; - let object = self.fb.insert_inst( - ObjAlloc::new(self.module.inst_set(), layout_ty), - self.fb.module_builder.objref_type(layout_ty), - ); - self.copy_source_into_object( - CopySource::Const { - value, - class: class.clone(), - }, - &class, - object, - )?; - self.fb.insert_inst( - ObjLoad::new(self.module.inst_set(), object), - self.module.ty_for_class(&class)?, - ) - } - PlaceTerminal::Const { value, .. } => self.fb.insert_inst( - ConstLoad::new(self.module.inst_set(), value), - self.module.ty_for_class(&class)?, - ), - PlaceTerminal::Ptr { addr, space, class } => self.load_from_ptr(addr, space, &class)?, - })) - } - - fn materialize_place_to_object( - &mut self, - place: &RuntimePlace<'db>, - dst: Option, - ) -> Result, LowerError> { - let dst_local = dst.ok_or_else(|| { - LowerError::Internal("materialize-place-to-object missing destination".to_string()) - })?; - let class = self.body.value_class(dst_local).ok_or_else(|| { - LowerError::Internal( - "materialize-place-to-object missing destination class".to_string(), - ) - })?; - let RuntimeClass::Ref { - pointee, - kind: RefKind::Object, - .. - } = class - else { - return Err(LowerError::Internal( - "materialize-place-to-object destination is not an object ref".to_string(), - )); - }; - let RuntimeClass::AggregateValue { layout } = **pointee else { - return Err(LowerError::Internal( - "materialize-place-to-object destination is not aggregate-backed".to_string(), - )); - }; - let layout_ty = self.module.ty_for_layout(layout)?; - let object = self.fb.insert_inst( - ObjAlloc::new(self.module.inst_set(), layout_ty), - self.fb.module_builder.objref_type(layout_ty), - ); - let Lowered::Value(terminal) = self.resolve_place(place)? else { - return Ok(Lowered::Terminated); - }; - let source = self.copy_source_for_terminal(terminal); - self.copy_source_into_object(source, &RuntimeClass::AggregateValue { layout }, object)?; - Ok(Lowered::Value(object)) - } - - fn copy_source_for_local( - &self, - local: RLocalId, - value: ValueId, - ) -> Result, LowerError> { - let class = self.body.value_class(local).cloned().ok_or_else(|| { - LowerError::Internal(format!("missing runtime class for local {local:?}")) - })?; - Ok(match class { - RuntimeClass::Ref { - pointee, - kind: RefKind::Object, - .. - } => CopySource::Object { - value, - class: *pointee, - }, - RuntimeClass::Ref { - pointee, - kind: RefKind::Const, - .. - } => CopySource::Const { - value, - class: *pointee, - }, - RuntimeClass::RawAddr { space, .. } => CopySource::Ptr { - addr: value, - space, - class, - }, - _ => CopySource::Value { value, class }, - }) - } - - fn copy_source_for_terminal(&self, terminal: PlaceTerminal<'db>) -> CopySource<'db> { - match terminal { - PlaceTerminal::Object { value, class } => CopySource::Object { value, class }, - PlaceTerminal::Const { value, class } => CopySource::Const { value, class }, - PlaceTerminal::Ptr { addr, space, class } => CopySource::Ptr { addr, space, class }, - } - } - - fn copy_source_into_object( - &mut self, - source: CopySource<'db>, - class: &RuntimeClass<'db>, - object: ValueId, - ) -> Result<(), LowerError> { - if let CopySource::Const { - value, - class: source_class, - } = &source - && source_class == class - && matches!(class, RuntimeClass::AggregateValue { .. }) - { - let class_ty = self.module.ty_for_class(class)?; - let object_ty = self.fb.module_builder.objref_type(class_ty); - let const_ty = self.fb.module_builder.constref_type(class_ty); - if self.fb.type_of(object) != object_ty || self.fb.type_of(*value) != const_ty { - return Err(LowerError::Internal(format!( - "const object copy type mismatch: object={:?} const={:?} class={class:?}", - self.fb.type_of(object), - self.fb.type_of(*value), - ))); - } - self.fb.insert_inst_no_result(ObjInitConst::new( - self.module.inst_set(), - object, - *value, - )); - return Ok(()); - } - - if !matches!(class, RuntimeClass::AggregateValue { .. }) { - let value = self.load_copy_source_leaf(&source, class)?; - self.fb - .insert_inst_no_result(ObjStore::new(self.module.inst_set(), object, value)); - return Ok(()); - } - - self.copy_aggregate_source_into_object(source, class, object) - } - - fn load_copy_source_leaf( - &mut self, - source: &CopySource<'db>, - class: &RuntimeClass<'db>, - ) -> Result { - Ok(match source { - CopySource::Value { - value, - class: source_class, - } => { - if matches!(source_class, RuntimeClass::AggregateValue { .. }) { - return Err(LowerError::Internal(format!( - "leaf copy source must not stay aggregate-valued: source={source_class:?} target={class:?}", - ))); - } - let ty = self.module.ty_for_class(class)?; - self.coerce_value_to_ty(*value, ty)? - } - CopySource::Object { - value, - class: source_class, - } => { - if matches!(source_class, RuntimeClass::AggregateValue { .. }) { - return Err(LowerError::Internal(format!( - "leaf object copy source must not stay aggregate-valued: source={source_class:?} target={class:?}", - ))); - } - self.fb.insert_inst( - ObjLoad::new(self.module.inst_set(), *value), - self.module.ty_for_class(class)?, - ) - } - CopySource::Const { value, .. } => self.fb.insert_inst( - ConstLoad::new(self.module.inst_set(), *value), - self.module.ty_for_class(class)?, - ), - CopySource::Ptr { - addr, - space, - class: source_class, - } => { - if matches!(source_class, RuntimeClass::AggregateValue { .. }) { - return Err(LowerError::Internal(format!( - "leaf ptr copy source must not stay aggregate-valued: source={source_class:?} target={class:?}", - ))); - } - self.load_from_ptr(*addr, *space, class)? - } - }) - } - - fn copy_source_class<'b>(&self, source: &'b CopySource<'db>) -> &'b RuntimeClass<'db> { - match source { - CopySource::Value { class, .. } - | CopySource::Object { class, .. } - | CopySource::Const { class, .. } - | CopySource::Ptr { class, .. } => class, - } - } - - fn copy_aggregate_source_into_object( - &mut self, - source: CopySource<'db>, - class: &RuntimeClass<'db>, - object: ValueId, - ) -> Result<(), LowerError> { - let RuntimeClass::AggregateValue { layout } = class else { - return Err(LowerError::Internal( - "aggregate source copy requires aggregate class".to_string(), - )); - }; - match layout.data(self.module.db) { - Layout::Struct(data) => { - for (idx, field) in data.fields.iter().enumerate() { - let field_idx = self.index_value(idx as u64); - let field_object = self.fb.insert_inst( - ObjProj::new(self.module.inst_set(), smallvec![object, field_idx]), - self.module.ty_for_object_projection(field)?, - ); - let field_source = match &source { - CopySource::Value { value, .. } => CopySource::Value { - value: self.extract_aggregate_field(*value, idx, field)?, - class: field.clone(), - }, - CopySource::Object { value, .. } => CopySource::Object { - value: self.fb.insert_inst( - ObjProj::new(self.module.inst_set(), smallvec![*value, field_idx]), - self.module.ty_for_object_projection(field)?, - ), - class: field.clone(), - }, - CopySource::Const { value, .. } => CopySource::Const { - value: self.fb.insert_inst( - ConstProj::new( - self.module.inst_set(), - smallvec![*value, field_idx], - ), - self.module.ty_for_const_projection(field)?, - ), - class: field.clone(), - }, - CopySource::Ptr { addr, space, .. } => CopySource::Ptr { - addr: self.offset_address( - *addr, - data.field_offset_words(self.module.db, idx), - *space, - )?, - space: *space, - class: field.clone(), - }, - }; - self.copy_source_into_object(field_source, field, field_object)?; - } - Ok(()) - } - Layout::Array(data) => { - for idx in 0..data.len as usize { - let elem_idx = self.index_value(idx as u64); - let elem_object = self.fb.insert_inst( - ObjIndex::new(self.module.inst_set(), object, elem_idx), - self.module.ty_for_object_projection(&data.elem)?, - ); - let elem_source = match &source { - CopySource::Value { value, .. } => CopySource::Value { - value: self.extract_aggregate_field(*value, idx, &data.elem)?, - class: data.elem.clone(), - }, - CopySource::Object { value, .. } => CopySource::Object { - value: self.fb.insert_inst( - ObjIndex::new(self.module.inst_set(), *value, elem_idx), - self.module.ty_for_object_projection(&data.elem)?, - ), - class: data.elem.clone(), - }, - CopySource::Const { value, .. } => CopySource::Const { - value: self.fb.insert_inst( - ConstIndex::new(self.module.inst_set(), *value, elem_idx), - self.module.ty_for_const_projection(&data.elem)?, - ), - class: data.elem.clone(), - }, - CopySource::Ptr { addr, space, .. } => CopySource::Ptr { - addr: self.offset_address( - *addr, - idx as u64 * data.elem.span_words(self.module.db), - *space, - )?, - space: *space, - class: data.elem.clone(), - }, - }; - self.copy_source_into_object(elem_source, &data.elem, elem_object)?; - } - Ok(()) - } - Layout::Enum(data) => { - self.copy_enum_source_into_object(source, *layout, data.variants.as_ref(), object) - } - } - } - - fn copy_enum_source_into_object( - &mut self, - source: CopySource<'db>, - dst_layout: LayoutId<'db>, - dst_variants: &[mir::runtime::EnumVariantLayout<'db>], - object: ValueId, - ) -> Result<(), LowerError> { - let source_class = self.copy_source_class(&source).clone(); - let RuntimeClass::AggregateValue { layout: src_layout } = source_class else { - return Err(LowerError::Internal( - "enum copy source must carry an enum aggregate class".to_string(), - )); - }; - let Layout::Enum(src_enum) = src_layout.data(self.module.db) else { - return Err(LowerError::Internal( - "enum copy source layout must be an enum".to_string(), - )); - }; - if src_enum.variants.len() != dst_variants.len() { - return Err(LowerError::Internal(format!( - "enum copy source/destination variant count mismatch: src={} dst={}", - src_enum.variants.len(), - dst_variants.len() - ))); - } - - let source = match source { - CopySource::Const { value, class } => CopySource::Value { - value: self.fb.insert_inst( - ConstLoad::new(self.module.inst_set(), value), - self.module.ty_for_class(&class)?, - ), - class, - }, - CopySource::Ptr { addr, space, class } => CopySource::Value { - value: self.load_aggregate_from_ptr(addr, space, src_layout)?, - class, - }, - source => source, - }; - - let tag = match &source { - CopySource::Value { value, .. } => self.fb.insert_inst( - EnumTag::new(self.module.inst_set(), *value), - self.module.enum_tag_ty(src_layout)?, - ), - CopySource::Object { value, .. } => self.fb.insert_inst( - EnumGetTag::new(self.module.inst_set(), *value), - self.module.enum_tag_ty(src_layout)?, - ), - CopySource::Const { .. } => unreachable!("const enum sources are normalized to values"), - CopySource::Ptr { .. } => unreachable!("ptr enum sources are normalized to values"), - }; - - let entry = self - .fb - .current_block() - .expect("enum copy requires a current block"); - let done = self.fb.append_block(); - let invalid = self.fb.append_block(); - let mut cases = Vec::with_capacity(dst_variants.len()); - let mut blocks = Vec::with_capacity(dst_variants.len()); - for (idx, _) in dst_variants.iter().enumerate() { - let block = self.fb.append_block(); - cases.push(( - self.fb - .make_imm_value(self.module.enum_tag_immediate(src_layout, idx as u16)?), - block, - )); - blocks.push(block); - } - self.fb.insert_inst_no_result(BrTable::new( - self.module.inst_set(), - tag, - Some(invalid), - cases, - )); - - for (idx, block) in blocks.into_iter().enumerate() { - self.fb.switch_to_block(block); - self.copy_enum_variant_into_object( - &source, - src_layout, - src_enum.variants[idx].fields.as_ref(), - dst_layout, - dst_variants[idx].fields.as_ref(), - VariantId { - enum_layout: src_layout, - index: idx as u16, - }, - VariantId { - enum_layout: dst_layout, - index: idx as u16, - }, - object, - )?; - self.fb - .insert_inst_no_result(Jump::new(self.module.inst_set(), done)); - } - - self.fb.switch_to_block(invalid); - self.fb - .insert_inst_no_result(Unreachable::new(self.module.inst_set())); - - self.fb.switch_to_block(done); - let _ = entry; - Ok(()) - } - - #[allow(clippy::too_many_arguments)] - fn copy_enum_variant_into_object( - &mut self, - source: &CopySource<'db>, - src_layout: LayoutId<'db>, - src_fields: &[RuntimeClass<'db>], - dst_layout: LayoutId<'db>, - dst_fields: &[RuntimeClass<'db>], - src_variant: VariantId<'db>, - dst_variant: VariantId<'db>, - object: ValueId, - ) -> Result<(), LowerError> { - if src_fields.len() != dst_fields.len() { - return Err(LowerError::Internal(format!( - "enum variant payload arity mismatch: src_layout={src_layout:?} dst_layout={dst_layout:?} src_variant={} dst_variant={} src_fields={} dst_fields={}", - src_variant.index, - dst_variant.index, - src_fields.len(), - dst_fields.len() - ))); - } - - self.fb.insert_inst_no_result(EnumSetTag::new( - self.module.inst_set(), - object, - self.variant_ref(dst_variant)?, - )); - if src_fields.is_empty() { - return Ok(()); - } - - let asserted_object = match source { - CopySource::Object { value, .. } => Some(self.fb.insert_inst( - EnumAssertVariantRef::new( - self.module.inst_set(), - *value, - self.variant_ref(src_variant)?, - ), - self.fb.type_of(*value), - )), - CopySource::Value { value, .. } => { - self.fb.insert_inst_no_result(EnumAssertVariant::new( - self.module.inst_set(), - *value, - self.variant_ref(src_variant)?, - )); - None - } - CopySource::Const { .. } => unreachable!("const enum sources are normalized to values"), - CopySource::Ptr { .. } => unreachable!("ptr enum sources are normalized to values"), - }; - - for (idx, (src_field, dst_field)) in src_fields.iter().zip(dst_fields.iter()).enumerate() { - let field_idx = self.index_value(idx as u64); - let field_object = self.fb.insert_inst( - EnumProj::new( - self.module.inst_set(), - object, - self.variant_ref(dst_variant)?, - field_idx, - ), - self.module.ty_for_object_projection(dst_field)?, - ); - let field_source = match source { - CopySource::Value { value, .. } => CopySource::Value { - value: self.fb.insert_inst( - EnumExtract::new( - self.module.inst_set(), - *value, - self.variant_ref(src_variant)?, - field_idx, - ), - self.module.ty_for_class(src_field)?, - ), - class: src_field.clone(), - }, - CopySource::Object { .. } => CopySource::Object { - value: self.fb.insert_inst( - EnumProj::new( - self.module.inst_set(), - asserted_object.expect("object enum copy should assert variant once"), - self.variant_ref(src_variant)?, - field_idx, - ), - self.module.ty_for_object_projection(src_field)?, - ), - class: src_field.clone(), - }, - CopySource::Const { .. } => { - unreachable!("const enum sources are normalized to values") - } - CopySource::Ptr { .. } => { - return Err(LowerError::Unsupported( - "copying enum aggregates from non-memory providers is not supported yet" - .to_string(), - )); - } - }; - self.copy_source_into_object(field_source, dst_field, field_object)?; - } - Ok(()) - } - - fn addr_of_place( - &mut self, - place: &RuntimePlace<'db>, - dst: Option, - ) -> Result, LowerError> { - let Lowered::Value(terminal) = self.resolve_place(place)? else { - return Ok(Lowered::Terminated); - }; - match terminal { - PlaceTerminal::Object { value, .. } => Ok(Lowered::Value(value)), - PlaceTerminal::Const { value, .. } => { - if let Some(dst) = dst - && matches!( - self.body.value_class(dst), - Some(RuntimeClass::Ref { - kind: RefKind::Const, - .. - }) - ) - { - return Ok(Lowered::Value(value)); - } - Err(LowerError::Unsupported( - "borrowing const-backed places requires a const-backed destination".to_string(), - )) - } - PlaceTerminal::Ptr { addr, .. } => { - if let Some(dst) = dst - && matches!( - self.body.value_class(dst), - Some(RuntimeClass::Ref { - kind: RefKind::Provider { - space: AddressSpaceKind::Memory, - .. - }, - .. - }) | Some(RuntimeClass::Ref { - kind: RefKind::Object | RefKind::Const, - .. - }) - ) - { - return Err(LowerError::Unsupported( - "memory providers require object-backed places, not raw pointers" - .to_string(), - )); - } - Ok(Lowered::Value(addr)) - } - } - } - - fn store_to_place( - &mut self, - place: &RuntimePlace<'db>, - src: ValueId, - ) -> Result, LowerError> { - let Lowered::Value(terminal) = self.resolve_place(place)? else { - return Ok(Lowered::Terminated); - }; - match terminal { - PlaceTerminal::Ptr { addr, space, class } => { - self.store_to_ptr(addr, space, &class, src)?; - Ok(Lowered::Value(())) - } - PlaceTerminal::Object { value, class } => { - if !matches!( - class, - RuntimeClass::Scalar(_) - | RuntimeClass::Ref { .. } - | RuntimeClass::RawAddr { .. } - ) { - return Err(LowerError::Unsupported( - "object place store requires scalar/raw subobject".to_string(), - )); - } - self.fb - .insert_inst_no_result(ObjStore::new(self.module.inst_set(), value, src)); - Ok(Lowered::Value(())) - } - PlaceTerminal::Const { .. } => Err(LowerError::Unsupported( - "cannot store into const-backed places".to_string(), - )), - } - } - - fn copy_into_place( - &mut self, - place: &RuntimePlace<'db>, - src: RLocalId, - ) -> Result, LowerError> { - let src_value = self.local_value(src)?; - let program = self.module.db as &dyn mir::MirDb; - let dst_class = resolve_runtime_place(self.module.db, &program, &self.body, place) - .map_err(|err| LowerError::Internal(format!("invalid runtime place: {err:?}")))? - .result_class; - let Lowered::Value(terminal) = self.resolve_place(place)? else { - return Ok(Lowered::Terminated); - }; - match terminal { - PlaceTerminal::Object { value, .. } => { - let source = self.copy_source_for_local(src, src_value)?; - self.copy_source_into_object(source, &dst_class, value)?; - Ok(Lowered::Value(())) - } - PlaceTerminal::Const { .. } => Err(LowerError::Unsupported( - "cannot copy into const-backed places".to_string(), - )), - PlaceTerminal::Ptr { addr, space, .. } => { - self.copy_to_ptr(addr, space, &dst_class, src_value)?; - Ok(Lowered::Value(())) - } - } - } - - fn copy_to_ptr( - &mut self, - addr: ValueId, - space: AddressSpaceKind, - class: &RuntimeClass<'db>, - src: ValueId, - ) -> Result<(), LowerError> { - match class { - RuntimeClass::Scalar(_) | RuntimeClass::Ref { .. } | RuntimeClass::RawAddr { .. } => { - self.store_to_ptr(addr, space, class, src) - } - RuntimeClass::AggregateValue { layout } => match layout.data(self.module.db) { - Layout::Struct(data) => { - for (idx, field) in data.fields.iter().enumerate() { - let field_value = self.extract_aggregate_field(src, idx, field)?; - let expected_ty = self.module.ty_for_class(field)?; - let actual_ty = self.fb.type_of(field_value); - if actual_ty != expected_ty { - return Err(LowerError::Internal(format!( - "copy-to-ptr struct field type mismatch: layout={layout:?} idx={idx} class={field:?} expected_ty={expected_ty:?} actual_ty={actual_ty:?} src_ty={:?}", - self.fb.type_of(src) - ))); - } - let field_addr = self.offset_address( - addr, - data.field_offset_words(self.module.db, idx), - space, - )?; - self.copy_to_ptr(field_addr, space, field, field_value)?; - } - Ok(()) - } - Layout::Array(data) => { - for idx in 0..data.len as usize { - let field_value = self.extract_aggregate_field(src, idx, &data.elem)?; - let expected_ty = self.module.ty_for_class(&data.elem)?; - let actual_ty = self.fb.type_of(field_value); - if actual_ty != expected_ty { - return Err(LowerError::Internal(format!( - "copy-to-ptr array elem type mismatch: layout={layout:?} idx={idx} class={:?} expected_ty={expected_ty:?} actual_ty={actual_ty:?} src_ty={:?}", - data.elem, - self.fb.type_of(src) - ))); - } - let elem_addr = self.offset_address( - addr, - idx as u64 * data.elem.span_words(self.module.db), - space, - )?; - self.copy_to_ptr(elem_addr, space, &data.elem, field_value)?; - } - Ok(()) - } - Layout::Enum(data) => self.copy_enum_to_ptr(addr, space, *layout, &data, src), - }, - } - } - - fn copy_enum_to_ptr( - &mut self, - addr: ValueId, - space: AddressSpaceKind, - layout: LayoutId<'db>, - data: &mir::runtime::EnumLayout<'db>, - src: ValueId, - ) -> Result<(), LowerError> { - let tag = self.fb.insert_inst( - EnumTag::new(self.module.inst_set(), src), - self.module.enum_tag_ty(layout)?, - ); - let done = self.fb.append_block(); - let invalid = self.fb.append_block(); - let mut cases = Vec::with_capacity(data.variants.len()); - let mut blocks = Vec::with_capacity(data.variants.len()); - for (idx, _) in data.variants.iter().enumerate() { - let block = self.fb.append_block(); - cases.push(( - self.fb - .make_imm_value(self.module.enum_tag_immediate(layout, idx as u16)?), - block, - )); - blocks.push(block); - } - self.fb.insert_inst_no_result(BrTable::new( - self.module.inst_set(), - tag, - Some(invalid), - cases, - )); - - for (idx, block) in blocks.into_iter().enumerate() { - self.fb.switch_to_block(block); - let variant = VariantId { - enum_layout: layout, - index: idx as u16, - }; - let tag_word = self.index_value(idx as u64); - self.store_to_ptr( - addr, - space, - &RuntimeClass::Scalar(data.tag.clone()), - tag_word, - )?; - for (field_idx, field) in data.variants[idx].fields.iter().enumerate() { - let field_idx_value = self.index_value(field_idx as u64); - let field_value = self.fb.insert_inst( - EnumExtract::new( - self.module.inst_set(), - src, - self.variant_ref(variant)?, - field_idx_value, - ), - self.module.ty_for_class(field)?, - ); - let field_addr = self.offset_address( - addr, - variant - .field_offset_words(self.module.db, FieldIndex(field_idx as u16)) - .ok_or_else(|| { - LowerError::Internal("variant field layout missing".to_string()) - })?, - space, - )?; - self.copy_to_ptr(field_addr, space, field, field_value)?; - } - self.fb - .insert_inst_no_result(Jump::new(self.module.inst_set(), done)); - } - - self.fb.switch_to_block(invalid); - self.fb - .insert_inst_no_result(Unreachable::new(self.module.inst_set())); - - self.fb.switch_to_block(done); - Ok(()) - } - - fn load_from_ptr( - &mut self, - addr: ValueId, - space: AddressSpaceKind, - class: &RuntimeClass<'db>, - ) -> Result { - match class { - RuntimeClass::Scalar(scalar) => self.load_scalar(addr, space, scalar), - RuntimeClass::Ref { - kind: - RefKind::Provider { - space: - AddressSpaceKind::Storage - | AddressSpaceKind::Transient - | AddressSpaceKind::Calldata - | AddressSpaceKind::Code, - .. - }, - .. - } => self.load_word(addr, space), - RuntimeClass::RawAddr { .. } => self.load_word(addr, space), - RuntimeClass::AggregateValue { layout } => match space { - AddressSpaceKind::Memory => Err(LowerError::Unsupported( - "memory aggregate values should be addressed through object refs".to_string(), - )), - AddressSpaceKind::Storage - | AddressSpaceKind::Transient - | AddressSpaceKind::Calldata - | AddressSpaceKind::Code => self.load_aggregate_from_ptr(addr, space, *layout), - }, - RuntimeClass::Ref { .. } => Err(LowerError::Unsupported( - "loading handle values from raw-address places is not supported".to_string(), - )), - } - } - - fn load_aggregate_from_ptr( - &mut self, - addr: ValueId, - space: AddressSpaceKind, - layout: LayoutId<'db>, - ) -> Result { - match layout.data(self.module.db) { - Layout::Struct(data) => { - let ty = self.module.ty_for_layout(layout)?; - let mut value = self.fb.make_undef_value(ty); - for (idx, field) in data.fields.iter().enumerate() { - let field_addr = self.offset_address( - addr, - data.field_offset_words(self.module.db, idx), - space, - )?; - let field_value = self.load_from_ptr(field_addr, space, field)?; - let expected_ty = self.module.ty_for_class(field)?; - let actual_ty = self.fb.type_of(field_value); - if actual_ty != expected_ty { - return Err(LowerError::Internal(format!( - "aggregate ptr load field type mismatch: layout={layout:?} idx={idx} class={field:?} expected_ty={expected_ty:?} actual_ty={actual_ty:?}" - ))); - } - let idx = self.index_value(idx as u64); - value = self.fb.insert_inst( - sonatina_ir::inst::data::InsertValue::new( - self.module.inst_set(), - value, - idx, - field_value, - ), - ty, - ); - } - Ok(value) - } - Layout::Array(data) => { - let ty = self.module.ty_for_layout(layout)?; - let mut value = self.fb.make_undef_value(ty); - for idx in 0..data.len as usize { - let elem_addr = self.offset_address( - addr, - idx as u64 * data.elem.span_words(self.module.db), - space, - )?; - let elem = self.load_from_ptr(elem_addr, space, &data.elem)?; - let expected_ty = self.module.ty_for_class(&data.elem)?; - let actual_ty = self.fb.type_of(elem); - if actual_ty != expected_ty { - return Err(LowerError::Internal(format!( - "aggregate ptr load elem type mismatch: layout={layout:?} idx={idx} class={:?} expected_ty={expected_ty:?} actual_ty={actual_ty:?}", - data.elem - ))); - } - let idx = self.index_value(idx as u64); - value = self.fb.insert_inst( - sonatina_ir::inst::data::InsertValue::new( - self.module.inst_set(), - value, - idx, - elem, - ), - ty, - ); - } - Ok(value) - } - Layout::Enum(data) => self.load_enum_from_ptr(addr, space, layout, &data), - } - } - - fn load_enum_from_ptr( - &mut self, - addr: ValueId, - space: AddressSpaceKind, - layout: LayoutId<'db>, - data: &mir::runtime::EnumLayout<'db>, - ) -> Result { - let layout_ty = self.module.ty_for_layout(layout)?; - let object = self.fb.insert_inst( - ObjAlloc::new(self.module.inst_set(), layout_ty), - self.fb.module_builder.objref_type(layout_ty), - ); - let tag = self.load_word(addr, space)?; - let done = self.fb.append_block(); - let invalid = self.fb.append_block(); - let mut cases = Vec::with_capacity(data.variants.len()); - let mut blocks = Vec::with_capacity(data.variants.len()); - for (idx, _) in data.variants.iter().enumerate() { - let block = self.fb.append_block(); - cases.push((self.index_value(idx as u64), block)); - blocks.push(block); - } - self.fb.insert_inst_no_result(BrTable::new( - self.module.inst_set(), - tag, - Some(invalid), - cases, - )); - - for (idx, block) in blocks.into_iter().enumerate() { - self.fb.switch_to_block(block); - let variant = VariantId { - enum_layout: layout, - index: idx as u16, - }; - let values = data.variants[idx] - .fields - .iter() - .enumerate() - .map(|(field_idx, field)| { - let field_addr = self.offset_address( - addr, - variant - .field_offset_words(self.module.db, FieldIndex(field_idx as u16)) - .ok_or_else(|| { - LowerError::Internal("variant field layout missing".to_string()) - })?, - space, - )?; - self.load_from_ptr(field_addr, space, field) - }) - .collect::, _>>()?; - self.fb.insert_inst_no_result(EnumWriteVariant::new( - self.module.inst_set(), - object, - self.variant_ref(variant)?, - values, - )); - self.fb - .insert_inst_no_result(Jump::new(self.module.inst_set(), done)); - } - - self.fb.switch_to_block(invalid); - self.fb - .insert_inst_no_result(Unreachable::new(self.module.inst_set())); - - self.fb.switch_to_block(done); - Ok(self - .fb - .insert_inst(ObjLoad::new(self.module.inst_set(), object), layout_ty)) - } - - fn load_word(&mut self, addr: ValueId, space: AddressSpaceKind) -> Result { - match space { - AddressSpaceKind::Memory => Ok(self.fb.insert_inst( - Mload::new(self.module.inst_set(), addr, Type::I256), - Type::I256, - )), - AddressSpaceKind::Storage => Ok(self - .fb - .insert_inst(EvmSload::new(self.module.inst_set(), addr), Type::I256)), - AddressSpaceKind::Transient => Ok(self - .fb - .insert_inst(EvmTload::new(self.module.inst_set(), addr), Type::I256)), - AddressSpaceKind::Calldata => Ok(self.fb.insert_inst( - EvmCalldataLoad::new(self.module.inst_set(), addr), - Type::I256, - )), - AddressSpaceKind::Code => { - let len = self.fb.make_imm_value(I256::from(32u64)); - let ptr_ty = self.fb.ptr_type(Type::I8); - let ptr = self - .fb - .insert_inst(EvmMalloc::new(self.module.inst_set(), len), ptr_ty); - let ptr = self.coerce_value_to_ty(ptr, Type::I256)?; - self.fb.insert_inst_no_result(EvmCodeCopy::new( - self.module.inst_set(), - ptr, - addr, - len, - )); - Ok(self.fb.insert_inst( - Mload::new(self.module.inst_set(), ptr, Type::I256), - Type::I256, - )) - } - } - } - - fn load_scalar( - &mut self, - addr: ValueId, - space: AddressSpaceKind, - scalar: &ScalarClass<'db>, - ) -> Result { - let word = self.load_word(addr, space)?; - self.cast_scalar(word, scalar_ty(scalar)) - } - - fn store_to_ptr( - &mut self, - addr: ValueId, - space: AddressSpaceKind, - class: &RuntimeClass<'db>, - src: ValueId, - ) -> Result<(), LowerError> { - let value = match class { - RuntimeClass::Scalar(scalar) => self.cast_scalar_with_signedness( - src, - scalar_word_ty(scalar), - scalar.is_signed_int(), - ), - RuntimeClass::Ref { - kind: - RefKind::Provider { - space: - AddressSpaceKind::Storage - | AddressSpaceKind::Transient - | AddressSpaceKind::Calldata - | AddressSpaceKind::Code, - .. - }, - .. - } => self.coerce_value_to_ty(src, Type::I256), - RuntimeClass::RawAddr { .. } => self.coerce_value_to_ty(src, Type::I256), - RuntimeClass::AggregateValue { .. } | RuntimeClass::Ref { .. } => Err( - LowerError::Unsupported("aggregate/handle ptr stores require CopyInto".to_string()), - ), - }?; - match space { - AddressSpaceKind::Memory => self.fb.insert_inst_no_result(Mstore::new( - self.module.inst_set(), - addr, - value, - Type::I256, - )), - AddressSpaceKind::Storage => { - self.fb - .insert_inst_no_result(EvmSstore::new(self.module.inst_set(), addr, value)) - } - AddressSpaceKind::Transient => { - self.fb - .insert_inst_no_result(EvmTstore::new(self.module.inst_set(), addr, value)) - } - AddressSpaceKind::Calldata => { - return Err(LowerError::Unsupported( - "storing into calldata-backed providers is not supported".to_string(), - )); - } - AddressSpaceKind::Code => { - return Err(LowerError::Unsupported( - "storing into code-backed providers is not supported".to_string(), - )); - } - } - Ok(()) - } - - fn extract_aggregate_field( - &mut self, - value: ValueId, - idx: usize, - class: &RuntimeClass<'db>, - ) -> Result { - let idx = self.index_value(idx as u64); - self.fb - .insert_inst( - sonatina_ir::inst::data::ExtractValue::new(self.module.inst_set(), value, idx), - self.module.ty_for_class(class)?, - ) - .pipe(Ok) - } - - fn make_aggregate_value( - &mut self, - layout: LayoutId<'db>, - fields: &[RLocalId], - ) -> Result { - match layout.data(self.module.db) { - Layout::Struct(data) => { - if data.fields.len() != fields.len() { - return Err(LowerError::Internal(format!( - "aggregate make field count mismatch: layout={layout:?} expected={} actual={}", - data.fields.len(), - fields.len() - ))); - } - let ty = self.module.ty_for_layout(layout)?; - let mut value = self.fb.make_undef_value(ty); - for (idx, (field, class)) in fields.iter().zip(data.fields.iter()).enumerate() { - let field_value = self.aggregate_make_field_value(*field, class)?; - value = self.insert_aggregate_field(value, ty, idx, field_value); - } - Ok(value) - } - Layout::Array(data) => { - if data.len as usize != fields.len() { - return Err(LowerError::Internal(format!( - "aggregate make element count mismatch: layout={layout:?} expected={} actual={}", - data.len, - fields.len() - ))); - } - let ty = self.module.ty_for_layout(layout)?; - let mut value = self.fb.make_undef_value(ty); - for (idx, field) in fields.iter().enumerate() { - let elem = self.aggregate_make_field_value(*field, &data.elem)?; - value = self.insert_aggregate_field(value, ty, idx, elem); - } - Ok(value) - } - Layout::Enum(_) => Err(LowerError::Internal( - "aggregate make should not build enum layouts".to_string(), - )), - } - } - - fn aggregate_make_field_value( - &mut self, - field: RLocalId, - class: &RuntimeClass<'db>, - ) -> Result { - let ty = self.module.ty_for_class(class)?; - if self.body.value_class(field).is_none() { - return Ok(zero_for_type(&mut self.fb, ty)); - } - let value = self.local_value(field)?; - self.coerce_value_to_ty(value, ty) - } - - fn insert_aggregate_field( - &mut self, - value: ValueId, - ty: Type, - idx: usize, - field: ValueId, - ) -> ValueId { - let idx = self.index_value(idx as u64); - self.fb.insert_inst( - InsertValue::new(self.module.inst_set(), value, idx, field), - ty, - ) - } - - fn cast_scalar(&mut self, value: ValueId, ty: Type) -> Result { - self.cast_scalar_with_signedness(value, ty, false) - } - - fn cast_scalar_with_signedness( - &mut self, - value: ValueId, - ty: Type, - signed: bool, - ) -> Result { - if self.fb.type_of(value) == ty { - return Ok(value); - } - if ty == Type::I1 { - return Ok(condition_to_i1(&mut self.fb, value, self.module.inst_set())); - } - let is = self.module.inst_set(); - Ok(cast_int_value(&mut self.fb, is, value, ty, signed)) - } - - fn coerce_to_dst( - &mut self, - value: ValueId, - dst: Option, - ) -> Result { - let Some(dst) = dst else { - return Ok(value); - }; - if self.body.value_class(dst).is_none() { - return Ok(value); - } - let ty = self.local_ty(dst)?; - self.coerce_value_to_ty(value, ty) - } - - fn coerce_value_to_ty(&mut self, value: ValueId, ty: Type) -> Result { - let from = self.fb.type_of(value); - if from == ty { - return Ok(value); - } - - let type_is_ref = |ty: Type| { - matches!( - ty.resolve_compound(&self.fb.module_builder.ctx), - Some(CompoundType::ObjRef(_) | CompoundType::ConstRef(_)) - ) - }; - if type_is_ref(from) || type_is_ref(ty) { - return Err(LowerError::Internal(format!( - "cannot coerce reference value from {from:?} to {ty:?}" - ))); - } - - let from_ptr = from.is_pointer(&self.fb.module_builder.ctx); - let to_ptr = ty.is_pointer(&self.fb.module_builder.ctx); - if !from_ptr && !to_ptr && (!from.is_integral() || !ty.is_integral()) { - return Err(LowerError::Internal(format!( - "cannot coerce non-scalar value from {from:?} to {ty:?}" - ))); - } - Ok(match (from_ptr, to_ptr) { - (true, false) => { - if !ty.is_integral() { - return Err(LowerError::Internal(format!( - "cannot coerce pointer value from {from:?} to non-integral {ty:?}" - ))); - } - self.fb - .insert_inst(PtrToInt::new(self.module.inst_set(), value, ty), ty) - } - (false, true) => { - if !from.is_integral() { - return Err(LowerError::Internal(format!( - "cannot coerce non-integral value from {from:?} to pointer {ty:?}" - ))); - } - self.fb - .insert_inst(IntToPtr::new(self.module.inst_set(), value, ty), ty) - } - (true, true) => self - .fb - .insert_inst(Bitcast::new(self.module.inst_set(), value, ty), ty), - (false, false) => self.cast_scalar(value, ty)?, - }) - } - - fn lower_unary( - &mut self, - op: UnOp, - value: ValueId, - result: &RuntimeClass<'db>, - ) -> Result { - let ty = self.module.ty_for_class(result)?; - Ok(match op { - UnOp::Not => { - let value = condition_to_i1(&mut self.fb, value, self.module.inst_set()); - self.fb - .insert_inst(IsZero::new(self.module.inst_set(), value), Type::I1) - } - UnOp::Minus => { - let value = self.cast_scalar(value, ty)?; - self.fb - .insert_inst(Neg::new(self.module.inst_set(), value), ty) - } - UnOp::BitNot => { - let value = self.cast_scalar(value, ty)?; - self.fb - .insert_inst(Not::new(self.module.inst_set(), value), ty) - } - UnOp::Plus | UnOp::Mut | UnOp::Ref => value, - }) - } - - fn lower_binary( - &mut self, - op: BinOp, - lhs: ValueId, - rhs: ValueId, - operand: &RuntimeClass<'db>, - ) -> Result { - Ok(match op { - BinOp::Arith(op) => self.lower_arith(op, lhs, rhs, operand)?, - BinOp::Comp(op) => self.lower_comp(op, lhs, rhs, operand)?, - BinOp::Logical(op) => match op { - LogicalBinOp::And => { - let lhs = condition_to_i1(&mut self.fb, lhs, self.module.inst_set()); - let rhs = condition_to_i1(&mut self.fb, rhs, self.module.inst_set()); - self.fb - .insert_inst(And::new(self.module.inst_set(), lhs, rhs), Type::I1) - } - LogicalBinOp::Or => { - let lhs = condition_to_i1(&mut self.fb, lhs, self.module.inst_set()); - let rhs = condition_to_i1(&mut self.fb, rhs, self.module.inst_set()); - self.fb - .insert_inst(Or::new(self.module.inst_set(), lhs, rhs), Type::I1) - } - }, - BinOp::Index => { - return Err(LowerError::Unsupported( - "index should not appear as a runtime binary op".to_string(), - )); - } - }) - } - - fn lower_arith( - &mut self, - op: ArithBinOp, - lhs: ValueId, - rhs: ValueId, - operand: &RuntimeClass<'db>, - ) -> Result { - let ty = self.module.ty_for_class(operand)?; - let lhs = self.cast_scalar(lhs, ty)?; - let rhs = self.cast_scalar(rhs, ty)?; - let signed = operand.is_signed_scalar(); - Ok(match op { - ArithBinOp::Add => { - let [raw, overflow] = if signed { - self.fb.insert_saddo(lhs, rhs) - } else { - self.fb.insert_uaddo(lhs, rhs) - }; - self.emit_panic_revert(overflow, PANIC_OVERFLOW)?; - raw - } - ArithBinOp::Sub => { - let [raw, overflow] = if signed { - self.fb.insert_ssubo(lhs, rhs) - } else { - self.fb.insert_usubo(lhs, rhs) - }; - self.emit_panic_revert(overflow, PANIC_OVERFLOW)?; - raw - } - ArithBinOp::Mul => { - let [raw, overflow] = if signed { - self.fb.insert_smulo(lhs, rhs) - } else { - self.fb.insert_umulo(lhs, rhs) - }; - self.emit_panic_revert(overflow, PANIC_OVERFLOW)?; - raw - } - ArithBinOp::Div => { - self.emit_division_by_zero_revert(rhs, ty)?; - let [raw, overflow] = if signed { - self.fb.insert_evm_sdivo(lhs, rhs) - } else { - self.fb.insert_evm_udivo(lhs, rhs) - }; - self.emit_panic_revert(overflow, PANIC_OVERFLOW)?; - raw - } - ArithBinOp::Rem => { - self.emit_division_by_zero_revert(rhs, ty)?; - if signed { - self.fb - .insert_inst(EvmSmod::new(self.module.inst_set(), lhs, rhs), ty) - } else { - self.fb - .insert_inst(EvmUmod::new(self.module.inst_set(), lhs, rhs), ty) - } - } - ArithBinOp::Pow => self - .fb - .insert_inst(EvmExp::new(self.module.inst_set(), lhs, rhs), ty), - ArithBinOp::LShift => self - .fb - .insert_inst(Shl::new(self.module.inst_set(), rhs, lhs), ty), - ArithBinOp::RShift => { - if signed { - self.fb - .insert_inst(Sar::new(self.module.inst_set(), rhs, lhs), ty) - } else { - self.fb - .insert_inst(Shr::new(self.module.inst_set(), rhs, lhs), ty) - } - } - ArithBinOp::BitOr => self - .fb - .insert_inst(Or::new(self.module.inst_set(), lhs, rhs), ty), - ArithBinOp::BitXor => self - .fb - .insert_inst(Xor::new(self.module.inst_set(), lhs, rhs), ty), - ArithBinOp::BitAnd => self - .fb - .insert_inst(And::new(self.module.inst_set(), lhs, rhs), ty), - ArithBinOp::Range => { - return Err(LowerError::Unsupported( - "range is not a runtime arithmetic op".to_string(), - )); - } - }) - } - - fn lower_intrinsic_arith_builtin( - &mut self, - op: IntrinsicArithBinOp, - checked: bool, - lhs: RLocalId, - rhs: RLocalId, - class: &ScalarClass<'db>, - ) -> Result { - let ty = scalar_ty(class); - let lhs = self.local_value(lhs)?; - let rhs = self.local_value(rhs)?; - let lhs = self.cast_scalar(lhs, ty)?; - let rhs = self.cast_scalar(rhs, ty)?; - let signed = matches!(class.repr, ScalarRepr::Int { signed: true, .. }); - Ok(match (op, checked) { - (IntrinsicArithBinOp::Add, false) => self - .fb - .insert_inst(Add::new(self.module.inst_set(), lhs, rhs), ty), - (IntrinsicArithBinOp::Sub, false) => self - .fb - .insert_inst(Sub::new(self.module.inst_set(), lhs, rhs), ty), - (IntrinsicArithBinOp::Mul, false) => self - .fb - .insert_inst(Mul::new(self.module.inst_set(), lhs, rhs), ty), - (IntrinsicArithBinOp::Div, false) => { - if signed { - self.fb - .insert_inst(EvmSdiv::new(self.module.inst_set(), lhs, rhs), ty) - } else { - self.fb - .insert_inst(EvmUdiv::new(self.module.inst_set(), lhs, rhs), ty) - } - } - (IntrinsicArithBinOp::Rem, false) => { - if signed { - self.fb - .insert_inst(EvmSmod::new(self.module.inst_set(), lhs, rhs), ty) - } else { - self.fb - .insert_inst(EvmUmod::new(self.module.inst_set(), lhs, rhs), ty) - } - } - (IntrinsicArithBinOp::Pow, false) => self - .fb - .insert_inst(EvmExp::new(self.module.inst_set(), lhs, rhs), ty), - (IntrinsicArithBinOp::Add, true) => { - let [raw, overflow] = if signed { - self.fb.insert_saddo(lhs, rhs) - } else { - self.fb.insert_uaddo(lhs, rhs) - }; - self.emit_panic_revert(overflow, PANIC_OVERFLOW)?; - raw - } - (IntrinsicArithBinOp::Sub, true) => { - let [raw, overflow] = if signed { - self.fb.insert_ssubo(lhs, rhs) - } else { - self.fb.insert_usubo(lhs, rhs) - }; - self.emit_panic_revert(overflow, PANIC_OVERFLOW)?; - raw - } - (IntrinsicArithBinOp::Mul, true) => { - let [raw, overflow] = if signed { - self.fb.insert_smulo(lhs, rhs) - } else { - self.fb.insert_umulo(lhs, rhs) - }; - self.emit_panic_revert(overflow, PANIC_OVERFLOW)?; - raw - } - (IntrinsicArithBinOp::Div, true) => { - self.emit_division_by_zero_revert(rhs, ty)?; - let [raw, overflow] = if signed { - self.fb.insert_evm_sdivo(lhs, rhs) - } else { - self.fb.insert_evm_udivo(lhs, rhs) - }; - self.emit_panic_revert(overflow, PANIC_OVERFLOW)?; - raw - } - (IntrinsicArithBinOp::Rem, true) => { - self.emit_division_by_zero_revert(rhs, ty)?; - if signed { - self.fb - .insert_inst(EvmSmod::new(self.module.inst_set(), lhs, rhs), ty) - } else { - self.fb - .insert_inst(EvmUmod::new(self.module.inst_set(), lhs, rhs), ty) - } - } - (IntrinsicArithBinOp::Pow, true) => { - self.lower_checked_pow_builtin(lhs, rhs, ty, signed)? - } - }) - } - - fn lower_checked_pow_builtin( - &mut self, - base: ValueId, - exp: ValueId, - ty: Type, - signed: bool, - ) -> Result { - let zero = self.fb.make_imm_value(Immediate::zero(ty)); - let one = self.fb.make_imm_value(Immediate::one(ty)); - if signed { - let negative = self - .fb - .insert_inst(Slt::new(self.module.inst_set(), exp, zero), Type::I1); - self.emit_empty_revert(negative)?; - } - - let entry = self - .fb - .current_block() - .expect("checked pow requires a current block"); - let header = self.fb.append_block(); - let body = self.fb.append_block(); - let done = self.fb.append_block(); - self.fb - .insert_inst_no_result(Jump::new(self.module.inst_set(), header)); - self.fb.switch_to_block(header); - let result = self - .fb - .insert_inst(Phi::new(self.module.inst_set(), vec![(one, entry)]), ty); - let idx = self - .fb - .insert_inst(Phi::new(self.module.inst_set(), vec![(zero, entry)]), ty); - let done_cond = self - .fb - .insert_inst(Eq::new(self.module.inst_set(), idx, exp), Type::I1); - self.fb - .insert_inst_no_result(Br::new(self.module.inst_set(), done_cond, done, body)); - - self.fb.switch_to_block(body); - let [next_result, overflow] = if signed { - self.fb.insert_smulo(result, base) - } else { - self.fb.insert_umulo(result, base) - }; - self.emit_panic_revert(overflow, PANIC_OVERFLOW)?; - let one_step = self.fb.make_imm_value(Immediate::one(ty)); - let next_idx = self - .fb - .insert_inst(Add::new(self.module.inst_set(), idx, one_step), ty); - let loop_back = self - .fb - .current_block() - .expect("checked pow body should stay in a block"); - self.fb.append_phi_arg(result, next_result, loop_back); - self.fb.append_phi_arg(idx, next_idx, loop_back); - self.fb - .insert_inst_no_result(Jump::new(self.module.inst_set(), header)); - - self.fb.switch_to_block(done); - Ok(result) - } - - fn lower_comp( - &mut self, - op: CompBinOp, - lhs: ValueId, - rhs: ValueId, - operand: &RuntimeClass<'db>, - ) -> Result { - let ty = self.module.ty_for_class(operand)?; - let lhs = self.cast_scalar(lhs, ty)?; - let rhs = self.cast_scalar(rhs, ty)?; - let signed = operand.is_signed_scalar(); - Ok(match op { - CompBinOp::Eq => self - .fb - .insert_inst(Eq::new(self.module.inst_set(), lhs, rhs), Type::I1), - CompBinOp::NotEq => { - let eq = self - .fb - .insert_inst(Eq::new(self.module.inst_set(), lhs, rhs), Type::I1); - self.fb - .insert_inst(IsZero::new(self.module.inst_set(), eq), Type::I1) - } - CompBinOp::Lt => { - if signed { - self.fb - .insert_inst(Slt::new(self.module.inst_set(), lhs, rhs), Type::I1) - } else { - self.fb - .insert_inst(Lt::new(self.module.inst_set(), lhs, rhs), Type::I1) - } - } - CompBinOp::LtEq => { - let gt = if signed { - self.fb - .insert_inst(Slt::new(self.module.inst_set(), rhs, lhs), Type::I1) - } else { - self.fb - .insert_inst(Gt::new(self.module.inst_set(), lhs, rhs), Type::I1) - }; - self.fb - .insert_inst(IsZero::new(self.module.inst_set(), gt), Type::I1) - } - CompBinOp::Gt => { - if signed { - self.fb - .insert_inst(Slt::new(self.module.inst_set(), rhs, lhs), Type::I1) - } else { - self.fb - .insert_inst(Gt::new(self.module.inst_set(), lhs, rhs), Type::I1) - } - } - CompBinOp::GtEq => { - let lt = if signed { - self.fb - .insert_inst(Slt::new(self.module.inst_set(), lhs, rhs), Type::I1) - } else { - self.fb - .insert_inst(Lt::new(self.module.inst_set(), lhs, rhs), Type::I1) - }; - self.fb - .insert_inst(IsZero::new(self.module.inst_set(), lt), Type::I1) - } - }) - } - - fn ensure_empty_revert_block(&mut self) -> BlockId { - if let Some(block) = self.empty_revert_block { - return block; - } - let revert_block = self.fb.append_block(); - let current = self - .fb - .current_block() - .expect("overflow block requires current block"); - self.fb.switch_to_block(revert_block); - let zero = zero_for_type(&mut self.fb, Type::I256); - self.fb - .insert_inst_no_result(EvmRevert::new(self.module.inst_set(), zero, zero)); - self.fb.switch_to_block(current); - self.empty_revert_block = Some(revert_block); - revert_block - } - - fn ensure_panic_revert_block(&mut self, code: u64) -> BlockId { - if code == PANIC_OVERFLOW - && let Some(block) = self.overflow_panic_block - { - return block; - } - if code == PANIC_DIVISION_BY_ZERO - && let Some(block) = self.division_by_zero_panic_block - { - return block; - } - let revert_block = self.fb.append_block(); - let current = self - .fb - .current_block() - .expect("panic block requires current block"); - self.fb.switch_to_block(revert_block); - self.emit_panic_revert_payload(code); - self.fb.switch_to_block(current); - match code { - PANIC_OVERFLOW => self.overflow_panic_block = Some(revert_block), - PANIC_DIVISION_BY_ZERO => self.division_by_zero_panic_block = Some(revert_block), - _ => {} - } - revert_block - } - - fn emit_panic_revert_payload(&mut self, code: u64) { - let zero = self.fb.make_imm_value(I256::zero()); - let selector = self.fb.make_imm_value(panic_selector_immediate()); - let code_offset = self.fb.make_imm_value(I256::from(4u64)); - let code = self.fb.make_imm_value(I256::from(code)); - let len = self.fb.make_imm_value(I256::from(36u64)); - self.fb.insert_inst_no_result(Mstore::new( - self.module.inst_set(), - zero, - selector, - Type::I256, - )); - self.fb.insert_inst_no_result(Mstore::new( - self.module.inst_set(), - code_offset, - code, - Type::I256, - )); - self.fb - .insert_inst_no_result(EvmRevert::new(self.module.inst_set(), zero, len)); - } - - fn emit_empty_revert(&mut self, overflow_flag: ValueId) -> Result<(), LowerError> { - let revert_block = self.ensure_empty_revert_block(); - let continue_block = self.fb.append_block(); - self.fb.insert_inst_no_result(Br::new( - self.module.inst_set(), - overflow_flag, - revert_block, - continue_block, - )); - self.fb.switch_to_block(continue_block); - Ok(()) - } - - fn emit_panic_revert(&mut self, overflow_flag: ValueId, code: u64) -> Result<(), LowerError> { - let revert_block = self.ensure_panic_revert_block(code); - let continue_block = self.fb.append_block(); - self.fb.insert_inst_no_result(Br::new( - self.module.inst_set(), - overflow_flag, - revert_block, - continue_block, - )); - self.fb.switch_to_block(continue_block); - Ok(()) - } - - fn emit_division_by_zero_revert(&mut self, rhs: ValueId, ty: Type) -> Result<(), LowerError> { - let zero = self.fb.make_imm_value(Immediate::zero(ty)); - let divisor_is_zero = self - .fb - .insert_inst(Eq::new(self.module.inst_set(), rhs, zero), Type::I1); - self.emit_panic_revert(divisor_is_zero, PANIC_DIVISION_BY_ZERO) - } - - fn emit_unconditional_empty_revert(&mut self) -> Lowered { - let revert_block = self.ensure_empty_revert_block(); - self.fb - .insert_inst_no_result(Jump::new(self.module.inst_set(), revert_block)); - Lowered::Terminated - } - - fn checked_index_value( - &mut self, - base_class: &RuntimeClass<'db>, - index: &IndexSource, - ) -> Result, LowerError> { - let len = base_class.array_len(self.module.db).ok_or_else(|| { - LowerError::Internal("index projection on non-array class".to_string()) - })?; - match index { - IndexSource::Constant(index) => { - self.checked_constant_index_value(len, Some(*index as u64)) - } - IndexSource::Dynamic(index) => { - let index = self.local_value(*index)?; - if let Value::Immediate { imm, .. } = self.fb.func.dfg.value(index) { - return self.checked_constant_index_value(len, immediate_to_u64_index(*imm)); - } - let len = self.index_value(len); - let in_bounds = self - .fb - .insert_inst(Lt::new(self.module.inst_set(), index, len), Type::I1); - let out_of_bounds = self - .fb - .insert_inst(IsZero::new(self.module.inst_set(), in_bounds), Type::I1); - self.emit_empty_revert(out_of_bounds)?; - Ok(Lowered::Value(index)) - } - } - } - - fn checked_constant_index_value( - &mut self, - len: u64, - index: Option, - ) -> Result, LowerError> { - if let Some(index) = index - && index < len - { - return Ok(Lowered::Value(self.index_value(index))); - } - Ok(self.emit_unconditional_empty_revert()) - } - - fn variant_ref(&self, variant: VariantId<'db>) -> Result { - let ty = self - .module - .type_cache - .get(&variant.enum_layout) - .copied() - .ok_or_else(|| { - LowerError::Internal("enum type must be declared before use".to_string()) - })?; - let Type::Compound(compound) = ty else { - return Err(LowerError::Internal( - "enum type is not compound".to_string(), - )); - }; - self.fb - .module_builder - .ctx - .with_ty_store(|_store| EnumVariantRef::new(compound, variant.index as u32)) - .pipe(Ok) - } - - fn index_value(&mut self, value: u64) -> ValueId { - self.fb.make_imm_value(I256::from(value)) - } - - fn offset_address( - &mut self, - base: ValueId, - units: u64, - space: AddressSpaceKind, - ) -> Result { - if units == 0 { - return Ok(base); - } - let offset = self.index_value(self.scale_for_space(space, units)); - Ok(self - .fb - .insert_inst(Add::new(self.module.inst_set(), base, offset), Type::I256)) - } - - fn scale_for_space(&self, space: AddressSpaceKind, units: u64) -> u64 { - match space { - AddressSpaceKind::Memory | AddressSpaceKind::Calldata | AddressSpaceKind::Code => { - units.saturating_mul(32) - } - AddressSpaceKind::Storage | AddressSpaceKind::Transient => units, - } - } -} - -struct LowerBodyContext<'a, 'db> { - db: &'db DriverDataBase, - body: &'a RuntimeBody<'db>, - context: String, - block: Option, - stmt: Option, -} - -impl<'a, 'db> LowerBodyContext<'a, 'db> { - fn wrap(self, err: LowerError) -> LowerError { - let excerpt = self.block.map_or_else( - || mir::format_runtime_body(self.db, self.body), - |block| mir::format_runtime_body_excerpt(self.db, self.body, block, self.stmt), - ); - match err { - LowerError::RuntimeLower(_) => err, - LowerError::Unsupported(message) => LowerError::Unsupported(format!( - "{}: {message}\n\nrMIR context:\n{}", - self.context, excerpt - )), - LowerError::Internal(message) => LowerError::Internal(format!( - "{}: {message}\n\nrMIR context:\n{}", - self.context, excerpt - )), - } - } -} - -fn block_successors<'db>(terminator: &RTerminator<'db>) -> SmallVec<[RBlockId; 2]> { - match terminator { - RTerminator::Goto(block) => smallvec![*block], - RTerminator::Branch { - then_bb, else_bb, .. - } => smallvec![*then_bb, *else_bb], - RTerminator::SwitchScalar { cases, default, .. } => cases - .iter() - .map(|(_, block)| *block) - .chain(std::iter::once(*default)) - .collect(), - RTerminator::MatchEnumTag { cases, default, .. } => cases - .iter() - .map(|(_, block)| *block) - .chain(default.iter().copied()) - .collect(), - RTerminator::TerminalCall { .. } - | RTerminator::ReturnData { .. } - | RTerminator::Revert { .. } - | RTerminator::SelfDestruct { .. } - | RTerminator::Trap - | RTerminator::Return(_) - | RTerminator::Stop => SmallVec::new(), - } -} - -fn compute_reachable_blocks<'db>(body: &RuntimeBody<'db>) -> Vec { - let mut reachable = vec![false; body.blocks.len()]; - let mut worklist = vec![0usize]; - while let Some(idx) = worklist.pop() { - if std::mem::replace(&mut reachable[idx], true) { - continue; - } - for succ in block_successors(&body.blocks[idx].terminator) { - worklist.push(succ.as_u32() as usize); - } - } - reachable -} - -trait Pipe: Sized { - fn pipe(self, f: impl FnOnce(Self) -> T) -> T { - f(self) - } -} - -impl Pipe for T {} - -fn linkage_for_runtime(linkage: RuntimeLinkage) -> Linkage { - match linkage { - RuntimeLinkage::Private => Linkage::Private, - RuntimeLinkage::Internal => Linkage::Public, - } -} - -fn scalar_ty<'db>(scalar: &ScalarClass<'db>) -> Type { - match scalar.repr { - ScalarRepr::Bool => Type::I1, - ScalarRepr::Int { bits, .. } => int_ty(bits), - ScalarRepr::FixedBytes { len } => fixed_bytes_ty(len), - ScalarRepr::Address { .. } => Type::I256, - } -} - -fn scalar_word_ty<'db>(scalar: &ScalarClass<'db>) -> Type { - match scalar.repr { - ScalarRepr::Bool - | ScalarRepr::Int { .. } - | ScalarRepr::FixedBytes { .. } - | ScalarRepr::Address { .. } => Type::I256, - } -} - -fn intrinsic_prim_from_ty<'db>( - db: &'db DriverDataBase, - ty: TyId<'db>, -) -> Result { - let base_ty = ty.base_ty(db); - let TyData::TyBase(TyBase::Prim(prim)) = base_ty.data(db) else { - return Err(LowerError::Internal(format!( - "intrinsic type must be primitive, got `{}`", - ty.pretty_print(db) - ))); - }; - Ok(*prim) -} - -fn intrinsic_value_type(prim: PrimTy) -> Type { - match prim { - PrimTy::Bool => Type::I1, - PrimTy::U8 | PrimTy::I8 => Type::I8, - PrimTy::U16 | PrimTy::I16 => Type::I16, - PrimTy::U32 | PrimTy::I32 => Type::I32, - PrimTy::U64 | PrimTy::I64 => Type::I64, - PrimTy::U128 | PrimTy::I128 => Type::I128, - PrimTy::U256 | PrimTy::I256 | PrimTy::Usize | PrimTy::Isize => Type::I256, - PrimTy::String - | PrimTy::Array - | PrimTy::Tuple(_) - | PrimTy::Ptr - | PrimTy::View - | PrimTy::BorrowMut - | PrimTy::BorrowRef => Type::I256, - } -} - -fn lower_intrinsic_operand( - fb: &mut FunctionBuilder, - is: &EvmInstSet, - value: ValueId, - prim: PrimTy, - op_ty: Type, -) -> ValueId { - if prim == PrimTy::Bool { - condition_to_i1(fb, value, is) - } else { - cast_int_value(fb, is, value, op_ty, prim.is_signed_int()) - } -} - -fn cast_int_value( - fb: &mut FunctionBuilder, - is: &EvmInstSet, - value: ValueId, - target_ty: Type, - signed: bool, -) -> ValueId { - let current_ty = fb.type_of(value); - if current_ty == target_ty { - return value; - } - - let current_bits = int_bits(current_ty); - let target_bits = int_bits(target_ty); - if current_bits > target_bits { - fb.insert_inst(Trunc::new(is, value, target_ty), target_ty) - } else if current_bits < target_bits { - if signed && current_ty != Type::I1 { - fb.insert_inst(Sext::new(is, value, target_ty), target_ty) - } else { - fb.insert_inst(Zext::new(is, value, target_ty), target_ty) - } - } else { - value - } -} - -fn intrinsic_binary_args<'ctx, 'db, 'a>( - lowerer: &mut FunctionLowerer<'ctx, 'db, 'a>, - args: &[RLocalId], -) -> Result<(ValueId, ValueId), LowerError> { - let [lhs, rhs] = args else { - return Err(LowerError::Internal( - "intrinsic requires 2 arguments".to_string(), - )); - }; - Ok((lowerer.local_value(*lhs)?, lowerer.local_value(*rhs)?)) -} - -fn intrinsic_unary_arg<'ctx, 'db, 'a>( - lowerer: &mut FunctionLowerer<'ctx, 'db, 'a>, - args: &[RLocalId], -) -> Result { - let [value] = args else { - return Err(LowerError::Internal( - "intrinsic requires 1 argument".to_string(), - )); - }; - lowerer.local_value(*value) -} - -fn int_ty(bits: u16) -> Type { - match bits { - 0 | 1 => Type::I1, - 2..=8 => Type::I8, - 9..=16 => Type::I16, - 17..=32 => Type::I32, - 33..=64 => Type::I64, - 65..=128 => Type::I128, - _ => Type::I256, - } -} - -fn fixed_bytes_ty(len: u16) -> Type { - int_ty(len.saturating_mul(8)) -} - -fn int_bits(ty: Type) -> u16 { - match ty { - Type::I1 => 1, - Type::I8 => 8, - Type::I16 => 16, - Type::I32 => 32, - Type::I64 => 64, - Type::I128 => 128, - Type::I256 => 256, - _ => 256, - } -} - -fn bytes_to_i256(bytes: &[u8], signed: bool) -> I256 { - if bytes.is_empty() { - return I256::zero(); - } - let _ = signed; - I256::from_be_bytes(bytes) -} - -fn panic_selector_immediate() -> Immediate { - let mut bytes = [0; 32]; - bytes[..4].copy_from_slice(&[0x4e, 0x48, 0x7b, 0x71]); - Immediate::from_i256(bytes_to_i256(&bytes, false), Type::I256) -} - -fn zero_for_type(fb: &mut FunctionBuilder, ty: Type) -> ValueId { - if ty.is_unit() || ty.is_compound() { - fb.make_undef_value(ty) - } else if ty.is_integral() || ty.is_enum_tag() { - fb.make_imm_value(Immediate::zero(ty)) - } else { - fb.make_undef_value(ty) - } -} - -fn condition_to_i1( - fb: &mut FunctionBuilder, - cond: ValueId, - is: &EvmInstSet, -) -> ValueId { - if fb.type_of(cond) == Type::I1 { - cond - } else { - let zero = zero_for_type(fb, fb.type_of(cond)); - fb.insert_inst(Ne::new(is, cond, zero), Type::I1) - } -} - -fn stable_hash(value: &T) -> u64 { - let mut hasher = DefaultHasher::new(); - value.hash(&mut hasher); - hasher.finish() -} - -fn runtime_section_refs_match<'db>( - db: &'db DriverDataBase, - lhs: &mir::RuntimeSectionRef<'db>, - rhs: &mir::RuntimeSectionRef<'db>, -) -> bool { - let (lhs_object, lhs_section) = match lhs { - mir::RuntimeSectionRef::Local { object, section } - | mir::RuntimeSectionRef::External { object, section } => (object, section), - }; - let (rhs_object, rhs_section) = match rhs { - mir::RuntimeSectionRef::Local { object, section } - | mir::RuntimeSectionRef::External { object, section } => (object, section), - }; - lhs_object.name(db) == rhs_object.name(db) && lhs_section == rhs_section -} - -fn compute_section_membership<'db>( - db: &'db DriverDataBase, - package: &RuntimePackage<'db>, -) -> FxHashMap, Vec>> { - let mut membership = - FxHashMap::, Vec>>::default(); - for object in package.objects(db) { - for section in object.sections(db) { - let section_ref = mir::RuntimeSectionRef::Local { - object, - section: section.name.clone(), - }; - let mut stack = vec![section.entry.instance(db)]; - let mut seen = rustc_hash::FxHashSet::default(); - while let Some(instance) = stack.pop() { - if !seen.insert(instance) { - continue; - } - membership - .entry(instance) - .or_default() - .push(section_ref.clone()); - for call in instance.calls(db) { - stack.push(call.callee); - } - } - } - } - membership -} - -fn code_region_symbol<'db>( - db: &'db DriverDataBase, - package: &RuntimePackage<'db>, - region: mir::RuntimeCodeRegion<'db>, -) -> String { - package - .code_regions(db) - .iter() - .find(|resolved| resolved.region(db) == region) - .map(|resolved| resolved.symbol(db).clone()) - .unwrap_or_else(|| format!("code_region_{}", stable_hash(®ion))) -} - -fn immediate_to_u64_index(imm: Immediate) -> Option { - let value = imm.as_i256(); - if value.is_negative() || value > I256::from(u64::MAX) { - return None; - } - Some(value.to_u256().low_u64()) -} - -trait ProjectionType<'db> { - fn ty_for_object_projection(&mut self, class: &RuntimeClass<'db>) -> Result; - fn ty_for_const_projection(&mut self, class: &RuntimeClass<'db>) -> Result; -} - -impl<'db, 'a> ProjectionType<'db> for ModuleLowerer<'db, 'a> { - fn ty_for_object_projection(&mut self, class: &RuntimeClass<'db>) -> Result { - let field_ty = self.ty_for_class(class)?; - Ok(self.builder.objref_type(field_ty)) - } - - fn ty_for_const_projection(&mut self, class: &RuntimeClass<'db>) -> Result { - let field_ty = self.ty_for_class(class)?; - Ok(self.builder.constref_type(field_ty)) - } -} diff --git a/crates/codegen/src/sonatina/mod.rs b/crates/codegen/src/sonatina/mod.rs deleted file mode 100644 index 58c30a87ff..0000000000 --- a/crates/codegen/src/sonatina/mod.rs +++ /dev/null @@ -1,983 +0,0 @@ -mod lower_runtime; - -use std::collections::{BTreeMap, VecDeque}; - -use common::ingot::Ingot; -use driver::DriverDataBase; -use hir::hir_def::{HirIngot, TopLevelMod}; -use mir::runtime::ir::RuntimePackagePlan; -use mir::{RuntimePackage, build_runtime_package, build_test_runtime_package}; -use rustc_hash::FxHashSet; -use sonatina_codegen::{EvmCompile, OptLevel as SonatinaOptLevel}; -use sonatina_ir::{ - Module, - ir_writer::{FuncWriter, ModuleWriter}, - isa::evm::Evm, - module::{FuncRef, ModuleCtx}, -}; -use sonatina_triple::{Architecture, EvmVersion, OperatingSystem, TargetTriple, Vendor}; -use sonatina_verifier::{ - Location, VerificationLevel, VerificationReport, VerifierConfig, verify_module, -}; - -use crate::{ - OptLevel, TargetDataLayout, TestMetadata, TestModuleOutput, - runtime_package::ensure_runtime_package_has_roots, - test_output::{TestRootMetadataError, runtime_test_root_metadata}, -}; - -#[derive(Debug)] -pub enum LowerError { - RuntimeLower(mir::LowerError), - Unsupported(String), - Internal(String), -} - -impl std::fmt::Display for LowerError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - LowerError::RuntimeLower(err) => write!(f, "{err}"), - LowerError::Unsupported(message) => write!(f, "unsupported: {message}"), - LowerError::Internal(message) => write!(f, "internal error: {message}"), - } - } -} - -impl std::error::Error for LowerError {} - -impl From for LowerError { - fn from(err: mir::LowerError) -> Self { - LowerError::RuntimeLower(err) - } -} - -#[derive(Debug, Clone)] -pub struct SonatinaContractBytecode { - pub deploy: Vec, - pub runtime: Vec, -} - -#[derive(Debug, Clone, Copy, Default)] -pub struct SonatinaTestOptions { - pub emit_observability: bool, -} - -pub(crate) fn create_evm_isa() -> Evm { - Evm::new(TargetTriple::new( - Architecture::Evm, - Vendor::Ethereum, - OperatingSystem::Evm(EvmVersion::Osaka), - )) -} - -fn create_module_ctx() -> ModuleCtx { - ModuleCtx::new(&create_evm_isa()) -} - -fn ensure_module_sonatina_ir_valid(module: &Module) -> Result<(), LowerError> { - let report = verify_module(module, &VerifierConfig::for_level(VerificationLevel::Full)); - if report.has_errors() { - return Err(LowerError::Internal(format_verification_report( - module, &report, - ))); - } - Ok(()) -} - -fn format_verification_report(module: &Module, report: &VerificationReport) -> String { - const MAX_FUNC_CONTEXTS: usize = 3; - - let mut out = report.to_string(); - let funcs = failing_function_contexts(module, report); - if funcs.is_empty() { - return out; - } - - out.push_str("\n\nVerifier function IR context"); - if funcs.len() > MAX_FUNC_CONTEXTS { - out.push_str(&format!( - " (showing first {MAX_FUNC_CONTEXTS} of {})", - funcs.len() - )); - } - out.push_str(":\n"); - - for (func_ref, func_name, func_ir) in funcs.into_iter().take(MAX_FUNC_CONTEXTS) { - out.push_str(&format!( - "\n---- func{} (%{func_name}) ----\n{func_ir}\n", - func_ref.as_u32() - )); - } - - out -} - -fn failing_function_contexts( - module: &Module, - report: &VerificationReport, -) -> Vec<(FuncRef, String, String)> { - let mut funcs = Vec::new(); - for diagnostic in report.errors() { - let Some(func_ref) = diagnostic_func_ref(&diagnostic.primary) else { - continue; - }; - if funcs.iter().any(|(existing, _, _)| *existing == func_ref) - || !module.func_store.contains(func_ref) - { - continue; - } - let Some(func_name) = module - .ctx - .get_sig(func_ref) - .map(|sig| sig.name().to_string()) - else { - continue; - }; - let func_ir = module.func_store.view(func_ref, |func| { - FuncWriter::new(func_ref, func).dump_string() - }); - funcs.push((func_ref, func_name, func_ir)); - } - funcs -} - -fn diagnostic_func_ref(location: &Location) -> Option { - match location { - Location::Function(func) - | Location::Block { func, .. } - | Location::Inst { func, .. } - | Location::Value { func, .. } => Some(*func), - Location::Type { - func: Some(func), .. - } => Some(*func), - Location::Module - | Location::Global(_) - | Location::Object { .. } - | Location::Type { func: None, .. } => None, - } -} - -fn to_sonatina_opt_level(opt_level: OptLevel) -> SonatinaOptLevel { - match opt_level { - OptLevel::O0 => SonatinaOptLevel::O0, - OptLevel::O1 => SonatinaOptLevel::O1, - OptLevel::Os => SonatinaOptLevel::Os, - OptLevel::O2 => SonatinaOptLevel::O2, - } -} - -fn evm_compile(module: Module, opt_level: OptLevel, emit_observability: bool) -> EvmCompile { - EvmCompile::new(module) - .with_opt_level(to_sonatina_opt_level(opt_level)) - .with_observability(emit_observability) -} - -fn format_object_compile_errors(errors: &[sonatina_codegen::object::ObjectCompileError]) -> String { - errors - .iter() - .map(|error| format!("{error:?}")) - .collect::>() - .join("; ") -} - -fn compile_runtime_objects( - module: Module, - opt_level: OptLevel, - emit_observability: bool, -) -> Result, LowerError> { - let mut compile = evm_compile(module, opt_level, emit_observability); - ensure_module_sonatina_ir_valid(compile.optimize())?; - compile - .compile() - .map_err(|errors| LowerError::Internal(format_object_compile_errors(&errors))) -} - -fn section_name_for_runtime(name: &mir::RuntimeSectionName) -> sonatina_ir::SectionName { - match name { - mir::RuntimeSectionName::Init => "init".into(), - mir::RuntimeSectionName::Runtime => "runtime".into(), - mir::RuntimeSectionName::Main => "main".into(), - mir::RuntimeSectionName::Test(name) => format!("test_{name}").into(), - mir::RuntimeSectionName::CodeRegion(symbol) => format!("code_region_{symbol}").into(), - } -} - -fn wrap_as_init_code(runtime: &[u8]) -> Vec { - fn push_u256(mut value: usize) -> Vec { - let mut bytes = Vec::new(); - while value > 0 { - bytes.push((value & 0xff) as u8); - value >>= 8; - } - if bytes.is_empty() { - bytes.push(0); - } - bytes.reverse(); - let mut out = Vec::with_capacity(1 + bytes.len()); - out.push(0x5f + bytes.len() as u8); - out.extend(bytes); - out - } - - let len_push = push_u256(runtime.len()); - let mut init = Vec::with_capacity(32 + runtime.len()); - init.extend(len_push.clone()); - init.push(0x61); - let off_pos = init.len(); - init.extend([0, 0]); - init.extend([0x60, 0x00]); - init.push(0x39); - init.extend(len_push); - init.extend([0x60, 0x00]); - init.push(0xf3); - let off = init.len(); - init[off_pos] = ((off >> 8) & 0xff) as u8; - init[off_pos + 1] = (off & 0xff) as u8; - init.extend_from_slice(runtime); - init -} - -pub fn compile_runtime_package_sonatina( - db: &DriverDataBase, - package: &RuntimePackage<'_>, - layout: TargetDataLayout, -) -> Result { - lower_runtime::compile_runtime_package_sonatina(db, package, layout) -} - -fn select_runtime_package_contract<'db>( - db: &'db dyn mir::MirDb, - package: RuntimePackage<'db>, - contract: Option<&str>, -) -> Result, LowerError> { - let Some(contract) = contract else { - return Ok(package); - }; - let matches = root_objects_named(db, package, contract); - match matches.as_slice() { - [] => Err(LowerError::Internal(format!( - "root object `{contract}` not found in runtime package" - ))), - [root] => Ok(filter_runtime_package_to_root_objects( - db, - package, - &[*root], - )), - _ => Err(LowerError::Internal(format!( - "multiple root objects named `{contract}` in runtime package" - ))), - } -} - -fn select_ingot_runtime_packages<'db>( - db: &'db dyn mir::MirDb, - ingot: Ingot<'db>, - contract: Option<&str>, -) -> Result>, LowerError> { - let mut packages = Vec::new(); - for &top_mod in ingot.all_modules(db) { - let Some(package) = mir::build_ingot_module_runtime_package(db, top_mod)? else { - continue; - }; - let Some(contract) = contract else { - packages.push(package); - continue; - }; - let matches = root_objects_named(db, package, contract); - if matches.len() > 1 { - return Err(LowerError::Internal(format!( - "multiple root objects named `{contract}` in runtime package" - ))); - } - if let Some(root) = matches.first().copied() { - packages.push(filter_runtime_package_to_root_objects(db, package, &[root])); - } - } - if let Some(contract) = contract { - if packages.is_empty() { - return Err(LowerError::Internal(format!( - "root object `{contract}` not found in ingot runtime packages" - ))); - } - if packages.len() > 1 { - return Err(LowerError::Internal(format!( - "duplicate root object `{contract}` across ingot modules" - ))); - } - } - Ok(packages) -} - -fn root_objects_named<'db>( - db: &'db dyn mir::MirDb, - package: RuntimePackage<'db>, - name: &str, -) -> Vec> { - package - .root_objects(db) - .into_iter() - .filter(|object| object.name(db) == name) - .collect() -} - -fn filter_runtime_package_to_root_objects<'db>( - db: &'db dyn mir::MirDb, - package: RuntimePackage<'db>, - roots: &[mir::RuntimeObject<'db>], -) -> RuntimePackage<'db> { - let root_names = roots - .iter() - .map(|object| object.name(db).clone()) - .collect::>(); - let package_objects = package.objects(db); - let section_set = reachable_sections(db, &package_objects, roots); - let objects = package - .objects(db) - .into_iter() - .filter_map(|object| { - let sections = object - .sections(db) - .into_iter() - .filter(|section| { - section_set.contains(&runtime_section_key(db, object, §ion.name)) - }) - .collect::>(); - (!sections.is_empty()) - .then(|| mir::RuntimeObject::new(db, object.name(db).clone(), sections)) - }) - .collect::>(); - let function_set = reachable_functions(db, &objects); - let functions = package - .functions(db) - .into_iter() - .filter(|function| function_set.contains(&function.instance(db))) - .collect::>(); - let const_region_set = reachable_const_regions(db, &objects, &functions); - let const_regions = package - .const_regions(db) - .into_iter() - .filter(|region| const_region_set.contains(region)) - .collect::>(); - let code_regions = package - .code_regions(db) - .into_iter() - .filter(|region| section_set.contains(§ion_ref_key(db, region.source(db)))) - .collect::>(); - let root_objects = package - .objects(db) - .into_iter() - .filter(|object| root_names.contains(&object.name(db))) - .filter_map(|object| { - objects - .iter() - .find(|filtered| filtered.name(db) == object.name(db)) - .copied() - }) - .collect::>(); - let primary_object = package - .primary_object(db) - .filter(|object| root_names.contains(&object.name(db))) - .and_then(|object| { - objects - .iter() - .find(|filtered| filtered.name(db) == object.name(db)) - .copied() - }) - .or_else(|| root_objects.first().copied()); - - RuntimePackage::new( - db, - package.top_mod(db), - functions, - RuntimePackagePlan::new( - db, - objects, - const_regions, - code_regions, - root_objects, - primary_object, - ), - ) -} - -fn reachable_sections<'db>( - db: &'db dyn mir::MirDb, - objects: &[mir::RuntimeObject<'db>], - roots: &[mir::RuntimeObject<'db>], -) -> FxHashSet<(String, mir::RuntimeSectionName)> { - let mut seen = FxHashSet::default(); - let mut queue = roots - .iter() - .flat_map(|object| { - object - .sections(db) - .into_iter() - .map(|section| runtime_section_key(db, *object, §ion.name)) - }) - .collect::>(); - while let Some((object_name, section_name)) = queue.pop_front() { - if !seen.insert((object_name.clone(), section_name.clone())) { - continue; - } - for section in objects - .iter() - .flat_map(|object| { - object - .sections(db) - .into_iter() - .map(move |section| (*object, section)) - }) - .filter(|(object, _)| object.name(db) == object_name) - .filter(|(_, section)| section.name == section_name) - .map(|(_, section)| section) - { - for embed in section.embeds { - queue.push_back(section_ref_key(db, embed.source)); - } - } - } - seen -} - -fn runtime_section_key<'db>( - db: &'db dyn mir::MirDb, - object: mir::RuntimeObject<'db>, - section: &mir::RuntimeSectionName, -) -> (String, mir::RuntimeSectionName) { - (object.name(db).clone(), section.clone()) -} - -fn section_ref_key<'db>( - db: &'db dyn mir::MirDb, - section_ref: mir::RuntimeSectionRef<'db>, -) -> (String, mir::RuntimeSectionName) { - match section_ref { - mir::RuntimeSectionRef::Local { object, section } - | mir::RuntimeSectionRef::External { object, section } => { - runtime_section_key(db, object, §ion) - } - } -} - -fn reachable_functions<'db>( - db: &'db dyn mir::MirDb, - objects: &[mir::RuntimeObject<'db>], -) -> FxHashSet> { - let mut seen = FxHashSet::default(); - let mut queue = objects - .iter() - .flat_map(|object| object.sections(db)) - .map(|section| section.entry.instance(db)) - .collect::>(); - while let Some(instance) = queue.pop_front() { - if !seen.insert(instance) { - continue; - } - for call in instance.calls(db) { - queue.push_back(call.callee); - } - } - seen -} - -fn reachable_const_regions<'db>( - db: &'db dyn mir::MirDb, - objects: &[mir::RuntimeObject<'db>], - functions: &[mir::RuntimeFunction<'db>], -) -> FxHashSet> { - let mut seen = FxHashSet::default(); - for section in objects.iter().flat_map(|object| object.sections(db)) { - seen.extend(section.const_regions); - } - for function in functions { - seen.extend(function.referenced_const_regions(db)); - } - seen -} - -pub fn emit_runtime_package_sonatina_ir( - db: &DriverDataBase, - package: &RuntimePackage<'_>, - layout: TargetDataLayout, -) -> Result { - ensure_runtime_package_has_roots(db, package, "Sonatina IR")?; - let module = compile_runtime_package_sonatina(db, package, layout)?; - let mut writer = ModuleWriter::new(&module); - Ok(writer.dump_string()) -} - -pub fn emit_runtime_package_sonatina_ir_optimized( - db: &DriverDataBase, - package: &RuntimePackage<'_>, - layout: TargetDataLayout, - opt_level: OptLevel, -) -> Result { - ensure_runtime_package_has_roots(db, package, "Sonatina IR")?; - let module = compile_runtime_package_sonatina(db, package, layout)?; - ensure_module_sonatina_ir_valid(&module)?; - let mut compile = evm_compile(module, opt_level, false); - let optimized = compile.optimize(); - ensure_module_sonatina_ir_valid(optimized)?; - let mut writer = ModuleWriter::new(optimized); - Ok(writer.dump_string()) -} - -pub fn emit_runtime_package_sonatina_bytecode( - db: &DriverDataBase, - package: &RuntimePackage<'_>, - layout: TargetDataLayout, - opt_level: OptLevel, -) -> Result, LowerError> { - ensure_runtime_package_has_roots(db, package, "Sonatina bytecode")?; - let module = compile_runtime_package_sonatina(db, package, layout)?; - ensure_module_sonatina_ir_valid(&module)?; - let artifacts = compile_runtime_objects(module, opt_level, false)?; - let artifacts_by_name = artifacts - .iter() - .map(|artifact| (artifact.object.0.as_str(), artifact)) - .collect::>(); - - let mut out = BTreeMap::new(); - for object in package.root_objects(db) { - let object_name = object.name(db); - let artifact = artifacts_by_name - .get(object_name.as_str()) - .copied() - .ok_or_else(|| { - LowerError::Internal(format!("compiled object `{object_name}` not found")) - })?; - let init = artifact - .sections - .get(§ion_name_for_runtime(&mir::RuntimeSectionName::Init)); - let runtime = artifact - .sections - .get(§ion_name_for_runtime(&mir::RuntimeSectionName::Runtime)); - let (deploy, runtime) = match (init, runtime) { - (Some(init), Some(runtime)) => (init.bytes.clone(), runtime.bytes.clone()), - _ => { - let sections = object.sections(db); - let section = sections.first().ok_or_else(|| { - LowerError::Internal(format!("root object `{object_name}` has no sections")) - })?; - let runtime = artifact - .sections - .get(§ion_name_for_runtime(§ion.name)) - .ok_or_else(|| { - LowerError::Internal(format!( - "compiled object `{object_name}` is missing section `{:?}`", - section.name - )) - })? - .bytes - .clone(); - (wrap_as_init_code(&runtime), runtime) - } - }; - out.insert( - object_name.clone(), - SonatinaContractBytecode { deploy, runtime }, - ); - } - Ok(out) -} - -pub fn emit_module_sonatina_ir( - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, -) -> Result { - let package = build_runtime_package(db, top_mod)?; - emit_runtime_package_sonatina_ir(db, &package, crate::EVM_LAYOUT) -} - -pub fn emit_module_sonatina_ir_optimized( - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, - opt_level: OptLevel, - contract: Option<&str>, -) -> Result { - let package = build_runtime_package(db, top_mod)?; - let package = select_runtime_package_contract(db, package, contract)?; - emit_runtime_package_sonatina_ir_optimized(db, &package, crate::EVM_LAYOUT, opt_level) -} - -pub fn emit_ingot_sonatina_ir(db: &DriverDataBase, ingot: Ingot<'_>) -> Result { - let mut modules = Vec::new(); - for &top_mod in ingot.all_modules(db) { - let Some(package) = mir::build_ingot_module_runtime_package(db, top_mod)? else { - continue; - }; - modules.push(emit_runtime_package_sonatina_ir( - db, - &package, - crate::EVM_LAYOUT, - )?); - } - if modules.is_empty() { - return Err(mir::LowerError::Unsupported( - "runtime package has no root objects; refusing to emit target-only Sonatina IR" - .to_string(), - ) - .into()); - } - Ok(modules.join("\n\n")) -} - -pub fn emit_ingot_sonatina_ir_optimized( - db: &DriverDataBase, - ingot: Ingot<'_>, - opt_level: OptLevel, - contract: Option<&str>, -) -> Result { - let mut modules = Vec::new(); - for package in select_ingot_runtime_packages(db, ingot, contract)? { - modules.push(emit_runtime_package_sonatina_ir_optimized( - db, - &package, - crate::EVM_LAYOUT, - opt_level, - )?); - } - if modules.is_empty() { - return Err(mir::LowerError::Unsupported( - "runtime package has no root objects; refusing to emit target-only Sonatina IR" - .to_string(), - ) - .into()); - } - Ok(modules.join("\n\n")) -} - -pub fn validate_module_sonatina_ir( - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, -) -> Result { - let package = build_runtime_package(db, top_mod)?; - compile_runtime_package_sonatina(db, &package, crate::EVM_LAYOUT)?; - Ok("ok\n".to_string()) -} - -pub fn emit_module_sonatina_bytecode( - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, - opt_level: OptLevel, - contract: Option<&str>, -) -> Result, LowerError> { - let package = build_runtime_package(db, top_mod)?; - let package = select_runtime_package_contract(db, package, contract)?; - emit_runtime_package_sonatina_bytecode(db, &package, crate::EVM_LAYOUT, opt_level) -} - -pub fn emit_ingot_sonatina_bytecode( - db: &DriverDataBase, - ingot: Ingot<'_>, - opt_level: OptLevel, - contract: Option<&str>, -) -> Result, LowerError> { - let mut outputs = BTreeMap::new(); - for package in select_ingot_runtime_packages(db, ingot, contract)? { - for (name, bytecode) in - emit_runtime_package_sonatina_bytecode(db, &package, crate::EVM_LAYOUT, opt_level)? - { - if outputs.insert(name.clone(), bytecode).is_some() { - return Err(LowerError::Internal(format!( - "duplicate root object `{name}` across ingot modules" - ))); - } - } - } - if outputs.is_empty() { - return Err(mir::LowerError::Unsupported( - "runtime package has no root objects; refusing to emit target-only Sonatina bytecode" - .to_string(), - ) - .into()); - } - Ok(outputs) -} - -pub fn emit_test_module_sonatina( - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, - opt_level: OptLevel, - options: SonatinaTestOptions, - filter: Option<&str>, -) -> Result { - let package = build_test_runtime_package(db, top_mod, filter)?; - if package.root_objects(db).is_empty() { - return Ok(TestModuleOutput { tests: Vec::new() }); - } - let module = compile_runtime_package_sonatina(db, &package, crate::EVM_LAYOUT)?; - ensure_module_sonatina_ir_valid(&module)?; - let artifacts = compile_runtime_objects(module, opt_level, options.emit_observability)?; - let artifacts_by_name = artifacts - .iter() - .map(|artifact| (artifact.object.0.as_str(), artifact)) - .collect::>(); - - let mut tests = Vec::new(); - for object in package.root_objects(db) { - let sections = object.sections(db); - let Some(section) = sections.first() else { - continue; - }; - let mir::RuntimeSectionName::Test(_) = §ion.name else { - continue; - }; - let artifact = artifacts_by_name - .get(object.name(db).as_str()) - .copied() - .ok_or_else(|| { - LowerError::Internal(format!("compiled object `{}` not found", object.name(db))) - })?; - let runtime = artifact - .sections - .get(§ion_name_for_runtime(§ion.name)) - .ok_or_else(|| { - LowerError::Internal(format!( - "compiled object `{}` missing test section", - object.name(db) - )) - })?; - let metadata = runtime_test_root_metadata(db, §ion.entry.owner(db), §ion.name) - .map_err(|err| match err { - TestRootMetadataError::InvalidPackage(message) => LowerError::Internal(message), - TestRootMetadataError::Unsupported(message) => LowerError::Unsupported(message), - })?; - tests.push(TestMetadata { - display_name: metadata.display_name, - hir_name: metadata.hir_name, - symbol_name: section.entry.symbol(db).clone(), - object_name: object.name(db).clone(), - bytecode: wrap_as_init_code(&runtime.bytes), - sonatina_observability_json: artifact.observability_json(), - value_param_count: 0, - effect_param_count: 0, - init_bytecode: Vec::new(), - expected_revert: metadata.expected_revert, - initial_balance: metadata.initial_balance, - }); - } - Ok(TestModuleOutput { tests }) -} - -pub fn emit_test_ingot_sonatina( - db: &DriverDataBase, - ingot: Ingot<'_>, - opt_level: OptLevel, - options: SonatinaTestOptions, - filter: Option<&str>, -) -> Result { - let mut top_mods = ingot.all_modules(db).to_vec(); - top_mods.sort_by(|left, right| left.name(db).cmp(&right.name(db))); - - let mut output = TestModuleOutput { tests: Vec::new() }; - for top_mod in top_mods { - output.extend(emit_test_module_sonatina( - db, top_mod, opt_level, options, filter, - )?); - } - output.sort_tests(); - Ok(output) -} - -#[cfg(test)] -mod tests { - use super::*; - use common::InputDb; - use driver::DriverDataBase; - use std::{fs, path::PathBuf}; - use url::Url; - - fn temp_fixture_url(name: &str) -> Url { - let fixture_path = std::env::temp_dir().join(name); - Url::from_file_path(&fixture_path).expect("fixture path should be absolute") - } - - #[test] - fn fe_opt_levels_map_to_sonatina_opt_levels() { - assert_eq!(to_sonatina_opt_level(OptLevel::O0), SonatinaOptLevel::O0); - assert_eq!(to_sonatina_opt_level(OptLevel::O1), SonatinaOptLevel::O1); - assert_eq!(to_sonatina_opt_level(OptLevel::Os), SonatinaOptLevel::Os); - assert_eq!(to_sonatina_opt_level(OptLevel::O2), SonatinaOptLevel::O2); - } - - #[test] - fn module_sonatina_bytecode_respects_contract_filter() { - let mut db = DriverDataBase::default(); - let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("../fe/tests/fixtures/cli_output/build/multi_contract.fe"); - let fixture_source = - fs::read_to_string(&fixture_path).expect("multi_contract fixture should be readable"); - let file_url = Url::from_file_path(&fixture_path).expect("fixture path should be absolute"); - db.workspace() - .touch(&mut db, file_url.clone(), Some(fixture_source)); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - let bytecode = emit_module_sonatina_bytecode(&db, top_mod, OptLevel::O0, Some("Foo")) - .expect("selected contract should compile"); - let keys = bytecode.keys().map(String::as_str).collect::>(); - - assert_eq!( - keys, - vec!["Foo"], - "selected contract bytecode should exclude unselected roots" - ); - } - - #[test] - fn result_map_chain_test_runtime_package_retains_value_enum_asserts() { - let mut db = DriverDataBase::default(); - let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("../fe/tests/fixtures/fe_test/result_map_chain_infers_independently.fe"); - let fixture_source = fs::read_to_string(&fixture_path) - .expect("result_map_chain_infers_independently fixture should be readable"); - let file_url = Url::from_file_path(&fixture_path).expect("fixture path should be absolute"); - db.workspace() - .touch(&mut db, file_url.clone(), Some(fixture_source)); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - let package = build_test_runtime_package(&db, top_mod, None) - .expect("test runtime package should build"); - - let module = compile_runtime_package_sonatina(&db, &package, crate::EVM_LAYOUT) - .expect("test runtime package should lower to Sonatina IR"); - let dumped = ModuleWriter::new(&module).dump_string(); - let map_helpers = dumped - .lines() - .filter(|line| line.starts_with("func private %map")) - .collect::>(); - assert_eq!( - map_helpers.len(), - 2, - "expected two map helpers in test runtime package:\n{dumped}" - ); - assert!( - map_helpers - .iter() - .all(|line| line.starts_with("func private %map__g")), - "expected colliding map helpers to include generic discriminators:\n{dumped}" - ); - assert!( - dumped.contains("func private %unwrap"), - "expected unwrap helper in test runtime package:\n{dumped}" - ); - assert!( - dumped.contains("enum.assert_variant"), - "expected value enum proofs in test runtime package:\n{dumped}" - ); - - if let Err(err) = ensure_module_sonatina_ir_valid(&module) { - panic!("pre-opt test module should verify: {err}\n\n{dumped}"); - } - compile_runtime_objects(module, OptLevel::O0, false) - .expect("test runtime package should compile"); - } - - #[test] - fn int_downcast_test_runtime_package_verifies_with_enum_param_init_cfg() { - let mut db = DriverDataBase::default(); - let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("../fe/tests/fixtures/fe_test/int_downcast.fe"); - let fixture_source = - fs::read_to_string(&fixture_path).expect("int_downcast fixture should be readable"); - let file_url = Url::from_file_path(&fixture_path).expect("fixture path should be absolute"); - db.workspace() - .touch(&mut db, file_url.clone(), Some(fixture_source)); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - let package = build_test_runtime_package(&db, top_mod, None) - .expect("test runtime package should build"); - - let module = compile_runtime_package_sonatina(&db, &package, crate::EVM_LAYOUT) - .expect("test runtime package should lower to Sonatina IR"); - let dumped = ModuleWriter::new(&module).dump_string(); - - if let Err(err) = ensure_module_sonatina_ir_valid(&module) { - panic!("pre-opt test module should verify: {err}\n\n{dumped}"); - } - compile_runtime_objects(module, OptLevel::O0, false) - .expect("test runtime package should compile"); - } - - #[test] - fn enum_state_machine_test_runtime_package_supports_storage_enum_roundtrips() { - let mut db = DriverDataBase::default(); - let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("../fe/tests/fixtures/fe_test/enum_state_machine.fe"); - let fixture_source = fs::read_to_string(&fixture_path) - .expect("enum_state_machine fixture should be readable"); - let file_url = Url::from_file_path(&fixture_path).expect("fixture path should be absolute"); - db.workspace() - .touch(&mut db, file_url.clone(), Some(fixture_source)); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - let package = build_test_runtime_package(&db, top_mod, None) - .expect("test runtime package should build"); - - let module = compile_runtime_package_sonatina(&db, &package, crate::EVM_LAYOUT) - .expect("test runtime package should lower to Sonatina IR"); - let dumped = ModuleWriter::new(&module).dump_string(); - - if let Err(err) = ensure_module_sonatina_ir_valid(&module) { - panic!("pre-opt test module should verify: {err}\n\n{dumped}"); - } - compile_runtime_objects(module, OptLevel::O0, false) - .expect("test runtime package should compile"); - } - - #[test] - fn if_both_arms_return_test_runtime_package_has_no_empty_unreachable_blocks() { - let mut db = DriverDataBase::default(); - let file_url = temp_fixture_url("if_both_arms_return_sonatina_runtime.fe"); - db.workspace().touch( - &mut db, - file_url.clone(), - Some( - r#" -fn f(x: u256) -> u256 { - if x == 0 { - return 1 - } else { - return 2 - } -} - -#[test] -fn roundtrip() { - assert!(f(0) == 1) - assert!(f(1) == 2) -} -"# - .to_string(), - ), - ); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - - emit_test_module_sonatina( - &db, - top_mod, - OptLevel::O0, - SonatinaTestOptions::default(), - None, - ) - .expect( - "if branches that both return should lower without empty unreachable Sonatina blocks", - ); - } -} diff --git a/crates/codegen/src/test_output.rs b/crates/codegen/src/test_output.rs deleted file mode 100644 index fbcdb02fc5..0000000000 --- a/crates/codegen/src/test_output.rs +++ /dev/null @@ -1,248 +0,0 @@ -use driver::DriverDataBase; -use hir::{ - HirDb, - analysis::ty::ty_check::BodyOwner, - hir_def::{ItemKind, LitKind, attr::AttrArgValue}, -}; -use num_bigint::BigUint; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct TestMetadata { - pub display_name: String, - pub hir_name: String, - pub symbol_name: String, - pub object_name: String, - pub bytecode: Vec, - pub sonatina_observability_json: Option, - pub value_param_count: usize, - pub effect_param_count: usize, - pub init_bytecode: Vec, - pub expected_revert: Option, - pub initial_balance: Option>, -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum ExpectedRevert { - Any, - Selector([u8; 4]), - PanicCode(Vec), -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct TestModuleOutput { - pub tests: Vec, -} - -impl TestModuleOutput { - pub(crate) fn extend(&mut self, other: Self) { - self.tests.extend(other.tests); - } - - pub(crate) fn sort_tests(&mut self) { - self.tests.sort_by(|left, right| { - left.display_name - .cmp(&right.display_name) - .then_with(|| left.hir_name.cmp(&right.hir_name)) - .then_with(|| left.symbol_name.cmp(&right.symbol_name)) - .then_with(|| left.object_name.cmp(&right.object_name)) - }); - } -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub(crate) struct TestRootMetadata { - pub hir_name: String, - pub display_name: String, - pub expected_revert: Option, - pub initial_balance: Option>, -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub(crate) enum TestRootMetadataError { - InvalidPackage(String), - Unsupported(String), -} - -pub(crate) fn runtime_test_root_metadata<'db>( - db: &'db DriverDataBase, - owner: &mir::RuntimeFunctionOwner<'db>, - section_name: &mir::RuntimeSectionName, -) -> Result { - let mir::RuntimeSectionName::Test(hir_name) = section_name else { - return Err(TestRootMetadataError::InvalidPackage(format!( - "non-test section `{section_name:?}` used as a test root" - ))); - }; - let mir::RuntimeFunctionOwner::Synthetic(mir::RuntimeSyntheticSpec::TestRoot { - callee, .. - }) = owner - else { - return Err(TestRootMetadataError::InvalidPackage(format!( - "test section `{hir_name}` does not use a TestRoot wrapper" - ))); - }; - let Some(semantic) = callee.key(db).semantic(db) else { - return Err(TestRootMetadataError::InvalidPackage(format!( - "test section `{hir_name}` does not target a semantic instance" - ))); - }; - let BodyOwner::Func(func) = semantic.key(db).owner(db) else { - return Err(TestRootMetadataError::InvalidPackage(format!( - "test section `{hir_name}` does not target a function body" - ))); - }; - let attrs = ItemKind::from(func).attrs(db).ok_or_else(|| { - TestRootMetadataError::InvalidPackage(format!("test function `{hir_name}` has no attrs")) - })?; - let test_attr = attrs.get_attr(db, "test").ok_or_else(|| { - TestRootMetadataError::InvalidPackage(format!( - "test function `{hir_name}` is missing #[test]" - )) - })?; - let expected_revert = parse_expected_revert(db, hir_name, test_attr) - .map_err(TestRootMetadataError::Unsupported)?; - let initial_balance = parse_test_balance_arg(db, hir_name, test_attr)?; - Ok(TestRootMetadata { - hir_name: hir_name.clone(), - display_name: hir_name.clone(), - expected_revert, - initial_balance, - }) -} - -fn parse_test_balance_arg<'db>( - db: &'db dyn HirDb, - test_name: &str, - test_attr: &hir::hir_def::attr::NormalAttr<'db>, -) -> Result>, TestRootMetadataError> { - let balance = parse_test_attr_int_arg( - db, - test_name, - test_attr, - "balance", - "balance = ...", - "u256", - 32, - ) - .map_err(TestRootMetadataError::Unsupported)?; - Ok(balance.map(|value| value.to_bytes_be())) -} - -pub fn parse_expected_revert<'db>( - db: &'db dyn HirDb, - test_name: &str, - test_attr: &hir::hir_def::attr::NormalAttr<'db>, -) -> Result, String> { - let should_revert = test_attr.has_arg(db, "should_revert"); - let has_panic = has_test_attr_key(db, test_attr, "panic"); - let has_selector = has_test_attr_key(db, test_attr, "selector"); - - if !should_revert { - if has_panic && has_selector { - return Err(format!( - "invalid #[test] function `{test_name}`: `panic = ...` and `selector = ...` require `should_revert`" - )); - } - if has_panic { - return Err(format!( - "invalid #[test] function `{test_name}`: `panic = ...` requires `should_revert`" - )); - } - if has_selector { - return Err(format!( - "invalid #[test] function `{test_name}`: `selector = ...` requires `should_revert`" - )); - } - return Ok(None); - } - - let panic = parse_test_attr_int_arg( - db, - test_name, - test_attr, - "panic", - "should_revert, panic = ...", - "u256", - 32, - )?; - let selector = parse_test_attr_int_arg( - db, - test_name, - test_attr, - "selector", - "should_revert, selector = ...", - "u32", - 4, - )?; - - if panic.is_some() && selector.is_some() { - return Err(format!( - "invalid #[test] function `{test_name}`: #[test(should_revert)] cannot combine `panic = ...` and `selector = ...`" - )); - } - - if let Some(code) = panic { - let mut payload = Vec::with_capacity(36); - payload.extend_from_slice(&[0x4e, 0x48, 0x7b, 0x71]); - let code_bytes = code.to_bytes_be(); - let mut padded = [0u8; 32]; - padded[32 - code_bytes.len()..].copy_from_slice(&code_bytes); - payload.extend_from_slice(&padded); - return Ok(Some(ExpectedRevert::PanicCode(payload))); - } - - if let Some(sel) = selector { - let bytes = sel.to_bytes_be(); - let mut selector = [0u8; 4]; - selector[4 - bytes.len()..].copy_from_slice(&bytes); - return Ok(Some(ExpectedRevert::Selector(selector))); - } - - Ok(Some(ExpectedRevert::Any)) -} - -fn has_test_attr_key<'db>( - db: &'db dyn HirDb, - test_attr: &hir::hir_def::attr::NormalAttr<'db>, - key: &str, -) -> bool { - test_attr - .args - .iter() - .any(|arg| arg.key_str(db) == Some(key)) -} - -fn parse_test_attr_int_arg<'db>( - db: &'db dyn HirDb, - test_name: &str, - test_attr: &hir::hir_def::attr::NormalAttr<'db>, - key: &str, - attr_form: &str, - type_name: &str, - max_bytes: usize, -) -> Result, String> { - for arg in &test_attr.args { - if arg.key_str(db) != Some(key) { - continue; - } - let Some(value) = arg.value.as_ref() else { - return Err(format!( - "invalid #[test] function `{test_name}`: #[test({attr_form})] expects an integer literal" - )); - }; - let AttrArgValue::Lit(LitKind::Int(int_id)) = value else { - return Err(format!( - "invalid #[test] function `{test_name}`: #[test({attr_form})] expects an integer literal" - )); - }; - let value = int_id.data(db).clone(); - if value.to_bytes_be().len() > max_bytes { - return Err(format!( - "invalid #[test] function `{test_name}`: #[test({attr_form})] must fit in {type_name}" - )); - } - return Ok(Some(value)); - } - - Ok(None) -} diff --git a/crates/codegen/tests/code_region_borrowck.rs b/crates/codegen/tests/code_region_borrowck.rs deleted file mode 100644 index 571c19eeb2..0000000000 --- a/crates/codegen/tests/code_region_borrowck.rs +++ /dev/null @@ -1,61 +0,0 @@ -use common::InputDb; -use driver::DriverDataBase; -use std::path::PathBuf; -use url::Url; - -#[test] -fn code_region_fixture_has_no_semantic_borrow_diagnostics() { - let mut db = DriverDataBase::default(); - let fixture = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/code_region.fe"); - let file_url = Url::from_file_path(&fixture).expect("fixture path should be absolute"); - let content = std::fs::read_to_string(&fixture).expect("fixture should load"); - db.workspace() - .touch(&mut db, file_url.clone(), Some(content)); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - let diags = db.mir_diagnostics_for_top_mod(top_mod); - assert!( - diags - .iter() - .all(|diag| !diag.message.contains("move conflict")), - "{diags:#?}" - ); - assert!( - diags - .iter() - .all(|diag| !diag.message.contains("internal borrow checking error")), - "{diags:#?}" - ); -} - -#[test] -fn erc20_low_level_fixture_has_no_semantic_borrow_diagnostics() { - let mut db = DriverDataBase::default(); - let fixture = - PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/erc20_low_level.fe"); - let file_url = Url::from_file_path(&fixture).expect("fixture path should be absolute"); - let content = std::fs::read_to_string(&fixture).expect("fixture should load"); - db.workspace() - .touch(&mut db, file_url.clone(), Some(content)); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - let diags = db.mir_diagnostics_for_top_mod(top_mod); - assert!( - diags - .iter() - .all(|diag| !diag.message.contains("move conflict")), - "{diags:#?}" - ); - assert!( - diags - .iter() - .all(|diag| !diag.message.contains("internal borrow checking error")), - "{diags:#?}" - ); -} diff --git a/crates/codegen/tests/fixtures/alloc.fe b/crates/codegen/tests/fixtures/alloc.fe deleted file mode 100644 index 126e71ecde..0000000000 --- a/crates/codegen/tests/fixtures/alloc.fe +++ /dev/null @@ -1,9 +0,0 @@ -use std::evm::alloc - -pub fn bump(size: u256) -> u256 { - alloc(size) -} - -pub fn bump_const() -> u256 { - alloc(64) -} diff --git a/crates/codegen/tests/fixtures/alloc_self_assign.fe b/crates/codegen/tests/fixtures/alloc_self_assign.fe deleted file mode 100644 index f5a1512e54..0000000000 --- a/crates/codegen/tests/fixtures/alloc_self_assign.fe +++ /dev/null @@ -1,11 +0,0 @@ -use std::evm::alloc - -pub fn bump_self_assign(size: u256) -> u256 { - let mut x: u256 = size - x = alloc(x) - x -} - -pub fn main() -> u256 { - bump_self_assign(64) -} diff --git a/crates/codegen/tests/fixtures/arg_bindings.fe b/crates/codegen/tests/fixtures/arg_bindings.fe deleted file mode 100644 index 6dcf7c2d46..0000000000 --- a/crates/codegen/tests/fixtures/arg_bindings.fe +++ /dev/null @@ -1,8 +0,0 @@ -pub fn arg_bindings(x: u64, y: u64) -> u64 { - let z = x + y - z -} - -pub fn main() -> u64 { - arg_bindings(1, 2) -} diff --git a/crates/codegen/tests/fixtures/array_literal.fe b/crates/codegen/tests/fixtures/array_literal.fe deleted file mode 100644 index a531c2c440..0000000000 --- a/crates/codegen/tests/fixtures/array_literal.fe +++ /dev/null @@ -1,13 +0,0 @@ -pub fn large_array_literal() -> [u8; 64] { - let arr: [u8; 64] = [ - 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64 - ] - arr -} diff --git a/crates/codegen/tests/fixtures/array_literal_u256.fe b/crates/codegen/tests/fixtures/array_literal_u256.fe deleted file mode 100644 index 2482e37c87..0000000000 --- a/crates/codegen/tests/fixtures/array_literal_u256.fe +++ /dev/null @@ -1,4 +0,0 @@ -pub fn fixed_u256_array_literal() -> [u256; 4] { - let arr: [u256; 4] = [1, 2, 3, 4] - arr -} diff --git a/crates/codegen/tests/fixtures/array_mut.fe b/crates/codegen/tests/fixtures/array_mut.fe deleted file mode 100644 index f4cd1e3e6c..0000000000 --- a/crates/codegen/tests/fixtures/array_mut.fe +++ /dev/null @@ -1,8 +0,0 @@ -pub fn array_mut(x: u8) -> [u8; 4] { - let arr: [u8; 4] = [x, 2, 3, 4] - arr -} - -pub fn main() -> [u8; 4] { - array_mut(1) -} diff --git a/crates/codegen/tests/fixtures/aug_assign.fe b/crates/codegen/tests/fixtures/aug_assign.fe deleted file mode 100644 index e41c4a71d4..0000000000 --- a/crates/codegen/tests/fixtures/aug_assign.fe +++ /dev/null @@ -1,10 +0,0 @@ -pub fn aug_assign(x: u64, y: u64) -> u64 { - let mut acc: u64 = x - acc += y - acc *= 2 - acc / 2 -} - -pub fn main() -> u64 { - aug_assign(1, 2) -} diff --git a/crates/codegen/tests/fixtures/aug_assign_bit_ops.fe b/crates/codegen/tests/fixtures/aug_assign_bit_ops.fe deleted file mode 100644 index 92d45154da..0000000000 --- a/crates/codegen/tests/fixtures/aug_assign_bit_ops.fe +++ /dev/null @@ -1,14 +0,0 @@ -pub fn aug_assign_bit_ops(x: u256, y: u256) -> u256 { - let mut acc: u256 = x - acc **= y - acc <<= 3 - acc >>= 1 - acc &= 0xff - acc |= 1 - acc ^= 2 - acc -} - -pub fn main() -> u256 { - aug_assign_bit_ops(3, 2) -} diff --git a/crates/codegen/tests/fixtures/bit_and.fe b/crates/codegen/tests/fixtures/bit_and.fe deleted file mode 100644 index 65934aafbd..0000000000 --- a/crates/codegen/tests/fixtures/bit_and.fe +++ /dev/null @@ -1,3 +0,0 @@ -pub fn bit_and() -> u64 { - 1 & 2 -} diff --git a/crates/codegen/tests/fixtures/bit_ops.fe b/crates/codegen/tests/fixtures/bit_ops.fe deleted file mode 100644 index d87878f591..0000000000 --- a/crates/codegen/tests/fixtures/bit_ops.fe +++ /dev/null @@ -1,17 +0,0 @@ -pub fn bit_ops(x: u256, y: u256) -> (u256, u256, u256, u256, u256) { - let and_v = x & y - let or_v = x | y - let xor_v = x ^ y - let shl_v = x << 8 - let shr_v = x >> 2 - (and_v, or_v, xor_v, shl_v, shr_v) -} - -pub fn pow_op(x: u256, y: u256) -> u256 { - x ** y -} - -pub fn main() -> u256 { - let _ = bit_ops(1, 2) - pow_op(2, 3) -} diff --git a/crates/codegen/tests/fixtures/bitnot.fe b/crates/codegen/tests/fixtures/bitnot.fe deleted file mode 100644 index a8bd6f4d12..0000000000 --- a/crates/codegen/tests/fixtures/bitnot.fe +++ /dev/null @@ -1,7 +0,0 @@ -pub fn bit_not(x: u256) -> u256 { - ~x -} - -pub fn main() -> u256 { - bit_not(1) -} diff --git a/crates/codegen/tests/fixtures/block_expr.fe b/crates/codegen/tests/fixtures/block_expr.fe deleted file mode 100644 index 6abc40faaf..0000000000 --- a/crates/codegen/tests/fixtures/block_expr.fe +++ /dev/null @@ -1,5 +0,0 @@ -pub fn block_expr() -> u64 { - { - 1 + 2 - } -} diff --git a/crates/codegen/tests/fixtures/bool_literal.fe b/crates/codegen/tests/fixtures/bool_literal.fe deleted file mode 100644 index a9fbf25da8..0000000000 --- a/crates/codegen/tests/fixtures/bool_literal.fe +++ /dev/null @@ -1,3 +0,0 @@ -pub fn bool_literal() -> bool { - true -} diff --git a/crates/codegen/tests/fixtures/borrow_handles_readback.fe b/crates/codegen/tests/fixtures/borrow_handles_readback.fe deleted file mode 100644 index 2c794e7958..0000000000 --- a/crates/codegen/tests/fixtures/borrow_handles_readback.fe +++ /dev/null @@ -1,6 +0,0 @@ -pub fn borrow_handles_readback() -> u256 { - let mut x: u256 = 0 - let p: mut u256 = mut x - p = 5 - x -} diff --git a/crates/codegen/tests/fixtures/borrow_storage_field_handle.fe b/crates/codegen/tests/fixtures/borrow_storage_field_handle.fe deleted file mode 100644 index 71a23694a6..0000000000 --- a/crates/codegen/tests/fixtures/borrow_storage_field_handle.fe +++ /dev/null @@ -1,22 +0,0 @@ -use std::evm::{RawStorage, StorPtr} - -struct CoinStore { - alice: u256, -} - -fn borrow_storage_field_handle() -> u256 - uses (store: mut CoinStore) -{ - let p: mut u256 = mut store.alice - p += 1 - store.alice -} - -pub fn main() -> u256 - uses (sto: mut RawStorage) -{ - let mut store: StorPtr = sto.stor_ptr(0) - with (store) { - borrow_storage_field_handle() - } -} diff --git a/crates/codegen/tests/fixtures/by_ref_trait_provider_storage_bug.fe b/crates/codegen/tests/fixtures/by_ref_trait_provider_storage_bug.fe deleted file mode 100644 index 8165ea0a06..0000000000 --- a/crates/codegen/tests/fixtures/by_ref_trait_provider_storage_bug.fe +++ /dev/null @@ -1,42 +0,0 @@ -// Demonstrates a known miscompile: passing a storage-backed by-ref provider as a trait effect -// causes the callee to treat it as a memory pointer (defaulting by-ref providers to `mem`). - -trait Ctx { - fn sum(self) -> u256 -} - -struct Pair { - a: u256, - b: u256, -} - -impl Ctx for Pair { - fn sum(self) -> u256 { - self.a + self.b - } -} - -fn use_ctx() -> u256 uses (ctx: Ctx) { - ctx.sum() -} - -msg Msg { - #[selector = 1] - Go -> u256 -} - -pub contract ByRefTraitProviderStorageBug { - mut ctx: Pair - - init() uses (mut ctx) { - ctx = Pair { a: 40, b: 2 } - } - - recv Msg { - Go -> u256 uses (ctx) { - with (ctx) { - use_ctx() - } - } - } -} diff --git a/crates/codegen/tests/fixtures/caller.fe b/crates/codegen/tests/fixtures/caller.fe deleted file mode 100644 index cf3bf02c1a..0000000000 --- a/crates/codegen/tests/fixtures/caller.fe +++ /dev/null @@ -1,9 +0,0 @@ -use std::evm::{Address, Ctx} - -fn who_called() -> Address uses (ctx: Ctx) { - ctx.caller() -} - -pub fn main() -> Address uses (ctx: Ctx) { - who_called() -} diff --git a/crates/codegen/tests/fixtures/cast_u8_usize_cmp.fe b/crates/codegen/tests/fixtures/cast_u8_usize_cmp.fe deleted file mode 100644 index d4569e4ff3..0000000000 --- a/crates/codegen/tests/fixtures/cast_u8_usize_cmp.fe +++ /dev/null @@ -1,17 +0,0 @@ -pub fn cast_u8_usize_cmp(indices: [u8; 8], i: usize, j: usize) -> u8 { - let path = indices[i] - if j < path as usize { - return 1 - } - if j == path as usize { - return 2 - } - if j > path as usize { - return 3 - } - 0 -} - -pub fn main() -> u8 { - cast_u8_usize_cmp([1, 2, 3, 4, 5, 6, 7, 8], 1, 2) -} diff --git a/crates/codegen/tests/fixtures/code_region.fe b/crates/codegen/tests/fixtures/code_region.fe deleted file mode 100644 index 81a758cbfb..0000000000 --- a/crates/codegen/tests/fixtures/code_region.fe +++ /dev/null @@ -1,59 +0,0 @@ -use std::evm::{Create, Evm, RawOps, mem} - -#[contract_init(Foo)] -fn init() uses (evm: mut Evm) { - { // create child contract - let len = evm.code_region_len(child_init) - let offset = evm.code_region_offset(child_init) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.create2_raw(value: 0, offset: dest, len: len, salt: 0x1234) - } - - let len = evm.code_region_len(runtime) - let offset = evm.code_region_offset(runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(Foo)] -fn runtime() uses (evm: mut Evm) { - with (RawOps = evm) { - match read_selector() { - 0x12345678 => { transfer() } - 0x23456789 => { balance() } - _ => {} - } - } - evm.return_data(offset: 0, len: 0) -} - -#[contract_init(Child)] -fn child_init() uses (evm: mut Evm) { - let len = evm.code_region_len(child_runtime) - let offset = evm.code_region_offset(child_runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(Child)] -fn child_runtime() uses (evm: mut Evm) { - evm.calldatacopy(dest: 0, offset: 0, len: 4) - evm.return_data(offset: 0, len: 4) -} - -fn balance() uses (ops: RawOps) { - ops.return_data(offset: 0, len: 0) -} - -fn transfer() uses (ops: RawOps) { - ops.return_data(offset: 0, len: 0) -} - -pub fn read_selector() -> u256 uses (ops: RawOps) { - let word = ops.calldataload(0) - // Shift right by 224 bits to keep only the first four bytes. - word >> 224 -} diff --git a/crates/codegen/tests/fixtures/code_region_qualified.fe b/crates/codegen/tests/fixtures/code_region_qualified.fe deleted file mode 100644 index 13821819e1..0000000000 --- a/crates/codegen/tests/fixtures/code_region_qualified.fe +++ /dev/null @@ -1,15 +0,0 @@ -use std::evm::{Evm, mem} - -#[contract_init(Foo)] -fn init() uses (evm: mut Evm) { - let len = evm.code_region_len(self::runtime) - let offset = evm.code_region_offset(self::runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(Foo)] -fn runtime() uses (evm: mut Evm) { - evm.return_data(offset: 0, len: 0) -} diff --git a/crates/codegen/tests/fixtures/comparison_ops.fe b/crates/codegen/tests/fixtures/comparison_ops.fe deleted file mode 100644 index 99616f731e..0000000000 --- a/crates/codegen/tests/fixtures/comparison_ops.fe +++ /dev/null @@ -1,7 +0,0 @@ -pub fn comparison_ops() -> (bool, bool, bool, bool, bool, bool) { - // TODO: 1u256 syntax - let one: u256 = 1 - let two: u256 = 2 - let three: u256 = 3 - (one == one, one != two, one < two, two <= two, three > two, three >= three) -} diff --git a/crates/codegen/tests/fixtures/const_array.fe b/crates/codegen/tests/fixtures/const_array.fe deleted file mode 100644 index d74ff456b0..0000000000 --- a/crates/codegen/tests/fixtures/const_array.fe +++ /dev/null @@ -1,9 +0,0 @@ -const VALS: [u256; 3] = [10, 20, 30] - -pub fn sum_two(i: usize, j: usize) -> u256 { - VALS[i] + VALS[j] -} - -pub fn main() -> u256 { - sum_two(0, 1) -} diff --git a/crates/codegen/tests/fixtures/const_array_add.fe b/crates/codegen/tests/fixtures/const_array_add.fe deleted file mode 100644 index bdf0a1fe3f..0000000000 --- a/crates/codegen/tests/fixtures/const_array_add.fe +++ /dev/null @@ -1,5 +0,0 @@ -const C: [u256; 3] = [10, 20, 30] - -pub fn get_sum() -> u256 { - return 1 + C[0] -} diff --git a/crates/codegen/tests/fixtures/const_array_addmod.fe b/crates/codegen/tests/fixtures/const_array_addmod.fe deleted file mode 100644 index af4d6f1c64..0000000000 --- a/crates/codegen/tests/fixtures/const_array_addmod.fe +++ /dev/null @@ -1,5 +0,0 @@ -const C: [u256; 3] = [10, 20, 30] - -pub fn get_sum() -> u256 { - return (1 + C[0]) % 100 -} diff --git a/crates/codegen/tests/fixtures/const_array_branch.fe b/crates/codegen/tests/fixtures/const_array_branch.fe deleted file mode 100644 index 349224e181..0000000000 --- a/crates/codegen/tests/fixtures/const_array_branch.fe +++ /dev/null @@ -1,13 +0,0 @@ -const C: [u256; 1] = [1] - -pub fn const_array_branch(flag: bool) -> u256 { - if flag { - C[0] - } else { - C[0] - } -} - -pub fn main() -> u256 { - const_array_branch(true) -} diff --git a/crates/codegen/tests/fixtures/const_array_loop.fe b/crates/codegen/tests/fixtures/const_array_loop.fe deleted file mode 100644 index db886e2193..0000000000 --- a/crates/codegen/tests/fixtures/const_array_loop.fe +++ /dev/null @@ -1,18 +0,0 @@ -const VALS: [u256; 3] = [10, 20, 30] - -pub fn sum_loop(n: usize) -> u256 { - let mut i: usize = 0 - let mut acc: u256 = 0 - - while i < n { - let idx: usize = i % 3 - acc = acc + VALS[idx] - i = i + 1 - } - - acc -} - -pub fn main() -> u256 { - sum_loop(3) -} diff --git a/crates/codegen/tests/fixtures/const_fn_mapping_slot_hash.fe b/crates/codegen/tests/fixtures/const_fn_mapping_slot_hash.fe deleted file mode 100644 index 46203d79af..0000000000 --- a/crates/codegen/tests/fixtures/const_fn_mapping_slot_hash.fe +++ /dev/null @@ -1,13 +0,0 @@ -use core::intrinsic - -// Real-world use case: computing a Solidity-style mapping slot hash at compile time. -// Equivalent to `keccak256(abi.encode(key, slot))`. -const BALANCES_SLOT: u256 = { - let words: [u256; 2] = [0x1111111111111111111111111111111111111111, 7] - let bytes: [u8; 64] = intrinsic::__as_bytes(words) - intrinsic::__keccak256(bytes) -} - -fn main() -> u256 { - BALANCES_SLOT -} diff --git a/crates/codegen/tests/fixtures/const_fn_packed_config.fe b/crates/codegen/tests/fixtures/const_fn_packed_config.fe deleted file mode 100644 index ba2bf59055..0000000000 --- a/crates/codegen/tests/fixtures/const_fn_packed_config.fe +++ /dev/null @@ -1,34 +0,0 @@ -// Real-world use case: packing configuration data into a single word at compile -// time, which can then be stored in a single storage slot for cheaper runtime -// reads. -// -// This exercises CTFE support for: -// - `match` in `const fn` -// - tuple destructuring in `let` bindings -const fn token_params(_ kind: u8) -> (u8, u16) { - match kind { - 0 => (18, 30), - 1 => (6, 5), - _ => (18, 0), - } -} - -const fn pack_config(_ decimals: u8, _ paused: bool, _ fee_bps: u16) -> u256 { - let paused_bit: u256 = if paused { 1 } else { 0 } - let decimals: u256 = decimals as u256 - let fee_bps: u256 = fee_bps as u256 - - // [paused:1][decimals:8][fee_bps:16] - (paused_bit << 24) | (decimals << 16) | fee_bps -} - -const fn packed_token_config(_ kind: u8, _ paused: bool) -> u256 { - let (decimals, fee_bps) = token_params(kind) - pack_config(decimals, paused, fee_bps) -} - -const CONFIG: u256 = packed_token_config(0, false) - -fn main() -> u256 { - CONFIG -} diff --git a/crates/codegen/tests/fixtures/const_keccak.fe b/crates/codegen/tests/fixtures/const_keccak.fe deleted file mode 100644 index fed9b2e17e..0000000000 --- a/crates/codegen/tests/fixtures/const_keccak.fe +++ /dev/null @@ -1,5 +0,0 @@ -const HASH: u256 = core::keccak("hello") - -fn main() -> u256 { - HASH -} diff --git a/crates/codegen/tests/fixtures/const_nested_u8_array.fe b/crates/codegen/tests/fixtures/const_nested_u8_array.fe deleted file mode 100644 index 9e03c72a0f..0000000000 --- a/crates/codegen/tests/fixtures/const_nested_u8_array.fe +++ /dev/null @@ -1,5 +0,0 @@ -const C: [[u8; 2]; 2] = [[1, 2], [3, 4]] - -pub fn const_nested_u8_array() -> u8 { - C[1][0] -} diff --git a/crates/codegen/tests/fixtures/const_string_literal_large.fe b/crates/codegen/tests/fixtures/const_string_literal_large.fe deleted file mode 100644 index 6211cc4dff..0000000000 --- a/crates/codegen/tests/fixtures/const_string_literal_large.fe +++ /dev/null @@ -1,5 +0,0 @@ -const BIG: String<31> = "abcdefghijklmnopqrstuvwxyzabcde" - -pub fn large_string_const() -> String<31> { - BIG -} diff --git a/crates/codegen/tests/fixtures/const_u8_array.fe b/crates/codegen/tests/fixtures/const_u8_array.fe deleted file mode 100644 index 04ae9f50ec..0000000000 --- a/crates/codegen/tests/fixtures/const_u8_array.fe +++ /dev/null @@ -1,33 +0,0 @@ -const SMALL: [u8; 2] = [1, 2] -const BIG: [u8; 40] = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -] - -pub fn index_direct() -> u8 { - SMALL[1] -} - -pub fn alias_then_index() -> u8 { - let x: [u8; 2] = SMALL - x[0] -} - -pub fn pass_then_index() -> u8 { - f(SMALL) -} - -fn f(_ arr: [u8; 2]) -> u8 { - arr[1] -} - -pub fn big_index() -> u8 { - BIG[39] -} - -pub fn big_copy_first() -> u8 { - let y: [u8; 40] = BIG - y[0] -} diff --git a/crates/codegen/tests/fixtures/contract_dispatch.fe b/crates/codegen/tests/fixtures/contract_dispatch.fe deleted file mode 100644 index 7c57af6cfd..0000000000 --- a/crates/codegen/tests/fixtures/contract_dispatch.fe +++ /dev/null @@ -1,8 +0,0 @@ -fn emit_code() -> u64 { - 1 -} - -#[contract_runtime(MinimalDispatcher)] -fn dispatch() { - let _value: u64 = emit_code() -} diff --git a/crates/codegen/tests/fixtures/create_contract.fe b/crates/codegen/tests/fixtures/create_contract.fe deleted file mode 100644 index 1cfd13b1ec..0000000000 --- a/crates/codegen/tests/fixtures/create_contract.fe +++ /dev/null @@ -1,35 +0,0 @@ -use std::evm::{Address, Create} - -msg FactoryMsg { - #[selector = 1] - Deploy { x: u256, y: u256 } -> Address, - - #[selector = 2] - Deploy2 { x: u256, y: u256, salt: u256 } -> Address, -} - -pub struct Pair { - x: u256, - y: u256, -} - -pub contract Child { - mut state: Pair - - init(x: u256, y: u256) uses (mut state) { - state.x = x - state.y = y - } -} - -pub contract Factory uses (create: mut Create) { - recv FactoryMsg { - Deploy { x, y } -> Address uses (mut create) { - create.create(value: 0, args: (x, y)) - } - - Deploy2 { x, y, salt } -> Address uses (mut create) { - create.create2(value: 0, args: (x, y), salt: salt) - } - } -} diff --git a/crates/codegen/tests/fixtures/effect_handle_field_deref.fe b/crates/codegen/tests/fixtures/effect_handle_field_deref.fe deleted file mode 100644 index 9fd9934abe..0000000000 --- a/crates/codegen/tests/fixtures/effect_handle_field_deref.fe +++ /dev/null @@ -1,74 +0,0 @@ -use std::evm::{Evm, StorPtr} - -msg Msg { - #[selector = 1] - SeedSlot { slot: u256, value: u256 } -> u256, - #[selector = 2] - ReadViaHolder { slot: u256 } -> u256, - #[selector = 3] - BumpMover { by: u256 } -> u256, -} - -struct Cell { - value: u256, -} - -struct Holder { - ptr: StorPtr, - tag: u256, -} - -struct CellMover { - cell: mut Cell, -} - -fn extract_ptr(holder: own Holder) -> StorPtr { - holder.ptr -} - -fn read_cell() -> u256 uses (cell: Cell) { - cell.value -} - -fn write_cell(value: u256) -> u256 uses (cell: mut Cell) { - cell.value = value - cell.value -} - -impl CellMover { - fn bump(mut self, by: u256) -> u256 { - self.cell.value += by - self.cell.value - } -} - -pub contract EffectHandleFieldDeref { - mut live: Cell, - - init() uses (mut live) { - live.value = 0 - } - - recv Msg { - SeedSlot { slot, value } -> u256 uses (evm: mut Evm) { - let ptr: StorPtr = evm.stor_ptr(slot) - with (ptr) { - write_cell(value) - } - } - - ReadViaHolder { slot } -> u256 uses (evm: mut Evm) { - let holder = Holder { ptr: evm.stor_ptr(slot), tag: 1 } - let ptr = extract_ptr(holder) - with (ptr) { - read_cell() - } - } - - BumpMover { by } -> u256 uses (mut live) { - let cell = mut live - let mut mover = CellMover { cell } - mover.bump(by) - } - } -} diff --git a/crates/codegen/tests/fixtures/effect_ptr_calldata_domain.fe b/crates/codegen/tests/fixtures/effect_ptr_calldata_domain.fe deleted file mode 100644 index aa9c855d35..0000000000 --- a/crates/codegen/tests/fixtures/effect_ptr_calldata_domain.fe +++ /dev/null @@ -1,10 +0,0 @@ -fn read_x() -> u256 uses (x: u256) { - x -} - -fn test_calldata_ptr_domain() { - let c: std::evm::CalldataPtr = std::evm::CalldataPtr::from_raw(0) - with (c) { - let _v = read_x() - } -} diff --git a/crates/codegen/tests/fixtures/effect_ptr_domains.fe b/crates/codegen/tests/fixtures/effect_ptr_domains.fe deleted file mode 100644 index 62a96ee62c..0000000000 --- a/crates/codegen/tests/fixtures/effect_ptr_domains.fe +++ /dev/null @@ -1,28 +0,0 @@ -use std::evm::{MemPtr, RawMem, RawStorage, StorPtr} - -struct Foo { - a: u256, - b: u256, -} - -fn bump() uses (foo: mut Foo) { - foo.a = foo.a + 1 - foo.b = foo.b + 2 -} - -fn test_effect_ptr_domains() uses (st: mut RawStorage, mem: mut RawMem) { - let mp: MemPtr = mem.mem_ptr(0x100) - with (mp) { - bump() - } - - let sp: StorPtr = st.stor_ptr(0) - with (sp) { - bump() - } - - let mut foo = Foo { a: 10, b: 20 } - with (foo) { - bump() - } -} diff --git a/crates/codegen/tests/fixtures/effect_ptr_name_collision.fe b/crates/codegen/tests/fixtures/effect_ptr_name_collision.fe deleted file mode 100644 index fb45de56da..0000000000 --- a/crates/codegen/tests/fixtures/effect_ptr_name_collision.fe +++ /dev/null @@ -1,13 +0,0 @@ -struct MemPtr { - value: T, - tag: u256, -} - -fn read_tag(ptr: MemPtr) -> u256 { - ptr.tag -} - -pub fn effect_ptr_name_collision() -> u256 { - let ptr = MemPtr { value: 1, tag: 7 } - read_tag(ptr) -} diff --git a/crates/codegen/tests/fixtures/enum_variant_contract.fe b/crates/codegen/tests/fixtures/enum_variant_contract.fe deleted file mode 100644 index 50d2beae35..0000000000 --- a/crates/codegen/tests/fixtures/enum_variant_contract.fe +++ /dev/null @@ -1,63 +0,0 @@ -use std::evm::{Evm, RawMem, RawOps, mem} - -enum MyOption { - None, - Some(u256), -} - -fn abi_encode_u256(value: u256) -> ! uses (ops: mut RawOps) { - let ptr: u256 = 0 - ops.mstore(addr: ptr, value: value) - ops.return_data(offset: ptr, len: 32) -} - -#[contract_init(EnumContract)] -fn init() uses (evm: mut Evm) { - let len = evm.code_region_len(runtime) - let offset = evm.code_region_offset(runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(EnumContract)] -fn runtime() uses (evm: mut Evm) { - let selector = evm.calldataload(0) >> 224 - - // make_some(uint256) -> returns the value back - // Selector: keccak256("make_some(uint256)")[:4] = 0x6c56cb0c - if selector == 0x6c56cb0c { - let value = evm.calldataload(4) - let opt = MyOption::Some(value) - let result = match opt { - MyOption::Some(val) => val - MyOption::None => 0 - } - with (RawOps = evm) { abi_encode_u256(value: result) } - } - - // make_none() -> returns 0 - // Selector: keccak256("make_none()")[:4] = 0x455dd373 - if selector == 0x455dd373 { - let opt = MyOption::None - let result = match opt { - MyOption::Some(val) => val - MyOption::None => 0 - } - with (RawOps = evm) { abi_encode_u256(value: result) } - } - - // is_some_check(uint256) -> returns 1 if constructed as Some - // Selector: keccak256("is_some_check(uint256)")[:4] = 0xd4eee422 - if selector == 0xd4eee422 { - let value = evm.calldataload(4) - let opt = MyOption::Some(value) - let result = match opt { - MyOption::Some(_) => 1 - MyOption::None => 0 - } - with (RawOps = evm) { abi_encode_u256(value: result) } - } - - evm.return_data(offset: 0, len: 0) -} diff --git a/crates/codegen/tests/fixtures/erc20.fe b/crates/codegen/tests/fixtures/erc20.fe deleted file mode 100644 index 83ba543939..0000000000 --- a/crates/codegen/tests/fixtures/erc20.fe +++ /dev/null @@ -1,255 +0,0 @@ -use std::evm::{Address, Ctx, StorageMap} -use std::evm::effects::Log - -// roles -const MINTER: u256 = 1 -const BURNER: u256 = 2 - -pub contract CoolCoin uses (ctx: mut Ctx, log: mut Log) { - // Storage fields. These act as effects within the contract. - mut store: TokenStore, - mut auth: AccessControl, - - // Initialize the token with name, symbol, decimals, and initial supply - init(initial_supply: u256, owner: Address) - uses (mut store, mut auth, mut ctx, mut log) - { - auth.grant(role: MINTER, to: owner) - auth.grant(role: BURNER, to: owner) - - if initial_supply > 0 { - mint(to: owner, amount: initial_supply) - } - } - - recv Erc20 { - Transfer { to, amount } -> bool uses (ctx, mut store, mut log) { - transfer(from: ctx.caller(), to, amount) - true - } - - Approve { spender, amount } -> bool uses (ctx, mut store, mut log) { - approve(owner: ctx.caller(), spender, amount) - true - } - - TransferFrom { from, to, amount } -> bool uses (ctx, mut store, mut log) { - spend_allowance(owner: from, spender: ctx.caller(), amount) - transfer(from, to, amount) - true - } - - BalanceOf { account } -> u256 uses store { - store.balances.get(account) - } - - Allowance { owner, spender } -> u256 uses (store) { - store.allowances.get((owner, spender)) - } - - TotalSupply {} -> u256 uses store { - store.total_supply - } - - Name {} -> String<31> { "CoolCoin" } - Symbol {} -> String<8> { "COOL" } - Decimals {} -> u8 { 18 } - } - - // Extended functionality (minting and burning) - recv Erc20Extended { - Mint { to, amount } -> bool uses (ctx, mut store, mut log, auth) { - auth.require(role: MINTER) - mint(to, amount) - true - } - - // Burns tokens from caller's balance - Burn { amount } -> bool uses (ctx, mut store, mut log) { - burn(from: ctx.caller(), amount) - true - } - - // Burns tokens from an account using allowance (requires BURNER or allowance) - BurnFrom { from, amount } -> bool uses (ctx, mut store, mut log) { - spend_allowance(owner: from, spender: ctx.caller(), amount) - burn(from, amount) - true - } - - IncreaseAllowance { spender, added_value } -> bool - uses (ctx, mut store, mut log) - { - let owner = ctx.caller() - let current = store.allowances.get((owner, spender)) - approve(owner, spender, amount: current + added_value) - true - } - - DecreaseAllowance { spender, subtracted_value } -> bool - uses (ctx, mut store, mut log) { - let owner = ctx.caller() - let current = store.allowances.get((owner, spender)) - assert!(current >= subtracted_value) - approve(owner, spender, amount: current - subtracted_value) - true - } - } -} - -fn transfer(from: Address, to: Address, amount: u256) - uses (store: mut TokenStore, log: mut Log) -{ - assert!(from != Address::zero()) - assert!(to != Address::zero()) - - let from_balance = store.balances.get(from) - assert!(from_balance >= amount) - - store.balances.set(key: from, value: from_balance - amount) - store.balances.set(key: to, value: store.balances.get(to) + amount) - - log.emit(TransferEvent { from, to, value: amount }) -} - -fn mint(to: Address, amount: u256) - uses (store: mut TokenStore, log: mut Log) -{ - assert!(to != Address::zero()) - - store.total_supply += amount - store.balances.set(key: to, value: store.balances.get(to) + amount) - - log.emit(TransferEvent { from: Address::zero(), to, value: amount }) -} - -fn burn(from: Address, amount: u256) - uses (store: mut TokenStore, log: mut Log) -{ - assert!(from != Address::zero()) - - let from_balance = store.balances.get(from) - assert!(from_balance >= amount) - - store.balances.set(key: from, value: from_balance - amount) - store.total_supply -= amount - - log.emit(TransferEvent { from, to: Address::zero(), value: amount }) -} - -fn approve(owner: Address, spender: Address, amount: u256) - uses (store: mut TokenStore, log: mut Log) -{ - assert!(owner != Address::zero()) - assert!(spender != Address::zero()) - - store.allowances.set(key: (owner, spender), value: amount) - - log.emit(ApprovalEvent { owner, spender, value: amount }) -} - -// Internal function to spend allowance -fn spend_allowance(owner: Address, spender: Address, amount: u256) - uses (store: mut TokenStore) -{ - let current = store.allowances.get((owner, spender)) - // if current != u256::MAX { // TODO: define ::MAX constants - assert!(current >= amount) - store.allowances.set(key: (owner, spender), value: current - amount) - // } -} - -struct TokenStore { - total_supply: u256, - balances: StorageMap, - allowances: StorageMap<(Address, Address), u256>, -} - -pub struct AccessControl { - roles: StorageMap<(u256, Address), bool>, -} - -impl AccessControl { - pub fn has_role(self, role: u256, account: Address) -> bool { - self.roles.get((role, account)) - } - - pub fn require(self, role: u256) uses (ctx: Ctx) { - assert!(self.roles.get((role, ctx.caller())) == true) - } - - pub fn grant(mut self, role: u256, to: Address) { - self.roles.set(key: (role, to), value: true) - } - - pub fn revoke(mut self, role: u256, from: Address) { - self.roles.set(key: (role, from), value: false) - } -} - -// ERC20 standard message types -msg Erc20 { - #[selector = sol("name()")] - Name -> String<31>, - - #[selector = sol("symbol()")] - Symbol -> String<8>, - - #[selector = sol("decimals()")] - Decimals -> u8, - - #[selector = sol("totalSupply()")] - TotalSupply -> u256, - - #[selector = sol("balanceOf(address)")] - BalanceOf { account: Address } -> u256, - - #[selector = sol("allowance(address,address)")] - Allowance { owner: Address, spender: Address } -> u256, - - #[selector = sol("transfer(address,uint256)")] - Transfer { to: Address, amount: u256 } -> bool, - - #[selector = sol("approve(address,uint256)")] - Approve { spender: Address, amount: u256 } -> bool, - - #[selector = sol("transferFrom(address,address,uint256)")] - TransferFrom { from: Address, to: Address, amount: u256 } -> bool, -} - -// Extended ERC20 message types (minting, burning, allowance helpers) -msg Erc20Extended { - #[selector = sol("mint(address,uint256)")] - Mint { to: Address, amount: u256 } -> bool, - - #[selector = sol("burn(uint256)")] - Burn { amount: u256 } -> bool, - - #[selector = sol("burnFrom(address,uint256)")] - BurnFrom { from: Address, amount: u256 } -> bool, - - #[selector = sol("increaseAllowance(address,uint256)")] - IncreaseAllowance { spender: Address, added_value: u256 } -> bool, - - #[selector = sol("decreaseAllowance(address,uint256)")] - DecreaseAllowance { spender: Address, subtracted_value: u256 } -> bool, -} - -// ERC20 events -#[event] -struct TransferEvent { - #[indexed] - from: Address, - #[indexed] - to: Address, - value: u256, -} - -#[event] -struct ApprovalEvent { - #[indexed] - owner: Address, - #[indexed] - spender: Address, - value: u256, -} diff --git a/crates/codegen/tests/fixtures/erc20_low_level.fe b/crates/codegen/tests/fixtures/erc20_low_level.fe deleted file mode 100644 index c288c7dee9..0000000000 --- a/crates/codegen/tests/fixtures/erc20_low_level.fe +++ /dev/null @@ -1,187 +0,0 @@ -use std::evm::{Address, Ctx, Evm, RawMem, RawOps, RawStorage, StorageMap, StorPtr, mem} - -// Helpers --------------------------------------------------------------- - -const BALANCES_SALT: u256 = 0 -const ALLOWANCES_SALT: u256 = 1 - -fn abi_encode_u256(value: u256) -> ! uses (ops: mut RawOps) { - ops.mstore(addr: 0, value: value) - ops.return_data(offset: 0, len: 32) -} - -fn abi_encode_string(word: u256, len: u256) -> ! uses (ops: mut RawOps) { - // ABI encoding for a single dynamic string literal - ops.mstore(addr: 0, value: 32) // offset to data - ops.mstore(addr: 32, value: len) // string length - ops.mstore(addr: 64, value: word) - ops.return_data(offset: 0, len: 96) -} - -// ERC20 storage --------------------------------------------------------- - -struct Erc20 { - balances: StorageMap, - allowances: StorageMap<(Address, Address), u256>, - supply: u256, - owner: Address, -} - -impl Erc20 { - - fn balance_of(self, addr: Address) -> u256 { - self.balances.get(key: addr) - } - - fn allowance(self, owner: Address, spender: Address) -> u256 { - self.allowances.get(key: (owner, spender)) - } - - fn approve(mut self, owner: Address, spender: Address, value: u256) { - self.allowances.set(key: (owner, spender), value: value) - } - - fn total_supply(self) -> u256 { - self.supply - } - - fn set_owner_once(mut self, owner: Address) uses (ops: RawOps) { - if self.owner != Address::zero() { - ops.revert(offset: 0, len: 0) - } - self.owner = owner - } - - fn transfer(mut self, from: Address, to: Address, amount: u256) uses (ops: RawOps) { - let from_bal = self.balance_of(addr: from) - if from_bal < amount { - ops.revert(offset: 0, len: 0) - } - let to_bal = self.balance_of(addr: to) - self.balances.set(key: from, value: from_bal - amount) - self.balances.set(key: to, value: to_bal + amount) - } - - fn transfer_from(mut self, owner: Address, to: Address, amount: u256) uses (ctx: Ctx, ops: RawOps) { - let spender = ctx.caller() - let allowed = self.allowance(owner: owner, spender: spender) - if allowed < amount { - ops.revert(offset: 0, len: 0) - } - self.transfer(from: owner, to: to, amount: amount) - self.allowances.set(key: (owner, spender), value: allowed - amount) - } - - fn mint(mut self, to: Address, amount: u256) uses (ctx: Ctx, ops: RawOps) { - let caller = ctx.caller() - if caller != self.owner { - ops.revert(offset: 0, len: 0) - } - let bal = self.balance_of(addr: to) - self.balances.set(key: to, value: bal + amount) - self.supply = self.supply + amount - } -} - -fn do_init() uses (erc20: mut Erc20, ctx: Ctx, ops: RawOps) { - erc20.set_owner_once(owner: ctx.caller()) -} - -fn balance_of(addr: Address) -> u256 uses (erc20: Erc20) { - erc20.balances.get(key: addr) -} - -fn allowance(owner: Address, spender: Address) -> u256 uses (erc20: Erc20) { - erc20.allowances.get(key: (owner, spender)) -} - -fn transfer(to: Address, amount: u256) -> u256 uses (erc20: mut Erc20, ctx: Ctx, ops: RawOps) { - erc20.transfer(from: ctx.caller(), to: to, amount: amount) - 1 -} - -fn approve(spender: Address, amount: u256) -> u256 uses (erc20: mut Erc20, ctx: Ctx) { - erc20.approve(owner: ctx.caller(), spender: spender, value: amount) - 1 -} - -fn transfer_from(from: Address, to: Address, amount: u256) -> u256 uses (erc20: mut Erc20, ctx: Ctx, ops: RawOps) { - erc20.transfer_from(owner: from, to: to, amount: amount) - 1 -} - -fn mint(to: Address, amount: u256) -> u256 uses (erc20: mut Erc20, ctx: Ctx, ops: RawOps) { - erc20.mint(to: to, amount: amount) - 1 -} - -// Entry points ---------------------------------------------------------- - -#[contract_init(Erc20Contract)] -fn init() uses (evm: mut Evm) { - let mut erc20: StorPtr> = evm.stor_ptr(0) - with (erc20, Ctx = evm, RawOps = evm) { - do_init() - } - let len = evm.code_region_len(runtime) - let offset = evm.code_region_offset(runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(Erc20Contract)] -fn runtime() uses (evm: mut Evm) { - let mut erc20: StorPtr> = evm.stor_ptr(0) - let selector = evm.calldataload(0) >> 224 - with (erc20, Ctx = evm, RawOps = evm) { - match selector { - 0x70a08231 => { // balanceOf(address) - let owner = Address { inner: evm.calldataload(4) } - abi_encode_u256(value: balance_of(addr: owner)) - } - 0xdd62ed3e => { // allowance(address,address) - let owner = Address { inner: evm.calldataload(4) } - let spender = Address { inner: evm.calldataload(36) } - abi_encode_u256(value: allowance(owner: owner, spender: spender)) - } - 0x06fdde03 => { // name() - abi_encode_string( - word: 0x4665546f6b656e00000000000000000000000000000000000000000000000000, - len: 7, - ) - } - 0x95d89b41 => { // symbol() - abi_encode_string( - word: 0x4645540000000000000000000000000000000000000000000000000000000000, - len: 3, - ) - } - 0x313ce567 => { // decimals() - abi_encode_u256(value: 18) - } - 0xa9059cbb => { // transfer(address,uint256) - let to = Address { inner: evm.calldataload(4) } - let amount = evm.calldataload(36) - abi_encode_u256(value: transfer(to: to, amount: amount)) - } - 0x095ea7b3 => { // approve(address,uint256) - let spender = Address { inner: evm.calldataload(4) } - let amount = evm.calldataload(36) - abi_encode_u256(value: approve(spender: spender, amount: amount)) - } - 0x23b872dd => { // transferFrom(address,address,uint256) - let from = Address { inner: evm.calldataload(4) } - let to = Address { inner: evm.calldataload(36) } - let amount = evm.calldataload(68) - abi_encode_u256(value: transfer_from(from: from, to: to, amount: amount)) - } - 0x40c10f19 => { // mint(address,uint256) - let to = Address { inner: evm.calldataload(4) } - let amount = evm.calldataload(36) - abi_encode_u256(value: mint(to: to, amount: amount)) - } - _ => evm.revert(offset: 0, len: 0) - } - } -} diff --git a/crates/codegen/tests/fixtures/event_logging.fe b/crates/codegen/tests/fixtures/event_logging.fe deleted file mode 100644 index 10ad460a41..0000000000 --- a/crates/codegen/tests/fixtures/event_logging.fe +++ /dev/null @@ -1,24 +0,0 @@ -use std::evm::{Address, Evm, Event} - -#[event] -struct Transfer { - #[indexed] - from: Address, - #[indexed] - to: Address, - amount: u256, -} - -fn emit_transfer(evm: mut Evm, from: Address, to: Address, amount: u256) { - let e = Transfer { from, to, amount } - e.emit(evm) -} - -pub fn main() uses (evm: mut Evm) { - emit_transfer( - evm, - Address { inner: 1 }, - Address { inner: 2 }, - 100, - ) -} diff --git a/crates/codegen/tests/fixtures/event_logging_via_log.fe b/crates/codegen/tests/fixtures/event_logging_via_log.fe deleted file mode 100644 index 858f67cd66..0000000000 --- a/crates/codegen/tests/fixtures/event_logging_via_log.fe +++ /dev/null @@ -1,23 +0,0 @@ -use std::evm::{Address, Evm, Log} - -#[event] -struct Transfer { - #[indexed] - from: Address, - #[indexed] - to: Address, - amount: u256, -} - -fn emit_transfer(evm: mut Evm, from: Address, to: Address, amount: u256) { - evm.emit(Transfer { from, to, amount }) -} - -pub fn main() uses (evm: mut Evm) { - emit_transfer( - evm, - Address { inner: 1 }, - Address { inner: 2 }, - 100, - ) -} diff --git a/crates/codegen/tests/fixtures/explicit_raw_boundaries.fe b/crates/codegen/tests/fixtures/explicit_raw_boundaries.fe deleted file mode 100644 index 74fe0ad8e9..0000000000 --- a/crates/codegen/tests/fixtures/explicit_raw_boundaries.fe +++ /dev/null @@ -1,26 +0,0 @@ -use core::EffectHandle -use std::evm::{MemPtr, RawMem} - -struct Data { - value: u256, -} - -fn bump() uses (value: mut u256) { - value += 1 -} - -fn raw_store() uses (data: mut MemPtr, mem: mut RawMem) { - mem.mstore(addr: data.raw(), value: 8) -} - -pub fn explicit_raw_boundaries() uses (mem: mut RawMem) { - let ptr: MemPtr = mem.mem_ptr(0x100) - with (ptr) { - bump() - } - - let data: MemPtr = mem.mem_ptr(0x120) - with (data, mem) { - raw_store() - } -} diff --git a/crates/codegen/tests/fixtures/for_array.fe b/crates/codegen/tests/fixtures/for_array.fe deleted file mode 100644 index 15903f5b7c..0000000000 --- a/crates/codegen/tests/fixtures/for_array.fe +++ /dev/null @@ -1,13 +0,0 @@ -// For loop over a large array (uses while-style loop, not unrolled) -pub fn for_array_sum() -> u64 { - let arr: [u64; 25] = [ - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25 - ] - let mut sum: u64 = 0 - for elem in arr { - sum = sum + elem - } - sum -} diff --git a/crates/codegen/tests/fixtures/for_array_large.fe b/crates/codegen/tests/fixtures/for_array_large.fe deleted file mode 100644 index 6c091990a0..0000000000 --- a/crates/codegen/tests/fixtures/for_array_large.fe +++ /dev/null @@ -1,9 +0,0 @@ -// For loop over a large array (>= 10 elements) should NOT auto-unroll -pub fn for_array_large_sum() -> u64 { - let arr: [u64; 10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - let mut sum: u64 = 0 - for elem in arr { - sum = sum + elem - } - sum -} diff --git a/crates/codegen/tests/fixtures/for_range.fe b/crates/codegen/tests/fixtures/for_range.fe deleted file mode 100644 index 0000e28b05..0000000000 --- a/crates/codegen/tests/fixtures/for_range.fe +++ /dev/null @@ -1,10 +0,0 @@ -// For loop over a range -pub fn for_range_sum() -> usize { - let mut sum: usize = 0 - let start: usize = 0 - let end: usize = 10 - for i in start..end { - sum = sum + i - } - sum -} diff --git a/crates/codegen/tests/fixtures/full_contract.fe b/crates/codegen/tests/fixtures/full_contract.fe deleted file mode 100644 index 6811a7192f..0000000000 --- a/crates/codegen/tests/fixtures/full_contract.fe +++ /dev/null @@ -1,55 +0,0 @@ -use std::evm::{Evm, RawMem, RawOps, mem} - -struct Point { x: u256, y: u256 } -struct Square { side: u256 } - -impl Point { - fn area(self) -> u256 { - self.x * self.y - } -} - -impl Square { - fn area(self) -> u256 { - let side = self.side - side * side - } -} - -fn abi_encode(value: u256) -> ! uses (ops: mut RawOps) { - let ptr: u256 = 0 - ops.mstore(addr: ptr, value: value) - ops.return_data(offset: ptr, len: 32) -} - -#[contract_init(ShapeDispatcher)] -fn init() uses (evm: mut Evm) { - let len = evm.code_region_len(dispatch) - let offset = evm.code_region_offset(dispatch) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(ShapeDispatcher)] -fn dispatch() uses (evm: mut Evm) { - let selector = evm.calldataload(0) >> 224 - if selector == 0x090251bf { - let x = evm.calldataload(4) - let y = evm.calldataload(36) - let mut p = Point { x: x, y: y } - p.x = p.x + 1 - p.y = p.y + 2 - let value = p.area() - with (RawOps = evm) { abi_encode(value) } - } - if selector == 0x7b292909 { - let side = evm.calldataload(4) - let mut s = Square { side: side } - s.side = s.side + 3 - let value = s.area() - with (RawOps = evm) { abi_encode(value) } - } - - evm.return_data(offset: 0, len: 0) -} diff --git a/crates/codegen/tests/fixtures/function_call.fe b/crates/codegen/tests/fixtures/function_call.fe deleted file mode 100644 index 29e1fa4caa..0000000000 --- a/crates/codegen/tests/fixtures/function_call.fe +++ /dev/null @@ -1,7 +0,0 @@ -pub fn add_one(_ x: u64) -> u64 { - x + 1 -} - -pub fn call_add_one() -> u64 { - add_one(5) -} diff --git a/crates/codegen/tests/fixtures/generic_identity.fe b/crates/codegen/tests/fixtures/generic_identity.fe deleted file mode 100644 index 0969a9e2e7..0000000000 --- a/crates/codegen/tests/fixtures/generic_identity.fe +++ /dev/null @@ -1,13 +0,0 @@ -fn identity(_ value: own T) -> T { - value -} - -fn call_identity_u32() -> u32 { - let val = identity(7) - val -} - -fn call_identity_bool() -> bool { - let val = identity(true) - val -} diff --git a/crates/codegen/tests/fixtures/high_level_contract.fe b/crates/codegen/tests/fixtures/high_level_contract.fe deleted file mode 100644 index a739ddb212..0000000000 --- a/crates/codegen/tests/fixtures/high_level_contract.fe +++ /dev/null @@ -1,36 +0,0 @@ -msg EchoMsg { - #[selector = 1] - Answer -> u256, - #[selector = 2] - Echo { x: u256 } -> u256, - #[selector = 3] - GetX -> u256 -} - -pub struct Foo { - x: u256, - y: u256, -} - -pub contract EchoContract { - mut state: Foo - - init(x: u256, y: u256) uses (mut state) { - state.x = x - state.y = y - } - - recv EchoMsg { - Answer -> u256 { - 42 - } - - Echo { x } -> u256 { - x - } - - GetX -> u256 uses (state) { - state.x - } - } -} diff --git a/crates/codegen/tests/fixtures/if_else.fe b/crates/codegen/tests/fixtures/if_else.fe deleted file mode 100644 index 7491601df8..0000000000 --- a/crates/codegen/tests/fixtures/if_else.fe +++ /dev/null @@ -1,15 +0,0 @@ -pub fn if_else(cond: bool) -> u64 { - if cond { - helper(1) - } else { - helper(2) - } -} - -fn helper(_ x: u64) -> u64 { - x + 1 -} - -pub fn main() -> u64 { - if_else(true) -} diff --git a/crates/codegen/tests/fixtures/immutable_contract_field_init_set.fe b/crates/codegen/tests/fixtures/immutable_contract_field_init_set.fe deleted file mode 100644 index 937b8ced7f..0000000000 --- a/crates/codegen/tests/fixtures/immutable_contract_field_init_set.fe +++ /dev/null @@ -1,18 +0,0 @@ -msg Msg { - #[selector = 1] - Get -> u256 -} - -pub contract ImmutableContractFieldInitSet { - x: u256 - - init(v: u256) uses (mut x) { - x = v - } - - recv Msg { - Get -> u256 uses (x) { - x - } - } -} diff --git a/crates/codegen/tests/fixtures/init_args_with_child_dep.fe b/crates/codegen/tests/fixtures/init_args_with_child_dep.fe deleted file mode 100644 index 46eeab3044..0000000000 --- a/crates/codegen/tests/fixtures/init_args_with_child_dep.fe +++ /dev/null @@ -1,11 +0,0 @@ -use std::evm::Create - -pub contract Child { - init(x: u256, y: u256) {} -} - -pub contract Parent uses (create: mut Create) { - init(seed: u256) uses (mut create) { - create.create(value: 0, args: (seed, seed)) - } -} diff --git a/crates/codegen/tests/fixtures/internal_helper_shadowing.fe b/crates/codegen/tests/fixtures/internal_helper_shadowing.fe deleted file mode 100644 index 223bf5328e..0000000000 --- a/crates/codegen/tests/fixtures/internal_helper_shadowing.fe +++ /dev/null @@ -1,21 +0,0 @@ -use core::ops::SaturatingAdd - -pub fn checked_add_u64(a: u64, b: u64) -> u64 { - 77 -} - -pub fn saturating_add_u64(a: u64, b: u64) -> u64 { - 88 -} - -pub fn call_user_helpers(a: u64, b: u64) -> (u64, u64) { - (checked_add_u64(a, b), saturating_add_u64(a, b)) -} - -pub fn call_internal_helpers(a: u64, b: u64) -> (u64, u64) { - (a + b, a.saturating_add(b)) -} - -pub fn main() -> ((u64, u64), (u64, u64)) { - (call_user_helpers(1, 2), call_internal_helpers(1, 2)) -} diff --git a/crates/codegen/tests/fixtures/intrinsic_ops.fe b/crates/codegen/tests/fixtures/intrinsic_ops.fe deleted file mode 100644 index dc6a71a7e8..0000000000 --- a/crates/codegen/tests/fixtures/intrinsic_ops.fe +++ /dev/null @@ -1,38 +0,0 @@ -use std::evm::{RawMem, RawOps, RawStorage} - -pub fn load_word(ptr: u256) -> u256 uses (mem: RawMem) { - mem.mload(ptr) -} - -pub fn store_word(ptr: u256, value: u256) uses (mem: mut RawMem) { - mem.mstore(addr: ptr, value: value) -} - -pub fn store_byte(ptr: u256, value: u8) uses (mem: mut RawMem) { - mem.mstore8(addr: ptr, value: value) -} - -pub fn load_slot(slot: u256) -> u256 uses (sto: RawStorage) { - sto.sload(slot) -} - -pub fn store_slot(slot: u256, value: u256) uses (sto: mut RawStorage) { - sto.sstore(slot: slot, value: value) -} - -pub fn load_calldata(offset: u256) -> u256 uses (ops: RawOps) { - ops.calldataload(offset) -} - -pub fn finish(ptr: u256, len: u256) uses (ops: RawOps) { - ops.return_data(offset: ptr, len: len) -} - -pub fn main() -> u256 - uses (mem: mut RawMem, sto: mut RawStorage, ops: RawOps) -{ - store_word(0x80, 1) - store_byte(0x81, 2) - store_slot(3, 4) - load_word(0x80) + load_slot(3) + load_calldata(0) -} diff --git a/crates/codegen/tests/fixtures/keccak_in_fn.fe b/crates/codegen/tests/fixtures/keccak_in_fn.fe deleted file mode 100644 index 7c8fdb4fd1..0000000000 --- a/crates/codegen/tests/fixtures/keccak_in_fn.fe +++ /dev/null @@ -1,3 +0,0 @@ -fn main() -> u256 { - core::keccak("hello") -} diff --git a/crates/codegen/tests/fixtures/keccak_intrinsic.fe b/crates/codegen/tests/fixtures/keccak_intrinsic.fe deleted file mode 100644 index 1ca14fad4e..0000000000 --- a/crates/codegen/tests/fixtures/keccak_intrinsic.fe +++ /dev/null @@ -1,9 +0,0 @@ -use std::evm::RawOps - -pub fn hash(ptr: u256, len: u256) -> u256 uses (ops: RawOps) { - ops.keccak256(offset: ptr, len: len) -} - -pub fn main() -> u256 uses (ops: RawOps) { - hash(0, 32) -} diff --git a/crates/codegen/tests/fixtures/layout/enum_nested.fe b/crates/codegen/tests/fixtures/layout/enum_nested.fe deleted file mode 100644 index fd599fc796..0000000000 --- a/crates/codegen/tests/fixtures/layout/enum_nested.fe +++ /dev/null @@ -1,12 +0,0 @@ -// Test layout of enums with aggregate payloads - -struct Point { - x: u64, - y: u64, -} - -enum Shape { - Empty, - Circle(u64), - Rectangle(Point) -} diff --git a/crates/codegen/tests/fixtures/layout/enum_nested.snap b/crates/codegen/tests/fixtures/layout/enum_nested.snap deleted file mode 100644 index a4544ad063..0000000000 --- a/crates/codegen/tests/fixtures/layout/enum_nested.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: crates/hir/tests/layout.rs -assertion_line: 144 -expression: report -input_file: test_files/layout/enum_nested.fe ---- -struct Point: - size: 16 bytes - fields: - [0]: offset=0, size=8 - [1]: offset=8, size=8 -enum Shape: - size: 48 bytes - discriminant: 32 bytes - variants: - Empty: (unit) - Circle: - [0]: offset=32, size=8 - Rectangle: - [0]: offset=32, size=16 diff --git a/crates/codegen/tests/fixtures/layout/enum_simple.fe b/crates/codegen/tests/fixtures/layout/enum_simple.fe deleted file mode 100644 index 3de6e82af2..0000000000 --- a/crates/codegen/tests/fixtures/layout/enum_simple.fe +++ /dev/null @@ -1,18 +0,0 @@ -// Test layout of simple enums - -enum UnitOnly { - A, - B, - C -} - -enum WithPayload { - None, - Some(u256) -} - -enum MultiField { - Empty, - One(u8), - Two(u8, u16) -} diff --git a/crates/codegen/tests/fixtures/layout/enum_simple.snap b/crates/codegen/tests/fixtures/layout/enum_simple.snap deleted file mode 100644 index ff8a9bef08..0000000000 --- a/crates/codegen/tests/fixtures/layout/enum_simple.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/hir/tests/layout.rs -assertion_line: 144 -expression: report -input_file: test_files/layout/enum_simple.fe ---- -enum UnitOnly: - size: 32 bytes - discriminant: 32 bytes - variants: - A: (unit) - B: (unit) - C: (unit) -enum WithPayload: - size: 64 bytes - discriminant: 32 bytes - variants: - None: (unit) - Some: - [0]: offset=32, size=32 -enum MultiField: - size: 35 bytes - discriminant: 32 bytes - variants: - Empty: (unit) - One: - [0]: offset=32, size=1 - Two: - [0]: offset=32, size=1 - [1]: offset=33, size=2 diff --git a/crates/codegen/tests/fixtures/layout/mixed_sizes.fe b/crates/codegen/tests/fixtures/layout/mixed_sizes.fe deleted file mode 100644 index d1996a83ab..0000000000 --- a/crates/codegen/tests/fixtures/layout/mixed_sizes.fe +++ /dev/null @@ -1,18 +0,0 @@ -// Test packed layout with mixed field sizes - -struct PackedSmall { - a: u8, - b: u8, - c: u8, -} - -struct PackedMixed { - small1: u8, - big: u256, - small2: u8, -} - -struct ReverseMixed { - big: u256, - small: u8, -} diff --git a/crates/codegen/tests/fixtures/layout/mixed_sizes.snap b/crates/codegen/tests/fixtures/layout/mixed_sizes.snap deleted file mode 100644 index 760dfa3df0..0000000000 --- a/crates/codegen/tests/fixtures/layout/mixed_sizes.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: crates/hir/tests/layout.rs -assertion_line: 144 -expression: report -input_file: test_files/layout/mixed_sizes.fe ---- -struct PackedSmall: - size: 3 bytes - fields: - [0]: offset=0, size=1 - [1]: offset=1, size=1 - [2]: offset=2, size=1 -struct PackedMixed: - size: 34 bytes - fields: - [0]: offset=0, size=1 - [1]: offset=1, size=32 - [2]: offset=33, size=1 -struct ReverseMixed: - size: 33 bytes - fields: - [0]: offset=0, size=32 - [1]: offset=32, size=1 diff --git a/crates/codegen/tests/fixtures/layout/primitives.fe b/crates/codegen/tests/fixtures/layout/primitives.fe deleted file mode 100644 index 4b4566d8cc..0000000000 --- a/crates/codegen/tests/fixtures/layout/primitives.fe +++ /dev/null @@ -1,24 +0,0 @@ -// Test layout of primitive types in structs - -struct SingleU8 { - a: u8, -} - -struct SingleU256 { - a: u256, -} - -struct MixedPrimitives { - a: u8, - b: u16, - c: u32, - d: u64, - e: u128, - f: u256, -} - -struct Bools { - a: bool, - b: bool, - c: bool, -} diff --git a/crates/codegen/tests/fixtures/layout/primitives.snap b/crates/codegen/tests/fixtures/layout/primitives.snap deleted file mode 100644 index d7370fa5d7..0000000000 --- a/crates/codegen/tests/fixtures/layout/primitives.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: crates/hir/tests/layout.rs -assertion_line: 144 -expression: report -input_file: test_files/layout/primitives.fe ---- -struct SingleU8: - size: 1 bytes - fields: - [0]: offset=0, size=1 -struct SingleU256: - size: 32 bytes - fields: - [0]: offset=0, size=32 -struct MixedPrimitives: - size: 63 bytes - fields: - [0]: offset=0, size=1 - [1]: offset=1, size=2 - [2]: offset=3, size=4 - [3]: offset=7, size=8 - [4]: offset=15, size=16 - [5]: offset=31, size=32 -struct Bools: - size: 3 bytes - fields: - [0]: offset=0, size=1 - [1]: offset=1, size=1 - [2]: offset=2, size=1 diff --git a/crates/codegen/tests/fixtures/layout/range_bounds.fe b/crates/codegen/tests/fixtures/layout/range_bounds.fe deleted file mode 100644 index ebca8b7f7a..0000000000 --- a/crates/codegen/tests/fixtures/layout/range_bounds.fe +++ /dev/null @@ -1,19 +0,0 @@ -use core::{Range, Known, Unknown} - -struct WrapZero { - left: u256, - range: Range, Known<4>>, - right: u256, -} - -struct WrapOne { - left: u256, - range: Range, Unknown>, - right: u256, -} - -struct WrapTwo { - left: u256, - range: Range, - right: u256, -} diff --git a/crates/codegen/tests/fixtures/layout/range_bounds.snap b/crates/codegen/tests/fixtures/layout/range_bounds.snap deleted file mode 100644 index d6c19baf29..0000000000 --- a/crates/codegen/tests/fixtures/layout/range_bounds.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: crates/codegen/tests/layout.rs -expression: report -input_file: tests/fixtures/layout/range_bounds.fe ---- -struct WrapZero: - size: 64 bytes - fields: - [0]: offset=0, size=32 - [1]: offset=32, size=0 - [2]: offset=32, size=32 -struct WrapOne: - size: 96 bytes - fields: - [0]: offset=0, size=32 - [1]: offset=32, size=32 - [2]: offset=64, size=32 -struct WrapTwo: - size: 128 bytes - fields: - [0]: offset=0, size=32 - [1]: offset=32, size=64 - [2]: offset=96, size=32 diff --git a/crates/codegen/tests/fixtures/layout/struct_nested.fe b/crates/codegen/tests/fixtures/layout/struct_nested.fe deleted file mode 100644 index c9b531810d..0000000000 --- a/crates/codegen/tests/fixtures/layout/struct_nested.fe +++ /dev/null @@ -1,17 +0,0 @@ -// Test layout of nested structs - -struct Inner { - x: u8, - y: u8, -} - -struct Outer { - inner: Inner, - z: u256, -} - -struct DeepNest { - a: Inner, - b: Inner, - c: u8, -} diff --git a/crates/codegen/tests/fixtures/layout/struct_nested.snap b/crates/codegen/tests/fixtures/layout/struct_nested.snap deleted file mode 100644 index d6bc0a4e6f..0000000000 --- a/crates/codegen/tests/fixtures/layout/struct_nested.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: crates/hir/tests/layout.rs -assertion_line: 144 -expression: report -input_file: test_files/layout/struct_nested.fe ---- -struct Inner: - size: 2 bytes - fields: - [0]: offset=0, size=1 - [1]: offset=1, size=1 -struct Outer: - size: 34 bytes - fields: - [0]: offset=0, size=2 - [1]: offset=2, size=32 -struct DeepNest: - size: 5 bytes - fields: - [0]: offset=0, size=2 - [1]: offset=2, size=2 - [2]: offset=4, size=1 diff --git a/crates/codegen/tests/fixtures/literal_add.fe b/crates/codegen/tests/fixtures/literal_add.fe deleted file mode 100644 index 6339fa4cdf..0000000000 --- a/crates/codegen/tests/fixtures/literal_add.fe +++ /dev/null @@ -1,8 +0,0 @@ -fn main() -> u64 { - let x: u64 = add(10, 20) - x -} - -const fn add(_ a: u64, _ b: u64) -> u64 { - a + b -} diff --git a/crates/codegen/tests/fixtures/literal_sub.fe b/crates/codegen/tests/fixtures/literal_sub.fe deleted file mode 100644 index b527d67ba4..0000000000 --- a/crates/codegen/tests/fixtures/literal_sub.fe +++ /dev/null @@ -1,3 +0,0 @@ -pub fn literal_sub() -> u64 { - 1 - 2 -} diff --git a/crates/codegen/tests/fixtures/local_bindings.fe b/crates/codegen/tests/fixtures/local_bindings.fe deleted file mode 100644 index 2de0417dd5..0000000000 --- a/crates/codegen/tests/fixtures/local_bindings.fe +++ /dev/null @@ -1,5 +0,0 @@ -pub fn local_bindings() -> u64 { - let x: u64 = 1 + 2 - let y = 3 - y -} diff --git a/crates/codegen/tests/fixtures/logical_ops.fe b/crates/codegen/tests/fixtures/logical_ops.fe deleted file mode 100644 index 61c057cc8c..0000000000 --- a/crates/codegen/tests/fixtures/logical_ops.fe +++ /dev/null @@ -1,11 +0,0 @@ -fn logical_or(_ value: u8) -> bool { - value == 255 || value + 1 > 0 -} - -fn logical_and(_ value: u8) -> bool { - value != 255 && value + 1 > 0 -} - -pub fn logical_ops() -> (bool, bool) { - (logical_or(255), logical_and(255)) -} diff --git a/crates/codegen/tests/fixtures/match_arm_return.fe b/crates/codegen/tests/fixtures/match_arm_return.fe deleted file mode 100644 index 7750947905..0000000000 --- a/crates/codegen/tests/fixtures/match_arm_return.fe +++ /dev/null @@ -1,18 +0,0 @@ -// Regression test: `return` directly in a match arm (without block braces) -// should be accepted by the parser. - -enum E { - A(u256), - B, -} - -fn f(e: E) -> u256 { - match e { - E::A(v) => return v - E::B => return 0 - } -} - -pub fn main() -> u256 { - f(E::B) -} diff --git a/crates/codegen/tests/fixtures/match_arm_return_comma.fe b/crates/codegen/tests/fixtures/match_arm_return_comma.fe deleted file mode 100644 index 32a5f4af45..0000000000 --- a/crates/codegen/tests/fixtures/match_arm_return_comma.fe +++ /dev/null @@ -1,17 +0,0 @@ -// Regression test: bare `return` in comma-separated match arms should parse correctly. - -enum E { - A(u256), - B, -} - -fn f(e: E) -> u256 { - match e { - E::A(v) => return v, - E::B => return 0, - } -} - -pub fn main() -> u256 { - f(E::A(1)) -} diff --git a/crates/codegen/tests/fixtures/match_enum.fe b/crates/codegen/tests/fixtures/match_enum.fe deleted file mode 100644 index efde5ad8e7..0000000000 --- a/crates/codegen/tests/fixtures/match_enum.fe +++ /dev/null @@ -1,18 +0,0 @@ -enum MyEnum { - A, - B, - C, -} - -pub fn match_enum(e: MyEnum) -> u8 { - match e { - MyEnum::A => 1, - MyEnum::B => 2, - MyEnum::C => 3, - _ => 4, - } -} - -pub fn main() -> u8 { - match_enum(MyEnum::B) -} diff --git a/crates/codegen/tests/fixtures/match_enum_with_data.fe b/crates/codegen/tests/fixtures/match_enum_with_data.fe deleted file mode 100644 index cb034ea9d6..0000000000 --- a/crates/codegen/tests/fixtures/match_enum_with_data.fe +++ /dev/null @@ -1,21 +0,0 @@ - -enum MyOption { - None, - Some(u64), -} - -pub fn make_some(value: u64) -> MyOption { - MyOption::Some(value) -} - -pub fn match_option(opt: own MyOption) -> u64 { - match opt { - MyOption::Some(value) => value, - MyOption::None => 0, - } -} - -pub fn main() -> u64 { - let opt = make_some(7) - match_option(opt) -} diff --git a/crates/codegen/tests/fixtures/match_fn_call.fe b/crates/codegen/tests/fixtures/match_fn_call.fe deleted file mode 100644 index 377a62a26e..0000000000 --- a/crates/codegen/tests/fixtures/match_fn_call.fe +++ /dev/null @@ -1,19 +0,0 @@ -use std::evm::RawOps - -fn example() -> u256 uses (ops: RawOps) { - match read_selector() { - 0x12345678 => 1, - 0x23456789 => 2, - _ => 3, - } -} - -pub fn read_selector() -> u256 uses (ops: RawOps) { - let word = ops.calldataload(0) - // Shift right by 224 bits to keep only the first four bytes. - word >> 224 -} - -pub fn main() -> u256 uses (ops: RawOps) { - example() -} diff --git a/crates/codegen/tests/fixtures/match_literal.fe b/crates/codegen/tests/fixtures/match_literal.fe deleted file mode 100644 index 8e23d38dd7..0000000000 --- a/crates/codegen/tests/fixtures/match_literal.fe +++ /dev/null @@ -1,118 +0,0 @@ -pub fn match_bool(e: bool) -> u64 { - match e { - true => 1, - _ => 2, - } -} - -pub fn match_u8(e: u8) -> u8 { - match e { - 0 => 1, - 255 => 2, - _ => 3, - } -} - -pub fn match_u16(e: u16) -> u16 { - match e { - 0x1234 => 1, - 0xabcd => 2, - _ => 3, - } -} - -pub fn match_u32(e: u32) -> u32 { - match e { - 0xdeadbeef => 1, - 0xcafebabe => 2, - _ => 3, - } -} - -pub fn match_u64(e: u64) -> u64 { - match e { - 0 => 1, - 0xffffffffffffffff => 2, - _ => 3, - } -} - -pub fn match_u128(e: u128) -> u128 { - match e { - 0 => 1, - 0xffffffffffffffffffffffffffffffff => 2, - _ => 3, - } -} - -pub fn match_u256(e: u256) -> u256 { - match e { - 0 => 1, - 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff => 2, - _ => 3, - } -} - -pub fn match_i8(e: i8) -> i8 { - match e { - 0 => 1, - 99 => 2, - _ => 3, - } -} - -pub fn match_i16(e: i16) -> i16 { - match e { - 0 => 1, - 32000 => 2, - _ => 3, - } -} - -pub fn match_i32(e: i32) -> i32 { - match e { - 0 => 1, - 2000000000 => 2, - _ => 3, - } -} - -pub fn match_i64(e: i64) -> i64 { - match e { - 0 => 1, - 9223372036854775807 => 2, - _ => 3, - } -} - -pub fn match_i128(e: i128) -> i128 { - match e { - 0 => 1, - 170141183460469231731687303715884105727 => 2, - _ => 3, - } -} - -pub fn match_i256(e: i256) -> i256 { - match e { - 0 => 1, - 115792089237316195423570985008687907853269984665640564039457584007913129639935 => 2, - _ => 3, - } -} - -pub fn main() { - let _ = match_bool(true) - let _ = match_u8(255) - let _ = match_u16(0x1234) - let _ = match_u32(0xdeadbeef) - let _ = match_u64(1) - let _ = match_u128(1) - let _ = match_u256(1) - let _ = match_i8(99) - let _ = match_i16(32000) - let _ = match_i32(2000000000) - let _ = match_i64(1) - let _ = match_i128(1) - let _ = match_i256(1) -} diff --git a/crates/codegen/tests/fixtures/match_mixed_return.fe b/crates/codegen/tests/fixtures/match_mixed_return.fe deleted file mode 100644 index 61b700e615..0000000000 --- a/crates/codegen/tests/fixtures/match_mixed_return.fe +++ /dev/null @@ -1,19 +0,0 @@ -enum E { - A, - B, -} - -fn f(e: E) -> u256 { - // Mixed arms: one returns, one continues. Code after the match should be skipped for E::A. - let x = match e { - E::A => { return 0 } - E::B => { 1 } - } - - // If lowering is wrong, this runs even for E::A; we expect only the B arm to reach here. - x + 1 -} - -pub fn main() -> u256 { - f(E::B) -} diff --git a/crates/codegen/tests/fixtures/match_nested_default.fe b/crates/codegen/tests/fixtures/match_nested_default.fe deleted file mode 100644 index 737f465b6b..0000000000 --- a/crates/codegen/tests/fixtures/match_nested_default.fe +++ /dev/null @@ -1,61 +0,0 @@ -enum Inner { - A, - B, - C -} - -enum Outer { - First(Inner), - Second(Inner) -} - -// Nested defaults: wildcard catches both outer and inner defaults -pub fn nested_with_defaults(o: Outer) -> u8 { - match o { - Outer::First(Inner::A) => 1 - Outer::Second(Inner::B) => 2 - _ => 0 - } -} - -// Specific outer, wildcard inner - the bug case! -// Outer::First(_) should match First(B) and First(C), returning 2 -// _ should only match Second variants, returning 3 -pub fn outer_specific_inner_wildcard(o: Outer) -> u8 { - match o { - Outer::First(Inner::A) => 1 - Outer::First(_) => 2 - _ => 3 - } -} - -// Deep nesting with wildcards at multiple levels -enum Deep { - Wrap(Outer) -} - -pub fn deeply_nested_wildcard(d: Deep) -> u8 { - match d { - Deep::Wrap(Outer::First(Inner::A)) => 1 - _ => 0 - } -} - -// Exhaustive inner match with outer wildcard -pub fn exhaustive_inner_outer_wildcard(o: Outer) -> u8 { - match o { - Outer::First(Inner::A) => 1 - Outer::First(Inner::B) => 2 - Outer::First(Inner::C) => 3 - _ => 0 - } -} - -pub fn main() -> (u8, u8, u8, u8) { - ( - nested_with_defaults(Outer::First(Inner::A)), - outer_specific_inner_wildcard(Outer::First(Inner::B)), - deeply_nested_wildcard(Deep::Wrap(Outer::Second(Inner::C))), - exhaustive_inner_outer_wildcard(Outer::First(Inner::C)), - ) -} diff --git a/crates/codegen/tests/fixtures/match_nested_enum.fe b/crates/codegen/tests/fixtures/match_nested_enum.fe deleted file mode 100644 index 70e67ce947..0000000000 --- a/crates/codegen/tests/fixtures/match_nested_enum.fe +++ /dev/null @@ -1,23 +0,0 @@ - -enum Inner { - Unit, - Value(u8) -} - -enum Outer { - First(Inner), - Second(u8) -} - -// Test nested enum pattern matching with bindings -pub fn match_nested_enum(outer: own Outer) -> u8 { - match outer { - Outer::First(Inner::Unit) => 0 - Outer::First(Inner::Value(x)) => x - Outer::Second(y) => y - } -} - -pub fn main() -> u8 { - match_nested_enum(Outer::First(Inner::Value(7))) -} diff --git a/crates/codegen/tests/fixtures/match_newtype_nested.fe b/crates/codegen/tests/fixtures/match_newtype_nested.fe deleted file mode 100644 index 08ac0c5bae..0000000000 --- a/crates/codegen/tests/fixtures/match_newtype_nested.fe +++ /dev/null @@ -1,19 +0,0 @@ -struct B { - inner: u256, -} - -struct A { - inner: B, -} - -pub fn match_newtype_nested(a: own A) -> u256 { - match a { - A { inner: B { inner: 0 } } => 0, - A { inner: B { inner: x } } => x, - } -} - -fn f() -> u256 { - let a = A { inner: B { inner: 10 }} - match_newtype_nested(a) -} diff --git a/crates/codegen/tests/fixtures/match_return.fe b/crates/codegen/tests/fixtures/match_return.fe deleted file mode 100644 index 08a00bdfc3..0000000000 --- a/crates/codegen/tests/fixtures/match_return.fe +++ /dev/null @@ -1,14 +0,0 @@ -use std::evm::RawOps - -enum E { A, B } - -fn f(e: E) uses (ops: RawOps) { - match e { - E::A => { ops.return_data(offset: 0, len: 0) } - E::B => { ops.return_data(offset: 0, len: 0) } - } -} - -pub fn main() uses (ops: RawOps) { - f(E::A) -} diff --git a/crates/codegen/tests/fixtures/match_struct.fe b/crates/codegen/tests/fixtures/match_struct.fe deleted file mode 100644 index fcfed395a5..0000000000 --- a/crates/codegen/tests/fixtures/match_struct.fe +++ /dev/null @@ -1,31 +0,0 @@ -// Test struct pattern matching -// This exercises struct field decomposition in decision trees - -struct Point { - x: u8, - y: u8, -} - -pub fn match_struct_fields(p: Point) -> u8 { - match ref p { - Point { x: 0, y: 0 } => 0, - Point { x: 0, y } => y, - Point { x, y: 0 } => x, - Point { x, y } => x + y, - } -} - -pub fn match_struct_wildcard(p: Point) -> u8 { - match ref p { - Point { x: 0, y: _ } => 1, - Point { x: _, y: 0 } => 2, - _ => 3, - } -} - -pub fn main() -> (u8, u8) { - ( - match_struct_fields(Point { x: 1, y: 2 }), - match_struct_wildcard(Point { x: 0, y: 1 }), - ) -} diff --git a/crates/codegen/tests/fixtures/match_tuple.fe b/crates/codegen/tests/fixtures/match_tuple.fe deleted file mode 100644 index b1355dda7c..0000000000 --- a/crates/codegen/tests/fixtures/match_tuple.fe +++ /dev/null @@ -1,35 +0,0 @@ -// Test basic tuple pattern matching -// This exercises decision tree occurrence paths for tuple decomposition - -pub fn match_bool_tuple(t: (bool, bool)) -> u8 { - match t { - (true, true) => 3, - (true, false) => 2, - (false, true) => 1, - (false, false) => 0, - } -} - -pub fn match_tuple_with_wildcard(t: (bool, bool)) -> u8 { - match t { - (true, _) => 1, - (false, _) => 0, - } -} - -pub fn match_mixed_tuple(t: (bool, u8)) -> u8 { - match t { - (true, 0) => 10, - (true, 1) => 11, - (true, _) => 12, - (false, _) => 0, - } -} - -pub fn main() -> (u8, u8, u8) { - ( - match_bool_tuple((true, false)), - match_tuple_with_wildcard((false, true)), - match_mixed_tuple((true, 2)), - ) -} diff --git a/crates/codegen/tests/fixtures/match_tuple_binding.fe b/crates/codegen/tests/fixtures/match_tuple_binding.fe deleted file mode 100644 index 4d26714dfb..0000000000 --- a/crates/codegen/tests/fixtures/match_tuple_binding.fe +++ /dev/null @@ -1,25 +0,0 @@ -// Test tuple pattern matching WITH variable bindings -// This exercises decision tree leaf.bindings for tuple elements - -pub fn match_tuple_extract(t: own (u8, u8)) -> u8 { - match t { - (0, y) => y, - (x, 0) => x, - (a, b) => a + b, - } -} - -pub fn match_nested_extract(t: own ((u8, u8), u8)) -> u8 { - match t { - ((0, 0), z) => z, - ((x, y), 0) => x + y, - ((a, _), c) => a + c, - } -} - -pub fn main() -> (u8, u8) { - ( - match_tuple_extract((1, 2)), - match_nested_extract(((1, 2), 3)), - ) -} diff --git a/crates/codegen/tests/fixtures/match_tuple_nested.fe b/crates/codegen/tests/fixtures/match_tuple_nested.fe deleted file mode 100644 index 7891f04ab5..0000000000 --- a/crates/codegen/tests/fixtures/match_tuple_nested.fe +++ /dev/null @@ -1,27 +0,0 @@ -// Test nested tuple pattern matching -// This exercises multi-level occurrence paths - -pub fn match_nested_tuple(t: ((bool, bool), bool)) -> u8 { - match t { - ((true, true), true) => 7, - ((true, true), false) => 6, - ((true, false), _) => 5, - ((false, _), true) => 2, - ((false, _), false) => 1, - } -} - -pub fn match_deeply_nested(t: (((bool, bool), bool), bool)) -> u8 { - match t { - (((true, true), true), true) => 15, - (((true, _), _), _) => 8, - (((false, _), _), _) => 0, - } -} - -pub fn main() -> (u8, u8) { - ( - match_nested_tuple(((true, false), true)), - match_deeply_nested((((true, true), false), true)), - ) -} diff --git a/crates/codegen/tests/fixtures/match_wildcard.fe b/crates/codegen/tests/fixtures/match_wildcard.fe deleted file mode 100644 index 597856b974..0000000000 --- a/crates/codegen/tests/fixtures/match_wildcard.fe +++ /dev/null @@ -1,38 +0,0 @@ -enum Color { - Red, - Green, - Blue -} - -// Simple wildcard as catch-all -pub fn match_with_wildcard(c: Color) -> u8 { - match c { - Color::Red => 1 - _ => 0 - } -} - -// Wildcard in the middle -pub fn wildcard_not_last(x: u8) -> u8 { - match x { - 0 => 10 - _ => 99 - } -} - -// Multiple specific cases before wildcard -pub fn multiple_before_wildcard(c: Color) -> u8 { - match c { - Color::Red => 1 - Color::Green => 2 - _ => 3 - } -} - -pub fn main() -> (u8, u8, u8) { - ( - match_with_wildcard(Color::Red), - wildcard_not_last(1), - multiple_before_wildcard(Color::Green), - ) -} diff --git a/crates/codegen/tests/fixtures/math_ops.fe b/crates/codegen/tests/fixtures/math_ops.fe deleted file mode 100644 index 398e76ce9a..0000000000 --- a/crates/codegen/tests/fixtures/math_ops.fe +++ /dev/null @@ -1,3 +0,0 @@ -pub fn math_ops() -> u64 { - (10 - 3) * 2 / 7 % 3 -} diff --git a/crates/codegen/tests/fixtures/method_call.fe b/crates/codegen/tests/fixtures/method_call.fe deleted file mode 100644 index e36bd38623..0000000000 --- a/crates/codegen/tests/fixtures/method_call.fe +++ /dev/null @@ -1,19 +0,0 @@ -struct Foo {} - -fn make_value() -> u64 { - 42 -} - -impl Foo { - pub fn gen_value(self) -> u64 { - make_value() - } - - pub fn return_value(self) -> u64 { - self.gen_value() - } -} - -pub fn call_method(foo: Foo) -> u64 { - foo.return_value() -} diff --git a/crates/codegen/tests/fixtures/method_infer_by_constraints.fe b/crates/codegen/tests/fixtures/method_infer_by_constraints.fe deleted file mode 100644 index 24ea767da3..0000000000 --- a/crates/codegen/tests/fixtures/method_infer_by_constraints.fe +++ /dev/null @@ -1,24 +0,0 @@ -struct S { - t: T, -} - -trait Foo { - fn foo(self) -> (T, U) -} - -impl Foo for S where T: Copy { - fn foo(self) -> (T, u64) { - (self.t, 1) - } -} - -impl Foo for S { - fn foo(self) -> (u32, u32) { - (1, 2) - } -} - -pub fn call() -> (u64, u64) { - let s: S = S { t: 10 } - s.foo() -} diff --git a/crates/codegen/tests/fixtures/momo.fe b/crates/codegen/tests/fixtures/momo.fe deleted file mode 100644 index ad92104891..0000000000 --- a/crates/codegen/tests/fixtures/momo.fe +++ /dev/null @@ -1,12 +0,0 @@ -struct MyStruct { - x: u8, - y: u8, -} - -pub fn read_x(val: MyStruct) -> u8 { - val.x + val.y -} - -pub fn main() -> u8 { - read_x(MyStruct { x: 1, y: 2 }) -} diff --git a/crates/codegen/tests/fixtures/name_collisions.fe b/crates/codegen/tests/fixtures/name_collisions.fe deleted file mode 100644 index 6321053e7a..0000000000 --- a/crates/codegen/tests/fixtures/name_collisions.fe +++ /dev/null @@ -1,220 +0,0 @@ -// This test demonstrates various name collision issues in symbol mangling. -// Each section shows a different category of collision that can produce -// invalid backend output (duplicate function definitions). - -// ============================================================================= -// 1. Module qualifier flattening collisions -// ============================================================================= -// When a base name is considered "ambiguous", mangling prefixes it with a module -// qualifier. That qualifier is computed by joining module segments with `_`. -// If two distinct module paths produce the same qualifier string, the base is -// *not* considered ambiguous and we can emit duplicate symbols. -// -// Example: `a::b` and `a_b` both qualify to `a_b`, so both functions below end -// up as `flattened_fn`. - -mod a { - pub mod b { - pub fn flattened_fn() -> u32 { - 1 - } - } -} - -mod a_b { - pub fn flattened_fn() -> u32 { - 2 - } -} - -fn test_module_qualifier_flatten_collision() -> u32 { - a::b::flattened_fn() + a_b::flattened_fn() -} - -// ============================================================================= -// 2. Type name collisions in generic mangling -// ============================================================================= -// Generic suffixes use ty.pretty_print() which for ADTs is only the bare -// identifier, so two distinct types named `S` in different modules collide. - -mod types_a { - pub struct S { - pub x: u32 - } -} - -mod types_b { - pub struct S { - pub y: u64 - } -} - -fn generic_fn(_ val: own T) -> T { - val -} - -fn test_generic_type_collision() -> u32 { - let a: types_a::S = types_a::S { x: 1 } - let b: types_b::S = types_b::S { y: 2 } - // Both instantiations mangle as `generic_fn__S__` even though - // they're different types - let _ = generic_fn(a) - let _ = generic_fn(b) - 42 -} - -// ============================================================================= -// 3. Impl method prefix collisions -// ============================================================================= -// associated_prefix uses ty.pretty_print() so inherent methods on same-named -// types in different modules can collide. - -mod impl_a { - pub struct Widget { - pub val: u32 - } - - impl Widget { - pub fn process(self) -> u32 { - self.val * 2 - } - } -} - -mod impl_b { - pub struct Widget { - pub val: u64 - } - - impl Widget { - pub fn process(self) -> u64 { - self.val * 3 - } - } -} - -fn test_impl_method_collision() -> u32 { - let a = impl_a::Widget { val: 10 } - let b = impl_b::Widget { val: 20 } - // Both methods mangle as `widget_process` even though they're - // on different types - let x: u32 = a.process() - let y: u64 = b.process() - x -} - -// ============================================================================= -// 4. Trait method collisions (same trait name in different modules) -// ============================================================================= -// Trait method mangling includes the trait's identifier, but not its module -// path. So two distinct traits named `Trait` in different modules collide. - -mod trait_mod_a { - pub trait Trait { - fn same_method(self) -> u32 - } -} - -mod trait_mod_b { - pub trait Trait { - fn same_method(self) -> u32 - } -} - -struct MultiTraitImpl { - pub value: u32 -} - -impl trait_mod_a::Trait for MultiTraitImpl { - fn same_method(self) -> u32 { - self.value + 1 - } -} - -impl trait_mod_b::Trait for MultiTraitImpl { - fn same_method(self) -> u32 { - self.value + 2 - } -} - -fn test_trait_method_collision() -> u32 { - let obj = MultiTraitImpl { value: 100 } - // Both trait method implementations may collide - let a: u32 = trait_mod_a::Trait::same_method(obj) - let obj2 = MultiTraitImpl { value: 100 } - let b: u32 = trait_mod_b::Trait::same_method(obj2) - a + b -} - -// ============================================================================= -// 5. Parameter vs local variable name collisions -// ============================================================================= -// alloc_local() generates names v0, v1, v2... starting from 0, regardless of -// parameter names. If a parameter is named v0, local variables will collide. - -fn param_local_collision(_ v0: u32) -> u32 { - // The first local variable allocated will also be named v0, - // colliding with the parameter - let x = v0 + 1 - let y = x + 2 - y -} - -fn test_param_local_collision() -> u32 { - param_local_collision(10) -} - -// ============================================================================= -// 6. User-defined conversion-pattern name -// ============================================================================= - -fn __u32_as_u256(_ x: u32) -> u256 { - let result: u256 = 999 - result -} - -fn test_user_defined_conversion_pattern_name() -> u256 { - __u32_as_u256(42) -} - -// ============================================================================= -// 7. `ret` parameter name collision -// ============================================================================= -// Codegen uses a fixed return name `ret` in backend signatures. Parameters are -// uniqued against each other, but not against this implicit return name. - -fn ret_param_collision(_ ret: u32) -> u32 { - ret + 1 -} - -fn test_ret_param_collision() -> u32 { - ret_param_collision(10) -} - -// ============================================================================= -// 8. Backend reserved function name collision -// ============================================================================= -// Function symbols must not collide with backend-reserved words/opcodes. - -fn add() -> u32 { - 123 -} - -fn test_backend_reserved_fn_collision() -> u32 { - add() -} - -// ============================================================================= -// Entry point that exercises all collision scenarios -// ============================================================================= -pub fn main() -> u32 { - let _ = test_module_qualifier_flatten_collision() - let _ = test_generic_type_collision() - let _ = test_impl_method_collision() - let _ = test_trait_method_collision() - let _ = test_param_local_collision() - let _ = test_user_defined_conversion_pattern_name() - let _ = test_ret_param_collision() - let _ = test_backend_reserved_fn_collision() - 0 -} diff --git a/crates/codegen/tests/fixtures/nested_struct.fe b/crates/codegen/tests/fixtures/nested_struct.fe deleted file mode 100644 index 9bf329394b..0000000000 --- a/crates/codegen/tests/fixtures/nested_struct.fe +++ /dev/null @@ -1,68 +0,0 @@ -use std::evm::{Evm, RawMem, RawOps, RawStorage, StorPtr, mem} - -struct Inner { - value: u256, -} - -struct Outer { - inner: Inner, -} - -struct MemOuter { - inner: Inner, -} - -fn abi_encode(value: u256) -> ! uses (ops: mut RawOps) { - ops.mstore(addr: 0, value: value) - ops.return_data(offset: 0, len: 32) -} - -fn read_inner() -> u256 - uses (outer: Outer) -{ - outer.inner.value -} - -fn write_inner(value: u256) - uses (outer: mut Outer) -{ - outer.inner.value = value -} - -fn mem_read(value: u256) -> u256 { - let mut tmp = MemOuter { inner: Inner { value: 0 } } - tmp.inner.value = value - tmp.inner.value -} - -#[contract_init(NestedStruct)] -fn init() uses (evm: mut Evm) { - let len = evm.code_region_len(runtime) - let offset = evm.code_region_offset(runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(NestedStruct)] -fn runtime() uses (evm: mut Evm) { - let mut outer: StorPtr = evm.stor_ptr(0) - with (outer, RawOps = evm) { - let selector = evm.calldataload(0) >> 224 - match selector { - 0xb849fac8 => { // write_inner(uint256) - let value = evm.calldataload(4) - write_inner(value) - abi_encode(value: value) - } - 0xd164e48d => { // read_inner() - abi_encode(value: read_inner()) - } - 0x806f30cd => { // mem_read(uint256) - let value = evm.calldataload(4) - abi_encode(value: mem_read(value)) - } - _ => evm.return_data(offset: 0, len: 0) - } - } -} diff --git a/crates/codegen/tests/fixtures/newtype_field_mut_method_call.fe b/crates/codegen/tests/fixtures/newtype_field_mut_method_call.fe deleted file mode 100644 index b839025db5..0000000000 --- a/crates/codegen/tests/fixtures/newtype_field_mut_method_call.fe +++ /dev/null @@ -1,40 +0,0 @@ -struct Counter { - value: u256, - pad: u256, -} - -impl Counter { - fn bump(mut self) { - self.value += 1 - } -} - -struct WrapCounter { - inner: Counter, -} - -impl WrapCounter { - fn bump(mut self) { - self.inner.value += 1 - } -} - -struct Container { - pad: u256, - w: WrapCounter, -} - -pub fn newtype_field_mut_method_call(x: u256) -> u256 { - let mut c = Container { - pad: 0, - w: WrapCounter { - inner: Counter { value: x, pad: 0 }, - }, - } - c.w.bump() - c.w.inner.value -} - -pub fn main() -> u256 { - newtype_field_mut_method_call(1) -} diff --git a/crates/codegen/tests/fixtures/newtype_storage_byplace_effect_arg.fe b/crates/codegen/tests/fixtures/newtype_storage_byplace_effect_arg.fe deleted file mode 100644 index 9c210f8705..0000000000 --- a/crates/codegen/tests/fixtures/newtype_storage_byplace_effect_arg.fe +++ /dev/null @@ -1,27 +0,0 @@ -msg Msg { - #[selector = 1] - Bump -> u256 -} - -struct Wrap { - inner: u256, -} - -fn bump() uses (w: mut Wrap) { - w.inner += 1 -} - -pub contract NewtypeByPlaceEffectArg { - mut x: u256 - mut w: Wrap - - init() {} - - recv Msg { - Bump -> u256 uses (mut w, mut x) { - bump() - x += 1 - x - } - } -} diff --git a/crates/codegen/tests/fixtures/newtype_storage_field_mut_method_call.fe b/crates/codegen/tests/fixtures/newtype_storage_field_mut_method_call.fe deleted file mode 100644 index 60b8c90c7a..0000000000 --- a/crates/codegen/tests/fixtures/newtype_storage_field_mut_method_call.fe +++ /dev/null @@ -1,28 +0,0 @@ -msg Msg { - #[selector = 1] - Bump -> u256 -} - -struct Wrap { - inner: u256, -} - -impl Wrap { - fn bump(mut self) { - self.inner += 1 - } -} - -pub contract NewtypeStorageFieldMutMethodCall { - mut pad: u256 - mut w: Wrap - - init() {} - - recv Msg { - Bump -> u256 uses (mut w) { - w.bump() - w.inner - } - } -} diff --git a/crates/codegen/tests/fixtures/newtype_u8_word_conversion.fe b/crates/codegen/tests/fixtures/newtype_u8_word_conversion.fe deleted file mode 100644 index 49b8dfa586..0000000000 --- a/crates/codegen/tests/fixtures/newtype_u8_word_conversion.fe +++ /dev/null @@ -1,18 +0,0 @@ -struct WrapU8 { - inner: u8, -} - -struct Container { - w: WrapU8, - pad: u256, -} - -pub fn newtype_u8_roundtrip(x: u8) -> u8 { - let c = Container { w: WrapU8 { inner: x }, pad: 0 } - let w = ref c.w - w.inner -} - -pub fn main() -> u8 { - newtype_u8_roundtrip(7) -} diff --git a/crates/codegen/tests/fixtures/newtype_word_mut_method_call.fe b/crates/codegen/tests/fixtures/newtype_word_mut_method_call.fe deleted file mode 100644 index c6f92f9a04..0000000000 --- a/crates/codegen/tests/fixtures/newtype_word_mut_method_call.fe +++ /dev/null @@ -1,20 +0,0 @@ -struct Wrap { - inner: u256, -} - -impl Wrap { - fn bump(mut own self) -> Self { - self.inner += 1 - self - } -} - -pub fn newtype_word_mut_method_call(x: u256) -> u256 { - let w = Wrap { inner: x } - let w = w.bump() - w.inner -} - -pub fn main() -> u256 { - newtype_word_mut_method_call(1) -} diff --git a/crates/codegen/tests/fixtures/packed_struct_u8_array_field.fe b/crates/codegen/tests/fixtures/packed_struct_u8_array_field.fe deleted file mode 100644 index 3e217050b9..0000000000 --- a/crates/codegen/tests/fixtures/packed_struct_u8_array_field.fe +++ /dev/null @@ -1,12 +0,0 @@ -struct Pair { - bytes: [u8; 2], - value: u256, -} - -pub fn packed_field_offset() -> u256 { - let pair = Pair { - bytes: [1, 2], - value: 42, - } - pair.value -} diff --git a/crates/codegen/tests/fixtures/pointer_field_aggregate.fe b/crates/codegen/tests/fixtures/pointer_field_aggregate.fe deleted file mode 100644 index c8c78d9f88..0000000000 --- a/crates/codegen/tests/fixtures/pointer_field_aggregate.fe +++ /dev/null @@ -1,24 +0,0 @@ -use std::evm::{MemPtr, RawMem} - -struct Holder { - ptr: MemPtr, - value: u256, -} - -fn bump() uses (value: mut u256) { - value += 1 -} - -pub fn pointer_field_aggregate() uses (mem: mut RawMem) { - let mut holder = Holder { ptr: mem.mem_ptr(0x100), value: 1 } - let first = holder.ptr - with (first) { - bump() - } - - holder.ptr = mem.mem_ptr(0x120) - let second = holder.ptr - with (second) { - bump() - } -} diff --git a/crates/codegen/tests/fixtures/range_bounds.fe b/crates/codegen/tests/fixtures/range_bounds.fe deleted file mode 100644 index ccdb56a9c2..0000000000 --- a/crates/codegen/tests/fixtures/range_bounds.fe +++ /dev/null @@ -1,31 +0,0 @@ -pub fn sum_const() -> usize { - let mut sum: usize = 0 - for i in 0..4 { - sum = sum + i - } - sum -} - -pub fn sum_dynamic_end(end: usize) -> usize { - let mut sum: usize = 0 - for i in 0..end { - sum = sum + i - } - sum -} - -pub fn sum_dynamic_start(start: usize) -> usize { - let mut sum: usize = 0 - for i in start..4 { - sum = sum + i - } - sum -} - -pub fn sum_dynamic(start: usize, end: usize) -> usize { - let mut sum: usize = 0 - for i in start..end { - sum = sum + i - } - sum -} diff --git a/crates/codegen/tests/fixtures/raw_log_emit.fe b/crates/codegen/tests/fixtures/raw_log_emit.fe deleted file mode 100644 index 42ead89e47..0000000000 --- a/crates/codegen/tests/fixtures/raw_log_emit.fe +++ /dev/null @@ -1,15 +0,0 @@ -use core::EffectHandle -use std::evm::{Evm, Log, MemPtr, RawMem} - -struct Data { - a: u256, -} - -fn raw_emit(evm: mut Evm) { - let data: MemPtr = evm.mem_ptr(0x100) - evm.log0(offset: data.raw(), len: core::size_of()) -} - -pub fn main() uses (evm: mut Evm) { - raw_emit(mut evm) -} diff --git a/crates/codegen/tests/fixtures/ref_is_not_a_copy.fe b/crates/codegen/tests/fixtures/ref_is_not_a_copy.fe deleted file mode 100644 index 1931b38f4a..0000000000 --- a/crates/codegen/tests/fixtures/ref_is_not_a_copy.fe +++ /dev/null @@ -1,27 +0,0 @@ -struct Data { - x: u256, - y: u256, -} - -struct LiveView { - x: ref u256, - y: ref u256, -} - -fn live_view(_ d: ref Data) -> LiveView { - LiveView { x: ref d.x, y: ref d.y } -} - -#[test] -fn test_ref_is_not_a_copy() { - let d = Data { x: 10, y: 20 } - let live = live_view(ref d) - let live_x: ref u256 = live.x - let live_y: ref u256 = live.y - assert!(live_x == d.x) - assert!(live_y == d.y) -} - -pub fn main() { - test_ref_is_not_a_copy() -} diff --git a/crates/codegen/tests/fixtures/ret.fe b/crates/codegen/tests/fixtures/ret.fe deleted file mode 100644 index 789ca63930..0000000000 --- a/crates/codegen/tests/fixtures/ret.fe +++ /dev/null @@ -1,21 +0,0 @@ -pub fn retfoo(b1: bool, x: u64) -> u64 { - if b1 { - return 0 - } - - if x < 5 { - return 1 - } - - let y = x - 1 - - if y == 42 { - return 2 - } - - y + 1 -} - -pub fn main() -> u64 { - retfoo(false, 7) -} diff --git a/crates/codegen/tests/fixtures/revert.fe b/crates/codegen/tests/fixtures/revert.fe deleted file mode 100644 index 2995537ae2..0000000000 --- a/crates/codegen/tests/fixtures/revert.fe +++ /dev/null @@ -1,10 +0,0 @@ -use std::evm::{RawMem, RawOps} - -fn fail() uses (ops: mut RawOps) { - ops.mstore(addr: 0, value: 42) - ops.revert(offset: 0, len: 32) -} - -pub fn main() uses (ops: mut RawOps) { - fail() -} diff --git a/crates/codegen/tests/fixtures/runtime_constructs/fe.toml b/crates/codegen/tests/fixtures/runtime_constructs/fe.toml deleted file mode 100644 index 84680d62b9..0000000000 --- a/crates/codegen/tests/fixtures/runtime_constructs/fe.toml +++ /dev/null @@ -1,4 +0,0 @@ -[ingot] -name = "runtime_constructs" -version = "0.1.0" - diff --git a/crates/codegen/tests/fixtures/runtime_constructs/src/child.fe b/crates/codegen/tests/fixtures/runtime_constructs/src/child.fe deleted file mode 100644 index d38c40e336..0000000000 --- a/crates/codegen/tests/fixtures/runtime_constructs/src/child.fe +++ /dev/null @@ -1,16 +0,0 @@ -use std::evm::{Evm, mem} - -#[contract_init(Child)] -pub fn child_init() uses (evm: mut Evm) { - let len = evm.code_region_len(child_runtime) - let offset = evm.code_region_offset(child_runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(Child)] -pub fn child_runtime() uses (evm: mut Evm) { - evm.mstore(addr: 0, value: 0xbeef) - evm.return_data(offset: 0, len: 32) -} diff --git a/crates/codegen/tests/fixtures/runtime_constructs/src/lib.fe b/crates/codegen/tests/fixtures/runtime_constructs/src/lib.fe deleted file mode 100644 index d4ca92baef..0000000000 --- a/crates/codegen/tests/fixtures/runtime_constructs/src/lib.fe +++ /dev/null @@ -1,21 +0,0 @@ -use std::evm::{Create, Evm, mem} - -#[contract_init(Parent)] -fn init() uses (evm: mut Evm) { - let len = evm.code_region_len(runtime) - let offset = evm.code_region_offset(runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(Parent)] -fn runtime() uses (evm: mut Evm) { - let len = evm.code_region_len(child::child_init) - let offset = evm.code_region_offset(child::child_init) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - let addr = evm.create2_raw(value: 0, offset: dest, len: len, salt: 0x1234) - evm.mstore(addr: 0, value: addr.inner) - evm.return_data(offset: 0, len: 32) -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/alloc.snap b/crates/codegen/tests/fixtures/sonatina_ir/alloc.snap deleted file mode 100644 index 3372938ecc..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/alloc.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/alloc.fe ---- -target = "evm-ethereum-osaka" - -func private %bump_const() -> i256 { - block0: - jump block1; - - block1: - v1.*i8 = evm_malloc 64.i256; - v2.i256 = ptr_to_int v1 i256; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %bump_const; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/alloc_self_assign.snap b/crates/codegen/tests/fixtures/sonatina_ir/alloc_self_assign.snap deleted file mode 100644 index 28cb3be886..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/alloc_self_assign.snap +++ /dev/null @@ -1,41 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/alloc_self_assign.fe ---- -target = "evm-ethereum-osaka" - -func private %bump_self_assign(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.*i8 = evm_malloc v0; - v3.i256 = ptr_to_int v2 i256; - return v3; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %bump_self_assign 64.i256; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/arg_bindings.snap b/crates/codegen/tests/fixtures/sonatina_ir/arg_bindings.snap deleted file mode 100644 index c8bd6e3899..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/arg_bindings.snap +++ /dev/null @@ -1,48 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/arg_bindings.fe ---- -target = "evm-ethereum-osaka" - -func private %arg_bindings(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - (v4.i64, v5.i1) = uaddo v0 v1; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v4; -} - -func private %main() -> i64 { - block0: - jump block1; - - block1: - v2.i64 = call %arg_bindings 1.i64 2.i64; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/array_literal.snap b/crates/codegen/tests/fixtures/sonatina_ir/array_literal.snap deleted file mode 100644 index 486741105f..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/array_literal.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/array_literal.fe ---- -target = "evm-ethereum-osaka" - -global private const [i8; 64] $const_region_0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64]; - -func private %large_array_literal() -> [i8; 64] { - block0: - jump block1; - - block1: - v64.constref<[i8; 64]> = const.ref $const_region_0; - v65.constref<[i8; 64]> = const.ref $const_region_0; - v66.objref<[i8; 64]> = obj.alloc [i8; 64]; - obj.init.const v66 v65; - v67.[i8; 64] = obj.load v66; - return v67; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.[i8; 64] = call %large_array_literal; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/array_literal_u256.snap b/crates/codegen/tests/fixtures/sonatina_ir/array_literal_u256.snap deleted file mode 100644 index 6649f5f68a..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/array_literal_u256.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/array_literal_u256.fe ---- -target = "evm-ethereum-osaka" - -global private const [i256; 4] $const_region_0 = [1, 2, 3, 4]; - -func private %fixed_u256_array_literal() -> [i256; 4] { - block0: - jump block1; - - block1: - v4.constref<[i256; 4]> = const.ref $const_region_0; - v5.constref<[i256; 4]> = const.ref $const_region_0; - v6.objref<[i256; 4]> = obj.alloc [i256; 4]; - obj.init.const v6 v5; - v7.[i256; 4] = obj.load v6; - return v7; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.[i256; 4] = call %fixed_u256_array_literal; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/array_mut.snap b/crates/codegen/tests/fixtures/sonatina_ir/array_mut.snap deleted file mode 100644 index 2d8855cb58..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/array_mut.snap +++ /dev/null @@ -1,43 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/array_mut.fe ---- -target = "evm-ethereum-osaka" - -func private %array_mut(v0.i8) -> [i8; 4] { - block0: - jump block1; - - block1: - v7.[i8; 4] = insert_value undef.[i8; 4] 0.i256 v0; - v9.[i8; 4] = insert_value v7 1.i256 2.i8; - v11.[i8; 4] = insert_value v9 2.i256 3.i8; - v13.[i8; 4] = insert_value v11 3.i256 4.i8; - return v13; -} - -func private %main() -> [i8; 4] { - block0: - jump block1; - - block1: - v1.[i8; 4] = call %array_mut 1.i8; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.[i8; 4] = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/aug_assign.snap b/crates/codegen/tests/fixtures/sonatina_ir/aug_assign.snap deleted file mode 100644 index e54bb81fd0..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/aug_assign.snap +++ /dev/null @@ -1,78 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/aug_assign.fe ---- -target = "evm-ethereum-osaka" - -func private %aug_assign(v0.i64, v1.i64) -> i64 { - block0: - v2.*i64 = alloca i64; - jump block1; - - block1: - mstore v2 v0 i64; - v4.i256 = ptr_to_int v2 i256; - v6.i256 = mload v4 i256; - v7.i64 = trunc v6 i64; - (v8.i64, v9.i1) = uaddo v7 v1; - br v9 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v16.i256 = zext v8 i256; - mstore v4 v16 i256; - v17.i256 = ptr_to_int v2 i256; - v19.i256 = mload v17 i256; - v20.i64 = trunc v19 i64; - (v21.i64, v22.i1) = umulo v20 2.i64; - br v22 block2 block4; - - block4: - v24.i256 = zext v21 i256; - mstore v17 v24 i256; - v25.i64 = mload v2 i64; - v27.i1 = eq 2.i64 0.i64; - br v27 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 18.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - (v29.i64, v30.i1) = evm_udivo v25 2.i64; - br v30 block2 block7; - - block7: - return v29; -} - -func private %main() -> i64 { - block0: - jump block1; - - block1: - v2.i64 = call %aug_assign 1.i64 2.i64; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/aug_assign_bit_ops.snap b/crates/codegen/tests/fixtures/sonatina_ir/aug_assign_bit_ops.snap deleted file mode 100644 index 689f51cf8a..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/aug_assign_bit_ops.snap +++ /dev/null @@ -1,87 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/aug_assign_bit_ops.fe ---- -target = "evm-ethereum-osaka" - -func private %aug_assign_bit_ops(v0.i256, v1.i256) -> i256 { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - mstore v2 v0 i256; - v4.i256 = ptr_to_int v2 i256; - v6.i256 = mload v4 i256; - jump block2; - - block2: - v9.i256 = phi (1.i256 block1) (v12 block6); - v10.i256 = phi (0.i256 block1) (v18 block6); - v11.i1 = eq v10 v1; - br v11 block4 block3; - - block3: - (v12.i256, v13.i1) = umulo v9 v6; - br v13 block5 block6; - - block4: - mstore v4 v9 i256; - v20.i256 = ptr_to_int v2 i256; - v22.i256 = mload v20 i256; - v23.i256 = shl 3.i256 v22; - mstore v20 v23 i256; - v24.i256 = ptr_to_int v2 i256; - v25.i256 = mload v24 i256; - v26.i256 = shr 1.i256 v25; - mstore v24 v26 i256; - v27.i256 = ptr_to_int v2 i256; - v29.i256 = mload v27 i256; - v30.i256 = and v29 255.i256; - mstore v27 v30 i256; - v31.i256 = ptr_to_int v2 i256; - v32.i256 = mload v31 i256; - v33.i256 = or v32 1.i256; - mstore v31 v33 i256; - v34.i256 = ptr_to_int v2 i256; - v36.i256 = mload v34 i256; - v37.i256 = xor v36 2.i256; - mstore v34 v37 i256; - v38.i256 = mload v2 i256; - return v38; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v18.i256 = add v10 1.i256; - jump block2; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %aug_assign_bit_ops 3.i256 2.i256; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/bit_and.snap b/crates/codegen/tests/fixtures/sonatina_ir/bit_and.snap deleted file mode 100644 index bc6faff772..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/bit_and.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/bit_and.fe ---- -target = "evm-ethereum-osaka" - -func private %bit_and() -> i64 { - block0: - jump block1; - - block1: - return 0.i64; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %bit_and; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/bit_ops.snap b/crates/codegen/tests/fixtures/sonatina_ir/bit_ops.snap deleted file mode 100644 index e94c57a407..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/bit_ops.snap +++ /dev/null @@ -1,82 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/bit_ops.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256, i256, i256, i256}; - -func private %bit_ops(v0.i256, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = and v0 v1; - v5.i256 = or v0 v1; - v6.i256 = xor v0 v1; - v8.i256 = shl 8.i256 v0; - v10.i256 = shr 2.i256 v0; - v13.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - v15.@layout_0 = insert_value v13 1.i256 v5; - v16.@layout_0 = insert_value v15 2.i256 v6; - v18.@layout_0 = insert_value v16 3.i256 v8; - v20.@layout_0 = insert_value v18 4.i256 v10; - return v20; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %bit_ops 1.i256 2.i256; - v4.i256 = call %pow_op 2.i256 3.i256; - return v4; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - -func private %pow_op(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - jump block2; - - block2: - v6.i256 = phi (1.i256 block1) (v9 block6); - v7.i256 = phi (0.i256 block1) (v15 block6); - v8.i1 = eq v7 v1; - br v8 block4 block3; - - block3: - (v9.i256, v10.i1) = umulo v6 v0; - br v10 block5 block6; - - block4: - return v6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v15.i256 = add v7 1.i256; - jump block2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/bitnot.snap b/crates/codegen/tests/fixtures/sonatina_ir/bitnot.snap deleted file mode 100644 index 040b6b134c..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/bitnot.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/bitnot.fe ---- -target = "evm-ethereum-osaka" - -func private %bit_not(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = not v0; - return v2; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %bit_not 1.i256; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/block_expr.snap b/crates/codegen/tests/fixtures/sonatina_ir/block_expr.snap deleted file mode 100644 index 70c86e691e..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/block_expr.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/block_expr.fe ---- -target = "evm-ethereum-osaka" - -func private %block_expr() -> i64 { - block0: - jump block1; - - block1: - return 3.i64; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %block_expr; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/bool_literal.snap b/crates/codegen/tests/fixtures/sonatina_ir/bool_literal.snap deleted file mode 100644 index 76e0cc0cc5..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/bool_literal.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/bool_literal.fe ---- -target = "evm-ethereum-osaka" - -func private %bool_literal() -> i1 { - block0: - jump block1; - - block1: - return 1.i1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i1 = call %bool_literal; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/borrow_handles_readback.snap b/crates/codegen/tests/fixtures/sonatina_ir/borrow_handles_readback.snap deleted file mode 100644 index 94c4905986..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/borrow_handles_readback.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/borrow_handles_readback.fe ---- -target = "evm-ethereum-osaka" - -func private %borrow_handles_readback() -> i256 { - block0: - v0.*i256 = alloca i256; - jump block1; - - block1: - mstore v0 0.i256 i256; - v2.i256 = ptr_to_int v0 i256; - mstore v2 5.i256 i256; - v4.i256 = mload v0 i256; - return v4; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %borrow_handles_readback; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/borrow_storage_field_handle.snap b/crates/codegen/tests/fixtures/sonatina_ir/borrow_storage_field_handle.snap deleted file mode 100644 index 739da3b14e..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/borrow_storage_field_handle.snap +++ /dev/null @@ -1,69 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/borrow_storage_field_handle.fe ---- -target = "evm-ethereum-osaka" - -func private %borrow_storage_field_handle(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = evm_sload v0; - (v4.i256, v5.i1) = uaddo v3 1.i256; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - evm_sstore v0 v4; - v13.i256 = evm_sload v0; - return v13; -} - -func private %from_raw(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %stor_ptr 0.i256; - v2.i256 = call %borrow_storage_field_handle v1; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - -func private %stor_ptr(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %from_raw v0; - return v2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/by_ref_trait_provider_storage_bug.snap b/crates/codegen/tests/fixtures/sonatina_ir/by_ref_trait_provider_storage_bug.snap deleted file mode 100644 index 7f31c536f0..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/by_ref_trait_provider_storage_bug.snap +++ /dev/null @@ -1,548 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/by_ref_trait_provider_storage_bug.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256}; -type @layout_2 = {}; -type @layout_3 = {@layout_2}; -type @layout_4 = {i256, i256}; -type @layout_5 = {i256, i256}; - -global private const @layout_5 $const_region_0 = {40, 2}; -global private const @layout_1 $const_region_1 = {0}; - -func private %__ByRefTraitProviderStorageBug_init(v0.i256) { - block0: - jump block1; - - block1: - v3.constref<@layout_5> = const.ref $const_region_0; - v4.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v4 v3; - v5.@layout_5 = obj.load v4; - v8.i256 = extract_value v5 0.i256; - evm_sstore v0 v8; - v10.i256 = extract_value v5 1.i256; - v11.i256 = add v0 1.i256; - evm_sstore v11 v10; - return; -} - -func private %__ByRefTraitProviderStorageBug_recv_0_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %use_ctx v0; - return v2; -} - -func private %abi_field_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_83d5_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %abort() { - block0: - jump block1; - - block1: - call %revert 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %contract_init_abi_ByRefTraitProviderStorageBug() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - call %__ByRefTraitProviderStorageBug_init 0.i256; - return; -} - -func private %contract_init_root_ByRefTraitProviderStorageBug() { - block0: - jump block1; - - block1: - call %contract_init_abi_ByRefTraitProviderStorageBug; - v2.i256 = sym_addr &ByRefTraitProviderStorageBug_runtime; - v3.i256 = sym_size &ByRefTraitProviderStorageBug_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_ByRefTraitProviderStorageBug_1() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_3> = obj.alloc @layout_3; - call %decode_runtime_args v5; - v7.i256 = call %__ByRefTraitProviderStorageBug_recv_0_0 0.i256; - v8.@layout_4 = call %encode_single_root_alloc v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func private %contract_runtime_root_ByRefTraitProviderStorageBug() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (1.i32 block4); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_ByRefTraitProviderStorageBug_1; - unreachable; -} - -func inline(always) private %decode_from(v0.@layout_1, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %decode_from_prechecked_head(v0.@layout_1, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %decode_from v0 v1; - return; -} - -func inline(always) private %decode_runtime_args(v0.objref<@layout_3>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_1 = call %input; - v5.i256 = call %len v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %abort; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func private %encode(v0.i256, v1.objref<@layout_0>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_e918 v1 v0; - return; -} - -func private %encode_field(v0.i256, v1.objref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %base v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_83d5 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_7682 v1 v10; - v12.i256 = call %pos v1; - v13.i256 = mload v2 i256; - call %set_base v1 v13; - v15.i256 = mload v2 i256; - call %set_pos v1 v15; - call %encode v0 v1; - call %set_base v1 v5; - call %set_pos v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %pos v1; - call %encode_to_ptr v0 v24; - v28.i256 = add v24 32.i256; - call %set_pos v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode v0 v1; - return; -} - -func private %encode_single_root(v0.i256, v1.objref<@layout_0>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %base v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.i256) -> @layout_4 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_0 = call %encoder_new v2; - v4.objref<@layout_0> = obj.alloc @layout_0; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %base v4; - call %encode_single_root v0 v4; - v14.@layout_4 = insert_value undef.@layout_4 0.i256 v11; - v15.@layout_4 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_to_ptr(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %store_word v1 v0; - return; -} - -func private %encoder_new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %input() -> @layout_1 { - block0: - jump block1; - - block1: - v0.@layout_1 = call %impl_CallData__new; - return v0; -} - -func inline(always) private %len(v0.@layout_1) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %impl_CallData__new() -> @layout_1 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_1; - v2.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v2 v1; - v3.@layout_1 = obj.load v2; - return v3; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_0 = call %at v7; - return v8; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_83d5(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_83d5_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %pos(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %revert(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %set_base(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %set_pos(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %sum(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_sload v0; - v4.i256 = add v0 1.i256; - v5.i256 = evm_sload v4; - (v6.i256, v7.i1) = uaddo v2 v5; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %use_ctx(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %sum v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_7682(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_e918(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @ByRefTraitProviderStorageBug { - section init { - entry %contract_init_root_ByRefTraitProviderStorageBug; - embed .runtime as &ByRefTraitProviderStorageBug_runtime; - } - section runtime { - entry %contract_runtime_root_ByRefTraitProviderStorageBug; - data $const_region_1; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/caller.snap b/crates/codegen/tests/fixtures/sonatina_ir/caller.snap deleted file mode 100644 index 6c8ce7dd6e..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/caller.snap +++ /dev/null @@ -1,71 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/caller.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; - -func private %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_efe3() -> @layout_0 { - block0: - jump block1; - - block1: - v0.i256 = evm_caller; - v3.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - return v3; -} - -func private %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_efe3_0() -> @layout_0 { - block0: - jump block1; - - block1: - v0.i256 = evm_caller; - v3.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - return v3; -} - -func private %main() -> @layout_0 { - block0: - jump block1; - - block1: - v0.@layout_0 = call %standalone_caller__caller__who_called__gcd5c_a9cd; - return v0; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %main; - evm_stop; -} - -func private %standalone_caller__caller__who_called__gcd5c_4c8a() -> @layout_0 { - block0: - jump block1; - - block1: - v0.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_efe3; - return v0; -} - -func private %standalone_caller__caller__who_called__gcd5c_a9cd() -> @layout_0 { - block0: - jump block1; - - block1: - v0.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_efe3_0; - return v0; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/cast_u8_usize_cmp.snap b/crates/codegen/tests/fixtures/sonatina_ir/cast_u8_usize_cmp.snap deleted file mode 100644 index db3ab6c223..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/cast_u8_usize_cmp.snap +++ /dev/null @@ -1,85 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/cast_u8_usize_cmp.fe ---- -target = "evm-ethereum-osaka" - -global private const [i8; 8] $const_region_0 = [1, 2, 3, 4, 5, 6, 7, 8]; - -func private %cast_u8_usize_cmp(v0.constref<[i8; 8]>, v1.i256, v2.i256) -> i8 { - block0: - jump block1; - - block1: - v6.i1 = lt v1 8.i256; - v7.i1 = is_zero v6; - br v7 block11 block12; - - block2: - return 1.i8; - - block3: - jump block4; - - block4: - v17.i256 = zext v10 i256; - v18.i1 = eq v2 v17; - br v18 block5 block6; - - block5: - return 2.i8; - - block6: - jump block7; - - block7: - v22.i256 = zext v10 i256; - v23.i1 = gt v2 v22; - br v23 block8 block9; - - block8: - return 3.i8; - - block9: - jump block10; - - block10: - return 0.i8; - - block11: - evm_revert 0.i256 0.i256; - - block12: - v9.constref = const.index v0 v1; - v10.i8 = const.load v9; - v12.i256 = zext v10 i256; - v13.i1 = lt v2 v12; - br v13 block2 block3; -} - -func private %main() -> i8 { - block0: - jump block1; - - block1: - v8.constref<[i8; 8]> = const.ref $const_region_0; - v11.i8 = call %cast_u8_usize_cmp v8 1.i256 2.i256; - return v11; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i8 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/code_region.snap b/crates/codegen/tests/fixtures/sonatina_ir/code_region.snap deleted file mode 100644 index 8ab1c71930..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/code_region.snap +++ /dev/null @@ -1,256 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/code_region.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; - -func private %balance() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_e62a 0.i256 0.i256; - unreachable; -} - -func private %calldatacopy(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_calldata_copy v0 v1 v2; - return; -} - -func private %calldataload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %child_init() { - block0: - jump block1; - - block1: - v0.i256 = sym_size &__Child_runtime; - v1.i256 = sym_addr &__Child_runtime; - v2.*i8 = evm_malloc v0; - v3.i256 = ptr_to_int v2 i256; - call %std__lib__evm__effects__impl_trait_Evm_0098__codecopy_7791_0 v3 v1 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_5f25_2 v3 v0; - unreachable; -} - -func private %child_runtime() { - block0: - jump block1; - - block1: - call %calldatacopy 0.i256 0.i256 4.i256; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_5f25_1 0.i256 4.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__codecopy_7791(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_code_copy v0 v1 v2; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__codecopy_7791_0(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_code_copy v0 v1 v2; - return; -} - -func private %create2_raw(v0.i256, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v8.i256 = evm_create2 v0 v1 v2 v3; - v11.@layout_0 = insert_value undef.@layout_0 0.i256 v8; - return v11; -} - -func private %init() { - block0: - jump block1; - - block1: - v0.i256 = sym_size &__Child_init; - v1.i256 = sym_addr &__Child_init; - v2.*i8 = evm_malloc v0; - v3.i256 = ptr_to_int v2 i256; - call %std__lib__evm__effects__impl_trait_Evm_0098__codecopy_7791 v3 v1 v0; - v7.@layout_0 = call %create2_raw 0.i256 v3 v0 4660.i256; - v8.i256 = sym_size &__Foo_runtime; - v9.i256 = sym_addr &__Foo_runtime; - v10.*i8 = evm_malloc v8; - v11.i256 = ptr_to_int v10 i256; - call %std__lib__evm__effects__impl_trait_Evm_0098__codecopy_7791 v11 v9 v8; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_5f25_0 v11 v8; - unreachable; -} - -func private %manual_contract_init_root_Child() { - block0: - jump block1; - - block1: - call %child_init; - evm_stop; -} - -func private %manual_contract_init_root_Foo() { - block0: - jump block1; - - block1: - call %init; - evm_stop; -} - -func private %manual_contract_runtime_root_Child() { - block0: - jump block1; - - block1: - call %child_runtime; - evm_stop; -} - -func private %manual_contract_runtime_root_Foo() { - block0: - jump block1; - - block1: - call %runtime; - evm_stop; -} - -func private %read_selector() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %calldataload 0.i256; - v3.i256 = shr 224.i256 v1; - return v3; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_5f25(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_5f25_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_5f25_1(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_5f25_2(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_e62a(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %runtime() { - block0: - jump block1; - - block1: - v0.i256 = call %read_selector; - v2.i1 = eq v0 305419896.i256; - br v2 block3 block6; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_5f25 0.i256 0.i256; - unreachable; - - block3: - call %transfer; - unreachable; - - block4: - call %balance; - unreachable; - - block5: - jump block2; - - block6: - v6.i1 = eq v0 591751049.i256; - br v6 block4 block7; - - block7: - jump block5; -} - -func private %transfer() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_e62a 0.i256 0.i256; - unreachable; -} - - -object @Child { - section init { - entry %manual_contract_init_root_Child; - embed .runtime as &__Child_runtime; - } - section runtime { - entry %manual_contract_runtime_root_Child; - } -} - -object @Foo { - section init { - entry %manual_contract_init_root_Foo; - embed @Child.init as &__Child_init; - embed .runtime as &__Foo_runtime; - } - section runtime { - entry %manual_contract_runtime_root_Foo; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/code_region_qualified.snap b/crates/codegen/tests/fixtures/sonatina_ir/code_region_qualified.snap deleted file mode 100644 index e263e4c86c..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/code_region_qualified.snap +++ /dev/null @@ -1,83 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/code_region_qualified.fe ---- -target = "evm-ethereum-osaka" - -func private %codecopy(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_code_copy v0 v1 v2; - return; -} - -func private %init() { - block0: - jump block1; - - block1: - v0.i256 = sym_size &__Foo_runtime; - v1.i256 = sym_addr &__Foo_runtime; - v2.*i8 = evm_malloc v0; - v3.i256 = ptr_to_int v2 i256; - call %codecopy v3 v1 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_cf61_0 v3 v0; - unreachable; -} - -func private %manual_contract_init_root_Foo() { - block0: - jump block1; - - block1: - call %init; - evm_stop; -} - -func private %manual_contract_runtime_root_Foo() { - block0: - jump block1; - - block1: - call %runtime; - evm_stop; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_cf61(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_cf61_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %runtime() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_cf61 0.i256 0.i256; - unreachable; -} - - -object @Foo { - section init { - entry %manual_contract_init_root_Foo; - embed .runtime as &__Foo_runtime; - } - section runtime { - entry %manual_contract_runtime_root_Foo; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/comparison_ops.snap b/crates/codegen/tests/fixtures/sonatina_ir/comparison_ops.snap deleted file mode 100644 index 1c8156da86..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/comparison_ops.snap +++ /dev/null @@ -1,50 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/comparison_ops.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i1, i1, i1, i1, i1, i1}; - -global private const @layout_0 $const_region_0 = {1, 1, 1, 1, 1, 1}; - -func private %comparison_ops() -> @layout_0 { - block0: - v0.*i256 = alloca i256; - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - v3.*i256 = alloca i256; - v4.*i256 = alloca i256; - v5.*i256 = alloca i256; - jump block1; - - block1: - mstore v0 1.i256 i256; - mstore v1 2.i256 i256; - mstore v2 2.i256 i256; - mstore v3 2.i256 i256; - mstore v4 2.i256 i256; - mstore v5 3.i256 i256; - v10.constref<@layout_0> = const.ref $const_region_0; - v11.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v11 v10; - v12.@layout_0 = obj.load v11; - return v12; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %comparison_ops; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_array.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_array.snap deleted file mode 100644 index e7e49c5b30..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_array.snap +++ /dev/null @@ -1,69 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_array.fe ---- -target = "evm-ethereum-osaka" - -global private const [i256; 3] $const_region_0 = [10, 20, 30]; - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %sum_two 0.i256 1.i256; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - -func private %sum_two(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v2.constref<[i256; 3]> = const.ref $const_region_0; - v5.i1 = lt v0 3.i256; - v6.i1 = is_zero v5; - br v6 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v8.constref = const.index v2 v0; - v9.i256 = const.load v8; - v10.constref<[i256; 3]> = const.ref $const_region_0; - v12.i1 = lt v1 3.i256; - v13.i1 = is_zero v12; - br v13 block2 block4; - - block4: - v14.constref = const.index v10 v1; - v15.i256 = const.load v14; - (v17.i256, v18.i1) = uaddo v9 v15; - br v18 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v17; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_array_add.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_array_add.snap deleted file mode 100644 index 3939b36cd4..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_array_add.snap +++ /dev/null @@ -1,33 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_array_add.fe ---- -target = "evm-ethereum-osaka" - -global private const [i256; 3] $const_region_0 = [10, 20, 30]; - -func private %get_sum() -> i256 { - block0: - jump block1; - - block1: - v1.constref<[i256; 3]> = const.ref $const_region_0; - return 11.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %get_sum; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_array_addmod.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_array_addmod.snap deleted file mode 100644 index ea0a1bcf59..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_array_addmod.snap +++ /dev/null @@ -1,33 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_array_addmod.fe ---- -target = "evm-ethereum-osaka" - -global private const [i256; 3] $const_region_0 = [10, 20, 30]; - -func private %get_sum() -> i256 { - block0: - jump block1; - - block1: - v1.constref<[i256; 3]> = const.ref $const_region_0; - return 11.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %get_sum; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_array_branch.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_array_branch.snap deleted file mode 100644 index f3d48c3aa1..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_array_branch.snap +++ /dev/null @@ -1,52 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_array_branch.fe ---- -target = "evm-ethereum-osaka" - -global private const [i256; 1] $const_region_0 = [1]; - -func private %const_array_branch(v0.i1) -> i256 { - block0: - jump block1; - - block1: - br v0 block2 block3; - - block2: - v2.constref<[i256; 1]> = const.ref $const_region_0; - jump block4; - - block3: - v5.constref<[i256; 1]> = const.ref $const_region_0; - jump block4; - - block4: - return 1.i256; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %const_array_branch 1.i1; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_array_loop.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_array_loop.snap deleted file mode 100644 index c8d3e679f2..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_array_loop.snap +++ /dev/null @@ -1,87 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_array_loop.fe ---- -target = "evm-ethereum-osaka" - -global private const [i256; 3] $const_region_0 = [10, 20, 30]; - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %sum_loop 3.i256; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - -func private %sum_loop(v0.i256) -> i256 { - block0: - jump block1; - - block1: - jump block2; - - block2: - v28.i256 = phi (0.i256 block1) (v19 block11); - v2.i256 = phi (0.i256 block1) (v24 block11); - v4.i1 = lt v2 v0; - br v4 block3 block4; - - block3: - v7.i1 = eq 3.i256 0.i256; - br v7 block5 block6; - - block4: - return v28; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 18.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i256 = evm_umod v2 3.i256; - v13.constref<[i256; 3]> = const.ref $const_region_0; - v14.i1 = lt v12 3.i256; - v15.i1 = is_zero v14; - br v15 block7 block8; - - block7: - evm_revert 0.i256 0.i256; - - block8: - v16.constref = const.index v13 v12; - v17.i256 = const.load v16; - (v19.i256, v20.i1) = uaddo v28 v17; - br v20 block9 block10; - - block9: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block10: - (v24.i256, v25.i1) = uaddo v2 1.i256; - br v25 block9 block11; - - block11: - jump block2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_fn_mapping_slot_hash.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_fn_mapping_slot_hash.snap deleted file mode 100644 index cafd254314..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_fn_mapping_slot_hash.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_fn_mapping_slot_hash.fe ---- -target = "evm-ethereum-osaka" - -func private %main() -> i256 { - block0: - jump block1; - - block1: - return 3253375974595066614526584426541216327299611994431550246078837110170861790149.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_fn_packed_config.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_fn_packed_config.snap deleted file mode 100644 index 9d01adcbc6..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_fn_packed_config.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_fn_packed_config.fe ---- -target = "evm-ethereum-osaka" - -func private %main() -> i256 { - block0: - jump block1; - - block1: - return 1179678.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_keccak.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_keccak.snap deleted file mode 100644 index 76aed7e9fe..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_keccak.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_keccak.fe ---- -target = "evm-ethereum-osaka" - -func private %main() -> i256 { - block0: - jump block1; - - block1: - return 12910348618308260923200348219926901280687058984330794534952861439530514639560.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_nested_u8_array.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_nested_u8_array.snap deleted file mode 100644 index bfb48e5a2b..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_nested_u8_array.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_nested_u8_array.fe ---- -target = "evm-ethereum-osaka" - -global private const [[i8; 2]; 2] $const_region_0 = [[1, 2], [3, 4]]; -global private const [i8; 2] $const_region_1 = [3, 4]; - -func private %const_nested_u8_array() -> i8 { - block0: - jump block1; - - block1: - v0.constref<[[i8; 2]; 2]> = const.ref $const_region_0; - v2.constref<[i8; 2]> = const.ref $const_region_1; - return 3.i8; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i8 = call %const_nested_u8_array; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_string_literal_large.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_string_literal_large.snap deleted file mode 100644 index 0518e0b82d..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_string_literal_large.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_string_literal_large.fe ---- -target = "evm-ethereum-osaka" - -func private %large_string_const() -> i256 { - block0: - jump block1; - - block1: - return 172063216033151516844329818169388221396727601204421676283161692387156386917.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %large_string_const; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/const_u8_array.snap b/crates/codegen/tests/fixtures/sonatina_ir/const_u8_array.snap deleted file mode 100644 index 0851d84eb5..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/const_u8_array.snap +++ /dev/null @@ -1,83 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/const_u8_array.fe ---- -target = "evm-ethereum-osaka" - -global private const [i8; 2] $const_region_0 = [1, 2]; -global private const [i8; 40] $const_region_1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]; - -func private %alias_then_index() -> i8 { - block0: - jump block1; - - block1: - v0.constref<[i8; 2]> = const.ref $const_region_0; - v1.constref<[i8; 2]> = const.ref $const_region_0; - return 1.i8; -} - -func private %big_copy_first() -> i8 { - block0: - jump block1; - - block1: - v0.constref<[i8; 40]> = const.ref $const_region_1; - v1.constref<[i8; 40]> = const.ref $const_region_1; - return 0.i8; -} - -func private %big_index() -> i8 { - block0: - jump block1; - - block1: - v0.constref<[i8; 40]> = const.ref $const_region_1; - return 39.i8; -} - -func private %f(v0.constref<[i8; 2]>) -> i8 { - block0: - jump block1; - - block1: - v3.constref = const.index v0 1.i256; - v4.i8 = const.load v3; - return v4; -} - -func private %index_direct() -> i8 { - block0: - jump block1; - - block1: - v0.constref<[i8; 2]> = const.ref $const_region_0; - return 2.i8; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i8 = call %alias_then_index; - evm_stop; -} - -func private %pass_then_index() -> i8 { - block0: - jump block1; - - block1: - v0.constref<[i8; 2]> = const.ref $const_region_0; - v1.i8 = call %f v0; - return v1; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/contract_dispatch.snap b/crates/codegen/tests/fixtures/sonatina_ir/contract_dispatch.snap deleted file mode 100644 index 5eb42e2032..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/contract_dispatch.snap +++ /dev/null @@ -1,39 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/contract_dispatch.fe ---- -target = "evm-ethereum-osaka" - -func private %dispatch() { - block0: - jump block1; - - block1: - v0.i64 = call %emit_code; - return; -} - -func private %emit_code() -> i64 { - block0: - jump block1; - - block1: - return 1.i64; -} - -func private %manual_contract_runtime_root_MinimalDispatcher() { - block0: - jump block1; - - block1: - call %dispatch; - evm_stop; -} - - -object @MinimalDispatcher { - section runtime { - entry %manual_contract_runtime_root_MinimalDispatcher; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/create_contract.snap b/crates/codegen/tests/fixtures/sonatina_ir/create_contract.snap deleted file mode 100644 index 9c9e751667..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/create_contract.snap +++ /dev/null @@ -1,2081 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/create_contract.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; -type @layout_1 = {i256, i256}; -type @layout_2 = {i256, i256}; -type @layout_3 = {i256, i256}; -type @layout_4 = {@layout_3, i256}; -type @layout_5 = {@layout_4, i256}; -type @layout_6 = {i256}; -type @layout_7 = {i256, i256, i256}; -type @layout_8 = {i256, i256}; -type @layout_9 = {}; -type @layout_10 = {@layout_9}; - -global private const @layout_6 $const_region_0 = {0}; - -func private %__Child_init(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_sstore v2 v0; - v7.i256 = add v2 1.i256; - evm_sstore v7 v1; - return; -} - -func private %__Factory_recv_0_0(v0.i256, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v5.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v8.@layout_1 = insert_value v5 1.i256 v1; - v9.@layout_0 = call %create 0.i256 v8; - return v9; -} - -func private %__Factory_recv_0_1(v0.i256, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v9.@layout_1 = insert_value v6 1.i256 v1; - v11.@layout_0 = call %create2 0.i256 v9 v2; - return v11; -} - -func private %abi_field_size(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__g67a8_7f10_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_payload_size(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %payload_size__gbd8e v0; - return v2; -} - -func private %abi_single_root_size(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_0b80() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_286a 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_9c27() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_6bdb 0.i256 0.i256; - unreachable; -} - -func inline(always) private %std__lib__abi__sol__impl_SolEncoder_ce34__at_6558(v0.i256) -> @layout_2 { - block0: - jump block1; - - block1: - v4.@layout_2 = insert_value undef.@layout_2 0.i256 v0; - v6.@layout_2 = insert_value v4 1.i256 v0; - return v6; -} - -func inline(always) private %std__lib__abi__sol__impl_SolEncoder_ce34__at_9565(v0.i256) -> @layout_2 { - block0: - jump block1; - - block1: - v4.@layout_2 = insert_value undef.@layout_2 0.i256 v0; - v6.@layout_2 = insert_value v4 1.i256 v0; - return v6; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_0284(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %base__g463e(v0.objref<@layout_5>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_32b3(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_ae34(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_056e(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_7064; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_352b(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_e3bb; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_4046(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_43bf; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_4919(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_8b22; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %contract_init_abi_Child() { - block0: - v0.objref<@layout_3> = obj.alloc @layout_3; - v1.objref<@layout_5> = obj.alloc @layout_5; - jump block1; - - block1: - v3.i256 = evm_call_value; - v4.i1 = eq v3 0.i256; - v5.i1 = is_zero v4; - br v5 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v7.i256 = sym_size .; - v8.i256 = evm_code_size; - v9.i1 = lt v8 v7; - br v9 block4 block5; - - block4: - evm_revert 0.i256 0.i256; - - block5: - (v13.i256, v14.i1) = usubo v8 v7; - br v14 block6 block7; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v19.*i8 = evm_malloc v13; - v20.i256 = ptr_to_int v19 i256; - evm_code_copy v20 v7 v13; - v23.objref = obj.proj v0 0.i256; - obj.store v23 v20; - v25.objref = obj.proj v0 1.i256; - obj.store v25 v13; - v26.@layout_3 = obj.load v0; - v27.@layout_5 = call %decoder_new v26; - v28.objref<@layout_4> = obj.proj v1 0.i256; - v29.@layout_4 = extract_value v27 0.i256; - v30.objref<@layout_3> = obj.proj v28 0.i256; - v31.@layout_3 = extract_value v29 0.i256; - v32.objref = obj.proj v30 0.i256; - v33.i256 = extract_value v31 0.i256; - obj.store v32 v33; - v34.objref = obj.proj v30 1.i256; - v35.i256 = extract_value v31 1.i256; - obj.store v34 v35; - v36.objref = obj.proj v28 1.i256; - v37.i256 = extract_value v29 1.i256; - obj.store v36 v37; - v38.objref = obj.proj v1 1.i256; - v39.i256 = extract_value v27 1.i256; - obj.store v38 v39; - v40.@layout_1 = call %decode_payload__g4770 v1; - v41.i256 = extract_value v40 0.i256; - v42.i256 = extract_value v40 1.i256; - call %__Child_init v41 v42 0.i256; - return; -} - -func inline(always) private %contract_init_abi_Factory() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - return; -} - -func private %contract_init_root_Child() { - block0: - jump block1; - - block1: - call %contract_init_abi_Child; - v2.i256 = sym_addr &Child_runtime; - v3.i256 = sym_size &Child_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func private %contract_init_root_Factory() { - block0: - jump block1; - - block1: - call %contract_init_abi_Factory; - v2.i256 = sym_addr &Factory_runtime; - v3.i256 = sym_size &Factory_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_Factory_1() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_10> = obj.alloc @layout_10; - v6.@layout_8 = call %decode_runtime_args__gbdfb v5; - v7.i256 = extract_value v6 0.i256; - v9.i256 = extract_value v6 1.i256; - v10.@layout_0 = call %__Factory_recv_0_0 v7 v9; - v11.@layout_1 = call %encode_single_root_alloc v10; - v12.i256 = extract_value v11 0.i256; - v13.i256 = extract_value v11 1.i256; - evm_return v12 v13; -} - -func inline(always) private %contract_recv_abi_Factory_2() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_10> = obj.alloc @layout_10; - v6.@layout_7 = call %decode_runtime_args__gadcc v5; - v7.i256 = extract_value v6 0.i256; - v9.i256 = extract_value v6 1.i256; - v11.i256 = extract_value v6 2.i256; - v12.@layout_0 = call %__Factory_recv_0_1 v7 v9 v11; - v13.@layout_1 = call %encode_single_root_alloc v12; - v14.i256 = extract_value v13 0.i256; - v15.i256 = extract_value v13 1.i256; - evm_return v14 v15; -} - -func private %contract_runtime_root_Child() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3; - - block3: - evm_revert 0.i256 0.i256; -} - -func private %contract_runtime_root_Factory() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (1.i32 block4) (2.i32 block5); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_Factory_1; - unreachable; - - block5: - call %contract_recv_abi_Factory_2; - unreachable; -} - -func private %copy_words(v0.i256, v1.i256, v2.i256) { - block0: - v3.*i256 = alloca i256; - jump block1; - - block1: - mstore v3 0.i256 i256; - jump block2; - - block2: - v5.i256 = mload v3 i256; - v7.i1 = lt v5 v2; - br v7 block3 block4; - - block3: - v9.i256 = mload v3 i256; - (v10.i256, v11.i1) = uaddo v0 v9; - br v11 block5 block6; - - block4: - return; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v17.i256 = mload v3 i256; - (v18.i256, v19.i1) = uaddo v1 v17; - br v19 block5 block7; - - block7: - v20.i256 = mload v18 i256; - mstore v10 v20 i256; - v23.i256 = ptr_to_int v3 i256; - v25.i256 = mload v23 i256; - (v26.i256, v27.i1) = uaddo v25 32.i256; - br v27 block5 block8; - - block8: - mstore v23 v26 i256; - jump block2; -} - -func private %create(v0.i256, v1.@layout_1) -> @layout_0 { - block0: - jump block1; - - block1: - v2.i256 = sym_size &Child_init; - v3.i256 = sym_addr &Child_init; - br 1.i1 block5 block3; - - block2: - v7.*i8 = evm_malloc v2; - v8.i256 = ptr_to_int v7 i256; - evm_code_copy v8 v3 v2; - v12.@layout_0 = call %create_raw v0 v8 v2; - jump block4; - - block3: - v14.@layout_1 = call %encode_abi_payload v1; - v16.i256 = extract_value v14 1.i256; - (v18.i256, v19.i1) = uaddo v2 v16; - br v19 block9 block10; - - block4: - v43.@layout_0 = phi (v12 block2) (v42 block12); - v44.i256 = extract_value v43 0.i256; - v45.i1 = eq v44 0.i256; - br v45 block6 block7; - - block5: - br 0.i1 block2 block3; - - block6: - v47.i256 = evm_return_data_size; - v48.*i8 = evm_malloc v47; - v49.i256 = ptr_to_int v48 i256; - evm_return_data_copy v49 0.i256 v47; - evm_revert v49 v47; - - block7: - jump block8; - - block8: - return v43; - - block9: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block10: - v25.*i8 = evm_malloc v18; - v26.i256 = ptr_to_int v25 i256; - evm_code_copy v26 v3 v2; - (v30.i256, v31.i1) = uaddo v26 v2; - br v31 block9 block11; - - block11: - v33.i256 = extract_value v14 0.i256; - v34.i256 = extract_value v14 1.i256; - call %copy_words v30 v33 v34; - v36.i256 = extract_value v14 1.i256; - (v38.i256, v39.i1) = uaddo v2 v36; - br v39 block9 block12; - - block12: - v42.@layout_0 = call %create_raw v0 v26 v38; - jump block4; -} - -func private %create2(v0.i256, v1.@layout_1, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i256 = sym_size &Child_init; - v4.i256 = sym_addr &Child_init; - br 1.i1 block5 block3; - - block2: - v8.*i8 = evm_malloc v3; - v9.i256 = ptr_to_int v8 i256; - evm_code_copy v9 v4 v3; - v14.@layout_0 = call %create2_raw v0 v9 v3 v2; - jump block4; - - block3: - v16.@layout_1 = call %encode_abi_payload v1; - v18.i256 = extract_value v16 1.i256; - (v20.i256, v21.i1) = uaddo v3 v18; - br v21 block9 block10; - - block4: - v46.@layout_0 = phi (v14 block2) (v45 block12); - v47.i256 = extract_value v46 0.i256; - v48.i1 = eq v47 0.i256; - br v48 block6 block7; - - block5: - br 0.i1 block2 block3; - - block6: - v50.i256 = evm_return_data_size; - v51.*i8 = evm_malloc v50; - v52.i256 = ptr_to_int v51 i256; - evm_return_data_copy v52 0.i256 v50; - evm_revert v52 v50; - - block7: - jump block8; - - block8: - return v46; - - block9: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block10: - v27.*i8 = evm_malloc v20; - v28.i256 = ptr_to_int v27 i256; - evm_code_copy v28 v4 v3; - (v32.i256, v33.i1) = uaddo v28 v3; - br v33 block9 block11; - - block11: - v35.i256 = extract_value v16 0.i256; - v36.i256 = extract_value v16 1.i256; - call %copy_words v32 v35 v36; - v38.i256 = extract_value v16 1.i256; - (v40.i256, v41.i1) = uaddo v3 v38; - br v41 block9 block12; - - block12: - v45.@layout_0 = call %create2_raw v0 v28 v40 v2; - jump block4; -} - -func private %create2_raw(v0.i256, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v8.i256 = evm_create2 v0 v1 v2 v3; - v11.@layout_0 = insert_value undef.@layout_0 0.i256 v8; - return v11; -} - -func private %create_raw(v0.i256, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = evm_create v0 v1 v2; - v9.@layout_0 = insert_value undef.@layout_0 0.i256 v6; - return v9; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_43bf() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_7064() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_8b22() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_e3bb() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func inline(always) private %decode_field(v0.objref<@layout_5>) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_272f v0; - v4.i256 = call %base__g463e v0; - v5.i256 = call %pos__g463e v0; - (v6.i256, v7.i1) = uaddo v4 v3; - br v7 block5 block6; - - block3: - jump block4; - - block4: - v23.i256 = call %decode_payload__g407e v0; - return v23; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %set_base__g463e v0 v6; - v15.i256 = call %base__g463e v0; - call %set_pos__g463e v0 v15; - v17.i256 = call %decode_payload__g407e v0; - call %set_base__g463e v0 v4; - call %set_pos__g463e v0 v5; - return v17; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_0636(v0.@layout_6, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_32d2 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3180_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3180_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_5caf(v0.@layout_6, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3368 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8640_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8640_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_0f32(v0.@layout_6, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3368 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_4046 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_7fc6 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8640_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_f107(v0.@layout_6, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_32d2 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_4919 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_7780 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3180_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3180(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_8c36 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3180_0(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_8c36_0 v0 v1; - return v4; -} - -func inline(always) private %impl_trait_Deploy2__decode_from__gd20d(v0.@layout_6, v1.i256) -> @layout_7 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_6f75 v0; - v5.i256 = call %core__lib__abi__decode_msg_field_from__g5385_f1db v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %core__lib__abi__decode_msg_field_from__g5385_f1db v0 v1 v7 v3; - (v20.i256, v21.i1) = uaddo v1 32.i256; - br v21 block2 block4; - - block4: - (v22.i256, v23.i1) = uaddo v20 32.i256; - br v23 block2 block5; - - block5: - v27.i256 = call %core__lib__abi__decode_msg_field_from__g5385_f1db v0 v1 v22 v3; - v30.@layout_7 = insert_value undef.@layout_7 0.i256 v5; - v33.@layout_7 = insert_value v30 1.i256 v17; - v35.@layout_7 = insert_value v33 2.i256 v27; - return v35; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8640(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b2da v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8640_0(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b2da_0 v0 v1; - return v4; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_7780(v0.@layout_6, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_352b v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3180 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_7fc6(v0.@layout_6, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_056e v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8640 v0 v1; - return v8; -} - -func inline(always) private %impl_trait_Deploy__decode_from__gd20d(v0.@layout_6, v1.i256) -> @layout_8 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_2577 v0; - v5.i256 = call %core__lib__abi__decode_msg_field_from__g5385_790c v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %core__lib__abi__decode_msg_field_from__g5385_790c v0 v1 v7 v3; - v20.@layout_8 = insert_value undef.@layout_8 0.i256 v5; - v22.@layout_8 = insert_value v20 1.i256 v17; - return v22; -} - -func inline(always) private %decode_from_prechecked_head__g4e6c(v0.@layout_6, v1.i256, v2.i256) -> @layout_7 { - block0: - jump block1; - - block1: - v6.@layout_7 = call %impl_trait_Deploy2__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__gbecb(v0.@layout_6, v1.i256, v2.i256) -> @layout_8 { - block0: - jump block1; - - block1: - v6.@layout_8 = call %impl_trait_Deploy__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_790c(v0.@layout_6, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_f107 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_0636 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_f1db(v0.@layout_6, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_0f32 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_5caf v0 v1 v2; - return v14; -} - -func inline(always) private %decode_payload__g407e(v0.objref<@layout_5>) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7adc v0; - return v2; -} - -func private %decode_payload__g4770(v0.objref<@layout_5>) -> @layout_1 { - block0: - jump block1; - - block1: - v2.i256 = call %decode_field v0; - v3.i256 = call %decode_field v0; - v6.@layout_1 = insert_value undef.@layout_1 0.i256 v2; - v8.@layout_1 = insert_value v6 1.i256 v3; - return v8; -} - -func inline(always) private %decode_runtime_args__gadcc(v0.objref<@layout_10>) -> @layout_7 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_6 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_b215; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_847d v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_9c27; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_7 = call %decode_from_prechecked_head__g4e6c v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 100.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__gbdfb(v0.objref<@layout_10>) -> @layout_8 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_6 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_2b2c; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_8db5 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_0b80; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_8 = call %decode_from_prechecked_head__gbecb v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 68.i256 v15; - br v16 block2 block3; -} - -func private %decoder_new(v0.@layout_3) -> @layout_5 { - block0: - jump block1; - - block1: - v2.@layout_5 = call %impl_SolDecoder__new__g463e v0; - return v2; -} - -func private %dynamic_payload_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_9d4e v0; - return v3; - - block3: - jump block4; - - block4: - return 0.i256; -} - -func inline(always) private %encode__g7769(v0.@layout_1, v1.objref<@layout_2>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_0284 v1; - v6.i256 = add v4 64.i256; - mstore v2 v6 i256; - v8.i256 = add v4 32.i256; - v11.i256 = extract_value v0 0.i256; - v12.i256 = ptr_to_int v2 i256; - call %encode_field_at v11 v1 v4 v4 v12; - v15.i256 = extract_value v0 1.i256; - v16.i256 = ptr_to_int v2 i256; - call %encode_field_at v15 v1 v4 v8 v16; - v18.i256 = add v4 64.i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_4208 v1 v18; - return; -} - -func private %impl_trait_u256__encode__g426c(v0.i256, v1.objref<@layout_2>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_498a v1 v0; - return; -} - -func private %impl_trait_Address__encode__g426c(v0.@layout_0, v1.objref<@layout_2>) { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_2c07 v1 v4; - return; -} - -func private %encode_abi_payload(v0.@layout_1) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %encode_alloc v0; - return v2; -} - -func inline(always) private %encode_alloc(v0.@layout_1) -> @layout_1 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_payload_size v0; - v3.@layout_2 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_58e9 v2; - v4.objref<@layout_2> = obj.alloc @layout_2; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_ae34 v4; - call %encode__g7769 v0 v4; - v14.@layout_1 = insert_value undef.@layout_1 0.i256 v11; - v15.@layout_1 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_field(v0.@layout_0, v1.objref<@layout_2>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_32b3 v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__g67a8_7f10 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_528a v1 v10; - v12.i256 = call %impl_trait_SolEncoder__pos v1; - v13.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_b006 v1 v13; - v15.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_d061 v1 v15; - call %impl_trait_Address__encode__g426c v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_b006 v1 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_d061 v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %impl_trait_SolEncoder__pos v1; - call %impl_trait_Address__encode_to_ptr__gf13e v0 v24; - v28.i256 = add v24 32.i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_d061 v1 v28; - return; - - block6: - jump block7; - - block7: - call %impl_trait_Address__encode__g426c v0 v1; - return; -} - -func inline(always) private %encode_field_at(v0.i256, v1.objref<@layout_2>, v2.i256, v3.i256, v4.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_e893 v0; - v11.i256 = mload v4 i256; - v12.i256 = sub v11 v2; - call %write_word_at v1 v3 v12; - v15.i256 = mload v4 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_5121 v1 v15; - v17.i256 = mload v4 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_4208 v1 v17; - call %impl_trait_u256__encode__g426c v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_5121 v1 v2; - v21.i256 = mload v4 i256; - v22.i256 = add v21 v8; - mstore v4 v22 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - call %impl_trait_u256__encode_to_ptr__gf13e v0 v3; - return; - - block6: - jump block7; - - block7: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_4208 v1 v3; - call %impl_trait_u256__encode__g426c v0 v1; - return; -} - -func private %encode_single_root(v0.@layout_0, v1.objref<@layout_2>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_32b3 v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.@layout_0) -> @layout_1 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_2 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_c533 v2; - v4.objref<@layout_2> = obj.alloc @layout_2; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_32b3 v4; - call %encode_single_root v0 v4; - v14.@layout_1 = insert_value undef.@layout_1 0.i256 v11; - v15.@layout_1 = insert_value v14 1.i256 v2; - return v15; -} - -func private %impl_trait_u256__encode_to_ptr__gf13e(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_5d2b v1 v0; - return; -} - -func private %impl_trait_Address__encode_to_ptr__gf13e(v0.@layout_0, v1.i256) { - block0: - jump block1; - - block1: - v5.i256 = extract_value v0 0.i256; - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_d9ea v1 v5; - return; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_58e9(v0.i256) -> @layout_2 { - block0: - jump block1; - - block1: - v2.@layout_2 = call %std__lib__abi__sol__impl_SolEncoder_ce34__new_e146 v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_c533(v0.i256) -> @layout_2 { - block0: - jump block1; - - block1: - v2.@layout_2 = call %std__lib__abi__sol__impl_SolEncoder_ce34__new_aa27 v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_2b2c() -> @layout_6 { - block0: - jump block1; - - block1: - v0.@layout_6 = call %std__lib__evm__calldata__impl_CallData_8f43__new_b558; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_b215() -> @layout_6 { - block0: - jump block1; - - block1: - v0.@layout_6 = call %std__lib__evm__calldata__impl_CallData_8f43__new_4d25; - return v0; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_1fd5(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_2577(v0.@layout_6) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_3e84(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_6f75(v0.@layout_6) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_847d(v0.@layout_6) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_8db5(v0.@layout_6) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %impl_Cursor__new__g463e(v0.@layout_3) -> @layout_4 { - block0: - jump block1; - - block1: - v4.@layout_4 = insert_value undef.@layout_4 0.i256 v0; - v6.@layout_4 = insert_value v4 1.i256 0.i256; - return v6; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_4d25() -> @layout_6 { - block0: - jump block1; - - block1: - v1.constref<@layout_6> = const.ref $const_region_0; - v2.objref<@layout_6> = obj.alloc @layout_6; - obj.init.const v2 v1; - v3.@layout_6 = obj.load v2; - return v3; -} - -func private %std__lib__abi__sol__impl_SolEncoder_ce34__new_aa27(v0.i256) -> @layout_2 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_2 = call %std__lib__abi__sol__impl_SolEncoder_ce34__at_9565 v7; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_b558() -> @layout_6 { - block0: - jump block1; - - block1: - v1.constref<@layout_6> = const.ref $const_region_0; - v2.objref<@layout_6> = obj.alloc @layout_6; - obj.init.const v2 v1; - v3.@layout_6 = obj.load v2; - return v3; -} - -func private %std__lib__abi__sol__impl_SolEncoder_ce34__new_e146(v0.i256) -> @layout_2 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_2 = call %std__lib__abi__sol__impl_SolEncoder_ce34__at_6558 v7; - return v8; -} - -func inline(always) private %impl_SolDecoder__new__g463e(v0.@layout_3) -> @layout_5 { - block0: - jump block1; - - block1: - v2.@layout_4 = call %impl_Cursor__new__g463e v0; - v5.@layout_5 = insert_value undef.@layout_5 0.i256 v2; - v7.@layout_5 = insert_value v5 1.i256 0.i256; - return v7; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__g67a8_7f10(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__g67a8_7f10_0(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func inline(always) private %payload_size__gbd8e(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v5.i256 = call %dynamic_payload_size v4; - v6.i256 = add 64.i256 v5; - v8.i256 = extract_value v0 1.i256; - v9.i256 = call %dynamic_payload_size v8; - v10.i256 = add v6 v9; - return v10; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_9d4e(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_e893(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %pos__g463e(v0.objref<@layout_5>) -> i256 { - block0: - jump block1; - - block1: - v3.objref<@layout_4> = obj.proj v0 0.i256; - v5.objref = obj.proj v3 1.i256; - v6.i256 = obj.load v5; - return v6; -} - -func private %impl_trait_SolEncoder__pos(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_272f(v0.objref<@layout_5>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_4> = obj.proj v0 0.i256; - v5.objref<@layout_3> = obj.proj v4 0.i256; - v6.@layout_3 = obj.load v5; - v7.objref<@layout_4> = obj.proj v0 0.i256; - v8.objref<@layout_3> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_1fd5 v8; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref<@layout_3> = obj.proj v27 0.i256; - v29.@layout_3 = obj.load v28; - v30.objref<@layout_4> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_4> = obj.proj v0 0.i256; - v34.objref<@layout_3> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_d5b9 v34 v32; - v37.objref<@layout_4> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7adc(v0.objref<@layout_5>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_4> = obj.proj v0 0.i256; - v5.objref<@layout_3> = obj.proj v4 0.i256; - v6.@layout_3 = obj.load v5; - v7.objref<@layout_4> = obj.proj v0 0.i256; - v8.objref<@layout_3> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_3e84 v8; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref<@layout_3> = obj.proj v27 0.i256; - v29.@layout_3 = obj.load v28; - v30.objref<@layout_4> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_4> = obj.proj v0 0.i256; - v34.objref<@layout_3> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_3db5 v34 v32; - v37.objref<@layout_4> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_286a(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_6bdb(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %set_base__g463e(v0.objref<@layout_5>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_5121(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_b006(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_4208(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_d061(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %set_pos__g463e(v0.objref<@layout_5>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref = obj.proj v5 1.i256; - obj.store v7 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_5d2b(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_d9ea(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_32d2(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3368(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_3db5(v0.objref<@layout_3>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_8c36(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_8c36_0(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b2da(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b2da_0(v0.@layout_6, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_d5b9(v0.objref<@layout_3>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_2c07(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_498a(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_528a(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %write_word_at(v0.objref<@layout_2>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - mstore v1 v2 i256; - return; -} - - -object @Child { - section init { - entry %contract_init_root_Child; - embed .runtime as &Child_runtime; - } - section runtime { - entry %contract_runtime_root_Child; - } -} - -object @Factory { - section init { - entry %contract_init_root_Factory; - embed .runtime as &Factory_runtime; - } - section runtime { - entry %contract_runtime_root_Factory; - data $const_region_0; - embed @Child.init as &Child_init; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/effect_handle_field_deref.snap b/crates/codegen/tests/fixtures/sonatina_ir/effect_handle_field_deref.snap deleted file mode 100644 index 2bde5e6f37..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/effect_handle_field_deref.snap +++ /dev/null @@ -1,1655 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/effect_handle_field_deref.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256}; -type @layout_2 = {i256}; -type @layout_3 = {i256}; -type @layout_4 = {i256}; -type @layout_5 = {i256, i256}; -type @layout_6 = {}; -type @layout_7 = {@layout_6}; -type @layout_8 = {i256, i256}; -type @layout_9 = {i256, i256}; - -global private const @layout_2 $const_region_0 = {0}; - -func private %__EffectHandleFieldDeref_init(v0.i256) { - block0: - jump block1; - - block1: - evm_sstore v0 0.i256; - return; -} - -func private %__EffectHandleFieldDeref_recv_0_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %stor_ptr v0; - v5.i256 = call %write_cell v1 v3; - return v5; -} - -func private %__EffectHandleFieldDeref_recv_0_1(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %stor_ptr v0; - v6.@layout_9 = insert_value undef.@layout_9 0.i256 v2; - v7.@layout_9 = insert_value v6 1.i256 1.i256; - v8.i256 = call %extract_ptr v7; - v9.i256 = call %read_cell v8; - return v9; -} - -func private %__EffectHandleFieldDeref_recv_0_2(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v5.@layout_1 = insert_value undef.@layout_1 0.i256 v1; - v6.objref<@layout_1> = obj.alloc @layout_1; - v7.objref = obj.proj v6 0.i256; - v8.i256 = extract_value v5 0.i256; - obj.store v7 v8; - v10.i256 = call %bump v6 v0; - return v10; -} - -func private %abi_field_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_a8bc_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_4c56() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_a881 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_9c1e() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_ba8b 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_ffa6() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_27e9 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %bump(v0.objref<@layout_1>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = evm_sload v5; - (v8.i256, v9.i1) = uaddo v7 v1; - br v9 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - evm_sstore v5 v8; - v16.objref = obj.proj v0 0.i256; - v17.i256 = obj.load v16; - v18.i256 = evm_sload v17; - return v18; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_6c9f(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_5569; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_7613(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_1efd; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_d188(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_928c; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_3857(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_bd08; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_931a(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_9d46; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_c189(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_a064; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %contract_init_abi_EffectHandleFieldDeref() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - call %__EffectHandleFieldDeref_init 0.i256; - return; -} - -func private %contract_init_root_EffectHandleFieldDeref() { - block0: - jump block1; - - block1: - call %contract_init_abi_EffectHandleFieldDeref; - v2.i256 = sym_addr &EffectHandleFieldDeref_runtime; - v3.i256 = sym_size &EffectHandleFieldDeref_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_EffectHandleFieldDeref_1() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_7> = obj.alloc @layout_7; - v6.@layout_5 = call %decode_runtime_args__g5aad v5; - v7.i256 = extract_value v6 0.i256; - v9.i256 = extract_value v6 1.i256; - v10.i256 = call %__EffectHandleFieldDeref_recv_0_0 v7 v9; - v11.@layout_8 = call %encode_single_root_alloc v10; - v12.i256 = extract_value v11 0.i256; - v13.i256 = extract_value v11 1.i256; - evm_return v12 v13; -} - -func inline(always) private %contract_recv_abi_EffectHandleFieldDeref_2() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_7> = obj.alloc @layout_7; - v6.@layout_4 = call %decode_runtime_args__g01e9 v5; - v7.i256 = extract_value v6 0.i256; - v8.i256 = call %__EffectHandleFieldDeref_recv_0_1 v7; - v9.@layout_8 = call %encode_single_root_alloc v8; - v10.i256 = extract_value v9 0.i256; - v12.i256 = extract_value v9 1.i256; - evm_return v10 v12; -} - -func inline(always) private %contract_recv_abi_EffectHandleFieldDeref_3() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_7> = obj.alloc @layout_7; - v6.@layout_3 = call %decode_runtime_args__g0392 v5; - v7.i256 = extract_value v6 0.i256; - v8.i256 = call %__EffectHandleFieldDeref_recv_0_2 v7 0.i256; - v9.@layout_8 = call %encode_single_root_alloc v8; - v10.i256 = extract_value v9 0.i256; - v12.i256 = extract_value v9 1.i256; - evm_return v10 v12; -} - -func private %contract_runtime_root_EffectHandleFieldDeref() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (1.i32 block4) (2.i32 block5) (3.i32 block6); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_EffectHandleFieldDeref_1; - unreachable; - - block5: - call %contract_recv_abi_EffectHandleFieldDeref_2; - unreachable; - - block6: - call %contract_recv_abi_EffectHandleFieldDeref_3; - unreachable; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_1efd() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_5569() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_928c() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_9d46() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_a064() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_bd08() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_1cc8(v0.@layout_2, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_7303 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f4af_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f4af_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_23bd(v0.@layout_2, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_dee9 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f0a9_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f0a9_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_48de(v0.@layout_2, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_7c41 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_a878_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_a878_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_61db(v0.@layout_2, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_dee9 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_3857 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_dae2 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f0a9_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_d7e7(v0.@layout_2, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_7c41 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_c189 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_2684 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_a878_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_f2f8(v0.@layout_2, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_7303 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_931a v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_89cb v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f4af_0 v0 v2; - return v14; -} - -func inline(always) private %impl_trait_BumpMover__decode_from__gd20d(v0.@layout_2, v1.i256) -> @layout_3 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_9e81 v0; - v5.i256 = call %core__lib__abi__decode_msg_field_from__g5385_5108 v0 v1 v1 v3; - v8.@layout_3 = insert_value undef.@layout_3 0.i256 v5; - return v8; -} - -func inline(always) private %impl_trait_ReadViaHolder__decode_from__gd20d(v0.@layout_2, v1.i256) -> @layout_4 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_392e v0; - v5.i256 = call %core__lib__abi__decode_msg_field_from__g5385_7d42 v0 v1 v1 v3; - v8.@layout_4 = insert_value undef.@layout_4 0.i256 v5; - return v8; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_a878(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9c31 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_a878_0(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9c31_0 v0 v1; - return v4; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_2684(v0.@layout_2, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_6c9f v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_a878 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_89cb(v0.@layout_2, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_d188 v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f4af v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_dae2(v0.@layout_2, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_7613 v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f0a9 v0 v1; - return v8; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f0a9(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_950e v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f0a9_0(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_950e_0 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f4af(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_4e15 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_f4af_0(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_4e15_0 v0 v1; - return v4; -} - -func inline(always) private %impl_trait_SeedSlot__decode_from__gd20d(v0.@layout_2, v1.i256) -> @layout_5 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_1933 v0; - v5.i256 = call %core__lib__abi__decode_msg_field_from__g5385_3605 v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %core__lib__abi__decode_msg_field_from__g5385_3605 v0 v1 v7 v3; - v20.@layout_5 = insert_value undef.@layout_5 0.i256 v5; - v22.@layout_5 = insert_value v20 1.i256 v17; - return v22; -} - -func inline(always) private %decode_from_prechecked_head__gdaee(v0.@layout_2, v1.i256, v2.i256) -> @layout_3 { - block0: - jump block1; - - block1: - v6.@layout_3 = call %impl_trait_BumpMover__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__ge273(v0.@layout_2, v1.i256, v2.i256) -> @layout_4 { - block0: - jump block1; - - block1: - v6.@layout_4 = call %impl_trait_ReadViaHolder__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__g1d15(v0.@layout_2, v1.i256, v2.i256) -> @layout_5 { - block0: - jump block1; - - block1: - v6.@layout_5 = call %impl_trait_SeedSlot__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_3605(v0.@layout_2, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_61db v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_23bd v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_5108(v0.@layout_2, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_f2f8 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_1cc8 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_7d42(v0.@layout_2, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_d7e7 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_48de v0 v1 v2; - return v14; -} - -func inline(always) private %decode_runtime_args__g5aad(v0.objref<@layout_7>) -> @layout_5 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_2 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_dcd3; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_960d v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_9c1e; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_5 = call %decode_from_prechecked_head__g1d15 v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 68.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__g01e9(v0.objref<@layout_7>) -> @layout_4 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_2 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_c5c0; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_f59a v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_ffa6; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_4 = call %decode_from_prechecked_head__ge273 v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 36.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__g0392(v0.objref<@layout_7>) -> @layout_3 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_2 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_0e8a; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_4133 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_4c56; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_3 = call %decode_from_prechecked_head__gdaee v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 36.i256 v15; - br v16 block2 block3; -} - -func private %encode(v0.i256, v1.objref<@layout_0>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_2aa5 v1 v0; - return; -} - -func private %encode_field(v0.i256, v1.objref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %base v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_a8bc v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8a50 v1 v10; - v12.i256 = call %pos v1; - v13.i256 = mload v2 i256; - call %set_base v1 v13; - v15.i256 = mload v2 i256; - call %set_pos v1 v15; - call %encode v0 v1; - call %set_base v1 v5; - call %set_pos v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %pos v1; - call %encode_to_ptr v0 v24; - v28.i256 = add v24 32.i256; - call %set_pos v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode v0 v1; - return; -} - -func private %encode_single_root(v0.i256, v1.objref<@layout_0>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %base v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.i256) -> @layout_8 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_0 = call %encoder_new v2; - v4.objref<@layout_0> = obj.alloc @layout_0; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %base v4; - call %encode_single_root v0 v4; - v14.@layout_8 = insert_value undef.@layout_8 0.i256 v11; - v15.@layout_8 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_to_ptr(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %store_word v1 v0; - return; -} - -func private %encoder_new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %extract_ptr(v0.@layout_9) -> i256 { - block0: - v1.objref<@layout_9> = obj.alloc @layout_9; - v3.objref = obj.proj v1 0.i256; - v4.i256 = extract_value v0 0.i256; - obj.store v3 v4; - v6.objref = obj.proj v1 1.i256; - v7.i256 = extract_value v0 1.i256; - obj.store v6 v7; - jump block1; - - block1: - v8.objref = obj.proj v1 0.i256; - v9.i256 = obj.load v8; - return v9; -} - -func private %from_raw(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_0e8a() -> @layout_2 { - block0: - jump block1; - - block1: - v0.@layout_2 = call %std__lib__evm__calldata__impl_CallData_8f43__new_ac71; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_c5c0() -> @layout_2 { - block0: - jump block1; - - block1: - v0.@layout_2 = call %std__lib__evm__calldata__impl_CallData_8f43__new_e145; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_dcd3() -> @layout_2 { - block0: - jump block1; - - block1: - v0.@layout_2 = call %std__lib__evm__calldata__impl_CallData_8f43__new_0a05; - return v0; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_1933(v0.@layout_2) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_392e(v0.@layout_2) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_4133(v0.@layout_2) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_960d(v0.@layout_2) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_9e81(v0.@layout_2) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_f59a(v0.@layout_2) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_0a05() -> @layout_2 { - block0: - jump block1; - - block1: - v1.constref<@layout_2> = const.ref $const_region_0; - v2.objref<@layout_2> = obj.alloc @layout_2; - obj.init.const v2 v1; - v3.@layout_2 = obj.load v2; - return v3; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_0 = call %at v7; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_ac71() -> @layout_2 { - block0: - jump block1; - - block1: - v1.constref<@layout_2> = const.ref $const_region_0; - v2.objref<@layout_2> = obj.alloc @layout_2; - obj.init.const v2 v1; - v3.@layout_2 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_e145() -> @layout_2 { - block0: - jump block1; - - block1: - v1.constref<@layout_2> = const.ref $const_region_0; - v2.objref<@layout_2> = obj.alloc @layout_2; - obj.init.const v2 v1; - v3.@layout_2 = obj.load v2; - return v3; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_a8bc(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_a8bc_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %pos(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %read_cell(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_sload v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_27e9(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_a881(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_ba8b(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %set_base(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %set_pos(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %stor_ptr(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %from_raw v0; - return v2; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_4e15(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_4e15_0(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_7303(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_7c41(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_950e(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_950e_0(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9c31(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9c31_0(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_dee9(v0.@layout_2, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func private %write_cell(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - evm_sstore v1 v0; - v4.i256 = evm_sload v1; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_2aa5(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8a50(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @EffectHandleFieldDeref { - section init { - entry %contract_init_root_EffectHandleFieldDeref; - embed .runtime as &EffectHandleFieldDeref_runtime; - } - section runtime { - entry %contract_runtime_root_EffectHandleFieldDeref; - data $const_region_0; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/effect_ptr_calldata_domain.snap b/crates/codegen/tests/fixtures/sonatina_ir/effect_ptr_calldata_domain.snap deleted file mode 100644 index b02563e4dd..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/effect_ptr_calldata_domain.snap +++ /dev/null @@ -1,49 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/effect_ptr_calldata_domain.fe ---- -target = "evm-ethereum-osaka" - -func private %from_raw(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %test_calldata_ptr_domain; - evm_stop; -} - -func private %read_x(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %test_calldata_ptr_domain() { - block0: - jump block1; - - block1: - v1.i256 = call %from_raw 0.i256; - v2.i256 = call %read_x v1; - return; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/effect_ptr_domains.snap b/crates/codegen/tests/fixtures/sonatina_ir/effect_ptr_domains.snap deleted file mode 100644 index ffdf372092..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/effect_ptr_domains.snap +++ /dev/null @@ -1,162 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/effect_ptr_domains.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; - -global private const @layout_0 $const_region_0 = {10, 20}; - -func private %bump__gaab0(v0.i256) { - block0: - jump block1; - - block1: - v2.i256 = mload v0 i256; - (v4.i256, v5.i1) = uaddo v2 1.i256; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v0 v4 i256; - v13.i256 = add v0 32.i256; - v14.i256 = mload v13 i256; - (v16.i256, v17.i1) = uaddo v14 2.i256; - br v17 block2 block4; - - block4: - v19.i256 = add v0 32.i256; - mstore v19 v16 i256; - return; -} - -func private %bump__gc323(v0.i256) { - block0: - jump block1; - - block1: - v2.i256 = evm_sload v0; - (v4.i256, v5.i1) = uaddo v2 1.i256; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - evm_sstore v0 v4; - v12.i256 = add v0 1.i256; - v13.i256 = evm_sload v12; - (v15.i256, v16.i1) = uaddo v13 2.i256; - br v16 block2 block4; - - block4: - v18.i256 = add v0 1.i256; - evm_sstore v18 v15; - return; -} - -func private %bump__gb2d8(v0.objref<@layout_0>) { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - (v6.i256, v7.i1) = uaddo v4 1.i256; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v13.objref = obj.proj v0 0.i256; - obj.store v13 v6; - v14.objref = obj.proj v0 1.i256; - v15.i256 = obj.load v14; - (v17.i256, v18.i1) = uaddo v15 2.i256; - br v18 block2 block4; - - block4: - v20.objref = obj.proj v0 1.i256; - obj.store v20 v17; - return; -} - -func private %impl_trait_MemPtr__from_raw__gb2d8(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %impl_trait_StorPtr__from_raw__gb2d8(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %test_effect_ptr_domains; - evm_stop; -} - -func private %mem_ptr(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %impl_trait_MemPtr__from_raw__gb2d8 v0; - return v2; -} - -func private %stor_ptr(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %impl_trait_StorPtr__from_raw__gb2d8 v0; - return v2; -} - -func private %test_effect_ptr_domains() { - block0: - jump block1; - - block1: - v1.i256 = call %mem_ptr 256.i256; - call %bump__gaab0 v1; - v4.i256 = call %stor_ptr 0.i256; - call %bump__gc323 v4; - v8.constref<@layout_0> = const.ref $const_region_0; - v9.objref<@layout_0> = obj.alloc @layout_0; - v10.objref = obj.proj v9 0.i256; - obj.store v10 10.i256; - v12.objref = obj.proj v9 1.i256; - obj.store v12 20.i256; - call %bump__gb2d8 v9; - return; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/effect_ptr_name_collision.snap b/crates/codegen/tests/fixtures/sonatina_ir/effect_ptr_name_collision.snap deleted file mode 100644 index 1f8492cc29..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/effect_ptr_name_collision.snap +++ /dev/null @@ -1,47 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/effect_ptr_name_collision.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; - -global private const @layout_0 $const_region_0 = {1, 7}; - -func private %effect_ptr_name_collision() -> i256 { - block0: - jump block1; - - block1: - v2.constref<@layout_0> = const.ref $const_region_0; - v3.constref<@layout_0> = const.ref $const_region_0; - v4.i256 = call %read_tag v3; - return v4; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %effect_ptr_name_collision; - evm_stop; -} - -func private %read_tag(v0.constref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 1.i256; - v4.i256 = const.load v3; - return v4; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/enum_variant_contract.snap b/crates/codegen/tests/fixtures/sonatina_ir/enum_variant_contract.snap deleted file mode 100644 index ffc061ec75..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/enum_variant_contract.snap +++ /dev/null @@ -1,202 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/enum_variant_contract.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = enum { - #None, - #Some(i256), -}; - -func private %abi_encode_u256(v0.i256) { - block0: - jump block1; - - block1: - call %mstore 0.i256 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_06c7 0.i256 32.i256; - unreachable; -} - -func private %calldataload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %codecopy(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_code_copy v0 v1 v2; - return; -} - -func private %init() { - block0: - jump block1; - - block1: - v0.i256 = sym_size &__EnumContract_runtime; - v1.i256 = sym_addr &__EnumContract_runtime; - v2.*i8 = evm_malloc v0; - v3.i256 = ptr_to_int v2 i256; - call %codecopy v3 v1 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_1461_0 v3 v0; - unreachable; -} - -func private %manual_contract_init_root_EnumContract() { - block0: - jump block1; - - block1: - call %init; - evm_stop; -} - -func private %manual_contract_runtime_root_EnumContract() { - block0: - jump block1; - - block1: - call %runtime; - evm_stop; -} - -func private %mstore(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_06c7(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_1461(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_1461_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %runtime() { - block0: - jump block1; - - block1: - v1.i256 = call %calldataload 0.i256; - v3.i256 = shr 224.i256 v1; - v5.i1 = eq v3 1817627404.i256; - br v5 block2 block3; - - block2: - v7.i256 = call %calldataload 4.i256; - v8.@layout_0 = enum.make @layout_0 #Some v7; - v9.enumtag(@layout_0) = enum.tag v8; - br_table v9 (1.enumtag(@layout_0) block6) (0.enumtag(@layout_0) block7); - - block3: - jump block4; - - block4: - v14.i1 = eq v3 1163776883.i256; - br v14 block8 block9; - - block5: - v15.i256 = phi (v17 block6) (0.i256 block7); - call %abi_encode_u256 v15; - unreachable; - - block6: - enum.assert_variant v8 #Some; - v17.i256 = enum.extract v8 #Some 0.i256; - jump block5; - - block7: - jump block5; - - block8: - v18.@layout_0 = enum.make @layout_0 #None; - v19.@layout_0 = enum.make @layout_0 #None; - v20.enumtag(@layout_0) = enum.tag v19; - br_table v20 (1.enumtag(@layout_0) block12) (0.enumtag(@layout_0) block13); - - block9: - jump block10; - - block10: - v23.i1 = eq v3 3572425762.i256; - br v23 block14 block15; - - block11: - v24.i256 = phi (v26 block12) (0.i256 block13); - call %abi_encode_u256 v24; - unreachable; - - block12: - enum.assert_variant v19 #Some; - v26.i256 = enum.extract v19 #Some 0.i256; - jump block11; - - block13: - jump block11; - - block14: - v27.i256 = call %calldataload 4.i256; - v28.@layout_0 = enum.make @layout_0 #Some v27; - v29.enumtag(@layout_0) = enum.tag v28; - br_table v29 (1.enumtag(@layout_0) block18) (0.enumtag(@layout_0) block19); - - block15: - jump block16; - - block16: - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_1461 0.i256 0.i256; - unreachable; - - block17: - v30.i256 = phi (1.i256 block18) (0.i256 block19); - call %abi_encode_u256 v30; - unreachable; - - block18: - jump block17; - - block19: - jump block17; -} - - -object @EnumContract { - section init { - entry %manual_contract_init_root_EnumContract; - embed .runtime as &__EnumContract_runtime; - } - section runtime { - entry %manual_contract_runtime_root_EnumContract; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/erc20.snap b/crates/codegen/tests/fixtures/sonatina_ir/erc20.snap deleted file mode 100644 index 7e46d955f6..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/erc20.snap +++ /dev/null @@ -1,11185 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/erc20.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; -type @layout_1 = {i256, i256}; -type @layout_2 = {i256, i256}; -type @layout_3 = {@layout_2, i256}; -type @layout_4 = {@layout_3, i256}; -type @layout_5 = {i256}; -type @layout_6 = {@layout_0, @layout_0}; -type @layout_7 = {@layout_0, i256}; -type @layout_8 = {@layout_0, i256}; -type @layout_9 = {i256}; -type @layout_10 = {@layout_0, i256}; -type @layout_11 = {@layout_0}; -type @layout_12 = {@layout_0, i256}; -type @layout_13 = {@layout_0, @layout_0, i256}; -type @layout_14 = {@layout_0, i256}; -type @layout_15 = {@layout_0, i256}; -type @layout_16 = {i256, @layout_0}; -type @layout_17 = {}; -type @layout_18 = {@layout_17}; -type @layout_19 = {@layout_0, @layout_0, i256}; -type @layout_20 = {@layout_0, @layout_0, i256}; -type @layout_21 = {i256, i256}; -type @layout_22 = {@layout_0, @layout_0}; -type @layout_23 = {}; -type @layout_24 = {@layout_23}; -type @layout_25 = {@layout_24}; - -global private const @layout_5 $const_region_0 = {0}; -global private const @layout_0 $const_region_1 = {0}; - -func private %__CoolCoin_init(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - call %grant undef.objref<@layout_25> 1.i256 v1; - call %grant undef.objref<@layout_25> 2.i256 v1; - v12.i1 = gt v0 0.i256; - br v12 block2 block3; - - block2: - call %standalone_erc20__erc20__mint__gd6b1_6ffd v1 v0 v2; - jump block4; - - block3: - jump block4; - - block4: - return; -} - -func private %__CoolCoin_recv_0_0(v0.@layout_0, v1.i256, v2.i256) -> i1 { - block0: - jump block1; - - block1: - v3.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40_0; - call %standalone_erc20__erc20__transfer__gd6b1_d32a v3 v0 v1 v2; - return 1.i1; -} - -func private %__CoolCoin_recv_0_1(v0.@layout_0, v1.i256, v2.i256) -> i1 { - block0: - jump block1; - - block1: - v3.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40_0; - call %standalone_erc20__erc20__approve__gd6b1_88e5 v3 v0 v1 v2; - return 1.i1; -} - -func private %__CoolCoin_recv_0_2(v0.@layout_0, v1.@layout_0, v2.i256, v3.i256) -> i1 { - block0: - jump block1; - - block1: - v4.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40_0; - call %standalone_erc20__erc20__spend_allowance__gaf82_9523 v0 v4 v2 v3; - call %standalone_erc20__erc20__transfer__gd6b1_17ee v0 v1 v2 v3; - return 1.i1; -} - -func private %__CoolCoin_recv_0_3(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_33bc v0; - return v3; -} - -func private %__CoolCoin_recv_0_4(v0.@layout_0, v1.@layout_0, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.@layout_22 = insert_value undef.@layout_22 0.i256 v0; - v9.@layout_22 = insert_value v6 1.i256 v1; - v10.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g94db_c935 v9; - return v10; -} - -func private %__CoolCoin_recv_0_5(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_sload v0; - return v2; -} - -func private %__CoolCoin_recv_0_6() -> i256 { - block0: - jump block1; - - block1: - return 4859225033734580590.i256; -} - -func private %__CoolCoin_recv_0_7() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = zext 1129271116.i64 i256; - return v1; -} - -func private %__CoolCoin_recv_0_8() -> i8 { - block0: - jump block1; - - block1: - return 18.i8; -} - -func private %__CoolCoin_recv_1_0(v0.@layout_0, v1.i256, v2.i256) -> i1 { - block0: - jump block1; - - block1: - call %require 1.i256; - call %standalone_erc20__erc20__mint__gd6b1_bc3c v0 v1 v2; - return 1.i1; -} - -func private %__CoolCoin_recv_1_1(v0.i256, v1.i256) -> i1 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40_0; - call %standalone_erc20__erc20__burn__gd6b1_ba4e v2 v0 v1; - return 1.i1; -} - -func private %__CoolCoin_recv_1_2(v0.@layout_0, v1.i256, v2.i256) -> i1 { - block0: - jump block1; - - block1: - v3.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40_0; - call %standalone_erc20__erc20__spend_allowance__gaf82_9523_0 v0 v3 v1 v2; - call %standalone_erc20__erc20__burn__gd6b1_59b2 v0 v1 v2; - return 1.i1; -} - -func private %__CoolCoin_recv_1_3(v0.@layout_0, v1.i256, v2.i256) -> i1 { - block0: - jump block1; - - block1: - v3.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40_0; - v6.@layout_22 = insert_value undef.@layout_22 0.i256 v3; - v9.@layout_22 = insert_value v6 1.i256 v0; - v10.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g94db_552a_0 v9; - (v12.i256, v13.i1) = uaddo v10 v1; - br v13 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - call %standalone_erc20__erc20__approve__gd6b1_79e2 v3 v0 v12 v2; - return 1.i1; -} - -func private %__CoolCoin_recv_1_4(v0.@layout_0, v1.i256, v2.i256) -> i1 { - block0: - v3.*i256 = alloca i256; - jump block1; - - block1: - v4.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40_0; - v7.@layout_22 = insert_value undef.@layout_22 0.i256 v4; - v10.@layout_22 = insert_value v7 1.i256 v0; - v11.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g94db_552a_0 v10; - mstore v3 v1 i256; - v13.i256 = mload v3 i256; - v14.i1 = lt v11 v13; - v15.i1 = is_zero v14; - br v15 block2 block3; - - block2: - jump block4; - - block3: - v18.*i8 = evm_malloc 64.i256; - v19.i256 = ptr_to_int v18 i256; - mstore v19 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v23.i256, v24.i1) = uaddo v19 32.i256; - br v24 block5 block6; - - block4: - (v33.i256, v34.i1) = usubo v11 v1; - br v34 block5 block7; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v23 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v19 36.i256; - - block7: - call %standalone_erc20__erc20__approve__gd6b1_d2ba v4 v0 v33 v2; - return 1.i1; -} - -func private %abi_field_size__gda9b(v0.i1) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__gda9b_b33d_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_field_size__g79ff(v0.i8) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__g79ff_f3e8_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_field_size__g65da(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__impl_trait_String_c06e__payload_size__gc7cf_4aab_0 v0; - br 1.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_field_size__g5535(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__impl_trait_String_c06e__payload_size__g3eb7_f656_0 v0; - br 1.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_field_size__ge513(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_77e5_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %core__lib__abi__abi_payload_size__ge513_5ba7(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_effe v0; - return v2; -} - -func private %core__lib__abi__abi_payload_size__ge513_d165(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_18e9 v0; - return v2; -} - -func private %abi_single_root_size__gda9b(v0.i1) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size__gda9b v0; - return v2; -} - -func private %abi_single_root_size__g65da(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size__g65da v0; - return v2; -} - -func private %abi_single_root_size__g79ff(v0.i8) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size__g79ff v0; - return v2; -} - -func private %abi_single_root_size__ge513(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size__ge513 v0; - return v2; -} - -func private %abi_single_root_size__g5535(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size__g5535 v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_0a69() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_2b5d 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_12ed() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_34f1 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_20f2() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_0ea2 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_2f36() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_6471 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_57a6() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_9e6f 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_66b1() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_a28f 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_6993() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_41e6 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_98a8() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_2efa 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_9941() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_35af 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_a20a() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_3bd1 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_b229() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_9fb4 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_cb5c() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_cab9 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_ce6e() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_cb12 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_cf57() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_62f4 0.i256 0.i256; - unreachable; -} - -func private %standalone_erc20__erc20__approve__gd6b1_79e2(v0.@layout_0, v1.@layout_0, v2.i256, v3.i256) { - block0: - v4.objref<@layout_0> = obj.alloc @layout_0; - v5.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v7.@layout_0 = call %zero; - v9.objref = obj.proj v4 0.i256; - v10.i256 = extract_value v7 0.i256; - obj.store v9 v10; - v11.@layout_0 = obj.load v4; - v12.i1 = call %ne v0 v11; - br v12 block2 block3; - - block2: - jump block4; - - block3: - v15.*i8 = evm_malloc 64.i256; - v16.i256 = ptr_to_int v15 i256; - mstore v16 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v20.i256, v21.i1) = uaddo v16 32.i256; - br v21 block8 block9; - - block4: - v29.@layout_0 = call %zero; - v30.objref = obj.proj v5 0.i256; - v31.i256 = extract_value v29 0.i256; - obj.store v30 v31; - v32.@layout_0 = obj.load v5; - v33.i1 = call %ne v1 v32; - br v33 block5 block6; - - block5: - jump block7; - - block6: - v34.*i8 = evm_malloc 64.i256; - v35.i256 = ptr_to_int v34 i256; - mstore v35 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v37.i256, v38.i1) = uaddo v35 32.i256; - br v38 block8 block10; - - block7: - v44.i256 = add v3 1.i256; - v48.@layout_22 = insert_value undef.@layout_22 0.i256 v0; - v49.@layout_22 = insert_value v48 1.i256 v1; - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g94db_2fc5_0 v44 v49 v2; - v53.@layout_19 = insert_value undef.@layout_19 0.i256 v0; - v54.@layout_19 = insert_value v53 1.i256 v1; - v56.@layout_19 = insert_value v54 2.i256 v2; - call %emit__g9cd0 v56; - return; - - block8: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block9: - mstore v20 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v16 36.i256; - - block10: - mstore v37 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v35 36.i256; -} - -func private %standalone_erc20__erc20__approve__gd6b1_88e5(v0.@layout_0, v1.@layout_0, v2.i256, v3.i256) { - block0: - v4.objref<@layout_0> = obj.alloc @layout_0; - v5.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v7.@layout_0 = call %zero; - v9.objref = obj.proj v4 0.i256; - v10.i256 = extract_value v7 0.i256; - obj.store v9 v10; - v11.@layout_0 = obj.load v4; - v12.i1 = call %ne v0 v11; - br v12 block2 block3; - - block2: - jump block4; - - block3: - v15.*i8 = evm_malloc 64.i256; - v16.i256 = ptr_to_int v15 i256; - mstore v16 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v20.i256, v21.i1) = uaddo v16 32.i256; - br v21 block8 block9; - - block4: - v29.@layout_0 = call %zero; - v30.objref = obj.proj v5 0.i256; - v31.i256 = extract_value v29 0.i256; - obj.store v30 v31; - v32.@layout_0 = obj.load v5; - v33.i1 = call %ne v1 v32; - br v33 block5 block6; - - block5: - jump block7; - - block6: - v34.*i8 = evm_malloc 64.i256; - v35.i256 = ptr_to_int v34 i256; - mstore v35 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v37.i256, v38.i1) = uaddo v35 32.i256; - br v38 block8 block10; - - block7: - v44.i256 = add v3 1.i256; - v48.@layout_22 = insert_value undef.@layout_22 0.i256 v0; - v49.@layout_22 = insert_value v48 1.i256 v1; - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g94db_2fc5_0 v44 v49 v2; - v53.@layout_19 = insert_value undef.@layout_19 0.i256 v0; - v54.@layout_19 = insert_value v53 1.i256 v1; - v56.@layout_19 = insert_value v54 2.i256 v2; - call %emit__g9cd0 v56; - return; - - block8: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block9: - mstore v20 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v16 36.i256; - - block10: - mstore v37 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v35 36.i256; -} - -func private %standalone_erc20__erc20__approve__gd6b1_d2ba(v0.@layout_0, v1.@layout_0, v2.i256, v3.i256) { - block0: - v4.objref<@layout_0> = obj.alloc @layout_0; - v5.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v7.@layout_0 = call %zero; - v9.objref = obj.proj v4 0.i256; - v10.i256 = extract_value v7 0.i256; - obj.store v9 v10; - v11.@layout_0 = obj.load v4; - v12.i1 = call %ne v0 v11; - br v12 block2 block3; - - block2: - jump block4; - - block3: - v15.*i8 = evm_malloc 64.i256; - v16.i256 = ptr_to_int v15 i256; - mstore v16 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v20.i256, v21.i1) = uaddo v16 32.i256; - br v21 block8 block9; - - block4: - v29.@layout_0 = call %zero; - v30.objref = obj.proj v5 0.i256; - v31.i256 = extract_value v29 0.i256; - obj.store v30 v31; - v32.@layout_0 = obj.load v5; - v33.i1 = call %ne v1 v32; - br v33 block5 block6; - - block5: - jump block7; - - block6: - v34.*i8 = evm_malloc 64.i256; - v35.i256 = ptr_to_int v34 i256; - mstore v35 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v37.i256, v38.i1) = uaddo v35 32.i256; - br v38 block8 block10; - - block7: - v44.i256 = add v3 1.i256; - v48.@layout_22 = insert_value undef.@layout_22 0.i256 v0; - v49.@layout_22 = insert_value v48 1.i256 v1; - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g94db_2fc5_0 v44 v49 v2; - v53.@layout_19 = insert_value undef.@layout_19 0.i256 v0; - v54.@layout_19 = insert_value v53 1.i256 v1; - v56.@layout_19 = insert_value v54 2.i256 v2; - call %emit__g9cd0 v56; - return; - - block8: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block9: - mstore v20 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v16 36.i256; - - block10: - mstore v37 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v35 36.i256; -} - -func private %std__lib__abi__sol__types__impl_trait_Address_0a07__as_topic_4475(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = extract_value v0 0.i256; - return v3; -} - -func private %std__lib__abi__sol__types__impl_trait_Address_0a07__as_topic_d053(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = extract_value v0 0.i256; - return v3; -} - -func inline(always) private %std__lib__abi__sol__impl_SolEncoder_ce34__at_31d5(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func inline(always) private %std__lib__abi__sol__impl_SolEncoder_ce34__at_3361(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func inline(always) private %std__lib__abi__sol__impl_SolEncoder_ce34__at_65fb(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func inline(always) private %std__lib__abi__sol__impl_SolEncoder_ce34__at_69c8(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func inline(always) private %std__lib__abi__sol__impl_SolEncoder_ce34__at_7151(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func inline(always) private %std__lib__abi__sol__impl_SolEncoder_ce34__at_e384(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func inline(always) private %std__lib__abi__sol__impl_SolEncoder_ce34__at_fb00(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_1fbd(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_25d4(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_6030(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_8751(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_91bf(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_91bf_0(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_9c4a(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_a9a0(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_bb09(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_c13e(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_fd6f(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %standalone_erc20__erc20__burn__gd6b1_59b2(v0.@layout_0, v1.i256, v2.i256) { - block0: - v3.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v5.@layout_0 = call %zero; - v7.objref = obj.proj v3 0.i256; - v8.i256 = extract_value v5 0.i256; - obj.store v7 v8; - v9.@layout_0 = obj.load v3; - v10.i1 = call %ne v0 v9; - br v10 block2 block3; - - block2: - jump block4; - - block3: - v13.*i8 = evm_malloc 64.i256; - v14.i256 = ptr_to_int v13 i256; - mstore v14 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v18.i256, v19.i1) = uaddo v14 32.i256; - br v19 block8 block9; - - block4: - v27.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_d67a v0; - v29.i1 = lt v27 v1; - v30.i1 = is_zero v29; - br v30 block5 block6; - - block5: - jump block7; - - block6: - v31.*i8 = evm_malloc 64.i256; - v32.i256 = ptr_to_int v31 i256; - mstore v32 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v34.i256, v35.i1) = uaddo v32 32.i256; - br v35 block8 block10; - - block7: - v41.i256 = add v2 1.i256; - (v45.i256, v46.i1) = usubo v27 v1; - br v46 block8 block11; - - block8: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block9: - mstore v18 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v14 36.i256; - - block10: - mstore v34 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v32 36.i256; - - block11: - call %set__g636d v41 v0 v45; - v52.i256 = evm_sload v2; - (v53.i256, v54.i1) = usubo v52 v1; - br v54 block8 block12; - - block12: - evm_sstore v2 v53; - v57.@layout_0 = call %zero; - v60.@layout_20 = insert_value undef.@layout_20 0.i256 v0; - v61.@layout_20 = insert_value v60 1.i256 v57; - v63.@layout_20 = insert_value v61 2.i256 v1; - call %emit__g4c3d v63; - return; -} - -func private %standalone_erc20__erc20__burn__gd6b1_ba4e(v0.@layout_0, v1.i256, v2.i256) { - block0: - v3.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v5.@layout_0 = call %zero; - v7.objref = obj.proj v3 0.i256; - v8.i256 = extract_value v5 0.i256; - obj.store v7 v8; - v9.@layout_0 = obj.load v3; - v10.i1 = call %ne v0 v9; - br v10 block2 block3; - - block2: - jump block4; - - block3: - v13.*i8 = evm_malloc 64.i256; - v14.i256 = ptr_to_int v13 i256; - mstore v14 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v18.i256, v19.i1) = uaddo v14 32.i256; - br v19 block8 block9; - - block4: - v27.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_d67a v0; - v29.i1 = lt v27 v1; - v30.i1 = is_zero v29; - br v30 block5 block6; - - block5: - jump block7; - - block6: - v31.*i8 = evm_malloc 64.i256; - v32.i256 = ptr_to_int v31 i256; - mstore v32 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v34.i256, v35.i1) = uaddo v32 32.i256; - br v35 block8 block10; - - block7: - v41.i256 = add v2 1.i256; - (v45.i256, v46.i1) = usubo v27 v1; - br v46 block8 block11; - - block8: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block9: - mstore v18 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v14 36.i256; - - block10: - mstore v34 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v32 36.i256; - - block11: - call %set__g636d v41 v0 v45; - v52.i256 = evm_sload v2; - (v53.i256, v54.i1) = usubo v52 v1; - br v54 block8 block12; - - block12: - evm_sstore v2 v53; - v57.@layout_0 = call %zero; - v60.@layout_20 = insert_value undef.@layout_20 0.i256 v0; - v61.@layout_20 = insert_value v60 1.i256 v57; - v63.@layout_20 = insert_value v61 2.i256 v1; - call %emit__g4c3d v63; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40() -> @layout_0 { - block0: - jump block1; - - block1: - v0.i256 = evm_caller; - v3.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - return v3; -} - -func private %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40_0() -> @layout_0 { - block0: - jump block1; - - block1: - v0.i256 = evm_caller; - v3.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - return v3; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_01a8(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_947f; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_4689(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_733d; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_60b4(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_a0e7; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_6403(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_2004; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_9284(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_929c; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_9888(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_7414; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_9b12(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_dc07; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_a584(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_4ce8; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_aaf5(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_39f6; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_b8aa(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_0b81; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_c0b4(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_12a9; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_c3cb(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_a63d; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_cc78(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_6a0c; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_d1eb(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_f9e7; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_de97(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_0d37; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_e706(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_27a8; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_frame_end__gf13e_f40a(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_23e2; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_134e(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_fe05; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_15b4(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_d2b1; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_2af0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_eb20; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_2d1a(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_85bb; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_3749(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_e087; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_45b0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_57f0; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_46df(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_9af2; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_50a2(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_60d9; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_7a36(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_fd54; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_8bdb(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_bf37; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_9611(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_2515; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_9794(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_6332; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_9c13(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_7fdc; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_ad42(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_3f2a; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_b743(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_509b; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_c3ce(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_2546; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %core__lib__abi__checked_tail__gf13e_c89e(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_def1; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %contract_init_abi_CoolCoin() { - block0: - v0.objref<@layout_2> = obj.alloc @layout_2; - v1.objref<@layout_4> = obj.alloc @layout_4; - jump block1; - - block1: - v3.i256 = evm_call_value; - v4.i1 = eq v3 0.i256; - v5.i1 = is_zero v4; - br v5 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v7.i256 = sym_size .; - v8.i256 = evm_code_size; - v9.i1 = lt v8 v7; - br v9 block4 block5; - - block4: - evm_revert 0.i256 0.i256; - - block5: - (v13.i256, v14.i1) = usubo v8 v7; - br v14 block6 block7; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v19.*i8 = evm_malloc v13; - v20.i256 = ptr_to_int v19 i256; - evm_code_copy v20 v7 v13; - v23.objref = obj.proj v0 0.i256; - obj.store v23 v20; - v25.objref = obj.proj v0 1.i256; - obj.store v25 v13; - v26.@layout_2 = obj.load v0; - v27.@layout_4 = call %decoder_new v26; - v28.objref<@layout_3> = obj.proj v1 0.i256; - v29.@layout_3 = extract_value v27 0.i256; - v30.objref<@layout_2> = obj.proj v28 0.i256; - v31.@layout_2 = extract_value v29 0.i256; - v32.objref = obj.proj v30 0.i256; - v33.i256 = extract_value v31 0.i256; - obj.store v32 v33; - v34.objref = obj.proj v30 1.i256; - v35.i256 = extract_value v31 1.i256; - obj.store v34 v35; - v36.objref = obj.proj v28 1.i256; - v37.i256 = extract_value v29 1.i256; - obj.store v36 v37; - v38.objref = obj.proj v1 1.i256; - v39.i256 = extract_value v27 1.i256; - obj.store v38 v39; - v40.@layout_16 = call %decode_payload__gf566 v1; - v41.i256 = extract_value v40 0.i256; - v42.@layout_0 = extract_value v40 1.i256; - call %__CoolCoin_init v41 v42 0.i256; - return; -} - -func private %contract_init_root_CoolCoin() { - block0: - jump block1; - - block1: - call %contract_init_abi_CoolCoin; - v2.i256 = sym_addr &CoolCoin_runtime; - v3.i256 = sym_size &CoolCoin_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_CoolCoin_1086394137() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_8 = call %decode_runtime_args__g2273 v5; - v7.@layout_0 = extract_value v6 0.i256; - v9.i256 = extract_value v6 1.i256; - v10.i1 = call %__CoolCoin_recv_1_0 v7 v9 0.i256; - v11.@layout_21 = call %encode_single_root_alloc__g09ca v10; - v12.i256 = extract_value v11 0.i256; - v13.i256 = extract_value v11 1.i256; - evm_return v12 v13; -} - -func inline(always) private %contract_recv_abi_CoolCoin_1117154408() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_9 = call %decode_runtime_args__gf629 v5; - v7.i256 = extract_value v6 0.i256; - v8.i1 = call %__CoolCoin_recv_1_1 v7 0.i256; - v9.@layout_21 = call %encode_single_root_alloc__g09ca v8; - v10.i256 = extract_value v9 0.i256; - v12.i256 = extract_value v9 1.i256; - evm_return v10 v12; -} - -func inline(always) private %contract_recv_abi_CoolCoin_117300739() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - call %decode_runtime_args__gce2e v5; - v7.i256 = call %__CoolCoin_recv_0_6; - v8.@layout_21 = call %encode_single_root_alloc__g472d v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func inline(always) private %contract_recv_abi_CoolCoin_157198259() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_7 = call %decode_runtime_args__g7a2c v5; - v7.@layout_0 = extract_value v6 0.i256; - v9.i256 = extract_value v6 1.i256; - v10.i1 = call %__CoolCoin_recv_0_1 v7 v9 0.i256; - v11.@layout_21 = call %encode_single_root_alloc__g09ca v10; - v12.i256 = extract_value v11 0.i256; - v13.i256 = extract_value v11 1.i256; - evm_return v12 v13; -} - -func inline(always) private %contract_recv_abi_CoolCoin_1889567281() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_11 = call %decode_runtime_args__g953d v5; - v7.@layout_0 = extract_value v6 0.i256; - v8.i256 = call %__CoolCoin_recv_0_3 v7 0.i256; - v9.@layout_21 = call %encode_single_root_alloc__gac80 v8; - v10.i256 = extract_value v9 0.i256; - v12.i256 = extract_value v9 1.i256; - evm_return v10 v12; -} - -func inline(always) private %contract_recv_abi_CoolCoin_2043438992() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_10 = call %decode_runtime_args__g216b v5; - v7.@layout_0 = extract_value v6 0.i256; - v9.i256 = extract_value v6 1.i256; - v10.i1 = call %__CoolCoin_recv_1_2 v7 v9 0.i256; - v11.@layout_21 = call %encode_single_root_alloc__g09ca v10; - v12.i256 = extract_value v11 0.i256; - v13.i256 = extract_value v11 1.i256; - evm_return v12 v13; -} - -func inline(always) private %contract_recv_abi_CoolCoin_2514000705() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - call %decode_runtime_args__g295c v5; - v7.i256 = call %__CoolCoin_recv_0_7; - v8.@layout_21 = call %encode_single_root_alloc__g0c18 v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func inline(always) private %contract_recv_abi_CoolCoin_2757214935() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_15 = call %decode_runtime_args__g6a7c v5; - v7.@layout_0 = extract_value v6 0.i256; - v9.i256 = extract_value v6 1.i256; - v10.i1 = call %__CoolCoin_recv_1_4 v7 v9 0.i256; - v11.@layout_21 = call %encode_single_root_alloc__g09ca v10; - v12.i256 = extract_value v11 0.i256; - v13.i256 = extract_value v11 1.i256; - evm_return v12 v13; -} - -func inline(always) private %contract_recv_abi_CoolCoin_2835717307() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_14 = call %decode_runtime_args__ge035 v5; - v7.@layout_0 = extract_value v6 0.i256; - v9.i256 = extract_value v6 1.i256; - v10.i1 = call %__CoolCoin_recv_0_0 v7 v9 0.i256; - v11.@layout_21 = call %encode_single_root_alloc__g09ca v10; - v12.i256 = extract_value v11 0.i256; - v13.i256 = extract_value v11 1.i256; - evm_return v12 v13; -} - -func inline(always) private %contract_recv_abi_CoolCoin_3714247998() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_6 = call %decode_runtime_args__gc772 v5; - v7.@layout_0 = extract_value v6 0.i256; - v9.@layout_0 = extract_value v6 1.i256; - v10.i256 = call %__CoolCoin_recv_0_4 v7 v9 0.i256; - v11.@layout_21 = call %encode_single_root_alloc__gac80 v10; - v12.i256 = extract_value v11 0.i256; - v13.i256 = extract_value v11 1.i256; - evm_return v12 v13; -} - -func inline(always) private %contract_recv_abi_CoolCoin_404098525() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - call %decode_runtime_args__gce7d v5; - v7.i256 = call %__CoolCoin_recv_0_5 0.i256; - v8.@layout_21 = call %encode_single_root_alloc__gac80 v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func inline(always) private %contract_recv_abi_CoolCoin_599290589() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_13 = call %decode_runtime_args__g4e54 v5; - v7.@layout_0 = extract_value v6 0.i256; - v9.@layout_0 = extract_value v6 1.i256; - v11.i256 = extract_value v6 2.i256; - v12.i1 = call %__CoolCoin_recv_0_2 v7 v9 v11 0.i256; - v13.@layout_21 = call %encode_single_root_alloc__g09ca v12; - v14.i256 = extract_value v13 0.i256; - v15.i256 = extract_value v13 1.i256; - evm_return v14 v15; -} - -func inline(always) private %contract_recv_abi_CoolCoin_826074471() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - call %decode_runtime_args__g5a0b v5; - v7.i8 = call %__CoolCoin_recv_0_8; - v8.@layout_21 = call %encode_single_root_alloc__gcb0a v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func inline(always) private %contract_recv_abi_CoolCoin_961581905() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_18> = obj.alloc @layout_18; - v6.@layout_12 = call %decode_runtime_args__g698d v5; - v7.@layout_0 = extract_value v6 0.i256; - v9.i256 = extract_value v6 1.i256; - v10.i1 = call %__CoolCoin_recv_1_3 v7 v9 0.i256; - v11.@layout_21 = call %encode_single_root_alloc__g09ca v10; - v12.i256 = extract_value v11 0.i256; - v13.i256 = extract_value v11 1.i256; - evm_return v12 v13; -} - -func private %contract_runtime_root_CoolCoin() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (117300739.i32 block4) (157198259.i32 block5) (404098525.i32 block6) (599290589.i32 block7) (826074471.i32 block8) (961581905.i32 block9) (1086394137.i32 block10) (1117154408.i32 block11) (1889567281.i32 block12) (2043438992.i32 block13) (-1780966591.i32 block14) (-1537752361.i32 block15) (-1459249989.i32 block16) (-580719298.i32 block17); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_CoolCoin_117300739; - unreachable; - - block5: - call %contract_recv_abi_CoolCoin_157198259; - unreachable; - - block6: - call %contract_recv_abi_CoolCoin_404098525; - unreachable; - - block7: - call %contract_recv_abi_CoolCoin_599290589; - unreachable; - - block8: - call %contract_recv_abi_CoolCoin_826074471; - unreachable; - - block9: - call %contract_recv_abi_CoolCoin_961581905; - unreachable; - - block10: - call %contract_recv_abi_CoolCoin_1086394137; - unreachable; - - block11: - call %contract_recv_abi_CoolCoin_1117154408; - unreachable; - - block12: - call %contract_recv_abi_CoolCoin_1889567281; - unreachable; - - block13: - call %contract_recv_abi_CoolCoin_2043438992; - unreachable; - - block14: - call %contract_recv_abi_CoolCoin_2514000705; - unreachable; - - block15: - call %contract_recv_abi_CoolCoin_2757214935; - unreachable; - - block16: - call %contract_recv_abi_CoolCoin_2835717307; - unreachable; - - block17: - call %contract_recv_abi_CoolCoin_3714247998; - unreachable; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_0b81() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_0d37() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_12a9() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_2004() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_23e2() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_2515() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_2546() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_27a8() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_39f6() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_3f2a() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_4ce8() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_509b() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_57f0() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_60d9() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_6332() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_6a0c() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_733d() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_7414() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_7fdc() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_85bb() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_929c() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_947f() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_9af2() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_a0e7() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_a63d() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_bf37() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_d2b1() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_dc07() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_def1() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_e087() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_eb20() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_f9e7() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_fd54() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_fe05() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func inline(always) private %decode_field__g3854(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0a1c_0 v0; - v4.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_91bf_0 v0; - v5.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__pos__g463e_3f42_0 v0; - (v6.i256, v7.i1) = uaddo v4 v3; - br v7 block5 block6; - - block3: - jump block4; - - block4: - v23.i256 = call %impl_trait_u256__decode_payload__g407e v0; - return v23; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_4735_0 v0 v6; - v15.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_91bf_0 v0; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_ae9c_0 v0 v15; - v17.i256 = call %impl_trait_u256__decode_payload__g407e v0; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_4735_0 v0 v4; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_ae9c_0 v0 v5; - return v17; -} - -func inline(always) private %decode_field__g8463(v0.objref<@layout_4>) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0a1c v0; - v4.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_91bf v0; - v5.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__pos__g463e_3f42 v0; - (v6.i256, v7.i1) = uaddo v4 v3; - br v7 block5 block6; - - block3: - jump block4; - - block4: - v23.@layout_0 = call %impl_trait_Address__decode_payload__g407e v0; - return v23; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_4735 v0 v6; - v15.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_91bf v0; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_ae9c v0 v15; - v17.@layout_0 = call %impl_trait_Address__decode_payload__g407e v0; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_4735 v0 v4; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_ae9c v0 v5; - return v17; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_03a7(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9725 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3a7c_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3a7c_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__gcfb5_2692(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_69bf v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3716_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3716_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__gcfb5_2eef(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_ce64 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_2519_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_2519_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_4796(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_27ad v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8d9f_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8d9f_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_5cc4(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_5ce9 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_b39f_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_b39f_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__gcfb5_7143(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_faf2 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_5535_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_5535_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_7366(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c32c v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_5c31_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_5c31_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__gcfb5_786c(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c2d4 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_4e5e_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_4e5e_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_79b2(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b870 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_251a_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_251a_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__gcfb5_7fa7(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_fdcb v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_db93_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_db93_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_9270(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_780b v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_0a95_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_0a95_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__gcfb5_b564(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_88a1 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_9286_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_9286_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_cb05(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_49c5 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_18e6_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_18e6_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__gcfb5_d5a0(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_0f5c v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_f4e0_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_f4e0_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__gcfb5_d5c8(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_6dae v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3641_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3641_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__g5385_d887(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c259 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4e52_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4e52_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from__gcfb5_e784(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_7946 v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_b822_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_b822_0 v0 v8; - return v16; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__gcfb5_07a0(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_88a1 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_9794 v1 v7; - v11.@layout_0 = call %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_3fea v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_9286_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__gcfb5_18ef(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_69bf v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_46df v1 v7; - v11.@layout_0 = call %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_978c v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3716_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__gcfb5_2207(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_fdcb v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_45b0 v1 v7; - v11.@layout_0 = call %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_d676 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_db93_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__gcfb5_2724(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c2d4 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_ad42 v1 v7; - v11.@layout_0 = call %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_64e6 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_4e5e_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_34fc(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c32c v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_b743 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_d01b v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_5c31_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_5db0(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_27ad v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_9611 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_2374 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8d9f_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__gcfb5_764c(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_ce64 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_3749 v1 v7; - v11.@layout_0 = call %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_3639 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_2519_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_7760(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_780b v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_8bdb v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_1972 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_0a95_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_839e(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9725 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_2af0 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_43c7 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3a7c_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_847c(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b870 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_9c13 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_8823 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_251a_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__gcfb5_a4f7(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_faf2 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_2d1a v1 v7; - v11.@layout_0 = call %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_2c09 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_5535_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_b51a(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_5ce9 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_134e v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_2360 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_b39f_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_c7d5(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_49c5 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_15b4 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_38c3 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_18e6_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__g5385_d4dc(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c259 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_50a2 v1 v7; - v11.i256 = call %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_6ea9 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4e52_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__gcfb5_ed91(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_7946 v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_c3ce v1 v7; - v11.@layout_0 = call %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_8e68 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_b822_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__gcfb5_ef75(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_0f5c v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_7a36 v1 v7; - v11.@layout_0 = call %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_29bc v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_f4e0_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_field_from_prechecked_head__gcfb5_faf8(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_6dae v0 v2; - v9.i256 = call %core__lib__abi__checked_tail__gf13e_c89e v1 v7; - v11.@layout_0 = call %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_a883 v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3641_0 v0 v2; - return v14; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_0a95(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c700 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_0a95_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c700_0 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_18e6(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b705 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_18e6_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b705_0 v0 v1; - return v4; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_2519(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_8736 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_2519_0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_8736_0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_251a(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3bad v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_251a_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3bad_0 v0 v1; - return v4; -} - -func inline(always) private %impl_trait_Symbol__decode_from__gd20d(v0.@layout_5, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3641(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b9ca v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3641_0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b9ca_0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3716(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_d831 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3716_0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_d831_0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3a7c(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9757 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3a7c_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9757_0 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4e52(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_790f v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4e52_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_790f_0 v0 v1; - return v4; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_4e5e(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_fec2 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_4e5e_0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_fec2_0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_5535(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_a6b2 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_5535_0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_a6b2_0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_5c31(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3a1f v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_5c31_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3a1f_0 v0 v1; - return v4; -} - -func inline(always) private %impl_trait_Allowance__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_6 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_e949 v0; - v5.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_6698 v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_6698 v0 v1 v7 v3; - v20.@layout_6 = insert_value undef.@layout_6 0.i256 v5; - v22.@layout_6 = insert_value v20 1.i256 v17; - return v22; -} - -func inline(always) private %impl_trait_Approve__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_7 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_aa47 v0; - v5.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_329a v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %core__lib__abi__decode_msg_field_from__g5385_0219 v0 v1 v7 v3; - v20.@layout_7 = insert_value undef.@layout_7 0.i256 v5; - v22.@layout_7 = insert_value v20 1.i256 v17; - return v22; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8d9f(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b461 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8d9f_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b461_0 v0 v1; - return v4; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_9286(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_a8d6 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_9286_0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_a8d6_0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %impl_trait_Mint__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_8 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_779e v0; - v5.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_0358 v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %core__lib__abi__decode_msg_field_from__g5385_9796 v0 v1 v7 v3; - v20.@layout_8 = insert_value undef.@layout_8 0.i256 v5; - v22.@layout_8 = insert_value v20 1.i256 v17; - return v22; -} - -func inline(always) private %impl_trait_Burn__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_9 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_6f43 v0; - v5.i256 = call %core__lib__abi__decode_msg_field_from__g5385_ce42 v0 v1 v1 v3; - v8.@layout_9 = insert_value undef.@layout_9 0.i256 v5; - return v8; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_b39f(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_e134 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_b39f_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_e134_0 v0 v1; - return v4; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_b822(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_40a0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_b822_0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_40a0_0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %impl_trait_BurnFrom__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_10 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_e065 v0; - v5.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_059c v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %core__lib__abi__decode_msg_field_from__g5385_745e v0 v1 v7 v3; - v20.@layout_10 = insert_value undef.@layout_10 0.i256 v5; - v22.@layout_10 = insert_value v20 1.i256 v17; - return v22; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_1972(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_aaf5 v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_0a95 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_2360(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_01a8 v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_b39f v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_2374(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_a584 v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_8d9f v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_29bc(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_e706 v1 32.i256 v2; - v8.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_f4e0 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_2c09(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_cc78 v1 32.i256 v2; - v8.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_5535 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_3639(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_4689 v1 32.i256 v2; - v8.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_2519 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_38c3(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_c0b4 v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_18e6 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_3fea(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_de97 v1 32.i256 v2; - v8.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_9286 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_43c7(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_f40a v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_3a7c v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_64e6(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_6403 v1 32.i256 v2; - v8.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_4e5e v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_6ea9(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_9888 v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4e52 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_8823(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_9284 v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_251a v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_8e68(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_c3cb v1 32.i256 v2; - v8.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_b822 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_978c(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_60b4 v1 32.i256 v2; - v8.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3716 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_a883(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_9b12 v1 32.i256 v2; - v8.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_3641 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__g8bef_d01b(v0.@layout_5, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_d1eb v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_5c31 v0 v1; - return v8; -} - -func private %core__lib__abi__trait_Decode__decode_from_bounded__gd2f7_d676(v0.@layout_5, v1.i256, v2.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v6.i256 = call %core__lib__abi__checked_frame_end__gf13e_b8aa v1 32.i256 v2; - v8.@layout_0 = call %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_db93 v0 v1; - return v8; -} - -func inline(always) private %impl_trait_Decimals__decode_from__gd20d(v0.@layout_5, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %impl_trait_BalanceOf__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_11 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_e9e0 v0; - v5.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_6f66 v0 v1 v1 v3; - v8.@layout_11 = insert_value undef.@layout_11 0.i256 v5; - return v8; -} - -func inline(always) private %impl_trait_Name__decode_from__gd20d(v0.@layout_5, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %impl_trait_IncreaseAllowance__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_12 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_de6d v0; - v5.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_f58a v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %core__lib__abi__decode_msg_field_from__g5385_0929 v0 v1 v7 v3; - v20.@layout_12 = insert_value undef.@layout_12 0.i256 v5; - v22.@layout_12 = insert_value v20 1.i256 v17; - return v22; -} - -func inline(always) private %impl_trait_TransferFrom__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_13 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_36c4 v0; - v5.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_3b80 v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_3b80 v0 v1 v7 v3; - (v20.i256, v21.i1) = uaddo v1 32.i256; - br v21 block2 block4; - - block4: - (v22.i256, v23.i1) = uaddo v20 32.i256; - br v23 block2 block5; - - block5: - v27.i256 = call %core__lib__abi__decode_msg_field_from__g5385_2a48 v0 v1 v22 v3; - v30.@layout_13 = insert_value undef.@layout_13 0.i256 v5; - v33.@layout_13 = insert_value v30 1.i256 v17; - v35.@layout_13 = insert_value v33 2.i256 v27; - return v35; -} - -func inline(always) private %impl_trait_Transfer__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_14 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_0eff v0; - v5.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_bede v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %core__lib__abi__decode_msg_field_from__g5385_252f v0 v1 v7 v3; - v20.@layout_14 = insert_value undef.@layout_14 0.i256 v5; - v22.@layout_14 = insert_value v20 1.i256 v17; - return v22; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_db93(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3ba3 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_db93_0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3ba3_0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %impl_trait_DecreaseAllowance__decode_from__gd20d(v0.@layout_5, v1.i256) -> @layout_15 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_e83e v0; - v5.@layout_0 = call %core__lib__abi__decode_msg_field_from__gcfb5_7904 v0 v1 v1 v3; - (v7.i256, v8.i1) = uaddo v1 32.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %core__lib__abi__decode_msg_field_from__g5385_9aa8 v0 v1 v7 v3; - v20.@layout_15 = insert_value undef.@layout_15 0.i256 v5; - v22.@layout_15 = insert_value v20 1.i256 v17; - return v22; -} - -func inline(always) private %impl_trait_TotalSupply__decode_from__gd20d(v0.@layout_5, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_f4e0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_bae8 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %std__lib__evm__effects__impl_trait_Address_9c1b__decode_from__g72ab_f4e0_0(v0.@layout_5, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_bae8_0 v0 v1; - v6.i256 = shr 160.i256 v4; - v8.i1 = eq v6 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v12.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - return v12; -} - -func inline(always) private %decode_from_prechecked_head__gbd88(v0.@layout_5, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %impl_trait_Name__decode_from__gd20d v0 v1; - return; -} - -func inline(always) private %decode_from_prechecked_head__g76d6(v0.@layout_5, v1.i256, v2.i256) -> @layout_8 { - block0: - jump block1; - - block1: - v6.@layout_8 = call %impl_trait_Mint__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__g41f8(v0.@layout_5, v1.i256, v2.i256) -> @layout_9 { - block0: - jump block1; - - block1: - v6.@layout_9 = call %impl_trait_Burn__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__g205f(v0.@layout_5, v1.i256, v2.i256) -> @layout_14 { - block0: - jump block1; - - block1: - v6.@layout_14 = call %impl_trait_Transfer__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__g5470(v0.@layout_5, v1.i256, v2.i256) -> @layout_6 { - block0: - jump block1; - - block1: - v6.@layout_6 = call %impl_trait_Allowance__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__g6690(v0.@layout_5, v1.i256, v2.i256) -> @layout_13 { - block0: - jump block1; - - block1: - v6.@layout_13 = call %impl_trait_TransferFrom__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__g7ea0(v0.@layout_5, v1.i256, v2.i256) -> @layout_11 { - block0: - jump block1; - - block1: - v6.@layout_11 = call %impl_trait_BalanceOf__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__g691a(v0.@layout_5, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %impl_trait_Symbol__decode_from__gd20d v0 v1; - return; -} - -func inline(always) private %decode_from_prechecked_head__g7d8c(v0.@layout_5, v1.i256, v2.i256) -> @layout_12 { - block0: - jump block1; - - block1: - v6.@layout_12 = call %impl_trait_IncreaseAllowance__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__gab8c(v0.@layout_5, v1.i256, v2.i256) -> @layout_7 { - block0: - jump block1; - - block1: - v6.@layout_7 = call %impl_trait_Approve__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__g4997(v0.@layout_5, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %impl_trait_Decimals__decode_from__gd20d v0 v1; - return; -} - -func inline(always) private %decode_from_prechecked_head__gad59(v0.@layout_5, v1.i256, v2.i256) -> @layout_10 { - block0: - jump block1; - - block1: - v6.@layout_10 = call %impl_trait_BurnFrom__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_from_prechecked_head__g051e(v0.@layout_5, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %impl_trait_TotalSupply__decode_from__gd20d v0 v1; - return; -} - -func inline(always) private %decode_from_prechecked_head__g383e(v0.@layout_5, v1.i256, v2.i256) -> @layout_15 { - block0: - jump block1; - - block1: - v6.@layout_15 = call %impl_trait_DecreaseAllowance__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_0219(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_5db0 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_4796 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__gcfb5_0358(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.@layout_0 = call %core__lib__abi__decode_field_from_prechecked_head__gcfb5_18ef v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %core__lib__abi__decode_field_from__gcfb5_2692 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__gcfb5_059c(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.@layout_0 = call %core__lib__abi__decode_field_from_prechecked_head__gcfb5_2724 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %core__lib__abi__decode_field_from__gcfb5_786c v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_0929(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_7760 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_9270 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_252f(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_847c v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_79b2 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_2a48(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_839e v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_03a7 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__gcfb5_329a(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.@layout_0 = call %core__lib__abi__decode_field_from_prechecked_head__gcfb5_2207 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %core__lib__abi__decode_field_from__gcfb5_7fa7 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__gcfb5_3b80(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.@layout_0 = call %core__lib__abi__decode_field_from_prechecked_head__gcfb5_a4f7 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %core__lib__abi__decode_field_from__gcfb5_7143 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__gcfb5_6698(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.@layout_0 = call %core__lib__abi__decode_field_from_prechecked_head__gcfb5_07a0 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %core__lib__abi__decode_field_from__gcfb5_b564 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__gcfb5_6f66(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.@layout_0 = call %core__lib__abi__decode_field_from_prechecked_head__gcfb5_faf8 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %core__lib__abi__decode_field_from__gcfb5_d5c8 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_745e(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_c7d5 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_cb05 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__gcfb5_7904(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.@layout_0 = call %core__lib__abi__decode_field_from_prechecked_head__gcfb5_ef75 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %core__lib__abi__decode_field_from__gcfb5_d5a0 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_9796(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_34fc v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_7366 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_9aa8(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_b51a v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_5cc4 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__gcfb5_bede(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.@layout_0 = call %core__lib__abi__decode_field_from_prechecked_head__gcfb5_ed91 v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %core__lib__abi__decode_field_from__gcfb5_e784 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__g5385_ce42(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %core__lib__abi__decode_field_from_prechecked_head__g5385_d4dc v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__decode_field_from__g5385_d887 v0 v1 v2; - return v14; -} - -func inline(always) private %core__lib__abi__decode_msg_field_from__gcfb5_f58a(v0.@layout_5, v1.i256, v2.i256, v3.i256) -> @layout_0 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.@layout_0 = call %core__lib__abi__decode_field_from_prechecked_head__gcfb5_764c v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.@layout_0 = call %core__lib__abi__decode_field_from__gcfb5_2eef v0 v1 v2; - return v14; -} - -func inline(always) private %impl_trait_u256__decode_payload__g407e(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_85d9 v0; - return v2; -} - -func inline(always) private %impl_trait_Address__decode_payload__g407e(v0.objref<@layout_4>) -> @layout_0 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_87b3 v0; - v4.i256 = shr 160.i256 v2; - v6.i1 = eq v4 0.i256; - v7.i1 = is_zero v6; - br v7 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v10.@layout_0 = insert_value undef.@layout_0 0.i256 v2; - return v10; -} - -func private %decode_payload__gf566(v0.objref<@layout_4>) -> @layout_16 { - block0: - jump block1; - - block1: - v2.i256 = call %decode_field__g3854 v0; - v3.@layout_0 = call %decode_field__g8463 v0; - v6.@layout_16 = insert_value undef.@layout_16 0.i256 v2; - v8.@layout_16 = insert_value v6 1.i256 v3; - return v8; -} - -func inline(always) private %decode_runtime_args__g5a0b(v0.objref<@layout_18>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_cd56; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_fc14 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_57a6; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head__g4997 v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func inline(always) private %decode_runtime_args__g6a7c(v0.objref<@layout_18>) -> @layout_15 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_663b; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_5dcb v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_20f2; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_15 = call %decode_from_prechecked_head__g383e v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 68.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__g7a2c(v0.objref<@layout_18>) -> @layout_7 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_a580; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_22ff v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_ce6e; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_7 = call %decode_from_prechecked_head__gab8c v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 68.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__g295c(v0.objref<@layout_18>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_5bd8; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_ae2f v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_9941; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head__g691a v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func inline(always) private %decode_runtime_args__gce7d(v0.objref<@layout_18>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_88e5; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_9efd v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_b229; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head__g051e v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func inline(always) private %decode_runtime_args__g2273(v0.objref<@layout_18>) -> @layout_8 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_f89e; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_5742 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_0a69; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_8 = call %decode_from_prechecked_head__g76d6 v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 68.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__g4e54(v0.objref<@layout_18>) -> @layout_13 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_3dc9; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_ce93 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_2f36; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_13 = call %decode_from_prechecked_head__g6690 v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 100.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__g698d(v0.objref<@layout_18>) -> @layout_12 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_d673; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_f03b v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_cb5c; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_12 = call %decode_from_prechecked_head__g7d8c v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 68.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__gc772(v0.objref<@layout_18>) -> @layout_6 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_3347; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_4a91 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_12ed; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_6 = call %decode_from_prechecked_head__g5470 v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 68.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__g953d(v0.objref<@layout_18>) -> @layout_11 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_b73f; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_6107 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_6993; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_11 = call %decode_from_prechecked_head__g7ea0 v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 36.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__g216b(v0.objref<@layout_18>) -> @layout_10 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_6a54; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_7388 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_cf57; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_10 = call %decode_from_prechecked_head__gad59 v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 68.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__gf629(v0.objref<@layout_18>) -> @layout_9 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_e029; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_c018 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_98a8; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_9 = call %decode_from_prechecked_head__g41f8 v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 36.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__gce2e(v0.objref<@layout_18>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_844a; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_b318 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_66b1; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head__gbd88 v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func inline(always) private %decode_runtime_args__ge035(v0.objref<@layout_18>) -> @layout_14 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_5 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_dac7; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_1a14 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_a20a; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_14 = call %decode_from_prechecked_head__g205f v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 68.i256 v15; - br v16 block2 block3; -} - -func private %decoder_new(v0.@layout_2) -> @layout_4 { - block0: - jump block1; - - block1: - v2.@layout_4 = call %impl_SolDecoder__new__g463e v0; - return v2; -} - -func private %emit__g9cd0(v0.@layout_19) { - block0: - jump block1; - - block1: - call %impl_trait_ApprovalEvent__emit__gcd5c v0; - return; -} - -func inline(always) private %impl_trait_ApprovalEvent__emit__gcd5c(v0.@layout_19) { - block0: - jump block1; - - block1: - v3.i256 = extract_value v0 2.i256; - v4.@layout_21 = call %std__lib__evm__effects__encode_abi_payload__ge513_a2dc v3; - v6.i256 = extract_value v4 0.i256; - v8.i256 = extract_value v4 1.i256; - v10.@layout_0 = extract_value v0 0.i256; - v11.i256 = call %std__lib__abi__sol__types__impl_trait_Address_0a07__as_topic_d053 v10; - v12.@layout_0 = extract_value v0 1.i256; - v13.i256 = call %std__lib__abi__sol__types__impl_trait_Address_0a07__as_topic_d053 v12; - call %std__lib__evm__effects__impl_trait_Evm_476c__log3_ebb3 v6 v8 3682740849240848158437977969522068712009226744993583420104789809440898259342.i256 v11 v13; - return; -} - -func inline(always) private %impl_trait_TransferEvent__emit__gcd5c(v0.@layout_20) { - block0: - jump block1; - - block1: - v3.i256 = extract_value v0 2.i256; - v4.@layout_21 = call %std__lib__evm__effects__encode_abi_payload__ge513_3306 v3; - v6.i256 = extract_value v4 0.i256; - v8.i256 = extract_value v4 1.i256; - v10.@layout_0 = extract_value v0 0.i256; - v11.i256 = call %std__lib__abi__sol__types__impl_trait_Address_0a07__as_topic_4475 v10; - v12.@layout_0 = extract_value v0 1.i256; - v13.i256 = call %std__lib__abi__sol__types__impl_trait_Address_0a07__as_topic_4475 v12; - call %std__lib__evm__effects__impl_trait_Evm_476c__log3_89cc v6 v8 -9523714936405215257252364384647749786687397661936385964149718923739779436176.i256 v11 v13; - return; -} - -func private %emit__g4c3d(v0.@layout_20) { - block0: - jump block1; - - block1: - call %impl_trait_TransferEvent__emit__gcd5c v0; - return; -} - -func private %core__lib__abi__impl_trait_u256_d99e__encode__g426c_116b(v0.i256, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_eba3 v1 v0; - return; -} - -func private %core__lib__abi__impl_trait_u256_d99e__encode__g426c_270a(v0.i256, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_798d v1 v0; - return; -} - -func private %encode__g3cd9(v0.i256, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - v3.i256 = call %core__lib__num__impl_trait_String_8f88__to_word__g3eb7_4283 v0; - v4.i256 = call %core__lib__abi__packed_string_len_c13a v3; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_0617 v1 v4; - v8.i1 = eq v4 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_8751 v1; - v13.i256 = add v11 32.i256; - v15.i256 = sub 32.i256 v4; - v17.i256 = mul v15 8.i256; - v19.i256 = shl v17 v3; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_at_e460 v1 v13 v19; - jump block4; - - block3: - jump block4; - - block4: - return; -} - -func private %core__lib__abi__impl_trait_u256_d99e__encode__g426c_2910(v0.i256, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8eda v1 v0; - return; -} - -func private %encode__gbe21(v0.i256, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - v3.i256 = call %core__lib__num__impl_trait_String_8f88__to_word__gc7cf_de49 v0; - v4.i256 = call %core__lib__abi__packed_string_len_29ef v3; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_7a95 v1 v4; - v8.i1 = eq v4 0.i256; - v9.i1 = is_zero v8; - br v9 block2 block3; - - block2: - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_bb09 v1; - v13.i256 = add v11 32.i256; - v15.i256 = sub 32.i256 v4; - v17.i256 = mul v15 8.i256; - v19.i256 = shl v17 v3; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_at_7ecd v1 v13 v19; - jump block4; - - block3: - jump block4; - - block4: - return; -} - -func private %std__lib__evm__effects__encode_abi_payload__ge513_3306(v0.i256) -> @layout_21 { - block0: - jump block1; - - block1: - v2.@layout_21 = call %core__lib__abi__encode_alloc__gac80_5c94 v0; - return v2; -} - -func private %std__lib__evm__effects__encode_abi_payload__ge513_a2dc(v0.i256) -> @layout_21 { - block0: - jump block1; - - block1: - v2.@layout_21 = call %core__lib__abi__encode_alloc__gac80_4157 v0; - return v2; -} - -func private %impl_trait_u8__encode__g426c(v0.i8, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - v3.i256 = zext v0 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_124f v1 v3; - return; -} - -func inline(always) private %core__lib__abi__encode_alloc__gac80_4157(v0.i256) -> @layout_21 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__abi_payload_size__ge513_5ba7 v0; - v3.@layout_1 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_ddf2 v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_9c4a v4; - call %core__lib__abi__impl_trait_u256_d99e__encode__g426c_116b v0 v4; - v14.@layout_21 = insert_value undef.@layout_21 0.i256 v11; - v15.@layout_21 = insert_value v14 1.i256 v2; - return v15; -} - -func inline(always) private %core__lib__abi__encode_alloc__gac80_5c94(v0.i256) -> @layout_21 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__abi_payload_size__ge513_d165 v0; - v3.@layout_1 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_721a v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_1fbd v4; - call %core__lib__abi__impl_trait_u256_d99e__encode__g426c_270a v0 v4; - v14.@layout_21 = insert_value undef.@layout_21 0.i256 v11; - v15.@layout_21 = insert_value v14 1.i256 v2; - return v15; -} - -func private %impl_trait_bool__encode__g426c(v0.i1, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - br v0 block2 block3; - - block2: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_d813 v1 1.i256; - jump block4; - - block3: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_d813 v1 0.i256; - jump block4; - - block4: - return; -} - -func private %encode_field__g0a88(v0.i8, v1.objref<@layout_1>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_a9a0 v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__g79ff_f3e8 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_7b53 v1 v10; - v12.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_7b90 v1; - v13.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_844b v1 v13; - v15.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0f4a v1 v15; - call %impl_trait_u8__encode__g426c v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_844b v1 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0f4a v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_7b90 v1; - call %impl_trait_u8__encode_to_ptr__gf13e v0 v24; - v28.i256 = add v24 32.i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0f4a v1 v28; - return; - - block6: - jump block7; - - block7: - call %impl_trait_u8__encode__g426c v0 v1; - return; -} - -func private %encode_field__ge927(v0.i1, v1.objref<@layout_1>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_c13e v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__gda9b_b33d v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_aa60 v1 v10; - v12.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_6cac v1; - v13.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_cc2c v1 v13; - v15.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_b6ef v1 v15; - call %impl_trait_bool__encode__g426c v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_cc2c v1 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_b6ef v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_6cac v1; - call %impl_trait_bool__encode_to_ptr__gf13e v0 v24; - v28.i256 = add v24 32.i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_b6ef v1 v28; - return; - - block6: - jump block7; - - block7: - call %impl_trait_bool__encode__g426c v0 v1; - return; -} - -func private %encode_field__g2e64(v0.i256, v1.objref<@layout_1>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_fd6f v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_77e5 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8f67 v1 v10; - v12.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_0de4 v1; - v13.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_fa20 v1 v13; - v15.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_3857 v1 v15; - call %core__lib__abi__impl_trait_u256_d99e__encode__g426c_2910 v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_fa20 v1 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_3857 v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_0de4 v1; - call %impl_trait_u256__encode_to_ptr__gf13e v0 v24; - v28.i256 = add v24 32.i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_3857 v1 v28; - return; - - block6: - jump block7; - - block7: - call %core__lib__abi__impl_trait_u256_d99e__encode__g426c_2910 v0 v1; - return; -} - -func private %encode_field__g6d7e(v0.i256, v1.objref<@layout_1>, v2.i256) { - block0: - jump block1; - - block1: - br 1.i1 block2 block3; - - block2: - v5.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_6030 v1; - v8.i256 = call %core__lib__abi__impl_trait_String_c06e__payload_size__gc7cf_4aab v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_406d v1 v10; - v12.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_324d v1; - v13.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_750c v1 v13; - v15.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_597d v1 v15; - call %encode__gbe21 v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_750c v1 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_597d v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 0.i1 block5 block6; - - block5: - v24.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_324d v1; - call %encode_to_ptr__g30cc v0 v24; - unreachable; - - block6: - jump block7; - - block7: - call %encode__gbe21 v0 v1; - return; -} - -func private %encode_field__g859f(v0.i256, v1.objref<@layout_1>, v2.i256) { - block0: - jump block1; - - block1: - br 1.i1 block2 block3; - - block2: - v5.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_25d4 v1; - v8.i256 = call %core__lib__abi__impl_trait_String_c06e__payload_size__g3eb7_f656 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_1ad1 v1 v10; - v12.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_d8ed v1; - v13.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_c5ff v1 v13; - v15.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_7410 v1 v15; - call %encode__g3cd9 v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_c5ff v1 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_7410 v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 0.i1 block5 block6; - - block5: - v24.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_d8ed v1; - call %encode_to_ptr__g4320 v0 v24; - unreachable; - - block6: - jump block7; - - block7: - call %encode__g3cd9 v0 v1; - return; -} - -func private %encode_single_root__ge927(v0.i1, v1.objref<@layout_1>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_c13e v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field__ge927 v0 v1 v7; - return; -} - -func private %encode_single_root__g0a88(v0.i8, v1.objref<@layout_1>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_a9a0 v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field__g0a88 v0 v1 v7; - return; -} - -func private %encode_single_root__g859f(v0.i256, v1.objref<@layout_1>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_25d4 v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field__g859f v0 v1 v7; - return; -} - -func private %encode_single_root__g6d7e(v0.i256, v1.objref<@layout_1>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_6030 v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field__g6d7e v0 v1 v7; - return; -} - -func private %encode_single_root__g2e64(v0.i256, v1.objref<@layout_1>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_fd6f v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field__g2e64 v0 v1 v7; - return; -} - -func private %encode_single_root_alloc__gcb0a(v0.i8) -> @layout_21 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size__g79ff v0; - v3.@layout_1 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_513f v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_a9a0 v4; - call %encode_single_root__g0a88 v0 v4; - v14.@layout_21 = insert_value undef.@layout_21 0.i256 v11; - v15.@layout_21 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_single_root_alloc__gac80(v0.i256) -> @layout_21 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size__ge513 v0; - v3.@layout_1 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_94e9 v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_fd6f v4; - call %encode_single_root__g2e64 v0 v4; - v14.@layout_21 = insert_value undef.@layout_21 0.i256 v11; - v15.@layout_21 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_single_root_alloc__g0c18(v0.i256) -> @layout_21 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size__g65da v0; - v3.@layout_1 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_30df v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_6030 v4; - call %encode_single_root__g6d7e v0 v4; - v14.@layout_21 = insert_value undef.@layout_21 0.i256 v11; - v15.@layout_21 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_single_root_alloc__g09ca(v0.i1) -> @layout_21 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size__gda9b v0; - v3.@layout_1 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_1514 v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_c13e v4; - call %encode_single_root__ge927 v0 v4; - v14.@layout_21 = insert_value undef.@layout_21 0.i256 v11; - v15.@layout_21 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_single_root_alloc__g472d(v0.i256) -> @layout_21 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size__g5535 v0; - v3.@layout_1 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_a948 v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_25d4 v4; - call %encode_single_root__g859f v0 v4; - v14.@layout_21 = insert_value undef.@layout_21 0.i256 v11; - v15.@layout_21 = insert_value v14 1.i256 v2; - return v15; -} - -func private %impl_trait_u256__encode_to_ptr__gf13e(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_2361 v1 v0; - return; -} - -func private %encode_to_ptr__g4320(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_invalid; -} - -func private %impl_trait_bool__encode_to_ptr__gf13e(v0.i1, v1.i256) { - block0: - jump block1; - - block1: - br v0 block2 block3; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_be96 v1 1.i256; - jump block4; - - block3: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_be96 v1 0.i256; - jump block4; - - block4: - return; -} - -func private %encode_to_ptr__g30cc(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_invalid; -} - -func private %impl_trait_u8__encode_to_ptr__gf13e(v0.i8, v1.i256) { - block0: - jump block1; - - block1: - v4.i256 = zext v0 i256; - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_2c7e v1 v4; - return; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_1514(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__new_978f v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_30df(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__new_c575 v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_513f(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__new_f042 v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_721a(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__new_fdc1 v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_94e9(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__new_c2ff v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_a948(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__new_8670 v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__encoder_new_ddf2(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__new_36b0 v0; - return v2; -} - -func private %eq(v0.@layout_0, v1.@layout_0) -> i1 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = extract_value v1 0.i256; - v7.i1 = eq v4 v6; - return v7; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_83e7(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_896a(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_896a_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_c764(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_db05(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %impl_trait_bool__from_word(v0.i256) -> i1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - v4.i1 = is_zero v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_33bc(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g636d_6715 v0; - return v2; -} - -func inline(always) private %get__gc9ba(v0.@layout_16) -> i1 { - block0: - jump block1; - - block1: - v2.i1 = call %get_unchecked__gc9ba v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g94db_552a(v0.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g94db_6563 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g94db_552a_0(v0.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g94db_6563_0 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g94db_c935(v0.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g94db_43a6 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_d67a(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g636d_fb74 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g94db_43a6(v0.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_af75 v0 2.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_83e7 v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g94db_6563(v0.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_d4e7 v0 2.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_896a v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g94db_6563_0(v0.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_d4e7_0 v0 2.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_896a_0 v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g636d_6715(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_4599 v0 1.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_c764 v3; - return v4; -} - -func inline(always) private %get_unchecked__gc9ba(v0.@layout_16) -> i1 { - block0: - jump block1; - - block1: - v3.i256 = call %storagemap_get_word_with_salt__g9379 v0 3.i256; - v4.i1 = call %impl_trait_bool__from_word v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g636d_fb74(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_cb7c v0 1.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_db05 v3; - return v4; -} - -func private %grant(v0.objref<@layout_25>, v1.i256, v2.@layout_0) { - block0: - jump block1; - - block1: - v7.@layout_16 = insert_value undef.@layout_16 0.i256 v1; - v9.@layout_16 = insert_value v7 1.i256 v2; - call %set__gc9ba undef.objref<@layout_24> v9 1.i1; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_3347() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_f11a; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_3dc9() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_0d2c; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_5bd8() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_b0b8; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_663b() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_0fa9; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_6a54() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_147c; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_844a() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_923b; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_88e5() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_53e2; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_a580() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_8102; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_b73f() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_bc34; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_cd56() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_5438; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_d673() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_d306; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_dac7() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_0199; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_e029() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_f379; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_f89e() -> @layout_5 { - block0: - jump block1; - - block1: - v0.@layout_5 = call %std__lib__evm__calldata__impl_CallData_8f43__new_b671; - return v0; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_0eff(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_1a14(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_22ff(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_36c4(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_48ab(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_4a91(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_5742(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_5dcb(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_6107(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_6f43(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_7388(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_779e(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7b50(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7b50_0(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_9efd(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_a4fa(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_aa47(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_ae2f(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_b318(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_c018(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_ce93(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_de6d(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_e065(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_e83e(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_e949(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_e9e0(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_f03b(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_fc14(v0.@layout_5) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %std__lib__evm__effects__impl_trait_Evm_476c__log3_89cc(v0.i256, v1.i256, v2.i256, v3.i256, v4.i256) { - block0: - jump block1; - - block1: - evm_log3 v0 v1 v2 v3 v4; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_476c__log3_ebb3(v0.i256, v1.i256, v2.i256, v3.i256, v4.i256) { - block0: - jump block1; - - block1: - evm_log3 v0 v1 v2 v3 v4; - return; -} - -func private %standalone_erc20__erc20__mint__gd6b1_6ffd(v0.@layout_0, v1.i256, v2.i256) { - block0: - v3.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v5.@layout_0 = call %zero; - v7.objref = obj.proj v3 0.i256; - v8.i256 = extract_value v5 0.i256; - obj.store v7 v8; - v9.@layout_0 = obj.load v3; - v10.i1 = call %ne v0 v9; - br v10 block2 block3; - - block2: - jump block4; - - block3: - v13.*i8 = evm_malloc 64.i256; - v14.i256 = ptr_to_int v13 i256; - mstore v14 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v18.i256, v19.i1) = uaddo v14 32.i256; - br v19 block5 block6; - - block4: - v28.i256 = evm_sload v2; - (v29.i256, v30.i1) = uaddo v28 v1; - br v30 block5 block7; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v18 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v14 36.i256; - - block7: - evm_sstore v2 v29; - v34.i256 = add v2 1.i256; - v36.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_d67a v0; - (v38.i256, v39.i1) = uaddo v36 v1; - br v39 block5 block8; - - block8: - call %set__g636d v34 v0 v38; - v43.@layout_0 = call %zero; - v47.@layout_20 = insert_value undef.@layout_20 0.i256 v43; - v48.@layout_20 = insert_value v47 1.i256 v0; - v50.@layout_20 = insert_value v48 2.i256 v1; - call %emit__g4c3d v50; - return; -} - -func private %standalone_erc20__erc20__mint__gd6b1_bc3c(v0.@layout_0, v1.i256, v2.i256) { - block0: - v3.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v5.@layout_0 = call %zero; - v7.objref = obj.proj v3 0.i256; - v8.i256 = extract_value v5 0.i256; - obj.store v7 v8; - v9.@layout_0 = obj.load v3; - v10.i1 = call %ne v0 v9; - br v10 block2 block3; - - block2: - jump block4; - - block3: - v13.*i8 = evm_malloc 64.i256; - v14.i256 = ptr_to_int v13 i256; - mstore v14 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v18.i256, v19.i1) = uaddo v14 32.i256; - br v19 block5 block6; - - block4: - v28.i256 = evm_sload v2; - (v29.i256, v30.i1) = uaddo v28 v1; - br v30 block5 block7; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v18 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v14 36.i256; - - block7: - evm_sstore v2 v29; - v34.i256 = add v2 1.i256; - v36.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_d67a v0; - (v38.i256, v39.i1) = uaddo v36 v1; - br v39 block5 block8; - - block8: - call %set__g636d v34 v0 v38; - v43.@layout_0 = call %zero; - v47.@layout_20 = insert_value undef.@layout_20 0.i256 v43; - v48.@layout_20 = insert_value v47 1.i256 v0; - v50.@layout_20 = insert_value v48 2.i256 v1; - call %emit__g4c3d v50; - return; -} - -func private %ne(v0.@layout_0, v1.@layout_0) -> i1 { - block0: - jump block1; - - block1: - v4.i1 = call %eq v0 v1; - v5.i1 = is_zero v4; - return v5; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_0199() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_0d2c() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_0fa9() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_147c() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func inline(always) private %impl_SolDecoder__new__g463e(v0.@layout_2) -> @layout_4 { - block0: - jump block1; - - block1: - v2.@layout_3 = call %impl_Cursor__new__g463e v0; - v5.@layout_4 = insert_value undef.@layout_4 0.i256 v2; - v7.@layout_4 = insert_value v5 1.i256 0.i256; - return v7; -} - -func private %std__lib__abi__sol__impl_SolEncoder_ce34__new_36b0(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__at_e384 v7; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_53e2() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_5438() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_8102() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func private %std__lib__abi__sol__impl_SolEncoder_ce34__new_8670(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__at_65fb v7; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_923b() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func private %std__lib__abi__sol__impl_SolEncoder_ce34__new_978f(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__at_fb00 v7; - return v8; -} - -func inline(always) private %impl_Cursor__new__g463e(v0.@layout_2) -> @layout_3 { - block0: - jump block1; - - block1: - v4.@layout_3 = insert_value undef.@layout_3 0.i256 v0; - v6.@layout_3 = insert_value v4 1.i256 0.i256; - return v6; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_b0b8() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_b671() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_bc34() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func private %std__lib__abi__sol__impl_SolEncoder_ce34__new_c2ff(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__at_69c8 v7; - return v8; -} - -func private %std__lib__abi__sol__impl_SolEncoder_ce34__new_c575(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__at_3361 v7; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_d306() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func private %std__lib__abi__sol__impl_SolEncoder_ce34__new_f042(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__at_31d5 v7; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_f11a() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_f379() -> @layout_5 { - block0: - jump block1; - - block1: - v1.constref<@layout_5> = const.ref $const_region_0; - v2.objref<@layout_5> = obj.alloc @layout_5; - obj.init.const v2 v1; - v3.@layout_5 = obj.load v2; - return v3; -} - -func private %std__lib__abi__sol__impl_SolEncoder_ce34__new_fdc1(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %std__lib__abi__sol__impl_SolEncoder_ce34__at_7151 v7; - return v8; -} - -func private %core__lib__abi__packed_string_len_225d(v0.i256) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - mstore v1 0.i256 i256; - jump block2; - - block2: - v4.i256 = phi (v0 block1) (v19 block6); - v5.i1 = eq v4 0.i256; - v6.i1 = is_zero v5; - br v6 block3 block4; - - block3: - v7.i256 = ptr_to_int v1 i256; - v9.i256 = mload v7 i256; - (v10.i256, v11.i1) = uaddo v9 1.i256; - br v11 block5 block6; - - block4: - v20.i256 = mload v1 i256; - return v20; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v7 v10 i256; - v19.i256 = shr 8.i256 v4; - jump block2; -} - -func private %core__lib__abi__packed_string_len_225d_0(v0.i256) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - mstore v1 0.i256 i256; - jump block2; - - block2: - v4.i256 = phi (v0 block1) (v19 block6); - v5.i1 = eq v4 0.i256; - v6.i1 = is_zero v5; - br v6 block3 block4; - - block3: - v7.i256 = ptr_to_int v1 i256; - v9.i256 = mload v7 i256; - (v10.i256, v11.i1) = uaddo v9 1.i256; - br v11 block5 block6; - - block4: - v20.i256 = mload v1 i256; - return v20; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v7 v10 i256; - v19.i256 = shr 8.i256 v4; - jump block2; -} - -func private %core__lib__abi__packed_string_len_29ef(v0.i256) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - mstore v1 0.i256 i256; - jump block2; - - block2: - v4.i256 = phi (v0 block1) (v19 block6); - v5.i1 = eq v4 0.i256; - v6.i1 = is_zero v5; - br v6 block3 block4; - - block3: - v7.i256 = ptr_to_int v1 i256; - v9.i256 = mload v7 i256; - (v10.i256, v11.i1) = uaddo v9 1.i256; - br v11 block5 block6; - - block4: - v20.i256 = mload v1 i256; - return v20; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v7 v10 i256; - v19.i256 = shr 8.i256 v4; - jump block2; -} - -func private %core__lib__abi__packed_string_len_c13a(v0.i256) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - mstore v1 0.i256 i256; - jump block2; - - block2: - v4.i256 = phi (v0 block1) (v19 block6); - v5.i1 = eq v4 0.i256; - v6.i1 = is_zero v5; - br v6 block3 block4; - - block3: - v7.i256 = ptr_to_int v1 i256; - v9.i256 = mload v7 i256; - (v10.i256, v11.i1) = uaddo v9 1.i256; - br v11 block5 block6; - - block4: - v20.i256 = mload v1 i256; - return v20; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v7 v10 i256; - v19.i256 = shr 8.i256 v4; - jump block2; -} - -func private %core__lib__abi__packed_string_len_ecb6(v0.i256) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - mstore v1 0.i256 i256; - jump block2; - - block2: - v4.i256 = phi (v0 block1) (v19 block6); - v5.i1 = eq v4 0.i256; - v6.i1 = is_zero v5; - br v6 block3 block4; - - block3: - v7.i256 = ptr_to_int v1 i256; - v9.i256 = mload v7 i256; - (v10.i256, v11.i1) = uaddo v9 1.i256; - br v11 block5 block6; - - block4: - v20.i256 = mload v1 i256; - return v20; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v7 v10 i256; - v19.i256 = shr 8.i256 v4; - jump block2; -} - -func private %core__lib__abi__packed_string_len_ecb6_0(v0.i256) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - mstore v1 0.i256 i256; - jump block2; - - block2: - v4.i256 = phi (v0 block1) (v19 block6); - v5.i1 = eq v4 0.i256; - v6.i1 = is_zero v5; - br v6 block3 block4; - - block3: - v7.i256 = ptr_to_int v1 i256; - v9.i256 = mload v7 i256; - (v10.i256, v11.i1) = uaddo v9 1.i256; - br v11 block5 block6; - - block4: - v20.i256 = mload v1 i256; - return v20; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v7 v10 i256; - v19.i256 = shr 8.i256 v4; - jump block2; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_18e9(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__impl_trait_String_c06e__payload_size__gc7cf_4aab(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %core__lib__num__impl_trait_String_8f88__to_word__gc7cf_518a v0; - v4.i256 = call %core__lib__abi__packed_string_len_ecb6 v3; - v5.i256 = call %core__lib__abi__round_up_words_a41d v4; - (v6.i256, v7.i1) = uaddo 32.i256 v5; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %core__lib__abi__impl_trait_String_c06e__payload_size__gc7cf_4aab_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %core__lib__num__impl_trait_String_8f88__to_word__gc7cf_518a_0 v0; - v4.i256 = call %core__lib__abi__packed_string_len_ecb6_0 v3; - v5.i256 = call %core__lib__abi__round_up_words_a41d_0 v4; - (v6.i256, v7.i1) = uaddo 32.i256 v5; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_77e5(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_77e5_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__gda9b_b33d(v0.i1) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__gda9b_b33d_0(v0.i1) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_effe(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__g79ff_f3e8(v0.i8) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__g79ff_f3e8_0(v0.i8) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__impl_trait_String_c06e__payload_size__g3eb7_f656(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %core__lib__num__impl_trait_String_8f88__to_word__g3eb7_38b3 v0; - v4.i256 = call %core__lib__abi__packed_string_len_225d v3; - v5.i256 = call %core__lib__abi__round_up_words_b13c v4; - (v6.i256, v7.i1) = uaddo 32.i256 v5; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %core__lib__abi__impl_trait_String_c06e__payload_size__g3eb7_f656_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %core__lib__num__impl_trait_String_8f88__to_word__g3eb7_38b3_0 v0; - v4.i256 = call %core__lib__abi__packed_string_len_225d_0 v3; - v5.i256 = call %core__lib__abi__round_up_words_b13c_0 v4; - (v6.i256, v7.i1) = uaddo 32.i256 v5; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_0de4(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_324d(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__pos__g463e_3f42(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v3.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref = obj.proj v3 1.i256; - v6.i256 = obj.load v5; - return v6; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__pos__g463e_3f42_0(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v3.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref = obj.proj v3 1.i256; - v6.i256 = obj.load v5; - return v6; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_6cac(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_7b90(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__pos_d8ed(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0a1c(v0.objref<@layout_4>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref<@layout_2> = obj.proj v4 0.i256; - v6.@layout_2 = obj.load v5; - v7.objref<@layout_3> = obj.proj v0 0.i256; - v8.objref<@layout_2> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7b50 v8; - v10.objref<@layout_3> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_3> = obj.proj v0 0.i256; - v28.objref<@layout_2> = obj.proj v27 0.i256; - v29.@layout_2 = obj.load v28; - v30.objref<@layout_3> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_3> = obj.proj v0 0.i256; - v34.objref<@layout_2> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7f19 v34 v32; - v37.objref<@layout_3> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_3> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0a1c_0(v0.objref<@layout_4>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref<@layout_2> = obj.proj v4 0.i256; - v6.@layout_2 = obj.load v5; - v7.objref<@layout_3> = obj.proj v0 0.i256; - v8.objref<@layout_2> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7b50_0 v8; - v10.objref<@layout_3> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_3> = obj.proj v0 0.i256; - v28.objref<@layout_2> = obj.proj v27 0.i256; - v29.@layout_2 = obj.load v28; - v30.objref<@layout_3> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_3> = obj.proj v0 0.i256; - v34.objref<@layout_2> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7f19_0 v34 v32; - v37.objref<@layout_3> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_3> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_85d9(v0.objref<@layout_4>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref<@layout_2> = obj.proj v4 0.i256; - v6.@layout_2 = obj.load v5; - v7.objref<@layout_3> = obj.proj v0 0.i256; - v8.objref<@layout_2> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_48ab v8; - v10.objref<@layout_3> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_3> = obj.proj v0 0.i256; - v28.objref<@layout_2> = obj.proj v27 0.i256; - v29.@layout_2 = obj.load v28; - v30.objref<@layout_3> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_3> = obj.proj v0 0.i256; - v34.objref<@layout_2> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_6576 v34 v32; - v37.objref<@layout_3> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_3> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_87b3(v0.objref<@layout_4>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref<@layout_2> = obj.proj v4 0.i256; - v6.@layout_2 = obj.load v5; - v7.objref<@layout_3> = obj.proj v0 0.i256; - v8.objref<@layout_2> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_a4fa v8; - v10.objref<@layout_3> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_3> = obj.proj v0 0.i256; - v28.objref<@layout_2> = obj.proj v27 0.i256; - v29.@layout_2 = obj.load v28; - v30.objref<@layout_3> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_3> = obj.proj v0 0.i256; - v34.objref<@layout_2> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_fb71 v34 v32; - v37.objref<@layout_3> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_3> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func private %require(v0.i256) { - block0: - jump block1; - - block1: - v2.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_aa40; - v5.@layout_16 = insert_value undef.@layout_16 0.i256 v0; - v7.@layout_16 = insert_value v5 1.i256 v2; - v8.i1 = call %get__gc9ba v7; - v10.i1 = eq v8 1.i1; - br v10 block2 block3; - - block2: - jump block4; - - block3: - v13.*i8 = evm_malloc 64.i256; - v14.i256 = ptr_to_int v13 i256; - mstore v14 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v18.i256, v19.i1) = uaddo v14 32.i256; - br v19 block5 block6; - - block4: - return; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v18 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v14 36.i256; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_0ea2(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_2b5d(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_2efa(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_34f1(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_35af(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_3bd1(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_41e6(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_62f4(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_6471(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_9e6f(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_9fb4(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_a28f(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_cab9(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_cb12(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %core__lib__abi__round_up_words_a41d(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - return 0.i256; - - block3: - jump block4; - - block4: - (v6.i256, v7.i1) = usubo v0 1.i256; - br v7 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v13.i1 = eq 32.i256 0.i256; - br v13 block7 block8; - - block7: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 18.i256 i256; - evm_revert 0.i256 36.i256; - - block8: - (v15.i256, v16.i1) = evm_udivo v6 32.i256; - br v16 block5 block9; - - block9: - (v17.i256, v18.i1) = uaddo v15 1.i256; - br v18 block5 block10; - - block10: - (v19.i256, v20.i1) = umulo v17 32.i256; - br v20 block5 block11; - - block11: - return v19; -} - -func private %core__lib__abi__round_up_words_a41d_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - return 0.i256; - - block3: - jump block4; - - block4: - (v6.i256, v7.i1) = usubo v0 1.i256; - br v7 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v13.i1 = eq 32.i256 0.i256; - br v13 block7 block8; - - block7: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 18.i256 i256; - evm_revert 0.i256 36.i256; - - block8: - (v15.i256, v16.i1) = evm_udivo v6 32.i256; - br v16 block5 block9; - - block9: - (v17.i256, v18.i1) = uaddo v15 1.i256; - br v18 block5 block10; - - block10: - (v19.i256, v20.i1) = umulo v17 32.i256; - br v20 block5 block11; - - block11: - return v19; -} - -func private %core__lib__abi__round_up_words_b13c(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - return 0.i256; - - block3: - jump block4; - - block4: - (v6.i256, v7.i1) = usubo v0 1.i256; - br v7 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v13.i1 = eq 32.i256 0.i256; - br v13 block7 block8; - - block7: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 18.i256 i256; - evm_revert 0.i256 36.i256; - - block8: - (v15.i256, v16.i1) = evm_udivo v6 32.i256; - br v16 block5 block9; - - block9: - (v17.i256, v18.i1) = uaddo v15 1.i256; - br v18 block5 block10; - - block10: - (v19.i256, v20.i1) = umulo v17 32.i256; - br v20 block5 block11; - - block11: - return v19; -} - -func private %core__lib__abi__round_up_words_b13c_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - return 0.i256; - - block3: - jump block4; - - block4: - (v6.i256, v7.i1) = usubo v0 1.i256; - br v7 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v13.i1 = eq 32.i256 0.i256; - br v13 block7 block8; - - block7: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 18.i256 i256; - evm_revert 0.i256 36.i256; - - block8: - (v15.i256, v16.i1) = evm_udivo v6 32.i256; - br v16 block5 block9; - - block9: - (v17.i256, v18.i1) = uaddo v15 1.i256; - br v18 block5 block10; - - block10: - (v19.i256, v20.i1) = umulo v17 32.i256; - br v20 block5 block11; - - block11: - return v19; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g94db_2fc5(v0.i256, v1.@layout_22, v2.i256) { - block0: - jump block1; - - block1: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g94db_f05c v0 v1 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g94db_2fc5_0(v0.i256, v1.@layout_22, v2.i256) { - block0: - jump block1; - - block1: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g94db_f05c_0 v0 v1 v2; - return; -} - -func inline(always) private %set__g636d(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - call %set_unchecked__g636d v0 v1 v2; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_4735(v0.objref<@layout_4>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_4735_0(v0.objref<@layout_4>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_750c(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_844b(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_c5ff(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_cc2c(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_fa20(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func inline(always) private %set__gc9ba(v0.objref<@layout_24>, v1.@layout_16, v2.i1) { - block0: - jump block1; - - block1: - call %set_unchecked__gc9ba v0 v1 v2; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0f4a(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_3857(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_597d(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_7410(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_ae9c(v0.objref<@layout_4>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref<@layout_3> = obj.proj v0 0.i256; - v7.objref = obj.proj v5 1.i256; - obj.store v7 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_ae9c_0(v0.objref<@layout_4>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref<@layout_3> = obj.proj v0 0.i256; - v7.objref = obj.proj v5 1.i256; - obj.store v7 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_b6ef(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func inline(always) private %set_unchecked__gc9ba(v0.objref<@layout_24>, v1.@layout_16, v2.i1) { - block0: - jump block1; - - block1: - v5.i256 = call %impl_trait_bool__to_word v2; - call %storagemap_set_word_with_salt__g9379 v1 3.i256 v5; - return; -} - -func inline(always) private %set_unchecked__g636d(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_3a17 v2; - call %storagemap_set_word_with_salt__g67a8 v1 1.i256 v5; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g94db_f05c(v0.i256, v1.@layout_22, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_9907 v2; - call %std__lib__evm__storage_map__storagemap_set_word_with_salt__g7bf4_4d42 v1 2.i256 v5; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g94db_f05c_0(v0.i256, v1.@layout_22, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_9907_0 v2; - call %std__lib__evm__storage_map__storagemap_set_word_with_salt__g7bf4_4d42_0 v1 2.i256 v5; - return; -} - -func private %standalone_erc20__erc20__spend_allowance__gaf82_9523(v0.@layout_0, v1.@layout_0, v2.i256, v3.i256) { - block0: - jump block1; - - block1: - v8.@layout_22 = insert_value undef.@layout_22 0.i256 v0; - v10.@layout_22 = insert_value v8 1.i256 v1; - v11.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g94db_552a v10; - v13.i1 = lt v11 v2; - v14.i1 = is_zero v13; - br v14 block2 block3; - - block2: - jump block4; - - block3: - v17.*i8 = evm_malloc 64.i256; - v18.i256 = ptr_to_int v17 i256; - mstore v18 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v22.i256, v23.i1) = uaddo v18 32.i256; - br v23 block5 block6; - - block4: - v31.i256 = add v3 1.i256; - v35.@layout_22 = insert_value undef.@layout_22 0.i256 v0; - v36.@layout_22 = insert_value v35 1.i256 v1; - (v39.i256, v40.i1) = usubo v11 v2; - br v40 block5 block7; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v22 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v18 36.i256; - - block7: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g94db_2fc5 v31 v36 v39; - return; -} - -func private %standalone_erc20__erc20__spend_allowance__gaf82_9523_0(v0.@layout_0, v1.@layout_0, v2.i256, v3.i256) { - block0: - jump block1; - - block1: - v8.@layout_22 = insert_value undef.@layout_22 0.i256 v0; - v10.@layout_22 = insert_value v8 1.i256 v1; - v11.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g94db_552a v10; - v13.i1 = lt v11 v2; - v14.i1 = is_zero v13; - br v14 block2 block3; - - block2: - jump block4; - - block3: - v17.*i8 = evm_malloc 64.i256; - v18.i256 = ptr_to_int v17 i256; - mstore v18 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v22.i256, v23.i1) = uaddo v18 32.i256; - br v23 block5 block6; - - block4: - v31.i256 = add v3 1.i256; - v35.@layout_22 = insert_value undef.@layout_22 0.i256 v0; - v36.@layout_22 = insert_value v35 1.i256 v1; - (v39.i256, v40.i1) = usubo v11 v2; - br v40 block5 block7; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - mstore v22 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v18 36.i256; - - block7: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g94db_2fc5 v31 v36 v39; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_4599(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_9f5e v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_af75(v0.@layout_22, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_2a19 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %storagemap_get_word_with_salt__g9379(v0.@layout_16, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g9379_8aa7 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_cb7c(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_664a v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_d4e7(v0.@layout_22, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_81f5 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_d4e7_0(v0.@layout_22, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_81f5_1 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %storagemap_set_word_with_salt__g9379(v0.@layout_16, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g9379_8aa7_0 v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_set_word_with_salt__g7bf4_4d42(v0.@layout_22, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_81f5 v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_set_word_with_salt__g7bf4_4d42_0(v0.@layout_22, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_81f5_0 v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %storagemap_set_word_with_salt__g67a8(v0.@layout_0, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_664a v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_2a19(v0.@layout_22, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_2c8a v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_664a(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_a18a v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_81f5(v0.@layout_22, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_8264 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_81f5_0(v0.@layout_22, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_8264_0 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_81f5_1(v0.@layout_22, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_8264_1 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g9379_8aa7(v0.@layout_16, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait____9761__write_key__g6d15_4da6 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g9379_8aa7_0(v0.@layout_16, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait____9761__write_key__g6d15_4da6_0 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_9f5e(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_3658 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_2361(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_2c7e(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_be96(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %core__lib__num__impl_trait_String_8f88__to_word__g3eb7_38b3(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v8.i256 = and v0 452312848583266388373324160190187140051835877600158453279131187530910662655.i256; - return v8; -} - -func private %core__lib__num__impl_trait_String_8f88__to_word__g3eb7_38b3_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v8.i256 = and v0 452312848583266388373324160190187140051835877600158453279131187530910662655.i256; - return v8; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_3a17(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %core__lib__num__impl_trait_String_8f88__to_word__g3eb7_4283(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v8.i256 = and v0 452312848583266388373324160190187140051835877600158453279131187530910662655.i256; - return v8; -} - -func private %core__lib__num__impl_trait_String_8f88__to_word__gc7cf_518a(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v7.i256 = and v0 18446744073709551615.i256; - return v7; -} - -func private %core__lib__num__impl_trait_String_8f88__to_word__gc7cf_518a_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v7.i256 = and v0 18446744073709551615.i256; - return v7; -} - -func private %impl_trait_bool__to_word(v0.i1) -> i256 { - block0: - jump block1; - - block1: - br v0 block2 block3; - - block2: - jump block4; - - block3: - jump block4; - - block4: - v4.i256 = phi (1.i256 block2) (0.i256 block3); - return v4; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_9907(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_9907_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %core__lib__num__impl_trait_String_8f88__to_word__gc7cf_de49(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v7.i256 = and v0 18446744073709551615.i256; - return v7; -} - -func private %standalone_erc20__erc20__transfer__gd6b1_17ee(v0.@layout_0, v1.@layout_0, v2.i256, v3.i256) { - block0: - v4.objref<@layout_0> = obj.alloc @layout_0; - v5.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v7.@layout_0 = call %zero; - v9.objref = obj.proj v4 0.i256; - v10.i256 = extract_value v7 0.i256; - obj.store v9 v10; - v11.@layout_0 = obj.load v4; - v12.i1 = call %ne v0 v11; - br v12 block2 block3; - - block2: - jump block4; - - block3: - v15.*i8 = evm_malloc 64.i256; - v16.i256 = ptr_to_int v15 i256; - mstore v16 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v20.i256, v21.i1) = uaddo v16 32.i256; - br v21 block11 block12; - - block4: - v29.@layout_0 = call %zero; - v30.objref = obj.proj v5 0.i256; - v31.i256 = extract_value v29 0.i256; - obj.store v30 v31; - v32.@layout_0 = obj.load v5; - v33.i1 = call %ne v1 v32; - br v33 block5 block6; - - block5: - jump block7; - - block6: - v34.*i8 = evm_malloc 64.i256; - v35.i256 = ptr_to_int v34 i256; - mstore v35 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v37.i256, v38.i1) = uaddo v35 32.i256; - br v38 block11 block13; - - block7: - v43.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_d67a v0; - v45.i1 = lt v43 v2; - v46.i1 = is_zero v45; - br v46 block8 block9; - - block8: - jump block10; - - block9: - v47.*i8 = evm_malloc 64.i256; - v48.i256 = ptr_to_int v47 i256; - mstore v48 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v50.i256, v51.i1) = uaddo v48 32.i256; - br v51 block11 block14; - - block10: - v57.i256 = add v3 1.i256; - (v61.i256, v62.i1) = usubo v43 v2; - br v62 block11 block15; - - block11: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block12: - mstore v20 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v16 36.i256; - - block13: - mstore v37 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v35 36.i256; - - block14: - mstore v50 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v48 36.i256; - - block15: - call %set__g636d v57 v0 v61; - v67.i256 = add v3 1.i256; - v69.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_d67a v1; - (v71.i256, v72.i1) = uaddo v69 v2; - br v72 block11 block16; - - block16: - call %set__g636d v67 v1 v71; - v80.@layout_20 = insert_value undef.@layout_20 0.i256 v0; - v81.@layout_20 = insert_value v80 1.i256 v1; - v83.@layout_20 = insert_value v81 2.i256 v2; - call %emit__g4c3d v83; - return; -} - -func private %standalone_erc20__erc20__transfer__gd6b1_d32a(v0.@layout_0, v1.@layout_0, v2.i256, v3.i256) { - block0: - v4.objref<@layout_0> = obj.alloc @layout_0; - v5.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v7.@layout_0 = call %zero; - v9.objref = obj.proj v4 0.i256; - v10.i256 = extract_value v7 0.i256; - obj.store v9 v10; - v11.@layout_0 = obj.load v4; - v12.i1 = call %ne v0 v11; - br v12 block2 block3; - - block2: - jump block4; - - block3: - v15.*i8 = evm_malloc 64.i256; - v16.i256 = ptr_to_int v15 i256; - mstore v16 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v20.i256, v21.i1) = uaddo v16 32.i256; - br v21 block11 block12; - - block4: - v29.@layout_0 = call %zero; - v30.objref = obj.proj v5 0.i256; - v31.i256 = extract_value v29 0.i256; - obj.store v30 v31; - v32.@layout_0 = obj.load v5; - v33.i1 = call %ne v1 v32; - br v33 block5 block6; - - block5: - jump block7; - - block6: - v34.*i8 = evm_malloc 64.i256; - v35.i256 = ptr_to_int v34 i256; - mstore v35 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v37.i256, v38.i1) = uaddo v35 32.i256; - br v38 block11 block13; - - block7: - v43.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_d67a v0; - v45.i1 = lt v43 v2; - v46.i1 = is_zero v45; - br v46 block8 block9; - - block8: - jump block10; - - block9: - v47.*i8 = evm_malloc 64.i256; - v48.i256 = ptr_to_int v47 i256; - mstore v48 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v50.i256, v51.i1) = uaddo v48 32.i256; - br v51 block11 block14; - - block10: - v57.i256 = add v3 1.i256; - (v61.i256, v62.i1) = usubo v43 v2; - br v62 block11 block15; - - block11: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block12: - mstore v20 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v16 36.i256; - - block13: - mstore v37 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v35 36.i256; - - block14: - mstore v50 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v48 36.i256; - - block15: - call %set__g636d v57 v0 v61; - v67.i256 = add v3 1.i256; - v69.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g636d_d67a v1; - (v71.i256, v72.i1) = uaddo v69 v2; - br v72 block11 block16; - - block16: - call %set__g636d v67 v1 v71; - v80.@layout_20 = insert_value undef.@layout_20 0.i256 v0; - v81.@layout_20 = insert_value v80 1.i256 v1; - v83.@layout_20 = insert_value v81 2.i256 v2; - call %emit__g4c3d v83; - return; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_0f5c(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_27ad(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3a1f(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3a1f_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3ba3(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3ba3_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3bad(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_3bad_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_40a0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_40a0_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_49c5(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_5ce9(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_6576(v0.objref<@layout_2>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_69bf(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_6dae(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_780b(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_790f(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_790f_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_7946(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7f19(v0.objref<@layout_2>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7f19_0(v0.objref<@layout_2>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_8736(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_8736_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_88a1(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9725(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9757(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_9757_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_a6b2(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_a6b2_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_a8d6(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_a8d6_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b461(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b461_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b705(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b705_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b870(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b9ca(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_b9ca_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_bae8(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_bae8_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c259(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c2d4(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c32c(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c700(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_c700_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_ce64(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_d831(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_d831_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_e134(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_e134_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_faf2(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_fb71(v0.objref<@layout_2>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_fdcb(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_fec2(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_fec2_0(v0.@layout_5, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_1cfc(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_98d1 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_2c8a(v0.i256, v1.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v5.@layout_0 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_1cfc v0 v5; - (v7.i256, v8.i1) = uaddo v0 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v15.@layout_0 = extract_value v1 1.i256; - v16.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_1cfc v7 v15; - (v18.i256, v19.i1) = uaddo v6 v16; - br v19 block2 block4; - - block4: - return v18; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_3658(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_e672 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_37f0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait____9761__write_key__g6d15_4da6(v0.i256, v1.@layout_16) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_67af v0 v5; - (v7.i256, v8.i1) = uaddo v0 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v15.@layout_0 = extract_value v1 1.i256; - v16.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_c339 v7 v15; - (v18.i256, v19.i1) = uaddo v6 v16; - br v19 block2 block4; - - block4: - return v18; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait____9761__write_key__g6d15_4da6_0(v0.i256, v1.@layout_16) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_67af_0 v0 v5; - (v7.i256, v8.i1) = uaddo v0 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v15.@layout_0 = extract_value v1 1.i256; - v16.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_c339_0 v7 v15; - (v18.i256, v19.i1) = uaddo v6 v16; - br v19 block2 block4; - - block4: - return v18; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_67af(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_67af_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_8264(v0.i256, v1.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v5.@layout_0 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_ba7e v0 v5; - (v7.i256, v8.i1) = uaddo v0 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v15.@layout_0 = extract_value v1 1.i256; - v16.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_ba7e v7 v15; - (v18.i256, v19.i1) = uaddo v6 v16; - br v19 block2 block4; - - block4: - return v18; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_8264_0(v0.i256, v1.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v5.@layout_0 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_ba7e_0 v0 v5; - (v7.i256, v8.i1) = uaddo v0 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v15.@layout_0 = extract_value v1 1.i256; - v16.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_ba7e_0 v7 v15; - (v18.i256, v19.i1) = uaddo v6 v16; - br v19 block2 block4; - - block4: - return v18; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_8264_1(v0.i256, v1.@layout_22) -> i256 { - block0: - jump block1; - - block1: - v5.@layout_0 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_ba7e_1 v0 v5; - (v7.i256, v8.i1) = uaddo v0 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v15.@layout_0 = extract_value v1 1.i256; - v16.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_ba7e_1 v7 v15; - (v18.i256, v19.i1) = uaddo v6 v16; - br v19 block2 block4; - - block4: - return v18; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_9337(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_9337_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_98d1(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_a18a(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_37f0 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_ba7e(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_fecd v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_ba7e_0(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_fecd_0 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_ba7e_1(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_fecd_1 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_c339(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_9337 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_c339_0(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_9337_0 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_e672(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_fecd(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_fecd_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_fecd_1(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_0617(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_124f(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_1ad1(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_406d(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_798d(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_7a95(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_7b53(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8eda(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8f67(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_aa60(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_at_7ecd(v0.objref<@layout_1>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - mstore v1 v2 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_at_e460(v0.objref<@layout_1>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - mstore v1 v2 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_d813(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_eba3(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %zero() -> @layout_0 { - block0: - jump block1; - - block1: - v1.constref<@layout_0> = const.ref $const_region_1; - v2.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v2 v1; - v3.@layout_0 = obj.load v2; - return v3; -} - - -object @CoolCoin { - section init { - entry %contract_init_root_CoolCoin; - embed .runtime as &CoolCoin_runtime; - } - section runtime { - entry %contract_runtime_root_CoolCoin; - data $const_region_0; - data $const_region_1; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/erc20_low_level.snap b/crates/codegen/tests/fixtures/sonatina_ir/erc20_low_level.snap deleted file mode 100644 index 38451d9cf2..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/erc20_low_level.snap +++ /dev/null @@ -1,1492 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/erc20_low_level.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; -type @layout_1 = {@layout_0, @layout_0}; - -global private const @layout_0 $const_region_0 = {0}; - -func private %abi_encode_string(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %mstore 0.i256 32.i256; - call %mstore 32.i256 v1; - call %mstore 64.i256 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_3b86 0.i256 96.i256; - unreachable; -} - -func private %abi_encode_u256(v0.i256) { - block0: - jump block1; - - block1: - call %mstore 0.i256 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_3b86 0.i256 32.i256; - unreachable; -} - -func private %allowance__geb89(v0.@layout_0, v1.@layout_0, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v7.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v9.@layout_1 = insert_value v7 1.i256 v1; - v10.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__ga15b_679e v9; - return v10; -} - -func private %allowance__g35d6(v0.i256, v1.@layout_0, v2.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v7.@layout_1 = insert_value undef.@layout_1 0.i256 v1; - v9.@layout_1 = insert_value v7 1.i256 v2; - v10.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__ga15b_bf76 v9; - return v10; -} - -func private %approve__gb6ca(v0.@layout_0, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v4.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_8a6b; - call %approve__g35d6 v2 v4 v0 v1; - return 1.i256; -} - -func private %approve__g35d6(v0.i256, v1.@layout_0, v2.@layout_0, v3.i256) { - block0: - jump block1; - - block1: - v9.@layout_1 = insert_value undef.@layout_1 0.i256 v1; - v11.@layout_1 = insert_value v9 1.i256 v2; - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__ga15b_5971 v0 v11 v3; - return; -} - -func private %balance_of__geb89(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g2163_e6b0 v0; - return v3; -} - -func private %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_d3f5(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g2163_2521 v1; - return v3; -} - -func private %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_d3f5_0(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g2163_2521_0 v1; - return v3; -} - -func private %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_d3f5_1(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g2163_2521_1 v1; - return v3; -} - -func private %calldataload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_8a6b() -> @layout_0 { - block0: - jump block1; - - block1: - v0.i256 = evm_caller; - v3.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - return v3; -} - -func private %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_c33e() -> @layout_0 { - block0: - jump block1; - - block1: - v0.i256 = evm_caller; - v3.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - return v3; -} - -func private %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_c33e_0() -> @layout_0 { - block0: - jump block1; - - block1: - v0.i256 = evm_caller; - v3.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - return v3; -} - -func private %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_c33e_1() -> @layout_0 { - block0: - jump block1; - - block1: - v0.i256 = evm_caller; - v3.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - return v3; -} - -func private %codecopy(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_code_copy v0 v1 v2; - return; -} - -func private %do_init(v0.i256) { - block0: - jump block1; - - block1: - v2.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_c33e_0; - call %set_owner_once v0 v2; - return; -} - -func private %std__lib__evm__effects__impl_trait_Address_3ffb__eq_3b13(v0.i256, v1.@layout_0) -> i1 { - block0: - jump block1; - - block1: - v3.i256 = evm_sload v0; - v6.i256 = extract_value v1 0.i256; - v7.i1 = eq v3 v6; - return v7; -} - -func private %std__lib__evm__effects__impl_trait_Address_3ffb__eq_fb60(v0.@layout_0, v1.i256) -> i1 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = evm_sload v1; - v7.i1 = eq v4 v6; - return v7; -} - -func private %core__lib__effect_ref__impl_trait_StorPtr_27da__from_raw__gb51e_866d(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %core__lib__effect_ref__impl_trait_StorPtr_27da__from_raw__gb51e_866d_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_09f5(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_3cf5(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_51d4(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_51d4_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_51d4_1(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_89ed(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g2163_2521(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g2163_cd4e v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g2163_2521_0(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g2163_cd4e_0 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g2163_2521_1(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g2163_cd4e_1 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__ga15b_679e(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__ga15b_c992 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__ga15b_bf76(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__ga15b_60b3 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__g2163_e6b0(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g2163_1022 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g2163_1022(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_bfbb v0 0.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_3cf5 v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__ga15b_60b3(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_df22 v0 1.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_89ed v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__ga15b_c992(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_fdb1 v0 1.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_09f5 v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g2163_cd4e(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_71c2 v0 0.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_51d4 v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g2163_cd4e_0(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_71c2_0 v0 0.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_51d4_0 v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__g2163_cd4e_1(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_71c2_1 v0 0.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_51d4_1 v3; - return v4; -} - -func private %init() { - block0: - jump block1; - - block1: - v1.i256 = call %std__lib__evm__effects__trait_RawStorage__stor_ptr__g3730_6bd4_0 0.i256; - call %do_init v1; - v3.i256 = sym_size &__Erc20Contract_runtime; - v4.i256 = sym_addr &__Erc20Contract_runtime; - v5.*i8 = evm_malloc v3; - v6.i256 = ptr_to_int v5 i256; - call %codecopy v6 v4 v3; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_0402 v6 v3; - unreachable; -} - -func private %manual_contract_init_root_Erc20Contract() { - block0: - jump block1; - - block1: - call %init; - evm_stop; -} - -func private %manual_contract_runtime_root_Erc20Contract() { - block0: - jump block1; - - block1: - call %runtime; - evm_stop; -} - -func private %mint__gd1d8(v0.@layout_0, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - call %mint__g0502 v2 v0 v1; - return 1.i256; -} - -func private %mint__g0502(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - v3.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_c33e_1; - v6.i256 = add v0 1.i256; - v7.i1 = call %core__lib__ops__trait_Eq__ne__g7528_7551 v3 v6; - br v7 block2 block3; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_aec5 0.i256 0.i256; - unreachable; - - block3: - jump block4; - - block4: - v11.i256 = call %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_d3f5 v0 v1; - (v13.i256, v14.i1) = uaddo v11 v2; - br v14 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_e08a v0 v1 v13; - v23.i256 = evm_sload v0; - (v25.i256, v26.i1) = uaddo v23 v2; - br v26 block5 block7; - - block7: - evm_sstore v0 v25; - return; -} - -func private %mstore(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %core__lib__ops__trait_Eq__ne__g7528_324d(v0.i256, v1.@layout_0) -> i1 { - block0: - jump block1; - - block1: - v4.i1 = call %std__lib__evm__effects__impl_trait_Address_3ffb__eq_3b13 v0 v1; - v5.i1 = is_zero v4; - return v5; -} - -func private %core__lib__ops__trait_Eq__ne__g7528_7551(v0.@layout_0, v1.i256) -> i1 { - block0: - jump block1; - - block1: - v4.i1 = call %std__lib__evm__effects__impl_trait_Address_3ffb__eq_fb60 v0 v1; - v5.i1 = is_zero v4; - return v5; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_0402(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_3b86(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_61f0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_aec5(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_aec5_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_aec5_1(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_aec5_2(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %runtime() { - block0: - jump block1; - - block1: - v1.i256 = call %std__lib__evm__effects__trait_RawStorage__stor_ptr__g3730_6bd4 0.i256; - v2.i256 = call %calldataload 0.i256; - v4.i256 = shr 224.i256 v2; - v6.i1 = eq v4 1889567281.i256; - br v6 block2 block12; - - block2: - v8.i256 = call %calldataload 4.i256; - v10.@layout_0 = insert_value undef.@layout_0 0.i256 v8; - v12.i256 = call %balance_of__geb89 v10 v1; - call %abi_encode_u256 v12; - unreachable; - - block3: - v13.i256 = call %calldataload 4.i256; - v15.@layout_0 = insert_value undef.@layout_0 0.i256 v13; - v17.i256 = call %calldataload 36.i256; - v19.@layout_0 = insert_value undef.@layout_0 0.i256 v17; - v21.i256 = call %allowance__geb89 v15 v19 v1; - call %abi_encode_u256 v21; - unreachable; - - block4: - call %abi_encode_string 31840933704928615426292613906591192052886564858731089189578963311002547912704.i256 7.i256; - unreachable; - - block5: - call %abi_encode_string 31784391594991486112232083260356792451358613714049171750120207607087736291328.i256 3.i256; - unreachable; - - block6: - call %abi_encode_u256 18.i256; - unreachable; - - block7: - v27.i256 = call %calldataload 4.i256; - v29.@layout_0 = insert_value undef.@layout_0 0.i256 v27; - v30.i256 = call %calldataload 36.i256; - v32.i256 = call %transfer__gd1d8 v29 v30 v1; - call %abi_encode_u256 v32; - unreachable; - - block8: - v33.i256 = call %calldataload 4.i256; - v35.@layout_0 = insert_value undef.@layout_0 0.i256 v33; - v36.i256 = call %calldataload 36.i256; - v38.i256 = call %approve__gb6ca v35 v36 v1; - call %abi_encode_u256 v38; - unreachable; - - block9: - v39.i256 = call %calldataload 4.i256; - v41.@layout_0 = insert_value undef.@layout_0 0.i256 v39; - v42.i256 = call %calldataload 36.i256; - v44.@layout_0 = insert_value undef.@layout_0 0.i256 v42; - v46.i256 = call %calldataload 68.i256; - v48.i256 = call %transfer_from__gd1d8 v41 v44 v46 v1; - call %abi_encode_u256 v48; - unreachable; - - block10: - v49.i256 = call %calldataload 4.i256; - v51.@layout_0 = insert_value undef.@layout_0 0.i256 v49; - v52.i256 = call %calldataload 36.i256; - v54.i256 = call %mint__gd1d8 v51 v52 v1; - call %abi_encode_u256 v54; - unreachable; - - block11: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_61f0 0.i256 0.i256; - unreachable; - - block12: - v57.i1 = eq v4 3714247998.i256; - br v57 block3 block13; - - block13: - v60.i1 = eq v4 117300739.i256; - br v60 block4 block14; - - block14: - v63.i1 = eq v4 2514000705.i256; - br v63 block5 block15; - - block15: - v66.i1 = eq v4 826074471.i256; - br v66 block6 block16; - - block16: - v69.i1 = eq v4 2835717307.i256; - br v69 block7 block17; - - block17: - v72.i1 = eq v4 157198259.i256; - br v72 block8 block18; - - block18: - v75.i1 = eq v4 599290589.i256; - br v75 block9 block19; - - block19: - v78.i1 = eq v4 1086394137.i256; - br v78 block10 block20; - - block20: - jump block11; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set__ga15b_005d(v0.i256, v1.@layout_1, v2.i256) { - block0: - jump block1; - - block1: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__ga15b_7d9b v0 v1 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set__ga15b_5971(v0.i256, v1.@layout_1, v2.i256) { - block0: - jump block1; - - block1: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__ga15b_4ca5 v0 v1 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_e08a(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g2163_ef16 v0 v1 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_e08a_0(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g2163_ef16_0 v0 v1 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_e08a_1(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g2163_ef16_1 v0 v1 v2; - return; -} - -func private %set_owner_once(v0.i256, v1.@layout_0) { - block0: - v2.objref<@layout_0> = obj.alloc @layout_0; - jump block1; - - block1: - v5.i256 = add v0 1.i256; - v7.i256 = evm_sload v5; - v9.@layout_0 = insert_value undef.@layout_0 0.i256 v7; - v10.@layout_0 = call %zero; - v11.objref = obj.proj v2 0.i256; - v12.i256 = extract_value v10 0.i256; - obj.store v11 v12; - v13.i256 = add v0 1.i256; - v14.@layout_0 = obj.load v2; - v15.i1 = call %core__lib__ops__trait_Eq__ne__g7528_324d v13 v14; - br v15 block2 block3; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_aec5_1 0.i256 0.i256; - unreachable; - - block3: - jump block4; - - block4: - v18.i256 = add v0 1.i256; - v19.i256 = extract_value v1 0.i256; - evm_sstore v18 v19; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__ga15b_4ca5(v0.i256, v1.@layout_1, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_b350 v2; - call %std__lib__evm__storage_map__storagemap_set_word_with_salt__g7bf4_f41c v1 1.i256 v5; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__ga15b_7d9b(v0.i256, v1.@layout_1, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_c57e v2; - call %std__lib__evm__storage_map__storagemap_set_word_with_salt__g7bf4_84d2 v1 1.i256 v5; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g2163_ef16(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_fb94 v2; - call %std__lib__evm__storage_map__storagemap_set_word_with_salt__g67a8_1609 v1 0.i256 v5; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g2163_ef16_0(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_fb94_0 v2; - call %std__lib__evm__storage_map__storagemap_set_word_with_salt__g67a8_1609_0 v1 0.i256 v5; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__set_unchecked__g2163_ef16_1(v0.i256, v1.@layout_0, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_fb94_1 v2; - call %std__lib__evm__storage_map__storagemap_set_word_with_salt__g67a8_1609_1 v1 0.i256 v5; - return; -} - -func private %std__lib__evm__effects__trait_RawStorage__stor_ptr__g3730_6bd4(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__effect_ref__impl_trait_StorPtr_27da__from_raw__gb51e_866d v0; - return v2; -} - -func private %std__lib__evm__effects__trait_RawStorage__stor_ptr__g3730_6bd4_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__effect_ref__impl_trait_StorPtr_27da__from_raw__gb51e_866d_0 v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_71c2(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_501d v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_71c2_0(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_501d_0 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_71c2_1(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_501d_1 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g67a8_bfbb(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_e7af v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_df22(v0.@layout_1, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_a633 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__g7bf4_fdb1(v0.@layout_1, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_d8a5 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_set_word_with_salt__g67a8_1609(v0.@layout_0, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_501d v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_set_word_with_salt__g67a8_1609_0(v0.@layout_0, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_501d_0 v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_set_word_with_salt__g67a8_1609_1(v0.@layout_0, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_501d_1 v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_set_word_with_salt__g7bf4_84d2(v0.@layout_1, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_a633 v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_set_word_with_salt__g7bf4_f41c(v0.@layout_1, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_288a v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_288a(v0.@layout_1, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_9295 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_501d(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_5efc v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_501d_0(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_5efc_0 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_501d_1(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_5efc_1 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_a633(v0.@layout_1, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_2879 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g7bf4_d8a5(v0.@layout_1, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_d74c v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__g67a8_e7af(v0.@layout_0, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_72b5 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_b350(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_c57e(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_fb94(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_fb94_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_fb94_1(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %transfer__gd1d8(v0.@layout_0, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v4.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_c33e; - call %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__transfer__g0f37_dd4a v2 v4 v0 v1; - return 1.i256; -} - -func private %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__transfer__g0f37_dd4a(v0.i256, v1.@layout_0, v2.@layout_0, v3.i256) { - block0: - jump block1; - - block1: - v6.i256 = call %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_d3f5_0 v0 v1; - v8.i1 = lt v6 v3; - br v8 block2 block3; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_aec5_0 0.i256 0.i256; - unreachable; - - block3: - jump block4; - - block4: - v12.i256 = call %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_d3f5_0 v0 v2; - (v16.i256, v17.i1) = usubo v6 v3; - br v17 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_e08a_0 v0 v1 v16; - (v29.i256, v30.i1) = uaddo v12 v3; - br v30 block5 block7; - - block7: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_e08a_0 v0 v2 v29; - return; -} - -func private %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__transfer__g0f37_dd4a_0(v0.i256, v1.@layout_0, v2.@layout_0, v3.i256) { - block0: - jump block1; - - block1: - v6.i256 = call %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_d3f5_1 v0 v1; - v8.i1 = lt v6 v3; - br v8 block2 block3; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_aec5_2 0.i256 0.i256; - unreachable; - - block3: - jump block4; - - block4: - v12.i256 = call %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_d3f5_1 v0 v2; - (v16.i256, v17.i1) = usubo v6 v3; - br v17 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_e08a_1 v0 v1 v16; - (v29.i256, v30.i1) = uaddo v12 v3; - br v30 block5 block7; - - block7: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_e08a_1 v0 v2 v29; - return; -} - -func private %transfer_from__gd1d8(v0.@layout_0, v1.@layout_0, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - call %transfer_from__g0502 v3 v0 v1 v2; - return 1.i256; -} - -func private %transfer_from__g0502(v0.i256, v1.@layout_0, v2.@layout_0, v3.i256) { - block0: - jump block1; - - block1: - v4.@layout_0 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_c33e_1; - v7.i256 = call %allowance__g35d6 v0 v1 v4; - v9.i1 = lt v7 v3; - br v9 block2 block3; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_aec5 0.i256 0.i256; - unreachable; - - block3: - jump block4; - - block4: - call %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__transfer__g0f37_dd4a_0 v0 v1 v2 v3; - v17.@layout_1 = insert_value undef.@layout_1 0.i256 v1; - v20.@layout_1 = insert_value v17 1.i256 v4; - (v22.i256, v23.i1) = usubo v7 v3; - br v23 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__ga15b_005d v0 v20 v22; - return; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_1ccc(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_a6f4 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_2879(v0.i256, v1.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v5.@layout_0 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_b135 v0 v5; - (v7.i256, v8.i1) = uaddo v0 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v15.@layout_0 = extract_value v1 1.i256; - v16.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_b135 v7 v15; - (v18.i256, v19.i1) = uaddo v6 v16; - br v19 block2 block4; - - block4: - return v18; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_4327(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_5efc(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_7bb3 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_5efc_0(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_7bb3_0 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_5efc_1(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_7bb3_1 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_72b5(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_f2a4 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_7bb3(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_7bb3_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_7bb3_1(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_7d35(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_8589(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_7d35 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_9295(v0.i256, v1.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v5.@layout_0 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_8589 v0 v5; - (v7.i256, v8.i1) = uaddo v0 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v15.@layout_0 = extract_value v1 1.i256; - v16.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_8589 v7 v15; - (v18.i256, v19.i1) = uaddo v6 v16; - br v19 block2 block4; - - block4: - return v18; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_a6f4(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_b135(v0.i256, v1.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_4327 v0 v5; - return v6; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait____9761__write_key__g7528_d74c(v0.i256, v1.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v5.@layout_0 = extract_value v1 0.i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_1ccc v0 v5; - (v7.i256, v8.i1) = uaddo v0 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v15.@layout_0 = extract_value v1 1.i256; - v16.i256 = call %std__lib__evm__storage_map__impl_trait_Address_4d4e__write_key_1ccc v7 v15; - (v18.i256, v19.i1) = uaddo v6 v16; - br v19 block2 block4; - - block4: - return v18; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_f2a4(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func private %zero() -> @layout_0 { - block0: - jump block1; - - block1: - v1.constref<@layout_0> = const.ref $const_region_0; - v2.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v2 v1; - v3.@layout_0 = obj.load v2; - return v3; -} - - -object @Erc20Contract { - section init { - entry %manual_contract_init_root_Erc20Contract; - embed .runtime as &__Erc20Contract_runtime; - } - section runtime { - entry %manual_contract_runtime_root_Erc20Contract; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/event_logging.snap b/crates/codegen/tests/fixtures/sonatina_ir/event_logging.snap deleted file mode 100644 index d01682614b..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/event_logging.snap +++ /dev/null @@ -1,215 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/event_logging.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; -type @layout_1 = {i256, i256}; -type @layout_2 = {@layout_0, @layout_0, i256}; -type @layout_3 = {i256, i256}; - -global private const @layout_0 $const_region_0 = {1}; -global private const @layout_0 $const_region_1 = {2}; - -func private %abi_payload_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %payload_size v0; - return v2; -} - -func private %as_topic(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = extract_value v0 0.i256; - return v3; -} - -func inline(always) private %at(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %emit(v0.@layout_2) { - block0: - jump block1; - - block1: - v3.i256 = extract_value v0 2.i256; - v4.@layout_3 = call %encode_abi_payload v3; - v6.i256 = extract_value v4 0.i256; - v8.i256 = extract_value v4 1.i256; - v10.@layout_0 = extract_value v0 0.i256; - v11.i256 = call %as_topic v10; - v12.@layout_0 = extract_value v0 1.i256; - v13.i256 = call %as_topic v12; - call %log3 v6 v8 -15402802100530019096323380498944738953123845089667699673314898783681816316945.i256 v11 v13; - return; -} - -func private %emit_transfer(v0.constref<@layout_0>, v1.constref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - v6.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v6 v0; - v7.@layout_0 = obj.load v6; - v8.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v8 v1; - v9.@layout_0 = obj.load v8; - v12.@layout_2 = insert_value undef.@layout_2 0.i256 v7; - v14.@layout_2 = insert_value v12 1.i256 v9; - v16.@layout_2 = insert_value v14 2.i256 v2; - call %emit v16; - return; -} - -func private %encode(v0.i256, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - call %write_word v1 v0; - return; -} - -func private %encode_abi_payload(v0.i256) -> @layout_3 { - block0: - jump block1; - - block1: - v2.@layout_3 = call %encode_alloc v0; - return v2; -} - -func inline(always) private %encode_alloc(v0.i256) -> @layout_3 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_payload_size v0; - v3.@layout_1 = call %encoder_new v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %base v4; - call %encode v0 v4; - v14.@layout_3 = insert_value undef.@layout_3 0.i256 v11; - v15.@layout_3 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encoder_new(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %new v0; - return v2; -} - -func private %log3(v0.i256, v1.i256, v2.i256, v3.i256, v4.i256) { - block0: - jump block1; - - block1: - evm_log3 v0 v1 v2 v3 v4; - return; -} - -func private %main() { - block0: - jump block1; - - block1: - v1.constref<@layout_0> = const.ref $const_region_0; - v3.constref<@layout_0> = const.ref $const_region_1; - call %emit_transfer v1 v3 100.i256; - return; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %main; - evm_stop; -} - -func private %new(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %at v7; - return v8; -} - -func private %payload_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %write_word(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/event_logging_via_log.snap b/crates/codegen/tests/fixtures/sonatina_ir/event_logging_via_log.snap deleted file mode 100644 index b655442c50..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/event_logging_via_log.snap +++ /dev/null @@ -1,224 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/event_logging_via_log.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; -type @layout_1 = {i256, i256}; -type @layout_2 = {@layout_0, @layout_0, i256}; -type @layout_3 = {i256, i256}; - -global private const @layout_0 $const_region_0 = {1}; -global private const @layout_0 $const_region_1 = {2}; - -func private %abi_payload_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %payload_size v0; - return v2; -} - -func private %as_topic(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = extract_value v0 0.i256; - return v3; -} - -func inline(always) private %at(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %emit__g4f95(v0.@layout_2) { - block0: - jump block1; - - block1: - call %emit__gcd5c v0; - return; -} - -func inline(always) private %emit__gcd5c(v0.@layout_2) { - block0: - jump block1; - - block1: - v3.i256 = extract_value v0 2.i256; - v4.@layout_3 = call %encode_abi_payload v3; - v6.i256 = extract_value v4 0.i256; - v8.i256 = extract_value v4 1.i256; - v10.@layout_0 = extract_value v0 0.i256; - v11.i256 = call %as_topic v10; - v12.@layout_0 = extract_value v0 1.i256; - v13.i256 = call %as_topic v12; - call %log3 v6 v8 -15402802100530019096323380498944738953123845089667699673314898783681816316945.i256 v11 v13; - return; -} - -func private %emit_transfer(v0.constref<@layout_0>, v1.constref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - v6.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v6 v0; - v7.@layout_0 = obj.load v6; - v8.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v8 v1; - v9.@layout_0 = obj.load v8; - v12.@layout_2 = insert_value undef.@layout_2 0.i256 v7; - v14.@layout_2 = insert_value v12 1.i256 v9; - v16.@layout_2 = insert_value v14 2.i256 v2; - call %emit__g4f95 v16; - return; -} - -func private %encode(v0.i256, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - call %write_word v1 v0; - return; -} - -func private %encode_abi_payload(v0.i256) -> @layout_3 { - block0: - jump block1; - - block1: - v2.@layout_3 = call %encode_alloc v0; - return v2; -} - -func inline(always) private %encode_alloc(v0.i256) -> @layout_3 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_payload_size v0; - v3.@layout_1 = call %encoder_new v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %base v4; - call %encode v0 v4; - v14.@layout_3 = insert_value undef.@layout_3 0.i256 v11; - v15.@layout_3 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encoder_new(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %new v0; - return v2; -} - -func private %log3(v0.i256, v1.i256, v2.i256, v3.i256, v4.i256) { - block0: - jump block1; - - block1: - evm_log3 v0 v1 v2 v3 v4; - return; -} - -func private %main() { - block0: - jump block1; - - block1: - v1.constref<@layout_0> = const.ref $const_region_0; - v3.constref<@layout_0> = const.ref $const_region_1; - call %emit_transfer v1 v3 100.i256; - return; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %main; - evm_stop; -} - -func private %new(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %at v7; - return v8; -} - -func private %payload_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %write_word(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/explicit_raw_boundaries.snap b/crates/codegen/tests/fixtures/sonatina_ir/explicit_raw_boundaries.snap deleted file mode 100644 index 3bb867f0b4..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/explicit_raw_boundaries.snap +++ /dev/null @@ -1,141 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/explicit_raw_boundaries.fe ---- -target = "evm-ethereum-osaka" - -func private %bump(v0.i256) { - block0: - jump block1; - - block1: - v3.i256 = mload v0 i256; - (v4.i256, v5.i1) = uaddo v3 1.i256; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v0 v4 i256; - return; -} - -func private %explicit_raw_boundaries() { - block0: - jump block1; - - block1: - v1.i256 = call %mem_ptr__g8840 256.i256; - call %bump v1; - v4.i256 = call %mem_ptr__g9700 288.i256; - call %raw_store__gc18b v4; - return; -} - -func private %from_raw__g4a95(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %from_raw__ge513(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %explicit_raw_boundaries; - evm_stop; -} - -func private %mem_ptr__g9700(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %from_raw__g4a95 v0; - return v2; -} - -func private %mem_ptr__g8840(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %from_raw__ge513 v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_d0d8__mstore_c9f4(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_d0d8__mstore_c9f4_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %core__lib__effect_ref__impl_trait_MemPtr_ec03__raw__g4a95_c621(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %core__lib__effect_ref__impl_trait_MemPtr_ec03__raw__g4a95_c621_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %raw_store__gc18b(v0.i256) { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__effect_ref__impl_trait_MemPtr_ec03__raw__g4a95_c621_0 v0; - call %std__lib__evm__effects__impl_trait_Evm_d0d8__mstore_c9f4_0 v2 8.i256; - return; -} - -func private %raw_store__g64c6(v0.i256) { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__effect_ref__impl_trait_MemPtr_ec03__raw__g4a95_c621 v0; - call %std__lib__evm__effects__impl_trait_Evm_d0d8__mstore_c9f4 v2 8.i256; - return; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/for_array.snap b/crates/codegen/tests/fixtures/sonatina_ir/for_array.snap deleted file mode 100644 index 64be7e57a5..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/for_array.snap +++ /dev/null @@ -1,87 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/for_array.fe ---- -target = "evm-ethereum-osaka" - -global private const [i64; 25] $const_region_0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]; - -func private %for_array_sum() -> i64 { - block0: - jump block1; - - block1: - v25.constref<[i64; 25]> = const.ref $const_region_0; - v26.constref<[i64; 25]> = const.ref $const_region_0; - v29.i256 = call %len v26; - jump block2; - - block2: - v51.i64 = phi (0.i64 block1) (v37 block7); - v30.i256 = phi (0.i256 block1) (v45 block7); - v32.i1 = lt v30 v29; - br v32 block3 block4; - - block3: - v35.i64 = call %get v26 v30; - (v37.i64, v38.i1) = uaddo v51 v35; - br v38 block5 block6; - - block4: - return v51; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - (v45.i256, v46.i1) = uaddo v30 1.i256; - br v46 block5 block7; - - block7: - jump block2; -} - -func private %get(v0.constref<[i64; 25]>, v1.i256) -> i64 { - block0: - jump block1; - - block1: - v5.i1 = lt v1 25.i256; - v6.i1 = is_zero v5; - br v6 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v8.constref = const.index v0 v1; - v9.i64 = const.load v8; - return v9; -} - -func private %len(v0.constref<[i64; 25]>) -> i256 { - block0: - jump block1; - - block1: - return 25.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %for_array_sum; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/for_array_large.snap b/crates/codegen/tests/fixtures/sonatina_ir/for_array_large.snap deleted file mode 100644 index 0aeed98ba0..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/for_array_large.snap +++ /dev/null @@ -1,87 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/for_array_large.fe ---- -target = "evm-ethereum-osaka" - -global private const [i64; 10] $const_region_0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; - -func private %for_array_large_sum() -> i64 { - block0: - jump block1; - - block1: - v10.constref<[i64; 10]> = const.ref $const_region_0; - v11.constref<[i64; 10]> = const.ref $const_region_0; - v14.i256 = call %len v11; - jump block2; - - block2: - v36.i64 = phi (0.i64 block1) (v22 block7); - v15.i256 = phi (0.i256 block1) (v30 block7); - v17.i1 = lt v15 v14; - br v17 block3 block4; - - block3: - v20.i64 = call %get v11 v15; - (v22.i64, v23.i1) = uaddo v36 v20; - br v23 block5 block6; - - block4: - return v36; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - (v30.i256, v31.i1) = uaddo v15 1.i256; - br v31 block5 block7; - - block7: - jump block2; -} - -func private %get(v0.constref<[i64; 10]>, v1.i256) -> i64 { - block0: - jump block1; - - block1: - v5.i1 = lt v1 10.i256; - v6.i1 = is_zero v5; - br v6 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v8.constref = const.index v0 v1; - v9.i64 = const.load v8; - return v9; -} - -func private %len(v0.constref<[i64; 10]>) -> i256 { - block0: - jump block1; - - block1: - return 10.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %for_array_large_sum; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/for_range.snap b/crates/codegen/tests/fixtures/sonatina_ir/for_range.snap deleted file mode 100644 index 24789f717c..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/for_range.snap +++ /dev/null @@ -1,117 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/for_range.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; - -global private const @layout_0 $const_region_0 = {0, 10}; - -func private %for_range_sum() -> i256 { - block0: - jump block1; - - block1: - v2.constref<@layout_0> = const.ref $const_region_0; - v3.i256 = call %len v2; - jump block2; - - block2: - v25.i256 = phi (0.i256 block1) (v11 block7); - v4.i256 = phi (0.i256 block1) (v19 block7); - v6.i1 = lt v4 v3; - br v6 block3 block4; - - block3: - v9.i256 = call %get v2 v4; - (v11.i256, v12.i1) = uaddo v25 v9; - br v12 block5 block6; - - block4: - return v25; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - (v19.i256, v20.i1) = uaddo v4 1.i256; - br v20 block5 block7; - - block7: - jump block2; -} - -func private %get(v0.constref<@layout_0>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.constref = const.proj v0 0.i256; - v5.i256 = const.load v4; - (v7.i256, v8.i1) = uaddo v5 v1; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v7; -} - -func private %len(v0.constref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 1.i256; - v4.i256 = const.load v3; - v6.constref = const.proj v0 0.i256; - v7.i256 = const.load v6; - v8.i1 = lt v4 v7; - br v8 block2 block3; - - block2: - jump block4; - - block3: - v10.constref = const.proj v0 1.i256; - v11.i256 = const.load v10; - v12.constref = const.proj v0 0.i256; - v13.i256 = const.load v12; - (v14.i256, v15.i1) = usubo v11 v13; - br v15 block5 block6; - - block4: - v20.i256 = phi (0.i256 block2) (v14 block6); - return v20; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %for_range_sum; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/full_contract.snap b/crates/codegen/tests/fixtures/sonatina_ir/full_contract.snap deleted file mode 100644 index 76c6726509..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/full_contract.snap +++ /dev/null @@ -1,234 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/full_contract.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; -type @layout_1 = {i256, i256}; - -func private %abi_encode(v0.i256) { - block0: - jump block1; - - block1: - call %mstore 0.i256 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_b74b 0.i256 32.i256; - unreachable; -} - -func private %impl_Square__area(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - (v5.i256, v6.i1) = umulo v4 v4; - br v6 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v5; -} - -func private %impl_Point__area(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - v6.objref = obj.proj v0 1.i256; - v7.i256 = obj.load v6; - (v8.i256, v9.i1) = umulo v4 v7; - br v9 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v8; -} - -func private %calldataload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %codecopy(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_code_copy v0 v1 v2; - return; -} - -func private %dispatch() { - block0: - jump block1; - - block1: - v1.i256 = call %calldataload 0.i256; - v3.i256 = shr 224.i256 v1; - v5.i1 = eq v3 151146943.i256; - br v5 block2 block3; - - block2: - v7.i256 = call %calldataload 4.i256; - v9.i256 = call %calldataload 36.i256; - v11.@layout_1 = insert_value undef.@layout_1 0.i256 v7; - v13.@layout_1 = insert_value v11 1.i256 v9; - v14.objref<@layout_1> = obj.alloc @layout_1; - v15.objref = obj.proj v14 0.i256; - v16.i256 = extract_value v13 0.i256; - obj.store v15 v16; - v17.objref = obj.proj v14 1.i256; - v18.i256 = extract_value v13 1.i256; - obj.store v17 v18; - v19.objref = obj.proj v14 0.i256; - v20.i256 = obj.load v19; - (v21.i256, v22.i1) = uaddo v20 1.i256; - br v22 block8 block9; - - block3: - jump block4; - - block4: - v37.i1 = eq v3 2066295049.i256; - br v37 block5 block6; - - block5: - v38.i256 = call %calldataload 4.i256; - v40.@layout_0 = insert_value undef.@layout_0 0.i256 v38; - v41.objref<@layout_0> = obj.alloc @layout_0; - v42.objref = obj.proj v41 0.i256; - v43.i256 = extract_value v40 0.i256; - obj.store v42 v43; - v44.objref = obj.proj v41 0.i256; - v45.i256 = obj.load v44; - (v47.i256, v48.i1) = uaddo v45 3.i256; - br v48 block8 block11; - - block6: - jump block7; - - block7: - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_b16a 0.i256 0.i256; - unreachable; - - block8: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block9: - v26.objref = obj.proj v14 0.i256; - obj.store v26 v21; - v27.objref = obj.proj v14 1.i256; - v28.i256 = obj.load v27; - (v30.i256, v31.i1) = uaddo v28 2.i256; - br v31 block8 block10; - - block10: - v33.objref = obj.proj v14 1.i256; - obj.store v33 v30; - v34.i256 = call %impl_Point__area v14; - call %abi_encode v34; - unreachable; - - block11: - v50.objref = obj.proj v41 0.i256; - obj.store v50 v47; - v51.i256 = call %impl_Square__area v41; - call %abi_encode v51; - unreachable; -} - -func private %init() { - block0: - jump block1; - - block1: - v0.i256 = sym_size &__ShapeDispatcher_runtime; - v1.i256 = sym_addr &__ShapeDispatcher_runtime; - v2.*i8 = evm_malloc v0; - v3.i256 = ptr_to_int v2 i256; - call %codecopy v3 v1 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_b16a_0 v3 v0; - unreachable; -} - -func private %manual_contract_init_root_ShapeDispatcher() { - block0: - jump block1; - - block1: - call %init; - evm_stop; -} - -func private %manual_contract_runtime_root_ShapeDispatcher() { - block0: - jump block1; - - block1: - call %dispatch; - evm_stop; -} - -func private %mstore(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_b16a(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_b16a_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_b74b(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - - -object @ShapeDispatcher { - section init { - entry %manual_contract_init_root_ShapeDispatcher; - embed .runtime as &__ShapeDispatcher_runtime; - } - section runtime { - entry %manual_contract_runtime_root_ShapeDispatcher; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/function_call.snap b/crates/codegen/tests/fixtures/sonatina_ir/function_call.snap deleted file mode 100644 index 8f824a5659..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/function_call.snap +++ /dev/null @@ -1,48 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/function_call.fe ---- -target = "evm-ethereum-osaka" - -func private %add_one(v0.i64) -> i64 { - block0: - jump block1; - - block1: - (v3.i64, v4.i1) = uaddo v0 1.i64; - br v4 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v3; -} - -func private %call_add_one() -> i64 { - block0: - jump block1; - - block1: - v1.i64 = call %add_one 5.i64; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %call_add_one; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/generic_identity.snap b/crates/codegen/tests/fixtures/sonatina_ir/generic_identity.snap deleted file mode 100644 index c2216614f7..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/generic_identity.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/generic_identity.fe ---- -target = "evm-ethereum-osaka" - -func private %call_identity_bool() -> i1 { - block0: - jump block1; - - block1: - v1.i1 = call %identity__gda9b 1.i1; - return v1; -} - -func private %call_identity_u32() -> i32 { - block0: - jump block1; - - block1: - v1.i32 = call %identity__g6338 7.i32; - return v1; -} - -func private %identity__g6338(v0.i32) -> i32 { - block0: - jump block1; - - block1: - return v0; -} - -func private %identity__gda9b(v0.i1) -> i1 { - block0: - jump block1; - - block1: - return v0; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i1 = call %call_identity_bool; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/high_level_contract.snap b/crates/codegen/tests/fixtures/sonatina_ir/high_level_contract.snap deleted file mode 100644 index bc80be603d..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/high_level_contract.snap +++ /dev/null @@ -1,1404 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/high_level_contract.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256, i256}; -type @layout_2 = {@layout_1, i256}; -type @layout_3 = {@layout_2, i256}; -type @layout_4 = {i256}; -type @layout_5 = {i256}; -type @layout_6 = {i256, i256}; -type @layout_7 = {}; -type @layout_8 = {@layout_7}; - -global private const @layout_4 $const_region_0 = {0}; - -func private %__EchoContract_init(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_sstore v2 v0; - v7.i256 = add v2 1.i256; - evm_sstore v7 v1; - return; -} - -func private %__EchoContract_recv_0_0() -> i256 { - block0: - jump block1; - - block1: - return 42.i256; -} - -func private %__EchoContract_recv_0_1(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %__EchoContract_recv_0_2(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_sload v0; - return v2; -} - -func private %abi_field_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_9950_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_2725() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_a97d 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_87bf() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_f892 0.i256 0.i256; - unreachable; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__abort_ee4e() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_6da5 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base__g463e(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %impl_trait_SolEncoder__base(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %checked_frame_end(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - (v5.i256, v6.i1) = uaddo v0 v1; - br v6 block6 block7; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_f5d2; - unreachable; - - block3: - jump block4; - - block4: - return v5; - - block5: - v17.i1 = gt v5 v2; - br v17 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v13.i1 = lt v5 v0; - br v13 block2 block5; -} - -func inline(always) private %checked_tail(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - (v4.i256, v5.i1) = uaddo v0 v1; - br v5 block5 block6; - - block2: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_eb34; - unreachable; - - block3: - jump block4; - - block4: - return v4; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v12.i1 = lt v4 v0; - br v12 block2 block3; -} - -func inline(always) private %contract_init_abi_EchoContract() { - block0: - v0.objref<@layout_1> = obj.alloc @layout_1; - v1.objref<@layout_3> = obj.alloc @layout_3; - jump block1; - - block1: - v3.i256 = evm_call_value; - v4.i1 = eq v3 0.i256; - v5.i1 = is_zero v4; - br v5 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v7.i256 = sym_size .; - v8.i256 = evm_code_size; - v9.i1 = lt v8 v7; - br v9 block4 block5; - - block4: - evm_revert 0.i256 0.i256; - - block5: - (v13.i256, v14.i1) = usubo v8 v7; - br v14 block6 block7; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v19.*i8 = evm_malloc v13; - v20.i256 = ptr_to_int v19 i256; - evm_code_copy v20 v7 v13; - v23.objref = obj.proj v0 0.i256; - obj.store v23 v20; - v25.objref = obj.proj v0 1.i256; - obj.store v25 v13; - v26.@layout_1 = obj.load v0; - v27.@layout_3 = call %decoder_new v26; - v28.objref<@layout_2> = obj.proj v1 0.i256; - v29.@layout_2 = extract_value v27 0.i256; - v30.objref<@layout_1> = obj.proj v28 0.i256; - v31.@layout_1 = extract_value v29 0.i256; - v32.objref = obj.proj v30 0.i256; - v33.i256 = extract_value v31 0.i256; - obj.store v32 v33; - v34.objref = obj.proj v30 1.i256; - v35.i256 = extract_value v31 1.i256; - obj.store v34 v35; - v36.objref = obj.proj v28 1.i256; - v37.i256 = extract_value v29 1.i256; - obj.store v36 v37; - v38.objref = obj.proj v1 1.i256; - v39.i256 = extract_value v27 1.i256; - obj.store v38 v39; - v40.@layout_6 = call %decode_payload__g4770 v1; - v41.i256 = extract_value v40 0.i256; - v42.i256 = extract_value v40 1.i256; - call %__EchoContract_init v41 v42 0.i256; - return; -} - -func private %contract_init_root_EchoContract() { - block0: - jump block1; - - block1: - call %contract_init_abi_EchoContract; - v2.i256 = sym_addr &EchoContract_runtime; - v3.i256 = sym_size &EchoContract_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_EchoContract_1() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_8> = obj.alloc @layout_8; - call %decode_runtime_args__g235a v5; - v7.i256 = call %__EchoContract_recv_0_0; - v8.@layout_6 = call %encode_single_root_alloc v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func inline(always) private %contract_recv_abi_EchoContract_2() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_8> = obj.alloc @layout_8; - v6.@layout_5 = call %decode_runtime_args__g9e33 v5; - v7.i256 = extract_value v6 0.i256; - v8.i256 = call %__EchoContract_recv_0_1 v7; - v9.@layout_6 = call %encode_single_root_alloc v8; - v10.i256 = extract_value v9 0.i256; - v12.i256 = extract_value v9 1.i256; - evm_return v10 v12; -} - -func inline(always) private %contract_recv_abi_EchoContract_3() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_8> = obj.alloc @layout_8; - call %decode_runtime_args__gf173 v5; - v7.i256 = call %__EchoContract_recv_0_2 0.i256; - v8.@layout_6 = call %encode_single_root_alloc v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func private %contract_runtime_root_EchoContract() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (1.i32 block4) (2.i32 block5) (3.i32 block6); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_EchoContract_1; - unreachable; - - block5: - call %contract_recv_abi_EchoContract_2; - unreachable; - - block6: - call %contract_recv_abi_EchoContract_3; - unreachable; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_eb34() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decode_error_f5d2() { - block0: - jump block1; - - block1: - evm_revert 0.i256 0.i256; -} - -func inline(always) private %decode_field(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_66f1 v0; - v4.i256 = call %base__g463e v0; - v5.i256 = call %pos__g463e v0; - (v6.i256, v7.i1) = uaddo v4 v3; - br v7 block5 block6; - - block3: - jump block4; - - block4: - v23.i256 = call %decode_payload__g407e v0; - return v23; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %set_base__g463e v0 v6; - v15.i256 = call %base__g463e v0; - call %set_pos__g463e v0 v15; - v17.i256 = call %decode_payload__g407e v0; - call %set_base__g463e v0 v4; - call %set_pos__g463e v0 v5; - return v17; -} - -func inline(always) private %decode_field_from(v0.@layout_4, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v6.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_1f7f v0 v2; - (v8.i256, v9.i1) = uaddo v1 v6; - br v9 block5 block6; - - block3: - jump block4; - - block4: - v19.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4818_0 v0 v2; - return v19; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v16.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4818_0 v0 v8; - return v16; -} - -func inline(always) private %decode_field_from_prechecked_head(v0.@layout_4, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v7.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_1f7f v0 v2; - v9.i256 = call %checked_tail v1 v7; - v11.i256 = call %decode_from_bounded v0 v9 v3; - return v11; - - block3: - jump block4; - - block4: - v14.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4818_0 v0 v2; - return v14; -} - -func inline(always) private %impl_trait_Echo__decode_from__gd20d(v0.@layout_4, v1.i256) -> @layout_5 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_6a97 v0; - v5.i256 = call %decode_msg_field_from v0 v1 v1 v3; - v8.@layout_5 = insert_value undef.@layout_5 0.i256 v5; - return v8; -} - -func inline(always) private %impl_trait_Answer__decode_from__gd20d(v0.@layout_4, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %impl_trait_GetX__decode_from__gd20d(v0.@layout_4, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4818(v0.@layout_4, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_81b2 v0 v1; - return v4; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4818_0(v0.@layout_4, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_81b2_0 v0 v1; - return v4; -} - -func private %decode_from_bounded(v0.@layout_4, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.i256 = call %checked_frame_end v1 32.i256 v2; - v8.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_from__g72ab_4818 v0 v1; - return v8; -} - -func inline(always) private %decode_from_prechecked_head__g2d0f(v0.@layout_4, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %impl_trait_GetX__decode_from__gd20d v0 v1; - return; -} - -func inline(always) private %decode_from_prechecked_head__g2f3f(v0.@layout_4, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %impl_trait_Answer__decode_from__gd20d v0 v1; - return; -} - -func inline(always) private %decode_from_prechecked_head__g6fcf(v0.@layout_4, v1.i256, v2.i256) -> @layout_5 { - block0: - jump block1; - - block1: - v6.@layout_5 = call %impl_trait_Echo__decode_from__gd20d v0 v1; - return v6; -} - -func inline(always) private %decode_msg_field_from(v0.@layout_4, v1.i256, v2.i256, v3.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v9.i256 = call %decode_field_from_prechecked_head v0 v1 v2 v3; - return v9; - - block3: - jump block4; - - block4: - v14.i256 = call %decode_field_from v0 v1 v2; - return v14; -} - -func inline(always) private %decode_payload__g407e(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d95a v0; - return v2; -} - -func private %decode_payload__g4770(v0.objref<@layout_3>) -> @layout_6 { - block0: - jump block1; - - block1: - v2.i256 = call %decode_field v0; - v3.i256 = call %decode_field v0; - v6.@layout_6 = insert_value undef.@layout_6 0.i256 v2; - v8.@layout_6 = insert_value v6 1.i256 v3; - return v8; -} - -func inline(always) private %decode_runtime_args__g9e33(v0.objref<@layout_8>) -> @layout_5 { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_4 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_024f; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_7c2f v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_87bf; - unreachable; - - block3: - jump block4; - - block4: - v12.@layout_5 = call %decode_from_prechecked_head__g6fcf v3 4.i256 v5; - return v12; - - block5: - mstore v2 v5 i256; - v15.i256 = mload v2 i256; - v16.i1 = gt 36.i256 v15; - br v16 block2 block3; -} - -func inline(always) private %decode_runtime_args__gf173(v0.objref<@layout_8>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_4 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_58ca; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_34dc v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_2725; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head__g2d0f v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func inline(always) private %decode_runtime_args__g235a(v0.objref<@layout_8>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_4 = call %std__lib__evm__effects__impl_trait_Evm_c913__input_414c; - v5.i256 = call %std__lib__evm__calldata__impl_trait_CallData_087c__len_1779 v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %std__lib__evm__effects__impl_trait_Evm_c913__abort_ee4e; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head__g2f3f v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func private %decoder_new(v0.@layout_1) -> @layout_3 { - block0: - jump block1; - - block1: - v2.@layout_3 = call %impl_SolDecoder__new__g463e v0; - return v2; -} - -func private %encode(v0.i256, v1.objref<@layout_0>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_d116 v1 v0; - return; -} - -func private %encode_field(v0.i256, v1.objref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %impl_trait_SolEncoder__base v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_9950 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_6213 v1 v10; - v12.i256 = call %impl_trait_SolEncoder__pos v1; - v13.i256 = mload v2 i256; - call %impl_trait_SolEncoder__set_base v1 v13; - v15.i256 = mload v2 i256; - call %impl_trait_SolEncoder__set_pos v1 v15; - call %encode v0 v1; - call %impl_trait_SolEncoder__set_base v1 v5; - call %impl_trait_SolEncoder__set_pos v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %impl_trait_SolEncoder__pos v1; - call %encode_to_ptr v0 v24; - v28.i256 = add v24 32.i256; - call %impl_trait_SolEncoder__set_pos v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode v0 v1; - return; -} - -func private %encode_single_root(v0.i256, v1.objref<@layout_0>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %impl_trait_SolEncoder__base v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.i256) -> @layout_6 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_0 = call %encoder_new v2; - v4.objref<@layout_0> = obj.alloc @layout_0; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %impl_trait_SolEncoder__base v4; - call %encode_single_root v0 v4; - v14.@layout_6 = insert_value undef.@layout_6 0.i256 v11; - v15.@layout_6 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_to_ptr(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %store_word v1 v0; - return; -} - -func private %encoder_new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_024f() -> @layout_4 { - block0: - jump block1; - - block1: - v0.@layout_4 = call %std__lib__evm__calldata__impl_CallData_8f43__new_45d4; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_414c() -> @layout_4 { - block0: - jump block1; - - block1: - v0.@layout_4 = call %std__lib__evm__calldata__impl_CallData_8f43__new_c043; - return v0; -} - -func private %std__lib__evm__effects__impl_trait_Evm_c913__input_58ca() -> @layout_4 { - block0: - jump block1; - - block1: - v0.@layout_4 = call %std__lib__evm__calldata__impl_CallData_8f43__new_bdf6; - return v0; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_1779(v0.@layout_4) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_34dc(v0.@layout_4) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_6a97(v0.@layout_4) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__len_7c2f(v0.@layout_4) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8748(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f8db(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_0 = call %at v7; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_45d4() -> @layout_4 { - block0: - jump block1; - - block1: - v1.constref<@layout_4> = const.ref $const_region_0; - v2.objref<@layout_4> = obj.alloc @layout_4; - obj.init.const v2 v1; - v3.@layout_4 = obj.load v2; - return v3; -} - -func inline(always) private %impl_Cursor__new__g463e(v0.@layout_1) -> @layout_2 { - block0: - jump block1; - - block1: - v4.@layout_2 = insert_value undef.@layout_2 0.i256 v0; - v6.@layout_2 = insert_value v4 1.i256 0.i256; - return v6; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_bdf6() -> @layout_4 { - block0: - jump block1; - - block1: - v1.constref<@layout_4> = const.ref $const_region_0; - v2.objref<@layout_4> = obj.alloc @layout_4; - obj.init.const v2 v1; - v3.@layout_4 = obj.load v2; - return v3; -} - -func inline(always) private %std__lib__evm__calldata__impl_CallData_8f43__new_c043() -> @layout_4 { - block0: - jump block1; - - block1: - v1.constref<@layout_4> = const.ref $const_region_0; - v2.objref<@layout_4> = obj.alloc @layout_4; - obj.init.const v2 v1; - v3.@layout_4 = obj.load v2; - return v3; -} - -func inline(always) private %impl_SolDecoder__new__g463e(v0.@layout_1) -> @layout_3 { - block0: - jump block1; - - block1: - v2.@layout_2 = call %impl_Cursor__new__g463e v0; - v5.@layout_3 = insert_value undef.@layout_3 0.i256 v2; - v7.@layout_3 = insert_value v5 1.i256 0.i256; - return v7; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_9950(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_9950_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %pos__g463e(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - v3.objref<@layout_2> = obj.proj v0 0.i256; - v5.objref = obj.proj v3 1.i256; - v6.i256 = obj.load v5; - return v6; -} - -func private %impl_trait_SolEncoder__pos(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_66f1(v0.objref<@layout_3>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_2> = obj.proj v0 0.i256; - v5.objref<@layout_1> = obj.proj v4 0.i256; - v6.@layout_1 = obj.load v5; - v7.objref<@layout_2> = obj.proj v0 0.i256; - v8.objref<@layout_1> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f8db v8; - v10.objref<@layout_2> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_2> = obj.proj v0 0.i256; - v28.objref<@layout_1> = obj.proj v27 0.i256; - v29.@layout_1 = obj.load v28; - v30.objref<@layout_2> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_2> = obj.proj v0 0.i256; - v34.objref<@layout_1> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7f06 v34 v32; - v37.objref<@layout_2> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_2> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d95a(v0.objref<@layout_3>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_2> = obj.proj v0 0.i256; - v5.objref<@layout_1> = obj.proj v4 0.i256; - v6.@layout_1 = obj.load v5; - v7.objref<@layout_2> = obj.proj v0 0.i256; - v8.objref<@layout_1> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8748 v8; - v10.objref<@layout_2> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_2> = obj.proj v0 0.i256; - v28.objref<@layout_1> = obj.proj v27 0.i256; - v29.@layout_1 = obj.load v28; - v30.objref<@layout_2> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_2> = obj.proj v0 0.i256; - v34.objref<@layout_1> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_38bd v34 v32; - v37.objref<@layout_2> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_2> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_6da5(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_a97d(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_f892(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %impl_trait_SolEncoder__set_base(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %set_base__g463e(v0.objref<@layout_3>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %set_pos__g463e(v0.objref<@layout_3>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref<@layout_2> = obj.proj v0 0.i256; - v7.objref = obj.proj v5 1.i256; - obj.store v7 v1; - return; -} - -func private %impl_trait_SolEncoder__set_pos(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_1f7f(v0.@layout_4, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_38bd(v0.objref<@layout_1>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7f06(v0.objref<@layout_1>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_81b2(v0.@layout_4, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func inline(always) private %std__lib__evm__calldata__impl_trait_CallData_087c__word_at_81b2_0(v0.@layout_4, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v6.i256 = add v4 v1; - v7.i256 = evm_calldata_load v6; - return v7; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_6213(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_d116(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @EchoContract { - section init { - entry %contract_init_root_EchoContract; - embed .runtime as &EchoContract_runtime; - } - section runtime { - entry %contract_runtime_root_EchoContract; - data $const_region_0; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/if_else.snap b/crates/codegen/tests/fixtures/sonatina_ir/if_else.snap deleted file mode 100644 index e313b41bd0..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/if_else.snap +++ /dev/null @@ -1,68 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/if_else.fe ---- -target = "evm-ethereum-osaka" - -func private %helper(v0.i64) -> i64 { - block0: - jump block1; - - block1: - (v3.i64, v4.i1) = uaddo v0 1.i64; - br v4 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v3; -} - -func private %if_else(v0.i1) -> i64 { - block0: - jump block1; - - block1: - br v0 block2 block3; - - block2: - v3.i64 = call %helper 1.i64; - jump block4; - - block3: - v5.i64 = call %helper 2.i64; - jump block4; - - block4: - v6.i64 = phi (v3 block2) (v5 block3); - return v6; -} - -func private %main() -> i64 { - block0: - jump block1; - - block1: - v1.i64 = call %if_else 1.i1; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/immutable_contract_field_init_set.snap b/crates/codegen/tests/fixtures/sonatina_ir/immutable_contract_field_init_set.snap deleted file mode 100644 index fb0b6dc571..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/immutable_contract_field_init_set.snap +++ /dev/null @@ -1,884 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -assertion_line: 449 -expression: output -input_file: crates/codegen/tests/fixtures/immutable_contract_field_init_set.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256, i256}; -type @layout_2 = {@layout_1, i256}; -type @layout_3 = {@layout_2, i256}; -type @layout_4 = {i256}; -type @layout_5 = {i256}; -type @layout_6 = {}; -type @layout_7 = {@layout_6}; -type @layout_8 = {i256, i256}; - -global private const @layout_4 $const_region_0 = {0}; - -func private %__ImmutableContractFieldInitSet_init(v0.i256, v1.objref) { - block0: - jump block1; - - block1: - obj.store v1 v0; - return; -} - -func private %__ImmutableContractFieldInitSet_recv_0_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 32.i256; - v4.i256 = ptr_to_int v3 i256; - evm_code_copy v4 v0 32.i256; - v5.i256 = mload v4 i256; - return v5; -} - -func private %abi_field_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_6b32_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %abort() { - block0: - jump block1; - - block1: - call %revert 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - return v6; -} - -func private %impl_trait_SolEncoder__base(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %base__g463e(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %contract_init_abi_ImmutableContractFieldInitSet() { - block0: - v0.objref<@layout_1> = obj.alloc @layout_1; - v1.objref<@layout_3> = obj.alloc @layout_3; - jump block1; - - block1: - v3.i256 = evm_call_value; - v4.i1 = eq v3 0.i256; - v5.i1 = is_zero v4; - br v5 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v7.i256 = sym_size .; - v8.i256 = evm_code_size; - v9.i1 = lt v8 v7; - br v9 block4 block5; - - block4: - evm_revert 0.i256 0.i256; - - block5: - (v13.i256, v14.i1) = usubo v8 v7; - br v14 block6 block7; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v19.*i8 = evm_malloc v13; - v20.i256 = ptr_to_int v19 i256; - evm_code_copy v20 v7 v13; - v23.objref = obj.proj v0 0.i256; - obj.store v23 v20; - v25.objref = obj.proj v0 1.i256; - obj.store v25 v13; - v26.@layout_1 = obj.load v0; - v27.@layout_3 = call %decoder_new v26; - v28.objref<@layout_2> = obj.proj v1 0.i256; - v29.@layout_2 = extract_value v27 0.i256; - v30.objref<@layout_1> = obj.proj v28 0.i256; - v31.@layout_1 = extract_value v29 0.i256; - v32.objref = obj.proj v30 0.i256; - v33.i256 = extract_value v31 0.i256; - obj.store v32 v33; - v34.objref = obj.proj v30 1.i256; - v35.i256 = extract_value v31 1.i256; - obj.store v34 v35; - v36.objref = obj.proj v28 1.i256; - v37.i256 = extract_value v29 1.i256; - obj.store v36 v37; - v38.objref = obj.proj v1 1.i256; - v39.i256 = extract_value v27 1.i256; - obj.store v38 v39; - v40.@layout_5 = call %decode_payload__g3854 v1; - v41.i256 = extract_value v40 0.i256; - v43.*i8 = evm_malloc 32.i256; - v44.i256 = ptr_to_int v43 i256; - v45.objref = obj.alloc i256; - call %__ImmutableContractFieldInitSet_init v41 v45; - v47.i256 = obj.load v45; - (v48.i256, v49.i1) = umulo 0.i256 32.i256; - br v49 block6 block8; - - block8: - (v51.i256, v52.i1) = uaddo v44 v48; - br v52 block6 block9; - - block9: - mstore v51 v47 i256; - mstore 0.i256 v44 i256; - return; -} - -func private %contract_init_root_ImmutableContractFieldInitSet() { - block0: - jump block1; - - block1: - call %contract_init_abi_ImmutableContractFieldInitSet; - v2.i256 = sym_addr &ImmutableContractFieldInitSet_runtime; - v3.i256 = sym_size &ImmutableContractFieldInitSet_runtime; - v4.i256 = mload 0.i256 i256; - (v6.i256, v7.i1) = uaddo v3 32.i256; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v12.*i8 = evm_malloc v6; - v13.i256 = ptr_to_int v12 i256; - evm_code_copy v13 v2 v3; - (v17.i256, v18.i1) = uaddo v13 v3; - br v18 block2 block4; - - block4: - evm_mcopy v17 v4 32.i256; - evm_return v13 v6; -} - -func inline(always) private %contract_recv_abi_ImmutableContractFieldInitSet_1() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_7> = obj.alloc @layout_7; - call %decode_runtime_args v5; - v7.i256 = evm_code_size; - v9.i256 = add v7 -32.i256; - v10.i256 = call %__ImmutableContractFieldInitSet_recv_0_0 v9; - v11.@layout_8 = call %encode_single_root_alloc v10; - v12.i256 = extract_value v11 0.i256; - v14.i256 = extract_value v11 1.i256; - evm_return v12 v14; -} - -func private %contract_runtime_root_ImmutableContractFieldInitSet() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (1.i32 block4); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_ImmutableContractFieldInitSet_1; - unreachable; -} - -func inline(always) private %decode_field(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_f8bc v0; - v4.i256 = call %base__g463e v0; - v5.i256 = call %pos__g463e v0; - (v6.i256, v7.i1) = uaddo v4 v3; - br v7 block5 block6; - - block3: - jump block4; - - block4: - v23.i256 = call %decode_payload__g407e v0; - return v23; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %set_base__g463e v0 v6; - v15.i256 = call %base__g463e v0; - call %set_pos__g463e v0 v15; - v17.i256 = call %decode_payload__g407e v0; - call %set_base__g463e v0 v4; - call %set_pos__g463e v0 v5; - return v17; -} - -func inline(always) private %decode_from(v0.@layout_4, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %decode_from_prechecked_head(v0.@layout_4, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %decode_from v0 v1; - return; -} - -func private %decode_payload__g3854(v0.objref<@layout_3>) -> @layout_5 { - block0: - jump block1; - - block1: - v2.i256 = call %decode_field v0; - v5.@layout_5 = insert_value undef.@layout_5 0.i256 v2; - return v5; -} - -func inline(always) private %decode_payload__g407e(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9e55 v0; - return v2; -} - -func inline(always) private %decode_runtime_args(v0.objref<@layout_7>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_4 = call %input; - v5.i256 = call %impl_trait_CallData__len v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %abort; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func private %decoder_new(v0.@layout_1) -> @layout_3 { - block0: - jump block1; - - block1: - v2.@layout_3 = call %impl_SolDecoder__new__g463e v0; - return v2; -} - -func private %encode(v0.i256, v1.objref<@layout_0>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_bfe9 v1 v0; - return; -} - -func private %encode_field(v0.i256, v1.objref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %impl_trait_SolEncoder__base v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_6b32 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8a32 v1 v10; - v12.i256 = call %impl_trait_SolEncoder__pos v1; - v13.i256 = mload v2 i256; - call %impl_trait_SolEncoder__set_base v1 v13; - v15.i256 = mload v2 i256; - call %impl_trait_SolEncoder__set_pos v1 v15; - call %encode v0 v1; - call %impl_trait_SolEncoder__set_base v1 v5; - call %impl_trait_SolEncoder__set_pos v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %impl_trait_SolEncoder__pos v1; - call %encode_to_ptr v0 v24; - v28.i256 = add v24 32.i256; - call %impl_trait_SolEncoder__set_pos v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode v0 v1; - return; -} - -func private %encode_single_root(v0.i256, v1.objref<@layout_0>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %impl_trait_SolEncoder__base v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.i256) -> @layout_8 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_0 = call %encoder_new v2; - v4.objref<@layout_0> = obj.alloc @layout_0; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %impl_trait_SolEncoder__base v4; - call %encode_single_root v0 v4; - v14.@layout_8 = insert_value undef.@layout_8 0.i256 v11; - v15.@layout_8 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_to_ptr(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %store_word v1 v0; - return; -} - -func private %encoder_new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %input() -> @layout_4 { - block0: - jump block1; - - block1: - v0.@layout_4 = call %impl_CallData__new; - return v0; -} - -func inline(always) private %impl_trait_CallData__len(v0.@layout_4) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_e033(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f424(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %impl_SolDecoder__new__g463e(v0.@layout_1) -> @layout_3 { - block0: - jump block1; - - block1: - v2.@layout_2 = call %impl_Cursor__new__g463e v0; - v5.@layout_3 = insert_value undef.@layout_3 0.i256 v2; - v7.@layout_3 = insert_value v5 1.i256 0.i256; - return v7; -} - -func inline(always) private %impl_CallData__new() -> @layout_4 { - block0: - jump block1; - - block1: - v1.constref<@layout_4> = const.ref $const_region_0; - v2.objref<@layout_4> = obj.alloc @layout_4; - obj.init.const v2 v1; - v3.@layout_4 = obj.load v2; - return v3; -} - -func inline(always) private %impl_Cursor__new__g463e(v0.@layout_1) -> @layout_2 { - block0: - jump block1; - - block1: - v4.@layout_2 = insert_value undef.@layout_2 0.i256 v0; - v6.@layout_2 = insert_value v4 1.i256 0.i256; - return v6; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_0 = call %at v7; - return v8; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_6b32(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_6b32_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %impl_trait_SolEncoder__pos(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %pos__g463e(v0.objref<@layout_3>) -> i256 { - block0: - jump block1; - - block1: - v3.objref<@layout_2> = obj.proj v0 0.i256; - v5.objref = obj.proj v3 1.i256; - v6.i256 = obj.load v5; - return v6; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9e55(v0.objref<@layout_3>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_2> = obj.proj v0 0.i256; - v5.objref<@layout_1> = obj.proj v4 0.i256; - v6.@layout_1 = obj.load v5; - v7.objref<@layout_2> = obj.proj v0 0.i256; - v8.objref<@layout_1> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f424 v8; - v10.objref<@layout_2> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_2> = obj.proj v0 0.i256; - v28.objref<@layout_1> = obj.proj v27 0.i256; - v29.@layout_1 = obj.load v28; - v30.objref<@layout_2> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_2> = obj.proj v0 0.i256; - v34.objref<@layout_1> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_1e81 v34 v32; - v37.objref<@layout_2> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_2> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_f8bc(v0.objref<@layout_3>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_2> = obj.proj v0 0.i256; - v5.objref<@layout_1> = obj.proj v4 0.i256; - v6.@layout_1 = obj.load v5; - v7.objref<@layout_2> = obj.proj v0 0.i256; - v8.objref<@layout_1> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_e033 v8; - v10.objref<@layout_2> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_2> = obj.proj v0 0.i256; - v28.objref<@layout_1> = obj.proj v27 0.i256; - v29.@layout_1 = obj.load v28; - v30.objref<@layout_2> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_2> = obj.proj v0 0.i256; - v34.objref<@layout_1> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9935 v34 v32; - v37.objref<@layout_2> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_2> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func private %revert(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %impl_trait_SolEncoder__set_base(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %set_base__g463e(v0.objref<@layout_3>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %impl_trait_SolEncoder__set_pos(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %set_pos__g463e(v0.objref<@layout_3>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref<@layout_2> = obj.proj v0 0.i256; - v7.objref = obj.proj v5 1.i256; - obj.store v7 v1; - return; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_1e81(v0.objref<@layout_1>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9935(v0.objref<@layout_1>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8a32(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_bfe9(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @ImmutableContractFieldInitSet { - section init { - entry %contract_init_root_ImmutableContractFieldInitSet; - embed .runtime as &ImmutableContractFieldInitSet_runtime; - } - section runtime { - entry %contract_runtime_root_ImmutableContractFieldInitSet; - data $const_region_0; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/init_args_with_child_dep.snap b/crates/codegen/tests/fixtures/sonatina_ir/init_args_with_child_dep.snap deleted file mode 100644 index 67e3562671..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/init_args_with_child_dep.snap +++ /dev/null @@ -1,1229 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/init_args_with_child_dep.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256, i256}; -type @layout_2 = {i256, i256}; -type @layout_3 = {@layout_2, i256}; -type @layout_4 = {@layout_3, i256}; -type @layout_5 = {i256}; -type @layout_6 = {i256}; - -func private %__Child_init(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func private %__Parent_init(v0.i256) { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - v7.@layout_5 = call %create 0.i256 v6; - return; -} - -func private %abi_payload_size(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %payload_size__gbd8e v0; - return v2; -} - -func inline(always) private %at(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.@layout_1 = insert_value undef.@layout_1 0.i256 v0; - v6.@layout_1 = insert_value v4 1.i256 v0; - return v6; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_1672(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_2b07(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_f240(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_f488(v0.objref<@layout_1>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %contract_init_abi_Child() { - block0: - v0.objref<@layout_2> = obj.alloc @layout_2; - v1.objref<@layout_4> = obj.alloc @layout_4; - jump block1; - - block1: - v3.i256 = evm_call_value; - v4.i1 = eq v3 0.i256; - v5.i1 = is_zero v4; - br v5 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v7.i256 = sym_size .; - v8.i256 = evm_code_size; - v9.i1 = lt v8 v7; - br v9 block4 block5; - - block4: - evm_revert 0.i256 0.i256; - - block5: - (v13.i256, v14.i1) = usubo v8 v7; - br v14 block6 block7; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v19.*i8 = evm_malloc v13; - v20.i256 = ptr_to_int v19 i256; - evm_code_copy v20 v7 v13; - v23.objref = obj.proj v0 0.i256; - obj.store v23 v20; - v25.objref = obj.proj v0 1.i256; - obj.store v25 v13; - v26.@layout_2 = obj.load v0; - v27.@layout_4 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__decoder_new__g463e_6eaf_0 v26; - v28.objref<@layout_3> = obj.proj v1 0.i256; - v29.@layout_3 = extract_value v27 0.i256; - v30.objref<@layout_2> = obj.proj v28 0.i256; - v31.@layout_2 = extract_value v29 0.i256; - v32.objref = obj.proj v30 0.i256; - v33.i256 = extract_value v31 0.i256; - obj.store v32 v33; - v34.objref = obj.proj v30 1.i256; - v35.i256 = extract_value v31 1.i256; - obj.store v34 v35; - v36.objref = obj.proj v28 1.i256; - v37.i256 = extract_value v29 1.i256; - obj.store v36 v37; - v38.objref = obj.proj v1 1.i256; - v39.i256 = extract_value v27 1.i256; - obj.store v38 v39; - v40.@layout_0 = call %decode_payload__g4770 v1; - v41.i256 = extract_value v40 0.i256; - v42.i256 = extract_value v40 1.i256; - call %__Child_init v41 v42; - return; -} - -func inline(always) private %contract_init_abi_Parent() { - block0: - v0.objref<@layout_2> = obj.alloc @layout_2; - v1.objref<@layout_4> = obj.alloc @layout_4; - jump block1; - - block1: - v3.i256 = evm_call_value; - v4.i1 = eq v3 0.i256; - v5.i1 = is_zero v4; - br v5 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v7.i256 = sym_size .; - v8.i256 = evm_code_size; - v9.i1 = lt v8 v7; - br v9 block4 block5; - - block4: - evm_revert 0.i256 0.i256; - - block5: - (v13.i256, v14.i1) = usubo v8 v7; - br v14 block6 block7; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v19.*i8 = evm_malloc v13; - v20.i256 = ptr_to_int v19 i256; - evm_code_copy v20 v7 v13; - v23.objref = obj.proj v0 0.i256; - obj.store v23 v20; - v25.objref = obj.proj v0 1.i256; - obj.store v25 v13; - v26.@layout_2 = obj.load v0; - v27.@layout_4 = call %std__lib__abi__sol__impl_trait_Sol_1f5f__decoder_new__g463e_6eaf v26; - v28.objref<@layout_3> = obj.proj v1 0.i256; - v29.@layout_3 = extract_value v27 0.i256; - v30.objref<@layout_2> = obj.proj v28 0.i256; - v31.@layout_2 = extract_value v29 0.i256; - v32.objref = obj.proj v30 0.i256; - v33.i256 = extract_value v31 0.i256; - obj.store v32 v33; - v34.objref = obj.proj v30 1.i256; - v35.i256 = extract_value v31 1.i256; - obj.store v34 v35; - v36.objref = obj.proj v28 1.i256; - v37.i256 = extract_value v29 1.i256; - obj.store v36 v37; - v38.objref = obj.proj v1 1.i256; - v39.i256 = extract_value v27 1.i256; - obj.store v38 v39; - v40.@layout_6 = call %decode_payload__g3854 v1; - v41.i256 = extract_value v40 0.i256; - call %__Parent_init v41; - return; -} - -func private %contract_init_root_Child() { - block0: - jump block1; - - block1: - call %contract_init_abi_Child; - v2.i256 = sym_addr &Child_runtime; - v3.i256 = sym_size &Child_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func private %contract_init_root_Parent() { - block0: - jump block1; - - block1: - call %contract_init_abi_Parent; - v2.i256 = sym_addr &Parent_runtime; - v3.i256 = sym_size &Parent_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func private %contract_runtime_root_Child() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3; - - block3: - evm_revert 0.i256 0.i256; -} - -func private %contract_runtime_root_Parent() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3; - - block3: - evm_revert 0.i256 0.i256; -} - -func private %copy_words(v0.i256, v1.i256, v2.i256) { - block0: - v3.*i256 = alloca i256; - jump block1; - - block1: - mstore v3 0.i256 i256; - jump block2; - - block2: - v5.i256 = mload v3 i256; - v7.i1 = lt v5 v2; - br v7 block3 block4; - - block3: - v9.i256 = mload v3 i256; - (v10.i256, v11.i1) = uaddo v0 v9; - br v11 block5 block6; - - block4: - return; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v17.i256 = mload v3 i256; - (v18.i256, v19.i1) = uaddo v1 v17; - br v19 block5 block7; - - block7: - v20.i256 = mload v18 i256; - mstore v10 v20 i256; - v23.i256 = ptr_to_int v3 i256; - v25.i256 = mload v23 i256; - (v26.i256, v27.i1) = uaddo v25 32.i256; - br v27 block5 block8; - - block8: - mstore v23 v26 i256; - jump block2; -} - -func private %create(v0.i256, v1.@layout_0) -> @layout_5 { - block0: - jump block1; - - block1: - v2.i256 = sym_size &Child_init; - v3.i256 = sym_addr &Child_init; - br 1.i1 block5 block3; - - block2: - v7.*i8 = evm_malloc v2; - v8.i256 = ptr_to_int v7 i256; - evm_code_copy v8 v3 v2; - v12.@layout_5 = call %create_raw v0 v8 v2; - jump block4; - - block3: - v14.@layout_0 = call %encode_abi_payload v1; - v16.i256 = extract_value v14 1.i256; - (v18.i256, v19.i1) = uaddo v2 v16; - br v19 block9 block10; - - block4: - v43.@layout_5 = phi (v12 block2) (v42 block12); - v44.i256 = extract_value v43 0.i256; - v45.i1 = eq v44 0.i256; - br v45 block6 block7; - - block5: - br 0.i1 block2 block3; - - block6: - v47.i256 = evm_return_data_size; - v48.*i8 = evm_malloc v47; - v49.i256 = ptr_to_int v48 i256; - evm_return_data_copy v49 0.i256 v47; - evm_revert v49 v47; - - block7: - jump block8; - - block8: - return v43; - - block9: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block10: - v25.*i8 = evm_malloc v18; - v26.i256 = ptr_to_int v25 i256; - evm_code_copy v26 v3 v2; - (v30.i256, v31.i1) = uaddo v26 v2; - br v31 block9 block11; - - block11: - v33.i256 = extract_value v14 0.i256; - v34.i256 = extract_value v14 1.i256; - call %copy_words v30 v33 v34; - v36.i256 = extract_value v14 1.i256; - (v38.i256, v39.i1) = uaddo v2 v36; - br v39 block9 block12; - - block12: - v42.@layout_5 = call %create_raw v0 v26 v38; - jump block4; -} - -func private %create_raw(v0.i256, v1.i256, v2.i256) -> @layout_5 { - block0: - jump block1; - - block1: - v6.i256 = evm_create v0 v1 v2; - v9.@layout_5 = insert_value undef.@layout_5 0.i256 v6; - return v9; -} - -func inline(always) private %core__lib__abi__decode_field__g3854_271d(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_6997 v0; - v4.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_1672 v0; - v5.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__pos__g463e_5a37 v0; - (v6.i256, v7.i1) = uaddo v4 v3; - br v7 block5 block6; - - block3: - jump block4; - - block4: - v23.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_payload__g407e_92e8 v0; - return v23; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_e112 v0 v6; - v15.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_1672 v0; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_0c70 v0 v15; - v17.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_payload__g407e_92e8 v0; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_e112 v0 v4; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_0c70 v0 v5; - return v17; -} - -func inline(always) private %core__lib__abi__decode_field__g3854_e495(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c4ab v0; - v4.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_2b07 v0; - v5.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__pos__g463e_1111 v0; - (v6.i256, v7.i1) = uaddo v4 v3; - br v7 block5 block6; - - block3: - jump block4; - - block4: - v23.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_payload__g407e_a9a2 v0; - return v23; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_bba9 v0 v6; - v15.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__base__g463e_2b07 v0; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_5886 v0 v15; - v17.i256 = call %core__lib__abi__impl_trait_u256_85b6__decode_payload__g407e_a9a2 v0; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_bba9 v0 v4; - call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_5886 v0 v5; - return v17; -} - -func private %decode_payload__g4770(v0.objref<@layout_4>) -> @layout_0 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__decode_field__g3854_e495 v0; - v3.i256 = call %core__lib__abi__decode_field__g3854_e495 v0; - v6.@layout_0 = insert_value undef.@layout_0 0.i256 v2; - v8.@layout_0 = insert_value v6 1.i256 v3; - return v8; -} - -func private %decode_payload__g3854(v0.objref<@layout_4>) -> @layout_6 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__decode_field__g3854_271d v0; - v5.@layout_6 = insert_value undef.@layout_6 0.i256 v2; - return v5; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_payload__g407e_92e8(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b4b0 v0; - return v2; -} - -func inline(always) private %core__lib__abi__impl_trait_u256_85b6__decode_payload__g407e_a9a2(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_4a6a v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decoder_new__g463e_6eaf(v0.@layout_2) -> @layout_4 { - block0: - jump block1; - - block1: - v2.@layout_4 = call %std__lib__abi__sol__impl_SolDecoder_113c__new__g463e_7b57 v0; - return v2; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__decoder_new__g463e_6eaf_0(v0.@layout_2) -> @layout_4 { - block0: - jump block1; - - block1: - v2.@layout_4 = call %std__lib__abi__sol__impl_SolDecoder_113c__new__g463e_7b57_0 v0; - return v2; -} - -func private %dynamic_payload_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_e959 v0; - return v3; - - block3: - jump block4; - - block4: - return 0.i256; -} - -func inline(always) private %encode__g7769(v0.@layout_0, v1.objref<@layout_1>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_f240 v1; - v6.i256 = add v4 64.i256; - mstore v2 v6 i256; - v8.i256 = add v4 32.i256; - v11.i256 = extract_value v0 0.i256; - v12.i256 = ptr_to_int v2 i256; - call %encode_field_at v11 v1 v4 v4 v12; - v15.i256 = extract_value v0 1.i256; - v16.i256 = ptr_to_int v2 i256; - call %encode_field_at v15 v1 v4 v8 v16; - v18.i256 = add v4 64.i256; - call %impl_trait_SolEncoder__set_pos v1 v18; - return; -} - -func private %encode_abi_payload(v0.@layout_0) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %encode_alloc v0; - return v2; -} - -func inline(always) private %encode_alloc(v0.@layout_0) -> @layout_0 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_payload_size v0; - v3.@layout_1 = call %encoder_new v2; - v4.objref<@layout_1> = obj.alloc @layout_1; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_f488 v4; - call %encode__g7769 v0 v4; - v14.@layout_0 = insert_value undef.@layout_0 0.i256 v11; - v15.@layout_0 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode__g426c(v0.i256, v1.objref<@layout_1>) { - block0: - jump block1; - - block1: - call %write_word v1 v0; - return; -} - -func inline(always) private %encode_field_at(v0.i256, v1.objref<@layout_1>, v2.i256, v3.i256, v4.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_fde5 v0; - v11.i256 = mload v4 i256; - v12.i256 = sub v11 v2; - call %write_word_at v1 v3 v12; - v15.i256 = mload v4 i256; - call %impl_trait_SolEncoder__set_base v1 v15; - v17.i256 = mload v4 i256; - call %impl_trait_SolEncoder__set_pos v1 v17; - call %encode__g426c v0 v1; - call %impl_trait_SolEncoder__set_base v1 v2; - v21.i256 = mload v4 i256; - v22.i256 = add v21 v8; - mstore v4 v22 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - call %encode_to_ptr v0 v3; - return; - - block6: - jump block7; - - block7: - call %impl_trait_SolEncoder__set_pos v1 v3; - call %encode__g426c v0 v1; - return; -} - -func private %encode_to_ptr(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %store_word v1 v0; - return; -} - -func private %encoder_new(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_1 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_0d16(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_2f12(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_4f49(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_d700(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_1 = call %at v7; - return v8; -} - -func inline(always) private %std__lib__abi__sol__impl_SolDecoder_113c__new__g463e_7b57(v0.@layout_2) -> @layout_4 { - block0: - jump block1; - - block1: - v2.@layout_3 = call %core__lib__abi__impl_Cursor_1a04__new__g463e_aa29 v0; - v5.@layout_4 = insert_value undef.@layout_4 0.i256 v2; - v7.@layout_4 = insert_value v5 1.i256 0.i256; - return v7; -} - -func inline(always) private %std__lib__abi__sol__impl_SolDecoder_113c__new__g463e_7b57_0(v0.@layout_2) -> @layout_4 { - block0: - jump block1; - - block1: - v2.@layout_3 = call %core__lib__abi__impl_Cursor_1a04__new__g463e_aa29_0 v0; - v5.@layout_4 = insert_value undef.@layout_4 0.i256 v2; - v7.@layout_4 = insert_value v5 1.i256 0.i256; - return v7; -} - -func inline(always) private %core__lib__abi__impl_Cursor_1a04__new__g463e_aa29(v0.@layout_2) -> @layout_3 { - block0: - jump block1; - - block1: - v4.@layout_3 = insert_value undef.@layout_3 0.i256 v0; - v6.@layout_3 = insert_value v4 1.i256 0.i256; - return v6; -} - -func inline(always) private %core__lib__abi__impl_Cursor_1a04__new__g463e_aa29_0(v0.@layout_2) -> @layout_3 { - block0: - jump block1; - - block1: - v4.@layout_3 = insert_value undef.@layout_3 0.i256 v0; - v6.@layout_3 = insert_value v4 1.i256 0.i256; - return v6; -} - -func inline(always) private %payload_size__gbd8e(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v5.i256 = call %dynamic_payload_size v4; - v6.i256 = add 64.i256 v5; - v8.i256 = extract_value v0 1.i256; - v9.i256 = call %dynamic_payload_size v8; - v10.i256 = add v6 v9; - return v10; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_e959(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_fde5(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__pos__g463e_1111(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v3.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref = obj.proj v3 1.i256; - v6.i256 = obj.load v5; - return v6; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__pos__g463e_5a37(v0.objref<@layout_4>) -> i256 { - block0: - jump block1; - - block1: - v3.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref = obj.proj v3 1.i256; - v6.i256 = obj.load v5; - return v6; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_4a6a(v0.objref<@layout_4>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref<@layout_2> = obj.proj v4 0.i256; - v6.@layout_2 = obj.load v5; - v7.objref<@layout_3> = obj.proj v0 0.i256; - v8.objref<@layout_2> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_d700 v8; - v10.objref<@layout_3> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_3> = obj.proj v0 0.i256; - v28.objref<@layout_2> = obj.proj v27 0.i256; - v29.@layout_2 = obj.load v28; - v30.objref<@layout_3> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_3> = obj.proj v0 0.i256; - v34.objref<@layout_2> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7a87 v34 v32; - v37.objref<@layout_3> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_3> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_6997(v0.objref<@layout_4>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref<@layout_2> = obj.proj v4 0.i256; - v6.@layout_2 = obj.load v5; - v7.objref<@layout_3> = obj.proj v0 0.i256; - v8.objref<@layout_2> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_0d16 v8; - v10.objref<@layout_3> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_3> = obj.proj v0 0.i256; - v28.objref<@layout_2> = obj.proj v27 0.i256; - v29.@layout_2 = obj.load v28; - v30.objref<@layout_3> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_3> = obj.proj v0 0.i256; - v34.objref<@layout_2> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_f08f v34 v32; - v37.objref<@layout_3> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_3> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b4b0(v0.objref<@layout_4>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref<@layout_2> = obj.proj v4 0.i256; - v6.@layout_2 = obj.load v5; - v7.objref<@layout_3> = obj.proj v0 0.i256; - v8.objref<@layout_2> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_4f49 v8; - v10.objref<@layout_3> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_3> = obj.proj v0 0.i256; - v28.objref<@layout_2> = obj.proj v27 0.i256; - v29.@layout_2 = obj.load v28; - v30.objref<@layout_3> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_3> = obj.proj v0 0.i256; - v34.objref<@layout_2> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9236 v34 v32; - v37.objref<@layout_3> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_3> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func inline(always) private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c4ab(v0.objref<@layout_4>) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.objref<@layout_3> = obj.proj v0 0.i256; - v5.objref<@layout_2> = obj.proj v4 0.i256; - v6.@layout_2 = obj.load v5; - v7.objref<@layout_3> = obj.proj v0 0.i256; - v8.objref<@layout_2> = obj.proj v7 0.i256; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_2f12 v8; - v10.objref<@layout_3> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; - - block2: - evm_revert 0.i256 0.i256; - - block3: - jump block4; - - block4: - v27.objref<@layout_3> = obj.proj v0 0.i256; - v28.objref<@layout_2> = obj.proj v27 0.i256; - v29.@layout_2 = obj.load v28; - v30.objref<@layout_3> = obj.proj v0 0.i256; - v31.objref = obj.proj v30 1.i256; - v32.i256 = obj.load v31; - v33.objref<@layout_3> = obj.proj v0 0.i256; - v34.objref<@layout_2> = obj.proj v33 0.i256; - v35.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_78ee v34 v32; - v37.objref<@layout_3> = obj.proj v0 0.i256; - v38.objref = obj.proj v37 1.i256; - obj.store v38 v15; - return v35; - - block5: - mstore v1 v9 i256; - v41.i256 = mload v1 i256; - v42.i1 = gt v15 v41; - br v42 block2 block3; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v22.objref<@layout_3> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.i1 = lt v15 v24; - br v25 block2 block5; -} - -func private %impl_trait_SolEncoder__set_base(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_bba9(v0.objref<@layout_4>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_e112(v0.objref<@layout_4>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_0c70(v0.objref<@layout_4>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref<@layout_3> = obj.proj v0 0.i256; - v7.objref = obj.proj v5 1.i256; - obj.store v7 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_pos__g463e_5886(v0.objref<@layout_4>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref<@layout_3> = obj.proj v0 0.i256; - v7.objref = obj.proj v5 1.i256; - obj.store v7 v1; - return; -} - -func private %impl_trait_SolEncoder__set_pos(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_78ee(v0.objref<@layout_2>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7a87(v0.objref<@layout_2>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9236(v0.objref<@layout_2>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func private %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_f08f(v0.objref<@layout_2>, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 0.i256; - v5.i256 = obj.load v4; - v7.i256 = add v5 v1; - v8.i256 = mload v7 i256; - return v8; -} - -func private %write_word(v0.objref<@layout_1>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %write_word_at(v0.objref<@layout_1>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - mstore v1 v2 i256; - return; -} - - -object @Child { - section init { - entry %contract_init_root_Child; - embed .runtime as &Child_runtime; - } - section runtime { - entry %contract_runtime_root_Child; - } -} - -object @Parent { - section init { - entry %contract_init_root_Parent; - embed @Child.init as &Child_init; - embed .runtime as &Parent_runtime; - } - section runtime { - entry %contract_runtime_root_Parent; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/internal_helper_shadowing.snap b/crates/codegen/tests/fixtures/sonatina_ir/internal_helper_shadowing.snap deleted file mode 100644 index 4ad331b0ad..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/internal_helper_shadowing.snap +++ /dev/null @@ -1,94 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/internal_helper_shadowing.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i64, i64}; -type @layout_1 = {@layout_0, @layout_0}; - -func private %call_internal_helpers(v0.i64, v1.i64) -> @layout_0 { - block0: - jump block1; - - block1: - (v4.i64, v5.i1) = uaddo v0 v1; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v13.i64 = call %saturating_add v0 v1; - v15.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - v17.@layout_0 = insert_value v15 1.i256 v13; - return v17; -} - -func private %call_user_helpers(v0.i64, v1.i64) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i64 = call %checked_add_u64 v0 v1; - v5.i64 = call %saturating_add_u64 v0 v1; - v8.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - v10.@layout_0 = insert_value v8 1.i256 v5; - return v10; -} - -func private %checked_add_u64(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - return 77.i64; -} - -func private %main() -> @layout_1 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %call_user_helpers 1.i64 2.i64; - v3.@layout_0 = call %call_internal_helpers 1.i64 2.i64; - v6.@layout_1 = insert_value undef.@layout_1 0.i256 v2; - v8.@layout_1 = insert_value v6 1.i256 v3; - return v8; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_1 = call %main; - evm_stop; -} - -func private %saturating_add(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - v4.i64 = uaddsat v0 v1; - return v4; -} - -func private %saturating_add_u64(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - return 88.i64; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/intrinsic_ops.snap b/crates/codegen/tests/fixtures/sonatina_ir/intrinsic_ops.snap deleted file mode 100644 index af5256ace6..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/intrinsic_ops.snap +++ /dev/null @@ -1,157 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/intrinsic_ops.fe ---- -target = "evm-ethereum-osaka" - -func private %calldataload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %load_calldata(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %calldataload v0; - return v2; -} - -func private %load_slot(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %sload v0; - return v2; -} - -func private %load_word(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %mload v0; - return v2; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - call %store_word 128.i256 1.i256; - call %store_byte 129.i256 2.i8; - call %store_slot 3.i256 4.i256; - v9.i256 = call %load_word 128.i256; - v10.i256 = call %load_slot 3.i256; - (v11.i256, v12.i1) = uaddo v9 v10; - br v12 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v17.i256 = call %load_calldata 0.i256; - (v18.i256, v19.i1) = uaddo v11 v17; - br v19 block2 block4; - - block4: - return v18; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - -func private %mload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = mload v0 i256; - return v2; -} - -func private %mstore(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %mstore8(v0.i256, v1.i8) { - block0: - jump block1; - - block1: - evm_mstore8 v0 v1; - return; -} - -func private %sload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_sload v0; - return v2; -} - -func private %sstore(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_sstore v0 v1; - return; -} - -func private %store_byte(v0.i256, v1.i8) { - block0: - jump block1; - - block1: - call %mstore8 v0 v1; - return; -} - -func private %store_slot(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %sstore v0 v1; - return; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %mstore v0 v1; - return; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/keccak_in_fn.snap b/crates/codegen/tests/fixtures/sonatina_ir/keccak_in_fn.snap deleted file mode 100644 index e33ae2bdaf..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/keccak_in_fn.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/keccak_in_fn.fe ---- -target = "evm-ethereum-osaka" - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v6.[i8; 5] = insert_value undef.[i8; 5] 0.i256 104.i8; - v8.[i8; 5] = insert_value v6 1.i256 101.i8; - v10.[i8; 5] = insert_value v8 2.i256 108.i8; - v12.[i8; 5] = insert_value v10 3.i256 108.i8; - v14.[i8; 5] = insert_value v12 4.i256 111.i8; - return 12910348618308260923200348219926901280687058984330794534952861439530514639560.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/keccak_intrinsic.snap b/crates/codegen/tests/fixtures/sonatina_ir/keccak_intrinsic.snap deleted file mode 100644 index ea75a964a4..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/keccak_intrinsic.snap +++ /dev/null @@ -1,49 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/keccak_intrinsic.fe ---- -target = "evm-ethereum-osaka" - -func private %hash(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %keccak256 v0 v1; - return v4; -} - -func private %keccak256(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = evm_keccak256 v0 v1; - return v4; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %hash 0.i256 32.i256; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/literal_add.snap b/crates/codegen/tests/fixtures/sonatina_ir/literal_add.snap deleted file mode 100644 index 3a46766ea9..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/literal_add.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/literal_add.fe ---- -target = "evm-ethereum-osaka" - -func private %main() -> i64 { - block0: - jump block1; - - block1: - return 30.i64; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/literal_sub.snap b/crates/codegen/tests/fixtures/sonatina_ir/literal_sub.snap deleted file mode 100644 index 3cfc72a879..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/literal_sub.snap +++ /dev/null @@ -1,39 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/literal_sub.fe ---- -target = "evm-ethereum-osaka" - -func private %literal_sub() -> i64 { - block0: - jump block1; - - block1: - (v2.i64, v3.i1) = usubo 1.i64 2.i64; - br v3 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %literal_sub; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/local_bindings.snap b/crates/codegen/tests/fixtures/sonatina_ir/local_bindings.snap deleted file mode 100644 index ab35564bc3..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/local_bindings.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/local_bindings.fe ---- -target = "evm-ethereum-osaka" - -func private %local_bindings() -> i64 { - block0: - jump block1; - - block1: - return 3.i64; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %local_bindings; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/logical_ops.snap b/crates/codegen/tests/fixtures/sonatina_ir/logical_ops.snap deleted file mode 100644 index ee57af7501..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/logical_ops.snap +++ /dev/null @@ -1,101 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/logical_ops.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i1, i1}; - -func private %logical_and(v0.i8) -> i1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 -1.i8; - v4.i1 = is_zero v3; - br v4 block5 block3; - - block2: - jump block4; - - block3: - jump block4; - - block4: - v7.i1 = phi (1.i1 block2) (0.i1 block3); - return v7; - - block5: - (v10.i8, v11.i1) = uaddo v0 1.i8; - br v11 block6 block7; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v18.i1 = gt v10 0.i8; - br v18 block2 block3; -} - -func private %logical_ops() -> @layout_0 { - block0: - jump block1; - - block1: - v1.i1 = call %logical_or -1.i8; - v2.i1 = call %logical_and -1.i8; - v5.@layout_0 = insert_value undef.@layout_0 0.i256 v1; - v7.@layout_0 = insert_value v5 1.i256 v2; - return v7; -} - -func private %logical_or(v0.i8) -> i1 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 -1.i8; - br v3 block2 block5; - - block2: - jump block4; - - block3: - jump block4; - - block4: - v6.i1 = phi (1.i1 block2) (0.i1 block3); - return v6; - - block5: - (v9.i8, v10.i1) = uaddo v0 1.i8; - br v10 block6 block7; - - block6: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block7: - v17.i1 = gt v9 0.i8; - br v17 block2 block3; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %logical_ops; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return.snap deleted file mode 100644 index cf7e810848..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return.snap +++ /dev/null @@ -1,57 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_arm_return.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = enum { - #A(i256), - #B, -}; - -func private %f(v0.@layout_0) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v3.enumtag(@layout_0) = enum.tag v0; - br_table v3 (0.enumtag(@layout_0) block2) (1.enumtag(@layout_0) block3); - - block2: - enum.assert_variant v0 #A; - v8.i256 = enum.extract v0 #A 0.i256; - mstore v1 v8 i256; - v9.i256 = mload v1 i256; - return v9; - - block3: - return 0.i256; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v0.@layout_0 = enum.make @layout_0 #B; - v1.i256 = call %f v0; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return_comma.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return_comma.snap deleted file mode 100644 index 7c034dfc65..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return_comma.snap +++ /dev/null @@ -1,57 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_arm_return_comma.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = enum { - #A(i256), - #B, -}; - -func private %f(v0.@layout_0) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v3.enumtag(@layout_0) = enum.tag v0; - br_table v3 (0.enumtag(@layout_0) block2) (1.enumtag(@layout_0) block3); - - block2: - enum.assert_variant v0 #A; - v8.i256 = enum.extract v0 #A 0.i256; - mstore v1 v8 i256; - v9.i256 = mload v1 i256; - return v9; - - block3: - return 0.i256; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v1.@layout_0 = enum.make @layout_0 #A 1.i256; - v2.i256 = call %f v1; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_enum.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_enum.snap deleted file mode 100644 index 11bd3ba904..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_enum.snap +++ /dev/null @@ -1,60 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_enum.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = enum { - #A, - #B, - #C, -}; - -func private %main() -> i8 { - block0: - jump block1; - - block1: - v0.@layout_0 = enum.make @layout_0 #B; - v1.i8 = call %match_enum v0; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i8 = call %main; - evm_stop; -} - -func private %match_enum(v0.@layout_0) -> i8 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_0) = enum.tag v0; - br_table v2 (0.enumtag(@layout_0) block3) (1.enumtag(@layout_0) block4) (2.enumtag(@layout_0) block5); - - block2: - v6.i8 = phi (1.i8 block3) (2.i8 block4) (3.i8 block5); - return v6; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_enum_with_data.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_enum_with_data.snap deleted file mode 100644 index ff1fd34575..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_enum_with_data.snap +++ /dev/null @@ -1,67 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_enum_with_data.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = enum { - #None, - #Some(i64), -}; - -func private %main() -> i64 { - block0: - jump block1; - - block1: - v1.@layout_0 = call %make_some 7.i64; - v2.i64 = call %match_option v1; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %main; - evm_stop; -} - -func private %make_some(v0.i64) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = enum.make @layout_0 #Some v0; - return v2; -} - -func private %match_option(v0.@layout_0) -> i64 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_0) = enum.tag v0; - br_table v2 (1.enumtag(@layout_0) block3) (0.enumtag(@layout_0) block4); - - block2: - v5.i64 = phi (v8 block3) (0.i64 block4); - return v5; - - block3: - enum.assert_variant v0 #Some; - v8.i64 = enum.extract v0 #Some 0.i256; - jump block2; - - block4: - jump block2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_fn_call.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_fn_call.snap deleted file mode 100644 index 5be1404c1c..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_fn_call.snap +++ /dev/null @@ -1,148 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_fn_call.fe ---- -target = "evm-ethereum-osaka" - -func private %std__lib__evm__effects__impl_trait_Evm_0098__calldataload_97e7(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__calldataload_97e7_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__calldataload_97e7_1(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %standalone_match_fn_call__match_fn_call__example__gcd5c_4226() -> i256 { - block0: - jump block1; - - block1: - v0.i256 = call %standalone_match_fn_call__match_fn_call__read_selector__gcd5c_94d5; - v2.i1 = eq v0 305419896.i256; - br v2 block3 block6; - - block2: - v3.i256 = phi (1.i256 block3) (2.i256 block4) (3.i256 block5); - return v3; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v9.i1 = eq v0 591751049.i256; - br v9 block4 block7; - - block7: - jump block5; -} - -func private %standalone_match_fn_call__match_fn_call__example__gcd5c_6cd2() -> i256 { - block0: - jump block1; - - block1: - v0.i256 = call %standalone_match_fn_call__match_fn_call__read_selector__gcd5c_5a44; - v2.i1 = eq v0 305419896.i256; - br v2 block3 block6; - - block2: - v3.i256 = phi (1.i256 block3) (2.i256 block4) (3.i256 block5); - return v3; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v9.i1 = eq v0 591751049.i256; - br v9 block4 block7; - - block7: - jump block5; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v0.i256 = call %standalone_match_fn_call__match_fn_call__example__gcd5c_6cd2; - return v0; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - -func private %standalone_match_fn_call__match_fn_call__read_selector__gcd5c_044c() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %std__lib__evm__effects__impl_trait_Evm_0098__calldataload_97e7 0.i256; - v3.i256 = shr 224.i256 v1; - return v3; -} - -func private %standalone_match_fn_call__match_fn_call__read_selector__gcd5c_5a44() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %std__lib__evm__effects__impl_trait_Evm_0098__calldataload_97e7_0 0.i256; - v3.i256 = shr 224.i256 v1; - return v3; -} - -func private %standalone_match_fn_call__match_fn_call__read_selector__gcd5c_94d5() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %std__lib__evm__effects__impl_trait_Evm_0098__calldataload_97e7_1 0.i256; - v3.i256 = shr 224.i256 v1; - return v3; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_literal.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_literal.snap deleted file mode 100644 index 2650076cdf..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_literal.snap +++ /dev/null @@ -1,413 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_literal.fe ---- -target = "evm-ethereum-osaka" - -func private %main() { - block0: - jump block1; - - block1: - v1.i64 = call %match_bool 1.i1; - v3.i8 = call %match_u8 -1.i8; - v5.i16 = call %match_u16 4660.i16; - v7.i32 = call %match_u32 -559038737.i32; - v9.i64 = call %match_u64 1.i64; - v11.i128 = call %match_u128 1.i128; - v13.i256 = call %match_u256 1.i256; - v15.i8 = call %match_i8 99.i8; - v17.i16 = call %match_i16 32000.i16; - v19.i32 = call %match_i32 2000000000.i32; - v20.i64 = call %match_i64 1.i64; - v21.i128 = call %match_i128 1.i128; - v22.i256 = call %match_i256 1.i256; - return; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %main; - evm_stop; -} - -func private %match_bool(v0.i1) -> i64 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 1.i1; - br v3 block3 block5; - - block2: - v4.i64 = phi (1.i64 block3) (2.i64 block4); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block4; -} - -func private %match_i128(v0.i128) -> i128 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i128; - br v3 block3 block6; - - block2: - v4.i128 = phi (1.i128 block3) (2.i128 block4) (3.i128 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 170141183460469231731687303715884105727.i128; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_i16(v0.i16) -> i16 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i16; - br v3 block3 block6; - - block2: - v4.i16 = phi (1.i16 block3) (2.i16 block4) (3.i16 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 32000.i16; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_i256(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block3 block6; - - block2: - v4.i256 = phi (1.i256 block3) (2.i256 block4) (3.i256 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 -1.i256; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_i32(v0.i32) -> i32 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i32; - br v3 block3 block6; - - block2: - v4.i32 = phi (1.i32 block3) (2.i32 block4) (3.i32 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 2000000000.i32; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_i64(v0.i64) -> i64 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i64; - br v3 block3 block6; - - block2: - v4.i64 = phi (1.i64 block3) (2.i64 block4) (3.i64 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 9223372036854775807.i64; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_i8(v0.i8) -> i8 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i8; - br v3 block3 block6; - - block2: - v4.i8 = phi (1.i8 block3) (2.i8 block4) (3.i8 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 99.i8; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_u128(v0.i128) -> i128 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i128; - br v3 block3 block6; - - block2: - v4.i128 = phi (1.i128 block3) (2.i128 block4) (3.i128 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 -1.i128; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_u16(v0.i16) -> i16 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 4660.i16; - br v3 block3 block6; - - block2: - v4.i16 = phi (1.i16 block3) (2.i16 block4) (3.i16 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 -21555.i16; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_u256(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block3 block6; - - block2: - v4.i256 = phi (1.i256 block3) (2.i256 block4) (3.i256 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 -1.i256; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_u32(v0.i32) -> i32 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 -559038737.i32; - br v3 block3 block6; - - block2: - v4.i32 = phi (1.i32 block3) (2.i32 block4) (3.i32 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 -889275714.i32; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_u64(v0.i64) -> i64 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i64; - br v3 block3 block6; - - block2: - v4.i64 = phi (1.i64 block3) (2.i64 block4) (3.i64 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 -1.i64; - br v10 block4 block7; - - block7: - jump block5; -} - -func private %match_u8(v0.i8) -> i8 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i8; - br v3 block3 block6; - - block2: - v4.i8 = phi (1.i8 block3) (2.i8 block4) (3.i8 block5); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; - - block6: - v10.i1 = eq v0 -1.i8; - br v10 block4 block7; - - block7: - jump block5; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_mixed_return.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_mixed_return.snap deleted file mode 100644 index 0d06718895..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_mixed_return.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_mixed_return.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = enum { - #A, - #B, -}; - -func private %f(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_0) = enum.tag v0; - br_table v2 (0.enumtag(@layout_0) block3) (1.enumtag(@layout_0) block4); - - block2: - return 2.i256; - - block3: - return 0.i256; - - block4: - jump block2; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v0.@layout_0 = enum.make @layout_0 #B; - v1.i256 = call %f v0; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_nested_default.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_nested_default.snap deleted file mode 100644 index 47d05b1407..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_nested_default.snap +++ /dev/null @@ -1,199 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_nested_default.fe ---- -target = "evm-ethereum-osaka" - -type @layout_3 = {i8, i8, i8, i8}; -type @layout_0 = enum { - #A, - #B, - #C, -}; -type @layout_1 = enum { - #First(@layout_0), - #Second(@layout_0), -}; -type @layout_2 = enum { - #Wrap(@layout_1), -}; - -func private %deeply_nested_wildcard(v0.@layout_2) -> i8 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_2) = enum.tag v0; - br_table v2 (0.enumtag(@layout_2) block3); - - block2: - v4.i8 = phi (0.i8 block5) (1.i8 block6) (0.i8 block7); - return v4; - - block3: - enum.assert_variant v0 #Wrap; - v7.@layout_1 = enum.extract v0 #Wrap 0.i256; - v8.enumtag(@layout_1) = enum.tag v7; - br_table v8 block5 (0.enumtag(@layout_1) block4); - - block4: - enum.assert_variant v0 #Wrap; - v11.@layout_1 = enum.extract v0 #Wrap 0.i256; - enum.assert_variant v11 #First; - v12.@layout_0 = enum.extract v11 #First 0.i256; - v13.enumtag(@layout_0) = enum.tag v12; - br_table v13 block7 (0.enumtag(@layout_0) block6); - - block5: - jump block2; - - block6: - jump block2; - - block7: - jump block2; -} - -func private %exhaustive_inner_outer_wildcard(v0.@layout_1) -> i8 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_1) = enum.tag v0; - br_table v2 block4 (0.enumtag(@layout_1) block3); - - block2: - v4.i8 = phi (0.i8 block4) (1.i8 block5) (2.i8 block6) (3.i8 block7); - return v4; - - block3: - enum.assert_variant v0 #First; - v7.@layout_0 = enum.extract v0 #First 0.i256; - v8.enumtag(@layout_0) = enum.tag v7; - br_table v8 (0.enumtag(@layout_0) block5) (1.enumtag(@layout_0) block6) (2.enumtag(@layout_0) block7); - - block4: - jump block2; - - block5: - jump block2; - - block6: - jump block2; - - block7: - jump block2; -} - -func private %main() -> @layout_3 { - block0: - jump block1; - - block1: - v0.@layout_0 = enum.make @layout_0 #A; - v1.@layout_0 = enum.make @layout_0 #A; - v2.@layout_1 = enum.make @layout_1 #First v1; - v3.i8 = call %nested_with_defaults v2; - v4.@layout_0 = enum.make @layout_0 #B; - v5.@layout_0 = enum.make @layout_0 #B; - v6.@layout_1 = enum.make @layout_1 #First v5; - v7.i8 = call %outer_specific_inner_wildcard v6; - v8.@layout_0 = enum.make @layout_0 #C; - v9.@layout_0 = enum.make @layout_0 #C; - v10.@layout_1 = enum.make @layout_1 #Second v9; - v11.@layout_0 = enum.make @layout_0 #C; - v12.@layout_1 = enum.make @layout_1 #Second v11; - v13.@layout_2 = enum.make @layout_2 #Wrap v12; - v14.i8 = call %deeply_nested_wildcard v13; - v15.@layout_0 = enum.make @layout_0 #C; - v16.@layout_0 = enum.make @layout_0 #C; - v17.@layout_1 = enum.make @layout_1 #First v16; - v18.i8 = call %exhaustive_inner_outer_wildcard v17; - v21.@layout_3 = insert_value undef.@layout_3 0.i256 v3; - v23.@layout_3 = insert_value v21 1.i256 v7; - v25.@layout_3 = insert_value v23 2.i256 v14; - v27.@layout_3 = insert_value v25 3.i256 v18; - return v27; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_3 = call %main; - evm_stop; -} - -func private %nested_with_defaults(v0.@layout_1) -> i8 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_1) = enum.tag v0; - br_table v2 (0.enumtag(@layout_1) block3) (1.enumtag(@layout_1) block4); - - block2: - v5.i8 = phi (1.i8 block5) (0.i8 block6) (2.i8 block7) (0.i8 block8); - return v5; - - block3: - enum.assert_variant v0 #First; - v8.@layout_0 = enum.extract v0 #First 0.i256; - v9.enumtag(@layout_0) = enum.tag v8; - br_table v9 block6 (0.enumtag(@layout_0) block5); - - block4: - enum.assert_variant v0 #Second; - v12.@layout_0 = enum.extract v0 #Second 0.i256; - v13.enumtag(@layout_0) = enum.tag v12; - br_table v13 block8 (1.enumtag(@layout_0) block7); - - block5: - jump block2; - - block6: - jump block2; - - block7: - jump block2; - - block8: - jump block2; -} - -func private %outer_specific_inner_wildcard(v0.@layout_1) -> i8 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_1) = enum.tag v0; - br_table v2 block4 (0.enumtag(@layout_1) block3); - - block2: - v4.i8 = phi (3.i8 block4) (1.i8 block5) (2.i8 block6); - return v4; - - block3: - enum.assert_variant v0 #First; - v7.@layout_0 = enum.extract v0 #First 0.i256; - v8.enumtag(@layout_0) = enum.tag v7; - br_table v8 block6 (0.enumtag(@layout_0) block5); - - block4: - jump block2; - - block5: - jump block2; - - block6: - jump block2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_nested_enum.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_nested_enum.snap deleted file mode 100644 index 34f4f01c6d..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_nested_enum.snap +++ /dev/null @@ -1,76 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -assertion_line: 455 -expression: output -input_file: crates/codegen/tests/fixtures/match_nested_enum.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = enum { - #Unit, - #Value(i8), -}; -type @layout_1 = enum { - #First(@layout_0), - #Second(i8), -}; - -func private %main() -> i8 { - block0: - jump block1; - - block1: - v1.@layout_0 = enum.make @layout_0 #Value 7.i8; - v2.@layout_0 = enum.make @layout_0 #Value 7.i8; - v3.@layout_1 = enum.make @layout_1 #First v2; - v4.i8 = call %match_nested_enum v3; - return v4; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i8 = call %main; - evm_stop; -} - -func private %match_nested_enum(v0.@layout_1) -> i8 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_1) = enum.tag v0; - br_table v2 (0.enumtag(@layout_1) block3) (1.enumtag(@layout_1) block4); - - block2: - v5.i8 = phi (v13 block4) (0.i8 block5) (v16 block6); - return v5; - - block3: - enum.assert_variant v0 #First; - v8.@layout_0 = enum.extract v0 #First 0.i256; - v9.enumtag(@layout_0) = enum.tag v8; - br_table v9 (0.enumtag(@layout_0) block5) (1.enumtag(@layout_0) block6); - - block4: - enum.assert_variant v0 #Second; - v13.i8 = enum.extract v0 #Second 0.i256; - jump block2; - - block5: - jump block2; - - block6: - enum.assert_variant v8 #Value; - v16.i8 = enum.extract v8 #Value 0.i256; - jump block2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_newtype_nested.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_newtype_nested.snap deleted file mode 100644 index 061deef091..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_newtype_nested.snap +++ /dev/null @@ -1,73 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_newtype_nested.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; -type @layout_1 = {@layout_0}; - -global private const @layout_0 $const_region_0 = {10}; -global private const @layout_1 $const_region_1 = {{10}}; - -func private %f() -> i256 { - block0: - jump block1; - - block1: - v1.constref<@layout_0> = const.ref $const_region_0; - v2.constref<@layout_1> = const.ref $const_region_1; - v3.constref<@layout_1> = const.ref $const_region_1; - v4.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v4 v3; - v5.@layout_1 = obj.load v4; - v6.i256 = call %match_newtype_nested v5; - return v6; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %f; - evm_stop; -} - -func private %match_newtype_nested(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v1.i256 = phi (0.i256 block5) (v6 block6); - return v1; - - block3: - v4.@layout_0 = extract_value v0 0.i256; - jump block4; - - block4: - v6.i256 = extract_value v4 0.i256; - v7.i1 = eq v6 0.i256; - br v7 block5 block7; - - block5: - jump block2; - - block6: - jump block2; - - block7: - jump block6; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_return.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_return.snap deleted file mode 100644 index 94cbc4a694..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_return.snap +++ /dev/null @@ -1,62 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_return.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = enum { - #A, - #B, -}; - -func private %f(v0.@layout_0) { - block0: - jump block1; - - block1: - v2.enumtag(@layout_0) = enum.tag v0; - br_table v2 (0.enumtag(@layout_0) block2) (1.enumtag(@layout_0) block3); - - block2: - call %return_data 0.i256 0.i256; - unreachable; - - block3: - call %return_data 0.i256 0.i256; - unreachable; -} - -func private %main() { - block0: - jump block1; - - block1: - v0.@layout_0 = enum.make @layout_0 #A; - call %f v0; - unreachable; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %main; - evm_stop; -} - -func private %return_data(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_struct.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_struct.snap deleted file mode 100644 index 26021f63af..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_struct.snap +++ /dev/null @@ -1,161 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_struct.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i8, i8}; -type @layout_1 = {i8, i8}; - -global private const @layout_1 $const_region_0 = {1, 2}; -global private const @layout_1 $const_region_1 = {0, 1}; - -func private %main() -> @layout_0 { - block0: - jump block1; - - block1: - v2.constref<@layout_1> = const.ref $const_region_0; - v3.i8 = call %match_struct_fields v2; - v5.constref<@layout_1> = const.ref $const_region_1; - v6.i8 = call %match_struct_wildcard v5; - v9.@layout_0 = insert_value undef.@layout_0 0.i256 v3; - v11.@layout_0 = insert_value v9 1.i256 v6; - return v11; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %main; - evm_stop; -} - -func private %match_struct_fields(v0.constref<@layout_1>) -> i8 { - block0: - v1.*i8 = alloca i8; - v2.*i8 = alloca i8; - v3.*i8 = alloca i8; - v4.*i8 = alloca i8; - jump block1; - - block1: - jump block3; - - block2: - v6.i8 = phi (0.i8 block7) (v25 block8) (v29 block10) (v37 block14); - return v6; - - block3: - v10.constref = const.proj v0 1.i256; - v11.i8 = const.load v10; - v12.i1 = eq v11 0.i8; - br v12 block4 block6; - - block4: - v15.constref = const.proj v0 0.i256; - v16.i8 = const.load v15; - v17.i1 = eq v16 0.i8; - br v17 block7 block9; - - block5: - v19.constref = const.proj v0 0.i256; - v20.i8 = const.load v19; - v21.i1 = eq v20 0.i8; - br v21 block10 block12; - - block6: - jump block5; - - block7: - jump block2; - - block8: - v23.constref = const.proj v0 0.i256; - v24.i8 = const.load v23; - mstore v2 v24 i8; - v25.i8 = mload v2 i8; - jump block2; - - block9: - jump block8; - - block10: - v27.constref = const.proj v0 1.i256; - v28.i8 = const.load v27; - mstore v1 v28 i8; - v29.i8 = mload v1 i8; - jump block2; - - block11: - v31.constref = const.proj v0 1.i256; - v32.i8 = const.load v31; - mstore v4 v32 i8; - v33.constref = const.proj v0 0.i256; - v34.i8 = const.load v33; - mstore v3 v34 i8; - v35.i8 = mload v3 i8; - v36.i8 = mload v4 i8; - (v37.i8, v38.i1) = uaddo v35 v36; - br v38 block13 block14; - - block12: - jump block11; - - block13: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block14: - jump block2; -} - -func private %match_struct_wildcard(v0.constref<@layout_1>) -> i8 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v2.i8 = phi (1.i8 block4) (2.i8 block7) (3.i8 block8); - return v2; - - block3: - v6.constref = const.proj v0 0.i256; - v7.i8 = const.load v6; - v8.i1 = eq v7 0.i8; - br v8 block4 block6; - - block4: - jump block2; - - block5: - v12.constref = const.proj v0 1.i256; - v13.i8 = const.load v12; - v14.i1 = eq v13 0.i8; - br v14 block7 block9; - - block6: - jump block5; - - block7: - jump block2; - - block8: - jump block2; - - block9: - jump block8; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_tuple.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_tuple.snap deleted file mode 100644 index ea170a9ecc..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_tuple.snap +++ /dev/null @@ -1,171 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_tuple.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i8, i8, i8}; -type @layout_1 = {i1, i1}; -type @layout_2 = {i1, i8}; - -global private const @layout_1 $const_region_0 = {1, 0}; -global private const @layout_1 $const_region_1 = {0, 1}; -global private const @layout_2 $const_region_2 = {1, 2}; - -func private %main() -> @layout_0 { - block0: - jump block1; - - block1: - v2.constref<@layout_1> = const.ref $const_region_0; - v3.i8 = call %match_bool_tuple v2; - v4.constref<@layout_1> = const.ref $const_region_1; - v5.i8 = call %match_tuple_with_wildcard v4; - v7.constref<@layout_2> = const.ref $const_region_2; - v8.i8 = call %match_mixed_tuple v7; - v11.@layout_0 = insert_value undef.@layout_0 0.i256 v3; - v13.@layout_0 = insert_value v11 1.i256 v5; - v15.@layout_0 = insert_value v13 2.i256 v8; - return v15; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %main; - evm_stop; -} - -func private %match_bool_tuple(v0.constref<@layout_1>) -> i8 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v2.i8 = phi (3.i8 block7) (1.i8 block8) (2.i8 block10) (0.i8 block11); - return v2; - - block3: - v5.constref = const.proj v0 1.i256; - v6.i1 = const.load v5; - v8.i1 = eq v6 1.i1; - br v8 block4 block6; - - block4: - v11.constref = const.proj v0 0.i256; - v12.i1 = const.load v11; - v13.i1 = eq v12 1.i1; - br v13 block7 block9; - - block5: - v15.constref = const.proj v0 0.i256; - v16.i1 = const.load v15; - v17.i1 = eq v16 1.i1; - br v17 block10 block12; - - block6: - jump block5; - - block7: - jump block2; - - block8: - jump block2; - - block9: - jump block8; - - block10: - jump block2; - - block11: - jump block2; - - block12: - jump block11; -} - -func private %match_mixed_tuple(v0.constref<@layout_2>) -> i8 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v2.i8 = phi (0.i8 block5) (10.i8 block7) (11.i8 block8) (12.i8 block9); - return v2; - - block3: - v5.constref = const.proj v0 0.i256; - v6.i1 = const.load v5; - v8.i1 = eq v6 1.i1; - br v8 block4 block6; - - block4: - v11.constref = const.proj v0 1.i256; - v12.i8 = const.load v11; - v14.i1 = eq v12 0.i8; - br v14 block7 block10; - - block5: - jump block2; - - block6: - jump block5; - - block7: - jump block2; - - block8: - jump block2; - - block9: - jump block2; - - block10: - v20.i1 = eq v12 1.i8; - br v20 block8 block11; - - block11: - jump block9; -} - -func private %match_tuple_with_wildcard(v0.constref<@layout_1>) -> i8 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v2.i8 = phi (1.i8 block4) (0.i8 block5); - return v2; - - block3: - v5.constref = const.proj v0 0.i256; - v6.i1 = const.load v5; - v8.i1 = eq v6 1.i1; - br v8 block4 block6; - - block4: - jump block2; - - block5: - jump block2; - - block6: - jump block5; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_tuple_binding.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_tuple_binding.snap deleted file mode 100644 index c69312c7f8..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_tuple_binding.snap +++ /dev/null @@ -1,183 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_tuple_binding.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i8, i8}; -type @layout_1 = {@layout_0, i8}; - -global private const @layout_0 $const_region_0 = {1, 2}; -global private const @layout_1 $const_region_1 = {{1, 2}, 3}; - -func private %main() -> @layout_0 { - block0: - jump block1; - - block1: - v2.constref<@layout_0> = const.ref $const_region_0; - v3.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v3 v2; - v4.@layout_0 = obj.load v3; - v5.i8 = call %match_tuple_extract v4; - v6.constref<@layout_0> = const.ref $const_region_0; - v8.constref<@layout_1> = const.ref $const_region_1; - v9.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v9 v8; - v10.@layout_1 = obj.load v9; - v11.i8 = call %match_nested_extract v10; - v14.@layout_0 = insert_value undef.@layout_0 0.i256 v5; - v16.@layout_0 = insert_value v14 1.i256 v11; - return v16; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %main; - evm_stop; -} - -func private %match_nested_extract(v0.@layout_1) -> i8 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v1.i8 = phi (v17 block8) (v23 block18) (v31 block19) (v36 block20) (v41 block21); - return v1; - - block3: - v4.@layout_0 = extract_value v0 0.i256; - jump block4; - - block4: - v7.i8 = extract_value v4 1.i256; - v9.i1 = eq v7 0.i8; - br v9 block5 block7; - - block5: - v11.i8 = extract_value v4 0.i256; - v12.i1 = eq v11 0.i8; - br v12 block8 block10; - - block6: - v14.i8 = extract_value v0 1.i256; - v15.i1 = eq v14 0.i8; - br v15 block14 block16; - - block7: - jump block6; - - block8: - v17.i8 = extract_value v0 1.i256; - jump block2; - - block9: - v19.i8 = extract_value v0 1.i256; - v20.i1 = eq v19 0.i8; - br v20 block11 block13; - - block10: - jump block9; - - block11: - (v23.i8, v24.i1) = uaddo v11 v7; - br v24 block17 block18; - - block12: - (v31.i8, v32.i1) = uaddo v11 v19; - br v32 block17 block19; - - block13: - jump block12; - - block14: - v35.i8 = extract_value v4 0.i256; - (v36.i8, v37.i1) = uaddo v35 v7; - br v37 block17 block20; - - block15: - v40.i8 = extract_value v4 0.i256; - (v41.i8, v42.i1) = uaddo v40 v14; - br v42 block17 block21; - - block16: - jump block15; - - block17: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block18: - jump block2; - - block19: - jump block2; - - block20: - jump block2; - - block21: - jump block2; -} - -func private %match_tuple_extract(v0.@layout_0) -> i8 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v1.i8 = phi (v9 block4) (v4 block7) (v16 block11); - return v1; - - block3: - v4.i8 = extract_value v0 0.i256; - v6.i1 = eq v4 0.i8; - br v6 block4 block6; - - block4: - v9.i8 = extract_value v0 1.i256; - jump block2; - - block5: - v11.i8 = extract_value v0 1.i256; - v12.i1 = eq v11 0.i8; - br v12 block7 block9; - - block6: - jump block5; - - block7: - jump block2; - - block8: - (v16.i8, v17.i1) = uaddo v4 v11; - br v17 block10 block11; - - block9: - jump block8; - - block10: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block11: - jump block2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_tuple_nested.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_tuple_nested.snap deleted file mode 100644 index b0deff4d5d..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_tuple_nested.snap +++ /dev/null @@ -1,189 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_tuple_nested.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i8, i8}; -type @layout_1 = {i1, i1}; -type @layout_2 = {@layout_1, i1}; -type @layout_3 = {@layout_2, i1}; - -global private const @layout_1 $const_region_0 = {1, 0}; -global private const @layout_2 $const_region_1 = {{1, 0}, 1}; -global private const @layout_1 $const_region_2 = {1, 1}; -global private const @layout_2 $const_region_3 = {{1, 1}, 0}; -global private const @layout_3 $const_region_4 = {{{1, 1}, 0}, 1}; - -func private %main() -> @layout_0 { - block0: - jump block1; - - block1: - v2.constref<@layout_1> = const.ref $const_region_0; - v3.constref<@layout_2> = const.ref $const_region_1; - v4.i8 = call %match_nested_tuple v3; - v5.constref<@layout_1> = const.ref $const_region_2; - v6.constref<@layout_2> = const.ref $const_region_3; - v7.constref<@layout_3> = const.ref $const_region_4; - v8.i8 = call %match_deeply_nested v7; - v11.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - v13.@layout_0 = insert_value v11 1.i256 v8; - return v13; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %main; - evm_stop; -} - -func private %match_deeply_nested(v0.constref<@layout_3>) -> i8 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v2.i8 = phi (0.i8 block7) (8.i8 block10) (8.i8 block13) (15.i8 block15) (8.i8 block16); - return v2; - - block3: - v5.constref<@layout_2> = const.proj v0 0.i256; - v6.objref<@layout_2> = obj.alloc @layout_2; - obj.init.const v6 v5; - v7.@layout_2 = obj.load v6; - jump block4; - - block4: - v9.@layout_1 = extract_value v7 0.i256; - jump block5; - - block5: - v11.i1 = extract_value v9 0.i256; - v13.i1 = eq v11 1.i1; - br v13 block6 block8; - - block6: - v16.constref = const.proj v0 1.i256; - v17.i1 = const.load v16; - v18.i1 = eq v17 1.i1; - br v18 block9 block11; - - block7: - jump block2; - - block8: - jump block7; - - block9: - v21.i1 = extract_value v7 1.i256; - v22.i1 = eq v21 1.i1; - br v22 block12 block14; - - block10: - jump block2; - - block11: - jump block10; - - block12: - v25.i1 = extract_value v9 1.i256; - v26.i1 = eq v25 1.i1; - br v26 block15 block17; - - block13: - jump block2; - - block14: - jump block13; - - block15: - jump block2; - - block16: - jump block2; - - block17: - jump block16; -} - -func private %match_nested_tuple(v0.constref<@layout_2>) -> i8 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v2.i8 = phi (5.i8 block9) (7.i8 block11) (6.i8 block12) (2.i8 block14) (1.i8 block15); - return v2; - - block3: - v5.constref<@layout_1> = const.proj v0 0.i256; - v6.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v6 v5; - v7.@layout_1 = obj.load v6; - jump block4; - - block4: - v9.i1 = extract_value v7 0.i256; - v11.i1 = eq v9 1.i1; - br v11 block5 block7; - - block5: - v14.i1 = extract_value v7 1.i256; - v15.i1 = eq v14 1.i1; - br v15 block8 block10; - - block6: - v17.constref = const.proj v0 1.i256; - v18.i1 = const.load v17; - v19.i1 = eq v18 1.i1; - br v19 block14 block16; - - block7: - jump block6; - - block8: - v21.constref = const.proj v0 1.i256; - v22.i1 = const.load v21; - v23.i1 = eq v22 1.i1; - br v23 block11 block13; - - block9: - jump block2; - - block10: - jump block9; - - block11: - jump block2; - - block12: - jump block2; - - block13: - jump block12; - - block14: - jump block2; - - block15: - jump block2; - - block16: - jump block15; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_wildcard.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_wildcard.snap deleted file mode 100644 index a5a425680e..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_wildcard.snap +++ /dev/null @@ -1,108 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/match_wildcard.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i8, i8, i8}; -type @layout_1 = enum { - #Red, - #Green, - #Blue, -}; - -func private %main() -> @layout_0 { - block0: - jump block1; - - block1: - v0.@layout_1 = enum.make @layout_1 #Red; - v1.i8 = call %match_with_wildcard v0; - v3.i8 = call %wildcard_not_last 1.i8; - v4.@layout_1 = enum.make @layout_1 #Green; - v5.i8 = call %multiple_before_wildcard v4; - v8.@layout_0 = insert_value undef.@layout_0 0.i256 v1; - v10.@layout_0 = insert_value v8 1.i256 v3; - v12.@layout_0 = insert_value v10 2.i256 v5; - return v12; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %main; - evm_stop; -} - -func private %match_with_wildcard(v0.@layout_1) -> i8 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_1) = enum.tag v0; - br_table v2 block4 (0.enumtag(@layout_1) block3); - - block2: - v4.i8 = phi (1.i8 block3) (0.i8 block4); - return v4; - - block3: - jump block2; - - block4: - jump block2; -} - -func private %multiple_before_wildcard(v0.@layout_1) -> i8 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_1) = enum.tag v0; - br_table v2 block5 (0.enumtag(@layout_1) block3) (1.enumtag(@layout_1) block4); - - block2: - v5.i8 = phi (1.i8 block3) (2.i8 block4) (3.i8 block5); - return v5; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block2; -} - -func private %wildcard_not_last(v0.i8) -> i8 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i8; - br v3 block3 block5; - - block2: - v4.i8 = phi (10.i8 block3) (99.i8 block4); - return v4; - - block3: - jump block2; - - block4: - jump block2; - - block5: - jump block4; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/math_ops.snap b/crates/codegen/tests/fixtures/sonatina_ir/math_ops.snap deleted file mode 100644 index 57cde0a4ad..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/math_ops.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/math_ops.fe ---- -target = "evm-ethereum-osaka" - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %math_ops; - evm_stop; -} - -func private %math_ops() -> i64 { - block0: - jump block1; - - block1: - return 2.i64; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/method_call.snap b/crates/codegen/tests/fixtures/sonatina_ir/method_call.snap deleted file mode 100644 index 1e097ba145..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/method_call.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/method_call.fe ---- -target = "evm-ethereum-osaka" - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %make_value; - evm_stop; -} - -func private %make_value() -> i64 { - block0: - jump block1; - - block1: - return 42.i64; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/method_infer_by_constraints.snap b/crates/codegen/tests/fixtures/sonatina_ir/method_infer_by_constraints.snap deleted file mode 100644 index 88356ab8a5..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/method_infer_by_constraints.snap +++ /dev/null @@ -1,50 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/method_infer_by_constraints.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i64, i64}; -type @layout_1 = {i64}; - -global private const @layout_1 $const_region_0 = {10}; - -func private %call() -> @layout_0 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_0; - v2.constref<@layout_1> = const.ref $const_region_0; - v3.@layout_0 = call %foo v2; - return v3; -} - -func private %foo(v0.constref<@layout_1>) -> @layout_0 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i64 = const.load v3; - v7.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - v9.@layout_0 = insert_value v7 1.i256 1.i64; - return v9; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %call; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/momo.snap b/crates/codegen/tests/fixtures/sonatina_ir/momo.snap deleted file mode 100644 index 36398c2b08..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/momo.snap +++ /dev/null @@ -1,57 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/momo.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i8, i8}; - -global private const @layout_0 $const_region_0 = {1, 2}; - -func private %main() -> i8 { - block0: - jump block1; - - block1: - v2.constref<@layout_0> = const.ref $const_region_0; - v3.i8 = call %read_x v2; - return v3; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i8 = call %main; - evm_stop; -} - -func private %read_x(v0.constref<@layout_0>) -> i8 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i8 = const.load v3; - v6.constref = const.proj v0 1.i256; - v7.i8 = const.load v6; - (v8.i8, v9.i1) = uaddo v4 v7; - br v9 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v8; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/name_collisions.snap b/crates/codegen/tests/fixtures/sonatina_ir/name_collisions.snap deleted file mode 100644 index 43952e19d1..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/name_collisions.snap +++ /dev/null @@ -1,622 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/name_collisions.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i64}; -type @layout_1 = {i32}; -type @layout_2 = {i32}; -type @layout_3 = {i64}; -type @layout_4 = {i32}; - -global private const @layout_1 $const_region_0 = {1}; -global private const @layout_0 $const_region_1 = {2}; -global private const @layout_2 $const_region_2 = {10}; -global private const @layout_3 $const_region_3 = {20}; -global private const @layout_4 $const_region_4 = {100}; - -func private %standalone_name_collisions__name_collisions____u32_as_u256_56b3(v0.i32) -> i256 { - block0: - jump block1; - - block1: - return 999.i256; -} - -func private %standalone_name_collisions__name_collisions____u32_as_u256_56b3_0(v0.i32) -> i256 { - block0: - jump block1; - - block1: - return 999.i256; -} - -func private %standalone_name_collisions__name_collisions__add_9cf2() -> i32 { - block0: - jump block1; - - block1: - return 123.i32; -} - -func private %standalone_name_collisions__name_collisions__add_9cf2_0() -> i32 { - block0: - jump block1; - - block1: - return 123.i32; -} - -func private %standalone_name_collisions__name_collisions__add_9cf2_1() -> i32 { - block0: - jump block1; - - block1: - return 123.i32; -} - -func private %standalone_name_collisions__name_collisions__a__b__flattened_fn_97f0() -> i32 { - block0: - jump block1; - - block1: - return 1.i32; -} - -func private %standalone_name_collisions__name_collisions__a__b__flattened_fn_aebd() -> i32 { - block0: - jump block1; - - block1: - return 1.i32; -} - -func private %standalone_name_collisions__name_collisions__a__b__flattened_fn_aebd_0() -> i32 { - block0: - jump block1; - - block1: - return 1.i32; -} - -func private %standalone_name_collisions__name_collisions__a_b__flattened_fn_e3ab() -> i32 { - block0: - jump block1; - - block1: - return 2.i32; -} - -func private %standalone_name_collisions__name_collisions__a_b__flattened_fn_e3ab_0() -> i32 { - block0: - jump block1; - - block1: - return 2.i32; -} - -func private %standalone_name_collisions__name_collisions__a_b__flattened_fn_ec84() -> i32 { - block0: - jump block1; - - block1: - return 2.i32; -} - -func private %standalone_name_collisions__name_collisions__generic_fn__gf088_02a1(v0.@layout_0) -> @layout_0 { - block0: - jump block1; - - block1: - return v0; -} - -func private %standalone_name_collisions__name_collisions__generic_fn__gf088_02a1_0(v0.@layout_0) -> @layout_0 { - block0: - jump block1; - - block1: - return v0; -} - -func private %standalone_name_collisions__name_collisions__generic_fn__gb148_5d90(v0.@layout_1) -> @layout_1 { - block0: - jump block1; - - block1: - return v0; -} - -func private %standalone_name_collisions__name_collisions__generic_fn__gb148_5d90_0(v0.@layout_1) -> @layout_1 { - block0: - jump block1; - - block1: - return v0; -} - -func private %main() -> i32 { - block0: - jump block1; - - block1: - v0.i32 = call %standalone_name_collisions__name_collisions__test_module_qualifier_flatten_collision_0454_0; - v1.i32 = call %standalone_name_collisions__name_collisions__test_generic_type_collision_baa3_0; - v2.i32 = call %standalone_name_collisions__name_collisions__test_impl_method_collision_666c_0; - v3.i32 = call %standalone_name_collisions__name_collisions__test_trait_method_collision_540b_0; - v4.i32 = call %standalone_name_collisions__name_collisions__test_param_local_collision_c9bd_0; - v5.i256 = call %standalone_name_collisions__name_collisions__test_user_defined_conversion_pattern_name_d546_0; - v6.i32 = call %standalone_name_collisions__name_collisions__test_ret_param_collision_dc54_0; - v7.i32 = call %standalone_name_collisions__name_collisions__test_backend_reserved_fn_collision_d33d_0; - return 0.i32; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i32 = call %main; - evm_stop; -} - -func private %standalone_name_collisions__name_collisions__param_local_collision_a1c4(v0.i32) -> i32 { - block0: - jump block1; - - block1: - (v3.i32, v4.i1) = uaddo v0 1.i32; - br v4 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - (v11.i32, v12.i1) = uaddo v3 2.i32; - br v12 block2 block4; - - block4: - return v11; -} - -func private %standalone_name_collisions__name_collisions__param_local_collision_a1c4_0(v0.i32) -> i32 { - block0: - jump block1; - - block1: - (v3.i32, v4.i1) = uaddo v0 1.i32; - br v4 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - (v11.i32, v12.i1) = uaddo v3 2.i32; - br v12 block2 block4; - - block4: - return v11; -} - -func private %standalone_name_collisions__name_collisions__impl_a__impl_Widget_8971__process_7ed1(v0.constref<@layout_2>) -> i32 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i32 = const.load v3; - (v6.i32, v7.i1) = umulo v4 2.i32; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %standalone_name_collisions__name_collisions__impl_a__impl_Widget_8971__process_7ed1_0(v0.constref<@layout_2>) -> i32 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i32 = const.load v3; - (v6.i32, v7.i1) = umulo v4 2.i32; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %standalone_name_collisions__name_collisions__impl_b__impl_Widget_b0f7__process_cb50(v0.constref<@layout_3>) -> i64 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i64 = const.load v3; - (v6.i64, v7.i1) = umulo v4 3.i64; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %standalone_name_collisions__name_collisions__impl_b__impl_Widget_b0f7__process_cb50_0(v0.constref<@layout_3>) -> i64 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i64 = const.load v3; - (v6.i64, v7.i1) = umulo v4 3.i64; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %standalone_name_collisions__name_collisions__ret_param_collision_c303(v0.i32) -> i32 { - block0: - jump block1; - - block1: - (v3.i32, v4.i1) = uaddo v0 1.i32; - br v4 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v3; -} - -func private %standalone_name_collisions__name_collisions__ret_param_collision_c303_0(v0.i32) -> i32 { - block0: - jump block1; - - block1: - (v3.i32, v4.i1) = uaddo v0 1.i32; - br v4 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v3; -} - -func private %standalone_name_collisions__name_collisions__impl_trait_MultiTraitImpl_5bd8__same_method_133c(v0.constref<@layout_4>) -> i32 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i32 = const.load v3; - (v6.i32, v7.i1) = uaddo v4 1.i32; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %standalone_name_collisions__name_collisions__impl_trait_MultiTraitImpl_5bd8__same_method_133c_0(v0.constref<@layout_4>) -> i32 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i32 = const.load v3; - (v6.i32, v7.i1) = uaddo v4 1.i32; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %standalone_name_collisions__name_collisions__impl_trait_MultiTraitImpl_b140__same_method_66b3(v0.constref<@layout_4>) -> i32 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i32 = const.load v3; - (v6.i32, v7.i1) = uaddo v4 2.i32; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %standalone_name_collisions__name_collisions__impl_trait_MultiTraitImpl_b140__same_method_66b3_0(v0.constref<@layout_4>) -> i32 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v4.i32 = const.load v3; - (v6.i32, v7.i1) = uaddo v4 2.i32; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %standalone_name_collisions__name_collisions__test_backend_reserved_fn_collision_d33d() -> i32 { - block0: - jump block1; - - block1: - v0.i32 = call %standalone_name_collisions__name_collisions__add_9cf2; - return v0; -} - -func private %standalone_name_collisions__name_collisions__test_backend_reserved_fn_collision_d33d_0() -> i32 { - block0: - jump block1; - - block1: - v0.i32 = call %standalone_name_collisions__name_collisions__add_9cf2_0; - return v0; -} - -func private %standalone_name_collisions__name_collisions__test_generic_type_collision_baa3() -> i32 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_0; - v2.constref<@layout_1> = const.ref $const_region_0; - v4.constref<@layout_0> = const.ref $const_region_1; - v5.constref<@layout_0> = const.ref $const_region_1; - v6.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v6 v2; - v7.@layout_1 = obj.load v6; - v8.@layout_1 = call %standalone_name_collisions__name_collisions__generic_fn__gb148_5d90 v7; - v9.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v9 v5; - v10.@layout_0 = obj.load v9; - v11.@layout_0 = call %standalone_name_collisions__name_collisions__generic_fn__gf088_02a1 v10; - return 42.i32; -} - -func private %standalone_name_collisions__name_collisions__test_generic_type_collision_baa3_0() -> i32 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_0; - v2.constref<@layout_1> = const.ref $const_region_0; - v4.constref<@layout_0> = const.ref $const_region_1; - v5.constref<@layout_0> = const.ref $const_region_1; - v6.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v6 v2; - v7.@layout_1 = obj.load v6; - v8.@layout_1 = call %standalone_name_collisions__name_collisions__generic_fn__gb148_5d90_0 v7; - v9.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v9 v5; - v10.@layout_0 = obj.load v9; - v11.@layout_0 = call %standalone_name_collisions__name_collisions__generic_fn__gf088_02a1_0 v10; - return 42.i32; -} - -func private %standalone_name_collisions__name_collisions__test_impl_method_collision_666c() -> i32 { - block0: - jump block1; - - block1: - v1.constref<@layout_2> = const.ref $const_region_2; - v2.constref<@layout_2> = const.ref $const_region_2; - v4.constref<@layout_3> = const.ref $const_region_3; - v5.constref<@layout_3> = const.ref $const_region_3; - v6.i32 = call %standalone_name_collisions__name_collisions__impl_a__impl_Widget_8971__process_7ed1 v2; - v7.i64 = call %standalone_name_collisions__name_collisions__impl_b__impl_Widget_b0f7__process_cb50 v5; - return v6; -} - -func private %standalone_name_collisions__name_collisions__test_impl_method_collision_666c_0() -> i32 { - block0: - jump block1; - - block1: - v1.constref<@layout_2> = const.ref $const_region_2; - v2.constref<@layout_2> = const.ref $const_region_2; - v4.constref<@layout_3> = const.ref $const_region_3; - v5.constref<@layout_3> = const.ref $const_region_3; - v6.i32 = call %standalone_name_collisions__name_collisions__impl_a__impl_Widget_8971__process_7ed1_0 v2; - v7.i64 = call %standalone_name_collisions__name_collisions__impl_b__impl_Widget_b0f7__process_cb50_0 v5; - return v6; -} - -func private %standalone_name_collisions__name_collisions__test_module_qualifier_flatten_collision_0454() -> i32 { - block0: - jump block1; - - block1: - v0.i32 = call %standalone_name_collisions__name_collisions__a__b__flattened_fn_aebd; - v1.i32 = call %standalone_name_collisions__name_collisions__a_b__flattened_fn_e3ab; - (v2.i32, v3.i1) = uaddo v0 v1; - br v3 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v2; -} - -func private %standalone_name_collisions__name_collisions__test_module_qualifier_flatten_collision_0454_0() -> i32 { - block0: - jump block1; - - block1: - v0.i32 = call %standalone_name_collisions__name_collisions__a__b__flattened_fn_aebd_0; - v1.i32 = call %standalone_name_collisions__name_collisions__a_b__flattened_fn_e3ab_0; - (v2.i32, v3.i1) = uaddo v0 v1; - br v3 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v2; -} - -func private %standalone_name_collisions__name_collisions__test_param_local_collision_c9bd() -> i32 { - block0: - jump block1; - - block1: - v1.i32 = call %standalone_name_collisions__name_collisions__param_local_collision_a1c4 10.i32; - return v1; -} - -func private %standalone_name_collisions__name_collisions__test_param_local_collision_c9bd_0() -> i32 { - block0: - jump block1; - - block1: - v1.i32 = call %standalone_name_collisions__name_collisions__param_local_collision_a1c4_0 10.i32; - return v1; -} - -func private %standalone_name_collisions__name_collisions__test_ret_param_collision_dc54() -> i32 { - block0: - jump block1; - - block1: - v1.i32 = call %standalone_name_collisions__name_collisions__ret_param_collision_c303 10.i32; - return v1; -} - -func private %standalone_name_collisions__name_collisions__test_ret_param_collision_dc54_0() -> i32 { - block0: - jump block1; - - block1: - v1.i32 = call %standalone_name_collisions__name_collisions__ret_param_collision_c303_0 10.i32; - return v1; -} - -func private %standalone_name_collisions__name_collisions__test_trait_method_collision_540b() -> i32 { - block0: - jump block1; - - block1: - v1.constref<@layout_4> = const.ref $const_region_4; - v2.constref<@layout_4> = const.ref $const_region_4; - v3.i32 = call %standalone_name_collisions__name_collisions__impl_trait_MultiTraitImpl_5bd8__same_method_133c v2; - v4.constref<@layout_4> = const.ref $const_region_4; - v5.constref<@layout_4> = const.ref $const_region_4; - v6.i32 = call %standalone_name_collisions__name_collisions__impl_trait_MultiTraitImpl_b140__same_method_66b3 v5; - (v7.i32, v8.i1) = uaddo v3 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v7; -} - -func private %standalone_name_collisions__name_collisions__test_trait_method_collision_540b_0() -> i32 { - block0: - jump block1; - - block1: - v1.constref<@layout_4> = const.ref $const_region_4; - v2.constref<@layout_4> = const.ref $const_region_4; - v3.i32 = call %standalone_name_collisions__name_collisions__impl_trait_MultiTraitImpl_5bd8__same_method_133c_0 v2; - v4.constref<@layout_4> = const.ref $const_region_4; - v5.constref<@layout_4> = const.ref $const_region_4; - v6.i32 = call %standalone_name_collisions__name_collisions__impl_trait_MultiTraitImpl_b140__same_method_66b3_0 v5; - (v7.i32, v8.i1) = uaddo v3 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v7; -} - -func private %standalone_name_collisions__name_collisions__test_user_defined_conversion_pattern_name_d546() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %standalone_name_collisions__name_collisions____u32_as_u256_56b3 42.i32; - return v1; -} - -func private %standalone_name_collisions__name_collisions__test_user_defined_conversion_pattern_name_d546_0() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %standalone_name_collisions__name_collisions____u32_as_u256_56b3_0 42.i32; - return v1; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/nested_struct.snap b/crates/codegen/tests/fixtures/sonatina_ir/nested_struct.snap deleted file mode 100644 index c4a03ec25e..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/nested_struct.snap +++ /dev/null @@ -1,219 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/nested_struct.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; -type @layout_1 = {@layout_0}; - -global private const @layout_0 $const_region_0 = {0}; -global private const @layout_1 $const_region_1 = {{0}}; - -func private %abi_encode(v0.i256) { - block0: - jump block1; - - block1: - call %mstore 0.i256 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_f7e3 0.i256 32.i256; - unreachable; -} - -func private %calldataload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %codecopy(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_code_copy v0 v1 v2; - return; -} - -func private %from_raw(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %init() { - block0: - jump block1; - - block1: - v0.i256 = sym_size &__NestedStruct_runtime; - v1.i256 = sym_addr &__NestedStruct_runtime; - v2.*i8 = evm_malloc v0; - v3.i256 = ptr_to_int v2 i256; - call %codecopy v3 v1 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_7adf_0 v3 v0; - unreachable; -} - -func private %manual_contract_init_root_NestedStruct() { - block0: - jump block1; - - block1: - call %init; - evm_stop; -} - -func private %manual_contract_runtime_root_NestedStruct() { - block0: - jump block1; - - block1: - call %runtime; - evm_stop; -} - -func private %mem_read(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.constref<@layout_0> = const.ref $const_region_0; - v3.constref<@layout_1> = const.ref $const_region_1; - v5.@layout_0 = insert_value undef.@layout_0 0.i256 0.i256; - v6.objref<@layout_1> = obj.alloc @layout_1; - v7.objref<@layout_0> = obj.proj v6 0.i256; - v8.objref = obj.proj v7 0.i256; - v9.i256 = extract_value v5 0.i256; - obj.store v8 v9; - v11.objref<@layout_0> = obj.proj v6 0.i256; - v12.objref = obj.proj v11 0.i256; - obj.store v12 v0; - v13.objref<@layout_0> = obj.proj v6 0.i256; - v14.objref = obj.proj v13 0.i256; - v15.i256 = obj.load v14; - return v15; -} - -func private %mstore(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %read_inner(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_sload v0; - return v2; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_7adf(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_7adf_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_f7e3(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %runtime() { - block0: - jump block1; - - block1: - v1.i256 = call %stor_ptr 0.i256; - v2.i256 = call %calldataload 0.i256; - v4.i256 = shr 224.i256 v2; - v6.i1 = eq v4 3091856072.i256; - br v6 block2 block6; - - block2: - v8.i256 = call %calldataload 4.i256; - call %write_inner v8 v1; - call %abi_encode v8; - unreachable; - - block3: - v12.i256 = call %read_inner v1; - call %abi_encode v12; - unreachable; - - block4: - v13.i256 = call %calldataload 4.i256; - v14.i256 = call %mem_read v13; - call %abi_encode v14; - unreachable; - - block5: - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_7adf 0.i256 0.i256; - unreachable; - - block6: - v17.i1 = eq v4 3513050253.i256; - br v17 block3 block7; - - block7: - v20.i1 = eq v4 2154770637.i256; - br v20 block4 block8; - - block8: - jump block5; -} - -func private %stor_ptr(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %from_raw v0; - return v2; -} - -func private %write_inner(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_sstore v1 v0; - return; -} - - -object @NestedStruct { - section init { - entry %manual_contract_init_root_NestedStruct; - embed .runtime as &__NestedStruct_runtime; - } - section runtime { - entry %manual_contract_runtime_root_NestedStruct; - data $const_region_0; - data $const_region_1; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/newtype_field_mut_method_call.snap b/crates/codegen/tests/fixtures/sonatina_ir/newtype_field_mut_method_call.snap deleted file mode 100644 index bf4bfdeaaa..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/newtype_field_mut_method_call.snap +++ /dev/null @@ -1,89 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/newtype_field_mut_method_call.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {@layout_0}; -type @layout_2 = {i256, @layout_1}; - -func private %bump(v0.objref<@layout_1>) { - block0: - jump block1; - - block1: - v3.objref<@layout_0> = obj.proj v0 0.i256; - v4.objref = obj.proj v3 0.i256; - v6.i256 = obj.load v4; - (v7.i256, v8.i1) = uaddo v6 1.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - obj.store v4 v7; - return; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %newtype_field_mut_method_call 1.i256; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - -func private %newtype_field_mut_method_call(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 0.i256; - v8.@layout_1 = insert_value undef.@layout_1 0.i256 v6; - v10.@layout_2 = insert_value undef.@layout_2 0.i256 0.i256; - v11.@layout_2 = insert_value v10 1.i256 v8; - v12.objref<@layout_2> = obj.alloc @layout_2; - v13.objref = obj.proj v12 0.i256; - v14.i256 = extract_value v11 0.i256; - obj.store v13 v14; - v15.objref<@layout_1> = obj.proj v12 1.i256; - v16.@layout_1 = extract_value v11 1.i256; - v17.objref<@layout_0> = obj.proj v15 0.i256; - v18.@layout_0 = extract_value v16 0.i256; - v19.objref = obj.proj v17 0.i256; - v20.i256 = extract_value v18 0.i256; - obj.store v19 v20; - v21.objref = obj.proj v17 1.i256; - v22.i256 = extract_value v18 1.i256; - obj.store v21 v22; - v23.objref<@layout_1> = obj.proj v12 1.i256; - call %bump v23; - v25.objref<@layout_1> = obj.proj v12 1.i256; - v26.objref<@layout_0> = obj.proj v25 0.i256; - v27.objref = obj.proj v26 0.i256; - v28.i256 = obj.load v27; - return v28; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/newtype_storage_byplace_effect_arg.snap b/crates/codegen/tests/fixtures/sonatina_ir/newtype_storage_byplace_effect_arg.snap deleted file mode 100644 index 780d89e77c..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/newtype_storage_byplace_effect_arg.snap +++ /dev/null @@ -1,539 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/newtype_storage_byplace_effect_arg.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256}; -type @layout_2 = {}; -type @layout_3 = {@layout_2}; -type @layout_4 = {i256, i256}; - -global private const @layout_1 $const_region_0 = {0}; - -func private %__NewtypeByPlaceEffectArg_init() { - block0: - jump block1; - - block1: - return; -} - -func private %__NewtypeByPlaceEffectArg_recv_0_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - call %bump v0; - v6.i256 = evm_sload v1; - (v7.i256, v8.i1) = uaddo v6 1.i256; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - evm_sstore v1 v7; - v16.i256 = evm_sload v1; - return v16; -} - -func private %abi_field_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_a5ce_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %abort() { - block0: - jump block1; - - block1: - call %revert 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %bump(v0.i256) { - block0: - jump block1; - - block1: - v3.i256 = evm_sload v0; - (v4.i256, v5.i1) = uaddo v3 1.i256; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - evm_sstore v0 v4; - return; -} - -func inline(always) private %contract_init_abi_NewtypeByPlaceEffectArg() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - call %__NewtypeByPlaceEffectArg_init; - return; -} - -func private %contract_init_root_NewtypeByPlaceEffectArg() { - block0: - jump block1; - - block1: - call %contract_init_abi_NewtypeByPlaceEffectArg; - v2.i256 = sym_addr &NewtypeByPlaceEffectArg_runtime; - v3.i256 = sym_size &NewtypeByPlaceEffectArg_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_NewtypeByPlaceEffectArg_1() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_3> = obj.alloc @layout_3; - call %decode_runtime_args v5; - v8.i256 = call %__NewtypeByPlaceEffectArg_recv_0_0 1.i256 0.i256; - v9.@layout_4 = call %encode_single_root_alloc v8; - v10.i256 = extract_value v9 0.i256; - v11.i256 = extract_value v9 1.i256; - evm_return v10 v11; -} - -func private %contract_runtime_root_NewtypeByPlaceEffectArg() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (1.i32 block4); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_NewtypeByPlaceEffectArg_1; - unreachable; -} - -func inline(always) private %decode_from(v0.@layout_1, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %decode_from_prechecked_head(v0.@layout_1, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %decode_from v0 v1; - return; -} - -func inline(always) private %decode_runtime_args(v0.objref<@layout_3>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_1 = call %input; - v5.i256 = call %len v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %abort; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func private %encode(v0.i256, v1.objref<@layout_0>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8b2d v1 v0; - return; -} - -func private %encode_field(v0.i256, v1.objref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %base v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_a5ce v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_a98a v1 v10; - v12.i256 = call %pos v1; - v13.i256 = mload v2 i256; - call %set_base v1 v13; - v15.i256 = mload v2 i256; - call %set_pos v1 v15; - call %encode v0 v1; - call %set_base v1 v5; - call %set_pos v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %pos v1; - call %encode_to_ptr v0 v24; - v28.i256 = add v24 32.i256; - call %set_pos v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode v0 v1; - return; -} - -func private %encode_single_root(v0.i256, v1.objref<@layout_0>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %base v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.i256) -> @layout_4 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_0 = call %encoder_new v2; - v4.objref<@layout_0> = obj.alloc @layout_0; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %base v4; - call %encode_single_root v0 v4; - v14.@layout_4 = insert_value undef.@layout_4 0.i256 v11; - v15.@layout_4 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_to_ptr(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %store_word v1 v0; - return; -} - -func private %encoder_new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %input() -> @layout_1 { - block0: - jump block1; - - block1: - v0.@layout_1 = call %impl_CallData__new; - return v0; -} - -func inline(always) private %len(v0.@layout_1) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_0 = call %at v7; - return v8; -} - -func inline(always) private %impl_CallData__new() -> @layout_1 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_0; - v2.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v2 v1; - v3.@layout_1 = obj.load v2; - return v3; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_a5ce(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_a5ce_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %pos(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %revert(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %set_base(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %set_pos(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8b2d(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_a98a(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @NewtypeByPlaceEffectArg { - section init { - entry %contract_init_root_NewtypeByPlaceEffectArg; - embed .runtime as &NewtypeByPlaceEffectArg_runtime; - } - section runtime { - entry %contract_runtime_root_NewtypeByPlaceEffectArg; - data $const_region_0; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/newtype_storage_field_mut_method_call.snap b/crates/codegen/tests/fixtures/sonatina_ir/newtype_storage_field_mut_method_call.snap deleted file mode 100644 index da8cda06b0..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/newtype_storage_field_mut_method_call.snap +++ /dev/null @@ -1,529 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -assertion_line: 449 -expression: output -input_file: crates/codegen/tests/fixtures/newtype_storage_field_mut_method_call.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256}; -type @layout_2 = {}; -type @layout_3 = {@layout_2}; -type @layout_4 = {i256, i256}; - -global private const @layout_1 $const_region_0 = {0}; - -func private %__NewtypeStorageFieldMutMethodCall_init() { - block0: - jump block1; - - block1: - return; -} - -func private %__NewtypeStorageFieldMutMethodCall_recv_0_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - call %bump v0; - v3.i256 = evm_sload v0; - return v3; -} - -func private %abi_field_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_4e75_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %abort() { - block0: - jump block1; - - block1: - call %revert 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %bump(v0.i256) { - block0: - jump block1; - - block1: - v3.i256 = evm_sload v0; - (v4.i256, v5.i1) = uaddo v3 1.i256; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - evm_sstore v0 v4; - return; -} - -func inline(always) private %contract_init_abi_NewtypeStorageFieldMutMethodCall() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - call %__NewtypeStorageFieldMutMethodCall_init; - return; -} - -func private %contract_init_root_NewtypeStorageFieldMutMethodCall() { - block0: - jump block1; - - block1: - call %contract_init_abi_NewtypeStorageFieldMutMethodCall; - v2.i256 = sym_addr &NewtypeStorageFieldMutMethodCall_runtime; - v3.i256 = sym_size &NewtypeStorageFieldMutMethodCall_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_NewtypeStorageFieldMutMethodCall_1() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_3> = obj.alloc @layout_3; - call %decode_runtime_args v5; - v8.i256 = call %__NewtypeStorageFieldMutMethodCall_recv_0_0 1.i256; - v9.@layout_4 = call %encode_single_root_alloc v8; - v10.i256 = extract_value v9 0.i256; - v11.i256 = extract_value v9 1.i256; - evm_return v10 v11; -} - -func private %contract_runtime_root_NewtypeStorageFieldMutMethodCall() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (1.i32 block4); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_NewtypeStorageFieldMutMethodCall_1; - unreachable; -} - -func inline(always) private %decode_from(v0.@layout_1, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %decode_from_prechecked_head(v0.@layout_1, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %decode_from v0 v1; - return; -} - -func inline(always) private %decode_runtime_args(v0.objref<@layout_3>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_1 = call %input; - v5.i256 = call %len v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %abort; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func private %encode(v0.i256, v1.objref<@layout_0>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_90ae v1 v0; - return; -} - -func private %encode_field(v0.i256, v1.objref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %base v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_4e75 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_9251 v1 v10; - v12.i256 = call %pos v1; - v13.i256 = mload v2 i256; - call %set_base v1 v13; - v15.i256 = mload v2 i256; - call %set_pos v1 v15; - call %encode v0 v1; - call %set_base v1 v5; - call %set_pos v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %pos v1; - call %encode_to_ptr v0 v24; - v28.i256 = add v24 32.i256; - call %set_pos v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode v0 v1; - return; -} - -func private %encode_single_root(v0.i256, v1.objref<@layout_0>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %base v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.i256) -> @layout_4 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_0 = call %encoder_new v2; - v4.objref<@layout_0> = obj.alloc @layout_0; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %base v4; - call %encode_single_root v0 v4; - v14.@layout_4 = insert_value undef.@layout_4 0.i256 v11; - v15.@layout_4 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_to_ptr(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %store_word v1 v0; - return; -} - -func private %encoder_new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %input() -> @layout_1 { - block0: - jump block1; - - block1: - v0.@layout_1 = call %impl_CallData__new; - return v0; -} - -func inline(always) private %len(v0.@layout_1) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %impl_CallData__new() -> @layout_1 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_0; - v2.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v2 v1; - v3.@layout_1 = obj.load v2; - return v3; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_0 = call %at v7; - return v8; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_4e75(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_4e75_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %pos(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %revert(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %set_base(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %set_pos(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_90ae(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_9251(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @NewtypeStorageFieldMutMethodCall { - section init { - entry %contract_init_root_NewtypeStorageFieldMutMethodCall; - embed .runtime as &NewtypeStorageFieldMutMethodCall_runtime; - } - section runtime { - entry %contract_runtime_root_NewtypeStorageFieldMutMethodCall; - data $const_region_0; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/newtype_u8_word_conversion.snap b/crates/codegen/tests/fixtures/sonatina_ir/newtype_u8_word_conversion.snap deleted file mode 100644 index 5d8881eebc..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/newtype_u8_word_conversion.snap +++ /dev/null @@ -1,57 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/newtype_u8_word_conversion.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i8}; -type @layout_1 = {@layout_0, i256}; - -func private %main() -> i8 { - block0: - jump block1; - - block1: - v1.i8 = call %newtype_u8_roundtrip 7.i8; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i8 = call %main; - evm_stop; -} - -func private %newtype_u8_roundtrip(v0.i8) -> i8 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_1 = insert_value undef.@layout_1 0.i256 v4; - v8.@layout_1 = insert_value v6 1.i256 0.i256; - v9.objref<@layout_1> = obj.alloc @layout_1; - v10.objref<@layout_0> = obj.proj v9 0.i256; - v11.@layout_0 = extract_value v8 0.i256; - v12.objref = obj.proj v10 0.i256; - v13.i8 = extract_value v11 0.i256; - obj.store v12 v13; - v14.objref = obj.proj v9 1.i256; - v15.i256 = extract_value v8 1.i256; - obj.store v14 v15; - v16.objref<@layout_0> = obj.proj v9 0.i256; - v17.objref = obj.proj v16 0.i256; - v18.i8 = obj.load v17; - return v18; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/newtype_word_mut_method_call.snap b/crates/codegen/tests/fixtures/sonatina_ir/newtype_word_mut_method_call.snap deleted file mode 100644 index 540b9d5931..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/newtype_word_mut_method_call.snap +++ /dev/null @@ -1,69 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/newtype_word_mut_method_call.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; - -func private %bump(v0.@layout_0) -> @layout_0 { - block0: - v1.objref<@layout_0> = obj.alloc @layout_0; - v3.objref = obj.proj v1 0.i256; - v4.i256 = extract_value v0 0.i256; - obj.store v3 v4; - jump block1; - - block1: - v5.objref = obj.proj v1 0.i256; - v7.i256 = obj.load v5; - (v8.i256, v9.i1) = uaddo v7 1.i256; - br v9 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - obj.store v5 v8; - v15.@layout_0 = obj.load v1; - return v15; -} - -func private %main() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = call %newtype_word_mut_method_call 1.i256; - return v1; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %main; - evm_stop; -} - -func private %newtype_word_mut_method_call(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v5.@layout_0 = call %bump v4; - v6.i256 = extract_value v5 0.i256; - return v6; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/packed_struct_u8_array_field.snap b/crates/codegen/tests/fixtures/sonatina_ir/packed_struct_u8_array_field.snap deleted file mode 100644 index 7503ffe6fd..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/packed_struct_u8_array_field.snap +++ /dev/null @@ -1,38 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/packed_struct_u8_array_field.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {[i8; 2], i256}; - -global private const [i8; 2] $const_region_0 = [1, 2]; -global private const @layout_0 $const_region_1 = {[1, 2], 42}; - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %packed_field_offset; - evm_stop; -} - -func private %packed_field_offset() -> i256 { - block0: - jump block1; - - block1: - v2.constref<[i8; 2]> = const.ref $const_region_0; - v4.constref<@layout_0> = const.ref $const_region_1; - v5.constref<@layout_0> = const.ref $const_region_1; - return 42.i256; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/pointer_field_aggregate.snap b/crates/codegen/tests/fixtures/sonatina_ir/pointer_field_aggregate.snap deleted file mode 100644 index c2812eb32a..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/pointer_field_aggregate.snap +++ /dev/null @@ -1,106 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/pointer_field_aggregate.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; - -func private %standalone_pointer_field_aggregate__pointer_field_aggregate__bump__gef14_c7e6(v0.i256) { - block0: - jump block1; - - block1: - v3.i256 = mload v0 i256; - (v4.i256, v5.i1) = uaddo v3 1.i256; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v0 v4 i256; - return; -} - -func private %standalone_pointer_field_aggregate__pointer_field_aggregate__bump__gef14_c7e6_0(v0.i256) { - block0: - jump block1; - - block1: - v3.i256 = mload v0 i256; - (v4.i256, v5.i1) = uaddo v3 1.i256; - br v5 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v0 v4 i256; - return; -} - -func private %from_raw(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %pointer_field_aggregate; - evm_stop; -} - -func private %mem_ptr(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %from_raw v0; - return v2; -} - -func private %pointer_field_aggregate() { - block0: - jump block1; - - block1: - v1.i256 = call %mem_ptr 256.i256; - v5.@layout_0 = insert_value undef.@layout_0 0.i256 v1; - v6.@layout_0 = insert_value v5 1.i256 1.i256; - v7.objref<@layout_0> = obj.alloc @layout_0; - v8.objref = obj.proj v7 0.i256; - v9.i256 = extract_value v6 0.i256; - obj.store v8 v9; - v10.objref = obj.proj v7 1.i256; - v11.i256 = extract_value v6 1.i256; - obj.store v10 v11; - v12.objref = obj.proj v7 0.i256; - v13.i256 = obj.load v12; - call %standalone_pointer_field_aggregate__pointer_field_aggregate__bump__gef14_c7e6 v13; - v16.i256 = call %mem_ptr 288.i256; - v17.objref = obj.proj v7 0.i256; - obj.store v17 v16; - v18.objref = obj.proj v7 0.i256; - v19.i256 = obj.load v18; - call %standalone_pointer_field_aggregate__pointer_field_aggregate__bump__gef14_c7e6_0 v19; - return; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/range_bounds.snap b/crates/codegen/tests/fixtures/sonatina_ir/range_bounds.snap deleted file mode 100644 index 7ca2800d63..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/range_bounds.snap +++ /dev/null @@ -1,92 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/range_bounds.fe ---- -target = "evm-ethereum-osaka" - -func private %get(v0.i256) -> i256 { - block0: - jump block1; - - block1: - (v3.i256, v4.i1) = uaddo 0.i256 v0; - br v4 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v3; -} - -func private %len() -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - jump block4; - - block3: - jump block4; - - block4: - v3.i256 = phi (0.i256 block2) (4.i256 block3); - return v3; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %sum_const; - evm_stop; -} - -func private %sum_const() -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %len; - jump block2; - - block2: - v20.i256 = phi (0.i256 block1) (v9 block7); - v3.i256 = phi (0.i256 block1) (v16 block7); - v5.i1 = lt v3 v2; - br v5 block3 block4; - - block3: - v7.i256 = call %get v3; - (v9.i256, v10.i1) = uaddo v20 v7; - br v10 block5 block6; - - block4: - return v20; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - (v16.i256, v17.i1) = uaddo v3 1.i256; - br v17 block5 block7; - - block7: - jump block2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/raw_log_emit.snap b/crates/codegen/tests/fixtures/sonatina_ir/raw_log_emit.snap deleted file mode 100644 index 2d7f44e2b1..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/raw_log_emit.snap +++ /dev/null @@ -1,76 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/raw_log_emit.fe ---- -target = "evm-ethereum-osaka" - -func private %from_raw(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %log0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_log0 v0 v1; - return; -} - -func private %main() { - block0: - jump block1; - - block1: - call %raw_emit; - return; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %main; - evm_stop; -} - -func private %mem_ptr(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %from_raw v0; - return v2; -} - -func private %raw(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %raw_emit() { - block0: - jump block1; - - block1: - v1.i256 = call %mem_ptr 256.i256; - v2.i256 = call %raw v1; - call %log0 v2 32.i256; - return; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/ref_is_not_a_copy.snap b/crates/codegen/tests/fixtures/sonatina_ir/ref_is_not_a_copy.snap deleted file mode 100644 index 3aa18578be..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/ref_is_not_a_copy.snap +++ /dev/null @@ -1,119 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/ref_is_not_a_copy.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {constref, constref}; - -global private const @layout_0 $const_region_0 = {10, 20}; - -func private %live_view(v0.constref<@layout_0>) -> @layout_1 { - block0: - jump block1; - - block1: - v3.constref = const.proj v0 0.i256; - v5.constref = const.proj v0 1.i256; - v7.@layout_1 = insert_value undef.@layout_1 0.i256 v3; - v8.@layout_1 = insert_value v7 1.i256 v5; - return v8; -} - -func private %main() { - block0: - jump block1; - - block1: - call %test_ref_is_not_a_copy; - return; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %main; - evm_stop; -} - -func private %test_ref_is_not_a_copy() { - block0: - v0.*i256 = alloca i256; - v1.*i256 = alloca i256; - jump block1; - - block1: - v4.constref<@layout_0> = const.ref $const_region_0; - v5.constref<@layout_0> = const.ref $const_region_0; - v6.@layout_1 = call %live_view v5; - v7.objref<@layout_1> = obj.alloc @layout_1; - v9.objref> = obj.proj v7 0.i256; - v10.constref = extract_value v6 0.i256; - obj.store v9 v10; - v12.objref> = obj.proj v7 1.i256; - v13.constref = extract_value v6 1.i256; - obj.store v12 v13; - v14.objref> = obj.proj v7 0.i256; - v15.constref = obj.load v14; - v16.objref> = obj.proj v7 1.i256; - v17.constref = obj.load v16; - mstore v0 10.i256 i256; - v18.i256 = const.load v15; - v19.i256 = mload v0 i256; - v20.i1 = eq v18 v19; - br v20 block2 block3; - - block2: - jump block4; - - block3: - v23.*i8 = evm_malloc 64.i256; - v24.i256 = ptr_to_int v23 i256; - mstore v24 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v28.i256, v29.i1) = uaddo v24 32.i256; - br v29 block8 block9; - - block4: - mstore v1 20.i256 i256; - v37.i256 = const.load v17; - v38.i256 = mload v1 i256; - v39.i1 = eq v37 v38; - br v39 block5 block6; - - block5: - jump block7; - - block6: - v40.*i8 = evm_malloc 64.i256; - v41.i256 = ptr_to_int v40 i256; - mstore v41 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - (v43.i256, v44.i1) = uaddo v41 32.i256; - br v44 block8 block10; - - block7: - return; - - block8: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block9: - mstore v28 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v24 36.i256; - - block10: - mstore v43 26959946667150639794667015087019630673637144422540572481103610249216.i256 i256; - evm_revert v41 36.i256; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/ret.snap b/crates/codegen/tests/fixtures/sonatina_ir/ret.snap deleted file mode 100644 index e77455b426..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/ret.snap +++ /dev/null @@ -1,81 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/ret.fe ---- -target = "evm-ethereum-osaka" - -func private %main() -> i64 { - block0: - jump block1; - - block1: - v2.i64 = call %retfoo 0.i1 7.i64; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %main; - evm_stop; -} - -func private %retfoo(v0.i1, v1.i64) -> i64 { - block0: - jump block1; - - block1: - br v0 block2 block3; - - block2: - return 0.i64; - - block3: - jump block4; - - block4: - v6.i1 = lt v1 5.i64; - br v6 block5 block6; - - block5: - return 1.i64; - - block6: - jump block7; - - block7: - (v9.i64, v10.i1) = usubo v1 1.i64; - br v10 block11 block12; - - block8: - return 2.i64; - - block9: - jump block10; - - block10: - (v20.i64, v21.i1) = uaddo v9 1.i64; - br v21 block11 block13; - - block11: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block12: - v17.i1 = eq v9 42.i64; - br v17 block8 block9; - - block13: - return v20; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/revert.snap b/crates/codegen/tests/fixtures/sonatina_ir/revert.snap deleted file mode 100644 index efcceedff4..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/revert.snap +++ /dev/null @@ -1,85 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/revert.fe ---- -target = "evm-ethereum-osaka" - -func private %standalone_revert__revert__fail__gcd5c_35c3() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_d0d8__mstore_401f 0.i256 42.i256; - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_f9bb 0.i256 32.i256; - unreachable; -} - -func private %standalone_revert__revert__fail__gcd5c_cdbf() { - block0: - jump block1; - - block1: - call %std__lib__evm__effects__impl_trait_Evm_d0d8__mstore_401f_0 0.i256 42.i256; - call %std__lib__evm__effects__impl_trait_Evm_0098__revert_f9bb_0 0.i256 32.i256; - unreachable; -} - -func private %main() { - block0: - jump block1; - - block1: - call %standalone_revert__revert__fail__gcd5c_35c3; - unreachable; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %main; - evm_stop; -} - -func private %std__lib__evm__effects__impl_trait_Evm_d0d8__mstore_401f(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_d0d8__mstore_401f_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_f9bb(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__revert_f9bb_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/storage.snap b/crates/codegen/tests/fixtures/sonatina_ir/storage.snap deleted file mode 100644 index 551e48cbd2..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/storage.snap +++ /dev/null @@ -1,426 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/storage.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = enum { - #Ok, - #Insufficient, -}; - -func private %abi_encode(v0.i256) { - block0: - jump block1; - - block1: - call %mstore 0.i256 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_f28e 0.i256 32.i256; - unreachable; -} - -func private %balance_of_raw(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i1 = eq v0 0.i256; - br v4 block3 block5; - - block2: - v5.i256 = phi (v7 block3) (v11 block4); - return v5; - - block3: - v7.i256 = evm_sload v1; - jump block2; - - block4: - v10.i256 = add v1 1.i256; - v11.i256 = evm_sload v10; - jump block2; - - block5: - jump block4; -} - -func private %calldataload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %codecopy(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_code_copy v0 v1 v2; - return; -} - -func private %credit_alice(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = evm_sload v1; - (v6.i256, v7.i1) = uaddo v4 v0; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - evm_sstore v1 v6; - v15.i256 = evm_sload v2; - (v17.i256, v18.i1) = uaddo v15 v0; - br v18 block2 block4; - - block4: - evm_sstore v2 v17; - v21.i256 = evm_sload v1; - return v21; -} - -func private %credit_bob(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v5.i256 = add v1 1.i256; - v6.i256 = evm_sload v5; - (v8.i256, v9.i1) = uaddo v6 v0; - br v9 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - v16.i256 = add v1 1.i256; - evm_sstore v16 v8; - v18.i256 = evm_sload v2; - (v20.i256, v21.i1) = uaddo v18 v0; - br v21 block2 block4; - - block4: - evm_sstore v2 v20; - v24.i256 = add v1 1.i256; - v25.i256 = evm_sload v24; - return v25; -} - -func private %from_raw__gf198(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %from_raw__g9438(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %init() { - block0: - jump block1; - - block1: - v0.i256 = sym_size &__Coin_runtime; - v1.i256 = sym_addr &__Coin_runtime; - v2.*i8 = evm_malloc v0; - v3.i256 = ptr_to_int v2 i256; - call %codecopy v3 v1 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_e8fc_0 v3 v0; - unreachable; -} - -func private %manual_contract_init_root_Coin() { - block0: - jump block1; - - block1: - call %init; - evm_stop; -} - -func private %manual_contract_runtime_root_Coin() { - block0: - jump block1; - - block1: - call %runtime; - evm_stop; -} - -func private %mstore(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_e8fc(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_e8fc_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_f28e(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %runtime() { - block0: - jump block1; - - block1: - v1.i256 = call %stor_ptr__g2c78 0.i256; - v3.i256 = call %stor_ptr__gd216 2.i256; - v4.i256 = call %calldataload 0.i256; - v6.i256 = shr 224.i256 v4; - v8.i1 = eq v6 2877082652.i256; - br v8 block2 block7; - - block2: - v10.i256 = call %calldataload 4.i256; - v12.i256 = call %calldataload 36.i256; - v13.i1 = eq v10 0.i256; - br v13 block12 block14; - - block3: - v14.i256 = call %calldataload 4.i256; - v16.i256 = call %balance_of_raw v14 v1; - call %abi_encode v16; - unreachable; - - block4: - v17.i256 = call %calldataload 4.i256; - v18.i256 = call %calldataload 36.i256; - v19.i1 = eq v17 0.i256; - br v19 block16 block18; - - block5: - v21.i256 = call %total_supply v3; - call %abi_encode v21; - unreachable; - - block6: - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_e8fc 0.i256 0.i256; - unreachable; - - block7: - v24.i1 = eq v6 1818602213.i256; - br v24 block3 block8; - - block8: - v27.i1 = eq v6 217554442.i256; - br v27 block4 block9; - - block9: - v30.i1 = eq v6 960555502.i256; - br v30 block5 block10; - - block10: - jump block6; - - block11: - v31.i256 = phi (v35 block12) (v39 block13); - call %abi_encode v31; - unreachable; - - block12: - v35.i256 = call %credit_alice v12 v1 v3; - jump block11; - - block13: - v39.i256 = call %credit_bob v12 v1 v3; - jump block11; - - block14: - jump block13; - - block15: - v40.@layout_0 = phi (v44 block16) (v47 block17); - v41.i256 = call %transfer_result_code v40; - call %abi_encode v41; - unreachable; - - block16: - v44.@layout_0 = call %transfer_from_alice v18 v1; - jump block15; - - block17: - v47.@layout_0 = call %transfer_from_bob v18 v1; - jump block15; - - block18: - jump block17; -} - -func private %stor_ptr__g2c78(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %from_raw__g9438 v0; - return v2; -} - -func private %stor_ptr__gd216(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %from_raw__gf198 v0; - return v2; -} - -func private %total_supply(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_sload v0; - return v2; -} - -func private %transfer_from_alice(v0.i256, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i256 = evm_sload v1; - v5.i1 = lt v3 v0; - br v5 block2 block3; - - block2: - v6.@layout_0 = enum.make @layout_0 #Insufficient; - return v6; - - block3: - jump block4; - - block4: - v8.i256 = evm_sload v1; - (v10.i256, v11.i1) = usubo v8 v0; - br v11 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - evm_sstore v1 v10; - v19.i256 = add v1 1.i256; - v20.i256 = evm_sload v19; - (v22.i256, v23.i1) = uaddo v20 v0; - br v23 block5 block7; - - block7: - v25.i256 = add v1 1.i256; - evm_sstore v25 v22; - v26.@layout_0 = enum.make @layout_0 #Ok; - return v26; -} - -func private %transfer_from_bob(v0.i256, v1.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i256 = add v1 1.i256; - v5.i256 = evm_sload v4; - v7.i1 = lt v5 v0; - br v7 block2 block3; - - block2: - v8.@layout_0 = enum.make @layout_0 #Insufficient; - return v8; - - block3: - jump block4; - - block4: - v10.i256 = add v1 1.i256; - v11.i256 = evm_sload v10; - (v13.i256, v14.i1) = usubo v11 v0; - br v14 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - v21.i256 = add v1 1.i256; - evm_sstore v21 v13; - v22.i256 = evm_sload v1; - (v24.i256, v25.i1) = uaddo v22 v0; - br v25 block5 block7; - - block7: - evm_sstore v1 v24; - v27.@layout_0 = enum.make @layout_0 #Ok; - return v27; -} - -func private %transfer_result_code(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v2.enumtag(@layout_0) = enum.tag v0; - br_table v2 (0.enumtag(@layout_0) block3) (1.enumtag(@layout_0) block4); - - block2: - v5.i256 = phi (0.i256 block3) (1.i256 block4); - return v5; - - block3: - jump block2; - - block4: - jump block2; -} - - -object @Coin { - section init { - entry %manual_contract_init_root_Coin; - embed .runtime as &__Coin_runtime; - } - section runtime { - entry %manual_contract_runtime_root_Coin; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/storage_map.snap b/crates/codegen/tests/fixtures/sonatina_ir/storage_map.snap deleted file mode 100644 index f3321cbafb..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/storage_map.snap +++ /dev/null @@ -1,664 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/storage_map.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256}; -type @layout_2 = {}; -type @layout_3 = {@layout_2}; -type @layout_4 = {i256, i256}; -type @layout_5 = {}; -type @layout_6 = {@layout_5}; - -global private const @layout_1 $const_region_0 = {0}; - -func private %__C_recv_0_0() -> i256 { - block0: - jump block1; - - block1: - call %set_balance 1.i256 2.i256; - v3.i256 = call %get_balance 1.i256; - return v3; -} - -func private %abi_field_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_3135_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %abort() { - block0: - jump block1; - - block1: - call %revert 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %contract_init_abi_C() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - return; -} - -func private %contract_init_root_C() { - block0: - jump block1; - - block1: - call %contract_init_abi_C; - v2.i256 = sym_addr &C_runtime; - v3.i256 = sym_size &C_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_C_0() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_3> = obj.alloc @layout_3; - call %decode_runtime_args v5; - v7.i256 = call %__C_recv_0_0; - v8.@layout_4 = call %encode_single_root_alloc v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func private %contract_runtime_root_C() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (0.i32 block4); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_C_0; - unreachable; -} - -func inline(always) private %decode_from(v0.@layout_1, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %decode_from_prechecked_head(v0.@layout_1, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %decode_from v0 v1; - return; -} - -func inline(always) private %decode_runtime_args(v0.objref<@layout_3>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_1 = call %input; - v5.i256 = call %len v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %abort; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func private %encode(v0.i256, v1.objref<@layout_0>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_dff7 v1 v0; - return; -} - -func private %encode_field(v0.i256, v1.objref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %base v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_3135 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_e73a v1 v10; - v12.i256 = call %pos v1; - v13.i256 = mload v2 i256; - call %set_base v1 v13; - v15.i256 = mload v2 i256; - call %set_pos v1 v15; - call %encode v0 v1; - call %set_base v1 v5; - call %set_pos v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %pos v1; - call %encode_to_ptr v0 v24; - v28.i256 = add v24 32.i256; - call %set_pos v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode v0 v1; - return; -} - -func private %encode_single_root(v0.i256, v1.objref<@layout_0>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %base v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.i256) -> @layout_4 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_0 = call %encoder_new v2; - v4.objref<@layout_0> = obj.alloc @layout_0; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %base v4; - call %encode_single_root v0 v4; - v14.@layout_4 = insert_value undef.@layout_4 0.i256 v11; - v15.@layout_4 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_to_ptr(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %store_word v1 v0; - return; -} - -func private %encoder_new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %from_word(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func inline(always) private %get(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %get_unchecked v0; - return v2; -} - -func private %get_balance(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %get v0; - return v2; -} - -func inline(always) private %get_unchecked(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %storagemap_get_word_with_salt v0 0.i256; - v4.i256 = call %from_word v3; - return v4; -} - -func private %input() -> @layout_1 { - block0: - jump block1; - - block1: - v0.@layout_1 = call %impl_CallData__new; - return v0; -} - -func inline(always) private %len(v0.@layout_1) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_0 = call %at v7; - return v8; -} - -func inline(always) private %impl_CallData__new() -> @layout_1 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_0; - v2.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v2 v1; - v3.@layout_1 = obj.load v2; - return v3; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_3135(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_3135_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %pos(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %revert(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func inline(always) private %set(v0.objref<@layout_6>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %set_unchecked v0 v1 v2; - return; -} - -func private %set_balance(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %set undef.objref<@layout_6> v0 v1; - return; -} - -func private %set_base(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %set_pos(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func inline(always) private %set_unchecked(v0.objref<@layout_6>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %to_word v2; - call %storagemap_set_word_with_salt v1 0.i256 v5; - return; -} - -func inline(always) private %storagemap_get_word_with_salt(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_3954_0 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %storagemap_set_word_with_salt(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_3954 v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_3954(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_2db6 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_3954_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_2db6_0 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %to_word(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_2db6(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_2db6_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_dff7(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_e73a(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @C { - section init { - entry %contract_init_root_C; - embed .runtime as &C_runtime; - } - section runtime { - entry %contract_runtime_root_C; - data $const_region_0; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/storage_map_contract.snap b/crates/codegen/tests/fixtures/sonatina_ir/storage_map_contract.snap deleted file mode 100644 index 9eea4b3131..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/storage_map_contract.snap +++ /dev/null @@ -1,614 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/storage_map_contract.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {}; -type @layout_1 = {@layout_0}; -type @layout_2 = {@layout_0}; - -func private %abi_encode(v0.i256) { - block0: - jump block1; - - block1: - call %mstore 0.i256 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_284c 0.i256 32.i256; - unreachable; -} - -func private %calldataload(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_load v0; - return v2; -} - -func private %codecopy(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - evm_code_copy v0 v1 v2; - return; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_461b(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_461b_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_461b_1(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__gcbe1_9b00(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__gcbe1_8bec v0; - return v2; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get__gcbe1_9b00_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__gcbe1_8bec_0 v0; - return v2; -} - -func private %get_allowance(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %get__g7fdf v0; - return v2; -} - -func private %get_balance(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__gcbe1_9b00 v0; - return v2; -} - -func inline(always) private %get__g7fdf(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %get_unchecked__g7fdf v0; - return v2; -} - -func inline(always) private %get_unchecked__g7fdf(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__ge513_a5dc v0 1.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_461b v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__gcbe1_8bec(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__ge513_a5dc_0 v0 0.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_461b_0 v3; - return v4; -} - -func inline(always) private %std__lib__evm__storage_map__impl_StorageMap_9f54__get_unchecked__gcbe1_8bec_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = call %std__lib__evm__storage_map__storagemap_get_word_with_salt__ge513_a5dc_1 v0 0.i256; - v4.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__from_word_461b_1 v3; - return v4; -} - -func private %init() { - block0: - jump block1; - - block1: - v0.i256 = sym_size &__BalanceMap_runtime; - v1.i256 = sym_addr &__BalanceMap_runtime; - v2.*i8 = evm_malloc v0; - v3.i256 = ptr_to_int v2 i256; - call %codecopy v3 v1 v0; - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_ad81_0 v3 v0; - unreachable; -} - -func private %manual_contract_init_root_BalanceMap() { - block0: - jump block1; - - block1: - call %init; - evm_stop; -} - -func private %manual_contract_runtime_root_BalanceMap() { - block0: - jump block1; - - block1: - call %runtime; - evm_stop; -} - -func private %mstore(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %new__g219d() { - block0: - jump block1; - - block1: - call %new_unchecked__g7fdf; - return; -} - -func private %new__g10e6() { - block0: - jump block1; - - block1: - call %new_unchecked__gcbe1; - return; -} - -func private %new_unchecked__gcbe1() { - block0: - jump block1; - - block1: - return; -} - -func private %new_unchecked__g7fdf() { - block0: - jump block1; - - block1: - return; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_284c(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_ad81(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %std__lib__evm__effects__impl_trait_Evm_0098__return_data_ad81_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_return v0 v1; -} - -func private %runtime() { - block0: - jump block1; - - block1: - v1.i256 = call %calldataload 0.i256; - v3.i256 = shr 224.i256 v1; - call %new__g10e6; - call %new__g219d; - v7.i1 = eq v3 2630350600.i256; - br v7 block2 block8; - - block2: - v9.i256 = call %calldataload 4.i256; - v10.i256 = call %get_balance v9; - call %abi_encode v10; - unreachable; - - block3: - v11.i256 = call %calldataload 4.i256; - v13.i256 = call %calldataload 36.i256; - call %set_balance v11 v13; - call %abi_encode 0.i256; - unreachable; - - block4: - v15.i256 = call %calldataload 4.i256; - v16.i256 = call %calldataload 36.i256; - v18.i256 = call %calldataload 68.i256; - v19.i256 = call %transfer v15 v16 v18; - call %abi_encode v19; - unreachable; - - block5: - v20.i256 = call %calldataload 4.i256; - v21.i256 = call %get_allowance v20; - call %abi_encode v21; - unreachable; - - block6: - v22.i256 = call %calldataload 4.i256; - v23.i256 = call %calldataload 36.i256; - call %set_allowance v22 v23; - call %abi_encode 0.i256; - unreachable; - - block7: - call %std__lib__evm__effects__impl_trait_Evm_0098__return_data_ad81 0.i256 0.i256; - unreachable; - - block8: - v27.i1 = eq v3 1246470123.i256; - br v27 block3 block9; - - block9: - v30.i1 = eq v3 2430412327.i256; - br v30 block4 block10; - - block10: - v33.i1 = eq v3 3378517838.i256; - br v33 block5 block11; - - block11: - v36.i1 = eq v3 197806145.i256; - br v36 block6 block12; - - block12: - jump block7; -} - -func inline(always) private %set__gcbe1(v0.objref<@layout_1>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %set_unchecked__gcbe1 v0 v1 v2; - return; -} - -func inline(always) private %set__g7fdf(v0.objref<@layout_2>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %set_unchecked__g7fdf v0 v1 v2; - return; -} - -func private %set_allowance(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %set__g7fdf undef.objref<@layout_2> v0 v1; - return; -} - -func private %set_balance(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %set__gcbe1 undef.objref<@layout_1> v0 v1; - return; -} - -func inline(always) private %set_unchecked__gcbe1(v0.objref<@layout_1>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_1ead_0 v2; - call %std__lib__evm__storage_map__storagemap_set_word_with_salt__ge513_d78d_0 v1 0.i256 v5; - return; -} - -func inline(always) private %set_unchecked__g7fdf(v0.objref<@layout_2>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__word__impl_trait_u256_1f9e__to_word_1ead v2; - call %std__lib__evm__storage_map__storagemap_set_word_with_salt__ge513_d78d v1 1.i256 v5; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__ge513_a5dc(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_f97d v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__ge513_a5dc_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_f97d_0 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_get_word_with_salt__ge513_a5dc_1(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_f97d_2 v0 v1; - v5.i256 = evm_sload v4; - return v5; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_set_word_with_salt__ge513_d78d(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_f97d_1 v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_set_word_with_salt__ge513_d78d_0(v0.i256, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v5.i256 = call %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_f97d_2 v0 v1; - evm_sstore v5 v2; - return; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_f97d(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_bd6c v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_f97d_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_bd6c_0 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_f97d_1(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_bd6c_1 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func inline(always) private %std__lib__evm__storage_map__storagemap_storage_slot_with_salt__ge513_f97d_2(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v3.*i8 = evm_malloc 0.i256; - v4.i256 = ptr_to_int v3 i256; - v6.i256 = call %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_bd6c_2 v4 v0; - (v7.i256, v8.i1) = uaddo v4 v6; - br v8 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - mstore v7 v1 i256; - (v17.i256, v18.i1) = uaddo v6 32.i256; - br v18 block2 block4; - - block4: - v20.i256 = evm_keccak256 v4 v17; - return v20; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_1ead(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %std__lib__evm__word__impl_trait_u256_1f9e__to_word_1ead_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return v0; -} - -func private %transfer(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__gcbe1_9b00_0 v0; - v6.i1 = lt v4 v2; - br v6 block2 block3; - - block2: - return 1.i256; - - block3: - jump block4; - - block4: - v9.i256 = call %std__lib__evm__storage_map__impl_StorageMap_9f54__get__gcbe1_9b00_0 v1; - (v13.i256, v14.i1) = usubo v4 v2; - br v14 block5 block6; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - call %set__gcbe1 undef.objref<@layout_1> v0 v13; - (v26.i256, v27.i1) = uaddo v9 v2; - br v27 block5 block7; - - block7: - call %set__gcbe1 undef.objref<@layout_1> v1 v26; - return 0.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_bd6c(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_bd6c_0(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_bd6c_1(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - -func inline(always) private %std__lib__evm__storage_map__impl_trait_u256_0dfe__write_key_bd6c_2(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return 32.i256; -} - - -object @BalanceMap { - section init { - entry %manual_contract_init_root_BalanceMap; - embed .runtime as &__BalanceMap_runtime; - } - section runtime { - entry %manual_contract_runtime_root_BalanceMap; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/storage_packed_array.snap b/crates/codegen/tests/fixtures/sonatina_ir/storage_packed_array.snap deleted file mode 100644 index 1f7f11940c..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/storage_packed_array.snap +++ /dev/null @@ -1,649 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/storage_packed_array.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256}; -type @layout_2 = {}; -type @layout_3 = {@layout_2}; -type @layout_4 = {i256, i256}; -type @layout_6 = {}; -type @layout_7 = {@layout_6}; -type @layout_5 = enum { - #Some(i256), - #None, -}; - -global private const @layout_1 $const_region_0 = {0}; - -func private %__C_recv_0_0() -> i256 { - block0: - jump block1; - - block1: - call %set_status 1.i256 2.i256; - call %set_status 33.i256 5.i256; - v8.i256 = call %search_status 5.i256 0.i256 64.i256; - v9.i256 = call %get_status 1.i256; - return v9; -} - -func private %abi_field_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_6965_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %abort() { - block0: - jump block1; - - block1: - call %revert 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %contract_init_abi_C() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - return; -} - -func private %contract_init_root_C() { - block0: - jump block1; - - block1: - call %contract_init_abi_C; - v2.i256 = sym_addr &C_runtime; - v3.i256 = sym_size &C_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_C_0() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_3> = obj.alloc @layout_3; - call %decode_runtime_args v5; - v7.i256 = call %__C_recv_0_0; - v8.@layout_4 = call %encode_single_root_alloc v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func private %contract_runtime_root_C() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (0.i32 block4); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_C_0; - unreachable; -} - -func inline(always) private %decode_from(v0.@layout_1, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %decode_from_prechecked_head(v0.@layout_1, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %decode_from v0 v1; - return; -} - -func inline(always) private %decode_runtime_args(v0.objref<@layout_3>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_1 = call %input; - v5.i256 = call %len v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %abort; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func private %encode(v0.i256, v1.objref<@layout_0>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8250 v1 v0; - return; -} - -func private %encode_field(v0.i256, v1.objref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %base v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_6965 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_3bd7 v1 v10; - v12.i256 = call %pos v1; - v13.i256 = mload v2 i256; - call %set_base v1 v13; - v15.i256 = mload v2 i256; - call %set_pos v1 v15; - call %encode v0 v1; - call %set_base v1 v5; - call %set_pos v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %pos v1; - call %encode_to_ptr v0 v24; - v28.i256 = add v24 32.i256; - call %set_pos v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode v0 v1; - return; -} - -func private %encode_single_root(v0.i256, v1.objref<@layout_0>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %base v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.i256) -> @layout_4 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_0 = call %encoder_new v2; - v4.objref<@layout_0> = obj.alloc @layout_0; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %base v4; - call %encode_single_root v0 v4; - v14.@layout_4 = insert_value undef.@layout_4 0.i256 v11; - v15.@layout_4 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_to_ptr(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %store_word v1 v0; - return; -} - -func private %encoder_new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %impl_SolEncoder__new v0; - return v2; -} - -func inline(always) private %get(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = evm_udiv v0 32.i256; - v5.i256 = add 18569430475105882587588266137607568536673111973893317399460219858819262702947.i256 v4; - v6.i256 = evm_umod v0 32.i256; - v8.i256 = mul v6 8.i256; - v9.i256 = evm_sload v5; - v10.i256 = shr v8 v9; - v12.i256 = and v10 255.i256; - return v12; -} - -func private %get_status(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %get v0; - return v2; -} - -func private %input() -> @layout_1 { - block0: - jump block1; - - block1: - v0.@layout_1 = call %impl_CallData__new; - return v0; -} - -func inline(always) private %len(v0.@layout_1) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_0 = call %at v7; - return v8; -} - -func inline(always) private %impl_CallData__new() -> @layout_1 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_0; - v2.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v2 v1; - v3.@layout_1 = obj.load v2; - return v3; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_6965(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_6965_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %pos(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %revert(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %search(v0.i256, v1.i256, v2.i256) -> @layout_5 { - block0: - v3.*i256 = alloca i256; - v4.*i256 = alloca i256; - jump block1; - - block1: - mstore v3 v1 i256; - jump block2; - - block2: - v6.i256 = mload v3 i256; - v8.i1 = lt v6 v2; - br v8 block3 block4; - - block3: - v11.i256 = mload v3 i256; - v12.i256 = evm_udiv v11 32.i256; - v13.i256 = add 18569430475105882587588266137607568536673111973893317399460219858819262702947.i256 v12; - v14.i256 = evm_sload v13; - v15.i256 = mload v3 i256; - v16.i256 = evm_umod v15 32.i256; - mstore v4 v16 i256; - jump block5; - - block4: - v17.@layout_5 = enum.make @layout_5 #None; - return v17; - - block5: - v18.i256 = mload v4 i256; - v19.i1 = lt v18 32.i256; - br v19 block8 block7; - - block6: - v21.i256 = mload v4 i256; - v22.i256 = mul v21 8.i256; - v24.i256 = shr v22 v14; - v26.i256 = and v24 255.i256; - v28.i1 = eq v26 v0; - br v28 block9 block10; - - block7: - jump block2; - - block8: - v29.i256 = mload v3 i256; - v31.i1 = lt v29 v2; - br v31 block6 block7; - - block9: - v32.i256 = mload v3 i256; - v33.@layout_5 = enum.make @layout_5 #Some v32; - return v33; - - block10: - jump block11; - - block11: - v34.i256 = ptr_to_int v4 i256; - v36.i256 = mload v34 i256; - v37.i256 = add v36 1.i256; - mstore v34 v37 i256; - v38.i256 = ptr_to_int v3 i256; - v39.i256 = mload v38 i256; - v40.i256 = add v39 1.i256; - mstore v38 v40 i256; - jump block5; -} - -func private %search_status(v0.i256, v1.i256, v2.i256) -> i256 { - block0: - jump block1; - - block1: - v6.@layout_5 = call %search v0 v1 v2; - v7.enumtag(@layout_5) = enum.tag v6; - br_table v7 (0.enumtag(@layout_5) block2) (1.enumtag(@layout_5) block3); - - block2: - enum.assert_variant v6 #Some; - v12.i256 = enum.extract v6 #Some 0.i256; - return v12; - - block3: - return -1.i256; -} - -func inline(always) private %set(v0.objref<@layout_7>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - v6.i256 = evm_udiv v1 32.i256; - v7.i256 = add 18569430475105882587588266137607568536673111973893317399460219858819262702947.i256 v6; - v8.i256 = evm_umod v1 32.i256; - v10.i256 = mul v8 8.i256; - v12.i256 = shl v10 255.i256; - v13.i256 = evm_sload v7; - v15.i256 = xor -1.i256 v12; - v16.i256 = and v13 v15; - v18.i256 = and v2 255.i256; - v19.i256 = shl v10 v18; - v20.i256 = or v16 v19; - evm_sstore v7 v20; - return; -} - -func private %set_base(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %set_pos(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %set_status(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %set undef.objref<@layout_7> v0 v1; - return; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_3bd7(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_8250(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @C { - section init { - entry %contract_init_root_C; - embed .runtime as &C_runtime; - } - section runtime { - entry %contract_runtime_root_C; - data $const_region_0; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/string_literal.snap b/crates/codegen/tests/fixtures/sonatina_ir/string_literal.snap deleted file mode 100644 index 32322bf493..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/string_literal.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/string_literal.fe ---- -target = "evm-ethereum-osaka" - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %string_literal; - evm_stop; -} - -func private %string_literal() -> i256 { - block0: - jump block1; - - block1: - v1.i256 = zext 448378203247.i64 i256; - return v1; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/string_literal_large.snap b/crates/codegen/tests/fixtures/sonatina_ir/string_literal_large.snap deleted file mode 100644 index 84170e3c6e..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/string_literal_large.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/string_literal_large.fe ---- -target = "evm-ethereum-osaka" - -func private %large_string() -> i256 { - block0: - jump block1; - - block1: - return 172063216033151516844329818169388221396727601204421676283161692387156386917.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %large_string; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/struct_init.snap b/crates/codegen/tests/fixtures/sonatina_ir/struct_init.snap deleted file mode 100644 index 1c4ab556b3..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/struct_init.snap +++ /dev/null @@ -1,39 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/struct_init.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i64, i256}; - -global private const @layout_0 $const_region_0 = {42, 99}; - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %make_dummy; - evm_stop; -} - -func private %make_dummy() -> @layout_0 { - block0: - jump block1; - - block1: - v2.constref<@layout_0> = const.ref $const_region_0; - v3.constref<@layout_0> = const.ref $const_region_0; - v4.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v4 v3; - v5.@layout_0 = obj.load v4; - return v5; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/tstor_ptr_contract.snap b/crates/codegen/tests/fixtures/sonatina_ir/tstor_ptr_contract.snap deleted file mode 100644 index 834d5d8fae..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/tstor_ptr_contract.snap +++ /dev/null @@ -1,545 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/tstor_ptr_contract.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256}; -type @layout_2 = {}; -type @layout_3 = {@layout_2}; -type @layout_4 = {i256, i256}; - -global private const @layout_1 $const_region_0 = {0}; - -func private %__GuardContract_init(v0.i256) { - block0: - jump block1; - - block1: - v3.i256 = zext 0.i1 i256; - evm_tstore v0 v3; - return; -} - -func private %__GuardContract_recv_0_0(v0.i256, v1.i256) -> i1 { - block0: - jump block1; - - block1: - v4.i256 = evm_sload v1; - (v5.i256, v6.i1) = uaddo v4 1.i256; - br v6 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - evm_sstore v1 v5; - v14.i256 = evm_tload v0; - v15.i1 = ne v14 0.i256; - v16.i1 = is_zero v15; - v17.i256 = zext v16 i256; - evm_tstore v0 v17; - return v15; -} - -func private %abi_field_size(v0.i1) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__trait_AbiSize__payload_size__gda9b_f558_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.i1) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %abort() { - block0: - jump block1; - - block1: - call %revert 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v4.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v6.@layout_0 = insert_value v4 1.i256 v0; - return v6; -} - -func private %base(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %contract_init_abi_GuardContract() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - call %__GuardContract_init 0.i256; - return; -} - -func private %contract_init_root_GuardContract() { - block0: - jump block1; - - block1: - call %contract_init_abi_GuardContract; - v2.i256 = sym_addr &GuardContract_runtime; - v3.i256 = sym_size &GuardContract_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_GuardContract_1() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_3> = obj.alloc @layout_3; - call %decode_runtime_args v5; - v7.i1 = call %__GuardContract_recv_0_0 0.i256 0.i256; - v8.@layout_4 = call %encode_single_root_alloc v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func private %contract_runtime_root_GuardContract() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (1.i32 block4); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_GuardContract_1; - unreachable; -} - -func inline(always) private %decode_from(v0.@layout_1, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %decode_from_prechecked_head(v0.@layout_1, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %decode_from v0 v1; - return; -} - -func inline(always) private %decode_runtime_args(v0.objref<@layout_3>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_1 = call %input; - v5.i256 = call %len v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %abort; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func private %encode(v0.i1, v1.objref<@layout_0>) { - block0: - jump block1; - - block1: - br v0 block2 block3; - - block2: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_9a9f v1 1.i256; - jump block4; - - block3: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_9a9f v1 0.i256; - jump block4; - - block4: - return; -} - -func private %encode_field(v0.i1, v1.objref<@layout_0>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %base v1; - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__gda9b_f558 v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_74a3 v1 v10; - v12.i256 = call %pos v1; - v13.i256 = mload v2 i256; - call %set_base v1 v13; - v15.i256 = mload v2 i256; - call %set_pos v1 v15; - call %encode v0 v1; - call %set_base v1 v5; - call %set_pos v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %pos v1; - call %encode_to_ptr v0 v24; - v28.i256 = add v24 32.i256; - call %set_pos v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode v0 v1; - return; -} - -func private %encode_single_root(v0.i1, v1.objref<@layout_0>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %base v1; - v6.i256 = add v4 32.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.i1) -> @layout_4 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_0 = call %encoder_new v2; - v4.objref<@layout_0> = obj.alloc @layout_0; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %base v4; - call %encode_single_root v0 v4; - v14.@layout_4 = insert_value undef.@layout_4 0.i256 v11; - v15.@layout_4 = insert_value v14 1.i256 v2; - return v15; -} - -func private %encode_to_ptr(v0.i1, v1.i256) { - block0: - jump block1; - - block1: - br v0 block2 block3; - - block2: - call %store_word v1 1.i256; - jump block4; - - block3: - call %store_word v1 0.i256; - jump block4; - - block4: - return; -} - -func private %encoder_new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %input() -> @layout_1 { - block0: - jump block1; - - block1: - v0.@layout_1 = call %impl_CallData__new; - return v0; -} - -func inline(always) private %len(v0.@layout_1) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_0 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_0 = call %at v7; - return v8; -} - -func inline(always) private %impl_CallData__new() -> @layout_1 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_0; - v2.objref<@layout_1> = obj.alloc @layout_1; - obj.init.const v2 v1; - v3.@layout_1 = obj.load v2; - return v3; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__gda9b_f558(v0.i1) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__gda9b_f558_0(v0.i1) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %pos(v0.objref<@layout_0>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %revert(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %set_base(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %set_pos(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %store_word(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_74a3(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_9a9f(v0.objref<@layout_0>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - - -object @GuardContract { - section init { - entry %contract_init_root_GuardContract; - embed .runtime as &GuardContract_runtime; - } - section runtime { - entry %contract_runtime_root_GuardContract; - data $const_region_0; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/tuple_construction.snap b/crates/codegen/tests/fixtures/sonatina_ir/tuple_construction.snap deleted file mode 100644 index 20e078a53f..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/tuple_construction.snap +++ /dev/null @@ -1,51 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/tuple_construction.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i64, i256}; -type @layout_1 = {i256, i256, i256}; - -global private const @layout_1 $const_region_0 = {1, 2, 3}; -global private const @layout_0 $const_region_1 = {42, 99}; - -func private %access_tuple() -> i256 { - block0: - jump block1; - - block1: - v3.constref<@layout_1> = const.ref $const_region_0; - v4.constref<@layout_1> = const.ref $const_region_0; - return 2.i256; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %access_tuple; - evm_stop; -} - -func private %make_tuple() -> @layout_0 { - block0: - jump block1; - - block1: - v2.constref<@layout_0> = const.ref $const_region_1; - v3.constref<@layout_0> = const.ref $const_region_1; - v4.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v4 v3; - v5.@layout_0 = obj.load v4; - return v5; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/tuple_expr.snap b/crates/codegen/tests/fixtures/sonatina_ir/tuple_expr.snap deleted file mode 100644 index d32ad90bd7..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/tuple_expr.snap +++ /dev/null @@ -1,38 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/tuple_expr.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i64, i1}; - -global private const @layout_0 $const_region_0 = {3, 1}; - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %tuple_expr; - evm_stop; -} - -func private %tuple_expr() -> @layout_0 { - block0: - jump block1; - - block1: - v5.constref<@layout_0> = const.ref $const_region_0; - v6.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v6 v5; - v7.@layout_0 = obj.load v6; - return v7; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/tuple_literal_field_access.snap b/crates/codegen/tests/fixtures/sonatina_ir/tuple_literal_field_access.snap deleted file mode 100644 index 94917f4d28..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/tuple_literal_field_access.snap +++ /dev/null @@ -1,62 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/tuple_literal_field_access.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; -type @layout_1 = {i256, @layout_0}; -type @layout_2 = {@layout_0}; - -global private const @layout_0 $const_region_0 = {1, 2}; -global private const @layout_0 $const_region_1 = {2, 3}; -global private const @layout_1 $const_region_2 = {1, {2, 3}}; -global private const @layout_2 $const_region_3 = {{1, 2}}; - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %tuple_literal_field_access; - evm_stop; -} - -func private %tuple_literal_field_access() -> i256 { - block0: - jump block1; - - block1: - v2.constref<@layout_0> = const.ref $const_region_0; - return 2.i256; -} - -func private %tuple_literal_nested_access() -> i256 { - block0: - jump block1; - - block1: - v3.constref<@layout_0> = const.ref $const_region_1; - v4.constref<@layout_1> = const.ref $const_region_2; - v5.constref<@layout_0> = const.ref $const_region_1; - return 2.i256; -} - -func private %tuple_literal_struct_chain() -> i256 { - block0: - jump block1; - - block1: - v2.constref<@layout_0> = const.ref $const_region_0; - v3.constref<@layout_2> = const.ref $const_region_3; - v4.constref<@layout_0> = const.ref $const_region_0; - return 2.i256; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/tuple_return_contract.snap b/crates/codegen/tests/fixtures/sonatina_ir/tuple_return_contract.snap deleted file mode 100644 index bf02396193..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/tuple_return_contract.snap +++ /dev/null @@ -1,916 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/tuple_return_contract.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; -type @layout_1 = {i256, @layout_0}; -type @layout_2 = {i256, i256}; -type @layout_3 = {i256}; -type @layout_4 = {}; -type @layout_5 = {@layout_4}; -type @layout_6 = {i256, i256}; - -global private const @layout_3 $const_region_0 = {0}; -global private const @layout_0 $const_region_1 = {0}; - -func private %__TupleReturnContract_recv_0_0() -> @layout_1 { - block0: - jump block1; - - block1: - v1.@layout_0 = call %zero; - v4.@layout_1 = insert_value undef.@layout_1 0.i256 42.i256; - v6.@layout_1 = insert_value v4 1.i256 v1; - return v6; -} - -func private %abi_field_size(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %core__lib__abi__impl_trait____ccb6__payload_size__g6d15_e33b_0 v0; - br 0.i1 block2 block3; - - block2: - (v6.i256, v7.i1) = uaddo 32.i256 v2; - br v7 block5 block6; - - block3: - jump block4; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - return v6; -} - -func private %abi_single_root_size(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_field_size v0; - return v2; -} - -func private %abort() { - block0: - jump block1; - - block1: - call %revert 0.i256 0.i256; - unreachable; -} - -func inline(always) private %at(v0.i256) -> @layout_2 { - block0: - jump block1; - - block1: - v4.@layout_2 = insert_value undef.@layout_2 0.i256 v0; - v6.@layout_2 = insert_value v4 1.i256 v0; - return v6; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_8e95(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_a403(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 0.i256; - v4.i256 = obj.load v3; - return v4; -} - -func inline(always) private %contract_init_abi_TupleReturnContract() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - return; -} - -func private %contract_init_root_TupleReturnContract() { - block0: - jump block1; - - block1: - call %contract_init_abi_TupleReturnContract; - v2.i256 = sym_addr &TupleReturnContract_runtime; - v3.i256 = sym_size &TupleReturnContract_runtime; - evm_code_copy 0.i256 v2 v3; - evm_return 0.i256 v3; -} - -func inline(always) private %contract_recv_abi_TupleReturnContract_1() { - block0: - jump block1; - - block1: - v1.i256 = evm_call_value; - v2.i1 = eq v1 0.i256; - v3.i1 = is_zero v2; - br v3 block2 block3; - - block2: - evm_revert 0.i256 0.i256; - - block3: - v5.objref<@layout_5> = obj.alloc @layout_5; - call %decode_runtime_args v5; - v7.@layout_1 = call %__TupleReturnContract_recv_0_0; - v8.@layout_6 = call %encode_single_root_alloc v7; - v9.i256 = extract_value v8 0.i256; - v11.i256 = extract_value v8 1.i256; - evm_return v9 v11; -} - -func private %contract_runtime_root_TupleReturnContract() { - block0: - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v3.i1 = lt v2 4.i256; - br v3 block3 block2; - - block2: - v4.i256 = evm_calldata_load 0.i256; - v6.i256 = shr 224.i256 v4; - v7.i32 = trunc v6 i32; - br_table v7 block3 (1.i32 block4); - - block3: - evm_revert 0.i256 0.i256; - - block4: - call %contract_recv_abi_TupleReturnContract_1; - unreachable; -} - -func inline(always) private %decode_from(v0.@layout_3, v1.i256) { - block0: - jump block1; - - block1: - return; -} - -func inline(always) private %decode_from_prechecked_head(v0.@layout_3, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - call %decode_from v0 v1; - return; -} - -func inline(always) private %decode_runtime_args(v0.objref<@layout_5>) { - block0: - v1.*i256 = alloca i256; - v2.*i256 = alloca i256; - jump block1; - - block1: - v3.@layout_3 = call %input; - v5.i256 = call %len v3; - mstore v1 4.i256 i256; - br 0.i1 block2 block5; - - block2: - call %abort; - unreachable; - - block3: - jump block4; - - block4: - call %decode_from_prechecked_head v3 4.i256 v5; - return; - - block5: - mstore v2 v5 i256; - v14.i256 = mload v2 i256; - v15.i1 = gt 4.i256 v14; - br v15 block2 block3; -} - -func private %core__lib__abi__dynamic_payload_size__g67a8_baae(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %core__lib__abi__trait_AbiSize__payload_size__g67a8_75f0 v0; - return v3; - - block3: - jump block4; - - block4: - return 0.i256; -} - -func private %core__lib__abi__dynamic_payload_size__g67a8_baae_0(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %core__lib__abi__trait_AbiSize__payload_size__g67a8_75f0_0 v0; - return v3; - - block3: - jump block4; - - block4: - return 0.i256; -} - -func private %core__lib__abi__dynamic_payload_size__ge513_f973(v0.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_c169 v0; - return v3; - - block3: - jump block4; - - block4: - return 0.i256; -} - -func private %core__lib__abi__dynamic_payload_size__ge513_f973_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v3.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_c169_0 v0; - return v3; - - block3: - jump block4; - - block4: - return 0.i256; -} - -func inline(always) private %encode__g4887(v0.@layout_1, v1.objref<@layout_2>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_8e95 v1; - v6.i256 = add v4 64.i256; - mstore v2 v6 i256; - v8.i256 = add v4 32.i256; - v11.i256 = extract_value v0 0.i256; - v12.i256 = ptr_to_int v2 i256; - call %encode_field_at__g2e64 v11 v1 v4 v4 v12; - v15.@layout_0 = extract_value v0 1.i256; - v16.i256 = ptr_to_int v2 i256; - call %encode_field_at__gf6b4 v15 v1 v4 v8 v16; - v18.i256 = add v4 64.i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0d08_1 v1 v18; - return; -} - -func private %impl_trait_u256__encode__g426c(v0.i256, v1.objref<@layout_2>) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_a864 v1 v0; - return; -} - -func private %impl_trait_Address__encode__g426c(v0.@layout_0, v1.objref<@layout_2>) { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_e52b v1 v4; - return; -} - -func private %encode_field(v0.@layout_1, v1.objref<@layout_2>, v2.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v5.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_a403 v1; - v8.i256 = call %core__lib__abi__impl_trait____ccb6__payload_size__g6d15_e33b v0; - v9.i256 = mload v2 i256; - v10.i256 = sub v9 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_4363 v1 v10; - v12.i256 = call %pos v1; - v13.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_80f4 v1 v13; - v15.i256 = mload v2 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_516e v1 v15; - call %encode__g4887 v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_80f4 v1 v5; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_516e v1 v12; - v20.i256 = mload v2 i256; - v21.i256 = add v20 v8; - mstore v2 v21 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - v24.i256 = call %pos v1; - call %encode_to_ptr__g753b v0 v24; - v28.i256 = add v24 64.i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_516e v1 v28; - return; - - block6: - jump block7; - - block7: - call %encode__g4887 v0 v1; - return; -} - -func inline(always) private %encode_field_at__gf6b4(v0.@layout_0, v1.objref<@layout_2>, v2.i256, v3.i256, v4.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__g67a8_7cab v0; - v11.i256 = mload v4 i256; - v12.i256 = sub v11 v2; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_at_9d2f v1 v3 v12; - v15.i256 = mload v4 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_3ff5 v1 v15; - v17.i256 = mload v4 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0d08 v1 v17; - call %impl_trait_Address__encode__g426c v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_3ff5 v1 v2; - v21.i256 = mload v4 i256; - v22.i256 = add v21 v8; - mstore v4 v22 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - call %std__lib__evm__effects__impl_trait_Address_ed76__encode_to_ptr__gf13e_8bc3 v0 v3; - return; - - block6: - jump block7; - - block7: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0d08 v1 v3; - call %impl_trait_Address__encode__g426c v0 v1; - return; -} - -func inline(always) private %encode_field_at__g2e64(v0.i256, v1.objref<@layout_2>, v2.i256, v3.i256, v4.i256) { - block0: - jump block1; - - block1: - br 0.i1 block2 block3; - - block2: - v8.i256 = call %core__lib__abi__trait_AbiSize__payload_size__ge513_7c20 v0; - v11.i256 = mload v4 i256; - v12.i256 = sub v11 v2; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_at_9d2f_0 v1 v3 v12; - v15.i256 = mload v4 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_3ff5_0 v1 v15; - v17.i256 = mload v4 i256; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0d08_0 v1 v17; - call %impl_trait_u256__encode__g426c v0 v1; - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_3ff5_0 v1 v2; - v21.i256 = mload v4 i256; - v22.i256 = add v21 v8; - mstore v4 v22 i256; - return; - - block3: - jump block4; - - block4: - br 1.i1 block5 block6; - - block5: - call %core__lib__abi__impl_trait_u256_d99e__encode_to_ptr__gf13e_3ddf v0 v3; - return; - - block6: - jump block7; - - block7: - call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0d08_0 v1 v3; - call %impl_trait_u256__encode__g426c v0 v1; - return; -} - -func private %encode_single_root(v0.@layout_1, v1.objref<@layout_2>) { - block0: - v2.*i256 = alloca i256; - jump block1; - - block1: - v4.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_a403 v1; - v6.i256 = add v4 64.i256; - mstore v2 v6 i256; - v7.i256 = ptr_to_int v2 i256; - call %encode_field v0 v1 v7; - return; -} - -func private %encode_single_root_alloc(v0.@layout_1) -> @layout_6 { - block0: - jump block1; - - block1: - v2.i256 = call %abi_single_root_size v0; - v3.@layout_2 = call %encoder_new v2; - v4.objref<@layout_2> = obj.alloc @layout_2; - v6.objref = obj.proj v4 0.i256; - v7.i256 = extract_value v3 0.i256; - obj.store v6 v7; - v9.objref = obj.proj v4 1.i256; - v10.i256 = extract_value v3 1.i256; - obj.store v9 v10; - v11.i256 = call %std__lib__abi__sol__impl_trait_SolEncoder_19ce__base_a403 v4; - call %encode_single_root v0 v4; - v14.@layout_6 = insert_value undef.@layout_6 0.i256 v11; - v15.@layout_6 = insert_value v14 1.i256 v2; - return v15; -} - -func private %core__lib__abi__impl_trait_u256_d99e__encode_to_ptr__gf13e_3ddf(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_5688 v1 v0; - return; -} - -func private %core__lib__abi__impl_trait_u256_d99e__encode_to_ptr__gf13e_3ddf_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_5688 v1 v0; - return; -} - -func private %encode_to_ptr__g753b(v0.@layout_1, v1.i256) { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - call %core__lib__abi__impl_trait_u256_d99e__encode_to_ptr__gf13e_3ddf_0 v4 v1; - v8.@layout_0 = extract_value v0 1.i256; - v10.i256 = add v1 32.i256; - call %std__lib__evm__effects__impl_trait_Address_ed76__encode_to_ptr__gf13e_8bc3_0 v8 v10; - return; -} - -func private %std__lib__evm__effects__impl_trait_Address_ed76__encode_to_ptr__gf13e_8bc3(v0.@layout_0, v1.i256) { - block0: - jump block1; - - block1: - v5.i256 = extract_value v0 0.i256; - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_001d v1 v5; - return; -} - -func private %std__lib__evm__effects__impl_trait_Address_ed76__encode_to_ptr__gf13e_8bc3_0(v0.@layout_0, v1.i256) { - block0: - jump block1; - - block1: - v5.i256 = extract_value v0 0.i256; - call %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_001d_0 v1 v5; - return; -} - -func private %encoder_new(v0.i256) -> @layout_2 { - block0: - jump block1; - - block1: - v2.@layout_2 = call %impl_SolEncoder__new v0; - return v2; -} - -func private %input() -> @layout_3 { - block0: - jump block1; - - block1: - v0.@layout_3 = call %impl_CallData__new; - return v0; -} - -func inline(always) private %len(v0.@layout_3) -> i256 { - block0: - v1.*i256 = alloca i256; - jump block1; - - block1: - v2.i256 = evm_calldata_size; - v5.i256 = extract_value v0 0.i256; - mstore v1 v2 i256; - v6.i256 = mload v1 i256; - v7.i1 = gt v5 v6; - br v7 block2 block3; - - block2: - jump block4; - - block3: - v9.i256 = extract_value v0 0.i256; - (v11.i256, v12.i1) = usubo v2 v9; - br v12 block5 block6; - - block4: - v17.i256 = phi (0.i256 block2) (v11 block6); - return v17; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block4; -} - -func inline(always) private %impl_CallData__new() -> @layout_3 { - block0: - jump block1; - - block1: - v1.constref<@layout_3> = const.ref $const_region_0; - v2.objref<@layout_3> = obj.alloc @layout_3; - obj.init.const v2 v1; - v3.@layout_3 = obj.load v2; - return v3; -} - -func private %impl_SolEncoder__new(v0.i256) -> @layout_2 { - block0: - jump block1; - - block1: - v3.i1 = eq v0 0.i256; - br v3 block2 block3; - - block2: - jump block4; - - block3: - v5.*i8 = evm_malloc v0; - v6.i256 = ptr_to_int v5 i256; - jump block4; - - block4: - v7.i256 = phi (0.i256 block2) (v6 block3); - v8.@layout_2 = call %at v7; - return v8; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__g67a8_75f0(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__g67a8_75f0_0(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_7c20(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__g67a8_7cab(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_c169(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func private %core__lib__abi__trait_AbiSize__payload_size__ge513_c169_0(v0.i256) -> i256 { - block0: - jump block1; - - block1: - return 32.i256; -} - -func inline(always) private %core__lib__abi__impl_trait____ccb6__payload_size__g6d15_e33b(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v5.i256 = call %core__lib__abi__dynamic_payload_size__ge513_f973 v4; - v6.i256 = add 64.i256 v5; - v8.@layout_0 = extract_value v0 1.i256; - v9.i256 = call %core__lib__abi__dynamic_payload_size__g67a8_baae v8; - v10.i256 = add v6 v9; - return v10; -} - -func inline(always) private %core__lib__abi__impl_trait____ccb6__payload_size__g6d15_e33b_0(v0.@layout_1) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = extract_value v0 0.i256; - v5.i256 = call %core__lib__abi__dynamic_payload_size__ge513_f973_0 v4; - v6.i256 = add 64.i256 v5; - v8.@layout_0 = extract_value v0 1.i256; - v9.i256 = call %core__lib__abi__dynamic_payload_size__g67a8_baae_0 v8; - v10.i256 = add v6 v9; - return v10; -} - -func private %pos(v0.objref<@layout_2>) -> i256 { - block0: - jump block1; - - block1: - v3.objref = obj.proj v0 1.i256; - v4.i256 = obj.load v3; - return v4; -} - -func private %revert(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - evm_revert v0 v1; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_3ff5(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_3ff5_0(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_80f4(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 0.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0d08(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0d08_0(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_0d08_1(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_pos_516e(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v5.objref = obj.proj v0 1.i256; - obj.store v5 v1; - return; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_001d(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_001d_0(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_Sol_1f5f__store_word_5688(v0.i256, v1.i256) { - block0: - jump block1; - - block1: - mstore v0 v1 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_4363(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_a864(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_at_9d2f(v0.objref<@layout_2>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - mstore v1 v2 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_at_9d2f_0(v0.objref<@layout_2>, v1.i256, v2.i256) { - block0: - jump block1; - - block1: - mstore v1 v2 i256; - return; -} - -func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__write_word_e52b(v0.objref<@layout_2>, v1.i256) { - block0: - jump block1; - - block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - mstore v5 v1 i256; - v9.i256 = add v5 32.i256; - v10.objref = obj.proj v0 1.i256; - obj.store v10 v9; - return; -} - -func private %zero() -> @layout_0 { - block0: - jump block1; - - block1: - v1.constref<@layout_0> = const.ref $const_region_1; - v2.objref<@layout_0> = obj.alloc @layout_0; - obj.init.const v2 v1; - v3.@layout_0 = obj.load v2; - return v3; -} - - -object @TupleReturnContract { - section init { - entry %contract_init_root_TupleReturnContract; - embed .runtime as &TupleReturnContract_runtime; - } - section runtime { - entry %contract_runtime_root_TupleReturnContract; - data $const_region_0; - data $const_region_1; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/tuple_single_element_peeling.snap b/crates/codegen/tests/fixtures/sonatina_ir/tuple_single_element_peeling.snap deleted file mode 100644 index 7e6b8c3285..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/tuple_single_element_peeling.snap +++ /dev/null @@ -1,109 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/tuple_single_element_peeling.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256, i256, i8}; -type @layout_1 = {i1}; -type @layout_2 = {i256}; -type @layout_3 = {@layout_2}; -type @layout_4 = {i256}; -type @layout_5 = {@layout_4}; - -global private const @layout_1 $const_region_0 = {1}; - -func private %main() -> @layout_0 { - block0: - jump block1; - - block1: - v1.i256 = call %tuple_single_passthrough 1.i256; - v3.i256 = call %tuple_single_nested_passthrough 2.i256; - v5.i256 = call %tuple_single_struct_newtype_nested 3.i256; - v7.constref<@layout_1> = const.ref $const_region_0; - v8.i8 = call %match_single_element_tuple v7; - v11.@layout_0 = insert_value undef.@layout_0 0.i256 v1; - v12.@layout_0 = insert_value v11 1.i256 v3; - v13.@layout_0 = insert_value v12 2.i256 v5; - v14.@layout_0 = insert_value v13 3.i256 v8; - return v14; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_0 = call %main; - evm_stop; -} - -func private %match_single_element_tuple(v0.constref<@layout_1>) -> i8 { - block0: - jump block1; - - block1: - jump block3; - - block2: - v2.i8 = phi (1.i8 block4) (0.i8 block5); - return v2; - - block3: - v5.constref = const.proj v0 0.i256; - v6.i1 = const.load v5; - v8.i1 = eq v6 1.i1; - br v8 block4 block6; - - block4: - jump block2; - - block5: - jump block2; - - block6: - jump block5; -} - -func private %tuple_single_nested_passthrough(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v4.@layout_2 = insert_value undef.@layout_2 0.i256 v0; - v6.@layout_3 = insert_value undef.@layout_3 0.i256 v4; - v7.@layout_2 = extract_value v6 0.i256; - v8.i256 = extract_value v7 0.i256; - return v8; -} - -func private %tuple_single_passthrough(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v4.@layout_2 = insert_value undef.@layout_2 0.i256 v0; - v5.i256 = extract_value v4 0.i256; - return v5; -} - -func private %tuple_single_struct_newtype_nested(v0.i256) -> i256 { - block0: - jump block1; - - block1: - v4.@layout_4 = insert_value undef.@layout_4 0.i256 v0; - v6.@layout_5 = insert_value undef.@layout_5 0.i256 v4; - v7.@layout_4 = extract_value v6 0.i256; - v8.i256 = extract_value v7 0.i256; - return v8; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/unary_expr.snap b/crates/codegen/tests/fixtures/sonatina_ir/unary_expr.snap deleted file mode 100644 index 363a706c60..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/unary_expr.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/unary_expr.fe ---- -target = "evm-ethereum-osaka" - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %unary_expr; - evm_stop; -} - -func private %unary_expr() -> i64 { - block0: - jump block1; - - block1: - return -3.i64; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/unit_method_call.snap b/crates/codegen/tests/fixtures/sonatina_ir/unit_method_call.snap deleted file mode 100644 index 85768ef550..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/unit_method_call.snap +++ /dev/null @@ -1,53 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/unit_method_call.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256}; - -global private const @layout_0 $const_region_0 = {1}; - -func private %call_unit_method(v0.constref<@layout_0>) { - block0: - jump block1; - - block1: - call %increment v0; - return; -} - -func private %increment(v0.constref<@layout_0>) { - block0: - jump block1; - - block1: - return; -} - -func private %main() { - block0: - jump block1; - - block1: - v1.constref<@layout_0> = const.ref $const_region_0; - call %call_unit_method v1; - return; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %main; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/view_param_aggregate_value.snap b/crates/codegen/tests/fixtures/sonatina_ir/view_param_aggregate_value.snap deleted file mode 100644 index 4f49cd18f2..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/view_param_aggregate_value.snap +++ /dev/null @@ -1,63 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/view_param_aggregate_value.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i256, i256}; - -func private %call_view_param_aggregate_value() -> i256 { - block0: - jump block1; - - block1: - v2.i256 = call %view_param_aggregate_value 40.i256 2.i256; - return v2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i256 = call %call_view_param_aggregate_value; - evm_stop; -} - -func private %sum(v0.@layout_0) -> i256 { - block0: - jump block1; - - block1: - v3.i256 = extract_value v0 0.i256; - v5.i256 = extract_value v0 1.i256; - (v6.i256, v7.i1) = uaddo v3 v5; - br v7 block2 block3; - - block2: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block3: - return v6; -} - -func private %view_param_aggregate_value(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v6.@layout_0 = insert_value undef.@layout_0 0.i256 v0; - v8.@layout_0 = insert_value v6 1.i256 v1; - v9.i256 = call %sum v8; - return v9; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/while.snap b/crates/codegen/tests/fixtures/sonatina_ir/while.snap deleted file mode 100644 index 18dca220e5..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/while.snap +++ /dev/null @@ -1,50 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/while.fe ---- -target = "evm-ethereum-osaka" - -func private %do_while() -> i64 { - block0: - jump block1; - - block1: - jump block2; - - block2: - v2.i64 = phi (0.i64 block1) (v6 block6); - v3.i1 = lt v2 10.i64; - br v3 block3 block4; - - block3: - (v6.i64, v7.i1) = uaddo v2 1.i64; - br v7 block5 block6; - - block4: - return v2; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block2; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %do_while; - evm_stop; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/while_cond_call.snap b/crates/codegen/tests/fixtures/sonatina_ir/while_cond_call.snap deleted file mode 100644 index 78e840e8eb..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/while_cond_call.snap +++ /dev/null @@ -1,59 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/while_cond_call.fe ---- -target = "evm-ethereum-osaka" - -func private %lt_ten(v0.i64) -> i1 { - block0: - jump block1; - - block1: - v3.i1 = lt v0 10.i64; - return v3; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.i64 = call %while_cond_call; - evm_stop; -} - -func private %while_cond_call() -> i64 { - block0: - jump block1; - - block1: - jump block2; - - block2: - v1.i64 = phi (0.i64 block1) (v5 block6); - v2.i1 = call %lt_ten v1; - br v2 block3 block4; - - block3: - (v5.i64, v6.i1) = uaddo v1 1.i64; - br v6 block5 block6; - - block4: - return v1; - - block5: - mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; - mstore 4.i256 17.i256 i256; - evm_revert 0.i256 36.i256; - - block6: - jump block2; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/wrapping_saturating.snap b/crates/codegen/tests/fixtures/sonatina_ir/wrapping_saturating.snap deleted file mode 100644 index 0f869aba8c..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/wrapping_saturating.snap +++ /dev/null @@ -1,206 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -expression: output -input_file: crates/codegen/tests/fixtures/wrapping_saturating.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {i64, i64, i64}; -type @layout_1 = {i256, i256, i256}; -type @layout_2 = {@layout_0, @layout_0, @layout_1, @layout_1}; - -func private %main() -> @layout_2 { - block0: - jump block1; - - block1: - v2.@layout_0 = call %wrapping_ops_u64 1.i64 2.i64; - v3.@layout_0 = call %saturating_ops_u64 1.i64 2.i64; - v6.@layout_1 = call %wrapping_ops_u256 1.i256 2.i256; - v7.@layout_1 = call %saturating_ops_u256 1.i256 2.i256; - v10.@layout_2 = insert_value undef.@layout_2 0.i256 v2; - v11.@layout_2 = insert_value v10 1.i256 v3; - v12.@layout_2 = insert_value v11 2.i256 v6; - v14.@layout_2 = insert_value v12 3.i256 v7; - return v14; -} - -func private %main_root() { - block0: - jump block1; - - block1: - v0.@layout_2 = call %main; - evm_stop; -} - -func private %impl_trait_u256__saturating_add(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = uaddsat v0 v1; - return v4; -} - -func private %impl_trait_u64__saturating_add(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - v4.i64 = uaddsat v0 v1; - return v4; -} - -func private %impl_trait_u64__saturating_mul(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - v4.i64 = umulsat v0 v1; - return v4; -} - -func private %impl_trait_u256__saturating_mul(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = umulsat v0 v1; - return v4; -} - -func private %saturating_ops_u256(v0.i256, v1.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.i256 = call %impl_trait_u256__saturating_add v0 v1; - v5.i256 = call %impl_trait_u256__saturating_sub v0 v1; - v6.i256 = call %impl_trait_u256__saturating_mul v0 v1; - v9.@layout_1 = insert_value undef.@layout_1 0.i256 v4; - v11.@layout_1 = insert_value v9 1.i256 v5; - v13.@layout_1 = insert_value v11 2.i256 v6; - return v13; -} - -func private %saturating_ops_u64(v0.i64, v1.i64) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i64 = call %impl_trait_u64__saturating_add v0 v1; - v5.i64 = call %impl_trait_u64__saturating_sub v0 v1; - v6.i64 = call %impl_trait_u64__saturating_mul v0 v1; - v9.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - v11.@layout_0 = insert_value v9 1.i256 v5; - v13.@layout_0 = insert_value v11 2.i256 v6; - return v13; -} - -func private %impl_trait_u64__saturating_sub(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - v4.i64 = usubsat v0 v1; - return v4; -} - -func private %impl_trait_u256__saturating_sub(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = usubsat v0 v1; - return v4; -} - -func private %impl_trait_u64__wrapping_add(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - v4.i64 = add v0 v1; - return v4; -} - -func private %impl_trait_u256__wrapping_add(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = add v0 v1; - return v4; -} - -func private %impl_trait_u256__wrapping_mul(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = mul v0 v1; - return v4; -} - -func private %impl_trait_u64__wrapping_mul(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - v4.i64 = mul v0 v1; - return v4; -} - -func private %wrapping_ops_u256(v0.i256, v1.i256) -> @layout_1 { - block0: - jump block1; - - block1: - v4.i256 = call %impl_trait_u256__wrapping_add v0 v1; - v5.i256 = call %impl_trait_u256__wrapping_sub v0 v1; - v6.i256 = call %impl_trait_u256__wrapping_mul v0 v1; - v9.@layout_1 = insert_value undef.@layout_1 0.i256 v4; - v11.@layout_1 = insert_value v9 1.i256 v5; - v13.@layout_1 = insert_value v11 2.i256 v6; - return v13; -} - -func private %wrapping_ops_u64(v0.i64, v1.i64) -> @layout_0 { - block0: - jump block1; - - block1: - v4.i64 = call %impl_trait_u64__wrapping_add v0 v1; - v5.i64 = call %impl_trait_u64__wrapping_sub v0 v1; - v6.i64 = call %impl_trait_u64__wrapping_mul v0 v1; - v9.@layout_0 = insert_value undef.@layout_0 0.i256 v4; - v11.@layout_0 = insert_value v9 1.i256 v5; - v13.@layout_0 = insert_value v11 2.i256 v6; - return v13; -} - -func private %impl_trait_u64__wrapping_sub(v0.i64, v1.i64) -> i64 { - block0: - jump block1; - - block1: - v4.i64 = sub v0 v1; - return v4; -} - -func private %impl_trait_u256__wrapping_sub(v0.i256, v1.i256) -> i256 { - block0: - jump block1; - - block1: - v4.i256 = sub v0 v1; - return v4; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/sonatina_ir/zero_sized_aggregates.snap b/crates/codegen/tests/fixtures/sonatina_ir/zero_sized_aggregates.snap deleted file mode 100644 index ca7915a115..0000000000 --- a/crates/codegen/tests/fixtures/sonatina_ir/zero_sized_aggregates.snap +++ /dev/null @@ -1,71 +0,0 @@ ---- -source: crates/codegen/tests/sonatina_ir.rs -assertion_line: 431 -expression: output -input_file: crates/codegen/tests/fixtures/zero_sized_aggregates.fe ---- -target = "evm-ethereum-osaka" - -type @layout_0 = {}; -type @layout_1 = {@layout_0, i256}; -type @layout_2 = {@layout_0, i256}; - -global private const @layout_1 $const_region_0 = {{}, 1}; -global private const @layout_1 $const_region_1 = {{}, 7}; -global private const @layout_2 $const_region_2 = {{}, 5}; - -func private %empty_field_assign() { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_0; - v3.objref<@layout_1> = obj.alloc @layout_1; - v4.objref = obj.proj v3 1.i256; - obj.store v4 1.i256; - return; -} - -func private %main_root() { - block0: - jump block1; - - block1: - call %empty_field_assign; - evm_stop; -} - -func private %struct_with_empty() -> i256 { - block0: - jump block1; - - block1: - v1.constref<@layout_1> = const.ref $const_region_1; - v2.constref<@layout_1> = const.ref $const_region_1; - return 7.i256; -} - -func private %tuple_only_empty() { - block0: - jump block1; - - block1: - return; -} - -func private %tuple_with_empty() -> i256 { - block0: - jump block1; - - block1: - v1.constref<@layout_2> = const.ref $const_region_2; - v2.constref<@layout_2> = const.ref $const_region_2; - return 5.i256; -} - - -object @main { - section main { - entry %main_root; - } -} diff --git a/crates/codegen/tests/fixtures/storage.fe b/crates/codegen/tests/fixtures/storage.fe deleted file mode 100644 index 358af38349..0000000000 --- a/crates/codegen/tests/fixtures/storage.fe +++ /dev/null @@ -1,167 +0,0 @@ -use std::evm::{Evm, RawMem, RawOps, RawStorage, StorPtr, mem} - -enum User { - Alice, - Bob, -} - -enum TransferResult { - Ok, - Insufficient, -} - -struct CoinStore { - alice: u256, - bob: u256, -} - -struct TotalSupply { - total: u256, -} - -fn transfer_result_code(res: TransferResult) -> u256 { - match res { - TransferResult::Ok => 0 - TransferResult::Insufficient => 1 - } -} - -fn abi_encode(value: u256) -> ! uses (ops: mut RawOps) { - let ptr: u256 = 0 - ops.mstore(addr: ptr, value: value) - ops.return_data(offset: ptr, len: 32) -} - -fn credit(user: User, amount: u256) -> u256 - uses (store: mut CoinStore, supply: mut TotalSupply) -{ - match user { - User::Alice => credit_alice(amount) - User::Bob => credit_bob(amount) - } -} - -fn transfer(from: User, amount: u256) -> TransferResult - uses (store: mut CoinStore) -{ - match from { - User::Alice => transfer_from_alice(amount) - User::Bob => transfer_from_bob(amount) - } -} - -fn balance_of(user: User) -> u256 - uses (store: CoinStore) -{ - match user { - User::Alice => store.alice - User::Bob => store.bob - } -} - -fn balance_of_raw(_ user: u256) -> u256 - uses (store: CoinStore) -{ - match user { - 0 => store.alice - _ => store.bob - } -} - - -fn total_supply() -> u256 - uses (supply: TotalSupply) -{ - supply.total -} - -fn credit_alice(amount: u256) -> u256 - uses (store: mut CoinStore, supply: mut TotalSupply) -{ - store.alice = store.alice + amount - supply.total = supply.total + amount - store.alice -} - -fn credit_bob(amount: u256) -> u256 - uses (store: mut CoinStore, supply: mut TotalSupply) -{ - store.bob = store.bob + amount - supply.total = supply.total + amount - store.bob -} - -fn transfer_from_alice(amount: u256) -> TransferResult - uses (store: mut CoinStore) -{ - if store.alice < amount { - return TransferResult::Insufficient - } - store.alice = store.alice - amount - store.bob = store.bob + amount - TransferResult::Ok -} - -fn transfer_from_bob(amount: u256) -> TransferResult - uses (store: mut CoinStore) -{ - if store.bob < amount { - return TransferResult::Insufficient - } - store.bob = store.bob - amount - store.alice = store.alice + amount - TransferResult::Ok -} - -#[contract_init(Coin)] -fn init() uses (evm: mut Evm) { - let len = evm.code_region_len(runtime) - let offset = evm.code_region_offset(runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(Coin)] -fn runtime() uses (evm: mut Evm) { - let mut store: StorPtr = evm.stor_ptr(0) - let mut supply: StorPtr = evm.stor_ptr(2) - with (store, supply, RawOps = evm) { - let selector = evm.calldataload(0) >> 224 - match selector { - 0xab7ccc1c => { - // credit(uint256,uint256) - let who_raw = evm.calldataload(4) - let amount = evm.calldataload(36) - let new_balance = match who_raw { - 0 => credit_alice(amount) - _ => credit_bob(amount) - } - abi_encode(value: new_balance) - } - 0x6c65aae5 => { - // balance_of(uint256) - let who_raw = evm.calldataload(4) - let value = balance_of_raw(who_raw) - abi_encode(value: value) - } - 0x0cf79e0a => { - // transfer(uint256,uint256) - let who_raw = evm.calldataload(4) - let amount = evm.calldataload(36) - let res = match who_raw { - 0 => transfer_from_alice(amount) - _ => transfer_from_bob(amount) - } - let code = transfer_result_code(res: res) - abi_encode(value: code) - } - 0x3940e9ee => { - // total_supply() - let supply = total_supply() - abi_encode(value: supply) - } - _ => evm.return_data(offset: 0, len: 0) - } - } -} diff --git a/crates/codegen/tests/fixtures/storage_map.fe b/crates/codegen/tests/fixtures/storage_map.fe deleted file mode 100644 index 10ff8061ed..0000000000 --- a/crates/codegen/tests/fixtures/storage_map.fe +++ /dev/null @@ -1,33 +0,0 @@ -use std::evm::StorageMap - -msg Msg { - #[selector = 0] - Get -> u256, -} - -fn get_balance(addr: u256) -> u256 - uses (balances: StorageMap) -{ - balances.get(key: addr) -} - -fn set_balance(addr: u256, value: u256) - uses (balances: mut StorageMap) -{ - balances.set(key: addr, value) -} - -contract C { - mut balances: StorageMap - - recv Msg { - Get -> u256 uses (mut balances) { - with (mut balances) { - set_balance(addr: 1, value: 2) - } - with (balances) { - get_balance(addr: 1) - } - } - } -} diff --git a/crates/codegen/tests/fixtures/storage_map_contract.fe b/crates/codegen/tests/fixtures/storage_map_contract.fe deleted file mode 100644 index 18eb1c1eb5..0000000000 --- a/crates/codegen/tests/fixtures/storage_map_contract.fe +++ /dev/null @@ -1,110 +0,0 @@ -use std::evm::{Evm, RawMem, RawOps, RawStorage, StorageMap, StorPtr, mem} - -fn abi_encode(value: u256) -> ! uses (ops: mut RawOps) { - let ptr: u256 = 0 - ops.mstore(addr: ptr, value: value) - ops.return_data(offset: ptr, len: 32) -} - -// Two separate StorageMaps - balances and allowances -fn get_balance(addr: u256) -> u256 - uses (balances: StorageMap) -{ - balances.get(key: addr) -} - -fn set_balance(addr: u256, value: u256) - uses (balances: mut StorageMap) -{ - balances.set(key: addr, value) -} - -fn get_allowance(addr: u256) -> u256 - uses (allowances: StorageMap) -{ - allowances.get(key: addr) -} - -fn set_allowance(addr: u256, value: u256) - uses (allowances: mut StorageMap) -{ - allowances.set(key: addr, value) -} - -fn transfer(from: u256, to: u256, amount: u256) -> u256 - uses (balances: mut StorageMap) -{ - let from_balance = balances.get(key: from) - if from_balance < amount { - return 1 // insufficient funds - } - let to_balance = balances.get(key: to) - balances.set(key: from, value: from_balance - amount) - balances.set(key: to, value: to_balance + amount) - 0 // success -} - -#[contract_init(BalanceMap)] -fn init() uses (evm: mut Evm) { - let len = evm.code_region_len(runtime) - let offset = evm.code_region_offset(runtime) - let dest = mem::alloc(len) - evm.codecopy(dest: dest, offset: offset, len: len) - evm.return_data(offset: dest, len: len) -} - -#[contract_runtime(BalanceMap)] -fn runtime() uses (evm: mut Evm) { - let selector = evm.calldataload(0) >> 224 - with (RawStorage = evm) { - let mut balances: StorageMap = StorageMap::new() - let mut allowances: StorageMap = StorageMap::new() - with (RawOps = evm) { - match selector { - 0x9cc7f708 => { - // balanceOf(uint256) - let addr = evm.calldataload(4) - let balance = with (balances) { - get_balance(addr: addr) - } - abi_encode(value: balance) - } - 0x4a4b9feb => { - // setBalance(uint256,uint256) - let addr = evm.calldataload(4) - let value = evm.calldataload(36) - with (mut balances) { - set_balance(addr: addr, value: value) - } - abi_encode(value: 0) - } - 0x90dd2627 => { - // transfer(uint256,uint256,uint256) - let from = evm.calldataload(4) - let to = evm.calldataload(36) - let amount = evm.calldataload(68) - let result = with (mut balances) { - transfer(from: from, to: to, amount: amount) - } - abi_encode(value: result) - } - 0xc960174e => { - // getAllowance(uint256) - let addr = evm.calldataload(4) - let allowance = with (allowances) { get_allowance(addr: addr) } - abi_encode(value: allowance) - } - 0x0bca4841 => { - // setAllowance(uint256,uint256) - let addr = evm.calldataload(4) - let value = evm.calldataload(36) - with (mut allowances) { - set_allowance(addr: addr, value: value) - } - abi_encode(value: 0) - } - _ => evm.return_data(offset: 0, len: 0) - } - } - } -} diff --git a/crates/codegen/tests/fixtures/storage_packed_array.fe b/crates/codegen/tests/fixtures/storage_packed_array.fe deleted file mode 100644 index 0c471f38e5..0000000000 --- a/crates/codegen/tests/fixtures/storage_packed_array.fe +++ /dev/null @@ -1,44 +0,0 @@ -use std::evm::StoragePackedArray - -msg Msg { - #[selector = 0] - Get -> u256, -} - -fn get_status(_ id: u256) -> u256 - uses (status: StoragePackedArray<8, 0>) -{ - status.get(id) -} - -fn set_status(id: u256, value: u256) - uses (status: mut StoragePackedArray<8, 0>) -{ - status.set(i: id, value) -} - -fn search_status(needle: u256, start: u256, end: u256) -> u256 - uses (status: StoragePackedArray<8, 0>) -{ - match status.search(needle: needle, start: start, end: end) { - Option::Some(i) => return i - Option::None => return 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - } -} - -contract C { - status: StoragePackedArray<8, 0> - - recv Msg { - Get -> u256 uses (mut status) { - with (mut status) { - set_status(id: 1, value: 2) - set_status(id: 33, value: 5) - } - with (status) { - search_status(needle: 5, start: 0, end: 64) - get_status(1) - } - } - } -} diff --git a/crates/codegen/tests/fixtures/string_literal.fe b/crates/codegen/tests/fixtures/string_literal.fe deleted file mode 100644 index f324eb8c57..0000000000 --- a/crates/codegen/tests/fixtures/string_literal.fe +++ /dev/null @@ -1,3 +0,0 @@ -pub fn string_literal() -> String<5> { - "hello" -} diff --git a/crates/codegen/tests/fixtures/string_literal_large.fe b/crates/codegen/tests/fixtures/string_literal_large.fe deleted file mode 100644 index 11f1d10b76..0000000000 --- a/crates/codegen/tests/fixtures/string_literal_large.fe +++ /dev/null @@ -1,4 +0,0 @@ -// Test: Max inline string literal (31 bytes) should lower as one word. -pub fn large_string() -> String<31> { - "abcdefghijklmnopqrstuvwxyzabcde" -} diff --git a/crates/codegen/tests/fixtures/struct_init.fe b/crates/codegen/tests/fixtures/struct_init.fe deleted file mode 100644 index 0075cbe668..0000000000 --- a/crates/codegen/tests/fixtures/struct_init.fe +++ /dev/null @@ -1,12 +0,0 @@ -struct Dummy { - a: u64, - b: u256, -} - -pub fn make_dummy() -> Dummy { - let dum = Dummy { - a: 42, - b: 99, - } - dum -} diff --git a/crates/codegen/tests/fixtures/test_output/effect_test.fe b/crates/codegen/tests/fixtures/test_output/effect_test.fe deleted file mode 100644 index 0d78bd91ad..0000000000 --- a/crates/codegen/tests/fixtures/test_output/effect_test.fe +++ /dev/null @@ -1,6 +0,0 @@ -use std::evm::RawMem - -#[test] -fn test_effect() uses (mem: mut RawMem) { - mem.mstore(addr: 0x80, value: 1) -} diff --git a/crates/codegen/tests/fixtures/tstor_ptr_contract.fe b/crates/codegen/tests/fixtures/tstor_ptr_contract.fe deleted file mode 100644 index 1dfb8dd445..0000000000 --- a/crates/codegen/tests/fixtures/tstor_ptr_contract.fe +++ /dev/null @@ -1,24 +0,0 @@ -use std::evm::effects::TStorPtr - -msg GuardMsg { - #[selector = 1] - Flip -> bool -} - -pub contract GuardContract { - mut call_count: u256, - mut block_reentrance: TStorPtr, - - init() uses (mut block_reentrance) { - block_reentrance = false - } - - recv GuardMsg { - Flip -> bool uses (mut block_reentrance, mut call_count) { - call_count += 1 - let old = block_reentrance - block_reentrance = !old - old - } - } -} diff --git a/crates/codegen/tests/fixtures/tuple_construction.fe b/crates/codegen/tests/fixtures/tuple_construction.fe deleted file mode 100644 index c4c981ffec..0000000000 --- a/crates/codegen/tests/fixtures/tuple_construction.fe +++ /dev/null @@ -1,9 +0,0 @@ -pub fn make_tuple() -> (u64, u256) { - let t: (u64, u256) = (42, 99) - t -} - -pub fn access_tuple() -> u256 { - let t: (u256, u256, u256) = (1, 2, 3) - t.1 -} diff --git a/crates/codegen/tests/fixtures/tuple_expr.fe b/crates/codegen/tests/fixtures/tuple_expr.fe deleted file mode 100644 index 7ebc9c7ed8..0000000000 --- a/crates/codegen/tests/fixtures/tuple_expr.fe +++ /dev/null @@ -1,3 +0,0 @@ -pub fn tuple_expr() -> (u64, bool) { - (1 + 2, !false) -} diff --git a/crates/codegen/tests/fixtures/tuple_literal_field_access.fe b/crates/codegen/tests/fixtures/tuple_literal_field_access.fe deleted file mode 100644 index 0e36b365f7..0000000000 --- a/crates/codegen/tests/fixtures/tuple_literal_field_access.fe +++ /dev/null @@ -1,22 +0,0 @@ -struct PairWrap { - pair: (u256, u256), -} - -pub fn tuple_literal_field_access() -> u256 { - let a: u256 = 1 - let b: u256 = 2 - (a, b).1 -} - -pub fn tuple_literal_nested_access() -> u256 { - let a: u256 = 1 - let b: u256 = 2 - let c: u256 = 3 - (a, (b, c)).1.0 -} - -pub fn tuple_literal_struct_chain() -> u256 { - let a: u256 = 1 - let b: u256 = 2 - PairWrap { pair: (a, b) }.pair.1 -} diff --git a/crates/codegen/tests/fixtures/tuple_return_contract.fe b/crates/codegen/tests/fixtures/tuple_return_contract.fe deleted file mode 100644 index e92b4ef2d4..0000000000 --- a/crates/codegen/tests/fixtures/tuple_return_contract.fe +++ /dev/null @@ -1,14 +0,0 @@ -use std::evm::Address - -msg TupleMsg { - #[selector = 1] - Pair -> (u256, Address), -} - -pub contract TupleReturnContract { - recv TupleMsg { - Pair -> (u256, Address) { - (42, Address::zero()) - } - } -} diff --git a/crates/codegen/tests/fixtures/tuple_single_element_peeling.fe b/crates/codegen/tests/fixtures/tuple_single_element_peeling.fe deleted file mode 100644 index 5fa0b4e3e6..0000000000 --- a/crates/codegen/tests/fixtures/tuple_single_element_peeling.fe +++ /dev/null @@ -1,36 +0,0 @@ -// Tests transparent peeling for single-element tuples `(T,)`. - -struct WrapU256 { - inner: u256, -} - -pub fn tuple_single_passthrough(x: u256) -> u256 { - let t: (u256,) = (x,) - t.0 -} - -pub fn tuple_single_nested_passthrough(x: u256) -> u256 { - let t: ((u256,),) = ((x,),) - t.0.0 -} - -pub fn tuple_single_struct_newtype_nested(x: u256) -> u256 { - let t: (WrapU256,) = (WrapU256 { inner: x },) - t.0.inner -} - -pub fn match_single_element_tuple(t: (bool,)) -> u8 { - match t { - (true,) => 1, - (false,) => 0, - } -} - -pub fn main() -> (u256, u256, u256, u8) { - ( - tuple_single_passthrough(1), - tuple_single_nested_passthrough(2), - tuple_single_struct_newtype_nested(3), - match_single_element_tuple((true,)), - ) -} diff --git a/crates/codegen/tests/fixtures/unary_expr.fe b/crates/codegen/tests/fixtures/unary_expr.fe deleted file mode 100644 index 6a7bdccbae..0000000000 --- a/crates/codegen/tests/fixtures/unary_expr.fe +++ /dev/null @@ -1,3 +0,0 @@ -pub fn unary_expr() -> i64 { - -(1 + 2) -} diff --git a/crates/codegen/tests/fixtures/unit_method_call.fe b/crates/codegen/tests/fixtures/unit_method_call.fe deleted file mode 100644 index c706c3ced8..0000000000 --- a/crates/codegen/tests/fixtures/unit_method_call.fe +++ /dev/null @@ -1,16 +0,0 @@ -struct Counter { - value: u256, -} - -impl Counter { - fn increment(self) { - } -} - -fn call_unit_method(c: Counter) { - c.increment() -} - -pub fn main() { - call_unit_method(Counter { value: 1 }) -} diff --git a/crates/codegen/tests/fixtures/view_param_aggregate_value.fe b/crates/codegen/tests/fixtures/view_param_aggregate_value.fe deleted file mode 100644 index af1a6eb353..0000000000 --- a/crates/codegen/tests/fixtures/view_param_aggregate_value.fe +++ /dev/null @@ -1,19 +0,0 @@ -struct Pair { - a: u256, - b: u256, -} - -impl Pair { - pub fn sum(self) -> u256 { - self.a + self.b - } -} - -pub fn view_param_aggregate_value(a: u256, b: u256) -> u256 { - let pair = Pair { a: a, b: b } - pair.sum() -} - -pub fn call_view_param_aggregate_value() -> u256 { - view_param_aggregate_value(40, 2) -} diff --git a/crates/codegen/tests/fixtures/while.fe b/crates/codegen/tests/fixtures/while.fe deleted file mode 100644 index 9dd6197e1a..0000000000 --- a/crates/codegen/tests/fixtures/while.fe +++ /dev/null @@ -1,7 +0,0 @@ -pub fn do_while() -> u64 { - let mut i = 0 - while i < 10 { - i = i + 1 - } - i -} diff --git a/crates/codegen/tests/fixtures/while_cond_call.fe b/crates/codegen/tests/fixtures/while_cond_call.fe deleted file mode 100644 index b47b9fb331..0000000000 --- a/crates/codegen/tests/fixtures/while_cond_call.fe +++ /dev/null @@ -1,11 +0,0 @@ -fn lt_ten(_ value: u64) -> bool { - value < 10 -} - -pub fn while_cond_call() -> u64 { - let mut i = 0 - while lt_ten(i) { - i = i + 1 - } - i -} diff --git a/crates/codegen/tests/fixtures/wrapping_saturating.fe b/crates/codegen/tests/fixtures/wrapping_saturating.fe deleted file mode 100644 index fc6112b31c..0000000000 --- a/crates/codegen/tests/fixtures/wrapping_saturating.fe +++ /dev/null @@ -1,32 +0,0 @@ -use core::ops::{WrappingAdd, WrappingSub, WrappingMul} -use core::ops::{SaturatingAdd, SaturatingSub, SaturatingMul} - -pub fn wrapping_ops_u64(a: u64, b: u64) -> (u64, u64, u64) { - (a.wrapping_add(b), a.wrapping_sub(b), a.wrapping_mul(b)) -} - -pub fn saturating_ops_u64(a: u64, b: u64) -> (u64, u64, u64) { - (a.saturating_add(b), a.saturating_sub(b), a.saturating_mul(b)) -} - -pub fn wrapping_ops_u256(a: u256, b: u256) -> (u256, u256, u256) { - (a.wrapping_add(b), a.wrapping_sub(b), a.wrapping_mul(b)) -} - -pub fn saturating_ops_u256(a: u256, b: u256) -> (u256, u256, u256) { - (a.saturating_add(b), a.saturating_sub(b), a.saturating_mul(b)) -} - -pub fn main() -> ( - (u64, u64, u64), - (u64, u64, u64), - (u256, u256, u256), - (u256, u256, u256), -) { - ( - wrapping_ops_u64(1, 2), - saturating_ops_u64(1, 2), - wrapping_ops_u256(1, 2), - saturating_ops_u256(1, 2), - ) -} diff --git a/crates/codegen/tests/fixtures/zero_sized_aggregates.fe b/crates/codegen/tests/fixtures/zero_sized_aggregates.fe deleted file mode 100644 index c787b41377..0000000000 --- a/crates/codegen/tests/fixtures/zero_sized_aggregates.fe +++ /dev/null @@ -1,33 +0,0 @@ -struct Empty { -} - -struct Wrap { - empty: Empty, - value: u256, -} - -pub fn tuple_with_empty() -> u256 { - let e: Empty = Empty {} - let v: u256 = 5 - let t: (Empty, u256) = (e, v) - t.1 -} - -pub fn tuple_only_empty() -> (Empty,) { - let e: Empty = Empty {} - let t: (Empty,) = (e,) - t -} - -pub fn struct_with_empty() -> u256 { - let e: Empty = Empty {} - let v: u256 = 7 - let w: Wrap = Wrap { empty: e, value: v } - w.value -} - -pub fn empty_field_assign() { - let e: Empty = Empty {} - let mut w: Wrap = Wrap { empty: e, value: 1 } - w.empty = Empty {} -} diff --git a/crates/codegen/tests/runtime_handle_preservation.rs b/crates/codegen/tests/runtime_handle_preservation.rs deleted file mode 100644 index 62dc5366fd..0000000000 --- a/crates/codegen/tests/runtime_handle_preservation.rs +++ /dev/null @@ -1,2179 +0,0 @@ -use common::InputDb; -use driver::DriverDataBase; -use fe_codegen::{OptLevel, emit_module_sonatina_ir, emit_runtime_package_sonatina_ir_optimized}; -use hir::hir_def::TopLevelMod; -use mir::runtime::{AddressSpaceKind, RefKind}; -use mir::{ - IntrinsicArithBinOp, Layout, LayoutId, PlaceElem, PlaceRoot, RExpr, RLocalId, RStmt, - RuntimeBody, RuntimeBuiltin, RuntimeCarrier, RuntimeClass, RuntimeInstance, RuntimeLocalRoot, - RuntimePackage, build_runtime_package, build_test_runtime_package, -}; -use url::Url; - -fn sonatina_function_body<'a>(ir: &'a str, name: &str) -> &'a str { - let marker = format!("func private %{name}"); - let start = ir - .find(&marker) - .unwrap_or_else(|| panic!("missing function `{name}` in Sonatina IR:\n{ir}")); - let tail = &ir[start..]; - let end = tail - .find("\n\nfunc ") - .or_else(|| tail.find("\n\nobject ")) - .unwrap_or(tail.len()); - &tail[..end] -} - -fn sonatina_ops(body: &str) -> Vec<&str> { - body.lines() - .filter_map(|line| { - let line = line.trim(); - let rhs = line.split_once(" = ")?.1; - rhs.split_whitespace().next() - }) - .collect() -} - -fn contains_op_subsequence(body: &str, expected: &[&str]) -> bool { - let mut ops = sonatina_ops(body).into_iter(); - expected - .iter() - .all(|expected| ops.any(|op| op == *expected)) -} - -fn with_top_mod_for_source( - name: &str, - source: impl Into, - f: impl for<'db> FnOnce(&'db DriverDataBase, TopLevelMod<'db>) -> T, -) -> T { - let mut db = DriverDataBase::default(); - let file_url = Url::parse(&format!("file:///{name}")).unwrap(); - db.workspace() - .touch(&mut db, file_url.clone(), Some(source.into())); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - f(&db, db.top_mod(file)) -} - -fn sonatina_ir_for_source(name: &str, source: impl Into) -> String { - with_top_mod_for_source(name, source, |db, top_mod| { - emit_module_sonatina_ir(db, top_mod).expect("Sonatina IR") - }) -} - -macro_rules! with_runtime_package { - ($name:expr, $source:expr, |$db:ident, $package:ident| $body:block) => {{ - let mut $db = DriverDataBase::default(); - let file_url = Url::parse(&format!("file:///{}", $name)).unwrap(); - $db.workspace() - .touch(&mut $db, file_url.clone(), Some($source.into())); - let file = $db - .workspace() - .get(&$db, &file_url) - .expect("file should be loaded"); - let top_mod = $db.top_mod(file); - let $package = build_runtime_package(&$db, top_mod).expect("runtime package"); - $body - }}; -} - -macro_rules! with_test_runtime_package { - ($name:expr, $source:expr, |$db:ident, $package:ident| $body:block) => {{ - let mut $db = DriverDataBase::default(); - let file_url = Url::parse(&format!("file:///{}", $name)).unwrap(); - $db.workspace() - .touch(&mut $db, file_url.clone(), Some($source.into())); - let file = $db - .workspace() - .get(&$db, &file_url) - .expect("file should be loaded"); - let top_mod = $db.top_mod(file); - let $package = - build_test_runtime_package(&$db, top_mod, None).expect("runtime test package"); - $body - }}; -} - -fn runtime_body_for_symbol<'db>( - db: &'db DriverDataBase, - package: RuntimePackage<'db>, - symbol: &str, -) -> RuntimeBody<'db> { - let function = package - .functions(db) - .iter() - .copied() - .find(|function| function.symbol(db).contains(symbol)) - .unwrap_or_else(|| panic!("missing runtime function `{symbol}`")); - function.instance(db).body(db) -} - -fn runtime_body_stmts<'a, 'db>(body: &'a RuntimeBody<'db>) -> impl Iterator> { - body.blocks.iter().flat_map(|block| block.stmts.iter()) -} - -fn body_has_object_materialization(body: &RuntimeBody<'_>) -> bool { - runtime_body_stmts(body).any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::AllocObject { .. } - | RExpr::MaterializeToObject { .. } - | RExpr::MaterializePlaceToObject { .. }, - .. - } - ) - }) -} - -fn body_extracts_param_fields(body: &RuntimeBody<'_>, param: RLocalId, fields: &[u32]) -> bool { - fields.iter().all(|field| { - runtime_body_stmts(body).any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::AggregateExtract { value, index }, - .. - } if *value == param && index == field - ) - }) - }) -} - -fn transported_local_from_param(body: &RuntimeBody<'_>, param: RLocalId) -> RLocalId { - runtime_body_stmts(body) - .find_map(|stmt| match stmt { - RStmt::Assign { - dst, - expr: RExpr::AddrOf { place }, - } if matches!( - place.root, - PlaceRoot::Ptr { addr, .. } if addr == param && place.path.is_empty() - ) => - { - Some(*dst) - } - RStmt::Assign { - dst, - expr: RExpr::RetagRef { value }, - } if *value == param => Some(*dst), - RStmt::Assign { - dst, - expr: RExpr::Use(value), - } if *value == param => Some(*dst), - _ => None, - }) - .unwrap_or(param) -} - -fn body_preserves_handle_field(body: &RuntimeBody<'_>, param: RLocalId, field: u16) -> bool { - let transported = transported_local_from_param(body, param); - runtime_body_stmts(body).any(|stmt| match stmt { - RStmt::Assign { - expr: RExpr::AggregateMake { fields, .. }, - .. - } => fields - .get(field as usize) - .is_some_and(|src| *src == transported), - RStmt::Store { dst, src } => { - *src == transported - && matches!(dst.root, PlaceRoot::Ref(_)) - && matches!(dst.path.as_ref(), [PlaceElem::Field(stored)] if stored.0 == field) - } - _ => false, - }) -} - -fn storage_pair_ref_layout<'db>(class: &RuntimeClass<'db>) -> Option> { - match class { - RuntimeClass::Ref { - pointee, - kind: - RefKind::Provider { - space: AddressSpaceKind::Storage, - .. - }, - .. - } => pointee.aggregate_layout(), - RuntimeClass::Scalar(_) - | RuntimeClass::AggregateValue { .. } - | RuntimeClass::RawAddr { .. } - | RuntimeClass::Ref { .. } => None, - } -} - -#[test] -fn transparent_wrapper_returns_preserve_handle_fields_in_rmir() { - let src = format!( - "{}\nfn emit_helpers() -> u256 {{\n let arr: [u256; 8] = [1, 2, 3, 4, 5, 6, 7, 8]\n sum_last4(arr) + sum_first4(arr)\n}}\n", - include_str!("../../fe/tests/fixtures/fe_test/view_param_local_ref_take_reverse.fe"), - ); - with_test_runtime_package!( - "transparent_wrapper_returns_preserve_handle_fields_in_rmir.fe", - src, - |db, package| { - let take_debug = package - .functions(&db) - .iter() - .copied() - .filter(|function| function.symbol(&db).contains("take")) - .map(|function| { - let body = function.instance(&db).body(&db); - format!("{}:\n{body:#?}", function.symbol(&db)) - }) - .collect::>(); - let take_u256 = package - .functions(&db) - .iter() - .copied() - .find(|function| { - if !function.symbol(&db).contains("take") { - return false; - } - let body = function.instance(&db).body(&db); - let [_, param] = body.signature.params.as_slice() else { - return false; - }; - matches!( - param.class, - RuntimeClass::Ref { .. } | RuntimeClass::RawAddr { .. } - ) && body_preserves_handle_field(&body, param.local, 1) - }) - .unwrap_or_else(|| { - panic!( - "generated take helper that preserves the incoming handle field\n\n{}", - take_debug.join("\n\n") - ) - }); - let body = take_u256.instance(&db).body(&db); - let seq_param = body.signature.params[1].local; - - assert!( - !body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| matches!( - stmt, - RStmt::Assign { - expr: RExpr::MaterializeToObject { .. }, - .. - } - )), - "transparent wrapper returns should not materialize handle fields:\n{body:#?}" - ); - assert!( - body_preserves_handle_field(&body, seq_param, 1), - "transparent wrapper returns should carry the incoming borrow transport directly into the wrapper field:\n{body:#?}" - ); - } - ); -} - -#[test] -fn provider_root_trait_receivers_preserve_concrete_runtime_layouts() { - with_runtime_package!( - "provider_root_trait_receivers_preserve_concrete_runtime_layouts.fe", - include_str!("fixtures/by_ref_trait_provider_storage_bug.fe").to_string(), - |db, package| { - let use_ctx = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains("use_ctx")) - .expect("generated use_ctx runtime function"); - let body = use_ctx.instance(&db).body(&db); - let ctx_param = body.signature.params[0].local; - - let layout = storage_pair_ref_layout(&body.signature.params[0].class).unwrap_or_else(|| { - panic!("use_ctx should receive its provider-bound receiver as a storage ref:\n{body:#?}") - }); - let Layout::Struct(layout_data) = layout.data(&db) else { - panic!("storage receiver should use the concrete Pair layout:\n{body:#?}"); - }; - assert_eq!(layout_data.source_ty.pretty_print(&db).to_string(), "Pair"); - - let (callee, arg) = body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .find_map(|stmt| match stmt { - RStmt::Assign { - expr: RExpr::Call { callee, args }, - .. - } => args.first().map(|arg| (*callee, *arg)), - RStmt::Assign { .. } - | RStmt::EnumAssertVariant { .. } - | RStmt::Store { .. } - | RStmt::CopyInto { .. } - | RStmt::EnumSetTag { .. } - | RStmt::EnumWriteVariant { .. } => None, - }) - .unwrap_or_else(|| { - panic!("use_ctx should call the concrete trait receiver:\n{body:#?}") - }); - - let arg_class = body.value_class(arg).unwrap_or_else(|| { - panic!("use_ctx receiver argument should be runtime-visible:\n{body:#?}") - }); - assert_eq!( - storage_pair_ref_layout(arg_class), - Some(layout), - "use_ctx should pass the storage receiver handle directly:\n{body:#?}" - ); - let callee_signature = callee.interface_signature(&db); - assert_eq!( - callee_signature - .params - .first() - .and_then(|param| storage_pair_ref_layout(¶m.class)), - Some(layout), - "callee should receive the same concrete storage receiver layout:\ncallee={callee_signature:#?}\ncaller={body:#?}" - ); - assert!( - !body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::Load { place }, - .. - } if place.path.is_empty() - && (place.root == PlaceRoot::Ref(ctx_param) - || matches!(place.root, PlaceRoot::Provider(_))) - ) - }), - "view receiver should not load the whole provider-bound aggregate before dispatch:\n{body:#?}" - ); - } - ); -} - -#[test] -fn view_receiver_with_storage_aggregate_keeps_receiver_runtime_visible() { - with_runtime_package!( - "view_receiver_with_storage_aggregate_keeps_receiver_runtime_visible.fe", - include_str!("fixtures/by_ref_trait_provider_storage_bug.fe").to_string(), - |db, package| { - let sum = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains("sum")) - .expect("generated Pair::sum runtime function"); - let body = sum.instance(&db).body(&db); - let self_param = body.signature.params.first().unwrap_or_else(|| { - panic!("sum should keep its self view param visible:\n{body:#?}") - }); - let Some(layout) = storage_pair_ref_layout(&self_param.class) else { - panic!("view receiver should use ref-like transport:\n{body:#?}"); - }; - let Layout::Struct(layout_data) = layout.data(&db) else { - panic!("view receiver should point at the stored Pair layout:\n{body:#?}"); - }; - assert_eq!(layout_data.source_ty.pretty_print(&db).to_string(), "Pair"); - assert!( - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .filter(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::Load { place }, - .. - } if place.root == PlaceRoot::Ref(self_param.local) - && matches!(place.path.as_ref(), [PlaceElem::Field(_)]) - ) - }) - .count() - >= 2, - "view receiver should project and load Pair fields through the incoming storage ref:\n{body:#?}" - ); - assert!( - !body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::Load { place }, - .. - } if place.root == PlaceRoot::Ref(self_param.local) && place.path.is_empty() - ) - }), - "view receiver should not load the whole aggregate before field projection:\n{body:#?}" - ); - } - ); -} - -#[test] -fn effect_handle_from_raw_helpers_preserve_transport_in_rmir() { - with_runtime_package!( - "effect_handle_from_raw_helpers_preserve_transport_in_rmir.fe", - include_str!("fixtures/effect_handle_field_deref.fe").to_string(), - |db, package| { - let from_raw_helpers = package - .functions(&db) - .iter() - .copied() - .filter(|function| function.symbol(&db).contains("from_raw")) - .collect::>(); - assert!( - !from_raw_helpers.is_empty(), - "expected generated from_raw helpers in runtime package" - ); - - for function in from_raw_helpers { - let body = function.instance(&db).body(&db); - assert!( - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::ProviderFromRaw { .. }, - .. - } - ) - }), - "from_raw helper should rebuild the handle from the raw word:\n{body:#?}" - ); - assert!( - !body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::AddrOf { .. } | RExpr::MaterializeToObject { .. }, - .. - } | RStmt::CopyInto { .. } - ) - }), - "from_raw helper should not materialize or take the address of the raw slot:\n{body:#?}" - ); - } - } - ); -} - -#[test] -fn mem_ptr_from_raw_helpers_use_raw_addr_transport_in_rmir() { - with_runtime_package!( - "mem_ptr_from_raw_helpers_use_raw_addr_transport_in_rmir.fe", - include_str!("fixtures/raw_log_emit.fe").to_string(), - |db, package| { - let from_raw_helpers = package - .functions(&db) - .iter() - .copied() - .filter(|function| function.symbol(&db).contains("from_raw")) - .collect::>(); - assert!( - !from_raw_helpers.is_empty(), - "expected generated MemPtr::from_raw helper in runtime package" - ); - - for function in from_raw_helpers { - let body = function.instance(&db).body(&db); - assert!( - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::WordToRawAddr { - space: AddressSpaceKind::Memory, - .. - }, - .. - } - ) - }), - "MemPtr::from_raw should keep memory handles as raw-address transport:\n{body:#?}" - ); - assert!( - !body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::ProviderFromRaw { - space: AddressSpaceKind::Memory, - .. - }, - .. - } - ) - }), - "MemPtr::from_raw must not reconstruct memory provider refs:\n{body:#?}" - ); - } - } - ); -} - -#[test] -fn object_backed_nested_const_handle_fields_load_carriers_before_const_projection() { - let output = sonatina_ir_for_source( - "object_backed_nested_const_handle_fields_load_carriers_before_const_projection.fe", - r#"struct Data { - x: u256, -} - -struct View { - d: ref Data, -} - -fn read(v: own View) -> u256 { - v.d.x -} - -pub fn entry() -> u256 { - let data = Data { x: 1 } - let view = View { d: ref data } - read(view) -} -"#, - ); - let read = sonatina_function_body(&output, "read"); - - assert!( - contains_op_subsequence(read, &["obj.proj", "obj.load", "const.proj", "const.load"]), - "object-backed aggregates may store nested const refs, but field access must load the handle carrier before projecting through the const ref:\n{read}" - ); -} - -#[test] -fn storage_backed_nested_handle_fields_follow_carriers_before_projecting_children() { - let output = sonatina_ir_for_source( - "storage_backed_nested_handle_fields_follow_carriers_before_projecting_children.fe", - include_str!("fixtures/effect_handle_field_deref.fe").to_string(), - ); - let bump = sonatina_function_body(&output, "bump"); - - assert!( - contains_op_subsequence(bump, &["obj.proj", "obj.load", "evm_sload"]), - "nested storage-backed handle field access should load/follow the carrier before loading children:\n{bump}" - ); -} - -#[test] -fn storage_backed_nested_handle_field_borrows_use_storage_transport() { - with_runtime_package!( - "storage_backed_nested_handle_field_borrows_use_storage_transport.fe", - include_str!("fixtures/effect_handle_field_deref.fe").to_string(), - |db, package| { - let bump = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains("bump")) - .expect("generated bump runtime function"); - let body = bump.instance(&db).body(&db); - - let nested_field_borrow = body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .find_map(|stmt| match stmt { - RStmt::Assign { - dst, - expr: RExpr::AddrOf { place }, - } if matches!(place.root, PlaceRoot::Ref(_)) - && matches!(place.path.as_ref(), [PlaceElem::Field(field0), PlaceElem::Deref, PlaceElem::Field(field1)] if field0.0 == 0 && field1.0 == 0) => - { - Some(*dst) - } - RStmt::Assign { .. } - | RStmt::EnumAssertVariant { .. } - | RStmt::Store { .. } - | RStmt::CopyInto { .. } - | RStmt::EnumSetTag { .. } - | RStmt::EnumWriteVariant { .. } => None, - }) - .unwrap_or_else(|| { - panic!("expected nested field borrow in bump runtime body:\n{body:#?}") - }); - - let Some(RuntimeClass::Ref { pointee, kind, .. }) = - body.value_class(nested_field_borrow) - else { - panic!( - "nested storage-backed field borrow should lower as a typed ref:\n{body:#?}" - ); - }; - assert!( - matches!(**pointee, RuntimeClass::Scalar(_)), - "nested storage-backed field borrow should point at the scalar field:\n{body:#?}" - ); - assert!( - matches!( - kind, - RefKind::Provider { - space: mir::AddressSpaceKind::Storage, - .. - } - ), - "nested storage-backed field borrow should use storage transport, not object/memory transport:\n{body:#?}" - ); - } - ); -} - -#[test] -fn projected_enum_field_snapshots_preserve_full_enum_payloads() { - let output = sonatina_ir_for_source( - "projected_enum_field_snapshots_preserve_full_enum_payloads.fe", - r#"enum Flag { - A(u256), - B(u256), -} - -impl Copy for Flag {} - -struct Inner { - flag: Flag, -} - -struct Wrapper { - inner: Inner, -} - -fn repack(wrapper: Wrapper) -> Inner { - let flag = wrapper.inner.flag - let copy = flag - Inner { flag: copy } -} - -fn entry() -> Inner { - repack(Wrapper { - inner: Inner { flag: Flag::A(42) }, - }) -} -"#, - ); - let repack = sonatina_function_body(&output, "repack"); - - let repacks_full_payload = - contains_op_subsequence(repack, &["extract_value", "extract_value", "insert_value"]) - || (repack.contains("obj.load") && repack.contains("obj.store")); - assert!( - repacks_full_payload, - "repack should preserve the full enum payload while rebuilding the wrapper:\n{repack}" - ); - assert!( - !sonatina_ops(repack) - .into_iter() - .any(|op| op == "enum_tag" || op == "enum_tag_of"), - "projected enum field payload should stay a full enum value, not an enum tag:\n{repack}" - ); -} - -#[test] -fn read_only_scalar_params_used_as_indices_stay_unrooted() { - let source = r#" -const VALS: [u256; 3] = [10, 20, 30] - -fn sum_two(i: usize, j: usize) -> u256 { - VALS[i] + VALS[j] -} - -fn entry() -> u256 { - sum_two(i: 0, j: 1) -} -"#; - - with_runtime_package!( - "read_only_scalar_params_used_as_indices_stay_unrooted.fe", - source, - |db, package| { - let body = runtime_body_for_symbol(&db, package, "sum_two"); - - assert!( - matches!(body.locals[0].root, RuntimeLocalRoot::None), - "read-only scalar index param `i` should not get a runtime root:\n{body:#?}" - ); - assert!( - matches!(body.locals[1].root, RuntimeLocalRoot::None), - "read-only scalar index param `j` should not get a runtime root:\n{body:#?}" - ); - } - ); - - let ir = sonatina_ir_for_source( - "read_only_scalar_params_used_as_indices_stay_unrooted.fe", - source, - ); - let sum_two = sonatina_function_body(&ir, "sum_two"); - - assert!( - !sum_two.contains("alloca i256"), - "read-only scalar index params should not allocate stack slots:\n{sum_two}" - ); - assert!( - !sum_two.contains("mload"), - "read-only scalar index params should be used directly, not reloaded:\n{sum_two}" - ); -} - -#[test] -fn mutated_scalar_locals_stay_rooted() { - with_runtime_package!( - "mutated_scalar_locals_stay_rooted.fe", - r#" -fn bump(size: u256) -> u256 { - let mut value: u256 = size - value += 1 - value -} - -fn entry() -> u256 { - bump(size: 1) -} -"#, - |db, package| { - let body = runtime_body_for_symbol(&db, package, "bump"); - - assert!( - matches!(body.locals[0].root, RuntimeLocalRoot::None), - "read-only scalar param should not get a runtime root:\n{body:#?}" - ); - let rooted_scalar = body - .locals - .iter() - .enumerate() - .find_map(|(idx, local)| { - matches!(local.root, RuntimeLocalRoot::Slot(RuntimeClass::Scalar(_))) - .then(|| RLocalId::from_u32(idx as u32)) - }) - .unwrap_or_else(|| { - panic!("mutated scalar local should keep runtime storage:\n{body:#?}") - }); - let rooted_ptr = runtime_body_stmts(&body) - .find_map(|stmt| match stmt { - RStmt::Assign { - dst, - expr: RExpr::AddrOf { place }, - } if place.root == PlaceRoot::Slot(rooted_scalar) => Some(*dst), - _ => None, - }) - .unwrap_or_else(|| { - panic!("mutated scalar local should take the address of its rooted slot:\n{body:#?}") - }); - let stored_ptr = transported_local_from_param(&body, rooted_ptr); - assert!( - runtime_body_stmts(&body).any(|stmt| { - matches!( - stmt, - RStmt::Store { dst, .. } - if matches!(dst.root, PlaceRoot::Ptr { addr, .. } if addr == stored_ptr) - ) - }), - "mutated scalar local should store through the rooted slot pointer:\n{body:#?}" - ); - } - ); -} - -#[test] -fn immutable_own_aggregate_param_field_reads_stay_unrooted() { - with_runtime_package!( - "immutable_own_aggregate_param_field_reads_stay_unrooted.fe", - r#"struct Pair { - left: u256, - right: u256, -} - -fn sum_pair(_ pair: own Pair) -> u256 { - pair.left + pair.right -} - -fn entry() -> u256 { - sum_pair(Pair { left: 1, right: 2 }) -} -"#, - |db, package| { - let body = runtime_body_for_symbol(&db, package, "sum_pair"); - let pair = RLocalId::from_u32(0); - - assert!( - matches!( - body.signature.params[0].class, - RuntimeClass::AggregateValue { .. } - ), - "owned aggregate param should be passed as an aggregate value:\n{body:#?}" - ); - assert!( - matches!(body.locals[0].root, RuntimeLocalRoot::None), - "field-read-only owned aggregate param should not get a runtime root:\n{body:#?}" - ); - assert!( - body_extracts_param_fields(&body, pair, &[0, 1]), - "field reads should extract directly from the aggregate param:\n{body:#?}" - ); - assert!( - !body_has_object_materialization(&body), - "field-read-only owned aggregate param should not materialize to an object:\n{body:#?}" - ); - } - ); -} - -#[test] -fn read_only_mut_own_aggregate_receiver_field_reads_stay_unrooted() { - with_runtime_package!( - "read_only_mut_own_aggregate_receiver_field_reads_stay_unrooted.fe", - r#"struct Pair { - left: u256, - right: u256, -} - -impl Pair { - fn sum(mut own self) -> u256 { - self.left + self.right - } -} - -fn entry() -> u256 { - Pair { left: 1, right: 2 }.sum() -} -"#, - |db, package| { - let body = runtime_body_for_symbol(&db, package, "sum"); - let receiver = RLocalId::from_u32(0); - - assert!( - matches!( - body.signature.params[0].class, - RuntimeClass::AggregateValue { .. } - ), - "mut own receiver should still be passed as an aggregate value:\n{body:#?}" - ); - assert!( - matches!(body.locals[0].root, RuntimeLocalRoot::None), - "read-only mut own aggregate receiver should not get a runtime root:\n{body:#?}" - ); - assert!( - body_extracts_param_fields(&body, receiver, &[0, 1]), - "receiver field reads should extract directly from the aggregate param:\n{body:#?}" - ); - assert!( - !body_has_object_materialization(&body), - "read-only mut own aggregate receiver should not materialize to an object:\n{body:#?}" - ); - } - ); -} - -#[test] -fn immutable_own_tuple_destructuring_field_reads_stay_unrooted() { - with_runtime_package!( - "immutable_own_tuple_destructuring_field_reads_stay_unrooted.fe", - r#"struct Pair { - left: u256, - right: u256, -} - -fn sum_tuple(_ items: own (Pair, Pair)) -> u256 { - let (first, second) = items - first.left + second.right -} - -fn entry() -> u256 { - sum_tuple((Pair { left: 1, right: 2 }, Pair { left: 3, right: 4 })) -} -"#, - |db, package| { - let body = runtime_body_for_symbol(&db, package, "sum_tuple"); - let items = RLocalId::from_u32(0); - - assert!( - matches!( - body.signature.params[0].class, - RuntimeClass::AggregateValue { .. } - ), - "owned tuple param should be passed as an aggregate value:\n{body:#?}" - ); - assert!( - matches!(body.locals[0].root, RuntimeLocalRoot::None), - "field-read-only owned tuple param should not get a runtime root:\n{body:#?}" - ); - assert!( - body_extracts_param_fields(&body, items, &[0, 1]), - "tuple destructuring should extract directly from the aggregate param:\n{body:#?}" - ); - assert!( - !body_has_object_materialization(&body), - "tuple destructuring field reads should not materialize to an object:\n{body:#?}" - ); - } - ); -} - -#[test] -fn immutable_own_tuple_destructuring_call_args_stay_unrooted() { - with_runtime_package!( - "immutable_own_tuple_destructuring_call_args_stay_unrooted.fe", - r#"struct Pair { - left: u256, - right: u256, -} - -fn consume(_ pair: own Pair) -> u256 { - pair.left + pair.right -} - -fn sum_tuple(_ items: own (Pair, Pair)) -> u256 { - let (first, second) = items - consume(first) + consume(second) -} - -fn entry() -> u256 { - sum_tuple((Pair { left: 1, right: 2 }, Pair { left: 3, right: 4 })) -} -"#, - |db, package| { - let body = runtime_body_for_symbol(&db, package, "sum_tuple"); - let items = RLocalId::from_u32(0); - - assert!( - matches!( - body.signature.params[0].class, - RuntimeClass::AggregateValue { .. } - ), - "owned tuple param should be passed as an aggregate value:\n{body:#?}" - ); - assert!( - matches!(body.locals[0].root, RuntimeLocalRoot::None), - "owned tuple param should not get a runtime root for call-only destructured fields:\n{body:#?}" - ); - assert!( - body_extracts_param_fields(&body, items, &[0, 1]), - "tuple destructuring call args should extract directly from the aggregate param:\n{body:#?}" - ); - assert!( - !body_has_object_materialization(&body), - "tuple destructuring call args should not materialize to an object:\n{body:#?}" - ); - } - ); -} - -#[test] -fn mutating_mut_own_aggregate_receiver_stays_rooted() { - with_runtime_package!( - "mutating_mut_own_aggregate_receiver_stays_rooted.fe", - r#"struct Pair { - left: u256, - right: u256, -} - -impl Pair { - fn bump(mut own self) -> Pair { - self.left += 1 - self - } -} - -fn entry() -> Pair { - Pair { left: 1, right: 2 }.bump() -} -"#, - |db, package| { - let body = runtime_body_for_symbol(&db, package, "bump"); - let receiver = RLocalId::from_u32(0); - - assert!( - matches!(body.locals[0].root, RuntimeLocalRoot::Slot(_)), - "mutated mut own aggregate receiver should keep object-backed runtime storage:\n{body:#?}" - ); - assert!( - runtime_body_stmts(&body).any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::AddrOf { place }, - .. - } if place.root == PlaceRoot::Slot(receiver) - && matches!(place.path.as_ref(), [PlaceElem::Field(_)]) - ) - }), - "field mutation should take the address of the rooted receiver field:\n{body:#?}" - ); - assert!( - runtime_body_stmts(&body).any(|stmt| { - matches!( - stmt, - RStmt::Store { dst, .. } if matches!(dst.root, PlaceRoot::Ref(_)) - ) - }), - "field mutation should store through the rooted receiver field ref:\n{body:#?}" - ); - } - ); -} - -#[test] -fn owned_aggregate_values_with_place_style_reads_get_object_backed_runtime_storage() { - with_runtime_package!( - "owned_aggregate_values_with_place_style_reads_get_object_backed_runtime_storage.fe", - r#"struct Table { - used: [u8; 4], -} - -impl Table { - fn get(self, _ slot: usize) -> u8 { - let used = self.used - used[slot] - } -} - -fn entry() -> u8 { - Table { used: [1, 2, 3, 4] }.get(2) -} -"#, - |db, package| { - let get = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains("get")) - .expect("generated get runtime function"); - let body = get.instance(&db).body(&db); - let used_local = body - .locals - .iter() - .enumerate() - .find_map(|(idx, local)| { - (idx >= body.signature.params.len() - && local.semantic_ty.pretty_print(&db) == "[u8; 4]" - && matches!( - local.carrier, - mir::RuntimeCarrier::Value(RuntimeClass::Ref { - kind: RefKind::Object, - .. - }) - )) - .then_some(RLocalId::from_u32(idx as u32)) - }) - .unwrap_or_else(|| { - panic!( - "owned aggregate local with later place-style reads should be object-backed:\n{body:#?}" - ) - }); - - assert!( - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::MaterializePlaceToObject { .. } - | RExpr::MaterializeToObject { .. }, - .. - } - ) - }), - "owned aggregate local should materialize through object-backed lowering:\n{body:#?}" - ); - assert!( - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::Load { place }, - .. - } if place.root == PlaceRoot::Ref(used_local) - && matches!(place.path.as_ref(), [PlaceElem::Index(_)]) - ) - }), - "later projections should read from the owned aggregate local itself:\n{body:#?}" - ); - } - ); -} - -#[test] -fn derived_place_bound_field_aliases_do_not_write_back_to_receiver() { - with_runtime_package!( - "derived_place_bound_field_aliases_do_not_write_back_to_receiver.fe", - r#"pub struct Pair { - pub a: u256, - pub b: u256, -} - -impl Copy for Pair {} - -impl Pair { - pub fn check(self, _ x: u256) -> bool { - x == self.a - } -} - -pub fn entry() -> bool { - Pair { a: 1, b: 2 }.check(1) -} -"#, - |db, package| { - let check = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains("check")) - .expect("generated check runtime function"); - let body = check.instance(&db).body(&db); - let receiver = RLocalId::from_u32(0); - - assert!( - !body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| matches!( - stmt, - RStmt::Store { dst, .. } | RStmt::CopyInto { dst, .. } - if dst.root == PlaceRoot::Slot(receiver) - )), - "field reads through a derived place-bound alias should not write back to the receiver:\n{body:#?}" - ); - assert!( - body.locals - .iter() - .skip(body.signature.params.len()) - .any(|local| { - local.semantic_ty.pretty_print(&db) == "u256" - && matches!(local.carrier, RuntimeCarrier::Erased) - && matches!(local.root, RuntimeLocalRoot::None) - }), - "derived place-bound scalar alias should stay carrierless/rootless:\n{body:#?}" - ); - } - ); -} - -#[test] -fn linear_probe_big_struct_keeps_array_projection_reads_place_based() { - let mut db = DriverDataBase::default(); - let file_url = - Url::parse("file:///linear_probe_big_struct_keeps_array_projection_reads_place_based.fe") - .unwrap(); - db.workspace().touch( - &mut db, - file_url.clone(), - Some( - format!( - "{}\nfn entry() -> u256 {{\n let mut table = Table::empty()\n table.set(17, 99)\n table.get(17)\n}}\n", - include_str!("../../fe/tests/fixtures/fe_test/linear_probe_big_struct.fe") - ), - ), - ); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - let ir = emit_module_sonatina_ir(&db, top_mod) - .expect("linear_probe_big_struct should lower through Sonatina"); - let get_header = sonatina_function_body(&ir, "get") - .lines() - .next() - .expect("get function should have a signature line"); - assert!( - !get_header.contains("v0.@layout"), - "view aggregate receiver should not lower to a Sonatina value aggregate param:\n{get_header}" - ); - let package = build_runtime_package(&db, top_mod).expect("runtime package"); - let mut get_instance = None; - - for (name, expected_fields) in [("set", [true, true, false]), ("get", [true, true, true])] { - let function = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains(name)) - .unwrap_or_else(|| panic!("missing `{name}` runtime function")); - let body = function.instance(&db).body(&db); - if name == "get" { - get_instance = Some(function.instance(&db)); - assert!( - matches!( - body.signature.params[0].class, - RuntimeClass::Ref { .. } | RuntimeClass::RawAddr { .. } - ), - "view aggregate receiver should use ref-like runtime transport:\n{body:#?}" - ); - } - let self_local = body.signature.params[0].local; - let mut saw_indexed_reads = [false; 3]; - for stmt in body.blocks.iter().flat_map(|block| block.stmts.iter()) { - let RStmt::Assign { - expr: RExpr::Load { place }, - .. - } = stmt - else { - continue; - }; - if place.root != PlaceRoot::Ref(self_local) && place.root != PlaceRoot::Slot(self_local) - { - continue; - } - match place.path.as_ref() { - [PlaceElem::Field(field)] if field.0 < 3 => { - panic!( - "{name} should not load whole array field {} before indexing:\n{body:#?}", - field.0 - ); - } - [PlaceElem::Field(field), PlaceElem::Index(_)] if field.0 < 3 => { - saw_indexed_reads[field.0 as usize] = true; - } - _ => {} - } - } - for (idx, expected) in expected_fields.into_iter().enumerate() { - assert_eq!( - saw_indexed_reads[idx], - expected, - "{name} should {}read field {} through a composite place:\n{body:#?}", - if expected { "" } else { "not " }, - idx - ); - } - } - let get_instance = get_instance.expect("get runtime instance"); - let entry = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains("entry")) - .expect("entry runtime function"); - let entry_body = entry.instance(&db).body(&db); - let mut saw_get_call = false; - for stmt in entry_body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - { - let RStmt::Assign { - expr: RExpr::Call { callee, args }, - .. - } = stmt - else { - continue; - }; - if *callee != get_instance { - continue; - } - saw_get_call = true; - assert!( - !matches!( - entry_body.value_class(args[0]), - Some(RuntimeClass::AggregateValue { .. }) - ), - "caller should not materialize a whole aggregate before calling get:\n{entry_body:#?}" - ); - } - assert!( - saw_get_call, - "entry should contain a direct call to get:\n{entry_body:#?}" - ); -} - -#[test] -fn materialized_scalar_uses_do_not_keep_rawaddr_runtime_carriers() { - with_runtime_package!( - "materialized_scalar_uses_do_not_keep_rawaddr_runtime_carriers.fe", - r#"fn bump(_ x: mut u8) -> u8 { - x += 1 - x -} - -fn entry() -> u8 { - let mut x: u8 = 2 - bump(mut x) -} -"#, - |db, package| { - let bump = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains("bump")) - .expect("generated bump runtime function"); - let body = bump.instance(&db).body(&db); - let param_count = body.signature.params.len(); - let rawaddr_temps = body - .locals - .iter() - .enumerate() - .skip(param_count) - .filter_map(|(idx, local)| { - matches!( - local.carrier, - mir::RuntimeCarrier::Value(RuntimeClass::RawAddr { target: None, .. }) - ) - .then_some(RLocalId::from_u32(idx as u32)) - }) - .collect::>(); - - assert!( - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::Load { .. }, - .. - } - ) - }), - "materializing a mutable scalar use should load from its place root:\n{body:#?}" - ); - assert!( - rawaddr_temps.iter().all(|temp| { - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: - RExpr::Load { - place: - mir::RuntimePlace { - root: - PlaceRoot::Ptr { - addr, - class: RuntimeClass::Scalar(_), - .. - }, - .. - }, - }, - .. - } if addr == temp - ) - }) - }), - "raw-address scalar temps must be materialized through scalar loads before use:\n{body:#?}" - ); - } - ); -} - -#[test] -fn checked_extern_intrinsics_do_not_become_runtime_functions() { - with_runtime_package!( - "checked_extern_intrinsics_do_not_become_runtime_functions.fe", - r#" -fn add(a: u256, b: u256) -> u256 { - a + b -} - -fn neg(x: i256) -> i256 { - -x -} - -fn entry_add() -> u256 { - add(1, 2) -} - -fn entry_neg() -> i256 { - neg(-3) -} -"#, - |db, package| { - assert!( - package - .functions(&db) - .iter() - .all(|function| !function.symbol(&db).contains("__checked_")), - "checked extern intrinsics should lower directly through rMIR expressions, not as runtime functions:\n{:#?}", - package.functions(&db) - ); - } - ); -} - -#[test] -fn whole_handle_loads_materialize_values_before_rebinding_object_locals() { - with_runtime_package!( - "whole_handle_loads_materialize_values_before_rebinding_object_locals.fe", - include_str!("../../fe/tests/fixtures/fe_test/poseidon_mock.fe").to_string(), - |db, package| { - for function in package.functions(&db) { - let body = function.instance(&db).body(&db); - assert!( - !body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - dst, - expr: - RExpr::Load { - place: - mir::RuntimePlace { - root: PlaceRoot::Ref(_), - path, - }, - }, - } if path.is_empty() - && matches!( - body.locals[dst.as_u32() as usize].carrier, - mir::RuntimeCarrier::Value(mir::RuntimeClass::Ref { .. }) - ) - ) - }), - "whole-handle loads must materialize aggregate values before rebinding handle locals:\n{body:#?}" - ); - } - } - ); -} - -#[test] -fn by_value_enum_constants_do_not_become_const_regions() { - with_runtime_package!( - "by_value_enum_constants_do_not_become_const_regions.fe", - r#"enum E { A, B } - -fn select(flag: bool) -> E { - if flag { - E::A - } else { - E::B - } -} - -fn entry() -> u8 { - match select(true) { - E::A => 1, - E::B => 0, - } -}"#, - |db, package| { - let const_handle_bodies = package - .functions(&db) - .iter() - .filter_map(|function| { - let body = function.instance(&db).body(&db); - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::ConstRef { .. }, - .. - } - ) - }) - .then(|| format!("{}:\n{body:#?}", function.symbol(&db))) - }) - .collect::>(); - - assert!( - package.const_regions(&db).is_empty(), - "by-value enum constants should not create package const regions:\nregions={:#?}\n{}", - package.const_regions(&db), - const_handle_bodies.join("\n\n") - ); - assert!( - const_handle_bodies.is_empty(), - "by-value enum constants should lower inline, not through ConstRef:\n{}", - const_handle_bodies.join("\n\n") - ); - assert!( - package.functions(&db).iter().any(|function| { - let body = function.instance(&db).body(&db); - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::EnumMake { .. }, - .. - } - ) - }) - }), - "enum constants should lower through EnumMake in value position", - ); - } - ); -} - -#[test] -fn const_backed_array_args_lower_as_const_refs_in_sonatina() { - let cases = [ - ( - "const_backed_local_borrows_lower_as_const_refs_in_sonatina.fe", - r#" -const C: [u256; 4] = [11, 22, 33, 44] - -fn pick(values: ref [u256; 4], idx: usize) -> u256 { - values[idx] -} - -pub fn entry() -> u256 { - let values: [u256; 4] = C - let idx: usize = 2 - pick(values: ref values, idx) -} -"#, - "borrowed const-backed array", - ), - ( - "const_backed_view_params_lower_as_const_refs_in_sonatina.fe", - r#" -const C: [u256; 4] = [11, 22, 33, 44] - -fn pick(values: [u256; 4], idx: usize) -> u256 { - values[idx] -} - -pub fn entry() -> u256 { - let values: [u256; 4] = C - let idx: usize = 2 - pick(values, idx) -} -"#, - "view array parameter", - ), - ]; - - for (name, source, label) in cases { - let ir = sonatina_ir_for_source(name, source); - let pick = sonatina_function_body(&ir, "pick"); - - assert!( - pick.contains("constref<[i256; 4]>"), - "{label} should be passed as a const ref:\n{ir}" - ); - assert!( - pick.contains("const.index") && pick.contains("const.load"), - "{label} should load through const data projections:\n{pick}" - ); - assert!( - !ir.contains("obj.init.const"), - "{label} should not materialize the full array:\n{ir}" - ); - } -} - -#[test] -fn mutable_with_provider_reuses_materialized_root_for_later_readonly_effects() { - with_test_runtime_package!( - "mutable_with_provider_reuses_materialized_root_for_later_readonly_effects.fe", - include_str!("../../fe/tests/fixtures/fe_test/with_block_custom_effect.fe").to_string(), - |db, package| { - let incs = package - .functions(&db) - .iter() - .copied() - .filter(|function| function.symbol(&db).contains("inc")) - .map(|function| function.instance(&db)) - .collect::>(); - let reads = package - .functions(&db) - .iter() - .copied() - .filter(|function| function.symbol(&db).contains("read")) - .map(|function| function.instance(&db)) - .collect::>(); - assert!(!incs.is_empty(), "missing inc runtime function"); - assert!(!reads.is_empty(), "missing read runtime function"); - let test = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db) == "test_with_block_custom_effect") - .expect("test_with_block_custom_effect runtime function"); - let body = test.instance(&db).body(&db); - let call_arg = |callees: &[RuntimeInstance<'_>]| { - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .find_map(|stmt| match stmt { - RStmt::Assign { - expr: RExpr::Call { callee, args }, - .. - } if callees.contains(callee) => Some(args[0]), - _ => None, - }) - .unwrap_or_else(|| panic!("missing call in test body:\n{body:#?}")) - }; - let provider_root = |arg| { - if let Some(root) = body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .find_map(|stmt| match stmt { - RStmt::Assign { - dst, - expr: RExpr::AddrOf { place }, - } if *dst == arg && place.path.is_empty() => match place.root { - PlaceRoot::Ref(root) => Some(root), - PlaceRoot::Slot(_) | PlaceRoot::Ptr { .. } | PlaceRoot::Provider(_) => { - None - } - }, - _ => None, - }) - { - return root; - } - if matches!( - body.value_class(arg), - Some(RuntimeClass::Ref { - kind: RefKind::Object, - .. - }) - ) { - return arg; - } - panic!("call arg should carry or address the provider root:\n{body:#?}") - }; - - let inc_root = provider_root(call_arg(&incs)); - let read_arg = call_arg(&reads); - let read_root = provider_root(read_arg); - - assert_eq!( - inc_root, read_root, - "mutable and readonly uses of the same with-provider should share one root:\n{body:#?}" - ); - assert!( - matches!( - body.value_class(inc_root), - Some(RuntimeClass::Ref { - kind: RefKind::Object, - .. - }) - ), - "shared mutable with-provider root should be object-backed:\n{body:#?}" - ); - assert!( - matches!( - body.value_class(read_arg), - Some(RuntimeClass::Ref { - kind: RefKind::Object, - .. - }) - ), - "later readonly effect should read from the object-backed provider root, not the original const ref:\n{body:#?}" - ); - } - ); -} - -#[test] -fn readonly_with_provider_can_remain_const_backed() { - with_test_runtime_package!( - "readonly_with_provider_can_remain_const_backed.fe", - r#"pub struct Counter { - pub value: u256, -} - -fn read() -> u256 uses (counter: Counter) { - counter.value -} - -#[test] -fn test_readonly_with_provider() { - let out: u256 = with (Counter = Counter { value: 7 }) { - read() + read() - } - - assert!(out == 14) -}"#, - |db, package| { - let read = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db) == "read") - .expect("read runtime function") - .instance(&db); - let test = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db) == "test_readonly_with_provider") - .expect("test runtime function"); - let body = test.instance(&db).body(&db); - let read_args = body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .filter_map(|stmt| match stmt { - RStmt::Assign { - expr: RExpr::Call { callee, args }, - .. - } if *callee == read => Some(args[0]), - _ => None, - }) - .collect::>(); - - assert_eq!( - read_args.len(), - 2, - "readonly with-provider test should call read twice:\n{body:#?}" - ); - assert!( - read_args.iter().all(|arg| matches!( - body.value_class(*arg), - Some(RuntimeClass::Ref { - kind: RefKind::Const, - .. - }) - )), - "readonly-only with-provider should stay const-backed:\n{body:#?}" - ); - assert!( - !body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| matches!( - stmt, - RStmt::Assign { - expr: RExpr::MaterializeToObject { .. } | RExpr::AllocObject { .. }, - .. - } - )), - "readonly-only with-provider should not materialize the aggregate provider root:\n{body:#?}" - ); - } - ); -} - -#[test] -fn borrow_typed_aggregate_literals_lower_without_const_shape_mismatch() { - with_runtime_package!( - "borrow_typed_aggregate_literals_lower_without_const_shape_mismatch.fe", - r#"fn first(xs: ref [u256; 2]) -> u256 { - xs[0] -} - -fn entry() -> u256 { - first([10, 20]) -}"#, - |db, package| { - let debug = package - .functions(&db) - .iter() - .map(|function| { - let body = function.instance(&db).body(&db); - format!("{}:\n{body:#?}", function.symbol(&db)) - }) - .collect::>(); - - assert!( - package.functions(&db).iter().any(|function| { - let body = function.instance(&db).body(&db); - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::MaterializeToObject { .. } - | RExpr::AllocObject { .. }, - .. - } - ) - }) - }), - "borrow-typed aggregate literals should materialize through normal object/value lowering:\n{}", - debug.join("\n\n") - ); - } - ); -} - -#[test] -fn sonatina_enum_tag_matches_preserve_typed_tag_values() { - let _ = sonatina_ir_for_source( - "sonatina_enum_tag_matches_preserve_typed_tag_values.fe", - r#"enum Maybe { - None, - Some(u256), -} - -pub fn code(x: Maybe) -> u256 { - match x { - Maybe::None => 0, - Maybe::Some(v) => v, - } -} - -pub fn main() -> u256 { - code(Maybe::Some(1)) -}"#, - ); -} - -#[test] -fn object_backed_scalar_field_borrows_lower_as_typed_refs() { - with_runtime_package!( - "object_backed_scalar_field_borrows_lower_as_typed_refs.fe", - include_str!("fixtures/effect_handle_field_deref.fe").to_string(), - |db, package| { - let mut saw_scalar_ref_borrow = false; - for function in package.functions(&db) { - let body = function.instance(&db).body(&db); - for stmt in body.blocks.iter().flat_map(|block| block.stmts.iter()) { - let RStmt::Assign { - dst, - expr: RExpr::AddrOf { place }, - } = stmt - else { - continue; - }; - if !matches!(place.root, PlaceRoot::Ref(_)) { - continue; - } - let Some(RuntimeClass::Ref { pointee, kind, .. }) = body.value_class(*dst) - else { - continue; - }; - if !matches!(**pointee, RuntimeClass::Scalar(_)) { - continue; - } - assert!( - matches!( - kind, - RefKind::Object | RefKind::Provider { .. } | RefKind::Const - ), - "scalar field borrow should lower as a typed ref, not a raw address:\n{body:#?}" - ); - saw_scalar_ref_borrow = true; - } - } - - assert!( - saw_scalar_ref_borrow, - "expected at least one object-backed scalar field borrow to lower as RuntimeClass::Ref" - ); - } - ); -} - -#[test] -fn checked_overflow_exprs_survive_into_rmir() { - with_runtime_package!( - "debug_checked_add_unused_local_rmir.fe", - r#" -fn test_add_overflow_u8() { - let x: u8 = 255 - let y: u8 = x + 1 -} -"#, - |db, package| { - let func = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains("test_add_overflow_u8")) - .expect("generated runtime function"); - let body = func.instance(&db).body(&db); - assert!( - body.blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::Call { .. } - | RExpr::Builtin(RuntimeBuiltin::IntrinsicArith { - op: IntrinsicArithBinOp::Add, - checked: true, - .. - }), - .. - } - ) - }), - "checked overflow expression should survive semantic const canonicalization and lower to executable rMIR arithmetic:\n{body:#?}" - ); - } - ); -} - -#[test] -fn unit_branch_mutations_do_not_use_erased_call_results() { - with_runtime_package!( - "unit_branch_mutations_do_not_use_erased_call_results.fe", - r#" -#[test] -fn unit_branch_add_assign() { - let mut x: usize = 0 - if true { - x += 1 - } else { - x += 1 - } -} -"#, - |db, package| { - for function in package.functions(&db) { - let body = function.instance(&db).body(&db); - assert!( - !body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .any(|stmt| { - matches!( - stmt, - RStmt::Assign { - expr: RExpr::Use(value), - .. - } if body.value_class(*value).is_none() - ) - }), - "unit-valued mutation branches should not try to use erased call results:\n{}:\n{body:#?}", - function.symbol(&db), - ); - } - } - ); -} - -#[test] -fn by_value_array_returns_keep_visible_aggregate_signatures() { - with_runtime_package!( - "by_value_array_returns_keep_visible_aggregate_signatures.fe", - r#" -fn return_array_after_projection(xs: [u8; 4]) -> [u8; 4] { - let ys = xs - let _ = ys[2] - ys -} - -fn use_returned_array() -> u8 { - let mut xs: [u8; 4] = [1, 2, 3, 4] - xs = return_array_after_projection(xs) - xs[0] -} -"#, - |db, package| { - let callee = package - .functions(&db) - .iter() - .copied() - .find(|function| { - function - .symbol(&db) - .contains("return_array_after_projection") - }) - .expect("return_array_after_projection runtime function"); - let body = callee.instance(&db).body(&db); - - assert!( - matches!( - body.signature.ret, - Some(RuntimeClass::AggregateValue { .. }) - ), - "by-value aggregate helper should keep a visible aggregate return signature:\n{body:#?}" - ); - assert!( - body.locals - .iter() - .skip(body.signature.params.len()) - .any(|local| matches!( - &local.carrier, - mir::RuntimeCarrier::Value(RuntimeClass::Ref { - kind: RefKind::Object, - pointee, - .. - }) if matches!(pointee.as_ref(), RuntimeClass::AggregateValue { layout } if matches!(layout.data(&db), Layout::Array(_))) - )), - "helper should still be free to use internal object-backed storage for projectable owned aggregates:\n{body:#?}" - ); - } - ); -} - -#[test] -fn callers_of_by_value_array_returns_do_not_receive_object_ref_results() { - with_runtime_package!( - "callers_of_by_value_array_returns_do_not_receive_object_ref_results.fe", - r#" -fn return_array_after_projection(xs: [u8; 4]) -> [u8; 4] { - let ys = xs - let _ = ys[2] - ys -} - -fn use_returned_array() -> u8 { - let mut xs: [u8; 4] = [1, 2, 3, 4] - xs = return_array_after_projection(xs) - xs[0] -} -"#, - |db, package| { - let callee = package - .functions(&db) - .iter() - .copied() - .find(|function| { - function - .symbol(&db) - .contains("return_array_after_projection") - }) - .expect("return_array_after_projection runtime function") - .instance(&db); - let caller = package - .functions(&db) - .iter() - .copied() - .find(|function| function.symbol(&db).contains("use_returned_array")) - .expect("use_returned_array runtime function"); - let body = caller.instance(&db).body(&db); - - let call_results = body - .blocks - .iter() - .flat_map(|block| block.stmts.iter()) - .filter_map(|stmt| match stmt { - RStmt::Assign { - dst, - expr: RExpr::Call { callee: target, .. }, - } if *target == callee => Some(*dst), - _ => None, - }) - .collect::>(); - - assert!( - !call_results.is_empty(), - "caller should contain a direct call to the array-return helper:\n{body:#?}" - ); - assert!( - call_results.iter().all(|result| matches!( - body.value_class(*result), - Some(RuntimeClass::AggregateValue { .. }) - )), - "by-value aggregate call results should stay visible aggregate values in callers, not object refs:\n{body:#?}" - ); - } - ); -} - -#[test] -fn by_value_array_return_materialization_structurally_copies_into_object_storage() { - with_runtime_package!( - "by_value_array_return_materialization_structurally_copies_into_object_storage.fe", - r#" -fn return_array_after_projection(xs: [u256; 3]) -> [u256; 3] { - let ys = xs - let _ = ys[2] - ys -} - -fn use_returned_array() -> u256 { - let mut xs: [u256; 3] = [1, 2, 3] - xs = return_array_after_projection(xs) - xs[0] -} -"#, - |db, package| { - let output = emit_runtime_package_sonatina_ir_optimized( - &db, - &package, - fe_codegen::EVM_LAYOUT, - OptLevel::O0, - ) - .expect("Sonatina IR"); - let body = sonatina_function_body(&output, "use_returned_array"); - - assert!( - body.contains("extract_value"), - "by-value aggregate materialization should structurally extract fields instead of whole-object obj.store:\n{body}" - ); - assert!( - body.contains("obj.load"), - "object-backed aggregate copies should load leaf values from the source object before storing them:\n{body}" - ); - } - ); -} - -#[test] -fn fieldless_enum_fields_copy_into_object_storage_via_enum_ops() { - with_test_runtime_package!( - "fieldless_enum_fields_copy_into_object_storage_via_enum_ops.fe", - r#" -enum E { - A, - B, -} - -struct Pair { - xs: [u256; 3], - e: E, -} - -fn build(flag: bool) -> Pair { - let xs: [u256; 3] = [1, 2, 3] - let e = if flag { E::A } else { E::B } - Pair { xs, e } -} - -#[test] -fn exercise() { - let pair = build(true) - assert(pair.xs[0] == 1) -} -"#, - |db, package| { - let output = emit_runtime_package_sonatina_ir_optimized( - &db, - &package, - fe_codegen::EVM_LAYOUT, - OptLevel::O0, - ) - .expect("Sonatina IR"); - assert!( - output.contains("enum.set_tag"), - "fieldless enum object copies should set the destination enum tag explicitly:\n{output}" - ); - } - ); -} diff --git a/crates/codegen/tests/sonatina_gasprice.rs b/crates/codegen/tests/sonatina_gasprice.rs deleted file mode 100644 index ab16f554b4..0000000000 --- a/crates/codegen/tests/sonatina_gasprice.rs +++ /dev/null @@ -1,63 +0,0 @@ -use common::{InputDb, ingot::IngotBaseUrl, stdlib::BUILTIN_STD_BASE_URL}; -use driver::DriverDataBase; -use fe_codegen::emit_module_sonatina_ir; -use url::Url; - -#[test] -fn sonatina_lower_runtime_supports_gasprice() { - let mut db = DriverDataBase::default(); - - // `std::evm::ops::gasprice` exists but is not exported publicly. For this test, expose a - // small wrapper in the in-memory builtin stdlib so we can exercise the lowering path. - let std_base = Url::parse(BUILTIN_STD_BASE_URL).expect("builtin std base url should parse"); - std_base.touch( - &mut db, - "src/evm/gasprice_test.fe".into(), - Some( - r#" -use ingot::evm::ops - -pub fn gasprice() -> u256 { - ops::gasprice() -} -"# - .to_string(), - ), - ); - - let evm_url = std_base - .join("src/evm.fe") - .expect("builtin std evm module url should join"); - let evm_file = db - .workspace() - .get(&db, &evm_url) - .expect("builtin std evm module should exist"); - let mut evm_text = evm_file.text(&db).to_string(); - if !evm_text.contains("gasprice_test") { - evm_text.push_str("\npub use gasprice_test::{self, *}\n"); - db.workspace().update(&mut db, evm_url, evm_text); - } - - let module = r#" -use std::evm::gasprice - -pub fn main() -> u256 { - gasprice() -} -"#; - - let file_url = Url::parse("file:///sonatina_gasprice.fe").expect("test URL should parse"); - db.workspace() - .touch(&mut db, file_url.clone(), Some(module.to_string())); - let file = db - .workspace() - .get(&db, &file_url) - .expect("test file should be loaded"); - let top_mod = db.top_mod(file); - - let ir = emit_module_sonatina_ir(&db, top_mod).expect("Sonatina IR should emit"); - assert!( - ir.contains("evm_gas_price"), - "expected Sonatina IR to contain evm_gas_price instruction:\n{ir}" - ); -} diff --git a/crates/codegen/tests/sonatina_ir.rs b/crates/codegen/tests/sonatina_ir.rs deleted file mode 100644 index a89ae17277..0000000000 --- a/crates/codegen/tests/sonatina_ir.rs +++ /dev/null @@ -1,463 +0,0 @@ -//! Snapshot tests for Sonatina IR output. -//! -//! These tests compile Fe fixtures to Sonatina IR and snapshot the human-readable -//! IR text. This helps catch IR lowering bugs and makes it easy to review what -//! IR is generated for each fixture. -//! -//! Snapshots are stored in `fixtures/sonatina_ir/`. - -use common::InputDb; -use dir_test::{Fixture, dir_test}; -use driver::DriverDataBase; -use fe_codegen::emit_module_sonatina_ir; -use std::{collections::HashSet, path::Path}; -use test_utils::_macro_support::_insta::{self, Settings}; -use tracing::{info, warn}; -use url::Url; - -fn with_top_mod_for_source( - name: &str, - source: &str, - f: impl for<'db> FnOnce(&'db DriverDataBase, hir::hir_def::TopLevelMod<'db>) -> T, -) -> T { - let mut db = DriverDataBase::default(); - let file_url = Url::parse(&format!("file:///{name}")).expect("test URL should parse"); - db.workspace() - .touch(&mut db, file_url.clone(), Some(source.to_string())); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - f(&db, top_mod) -} - -fn sonatina_function_names(ir: &str) -> Vec { - ir.lines() - .filter_map(|line| { - let rest = line.trim_start().strip_prefix("func ")?; - let (_, rest) = rest.split_once('%')?; - let end = rest.find('(')?; - Some(rest[..end].to_string()) - }) - .collect() -} - -#[test] -fn zero_sized_const_aggregates_do_not_emit_const_regions() { - let ir = with_top_mod_for_source( - "zero_sized_const_aggregates_do_not_emit_const_regions.fe", - r#" -struct Empty { -} - -pub fn new_empty() -> Empty { - Empty {} -} -"#, - |db, top_mod| emit_module_sonatina_ir(db, top_mod).expect("Sonatina IR should emit"), - ); - - assert!( - !ir.contains("global private const"), - "zero-sized const aggregate should not emit a const global:\n{ir}" - ); - assert!( - !ir.contains("const.ref"), - "zero-sized const aggregate should not emit a const ref:\n{ir}" - ); - assert!( - !ir.contains("data $const_region"), - "zero-sized const aggregate should not emit section data:\n{ir}" - ); -} - -#[test] -fn assert_macro_message_lowers_to_direct_revert_payload() { - let ir = with_top_mod_for_source( - "assert_macro_message_lowers_to_direct_revert_payload.fe", - r#" -pub fn main() { - assert!(false, "boom") -} -"#, - |db, top_mod| emit_module_sonatina_ir(db, top_mod).expect("Sonatina IR should emit"), - ); - - assert!( - ir.contains("evm_revert") && ir.contains("100.i256"), - "`assert!` with a message should lower to direct Solidity Error(string) revert data:\n{ir}" - ); -} - -#[test] -fn sonatina_function_names_disambiguate_module_conflicts() { - let ir = with_top_mod_for_source( - "sonatina_function_names_disambiguate_module_conflicts.fe", - r#" -pub mod left { - pub fn same() -> u8 { - 1 - } -} - -pub mod right { - pub fn same() -> u8 { - 2 - } -} - -pub fn main() -> u8 { - left::same() + right::same() -} -"#, - |db, top_mod| emit_module_sonatina_ir(db, top_mod).expect("Sonatina IR should emit"), - ); - - let names = sonatina_function_names(&ir); - let unique_names = names.iter().collect::>(); - assert_eq!( - names.len(), - unique_names.len(), - "Sonatina function names must be unique across source modules:\n{ir}" - ); - assert!( - names - .iter() - .filter(|name| name.ends_with("__same") || name.contains("__same_")) - .all(|name| name.contains("__left__same") || name.contains("__right__same")), - "colliding module functions should include their module paths:\n{ir}" - ); -} - -#[test] -fn sonatina_function_names_disambiguate_generic_specializations() { - let ir = with_top_mod_for_source( - "sonatina_function_names_disambiguate_generic_specializations.fe", - r#" -fn identity(_ value: own T) -> T { - value -} - -fn bool_score(value: bool) -> u32 { - if value { - 1 - } else { - 0 - } -} - -pub fn main() -> u32 { - identity(7) + bool_score(identity(true)) -} -"#, - |db, top_mod| emit_module_sonatina_ir(db, top_mod).expect("Sonatina IR should emit"), - ); - - let names = sonatina_function_names(&ir); - let unique_names = names.iter().collect::>(); - assert_eq!( - names.len(), - unique_names.len(), - "Sonatina function names must be unique across generic specializations:\n{ir}" - ); - assert!( - names - .iter() - .filter(|name| name.starts_with("identity")) - .all(|name| name.starts_with("identity__g")), - "colliding generic specializations should include generic identity components:\n{ir}" - ); -} - -#[test] -fn wildcard_storage_map_root_reports_runtime_root_error() { - let err = with_top_mod_for_source( - "wildcard_storage_map_root_reports_runtime_root_error.fe", - r#" -use std::evm::StorageMap - -pub fn main() -> u256 - uses (balances: mut StorageMap) -{ - balances.get(key: 1) -} -"#, - |db, top_mod| { - emit_module_sonatina_ir(db, top_mod) - .expect_err("wildcard StorageMap roots should be rejected") - }, - ); - let message = err.to_string(); - assert!( - message.contains("standalone runtime root") - && message.contains("inferred layout const") - && message.contains("no caller to supply a concrete provider") - && message.contains("with (...)"), - "unexpected error message:\n{message}" - ); -} - -#[test] -fn explicit_storage_map_root_reports_ordinary_uses_error() { - let err = with_top_mod_for_source( - "explicit_storage_map_root_reports_ordinary_uses_error.fe", - r#" -use std::evm::StorageMap - -pub fn main() -> u256 - uses (balances: mut StorageMap) -{ - balances.get(key: 1) -} -"#, - |db, top_mod| { - emit_module_sonatina_ir(db, top_mod) - .expect_err("ordinary root StorageMap effects should be rejected") - }, - ); - let message = err.to_string(); - assert!( - message.contains("standalone root `main`") - && message.contains("ordinary uses parameter") - && message.contains("no caller to supply ordinary effect parameters") - && message.contains("with (...)"), - "unexpected error message:\n{message}" - ); -} - -#[test] -fn wildcard_storage_map_free_function_compiles_with_concrete_provider() { - let output = with_top_mod_for_source( - "wildcard_storage_map_free_function_compiles_with_concrete_provider.fe", - r#" -use std::evm::StorageMap - -fn get_balance(addr: u256) -> u256 - uses (balances: StorageMap) -{ - balances.get(key: addr) -} - -msg M { - #[selector = 0] - Get -> u256, -} - -contract C { - balances: StorageMap - - recv M { - Get -> u256 uses (balances) { - with (balances) { - get_balance(addr: 1) - } - } - } -} -"#, - |db, top_mod| { - emit_module_sonatina_ir(db, top_mod) - .expect("wildcard StorageMap helpers should compile from a concrete provider") - }, - ); - assert!( - output.contains("func private %get_balance") && output.contains("object @C"), - "concrete-provider StorageMap helper should emit real Sonatina IR:\n{output}" - ); -} - -#[test] -fn generic_noesc_storage_specialization_is_rejected_during_runtime_lowering() { - let err = with_top_mod_for_source( - "generic_noesc_storage_specialization_is_rejected_during_runtime_lowering.fe", - r#" -struct Box { - value: T, -} - -fn store_generic(value: own T) uses (slot: mut Box) { - slot = Box { value } -} - -pub contract GenericNoEsc { - mut slot: Box - - init() uses (mut slot) { - let mut x: u256 = 0 - store_generic(mut x) - } -} -"#, - |db, top_mod| { - emit_module_sonatina_ir(db, top_mod) - .expect_err("runtime lowering should reject specialized noesc storage escape") - }, - ); - let message = err.to_string(); - assert!( - message.contains("semantic noesc checking failed") - && message.contains("noesc violation in `fn store_generic`"), - "unexpected error message:\n{message}" - ); -} - -#[test] -fn sonatina_ir_rejects_target_only_output() { - let err = with_top_mod_for_source( - "sonatina_ir_rejects_target_only_output.fe", - r#" -fn helper(value: u256) -> u256 { - value -} -"#, - |db, top_mod| { - emit_module_sonatina_ir(db, top_mod).expect_err("empty packages should not emit IR") - }, - ); - let message = err.to_string(); - assert!( - message.contains("no root objects") && message.contains("target-only Sonatina IR"), - "unexpected error message:\n{message}" - ); -} - -#[test] -fn raw_log_emit_sonatina_ir_lowers_mem_ptr_from_raw() { - let output = with_top_mod_for_source( - "raw_log_emit_sonatina_ir_lowers_mem_ptr_from_raw.fe", - include_str!("fixtures/raw_log_emit.fe"), - |db, top_mod| { - emit_module_sonatina_ir(db, top_mod) - .expect("MemPtr::from_raw should lower for Sonatina") - }, - ); - - assert!( - output.contains("func private %raw_emit") && output.contains("object @main"), - "raw_log_emit should emit real Sonatina IR, not target-only output:\n{output}" - ); -} - -#[test] -fn constant_oob_index_terminates_without_continuation_projection() { - let output = with_top_mod_for_source( - "constant_oob_index_terminates_without_continuation_projection.fe", - r#" -fn main() -> u256 { - let arr: [u256; 2] = [10, 20] - return arr[2] -} -"#, - |db, top_mod| { - emit_module_sonatina_ir(db, top_mod) - .expect("constant out-of-bounds array access should lower to a revert") - }, - ); - - assert!( - output.contains("evm_revert 0.i256 0.i256"), - "constant out-of-bounds array access should lower to a revert:\n{output}" - ); - assert!( - !output.contains("br 1.i1"), - "constant out-of-bounds array access should not emit a conditional true branch plus continuation:\n{output}" - ); - assert!( - !output.contains("obj_index") && !output.contains("const_index"), - "constant out-of-bounds array access should not continue into index projection IR:\n{output}" - ); -} - -#[test] -fn semantic_never_returning_recv_returns_emit_sonatina_ir() { - let output = with_top_mod_for_source( - "semantic_never_returning_recv_returns_emit_sonatina_ir.fe", - r#" -use core::abi::Bytes - -msg Msg { - #[selector = 0x01] - GetBytes -> Bytes, - #[selector = 0x02] - GetScalar -> u256, -} - -fn abort() -> ! { - core::panic() -} - -pub contract C { - recv Msg { - GetBytes -> Bytes { - abort() - } - - GetScalar -> u256 { - abort() - } - } -} -"#, - |db, top_mod| { - emit_module_sonatina_ir(db, top_mod) - .expect("semantic never-returning recv arms should emit Sonatina IR") - }, - ); - - assert!( - output.contains("object @C") && output.contains("evm_invalid"), - "never-returning recv arms should lower to real terminating IR:\n{output}" - ); -} - -// NOTE: `dir_test` discovers fixtures at compile time; new fixture files will be picked up on a -// clean build (e.g. CI) or whenever this test target is recompiled. -// -// Sonatina IR tests only run on fixtures that the backend currently supports. Unsupported -// fixtures will produce LowerError::Unsupported, which we skip gracefully. -#[dir_test( - dir: "$CARGO_MANIFEST_DIR/tests/fixtures", - glob: "*.fe" -)] -fn sonatina_ir_snap(fixture: Fixture<&str>) { - let _logging = test_utils::setup_test_tracing(); - let mut db = DriverDataBase::default(); - let file_url = Url::from_file_path(fixture.path()).expect("fixture path should be absolute"); - db.workspace().touch( - &mut db, - file_url.clone(), - Some(fixture.content().to_string()), - ); - let file = db - .workspace() - .get(&db, &file_url) - .expect("file should be loaded"); - let top_mod = db.top_mod(file); - - let output = match emit_module_sonatina_ir(&db, top_mod) { - Ok(ir) => ir, - Err(fe_codegen::LowerError::Unsupported(msg)) => { - info!("SKIP {}: unsupported ({msg})", fixture.path()); - return; - } - Err(fe_codegen::LowerError::Internal(msg)) => { - warn!("SKIP {}: internal error ({msg})", fixture.path()); - return; - } - Err(err) => panic!("Sonatina IR lowering failed: {err}"), - }; - - // Store snapshots in the sonatina_ir/ subdirectory. - let fixture_path = Path::new(fixture.path()); - let fixture_name = fixture_path.file_stem().unwrap().to_str().unwrap(); - let snapshot_dir = fixture_path.parent().unwrap().join("sonatina_ir"); - - let mut settings = Settings::new(); - settings.set_snapshot_path(snapshot_dir); - settings.set_input_file(fixture.path()); - settings.set_prepend_module_to_snapshot(false); - settings.bind(|| { - _insta::assert_snapshot!(fixture_name, output); - }); -} diff --git a/crates/codegen/tests/sonatina_operand_collect.rs b/crates/codegen/tests/sonatina_operand_collect.rs deleted file mode 100644 index dd7119f4b0..0000000000 --- a/crates/codegen/tests/sonatina_operand_collect.rs +++ /dev/null @@ -1,45 +0,0 @@ -use sonatina_ir::{ - I256, Signature, ValueId, - builder::ModuleBuilder, - func_cursor::InstInserter, - inst::{Inst, evm::EvmCreate2}, - isa::Isa, - isa::evm::Evm, -}; -use sonatina_triple::{Architecture, EvmVersion, OperatingSystem, TargetTriple, Vendor}; - -#[test] -fn evm_create2_collects_all_operands() { - let triple = TargetTriple::new( - Architecture::Evm, - Vendor::Ethereum, - OperatingSystem::Evm(EvmVersion::Osaka), - ); - let isa = sonatina_ir::isa::evm::Evm::new(triple); - let is = isa.inst_set(); - - let inst = EvmCreate2::new(is, ValueId(1), ValueId(2), ValueId(3), ValueId(4)); - assert_eq!(inst.collect_values().len(), 4); -} - -#[test] -fn make_imm_value_is_interned() { - let triple = TargetTriple::new( - Architecture::Evm, - Vendor::Ethereum, - OperatingSystem::Evm(EvmVersion::Osaka), - ); - let isa = Evm::new(triple); - let ctx = sonatina_ir::module::ModuleCtx::new(&isa); - let builder = ModuleBuilder::new(ctx); - - let sig = Signature::new("f", sonatina_ir::Linkage::Public, &[], &[]); - let func_ref = builder.declare_function(sig).unwrap(); - let mut fb = builder.func_builder::(func_ref); - let entry = fb.append_block(); - fb.switch_to_block(entry); - - let a = fb.make_imm_value(I256::zero()); - let b = fb.make_imm_value(I256::zero()); - assert_eq!(a, b, "expected identical immediates to be interned"); -} diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml deleted file mode 100644 index dec813f978..0000000000 --- a/crates/common/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "fe-common" -version = "26.2.0" -edition.workspace = true -license = "Apache-2.0" -repository = "https://github.com/argotorg/fe" -description = "Provides HIR definition and lowering for Fe lang." - -[lib] -doctest = false - -[dependencies] -camino.workspace = true -paste.workspace = true -salsa.workspace = true -serde-semver.workspace = true -smol_str.workspace = true -rust-embed = "8.5.0" -toml = "0.8.8" -tracing.workspace = true -petgraph.workspace = true - -parser.workspace = true -url.workspace = true -typed-path.workspace = true -ordermap = "0.5.5" -rustc-hash.workspace = true -radix_immutable = "0.1" diff --git a/crates/common/src/cache.rs b/crates/common/src/cache.rs deleted file mode 100644 index 910e034114..0000000000 --- a/crates/common/src/cache.rs +++ /dev/null @@ -1,65 +0,0 @@ -use camino::Utf8PathBuf; -use std::{env, path::PathBuf}; - -fn utf8_path_from_os(value: std::ffi::OsString) -> Option { - Utf8PathBuf::from_path_buf(PathBuf::from(value)).ok() -} - -fn env_path(var: &str) -> Option { - env::var_os(var).and_then(utf8_path_from_os) -} - -fn join_components(mut base: Utf8PathBuf, components: &[&str]) -> Utf8PathBuf { - for component in components { - base.push(component); - } - base -} - -fn xdg_cache_dir() -> Option { - env_path("XDG_CACHE_HOME").map(|path| join_components(path, &["fe", "git"])) -} - -fn unix_home_cache() -> Option { - #[cfg(unix)] - { - env_path("HOME").map(|path| join_components(path, &[".cache", "fe", "git"])) - } - #[cfg(not(unix))] - { - None - } -} - -fn windows_local_appdata() -> Option { - #[cfg(windows)] - { - env_path("LOCALAPPDATA") - .or_else(|| env_path("USERPROFILE")) - .map(|path| join_components(path, &["Fe", "cache", "git"])) - } - #[cfg(not(windows))] - { - None - } -} - -pub fn remote_git_cache_dir() -> Option { - env_path("FE_REMOTE_CACHE_DIR") - .or_else(|| { - env_path("FE_CACHE_DIR").map(|path| { - if path.ends_with("git") { - path - } else { - join_components(path, &["git"]) - } - }) - }) - .or_else(xdg_cache_dir) - .or_else(unix_home_cache) - .or_else(windows_local_appdata) - .or_else(|| { - utf8_path_from_os(env::temp_dir().into()) - .map(|path| join_components(path, &["fe", "git"])) - }) -} diff --git a/crates/common/src/color.rs b/crates/common/src/color.rs deleted file mode 100644 index d6af87ddb2..0000000000 --- a/crates/common/src/color.rs +++ /dev/null @@ -1,73 +0,0 @@ -use std::{ - env, - io::{self, IsTerminal}, - sync::atomic::{AtomicU8, Ordering}, -}; - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum ColorPreference { - Auto, - Always, - Never, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum ColorTarget { - Stdout, - Stderr, -} - -// 0 = auto, 1 = always, 2 = never -static COLOR_PREFERENCE: AtomicU8 = AtomicU8::new(0); - -pub fn set_color_preference(preference: ColorPreference) { - let value = match preference { - ColorPreference::Auto => 0, - ColorPreference::Always => 1, - ColorPreference::Never => 2, - }; - COLOR_PREFERENCE.store(value, Ordering::Relaxed); -} - -pub fn color_preference() -> ColorPreference { - match COLOR_PREFERENCE.load(Ordering::Relaxed) { - 1 => ColorPreference::Always, - 2 => ColorPreference::Never, - _ => ColorPreference::Auto, - } -} - -pub fn should_colorize(target: ColorTarget) -> bool { - match color_preference() { - ColorPreference::Always => true, - ColorPreference::Never => false, - ColorPreference::Auto => should_colorize_auto(target), - } -} - -fn normalize_env(value: Result) -> Option { - match value { - Ok(string) => Some(string != "0"), - Err(_) => None, - } -} - -fn should_colorize_auto(target: ColorTarget) -> bool { - if normalize_env(env::var("CLICOLOR_FORCE")) == Some(true) { - return true; - } - - if normalize_env(env::var("NO_COLOR")).is_some() { - return false; - } - - let clicolor = normalize_env(env::var("CLICOLOR")).unwrap_or(true); - if !clicolor { - return false; - } - - match target { - ColorTarget::Stdout => io::stdout().is_terminal(), - ColorTarget::Stderr => io::stderr().is_terminal(), - } -} diff --git a/crates/common/src/compilation.rs b/crates/common/src/compilation.rs deleted file mode 100644 index d180c5c9a7..0000000000 --- a/crates/common/src/compilation.rs +++ /dev/null @@ -1,16 +0,0 @@ -use smol_str::SmolStr; - -use crate::InputDb; - -#[salsa::input] -#[derive(Debug)] -pub struct CompilationSettings { - pub profile: SmolStr, -} - -#[salsa::tracked] -impl CompilationSettings { - pub fn default(db: &dyn InputDb) -> Self { - Self::new(db, SmolStr::new("dev")) - } -} diff --git a/crates/common/src/config/dependency.rs b/crates/common/src/config/dependency.rs deleted file mode 100644 index 16f43c9be3..0000000000 --- a/crates/common/src/config/dependency.rs +++ /dev/null @@ -1,238 +0,0 @@ -use camino::Utf8PathBuf; -use smol_str::SmolStr; -use toml::Value; -use typed_path::{Utf8UnixPath, Utf8WindowsPath}; -use url::Url; - -use crate::dependencies::RemoteFiles; - -use super::{ConfigDiagnostic, is_valid_name}; - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct DependencyEntry { - pub alias: SmolStr, - pub location: DependencyEntryLocation, - pub arguments: crate::dependencies::DependencyArguments, -} - -impl DependencyEntry { - pub fn new( - alias: SmolStr, - location: DependencyEntryLocation, - arguments: crate::dependencies::DependencyArguments, - ) -> Self { - Self { - alias, - location, - arguments, - } - } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum DependencyEntryLocation { - RelativePath(Utf8PathBuf), - Remote(RemoteFiles), - WorkspaceCurrent, -} - -pub fn parse_root_dependencies( - parsed: &Value, - diagnostics: &mut Vec, -) -> Vec { - parsed - .get("dependencies") - .and_then(|value| value.as_table()) - .map(|table| parse_dependencies_table(table, "dependencies", diagnostics)) - .unwrap_or_default() -} - -pub fn parse_dependencies_table( - table: &toml::map::Map, - field_prefix: &str, - diagnostics: &mut Vec, -) -> Vec { - let mut dependencies = Vec::new(); - for (alias, value) in table { - if !is_valid_name(alias) { - diagnostics.push(ConfigDiagnostic::InvalidDependencyAlias(alias.into())); - } - - let alias = SmolStr::new(alias); - match value { - Value::String(path) => { - if let Ok(version) = path.parse() { - let arguments = crate::dependencies::DependencyArguments { - name: Some(alias.clone()), - version: Some(version), - }; - dependencies.push(DependencyEntry::new( - alias.clone(), - DependencyEntryLocation::WorkspaceCurrent, - arguments, - )); - } else if let Some(path) = parse_dependency_path(&alias, path, diagnostics) { - dependencies.push(DependencyEntry::new( - alias.clone(), - DependencyEntryLocation::RelativePath(path), - crate::dependencies::DependencyArguments::default(), - )); - } - } - Value::Boolean(true) => { - let arguments = crate::dependencies::DependencyArguments { - name: Some(alias.clone()), - ..Default::default() - }; - dependencies.push(DependencyEntry::new( - alias.clone(), - DependencyEntryLocation::WorkspaceCurrent, - arguments, - )); - } - Value::Table(table) => { - let mut arguments = crate::dependencies::DependencyArguments::default(); - let mut has_name_field = false; - let mut has_name = false; - if let Some(name) = table.get("name") { - has_name_field = true; - if let Some(name) = name.as_str() { - if is_valid_name(name) { - arguments.name = Some(SmolStr::new(name)); - has_name = true; - } else { - diagnostics.push(ConfigDiagnostic::InvalidDependencyName(name.into())); - } - } else { - diagnostics.push(ConfigDiagnostic::InvalidDependencyName( - name.to_string().into(), - )); - } - } - if let Some(version) = table.get("version").and_then(|value| value.as_str()) { - if let Ok(version) = version.parse() { - arguments.version = Some(version); - } else { - diagnostics - .push(ConfigDiagnostic::InvalidDependencyVersion(version.into())); - } - } - - if table.contains_key("source") { - match parse_git_dependency(&alias, table) { - Ok(remote) => dependencies.push(DependencyEntry::new( - alias.clone(), - DependencyEntryLocation::Remote(remote), - arguments, - )), - Err(diag) => diagnostics.push(diag), - } - } else if let Some(path) = table.get("path").and_then(|value| value.as_str()) { - if let Some(path) = parse_dependency_path(&alias, path, diagnostics) { - dependencies.push(DependencyEntry::new( - alias.clone(), - DependencyEntryLocation::RelativePath(path), - arguments, - )); - } - } else if has_name || (!has_name_field && arguments.version.is_some()) { - if arguments.name.is_none() { - arguments.name = Some(alias.clone()); - } - dependencies.push(DependencyEntry::new( - alias.clone(), - DependencyEntryLocation::WorkspaceCurrent, - arguments, - )); - } else if !has_name_field { - arguments.name = Some(alias.clone()); - dependencies.push(DependencyEntry::new( - alias.clone(), - DependencyEntryLocation::WorkspaceCurrent, - arguments, - )); - } else { - diagnostics.push(ConfigDiagnostic::MissingDependencyPath { - alias: alias.clone(), - description: format!("{field_prefix}.{alias}"), - }); - } - } - value => diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: field_prefix.into(), - found: value.type_str().to_lowercase().into(), - expected: Some("table".into()), - }), - } - } - dependencies -} - -fn parse_dependency_path( - alias: &SmolStr, - value: &str, - diagnostics: &mut Vec, -) -> Option { - if value.is_empty() || has_root(value) || has_url_scheme(value) { - diagnostics.push(ConfigDiagnostic::InvalidDependencyPath { - alias: alias.clone(), - value: value.into(), - }); - return None; - } - Some(Utf8PathBuf::from(value)) -} - -fn has_root(value: &str) -> bool { - Utf8UnixPath::new(value).has_root() || Utf8WindowsPath::new(value).has_root() -} - -fn has_url_scheme(value: &str) -> bool { - let Some((scheme, _)) = value.split_once(':') else { - return false; - }; - let Some(first) = scheme.chars().next() else { - return false; - }; - first.is_ascii_alphabetic() - && scheme - .chars() - .skip(1) - .all(|ch| ch.is_ascii_alphanumeric() || matches!(ch, '+' | '-' | '.')) -} - -fn parse_git_dependency( - alias: &SmolStr, - table: &toml::map::Map, -) -> Result { - let source_value = table - .get("source") - .and_then(|value| value.as_str()) - .ok_or_else(|| ConfigDiagnostic::MissingDependencySource { - alias: alias.clone(), - })?; - - let source = - Url::parse(source_value).map_err(|_| ConfigDiagnostic::InvalidDependencySource { - alias: alias.clone(), - value: source_value.into(), - })?; - - let rev_value = table - .get("rev") - .and_then(|value| value.as_str()) - .ok_or_else(|| ConfigDiagnostic::MissingDependencyRev { - alias: alias.clone(), - })?; - - let path = table - .get("path") - .and_then(|value| value.as_str()) - .map(Utf8PathBuf::from); - - Ok(RemoteFiles { - source, - rev: SmolStr::new(rev_value), - path, - }) -} diff --git a/crates/common/src/config/ingot.rs b/crates/common/src/config/ingot.rs deleted file mode 100644 index 36a7dd1b32..0000000000 --- a/crates/common/src/config/ingot.rs +++ /dev/null @@ -1,112 +0,0 @@ -use std::collections::BTreeMap; - -use smol_str::SmolStr; -use toml::Value; - -use crate::ingot::Version; - -use super::{ - ArithmeticMode, ConfigDiagnostic, DependencyArithmeticMode, ProfileSettings, dependency, - is_valid_name, parse_arithmetic_field, parse_dependency_arithmetic_field, parse_profiles_table, -}; - -#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)] -pub struct IngotMetadata { - pub name: Option, - pub version: Option, -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct IngotConfig { - pub metadata: IngotMetadata, - pub arithmetic: Option, - pub dependency_arithmetic: Option, - pub profiles: BTreeMap, - pub dependency_entries: Vec, - pub diagnostics: Vec, -} - -impl IngotConfig { - pub fn parse_from_value(parsed: &Value) -> Self { - let mut diagnostics = Vec::new(); - let (metadata, arithmetic, dependency_arithmetic) = parse_ingot(parsed, &mut diagnostics); - let profiles = parsed - .as_table() - .map(|table| parse_profiles_table(table, &mut diagnostics)) - .unwrap_or_default(); - let dependency_entries = dependency::parse_root_dependencies(parsed, &mut diagnostics); - Self { - metadata, - arithmetic, - dependency_arithmetic, - profiles, - dependency_entries, - diagnostics, - } - } - - pub fn arithmetic_for_profile(&self, profile: &str) -> Option { - self.profiles - .get(profile) - .and_then(|settings| settings.arithmetic) - } - - pub fn dependency_arithmetic_for_profile( - &self, - profile: &str, - ) -> Option { - self.profiles - .get(profile) - .and_then(|settings| settings.dependency_arithmetic) - } -} - -pub(crate) fn parse_ingot( - parsed: &Value, - diagnostics: &mut Vec, -) -> ( - IngotMetadata, - Option, - Option, -) { - let mut metadata = IngotMetadata::default(); - let mut arithmetic = None; - let mut dependency_arithmetic = None; - - let table = match parsed.get("ingot").and_then(|value| value.as_table()) { - Some(table) => Some(table), - None => parsed.as_table(), - }; - - if let Some(table) = table { - if let Some(name) = table.get("name") { - match name.as_str() { - Some(name) if is_valid_name(name) => metadata.name = Some(SmolStr::new(name)), - Some(name) => diagnostics.push(ConfigDiagnostic::InvalidName(SmolStr::new(name))), - None => diagnostics.push(ConfigDiagnostic::InvalidName(SmolStr::new( - name.to_string(), - ))), - } - } else { - diagnostics.push(ConfigDiagnostic::MissingName); - } - - if let Some(version) = table.get("version") { - match version.as_str().and_then(|value| value.parse().ok()) { - Some(version) => metadata.version = Some(version), - None => diagnostics.push(ConfigDiagnostic::InvalidVersion(SmolStr::from( - version.to_string(), - ))), - } - } else { - diagnostics.push(ConfigDiagnostic::MissingVersion); - } - - arithmetic = parse_arithmetic_field("ingot", table, diagnostics); - dependency_arithmetic = parse_dependency_arithmetic_field("ingot", table, diagnostics); - } else { - diagnostics.push(ConfigDiagnostic::MissingIngotMetadata); - } - - (metadata, arithmetic, dependency_arithmetic) -} diff --git a/crates/common/src/config/mod.rs b/crates/common/src/config/mod.rs deleted file mode 100644 index 112a33ddc1..0000000000 --- a/crates/common/src/config/mod.rs +++ /dev/null @@ -1,887 +0,0 @@ -use std::{collections::BTreeMap, fmt::Display}; - -use smol_str::SmolStr; -use toml::Value; -use url::Url; - -use crate::{ - dependencies::{Dependency, DependencyLocation, LocalFiles}, - urlext::UrlExt, -}; - -mod dependency; -mod ingot; -mod workspace; - -pub use dependency::{DependencyEntry, DependencyEntryLocation, parse_dependencies_table}; -pub use ingot::{IngotConfig, IngotMetadata}; -pub use workspace::{ - WorkspaceConfig, WorkspaceMemberSelection, WorkspaceResolution, WorkspaceSettings, -}; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum ArithmeticMode { - Checked, - Unchecked, -} - -impl ArithmeticMode { - pub fn parse(value: &str) -> Option { - match value { - "checked" => Some(Self::Checked), - "unchecked" => Some(Self::Unchecked), - _ => None, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum DependencyArithmeticMode { - Defer, - Checked, - Unchecked, -} - -impl DependencyArithmeticMode { - pub fn parse(value: &str) -> Option { - match value { - "defer" => Some(Self::Defer), - "checked" => Some(Self::Checked), - "unchecked" => Some(Self::Unchecked), - _ => None, - } - } -} - -#[derive(Debug, Clone, Default, PartialEq)] -pub struct ProfileSettings { - pub arithmetic: Option, - pub dependency_arithmetic: Option, - pub extra: toml::value::Table, -} - -impl Eq for ProfileSettings {} - -#[derive(Debug, Clone, PartialEq)] -pub enum Config { - Ingot(IngotConfig), - Workspace(Box), -} - -impl Config { - pub fn parse(content: &str) -> Result { - let parsed: Value = content - .parse() - .map_err(|e: toml::de::Error| e.to_string())?; - - let has_ingot_table = parsed.get("ingot").is_some(); - let has_workspace_table = parsed.get("workspace").is_some(); - - if has_ingot_table && has_workspace_table { - return Err("config cannot contain both [ingot] and [workspace] sections".to_string()); - } - - if has_ingot_table { - return Ok(Config::Ingot(ingot::IngotConfig::parse_from_value(&parsed))); - } - - if has_workspace_table || looks_like_workspace(&parsed) { - return workspace::parse_workspace_config(&parsed) - .map(|config| Config::Workspace(Box::new(config))); - } - - Ok(Config::Ingot(ingot::IngotConfig::parse_from_value(&parsed))) - } -} - -pub fn looks_like_workspace(parsed: &Value) -> bool { - let Some(table) = parsed.as_table() else { - return false; - }; - - table.contains_key("members") - || table.contains_key("default-members") - || table.contains_key("exclude") - || table.contains_key("resolution") - || table.contains_key("scripts") -} - -pub fn is_workspace_content(content: &str) -> bool { - let parsed: Value = match content.parse() { - Ok(parsed) => parsed, - Err(_) => return false, - }; - parsed.get("workspace").is_some() || looks_like_workspace(&parsed) -} - -impl IngotConfig { - pub fn dependencies(&self, base_url: &Url) -> (Vec, Vec) { - let mut dependencies = Vec::new(); - let mut diagnostics = Vec::new(); - for dependency in &self.dependency_entries { - match &dependency.location { - DependencyEntryLocation::RelativePath(path) => { - match base_url.join_directory(path) { - Ok(url) => dependencies.push(Dependency { - alias: dependency.alias.clone(), - arguments: dependency.arguments.clone(), - location: DependencyLocation::Local(LocalFiles { - path: path.clone(), - url, - }), - }), - Err(_) => diagnostics.push(ConfigDiagnostic::InvalidDependencyPath { - alias: dependency.alias.clone(), - value: path.as_str().into(), - }), - } - } - DependencyEntryLocation::Remote(remote) => dependencies.push(Dependency { - alias: dependency.alias.clone(), - arguments: dependency.arguments.clone(), - location: DependencyLocation::Remote(remote.clone()), - }), - DependencyEntryLocation::WorkspaceCurrent => dependencies.push(Dependency { - alias: dependency.alias.clone(), - arguments: dependency.arguments.clone(), - location: DependencyLocation::WorkspaceCurrent, - }), - } - } - (dependencies, diagnostics) - } - - pub fn formatted_diagnostics(&self) -> Option { - if self.diagnostics.is_empty() { - None - } else { - Some( - self.diagnostics - .iter() - .map(|diag| format!(" {diag}")) - .collect::>() - .join("\n"), - ) - } - } -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum ConfigDiagnostic { - MissingIngotMetadata, - MissingName, - MissingVersion, - InvalidName(SmolStr), - InvalidVersion(SmolStr), - MissingWorkspaceMembers, - InvalidWorkspaceMember(SmolStr), - InvalidWorkspaceDevMember(SmolStr), - InvalidWorkspaceDefaultMember(SmolStr), - InvalidWorkspaceExclude(SmolStr), - InvalidWorkspaceMemberName(SmolStr), - InvalidWorkspaceMemberVersion(SmolStr), - InvalidWorkspaceVersion(SmolStr), - MissingWorkspaceSection, - MissingWorkspaceMemberPath, - ConflictingWorkspaceMembersSpec, - InvalidDependencyAlias(SmolStr), - InvalidDependencyName(SmolStr), - InvalidDependencyVersion(SmolStr), - InvalidDependencyPath { - alias: SmolStr, - value: SmolStr, - }, - MissingDependencyPath { - alias: SmolStr, - description: String, - }, - MissingDependencySource { - alias: SmolStr, - }, - MissingDependencyRev { - alias: SmolStr, - }, - InvalidDependencySource { - alias: SmolStr, - value: SmolStr, - }, - InvalidArithmeticMode { - field: SmolStr, - value: SmolStr, - }, - InvalidDependencyArithmeticMode { - field: SmolStr, - value: SmolStr, - }, - UnexpectedTomlData { - field: SmolStr, - found: SmolStr, - expected: Option, - }, -} - -impl Display for ConfigDiagnostic { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::MissingIngotMetadata => write!(f, "Missing ingot metadata"), - Self::MissingName => write!(f, "Missing ingot name"), - Self::MissingVersion => write!(f, "Missing ingot version"), - Self::InvalidName(name) => write!(f, "Invalid ingot name \"{name}\""), - Self::InvalidVersion(version) => write!(f, "Invalid ingot version \"{version}\""), - Self::MissingWorkspaceMembers => write!(f, "Missing workspace members"), - Self::InvalidWorkspaceMember(value) => { - write!(f, "Invalid workspace member entry \"{value}\"") - } - Self::InvalidWorkspaceDevMember(value) => { - write!(f, "Invalid workspace dev member entry \"{value}\"") - } - Self::InvalidWorkspaceDefaultMember(value) => { - write!(f, "Invalid workspace default member entry \"{value}\"") - } - Self::InvalidWorkspaceExclude(value) => { - write!(f, "Invalid workspace exclude entry \"{value}\"") - } - Self::InvalidWorkspaceMemberName(value) => { - write!(f, "Invalid workspace member name \"{value}\"") - } - Self::InvalidWorkspaceMemberVersion(value) => { - write!(f, "Invalid workspace member version \"{value}\"") - } - Self::InvalidWorkspaceVersion(value) => { - write!(f, "Invalid workspace version \"{value}\"") - } - Self::MissingWorkspaceSection => { - write!(f, "Workspace config is missing a [workspace] section") - } - Self::MissingWorkspaceMemberPath => write!(f, "Workspace member is missing a path"), - Self::ConflictingWorkspaceMembersSpec => { - write!(f, "Cannot mix flat and categorized workspace members") - } - Self::InvalidDependencyAlias(alias) => { - write!(f, "Invalid dependency alias \"{alias}\"") - } - Self::InvalidDependencyName(name) => { - write!(f, "Invalid dependency name \"{name}\"") - } - Self::InvalidDependencyVersion(version) => { - write!(f, "Invalid dependency version \"{version}\"") - } - Self::InvalidDependencyPath { alias, value } => { - write!( - f, - "The dependency \"{alias}\" has an invalid path \"{value}\"" - ) - } - Self::MissingDependencyPath { alias, description } => write!( - f, - "The dependency \"{alias}\" is missing a path argument \"{description}\"" - ), - Self::MissingDependencySource { alias } => { - write!(f, "The dependency \"{alias}\" is missing a source field") - } - Self::MissingDependencyRev { alias } => { - write!(f, "The dependency \"{alias}\" is missing a rev field") - } - Self::InvalidDependencySource { alias, value } => write!( - f, - "The dependency \"{alias}\" has an invalid source \"{value}\"" - ), - Self::InvalidArithmeticMode { field, value } => write!( - f, - "Invalid arithmetic mode \"{value}\" in field {field}; expected \"checked\" or \"unchecked\"" - ), - Self::InvalidDependencyArithmeticMode { field, value } => write!( - f, - "Invalid dependency arithmetic mode \"{value}\" in field {field}; expected \"defer\", \"checked\", or \"unchecked\"" - ), - Self::UnexpectedTomlData { - field, - found, - expected, - } => { - if let Some(expected) = expected { - write!( - f, - "Expected a {expected} in field {field}, but found a {found}" - ) - } else { - write!(f, "Unexpected field {field}") - } - } - } - } -} - -pub(crate) fn is_valid_name_char(c: char) -> bool { - c.is_alphanumeric() || c == '_' -} - -pub(crate) fn is_valid_name(s: &str) -> bool { - s.chars().all(is_valid_name_char) -} - -pub(crate) fn parse_string_array_field( - parent: &str, - key: &str, - value: &Value, - diagnostics: &mut Vec, -) -> Vec { - match value { - Value::Array(entries) => { - let mut parsed = Vec::new(); - for entry in entries { - if let Some(value) = entry.as_str() { - parsed.push(SmolStr::new(value)); - } else { - diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: format_field_path(parent, key).into(), - found: entry.type_str().to_lowercase().into(), - expected: Some("string".into()), - }); - } - } - parsed - } - other => { - diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: format_field_path(parent, key).into(), - found: other.type_str().to_lowercase().into(), - expected: Some("array".into()), - }); - vec![] - } - } -} - -pub(crate) fn parse_arithmetic_field( - parent: &str, - table: &toml::value::Table, - diagnostics: &mut Vec, -) -> Option { - let value = table.get("arithmetic")?; - let field = if parent.is_empty() { - SmolStr::new("arithmetic") - } else { - SmolStr::new(format!("{parent}.arithmetic")) - }; - let Some(value) = value.as_str() else { - diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field, - found: value.type_str().to_lowercase().into(), - expected: Some("string".into()), - }); - return None; - }; - match ArithmeticMode::parse(value) { - Some(mode) => Some(mode), - None => { - diagnostics.push(ConfigDiagnostic::InvalidArithmeticMode { - field, - value: value.into(), - }); - None - } - } -} - -pub(crate) fn parse_dependency_arithmetic_field( - parent: &str, - table: &toml::value::Table, - diagnostics: &mut Vec, -) -> Option { - let value = table.get("dependency-arithmetic")?; - let field = if parent.is_empty() { - SmolStr::new("dependency-arithmetic") - } else { - SmolStr::new(format!("{parent}.dependency-arithmetic")) - }; - let Some(value) = value.as_str() else { - diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field, - found: value.type_str().to_lowercase().into(), - expected: Some("string".into()), - }); - return None; - }; - match DependencyArithmeticMode::parse(value) { - Some(mode) => Some(mode), - None => { - diagnostics.push(ConfigDiagnostic::InvalidDependencyArithmeticMode { - field, - value: value.into(), - }); - None - } - } -} - -pub(crate) fn parse_profiles_table( - table: &toml::value::Table, - diagnostics: &mut Vec, -) -> BTreeMap { - let Some(value) = table.get("profiles") else { - return BTreeMap::new(); - }; - let Some(entries) = value.as_table() else { - diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "profiles".into(), - found: value.type_str().to_lowercase().into(), - expected: Some("table".into()), - }); - return BTreeMap::new(); - }; - - let mut profiles = BTreeMap::new(); - for (name, value) in entries { - let Some(profile_table) = value.as_table() else { - diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: format!("profiles.{name}").into(), - found: value.type_str().to_lowercase().into(), - expected: Some("table".into()), - }); - continue; - }; - - let arithmetic = - parse_arithmetic_field(&format!("profiles.{name}"), profile_table, diagnostics); - let dependency_arithmetic = parse_dependency_arithmetic_field( - &format!("profiles.{name}"), - profile_table, - diagnostics, - ); - let mut extra = profile_table.clone(); - extra.remove("arithmetic"); - extra.remove("dependency-arithmetic"); - profiles.insert( - name.clone().into(), - ProfileSettings { - arithmetic, - dependency_arithmetic, - extra, - }, - ); - } - profiles -} - -pub fn resolve_arithmetic_mode( - ingot: Option<&IngotConfig>, - workspace: Option<&WorkspaceConfig>, - profile: &str, -) -> Option { - ingot - .and_then(|config| config.arithmetic_for_profile(profile).or(config.arithmetic)) - .or_else(|| { - workspace.and_then(|config| { - config - .workspace - .arithmetic_for_profile(profile) - .or(config.workspace.arithmetic) - }) - }) -} - -pub fn resolve_dependency_arithmetic_mode( - ingot: Option<&IngotConfig>, - workspace: Option<&WorkspaceConfig>, - profile: &str, -) -> DependencyArithmeticMode { - ingot - .and_then(|config| { - config - .dependency_arithmetic_for_profile(profile) - .or(config.dependency_arithmetic) - }) - .or_else(|| { - workspace.and_then(|config| { - config - .workspace - .dependency_arithmetic_for_profile(profile) - .or(config.workspace.dependency_arithmetic) - }) - }) - .unwrap_or(DependencyArithmeticMode::Defer) -} - -fn format_field_path(parent: &str, key: &str) -> String { - if parent.is_empty() { - key.to_string() - } else { - format!("{parent}.{key}") - } -} - -#[cfg(test)] -mod tests { - use super::*; - - use crate::dependencies::DependencyArguments; - - fn dependencies(config: &IngotConfig, base: &Url) -> Vec { - let (dependencies, diagnostics) = config.dependencies(base); - assert!( - diagnostics.is_empty(), - "unexpected dependency diagnostics: {diagnostics:?}" - ); - dependencies - } - - #[test] - fn parses_git_dependency_entry() { - let toml = r#" -[ingot] -name = "root" -version = "1.0.0" - -[dependencies] -remote = { source = "https://example.com/fe.git", rev = "abcd1234", path = "contracts" } -"#; - let config_file = Config::parse(toml).expect("config parses"); - let Config::Ingot(config) = config_file else { - panic!("expected ingot config"); - }; - assert!( - config.diagnostics.is_empty(), - "unexpected diagnostics: {:?}", - config.diagnostics - ); - let base = Url::parse("file:///workspace/root/").unwrap(); - let dependencies = dependencies(&config, &base); - assert_eq!(dependencies.len(), 1); - match &dependencies[0].location { - DependencyLocation::Remote(remote) => { - assert_eq!(remote.source.as_str(), "https://example.com/fe.git"); - assert_eq!(remote.rev, "abcd1234"); - assert_eq!( - remote.path.as_ref().map(|path| path.as_str()), - Some("contracts") - ); - } - other => panic!("expected git dependency, found {other:?}"), - } - } - - #[test] - fn reports_diagnostics_for_incomplete_git_dependency() { - let toml = r#" -[ingot] -name = "root" -version = "1.0.0" - -[dependencies] -missing_rev = { source = "https://example.com/repo.git" } -invalid_source = { source = "not a url", rev = "1234" } -"#; - let config_file = Config::parse(toml).expect("config parses"); - let Config::Ingot(config) = config_file else { - panic!("expected ingot config"); - }; - assert!( - config - .diagnostics - .iter() - .any(|diag| matches!(diag, ConfigDiagnostic::MissingDependencyRev { .. })) - ); - assert!( - config - .diagnostics - .iter() - .any(|diag| matches!(diag, ConfigDiagnostic::InvalidDependencySource { .. })) - ); - } - - #[test] - fn reports_diagnostics_for_invalid_dependency_paths() { - let toml = r#" -[ingot] -name = "root" -version = "1.0.0" - -[dependencies] -invalid_url = "http://[::1" -invalid_file = { path = "file:///tmp/dep" } -invalid_absolute = { path = "/tmp/dep" } -invalid_windows_root = { path = '\tmp\dep' } -invalid_windows_unc = { path = '\\server\share\dep' } -invalid_empty = { path = "" } -"#; - let config_file = Config::parse(toml).expect("config parses"); - let Config::Ingot(config) = config_file else { - panic!("expected ingot config"); - }; - assert!(config.dependency_entries.is_empty()); - - for (expected_alias, expected_value) in [ - ("invalid_url", "http://[::1"), - ("invalid_file", "file:///tmp/dep"), - ("invalid_absolute", "/tmp/dep"), - ("invalid_windows_root", r"\tmp\dep"), - ("invalid_windows_unc", r"\\server\share\dep"), - ("invalid_empty", ""), - ] { - assert!(config.diagnostics.iter().any(|diag| { - matches!( - diag, - ConfigDiagnostic::InvalidDependencyPath { alias, value } - if alias.as_str() == expected_alias && value.as_str() == expected_value - ) - })); - } - } - - #[test] - fn reports_diagnostics_for_dependency_url_join_errors() { - let config = IngotConfig { - metadata: IngotMetadata::default(), - arithmetic: None, - dependency_arithmetic: None, - profiles: BTreeMap::new(), - dependency_entries: vec![DependencyEntry::new( - SmolStr::new("dep"), - DependencyEntryLocation::RelativePath("http://[::1".into()), - DependencyArguments::default(), - )], - diagnostics: Vec::new(), - }; - - let (dependencies, diagnostics) = - config.dependencies(&Url::parse("file:///workspace/root/").unwrap()); - - assert!(dependencies.is_empty()); - assert_eq!(diagnostics.len(), 1); - assert!(matches!( - &diagnostics[0], - ConfigDiagnostic::InvalidDependencyPath { alias, value } - if alias.as_str() == "dep" && value.as_str() == "http://[::1" - )); - } - - #[test] - fn parses_name_only_dependency() { - let toml = r#" -[ingot] -name = "root" -version = "1.0.0" - -[dependencies] -util = { name = "utils" } -"#; - let config_file = Config::parse(toml).expect("config parses"); - let Config::Ingot(config) = config_file else { - panic!("expected ingot config"); - }; - assert_eq!( - dependencies(&config, &Url::parse("file:///workspace/root/").unwrap()).len(), - 1 - ); - let dependencies = dependencies(&config, &Url::parse("file:///workspace/root/").unwrap()); - let dependency = &dependencies[0]; - assert_eq!(dependency.arguments.name.as_deref(), Some("utils")); - assert!(matches!( - dependency.location, - DependencyLocation::WorkspaceCurrent - )); - } - - #[test] - fn parses_alias_only_dependency() { - let toml = r#" -[ingot] -name = "root" -version = "1.0.0" - -[dependencies] -util = true -"#; - let config_file = Config::parse(toml).expect("config parses"); - let Config::Ingot(config) = config_file else { - panic!("expected ingot config"); - }; - let dependencies = dependencies(&config, &Url::parse("file:///workspace/root/").unwrap()); - let dependency = &dependencies[0]; - assert_eq!(dependency.arguments.name.as_deref(), Some("util")); - assert!(matches!( - dependency.location, - DependencyLocation::WorkspaceCurrent - )); - } - - #[test] - fn parses_alias_version_dependency() { - let toml = r#" -[ingot] -name = "root" -version = "1.0.0" - -[dependencies] -util = "0.1.0" -"#; - let config_file = Config::parse(toml).expect("config parses"); - let Config::Ingot(config) = config_file else { - panic!("expected ingot config"); - }; - let dependencies = dependencies(&config, &Url::parse("file:///workspace/root/").unwrap()); - let dependency = &dependencies[0]; - assert_eq!(dependency.arguments.name.as_deref(), Some("util")); - assert_eq!( - dependency - .arguments - .version - .as_ref() - .map(|version| version.to_string()), - Some("0.1.0".to_string()) - ); - assert!(matches!( - dependency.location, - DependencyLocation::WorkspaceCurrent - )); - } - - #[test] - fn resolves_arithmetic_mode_with_ingot_profile_precedence() { - let ingot = IngotConfig { - metadata: IngotMetadata::default(), - arithmetic: Some(ArithmeticMode::Unchecked), - dependency_arithmetic: None, - profiles: BTreeMap::from([( - SmolStr::new("release"), - ProfileSettings { - arithmetic: Some(ArithmeticMode::Checked), - dependency_arithmetic: None, - extra: toml::value::Table::new(), - }, - )]), - dependency_entries: vec![], - diagnostics: vec![], - }; - let workspace = WorkspaceConfig { - workspace: WorkspaceSettings { - arithmetic: Some(ArithmeticMode::Checked), - profiles: BTreeMap::from([( - SmolStr::new("release"), - ProfileSettings { - arithmetic: Some(ArithmeticMode::Unchecked), - dependency_arithmetic: None, - extra: toml::value::Table::new(), - }, - )]), - ..WorkspaceSettings::default() - }, - diagnostics: vec![], - }; - - assert_eq!( - resolve_arithmetic_mode(Some(&ingot), Some(&workspace), "release"), - Some(ArithmeticMode::Checked) - ); - assert_eq!( - resolve_arithmetic_mode(Some(&ingot), Some(&workspace), "dev"), - Some(ArithmeticMode::Unchecked) - ); - } - - #[test] - fn resolves_arithmetic_mode_from_workspace_when_ingot_has_no_override() { - let workspace = WorkspaceConfig { - workspace: WorkspaceSettings { - arithmetic: Some(ArithmeticMode::Unchecked), - profiles: BTreeMap::from([( - SmolStr::new("release"), - ProfileSettings { - arithmetic: Some(ArithmeticMode::Checked), - dependency_arithmetic: None, - extra: toml::value::Table::new(), - }, - )]), - ..WorkspaceSettings::default() - }, - diagnostics: vec![], - }; - - assert_eq!( - resolve_arithmetic_mode(None, Some(&workspace), "release"), - Some(ArithmeticMode::Checked) - ); - assert_eq!( - resolve_arithmetic_mode(None, Some(&workspace), "dev"), - Some(ArithmeticMode::Unchecked) - ); - assert_eq!(resolve_arithmetic_mode(None, None, "dev"), None); - } - - #[test] - fn parses_root_profiles_as_ingot_config() { - let toml = r#" -[ingot] -name = "root" -version = "0.1.0" - -[profiles.release] -arithmetic = "unchecked" -dependency-arithmetic = "checked" -"#; - let config = Config::parse(toml).expect("config parses"); - let Config::Ingot(config) = config else { - panic!("expected ingot config"); - }; - assert_eq!( - config.arithmetic_for_profile("release"), - Some(ArithmeticMode::Unchecked) - ); - assert_eq!( - config.dependency_arithmetic_for_profile("release"), - Some(DependencyArithmeticMode::Checked) - ); - } - - #[test] - fn resolves_dependency_arithmetic_mode_with_profile_precedence() { - let ingot = IngotConfig { - metadata: IngotMetadata::default(), - arithmetic: None, - dependency_arithmetic: Some(DependencyArithmeticMode::Checked), - profiles: BTreeMap::from([( - SmolStr::new("release"), - ProfileSettings { - arithmetic: None, - dependency_arithmetic: Some(DependencyArithmeticMode::Unchecked), - extra: toml::value::Table::new(), - }, - )]), - dependency_entries: vec![], - diagnostics: vec![], - }; - let workspace = WorkspaceConfig { - workspace: WorkspaceSettings { - dependency_arithmetic: Some(DependencyArithmeticMode::Unchecked), - profiles: BTreeMap::from([( - SmolStr::new("release"), - ProfileSettings { - arithmetic: None, - dependency_arithmetic: Some(DependencyArithmeticMode::Checked), - extra: toml::value::Table::new(), - }, - )]), - ..WorkspaceSettings::default() - }, - diagnostics: vec![], - }; - - assert_eq!( - resolve_dependency_arithmetic_mode(Some(&ingot), Some(&workspace), "release"), - DependencyArithmeticMode::Unchecked - ); - assert_eq!( - resolve_dependency_arithmetic_mode(Some(&ingot), Some(&workspace), "dev"), - DependencyArithmeticMode::Checked - ); - assert_eq!( - resolve_dependency_arithmetic_mode(None, Some(&workspace), "release"), - DependencyArithmeticMode::Checked - ); - assert_eq!( - resolve_dependency_arithmetic_mode(None, None, "dev"), - DependencyArithmeticMode::Defer - ); - } -} diff --git a/crates/common/src/config/workspace.rs b/crates/common/src/config/workspace.rs deleted file mode 100644 index 3bc5974d73..0000000000 --- a/crates/common/src/config/workspace.rs +++ /dev/null @@ -1,531 +0,0 @@ -use std::collections::BTreeMap; - -use smol_str::SmolStr; -use toml::Value; - -use crate::ingot::Version; - -use super::{ - ArithmeticMode, ConfigDiagnostic, DependencyArithmeticMode, ProfileSettings, dependency, - is_valid_name, parse_arithmetic_field, parse_dependency_arithmetic_field, parse_profiles_table, - parse_string_array_field, -}; - -#[derive(Debug, Clone, Default, PartialEq)] -pub struct WorkspaceSettings { - pub name: Option, - pub version: Option, - pub members: Vec, - pub dev_members: Vec, - pub default_members: Option>, - pub exclude: Vec, - pub metadata: Option, - pub arithmetic: Option, - pub dependency_arithmetic: Option, - pub profiles: BTreeMap, - pub scripts: Vec, - pub resolution: Option, - pub dependencies: Vec, -} - -impl Eq for WorkspaceSettings {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct WorkspaceScript { - pub name: SmolStr, - pub command: SmolStr, -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct WorkspaceMemberSpec { - pub path: SmolStr, - pub name: Option, - pub version: Option, -} - -#[derive(Debug, Clone, Default, PartialEq)] -pub struct WorkspaceResolution { - pub registry: Option, - pub source: Option, - pub lockfile: Option, - pub extra: toml::value::Table, -} - -impl Eq for WorkspaceResolution {} - -#[derive(Debug, Clone, Copy)] -pub enum WorkspaceMemberSelection { - All, - DefaultOnly, - PrimaryOnly, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct WorkspaceConfig { - pub workspace: WorkspaceSettings, - pub diagnostics: Vec, -} - -impl Eq for WorkspaceConfig {} - -impl WorkspaceSettings { - pub fn arithmetic_for_profile(&self, profile: &str) -> Option { - self.profiles - .get(profile) - .and_then(|settings| settings.arithmetic) - } - - pub fn dependency_arithmetic_for_profile( - &self, - profile: &str, - ) -> Option { - self.profiles - .get(profile) - .and_then(|settings| settings.dependency_arithmetic) - } - - pub fn members_for_selection( - &self, - selection: WorkspaceMemberSelection, - ) -> Vec { - let mut members = match selection { - WorkspaceMemberSelection::PrimaryOnly => self.members.clone(), - WorkspaceMemberSelection::DefaultOnly => { - if let Some(defaults) = &self.default_members { - let mut combined = self.members.clone(); - combined.extend(self.dev_members.clone()); - combined - .into_iter() - .filter(|member| defaults.contains(&member.path)) - .collect() - } else { - self.members.clone() - } - } - WorkspaceMemberSelection::All => { - let mut combined = self.members.clone(); - combined.extend(self.dev_members.clone()); - combined - } - }; - members.sort_by(|a, b| { - a.path - .cmp(&b.path) - .then(a.name.cmp(&b.name)) - .then(a.version.cmp(&b.version)) - }); - members.dedup(); - members - } -} - -pub(crate) fn parse_workspace( - parsed: &Value, - diagnostics: &mut Vec, -) -> WorkspaceSettings { - let Some(table) = parsed.as_table() else { - return WorkspaceSettings::default(); - }; - - let mut workspace = WorkspaceSettings::default(); - - parse_identity(table, &mut workspace, diagnostics); - parse_members(table, &mut workspace, diagnostics); - parse_default_members(table, &mut workspace, diagnostics); - parse_exclude(table, &mut workspace, diagnostics); - parse_metadata(table, &mut workspace, diagnostics); - parse_arithmetic(table, &mut workspace, diagnostics); - workspace.profiles = parse_profiles_table(table, diagnostics); - parse_scripts(table, &mut workspace, diagnostics); - workspace.resolution = parse_resolution(table, diagnostics); - - workspace -} - -fn parse_identity( - table: &toml::value::Table, - workspace: &mut WorkspaceSettings, - diagnostics: &mut Vec, -) { - if let Some(name) = table.get("name") { - match name.as_str() { - Some(name) => workspace.name = Some(SmolStr::new(name)), - None => diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "name".into(), - found: name.type_str().to_lowercase().into(), - expected: Some("string".into()), - }), - } - } - - if let Some(version) = table.get("version") { - match version.as_str() { - Some(version) => match version.parse() { - Ok(parsed) => workspace.version = Some(parsed), - Err(_) => { - diagnostics.push(ConfigDiagnostic::InvalidWorkspaceVersion(version.into())) - } - }, - None => diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "version".into(), - found: version.type_str().to_lowercase().into(), - expected: Some("string".into()), - }), - } - } -} - -pub(crate) fn parse_workspace_config(parsed: &Value) -> Result { - let mut diagnostics = Vec::new(); - let has_workspace_section = parsed - .get("workspace") - .and_then(|value| value.as_table()) - .is_some(); - if !has_workspace_section && super::looks_like_workspace(parsed) { - diagnostics.push(ConfigDiagnostic::MissingWorkspaceSection); - } - let workspace_value = if let (Some(root), Some(workspace)) = ( - parsed.as_table(), - parsed.get("workspace").and_then(|value| value.as_table()), - ) { - let mut merged = root.clone(); - for (key, value) in workspace { - merged.insert(key.clone(), value.clone()); - } - Value::Table(merged) - } else { - parsed.clone() - }; - let mut workspace = parse_workspace(&workspace_value, &mut diagnostics); - - workspace.dependencies = dependency::parse_root_dependencies(parsed, &mut diagnostics); - - Ok(WorkspaceConfig { - workspace, - diagnostics, - }) -} - -fn parse_members( - table: &toml::value::Table, - workspace: &mut WorkspaceSettings, - diagnostics: &mut Vec, -) { - let Some(value) = table.get("members") else { - diagnostics.push(ConfigDiagnostic::MissingWorkspaceMembers); - return; - }; - - match value { - Value::Array(_entries) => { - workspace.members = parse_member_array_field("members", value, diagnostics); - } - Value::Table(member_table) => { - if let Some(main) = member_table.get("main") { - workspace.members = parse_member_array_field("members.main", main, diagnostics); - } else { - diagnostics.push(ConfigDiagnostic::MissingWorkspaceMembers); - } - if let Some(dev) = member_table.get("dev") { - workspace.dev_members = parse_member_array_field("members.dev", dev, diagnostics); - } - } - other => { - diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "members".into(), - found: other.type_str().to_lowercase().into(), - expected: Some("array".into()), - }); - } - } -} - -fn parse_default_members( - table: &toml::value::Table, - workspace: &mut WorkspaceSettings, - diagnostics: &mut Vec, -) { - let Some(value) = table.get("default-members") else { - return; - }; - - let defaults = parse_string_array_field("", "default-members", value, diagnostics); - workspace.default_members = Some(defaults); -} - -fn parse_exclude( - table: &toml::value::Table, - workspace: &mut WorkspaceSettings, - diagnostics: &mut Vec, -) { - let Some(value) = table.get("exclude") else { - return; - }; - workspace.exclude = parse_string_array_field("", "exclude", value, diagnostics); -} - -fn parse_member_array_field( - parent: &str, - value: &Value, - diagnostics: &mut Vec, -) -> Vec { - let Value::Array(entries) = value else { - diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: parent.into(), - found: value.type_str().to_lowercase().into(), - expected: Some("array".into()), - }); - return Vec::new(); - }; - - let mut parsed = Vec::new(); - for entry in entries { - match entry { - Value::String(value) => parsed.push(WorkspaceMemberSpec { - path: SmolStr::new(value), - name: None, - version: None, - }), - Value::Table(member_table) => { - let Some(path) = member_table.get("path").and_then(|value| value.as_str()) else { - diagnostics.push(ConfigDiagnostic::MissingWorkspaceMemberPath); - continue; - }; - let mut member = WorkspaceMemberSpec { - path: SmolStr::new(path), - name: None, - version: None, - }; - if let Some(name) = member_table.get("name").and_then(|value| value.as_str()) { - if is_valid_name(name) { - member.name = Some(SmolStr::new(name)); - } else { - diagnostics.push(ConfigDiagnostic::InvalidWorkspaceMemberName(name.into())); - } - } - if let Some(version) = member_table.get("version").and_then(|value| value.as_str()) - { - match version.parse() { - Ok(parsed) => member.version = Some(parsed), - Err(_) => diagnostics.push( - ConfigDiagnostic::InvalidWorkspaceMemberVersion(version.into()), - ), - } - } - parsed.push(member); - } - other => diagnostics.push(ConfigDiagnostic::InvalidWorkspaceMember( - other.to_string().into(), - )), - } - } - parsed -} - -fn parse_metadata( - table: &toml::value::Table, - workspace: &mut WorkspaceSettings, - diagnostics: &mut Vec, -) { - if let Some(value) = table.get("metadata") { - match value.as_table() { - Some(table) => workspace.metadata = Some(table.clone()), - None => diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "metadata".into(), - found: value.type_str().to_lowercase().into(), - expected: Some("table".into()), - }), - } - } -} - -fn parse_arithmetic( - table: &toml::value::Table, - workspace: &mut WorkspaceSettings, - diagnostics: &mut Vec, -) { - workspace.arithmetic = parse_arithmetic_field("workspace", table, diagnostics); - workspace.dependency_arithmetic = - parse_dependency_arithmetic_field("workspace", table, diagnostics); -} - -fn parse_scripts( - table: &toml::value::Table, - workspace: &mut WorkspaceSettings, - diagnostics: &mut Vec, -) { - if let Some(value) = table.get("scripts") { - match value { - Value::Table(entries) => { - for (name, value) in entries { - match value.as_str() { - Some(command) => workspace.scripts.push(WorkspaceScript { - name: SmolStr::new(name), - command: SmolStr::new(command), - }), - None => diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: format!("scripts.{name}").into(), - found: value.type_str().to_lowercase().into(), - expected: Some("string".into()), - }), - } - } - } - other => diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "scripts".into(), - found: other.type_str().to_lowercase().into(), - expected: Some("table".into()), - }), - } - } -} - -fn parse_resolution( - table: &toml::value::Table, - diagnostics: &mut Vec, -) -> Option { - let value = table.get("resolution")?; - - let Value::Table(entries) = value else { - diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "resolution".into(), - found: value.type_str().to_lowercase().into(), - expected: Some("table".into()), - }); - return None; - }; - - let mut resolution = WorkspaceResolution::default(); - for (key, value) in entries { - match key.as_str() { - "registry" => match value.as_str() { - Some(registry) => resolution.registry = Some(registry.into()), - None => diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "resolution.registry".into(), - found: value.type_str().to_lowercase().into(), - expected: Some("string".into()), - }), - }, - "source" => match value.as_str() { - Some(source) => resolution.source = Some(source.into()), - None => diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "resolution.source".into(), - found: value.type_str().to_lowercase().into(), - expected: Some("string".into()), - }), - }, - "lockfile" => match value.as_bool() { - Some(lockfile) => resolution.lockfile = Some(lockfile), - None => diagnostics.push(ConfigDiagnostic::UnexpectedTomlData { - field: "resolution.lockfile".into(), - found: value.type_str().to_lowercase().into(), - expected: Some("boolean".into()), - }), - }, - _ => { - resolution.extra.insert(key.clone(), value.clone()); - } - } - } - - Some(resolution) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn parses_workspace_section_with_extras() { - let toml = r#" -name = "workspace-root" -version = "0.1.0" -members = { main = ["ingot-a", "ingot-b/**"], dev = ["examples/**"] } -default-members = ["ingot-a"] -exclude = ["target", "ignored/**"] -arithmetic = "unchecked" -dependency-arithmetic = "defer" - -[metadata] -docs = true - -[profiles.release] -arithmetic = "checked" -dependency-arithmetic = "unchecked" -opt-level = 3 - -[scripts] -fmt = "fe fmt" -ci = "fe check" - -[resolution] -registry = "local" -source = "https://example.com" -lockfile = false -other = "keep" - -[dependencies] -util = { path = "ingots/util" } -"#; - let config_file = crate::config::Config::parse(toml).expect("config parses"); - let crate::config::Config::Workspace(workspace_config) = config_file else { - panic!("expected workspace config"); - }; - let workspace = workspace_config.workspace; - assert_eq!(workspace.name.as_deref(), Some("workspace-root")); - assert_eq!( - workspace - .version - .as_ref() - .map(|version| version.to_string()), - Some("0.1.0".to_string()) - ); - assert_eq!( - workspace.members, - vec![ - WorkspaceMemberSpec { - path: "ingot-a".into(), - name: None, - version: None, - }, - WorkspaceMemberSpec { - path: "ingot-b/**".into(), - name: None, - version: None, - } - ] - ); - assert_eq!( - workspace.dev_members, - vec![WorkspaceMemberSpec { - path: "examples/**".into(), - name: None, - version: None, - }] - ); - assert_eq!( - workspace.default_members.unwrap(), - vec![SmolStr::new("ingot-a")] - ); - assert_eq!(workspace.exclude, vec!["target", "ignored/**"]); - assert!(workspace.metadata.is_some()); - assert_eq!(workspace.arithmetic, Some(ArithmeticMode::Unchecked)); - assert_eq!( - workspace.dependency_arithmetic, - Some(DependencyArithmeticMode::Defer) - ); - let release = workspace.profiles.get("release").expect("release profile"); - assert_eq!(release.arithmetic, Some(ArithmeticMode::Checked)); - assert_eq!( - release.dependency_arithmetic, - Some(DependencyArithmeticMode::Unchecked) - ); - assert_eq!(release.extra.get("opt-level"), Some(&Value::Integer(3))); - assert_eq!(workspace.scripts.len(), 2); - let resolution = workspace.resolution.expect("resolution parsed"); - assert_eq!(resolution.registry.as_deref(), Some("local")); - assert_eq!(resolution.source.as_deref(), Some("https://example.com")); - assert_eq!(resolution.lockfile, Some(false)); - assert_eq!(workspace.dependencies.len(), 1); - } -} diff --git a/crates/common/src/dependencies/graph.rs b/crates/common/src/dependencies/graph.rs deleted file mode 100644 index 9fd78eb865..0000000000 --- a/crates/common/src/dependencies/graph.rs +++ /dev/null @@ -1,387 +0,0 @@ -#![allow(clippy::too_many_arguments)] // salsa-generated input constructor takes multiple fields - -use std::collections::{HashMap, HashSet}; - -use petgraph::graph::{DiGraph, NodeIndex}; -use petgraph::visit::{Dfs, EdgeRef}; -use salsa::Setter; -use smol_str::SmolStr; -use url::Url; - -use super::{DependencyAlias, DependencyArguments, RemoteFiles, WorkspaceMemberRecord}; -use crate::{InputDb, config::ArithmeticMode, ingot::Version}; - -type EdgeWeight = (DependencyAlias, DependencyArguments); - -#[salsa::input] -#[derive(Debug)] -pub struct DependencyGraph { - graph: DiGraph, - node_map: HashMap, - git_locations: HashMap, - reverse_git_map: HashMap, - ingots_by_metadata: HashMap<(SmolStr, Version), Url>, - workspace_members: HashMap>, - workspace_root_by_member: HashMap, - expected_member_metadata: HashMap, - forced_dependency_arithmetic: HashMap, -} - -#[salsa::tracked] -impl DependencyGraph { - pub fn default(db: &dyn InputDb) -> Self { - DependencyGraph::new( - db, - DiGraph::new(), - HashMap::new(), - HashMap::new(), - HashMap::new(), - HashMap::new(), - HashMap::new(), - HashMap::new(), - HashMap::new(), - HashMap::new(), - ) - } - - fn allocate_node( - graph: &mut DiGraph, - node_map: &mut HashMap, - url: &Url, - ) -> NodeIndex { - if let Some(&idx) = node_map.get(url) { - idx - } else { - let idx = graph.add_node(url.clone()); - node_map.insert(url.clone(), idx); - idx - } - } - - pub fn ensure_node(&self, db: &mut dyn InputDb, url: &Url) { - if self.node_map(db).contains_key(url) { - return; - } - let mut graph = self.graph(db); - let mut node_map = self.node_map(db); - Self::allocate_node(&mut graph, &mut node_map, url); - self.set_graph(db).to(graph); - self.set_node_map(db).to(node_map); - } - - pub fn register_ingot_metadata( - &self, - db: &mut dyn InputDb, - url: &Url, - name: SmolStr, - version: Version, - ) { - let mut map = self.ingots_by_metadata(db); - map.entry((name, version)).or_insert_with(|| url.clone()); - self.set_ingots_by_metadata(db).to(map); - } - - pub fn ingot_by_name_version( - &self, - db: &dyn InputDb, - name: &SmolStr, - version: &Version, - ) -> Option { - self.ingots_by_metadata(db) - .get(&(name.clone(), version.clone())) - .cloned() - } - - pub fn register_workspace_member( - &self, - db: &mut dyn InputDb, - workspace_root: &Url, - member: WorkspaceMemberRecord, - ) { - let mut members = self.workspace_members(db); - let entry = members.entry(workspace_root.clone()).or_default(); - if let Some(existing) = entry.iter_mut().find(|record| record.url == member.url) { - *existing = member.clone(); - } else { - entry.push(member.clone()); - } - self.set_workspace_members(db).to(members); - - self.register_workspace_member_root(db, workspace_root, &member.url); - } - - pub fn register_workspace_member_root( - &self, - db: &mut dyn InputDb, - workspace_root: &Url, - member_url: &Url, - ) { - let mut roots = self.workspace_root_by_member(db); - roots.insert(member_url.clone(), workspace_root.clone()); - self.set_workspace_root_by_member(db).to(roots); - } - - pub fn workspace_member_records( - &self, - db: &dyn InputDb, - workspace_root: &Url, - ) -> Vec { - self.workspace_members(db) - .get(workspace_root) - .cloned() - .unwrap_or_default() - } - - pub fn workspace_roots(&self, db: &dyn InputDb) -> Vec { - self.workspace_members(db).keys().cloned().collect() - } - - /// Ensure the workspace root has an entry in the members map even when - /// it has zero named members (e.g. a workspace with only glob patterns - /// that match nothing yet). Without this the root would be invisible to - /// `workspace_roots()`. - pub fn ensure_workspace_root(&self, db: &mut dyn InputDb, workspace_root: &Url) { - let mut members = self.workspace_members(db); - if members.contains_key(workspace_root) { - return; - } - members.entry(workspace_root.clone()).or_default(); - self.set_workspace_members(db).to(members); - } - - pub fn workspace_members_by_name( - &self, - db: &dyn InputDb, - workspace_root: &Url, - name: &SmolStr, - ) -> Vec { - self.workspace_members(db) - .get(workspace_root) - .map(|members| { - members - .iter() - .filter(|member| member.name == *name) - .cloned() - .collect() - }) - .unwrap_or_default() - } - - pub fn workspace_root_for_member(&self, db: &dyn InputDb, url: &Url) -> Option { - self.workspace_root_by_member(db).get(url).cloned() - } - - pub fn register_expected_member_metadata( - &self, - db: &mut dyn InputDb, - url: &Url, - name: SmolStr, - version: Version, - ) { - let mut map = self.expected_member_metadata(db); - map.insert(url.clone(), (name, version)); - self.set_expected_member_metadata(db).to(map); - } - - pub fn expected_member_metadata_for( - &self, - db: &dyn InputDb, - url: &Url, - ) -> Option<(SmolStr, Version)> { - self.expected_member_metadata(db).get(url).cloned() - } - - pub fn contains_url(&self, db: &dyn InputDb, url: &Url) -> bool { - self.node_map(db).contains_key(url) - } - - pub fn force_dependency_arithmetic( - &self, - db: &mut dyn InputDb, - url: &Url, - arithmetic: ArithmeticMode, - ) { - let mut forced = self.forced_dependency_arithmetic(db); - forced.insert(url.clone(), arithmetic); - self.set_forced_dependency_arithmetic(db).to(forced); - } - - pub fn forced_dependency_arithmetic_for( - &self, - db: &dyn InputDb, - url: &Url, - ) -> Option { - self.forced_dependency_arithmetic(db).get(url).copied() - } - - pub fn add_dependency( - &self, - db: &mut dyn InputDb, - source: &Url, - target: &Url, - alias: DependencyAlias, - arguments: DependencyArguments, - ) { - let mut graph = self.graph(db); - let mut node_map = self.node_map(db); - let source_idx = Self::allocate_node(&mut graph, &mut node_map, source); - let target_idx = Self::allocate_node(&mut graph, &mut node_map, target); - - // Avoid duplicate edges when re-resolving (e.g. workspace re-init after - // a new member ingot appears). If an edge with the same alias already - // exists, update its arguments in case they changed. - let existing = graph - .edges(source_idx) - .find(|e| e.target() == target_idx && e.weight().0 == alias) - .map(|e| e.id()); - if let Some(edge_id) = existing { - if graph[edge_id].1 != arguments { - graph[edge_id] = (alias, arguments); - } - } else { - graph.add_edge(source_idx, target_idx, (alias, arguments)); - } - - self.set_graph(db).to(graph); - self.set_node_map(db).to(node_map); - } - - pub fn petgraph(&self, db: &dyn InputDb) -> DiGraph { - self.graph(db) - } - - pub fn cyclic_subgraph(&self, db: &dyn InputDb) -> DiGraph { - use petgraph::algo::tarjan_scc; - - let graph = self.graph(db); - let sccs = tarjan_scc(&graph); - - let mut cyclic_nodes = HashSet::new(); - for scc in sccs { - if scc.len() > 1 { - for node_idx in scc { - cyclic_nodes.insert(node_idx); - } - } - } - - if cyclic_nodes.is_empty() { - return DiGraph::new(); - } - - let mut nodes_to_include = cyclic_nodes.clone(); - let mut visited = HashSet::new(); - let mut queue: Vec = cyclic_nodes.iter().copied().collect(); - - while let Some(current) = queue.pop() { - if !visited.insert(current) { - continue; - } - nodes_to_include.insert(current); - - for pred in graph.node_indices() { - if graph.find_edge(pred, current).is_some() && !visited.contains(&pred) { - queue.push(pred); - } - } - } - - let mut subgraph = DiGraph::new(); - let mut node_map = HashMap::new(); - - for &node_idx in &nodes_to_include { - let url = &graph[node_idx]; - let new_idx = subgraph.add_node(url.clone()); - node_map.insert(node_idx, new_idx); - } - - for edge in graph.edge_references() { - if let (Some(&from_new), Some(&to_new)) = - (node_map.get(&edge.source()), node_map.get(&edge.target())) - { - subgraph.add_edge(from_new, to_new, edge.weight().clone()); - } - } - - subgraph - } - - pub fn dependency_urls(&self, db: &dyn InputDb, url: &Url) -> Vec { - let node_map = self.node_map(db); - let graph = self.graph(db); - - if let Some(&root) = node_map.get(url) { - let mut dfs = Dfs::new(&graph, root); - let mut visited = Vec::new(); - while let Some(node) = dfs.next(&graph) { - if node != root { - visited.push(graph[node].clone()); - } - } - visited - } else { - Vec::new() - } - } - - pub fn direct_dependencies(&self, db: &dyn InputDb, url: &Url) -> Vec<(DependencyAlias, Url)> { - let node_map = self.node_map(db); - let graph = self.graph(db); - - let Some(&root) = node_map.get(url) else { - return Vec::new(); - }; - - graph - .edges(root) - .map(|edge| { - let (alias, _arguments) = edge.weight(); - (alias.clone(), graph[edge.target()].clone()) - }) - .collect() - } - - pub fn register_remote_checkout( - &self, - db: &mut dyn InputDb, - local_url: Url, - remote: RemoteFiles, - ) { - let mut git_map = self.git_locations(db); - git_map.insert(local_url.clone(), remote.clone()); - self.set_git_locations(db).to(git_map); - - let mut reverse = self.reverse_git_map(db); - reverse.insert(remote, local_url); - self.set_reverse_git_map(db).to(reverse); - } - - pub fn remote_git_for_local(&self, db: &dyn InputDb, local_url: &Url) -> Option { - self.git_locations(db).get(local_url).cloned() - } - - pub fn local_for_remote_git(&self, db: &dyn InputDb, remote: &RemoteFiles) -> Option { - self.reverse_git_map(db).get(remote).cloned() - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::define_input_db; - - define_input_db!(TestDatabase); - - #[test] - fn finds_ingot_by_metadata() { - let mut db = TestDatabase::default(); - let graph = DependencyGraph::default(&db); - - let url = Url::parse("file:///workspace/ingot/").unwrap(); - let version = Version::parse("0.1.0").unwrap(); - graph.register_ingot_metadata(&mut db, &url, "foo".into(), version.clone()); - - let found = graph.ingot_by_name_version(&db, &"foo".into(), &version); - assert_eq!(found, Some(url)); - } -} diff --git a/crates/common/src/dependencies/mod.rs b/crates/common/src/dependencies/mod.rs deleted file mode 100644 index 2aa4a28d08..0000000000 --- a/crates/common/src/dependencies/mod.rs +++ /dev/null @@ -1,73 +0,0 @@ -pub mod graph; -pub mod tree; - -use crate::ingot::Version; -use camino::Utf8PathBuf; -use smol_str::SmolStr; -use url::Url; - -#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] -pub struct DependencyArguments { - pub name: Option, - pub version: Option, -} - -pub type DependencyAlias = SmolStr; - -/// Metadata describing a git checkout on disk. This can later become an enum if -/// we support multiple remote transport mechanisms. -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -pub struct RemoteFiles { - pub source: Url, - pub rev: SmolStr, - pub path: Option, -} - -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -pub struct LocalFiles { - pub path: Utf8PathBuf, - pub url: Url, -} - -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -pub enum DependencyLocation { - Local(LocalFiles), - Remote(RemoteFiles), - WorkspaceCurrent, -} - -#[derive(Clone, Debug)] -pub struct Dependency { - pub alias: SmolStr, - pub location: DependencyLocation, - pub arguments: DependencyArguments, -} - -impl Dependency { - pub fn url(&self) -> &Url { - match &self.location { - DependencyLocation::Local(local) => &local.url, - DependencyLocation::Remote(remote) => &remote.source, - DependencyLocation::WorkspaceCurrent => panic!("workspace current has no URL"), - } - } -} - -#[derive(Clone, Debug)] -pub struct ExternalDependencyEdge { - pub parent: Url, - pub alias: SmolStr, - pub arguments: DependencyArguments, - pub remote: RemoteFiles, -} - -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -pub struct WorkspaceMemberRecord { - pub name: SmolStr, - pub version: Option, - pub path: Utf8PathBuf, - pub url: Url, -} - -pub use graph::DependencyGraph; -pub use tree::DependencyTree; diff --git a/crates/common/src/dependencies/tree.rs b/crates/common/src/dependencies/tree.rs deleted file mode 100644 index 32810e95b2..0000000000 --- a/crates/common/src/dependencies/tree.rs +++ /dev/null @@ -1,299 +0,0 @@ -use std::collections::{HashMap, HashSet}; - -use petgraph::graph::{DiGraph, NodeIndex}; -use petgraph::visit::EdgeRef; -use smol_str::SmolStr; -use url::Url; - -use super::{DependencyAlias, DependencyArguments}; -use crate::{ - InputDb, - color::{ColorTarget, should_colorize}, - config::{Config, IngotConfig}, - ingot::Version, -}; - -type TreeEdge = (DependencyAlias, DependencyArguments); - -pub struct DependencyTree { - root: Url, - graph: DiGraph, - configs: HashMap, - remote_edges: HashSet<(Url, Url)>, -} - -impl DependencyTree { - pub fn build(db: &dyn InputDb, root: &Url) -> Self { - let graph = db.dependency_graph().petgraph(db); - let configs = collect_configs(db, &graph); - let remote_edges = collect_remote_edges(db, &graph); - - Self::from_parts(graph, root.clone(), configs, remote_edges) - } - - pub fn from_parts( - graph: DiGraph, - root: Url, - configs: HashMap, - remote_edges: HashSet<(Url, Url)>, - ) -> Self { - Self { - root, - graph, - configs, - remote_edges, - } - } - - pub fn display(&self) -> String { - self.display_to(ColorTarget::Stdout) - } - - pub fn display_to(&self, target: ColorTarget) -> String { - display_tree( - &self.graph, - &self.root, - &self.configs, - &self.remote_edges, - should_colorize(target), - ) - } -} - -fn collect_configs(db: &dyn InputDb, graph: &DiGraph) -> HashMap { - let mut configs = HashMap::new(); - let mut workspace_versions: HashMap> = HashMap::new(); - for node_idx in graph.node_indices() { - let url = &graph[node_idx]; - if let Some(ingot) = db.workspace().containing_ingot(db, url.clone()) - && let Some(mut config) = ingot.config(db) - { - if config.metadata.version.is_none() - && let Some(workspace_url) = - db.dependency_graph().workspace_root_for_member(db, url) - { - let version = workspace_versions - .entry(workspace_url.clone()) - .or_insert_with(|| workspace_version(db, &workspace_url)); - if let Some(version) = version.clone() { - config.metadata.version = Some(version); - } - } - configs.insert(url.clone(), config); - } - } - configs -} - -fn workspace_version(db: &dyn InputDb, workspace_url: &Url) -> Option { - let config_url = workspace_url.join("fe.toml").ok()?; - let file = db.workspace().get(db, &config_url)?; - let parsed = Config::parse(file.text(db)).ok()?; - match parsed { - Config::Workspace(config) => config.workspace.version, - Config::Ingot(_) => None, - } -} - -fn collect_remote_edges(db: &dyn InputDb, graph: &DiGraph) -> HashSet<(Url, Url)> { - let mut edges = HashSet::new(); - for edge in graph.edge_references() { - let from = &graph[edge.source()]; - let to = &graph[edge.target()]; - let to_is_remote = db.dependency_graph().remote_git_for_local(db, to).is_some(); - if to_is_remote - && db - .dependency_graph() - .remote_git_for_local(db, from) - .is_none() - { - edges.insert((from.clone(), to.clone())); - } - } - edges -} - -#[derive(Clone)] -enum TreePrefix { - Root, - Fork(String), - Last(String), -} - -impl TreePrefix { - fn new_prefix(&self) -> String { - match self { - TreePrefix::Root => "".to_string(), - TreePrefix::Fork(p) => format!("{p}├── "), - TreePrefix::Last(p) => format!("{p}└── "), - } - } - - fn child_indent(&self) -> String { - match self { - TreePrefix::Root => "".to_string(), - TreePrefix::Fork(p) => format!("{p}│ "), - TreePrefix::Last(p) => format!("{p} "), - } - } -} - -fn display_tree( - graph: &DiGraph, - root_url: &Url, - configs: &HashMap, - remote_edges: &HashSet<(Url, Url)>, - colorize: bool, -) -> String { - let mut output = String::new(); - - let cycle_nodes = find_cycle_nodes(graph); - - if let Some(root_idx) = graph.node_indices().find(|i| graph[*i] == *root_url) { - let context = TreeContext { - graph, - configs, - cycle_nodes: &cycle_nodes, - remote_edges, - colorize, - }; - let mut seen = HashSet::new(); - print_node_with_alias( - &context, - root_idx, - TreePrefix::Root, - &mut output, - &mut seen, - None, - None, - ); - } else { - output.push_str("[error: root node not found]\n"); - } - - output -} - -struct TreeContext<'a> { - graph: &'a DiGraph, - configs: &'a HashMap, - cycle_nodes: &'a HashSet, - remote_edges: &'a HashSet<(Url, Url)>, - colorize: bool, -} - -fn print_node_with_alias( - context: &TreeContext, - node: NodeIndex, - prefix: TreePrefix, - output: &mut String, - seen: &mut HashSet, - alias: Option<&str>, - parent_url: Option<&Url>, -) { - let ingot_path = &context.graph[node]; - - // Build the label with alias support (no leading marker; remote marker is appended for local→remote edges) - let base_label = if let Some(config) = context.configs.get(ingot_path) { - let ingot_name = config.metadata.name.as_deref().unwrap_or("null"); - let version = config - .metadata - .version - .as_ref() - .map(ToString::to_string) - .unwrap_or_else(|| "null".to_string()); - - // Show "ingot_name as alias" if alias differs from ingot name - match alias { - Some(alias_str) if alias_str != ingot_name => { - format!("{ingot_name} as {alias_str} v{version}") - } - _ => format!("{ingot_name} v{version}"), - } - } else { - "[invalid fe.toml]".to_string() - }; - - let is_in_cycle = context.cycle_nodes.contains(&node); - let will_close_cycle = seen.contains(&node); - - let is_remote_edge = parent_url - .map(|parent| { - context - .remote_edges - .contains(&(parent.clone(), ingot_path.clone())) - }) - .unwrap_or(false); - - let mut label = base_label; - - if will_close_cycle { - label = format!("{label} [cycle]"); - } - - if is_remote_edge { - label = format!("{label} [remote]"); - } - - if is_in_cycle && context.colorize { - output.push_str(&format!("{}{}\n", prefix.new_prefix(), red(label))); - } else { - output.push_str(&format!("{}{}\n", prefix.new_prefix(), label)); - } - - if will_close_cycle { - return; - } - - seen.insert(node); - - // Process children with alias information from edges - let children: Vec<_> = context - .graph - .edges_directed(node, petgraph::Direction::Outgoing) - .collect(); - - for (i, edge) in children.iter().enumerate() { - let child_prefix = if i == children.len() - 1 { - TreePrefix::Last(prefix.child_indent()) - } else { - TreePrefix::Fork(prefix.child_indent()) - }; - - print_node_with_alias( - context, - edge.target(), - child_prefix, - output, - seen, - Some(&edge.weight().0), - Some(ingot_path), - ); - } - - seen.remove(&node); -} - -fn red(s: String) -> String { - format!("\x1b[31m{s}\x1b[0m") -} - -fn find_cycle_nodes(graph: &DiGraph) -> HashSet { - use petgraph::algo::kosaraju_scc; - - let mut cycles = HashSet::new(); - for scc in kosaraju_scc(graph) { - if scc.len() > 1 { - cycles.extend(scc); - } else { - let node = scc[0]; - if graph - .neighbors_directed(node, petgraph::Direction::Outgoing) - .any(|n| n == node) - { - cycles.insert(node); // self-loop - } - } - } - cycles -} diff --git a/crates/common/src/diagnostics.rs b/crates/common/src/diagnostics.rs deleted file mode 100644 index 0a30cd359e..0000000000 --- a/crates/common/src/diagnostics.rs +++ /dev/null @@ -1,233 +0,0 @@ -use std::fmt; - -use parser::TextRange; - -use crate::file::File; - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct CompleteDiagnostic { - pub severity: Severity, - pub message: String, - pub sub_diagnostics: Vec, - pub notes: Vec, - pub error_code: GlobalErrorCode, -} - -impl CompleteDiagnostic { - pub fn new( - severity: Severity, - message: String, - sub_diagnostics: Vec, - notes: Vec, - error_code: GlobalErrorCode, - ) -> Self { - Self { - severity, - message, - sub_diagnostics, - notes, - error_code, - } - } - - pub fn primary_span(&self) -> Option { - let span = self - .sub_diagnostics - .iter() - .find_map(|sub| sub.is_primary().then(|| sub.span.clone()).flatten()) - .or_else(|| self.sub_diagnostics.iter().find_map(|sub| sub.span.clone())); - - debug_assert!( - span.is_some(), - "spanless diagnostic ({}): {}", - self.error_code, - self.message - ); - - span - } -} - -pub fn cmp_complete_diagnostics( - lhs: &CompleteDiagnostic, - rhs: &CompleteDiagnostic, -) -> std::cmp::Ordering { - match lhs.error_code.cmp(&rhs.error_code) { - std::cmp::Ordering::Equal => { - let lhs_span = lhs.primary_span(); - let rhs_span = rhs.primary_span(); - match (lhs_span, rhs_span) { - (Some(lhs_span), Some(rhs_span)) => lhs_span.cmp(&rhs_span), - (Some(_), None) => std::cmp::Ordering::Less, - (None, Some(_)) => std::cmp::Ordering::Greater, - (None, None) => std::cmp::Ordering::Equal, - } - } - ord => ord, - } -} - -pub fn trim_trailing_line_whitespace(text: &str) -> String { - let mut result = String::with_capacity(text.len()); - for line in text.split_inclusive('\n') { - if let Some(line) = line.strip_suffix('\n') { - result.push_str(line.trim_end_matches([' ', '\t'])); - result.push('\n'); - } else { - result.push_str(line.trim_end_matches([' ', '\t'])); - } - } - result -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct GlobalErrorCode { - pub pass: DiagnosticPass, - pub local_code: u16, -} - -impl GlobalErrorCode { - pub fn new(pass: DiagnosticPass, local_code: u16) -> Self { - Self { pass, local_code } - } -} - -impl fmt::Display for GlobalErrorCode { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}-{:04}", self.pass.code(), self.local_code) - } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SubDiagnostic { - pub style: LabelStyle, - pub message: String, - pub span: Option, -} - -impl SubDiagnostic { - pub fn new(style: LabelStyle, message: String, span: Option) -> Self { - Self { - style, - message, - span, - } - } - - pub fn is_primary(&self) -> bool { - matches!(self.style, LabelStyle::Primary) - } -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] -pub enum LabelStyle { - Primary, - Secondary, -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Span { - pub file: File, - pub range: TextRange, - pub kind: SpanKind, -} - -impl PartialOrd for Span { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl Ord for Span { - fn cmp(&self, other: &Self) -> std::cmp::Ordering { - match self.file.cmp(&other.file) { - std::cmp::Ordering::Equal => self.range.start().cmp(&other.range.start()), - ord => ord, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum SpanKind { - /// A node corresponding is originally written in the source code. - Original, - - /// A node corresponding to the span is generated by macro expansion. - Expanded, - - /// No span information was found. - /// This happens if analysis code tries to get a span for a node that is - /// generated in lowering phase. - /// - /// If span has this kind, it means there is a bug in the analysis code. - /// The reason not to panic is that LSP should continue working even if - /// there are bugs in the span generation(This also makes easier to identify - /// the cause of the bug) - /// - /// Range is always the first character of the file in this case. - NotFound, -} - -impl Span { - pub fn new(file: File, range: TextRange, kind: SpanKind) -> Self { - Self { file, range, kind } - } -} - -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Severity { - Error, - Warning, - Note, -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub enum DiagnosticPass { - Parse, - MsgLower, - EventLower, - ErrorLower, - AttrMisuse, - - NameResolution, - - TypeDefinition, - TraitDefinition, - ImplTraitDefinition, - TraitSatisfaction, - MethodDefinition, - TyCheck, - - Mir, - SemanticBorrowck, - - ExternalAnalysis(ExternalAnalysisKey), -} - -impl DiagnosticPass { - pub fn code(&self) -> u16 { - match self { - Self::Parse => 1, - Self::MsgLower => 9, - Self::EventLower => 10, - Self::ErrorLower => 16, - Self::AttrMisuse => 12, - Self::NameResolution => 2, - Self::TypeDefinition => 3, - Self::TraitDefinition => 4, - Self::ImplTraitDefinition => 5, - Self::TraitSatisfaction => 6, - Self::MethodDefinition => 7, - Self::TyCheck => 8, - Self::Mir => 11, - Self::SemanticBorrowck => 16, - - Self::ExternalAnalysis(_) => u16::MAX, - } - } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct ExternalAnalysisKey { - name: String, -} diff --git a/crates/common/src/file/mod.rs b/crates/common/src/file/mod.rs deleted file mode 100644 index 1c639e9d1e..0000000000 --- a/crates/common/src/file/mod.rs +++ /dev/null @@ -1,55 +0,0 @@ -pub mod workspace; - -use camino::Utf8PathBuf; -use url::Url; -pub use workspace::Workspace; - -use crate::{InputDb, ingot::Ingot}; - -#[salsa::input(constructor = __new_impl)] -#[derive(Debug)] -pub struct File { - #[return_ref] - pub text: String, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum IngotFileKind { - /// A source file containing Fe code. - Source, - - /// A configuration file for the ingot. - Config, -} - -#[salsa::tracked] -impl File { - #[salsa::tracked] - pub fn containing_ingot(self, db: &dyn InputDb) -> Option> { - self.url(db) - .and_then(|url| db.workspace().containing_ingot(db, url)) - } - - #[salsa::tracked(return_ref)] - pub fn path(self, db: &dyn InputDb) -> Option { - self.containing_ingot(db) - .and_then(|ingot| db.workspace().get_relative_path(db, ingot.base(db), self)) - } - - #[salsa::tracked] - pub fn kind(self, db: &dyn InputDb) -> Option { - self.path(db).as_ref().and_then(|path| { - if path.as_str().ends_with(".fe") { - Some(IngotFileKind::Source) - } else if path.as_str().ends_with("fe.toml") { - Some(IngotFileKind::Config) - } else { - None - } - }) - } - - pub fn url(self, db: &dyn InputDb) -> Option { - db.workspace().get_path(db, self) - } -} diff --git a/crates/common/src/file/workspace.rs b/crates/common/src/file/workspace.rs deleted file mode 100644 index f9b4e7b902..0000000000 --- a/crates/common/src/file/workspace.rs +++ /dev/null @@ -1,169 +0,0 @@ -use camino::Utf8PathBuf; -use radix_immutable::{StringPrefixView, StringTrie, Trie}; -use salsa::Setter; -use url::Url; - -use crate::{InputDb, file::File, indexmap::ArcIndexMap}; - -#[derive(Debug)] -pub enum InputIndexError { - CannotReuseInput, -} - -#[salsa::input] -#[derive(Debug)] -pub struct Workspace { - files: StringTrie, - paths: ArcIndexMap, -} - -#[salsa::tracked] -impl Workspace { - pub fn default(db: &dyn InputDb) -> Self { - Workspace::new(db, Trie::new(), ArcIndexMap::default()) - } - pub(crate) fn set( - &self, - db: &mut dyn InputDb, - url: Url, - file: File, - ) -> Result { - let paths = self.paths(db); - if let Some(existing_url) = paths.get(&file) - && existing_url != &url - { - return Err(InputIndexError::CannotReuseInput); - } - - let files = self.files(db); - self.set_files(db).to(files.insert(url.clone(), file)); - let mut paths = self.paths(db); - paths.insert(file, url); - self.set_paths(db).to(paths); - Ok(file) - } - - pub fn get(&self, db: &dyn InputDb, url: &Url) -> Option { - self.files(db).get(url).cloned() - } - - pub fn remove(&self, db: &mut dyn InputDb, url: &Url) -> Option { - if let Some(_file) = self.files(db).get(url) { - let files = self.files(db); - if let (files, Some(file)) = files.remove(url) { - self.set_files(db).to(files); - let mut paths = self.paths(db); - paths.remove(&file); - self.set_paths(db).to(paths); - Some(file) - } else { - None - } - } else { - None - } - } - - #[salsa::tracked] - pub fn items_at_base(self, db: &dyn InputDb, base: Url) -> StringPrefixView { - self.files(db).view_subtrie(base) - } - - pub fn get_path(&self, db: &dyn InputDb, file: File) -> Option { - self.paths(db).get(&file).cloned() - } - - #[salsa::tracked] - pub fn get_relative_path(self, db: &dyn InputDb, base: Url, file: File) -> Option { - let file_url = match self.paths(db).get(&file) { - Some(url) => url.clone(), - None => return None, - }; - base.make_relative(&file_url).map(Utf8PathBuf::from) - } - - pub fn touch(&self, db: &mut dyn InputDb, url: Url, initial_content: Option) -> File { - // Check if the file already exists - if let Some(file) = self.get(db, &url) { - return file; - } - let initial = initial_content.unwrap_or_default(); - - let input_file = File::__new_impl(db, initial); - self.set(db, url, input_file) - .expect("Failed to create file") - } - - pub fn update(&self, db: &mut dyn InputDb, url: Url, content: String) -> File { - let file = self.touch(db, url, None); - file.set_text(db).to(content); - file - } - - pub fn all_files(&self, db: &dyn InputDb) -> StringTrie { - self.files(db) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - use crate::define_input_db; - - define_input_db!(TestDatabase); - - #[test] - fn test_input_index_basic() { - let mut db = TestDatabase::default(); - let index = db.workspace(); - - // Create a file and add it to the index - let file = File::__new_impl(&db, "test content".to_string()); - let url = Url::parse("file:///test.fe").unwrap(); - - index - .set(&mut db, url.clone(), file) - .expect("Failed to set file"); - - // Test we can look up the file - let retrieved_file = index.get(&db, &url); - assert!(retrieved_file.is_some()); - assert_eq!(retrieved_file.unwrap(), file); - - // Test removal - let removed_file = index.remove(&mut db, &url); - assert!(removed_file.is_some()); - assert_eq!(removed_file.unwrap(), file); - - // Verify it's gone - let retrieved_file = index.get(&db, &url); - assert!(retrieved_file.is_none()); - } - - #[test] - fn test_input_index_path() { - let mut db = TestDatabase::default(); - let index = db.workspace(); - - // Create a file and add it to the index - let file = File::__new_impl(&db, "test content".to_string()); - let url = Url::parse("file:///test.fe").unwrap(); - - index - .set(&mut db, url.clone(), file) - .expect("Failed to set file"); - - // Test we can look up the path - let path = index.get_path(&db, file); - assert!(path.is_some()); - assert_eq!(path.unwrap(), url); - - // Test we can look up a cloned file's path - #[allow(clippy::clone_on_copy)] - let cloned_file = file.clone(); - let path = index.get_path(&db, cloned_file); - assert!(path.is_some()); - assert_eq!(path.unwrap(), url); - } -} diff --git a/crates/common/src/indexmap.rs b/crates/common/src/indexmap.rs deleted file mode 100644 index 0abaa1494a..0000000000 --- a/crates/common/src/indexmap.rs +++ /dev/null @@ -1,293 +0,0 @@ -use std::{ - hash::Hash, - ops::{Deref, DerefMut}, -}; - -use rustc_hash::FxBuildHasher; -use salsa::Update; - -type OrderMap = ordermap::OrderMap; -type OrderSet = ordermap::OrderSet; - -#[derive(Debug, Clone, Hash, PartialEq, Eq)] -pub struct IndexMap(OrderMap); - -impl IndexMap { - pub fn new() -> Self { - Self(OrderMap::default()) - } - - pub fn with_capacity(n: usize) -> Self { - Self(OrderMap::with_capacity_and_hasher(n, FxBuildHasher {})) - } -} - -impl Default for IndexMap { - fn default() -> Self { - Self::new() - } -} - -impl IntoIterator for IndexMap { - type Item = as IntoIterator>::Item; - type IntoIter = as IntoIterator>::IntoIter; - fn into_iter(self) -> Self::IntoIter { - self.0.into_iter() - } -} - -impl<'a, K, V> IntoIterator for &'a IndexMap { - type Item = <&'a OrderMap as IntoIterator>::Item; - type IntoIter = <&'a OrderMap as IntoIterator>::IntoIter; - fn into_iter(self) -> Self::IntoIter { - (&self.0).into_iter() - } -} - -impl<'a, K, V> IntoIterator for &'a mut IndexMap { - type Item = <&'a mut OrderMap as IntoIterator>::Item; - type IntoIter = <&'a mut OrderMap as IntoIterator>::IntoIter; - fn into_iter(self) -> Self::IntoIter { - (&mut self.0).into_iter() - } -} - -impl FromIterator<(K, V)> for IndexMap -where - K: Hash + Eq, -{ - fn from_iter>(iter: T) -> Self { - Self(OrderMap::from_iter(iter)) - } -} - -impl Deref for IndexMap { - type Target = OrderMap; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for IndexMap { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -/// Arc-wrapped IndexMap for use as a salsa input field. -/// Clone is O(1) (Arc refcount bump). Mutations use Arc::make_mut. -#[derive(Debug, Clone)] -pub struct ArcIndexMap(pub std::sync::Arc>); - -impl ArcIndexMap { - pub fn new() -> Self { - Self(std::sync::Arc::new(IndexMap::new())) - } - - pub fn get(&self, key: &Q) -> Option<&V> - where - K: std::borrow::Borrow + Eq + Hash, - Q: Eq + Hash + ?Sized, - { - self.0.get(key) - } - - pub fn insert(&mut self, key: K, value: V) - where - K: Eq + Hash + Clone, - V: Clone, - { - std::sync::Arc::make_mut(&mut self.0).insert(key, value); - } - - pub fn remove(&mut self, key: &Q) - where - K: std::borrow::Borrow + Eq + Hash + Clone, - V: Clone, - Q: Eq + Hash + ?Sized, - { - std::sync::Arc::make_mut(&mut self.0).remove(key); - } -} - -impl Default for ArcIndexMap { - fn default() -> Self { - Self::new() - } -} - -impl PartialEq for ArcIndexMap -where - K: Eq + Hash, - V: PartialEq, -{ - fn eq(&self, other: &Self) -> bool { - std::sync::Arc::ptr_eq(&self.0, &other.0) || *self.0 == *other.0 - } -} - -impl Eq for ArcIndexMap -where - K: Eq + Hash, - V: Eq, -{ -} - -impl Hash for ArcIndexMap -where - K: Hash + Eq, - V: Hash, -{ - fn hash(&self, state: &mut H) { - for (k, v) in self.0.as_ref() { - k.hash(state); - v.hash(state); - } - } -} - -unsafe impl Update for ArcIndexMap -where - K: Eq + Hash + Clone, - V: Clone + PartialEq, -{ - unsafe fn maybe_update(old_pointer: *mut Self, new_value: Self) -> bool { - let old = unsafe { &mut *old_pointer }; - if std::sync::Arc::ptr_eq(&old.0, &new_value.0) { - return false; - } - if *old.0 == *new_value.0 { - return false; - } - *old = new_value; - true - } -} - -unsafe impl Update for IndexMap -where - K: Update + Eq + Hash, - V: Update, -{ - unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool { - unsafe { - let old_map = &mut *old_pointer; - - // Check if the keys in both maps are the same w.r.t the key order. - let is_key_same = old_map.len() == new_map.len() - && old_map - .keys() - .zip(new_map.keys()) - .all(|(old, new)| old == new); - - // If the keys are different, update entire map. - if !is_key_same { - old_map.clear(); - old_map.0.extend(new_map.0); - return true; - } - - // Update values if it's different. - let mut changed = false; - for (i, new_value) in new_map.0.into_values().enumerate() { - let old_value = &mut old_map[i]; - changed |= V::maybe_update(old_value, new_value); - } - - changed - } - } -} - -#[derive(Debug, Clone)] -pub struct IndexSet(OrderSet); - -impl IndexSet { - pub fn new() -> Self { - Self(OrderSet::default()) - } - - pub fn with_capacity(n: usize) -> Self { - Self(OrderSet::with_capacity_and_hasher(n, FxBuildHasher {})) - } -} - -impl Default for IndexSet { - fn default() -> Self { - Self::new() - } -} - -impl IntoIterator for IndexSet { - type Item = as IntoIterator>::Item; - type IntoIter = as IntoIterator>::IntoIter; - fn into_iter(self) -> Self::IntoIter { - self.0.into_iter() - } -} - -impl<'a, V> IntoIterator for &'a IndexSet { - type Item = <&'a OrderSet as IntoIterator>::Item; - type IntoIter = <&'a OrderSet as IntoIterator>::IntoIter; - fn into_iter(self) -> Self::IntoIter { - (&self.0).into_iter() - } -} - -impl PartialEq for IndexSet -where - V: Hash + Eq, -{ - fn eq(&self, other: &Self) -> bool { - self.0.eq(&other.0) - } -} - -impl Eq for IndexSet where V: Eq + Hash {} - -impl Hash for IndexSet -where - V: Hash + Eq, -{ - fn hash(&self, state: &mut H) { - self.0.hash(state); - } -} - -impl FromIterator for IndexSet -where - V: Hash + Eq, -{ - fn from_iter>(iter: T) -> Self { - Self(OrderSet::from_iter(iter)) - } -} - -impl Deref for IndexSet { - type Target = OrderSet; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for IndexSet { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -unsafe impl Update for IndexSet -where - V: Update + Eq + Hash, -{ - unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool { - let old_set = unsafe { &mut *old_pointer }; - if old_set == &new_set { - false - } else { - old_set.clear(); - old_set.0.extend(new_set.0); - true - } - } -} diff --git a/crates/common/src/ingot.rs b/crates/common/src/ingot.rs deleted file mode 100644 index 1b63d19a14..0000000000 --- a/crates/common/src/ingot.rs +++ /dev/null @@ -1,647 +0,0 @@ -use core::panic; - -use camino::Utf8PathBuf; -pub use radix_immutable::StringPrefixView; -use smol_str::SmolStr; -use url::Url; - -use crate::{ - InputDb, - config::{ArithmeticMode, Config, IngotConfig, WorkspaceConfig, resolve_arithmetic_mode}, - dependencies::DependencyLocation, - file::{File, Workspace}, - stdlib::{BUILTIN_CORE_BASE_URL, BUILTIN_STD_BASE_URL}, - urlext::UrlExt, -}; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum IngotKind { - /// A standalone ingot is a dummy ingot when the compiler is invoked - /// directly on a file. - StandAlone, - - /// A local ingot which is the current ingot being compiled. - Local, - - /// An external ingot which is depended on by the current ingot. - External, - - /// Core library ingot. - Core, - - /// Standard library ingot. - Std, -} - -pub trait IngotBaseUrl { - fn touch( - &self, - db: &mut dyn InputDb, - path: Utf8PathBuf, - initial_content: Option, - ) -> File; - fn ingot<'db>(&self, db: &'db dyn InputDb) -> Option>; -} - -impl IngotBaseUrl for Url { - fn touch( - &self, - db: &mut dyn InputDb, - relative_path: Utf8PathBuf, - initial_content: Option, - ) -> File { - if relative_path.is_absolute() { - panic!("Expected relative path, got absolute path: {relative_path}"); - } - let path = self - .directory() - .expect("failed to parse directory") - .join(relative_path.as_str()) - .expect("failed to parse path"); - db.workspace().touch(db, path, initial_content) - } - fn ingot<'db>(&self, db: &'db dyn InputDb) -> Option> { - db.workspace().containing_ingot(db, self.clone()) - } -} - -#[salsa::interned] -#[derive(Debug)] -pub struct Ingot<'db> { - pub base: Url, - pub standalone_file: Option, - pub kind: IngotKind, -} - -#[derive(Debug)] -pub enum IngotError { - RootFileNotFound, -} - -#[salsa::tracked] -impl<'db> Ingot<'db> { - pub fn root_file(&self, db: &dyn InputDb) -> Result { - if let Some(root_file) = self.standalone_file(db) { - Ok(root_file) - } else { - let path = self - .base(db) - .join("src/lib.fe") - .expect("failed to join path"); - db.workspace() - .get(db, &path) - .ok_or(IngotError::RootFileNotFound) - } - } - - #[salsa::tracked] - pub fn files(self, db: &'db dyn InputDb) -> StringPrefixView { - if let Some(standalone_file) = self.standalone_file(db) { - // For standalone ingots, use the standalone file URL as the base - db.workspace().items_at_base( - db, - standalone_file - .url(db) - .expect("file should be registered in the index"), - ) - } else { - // For regular ingots, use the ingot base URL - db.workspace().items_at_base(db, self.base(db)) - } - } - - #[salsa::tracked] - pub fn config_file(self, db: &'db dyn InputDb) -> Option { - db.workspace().containing_ingot_config(db, self.base(db)) - } - - #[salsa::tracked] - fn parse_config(self, db: &'db dyn InputDb) -> Option> { - self.config_file(db) - .map(|config_file| Config::parse(config_file.text(db))) - .map(|result| { - result.and_then(|config_file| match config_file { - Config::Ingot(config) => Ok(config), - Config::Workspace(_) => { - Err("Expected an ingot config but found a workspace config".to_string()) - } - }) - }) - } - - #[salsa::tracked] - pub fn config(self, db: &'db dyn InputDb) -> Option { - self.parse_config(db).and_then(|result| result.ok()) - } - - #[salsa::tracked] - pub fn config_parse_error(self, db: &'db dyn InputDb) -> Option { - self.parse_config(db).and_then(|result| result.err()) - } - - #[salsa::tracked] - pub fn workspace_root(self, db: &'db dyn InputDb) -> Option { - db.dependency_graph() - .workspace_root_for_member(db, &self.base(db)) - } - - #[salsa::tracked] - pub fn workspace_config_file(self, db: &'db dyn InputDb) -> Option { - let workspace_root = self.workspace_root(db)?; - let config_url = workspace_root.join("fe.toml").ok()?; - db.workspace().get(db, &config_url) - } - - #[salsa::tracked] - fn parse_workspace_config( - self, - db: &'db dyn InputDb, - ) -> Option> { - self.workspace_config_file(db) - .map(|config_file| Config::parse(config_file.text(db))) - .map(|result| { - result.and_then(|config_file| match config_file { - Config::Workspace(config) => Ok(*config), - Config::Ingot(_) => { - Err("Expected a workspace config but found an ingot config".to_string()) - } - }) - }) - } - - #[salsa::tracked] - pub fn workspace_config(self, db: &'db dyn InputDb) -> Option { - self.parse_workspace_config(db) - .and_then(|result| result.ok()) - } - - #[salsa::tracked] - pub fn arithmetic_mode(self, db: &'db dyn InputDb) -> Option { - if let Some(mode) = db - .dependency_graph() - .forced_dependency_arithmetic_for(db, &self.base(db)) - { - return Some(mode); - } - let profile = db.compilation_settings().profile(db); - resolve_arithmetic_mode( - self.config(db).as_ref(), - self.workspace_config(db).as_ref(), - profile.as_str(), - ) - } - - #[salsa::tracked] - pub fn version(self, db: &'db dyn InputDb) -> Option { - self.config(db).and_then(|config| config.metadata.version) - } - - #[salsa::tracked] - pub fn dependencies(self, db: &'db dyn InputDb) -> Vec<(SmolStr, Url)> { - let kind = self.kind(db); - let base_url = self.base(db); - let skip_config = matches!((kind, base_url.scheme()), (IngotKind::Std, "builtin-std")); - - let mut deps = if skip_config { - Vec::new() - } else { - let graph_deps = db - .dependency_graph() - .direct_dependencies(db, &base_url) - .into_iter() - .collect::>(); - - if !graph_deps.is_empty() { - graph_deps - } else { - match self.config(db) { - Some(config) => { - let (dependencies, _) = config.dependencies(&base_url); - dependencies - .into_iter() - .filter_map(|dependency| { - let url = match &dependency.location { - DependencyLocation::Remote(remote) => db - .dependency_graph() - .local_for_remote_git(db, remote) - .unwrap_or_else(|| remote.source.clone()), - DependencyLocation::Local(local) => local.url.clone(), - DependencyLocation::WorkspaceCurrent => { - let name = dependency.arguments.name.clone()?; - let workspace_root = db - .dependency_graph() - .workspace_root_for_member(db, &base_url)?; - let candidates = db - .dependency_graph() - .workspace_members_by_name(db, &workspace_root, &name); - let selected = - if let Some(version) = &dependency.arguments.version { - candidates.iter().find(|member| { - member.version.as_ref() == Some(version) - }) - } else if candidates.len() == 1 { - candidates.first() - } else { - None - }; - let member = selected?; - member.url.clone() - } - }; - Some((dependency.alias.clone(), url)) - }) - .collect() - } - None => vec![], - } - } - }; - - let workspace_member_url = |name: &str| -> Option { - let workspace_root = db - .dependency_graph() - .workspace_root_for_member(db, &base_url)?; - let name = SmolStr::new(name); - db.dependency_graph() - .workspace_members_by_name(db, &workspace_root, &name) - .first() - .map(|member| member.url.clone()) - }; - - let core_url = workspace_member_url("core").unwrap_or_else(|| { - Url::parse(BUILTIN_CORE_BASE_URL).expect("couldn't parse core ingot URL") - }); - let std_url = workspace_member_url("std").unwrap_or_else(|| { - Url::parse(BUILTIN_STD_BASE_URL).expect("couldn't parse std ingot URL") - }); - - if kind != IngotKind::Core && !deps.iter().any(|(alias, _)| alias == "core") { - deps.push(("core".into(), core_url)); - } - if !matches!(kind, IngotKind::Core | IngotKind::Std) - && !deps.iter().any(|(alias, _)| alias == "std") - { - deps.push(("std".into(), std_url)); - } - - deps - } -} - -pub type Version = serde_semver::semver::Version; - -#[salsa::tracked] -impl Workspace { - /// Recursively search for a local ingot configuration file - #[salsa::tracked] - pub fn containing_ingot_config(self, db: &dyn InputDb, file: Url) -> Option { - tracing::debug!(target: "ingot_config", "containing_ingot_config called with file: {}", file); - let dir = match file.directory() { - Some(d) => d, - None => { - tracing::debug!(target: "ingot_config", "Could not get directory for: {}", file); - return None; - } - }; - tracing::debug!(target: "ingot_config", "Search directory: {}", dir); - - let config_url = match dir.join("fe.toml") { - Ok(url) => url, - Err(_) => { - tracing::debug!(target: "ingot_config", "Could not join 'fe.toml' to dir: {}", dir); - return None; - } - }; - tracing::debug!(target: "ingot_config", "Looking for config file at: {}", config_url); - - if let Some(file_obj) = self.get(db, &config_url) { - tracing::debug!(target: "ingot_config", "Found config file in index: {}", config_url); - Some(file_obj) - } else { - tracing::debug!(target: "ingot_config", "Config file NOT found in index: {}. Checking parent.", config_url); - if let Some(parent_dir_url) = dir.parent() { - tracing::debug!(target: "ingot_config", "Recursively calling containing_ingot_config for parent: {}", parent_dir_url); - self.containing_ingot_config(db, parent_dir_url) - } else { - tracing::debug!(target: "ingot_config", "No parent directory for {}, stopping search.", dir); - None - } - } - } - - #[salsa::tracked] - pub fn containing_ingot(self, db: &dyn InputDb, location: Url) -> Option> { - // Try to find a config file to determine if this is part of a structured ingot - if let Some(config_file) = db.workspace().containing_ingot_config(db, location.clone()) { - // Extract base URL from config file location - let base_url = config_file - .url(db) - .expect("Config file should be indexed") - .directory() - .expect("Config URL should have a directory"); - - let mut kind = match base_url.scheme() { - "builtin-core" => IngotKind::Core, - "builtin-std" => IngotKind::Std, - _ => IngotKind::Local, - }; - if kind == IngotKind::Local - && let Ok(Config::Ingot(config)) = Config::parse(config_file.text(db)) - { - match config.metadata.name.as_deref() { - Some("core") => kind = IngotKind::Core, - Some("std") => kind = IngotKind::Std, - _ => {} - } - } - - // Check that the file is actually under the ingot's source tree. - // A file like `crates/language-server/test_files/goto.fe` shouldn't - // be claimed by a `fe.toml` at the repo root if it's not under `src/`. - let src_prefix = base_url - .join("src/") - .expect("failed to join src/ to base URL"); - let is_under_src = location.as_str().starts_with(src_prefix.as_str()); - let is_at_root = location - .directory() - .is_some_and(|dir| dir.as_str() == base_url.as_str()); - - if is_under_src || is_at_root { - return Some(Ingot::new(db, base_url.clone(), None, kind)); - } - - tracing::debug!( - "File {} is not under ingot src/ at {}; treating as standalone", - location, - base_url, - ); - } - - // Make a standalone ingot if no config is found (or config's ingot has no root) - let base = location.directory().unwrap_or_else(|| location.clone()); - let specific_root_file = if location.path().ends_with(".fe") { - db.workspace().get(db, &location) - } else { - None - }; - Some(Ingot::new( - db, - base, - specific_root_file, - IngotKind::StandAlone, - )) - } - - pub fn touch_ingot<'db>( - self, - db: &'db mut dyn InputDb, - base_url: &Url, - config_content: Option, - ) -> Option> { - let base_dir = base_url - .directory() - .expect("Base URL should have a directory"); - let config_file = base_dir - .join("fe.toml") - .expect("Config file should be indexed"); - let config = self.touch(db, config_file, config_content); - - config.containing_ingot(db) - } -} - -#[cfg(test)] -mod tests { - use crate::file::File; - - use super::*; - - use crate::define_input_db; - - define_input_db!(TestDatabase); - - #[test] - fn test_locate_config() { - let mut db = TestDatabase::default(); - let index = db.workspace(); - - // Create our test files - a library file, a config file, and a standalone file - let url_lib = Url::parse("file:///foo/src/lib.fe").unwrap(); - let lib = File::__new_impl(&db, "lib".to_string()); - - let url_config = Url::parse("file:///foo/fe.toml").unwrap(); - let config = File::__new_impl(&db, "config".to_string()); - - let url_standalone = Url::parse("file:///bar/standalone.fe").unwrap(); - let standalone = File::__new_impl(&db, "standalone".to_string()); - - // Add the files to the index - index - .set(&mut db, url_lib.clone(), lib) - .expect("Failed to set lib file"); - index - .set(&mut db, url_config.clone(), config) - .expect("Failed to set config file"); - index - .set(&mut db, url_standalone.clone(), standalone) - .expect("Failed to set standalone file"); - - // Test recursive search: lib.fe is in /foo/src/ but config is in /foo/ - // This tests that we correctly search up the directory tree - let found_config = index.containing_ingot_config(&db, url_lib); - assert!(found_config.is_some()); - assert_eq!(found_config.and_then(|c| c.url(&db)).unwrap(), url_config); - - // Test that standalone file without a config returns None - let no_config = index.containing_ingot_config(&db, url_standalone); - assert!(no_config.is_none()); - } - - #[test] - fn test_same_ingot_for_nested_paths() { - let mut db = TestDatabase::default(); - let index = db.workspace(); - - // Create an ingot structure - let url_config = Url::parse("file:///project/fe.toml").unwrap(); - let config = File::__new_impl(&db, "[ingot]\nname = \"test\"".to_string()); - - let url_lib = Url::parse("file:///project/src/lib.fe").unwrap(); - let lib = File::__new_impl(&db, "pub fn main() {}".to_string()); - - let url_mod = Url::parse("file:///project/src/module.fe").unwrap(); - let module = File::__new_impl(&db, "pub fn helper() {}".to_string()); - - let url_nested = Url::parse("file:///project/src/nested/deep.fe").unwrap(); - let nested = File::__new_impl(&db, "pub fn deep_fn() {}".to_string()); - - // Add all files to the index - index - .set(&mut db, url_config.clone(), config) - .expect("Failed to set config file"); - index - .set(&mut db, url_lib.clone(), lib) - .expect("Failed to set lib file"); - index - .set(&mut db, url_mod.clone(), module) - .expect("Failed to set module file"); - index - .set(&mut db, url_nested.clone(), nested) - .expect("Failed to set nested file"); - - // Get ingots for different files in the same project - let ingot_lib = index.containing_ingot(&db, url_lib); - let ingot_mod = index.containing_ingot(&db, url_mod); - let ingot_nested = index.containing_ingot(&db, url_nested); - - // All should return Some - assert!(ingot_lib.is_some()); - assert!(ingot_mod.is_some()); - assert!(ingot_nested.is_some()); - - let ingot_lib = ingot_lib.unwrap(); - let ingot_mod = ingot_mod.unwrap(); - let ingot_nested = ingot_nested.unwrap(); - - // Critical test: All files in the same logical ingot should return the SAME Salsa instance - // This ensures we don't have infinite loops due to different ingot IDs - assert_eq!( - ingot_lib, ingot_mod, - "lib.fe and module.fe should have the same ingot" - ); - assert_eq!( - ingot_lib, ingot_nested, - "lib.fe and nested/deep.fe should have the same ingot" - ); - assert_eq!( - ingot_mod, ingot_nested, - "module.fe and nested/deep.fe should have the same ingot" - ); - - // Verify they all have the same base URL - assert_eq!(ingot_lib.base(&db), ingot_mod.base(&db)); - assert_eq!(ingot_lib.base(&db), ingot_nested.base(&db)); - - let expected_base = Url::parse("file:///project/").unwrap(); - assert_eq!(ingot_lib.base(&db), expected_base); - } - - #[test] - fn test_ingot_files_updates_when_new_files_added() { - let mut db = TestDatabase::default(); - let index = db.workspace(); - - // Create initial files for an ingot - let config_url = Url::parse("file:///project/fe.toml").unwrap(); - let config_file = File::__new_impl(&db, "[ingot]\nname = \"test\"".to_string()); - - let lib_url = Url::parse("file:///project/src/lib.fe").unwrap(); - let lib_file = File::__new_impl(&db, "pub use S".to_string()); - - // Add initial files to the index - index - .set(&mut db, config_url.clone(), config_file) - .expect("Failed to set config file"); - index - .set(&mut db, lib_url.clone(), lib_file) - .expect("Failed to set lib file"); - - // Get the ingot and its initial files, then drop the reference - let initial_count = { - let ingot = index - .containing_ingot(&db, lib_url.clone()) - .expect("Should find ingot"); - let initial_files = ingot.files(&db); - initial_files.iter().count() - }; - - // Should have 2 files initially (config + lib) - assert_eq!(initial_count, 2, "Should have 2 initial files"); - - // Add a new source file to the same ingot - let mod_url = Url::parse("file:///project/src/module.fe").unwrap(); - let mod_file = File::__new_impl(&db, "pub struct NewStruct;".to_string()); - - index - .set(&mut db, mod_url.clone(), mod_file) - .expect("Failed to set module file"); - - // Get the updated files list - this tests that Salsa correctly invalidates - // and recomputes the files list when new files are added - let ingot = index - .containing_ingot(&db, lib_url.clone()) - .expect("Should find ingot"); - let updated_files = ingot.files(&db); - let updated_count = updated_files.iter().count(); - - // Should now have 3 files (config + lib + module) - assert_eq!(updated_count, 3, "Should have 3 files after adding module"); - - // Verify the new file is in the list - let file_urls: Vec = updated_files.iter().map(|(url, _)| url).collect(); - assert!( - file_urls.contains(&mod_url), - "New module file should be in the files list" - ); - assert!( - file_urls.contains(&lib_url), - "Original lib file should still be in the files list" - ); - assert!( - file_urls.contains(&config_url), - "Config file should still be in the files list" - ); - } - - #[test] - fn test_file_containing_ingot_establishes_dependency() { - let mut db = TestDatabase::default(); - let index = db.workspace(); - - // Create a regular ingot with config file - let config_url = Url::parse("file:///project/fe.toml").unwrap(); - let config_file = File::__new_impl(&db, "[ingot]\nname = \"test\"".to_string()); - - let main_url = Url::parse("file:///project/src/main.fe").unwrap(); - let main_file = File::__new_impl(&db, "use foo::*\npub use S".to_string()); - - index - .set(&mut db, config_url.clone(), config_file) - .expect("Failed to set config file"); - index - .set(&mut db, main_url.clone(), main_file) - .expect("Failed to set main file"); - - // Call containing_ingot, which should trigger the side effect of calling ingot.files() - let ingot_option = main_file.containing_ingot(&db); - assert!(ingot_option.is_some(), "Should find ingot for main file"); - - // Drop the ingot reference before mutating the database - let _ = ingot_option; - - // Add another file to the same ingot - let other_url = Url::parse("file:///project/src/other.fe").unwrap(); - let other_file = File::__new_impl(&db, "pub struct OtherStruct;".to_string()); - - index - .set(&mut db, other_url.clone(), other_file) - .expect("Failed to set other file"); - - // Get the ingot again and check that the dependency established by the containing_ingot - // call ensures the files list is correctly updated - let ingot = main_file.containing_ingot(&db).expect("Should find ingot"); - let files = ingot.files(&db); - let file_count = files.iter().count(); - - // Should have all files now (config + main + other) - assert_eq!(file_count, 3, "Should have 3 files in the ingot"); - - let file_urls: Vec = files.iter().map(|(url, _)| url).collect(); - assert!( - file_urls.contains(&config_url), - "Should contain config file" - ); - assert!(file_urls.contains(&main_url), "Should contain main file"); - assert!(file_urls.contains(&other_url), "Should contain other file"); - } -} diff --git a/crates/common/src/layout.rs b/crates/common/src/layout.rs deleted file mode 100644 index 433a1810ce..0000000000 --- a/crates/common/src/layout.rs +++ /dev/null @@ -1,18 +0,0 @@ -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct TargetDataLayout { - pub word_size_bytes: usize, - pub discriminant_size_bytes: usize, -} - -impl TargetDataLayout { - pub const fn evm() -> Self { - Self { - word_size_bytes: 32, - discriminant_size_bytes: 1, - } - } -} - -pub const EVM_LAYOUT: TargetDataLayout = TargetDataLayout::evm(); -pub const WORD_SIZE_BYTES: usize = EVM_LAYOUT.word_size_bytes; -pub const DISCRIMINANT_SIZE_BYTES: usize = EVM_LAYOUT.discriminant_size_bytes; diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs deleted file mode 100644 index 610bd38aa8..0000000000 --- a/crates/common/src/lib.rs +++ /dev/null @@ -1,127 +0,0 @@ -pub mod cache; -pub mod color; -pub mod compilation; -pub mod config; -pub mod dependencies; -pub mod diagnostics; -pub mod file; -pub mod indexmap; -pub mod ingot; -pub mod layout; -pub mod options; -pub mod paths; -pub mod stdlib; -pub mod urlext; - -use compilation::CompilationSettings; -use dependencies::DependencyGraph; -use file::Workspace; -use options::CompilerOptions; - -#[salsa::db] -// Each database must implement InputDb explicitly with its own storage mechanism -pub trait InputDb: salsa::Database { - fn workspace(&self) -> Workspace; - fn dependency_graph(&self) -> DependencyGraph; - fn compiler_options(&self) -> CompilerOptions; - fn compilation_settings(&self) -> CompilationSettings; -} - -#[doc(hidden)] -pub use paste::paste; - -// Macro for implementing the InputDb trait for a Salsa database struct -// This assumes the database has a field named `index` of type `Option`. -#[macro_export] -macro_rules! impl_input_db { - ($db_type:ty) => { - #[salsa::db] - impl $crate::InputDb for $db_type { - fn workspace(&self) -> $crate::file::Workspace { - self.index.clone().expect("Workspace not initialized") - } - fn dependency_graph(&self) -> $crate::dependencies::DependencyGraph { - self.graph.clone().expect("Graph not initialized") - } - fn compiler_options(&self) -> $crate::options::CompilerOptions { - self.options - .clone() - .expect("Compiler options not initialized") - } - fn compilation_settings(&self) -> $crate::compilation::CompilationSettings { - self.settings - .clone() - .expect("Compilation settings not initialized") - } - } - }; -} - -// Macro for implementing Default for a Salsa database with Workspace - -// This assumes the database has a field named `index` of type `Option`, -// and will initialize it properly. -#[macro_export] -macro_rules! impl_db_default { - ($db_type:ty) => { - impl Default for $db_type - where - $db_type: $crate::stdlib::HasBuiltinCore + $crate::stdlib::HasBuiltinStd, - { - fn default() -> Self { - let mut db = Self { - storage: salsa::Storage::default(), - index: None, - graph: None, - options: None, - settings: None, - }; - let index = $crate::file::Workspace::default(&db); - db.index = Some(index); - let graph = $crate::dependencies::DependencyGraph::default(&db); - db.graph = Some(graph); - let options = $crate::options::CompilerOptions::default(&db); - db.options = Some(options); - let settings = $crate::compilation::CompilationSettings::default(&db); - db.settings = Some(settings); - $crate::stdlib::HasBuiltinCore::initialize_builtin_core(&mut db); - $crate::stdlib::HasBuiltinStd::initialize_builtin_std(&mut db); - db - } - } - }; -} - -// Macro for creating a standard Salsa database with Workspace support -#[macro_export] -macro_rules! define_input_db { - ($db_name:ident) => { - #[derive(Clone)] - #[salsa::db] - pub struct $db_name { - storage: salsa::Storage, - index: Option<$crate::file::Workspace>, - graph: Option<$crate::dependencies::DependencyGraph>, - options: Option<$crate::options::CompilerOptions>, - settings: Option<$crate::compilation::CompilationSettings>, - } - - #[salsa::db] - impl salsa::Database for $db_name { - fn salsa_event(&self, _event: &dyn Fn() -> salsa::Event) {} - } - - $crate::impl_input_db!($db_name); - $crate::impl_db_default!($db_name); - }; -} - -#[macro_export] -macro_rules! impl_db_traits { - ($db_type:ty, $($trait_name:ident),+ $(,)?) => { - #[salsa::db] - impl salsa::Database for $db_type { - fn salsa_event(&self, _event: &dyn Fn() -> salsa::Event) {} - } - }; -} diff --git a/crates/common/src/options.rs b/crates/common/src/options.rs deleted file mode 100644 index d9e0e2a940..0000000000 --- a/crates/common/src/options.rs +++ /dev/null @@ -1,15 +0,0 @@ -use crate::InputDb; - -#[salsa::input] -#[derive(Debug)] -pub struct CompilerOptions { - /// Whether to use recovery mode when parsing. - pub recovery_mode: bool, -} - -#[salsa::tracked] -impl CompilerOptions { - pub fn default(db: &dyn InputDb) -> Self { - CompilerOptions::new(db, true) - } -} diff --git a/crates/common/src/paths.rs b/crates/common/src/paths.rs deleted file mode 100644 index a9cc66d251..0000000000 --- a/crates/common/src/paths.rs +++ /dev/null @@ -1,162 +0,0 @@ -use camino::{Utf8Path, Utf8PathBuf}; -use std::io; -use std::path::{Path, PathBuf}; -use typed_path::{Utf8WindowsComponent, Utf8WindowsPath, Utf8WindowsPrefix}; -use url::Url; - -fn non_utf8_path_error(path: PathBuf) -> io::Error { - io::Error::new( - io::ErrorKind::InvalidData, - format!("path is not UTF-8: {}", path.display()), - ) -} - -pub fn normalize_slashes(raw: &str) -> String { - if !raw.contains('\\') { - return raw.to_string(); - } - - let mut normalized = String::with_capacity(raw.len()); - let mut needs_separator = false; - - for component in Utf8WindowsPath::new(raw).components() { - match component { - Utf8WindowsComponent::Prefix(prefix) => { - if needs_separator { - normalized.push('/'); - } - - let is_disk_prefix = matches!(prefix.kind(), Utf8WindowsPrefix::Disk(_)); - normalized.push_str(&normalize_windows_prefix(prefix.kind())); - needs_separator = !is_disk_prefix && !normalized.ends_with('/'); - } - Utf8WindowsComponent::RootDir => { - if !normalized.ends_with('/') { - normalized.push('/'); - } - needs_separator = false; - } - Utf8WindowsComponent::CurDir => { - if needs_separator { - normalized.push('/'); - } - normalized.push('.'); - needs_separator = true; - } - Utf8WindowsComponent::ParentDir => { - if needs_separator { - normalized.push('/'); - } - normalized.push_str(".."); - needs_separator = true; - } - Utf8WindowsComponent::Normal(component) => { - if needs_separator { - normalized.push('/'); - } - normalized.push_str(component); - needs_separator = true; - } - } - } - - normalized -} - -pub fn glob_pattern(path: &Path) -> String { - normalize_slashes(path.to_string_lossy().as_ref()) -} - -fn normalize_windows_prefix(prefix: Utf8WindowsPrefix<'_>) -> String { - match prefix { - Utf8WindowsPrefix::Verbatim(component) => format!("//?/{component}"), - Utf8WindowsPrefix::VerbatimUNC(server, share) => { - format!("//?/UNC/{server}/{share}") - } - Utf8WindowsPrefix::VerbatimDisk(drive) => format!("//?/{drive}:"), - Utf8WindowsPrefix::DeviceNS(device) => format!("//./{device}"), - Utf8WindowsPrefix::UNC(server, share) => format!("//{server}/{share}"), - Utf8WindowsPrefix::Disk(drive) => format!("{drive}:"), - } -} - -pub fn file_url_to_utf8_path(url: &Url) -> Option { - #[cfg(not(target_arch = "wasm32"))] - let path = url.to_file_path().ok()?; - #[cfg(target_arch = "wasm32")] - let path = { - if url.scheme() != "file" { - return None; - } - PathBuf::from(url.path()) - }; - Utf8PathBuf::from_path_buf(path).ok() -} - -pub fn canonicalize_utf8(path: &Path) -> io::Result { - let canonical = path.canonicalize()?; - Utf8PathBuf::from_path_buf(canonical).map_err(non_utf8_path_error) -} - -pub fn absolute_utf8(path: &Utf8Path) -> io::Result { - if path.is_absolute() { - return Ok(path.to_path_buf()); - } - - let cwd = std::env::current_dir()?; - let cwd = Utf8PathBuf::from_path_buf(cwd).map_err(non_utf8_path_error)?; - Ok(cwd.join(path)) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn normalizes_slashes() { - assert_eq!(normalize_slashes(r"a\b\c"), "a/b/c"); - } - - #[test] - fn normalizes_disk_paths() { - assert_eq!(normalize_slashes(r"C:\a\b\c"), "C:/a/b/c"); - assert_eq!(normalize_slashes(r"C:a\b\c"), "C:a/b/c"); - } - - #[test] - fn normalizes_unc_paths() { - assert_eq!( - normalize_slashes(r"\\server\share\path\to\file"), - "//server/share/path/to/file" - ); - } - - #[test] - fn converts_file_urls_to_utf8_paths() { - let cwd = std::env::current_dir().expect("current dir"); - let url = Url::from_directory_path(&cwd).expect("directory url"); - let path = file_url_to_utf8_path(&url).expect("file url to path"); - assert_eq!(path, Utf8PathBuf::from_path_buf(cwd).unwrap()); - } - - #[test] - fn builds_glob_patterns_with_forward_slashes() { - let pattern = glob_pattern(Path::new(r"a\b\**\fe.toml")); - assert_eq!(pattern, "a/b/**/fe.toml"); - } - - #[test] - fn makes_relative_paths_absolute() { - let absolute = absolute_utf8(Utf8Path::new("src")).expect("absolute path"); - assert!(absolute.is_absolute()); - } - - #[test] - fn canonicalizes_paths_to_utf8() { - let cwd = std::env::current_dir().expect("current dir"); - let path = canonicalize_utf8(&cwd).expect("canonicalize"); - let expected = cwd.canonicalize().expect("canonicalize cwd"); - let expected = Utf8PathBuf::from_path_buf(expected).unwrap(); - assert_eq!(path, expected); - } -} diff --git a/crates/common/src/stdlib.rs b/crates/common/src/stdlib.rs deleted file mode 100644 index d047e1317a..0000000000 --- a/crates/common/src/stdlib.rs +++ /dev/null @@ -1,195 +0,0 @@ -use std::fs; - -use camino::{Utf8Path, Utf8PathBuf}; -use rust_embed::Embed; -use url::Url; - -use crate::{ - InputDb, - ingot::{Ingot, IngotBaseUrl}, -}; - -// Use the canonical single-slash form for custom-scheme base URLs. -// `Url::join` normalizes children under `builtin-core:/...`, so lookups must -// use the same base form or builtin ingots appear empty. -pub static BUILTIN_CORE_BASE_URL: &str = "builtin-core:/"; -pub static BUILTIN_STD_BASE_URL: &str = "builtin-std:/"; - -fn is_library_file(path: &Utf8Path) -> bool { - matches!(path.file_name(), Some("fe.toml")) || matches!(path.extension(), Some("fe")) -} - -fn initialize_builtin(db: &mut dyn InputDb, base_url: &str) { - let base = Url::parse(base_url).unwrap(); - - // Ensure deterministic file insertion order across platforms/builds. - // This matters because downstream iteration over workspace tries is depth-first. - let mut paths = E::iter() - .map(|path| Utf8PathBuf::from(path.to_string())) - .collect::>(); - paths.sort(); - for path in paths { - if !is_library_file(&path) { - continue; - } - - let contents = String::from_utf8( - E::get(path.as_str()) - .unwrap_or_else(|| panic!("missing embedded builtin `{path}`")) - .data - .into_owned(), - ) - .unwrap_or_else(|_| panic!("embedded builtin `{path}` must be UTF-8")); - base.touch(db, path, contents.into()); - } -} - -fn load_library_dir(db: &mut dyn InputDb, base_url: &str, root: &Utf8Path) -> Result<(), String> { - let base = Url::parse(base_url).map_err(|_| "invalid base url".to_string())?; - let mut stack = vec![root.to_path_buf()]; - - while let Some(dir) = stack.pop() { - let entries = fs::read_dir(dir.as_std_path()) - .map_err(|err| format!("Failed to read {}: {err}", dir))? - .map(|entry| { - let entry = entry.map_err(|err| format!("Failed to read entry: {err}"))?; - let path = Utf8PathBuf::from_path_buf(entry.path()) - .map_err(|_| "Library path is not UTF-8".to_string())?; - let file_type = entry - .file_type() - .map_err(|err| format!("Failed to read file type: {err}"))?; - Ok((path, file_type)) - }) - .collect::, String>>()?; - - // Ensure deterministic traversal order across platforms/filesystems. - let mut entries = entries; - entries.sort_by(|(lhs, _), (rhs, _)| lhs.cmp(rhs)); - for (path, file_type) in entries { - if file_type.is_dir() { - stack.push(path); - continue; - } - if !is_library_file(&path) { - continue; - } - let relative = path - .strip_prefix(root) - .map_err(|_| "Library path escaped root".to_string())?; - let url = base - .join(relative.as_str()) - .map_err(|_| "Failed to join library path".to_string())?; - let content = fs::read_to_string(path.as_std_path()) - .map_err(|err| format!("Failed to read {}: {err}", path))?; - db.workspace().update(db, url, content); - } - } - - Ok(()) -} - -pub fn load_library_from_path(db: &mut dyn InputDb, library_root: &Utf8Path) -> Result<(), String> { - let core_root = library_root.join("core"); - let std_root = library_root.join("std"); - - // Clear embedded builtins first so stale files from the embedded version - // don't leak into the index when the on-disk version has fewer files. - clear_library(db, BUILTIN_CORE_BASE_URL); - clear_library(db, BUILTIN_STD_BASE_URL); - - load_library_dir(db, BUILTIN_CORE_BASE_URL, &core_root)?; - load_library_dir(db, BUILTIN_STD_BASE_URL, &std_root)?; - Ok(()) -} - -fn clear_library(db: &mut dyn InputDb, base_url: &str) { - let base = Url::parse(base_url).unwrap(); - let workspace = db.workspace(); - let urls: Vec = workspace - .items_at_base(db, base) - .iter() - .map(|(url, _)| url.clone()) - .collect(); - for url in urls { - workspace.remove(db, &url); - } -} - -#[derive(Embed)] -#[folder = "../../ingots/core"] -pub struct Core; - -pub trait HasBuiltinCore: InputDb { - fn initialize_builtin_core(&mut self); - fn builtin_core(&self) -> Ingot<'_>; -} - -impl HasBuiltinCore for T { - fn initialize_builtin_core(&mut self) { - initialize_builtin::(self, BUILTIN_CORE_BASE_URL); - } - - fn builtin_core(&self) -> Ingot<'_> { - let core = self - .workspace() - .containing_ingot(self, Url::parse(BUILTIN_CORE_BASE_URL).unwrap()); - core.expect("Built-in core ingot failed to initialize") - } -} - -#[derive(Embed)] -#[folder = "../../ingots/std"] -pub struct Std; - -pub trait HasBuiltinStd: InputDb { - fn initialize_builtin_std(&mut self); - fn builtin_std(&self) -> Ingot<'_>; -} - -impl HasBuiltinStd for T { - fn initialize_builtin_std(&mut self) { - initialize_builtin::(self, BUILTIN_STD_BASE_URL); - } - - fn builtin_std(&self) -> Ingot<'_> { - let std = self - .workspace() - .containing_ingot(self, Url::parse(BUILTIN_STD_BASE_URL).unwrap()); - std.expect("Built-in std ingot failed to initialize") - } -} - -#[cfg(test)] -mod tests { - use camino::Utf8Path; - - use super::{HasBuiltinCore, HasBuiltinStd, is_library_file}; - use crate::define_input_db; - - define_input_db!(TestDb); - - #[test] - fn library_loader_filters_non_fe_files() { - assert!(is_library_file(Utf8Path::new("fe.toml"))); - assert!(is_library_file(Utf8Path::new("src/lib.fe"))); - assert!(!is_library_file(Utf8Path::new(".DS_Store"))); - assert!(!is_library_file(Utf8Path::new("src/lib.rs"))); - assert!(!is_library_file(Utf8Path::new("README.md"))); - } - - #[test] - fn builtin_ingots_are_indexed_under_their_lookup_urls() { - let db = TestDb::default(); - let core = db.builtin_core(); - let std = db.builtin_std(); - - assert!( - core.files(&db).iter().next().is_some(), - "builtin core ingot should contain indexed files" - ); - assert!( - std.files(&db).iter().next().is_some(), - "builtin std ingot should contain indexed files" - ); - } -} diff --git a/crates/common/src/urlext.rs b/crates/common/src/urlext.rs deleted file mode 100644 index eabaa986f3..0000000000 --- a/crates/common/src/urlext.rs +++ /dev/null @@ -1,145 +0,0 @@ -use camino::Utf8PathBuf; -use url::Url; - -#[derive(Debug)] -pub enum UrlExtError { - DirectoryRangeError, - AsDirectoryError, -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum UrlError { - InvalidPath, - JoinError, - CanonicalizationError, -} - -pub trait UrlExt { - fn parent(&self) -> Option; - fn directory(&self) -> Option; - fn join_directory(&self, path: &Utf8PathBuf) -> Result; -} - -impl UrlExt for Url { - fn directory(&self) -> Option { - if self.cannot_be_a_base() { - return None; - }; - let mut url = self.clone(); - - if url.path().ends_with('/') { - return Some(url); - } - - if let Ok(mut segments) = url.path_segments_mut() { - segments.pop(); - segments.push(""); - } - - Some(url) - } - - fn parent(&self) -> Option { - let directory = self.directory()?; - - if *self != directory { - // If we're not already at a directory, return the directory - Some(directory) - } else if self.path() == "/" { - None - } else { - // We're already at a directory, go up one level - let mut parent = self.clone(); - if let Ok(mut segments) = parent.path_segments_mut() { - segments.pop(); - segments.pop(); - segments.push(""); // Ensure trailing slash - } - Some(parent) - } - } - - fn join_directory(&self, path: &Utf8PathBuf) -> Result { - Ok(if path.as_str().ends_with("/") { - self.join(path.as_str()).map_err(|_| UrlError::JoinError)? - } else { - let mut path = path.clone(); - path.push(""); - self.join(path.as_str()).map_err(|_| UrlError::JoinError)? - }) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_directory_basic() { - let url = Url::parse("https://example.com/foo/bar/baz").unwrap(); - let directory = url.directory(); - assert!(directory.is_some()); - assert_eq!(directory.unwrap().as_str(), "https://example.com/foo/bar/"); - - let url = Url::parse("https://example.com/foo/bar/baz/").unwrap(); - let directory = url.directory(); - assert!(directory.is_some()); - assert_eq!( - directory.unwrap().as_str(), - "https://example.com/foo/bar/baz/" - ); - } - - #[test] - fn test_parent_basic() { - let url = Url::parse("https://example.com/foo/bar").unwrap(); - let parent = url.parent(); - assert!(parent.is_some()); - assert_eq!(parent.unwrap().as_str(), "https://example.com/foo/"); - - let url = Url::parse("https://example.com/foo/").unwrap(); - let parent = url.parent(); - assert!(parent.is_some()); - assert_eq!(parent.unwrap().as_str(), "https://example.com/"); - - let url = Url::parse("https://example.com/").unwrap(); - let parent = url.parent(); - assert!( - parent.is_none(), - "Parent should be `None` but instead we got {parent:?}" - ); - } - - #[test] - fn test_file_url_parent_behavior() { - // Test file:// URL paths - let file_url = Url::parse("file:///foo/bar/baz.txt").unwrap(); - - // Test directory() behavior - let dir = file_url.directory(); - assert!(dir.is_some()); - assert_eq!(dir.unwrap().as_str(), "file:///foo/bar/"); - - // Test parent() behavior - from file to directory - let parent = file_url.parent(); - assert!(parent.is_some()); - assert_eq!(parent.unwrap().as_str(), "file:///foo/bar/"); - - // Test parent of directory - let dir_url = Url::parse("file:///foo/bar/").unwrap(); - let parent = dir_url.parent(); - assert!(parent.is_some()); - let parent_url = parent.unwrap(); - assert_eq!(parent_url.as_str(), "file:///foo/"); - - // Test parent of parent - let parent_of_parent = parent_url.parent(); - assert!(parent_of_parent.is_some()); - assert_eq!(parent_of_parent.unwrap().as_str(), "file:///"); - - // Test parent of root - let root_url = Url::parse("file:///").unwrap(); - let root_parent = root_url.parent(); - assert!(root_parent.is_none(), "Root URL should have no parent"); - } -} diff --git a/crates/contract-harness/Cargo.toml b/crates/contract-harness/Cargo.toml deleted file mode 100644 index cea51ddfdc..0000000000 --- a/crates/contract-harness/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "fe-contract-harness" -version = "26.2.0" -edition.workspace = true - -[dependencies] -driver = { path = "../driver", package = "fe-driver" } -codegen = { path = "../codegen", package = "fe-codegen" } -common = { path = "../common", package = "fe-common" } -revm = { version = "33.1.0", default-features = false, features = ["std"] } -hex = "0.4" -url.workspace = true -ethers-core = "2" -thiserror = "1" -tracing.workspace = true - -[dev-dependencies] -serde_json = "1" diff --git a/crates/contract-harness/src/lib.rs b/crates/contract-harness/src/lib.rs deleted file mode 100644 index f4f281f1e1..0000000000 --- a/crates/contract-harness/src/lib.rs +++ /dev/null @@ -1,3965 +0,0 @@ -//! Test harness utilities for compiling Fe contracts and exercising their runtimes with `revm`. -use codegen::{OptLevel, emit_module_sonatina_bytecode}; -use common::InputDb; -use driver::DriverDataBase; -use ethers_core::abi::{AbiParser, ParamType, ParseError as AbiParseError, Token, decode}; -use hex::FromHex; -pub use revm::primitives::{Address, Log, U256}; -use revm::{ - InspectCommitEvm, - bytecode::Bytecode, - context::{ - Context, TxEnv, - result::{ExecutionResult, HaltReason, Output}, - }, - database::InMemoryDB, - handler::{ExecuteCommitEvm, MainBuilder, MainContext, MainnetContext, MainnetEvm}, - interpreter::interpreter_types::Jumps, - primitives::{Bytes as EvmBytes, TxKind}, - state::AccountInfo, -}; -use std::{ - cmp::Reverse, - collections::{HashMap, VecDeque}, - fmt, - io::Write, - path::{Path, PathBuf}, -}; -use thiserror::Error; -use url::Url; - -/// Default in-memory file path used when compiling inline Fe sources. -const MEMORY_SOURCE_URL: &str = "file:///contract.fe"; -/// Tests may emit oversized helper contracts that would never be deployed on-chain. -const TEST_CONTRACT_CODE_SIZE_LIMIT: usize = 1024 * 1024; -const TEST_CONTRACT_INITCODE_SIZE_LIMIT: usize = 2 * TEST_CONTRACT_CODE_SIZE_LIMIT; -/// Test-only execution budget for deploying and calling generated helper contracts. -const TEST_GAS_LIMIT: u64 = 1_000_000_000; - -/// Error type returned by the harness. -#[derive(Error)] -pub enum HarnessError { - #[error("fe compiler diagnostics:\n{0}")] - CompilerDiagnostics(String), - #[error("failed to emit Sonatina bytecode: {0}")] - EmitSonatina(String), - #[error("abi encoding failed: {0}")] - Abi(#[from] ethers_core::abi::Error), - #[error("failed to parse function signature: {0}")] - AbiSignature(#[from] AbiParseError), - #[error("execution failed: {0}")] - Execution(String), - #[error("runtime reverted with data {0}")] - Revert(RevertData), - #[error("runtime halted: {reason:?} (gas_used={gas_used})")] - Halted { reason: HaltReason, gas_used: u64 }, - #[error("unexpected output variant from runtime")] - UnexpectedOutput, - #[error("invalid hex string: {0}")] - Hex(#[from] hex::FromHexError), - #[error("io error: {0}")] - Io(#[from] std::io::Error), -} - -impl fmt::Debug for HarnessError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(self, f) - } -} - -/// Captures raw revert data and provides a nicer `Display` implementation. -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct RevertData(pub Vec); - -impl fmt::Display for RevertData { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "0x{}", hex::encode(&self.0)) - } -} - -/// Options that control how the Fe source is compiled. -#[derive(Debug, Clone, Default)] -pub struct CompileOptions { - pub opt_level: OptLevel, -} - -/// Options that control the execution context fed into `revm`. -#[derive(Debug, Clone, Copy)] -pub struct ExecutionOptions { - pub caller: Address, - pub gas_limit: u64, - pub gas_price: u128, - pub value: U256, - /// Optional transaction nonce; when absent the harness uses the caller's - /// current nonce from the in-memory database. - pub nonce: Option, -} - -/// Optional tracing settings for a runtime call. -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct EvmTraceOptions { - /// Number of trailing EVM steps to keep in the ring buffer. - pub keep_steps: usize, - /// Number of stack values to render for each traced step. - pub stack_n: usize, - /// Optional output file for trace text. When absent, tracing only goes to stderr. - pub out_path: Option, - /// Whether to mirror trace output to stderr. - pub write_stderr: bool, -} - -impl Default for EvmTraceOptions { - fn default() -> Self { - Self { - keep_steps: 200, - stack_n: 0, - out_path: None, - write_stderr: true, - } - } -} - -impl Default for ExecutionOptions { - fn default() -> Self { - Self { - caller: Address::ZERO, - gas_limit: TEST_GAS_LIMIT, - gas_price: 0, - value: U256::ZERO, - nonce: None, - } - } -} - -/// Output returned from executing contract runtime bytecode. -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct CallResult { - pub return_data: Vec, - pub gas_used: u64, -} - -/// Output returned from executing contract runtime bytecode along with logs. -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct CallResultWithLogs { - pub result: CallResult, - pub logs: Vec, - pub raw_logs: Vec, -} - -/// Per-call gas attribution gathered from a full instruction trace replay. -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] -pub struct CallGasProfile { - /// Number of EVM instructions executed. - pub step_count: u64, - /// Sum of per-step gas deltas on the root runtime frame. - pub total_step_gas: u64, - /// Root-frame gas attributed to CREATE opcode steps (`0xF0`). - pub create_opcode_gas: u64, - /// Root-frame gas attributed to CREATE2 opcode steps (`0xF5`). - pub create2_opcode_gas: u64, - /// Root-frame gas attributed to all non-CREATE/CREATE2 opcode steps. - pub non_create_opcode_gas: u64, - /// Number of CREATE opcode steps (`0xF0`). - pub create_opcode_steps: u64, - /// Number of CREATE2 opcode steps (`0xF5`). - pub create2_opcode_steps: u64, - /// Gas reported by CREATE frame outcomes (constructor execution envelope). - pub constructor_frame_gas: u64, - /// Root-frame gas outside constructor execution (`total_step_gas - constructor_frame_gas`). - pub non_constructor_frame_gas: u64, -} - -fn prepare_account( - runtime_bytecode_hex: &str, -) -> Result<(Bytecode, Address, InMemoryDB), HarnessError> { - let code = hex_to_bytes(runtime_bytecode_hex)?; - let bytecode = Bytecode::new_raw(EvmBytes::from(code)); - let address = Address::with_last_byte(0xff); - Ok((bytecode, address, InMemoryDB::default())) -} - -fn transact( - evm: &mut MainnetEvm>, - address: Address, - calldata: &[u8], - options: ExecutionOptions, - nonce: u64, - trace_options: Option<&EvmTraceOptions>, -) -> Result { - let outcome = transact_with_logs(evm, address, calldata, options, nonce, trace_options)?; - Ok(outcome.result) -} - -/// Executes a call transaction and returns the result plus formatted logs. -/// -/// * `evm` - Mutable EVM instance to execute against. -/// * `address` - Target contract address. -/// * `calldata` - ABI-encoded call data. -/// * `options` - Execution options (gas, caller, value). -/// * `nonce` - Transaction nonce to use. -/// -/// Returns the call result along with any logs emitted by the execution. -fn transact_with_logs( - evm: &mut MainnetEvm>, - address: Address, - calldata: &[u8], - options: ExecutionOptions, - nonce: u64, - trace_options: Option<&EvmTraceOptions>, -) -> Result { - let build_tx = || { - TxEnv::builder() - .caller(options.caller) - .gas_limit(options.gas_limit) - .gas_price(options.gas_price) - .to(address) - .value(options.value) - .data(EvmBytes::copy_from_slice(calldata)) - .nonce(nonce) - .build() - }; - - if let Some(trace_options) = trace_options { - trace_tx(evm, build_tx().expect("tx builder is valid"), trace_options); - } - - let tx = build_tx().map_err(|err| HarnessError::Execution(format!("{err:?}")))?; - - let result = evm - .transact_commit(tx) - .map_err(|err| HarnessError::Execution(err.to_string()))?; - match result { - ExecutionResult::Success { - output: Output::Call(bytes), - gas_used, - logs, - .. - } => Ok(CallResultWithLogs { - result: CallResult { - return_data: bytes.to_vec(), - gas_used, - }, - logs: format_logs(&logs), - raw_logs: logs, - }), - ExecutionResult::Success { - output: Output::Create(..), - .. - } => Err(HarnessError::UnexpectedOutput), - ExecutionResult::Revert { output, .. } => { - Err(HarnessError::Revert(RevertData(output.to_vec()))) - } - ExecutionResult::Halt { reason, gas_used } => { - Err(HarnessError::Halted { reason, gas_used }) - } - } -} - -fn trace_tx(evm: &MainnetEvm>, tx: TxEnv, options: &EvmTraceOptions) { - #[derive(Clone, Debug)] - struct Step { - pc: usize, - opcode: u8, - stack_len: usize, - gas_remaining: u64, - stack_top: Vec, - } - - #[derive(Clone, Debug)] - struct RingTrace { - keep: usize, - stack_n: usize, - steps: VecDeque, - total_steps: u64, - } - - impl RingTrace { - fn new(keep: usize, stack_n: usize) -> Self { - Self { - keep, - stack_n, - steps: VecDeque::with_capacity(keep), - total_steps: 0, - } - } - - fn push(&mut self, step: Step) { - self.total_steps += 1; - if self.steps.len() == self.keep { - self.steps.pop_front(); - } - self.steps.push_back(step); - } - - fn format(&self) -> String { - let mut out = String::new(); - out.push_str(&format!( - "TRACE (last {} of {} steps)\n", - self.steps.len(), - self.total_steps - )); - for s in &self.steps { - if self.stack_n > 0 { - out.push_str(&format!( - "pc={:04} op=0x{:02x} stack={} gas_rem={} top={}\n", - s.pc, - s.opcode, - s.stack_len, - s.gas_remaining, - s.stack_top.join(",") - )); - } else { - out.push_str(&format!( - "pc={:04} op=0x{:02x} stack={} gas_rem={}\n", - s.pc, s.opcode, s.stack_len, s.gas_remaining - )); - } - } - out - } - } - - impl revm::Inspector for RingTrace { - fn step(&mut self, interp: &mut revm::interpreter::Interpreter, _context: &mut CTX) { - let stack_top = if self.stack_n == 0 { - Vec::new() - } else { - interp - .stack - .data() - .iter() - .rev() - .take(self.stack_n) - .rev() - .map(|v| format!("{v:#x}")) - .collect() - }; - self.push(Step { - pc: interp.bytecode.pc(), - opcode: interp.bytecode.opcode(), - stack_len: interp.stack.len(), - gas_remaining: interp.gas.remaining(), - stack_top, - }); - } - } - - use revm::interpreter::interpreter_types::{Jumps, StackTr}; - - // Clone the EVM (including DB state) for tracing so we don't disturb the caller's state. - let ctx = evm.ctx.clone(); - let mut trace_evm = - ctx.build_mainnet_with_inspector(RingTrace::new(options.keep_steps, options.stack_n)); - - let result = trace_evm.inspect_tx_commit(tx); - let formatted = format!( - "{}\ntrace result: {result:?}\n", - trace_evm.inspector.format() - ); - if let Some(path) = &options.out_path { - match std::fs::OpenOptions::new() - .create(true) - .append(true) - .open(path) - .and_then(|mut f| f.write_all(formatted.as_bytes())) - { - Ok(()) => { - if options.write_stderr { - tracing::debug!("{formatted}"); - } - } - Err(err) => { - tracing::error!( - "EVM trace output: failed to write `{}`: {err}", - path.display() - ); - tracing::debug!("{formatted}"); - } - } - } else if options.write_stderr { - tracing::debug!("{formatted}"); - } -} - -// --------------------------------------------------------------------------- -// Call-trace inspector: captures CALL/CREATE events at contract boundaries -// --------------------------------------------------------------------------- - -/// Normalized address in a call trace (sequential ID, not raw address). -type AddrId = usize; - -/// A single event in a call trace. -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum CallTraceEvent { - Call { - target: AddrId, - calldata: Vec, - output: Vec, - success: bool, - }, - Create { - scheme: &'static str, - address: AddrId, - success: bool, - }, -} - -/// Address-normalized call trace from a single test execution. -#[derive(Debug, Clone, Default)] -pub struct CallTrace { - pub events: Vec, - addr_map: HashMap, -} - -impl CallTrace { - /// Replaces known addresses in a hex-encoded byte string with their `$N` IDs. - /// - /// EVM addresses are 20 bytes. In ABI-encoded return data, they appear as - /// 32-byte words with 12 zero bytes followed by the 20-byte address. - /// We scan for both raw 20-byte occurrences and zero-padded 32-byte words. - fn normalize_hex(hex_str: &str, addr_map: &HashMap) -> String { - if addr_map.is_empty() || hex_str.is_empty() { - return hex_str.to_string(); - } - - let mut result = hex_str.to_string(); - // Sort by longest hex representation first to avoid partial replacements - let mut entries: Vec<_> = addr_map.iter().collect(); - entries.sort_by_key(|(addr, _)| Reverse(addr.to_string().len())); - - for (addr, id) in entries { - let addr_hex = hex::encode(addr.as_slice()); // 40 hex chars - // Replace zero-padded 32-byte ABI word (24 zeros + 40 hex chars) - let padded = format!("000000000000000000000000{addr_hex}"); - result = result.replace(&padded, &format!("${id}")); - // Also replace bare 20-byte address - result = result.replace(&addr_hex, &format!("${id}")); - } - result - } -} - -impl fmt::Display for CallTrace { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - for event in &self.events { - match event { - CallTraceEvent::Call { - target, - calldata, - output, - success, - } => { - let status = if *success { "ok" } else { "revert" }; - let ret_hex = CallTrace::normalize_hex(&hex::encode(output), &self.addr_map); - let data_hex = CallTrace::normalize_hex(&hex::encode(calldata), &self.addr_map); - writeln!( - f, - "CALL ${target} data={data_hex} -> {status} ret={ret_hex}", - )?; - } - CallTraceEvent::Create { - scheme, - address, - success, - } => { - let status = if *success { "ok" } else { "fail" }; - writeln!(f, "{scheme} {status} -> ${address}")?; - } - } - } - Ok(()) - } -} - -/// Tracks whether we are inside a CALL or CREATE frame. -#[derive(Debug, Clone)] -enum PendingFrame { - Call { target: AddrId, calldata: Vec }, - Create { scheme: &'static str }, -} - -/// Inspector that records every CALL/CREATE at contract boundaries. -/// -/// Addresses are normalized to sequential IDs so that traces from different -/// backends (which produce different bytecode and therefore different -/// CREATE-derived addresses) can be compared directly. -#[derive(Debug)] -pub struct CallTracer { - addr_map: HashMap, - next_id: AddrId, - stack: Vec, - events: Vec, -} - -impl Default for CallTracer { - fn default() -> Self { - Self::new() - } -} - -impl CallTracer { - pub fn new() -> Self { - Self { - addr_map: HashMap::new(), - next_id: 0, - stack: Vec::new(), - events: Vec::new(), - } - } - - fn resolve_addr(&mut self, addr: Address) -> AddrId { - let next = self.next_id; - *self.addr_map.entry(addr).or_insert_with(|| { - self.next_id = next + 1; - next - }) - } - - fn assign_new_addr(&mut self, addr: Address) -> AddrId { - let id = self.next_id; - self.next_id += 1; - self.addr_map.insert(addr, id); - id - } - - pub fn into_trace(self) -> CallTrace { - CallTrace { - events: self.events, - addr_map: self.addr_map, - } - } -} - -impl - revm::Inspector for CallTracer -{ - fn call( - &mut self, - context: &mut CTX, - inputs: &mut revm::interpreter::CallInputs, - ) -> Option { - let target_id = self.resolve_addr(inputs.target_address); - let calldata = inputs.input.bytes(context).to_vec(); - self.stack.push(PendingFrame::Call { - target: target_id, - calldata, - }); - None - } - - fn call_end( - &mut self, - _context: &mut CTX, - _inputs: &revm::interpreter::CallInputs, - outcome: &mut revm::interpreter::CallOutcome, - ) { - let Some(frame) = self.stack.pop() else { - return; - }; - if let PendingFrame::Call { target, calldata } = frame { - self.events.push(CallTraceEvent::Call { - target, - calldata, - output: outcome.result.output.to_vec(), - success: outcome.result.result.is_ok(), - }); - } - } - - fn create( - &mut self, - _context: &mut CTX, - inputs: &mut revm::interpreter::CreateInputs, - ) -> Option { - let scheme = match inputs.scheme { - revm::context_interface::CreateScheme::Create => "CREATE", - revm::context_interface::CreateScheme::Create2 { .. } => "CREATE2", - revm::context_interface::CreateScheme::Custom { .. } => "CREATE_CUSTOM", - }; - self.stack.push(PendingFrame::Create { scheme }); - None - } - - fn create_end( - &mut self, - _context: &mut CTX, - _inputs: &revm::interpreter::CreateInputs, - outcome: &mut revm::interpreter::CreateOutcome, - ) { - let Some(frame) = self.stack.pop() else { - return; - }; - if let PendingFrame::Create { scheme } = frame { - let success = outcome.result.result.is_ok(); - let addr_id = if let Some(addr) = outcome.address { - self.assign_new_addr(addr) - } else { - // Failed create — assign a placeholder ID - let id = self.next_id; - self.next_id += 1; - id - }; - self.events.push(CallTraceEvent::Create { - scheme, - address: addr_id, - success, - }); - } - } -} - -/// Formats raw EVM logs into debug strings for display. -/// -/// * `logs` - Logs emitted by the EVM execution. -/// -/// Returns a vector of formatted log strings. -fn format_logs(logs: &[Log]) -> Vec { - logs.iter().map(|log| format!("{log:?}")).collect() -} - -/// Stateful runtime instance backed by a persistent in-memory database. -pub struct RuntimeInstance { - evm: MainnetEvm>, - address: Address, - next_nonce_by_caller: HashMap, - trace_options: Option, -} - -impl RuntimeInstance { - /// Instantiates a runtime instance from raw bytecode, inserting it into an `InMemoryDB`. - pub fn new(runtime_bytecode_hex: &str) -> Result { - let (bytecode, address, mut db) = prepare_account(runtime_bytecode_hex)?; - let code_hash = bytecode.hash_slow(); - db.insert_account_info( - address, - AccountInfo::new(U256::ZERO, 0, code_hash, bytecode), - ); - let ctx = Context::mainnet().with_db(db).modify_cfg_chained(|cfg| { - cfg.limit_contract_code_size = Some(TEST_CONTRACT_CODE_SIZE_LIMIT); - cfg.limit_contract_initcode_size = Some(TEST_CONTRACT_INITCODE_SIZE_LIMIT); - }); - let evm = ctx.build_mainnet(); - Ok(Self { - evm, - address, - next_nonce_by_caller: HashMap::new(), - trace_options: None, - }) - } - - /// Deploys a contract by executing its init bytecode and using the returned runtime code. - /// This properly runs any initialization logic in the constructor. - pub fn deploy(init_bytecode_hex: &str) -> Result { - Self::deploy_tracked(init_bytecode_hex).map(|(instance, _)| instance) - } - - /// Deploys a contract and returns the runtime instance plus deployment gas. - pub fn deploy_tracked(init_bytecode_hex: &str) -> Result<(Self, u64), HarnessError> { - Self::deploy_with_constructor_args_tracked(init_bytecode_hex, &[]) - } - - /// Deploys a contract by executing its init bytecode with ABI-encoded constructor args. - pub fn deploy_with_constructor_args( - init_bytecode_hex: &str, - constructor_args: &[u8], - ) -> Result { - Self::deploy_with_constructor_args_tracked(init_bytecode_hex, constructor_args) - .map(|(instance, _)| instance) - } - - /// Deploys a contract with constructor args and returns deployment gas. - pub fn deploy_with_constructor_args_tracked( - init_bytecode_hex: &str, - constructor_args: &[u8], - ) -> Result<(Self, u64), HarnessError> { - let mut init_code = hex_to_bytes(init_bytecode_hex)?; - init_code.extend_from_slice(constructor_args); - let caller = Address::ZERO; - - let mut db = InMemoryDB::default(); - // Give the caller some balance for deployment - db.insert_account_info( - caller, - AccountInfo::new( - U256::from(1_000_000_000u64), - 0, - Default::default(), - Bytecode::default(), - ), - ); - - let ctx = Context::mainnet().with_db(db).modify_cfg_chained(|cfg| { - cfg.limit_contract_code_size = Some(TEST_CONTRACT_CODE_SIZE_LIMIT); - cfg.limit_contract_initcode_size = Some(TEST_CONTRACT_INITCODE_SIZE_LIMIT); - }); - let mut evm = ctx.build_mainnet(); - - // Create deployment transaction (TxKind::Create means contract creation) - let tx = TxEnv::builder() - .caller(caller) - .gas_limit(TEST_GAS_LIMIT) - .gas_price(0) - .kind(TxKind::Create) - .data(EvmBytes::from(init_code)) - .nonce(0) - .build() - .map_err(|err| HarnessError::Execution(format!("{err:?}")))?; - - let result = evm - .transact_commit(tx) - .map_err(|err| HarnessError::Execution(err.to_string()))?; - - match result { - ExecutionResult::Success { - output: Output::Create(_, Some(deployed_address)), - gas_used, - .. - } => { - // The contract was deployed successfully; revm has already inserted the account - let mut next_nonce_by_caller = HashMap::new(); - next_nonce_by_caller.insert(caller, 1); - Ok(( - Self { - evm, - address: deployed_address, - next_nonce_by_caller, - trace_options: None, - }, - gas_used, - )) - } - ExecutionResult::Success { output, .. } => Err(HarnessError::Execution(format!( - "deployment returned unexpected output: {output:?}" - ))), - ExecutionResult::Revert { output, .. } => { - Err(HarnessError::Revert(RevertData(output.to_vec()))) - } - ExecutionResult::Halt { reason, gas_used } => { - Err(HarnessError::Halted { reason, gas_used }) - } - } - } - - /// Deploys another contract into the same in-memory EVM context. - pub fn deploy_sidecar( - &mut self, - init_bytecode_hex: &str, - constructor_args: &[u8], - ) -> Result { - let mut init_code = hex_to_bytes(init_bytecode_hex)?; - init_code.extend_from_slice(constructor_args); - - let caller = Address::ZERO; - let nonce = self.effective_nonce(ExecutionOptions { - caller, - ..ExecutionOptions::default() - }); - - let tx = TxEnv::builder() - .caller(caller) - .gas_limit(10_000_000) - .gas_price(0) - .kind(TxKind::Create) - .data(EvmBytes::from(init_code)) - .nonce(nonce) - .build() - .map_err(|err| HarnessError::Execution(format!("{err:?}")))?; - - let result = self - .evm - .transact_commit(tx) - .map_err(|err| HarnessError::Execution(err.to_string()))?; - - match result { - ExecutionResult::Success { - output: Output::Create(_, Some(deployed_address)), - .. - } => Ok(deployed_address), - ExecutionResult::Success { output, .. } => Err(HarnessError::Execution(format!( - "deployment returned unexpected output: {output:?}" - ))), - ExecutionResult::Revert { output, .. } => { - Err(HarnessError::Revert(RevertData(output.to_vec()))) - } - ExecutionResult::Halt { reason, gas_used } => { - Err(HarnessError::Halted { reason, gas_used }) - } - } - } - - /// Gives the deployed contract the specified balance (in wei). - /// - /// This is useful for tests that need the contract to send ETH - /// via internal calls (e.g. `evm.call(value: 1, ...)`). - pub fn fund_contract(&mut self, amount: U256) { - let address = self.address; - self.fund_account(address, amount); - } - - /// Adds `amount` wei to the given account's balance. - /// - /// Useful for tests where the caller needs to send ETH along with a call - /// (e.g. payable deposits). Default `ExecutionOptions` uses `Address::ZERO` - /// as the caller; fund that address to enable value transfers from it. - pub fn fund_account(&mut self, address: Address, amount: U256) { - let js = &mut self.evm.ctx.journaled_state; - - // Update the underlying DB cache so future loads see the balance. - let mut info = js - .database - .cache - .accounts - .get(&address) - .map(|a| a.info.clone()) - .unwrap_or_default(); - info.balance = info.balance.saturating_add(amount); - js.database.insert_account_info(address, info.clone()); - - // Also update the live journal state — after deploy the account is - // already loaded there, and value transfers read from the journal - // rather than reloading from the DB cache. - if let Some(account) = js.state.get_mut(&address) { - account.info.balance = info.balance; - } - } - - fn effective_nonce(&mut self, options: ExecutionOptions) -> u64 { - if let Some(nonce) = options.nonce { - let entry = self.next_nonce_by_caller.entry(options.caller).or_insert(0); - *entry = (*entry).max(nonce + 1); - return nonce; - } - - let entry = self.next_nonce_by_caller.entry(options.caller).or_insert(0); - let current = *entry; - *entry += 1; - current - } - - /// Executes the runtime with arbitrary calldata. - pub fn call_raw( - &mut self, - calldata: &[u8], - options: ExecutionOptions, - ) -> Result { - let nonce = self.effective_nonce(options); - transact( - &mut self.evm, - self.address, - calldata, - options, - nonce, - self.trace_options.as_ref(), - ) - } - - /// Executes the runtime with arbitrary calldata, returning execution logs. - pub fn call_raw_with_logs( - &mut self, - calldata: &[u8], - options: ExecutionOptions, - ) -> Result { - let nonce = self.effective_nonce(options); - transact_with_logs( - &mut self.evm, - self.address, - calldata, - options, - nonce, - self.trace_options.as_ref(), - ) - } - - /// Executes the runtime at an arbitrary address using the same underlying EVM state. - pub fn call_raw_at( - &mut self, - address: Address, - calldata: &[u8], - options: ExecutionOptions, - ) -> Result { - let nonce = self.effective_nonce(options); - transact( - &mut self.evm, - address, - calldata, - options, - nonce, - self.trace_options.as_ref(), - ) - } - - /// Configures optional step-by-step EVM tracing for subsequent calls. - pub fn set_trace_options(&mut self, trace_options: Option) { - self.trace_options = trace_options; - } - - /// Executes a strongly-typed function call using ABI encoding. - pub fn call_function( - &mut self, - signature: &str, - args: &[Token], - options: ExecutionOptions, - ) -> Result { - let calldata = encode_function_call(signature, args)?; - self.call_raw(&calldata, options) - } - - /// Re-executes the last transaction on a **cloned** EVM context with the - /// `CallTracer` inspector attached, producing a normalized call trace. - /// - /// Uses `&self` because it clones the context — does not mutate real state. - pub fn call_raw_traced(&self, calldata: &[u8], options: ExecutionOptions) -> CallTrace { - let ctx = self.evm.ctx.clone(); - let mut tracer = CallTracer::new(); - let mut trace_evm = ctx.build_mainnet_with_inspector(&mut tracer); - - // Honor explicit nonce when set, otherwise use stored nonce for this caller. - let nonce = options.nonce.unwrap_or_else(|| { - self.next_nonce_by_caller - .get(&options.caller) - .copied() - .unwrap_or(0) - }); - - let tx = TxEnv::builder() - .caller(options.caller) - .gas_limit(options.gas_limit) - .gas_price(options.gas_price) - .to(self.address) - .value(options.value) - .data(EvmBytes::copy_from_slice(calldata)) - .nonce(nonce) - .build() - .expect("tx builder is valid"); - - let _ = trace_evm.inspect_tx_commit(tx); - tracer.into_trace() - } - - /// Re-executes the call on a cloned EVM context and returns total EVM steps. - /// - /// Uses `&self` because this is a read-only replay that does not mutate the - /// runtime state used by real executions. - pub fn call_raw_step_count(&self, calldata: &[u8], options: ExecutionOptions) -> u64 { - self.call_raw_gas_profile(calldata, options).step_count - } - - /// Re-executes the call on a cloned EVM context and returns full-step gas attribution. - /// - /// Uses `&self` because this is a read-only replay that does not mutate the - /// runtime state used by real executions. - pub fn call_raw_gas_profile( - &self, - calldata: &[u8], - options: ExecutionOptions, - ) -> CallGasProfile { - #[derive(Debug, Clone, Copy, PartialEq, Eq)] - enum InvocationKind { - Call, - Create, - } - - #[derive(Debug, Clone, Copy)] - struct PendingInvocation { - kind: InvocationKind, - started_interp: bool, - } - - #[derive(Debug, Clone, Copy)] - struct FrameState { - in_constructor: bool, - pending_gas_remaining: u64, - pending_opcode: u8, - } - - impl FrameState { - fn new(in_constructor: bool, gas_limit: u64) -> Self { - Self { - in_constructor, - pending_gas_remaining: gas_limit, - pending_opcode: 0, - } - } - } - - #[derive(Debug, Default)] - struct GasAttributionInspector { - frame_stack: Vec, - pending_invocations: Vec, - profile: CallGasProfile, - } - - impl GasAttributionInspector { - fn record_root_step_delta(&mut self, opcode: u8, delta: u64) { - self.profile.total_step_gas = self.profile.total_step_gas.saturating_add(delta); - match opcode { - 0xf0 => { - self.profile.create_opcode_steps += 1; - self.profile.create_opcode_gas = - self.profile.create_opcode_gas.saturating_add(delta); - } - 0xf5 => { - self.profile.create2_opcode_steps += 1; - self.profile.create2_opcode_gas = - self.profile.create2_opcode_gas.saturating_add(delta); - } - _ => {} - } - } - - fn complete_invocation(&mut self, kind: InvocationKind) -> Option { - self.pending_invocations - .iter() - .rposition(|invocation| invocation.kind == kind) - .map(|index| self.pending_invocations.remove(index)) - } - } - - impl revm::Inspector - for GasAttributionInspector - { - fn initialize_interp( - &mut self, - interp: &mut revm::interpreter::Interpreter, - _context: &mut CTX, - ) { - let in_constructor = if self.frame_stack.is_empty() { - false - } else { - let parent_in_constructor = self - .frame_stack - .last() - .map(|frame| frame.in_constructor) - .unwrap_or(false); - let child_kind = self - .pending_invocations - .iter_mut() - .rev() - .find(|invocation| !invocation.started_interp) - .map(|invocation| { - invocation.started_interp = true; - invocation.kind - }); - parent_in_constructor || matches!(child_kind, Some(InvocationKind::Create)) - }; - self.frame_stack - .push(FrameState::new(in_constructor, interp.gas.limit())); - } - - fn step( - &mut self, - interp: &mut revm::interpreter::Interpreter, - _context: &mut CTX, - ) { - if let Some(frame) = self.frame_stack.last_mut() { - frame.pending_gas_remaining = interp.gas.remaining(); - frame.pending_opcode = interp.bytecode.opcode(); - } - self.profile.step_count += 1; - } - - fn step_end( - &mut self, - interp: &mut revm::interpreter::Interpreter, - _context: &mut CTX, - ) { - let frame_depth = self.frame_stack.len(); - let Some(frame) = self.frame_stack.last_mut() else { - return; - }; - let remaining = interp.gas.remaining(); - let delta = frame.pending_gas_remaining.saturating_sub(remaining); - let opcode = frame.pending_opcode; - if frame_depth == 1 { - self.record_root_step_delta(opcode, delta); - } - } - - fn call( - &mut self, - _context: &mut CTX, - _inputs: &mut revm::interpreter::CallInputs, - ) -> Option { - self.pending_invocations.push(PendingInvocation { - kind: InvocationKind::Call, - started_interp: false, - }); - None - } - - fn call_end( - &mut self, - _context: &mut CTX, - _inputs: &revm::interpreter::CallInputs, - _outcome: &mut revm::interpreter::CallOutcome, - ) { - if let Some(invocation) = self.complete_invocation(InvocationKind::Call) - && invocation.started_interp - { - let _ = self.frame_stack.pop(); - } - } - - fn create( - &mut self, - _context: &mut CTX, - _inputs: &mut revm::interpreter::CreateInputs, - ) -> Option { - self.pending_invocations.push(PendingInvocation { - kind: InvocationKind::Create, - started_interp: false, - }); - None - } - - fn create_end( - &mut self, - _context: &mut CTX, - _inputs: &revm::interpreter::CreateInputs, - outcome: &mut revm::interpreter::CreateOutcome, - ) { - if let Some(invocation) = self.complete_invocation(InvocationKind::Create) - && invocation.started_interp - { - self.profile.constructor_frame_gas = self - .profile - .constructor_frame_gas - .saturating_add(outcome.result.gas.spent()); - let _ = self.frame_stack.pop(); - } - } - } - - let ctx = self.evm.ctx.clone(); - let mut inspector = GasAttributionInspector::default(); - let mut trace_evm = ctx.build_mainnet_with_inspector(&mut inspector); - - // Honor explicit nonce when set, otherwise use stored nonce for this caller. - let nonce = options.nonce.unwrap_or_else(|| { - self.next_nonce_by_caller - .get(&options.caller) - .copied() - .unwrap_or(0) - }); - - let tx = TxEnv::builder() - .caller(options.caller) - .gas_limit(options.gas_limit) - .gas_price(options.gas_price) - .to(self.address) - .value(options.value) - .data(EvmBytes::copy_from_slice(calldata)) - .nonce(nonce) - .build() - .expect("tx builder is valid"); - - let _ = trace_evm.inspect_tx_commit(tx); - let mut profile = trace_evm.inspector.profile; - let create_total = profile - .create_opcode_gas - .saturating_add(profile.create2_opcode_gas); - profile.non_create_opcode_gas = profile.total_step_gas.saturating_sub(create_total); - profile.non_constructor_frame_gas = profile - .total_step_gas - .saturating_sub(profile.constructor_frame_gas); - profile - } - - /// Returns the contract address assigned to this runtime instance. - pub fn address(&self) -> Address { - self.address - } -} - -#[derive(Debug, Clone)] -pub struct ContractBytecode { - pub bytecode: String, - pub runtime_bytecode: String, -} - -/// Harness that compiles Fe source code and executes the resulting contract runtime. -pub struct FeContractHarness { - contract: ContractBytecode, -} - -impl FeContractHarness { - /// Convenience helper that uses default [`CompileOptions`]. - pub fn compile(contract_name: &str, source: &str) -> Result { - Self::compile_from_source(contract_name, source, CompileOptions::default()) - } - - /// Compiles the provided Fe source into bytecode for the specified contract. - pub fn compile_from_source( - contract_name: &str, - source: &str, - options: CompileOptions, - ) -> Result { - let mut db = DriverDataBase::default(); - let url = Url::parse(MEMORY_SOURCE_URL).expect("static URL is valid"); - db.workspace() - .touch(&mut db, url.clone(), Some(source.to_string())); - let file = db - .workspace() - .get(&db, &url) - .expect("file should exist in workspace"); - let top_mod = db.top_mod(file); - let diags = db.run_on_top_mod(top_mod); - if !diags.is_empty() { - return Err(HarnessError::CompilerDiagnostics(diags.format_diags(&db))); - } - let bytecode = - emit_module_sonatina_bytecode(&db, top_mod, options.opt_level, Some(contract_name)) - .map_err(|err| HarnessError::EmitSonatina(err.to_string()))?; - let bytecode = bytecode.get(contract_name).ok_or_else(|| { - HarnessError::EmitSonatina(format!("missing bytecode for `{contract_name}`")) - })?; - let contract = ContractBytecode { - bytecode: hex::encode(&bytecode.deploy), - runtime_bytecode: hex::encode(&bytecode.runtime), - }; - Ok(Self { contract }) - } - - /// Reads a source file from disk and compiles the specified contract. - pub fn compile_from_file( - contract_name: &str, - path: impl AsRef, - options: CompileOptions, - ) -> Result { - let source = std::fs::read_to_string(path)?; - Self::compile_from_source(contract_name, &source, options) - } - - /// Returns the compiled raw runtime bytecode. - pub fn runtime_bytecode(&self) -> &str { - &self.contract.runtime_bytecode - } - - /// Returns the compiled init bytecode. - pub fn init_bytecode(&self) -> &str { - &self.contract.bytecode - } - - /// Executes the compiled runtime with arbitrary calldata. - pub fn call_raw( - &self, - calldata: &[u8], - options: ExecutionOptions, - ) -> Result { - execute_runtime(&self.contract.runtime_bytecode, calldata, options) - } - - /// ABI-encodes the provided arguments and executes the runtime. - pub fn call_function( - &self, - signature: &str, - args: &[Token], - options: ExecutionOptions, - ) -> Result { - let calldata = encode_function_call(signature, args)?; - self.call_raw(&calldata, options) - } - - /// Creates a persistent runtime instance that can serve multiple calls. - pub fn deploy_instance(&self) -> Result { - RuntimeInstance::new(&self.contract.runtime_bytecode) - } - - /// Deploys a contract by running the init bytecode, initializing storage. - /// Use this when your contract has initialization logic (e.g., storage setup). - pub fn deploy_with_init(&self) -> Result { - RuntimeInstance::deploy(&self.contract.bytecode) - } - - /// Deploys a contract by running the init bytecode with ABI-encoded constructor args. - pub fn deploy_with_init_args( - &self, - constructor_args: &[Token], - ) -> Result { - let args = ethers_core::abi::encode(constructor_args); - RuntimeInstance::deploy_with_constructor_args(&self.contract.bytecode, &args) - } -} - -/// Compiles the provided Fe source to Sonatina-generated runtime bytecode (hex-encoded). -pub fn compile_runtime_sonatina_from_source(source: &str) -> Result { - let mut db = DriverDataBase::default(); - let url = Url::parse(MEMORY_SOURCE_URL).expect("static URL is valid"); - db.workspace() - .touch(&mut db, url.clone(), Some(source.to_string())); - let file = db - .workspace() - .get(&db, &url) - .expect("file should exist in workspace"); - let top_mod = db.top_mod(file); - let diags = db.run_on_top_mod(top_mod); - if !diags.is_empty() { - return Err(HarnessError::CompilerDiagnostics(diags.format_diags(&db))); - } - - let bytecode = emit_module_sonatina_bytecode(&db, top_mod, OptLevel::default(), None) - .map_err(|err| HarnessError::EmitSonatina(err.to_string()))?; - let contract = bytecode - .values() - .next() - .ok_or_else(|| HarnessError::EmitSonatina("no runtime bytecode emitted".into()))?; - Ok(hex::encode(&contract.runtime)) -} - -/// ABI-encodes a function call according to the provided signature. -pub fn encode_function_call(signature: &str, args: &[Token]) -> Result, HarnessError> { - let function = AbiParser::default().parse_function(signature)?; - let encoded = function.encode_input(args)?; - Ok(encoded) -} - -/// Executes the provided runtime bytecode within `revm`. -pub fn execute_runtime( - runtime_bytecode_hex: &str, - calldata: &[u8], - options: ExecutionOptions, -) -> Result { - let mut instance = RuntimeInstance::new(runtime_bytecode_hex)?; - instance.call_raw(calldata, options) -} - -/// Parses a hex string (with or without `0x` prefix) into raw bytes. -pub fn hex_to_bytes(hex: &str) -> Result, HarnessError> { - let trimmed = hex.trim().strip_prefix("0x").unwrap_or(hex.trim()); - Vec::from_hex(trimmed).map_err(HarnessError::Hex) -} - -/// Interprets exactly 32 return bytes as a big-endian `U256`. -pub fn bytes_to_u256(bytes: &[u8]) -> Result { - if bytes.len() != 32 { - return Err(HarnessError::Execution(format!( - "expected 32 bytes of return data, found {}", - bytes.len() - ))); - } - let mut buf = [0u8; 32]; - buf.copy_from_slice(bytes); - Ok(U256::from_be_bytes(buf)) -} - -/// Decodes ABI-encoded string return data. -pub fn bytes_to_string(bytes: &[u8]) -> Result { - let mut tokens = decode(&[ParamType::String], bytes)?; - match tokens.pop() { - Some(Token::String(value)) => Ok(value), - _ => Err(HarnessError::Execution( - "expected ABI string return data".to_string(), - )), - } -} - -#[cfg(test)] -#[allow(clippy::print_stderr)] -mod tests { - use super::*; - use ethers_core::{ - abi::{AbiParser, Function, Param, ParamType, StateMutability, Token, decode}, - types::U256 as AbiU256, - }; - - fn compile_calldata_decode_contract() -> Option { - let source = r#" -use std::abi::sol -use std::abi::{decode_input, decode_input_at} -use std::evm::{CallData, Evm} - -msg DecodeMsg { - #[selector = sol("raw(uint256)")] - Raw { value: u256 } -> u256, - #[selector = sol("read(uint256)")] - Read { value: u256 } -> u256, - #[selector = sol("selector()")] - Selector -> u256, - #[selector = sol("args(uint256)")] - Args { value: u256 } -> u256, - #[selector = sol("tuple(uint64,bool)")] - Tuple { a: u64, flag: bool } -> u256, - #[selector = sol("generic(uint256)")] - Generic { value: u256 } -> u256, - #[selector = sol("bad()")] - Bad -> u256, - #[selector = sol("bad_view()")] - BadView -> u256, -} - -pub contract DecodeHarness { - recv DecodeMsg { - Raw { value: _ } -> u256 { - CallData::new().decode() - } - - Read { value } -> u256 { - let decoded = CallData::with_base(4).decode() - assert!(decoded == value) - decoded - } - - Selector -> u256 uses (evm: Evm) { - evm.selector() as u256 - } - - Args { value } -> u256 uses (evm: mut Evm) { - let decoded = evm.decode_args() - assert!(decoded == value) - decoded - } - - Tuple { a, flag } -> u256 uses (evm: mut Evm) { - let decoded: (u64, bool) = evm.decode_args<(u64, bool)>() - assert!(decoded.0 == a) - assert!(decoded.1 == flag) - if flag { - a as u256 - } else { - 0 - } - } - - Generic { value } -> u256 { - let input = CallData::with_base(4) - let decoded: u256 = decode_input(input) - let decoded_at: u256 = decode_input_at(CallData::new(), 4) - assert!(decoded == value) - assert!(decoded_at == value) - decoded - } - - Bad -> u256 { - decode_input_at(CallData::new(), 5) - } - - BadView -> u256 { - CallData::with_base(5).decode() - } - } -} -"#; - - Some( - FeContractHarness::compile_from_source( - "DecodeHarness", - source, - CompileOptions::default(), - ) - .expect("calldata decode contract should compile"), - ) - } - - fn compile_canonical_decode_contract() -> Option { - let source = r#" -use std::abi::sol -use std::evm::Address - -msg CanonicalMsg { - #[selector = sol("readBool(bool)")] - ReadBool { value: bool } -> u256, - #[selector = sol("readU8(uint8)")] - ReadU8 { value: u8 } -> u256, - #[selector = sol("readI8(int8)")] - ReadI8 { value: i8 } -> u256, - #[selector = sol("readAddress(address)")] - ReadAddress { value: Address } -> u256, -} - -pub contract CanonicalHarness { - recv CanonicalMsg { - ReadBool { value } -> u256 { - if value { 1 } else { 0 } - } - - ReadU8 { value } -> u256 { - value as u256 - } - - ReadI8 { value } -> u256 { - if value == 127 { 1 } else { 0 } - } - - ReadAddress { value } -> u256 { - value.inner - } - } -} -"#; - - Some( - FeContractHarness::compile_from_source( - "CanonicalHarness", - source, - CompileOptions::default(), - ) - .expect("canonical decode contract should compile"), - ) - } - - fn compile_dynamic_view_contract() -> Option { - let source = r#" -use std::abi::sol -use std::abi::sol::{decode_bytes_view, decode_bytes_view_at, decode_string_view} -use std::evm::{CallData, Evm} - -const BYTES_LEN_SELECTOR: u32 = sol("bytesLen(bytes)") -const SECOND_BYTES_LEN_SELECTOR: u32 = sol("secondBytesLen(bytes,bytes)") -const STRING_FIRST_SELECTOR: u32 = sol("stringFirst(string)") -const STRING_LEN_SELECTOR: u32 = sol("stringLen(string)") - -#[contract_init(ViewHarness)] -fn init() uses (evm: mut Evm) { - evm.create_contract(runtime) -} - -#[contract_runtime(ViewHarness)] -fn runtime() uses (evm: mut Evm) { - let sel = evm.selector() - - if sel == BYTES_LEN_SELECTOR { - let view = decode_bytes_view(CallData::with_base(4)) - evm.mstore(addr: 0, value: view.len()) - evm.return_data(offset: 0, len: 32) - } - - if sel == SECOND_BYTES_LEN_SELECTOR { - let view = decode_bytes_view_at(CallData::with_base(4), base: 0, head_pos: 32) - evm.mstore(addr: 0, value: view.len()) - evm.return_data(offset: 0, len: 32) - } - - if sel == STRING_FIRST_SELECTOR { - let view = decode_string_view(CallData::with_base(4)) - let first: u256 = if view.is_empty() { 0 } else { view.byte_at(0) as u256 } - evm.mstore(addr: 0, value: first) - evm.return_data(offset: 0, len: 32) - } - - if sel == STRING_LEN_SELECTOR { - let view = decode_string_view(CallData::with_base(4)) - evm.mstore(addr: 0, value: view.len()) - evm.return_data(offset: 0, len: 32) - } - - evm.revert(offset: 0, len: 0) -} -"#; - - Some( - FeContractHarness::compile_from_source( - "ViewHarness", - source, - CompileOptions::default(), - ) - .expect("dynamic view contract should compile"), - ) - } - - fn compile_storage_bytes_contract() -> Option { - let source = r#" -use std::abi::sol -use std::abi::sol::{decode_bytes_view, decode_bytes_view_at} -use std::evm::{CallData, Evm, RawStorage, StorageBytes, emit_bytes_event_view} - -const SET_SELECTOR: u32 = sol("set(bytes)") -const GET_SELECTOR: u32 = sol("get()") -const CLEAR_SELECTOR: u32 = sol("clear()") -const EMIT_SELECTOR: u32 = sol("emit(bytes)") -const TOPIC0: u256 = 0x1234 - -type Blobs = StorageBytes - -#[contract_init(StorageBytesHarness)] -fn init() uses (evm: mut Evm) { - evm.create_contract(runtime) -} - -#[contract_runtime(StorageBytesHarness)] -fn runtime() uses (evm: mut Evm) { - let sel = evm.selector() - with (RawStorage = evm) { - let mut blobs: Blobs = Blobs::new() - - if sel == SET_SELECTOR { - let view = decode_bytes_view(CallData::with_base(4)) - with (mut blobs) { - blobs.store_view(key: 0, view: view) - } - evm.return_data(offset: 0, len: 0) - } - - if sel == GET_SELECTOR { - blobs.encode_return(key: 0) - } - - if sel == CLEAR_SELECTOR { - with (mut blobs) { - blobs.clear(key: 0) - } - evm.return_data(offset: 0, len: 0) - } - - if sel == EMIT_SELECTOR { - let view = decode_bytes_view_at(CallData::new(), base: 4, head_pos: 0) - emit_bytes_event_view(topic0: TOPIC0, view: view) - evm.return_data(offset: 0, len: 0) - } - } - - evm.revert(offset: 0, len: 0) -} -"#; - - Some( - FeContractHarness::compile_from_source( - "StorageBytesHarness", - source, - CompileOptions::default(), - ) - .expect("storage bytes contract should compile"), - ) - } - - fn emit_then_text_contract_source() -> &'static str { - r#" -use std::abi::{sol, Bytes} -use std::evm::emit_bytes_event_view - -const TOPIC0: u256 = 0x1234 - -msg EmitThenTextMsg { - #[selector = sol("emitAndReturn(bytes)")] - EmitAndReturn { data: Bytes } -> Text, -} - -pub contract EmitThenText { - recv EmitThenTextMsg { - EmitAndReturn { data } -> Text { - emit_bytes_event_view(topic0: TOPIC0, view: data.view()) - "emit-and-return-abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789" - } - } -} -"# - } - - fn compile_emit_then_text_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "EmitThenText", - emit_then_text_contract_source(), - CompileOptions::default(), - ) - .expect("emit-then-text contract should compile"), - ) - } - - fn raw_static_target_contract_source() -> &'static str { - r#" -use std::abi::sol - -msg RawStaticTargetMsg { - #[selector = sol("word()")] - Word -> u256, - - #[selector = sol("flag()")] - Flag -> bool, -} - -pub contract RawStaticTarget { - recv RawStaticTargetMsg { - Word -> u256 { - 7 - } - - Flag -> bool { - true - } - } -} -"# - } - - fn compile_raw_static_target_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "RawStaticTarget", - raw_static_target_contract_source(), - CompileOptions::default(), - ) - .expect("raw static target contract should compile"), - ) - } - - fn raw_static_caller_contract_source() -> &'static str { - r#" -use std::abi::sol -use std::evm::{Evm, Address, Ctx, RawMem, staticcall_decode} - -const WORD_SELECTOR: u32 = sol("word()") -const FLAG_SELECTOR: u32 = sol("flag()") - -msg RawStaticCallerMsg { - #[selector = sol("callWord(address)")] - CallWord { target: Address } -> u256, - - #[selector = sol("callFlag(address)")] - CallFlag { target: Address } -> bool, -} - -pub contract RawStaticCaller { - recv RawStaticCallerMsg { - CallWord { target } -> u256 uses (evm: mut Evm) { - evm.mstore(addr: 0, value: (WORD_SELECTOR as u256) << 224) - staticcall_decode(addr: target, gas: evm.gas(), args_offset: 0, args_len: 4) - } - CallFlag { target } -> bool uses (evm: mut Evm) { - evm.mstore(addr: 0, value: (FLAG_SELECTOR as u256) << 224) - staticcall_decode(addr: target, gas: evm.gas(), args_offset: 0, args_len: 4) - } - } -} -"# - } - - fn compile_raw_static_caller_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "RawStaticCaller", - raw_static_caller_contract_source(), - CompileOptions::default(), - ) - .expect("raw static caller contract should compile"), - ) - } - - fn bad_bool_target_contract_source() -> &'static str { - r#" -use std::abi::sol -use std::evm::Evm - -const FLAG_SELECTOR: u32 = sol("flag()") - -#[contract_init(BadBoolTarget)] -fn init() uses (evm: mut Evm) { - evm.create_contract(runtime) -} - -#[contract_runtime(BadBoolTarget)] -fn runtime() uses (evm: mut Evm) { - if evm.selector() == FLAG_SELECTOR { - evm.mstore(addr: 0, value: 2) - evm.return_data(offset: 0, len: 32) - } - - evm.revert(offset: 0, len: 0) -} -"# - } - - fn compile_bad_bool_target_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "BadBoolTarget", - bad_bool_target_contract_source(), - CompileOptions::default(), - ) - .expect("bad bool target contract should compile"), - ) - } - - fn string_echo_contract_source() -> &'static str { - r#" -use std::abi::sol -use std::evm::effects::Log - -msg EchoMsg { - #[selector = sol("echo(string)")] - Echo { text: Text } -> Text, - - #[selector = sol("emit(string)")] - Emit { text: Text } -> bool, -} - -#[event] -struct Echoed { - text: Text, -} - -pub contract StringEcho uses (log: mut Log) { - recv EchoMsg { - Echo { text } -> Text { - text - } - - Emit { text } -> bool uses (mut log) { - log.emit(Echoed { text }) - true - } - } -} -"# - } - - fn string_caller_contract_source() -> &'static str { - r#" -use std::abi::sol -use std::evm::{Address, Call} - -msg EchoMsg { - #[selector = sol("echo(string)")] - Echo { text: Text } -> Text, -} - -msg CallerMsg { - #[selector = sol("callEcho(address,string)")] - CallEcho { target: Address, text: Text } -> Text, -} - -pub contract StringCaller uses (call: mut Call) { - recv CallerMsg { - CallEcho { target, text } -> Text uses (mut call) { - target.call(EchoMsg::Echo { text }) - } - } -} -"# - } - - fn string_literal_contract_source() -> &'static str { - r#" -use std::abi::sol - -msg LiteralMsg { - #[selector = sol("literal()")] - Literal -> Text, -} - -pub contract StringLiteral { - recv LiteralMsg { - Literal -> Text { - let text = "literal-abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789" - text - } - } -} -"# - } - - fn compile_string_echo_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "StringEcho", - string_echo_contract_source(), - CompileOptions::default(), - ) - .expect("string echo contract should compile"), - ) - } - - fn compile_string_caller_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "StringCaller", - string_caller_contract_source(), - CompileOptions::default(), - ) - .expect("string caller contract should compile"), - ) - } - - fn compile_string_literal_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "StringLiteral", - string_literal_contract_source(), - CompileOptions::default(), - ) - .expect("string literal contract should compile"), - ) - } - - fn string_view_contract_source() -> &'static str { - r#" -use std::abi::sol - -msg ViewMsg { - #[selector = sol("head(string)")] - Head { text: Text } -> u8, -} - -pub contract StringViewHead { - recv ViewMsg { - Head { text } -> u8 { - text.view().byte_at(0) - } - } -} -"# - } - - fn compile_string_view_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "StringViewHead", - string_view_contract_source(), - CompileOptions::default(), - ) - .expect("string view contract should compile"), - ) - } - - fn vec_echo_contract_source() -> &'static str { - r#" -use std::abi::sol - -msg VecMsg { - #[selector = sol("echo(uint256[])")] - Echo { values: Vec } -> Vec, -} - -pub contract VecEcho { - recv VecMsg { - Echo { values } -> Vec { - values - } - } -} -"# - } - - fn compile_vec_echo_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "VecEcho", - vec_echo_contract_source(), - CompileOptions::default(), - ) - .expect("vec echo contract should compile"), - ) - } - - fn nested_tuple_echo_contract_source() -> &'static str { - r#" -use std::abi::sol - -msg NestedEchoMsg { - #[selector = sol("echo((string,uint64))")] - Echo { pair: (Text, u64) } -> (Text, u64), -} - -pub contract NestedTupleEcho { - recv NestedEchoMsg { - Echo { pair } -> (Text, u64) { - pair - } - } -} -"# - } - - fn nested_tuple_caller_contract_source() -> &'static str { - r#" -use std::abi::sol -use std::evm::{Address, Call} - -msg NestedEchoMsg { - #[selector = sol("echo((string,uint64))")] - Echo { pair: (Text, u64) } -> (Text, u64), -} - -msg NestedCallerMsg { - #[selector = sol("callEcho(address,(string,uint64))")] - CallEcho { target: Address, pair: (Text, u64) } -> (Text, u64), -} - -pub contract NestedTupleCaller uses (call: mut Call) { - recv NestedCallerMsg { - CallEcho { target, pair } -> (Text, u64) uses (mut call) { - target.call(NestedEchoMsg::Echo { pair }) - } - } -} -"# - } - - fn nested_tuple_init_contract_source() -> &'static str { - r#" -use std::abi::sol - -msg StoredPairMsg { - #[selector = sol("getTextLen()")] - GetTextLen -> u256, - #[selector = sol("getFirstByte()")] - GetFirstByte -> u8, - #[selector = sol("getCount()")] - GetCount -> u64, -} - -struct PairStore { - text_len: u256, - first_byte: u8, - count: u64, -} - -pub contract NestedTupleInit { - mut store: PairStore - - init(text: Text, count: u64) uses (mut store) { - store.text_len = text.len() - store.first_byte = if text.is_empty() { 0 } else { text.as_bytes().byte_at(0) } - store.count = count - } - - recv StoredPairMsg { - GetTextLen -> u256 uses (store) { - store.text_len - } - - GetFirstByte -> u8 uses (store) { - store.first_byte - } - - GetCount -> u64 uses (store) { - store.count - } - } -} -"# - } - - fn tuple_head_guard_contract_source() -> &'static str { - r#" -use std::abi::sol - -msg TupleHeadGuardMsg { - #[selector = sol("read((uint64,string))")] - Read { pair: (u64, Text) } -> u256, -} - -pub contract TupleHeadGuard { - recv TupleHeadGuardMsg { - Read { pair } -> u256 { - (pair.0 as u256) + pair.1.len() - } - } -} -"# - } - - fn compile_nested_tuple_echo_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "NestedTupleEcho", - nested_tuple_echo_contract_source(), - CompileOptions::default(), - ) - .expect("nested tuple echo contract should compile"), - ) - } - - fn compile_nested_tuple_caller_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "NestedTupleCaller", - nested_tuple_caller_contract_source(), - CompileOptions::default(), - ) - .expect("nested tuple caller contract should compile"), - ) - } - - fn compile_nested_tuple_init_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "NestedTupleInit", - nested_tuple_init_contract_source(), - CompileOptions::default(), - ) - .expect("nested tuple init contract should compile"), - ) - } - - fn compile_tuple_head_guard_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "TupleHeadGuard", - tuple_head_guard_contract_source(), - CompileOptions::default(), - ) - .expect("tuple head guard contract should compile"), - ) - } - - fn fixed_string_decode_contract_source() -> &'static str { - r#" -use std::abi::sol - -msg FixedStringDecodeMsg { - #[selector = sol("ok(string)")] - Ok { text: String<31> } -> u256, -} - -pub contract FixedStringDecode { - recv FixedStringDecodeMsg { - Ok { text } -> u256 { - 1 - } - } -} -"# - } - - fn compile_fixed_string_decode_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "FixedStringDecode", - fixed_string_decode_contract_source(), - CompileOptions::default(), - ) - .expect("fixed string decode contract should compile"), - ) - } - - fn fixed_string_return_caller_contract_source() -> &'static str { - r#" -use std::abi::sol -use std::evm::{Address, Call} - -msg FixedStringEchoMsg { - #[selector = sol("echo(string)")] - Echo { text: Text } -> String<31>, -} - -msg FixedStringCallerMsg { - #[selector = sol("forward(address,string)")] - Forward { target: Address, text: Text } -> String<31>, -} - -pub contract FixedStringCaller uses (call: mut Call) { - recv FixedStringCallerMsg { - Forward { target, text } -> String<31> uses (mut call) { - target.call(FixedStringEchoMsg::Echo { text }) - } - } -} -"# - } - - fn compile_fixed_string_return_caller_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "FixedStringCaller", - fixed_string_return_caller_contract_source(), - CompileOptions::default(), - ) - .expect("fixed string return caller contract should compile"), - ) - } - - fn create2_init_args_contract_source() -> &'static str { - r#" -use std::abi::sol -use std::evm::Create - -msg StaticChildMsg { - #[selector = sol("getByte()")] - GetByte -> u8, -} - -msg DynamicChildMsg { - #[selector = sol("getTextLen()")] - GetTextLen -> u256, - #[selector = sol("getFirstByte()")] - GetFirstByte -> u8, - #[selector = sol("getCount()")] - GetCount -> u64, -} - -msg ParentMsg { - #[selector = sol("deployStatic()")] - DeployStatic -> u256, - #[selector = sol("deployDynamic(string,uint64)")] - DeployDynamic { text: Text, count: u64 } -> u256, -} - -pub contract StaticChild { - mut stored: u8 - - init(value: u8) uses (mut stored) { - stored = value - } - - recv StaticChildMsg { - GetByte -> u8 uses (stored) { - stored - } - } -} - -struct DynamicStore { - text_len: u256, - first_byte: u8, - count: u64, -} - -pub contract DynamicChild { - mut store: DynamicStore - - init(text: Text, count: u64) uses (mut store) { - store.text_len = text.len() - store.first_byte = if text.is_empty() { 0 } else { text.as_bytes().byte_at(0) } - store.count = count - } - - recv DynamicChildMsg { - GetTextLen -> u256 uses (store) { - store.text_len - } - - GetFirstByte -> u8 uses (store) { - store.first_byte - } - - GetCount -> u64 uses (store) { - store.count - } - } -} - -pub contract Create2Parent uses (create: mut Create) { - recv ParentMsg { - DeployStatic -> u256 uses (mut create) { - create.create2(value: 0, args: (7,), salt: 1).inner - } - - DeployDynamic { text, count } -> u256 uses (mut create) { - create.create2(value: 0, args: (text, count), salt: 2).inner - } - } -} -"# - } - - fn compile_create2_init_args_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "Create2Parent", - create2_init_args_contract_source(), - CompileOptions::default(), - ) - .expect("create2 init arg contract should compile"), - ) - } - - fn custom_width_encode_contract_source() -> &'static str { - r#" -use std::abi::sol::{self, Int40, Int136, Uint24, Uint160} -use std::evm::effects::Log - -msg CustomWidthMsg { - #[selector = sol("goodUint24()")] - GoodUint24 -> Uint24, - #[selector = sol("badUint24()")] - BadUint24 -> Uint24, - #[selector = sol("goodUint160()")] - GoodUint160 -> Uint160, - #[selector = sol("badUint160()")] - BadUint160 -> Uint160, - #[selector = sol("goodInt40()")] - GoodInt40 -> Int40, - #[selector = sol("badInt40()")] - BadInt40 -> Int40, - #[selector = sol("goodInt136()")] - GoodInt136 -> Int136, - #[selector = sol("badInt136()")] - BadInt136 -> Int136, - #[selector = sol("emitGoodUint160()")] - EmitGoodUint160 -> bool, - #[selector = sol("emitBadUint160()")] - EmitBadUint160 -> bool, -} - -#[event] -struct SeenUint160 { - #[indexed] - value: Uint160, -} - -pub contract CustomWidthBoundary uses (log: mut Log) { - recv CustomWidthMsg { - GoodUint24 -> Uint24 { - Uint24 { val: 7 } - } - - BadUint24 -> Uint24 { - Uint24 { val: (1 as u32) << 31 } - } - - GoodUint160 -> Uint160 { - Uint160 { val: 1 } - } - - BadUint160 -> Uint160 { - Uint160 { val: (1 as u256) << 200 } - } - - GoodInt40 -> Int40 { - Int40 { val: 5 } - } - - BadInt40 -> Int40 { - Int40 { val: (1 as i64) << 60 } - } - - GoodInt136 -> Int136 { - Int136 { val: 5 } - } - - BadInt136 -> Int136 { - Int136 { val: (1 as i256) << 180 } - } - - EmitGoodUint160 -> bool uses (mut log) { - log.emit(SeenUint160 { value: Uint160 { val: 1 } }) - true - } - - EmitBadUint160 -> bool uses (mut log) { - log.emit(SeenUint160 { value: Uint160 { val: (1 as u256) << 200 } }) - true - } - } -} -"# - } - - fn compile_custom_width_encode_contract() -> Option { - Some( - FeContractHarness::compile_from_source( - "CustomWidthBoundary", - custom_width_encode_contract_source(), - CompileOptions::default(), - ) - .expect("custom width encode contract should compile"), - ) - } - - fn nested_tuple_param_type() -> ParamType { - ParamType::Tuple(vec![ParamType::String, ParamType::Uint(64)]) - } - - fn nested_tuple_token(text: &str, count: u64) -> Token { - Token::Tuple(vec![ - Token::String(text.to_string()), - Token::Uint(AbiU256::from(count)), - ]) - } - - fn long_string_value(tag: &str) -> String { - format!("{tag}-abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789") - } - - fn dyn_uint_array_param_type() -> ParamType { - ParamType::Array(Box::new(ParamType::Uint(256))) - } - - fn dyn_uint_array_token(values: &[u64]) -> Token { - Token::Array( - values - .iter() - .map(|value| Token::Uint(AbiU256::from(*value))) - .collect::>(), - ) - } - - fn fixed_bool_array_param_type(len: usize) -> ParamType { - ParamType::FixedArray(Box::new(ParamType::Bool), len) - } - - fn fixed_bool_array_token(len: usize) -> Token { - Token::FixedArray( - (0..len) - .map(|i| Token::Bool(i % 2 == 0)) - .collect::>(), - ) - } - - fn fixed_string_array_param_type(len: usize) -> ParamType { - ParamType::FixedArray(Box::new(ParamType::String), len) - } - - fn fixed_string_array_token(len: usize) -> Token { - Token::FixedArray( - (0..len) - .map(|i| Token::String(long_string_value(&format!("str-{i:02}")))) - .collect::>(), - ) - } - - fn fixed_bytes_array_param_type(len: usize) -> ParamType { - ParamType::FixedArray(Box::new(ParamType::Bytes), len) - } - - fn fixed_bytes_array_token(len: usize) -> Token { - Token::FixedArray( - (0..len) - .map(|i| Token::Bytes(vec![i as u8, (i as u8) ^ 0x5a, 0xff])) - .collect::>(), - ) - } - - fn fixed_bool_array_contract_source(len: usize) -> String { - format!( - r#" -use std::abi::sol - -msg FixedBoolArrayMsg {{ - #[selector = sol("echo(bool[{len}])")] - Echo {{ value: [bool; {len}] }} -> [bool; {len}], -}} - -pub contract FixedBoolArrayBoundary {{ - recv FixedBoolArrayMsg {{ - Echo {{ value }} -> [bool; {len}] {{ - value - }} - }} -}} -"# - ) - } - - fn fixed_dynamic_array_contract_source(len: usize) -> String { - format!( - r#" -use std::abi::{{sol, Bytes}} - -msg FixedDynamicArrayMsg {{ - #[selector = sol("echoString(string[{len}])")] - EchoString {{ value: [Text; {len}] }} -> [Text; {len}], - #[selector = sol("echoBytes(bytes[{len}])")] - EchoBytes {{ value: [Bytes; {len}] }} -> [Bytes; {len}], -}} - -pub contract FixedDynamicArrayBoundary {{ - recv FixedDynamicArrayMsg {{ - EchoString {{ value }} -> [Text; {len}] {{ - value - }} - - EchoBytes {{ value }} -> [Bytes; {len}] {{ - value - }} - }} -}} -"# - ) - } - - #[allow(deprecated)] - fn encode_typed_function_call( - name: &str, - inputs: Vec, - args: &[Token], - ) -> Result, HarnessError> { - let function = Function { - name: name.to_string(), - inputs: inputs - .into_iter() - .map(|kind| Param { - name: String::new(), - kind, - internal_type: None, - }) - .collect(), - outputs: Vec::new(), - constant: None, - state_mutability: StateMutability::NonPayable, - }; - Ok(function.encode_input(args)?) - } - - fn assert_empty_revert(err: HarnessError) { - match err { - HarnessError::Revert(data) => { - assert!(data.0.is_empty(), "expected empty revert data, got {data}"); - } - other => panic!("expected revert, got {other:?}"), - } - } - - fn raw_single_word_call(signature: &str, word: [u8; 32]) -> Vec { - let function = AbiParser::default() - .parse_function(signature) - .expect("signature should parse"); - let mut calldata = function.short_signature().to_vec(); - calldata.extend_from_slice(&word); - calldata - } - - fn word_from_u256(value: AbiU256) -> [u8; 32] { - let mut word = [0u8; 32]; - value.to_big_endian(&mut word); - word - } - - fn address_word(bytes: [u8; 20]) -> [u8; 32] { - let mut word = [0u8; 32]; - word[12..].copy_from_slice(&bytes); - word - } - - #[test] - fn erc20_contract_test() { - let source_path = concat!( - env!("CARGO_MANIFEST_DIR"), - "/../codegen/tests/fixtures/erc20.fe" - ); - let harness = FeContractHarness::compile_from_file( - "CoolCoin", - source_path, - CompileOptions::default(), - ) - .expect("compilation should succeed"); - - let owner = Address::with_last_byte(0x01); - let alice = Address::with_last_byte(0x02); - let bob = Address::with_last_byte(0x03); - - let owner_abi = ethers_core::types::Address::from_low_u64_be(1); - let alice_abi = ethers_core::types::Address::from_low_u64_be(2); - let bob_abi = ethers_core::types::Address::from_low_u64_be(3); - - let initial_supply = AbiU256::from(1_000u64); - let mut instance = harness - .deploy_with_init_args(&[Token::Uint(initial_supply), Token::Address(owner_abi)]) - .expect("deployment succeeds"); - - let owner_opts = ExecutionOptions { - caller: owner, - ..ExecutionOptions::default() - }; - - let name_call = encode_function_call("name()", &[]).unwrap(); - let name_res = instance - .call_raw(&name_call, owner_opts) - .expect("name() should succeed"); - assert_eq!( - bytes_to_string(&name_res.return_data).unwrap(), - "CoolCoin", - "name() should return CoolCoin" - ); - - let symbol_call = encode_function_call("symbol()", &[]).unwrap(); - let symbol_res = instance - .call_raw(&symbol_call, owner_opts) - .expect("symbol() should succeed"); - assert_eq!( - bytes_to_string(&symbol_res.return_data).unwrap(), - "COOL", - "symbol() should return COOL" - ); - - let decimals_call = encode_function_call("decimals()", &[]).unwrap(); - let decimals_res = instance - .call_raw(&decimals_call, owner_opts) - .expect("decimals() should succeed"); - assert_eq!( - bytes_to_u256(&decimals_res.return_data).unwrap(), - U256::from(18u64), - "decimals() should return 18" - ); - - let total_supply_call = encode_function_call("totalSupply()", &[]).unwrap(); - let total_supply_res = instance - .call_raw(&total_supply_call, owner_opts) - .expect("totalSupply() should succeed"); - assert_eq!( - bytes_to_u256(&total_supply_res.return_data).unwrap(), - U256::from(1_000u64), - "totalSupply() should match constructor mint" - ); - - let bal_owner_call = - encode_function_call("balanceOf(address)", &[Token::Address(owner_abi)]).unwrap(); - let bal_owner = instance - .call_raw(&bal_owner_call, owner_opts) - .expect("balanceOf(owner) should succeed"); - assert_eq!( - bytes_to_u256(&bal_owner.return_data).unwrap(), - U256::from(1_000u64), - "owner should receive initial supply" - ); - - // transfer 250 from owner -> alice - let transfer_call = encode_function_call( - "transfer(address,uint256)", - &[ - Token::Address(alice_abi), - Token::Uint(AbiU256::from(250u64)), - ], - ) - .unwrap(); - let transfer_res = instance - .call_raw(&transfer_call, owner_opts) - .expect("transfer should succeed"); - assert_eq!( - bytes_to_u256(&transfer_res.return_data).unwrap(), - U256::from(1u64), - "transfer should return true" - ); - - let bal_owner = instance - .call_raw(&bal_owner_call, owner_opts) - .expect("balanceOf(owner) after transfer should succeed"); - assert_eq!( - bytes_to_u256(&bal_owner.return_data).unwrap(), - U256::from(750u64), - "owner balance should decrease after transfer" - ); - - let bal_alice_call = - encode_function_call("balanceOf(address)", &[Token::Address(alice_abi)]).unwrap(); - let bal_alice = instance - .call_raw(&bal_alice_call, owner_opts) - .expect("balanceOf(alice) after transfer should succeed"); - assert_eq!( - bytes_to_u256(&bal_alice.return_data).unwrap(), - U256::from(250u64), - "alice balance should increase after transfer" - ); - - // approve bob to spend 100 from owner - let approve_call = encode_function_call( - "approve(address,uint256)", - &[Token::Address(bob_abi), Token::Uint(AbiU256::from(100u64))], - ) - .unwrap(); - let approve_res = instance - .call_raw(&approve_call, owner_opts) - .expect("approve should succeed"); - assert_eq!( - bytes_to_u256(&approve_res.return_data).unwrap(), - U256::from(1u64), - "approve should return true" - ); - - let allowance_call = encode_function_call( - "allowance(address,address)", - &[Token::Address(owner_abi), Token::Address(bob_abi)], - ) - .unwrap(); - let allowance_res = instance - .call_raw(&allowance_call, owner_opts) - .expect("allowance should succeed"); - assert_eq!( - bytes_to_u256(&allowance_res.return_data).unwrap(), - U256::from(100u64), - "allowance should match approve" - ); - - // transferFrom by bob: owner -> alice, 60 - let transfer_from_call = encode_function_call( - "transferFrom(address,address,uint256)", - &[ - Token::Address(owner_abi), - Token::Address(alice_abi), - Token::Uint(AbiU256::from(60u64)), - ], - ) - .unwrap(); - let bob_opts = ExecutionOptions { - caller: bob, - ..ExecutionOptions::default() - }; - let transfer_from_res = instance - .call_raw(&transfer_from_call, bob_opts) - .expect("transferFrom should succeed"); - assert_eq!( - bytes_to_u256(&transfer_from_res.return_data).unwrap(), - U256::from(1u64), - "transferFrom should return true" - ); - - let allowance_res = instance - .call_raw(&allowance_call, owner_opts) - .expect("allowance after transferFrom should succeed"); - assert_eq!( - bytes_to_u256(&allowance_res.return_data).unwrap(), - U256::from(40u64), - "allowance should decrease after transferFrom" - ); - - // mint 10 to alice (owner is MINTER) - let mint_call = encode_function_call( - "mint(address,uint256)", - &[Token::Address(alice_abi), Token::Uint(AbiU256::from(10u64))], - ) - .unwrap(); - let mint_res = instance - .call_raw(&mint_call, owner_opts) - .expect("mint should succeed"); - assert_eq!( - bytes_to_u256(&mint_res.return_data).unwrap(), - U256::from(1u64), - "mint should return true" - ); - - let total_supply_res = instance - .call_raw(&total_supply_call, owner_opts) - .expect("totalSupply after mint should succeed"); - assert_eq!( - bytes_to_u256(&total_supply_res.return_data).unwrap(), - U256::from(1_010u64), - "totalSupply should increase after mint" - ); - - // burn 5 from alice - let burn_call = - encode_function_call("burn(uint256)", &[Token::Uint(AbiU256::from(5u64))]).unwrap(); - let alice_opts = ExecutionOptions { - caller: alice, - ..ExecutionOptions::default() - }; - let burn_res = instance - .call_raw(&burn_call, alice_opts) - .expect("burn should succeed"); - assert_eq!( - bytes_to_u256(&burn_res.return_data).unwrap(), - U256::from(1u64), - "burn should return true" - ); - - let total_supply_res = instance - .call_raw(&total_supply_call, owner_opts) - .expect("totalSupply after burn should succeed"); - assert_eq!( - bytes_to_u256(&total_supply_res.return_data).unwrap(), - U256::from(1_005u64), - "totalSupply should decrease after burn" - ); - } - - #[test] - fn calldata_rebased_view_reads_after_selector() { - let Some(harness) = compile_calldata_decode_contract() else { - return; - }; - - let call = encode_function_call("read(uint256)", &[Token::Uint(AbiU256::from(42u64))]) - .expect("calldata should encode"); - let result = harness - .call_raw(&call, ExecutionOptions::default()) - .expect("read(uint256) should succeed"); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(42u64), - "CallData::with_base(4).decode() should read the ABI word after the selector" - ); - } - - #[test] - fn calldata_decode_raw_starts_at_byte_zero() { - let Some(harness) = compile_calldata_decode_contract() else { - return; - }; - - let call = encode_function_call("raw(uint256)", &[Token::Uint(AbiU256::from(42u64))]) - .expect("calldata should encode"); - let result = harness - .call_raw(&call, ExecutionOptions::default()) - .expect("raw(uint256) should succeed"); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - bytes_to_u256(&call[..32]).unwrap(), - "CallData::new().decode() should read the first 32 calldata bytes including the selector prefix" - ); - } - - #[test] - fn evm_decode_args_reads_after_selector() { - let Some(harness) = compile_calldata_decode_contract() else { - return; - }; - - let call = encode_function_call("args(uint256)", &[Token::Uint(AbiU256::from(77u64))]) - .expect("calldata should encode"); - let result = harness - .call_raw(&call, ExecutionOptions::default()) - .expect("args(uint256) should succeed"); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(77u64), - "evm.decode_args() should decode the ABI payload after the selector" - ); - } - - #[test] - fn evm_selector_matches_current_call_selector() { - let Some(harness) = compile_calldata_decode_contract() else { - return; - }; - - let call = encode_function_call("selector()", &[]).expect("calldata should encode"); - let result = harness - .call_raw(&call, ExecutionOptions::default()) - .expect("selector() should succeed"); - let expected = u32::from_be_bytes([call[0], call[1], call[2], call[3]]); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(expected), - "evm.selector() should return the current 4-byte selector" - ); - } - - #[test] - fn evm_decode_args_tuple_round_trip() { - let Some(harness) = compile_calldata_decode_contract() else { - return; - }; - - let call = encode_function_call( - "tuple(uint64,bool)", - &[Token::Uint(AbiU256::from(7u64)), Token::Bool(true)], - ) - .expect("calldata should encode"); - let result = harness - .call_raw(&call, ExecutionOptions::default()) - .expect("tuple(uint64,bool) should succeed"); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(7u64), - "evm.selector() and evm.decode_args() should round-trip tuple arguments" - ); - } - - #[test] - fn calldata_decode_input_over_rebased_view_matches_decode_input_at() { - let Some(harness) = compile_calldata_decode_contract() else { - return; - }; - - let call = encode_function_call("generic(uint256)", &[Token::Uint(AbiU256::from(99u64))]) - .expect("calldata should encode"); - let result = harness - .call_raw(&call, ExecutionOptions::default()) - .expect("generic(uint256) should succeed"); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(99u64), - "decode_input(CallData::with_base(4)) should match decode_input_at(CallData::new(), 4)" - ); - } - - #[test] - fn calldata_decode_input_at_reverts_when_base_is_past_end() { - let Some(harness) = compile_calldata_decode_contract() else { - return; - }; - - let call = encode_function_call("bad()", &[]).expect("calldata should encode"); - let err = harness - .call_raw(&call, ExecutionOptions::default()) - .expect_err("bad() should revert when decode_input_at base exceeds calldata len"); - - assert_empty_revert(err); - } - - #[test] - fn calldata_view_decode_reverts_when_base_is_past_end() { - let Some(harness) = compile_calldata_decode_contract() else { - return; - }; - - let call = encode_function_call("bad_view()", &[]).expect("calldata should encode"); - let err = harness - .call_raw(&call, ExecutionOptions::default()) - .expect_err("bad_view() should revert when the rebased calldata view is past the end"); - - assert_empty_revert(err); - } - - #[test] - fn canonical_bool_decode_accepts_only_zero_or_one() { - let Some(harness) = compile_canonical_decode_contract() else { - return; - }; - - let ok = harness - .call_function( - "readBool(bool)", - &[Token::Bool(true)], - ExecutionOptions::default(), - ) - .expect("canonical bool should decode"); - assert_eq!(bytes_to_u256(&ok.return_data).unwrap(), U256::from(1u64)); - - let invalid = raw_single_word_call("readBool(bool)", word_from_u256(AbiU256::from(2u64))); - let err = harness - .call_raw(&invalid, ExecutionOptions::default()) - .expect_err("bool=2 should revert"); - assert_empty_revert(err); - } - - #[test] - fn canonical_u8_decode_rejects_nonzero_high_bits() { - let Some(harness) = compile_canonical_decode_contract() else { - return; - }; - - let ok = harness - .call_function( - "readU8(uint8)", - &[Token::Uint(AbiU256::from(42u64))], - ExecutionOptions::default(), - ) - .expect("canonical uint8 should decode"); - assert_eq!(bytes_to_u256(&ok.return_data).unwrap(), U256::from(42u64)); - - let invalid = - raw_single_word_call("readU8(uint8)", word_from_u256(AbiU256::from(0x100u64))); - let err = harness - .call_raw(&invalid, ExecutionOptions::default()) - .expect_err("uint8 with nonzero high bits should revert"); - assert_empty_revert(err); - } - - #[test] - fn canonical_i8_decode_requires_sign_extension() { - let Some(harness) = compile_canonical_decode_contract() else { - return; - }; - - let ok = raw_single_word_call("readI8(int8)", word_from_u256(AbiU256::from(127u64))); - let result = harness - .call_raw(&ok, ExecutionOptions::default()) - .expect("canonical int8=127 should decode"); - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(1u64) - ); - - let mut invalid_word = [0u8; 32]; - invalid_word[31] = 0xff; - let invalid = raw_single_word_call("readI8(int8)", invalid_word); - let err = harness - .call_raw(&invalid, ExecutionOptions::default()) - .expect_err("non-sign-extended int8 should revert"); - assert_empty_revert(err); - } - - #[test] - fn canonical_address_decode_rejects_nonzero_high_bits() { - let Some(harness) = compile_canonical_decode_contract() else { - return; - }; - - let raw = [0x11u8; 20]; - let ok_word = address_word(raw); - let ok = harness - .call_raw( - &raw_single_word_call("readAddress(address)", ok_word), - ExecutionOptions::default(), - ) - .expect("canonical address should decode"); - assert_eq!( - bytes_to_u256(&ok.return_data).unwrap(), - bytes_to_u256(&ok_word).unwrap(), - "address decode should preserve the low 160 bits" - ); - - let mut invalid_word = ok_word; - invalid_word[0] = 1; - let invalid = raw_single_word_call("readAddress(address)", invalid_word); - let err = harness - .call_raw(&invalid, ExecutionOptions::default()) - .expect_err("address with nonzero high bits should revert"); - assert_empty_revert(err); - } - - #[test] - fn decode_bytes_view_reads_dynamic_arg_length() { - let Some(harness) = compile_dynamic_view_contract() else { - return; - }; - - let call = encode_function_call( - "bytesLen(bytes)", - &[Token::Bytes(vec![0xaa, 0xbb, 0xcc, 0xdd, 0xee])], - ) - .expect("calldata should encode"); - let result = harness - .call_raw(&call, ExecutionOptions::default()) - .expect("bytesLen(bytes) should succeed"); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(5u64), - "decode_bytes_view should expose the dynamic byte length" - ); - } - - #[test] - fn decode_bytes_view_at_can_target_second_dynamic_arg() { - let Some(harness) = compile_dynamic_view_contract() else { - return; - }; - - let call = encode_function_call( - "secondBytesLen(bytes,bytes)", - &[ - Token::Bytes(vec![0x01, 0x02]), - Token::Bytes(vec![0xaa, 0xbb, 0xcc, 0xdd]), - ], - ) - .expect("calldata should encode"); - let result = harness - .call_raw(&call, ExecutionOptions::default()) - .expect("secondBytesLen(bytes,bytes) should succeed"); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(4u64), - "decode_bytes_view_at should decode the selected dynamic head" - ); - } - - #[test] - fn decode_string_view_exposes_string_bytes() { - let Some(harness) = compile_dynamic_view_contract() else { - return; - }; - - let first_call = - encode_function_call("stringFirst(string)", &[Token::String("hello".to_string())]) - .expect("calldata should encode"); - let first = harness - .call_raw(&first_call, ExecutionOptions::default()) - .expect("stringFirst(string) should succeed"); - assert_eq!( - bytes_to_u256(&first.return_data).unwrap(), - U256::from(b'h' as u64), - "decode_string_view should expose the underlying UTF-8 bytes" - ); - - let len_call = - encode_function_call("stringLen(string)", &[Token::String("hello".to_string())]) - .expect("calldata should encode"); - let len = harness - .call_raw(&len_call, ExecutionOptions::default()) - .expect("stringLen(string) should succeed"); - assert_eq!( - bytes_to_u256(&len.return_data).unwrap(), - U256::from(5u64), - "decode_string_view should expose the dynamic string length" - ); - } - - #[test] - fn storage_bytes_round_trip_and_clear() { - let Some(harness) = compile_storage_bytes_contract() else { - return; - }; - - let mut instance = harness - .deploy_with_init() - .expect("storage bytes contract should deploy"); - let payload = vec![0xaa, 0xbb, 0xcc, 0xdd, 0xee]; - - instance - .call_function( - "set(bytes)", - &[Token::Bytes(payload.clone())], - ExecutionOptions::default(), - ) - .expect("set(bytes) should succeed"); - - let stored = instance - .call_function("get()", &[], ExecutionOptions::default()) - .expect("get() should succeed"); - let decoded = decode(&[ParamType::Bytes], &stored.return_data) - .expect("get() should return ABI-encoded bytes"); - assert_eq!(decoded, vec![Token::Bytes(payload.clone())]); - - instance - .call_function("clear()", &[], ExecutionOptions::default()) - .expect("clear() should succeed"); - - let cleared = instance - .call_function("get()", &[], ExecutionOptions::default()) - .expect("get() after clear should succeed"); - let decoded = decode(&[ParamType::Bytes], &cleared.return_data) - .expect("cleared get() should return ABI-encoded bytes"); - assert_eq!(decoded, vec![Token::Bytes(Vec::new())]); - } - - #[test] - fn emit_bytes_event_emits_a_log() { - let Some(harness) = compile_storage_bytes_contract() else { - return; - }; - - let mut instance = harness - .deploy_with_init() - .expect("storage bytes contract should deploy"); - let call = encode_function_call("emit(bytes)", &[Token::Bytes(vec![0xaa, 0xbb, 0xcc])]) - .expect("calldata should encode"); - let result = instance - .call_raw_with_logs(&call, ExecutionOptions::default()) - .expect("emit(bytes) should succeed"); - - assert_eq!(result.logs.len(), 1, "emit_bytes_event should emit one log"); - assert!( - result.logs[0].contains("aabbcc"), - "log output should contain the event payload bytes" - ); - } - - #[test] - fn emit_bytes_event_does_not_clobber_subsequent_dynamic_return() { - let Some(harness) = compile_emit_then_text_contract() else { - return; - }; - - let payload = vec![0xaa, 0xbb, 0xcc, 0xdd]; - let mut instance = harness - .deploy_with_init() - .expect("emit-then-text contract should deploy"); - let call = encode_function_call("emitAndReturn(bytes)", &[Token::Bytes(payload.clone())]) - .expect("calldata should encode"); - let result = instance - .call_raw_with_logs(&call, ExecutionOptions::default()) - .expect("emitAndReturn(bytes) should succeed"); - - assert_eq!(result.logs.len(), 1, "emit_bytes_event should emit one log"); - assert!( - result.logs[0].contains("aabbccdd"), - "log output should contain the event payload bytes" - ); - - let decoded = decode(&[ParamType::String], &result.result.return_data) - .expect("emitAndReturn(bytes) should return ABI-encoded string"); - assert_eq!( - decoded, - vec![Token::String(long_string_value("emit-and-return"))] - ); - } - - #[test] - fn raw_staticcall_decode_round_trips_word() { - let Some(target_harness) = compile_raw_static_target_contract() else { - return; - }; - let Some(caller_harness) = compile_raw_static_caller_contract() else { - return; - }; - - let mut caller = caller_harness - .deploy_with_init() - .expect("raw static caller contract should deploy"); - let target_addr = caller - .deploy_sidecar(target_harness.init_bytecode(), &[]) - .expect("raw static target sidecar should deploy"); - let target_abi = ethers_core::types::Address::from_slice(target_addr.as_slice()); - - let result = caller - .call_function( - "callWord(address)", - &[Token::Address(target_abi)], - ExecutionOptions::default(), - ) - .expect("callWord(address) should succeed"); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(7u64), - "staticcall_decode should ABI-decode the returned word" - ); - } - - #[test] - fn raw_staticcall_decode_rejects_empty_returndata() { - let Some(harness) = compile_raw_static_caller_contract() else { - return; - }; - - let mut caller = harness - .deploy_with_init() - .expect("raw static caller contract should deploy"); - let eoa = ethers_core::types::Address::from_low_u64_be(0x1234); - let err = caller - .call_function( - "callWord(address)", - &[Token::Address(eoa)], - ExecutionOptions::default(), - ) - .expect_err("callWord(address) should revert on empty returndata"); - - assert_empty_revert(err); - } - - #[test] - fn raw_staticcall_decode_rejects_noncanonical_bool() { - let Some(target_harness) = compile_bad_bool_target_contract() else { - return; - }; - let Some(caller_harness) = compile_raw_static_caller_contract() else { - return; - }; - - let mut caller = caller_harness - .deploy_with_init() - .expect("raw static caller contract should deploy"); - let target_addr = caller - .deploy_sidecar(target_harness.init_bytecode(), &[]) - .expect("bad bool target sidecar should deploy"); - let target_abi = ethers_core::types::Address::from_slice(target_addr.as_slice()); - let err = caller - .call_function( - "callFlag(address)", - &[Token::Address(target_abi)], - ExecutionOptions::default(), - ) - .expect_err("callFlag(address) should revert on non-canonical bool returndata"); - - assert_empty_revert(err); - } - - #[test] - fn dynamic_string_unannotated_literal_binding_round_trips() { - let Some(harness) = compile_string_literal_contract() else { - return; - }; - - let expected = long_string_value("literal"); - let mut instance = harness - .deploy_with_init() - .expect("string literal contract should deploy"); - let result = instance - .call_function("literal()", &[], ExecutionOptions::default()) - .expect("literal() should succeed"); - - let decoded = decode(&[ParamType::String], &result.return_data) - .expect("literal() should return ABI-encoded string"); - assert_eq!(decoded, vec![Token::String(expected)]); - } - - #[test] - fn dynamic_string_view_returns_first_byte() { - let Some(harness) = compile_string_view_contract() else { - return; - }; - - let payload = long_string_value("view"); - let mut instance = harness - .deploy_with_init() - .expect("string view contract should deploy"); - let result = instance - .call_function( - "head(string)", - &[Token::String(payload.clone())], - ExecutionOptions::default(), - ) - .expect("head(string) should succeed"); - - assert_eq!( - bytes_to_u256(&result.return_data).unwrap(), - U256::from(payload.as_bytes()[0]), - "head(string) should read through Text.view()" - ); - } - - #[test] - fn dynamic_string_round_trip_supports_long_payloads() { - let Some(harness) = compile_string_echo_contract() else { - return; - }; - - let payload = long_string_value("echo"); - let mut instance = harness - .deploy_with_init() - .expect("string echo contract should deploy"); - let result = instance - .call_function( - "echo(string)", - &[Token::String(payload.clone())], - ExecutionOptions::default(), - ) - .expect("echo(string) should succeed"); - - let decoded = decode(&[ParamType::String], &result.return_data) - .expect("echo(string) should return ABI-encoded string"); - assert_eq!(decoded, vec![Token::String(payload)]); - } - - #[test] - fn dynamic_string_decode_and_return_round_trip() { - let Some(harness) = compile_string_echo_contract() else { - return; - }; - - let payload = long_string_value("roundtrip"); - let mut instance = harness - .deploy_with_init() - .expect("string echo contract should deploy"); - let result = instance - .call_function( - "echo(string)", - &[Token::String(payload.clone())], - ExecutionOptions::default(), - ) - .expect("echo(string) should succeed"); - - let decoded = decode(&[ParamType::String], &result.return_data) - .expect("echo(string) should return ABI-encoded string"); - assert_eq!(decoded, vec![Token::String(payload)]); - } - - #[test] - fn dynamic_vec_alias_round_trips() { - let Some(harness) = compile_vec_echo_contract() else { - return; - }; - - let value = dyn_uint_array_token(&[3, 5, 8, 13, 21]); - let mut instance = harness - .deploy_with_init() - .expect("vec echo contract should deploy"); - let call = encode_typed_function_call( - "echo", - vec![dyn_uint_array_param_type()], - std::slice::from_ref(&value), - ) - .expect("typed calldata should encode"); - let result = instance - .call_raw(&call, ExecutionOptions::default()) - .expect("echo(uint256[]) should succeed"); - let decoded = decode(&[dyn_uint_array_param_type()], &result.return_data) - .expect("echo(uint256[]) should return ABI-encoded array"); - - assert_eq!(decoded, vec![value]); - } - - #[test] - fn dynamic_string_msg_call_round_trips() { - let Some(echo_harness) = compile_string_echo_contract() else { - return; - }; - let Some(caller_harness) = compile_string_caller_contract() else { - return; - }; - - let payload = long_string_value("caller"); - let mut caller = caller_harness - .deploy_with_init() - .expect("string caller contract should deploy"); - let echo_addr = caller - .deploy_sidecar(echo_harness.init_bytecode(), &[]) - .expect("string echo sidecar should deploy"); - let echo_abi = ethers_core::types::Address::from_slice(echo_addr.as_slice()); - - let result = caller - .call_function( - "callEcho(address,string)", - &[Token::Address(echo_abi), Token::String(payload.clone())], - ExecutionOptions::default(), - ) - .expect("callEcho(address,string) should succeed"); - - let decoded = decode(&[ParamType::String], &result.return_data) - .expect("callEcho(address,string) should return ABI-encoded string"); - assert_eq!(decoded, vec![Token::String(payload)]); - } - - #[test] - fn dynamic_string_event_payload_is_abi_encoded() { - let Some(harness) = compile_string_echo_contract() else { - return; - }; - - let payload = long_string_value("event"); - let mut instance = harness - .deploy_with_init() - .expect("string echo contract should deploy"); - let call = encode_function_call("emit(string)", &[Token::String(payload.clone())]) - .expect("calldata should encode"); - let result = instance - .call_raw_with_logs(&call, ExecutionOptions::default()) - .expect("emit(string) should succeed"); - - assert_eq!(result.logs.len(), 1, "emit(string) should emit one log"); - assert!( - result.logs[0].contains(&hex::encode(payload.as_bytes())), - "log output should contain the ABI-encoded string payload" - ); - } - - #[test] - fn dynamic_tuple_return_is_solidity_compatible() { - let Some(harness) = compile_nested_tuple_echo_contract() else { - return; - }; - - let text = long_string_value("tuple-return"); - let mut instance = harness - .deploy_with_init() - .expect("nested tuple echo contract should deploy"); - let call = encode_typed_function_call( - "echo", - vec![nested_tuple_param_type()], - &[nested_tuple_token(&text, 7)], - ) - .expect("typed calldata should encode"); - let result = instance - .call_raw(&call, ExecutionOptions::default()) - .expect("echo((string,uint64)) should succeed"); - - let decoded = decode(&[nested_tuple_param_type()], &result.return_data) - .expect("echo((string,uint64)) should return ABI-encoded outputs"); - assert_eq!(decoded, vec![nested_tuple_token(&text, 7)]); - } - - #[test] - fn dynamic_tuple_msg_call_round_trips() { - let Some(echo_harness) = compile_nested_tuple_echo_contract() else { - return; - }; - let Some(caller_harness) = compile_nested_tuple_caller_contract() else { - return; - }; - - let text = long_string_value("tuple-call"); - let mut caller = caller_harness - .deploy_with_init() - .expect("nested tuple caller contract should deploy"); - let echo_addr = caller - .deploy_sidecar(echo_harness.init_bytecode(), &[]) - .expect("nested tuple echo sidecar should deploy"); - let echo_abi = ethers_core::types::Address::from_slice(echo_addr.as_slice()); - - let call = encode_typed_function_call( - "callEcho", - vec![ParamType::Address, nested_tuple_param_type()], - &[Token::Address(echo_abi), nested_tuple_token(&text, 9)], - ) - .expect("typed calldata should encode"); - let result = caller - .call_raw(&call, ExecutionOptions::default()) - .expect("callEcho(address,(string,uint64)) should succeed"); - - let decoded = decode(&[nested_tuple_param_type()], &result.return_data) - .expect("callEcho(address,(string,uint64)) should return ABI-encoded outputs"); - assert_eq!(decoded, vec![nested_tuple_token(&text, 9)]); - } - - #[test] - fn truncated_dynamic_tuple_head_reverts_before_padded_offset_read() { - let Some(harness) = compile_tuple_head_guard_contract() else { - return; - }; - - let mut instance = harness - .deploy_with_init() - .expect("tuple head guard contract should deploy"); - let mut call = encode_typed_function_call( - "read", - vec![ParamType::Tuple(vec![ - ParamType::Uint(64), - ParamType::String, - ])], - &[Token::Tuple(vec![ - Token::Uint(AbiU256::from(0u64)), - Token::String("missing-head".to_string()), - ])], - ) - .expect("typed calldata should encode"); - - call.truncate(4 + 32 + 32); - let err = instance - .call_raw(&call, ExecutionOptions::default()) - .expect_err("truncated tuple head should revert"); - assert_empty_revert(err); - } - - #[test] - fn dynamic_tuple_constructor_args_round_trip() { - let Some(harness) = compile_nested_tuple_init_contract() else { - return; - }; - - let text = long_string_value("ctor"); - let mut instance = harness - .deploy_with_init_args(&[ - Token::String(text.clone()), - Token::Uint(AbiU256::from(11u64)), - ]) - .expect("nested tuple init contract should deploy"); - let text_len = instance - .call_function("getTextLen()", &[], ExecutionOptions::default()) - .expect("getTextLen() should succeed"); - let first_byte = instance - .call_function("getFirstByte()", &[], ExecutionOptions::default()) - .expect("getFirstByte() should succeed"); - let count = instance - .call_function("getCount()", &[], ExecutionOptions::default()) - .expect("getCount() should succeed"); - - let decoded_text_len = decode(&[ParamType::Uint(256)], &text_len.return_data) - .expect("getTextLen() should return ABI-encoded length"); - assert_eq!( - decoded_text_len, - vec![Token::Uint(AbiU256::from(text.len()))], - "constructor should observe the full decoded string length" - ); - let decoded_first_byte = decode(&[ParamType::Uint(8)], &first_byte.return_data) - .expect("getFirstByte() should return ABI-encoded byte"); - assert_eq!( - decoded_first_byte, - vec![Token::Uint(AbiU256::from(text.as_bytes()[0]))], - "constructor should observe the decoded string payload" - ); - assert_eq!( - bytes_to_u256(&count.return_data).unwrap(), - U256::from(11u64), - "constructor should store the tuple's scalar tail value" - ); - } - - #[test] - fn create2_static_constructor_args_round_trip() { - let Some(harness) = compile_create2_init_args_contract() else { - return; - }; - - let mut parent = harness - .deploy_with_init() - .expect("create2 parent contract should deploy"); - let deployed = parent - .call_function("deployStatic()", &[], ExecutionOptions::default()) - .expect("deployStatic() should succeed"); - let child_address = Address::from_slice(&deployed.return_data[12..]); - - let get_byte = encode_function_call("getByte()", &[]).expect("calldata should encode"); - let child = parent - .call_raw_at(child_address, &get_byte, ExecutionOptions::default()) - .expect("static child runtime should succeed"); - let decoded = decode(&[ParamType::Uint(8)], &child.return_data) - .expect("getByte() should return ABI-encoded u8"); - assert_eq!( - decoded, - vec![Token::Uint(AbiU256::from(7u64))], - "create2 should append direct static init args using ABI width, not memory size" - ); - } - - #[test] - fn create2_dynamic_constructor_args_round_trip() { - let Some(harness) = compile_create2_init_args_contract() else { - return; - }; - - let text = long_string_value("create2-ctor"); - let mut parent = harness - .deploy_with_init() - .expect("create2 parent contract should deploy"); - let deployed = parent - .call_function( - "deployDynamic(string,uint64)", - &[ - Token::String(text.clone()), - Token::Uint(AbiU256::from(13u64)), - ], - ExecutionOptions::default(), - ) - .expect("deployDynamic(string,uint64) should succeed"); - let child_address = Address::from_slice(&deployed.return_data[12..]); - - let text_len = parent - .call_raw_at( - child_address, - &encode_function_call("getTextLen()", &[]).expect("calldata should encode"), - ExecutionOptions::default(), - ) - .expect("getTextLen() should succeed"); - let first_byte = parent - .call_raw_at( - child_address, - &encode_function_call("getFirstByte()", &[]).expect("calldata should encode"), - ExecutionOptions::default(), - ) - .expect("getFirstByte() should succeed"); - let count = parent - .call_raw_at( - child_address, - &encode_function_call("getCount()", &[]).expect("calldata should encode"), - ExecutionOptions::default(), - ) - .expect("getCount() should succeed"); - - assert_eq!( - bytes_to_u256(&text_len.return_data).unwrap(), - U256::from(text.len() as u64), - "create2 should encode dynamic init args without an extra root wrapper" - ); - let decoded_first_byte = decode(&[ParamType::Uint(8)], &first_byte.return_data) - .expect("getFirstByte() should return ABI-encoded u8"); - assert_eq!( - decoded_first_byte, - vec![Token::Uint(AbiU256::from(text.as_bytes()[0]))], - "constructor should observe the decoded string payload" - ); - assert_eq!( - bytes_to_u256(&count.return_data).unwrap(), - U256::from(13u64), - "constructor should observe the scalar tail argument" - ); - } - - #[test] - fn fixed_string_calldata_decode_rejects_oversized_payloads() { - let Some(harness) = compile_fixed_string_decode_contract() else { - return; - }; - - harness - .call_function( - "ok(string)", - &[Token::String("short-string".to_string())], - ExecutionOptions::default(), - ) - .expect("short string should decode into String<31>"); - - let err = harness - .call_function( - "ok(string)", - &[Token::String(long_string_value("fixed-string-overflow"))], - ExecutionOptions::default(), - ) - .expect_err("32+ byte string should not silently truncate into String<31>"); - assert_empty_revert(err); - - let mut truncated = - encode_function_call("ok(string)", &[Token::String("hello".to_string())]) - .expect("calldata should encode"); - truncated.truncate(truncated.len() - 1); - let err = harness - .call_raw(&truncated, ExecutionOptions::default()) - .expect_err("truncated string tail should revert during decode"); - assert_empty_revert(err); - } - - #[test] - fn fixed_string_returndata_decode_rejects_oversized_payloads() { - let Some(target_harness) = compile_string_echo_contract() else { - return; - }; - let Some(caller_harness) = compile_fixed_string_return_caller_contract() else { - return; - }; - - let mut caller = caller_harness - .deploy_with_init() - .expect("fixed string return caller contract should deploy"); - let target_addr = caller - .deploy_sidecar(target_harness.init_bytecode(), &[]) - .expect("string echo sidecar should deploy"); - let target_abi = ethers_core::types::Address::from_slice(target_addr.as_slice()); - - let short_text = "short-return".to_string(); - let short_call = encode_typed_function_call( - "forward", - vec![ParamType::Address, ParamType::String], - &[ - Token::Address(target_abi), - Token::String(short_text.clone()), - ], - ) - .expect("typed calldata should encode"); - let short_result = caller - .call_raw(&short_call, ExecutionOptions::default()) - .expect("short return string should decode into String<31>"); - let short_decoded = decode(&[ParamType::String], &short_result.return_data) - .expect("forward(address,string) should return ABI-encoded string"); - assert_eq!(short_decoded, vec![Token::String(short_text)]); - - let long_text = long_string_value("fixed-string-return-overflow"); - let long_call = encode_typed_function_call( - "forward", - vec![ParamType::Address, ParamType::String], - &[Token::Address(target_abi), Token::String(long_text)], - ) - .expect("typed calldata should encode"); - let err = caller - .call_raw(&long_call, ExecutionOptions::default()) - .expect_err("32+ byte returndata should not silently truncate into String<31>"); - assert_empty_revert(err); - } - - #[test] - fn custom_width_encode_rejects_non_canonical_values() { - let Some(harness) = compile_custom_width_encode_contract() else { - return; - }; - - let mut instance = harness - .deploy_with_init() - .expect("custom width encode contract should deploy"); - - let good_uint24 = instance - .call_function("goodUint24()", &[], ExecutionOptions::default()) - .expect("goodUint24() should succeed"); - assert_eq!( - decode(&[ParamType::Uint(24)], &good_uint24.return_data) - .expect("goodUint24() should return ABI-encoded uint24"), - vec![Token::Uint(AbiU256::from(7u64))] - ); - - let err = instance - .call_function("badUint24()", &[], ExecutionOptions::default()) - .expect_err("out-of-range Uint24 should revert during ABI encode"); - assert_empty_revert(err); - - let good_uint160 = instance - .call_function("goodUint160()", &[], ExecutionOptions::default()) - .expect("goodUint160() should succeed"); - assert_eq!( - decode(&[ParamType::Uint(160)], &good_uint160.return_data) - .expect("goodUint160() should return ABI-encoded uint160"), - vec![Token::Uint(AbiU256::from(1u64))] - ); - - let err = instance - .call_function("badUint160()", &[], ExecutionOptions::default()) - .expect_err("out-of-range Uint160 should revert during ABI encode"); - assert_empty_revert(err); - - let good_int40 = instance - .call_function("goodInt40()", &[], ExecutionOptions::default()) - .expect("goodInt40() should succeed"); - assert_eq!( - decode(&[ParamType::Int(40)], &good_int40.return_data) - .expect("goodInt40() should return ABI-encoded int40"), - vec![Token::Int(AbiU256::from(5u64))] - ); - - let err = instance - .call_function("badInt40()", &[], ExecutionOptions::default()) - .expect_err("out-of-range Int40 should revert during ABI encode"); - assert_empty_revert(err); - - let good_int136 = instance - .call_function("goodInt136()", &[], ExecutionOptions::default()) - .expect("goodInt136() should succeed"); - assert_eq!( - decode(&[ParamType::Int(136)], &good_int136.return_data) - .expect("goodInt136() should return ABI-encoded int136"), - vec![Token::Int(AbiU256::from(5u64))] - ); - - let err = instance - .call_function("badInt136()", &[], ExecutionOptions::default()) - .expect_err("out-of-range Int136 should revert during ABI encode"); - assert_empty_revert(err); - } - - #[test] - fn custom_width_topics_reject_non_canonical_values() { - let Some(harness) = compile_custom_width_encode_contract() else { - return; - }; - - let mut instance = harness - .deploy_with_init() - .expect("custom width encode contract should deploy"); - - let ok = instance - .call_raw_with_logs( - &encode_function_call("emitGoodUint160()", &[]).expect("calldata should encode"), - ExecutionOptions::default(), - ) - .expect("canonical Uint160 topic should emit successfully"); - assert_eq!(ok.logs.len(), 1, "expected a single emitted event"); - - let err = instance - .call_raw( - &encode_function_call("emitBadUint160()", &[]).expect("calldata should encode"), - ExecutionOptions::default(), - ) - .expect_err("out-of-range Uint160 topic should revert during event emission"); - assert_empty_revert(err); - } - - #[test] - fn fixed_array_contract_round_trips_bool_array_64() { - let source = fixed_bool_array_contract_source(64); - let harness = FeContractHarness::compile_from_source( - "FixedBoolArrayBoundary", - &source, - CompileOptions::default(), - ) - .expect("fixed bool[64] contract should compile"); - let mut instance = harness - .deploy_with_init() - .expect("fixed bool[64] contract should deploy"); - let value = fixed_bool_array_token(64); - let call = encode_typed_function_call( - "echo", - vec![fixed_bool_array_param_type(64)], - std::slice::from_ref(&value), - ) - .expect("typed calldata should encode"); - let result = instance - .call_raw(&call, ExecutionOptions::default()) - .expect("echo(bool[64]) should succeed"); - let decoded = decode(&[fixed_bool_array_param_type(64)], &result.return_data) - .expect("echo(bool[64]) should return ABI-encoded fixed array"); - - assert_eq!(decoded, vec![value]); - } - - #[test] - fn fixed_array_contract_round_trips_bool_array_65() { - let source = fixed_bool_array_contract_source(65); - let harness = FeContractHarness::compile_from_source( - "FixedBoolArrayBoundary", - &source, - CompileOptions::default(), - ) - .expect("fixed bool[65] contract should compile"); - let mut instance = harness - .deploy_with_init() - .expect("fixed bool[65] contract should deploy"); - let value = fixed_bool_array_token(65); - let call = encode_typed_function_call( - "echo", - vec![fixed_bool_array_param_type(65)], - std::slice::from_ref(&value), - ) - .expect("typed calldata should encode"); - let result = instance - .call_raw(&call, ExecutionOptions::default()) - .expect("echo(bool[65]) should succeed"); - let decoded = decode(&[fixed_bool_array_param_type(65)], &result.return_data) - .expect("echo(bool[65]) should return ABI-encoded fixed array"); - - assert_eq!(decoded, vec![value]); - } - - #[test] - fn fixed_array_contract_round_trips_string_and_bytes_array_65() { - let source = fixed_dynamic_array_contract_source(65); - let harness = FeContractHarness::compile_from_source( - "FixedDynamicArrayBoundary", - &source, - CompileOptions::default(), - ) - .expect("fixed string[65]/bytes[65] contract should compile"); - let mut instance = harness - .deploy_with_init() - .expect("fixed string[65]/bytes[65] contract should deploy"); - - let string_value = fixed_string_array_token(65); - let string_call = encode_typed_function_call( - "echoString", - vec![fixed_string_array_param_type(65)], - std::slice::from_ref(&string_value), - ) - .expect("typed string calldata should encode"); - let string_result = instance - .call_raw(&string_call, ExecutionOptions::default()) - .expect("echoString(string[65]) should succeed"); - let string_decoded = decode( - &[fixed_string_array_param_type(65)], - &string_result.return_data, - ) - .expect("echoString(string[65]) should return ABI-encoded fixed array"); - assert_eq!(string_decoded, vec![string_value]); - - let bytes_value = fixed_bytes_array_token(65); - let bytes_call = encode_typed_function_call( - "echoBytes", - vec![fixed_bytes_array_param_type(65)], - std::slice::from_ref(&bytes_value), - ) - .expect("typed bytes calldata should encode"); - let bytes_result = instance - .call_raw(&bytes_call, ExecutionOptions::default()) - .expect("echoBytes(bytes[65]) should succeed"); - let bytes_decoded = decode( - &[fixed_bytes_array_param_type(65)], - &bytes_result.return_data, - ) - .expect("echoBytes(bytes[65]) should return ABI-encoded fixed array"); - assert_eq!(bytes_decoded, vec![bytes_value]); - } - - #[test] - fn runtime_constructs_contract() { - let fixture_dir = concat!( - env!("CARGO_MANIFEST_DIR"), - "/../codegen/tests/fixtures/runtime_constructs" - ); - let ingot_url = Url::from_directory_path(fixture_dir).expect("fixture dir is valid"); - - let mut db = DriverDataBase::default(); - let had_init_diagnostics = driver::init_ingot(&mut db, &ingot_url); - assert!( - !had_init_diagnostics, - "ingot resolution should succeed for `{ingot_url}`" - ); - - let ingot = db - .workspace() - .containing_ingot(&db, ingot_url.clone()) - .expect("ingot should be registered in workspace"); - let diags = db.run_on_ingot(ingot); - if !diags.is_empty() { - panic!("compiler diagnostics:\n{}", diags.format_diags(&db)); - } - - let root_file = ingot.root_file(&db).expect("ingot should have root file"); - let top_mod = db.top_mod(root_file); - let bytecode = - emit_module_sonatina_bytecode(&db, top_mod, OptLevel::default(), Some("Parent")) - .expect("Sonatina bytecode should compile"); - let contract = bytecode - .get("Parent") - .expect("Parent bytecode should exist"); - let init_bytecode = hex::encode(&contract.deploy); - - let mut instance = - RuntimeInstance::deploy(&init_bytecode).expect("parent deployment should succeed"); - let parent_res = instance - .call_raw(&[], ExecutionOptions::default()) - .expect("parent runtime should succeed"); - assert_eq!( - parent_res.return_data.len(), - 32, - "parent should return a u256 word containing the deployed child address" - ); - - let child_address = Address::from_slice(&parent_res.return_data[12..]); - assert_ne!( - child_address, - Address::ZERO, - "parent should return a nonzero child address" - ); - - let child_res = instance - .call_raw_at(child_address, &[], ExecutionOptions::default()) - .expect("child runtime should succeed"); - assert_eq!( - bytes_to_u256(&child_res.return_data).unwrap(), - U256::from(0xbeefu64), - "child runtime should return expected value" - ); - } -} diff --git a/crates/driver/Cargo.toml b/crates/driver/Cargo.toml deleted file mode 100644 index aec3b80651..0000000000 --- a/crates/driver/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "fe-driver" -version = "26.2.0" -edition.workspace = true -license = "Apache-2.0" -repository = "https://github.com/argotorg/fe" -description = "Provides Fe driver" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lib] -doctest = false - -[dependencies] -camino.workspace = true -codespan-reporting.workspace = true -salsa.workspace = true -smol_str.workspace = true - -common.workspace = true -hir.workspace = true -resolver.workspace = true -url.workspace = true -tracing.workspace = true -petgraph.workspace = true -glob.workspace = true - -[dev-dependencies] -tempfile = "3.13" diff --git a/crates/driver/src/cli_target.rs b/crates/driver/src/cli_target.rs deleted file mode 100644 index 80fa0d4c14..0000000000 --- a/crates/driver/src/cli_target.rs +++ /dev/null @@ -1,235 +0,0 @@ -use std::fs; - -use camino::Utf8PathBuf; -use common::{InputDb, config::Config}; -use resolver::{ResolutionHandler, Resolver}; -use resolver::{ - files::ancestor_fe_toml_dirs, - ingot::{FeTomlProbe, infer_config_kind}, -}; -use smol_str::SmolStr; -use url::Url; - -use crate::DriverDataBase; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum CliTarget { - StandaloneFile(Utf8PathBuf), - Directory(Utf8PathBuf), -} - -struct ResolvedMember { - path: Utf8PathBuf, - url: Url, -} - -struct ConfigProbe; - -impl ResolutionHandler for ConfigProbe { - type Item = FeTomlProbe; - - fn handle_resolution( - &mut self, - _description: &Url, - resource: resolver::files::FilesResource, - ) -> Self::Item { - for file in &resource.files { - if file.path.as_str().ends_with("fe.toml") { - return FeTomlProbe::Present { - kind_hint: infer_config_kind(&file.content), - }; - } - } - FeTomlProbe::Missing - } -} - -pub fn resolve_cli_target( - db: &mut DriverDataBase, - path: &Utf8PathBuf, - force_standalone: bool, -) -> Result { - let arg = path.as_str(); - let is_name = is_name_candidate(arg); - let path_exists = path.exists(); - - if path.is_file() { - if path.file_name() == Some("fe.toml") { - return Err(format!( - "fe.toml file paths are not accepted: {path}. Pass the containing directory instead" - )); - } - if path.extension() == Some("fe") { - // If the file lives under an ingot, operate from that directory so imports resolve - // in context. For workspace roots, prefer treating the file as standalone unless - // the user explicitly targets the workspace. - if !force_standalone - && let Ok(canonical) = path.canonicalize_utf8() - && let Some(root) = ancestor_fe_toml_dirs(canonical.as_std_path()) - .first() - .and_then(|root| Utf8PathBuf::from_path_buf(root.to_path_buf()).ok()) - { - let config_path = root.join("fe.toml"); - if let Ok(content) = fs::read_to_string(&config_path) - && matches!(Config::parse(&content), Ok(Config::Ingot(_))) - { - return Ok(CliTarget::Directory(root)); - } - } - - return Ok(CliTarget::StandaloneFile(path.clone())); - } - return Err("Path must be either a .fe file or a directory containing fe.toml".into()); - } - - let name_match = if is_name { - resolve_member_by_name(db, arg)? - } else { - None - }; - - let path_member = if is_name && path_exists { - resolve_member_by_path(db, path)? - } else { - None - }; - - if path_exists && name_match.is_some() { - match (&name_match, &path_member) { - (Some(name_member), Some(path_member)) => { - if name_member.url == path_member.url { - return Ok(CliTarget::Directory(path_member.path.clone())); - } - return Err(format!( - "Argument \"{arg}\" matches a workspace member name but does not match the provided path" - )); - } - (Some(_), None) => { - return Err(format!( - "Argument \"{arg}\" matches a workspace member name but does not match the provided path" - )); - } - _ => {} - } - } - - if let Some(name_member) = name_match { - return Ok(CliTarget::Directory(name_member.path)); - } - - if path_exists { - if path.is_dir() && path.join("fe.toml").is_file() { - return Ok(CliTarget::Directory(path.clone())); - } - return Err("Path must be either a .fe file or a directory containing fe.toml".into()); - } - - Err("Path must be either a .fe file or a directory containing fe.toml".into()) -} - -fn is_name_candidate(value: &str) -> bool { - !value.is_empty() && value.chars().all(|c| c.is_ascii_alphanumeric() || c == '_') -} - -fn resolve_member_by_name( - db: &mut DriverDataBase, - name: &str, -) -> Result, String> { - let cwd = std::env::current_dir() - .map_err(|err| format!("Failed to read current directory: {err}"))?; - let cwd = Utf8PathBuf::from_path_buf(cwd) - .map_err(|_| "Current directory is not valid UTF-8".to_string())?; - let workspace_root = find_workspace_root(db, &cwd)?; - let Some(workspace_root) = workspace_root else { - return Ok(None); - }; - let workspace_url = dir_url(&workspace_root)?; - let mut matches = - db.dependency_graph() - .workspace_members_by_name(db, &workspace_url, &SmolStr::new(name)); - if matches.is_empty() { - return Ok(None); - } - if matches.len() > 1 { - return Err(format!( - "Multiple workspace members named \"{name}\"; specify a path instead" - )); - } - let member = matches.pop().map(|member| ResolvedMember { - path: workspace_root.join(member.path.as_str()), - url: member.url, - }); - Ok(member) -} - -fn resolve_member_by_path( - db: &mut DriverDataBase, - path: &Utf8PathBuf, -) -> Result, String> { - if !path.is_dir() { - return Ok(None); - } - let workspace_root = find_workspace_root(db, path)?; - let Some(workspace_root) = workspace_root else { - return Ok(None); - }; - let workspace_url = dir_url(&workspace_root)?; - let members = db - .dependency_graph() - .workspace_member_records(db, &workspace_url); - let canonical = path - .canonicalize_utf8() - .map_err(|_| format!("Invalid or non-existent directory path: {path}"))?; - let target_url = Url::from_directory_path(canonical.as_str()) - .map_err(|_| format!("Invalid directory path: {path}"))?; - - Ok(members - .into_iter() - .find(|member| member.url == target_url) - .map(|member| ResolvedMember { - path: workspace_root.join(member.path.as_str()), - url: member.url, - })) -} - -fn find_workspace_root( - db: &mut DriverDataBase, - start: &Utf8PathBuf, -) -> Result, String> { - let dirs = ancestor_fe_toml_dirs(start.as_std_path()); - for dir in dirs { - let dir = Utf8PathBuf::from_path_buf(dir) - .map_err(|_| "Encountered non UTF-8 workspace path".to_string())?; - let url = dir_url(&dir)?; - let mut resolver = resolver::ingot::minimal_files_resolver(); - let summary = resolver - .resolve(&mut ConfigProbe, &url) - .map_err(|err| err.to_string())?; - if summary.kind_hint() == Some(resolver::ingot::ConfigKind::Workspace) { - if db - .dependency_graph() - .workspace_member_records(db, &url) - .is_empty() - { - let _ = crate::init_ingot(db, &url); - } - return Ok(Some(dir)); - } - } - Ok(None) -} - -fn dir_url(path: &Utf8PathBuf) -> Result { - let canonical_path = match path.canonicalize_utf8() { - Ok(path) => path, - Err(_) => { - let cwd = std::env::current_dir() - .map_err(|err| format!("Failed to read current directory: {err}"))?; - let cwd = Utf8PathBuf::from_path_buf(cwd) - .map_err(|_| "Current directory is not valid UTF-8".to_string())?; - cwd.join(path) - } - }; - Url::from_directory_path(canonical_path.as_str()) - .map_err(|_| format!("Invalid or non-existent directory path: {path}")) -} diff --git a/crates/driver/src/db.rs b/crates/driver/src/db.rs deleted file mode 100644 index 9fc4b0d438..0000000000 --- a/crates/driver/src/db.rs +++ /dev/null @@ -1,181 +0,0 @@ -use crate::diagnostics::CsDbWrapper; -use codespan_reporting::term::{ - self, - termcolor::{BufferWriter, ColorChoice}, -}; -use common::file::File; -use common::{ - define_input_db, - diagnostics::{ - CompleteDiagnostic, Severity, cmp_complete_diagnostics, trim_trailing_line_whitespace, - }, -}; -use hir::analysis::{ - analysis_pass::AnalysisPassManager, diagnostics::DiagnosticVoucher, initialize_analysis_pass, - semantic::SemanticBorrowAnalysisPass, -}; -use hir::{ - Ingot, - hir_def::{HirIngot, TopLevelMod}, - lower::{map_file_to_mod, module_tree}, -}; - -use crate::diagnostics::ToCsDiag; - -define_input_db!(DriverDataBase); - -impl DriverDataBase { - // TODO: An temporary implementation for ui testing. - pub fn run_on_top_mod<'db>(&'db self, top_mod: TopLevelMod<'db>) -> DiagnosticsCollection<'db> { - self.run_on_file_with_pass_manager(top_mod, initialize_analysis_pass()) - } - - pub fn run_on_file_with_pass_manager<'db>( - &'db self, - top_mod: TopLevelMod<'db>, - mut pass_manager: hir::analysis::analysis_pass::AnalysisPassManager, - ) -> DiagnosticsCollection<'db> { - DiagnosticsCollection(pass_manager.run_on_module(self, top_mod)) - } - - pub fn run_on_ingot<'db>(&'db self, ingot: Ingot<'db>) -> DiagnosticsCollection<'db> { - self.run_on_ingot_with_pass_manager(ingot, initialize_analysis_pass()) - } - - pub fn run_on_ingot_with_pass_manager<'db>( - &'db self, - ingot: Ingot<'db>, - mut pass_manager: hir::analysis::analysis_pass::AnalysisPassManager, - ) -> DiagnosticsCollection<'db> { - let tree = module_tree(self, ingot); - DiagnosticsCollection(pass_manager.run_on_module_tree(self, tree)) - } - - pub fn top_mod(&self, input: File) -> TopLevelMod<'_> { - map_file_to_mod(self, input) - } - - pub fn mir_diagnostics_for_top_mod<'db>( - &'db self, - top_mod: TopLevelMod<'db>, - ) -> Vec { - let mut pass_manager = initialize_mir_diagnostics_pass(); - let mut diagnostics: Vec<_> = pass_manager - .run_on_module(self, top_mod) - .into_iter() - .map(|diag| diag.to_complete(self)) - .collect(); - sort_and_dedup_complete_diagnostics(&mut diagnostics); - diagnostics - } - - pub fn mir_diagnostics_for_ingot<'db>(&'db self, ingot: Ingot<'db>) -> Vec { - // Empty ingots (e.g. deleted during incremental workspace changes) - // have no root module to analyze. - if ingot.module_tree(self).root_data().is_none() { - return Vec::new(); - }; - if self.run_on_ingot(ingot).has_errors(self) { - return Vec::new(); - } - let mut pass_manager = initialize_mir_diagnostics_pass(); - let mut diagnostics: Vec<_> = pass_manager - .run_on_module_tree(self, ingot.module_tree(self)) - .into_iter() - .map(|diag| diag.to_complete(self)) - .collect(); - sort_and_dedup_complete_diagnostics(&mut diagnostics); - diagnostics - } - - pub fn emit_complete_diagnostics(&self, diagnostics: &[CompleteDiagnostic]) { - let writer = BufferWriter::stderr(ColorChoice::Auto); - let mut buffer = writer.buffer(); - let config = term::Config::default(); - let mut diagnostics = diagnostics.to_vec(); - sort_and_dedup_complete_diagnostics(&mut diagnostics); - - for diag in diagnostics { - term::emit(&mut buffer, &config, &CsDbWrapper(self), &diag.to_cs(self)).unwrap(); - } - - writer - .print(&buffer) - .expect("Failed to write diagnostics to stderr"); - } - - pub fn format_complete_diagnostics(&self, diagnostics: &[CompleteDiagnostic]) -> String { - let writer = BufferWriter::stderr(ColorChoice::Never); - let mut buffer = writer.buffer(); - let config = term::Config::default(); - let mut diagnostics = diagnostics.to_vec(); - sort_and_dedup_complete_diagnostics(&mut diagnostics); - - for diag in diagnostics { - term::emit(&mut buffer, &config, &CsDbWrapper(self), &diag.to_cs(self)).unwrap(); - } - - trim_trailing_line_whitespace(std::str::from_utf8(buffer.as_slice()).unwrap()) - } -} - -fn initialize_mir_diagnostics_pass() -> AnalysisPassManager { - let mut pass_manager = AnalysisPassManager::new(); - pass_manager.add_module_pass("SemanticBorrow", Box::new(SemanticBorrowAnalysisPass)); - pass_manager -} - -pub struct DiagnosticsCollection<'db>(Vec>); -impl DiagnosticsCollection<'_> { - pub fn is_empty(&self) -> bool { - self.0.is_empty() - } - - pub fn has_errors(&self, db: &DriverDataBase) -> bool { - self.finalize(db) - .iter() - .any(|d| d.severity == Severity::Error) - } - - pub fn emit(&self, db: &DriverDataBase) { - let writer = BufferWriter::stderr(ColorChoice::Auto); - let mut buffer = writer.buffer(); - let config = term::Config::default(); - - for diag in self.finalize(db) { - term::emit(&mut buffer, &config, &CsDbWrapper(db), &diag.to_cs(db)).unwrap(); - } - - writer - .print(&buffer) - .expect("Failed to write diagnostics to stderr"); - } - - /// Format the accumulated diagnostics to a string. - pub fn format_diags(&self, db: &DriverDataBase) -> String { - let writer = BufferWriter::stderr(ColorChoice::Never); - let mut buffer = writer.buffer(); - let config = term::Config::default(); - - for diag in self.finalize(db) { - term::emit(&mut buffer, &config, &CsDbWrapper(db), &diag.to_cs(db)).unwrap(); - } - - trim_trailing_line_whitespace(std::str::from_utf8(buffer.as_slice()).unwrap()) - } - - fn finalize(&self, db: &DriverDataBase) -> Vec { - let mut diags: Vec<_> = self.0.iter().map(|d| d.as_ref().to_complete(db)).collect(); - sort_and_dedup_complete_diagnostics(&mut diags); - diags - } -} - -fn sort_complete_diagnostics(diags: &mut [CompleteDiagnostic]) { - diags.sort_by(cmp_complete_diagnostics); -} - -fn sort_and_dedup_complete_diagnostics(diags: &mut Vec) { - sort_complete_diagnostics(diags); - diags.dedup(); -} diff --git a/crates/driver/src/diagnostics.rs b/crates/driver/src/diagnostics.rs deleted file mode 100644 index 2fe9fed69d..0000000000 --- a/crates/driver/src/diagnostics.rs +++ /dev/null @@ -1,130 +0,0 @@ -use std::ops::Range; - -use camino::Utf8Path; -use codespan_reporting as cs; -use common::{ - InputDb, - diagnostics::{CompleteDiagnostic, LabelStyle, Severity}, - file::File, -}; -use cs::{diagnostic as cs_diag, files as cs_files}; -use hir::analysis::diagnostics::{DiagnosticVoucher, SpannedHirAnalysisDb}; - -pub trait ToCsDiag { - fn to_cs(&self, db: &dyn SpannedInputDb) -> cs_diag::Diagnostic; -} - -pub trait SpannedInputDb: SpannedHirAnalysisDb + InputDb {} -impl SpannedInputDb for T where T: SpannedHirAnalysisDb + InputDb {} - -impl ToCsDiag for T -where - T: DiagnosticVoucher, -{ - fn to_cs(&self, db: &dyn SpannedInputDb) -> cs_diag::Diagnostic { - complete_to_cs(self.to_complete(db)) - } -} - -fn complete_to_cs(complete: CompleteDiagnostic) -> cs_diag::Diagnostic { - let severity = convert_severity(complete.severity); - let code = Some(complete.error_code.to_string()); - let message = complete.message; - - let labels = complete - .sub_diagnostics - .into_iter() - .filter_map(|sub_diag| { - let span = sub_diag.span?; - match sub_diag.style { - LabelStyle::Primary => { - cs_diag::Label::new(cs_diag::LabelStyle::Primary, span.file, span.range) - } - LabelStyle::Secondary => { - cs_diag::Label::new(cs_diag::LabelStyle::Secondary, span.file, span.range) - } - } - .with_message(sub_diag.message) - .into() - }) - .collect(); - - cs_diag::Diagnostic { - severity, - code, - message, - labels, - notes: complete.notes, - } -} - -fn convert_severity(severity: Severity) -> cs_diag::Severity { - match severity { - Severity::Error => cs_diag::Severity::Error, - Severity::Warning => cs_diag::Severity::Warning, - Severity::Note => cs_diag::Severity::Note, - } -} - -#[salsa::tracked(return_ref)] -pub fn file_line_starts(db: &dyn SpannedHirAnalysisDb, file: File) -> Vec { - cs::files::line_starts(file.text(db)).collect() -} - -pub struct CsDbWrapper<'a>(pub &'a dyn SpannedHirAnalysisDb); - -impl<'db> cs_files::Files<'db> for CsDbWrapper<'db> { - type FileId = File; - type Name = &'db Utf8Path; - type Source = &'db str; - - fn name(&'db self, file_id: Self::FileId) -> Result { - match file_id.path(self.0) { - Some(path) => Ok(path.as_path()), - None => Err(cs_files::Error::FileMissing), - } - } - - fn source(&'db self, file_id: Self::FileId) -> Result { - Ok(file_id.text(self.0)) - } - - fn line_index( - &'db self, - file_id: Self::FileId, - byte_index: usize, - ) -> Result { - let starts = file_line_starts(self.0, file_id); - Ok(starts - .binary_search(&byte_index) - .unwrap_or_else(|next_line| next_line - 1)) - } - - fn line_range( - &'db self, - file_id: Self::FileId, - line_index: usize, - ) -> Result, cs_files::Error> { - let line_starts = file_line_starts(self.0, file_id); - - let start = *line_starts - .get(line_index) - .ok_or(cs_files::Error::LineTooLarge { - given: line_index, - max: line_starts.len() - 1, - })?; - - let end = if line_index == line_starts.len() - 1 { - file_id.text(self.0).len() - } else { - *line_starts - .get(line_index + 1) - .ok_or(cs_files::Error::LineTooLarge { - given: line_index, - max: line_starts.len() - 1, - })? - }; - - Ok(Range { start, end }) - } -} diff --git a/crates/driver/src/files.rs b/crates/driver/src/files.rs deleted file mode 100644 index 0df4deb94c..0000000000 --- a/crates/driver/src/files.rs +++ /dev/null @@ -1,23 +0,0 @@ -use camino::Utf8PathBuf; - -pub const FE_TOML: &str = "fe.toml"; - -pub fn find_project_root() -> Option { - let mut path = Utf8PathBuf::from_path_buf( - std::env::current_dir().expect("Unable to get current directory"), - ) - .expect("Expected utf8 path"); - - loop { - let fe_toml = path.join(FE_TOML); - if fe_toml.is_file() { - return Some(path); - } - - if !path.pop() { - break; - } - } - - None -} diff --git a/crates/driver/src/ingot_handler.rs b/crates/driver/src/ingot_handler.rs deleted file mode 100644 index c95b3be465..0000000000 --- a/crates/driver/src/ingot_handler.rs +++ /dev/null @@ -1,1440 +0,0 @@ -use std::collections::{HashMap, HashSet}; - -use camino::{Utf8Path, Utf8PathBuf}; -use common::{ - InputDb, - config::{ - ArithmeticMode, Config, ConfigDiagnostic, DependencyArithmeticMode, - WorkspaceMemberSelection, resolve_dependency_arithmetic_mode, - }, - dependencies::{ - DependencyAlias, DependencyArguments, DependencyLocation, LocalFiles, RemoteFiles, - WorkspaceMemberRecord, - }, - urlext::UrlExt, -}; -use resolver::{ - ResolutionHandler, - git::GitDescription, - graph::{ - DiGraph, GraphNodeOutcome, GraphResolutionHandler, UnresolvedNode, petgraph::visit::EdgeRef, - }, - ingot::{ - ConfigKind, IngotDescriptor, IngotOrigin, IngotPriority, IngotResolutionDiagnostic, - IngotResolutionEvent, IngotResolverImpl, IngotResource, - }, -}; -use smol_str::SmolStr; -use url::Url; - -use crate::IngotInitDiagnostics; - -pub struct IngotHandler<'a> { - pub db: &'a mut dyn InputDb, - ingot_urls: HashMap, - had_diagnostics: bool, - reported_checkouts: HashSet, - dependency_contexts: HashMap>, - dependency_arithmetic_requests: HashMap>, - forced_dependency_arithmetic_sources: HashMap, - emitted_diagnostics: HashSet, -} - -#[derive(Clone, Debug)] -struct DependencyContext { - from_ingot_url: Url, - dependency: SmolStr, -} - -#[derive(Clone, Debug)] -struct DependencyArithmeticRequest { - from_ingot_url: Url, - dependency: SmolStr, - mode: ArithmeticMode, -} - -fn dependency_arithmetic_mode(mode: DependencyArithmeticMode) -> Option { - match mode { - DependencyArithmeticMode::Defer => None, - DependencyArithmeticMode::Checked => Some(ArithmeticMode::Checked), - DependencyArithmeticMode::Unchecked => Some(ArithmeticMode::Unchecked), - } -} - -fn forced_dependency_policy(mode: ArithmeticMode) -> DependencyArithmeticMode { - match mode { - ArithmeticMode::Checked => DependencyArithmeticMode::Checked, - ArithmeticMode::Unchecked => DependencyArithmeticMode::Unchecked, - } -} - -fn workspace_version_for_member( - db: &dyn InputDb, - ingot_url: &Url, -) -> Option { - let workspace_url = db - .dependency_graph() - .workspace_root_for_member(db, ingot_url)?; - let config_url = workspace_url.join("fe.toml").ok()?; - let file = db.workspace().get(db, &config_url)?; - let config_file = Config::parse(file.text(db)).ok()?; - match config_file { - Config::Workspace(workspace_config) => workspace_config.workspace.version, - Config::Ingot(_) => None, - } -} - -impl<'a> IngotHandler<'a> { - pub fn new(db: &'a mut dyn InputDb) -> Self { - Self { - db, - ingot_urls: HashMap::new(), - had_diagnostics: false, - reported_checkouts: HashSet::new(), - dependency_contexts: HashMap::new(), - dependency_arithmetic_requests: HashMap::new(), - forced_dependency_arithmetic_sources: HashMap::new(), - emitted_diagnostics: HashSet::new(), - } - } - - pub fn had_diagnostics(&self) -> bool { - self.had_diagnostics - } - - fn record_dependency_context( - &mut self, - descriptor: &IngotDescriptor, - from_ingot_url: &Url, - dependency: &SmolStr, - ) { - let contexts = self - .dependency_contexts - .entry(descriptor.clone()) - .or_default(); - if contexts.iter().any(|context| { - context.from_ingot_url == *from_ingot_url && context.dependency == *dependency - }) { - return; - } - contexts.push(DependencyContext { - from_ingot_url: from_ingot_url.clone(), - dependency: dependency.clone(), - }); - } - - fn report_warn(&mut self, diagnostic: IngotInitDiagnostics) { - let diagnostic_string = diagnostic.to_string(); - if !self.emitted_diagnostics.insert(diagnostic_string.clone()) { - return; - } - self.had_diagnostics = true; - tracing::warn!(target: "resolver", "{diagnostic_string}"); - eprintln!("Error: {diagnostic_string}"); - } - - fn report_error(&mut self, diagnostic: IngotInitDiagnostics) { - let diagnostic_string = diagnostic.to_string(); - if !self.emitted_diagnostics.insert(diagnostic_string.clone()) { - return; - } - self.had_diagnostics = true; - tracing::error!(target: "resolver", "{diagnostic_string}"); - eprintln!("Error: {diagnostic_string}"); - } - - fn workspace_config_for_root( - &mut self, - workspace_root: Option<&Url>, - ) -> Option { - let workspace_root = workspace_root?; - match self.config_at_url(workspace_root).ok()? { - Config::Workspace(config) => Some(*config), - Config::Ingot(_) => None, - } - } - - fn record_dependency_arithmetic_request( - &mut self, - descriptor: &IngotDescriptor, - from_ingot_url: &Url, - dependency: &SmolStr, - mode: ArithmeticMode, - ) { - let requests = self - .dependency_arithmetic_requests - .entry(descriptor.clone()) - .or_default(); - if requests.iter().any(|request| { - request.from_ingot_url == *from_ingot_url - && request.dependency == *dependency - && request.mode == mode - }) { - return; - } - requests.push(DependencyArithmeticRequest { - from_ingot_url: from_ingot_url.clone(), - dependency: dependency.clone(), - mode, - }); - } - - fn requested_dependency_arithmetic( - &self, - descriptor: &IngotDescriptor, - ) -> Option { - self.dependency_arithmetic_requests - .get(descriptor) - .and_then(|requests| requests.first().cloned()) - } - - fn register_forced_dependency_arithmetic( - &mut self, - dependency_url: &Url, - request: DependencyArithmeticRequest, - ) { - if let Some(existing) = self - .forced_dependency_arithmetic_sources - .get(dependency_url) - .cloned() - { - if existing.mode != request.mode { - self.report_error(IngotInitDiagnostics::DependencyArithmeticConflict { - dependency_url: dependency_url.clone(), - first_ingot_url: existing.from_ingot_url, - first_dependency: existing.dependency, - first_mode: existing.mode, - second_ingot_url: request.from_ingot_url, - second_dependency: request.dependency, - second_mode: request.mode, - }); - return; - } - } else { - self.forced_dependency_arithmetic_sources - .insert(dependency_url.clone(), request.clone()); - } - - self.db.dependency_graph().force_dependency_arithmetic( - self.db, - dependency_url, - request.mode, - ); - } - - fn outbound_dependency_policy_for_ingot( - &mut self, - descriptor: &IngotDescriptor, - ingot_url: &Url, - workspace_root: Option<&Url>, - config: &common::config::IngotConfig, - ) -> DependencyArithmeticMode { - if let Some(mode) = self - .db - .dependency_graph() - .forced_dependency_arithmetic_for(self.db, ingot_url) - .or_else(|| { - self.requested_dependency_arithmetic(descriptor) - .map(|request| request.mode) - }) - { - return forced_dependency_policy(mode); - } - - let workspace_config = self.workspace_config_for_root(workspace_root); - let profile = self.db.compilation_settings().profile(self.db); - resolve_dependency_arithmetic_mode( - Some(config), - workspace_config.as_ref(), - profile.as_str(), - ) - } - - fn outbound_dependency_policy_for_url(&mut self, ingot_url: &Url) -> DependencyArithmeticMode { - if let Some(mode) = self - .db - .dependency_graph() - .forced_dependency_arithmetic_for(self.db, ingot_url) - { - return forced_dependency_policy(mode); - } - - let profile = self.db.compilation_settings().profile(self.db); - let workspace_root = self - .db - .dependency_graph() - .workspace_root_for_member(self.db, ingot_url); - let workspace_config = self.workspace_config_for_root(workspace_root.as_ref()); - match self.config_at_url(ingot_url) { - Ok(Config::Ingot(config)) => resolve_dependency_arithmetic_mode( - Some(&config), - workspace_config.as_ref(), - profile.as_str(), - ), - Ok(Config::Workspace(config)) => { - resolve_dependency_arithmetic_mode(None, Some(&config), profile.as_str()) - } - Err(_) => DependencyArithmeticMode::Defer, - } - } - - fn is_external_dependency( - &self, - workspace_root: Option<&Url>, - dependency: &common::dependencies::Dependency, - ) -> bool { - match &dependency.location { - DependencyLocation::WorkspaceCurrent => false, - DependencyLocation::Remote(_) => true, - DependencyLocation::Local(local) => workspace_root.is_none_or(|workspace_root| { - self.db - .dependency_graph() - .workspace_root_for_member(self.db, &local.url) - .as_ref() - != Some(workspace_root) - }), - } - } - - fn is_external_dependency_url(&self, from_url: &Url, to_url: &Url) -> bool { - self.db - .dependency_graph() - .workspace_root_for_member(self.db, from_url) - .is_none_or(|workspace_root| { - self.db - .dependency_graph() - .workspace_root_for_member(self.db, to_url) - .as_ref() - != Some(&workspace_root) - }) - } - - fn record_files(&mut self, files: &[resolver::files::File]) { - for file in files { - let file_url = - Url::from_file_path(file.path.as_std_path()).expect("resolved path to url"); - self.db - .workspace() - .touch(self.db, file_url, Some(file.content.clone())); - } - } - - fn record_files_owned(&mut self, files: Vec) { - for file in files { - let file_url = - Url::from_file_path(file.path.as_std_path()).expect("resolved path to url"); - self.db - .workspace() - .touch(self.db, file_url, Some(file.content)); - } - } - - fn register_remote_mapping(&mut self, ingot_url: &Url, origin: &IngotOrigin) { - if let IngotOrigin::Remote { description, .. } = origin { - let remote = RemoteFiles { - source: description.source.clone(), - rev: SmolStr::new(description.rev.clone()), - path: description.path.clone(), - }; - self.db - .dependency_graph() - .register_remote_checkout(self.db, ingot_url.clone(), remote); - } - } - - fn convert_dependency( - &mut self, - ingot_url: &Url, - origin: &IngotOrigin, - workspace_root: Option<&Url>, - dependency: common::dependencies::Dependency, - ) -> Option<(IngotDescriptor, (DependencyAlias, DependencyArguments))> { - let common::dependencies::Dependency { - alias, - location, - arguments, - } = dependency; - - match location { - DependencyLocation::WorkspaceCurrent => { - let name = arguments.name.clone().unwrap_or_else(|| alias.clone()); - - let Some(workspace_root) = workspace_root else { - self.report_error(IngotInitDiagnostics::WorkspaceNameLookupUnavailable { - ingot_url: ingot_url.clone(), - dependency: alias.clone(), - }); - return None; - }; - - let workspace_current = common::dependencies::Dependency { - alias: alias.clone(), - location: DependencyLocation::WorkspaceCurrent, - arguments: arguments.clone(), - }; - match self.workspace_dependency_for_alias( - ingot_url, - origin, - workspace_root, - &workspace_current, - ) { - Ok(Some(descriptor)) => { - return Some((descriptor, (alias, arguments))); - } - Ok(None) => {} - Err(error) => { - self.report_error(IngotInitDiagnostics::WorkspaceMemberResolutionFailed { - ingot_url: ingot_url.clone(), - dependency: alias.clone(), - error, - }); - return None; - } - } - - match origin { - IngotOrigin::Local => { - let descriptor = IngotDescriptor::LocalByName { - base: workspace_root.clone(), - name, - }; - self.record_dependency_context(&descriptor, ingot_url, &alias); - Some((descriptor, (alias, arguments))) - } - IngotOrigin::Remote { - description, - checkout_path, - .. - } => { - match relative_path_within_checkout(checkout_path.as_path(), workspace_root) - { - Ok(relative_path) => { - let mut base = GitDescription::new( - description.source.clone(), - description.rev.clone(), - ); - if let Some(path) = relative_path { - base = base.with_path(path); - } - let descriptor = IngotDescriptor::RemoteByName { base, name }; - self.record_dependency_context(&descriptor, ingot_url, &alias); - Some((descriptor, (alias, arguments))) - } - Err(error) => { - self.report_error( - IngotInitDiagnostics::RemotePathResolutionError { - ingot_url: ingot_url.clone(), - dependency: alias, - error, - }, - ); - None - } - } - } - } - } - DependencyLocation::Local(local) => { - if let Some(name) = arguments.name.clone() { - match origin { - IngotOrigin::Local => { - let descriptor = IngotDescriptor::LocalByName { - base: local.url, - name, - }; - self.record_dependency_context(&descriptor, ingot_url, &alias); - Some((descriptor, (alias, arguments))) - } - IngotOrigin::Remote { - description, - checkout_path, - .. - } => { - match relative_path_within_checkout(checkout_path.as_path(), &local.url) - { - Ok(relative_path) => { - let mut base = GitDescription::new( - description.source.clone(), - description.rev.clone(), - ); - if let Some(path) = relative_path { - base = base.with_path(path); - } - let descriptor = IngotDescriptor::RemoteByName { base, name }; - self.record_dependency_context(&descriptor, ingot_url, &alias); - Some((descriptor, (alias, arguments))) - } - Err(error) => { - self.report_error( - IngotInitDiagnostics::RemotePathResolutionError { - ingot_url: ingot_url.clone(), - dependency: alias, - error, - }, - ); - None - } - } - } - } - } else { - match origin { - IngotOrigin::Local => { - let descriptor = IngotDescriptor::Local(local.url); - self.record_dependency_context(&descriptor, ingot_url, &alias); - Some((descriptor, (alias, arguments))) - } - IngotOrigin::Remote { - description, - checkout_path, - .. - } => { - match relative_path_within_checkout(checkout_path.as_path(), &local.url) - { - Ok(relative_path) => { - let mut next_description = GitDescription::new( - description.source.clone(), - description.rev.clone(), - ); - if let Some(path) = relative_path { - next_description = next_description.with_path(path); - } - let descriptor = IngotDescriptor::Remote(next_description); - self.record_dependency_context(&descriptor, ingot_url, &alias); - Some((descriptor, (alias, arguments))) - } - Err(error) => { - self.report_error( - IngotInitDiagnostics::RemotePathResolutionError { - ingot_url: ingot_url.clone(), - dependency: alias, - error, - }, - ); - None - } - } - } - } - } - } - DependencyLocation::Remote(remote) => { - if let Some(name) = arguments.name.clone() { - let mut base = - GitDescription::new(remote.source.clone(), remote.rev.to_string()); - if let Some(path) = remote.path.clone() { - base = base.with_path(path); - } - let descriptor = IngotDescriptor::RemoteByName { base, name }; - self.record_dependency_context(&descriptor, ingot_url, &alias); - Some((descriptor, (alias, arguments))) - } else { - let mut next_description = - GitDescription::new(remote.source.clone(), remote.rev.to_string()); - if let Some(path) = remote.path.clone() { - next_description = next_description.with_path(path); - } - let descriptor = IngotDescriptor::Remote(next_description); - self.record_dependency_context(&descriptor, ingot_url, &alias); - Some((descriptor, (alias, arguments))) - } - } - } - } - - fn workspace_dependency_for_alias( - &mut self, - ingot_url: &Url, - origin: &IngotOrigin, - workspace_root: &Url, - dependency: &common::dependencies::Dependency, - ) -> Result, String> { - let config = self.config_at_url(workspace_root)?; - let Config::Workspace(workspace_config) = config else { - return Ok(None); - }; - - let Some(entry) = workspace_config - .workspace - .dependencies - .iter() - .find(|entry| entry.alias == dependency.alias) - else { - return Ok(None); - }; - - let location = match &entry.location { - common::config::DependencyEntryLocation::RelativePath(path) => { - let url = workspace_root - .join_directory(path) - .map_err(|_| format!("Failed to join workspace dependency path {path}"))?; - DependencyLocation::Local(LocalFiles { - path: path.clone(), - url, - }) - } - common::config::DependencyEntryLocation::Remote(remote) => { - DependencyLocation::Remote(remote.clone()) - } - common::config::DependencyEntryLocation::WorkspaceCurrent => { - return Err(format!( - "Workspace dependency '{}' must specify a path or a source", - entry.alias - )); - } - }; - - let mut arguments = entry.arguments.clone(); - if arguments.name.is_none() { - arguments.name = dependency.arguments.name.clone(); - } - if dependency.arguments.version.is_some() { - arguments.version = dependency.arguments.version.clone(); - } - - let workspace_dependency = common::dependencies::Dependency { - alias: entry.alias.clone(), - location, - arguments, - }; - - Ok(self - .convert_dependency( - ingot_url, - origin, - Some(workspace_root), - workspace_dependency, - ) - .map(|(descriptor, _)| descriptor)) - } - - fn workspace_member_metadata( - &mut self, - member: &crate::ExpandedWorkspaceMember, - ) -> Result<(Option, Option), String> { - let config = self.config_at_url(&member.url)?; - let Config::Ingot(ingot) = config else { - return Err(format!("Expected ingot config at {}", member.url)); - }; - - if let Some(expected_name) = member.name.as_ref() - && ingot.metadata.name.as_ref() != Some(expected_name) - { - return Err(format!( - "Workspace member {} has mismatched metadata: name expected {expected_name} but found {}", - member.url, - ingot.metadata.name.as_deref().unwrap_or("") - )); - } - - if let Some(expected_version) = member.version.as_ref() - && ingot.metadata.version.as_ref() != Some(expected_version) - { - return Err(format!( - "Workspace member {} has mismatched metadata: version expected {expected_version} but found {}", - member.url, - ingot - .metadata - .version - .as_ref() - .map(ToString::to_string) - .unwrap_or_else(|| "".to_string()) - )); - } - - let name = member.name.clone().or(ingot.metadata.name.clone()); - let version = member.version.clone().or(ingot.metadata.version.clone()); - Ok((name, version)) - } - - fn handle_workspace_config( - &mut self, - resource: &IngotResource, - workspace_config: common::config::WorkspaceConfig, - ) -> Vec> - { - if !workspace_config.diagnostics.is_empty() { - self.report_warn(IngotInitDiagnostics::WorkspaceDiagnostics { - workspace_url: resource.ingot_url.clone(), - diagnostics: workspace_config.diagnostics.clone(), - }); - } - - let workspace = workspace_config.workspace.clone(); - let workspace_dependency_aliases: HashSet<_> = workspace - .dependencies - .iter() - .map(|dependency| dependency.alias.clone()) - .collect(); - let selection = if workspace.default_members.is_some() { - WorkspaceMemberSelection::DefaultOnly - } else { - WorkspaceMemberSelection::All - }; - let mut members = - match crate::expand_workspace_members(&workspace, &resource.ingot_url, selection) { - Ok(members) => members, - Err(error) => { - self.report_error(IngotInitDiagnostics::WorkspaceMembersError { - workspace_url: resource.ingot_url.clone(), - error, - }); - return Vec::new(); - } - }; - - self.db - .dependency_graph() - .ensure_workspace_root(self.db, &resource.ingot_url); - - for member in &mut members { - let explicit_name = member.name.clone(); - let explicit_version = member.version.clone(); - let (name, version) = match self.workspace_member_metadata(member) { - Ok(metadata) => metadata, - Err(error) => { - self.report_error(IngotInitDiagnostics::WorkspaceMembersError { - workspace_url: resource.ingot_url.clone(), - error, - }); - return Vec::new(); - } - }; - member.name = name; - member.version = version; - self.db.dependency_graph().register_workspace_member_root( - self.db, - &resource.ingot_url, - &member.url, - ); - if let (Some(name), Some(version)) = (explicit_name, explicit_version) { - self.db - .dependency_graph() - .register_expected_member_metadata( - self.db, - &member.url, - name.clone(), - version.clone(), - ); - } - - if let Some(name) = &member.name { - if workspace_dependency_aliases.contains(name) { - self.report_error(IngotInitDiagnostics::WorkspaceDependencyAliasConflict { - workspace_url: resource.ingot_url.clone(), - alias: name.clone(), - }); - return Vec::new(); - } - let existing = self.db.dependency_graph().workspace_members_by_name( - self.db, - &resource.ingot_url, - name, - ); - if existing.iter().any(|other| other.url != member.url) { - self.report_error(IngotInitDiagnostics::WorkspaceMemberDuplicate { - workspace_url: resource.ingot_url.clone(), - name: name.clone(), - version: None, - }); - return Vec::new(); - } - let record = WorkspaceMemberRecord { - name: name.clone(), - version: member.version.clone(), - path: member.path.clone(), - url: member.url.clone(), - }; - self.db.dependency_graph().register_workspace_member( - self.db, - &resource.ingot_url, - record, - ); - } - } - - let mut dependencies = Vec::new(); - for member in members { - if member.url == resource.ingot_url { - continue; - } - let arguments = DependencyArguments { - name: member.name.clone(), - version: member.version.clone(), - }; - let alias = member - .name - .clone() - .unwrap_or_else(|| SmolStr::new(member.path.as_str())); - let descriptor = match &resource.origin { - IngotOrigin::Local => IngotDescriptor::Local(member.url.clone()), - IngotOrigin::Remote { description, .. } => { - let mut member_path = member.path.clone(); - if let Some(root_path) = &description.path { - member_path = root_path.join(member_path.as_str()); - } - let next_description = - GitDescription::new(description.source.clone(), description.rev.clone()) - .with_path(member_path); - IngotDescriptor::Remote(next_description) - } - }; - let priority = match &descriptor { - IngotDescriptor::Local(_) => IngotPriority::local(), - IngotDescriptor::Remote(_) => IngotPriority::remote(), - _ => unreachable!("workspace members must resolve to local or remote descriptors"), - }; - dependencies.push(UnresolvedNode { - priority, - description: descriptor, - edge: (alias, arguments), - }); - } - - dependencies - } - - fn config_at_url(&mut self, url: &Url) -> Result { - let config_url = url - .join("fe.toml") - .map_err(|_| "failed to locate fe.toml for dependency".to_string())?; - - let file = self - .db - .workspace() - .get(self.db, &config_url) - .ok_or_else(|| format!("Missing config at {config_url}"))?; - Config::parse(file.text(self.db)) - .map_err(|err| format!("Failed to parse {config_url}: {err}")) - } - - fn ensure_phantom_lib_file(&mut self, ingot_url: &Url) { - let lib_url = match ingot_url.join("src/lib.fe") { - Ok(url) => url, - Err(_) => return, - }; - - if self.db.workspace().get(self.db, &lib_url).is_some() { - return; - } - - // If `src/lib.fe` exists on disk but couldn't be read, don't hide that error by - // synthesizing a replacement. - if lib_url - .to_file_path() - .ok() - .is_some_and(|path| path.is_file()) - { - return; - } - - let src_prefix = match ingot_url.join("src/") { - Ok(url) => url, - Err(_) => return, - }; - - let has_sources = self - .db - .workspace() - .items_at_base(self.db, src_prefix) - .iter() - .any(|(url, _)| url.as_str().ends_with(".fe")); - if !has_sources { - return; - } - - self.db - .workspace() - .touch(self.db, lib_url, Some(String::new())); - } - - fn effective_metadata_for_ingot( - &mut self, - ingot_url: &Url, - ) -> Option<(Option, Option)> { - let config = self.config_at_url(ingot_url).ok()?; - match config { - Config::Ingot(ingot) => { - let name = ingot.metadata.name.clone(); - let version = ingot - .metadata - .version - .clone() - .or_else(|| workspace_version_for_member(self.db, ingot_url)); - Some((name, version)) - } - Config::Workspace(_) => None, - } - } -} - -impl<'a> ResolutionHandler for IngotHandler<'a> { - type Item = Result< - GraphNodeOutcome, - resolver::ingot::IngotResolutionError, - >; - - fn on_resolution_diagnostic(&mut self, diagnostic: IngotResolutionDiagnostic) { - match diagnostic { - IngotResolutionDiagnostic::Files(diagnostic) => { - self.report_warn(IngotInitDiagnostics::FileError { diagnostic }); - } - } - } - - fn on_resolution_event(&mut self, event: IngotResolutionEvent) { - match event { - IngotResolutionEvent::FilesResolved { files } => { - self.record_files_owned(files); - } - IngotResolutionEvent::RemoteCheckoutStart { description } => { - tracing::info!(target: "resolver", "Checking out {description}"); - } - IngotResolutionEvent::RemoteCheckoutComplete { - ingot_url, - reused_checkout, - description, - .. - } => { - if reused_checkout { - if self.reported_checkouts.contains(&description) { - return; - } - tracing::debug!(target: "resolver", "Using cached checkout {}", ingot_url); - return; - } - tracing::info!(target: "resolver", "Checked out {}", ingot_url); - } - } - } - - fn on_resolution_error( - &mut self, - description: &IngotDescriptor, - error: resolver::ingot::IngotResolutionError, - ) { - if matches!( - description, - IngotDescriptor::Remote(_) | IngotDescriptor::RemoteByName { .. } - ) { - tracing::error!( - target: "resolver", - "Failed to check out {description}: {error}" - ); - } - - if let resolver::ingot::IngotResolutionError::Selection(selection) = &error - && let Some(contexts) = self.dependency_contexts.get(description).cloned() - { - use resolver::ingot::IngotSelectionError; - - for context in contexts { - match selection.as_ref() { - IngotSelectionError::NoResolvedIngotByMetadata { name, version } => { - self.report_error(IngotInitDiagnostics::IngotByNameResolutionFailed { - ingot_url: context.from_ingot_url.clone(), - dependency: context.dependency.clone(), - name: name.clone(), - version: version.clone(), - }); - } - IngotSelectionError::WorkspacePathRequiresSelection { workspace_url } => { - self.report_error(IngotInitDiagnostics::WorkspacePathRequiresSelection { - ingot_url: context.from_ingot_url.clone(), - dependency: context.dependency.clone(), - workspace_url: workspace_url.clone(), - }); - } - IngotSelectionError::WorkspaceMemberNotFound { - workspace_url, - name, - } - | IngotSelectionError::WorkspaceMemberDuplicate { - workspace_url, - name, - } => { - self.report_error(IngotInitDiagnostics::WorkspaceMemberResolutionFailed { - ingot_url: context.from_ingot_url.clone(), - dependency: context.dependency.clone(), - error: format!( - "No workspace member named \"{name}\" found in {workspace_url}" - ), - }); - } - IngotSelectionError::DependencyMetadataMismatch { - dependency_url, - expected_name, - found_name, - found_version, - } => { - self.report_error(IngotInitDiagnostics::DependencyMetadataMismatch { - ingot_url: context.from_ingot_url.clone(), - dependency: context.dependency.clone(), - dependency_url: dependency_url.clone(), - expected_name: expected_name.clone(), - expected_version: None, - found_name: found_name.clone(), - found_version: found_version.clone(), - }); - } - IngotSelectionError::MissingConfig { config_url } => { - self.report_error(IngotInitDiagnostics::WorkspaceMemberResolutionFailed { - ingot_url: context.from_ingot_url.clone(), - dependency: context.dependency.clone(), - error: format!("Missing config at {config_url}"), - }); - } - IngotSelectionError::ConfigParseError { config_url, error } => { - self.report_error(IngotInitDiagnostics::WorkspaceMemberResolutionFailed { - ingot_url: context.from_ingot_url.clone(), - dependency: context.dependency.clone(), - error: format!("Failed to parse {config_url}: {error}"), - }); - } - } - } - return; - } - - match description { - IngotDescriptor::Local(target) => { - self.report_error(IngotInitDiagnostics::UnresolvableIngotDependency { - target: target.clone(), - error, - }) - } - IngotDescriptor::LocalByName { base, .. } => { - self.report_error(IngotInitDiagnostics::UnresolvableIngotDependency { - target: base.clone(), - error, - }) - } - IngotDescriptor::ByNameVersion { .. } => { - tracing::error!( - target: "resolver", - "Unhandled ByNameVersion resolution error for {description}: {error}" - ); - } - IngotDescriptor::Remote(target) => { - self.report_error(IngotInitDiagnostics::UnresolvableRemoteDependency { - target: target.clone(), - error, - }) - } - IngotDescriptor::RemoteByName { base, .. } => { - self.report_error(IngotInitDiagnostics::UnresolvableRemoteDependency { - target: base.clone(), - error, - }) - } - }; - } - - fn handle_resolution( - &mut self, - descriptor: &IngotDescriptor, - resource: IngotResource, - ) -> Self::Item { - let IngotResource { - ingot_url, - origin, - workspace_root, - config_probe, - files_error, - } = resource; - - if let Some(workspace_root) = &workspace_root { - self.db.dependency_graph().register_workspace_member_root( - self.db, - workspace_root, - &ingot_url, - ); - } - - self.register_remote_mapping(&ingot_url, &origin); - - if let Some(error) = files_error { - match &origin { - IngotOrigin::Local => { - self.report_error(IngotInitDiagnostics::UnresolvableIngotDependency { - target: ingot_url.clone(), - error: resolver::ingot::IngotResolutionError::Files(error), - }); - } - IngotOrigin::Remote { .. } => { - self.report_error(IngotInitDiagnostics::RemoteFileError { - ingot_url: ingot_url.clone(), - error: error.to_string(), - }); - } - } - self.ingot_urls - .insert(descriptor.clone(), ingot_url.clone()); - return Ok(GraphNodeOutcome { - canonical_description: descriptor.clone(), - aliases: Vec::new(), - forward_nodes: Vec::new(), - }); - } - - if !config_probe.has_config() { - if matches!(&origin, IngotOrigin::Remote { .. }) { - self.report_error(IngotInitDiagnostics::RemoteFileError { - ingot_url: ingot_url.clone(), - error: "Remote ingot is missing fe.toml".into(), - }); - } - self.ingot_urls - .insert(descriptor.clone(), ingot_url.clone()); - return Ok(GraphNodeOutcome { - canonical_description: descriptor.clone(), - aliases: Vec::new(), - forward_nodes: Vec::new(), - }); - } - - let config = match self.config_at_url(&ingot_url) { - Ok(config) => config, - Err(error) => { - match &origin { - IngotOrigin::Local => { - if config_probe.kind_hint() == Some(ConfigKind::Workspace) { - self.report_error(IngotInitDiagnostics::WorkspaceConfigParseError { - workspace_url: ingot_url.clone(), - error, - }); - } else { - self.report_error(IngotInitDiagnostics::ConfigParseError { - ingot_url: ingot_url.clone(), - error, - }); - } - } - IngotOrigin::Remote { .. } => { - self.report_error(IngotInitDiagnostics::RemoteConfigParseError { - ingot_url: ingot_url.clone(), - error, - }); - } - } - self.ingot_urls - .insert(descriptor.clone(), ingot_url.clone()); - return Ok(GraphNodeOutcome { - canonical_description: descriptor.clone(), - aliases: Vec::new(), - forward_nodes: Vec::new(), - }); - } - }; - - if let Config::Workspace(workspace_config) = config { - if self.dependency_contexts.contains_key(descriptor) { - return Err(resolver::ingot::IngotResolutionError::Selection(Box::new( - resolver::ingot::IngotSelectionError::WorkspacePathRequiresSelection { - workspace_url: ingot_url.clone(), - }, - ))); - } - - self.ingot_urls - .insert(descriptor.clone(), ingot_url.clone()); - return Ok(GraphNodeOutcome { - canonical_description: descriptor.clone(), - aliases: Vec::new(), - forward_nodes: self.handle_workspace_config( - &IngotResource { - ingot_url, - origin, - workspace_root, - config_probe, - files_error: None, - }, - *workspace_config, - ), - }); - } - - let Config::Ingot(mut config) = config else { - self.ingot_urls - .insert(descriptor.clone(), ingot_url.clone()); - return Ok(GraphNodeOutcome { - canonical_description: descriptor.clone(), - aliases: Vec::new(), - forward_nodes: Vec::new(), - }); - }; - - let mut diagnostics = config.diagnostics.clone(); - - if config.metadata.version.is_none() - && let Some(version) = workspace_version_for_member(self.db, &ingot_url) - { - config.metadata.version = Some(version); - diagnostics.retain(|diag| !matches!(diag, ConfigDiagnostic::MissingVersion)); - } - - let (config_dependencies, dependency_diagnostics) = config.dependencies(&ingot_url); - diagnostics.extend(dependency_diagnostics); - - if !diagnostics.is_empty() { - match &origin { - IngotOrigin::Local => self.report_warn(IngotInitDiagnostics::ConfigDiagnostics { - ingot_url: ingot_url.clone(), - diagnostics, - }), - IngotOrigin::Remote { .. } => { - self.report_warn(IngotInitDiagnostics::RemoteConfigDiagnostics { - ingot_url: ingot_url.clone(), - diagnostics, - }) - } - }; - } - - self.ensure_phantom_lib_file(&ingot_url); - - self.db.dependency_graph().ensure_node(self.db, &ingot_url); - - if let Some((expected_name, expected_version)) = self - .db - .dependency_graph() - .expected_member_metadata_for(self.db, &ingot_url) - && (config.metadata.name.as_ref() != Some(&expected_name) - || config.metadata.version.as_ref() != Some(&expected_version)) - { - self.report_error(IngotInitDiagnostics::WorkspaceMemberMetadataMismatch { - ingot_url: ingot_url.clone(), - expected_name, - expected_version, - found_name: config.metadata.name.clone(), - found_version: config.metadata.version.clone(), - }); - self.ingot_urls - .insert(descriptor.clone(), ingot_url.clone()); - return Ok(GraphNodeOutcome { - canonical_description: descriptor.clone(), - aliases: Vec::new(), - forward_nodes: Vec::new(), - }); - } - - let mut aliases = Vec::new(); - if let (Some(name), Some(version)) = ( - config.metadata.name.clone(), - config.metadata.version.clone(), - ) { - self.db.dependency_graph().register_ingot_metadata( - self.db, - &ingot_url, - name.clone(), - version.clone(), - ); - aliases.push(IngotDescriptor::ByNameVersion { name, version }); - } - - let workspace_member_alias = workspace_root.as_ref().and_then(|workspace_root| { - config.metadata.name.clone().map(|name| match &origin { - IngotOrigin::Local => IngotDescriptor::LocalByName { - base: workspace_root.clone(), - name, - }, - IngotOrigin::Remote { - description, - checkout_path, - .. - } => { - let mut base = - GitDescription::new(description.source.clone(), description.rev.clone()); - if let Ok(relative) = - relative_path_within_checkout(checkout_path.as_path(), workspace_root) - && let Some(path) = relative - { - base = base.with_path(path); - } - IngotDescriptor::RemoteByName { base, name } - } - }) - }); - - let canonical_description = workspace_member_alias - .clone() - .unwrap_or_else(|| descriptor.clone()); - - let concrete_description = match &origin { - IngotOrigin::Local => IngotDescriptor::Local(ingot_url.clone()), - IngotOrigin::Remote { description, .. } => IngotDescriptor::Remote(description.clone()), - }; - if concrete_description != canonical_description { - aliases.push(concrete_description); - } - - if let Some(request) = self.requested_dependency_arithmetic(descriptor) { - self.register_forced_dependency_arithmetic(&ingot_url, request); - } - - let dependency_policy = self.outbound_dependency_policy_for_ingot( - descriptor, - &ingot_url, - workspace_root.as_ref(), - &config, - ); - let mut dependencies = Vec::new(); - for dependency in config_dependencies { - let is_external = self.is_external_dependency(workspace_root.as_ref(), &dependency); - if let Some(converted) = - self.convert_dependency(&ingot_url, &origin, workspace_root.as_ref(), dependency) - { - if is_external && let Some(mode) = dependency_arithmetic_mode(dependency_policy) { - self.record_dependency_arithmetic_request( - &converted.0, - &ingot_url, - &converted.1.0, - mode, - ); - } - let priority = match &converted.0 { - IngotDescriptor::Local(_) | IngotDescriptor::LocalByName { .. } => { - IngotPriority::local() - } - IngotDescriptor::Remote(_) - | IngotDescriptor::RemoteByName { .. } - | IngotDescriptor::ByNameVersion { .. } => IngotPriority::remote(), - }; - dependencies.push(UnresolvedNode { - priority, - description: converted.0, - edge: converted.1, - }); - } - } - - self.ingot_urls - .insert(canonical_description.clone(), ingot_url.clone()); - - Ok(GraphNodeOutcome { - canonical_description, - aliases, - forward_nodes: dependencies, - }) - } -} - -impl<'a> ResolutionHandler for IngotHandler<'a> { - type Item = resolver::files::FilesResource; - - fn on_resolution_diagnostic(&mut self, diagnostic: resolver::files::FilesResolutionDiagnostic) { - self.report_warn(IngotInitDiagnostics::FileError { diagnostic }); - } - - fn handle_resolution( - &mut self, - _description: &Url, - resource: resolver::files::FilesResource, - ) -> Self::Item { - self.record_files(&resource.files); - resource - } -} - -impl<'a> - GraphResolutionHandler< - IngotDescriptor, - DiGraph, - > for IngotHandler<'a> -{ - type Item = (); - - fn handle_graph_resolution( - &mut self, - _descriptor: &IngotDescriptor, - graph: DiGraph, - ) -> Self::Item { - let mut registered_nodes = HashSet::new(); - for node_idx in graph.node_indices() { - if let Some(url) = self.ingot_urls.get(&graph[node_idx]) - && registered_nodes.insert(url.clone()) - { - self.db.dependency_graph().ensure_node(self.db, url); - } - } - - let mut registered_edges = HashSet::new(); - for edge in graph.edge_references() { - if let (Some(from_url), Some(to_url)) = ( - self.ingot_urls.get(&graph[edge.source()]), - self.ingot_urls.get(&graph[edge.target()]), - ) { - let from_url = from_url.clone(); - let to_url = to_url.clone(); - let (alias, arguments) = edge.weight(); - if registered_edges.insert(( - from_url.clone(), - to_url.clone(), - alias.clone(), - arguments.clone(), - )) { - if let Some(expected_version) = arguments.version.clone() - && let Some((found_name, found_version)) = - self.effective_metadata_for_ingot(&to_url) - && found_version.as_ref() != Some(&expected_version) - { - let expected_name = arguments - .name - .clone() - .or_else(|| found_name.clone()) - .unwrap_or_else(|| alias.clone()); - self.report_error(IngotInitDiagnostics::DependencyMetadataMismatch { - ingot_url: from_url.clone(), - dependency: alias.clone(), - dependency_url: to_url.clone(), - expected_name, - expected_version: Some(expected_version), - found_name, - found_version, - }); - } - if self.is_external_dependency_url(&from_url, &to_url) - && let Some(mode) = dependency_arithmetic_mode( - self.outbound_dependency_policy_for_url(&from_url), - ) - { - self.register_forced_dependency_arithmetic( - &to_url, - DependencyArithmeticRequest { - from_ingot_url: from_url.clone(), - dependency: alias.clone(), - mode, - }, - ); - } - self.db.dependency_graph().add_dependency( - self.db, - &from_url, - &to_url, - alias.clone(), - arguments.clone(), - ); - } - } - } - } -} - -fn relative_path_within_checkout( - checkout_path: &Utf8Path, - target_url: &Url, -) -> Result, String> { - let path_buf = target_url - .to_file_path() - .map_err(|_| "target URL is not a file URL".to_string())?; - let utf8_path = Utf8PathBuf::from_path_buf(path_buf) - .map_err(|_| "non UTF-8 path encountered in remote dependency".to_string())?; - let relative = utf8_path - .strip_prefix(checkout_path) - .map_err(|_| "path escapes the checked-out repository".to_string())?; - if relative.as_str().is_empty() { - Ok(None) - } else { - Ok(Some(relative.to_owned())) - } -} diff --git a/crates/driver/src/lib.rs b/crates/driver/src/lib.rs deleted file mode 100644 index 302677c34e..0000000000 --- a/crates/driver/src/lib.rs +++ /dev/null @@ -1,886 +0,0 @@ -#![allow(clippy::print_stderr)] - -pub mod cli_target; -pub mod db; -pub mod diagnostics; -pub mod files; -mod ingot_handler; - -pub use common::dependencies::DependencyTree; - -use std::collections::{HashMap, HashSet}; - -use camino::Utf8PathBuf; -use common::{ - InputDb, - cache::remote_git_cache_dir, - config::WorkspaceMemberSelection, - ingot::Version, - stdlib::{HasBuiltinCore, HasBuiltinStd}, -}; -pub use db::DriverDataBase; -use ingot_handler::IngotHandler; -use smol_str::SmolStr; - -use hir::analysis::core_requirements; -use hir::hir_def::TopLevelMod; -pub use resolver::workspace::{ExpandedWorkspaceMember, expand_workspace_members}; -use resolver::{ - files::FilesResolutionDiagnostic, - git::{GitDescription, GitResolver}, - graph::{GraphResolver, GraphResolverImpl}, - ingot::{IngotDescriptor, IngotResolutionError, IngotResolverImpl, RemoteProgress}, -}; -use url::Url; - -struct LoggingProgress; - -impl RemoteProgress for LoggingProgress { - fn start(&mut self, description: &GitDescription) { - tracing::info!(target: "resolver", "Resolving remote dependency {}", description); - } - - fn success(&mut self, _description: &GitDescription, ingot_url: &Url) { - tracing::info!(target: "resolver", "Resolved {}", ingot_url); - } - - fn error(&mut self, description: &GitDescription, error: &IngotResolutionError) { - tracing::warn!( - target: "resolver", - "Failed to resolve {}: {}", - description, - error - ); - } -} - -fn ingot_resolver(remote_checkout_root: Utf8PathBuf) -> IngotResolverImpl { - let git_resolver = GitResolver::new(remote_checkout_root); - IngotResolverImpl::new(git_resolver).with_progress(Box::new(LoggingProgress)) -} - -pub fn init_ingot(db: &mut DriverDataBase, ingot_url: &Url) -> bool { - init_ingot_graph(db, ingot_url) -} - -/// Result of discovering and initializing ingots/files from a root directory. -pub struct DiscoveredProject { - /// Ingot URLs that were loaded into the DB. - pub ingot_urls: Vec, - /// Standalone `.fe` file URLs that were loaded into the DB. - pub standalone_files: Vec, -} - -/// Discover ingots/workspaces from `root_url` and init them into `db`. -/// -/// 1. Runs `discover_context` (walks up looking for fe.toml). -/// 2. If nothing found AND root has no fe.toml, scans downward for child -/// ingots/workspaces and standalone `.fe` files (e.g. a workbook with -/// scattered lessons). -pub fn discover_and_init(db: &mut DriverDataBase, root_url: &Url) -> DiscoveredProject { - use resolver::workspace::discover_context; - use std::collections::BTreeSet; - - let mut result = DiscoveredProject { - ingot_urls: Vec::new(), - standalone_files: Vec::new(), - }; - - let Ok(discovery) = discover_context(root_url, false) else { - return result; - }; - - // Init workspace root if present - if let Some(ws_root) = &discovery.workspace_root { - init_ingot(db, ws_root); - result.ingot_urls.push(ws_root.clone()); - } - - // Init all discovered ingots (workspace members) - for url in &discovery.ingot_roots { - init_ingot(db, url); - result.ingot_urls.push(url.clone()); - } - - // If discover_context found actual ingot roots (not just a workspace root - // with no members), we're done. A workspace with `members = []` should - // still fall through to the downward scan. - if !discovery.ingot_roots.is_empty() { - return result; - } - - // Fallback: if root itself has fe.toml, init it directly - let root_has_config = root_url - .to_file_path() - .map(|p| p.join("fe.toml").is_file()) - .unwrap_or(false); - if root_has_config { - init_ingot(db, root_url); - result.ingot_urls.push(root_url.clone()); - return result; - } - - // Nothing discovered upward and no root config — scan downward for - // child ingots/workspaces (e.g. a workbook with scattered lessons). - let Ok(root_path) = root_url.to_file_path() else { - return result; - }; - - // Collect fe.toml locations and standalone .fe files via recursive scan - let mut config_dirs = BTreeSet::new(); - let mut fe_files = Vec::new(); - fn scan_dir( - dir: &std::path::Path, - configs: &mut BTreeSet, - files: &mut Vec, - ) { - let Ok(entries) = std::fs::read_dir(dir) else { - return; - }; - for entry in entries.flatten() { - let path = entry.path(); - if path.is_dir() { - // Skip hidden dirs like .solutions - if path - .file_name() - .is_some_and(|n| n.to_string_lossy().starts_with('.')) - { - continue; - } - // Skip symlinks to avoid infinite recursion on cyclic links - if path - .symlink_metadata() - .is_ok_and(|m| m.file_type().is_symlink()) - { - continue; - } - if path.join("fe.toml").is_file() { - configs.insert(path.clone()); - } - scan_dir(&path, configs, files); - } else if path.extension().is_some_and(|ext| ext == "fe") { - files.push(path); - } - } - } - scan_dir(&root_path, &mut config_dirs, &mut fe_files); - - // Filter out dirs that are inside another discovered dir (workspace members - // will be expanded by discover_context, so we only want top-level configs). - let top_level_dirs: Vec<_> = config_dirs - .iter() - .filter(|dir| { - !config_dirs - .iter() - .any(|other| other != *dir && dir.starts_with(other)) - }) - .cloned() - .collect(); - - // Collect all ingot src/ directories to filter out .fe files that belong to ingots - let mut ingot_src_dirs: Vec = Vec::new(); - - for dir in top_level_dirs { - let Ok(dir_url) = Url::from_directory_path(&dir) else { - continue; - }; - ingot_src_dirs.push(dir.clone()); - // Run discover_context on each top-level config dir to properly - // handle workspaces (expands members) vs plain ingots. - if let Ok(sub_discovery) = discover_context(&dir_url, false) { - if let Some(ws_root) = &sub_discovery.workspace_root { - init_ingot(db, ws_root); - result.ingot_urls.push(ws_root.clone()); - } - for url in &sub_discovery.ingot_roots { - if !result.ingot_urls.contains(url) { - init_ingot(db, url); - result.ingot_urls.push(url.clone()); - if let Ok(p) = url.to_file_path() { - ingot_src_dirs.push(p); - } - } - } - if sub_discovery.workspace_root.is_none() && sub_discovery.ingot_roots.is_empty() { - init_ingot(db, &dir_url); - result.ingot_urls.push(dir_url); - } - } - } - - // Load standalone .fe files that aren't under any discovered ingot - for fe_path in &fe_files { - let under_ingot = ingot_src_dirs.iter().any(|d| fe_path.starts_with(d)); - if under_ingot { - continue; - } - if let Ok(content) = std::fs::read_to_string(fe_path) - && let Ok(url) = Url::from_file_path(fe_path) - { - db.workspace().touch(db, url.clone(), Some(content)); - result.standalone_files.push(url); - } - } - - result -} - -pub fn check_library_requirements(db: &DriverDataBase) -> Vec { - let mut missing = Vec::new(); - - let core = db.builtin_core(); - if let Ok(core_file) = core.root_file(db) { - let top_mod = db.top_mod(core_file); - missing.extend( - core_requirements::check_core_requirements(db, top_mod.scope()) - .into_iter() - .map(|req| req.to_string()), - ); - } else { - missing.push("missing required core ingot".to_string()); - } - - let std_ingot = db.builtin_std(); - if let Ok(std_file) = std_ingot.root_file(db) { - let top_mod = db.top_mod(std_file); - missing.extend( - core_requirements::check_std_type_requirements(db, top_mod.scope()) - .into_iter() - .map(|req| req.to_string()), - ); - } else { - missing.push("missing required std ingot".to_string()); - } - - missing -} - -fn init_ingot_graph(db: &mut DriverDataBase, ingot_url: &Url) -> bool { - tracing::info!(target: "resolver", "Starting ingot resolution for: {}", ingot_url); - let checkout_root = remote_checkout_root(ingot_url); - let mut handler = IngotHandler::new(db); - let mut ingot_graph_resolver = GraphResolverImpl::new(ingot_resolver(checkout_root)); - - // Root ingot resolution should never fail since directory existence is validated earlier. - // If it fails, it indicates a bug in the resolver or an unexpected system condition. - if let Err(err) = - ingot_graph_resolver.graph_resolve(&mut handler, &IngotDescriptor::Local(ingot_url.clone())) - { - panic!( - "Unexpected failure resolving root ingot at {ingot_url}: {err:?}. This indicates a bug in the resolver since directory existence is validated before calling init_ingot." - ); - } - - let mut had_diagnostics = handler.had_diagnostics(); - - // Check for cycles after graph resolution (now that handler is dropped) - let cyclic_subgraph = db.dependency_graph().cyclic_subgraph(db); - - // Add cycle diagnostics - single comprehensive diagnostic if any cycles exist - if cyclic_subgraph.node_count() > 0 { - // Get configs for all nodes in the cyclic subgraph - let mut configs = HashMap::new(); - for node_idx in cyclic_subgraph.node_indices() { - let url = &cyclic_subgraph[node_idx]; - if let Some(ingot) = db.workspace().containing_ingot(db, url.clone()) - && let Some(config) = ingot.config(db) - { - configs.insert(url.clone(), config); - } - } - - // The root ingot should be part of any detected cycles since we're analyzing its dependencies - if !cyclic_subgraph - .node_indices() - .any(|idx| cyclic_subgraph[idx] == *ingot_url) - { - panic!( - "Root ingot {ingot_url} not found in cyclic subgraph. This indicates a bug in cycle detection logic." - ); - } - - // Generate the tree display string - let tree_display = - DependencyTree::from_parts(cyclic_subgraph, ingot_url.clone(), configs, HashSet::new()) - .display_to(common::color::ColorTarget::Stderr); - - let diag = IngotInitDiagnostics::IngotDependencyCycle { tree_display }; - tracing::warn!(target: "resolver", "{diag}"); - eprintln!("Error: {diag}"); - had_diagnostics = true; - } - - if !had_diagnostics { - tracing::info!(target: "resolver", "Ingot resolution completed successfully for: {}", ingot_url); - } else { - tracing::warn!(target: "resolver", "Ingot resolution completed with diagnostics for: {}", ingot_url); - } - - had_diagnostics -} - -pub fn init_workspace(db: &mut DriverDataBase, workspace_url: &Url) -> bool { - init_ingot_graph(db, workspace_url) -} - -pub fn find_ingot_by_metadata(db: &DriverDataBase, name: &str, version: &Version) -> Option { - db.dependency_graph() - .ingot_by_name_version(db, &SmolStr::new(name), version) -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct WorkspaceMember { - pub url: Url, - pub path: Utf8PathBuf, - pub name: Option, - pub version: Option, -} - -fn _dump_scope_graph(db: &DriverDataBase, top_mod: TopLevelMod) -> String { - let mut s = vec![]; - top_mod.scope_graph(db).write_as_dot(db, &mut s).unwrap(); - String::from_utf8(s).unwrap() -} - -pub fn workspace_member_urls( - workspace: &common::config::WorkspaceSettings, - workspace_url: &Url, -) -> Result, String> { - let members = workspace_members(workspace, workspace_url)?; - Ok(members - .into_iter() - .filter(|member| member.url != *workspace_url) - .map(|member| member.url) - .collect()) -} - -pub fn workspace_members( - workspace: &common::config::WorkspaceSettings, - workspace_url: &Url, -) -> Result, String> { - let selection = if workspace.default_members.is_some() { - WorkspaceMemberSelection::DefaultOnly - } else { - WorkspaceMemberSelection::All - }; - let members = expand_workspace_members(workspace, workspace_url, selection)?; - Ok(members - .into_iter() - .filter(|member| member.url != *workspace_url) - .map(|member| WorkspaceMember { - url: member.url, - path: member.path, - name: member.name, - version: member.version, - }) - .collect()) -} - -// Maybe the driver should eventually only support WASI? - -#[derive(Debug)] -pub enum IngotInitDiagnostics { - UnresolvableIngotDependency { - target: Url, - error: IngotResolutionError, - }, - IngotDependencyCycle { - tree_display: String, - }, - FileError { - diagnostic: FilesResolutionDiagnostic, - }, - ConfigParseError { - ingot_url: Url, - error: String, - }, - ConfigDiagnostics { - ingot_url: Url, - diagnostics: Vec, - }, - WorkspaceConfigParseError { - workspace_url: Url, - error: String, - }, - WorkspaceDiagnostics { - workspace_url: Url, - diagnostics: Vec, - }, - WorkspaceMembersError { - workspace_url: Url, - error: String, - }, - WorkspaceMemberDuplicate { - workspace_url: Url, - name: SmolStr, - version: Option, - }, - WorkspaceMemberMetadataMismatch { - ingot_url: Url, - expected_name: SmolStr, - expected_version: Version, - found_name: Option, - found_version: Option, - }, - WorkspaceDependencyAliasConflict { - workspace_url: Url, - alias: SmolStr, - }, - WorkspacePathRequiresSelection { - ingot_url: Url, - dependency: SmolStr, - workspace_url: Url, - }, - WorkspaceNameLookupUnavailable { - ingot_url: Url, - dependency: SmolStr, - }, - DependencyMetadataMismatch { - ingot_url: Url, - dependency: SmolStr, - dependency_url: Url, - expected_name: SmolStr, - expected_version: Option, - found_name: Option, - found_version: Option, - }, - DependencyArithmeticConflict { - dependency_url: Url, - first_ingot_url: Url, - first_dependency: SmolStr, - first_mode: common::config::ArithmeticMode, - second_ingot_url: Url, - second_dependency: SmolStr, - second_mode: common::config::ArithmeticMode, - }, - WorkspaceMemberResolutionFailed { - ingot_url: Url, - dependency: SmolStr, - error: String, - }, - IngotByNameResolutionFailed { - ingot_url: Url, - dependency: SmolStr, - name: SmolStr, - version: Version, - }, - RemoteFileError { - ingot_url: Url, - error: String, - }, - RemoteConfigParseError { - ingot_url: Url, - error: String, - }, - RemoteConfigDiagnostics { - ingot_url: Url, - diagnostics: Vec, - }, - UnresolvableRemoteDependency { - target: GitDescription, - error: IngotResolutionError, - }, - RemotePathResolutionError { - ingot_url: Url, - dependency: SmolStr, - error: String, - }, -} - -fn format_metadata(name: &Option, version: &Option) -> String { - let name = name - .as_ref() - .map(ToString::to_string) - .unwrap_or_else(|| "".to_string()); - let version = version - .as_ref() - .map(ToString::to_string) - .unwrap_or_else(|| "".to_string()); - format!("{name}@{version}") -} - -impl std::fmt::Display for IngotInitDiagnostics { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - IngotInitDiagnostics::UnresolvableIngotDependency { target, error } => { - write!(f, "Failed to resolve ingot dependency '{target}': {error}") - } - IngotInitDiagnostics::IngotDependencyCycle { tree_display } => { - write!( - f, - "Detected cycle(s) in ingot dependencies:\n\n{tree_display}" - ) - } - IngotInitDiagnostics::FileError { diagnostic } => { - write!(f, "File resolution failed: {diagnostic}") - } - IngotInitDiagnostics::ConfigParseError { ingot_url, error } => { - write!(f, "Invalid fe.toml in ingot {ingot_url}: {error}") - } - IngotInitDiagnostics::ConfigDiagnostics { - ingot_url, - diagnostics, - } => { - if diagnostics.len() == 1 { - write!( - f, - "Invalid fe.toml in ingot {ingot_url}: {}", - diagnostics[0] - ) - } else { - writeln!(f, "Invalid fe.toml in ingot {ingot_url}:")?; - for diagnostic in diagnostics { - writeln!(f, " • {diagnostic}")?; - } - Ok(()) - } - } - IngotInitDiagnostics::WorkspaceConfigParseError { - workspace_url, - error, - } => { - write!(f, "Invalid workspace fe.toml in {workspace_url}: {error}") - } - IngotInitDiagnostics::WorkspaceDiagnostics { - workspace_url, - diagnostics, - } => { - if diagnostics.len() == 1 { - write!( - f, - "Invalid workspace fe.toml in {workspace_url}: {}", - diagnostics[0] - ) - } else { - writeln!(f, "Invalid workspace fe.toml in {workspace_url}:")?; - for diagnostic in diagnostics { - writeln!(f, " • {diagnostic}")?; - } - Ok(()) - } - } - IngotInitDiagnostics::WorkspaceMembersError { - workspace_url, - error, - } => { - write!( - f, - "Failed to resolve workspace members in {workspace_url}: {error}" - ) - } - IngotInitDiagnostics::WorkspaceMemberDuplicate { - workspace_url, - name, - version, - } => { - let _ = version; - write!( - f, - "Workspace member {name} is duplicated in {workspace_url}" - ) - } - IngotInitDiagnostics::WorkspaceMemberMetadataMismatch { - ingot_url, - expected_name, - expected_version, - found_name, - found_version, - } => { - write!( - f, - "Workspace member {expected_name}@{expected_version} in {ingot_url} has mismatched metadata (found {})", - format_metadata(found_name, found_version) - ) - } - IngotInitDiagnostics::WorkspaceDependencyAliasConflict { - workspace_url, - alias, - } => { - write!( - f, - "Workspace dependency alias '{alias}' conflicts with a workspace member name in {workspace_url}" - ) - } - IngotInitDiagnostics::WorkspacePathRequiresSelection { - ingot_url, - dependency, - workspace_url, - } => { - write!( - f, - "Dependency '{dependency}' in {ingot_url} points to a workspace at {workspace_url}; provide an ingot path or a name/version" - ) - } - IngotInitDiagnostics::WorkspaceNameLookupUnavailable { - ingot_url, - dependency, - } => { - write!( - f, - "Dependency '{dependency}' in {ingot_url} uses name-only lookup outside a workspace" - ) - } - IngotInitDiagnostics::DependencyMetadataMismatch { - ingot_url, - dependency, - dependency_url, - expected_name, - expected_version, - found_name, - found_version, - } => { - if let Some(expected_version) = expected_version { - write!( - f, - "Dependency '{dependency}' in {ingot_url} expected {expected_name}@{expected_version} at {dependency_url} but found {}", - format_metadata(found_name, found_version) - ) - } else { - write!( - f, - "Dependency '{dependency}' in {ingot_url} expected {expected_name} at {dependency_url} but found {}", - format_metadata(found_name, found_version) - ) - } - } - IngotInitDiagnostics::DependencyArithmeticConflict { - dependency_url, - first_ingot_url, - first_dependency, - first_mode, - second_ingot_url, - second_dependency, - second_mode, - } => { - write!( - f, - "Dependency arithmetic conflict for {dependency_url}: '{first_dependency}' in {first_ingot_url} forced {first_mode:?}, but '{second_dependency}' in {second_ingot_url} forced {second_mode:?}" - ) - } - IngotInitDiagnostics::WorkspaceMemberResolutionFailed { - ingot_url, - dependency, - error, - } => { - write!( - f, - "Failed to resolve workspace member for '{dependency}' in {ingot_url}: {error}" - ) - } - IngotInitDiagnostics::IngotByNameResolutionFailed { - ingot_url, - dependency, - name, - version, - } => { - write!( - f, - "Dependency '{dependency}' in {ingot_url} requested ingot {name}@{version} but it was not found in the workspace registry" - ) - } - IngotInitDiagnostics::RemoteFileError { ingot_url, error } => { - write!(f, "Remote file operation failed at {ingot_url}: {error}") - } - IngotInitDiagnostics::RemoteConfigParseError { ingot_url, error } => { - write!(f, "Invalid remote fe.toml in {ingot_url}: {error}") - } - IngotInitDiagnostics::RemoteConfigDiagnostics { - ingot_url, - diagnostics, - } => { - if diagnostics.len() == 1 { - write!( - f, - "Invalid remote fe.toml in {ingot_url}: {}", - diagnostics[0] - ) - } else { - writeln!(f, "Invalid remote fe.toml in {ingot_url}:")?; - for diagnostic in diagnostics { - writeln!(f, " • {diagnostic}")?; - } - Ok(()) - } - } - IngotInitDiagnostics::UnresolvableRemoteDependency { target, error } => { - write!(f, "Failed to resolve remote dependency '{target}': {error}") - } - IngotInitDiagnostics::RemotePathResolutionError { - ingot_url, - dependency, - error, - } => { - write!( - f, - "Remote dependency '{dependency}' in {ingot_url} points outside the repository: {error}" - ) - } - } - } -} - -pub(crate) fn remote_checkout_root(ingot_url: &Url) -> Utf8PathBuf { - if let Some(root) = remote_git_cache_dir() { - return root; - } - - let mut ingot_path = Utf8PathBuf::from_path_buf( - ingot_url - .to_file_path() - .expect("ingot URL should map to a local path"), - ) - .expect("ingot path should be valid UTF-8"); - ingot_path.push(".fe"); - ingot_path.push("git"); - ingot_path -} - -#[cfg(test)] -mod tests { - use super::*; - - /// discover_and_init should not panic on a directory with no fe.toml. - #[test] - fn discover_and_init_empty_dir() { - let tmp = tempfile::tempdir().unwrap(); - let url = Url::from_directory_path(tmp.path()).unwrap(); - let mut db = DriverDataBase::default(); - let result = discover_and_init(&mut db, &url); - assert!(result.ingot_urls.is_empty()); - assert!(result.standalone_files.is_empty()); - } - - /// discover_and_init should find a single ingot at root. - #[test] - fn discover_and_init_single_ingot() { - let tmp = tempfile::tempdir().unwrap(); - let root = tmp.path(); - std::fs::write( - root.join("fe.toml"), - "[ingot]\nname = \"test\"\nversion = \"0.1.0\"\n", - ) - .unwrap(); - std::fs::create_dir_all(root.join("src")).unwrap(); - std::fs::write(root.join("src").join("lib.fe"), "pub fn foo() {}").unwrap(); - - let url = Url::from_directory_path(root).unwrap(); - let mut db = DriverDataBase::default(); - let result = discover_and_init(&mut db, &url); - assert_eq!(result.ingot_urls.len(), 1); - } - - /// discover_and_init should scan downward and find child ingots when - /// the root has no fe.toml. - #[test] - fn discover_and_init_scattered_ingots() { - let tmp = tempfile::tempdir().unwrap(); - let root = tmp.path(); - - // Create two child ingots under lessons/ - for name in &["alpha", "beta"] { - let ingot_dir = root.join("lessons").join(name); - std::fs::create_dir_all(ingot_dir.join("src")).unwrap(); - std::fs::write( - ingot_dir.join("fe.toml"), - format!("[ingot]\nname = \"{name}\"\nversion = \"0.1.0\"\n"), - ) - .unwrap(); - std::fs::write(ingot_dir.join("src").join("lib.fe"), "pub fn f() {}").unwrap(); - } - - let url = Url::from_directory_path(root).unwrap(); - let mut db = DriverDataBase::default(); - let result = discover_and_init(&mut db, &url); - assert_eq!(result.ingot_urls.len(), 2, "should find both child ingots"); - } - - /// discover_and_init should still scan downward when a workspace root - /// is found but has no member ingots (e.g. `members = []`). - #[test] - fn discover_and_init_empty_workspace_scans_children() { - let tmp = tempfile::tempdir().unwrap(); - let root = tmp.path(); - - // Create a workspace with empty members - std::fs::write(root.join("fe.toml"), "[workspace]\nmembers = []\n").unwrap(); - - // Create a child ingot that should be discovered by downward scan - let child = root.join("packages").join("child"); - std::fs::create_dir_all(child.join("src")).unwrap(); - std::fs::write( - child.join("fe.toml"), - "[ingot]\nname = \"child\"\nversion = \"0.1.0\"\n", - ) - .unwrap(); - std::fs::write(child.join("src").join("lib.fe"), "pub fn f() {}").unwrap(); - - let url = Url::from_directory_path(root).unwrap(); - let mut db = DriverDataBase::default(); - let result = discover_and_init(&mut db, &url); - // Workspace root + the child ingot discovered by downward scan - assert!( - result.ingot_urls.len() >= 2, - "should find workspace root and child ingot, got {}", - result.ingot_urls.len() - ); - } - - /// discover_and_init should not follow directory symlinks (cyclic links - /// would cause infinite recursion). - #[cfg(unix)] - #[test] - fn discover_and_init_skips_symlinks() { - let tmp = tempfile::tempdir().unwrap(); - let root = tmp.path(); - - // Create a directory with a cyclic symlink - let subdir = root.join("lessons"); - std::fs::create_dir_all(&subdir).unwrap(); - std::os::unix::fs::symlink(root, subdir.join("loop")).unwrap(); - - // Create a standalone .fe file to prove we still scan non-symlink entries - std::fs::write(root.join("hello.fe"), "pub fn hello() {}").unwrap(); - - let url = Url::from_directory_path(root).unwrap(); - let mut db = DriverDataBase::default(); - // This would hang/overflow before the symlink fix - let result = discover_and_init(&mut db, &url); - assert_eq!( - result.standalone_files.len(), - 1, - "should find the standalone file without infinite recursion" - ); - } - - /// discover_and_init should find standalone .fe files not under any ingot. - #[test] - fn discover_and_init_standalone_files() { - let tmp = tempfile::tempdir().unwrap(); - let root = tmp.path(); - - // Create a standalone .fe file - let lessons = root.join("lessons").join("basics"); - std::fs::create_dir_all(&lessons).unwrap(); - std::fs::write(lessons.join("hello.fe"), "pub fn hello() {}").unwrap(); - - // And an ingot alongside it - let ingot_dir = root.join("lessons").join("myingot"); - std::fs::create_dir_all(ingot_dir.join("src")).unwrap(); - std::fs::write( - ingot_dir.join("fe.toml"), - "[ingot]\nname = \"myingot\"\nversion = \"0.1.0\"\n", - ) - .unwrap(); - std::fs::write(ingot_dir.join("src").join("lib.fe"), "pub fn f() {}").unwrap(); - - let url = Url::from_directory_path(root).unwrap(); - let mut db = DriverDataBase::default(); - let result = discover_and_init(&mut db, &url); - assert_eq!(result.ingot_urls.len(), 1, "should find the ingot"); - assert_eq!( - result.standalone_files.len(), - 1, - "should find the standalone file" - ); - } -} diff --git a/crates/driver/tests/workspace_resolution.rs b/crates/driver/tests/workspace_resolution.rs deleted file mode 100644 index 18e84c5399..0000000000 --- a/crates/driver/tests/workspace_resolution.rs +++ /dev/null @@ -1,1135 +0,0 @@ -use std::fs; -use std::process::Command; - -use camino::Utf8PathBuf; -use common::InputDb; -use common::cache::remote_git_cache_dir; -use common::file::IngotFileKind; -use fe_driver::{DriverDataBase, init_ingot, init_workspace}; -use resolver::git::{GitDescription, GitResolver}; -use tempfile::TempDir; -use url::Url; - -fn write_file(path: &Utf8PathBuf, content: &str) { - if let Some(parent) = path.parent() { - fs::create_dir_all(parent.as_std_path()).unwrap(); - } - fs::write(path.as_std_path(), content).unwrap(); -} - -fn git_commit(repo: &Utf8PathBuf, message: &str) -> String { - Command::new("git") - .arg("-C") - .arg(repo.as_std_path()) - .arg("add") - .arg(".") - .status() - .expect("git add") - .success() - .then_some(()) - .expect("git add success"); - Command::new("git") - .arg("-C") - .arg(repo.as_std_path()) - .args(["commit", "-m", message]) - .status() - .expect("git commit") - .success() - .then_some(()) - .expect("git commit success"); - - let output = Command::new("git") - .arg("-C") - .arg(repo.as_std_path()) - .args(["rev-parse", "HEAD"]) - .output() - .expect("git rev-parse"); - assert!(output.status.success()); - String::from_utf8_lossy(&output.stdout).trim().to_string() -} - -static REMOTE_CACHE_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); - -fn with_remote_cache_dir(cache_root: &Utf8PathBuf, f: impl FnOnce() -> T) -> T { - let _guard = REMOTE_CACHE_LOCK.lock().expect("remote cache lock"); - let previous = std::env::var("FE_REMOTE_CACHE_DIR").ok(); - unsafe { - std::env::set_var("FE_REMOTE_CACHE_DIR", cache_root.as_str()); - } - let result = f(); - unsafe { - match previous { - Some(value) => std::env::set_var("FE_REMOTE_CACHE_DIR", value), - None => std::env::remove_var("FE_REMOTE_CACHE_DIR"), - } - } - result -} - -#[cfg(unix)] -#[test] -fn resolves_workspace_member_by_name_local_through_symlinked_workspace_root() { - use std::os::unix::fs::symlink; - - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let workspace_link = root.join("workspace_link"); - let ingot_a = workspace_root.join("ingots/a"); - let ingot_b = workspace_root.join("ingots/b"); - - fs::create_dir_all(workspace_root.as_std_path()).unwrap(); - symlink(workspace_root.as_std_path(), workspace_link.as_std_path()).unwrap(); - - write_file( - &workspace_root.join("fe.toml"), - r#" -[workspace] -name = "local-workspace" -version = "0.1.0" -members = [ - { path = "ingots/a", name = "a", version = "0.1.0" }, - { path = "ingots/b", name = "b", version = "0.1.0" }, -] -"#, - ); - - write_file( - &ingot_a.join("fe.toml"), - r#" -[ingot] -name = "a" -version = "0.1.0" - -[dependencies] -b = true -"#, - ); - write_file(&ingot_a.join("src/lib.fe"), "pub fn main() {}\n"); - - write_file( - &ingot_b.join("fe.toml"), - r#" -[ingot] -name = "b" -version = "0.1.0" -"#, - ); - write_file(&ingot_b.join("src/lib.fe"), "pub fn main() {}\n"); - - let workspace_url = - Url::from_directory_path(workspace_link.as_std_path()).expect("workspace url"); - let ingot_a_url = Url::from_directory_path(workspace_link.join("ingots/a").as_std_path()) - .expect("ingot a url"); - let ingot_b_url = Url::from_directory_path(workspace_link.join("ingots/b").as_std_path()) - .expect("ingot b url"); - - let mut db = DriverDataBase::default(); - let had_diagnostics = init_workspace(&mut db, &workspace_url); - assert!(!had_diagnostics, "unexpected diagnostics"); - - let deps = db.dependency_graph().dependency_urls(&db, &ingot_a_url); - assert!(deps.contains(&ingot_b_url)); -} - -#[test] -fn resolves_workspace_member_by_name_local() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let ingot_a = workspace_root.join("ingots/a"); - let ingot_b = workspace_root.join("ingots/b"); - - write_file( - &workspace_root.join("fe.toml"), - r#" -[workspace] -name = "local-workspace" -version = "0.1.0" -members = [ - { path = "ingots/a", name = "a", version = "0.1.0" }, - { path = "ingots/b", name = "b", version = "0.1.0" }, -] -"#, - ); - - write_file( - &ingot_a.join("fe.toml"), - r#" -[ingot] -name = "a" -version = "0.1.0" - -[dependencies] -b = true -"#, - ); - write_file(&ingot_a.join("src/lib.fe"), "pub fn main() {}\n"); - - write_file( - &ingot_b.join("fe.toml"), - r#" -[ingot] -name = "b" -version = "0.1.0" -"#, - ); - write_file(&ingot_b.join("src/lib.fe"), "pub fn main() {}\n"); - - let workspace_url = - Url::from_directory_path(workspace_root.as_std_path()).expect("workspace url"); - let ingot_a_url = Url::from_directory_path(ingot_a.as_std_path()).expect("ingot a url"); - let ingot_b_url = Url::from_directory_path(ingot_b.as_std_path()).expect("ingot b url"); - - let mut db = DriverDataBase::default(); - let had_diagnostics = init_workspace(&mut db, &workspace_url); - assert!(!had_diagnostics, "unexpected diagnostics"); - - let deps = db.dependency_graph().dependency_urls(&db, &ingot_a_url); - assert!(deps.contains(&ingot_b_url)); -} - -#[test] -fn resolves_workspace_member_by_version_string_local() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let ingot_a = workspace_root.join("ingots/a"); - let ingot_b = workspace_root.join("ingots/b"); - - write_file( - &workspace_root.join("fe.toml"), - r#" -[workspace] -name = "local-workspace" -version = "0.1.0" -members = [ - { path = "ingots/a", name = "a", version = "0.1.0" }, - { path = "ingots/b", name = "b", version = "0.1.0" }, -] -"#, - ); - - write_file( - &ingot_a.join("fe.toml"), - r#" -[ingot] -name = "a" -version = "0.1.0" - -[dependencies] -b = "0.1.0" -"#, - ); - write_file(&ingot_a.join("src/lib.fe"), "pub fn main() {}\n"); - - write_file( - &ingot_b.join("fe.toml"), - r#" -[ingot] -name = "b" -version = "0.1.0" -"#, - ); - write_file(&ingot_b.join("src/lib.fe"), "pub fn main() {}\n"); - - let workspace_url = - Url::from_directory_path(workspace_root.as_std_path()).expect("workspace url"); - let ingot_a_url = Url::from_directory_path(ingot_a.as_std_path()).expect("ingot a url"); - let ingot_b_url = Url::from_directory_path(ingot_b.as_std_path()).expect("ingot b url"); - - let mut db = DriverDataBase::default(); - let had_diagnostics = init_workspace(&mut db, &workspace_url); - assert!(!had_diagnostics, "unexpected diagnostics"); - - let deps = db.dependency_graph().dependency_urls(&db, &ingot_a_url); - assert!(deps.contains(&ingot_b_url)); -} - -#[test] -fn resolves_workspace_dependency_by_alias_local() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let ingot_a = workspace_root.join("ingots/a"); - let ingot_b = workspace_root.join("ingots/b"); - let util = workspace_root.join("vendor/util"); - - write_file( - &workspace_root.join("fe.toml"), - r#" -[workspace] -name = "local-workspace" -version = "0.1.0" -members = [ - { path = "ingots/a", name = "a", version = "0.1.0" }, - { path = "ingots/b", name = "b", version = "0.1.0" }, -] - -[dependencies] -util = { path = "vendor/util", name = "util", version = "0.1.0" } -"#, - ); - - write_file( - &ingot_a.join("fe.toml"), - r#" -[ingot] -name = "a" -version = "0.1.0" - -[dependencies] -b = true -util = true -"#, - ); - write_file(&ingot_a.join("src/lib.fe"), "pub fn main() {}\n"); - - write_file( - &ingot_b.join("fe.toml"), - r#" -[ingot] -name = "b" -version = "0.1.0" -"#, - ); - write_file(&ingot_b.join("src/lib.fe"), "pub fn main() {}\n"); - - write_file( - &util.join("fe.toml"), - r#" -[ingot] -name = "util" -version = "0.1.0" -"#, - ); - write_file(&util.join("src/lib.fe"), "pub fn main() {}\n"); - - let workspace_url = - Url::from_directory_path(workspace_root.as_std_path()).expect("workspace url"); - let ingot_a_url = Url::from_directory_path(ingot_a.as_std_path()).expect("ingot a url"); - let ingot_b_url = Url::from_directory_path(ingot_b.as_std_path()).expect("ingot b url"); - let util_url = Url::from_directory_path(util.as_std_path()).expect("util url"); - - let mut db = DriverDataBase::default(); - let had_diagnostics = init_workspace(&mut db, &workspace_url); - assert!(!had_diagnostics, "unexpected diagnostics"); - - let deps = db.dependency_graph().dependency_urls(&db, &ingot_a_url); - assert!(deps.contains(&ingot_b_url)); - assert!(deps.contains(&util_url)); -} - -#[test] -fn rejects_workspace_with_duplicate_member_names() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let member_a = workspace_root.join("ingots/lib_v1"); - let member_b = workspace_root.join("ingots/lib_v2"); - - write_file( - &workspace_root.join("fe.toml"), - r#" -[workspace] -name = "duplicate-members" -version = "0.1.0" -members = [ - { path = "ingots/lib_v1", name = "lib" }, - { path = "ingots/lib_v2", name = "lib" }, -] -"#, - ); - - write_file( - &member_a.join("fe.toml"), - r#" -[ingot] -name = "lib" -version = "0.1.0" -"#, - ); - write_file( - &member_a.join("src/lib.fe"), - "pub fn add(a: u256, b: u256) -> u256 { a + b }\n", - ); - - write_file( - &member_b.join("fe.toml"), - r#" -[ingot] -name = "lib" -version = "0.2.0" -"#, - ); - write_file( - &member_b.join("src/lib.fe"), - "pub fn add(a: u256, b: u256) -> u256 { a + b }\n", - ); - - let workspace_url = - Url::from_directory_path(workspace_root.as_std_path()).expect("workspace url"); - let mut db = DriverDataBase::default(); - let had_diagnostics = init_workspace(&mut db, &workspace_url); - assert!(had_diagnostics, "expected duplicate member diagnostics"); -} - -#[test] -fn rejects_workspace_dependency_alias_conflicting_with_member_name() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let ingot_a = workspace_root.join("ingots/a"); - let ingot_b = workspace_root.join("ingots/b"); - let dep_b = workspace_root.join("vendor/dep_b"); - - write_file( - &workspace_root.join("fe.toml"), - r#" -[workspace] -name = "local-workspace" -version = "0.1.0" -members = [ - { path = "ingots/a", name = "a", version = "0.1.0" }, - { path = "ingots/b", name = "b", version = "0.1.0" }, -] - -[dependencies] -b = { path = "vendor/dep_b", name = "dep_b", version = "0.1.0" } -"#, - ); - - write_file( - &ingot_a.join("fe.toml"), - r#" -[ingot] -name = "a" -version = "0.1.0" -"#, - ); - write_file(&ingot_a.join("src/lib.fe"), "pub fn main() {}\n"); - - write_file( - &ingot_b.join("fe.toml"), - r#" -[ingot] -name = "b" -version = "0.1.0" -"#, - ); - write_file(&ingot_b.join("src/lib.fe"), "pub fn main() {}\n"); - - write_file( - &dep_b.join("fe.toml"), - r#" -[ingot] -name = "dep_b" -version = "0.1.0" -"#, - ); - write_file(&dep_b.join("src/lib.fe"), "pub fn main() {}\n"); - - let workspace_url = - Url::from_directory_path(workspace_root.as_std_path()).expect("workspace url"); - let mut db = DriverDataBase::default(); - let had_diagnostics = init_workspace(&mut db, &workspace_url); - assert!(had_diagnostics, "expected diagnostics"); -} - -#[test] -fn rejects_workspace_member_name_mismatch() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let ingot_a = workspace_root.join("ingots/a"); - - write_file( - &workspace_root.join("fe.toml"), - r#" -[workspace] -name = "mismatch-workspace" -version = "0.1.0" -members = [ - { path = "ingots/a", name = "a" }, -] -"#, - ); - - write_file( - &ingot_a.join("fe.toml"), - r#" -[ingot] -name = "not_a" -version = "0.1.0" -"#, - ); - - let workspace_url = - Url::from_directory_path(workspace_root.as_std_path()).expect("workspace url"); - let mut db = DriverDataBase::default(); - let had_diagnostics = init_workspace(&mut db, &workspace_url); - assert!(had_diagnostics, "expected metadata mismatch diagnostics"); -} - -#[test] -fn rejects_workspace_member_version_mismatch() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let ingot_a = workspace_root.join("ingots/a"); - - write_file( - &workspace_root.join("fe.toml"), - r#" -[workspace] -name = "mismatch-workspace" -version = "0.1.0" -members = [ - { path = "ingots/a", version = "9.9.9" }, -] -"#, - ); - - write_file( - &ingot_a.join("fe.toml"), - r#" -[ingot] -name = "a" -version = "0.1.0" -"#, - ); - - let workspace_url = - Url::from_directory_path(workspace_root.as_std_path()).expect("workspace url"); - let mut db = DriverDataBase::default(); - let had_diagnostics = init_workspace(&mut db, &workspace_url); - assert!(had_diagnostics, "expected metadata mismatch diagnostics"); -} - -#[test] -fn resolves_remote_workspace_member_by_name() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_repo = root.join("remote_ws"); - let member_path = workspace_repo.join("ingots/core"); - - fs::create_dir_all(workspace_repo.as_std_path()).unwrap(); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .arg("init") - .status() - .expect("git init") - .success() - .then_some(()) - .expect("git init success"); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .args(["config", "user.email", "fe@example.com"]) - .status() - .expect("git config email") - .success() - .then_some(()) - .expect("git config email success"); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .args(["config", "user.name", "fe"]) - .status() - .expect("git config name") - .success() - .then_some(()) - .expect("git config name success"); - - write_file( - &workspace_repo.join("fe.toml"), - r#" -name = "remote-workspace" -version = "0.1.0" -members = [ - { path = "ingots/core", name = "core", version = "0.1.0" }, -] -"#, - ); - write_file( - &member_path.join("fe.toml"), - r#" -[ingot] -name = "core" -version = "0.1.0" -"#, - ); - write_file(&member_path.join("src/lib.fe"), "pub fn main() {}\n"); - write_file(&workspace_repo.join("outside.txt"), "outside\n"); - - let rev = git_commit(&workspace_repo, "initial"); - let source_url = Url::from_directory_path(workspace_repo.as_std_path()) - .expect("repo url") - .to_string(); - - let cache_root = root.join("git-cache"); - fs::create_dir_all(cache_root.as_std_path()).unwrap(); - - let local_root = root.join("consumer"); - let local_ingot = local_root.join("ingot"); - write_file( - &local_ingot.join("fe.toml"), - &format!( - r#" -[ingot] -name = "consumer" -version = "0.1.0" - -[dependencies] -core = {{ source = "{}", rev = "{}", name = "core", version = "0.1.0" }} -"#, - source_url, rev - ), - ); - write_file(&local_ingot.join("src/lib.fe"), "pub fn main() {}\n"); - - with_remote_cache_dir(&cache_root, || { - let ingot_url = Url::from_directory_path(local_ingot.as_std_path()).expect("ingot url"); - let mut db = DriverDataBase::default(); - let had_diagnostics = init_ingot(&mut db, &ingot_url); - assert!(!had_diagnostics, "unexpected diagnostics"); - - let cache_root = remote_git_cache_dir().expect("cache dir"); - let git = GitResolver::new(cache_root); - let description = - GitDescription::new(Url::parse(&source_url).expect("source url"), rev.clone()); - let checkout_path = git.checkout_path(&description); - assert!( - checkout_path.join("outside.txt").is_file(), - "expected full checkout to include repo-root files" - ); - let member_url = Url::from_directory_path(checkout_path.join("ingots/core").as_std_path()) - .expect("member url"); - - let deps = db.dependency_graph().dependency_urls(&db, &ingot_url); - assert!(deps.contains(&member_url)); - let ingot = db - .workspace() - .containing_ingot(&db, member_url) - .expect("expected member ingot"); - let has_source_files = ingot - .files(&db) - .iter() - .any(|(_, file)| matches!(file.kind(&db), Some(IngotFileKind::Source))); - assert!( - has_source_files, - "expected member ingot to load source files" - ); - }); -} - -#[test] -fn resolves_remote_workspace_member_by_name_in_subdir() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_repo = root.join("remote_ws"); - let workspace_root = workspace_repo.join("workspace"); - let member_path = workspace_root.join("ingots/core"); - - fs::create_dir_all(workspace_root.as_std_path()).unwrap(); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .arg("init") - .status() - .expect("git init") - .success() - .then_some(()) - .expect("git init success"); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .args(["config", "user.email", "fe@example.com"]) - .status() - .expect("git config email") - .success() - .then_some(()) - .expect("git config email success"); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .args(["config", "user.name", "fe"]) - .status() - .expect("git config name") - .success() - .then_some(()) - .expect("git config name success"); - - write_file( - &workspace_root.join("fe.toml"), - r#" -name = "remote-workspace" -version = "0.1.0" -members = [ - { path = "ingots/core", name = "core", version = "0.1.0" }, -] -"#, - ); - write_file( - &member_path.join("fe.toml"), - r#" -[ingot] -name = "core" -version = "0.1.0" -"#, - ); - write_file(&member_path.join("src/lib.fe"), "pub fn main() {}\n"); - write_file(&workspace_repo.join("outside.txt"), "outside\n"); - - let rev = git_commit(&workspace_repo, "initial"); - let source_url = Url::from_directory_path(workspace_repo.as_std_path()) - .expect("repo url") - .to_string(); - - let cache_root = root.join("git-cache"); - fs::create_dir_all(cache_root.as_std_path()).unwrap(); - - let local_root = root.join("consumer"); - let local_ingot = local_root.join("ingot"); - write_file( - &local_ingot.join("fe.toml"), - &format!( - r#" -[ingot] -name = "consumer" -version = "0.1.0" - -[dependencies] -core = {{ source = "{}", rev = "{}", path = "workspace", name = "core", version = "0.1.0" }} -"#, - source_url, rev - ), - ); - write_file(&local_ingot.join("src/lib.fe"), "pub fn main() {}\n"); - - with_remote_cache_dir(&cache_root, || { - let ingot_url = Url::from_directory_path(local_ingot.as_std_path()).expect("ingot url"); - let mut db = DriverDataBase::default(); - let had_diagnostics = init_ingot(&mut db, &ingot_url); - assert!(!had_diagnostics, "unexpected diagnostics"); - - let cache_root = remote_git_cache_dir().expect("cache dir"); - let git = GitResolver::new(cache_root); - let description = - GitDescription::new(Url::parse(&source_url).expect("source url"), rev.clone()); - let checkout_path = git.checkout_path(&description); - assert!( - checkout_path.join("workspace/fe.toml").is_file(), - "expected sparse checkout to include workspace config" - ); - assert!( - !checkout_path.join("outside.txt").is_file(), - "expected sparse checkout to exclude repo-root files" - ); - let member_url = - Url::from_directory_path(checkout_path.join("workspace/ingots/core").as_std_path()) - .expect("member url"); - - let deps = db.dependency_graph().dependency_urls(&db, &ingot_url); - assert!(deps.contains(&member_url)); - let ingot = db - .workspace() - .containing_ingot(&db, member_url) - .expect("expected member ingot"); - let has_source_files = ingot - .files(&db) - .iter() - .any(|(_, file)| matches!(file.kind(&db), Some(IngotFileKind::Source))); - assert!( - has_source_files, - "expected member ingot to load source files" - ); - }); -} - -#[test] -fn resolves_remote_workspace_member_by_direct_path_with_workspace_dependencies() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_repo = root.join("remote_ws"); - let core_path = workspace_repo.join("ingots/core"); - let util_path = workspace_repo.join("ingots/util"); - - fs::create_dir_all(workspace_repo.as_std_path()).unwrap(); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .arg("init") - .status() - .expect("git init") - .success() - .then_some(()) - .expect("git init success"); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .args(["config", "user.email", "fe@example.com"]) - .status() - .expect("git config email") - .success() - .then_some(()) - .expect("git config email success"); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .args(["config", "user.name", "fe"]) - .status() - .expect("git config name") - .success() - .then_some(()) - .expect("git config name success"); - - write_file( - &workspace_repo.join("fe.toml"), - r#" -name = "remote-workspace" -version = "0.1.0" -members = [ - { path = "ingots/core", name = "core", version = "0.1.0" }, - { path = "ingots/util", name = "util", version = "0.1.0" }, -] -"#, - ); - write_file( - &core_path.join("fe.toml"), - r#" -[ingot] -name = "core" -version = "0.1.0" - -[dependencies] -util = true -"#, - ); - write_file(&core_path.join("src/lib.fe"), "pub fn main() {}\n"); - write_file( - &util_path.join("fe.toml"), - r#" -[ingot] -name = "util" -version = "0.1.0" -"#, - ); - write_file(&util_path.join("src/lib.fe"), "pub fn helper() {}\n"); - - let rev = git_commit(&workspace_repo, "initial"); - let source_url = Url::from_directory_path(workspace_repo.as_std_path()) - .expect("repo url") - .to_string(); - - let cache_root = root.join("git-cache"); - fs::create_dir_all(cache_root.as_std_path()).unwrap(); - - let local_root = root.join("consumer"); - let local_ingot = local_root.join("ingot"); - write_file( - &local_ingot.join("fe.toml"), - &format!( - r#" -[ingot] -name = "consumer" -version = "0.1.0" - -[dependencies] -core = {{ source = "{}", rev = "{}", path = "ingots/core" }} -"#, - source_url, rev - ), - ); - write_file(&local_ingot.join("src/lib.fe"), "pub fn main() {}\n"); - - with_remote_cache_dir(&cache_root, || { - let ingot_url = Url::from_directory_path(local_ingot.as_std_path()).expect("ingot url"); - let mut db = DriverDataBase::default(); - let had_diagnostics = init_ingot(&mut db, &ingot_url); - assert!(!had_diagnostics, "unexpected diagnostics"); - - let cache_root = remote_git_cache_dir().expect("cache dir"); - let git = GitResolver::new(cache_root); - let checkout_path = git.checkout_path(&GitDescription::new( - Url::parse(&source_url).expect("source url"), - rev.clone(), - )); - assert!( - checkout_path.join("fe.toml").is_file(), - "expected sparse checkout to preserve workspace config" - ); - - let core_url = Url::from_directory_path(checkout_path.join("ingots/core").as_std_path()) - .expect("core url"); - let util_url = Url::from_directory_path(checkout_path.join("ingots/util").as_std_path()) - .expect("util url"); - - let consumer_deps = db.dependency_graph().dependency_urls(&db, &ingot_url); - assert!(consumer_deps.contains(&core_url)); - - let core_deps = db.dependency_graph().dependency_urls(&db, &core_url); - assert!(core_deps.contains(&util_url)); - }); -} - -#[test] -fn resolves_remote_workspace_member_dependency_urls() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_repo = root.join("remote_ws"); - let member_path = workspace_repo.join("ingots/core"); - - fs::create_dir_all(workspace_repo.as_std_path()).unwrap(); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .arg("init") - .status() - .expect("git init") - .success() - .then_some(()) - .expect("git init success"); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .args(["config", "user.email", "fe@example.com"]) - .status() - .expect("git config email") - .success() - .then_some(()) - .expect("git config email success"); - Command::new("git") - .arg("-C") - .arg(workspace_repo.as_std_path()) - .args(["config", "user.name", "fe"]) - .status() - .expect("git config name") - .success() - .then_some(()) - .expect("git config name success"); - - write_file( - &workspace_repo.join("fe.toml"), - r#" -name = "remote-workspace" -version = "0.1.0" -members = [ - { path = "ingots/core", name = "core", version = "0.1.0" }, -] -"#, - ); - write_file( - &member_path.join("fe.toml"), - r#" -[ingot] -name = "core" -version = "0.1.0" -"#, - ); - write_file(&member_path.join("src/lib.fe"), "pub fn main() {}\n"); - - let rev = git_commit(&workspace_repo, "initial"); - let source_url = Url::from_directory_path(workspace_repo.as_std_path()) - .expect("repo url") - .to_string(); - - let cache_root = root.join("git-cache"); - fs::create_dir_all(cache_root.as_std_path()).unwrap(); - - let local_root = root.join("consumer"); - let local_ingot = local_root.join("ingot"); - write_file( - &local_ingot.join("fe.toml"), - &format!( - r#" -[ingot] -name = "consumer" -version = "0.1.0" - -[dependencies] -remote_core = {{ source = "{}", rev = "{}", name = "core", version = "0.1.0" }} -"#, - source_url, rev - ), - ); - write_file(&local_ingot.join("src/lib.fe"), "pub fn main() {}\n"); - - with_remote_cache_dir(&cache_root, || { - let ingot_url = Url::from_directory_path(local_ingot.as_std_path()).expect("ingot url"); - let mut db = DriverDataBase::default(); - let had_diagnostics = init_ingot(&mut db, &ingot_url); - assert!(!had_diagnostics, "unexpected diagnostics"); - - let cache_root = remote_git_cache_dir().expect("cache dir"); - let git = GitResolver::new(cache_root); - let description = - GitDescription::new(Url::parse(&source_url).expect("source url"), rev.clone()); - let checkout_path = git.checkout_path(&description); - let member_url = Url::from_directory_path(checkout_path.join("ingots/core").as_std_path()) - .expect("member url"); - - let ingot = db - .workspace() - .containing_ingot(&db, ingot_url.clone()) - .expect("expected consumer ingot"); - let deps = ingot.dependencies(&db); - assert!( - deps.iter() - .any(|(name, url)| name == "remote_core" && url == &member_url) - ); - }); -} - -#[test] -fn reports_workspace_dependency_without_selection() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let ingot_a = workspace_root.join("ingots/a"); - let ingot_b = workspace_root.join("ingots/b"); - - write_file( - &workspace_root.join("fe.toml"), - r#" -name = "local-workspace" -version = "0.1.0" -members = [ - { path = "ingots/a", name = "a", version = "0.1.0" }, - { path = "ingots/b", name = "b", version = "0.1.0" }, -] -"#, - ); - - write_file( - &ingot_a.join("fe.toml"), - r#" -[ingot] -name = "a" -version = "0.1.0" - -[dependencies] -workspace = { path = "../.." } -"#, - ); - write_file(&ingot_a.join("src/lib.fe"), "pub fn main() {}\n"); - - write_file( - &ingot_b.join("fe.toml"), - r#" -[ingot] -name = "b" -version = "0.1.0" -"#, - ); - write_file(&ingot_b.join("src/lib.fe"), "pub fn main() {}\n"); - - let ingot_a_url = Url::from_directory_path(ingot_a.as_std_path()).expect("ingot a url"); - let mut db = DriverDataBase::default(); - let had_diagnostics = init_ingot(&mut db, &ingot_a_url); - assert!(had_diagnostics, "expected diagnostics"); -} - -/// Regression test: when a workspace member is added after initial workspace -/// resolution, re-initializing the workspace root should register the new -/// member so that other members can resolve dependencies on it. -#[test] -fn reinit_workspace_discovers_new_member() { - let temp = TempDir::new().unwrap(); - let root = Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).unwrap(); - let workspace_root = root.join("workspace"); - let counter_test = workspace_root.join("counter_test"); - let counter = workspace_root.join("counter"); - - // Workspace declares both members, but only counter_test exists initially - write_file( - &workspace_root.join("fe.toml"), - r#" -[workspace] -name = "getting-started" -version = "0.1.0" -members = ["counter_test", "counter"] -"#, - ); - - write_file( - &counter_test.join("fe.toml"), - r#" -[ingot] -name = "counter_test" -version = "0.1.0" - -[dependencies] -counter = true -"#, - ); - write_file(&counter_test.join("src/lib.fe"), "use counter::Counter\n"); - - // counter directory does NOT exist yet - - let workspace_url = - Url::from_directory_path(workspace_root.as_std_path()).expect("workspace url"); - let counter_test_url = - Url::from_directory_path(counter_test.as_std_path()).expect("counter_test url"); - let counter_url = Url::from_directory_path(counter.as_std_path()).expect("counter url"); - - // --- Phase 1: initial workspace resolution (counter missing) --- - let mut db = DriverDataBase::default(); - let _had_diagnostics = init_workspace(&mut db, &workspace_url); - - // counter_test should be registered as workspace member - let members = db - .dependency_graph() - .workspace_member_records(&db, &workspace_url); - assert!( - members.iter().any(|m| m.url == counter_test_url), - "counter_test should be a workspace member" - ); - // counter should NOT be a workspace member (directory didn't exist) - assert!( - !members.iter().any(|m| m.url == counter_url), - "counter should not be a workspace member yet" - ); - - // counter_test's dependency graph should NOT contain counter - let deps = db - .dependency_graph() - .dependency_urls(&db, &counter_test_url); - assert!( - !deps.contains(&counter_url), - "counter_test should not depend on counter yet" - ); - - // --- Phase 2: create counter ingot on disk --- - write_file( - &counter.join("fe.toml"), - r#" -[ingot] -name = "counter" -version = "0.1.0" -"#, - ); - write_file(&counter.join("src/lib.fe"), "pub contract Counter {}\n"); - - // --- Phase 3: re-init workspace (the fix) --- - let _had_diagnostics = init_workspace(&mut db, &workspace_url); - - // counter should now be registered as workspace member - let members = db - .dependency_graph() - .workspace_member_records(&db, &workspace_url); - assert!( - members.iter().any(|m| m.url == counter_url), - "counter should now be a workspace member after re-init" - ); - - // counter_test should now have counter in its dependency graph - let deps = db - .dependency_graph() - .dependency_urls(&db, &counter_test_url); - assert!( - deps.contains(&counter_url), - "counter_test should now depend on counter after workspace re-init" - ); -} diff --git a/crates/fe-dataflow/Cargo.toml b/crates/fe-dataflow/Cargo.toml deleted file mode 100644 index 5ce292bd4b..0000000000 --- a/crates/fe-dataflow/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "fe-dataflow" -version = "26.2.0" -edition.workspace = true -license = "Apache-2.0" -repository = "https://github.com/argotorg/fe" -description = "Shared dataflow solver kernels for Fe" - -[lib] -doctest = false - -[dependencies] -cranelift-entity.workspace = true diff --git a/crates/fe-dataflow/src/cfg.rs b/crates/fe-dataflow/src/cfg.rs deleted file mode 100644 index d0243f17a9..0000000000 --- a/crates/fe-dataflow/src/cfg.rs +++ /dev/null @@ -1,354 +0,0 @@ -use std::convert::Infallible; - -use cranelift_entity::{EntityRef, SecondaryMap}; - -use crate::{JoinSemiLattice, queue::WorkQueue}; - -pub trait ForwardCfgAnalysis { - type Block: EntityRef; - type State: Clone + JoinSemiLattice; - type Error; - - fn block_count(&self) -> usize; - fn seed_blocks(&self) -> Vec; - fn bottom(&self) -> Self::State; - fn initialize( - &mut self, - _entry_states: &mut SecondaryMap, - ) -> Result<(), Self::Error> { - Ok(()) - } - - fn transfer( - &mut self, - block: Self::Block, - in_state: &Self::State, - ) -> Result; - fn successors(&self, block: Self::Block) -> &[Self::Block]; -} - -pub trait BackwardCfgAnalysis { - type Block: EntityRef; - type State: Clone + JoinSemiLattice; - - fn block_count(&self) -> usize; - fn seed_blocks(&self) -> Vec; - fn bottom(&self) -> Self::State; - fn initialize(&mut self, exit_states: &mut SecondaryMap); - fn transfer(&mut self, block: Self::Block, out_state: &Self::State) -> Self::State; - fn predecessors(&self, block: Self::Block) -> &[Self::Block]; -} - -pub fn solve_forward_cfg>( - analysis: &mut A, -) -> SecondaryMap { - match try_solve_forward_cfg(analysis) { - Ok(states) => states, - Err(err) => match err {}, - } -} - -pub fn solve_backward_cfg( - analysis: &mut A, -) -> SecondaryMap { - let mut exit_states = SecondaryMap::with_default(analysis.bottom()); - exit_states.resize(analysis.block_count()); - analysis.initialize(&mut exit_states); - - let seed_blocks = analysis.seed_blocks(); - let mut reached = SecondaryMap::with_default(false); - reached.resize(analysis.block_count()); - for block in seed_blocks.iter().copied() { - reached[block] = true; - } - let mut queue = WorkQueue::with_seed(analysis.block_count(), seed_blocks); - while let Some(block) = queue.pop() { - let in_state = analysis.transfer(block, &exit_states[block]); - for pred in analysis.predecessors(block).iter().copied() { - let changed = exit_states[pred].join_into(&in_state); - let newly_reached = !reached[pred]; - reached[pred] = true; - if newly_reached || changed { - queue.push(pred); - } - } - } - - exit_states -} - -pub fn try_solve_forward_cfg( - analysis: &mut A, -) -> Result, A::Error> { - let mut entry_states = SecondaryMap::with_default(analysis.bottom()); - entry_states.resize(analysis.block_count()); - analysis.initialize(&mut entry_states)?; - - let seed_blocks = analysis.seed_blocks(); - let mut reached = SecondaryMap::with_default(false); - reached.resize(analysis.block_count()); - for block in seed_blocks.iter().copied() { - reached[block] = true; - } - let mut queue = WorkQueue::with_seed(analysis.block_count(), seed_blocks); - while let Some(block) = queue.pop() { - let out_state = analysis.transfer(block, &entry_states[block])?; - for succ in analysis.successors(block).iter().copied() { - let changed = entry_states[succ].join_into(&out_state); - let newly_reached = !reached[succ]; - reached[succ] = true; - if newly_reached || changed { - queue.push(succ); - } - } - } - - Ok(entry_states) -} - -#[cfg(test)] -mod tests { - use std::convert::Infallible; - - use cranelift_entity::{EntityRef, entity_impl}; - - use super::{BackwardCfgAnalysis, ForwardCfgAnalysis, solve_backward_cfg, solve_forward_cfg}; - use crate::JoinSemiLattice; - - #[derive(Clone, Copy, Debug, PartialEq, Eq)] - struct Block(u32); - entity_impl!(Block); - - const SUCCESSORS: [&[Block]; 4] = [&[Block(1), Block(2)], &[Block(3)], &[Block(3)], &[]]; - const PREDECESSORS: [&[Block]; 4] = [&[], &[Block(0)], &[Block(0)], &[Block(1), Block(2)]]; - - #[derive(Clone, Copy, Debug, Eq, PartialEq)] - struct Bits(u8); - - impl JoinSemiLattice for Bits { - fn join_into(&mut self, other: &Self) -> bool { - let joined = self.0 | other.0; - let changed = joined != self.0; - self.0 = joined; - changed - } - } - - struct ForwardBitsAnalysis; - - impl ForwardCfgAnalysis for ForwardBitsAnalysis { - type Block = Block; - type State = Bits; - type Error = Infallible; - - fn block_count(&self) -> usize { - SUCCESSORS.len() - } - - fn seed_blocks(&self) -> Vec { - vec![Block::new(0)] - } - - fn bottom(&self) -> Self::State { - Bits(0) - } - - fn initialize( - &mut self, - entry_states: &mut cranelift_entity::SecondaryMap, - ) -> Result<(), Self::Error> { - entry_states[Block::new(0)] = Bits(0b0001); - Ok(()) - } - - fn transfer( - &mut self, - block: Self::Block, - in_state: &Self::State, - ) -> Result { - Ok(Bits(in_state.0 | (1 << block.index()))) - } - - fn successors(&self, block: Self::Block) -> &[Self::Block] { - SUCCESSORS[block.index()] - } - } - - struct BackwardBitsAnalysis; - - impl BackwardCfgAnalysis for BackwardBitsAnalysis { - type Block = Block; - type State = Bits; - - fn block_count(&self) -> usize { - PREDECESSORS.len() - } - - fn seed_blocks(&self) -> Vec { - vec![Block::new(3)] - } - - fn bottom(&self) -> Self::State { - Bits(0) - } - - fn initialize( - &mut self, - exit_states: &mut cranelift_entity::SecondaryMap, - ) { - exit_states[Block::new(3)] = Bits(0b1000); - } - - fn transfer(&mut self, block: Self::Block, out_state: &Self::State) -> Self::State { - Bits(out_state.0 | (1 << block.index())) - } - - fn predecessors(&self, block: Self::Block) -> &[Self::Block] { - PREDECESSORS[block.index()] - } - } - - #[test] - fn forward_cfg_solver_propagates_through_diamond() { - let states = solve_forward_cfg(&mut ForwardBitsAnalysis); - - assert_eq!( - [ - states[Block::new(0)], - states[Block::new(1)], - states[Block::new(2)], - states[Block::new(3)] - ], - [Bits(0b0001), Bits(0b0001), Bits(0b0001), Bits(0b0111)] - ); - } - - #[test] - fn backward_cfg_solver_propagates_through_diamond() { - let states = solve_backward_cfg(&mut BackwardBitsAnalysis); - - assert_eq!( - [ - states[Block::new(0)], - states[Block::new(1)], - states[Block::new(2)], - states[Block::new(3)] - ], - [Bits(0b1110), Bits(0b1000), Bits(0b1000), Bits(0b1000)] - ); - } - - struct ReachabilityAnalysis; - - impl ForwardCfgAnalysis for ReachabilityAnalysis { - type Block = Block; - type State = Bits; - type Error = Infallible; - - fn block_count(&self) -> usize { - 3 - } - - fn seed_blocks(&self) -> Vec { - vec![Block::new(0)] - } - - fn bottom(&self) -> Self::State { - Bits(0) - } - - fn initialize( - &mut self, - entry_states: &mut cranelift_entity::SecondaryMap, - ) -> Result<(), Self::Error> { - entry_states[Block::new(0)] = Bits(1); - Ok(()) - } - - fn transfer( - &mut self, - block: Self::Block, - in_state: &Self::State, - ) -> Result { - Ok(Bits(in_state.0 | (1 << block.index()))) - } - - fn successors(&self, block: Self::Block) -> &[Self::Block] { - match block.index() { - 0 => &[Block(1)], - 1 | 2 => &[], - _ => unreachable!(), - } - } - } - - #[test] - fn forward_cfg_solver_does_not_process_unreachable_blocks() { - let states = solve_forward_cfg(&mut ReachabilityAnalysis); - - assert_eq!( - [ - states[Block::new(0)], - states[Block::new(1)], - states[Block::new(2)] - ], - [Bits(1), Bits(1), Bits(0)] - ); - } - - struct ReachBottomThenGenerateAnalysis; - - impl ForwardCfgAnalysis for ReachBottomThenGenerateAnalysis { - type Block = Block; - type State = Bits; - type Error = Infallible; - - fn block_count(&self) -> usize { - 3 - } - - fn seed_blocks(&self) -> Vec { - vec![Block::new(0)] - } - - fn bottom(&self) -> Self::State { - Bits(0) - } - - fn transfer( - &mut self, - block: Self::Block, - in_state: &Self::State, - ) -> Result { - Ok(match block.index() { - 0 => *in_state, - 1 => Bits(0b10), - 2 => Bits(in_state.0 | 0b100), - _ => unreachable!(), - }) - } - - fn successors(&self, block: Self::Block) -> &[Self::Block] { - match block.index() { - 0 => &[Block(1)], - 1 => &[Block(2)], - 2 => &[], - _ => unreachable!(), - } - } - } - - #[test] - fn forward_cfg_solver_processes_newly_reached_bottom_state_blocks() { - let states = solve_forward_cfg(&mut ReachBottomThenGenerateAnalysis); - - assert_eq!( - [ - states[Block::new(0)], - states[Block::new(1)], - states[Block::new(2)] - ], - [Bits(0), Bits(0), Bits(0b10)] - ); - } -} diff --git a/crates/fe-dataflow/src/lattice.rs b/crates/fe-dataflow/src/lattice.rs deleted file mode 100644 index 81780d0a06..0000000000 --- a/crates/fe-dataflow/src/lattice.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub trait JoinSemiLattice { - fn join_into(&mut self, other: &Self) -> bool; -} diff --git a/crates/fe-dataflow/src/lib.rs b/crates/fe-dataflow/src/lib.rs deleted file mode 100644 index ed64a7d828..0000000000 --- a/crates/fe-dataflow/src/lib.rs +++ /dev/null @@ -1,11 +0,0 @@ -mod cfg; -mod lattice; -mod queue; -mod sparse; - -pub use cfg::{ - BackwardCfgAnalysis, ForwardCfgAnalysis, solve_backward_cfg, solve_forward_cfg, - try_solve_forward_cfg, -}; -pub use lattice::JoinSemiLattice; -pub use sparse::{SparseAnalysis, solve_sparse, try_solve_sparse}; diff --git a/crates/fe-dataflow/src/queue.rs b/crates/fe-dataflow/src/queue.rs deleted file mode 100644 index 6b26ad22a7..0000000000 --- a/crates/fe-dataflow/src/queue.rs +++ /dev/null @@ -1,61 +0,0 @@ -use std::collections::VecDeque; - -use cranelift_entity::{EntityRef, SecondaryMap}; - -pub(crate) struct WorkQueue { - queued: SecondaryMap, - pending: VecDeque, -} - -impl WorkQueue { - pub(crate) fn with_seed(count: usize, seed: impl IntoIterator) -> Self { - let mut queued = SecondaryMap::new(); - queued.resize(count); - let mut queue = Self { - queued, - pending: VecDeque::new(), - }; - for node in seed { - queue.push(node); - } - queue - } - - pub(crate) fn push(&mut self, node: N) { - if !self.queued[node] { - self.queued[node] = true; - self.pending.push_back(node); - } - } - - pub(crate) fn pop(&mut self) -> Option { - let node = self.pending.pop_front()?; - self.queued[node] = false; - Some(node) - } -} - -#[cfg(test)] -mod tests { - use cranelift_entity::{EntityRef, entity_impl}; - - use super::WorkQueue; - - #[derive(Clone, Copy, Debug, PartialEq, Eq)] - struct Node(u32); - entity_impl!(Node); - - #[test] - fn deduplicates_nodes() { - let mut queue = WorkQueue::with_seed(3, [Node::new(0), Node::new(1), Node::new(2)]); - - assert_eq!(queue.pop(), Some(Node::new(0))); - queue.push(Node::new(1)); - queue.push(Node::new(1)); - queue.push(Node::new(1)); - - assert_eq!(queue.pop(), Some(Node::new(1))); - assert_eq!(queue.pop(), Some(Node::new(2))); - assert_eq!(queue.pop(), None); - } -} diff --git a/crates/fe-dataflow/src/sparse.rs b/crates/fe-dataflow/src/sparse.rs deleted file mode 100644 index 84149b50c9..0000000000 --- a/crates/fe-dataflow/src/sparse.rs +++ /dev/null @@ -1,166 +0,0 @@ -use std::convert::Infallible; - -use cranelift_entity::EntityRef; - -use crate::queue::WorkQueue; - -pub trait SparseAnalysis { - type Node: EntityRef; - type State; - type Error; - - fn node_count(&self) -> usize; - fn seed_nodes(&self) -> Vec; - fn step(&mut self, node: Self::Node, state: &mut Self::State) -> Result; - fn dependents(&self, node: Self::Node, out: &mut Vec); -} - -pub fn try_solve_sparse( - analysis: &mut A, - state: &mut A::State, -) -> Result<(), A::Error> { - let mut queue = WorkQueue::with_seed(analysis.node_count(), analysis.seed_nodes()); - let mut dependents = Vec::new(); - while let Some(node) = queue.pop() { - if analysis.step(node, state)? { - dependents.clear(); - analysis.dependents(node, &mut dependents); - for dependent in dependents.drain(..) { - queue.push(dependent); - } - } - } - Ok(()) -} - -pub fn solve_sparse>(analysis: &mut A, state: &mut A::State) { - match try_solve_sparse(analysis, state) { - Ok(()) => {} - Err(err) => match err {}, - } -} - -#[cfg(test)] -mod tests { - use std::convert::Infallible; - - use cranelift_entity::{EntityRef, entity_impl}; - - use super::{SparseAnalysis, solve_sparse, try_solve_sparse}; - - #[derive(Clone, Copy, Debug, PartialEq, Eq)] - struct Node(u32); - entity_impl!(Node); - - struct ChainAnalysis { - runs: Vec, - } - - impl SparseAnalysis for ChainAnalysis { - type Node = Node; - type State = Vec; - type Error = Infallible; - - fn node_count(&self) -> usize { - 3 - } - - fn seed_nodes(&self) -> Vec { - vec![Node::new(0)] - } - - fn step(&mut self, node: Self::Node, state: &mut Self::State) -> Result { - self.runs[node.index()] += 1; - let changed = !state[node.index()]; - state[node.index()] = true; - Ok(changed) - } - - fn dependents(&self, node: Self::Node, out: &mut Vec) { - if node.index() + 1 < self.node_count() { - out.push(Node::new(node.index() + 1)); - } - } - } - - #[test] - fn sparse_solver_propagates_to_dependents() { - let mut analysis = ChainAnalysis { runs: vec![0; 3] }; - let mut state = vec![false; 3]; - - solve_sparse(&mut analysis, &mut state); - - assert_eq!(state, vec![true, true, true]); - assert_eq!(analysis.runs, vec![1, 1, 1]); - } - - struct StableAnalysis { - runs: Vec, - } - - impl SparseAnalysis for StableAnalysis { - type Node = Node; - type State = (); - type Error = Infallible; - - fn node_count(&self) -> usize { - 2 - } - - fn seed_nodes(&self) -> Vec { - vec![Node::new(0)] - } - - fn step(&mut self, node: Self::Node, _: &mut Self::State) -> Result { - self.runs[node.index()] += 1; - Ok(false) - } - - fn dependents(&self, _node: Self::Node, out: &mut Vec) { - out.push(Node::new(1)); - } - } - - #[test] - fn sparse_solver_does_not_reenqueue_when_unchanged() { - let mut analysis = StableAnalysis { runs: vec![0; 2] }; - let mut state = (); - - solve_sparse(&mut analysis, &mut state); - - assert_eq!(analysis.runs, vec![1, 0]); - } - - #[derive(Debug, PartialEq, Eq)] - struct TestError; - - struct FallibleAnalysis; - - impl SparseAnalysis for FallibleAnalysis { - type Node = Node; - type State = (); - type Error = TestError; - - fn node_count(&self) -> usize { - 1 - } - - fn seed_nodes(&self) -> Vec { - vec![Node::new(0)] - } - - fn step(&mut self, _node: Self::Node, _: &mut Self::State) -> Result { - Err(TestError) - } - - fn dependents(&self, _node: Self::Node, _out: &mut Vec) {} - } - - #[test] - fn sparse_solver_propagates_errors() { - let mut analysis = FallibleAnalysis; - let mut state = (); - - assert_eq!(try_solve_sparse(&mut analysis, &mut state), Err(TestError)); - } -} diff --git a/crates/fe-web/Cargo.toml b/crates/fe-web/Cargo.toml deleted file mode 100644 index 296a10a246..0000000000 --- a/crates/fe-web/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "fe-web" -version = "26.2.0" -edition.workspace = true -license = "Apache-2.0" -repository = "https://github.com/ethereum/fe" -description = "Fe documentation model types and web components" - -[lib] -crate-type = ["cdylib", "rlib"] - -[package.metadata.wasm-pack.profile.release] -wasm-opt = ["-Os"] - -[features] -default = [] -wasm = ["dep:wasm-bindgen", "dep:js-sys", "dep:scip", "dep:protobuf"] - -[dependencies] -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -pulldown-cmark = { version = "0.12", default-features = false, features = ["html"] } - -# WASM support (optional) -wasm-bindgen = { version = "0.2", optional = true } -js-sys = { version = "0.3", optional = true } -scip = { version = "0.6.1", optional = true } -protobuf = { version = "=3.7.2", optional = true } - -[dev-dependencies] -wasm-bindgen-test.workspace = true -insta = { version = "1.42", features = ["json"] } -schemars = "0.8" diff --git a/crates/fe-web/assets/fe-code-block.js b/crates/fe-web/assets/fe-code-block.js deleted file mode 100644 index f9603edcd4..0000000000 --- a/crates/fe-web/assets/fe-code-block.js +++ /dev/null @@ -1,781 +0,0 @@ -// — Custom element for syntax-highlighted Fe code blocks. -// -// Raw source text lives in the light DOM and is never destroyed. The -// rendered (highlighted + SCIP-annotated) version lives in an open -// shadow root, so `element.textContent` always returns the original code. -// -// Call `element.refresh()` to re-render with fresh ScipStore data. -// -// Attributes: -// lang — language name (default "fe") -// line-numbers — show line number gutter -// collapsed — start collapsed with
/ -// symbol — doc path (e.g. "mylib::Game/struct") to fetch source from FE_DOC_INDEX -// region — extract a named region (// #region name ... // #endregion name) from source -// data-file — SCIP source file path for positional symbol resolution -// data-line-offset — 0-based line offset for source excerpts (maps local line 0 to file line N) -// data-scope — SCIP scope path for signature code blocks (set by server) - -// Shared CSSStyleSheet adopted by all shadow roots. -// -// In bundled mode (fe-web.js), the CSS is available as _FE_HIGHLIGHT_CSS -// (injected at build time). In standalone mode (external ), we -// extract rules from the loaded stylesheet. Either way, the sheet is -// constructed once and shared. -var _codeBlockSheet = null; - -// Injected at bundle build time. When loaded standalone (not via the -// bundle), this is undefined and we fall back to reading page styles. -var _FE_HIGHLIGHT_CSS = (typeof __FE_HIGHLIGHT_CSS_INJECTED__ !== "undefined") - ? __FE_HIGHLIGHT_CSS_INJECTED__ : null; - -function _getCodeBlockSheet() { - if (_codeBlockSheet) return _codeBlockSheet; - - var css = _FE_HIGHLIGHT_CSS; - - // Not bundled — try to read from page - - - - {scip_section}{source_section} - - - - - - - - - - - - -"#, - title = safe_title, - css = STYLES_CSS, - highlight_css = FE_HIGHLIGHT_CSS, - json = safe_json, - scip_section = scip_section, - source_section = source_section, - tree_sitter_js = TREE_SITTER_JS, - highlighter_js = highlighter_js, - code_block_js = FE_CODE_BLOCK_JS, - signature_js = FE_SIGNATURE_JS, - doc_item_js = FE_DOC_ITEM_JS, - symbol_link_js = FE_SYMBOL_LINK_JS, - search_js = FE_SEARCH_JS, - doc_nav_js = FE_DOC_NAV_JS, - doc_viewer_js = FE_DOC_VIEWER_JS, - ) -} - -/// Build a standalone fe-web.js bundle for external consumption. -/// -/// This is the single JS file that consumers load via: -/// ` - -// ============================================================================ -// Script-tag loader: reads data-src and data-docs, fetches JSON, populates globals -// ============================================================================ -(function() {{ - "use strict"; - var script = document.currentScript || document.querySelector('script[data-src]'); - if (!script) return; - - var dataSrc = script.getAttribute('data-src'); - var dataDocs = script.getAttribute('data-docs'); - - if (dataDocs) {{ - window.FE_DOCS_BASE = dataDocs; - }} - - // Signal that the bundle is loading - window.FE_WEB_READY = new Promise(function(resolve) {{ - window._feWebResolve = resolve; - }}); - - if (dataSrc) {{ - (typeof feFetchJson === 'function' ? feFetchJson(dataSrc) : - fetch(dataSrc).then(function(r) {{ - if (!r.ok) throw new Error("HTTP " + r.status + " loading " + dataSrc); - return r.json(); - }})) - .then(function(data) {{ - data = feMigrate(data); - if (data && data.index) {{ - window.FE_DOC_INDEX = data.index; - if (data.scip) {{ - window.FE_SCIP_DATA = data.scip; - if (typeof ScipStore !== 'undefined') {{ - try {{ window.FE_SCIP = new ScipStore(data.scip); }} catch(e) {{ - console.error('[fe-web] ScipStore init failed:', e); - }} - }} - }} - }} else if (data) {{ - // Fallback — should not happen after migration - window.FE_DOC_INDEX = data; - }} - window._feWebResolve(); - document.dispatchEvent(new CustomEvent('fe-web-ready')); - }}) - .catch(function(err) {{ - console.error('[fe-web] Failed to load', dataSrc, err); - window._feWebResolve(); - }}); - }} else {{ - // No data-src — globals may already be set (e.g. static site) - window._feWebResolve(); - }} -}})(); - -// ============================================================================ -// ScipStore -// ============================================================================ -{scip_store_js} - -// ============================================================================ -// Tree-sitter runtime -// ============================================================================ -{tree_sitter_js} - -// ============================================================================ -// Highlighter (with embedded WASM) -// ============================================================================ -{highlighter_js} - -// ============================================================================ -// Highlight CSS (injected for shadow DOM adoption — no DOM scanning needed) -// ============================================================================ -var __FE_HIGHLIGHT_CSS_INJECTED__ = {highlight_css_js}; - -// ============================================================================ -// Custom elements -// ============================================================================ -{code_block_js} - -{signature_js} - -{doc_item_js} - -{symbol_link_js} - -{search_js} - -{doc_nav_js} - -{doc_viewer_js} -"#, - scip_store_js = scip_store_js(), - tree_sitter_js = TREE_SITTER_JS, - highlighter_js = highlighter_js, - highlight_css_js = highlight_css_literal, - code_block_js = FE_CODE_BLOCK_JS, - signature_js = FE_SIGNATURE_JS, - doc_item_js = FE_DOC_ITEM_JS, - symbol_link_js = FE_SYMBOL_LINK_JS, - search_js = FE_SEARCH_JS, - doc_nav_js = FE_DOC_NAV_JS, - doc_viewer_js = FE_DOC_VIEWER_JS, - ) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn styles_css_is_nonempty() { - assert!(!STYLES_CSS.is_empty()); - assert!(STYLES_CSS.contains(":root")); - } - - #[test] - fn fe_web_js_is_nonempty() { - assert!(!FE_WEB_JS.is_empty()); - assert!(FE_WEB_JS.contains("render")); - } - - #[test] - fn custom_element_js_nonempty() { - assert!(FE_CODE_BLOCK_JS.contains("fe-code-block")); - assert!(FE_SIGNATURE_JS.contains("fe-signature")); - assert!(FE_SEARCH_JS.contains("fe-search")); - assert!(FE_DOC_ITEM_JS.contains("fe-doc-item")); - assert!(FE_SYMBOL_LINK_JS.contains("fe-symbol-link")); - } - - #[test] - fn highlighter_js_has_embedded_data() { - let js = build_highlighter_js(); - // Should not contain unresolved placeholders - assert!( - !js.contains("%%TS_WASM_B64%%"), - "TS_WASM placeholder should be replaced" - ); - assert!( - !js.contains("%%FE_WASM_B64%%"), - "FE_WASM placeholder should be replaced" - ); - assert!( - !js.contains("%%HIGHLIGHTS_SCM%%"), - "HIGHLIGHTS_SCM placeholder should be replaced" - ); - // Should contain base64-encoded data (long strings starting with typical WASM b64) - assert!( - js.len() > 100_000, - "should be large with embedded WASMs: {} bytes", - js.len() - ); - } - - #[test] - fn html_shell_produces_valid_output() { - let json = r#"{"items":[],"modules":[]}"#; - let html = html_shell("Test Docs", json); - - assert!(html.contains("")); - assert!(html.contains("Test Docs")); - assert!(html.contains(":root")); - assert!(html.contains(r#"window.FE_DOC_INDEX = {"items":[],"modules":[]}"#)); - // Uses component instead of manual div layout - assert!(html.contains("fe-doc-viewer")); - // Custom elements are loaded - assert!(html.contains("fe-code-block")); - assert!(html.contains("fe-signature")); - assert!(html.contains("fe-doc-item")); - assert!(html.contains("fe-symbol-link")); - assert!(html.contains("fe-search")); - assert!(html.contains("fe-doc-nav")); - // Tree-sitter and highlighter are loaded - assert!( - html.contains("TreeSitter"), - "should contain tree-sitter runtime" - ); - assert!(html.contains("FeHighlighter"), "should contain highlighter"); - } - - #[test] - fn html_shell_escapes_script_injection_in_json() { - let malicious_json = r#"{"x":""}"#; - let html = html_shell("Docs", malicious_json); - // The raw must not appear — it would break out of the script tag - assert!(!html.contains("", "{}"); - assert!(!html.contains("<script>")); - assert!(html.contains("<title><script>")); - } - - #[test] - fn escape_helpers() { - assert_eq!(escape_html_text("a<b>c&d"), "a<b>c&d"); - assert_eq!(escape_script_content("</script>"), r"<\/script>"); - // No escaping needed for safe content - assert_eq!(escape_script_content("hello world"), "hello world"); - } - - #[test] - fn html_shell_with_scip_embeds_data() { - let json = r#"{"items":[],"modules":[]}"#; - let scip_json = r#"{"symbols":{},"files":{}}"#; - let html = html_shell_with_scip("Test", json, Some(scip_json)); - - // Contains the ScipStore class - assert!(html.contains("ScipStore"), "should have ScipStore class"); - // Contains the SCIP data assignment - assert!( - html.contains("FE_SCIP_DATA"), - "should have SCIP data inline" - ); - // Contains the FE_SCIP initialization - assert!(html.contains("window.FE_SCIP"), "should initialize FE_SCIP"); - // Still contains the base DocIndex - assert!(html.contains("FE_DOC_INDEX"), "should still have DocIndex"); - } - - #[test] - fn html_shell_with_scip_none_matches_original() { - let json = r#"{"items":[],"modules":[]}"#; - let without = html_shell("Test", json); - let with_none = html_shell_with_scip("Test", json, None); - assert_eq!(without, with_none); - } - - #[test] - fn js_escape_handles_special_chars() { - assert_eq!(js_escape_string("hello\nworld"), "hello\\nworld"); - assert_eq!(js_escape_string(r#"a"b"#), r#"a\"b"#); - assert_eq!(js_escape_string("a\\b"), "a\\\\b"); - } -} diff --git a/crates/fe-web/src/escape.rs b/crates/fe-web/src/escape.rs deleted file mode 100644 index dc767c04d6..0000000000 --- a/crates/fe-web/src/escape.rs +++ /dev/null @@ -1,104 +0,0 @@ -//! HTML and script-context escaping utilities. - -/// Escape for embedding in HTML attribute values and general code content. -/// -/// Escapes: `& < > " '` -pub fn escape_html(s: &str) -> String { - s.replace('&', "&") - .replace('<', "<") - .replace('>', ">") - .replace('"', """) - .replace('\'', "'") -} - -/// Escape for embedding in HTML element content (e.g., `<title>`). -/// -/// Only escapes `& < >` — quotes are safe in element text. -pub fn escape_html_text(s: &str) -> String { - s.replace('&', "&") - .replace('<', "<") - .replace('>', ">") -} - -/// Escape content for safe embedding inside a `<script>` tag. -/// -/// The only dangerous sequence is `</` which can close the script element. -/// We replace `</` with `<\/` which is valid in JS string literals and JSON. -pub fn escape_script_content(s: &str) -> String { - s.replace("</", r"<\/") -} - -/// Encode bytes as standard base64 (no external dependency). -pub fn base64_encode(data: &[u8]) -> String { - const CHARS: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - let mut out = String::with_capacity(data.len().div_ceil(3) * 4); - let mut i = 0; - while i + 2 < data.len() { - let n = ((data[i] as u32) << 16) | ((data[i + 1] as u32) << 8) | (data[i + 2] as u32); - out.push(CHARS[(n >> 18 & 0x3f) as usize] as char); - out.push(CHARS[(n >> 12 & 0x3f) as usize] as char); - out.push(CHARS[(n >> 6 & 0x3f) as usize] as char); - out.push(CHARS[(n & 0x3f) as usize] as char); - i += 3; - } - match data.len() - i { - 1 => { - let n = (data[i] as u32) << 16; - out.push(CHARS[(n >> 18 & 0x3f) as usize] as char); - out.push(CHARS[(n >> 12 & 0x3f) as usize] as char); - out.push('='); - out.push('='); - } - 2 => { - let n = ((data[i] as u32) << 16) | ((data[i + 1] as u32) << 8); - out.push(CHARS[(n >> 18 & 0x3f) as usize] as char); - out.push(CHARS[(n >> 12 & 0x3f) as usize] as char); - out.push(CHARS[(n >> 6 & 0x3f) as usize] as char); - out.push('='); - } - _ => {} - } - out -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn escape_html_all_chars() { - assert_eq!( - escape_html("a<b>c&d\"e'f"), - "a<b>c&d"e'f" - ); - } - - #[test] - fn escape_html_text_no_quotes() { - assert_eq!(escape_html_text("a<b>c&d\"e'f"), "a<b>c&d\"e'f"); - } - - #[test] - fn escape_script_content_closes_tag() { - assert_eq!(escape_script_content("</script>"), r"<\/script>"); - assert_eq!(escape_script_content("hello world"), "hello world"); - } - - #[test] - fn base64_encode_standard_vectors() { - // RFC 4648 test vectors - assert_eq!(base64_encode(b""), ""); - assert_eq!(base64_encode(b"f"), "Zg=="); - assert_eq!(base64_encode(b"fo"), "Zm8="); - assert_eq!(base64_encode(b"foo"), "Zm9v"); - assert_eq!(base64_encode(b"foob"), "Zm9vYg=="); - assert_eq!(base64_encode(b"fooba"), "Zm9vYmE="); - assert_eq!(base64_encode(b"foobar"), "Zm9vYmFy"); - } - - #[test] - fn base64_encode_binary() { - assert_eq!(base64_encode(&[0, 1, 2, 255]), "AAEC/w=="); - } -} diff --git a/crates/fe-web/src/lib.rs b/crates/fe-web/src/lib.rs deleted file mode 100644 index 8d77cc9882..0000000000 --- a/crates/fe-web/src/lib.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! Fe Web — documentation model types and web components -//! -//! This crate provides: -//! - `model`: Documentation data model (DocIndex, DocItem, etc.) -//! - `markdown`: Markdown-to-HTML rendering -//! - `assets`: Embedded CSS/JS for static doc sites -//! - `static_site`: Static site generator (`fe doc --static`) -//! - `wasm` (feature-gated): WASM query module for browser-side doc lookup - -pub mod assets; -pub mod escape; -pub mod markdown; -pub mod model; -pub mod starlight; -pub mod static_site; - -#[cfg(feature = "wasm")] -pub mod wasm; diff --git a/crates/fe-web/src/markdown.rs b/crates/fe-web/src/markdown.rs deleted file mode 100644 index a0e0b63f3e..0000000000 --- a/crates/fe-web/src/markdown.rs +++ /dev/null @@ -1,194 +0,0 @@ -//! Markdown to HTML rendering with syntax highlighting - -use pulldown_cmark::{Event, Options, Parser, Tag, TagEnd, html}; - -/// Render markdown to HTML with Fe syntax highlighting for code blocks -pub fn render_markdown(markdown: &str) -> String { - let mut options = Options::empty(); - options.insert(Options::ENABLE_STRIKETHROUGH); - options.insert(Options::ENABLE_TABLES); - - // Convert single newlines to hard breaks (two trailing spaces) - // This preserves line breaks in doc comments as users expect - let processed = preserve_line_breaks(markdown); - - let parser = Parser::new_ext(&processed, options); - - // Process events, handling code blocks specially - let parser = CodeBlockHighlighter::new(parser); - - let mut html_output = String::new(); - html::push_html(&mut html_output, parser); - - html_output -} - -/// Iterator adapter that highlights code blocks -struct CodeBlockHighlighter<I> { - inner: I, - in_code_block: bool, - code_lang: Option<String>, - code_buffer: String, -} - -impl<'a, I> CodeBlockHighlighter<I> -where - I: Iterator<Item = Event<'a>>, -{ - fn new(inner: I) -> Self { - Self { - inner, - in_code_block: false, - code_lang: None, - code_buffer: String::new(), - } - } - - fn highlight_code(&self, code: &str, lang: Option<&str>) -> String { - // Fe code blocks are emitted as raw <fe-code-block> — client-side - // FeHighlighter handles syntax highlighting and type linking. - if let Some(l) = lang - && (l == "fe" || l.starts_with("fe,") || l.starts_with("fe ")) - { - return format!( - "<fe-code-block lang=\"fe\">{}</fe-code-block>", - html_escape(code) - ); - } - - // Fallback for other languages: html-escaped <pre><code> - let lang_class = lang - .map(|l| format!(" class=\"language-{}\"", html_escape(l))) - .unwrap_or_default(); - - format!( - "<pre><code{}>{}</code></pre>", - lang_class, - html_escape(code) - ) - } -} - -impl<'a, I> Iterator for CodeBlockHighlighter<I> -where - I: Iterator<Item = Event<'a>>, -{ - type Item = Event<'a>; - - fn next(&mut self) -> Option<Self::Item> { - loop { - let event = self.inner.next()?; - - match &event { - Event::Start(Tag::CodeBlock(kind)) => { - self.in_code_block = true; - self.code_buffer.clear(); - self.code_lang = match kind { - pulldown_cmark::CodeBlockKind::Fenced(lang) => { - let lang_str = lang.as_ref(); - if lang_str.is_empty() { - None - } else { - Some(lang_str.to_string()) - } - } - pulldown_cmark::CodeBlockKind::Indented => None, - }; - continue; - } - Event::End(TagEnd::CodeBlock) => { - self.in_code_block = false; - let highlighted = - self.highlight_code(&self.code_buffer, self.code_lang.as_deref()); - return Some(Event::Html(highlighted.into())); - } - Event::Text(text) if self.in_code_block => { - self.code_buffer.push_str(text); - continue; - } - _ => return Some(event), - } - } - } -} - -/// Convert single newlines to markdown hard breaks (two trailing spaces + newline) -/// This preserves line breaks in doc comments while still allowing paragraph breaks (double newlines) -fn preserve_line_breaks(text: &str) -> String { - let mut result = String::with_capacity(text.len() * 2); - let mut in_code_block = false; - let mut prev_was_newline = false; - - for line in text.lines() { - // Track code block state - if line.trim().starts_with("```") { - in_code_block = !in_code_block; - } - - if !result.is_empty() { - if prev_was_newline { - // Double newline - keep as paragraph break - result.push('\n'); - } else if !in_code_block && !line.is_empty() { - // Single newline outside code block - add hard break - result.push_str(" \n"); - } else { - result.push('\n'); - } - } - - prev_was_newline = line.is_empty(); - result.push_str(line); - } - - result -} - -/// Escape HTML special characters -fn html_escape(s: &str) -> String { - crate::escape::escape_html(s) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_basic_markdown() { - let md = "# Hello\n\nThis is a **test**."; - let html = render_markdown(md); - assert!(html.contains("<h1>Hello</h1>")); - assert!(html.contains("<strong>test</strong>")); - } - - #[test] - fn test_code_block() { - let md = "```fe\nfn main() {}\n```"; - let html = render_markdown(md); - assert!( - html.contains("fe-code-block"), - "should wrap in <fe-code-block>: {html}" - ); - // Raw text content (client-side highlighting handles syntax colors) - assert!( - html.contains("fn main()"), - "should contain raw code text: {html}" - ); - } - - #[test] - fn test_multiline_preserves_breaks() { - let md = "Line 1\nLine 2\nLine 3"; - let html = render_markdown(md); - // Each line should have a <br> tag (from hard break) - assert!(html.contains("<br")); - } - - #[test] - fn test_paragraph_breaks_preserved() { - let md = "Paragraph 1\n\nParagraph 2"; - let html = render_markdown(md); - // Should have two <p> tags - assert!(html.matches("<p>").count() == 2); - } -} diff --git a/crates/fe-web/src/model.rs b/crates/fe-web/src/model.rs deleted file mode 100644 index a549b06ce8..0000000000 --- a/crates/fe-web/src/model.rs +++ /dev/null @@ -1,1243 +0,0 @@ -//! Documentation data model -//! -//! These types represent extracted documentation in a format suitable for rendering. -//! They are designed to be serializable for static site generation and cacheable -//! for dynamic serving. - -use serde::{Deserialize, Serialize}; - -/// Current schema version for the docs.json envelope. -/// -/// SERIALIZATION CONTRACT: Bump this number whenever you change the -/// serialization shape of DocIndex, DocItem, DocChild, DocModuleTree, or -/// any type reachable from them. When you bump it, you MUST also: -/// 1. Update the snapshot test in this module (cargo test, accept new snap). -/// 2. Add a migration case in fe-scip-store.js feMigrate(). -pub const SCHEMA_VERSION: u32 = 4; - -// ============================================================================ -// Rich Signature Types (for rendering signatures with embedded links) -// ============================================================================ - -/// A part of a signature - either plain text or a linkable reference -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct SignaturePart { - /// The display text - pub text: String, - /// If Some, render as a link to this doc path (e.g., "hoverable::Numbers/struct") - #[serde(default, skip_serializing_if = "Option::is_none")] - pub link: Option<String>, -} - -impl SignaturePart { - /// Create a plain text part - pub fn text(s: impl Into<String>) -> Self { - Self { - text: s.into(), - link: None, - } - } - - /// Create a linked part - pub fn link(text: impl Into<String>, path: impl Into<String>) -> Self { - Self { - text: text.into(), - link: Some(path.into()), - } - } -} - -/// A rich signature with embedded links -pub type RichSignature = Vec<SignaturePart>; - -/// Helper to create a RichSignature from a plain string (no links) -pub fn plain_signature(s: impl Into<String>) -> RichSignature { - vec![SignaturePart::text(s)] -} - -/// Source location of a signature in its file, used to overlay SCIP occurrences. -/// -/// Byte offsets are exact: `file_text[byte_start..byte_end] == signature_text`. -/// Skipped during serialization — only used in-memory during doc generation. -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct SignatureSpanData { - /// Absolute file URL (file:// scheme), used to compute relative path for - /// matching against SCIP document `relative_path` fields. - pub file_url: String, - /// Start byte offset in the file text. - pub byte_start: usize, - /// End byte offset in the file text. - pub byte_end: usize, -} - -// ============================================================================ -// Core Documentation Types -// ============================================================================ - -/// A documented item in the Fe codebase -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocItem { - /// Unique path identifier (e.g., "std::option::Option") - pub path: String, - /// Short name of the item - pub name: String, - /// What kind of item this is - pub kind: DocItemKind, - /// The item's visibility - pub visibility: DocVisibility, - /// Parsed documentation content - pub docs: Option<DocContent>, - /// The item's signature/definition (plain text for backward compat) - pub signature: String, - /// Rich signature with embedded links (for rendering) - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub rich_signature: RichSignature, - /// Source span of the signature (for SCIP occurrence overlay, not serialized) - #[serde(skip)] - pub signature_span: Option<SignatureSpanData>, - /// SCIP scope path for this signature (set during enrich_signatures) - #[serde(default, skip_serializing_if = "Option::is_none")] - pub sig_scope: Option<String>, - /// Generic parameters, if any - pub generics: Vec<DocGenericParam>, - /// Where clause bounds, if any - pub where_bounds: Vec<String>, - /// Child items (methods, fields, variants, etc.) - pub children: Vec<DocChild>, - /// Source location for "view source" links - pub source: Option<DocSourceLoc>, - /// Full source text of the item definition (for inline "view source") - #[serde(default, skip_serializing_if = "Option::is_none")] - pub source_text: Option<String>, - /// Trait implementations for this type (structs, enums, contracts) - #[serde(default)] - pub trait_impls: Vec<DocTraitImpl>, - /// Types that implement this trait (for trait pages) - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub implementors: Vec<DocImplementor>, -} - -/// A type that implements a trait -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocImplementor { - /// The implementing type name - pub type_name: String, - /// Path to the type's documentation - pub type_url: String, - /// The trait name (for linking to the impl block) - pub trait_name: String, - /// The full impl signature (plain text) - pub signature: String, - /// Rich signature with embedded links - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub rich_signature: RichSignature, - /// Source span for the full impl signature (for SCIP positional linking). - /// In-memory only; not serialized to JSON. - #[serde(skip)] - pub signature_span: Option<SignatureSpanData>, - /// SCIP scope path for this implementor signature - #[serde(default, skip_serializing_if = "Option::is_none")] - pub sig_scope: Option<String>, -} - -impl DocItem { - /// Get the URL path for this item (includes kind suffix) - pub fn url_path(&self) -> String { - format!("{}/{}", self.path, self.kind.as_str()) - } -} - -/// The kind of documented item -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -#[serde(rename_all = "snake_case")] -pub enum DocItemKind { - Module, - Function, - Struct, - Enum, - Trait, - Contract, - TypeAlias, - Const, - Impl, - ImplTrait, - /// A `msg` block (desugared to module internally). - Msg, - /// A variant of a `msg` block (desugared to struct internally). - MsgVariant, -} - -impl DocItemKind { - pub fn as_str(&self) -> &'static str { - match self { - DocItemKind::Module => "mod", - DocItemKind::Function => "fn", - DocItemKind::Struct => "struct", - DocItemKind::Enum => "enum", - DocItemKind::Trait => "trait", - DocItemKind::Contract => "contract", - DocItemKind::TypeAlias => "type", - DocItemKind::Const => "const", - DocItemKind::Impl => "impl", - DocItemKind::ImplTrait => "impl", - DocItemKind::Msg => "msg", - DocItemKind::MsgVariant => "msg_variant", - } - } - - /// Parse kind from URL suffix string - pub fn parse(s: &str) -> Option<Self> { - match s { - "mod" | "module" => Some(DocItemKind::Module), - "fn" | "function" => Some(DocItemKind::Function), - "struct" => Some(DocItemKind::Struct), - "enum" => Some(DocItemKind::Enum), - "trait" => Some(DocItemKind::Trait), - "contract" => Some(DocItemKind::Contract), - "type" => Some(DocItemKind::TypeAlias), - "const" => Some(DocItemKind::Const), - "impl" => Some(DocItemKind::Impl), - "msg" => Some(DocItemKind::Msg), - "msg_variant" => Some(DocItemKind::MsgVariant), - _ => None, - } - } - - pub fn display_name(&self) -> &'static str { - match self { - DocItemKind::Module => "Module", - DocItemKind::Function => "Function", - DocItemKind::Struct => "Struct", - DocItemKind::Enum => "Enum", - DocItemKind::Trait => "Trait", - DocItemKind::Contract => "Contract", - DocItemKind::TypeAlias => "Type Alias", - DocItemKind::Const => "Constant", - DocItemKind::Impl => "Implementation", - DocItemKind::ImplTrait => "Trait Implementation", - DocItemKind::Msg => "Message", - DocItemKind::MsgVariant => "Message Variant", - } - } - - /// Plural display name for section headers - pub fn plural_name(&self) -> &'static str { - match self { - DocItemKind::Module => "Modules", - DocItemKind::Function => "Functions", - DocItemKind::Struct => "Structs", - DocItemKind::Enum => "Enums", - DocItemKind::Trait => "Traits", - DocItemKind::Contract => "Contracts", - DocItemKind::TypeAlias => "Type Aliases", - DocItemKind::Const => "Constants", - DocItemKind::Impl => "Implementations", - DocItemKind::ImplTrait => "Trait Implementations", - DocItemKind::Msg => "Messages", - DocItemKind::MsgVariant => "Message Variants", - } - } - - /// Display order for sidebar grouping (lower = first) - pub fn display_order(&self) -> u8 { - match self { - DocItemKind::Module => 0, - DocItemKind::Msg => 1, - DocItemKind::Trait => 2, - DocItemKind::Contract => 3, - DocItemKind::Struct => 4, - DocItemKind::Enum => 5, - DocItemKind::TypeAlias => 6, - DocItemKind::Function => 7, - DocItemKind::Const => 8, - DocItemKind::Impl => 9, - DocItemKind::ImplTrait => 10, - DocItemKind::MsgVariant => 11, - } - } -} - -/// Visibility of a documented item -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -#[serde(rename_all = "snake_case")] -pub enum DocVisibility { - Public, - Private, -} - -/// Parsed documentation content with sections -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocContent { - /// The main summary (first paragraph) - pub summary: String, - /// Full documentation body (markdown) - pub body: String, - /// Extracted sections like # Examples, # Panics, etc. - pub sections: Vec<DocSection>, -} - -impl DocContent { - pub fn from_raw(raw: &str) -> Self { - let trimmed = raw.trim(); - - // Split into summary (first paragraph) and body - let (summary, body) = if let Some(idx) = trimmed.find("\n\n") { - (trimmed[..idx].to_string(), trimmed.to_string()) - } else { - (trimmed.to_string(), trimmed.to_string()) - }; - - // Extract known sections - let sections = Self::extract_sections(trimmed); - - DocContent { - summary, - body, - sections, - } - } - - fn extract_sections(text: &str) -> Vec<DocSection> { - let mut sections = Vec::new(); - let mut current_section: Option<(String, String)> = None; - - for line in text.lines() { - if let Some(header) = line.strip_prefix("# ") { - // Save previous section if any - if let Some((name, content)) = current_section.take() { - sections.push(DocSection { - name, - content: content.trim().to_string(), - }); - } - // Start new section - let name = header.trim().to_string(); - current_section = Some((name, String::new())); - } else if let Some((_, ref mut content)) = current_section { - content.push_str(line); - content.push('\n'); - } - } - - // Save final section - if let Some((name, content)) = current_section { - sections.push(DocSection { - name, - content: content.trim().to_string(), - }); - } - - sections - } -} - -/// A named section within documentation (e.g., "Examples", "Panics") -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocSection { - pub name: String, - pub content: String, -} - -/// A generic parameter with its bounds -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocGenericParam { - pub name: String, - pub bounds: Vec<String>, - pub default: Option<String>, -} - -/// A child of a documented item -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocChild { - pub kind: DocChildKind, - pub name: String, - pub docs: Option<DocContent>, - pub signature: String, - /// Rich signature with embedded links - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub rich_signature: RichSignature, - /// Source span of the signature (for SCIP occurrence overlay, not serialized) - #[serde(skip)] - pub signature_span: Option<SignatureSpanData>, - /// SCIP scope path for this signature - #[serde(default, skip_serializing_if = "Option::is_none")] - pub sig_scope: Option<String>, - pub visibility: DocVisibility, -} - -/// Kind of child item -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -#[serde(rename_all = "snake_case")] -pub enum DocChildKind { - Field, - Variant, - Method, - AssocType, - AssocConst, - /// A contract `init(...)` block. - Init, - /// A single arm of a contract `recv Msg { Variant ... }` block. - RecvHandler, -} - -impl DocChildKind { - pub fn display_name(&self) -> &'static str { - match self { - DocChildKind::Field => "Field", - DocChildKind::Variant => "Variant", - DocChildKind::Method => "Method", - DocChildKind::AssocType => "Associated Type", - DocChildKind::AssocConst => "Associated Constant", - DocChildKind::Init => "Initializer", - DocChildKind::RecvHandler => "Handler", - } - } - - /// Plural display name for section headers - pub fn plural_name(&self) -> &'static str { - match self { - DocChildKind::Field => "Fields", - DocChildKind::Variant => "Variants", - DocChildKind::Method => "Methods", - DocChildKind::AssocType => "Associated Types", - DocChildKind::AssocConst => "Associated Constants", - DocChildKind::Init => "Initializer", - DocChildKind::RecvHandler => "Message Handlers", - } - } - - /// Display order for grouping (lower = first) - pub fn display_order(&self) -> u8 { - match self { - DocChildKind::Variant => 0, - DocChildKind::Field => 1, - DocChildKind::Init => 2, - DocChildKind::RecvHandler => 3, - DocChildKind::AssocType => 4, - DocChildKind::AssocConst => 5, - DocChildKind::Method => 6, - } - } - - /// Anchor prefix for linking (rustdoc-style) - pub fn anchor_prefix(&self) -> &'static str { - match self { - DocChildKind::Field => "field", - DocChildKind::Variant => "variant", - DocChildKind::Method => "tymethod", - DocChildKind::AssocType => "associatedtype", - DocChildKind::AssocConst => "associatedconstant", - DocChildKind::Init => "init", - DocChildKind::RecvHandler => "handler", - } - } -} - -/// Source location for linking to source code -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocSourceLoc { - /// Absolute file path — used only in-memory by LSP for "goto source". - /// Never serialized to JSON (avoids leaking machine paths into static output). - #[serde(skip)] - pub file: String, - /// Relative display path (shown in UI) - pub display_file: String, - pub line: u32, - pub column: u32, -} - -/// A trait implementation reference (shown on type pages) -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocTraitImpl { - /// The name of the trait being implemented (e.g., "Clone"). Empty for inherent impls. - pub trait_name: String, - /// URL path to the impl item's documentation - pub impl_url: String, - /// The full signature of the impl (e.g., "impl Clone for MyStruct") - pub signature: String, - /// Rich signature with embedded links - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub rich_signature: RichSignature, - /// Source span of the signature (for SCIP occurrence overlay, not serialized) - #[serde(skip)] - pub signature_span: Option<SignatureSpanData>, - /// SCIP scope path for this impl signature - #[serde(default, skip_serializing_if = "Option::is_none")] - pub sig_scope: Option<String>, - /// Methods defined in this impl block (displayed inline on type pages) - #[serde(default)] - pub methods: Vec<DocImplMethod>, -} - -/// A method in an impl block (for inline display on type pages) -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocImplMethod { - /// Method name - pub name: String, - /// Method signature (e.g., "pub fn foo(&self) -> u32") - pub signature: String, - /// Rich signature with embedded links - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub rich_signature: RichSignature, - /// Source span of the signature (for SCIP occurrence overlay, not serialized) - #[serde(skip)] - pub signature_span: Option<SignatureSpanData>, - /// SCIP scope path for this method signature - #[serde(default, skip_serializing_if = "Option::is_none")] - pub sig_scope: Option<String>, - /// Parsed documentation content - pub docs: Option<DocContent>, -} - -/// A collection of documented items forming a documentation index -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocIndex { - /// All documented items, keyed by path - pub items: Vec<DocItem>, - /// Module hierarchy for navigation - pub modules: Vec<DocModuleTree>, - /// Builtin library modules (core, std), rendered separately in sidebar - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub builtin_modules: Vec<DocModuleTree>, -} - -impl DocIndex { - pub fn new() -> Self { - Self::default() - } - - pub fn add_item(&mut self, item: DocItem) { - self.items.push(item); - } - - /// Find an item by its path (without kind suffix) - pub fn find_by_path(&self, path: &str) -> Option<&DocItem> { - self.items.iter().find(|item| item.path == path) - } - - /// Find an item by path and kind - pub fn find_by_path_and_kind(&self, path: &str, kind: DocItemKind) -> Option<&DocItem> { - self.items - .iter() - .find(|item| item.path == path && item.kind == kind) - } - - /// Parse a URL path (potentially with kind suffix) and find the item. - /// URL format: "path::to::item" or "path::to::item/kind" - /// Returns the item if found, handling both formats. - pub fn find_by_url(&self, url_path: &str) -> Option<&DocItem> { - // Try to parse kind suffix (e.g., "lib::foo/fn" -> path="lib::foo", kind="fn") - if let Some((path, kind_str)) = url_path.rsplit_once('/') - && let Some(kind) = DocItemKind::parse(kind_str) - { - // URL has valid kind suffix - find by path and kind - return self.find_by_path_and_kind(path, kind); - } - // No valid kind suffix - find by path alone (may be ambiguous) - self.find_by_path(url_path) - } - - /// Find all items with a given path (for disambiguation) - pub fn find_all_by_path(&self, path: &str) -> Vec<&DocItem> { - self.items.iter().filter(|item| item.path == path).collect() - } - - /// Build a searchable index of items - pub fn search(&self, query: &str) -> Vec<&DocItem> { - let query_lower = query.to_lowercase(); - self.items - .iter() - .filter(|item| { - item.name.to_lowercase().contains(&query_lower) - || item.path.to_lowercase().contains(&query_lower) - }) - .collect() - } - - /// Link trait implementations to their target types and implementors to traits. - /// `links` is a list of (target_type_path, DocTraitImpl) pairs extracted - /// from the HIR using semantic helpers. - pub fn link_trait_impls(&mut self, links: Vec<(String, DocTraitImpl)>) { - // Build lookup maps keyed by full path to avoid collisions between - // same-named types in different modules (e.g. a::Foo vs b::Foo). - // Maps own their strings so we can mutably borrow self.items later. - let type_items: std::collections::HashMap<String, (String, DocItemKind)> = self - .items - .iter() - .filter(|item| { - matches!( - item.kind, - DocItemKind::Struct | DocItemKind::Enum | DocItemKind::Contract - ) - }) - .map(|item| (item.path.clone(), (item.path.clone(), item.kind))) - .collect(); - - let trait_items: std::collections::HashMap<String, String> = self - .items - .iter() - .filter(|item| item.kind == DocItemKind::Trait) - .map(|item| (item.path.clone(), item.path.clone())) - .collect(); - - /// Look up a type by path: try exact path first, then fall back to - /// simple-name scan (for unqualified paths from older extractors). - fn lookup_type( - map: &std::collections::HashMap<String, (String, DocItemKind)>, - target: &str, - ) -> Option<(String, String)> { - if let Some((path, kind)) = map.get(target) { - return Some((path.clone(), kind.as_str().to_string())); - } - // Simple-name fallback when target has no `::` - if !target.contains("::") { - for (path, kind) in map.values() { - let simple = extract_simple_type_name(path); - if simple == target { - return Some((path.clone(), kind.as_str().to_string())); - } - } - } - None - } - - /// Look up a trait by path: try exact path first, then simple-name scan. - fn lookup_trait( - map: &std::collections::HashMap<String, String>, - target: &str, - ) -> Option<String> { - if let Some(path) = map.get(target) { - return Some(path.clone()); - } - if !target.contains("::") { - for path in map.values() { - let simple = extract_simple_type_name(path); - if simple == target { - return Some(path.clone()); - } - } - } - None - } - - // First pass: collect implementors for each trait (keyed by trait path) - let mut trait_implementors: std::collections::HashMap<String, Vec<DocImplementor>> = - std::collections::HashMap::new(); - - for (target_type, trait_impl) in &links { - // Skip inherent impls (empty trait_name) - if trait_impl.trait_name.is_empty() { - continue; - } - - let trait_simple_name = extract_simple_type_name(&trait_impl.trait_name); - let type_simple_name = extract_simple_type_name(target_type); - - // Look up the actual type item to get the correct path and kind - let (type_path, type_kind_suffix) = - if let Some((path, kind)) = lookup_type(&type_items, target_type) { - (path, kind) - } else { - // Fallback to the target_type path with struct suffix - (target_type.clone(), "struct".to_string()) - }; - - // Look up the actual trait to get the correct path - let trait_path = lookup_trait(&trait_items, &trait_impl.trait_name) - .unwrap_or_else(|| trait_impl.trait_name.clone()); - - // Build rich signature: "impl Trait for Type" - let rich_signature = vec![ - SignaturePart::text("impl "), - SignaturePart::link(&trait_simple_name, format!("{}/trait", trait_path)), - SignaturePart::text(" for "), - SignaturePart::link( - &type_simple_name, - format!("{}/{}", type_path, type_kind_suffix), - ), - ]; - - // Create implementor entry with correct URL and rich signature - let implementor = DocImplementor { - type_name: type_simple_name.clone(), - type_url: format!("{}/{}", type_path, type_kind_suffix), - trait_name: trait_simple_name.clone(), - signature: trait_impl.signature.clone(), - rich_signature, - signature_span: trait_impl.signature_span.clone(), - sig_scope: None, - }; - - // Key by trait path (not simple name) to avoid cross-module collisions - let trait_key = trait_path.to_string(); - trait_implementors - .entry(trait_key) - .or_default() - .push(implementor); - } - - // Second pass: link trait impls to types and implementors to traits - for (target_type, mut trait_impl) in links { - let target_simple_name = extract_simple_type_name(&target_type); - let trait_simple_name = extract_simple_type_name(&trait_impl.trait_name); - - for item in &mut self.items { - // Link trait impls to types (structs, enums, contracts) - let is_type = matches!( - item.kind, - DocItemKind::Struct | DocItemKind::Enum | DocItemKind::Contract - ); - if is_type { - // Prefer exact canonical path match; only fall back to - // simple-name matching when the caller didn't provide a - // fully qualified path (e.g. from older extractors). - let matches = item.path == target_type - || (!target_type.contains("::") - && (item.name == target_simple_name - || item.path.ends_with(&format!("::{}", target_simple_name)))); - - if matches { - // Build rich signature for this trait impl if it's a trait impl (not inherent) - if !trait_impl.trait_name.is_empty() && trait_impl.rich_signature.is_empty() - { - // Look up the trait URL - let trait_url = lookup_trait(&trait_items, &trait_impl.trait_name) - .map(|p| format!("{}/trait", p)) - .unwrap_or_else(|| format!("{}/trait", &trait_impl.trait_name)); - - // Use the target item's path and kind for the type URL - let type_url = format!("{}/{}", item.path, item.kind.as_str()); - - trait_impl.rich_signature = vec![ - SignaturePart::text("impl "), - SignaturePart::link(&trait_simple_name, trait_url), - SignaturePart::text(" for "), - SignaturePart::link(&target_simple_name, type_url), - ]; - } - item.trait_impls.push(trait_impl.clone()); - } - } - - // Link implementors to traits - if item.kind == DocItemKind::Trait && !trait_impl.trait_name.is_empty() { - let trait_matches = item.path == trait_impl.trait_name - || item.name == trait_simple_name - || item.path.ends_with(&format!("::{}", trait_simple_name)); - - // Look up by item's full path first, then by simple name - let impls = trait_implementors - .get(item.path.as_str()) - .or_else(|| trait_implementors.get(&trait_simple_name)); - - if trait_matches && let Some(impls) = impls { - // Only add if not already present (dedup by type_url, not name) - for imp in impls { - if !item.implementors.iter().any(|i| i.type_url == imp.type_url) { - item.implementors.push(imp.clone()); - } - } - } - } - } - } - } -} - -/// Extract the simple type name from a potentially qualified/generic path. -/// "mod::MyStruct<T>" -> "MyStruct" -/// "MyStruct" -> "MyStruct" -fn extract_simple_type_name(type_str: &str) -> String { - let without_generics = type_str.split('<').next().unwrap_or(type_str); - without_generics - .rsplit("::") - .next() - .unwrap_or(without_generics) - .trim() - .to_string() -} - -/// Module tree for navigation sidebar -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocModuleTree { - pub name: String, - pub path: String, - pub children: Vec<DocModuleTree>, - /// Direct items in this module (non-module children) - pub items: Vec<DocModuleItem>, -} - -impl DocModuleTree { - /// Get the URL path for this module (includes kind suffix) - pub fn url_path(&self) -> String { - format!("{}/mod", self.path) - } -} - -/// A reference to an item within a module -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr(test, derive(schemars::JsonSchema))] -pub struct DocModuleItem { - pub name: String, - pub path: String, - pub kind: DocItemKind, - /// Brief summary (first sentence of docs) - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option<String>, -} - -impl DocModuleItem { - /// Get the URL path for this item (includes kind suffix) - pub fn url_path(&self) -> String { - format!("{}/{}", self.path, self.kind.as_str()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn sample_index() -> DocIndex { - let mut index = DocIndex::new(); - index.add_item(DocItem { - path: "mylib::Point".into(), - name: "Point".into(), - kind: DocItemKind::Struct, - visibility: DocVisibility::Public, - docs: Some(DocContent::from_raw("A 2D point.\n\nUsed for coordinates.")), - signature: "pub struct Point".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![DocGenericParam { - name: "T".into(), - bounds: vec![], - default: None, - }], - where_bounds: vec![], - children: vec![DocChild { - kind: DocChildKind::Field, - name: "x".into(), - docs: Some(DocContent::from_raw("The x coordinate")), - signature: "x: u256".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - visibility: DocVisibility::Public, - }], - source: Some(DocSourceLoc { - file: "/src/lib.fe".into(), - display_file: "lib.fe".into(), - line: 1, - column: 0, - }), - source_text: None, - trait_impls: vec![], - implementors: vec![], - }); - index.add_item(DocItem { - path: "mylib::Color".into(), - name: "Color".into(), - kind: DocItemKind::Enum, - visibility: DocVisibility::Public, - docs: None, - signature: "pub enum Color".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![], - where_bounds: vec![], - children: vec![ - DocChild { - kind: DocChildKind::Variant, - name: "Red".into(), - docs: None, - signature: "Red".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - visibility: DocVisibility::Public, - }, - DocChild { - kind: DocChildKind::Variant, - name: "Green".into(), - docs: None, - signature: "Green".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - visibility: DocVisibility::Public, - }, - ], - source: None, - source_text: None, - trait_impls: vec![], - implementors: vec![], - }); - index.add_item(DocItem { - path: "mylib::add".into(), - name: "add".into(), - kind: DocItemKind::Function, - visibility: DocVisibility::Public, - docs: Some(DocContent::from_raw("Add two numbers.")), - signature: "pub fn add(a: u256, b: u256) -> u256".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![], - where_bounds: vec![], - children: vec![], - source: None, - source_text: None, - trait_impls: vec![], - implementors: vec![], - }); - index.add_item(DocItem { - path: "mylib::TokenMsg".into(), - name: "TokenMsg".into(), - kind: DocItemKind::Msg, - visibility: DocVisibility::Public, - docs: None, - signature: "pub msg TokenMsg".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![], - where_bounds: vec![], - children: vec![], - source: None, - source_text: None, - trait_impls: vec![], - implementors: vec![], - }); - index.add_item(DocItem { - path: "mylib::TokenMsg::Transfer".into(), - name: "Transfer".into(), - kind: DocItemKind::MsgVariant, - visibility: DocVisibility::Public, - docs: None, - signature: "Transfer { to: Address } -> bool".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![], - where_bounds: vec![], - children: vec![], - source: None, - source_text: None, - trait_impls: vec![], - implementors: vec![], - }); - index - } - - #[test] - fn json_round_trip() { - let index = sample_index(); - let json = serde_json::to_string_pretty(&index).expect("serialize"); - let deserialized: DocIndex = serde_json::from_str(&json).expect("deserialize"); - - assert_eq!(index.items.len(), deserialized.items.len()); - for (a, b) in index.items.iter().zip(deserialized.items.iter()) { - assert_eq!(a.path, b.path); - assert_eq!(a.name, b.name); - assert_eq!(a.kind, b.kind); - assert_eq!(a.visibility, b.visibility); - assert_eq!(a.docs, b.docs); - assert_eq!(a.signature, b.signature); - assert_eq!(a.generics, b.generics); - assert_eq!(a.children, b.children); - // source.file is #[serde(skip)] — verify it's dropped on round-trip - if let (Some(sa), Some(sb)) = (&a.source, &b.source) { - assert!( - sb.file.is_empty(), - "source.file should not survive serialization" - ); - assert_eq!(sa.display_file, sb.display_file); - assert_eq!(sa.line, sb.line); - assert_eq!(sa.column, sb.column); - } else { - assert_eq!(a.source.is_some(), b.source.is_some()); - } - } - } - - #[test] - fn find_by_url_with_kind() { - let index = sample_index(); - let item = index.find_by_url("mylib::Point/struct"); - assert!(item.is_some()); - assert_eq!(item.unwrap().name, "Point"); - } - - #[test] - fn find_by_url_without_kind() { - let index = sample_index(); - let item = index.find_by_url("mylib::Color"); - assert!(item.is_some()); - assert_eq!(item.unwrap().name, "Color"); - } - - #[test] - fn find_by_url_not_found() { - let index = sample_index(); - assert!(index.find_by_url("mylib::Missing/struct").is_none()); - } - - #[test] - fn search_by_name() { - let index = sample_index(); - let results = index.search("Point"); - assert_eq!(results.len(), 1); - assert_eq!(results[0].name, "Point"); - } - - #[test] - fn search_case_insensitive() { - let index = sample_index(); - let results = index.search("color"); - assert_eq!(results.len(), 1); - assert_eq!(results[0].name, "Color"); - } - - #[test] - fn search_by_path() { - let index = sample_index(); - let results = index.search("mylib"); - assert_eq!(results.len(), 5); - } - - #[test] - fn doc_content_parsing() { - let content = DocContent::from_raw( - "Summary line.\n\nDetailed body here.\n\n# Examples\nSome example code.", - ); - assert_eq!(content.summary, "Summary line."); - assert!(content.body.contains("Detailed body here.")); - assert_eq!(content.sections.len(), 1); - assert_eq!(content.sections[0].name, "Examples"); - assert_eq!(content.sections[0].content, "Some example code."); - } - - #[test] - fn doc_item_url_path() { - let index = sample_index(); - let item = index.find_by_path("mylib::Point").unwrap(); - assert_eq!(item.url_path(), "mylib::Point/struct"); - } - - fn make_struct_item(path: &str, name: &str) -> DocItem { - DocItem { - path: path.into(), - name: name.into(), - kind: DocItemKind::Struct, - visibility: DocVisibility::Public, - docs: None, - signature: format!("pub struct {name}"), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![], - where_bounds: vec![], - children: vec![], - source: None, - source_text: None, - trait_impls: vec![], - implementors: vec![], - } - } - - fn make_trait_item(path: &str, name: &str) -> DocItem { - DocItem { - path: path.into(), - name: name.into(), - kind: DocItemKind::Trait, - visibility: DocVisibility::Public, - docs: None, - signature: format!("pub trait {name}"), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![], - where_bounds: vec![], - children: vec![], - source: None, - source_text: None, - trait_impls: vec![], - implementors: vec![], - } - } - - fn make_trait_impl(trait_name: &str) -> DocTraitImpl { - DocTraitImpl { - trait_name: trait_name.into(), - impl_url: String::new(), - signature: format!("impl {trait_name} for ..."), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - methods: vec![], - } - } - - #[test] - fn link_trait_impls_exact_path_match() { - let mut index = DocIndex::new(); - index.add_item(make_struct_item("mylib::Point", "Point")); - index.add_item(make_trait_item("mylib::Clone", "Clone")); - - let links = vec![("mylib::Point".into(), make_trait_impl("mylib::Clone"))]; - index.link_trait_impls(links); - - let point = index.find_by_path("mylib::Point").unwrap(); - assert_eq!(point.trait_impls.len(), 1, "exact path should match"); - } - - #[test] - fn link_trait_impls_no_false_match_across_modules() { - let mut index = DocIndex::new(); - // Two structs with the same simple name in different modules - index.add_item(make_struct_item("mod_a::Point", "Point")); - index.add_item(make_struct_item("mod_b::Point", "Point")); - - // Impl targets mod_a::Point specifically - let links = vec![("mod_a::Point".into(), make_trait_impl("Clone"))]; - index.link_trait_impls(links); - - let point_a = index.find_by_path("mod_a::Point").unwrap(); - let point_b = index.find_by_path("mod_b::Point").unwrap(); - assert_eq!(point_a.trait_impls.len(), 1, "exact path match on mod_a"); - assert_eq!( - point_b.trait_impls.len(), - 0, - "mod_b::Point should NOT match mod_a::Point" - ); - } - - #[test] - fn link_trait_impls_simple_name_fallback() { - let mut index = DocIndex::new(); - index.add_item(make_struct_item("mylib::Point", "Point")); - - // When target is a simple name (no "::"), fall back to name matching - let links = vec![("Point".into(), make_trait_impl("Clone"))]; - index.link_trait_impls(links); - - let point = index.find_by_path("mylib::Point").unwrap(); - assert_eq!( - point.trait_impls.len(), - 1, - "simple name should fall back to name matching" - ); - } - - #[test] - fn link_trait_impls_populates_implementors() { - let mut index = DocIndex::new(); - index.add_item(make_struct_item("mylib::Point", "Point")); - index.add_item(make_trait_item("mylib::Display", "Display")); - - let links = vec![("mylib::Point".into(), make_trait_impl("Display"))]; - index.link_trait_impls(links); - - let display = index.find_by_path("mylib::Display").unwrap(); - assert_eq!( - display.implementors.len(), - 1, - "trait should get implementor entry" - ); - assert_eq!(display.implementors[0].type_name, "Point"); - } - - #[test] - fn link_trait_impls_type_lookup_no_collision() { - // Two structs with the same simple name — the lookup map must - // resolve each to the correct full path without collisions. - let mut index = DocIndex::new(); - index.add_item(make_struct_item("a::Foo", "Foo")); - index.add_item(make_struct_item("b::Foo", "Foo")); - index.add_item(make_trait_item("mylib::Display", "Display")); - - let links = vec![ - ("a::Foo".into(), make_trait_impl("Display")), - ("b::Foo".into(), make_trait_impl("Display")), - ]; - index.link_trait_impls(links); - - // Both should get the impl - let foo_a = index.find_by_path("a::Foo").unwrap(); - let foo_b = index.find_by_path("b::Foo").unwrap(); - assert_eq!(foo_a.trait_impls.len(), 1); - assert_eq!(foo_b.trait_impls.len(), 1); - - // The trait should have BOTH as implementors (dedup by type_url) - let display = index.find_by_path("mylib::Display").unwrap(); - assert_eq!( - display.implementors.len(), - 2, - "both a::Foo and b::Foo should appear as implementors" - ); - let urls: Vec<&str> = display - .implementors - .iter() - .map(|i| i.type_url.as_str()) - .collect(); - assert!(urls.contains(&"a::Foo/struct")); - assert!(urls.contains(&"b::Foo/struct")); - } - - #[test] - fn link_trait_impls_dedup_by_url_not_name() { - // Two types with the same simple name implementing the same trait - // should not be deduplicated — dedup should use type_url, not type_name. - let mut index = DocIndex::new(); - index.add_item(make_struct_item("x::Result", "Result")); - index.add_item(make_struct_item("y::Result", "Result")); - index.add_item(make_trait_item("mylib::Debug", "Debug")); - - let links = vec![ - ("x::Result".into(), make_trait_impl("Debug")), - ("y::Result".into(), make_trait_impl("Debug")), - ]; - index.link_trait_impls(links); - - let debug_trait = index.find_by_path("mylib::Debug").unwrap(); - assert_eq!( - debug_trait.implementors.len(), - 2, - "both x::Result and y::Result should be separate implementors" - ); - } - - /// Snapshot test for the DocIndex JSON Schema. - /// - /// This derives the schema directly from the Rust type definitions. - /// Any structural change — new fields, removed fields, new enum variants, - /// type changes — will produce a diff. - /// - /// If this test fails, the JSON shape of docs.json has changed. - /// Before accepting the new snapshot: - /// 1. Bump SCHEMA_VERSION in this file. - /// 2. Add a migration case in fe-scip-store.js feMigrate(). - #[test] - fn doc_index_schema_snapshot() { - let schema = schemars::schema_for!(DocIndex); - let value = serde_json::to_value(&schema).expect("serialize schema"); - insta::assert_json_snapshot!("doc_index_schema", value); - } -} diff --git a/crates/fe-web/src/snapshots/fe_web__model__tests__doc_index_schema.snap b/crates/fe-web/src/snapshots/fe_web__model__tests__doc_index_schema.snap deleted file mode 100644 index 0419414d22..0000000000 --- a/crates/fe-web/src/snapshots/fe_web__model__tests__doc_index_schema.snap +++ /dev/null @@ -1,582 +0,0 @@ ---- -source: crates/fe-web/src/model.rs -assertion_line: 1241 -expression: value ---- -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "DocChild": { - "description": "A child of a documented item", - "properties": { - "docs": { - "anyOf": [ - { - "$ref": "#/definitions/DocContent" - }, - { - "type": "null" - } - ] - }, - "kind": { - "$ref": "#/definitions/DocChildKind" - }, - "name": { - "type": "string" - }, - "rich_signature": { - "description": "Rich signature with embedded links", - "items": { - "$ref": "#/definitions/SignaturePart" - }, - "type": "array" - }, - "sig_scope": { - "description": "SCIP scope path for this signature", - "type": [ - "string", - "null" - ] - }, - "signature": { - "type": "string" - }, - "visibility": { - "$ref": "#/definitions/DocVisibility" - } - }, - "required": [ - "kind", - "name", - "signature", - "visibility" - ], - "type": "object" - }, - "DocChildKind": { - "description": "Kind of child item", - "oneOf": [ - { - "enum": [ - "field", - "variant", - "method", - "assoc_type", - "assoc_const" - ], - "type": "string" - }, - { - "description": "A contract `init(...)` block.", - "enum": [ - "init" - ], - "type": "string" - }, - { - "description": "A single arm of a contract `recv Msg { Variant ... }` block.", - "enum": [ - "recv_handler" - ], - "type": "string" - } - ] - }, - "DocContent": { - "description": "Parsed documentation content with sections", - "properties": { - "body": { - "description": "Full documentation body (markdown)", - "type": "string" - }, - "sections": { - "description": "Extracted sections like # Examples, # Panics, etc.", - "items": { - "$ref": "#/definitions/DocSection" - }, - "type": "array" - }, - "summary": { - "description": "The main summary (first paragraph)", - "type": "string" - } - }, - "required": [ - "body", - "sections", - "summary" - ], - "type": "object" - }, - "DocGenericParam": { - "description": "A generic parameter with its bounds", - "properties": { - "bounds": { - "items": { - "type": "string" - }, - "type": "array" - }, - "default": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": "string" - } - }, - "required": [ - "bounds", - "name" - ], - "type": "object" - }, - "DocImplMethod": { - "description": "A method in an impl block (for inline display on type pages)", - "properties": { - "docs": { - "anyOf": [ - { - "$ref": "#/definitions/DocContent" - }, - { - "type": "null" - } - ], - "description": "Parsed documentation content" - }, - "name": { - "description": "Method name", - "type": "string" - }, - "rich_signature": { - "description": "Rich signature with embedded links", - "items": { - "$ref": "#/definitions/SignaturePart" - }, - "type": "array" - }, - "sig_scope": { - "description": "SCIP scope path for this method signature", - "type": [ - "string", - "null" - ] - }, - "signature": { - "description": "Method signature (e.g., \"pub fn foo(&self) -> u32\")", - "type": "string" - } - }, - "required": [ - "name", - "signature" - ], - "type": "object" - }, - "DocImplementor": { - "description": "A type that implements a trait", - "properties": { - "rich_signature": { - "description": "Rich signature with embedded links", - "items": { - "$ref": "#/definitions/SignaturePart" - }, - "type": "array" - }, - "sig_scope": { - "description": "SCIP scope path for this implementor signature", - "type": [ - "string", - "null" - ] - }, - "signature": { - "description": "The full impl signature (plain text)", - "type": "string" - }, - "trait_name": { - "description": "The trait name (for linking to the impl block)", - "type": "string" - }, - "type_name": { - "description": "The implementing type name", - "type": "string" - }, - "type_url": { - "description": "Path to the type's documentation", - "type": "string" - } - }, - "required": [ - "signature", - "trait_name", - "type_name", - "type_url" - ], - "type": "object" - }, - "DocItem": { - "description": "A documented item in the Fe codebase", - "properties": { - "children": { - "description": "Child items (methods, fields, variants, etc.)", - "items": { - "$ref": "#/definitions/DocChild" - }, - "type": "array" - }, - "docs": { - "anyOf": [ - { - "$ref": "#/definitions/DocContent" - }, - { - "type": "null" - } - ], - "description": "Parsed documentation content" - }, - "generics": { - "description": "Generic parameters, if any", - "items": { - "$ref": "#/definitions/DocGenericParam" - }, - "type": "array" - }, - "implementors": { - "description": "Types that implement this trait (for trait pages)", - "items": { - "$ref": "#/definitions/DocImplementor" - }, - "type": "array" - }, - "kind": { - "allOf": [ - { - "$ref": "#/definitions/DocItemKind" - } - ], - "description": "What kind of item this is" - }, - "name": { - "description": "Short name of the item", - "type": "string" - }, - "path": { - "description": "Unique path identifier (e.g., \"std::option::Option\")", - "type": "string" - }, - "rich_signature": { - "description": "Rich signature with embedded links (for rendering)", - "items": { - "$ref": "#/definitions/SignaturePart" - }, - "type": "array" - }, - "sig_scope": { - "description": "SCIP scope path for this signature (set during enrich_signatures)", - "type": [ - "string", - "null" - ] - }, - "signature": { - "description": "The item's signature/definition (plain text for backward compat)", - "type": "string" - }, - "source": { - "anyOf": [ - { - "$ref": "#/definitions/DocSourceLoc" - }, - { - "type": "null" - } - ], - "description": "Source location for \"view source\" links" - }, - "source_text": { - "description": "Full source text of the item definition (for inline \"view source\")", - "type": [ - "string", - "null" - ] - }, - "trait_impls": { - "default": [], - "description": "Trait implementations for this type (structs, enums, contracts)", - "items": { - "$ref": "#/definitions/DocTraitImpl" - }, - "type": "array" - }, - "visibility": { - "allOf": [ - { - "$ref": "#/definitions/DocVisibility" - } - ], - "description": "The item's visibility" - }, - "where_bounds": { - "description": "Where clause bounds, if any", - "items": { - "type": "string" - }, - "type": "array" - } - }, - "required": [ - "children", - "generics", - "kind", - "name", - "path", - "signature", - "visibility", - "where_bounds" - ], - "type": "object" - }, - "DocItemKind": { - "description": "The kind of documented item", - "oneOf": [ - { - "enum": [ - "module", - "function", - "struct", - "enum", - "trait", - "contract", - "type_alias", - "const", - "impl", - "impl_trait" - ], - "type": "string" - }, - { - "description": "A `msg` block (desugared to module internally).", - "enum": [ - "msg" - ], - "type": "string" - }, - { - "description": "A variant of a `msg` block (desugared to struct internally).", - "enum": [ - "msg_variant" - ], - "type": "string" - } - ] - }, - "DocModuleItem": { - "description": "A reference to an item within a module", - "properties": { - "kind": { - "$ref": "#/definitions/DocItemKind" - }, - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "summary": { - "description": "Brief summary (first sentence of docs)", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "kind", - "name", - "path" - ], - "type": "object" - }, - "DocModuleTree": { - "description": "Module tree for navigation sidebar", - "properties": { - "children": { - "items": { - "$ref": "#/definitions/DocModuleTree" - }, - "type": "array" - }, - "items": { - "description": "Direct items in this module (non-module children)", - "items": { - "$ref": "#/definitions/DocModuleItem" - }, - "type": "array" - }, - "name": { - "type": "string" - }, - "path": { - "type": "string" - } - }, - "required": [ - "children", - "items", - "name", - "path" - ], - "type": "object" - }, - "DocSection": { - "description": "A named section within documentation (e.g., \"Examples\", \"Panics\")", - "properties": { - "content": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "content", - "name" - ], - "type": "object" - }, - "DocSourceLoc": { - "description": "Source location for linking to source code", - "properties": { - "column": { - "format": "uint32", - "minimum": 0.0, - "type": "integer" - }, - "display_file": { - "description": "Relative display path (shown in UI)", - "type": "string" - }, - "line": { - "format": "uint32", - "minimum": 0.0, - "type": "integer" - } - }, - "required": [ - "column", - "display_file", - "line" - ], - "type": "object" - }, - "DocTraitImpl": { - "description": "A trait implementation reference (shown on type pages)", - "properties": { - "impl_url": { - "description": "URL path to the impl item's documentation", - "type": "string" - }, - "methods": { - "default": [], - "description": "Methods defined in this impl block (displayed inline on type pages)", - "items": { - "$ref": "#/definitions/DocImplMethod" - }, - "type": "array" - }, - "rich_signature": { - "description": "Rich signature with embedded links", - "items": { - "$ref": "#/definitions/SignaturePart" - }, - "type": "array" - }, - "sig_scope": { - "description": "SCIP scope path for this impl signature", - "type": [ - "string", - "null" - ] - }, - "signature": { - "description": "The full signature of the impl (e.g., \"impl Clone for MyStruct\")", - "type": "string" - }, - "trait_name": { - "description": "The name of the trait being implemented (e.g., \"Clone\"). Empty for inherent impls.", - "type": "string" - } - }, - "required": [ - "impl_url", - "signature", - "trait_name" - ], - "type": "object" - }, - "DocVisibility": { - "description": "Visibility of a documented item", - "enum": [ - "public", - "private" - ], - "type": "string" - }, - "SignaturePart": { - "description": "A part of a signature - either plain text or a linkable reference", - "properties": { - "link": { - "description": "If Some, render as a link to this doc path (e.g., \"hoverable::Numbers/struct\")", - "type": [ - "string", - "null" - ] - }, - "text": { - "description": "The display text", - "type": "string" - } - }, - "required": [ - "text" - ], - "type": "object" - } - }, - "description": "A collection of documented items forming a documentation index", - "properties": { - "builtin_modules": { - "description": "Builtin library modules (core, std), rendered separately in sidebar", - "items": { - "$ref": "#/definitions/DocModuleTree" - }, - "type": "array" - }, - "items": { - "description": "All documented items, keyed by path", - "items": { - "$ref": "#/definitions/DocItem" - }, - "type": "array" - }, - "modules": { - "description": "Module hierarchy for navigation", - "items": { - "$ref": "#/definitions/DocModuleTree" - }, - "type": "array" - } - }, - "required": [ - "items", - "modules" - ], - "title": "DocIndex", - "type": "object" -} diff --git a/crates/fe-web/src/starlight.rs b/crates/fe-web/src/starlight.rs deleted file mode 100644 index ce403ce80c..0000000000 --- a/crates/fe-web/src/starlight.rs +++ /dev/null @@ -1,673 +0,0 @@ -//! Starlight-compatible markdown page generator. -//! -//! Generates a directory of `.md` files from a [`DocIndex`] that Astro Starlight -//! can render as native documentation pages with sidebar, search, and badges. - -use std::collections::HashMap; -use std::fmt::Write as _; -use std::io; -use std::path::Path; - -use crate::escape::escape_html; -use crate::model::*; - -/// Generate Starlight-compatible markdown pages from a [`DocIndex`]. -/// -/// Each module becomes a directory with an `index.md`, and each item becomes -/// an individual `.md` file with Starlight frontmatter (title, description, -/// sidebar badge, etc.). -pub fn generate(index: &DocIndex, output_dir: &Path, base_url: &str) -> io::Result<()> { - std::fs::create_dir_all(output_dir)?; - - let collisions = detect_collisions(index); - - // Root index page - write_root_index(index, output_dir, base_url)?; - - // Module pages - for module in &index.modules { - write_module_tree(module, index, output_dir, base_url, &collisions)?; - } - - // Item pages (skip Module/Impl/ImplTrait — they're rendered elsewhere) - for item in &index.items { - if matches!( - item.kind, - DocItemKind::Module | DocItemKind::Impl | DocItemKind::ImplTrait - ) { - continue; - } - write_item_page(item, index, output_dir, base_url, &collisions)?; - } - - // Write web component assets for Starlight to import - write_component_assets(output_dir)?; - - Ok(()) -} - -// --------------------------------------------------------------------------- -// Path helpers -// --------------------------------------------------------------------------- - -/// Convert a doc path like `mylib::Greeter` to a filesystem path like `mylib/greeter.md`. -fn item_fs_path( - path: &str, - kind: DocItemKind, - collisions: &HashMap<String, Vec<DocItemKind>>, -) -> std::path::PathBuf { - let segments: Vec<&str> = path.split("::").collect(); - let mut p = std::path::PathBuf::new(); - - if kind == DocItemKind::Module { - for seg in &segments { - p.push(slug(seg)); - } - p.push("index.md"); - return p; - } - - // Parent module segments → directories - for seg in &segments[..segments.len().saturating_sub(1)] { - p.push(slug(seg)); - } - - // Item filename, with kind suffix if there's a name collision - let name = slug(segments.last().unwrap_or(&"unknown")); - if collisions.contains_key(path) { - p.push(format!("{}-{}.md", name, kind.as_str())); - } else { - p.push(format!("{name}.md")); - } - - p -} - -/// Convert a name to a URL-safe slug (lowercase). -fn slug(name: &str) -> String { - name.to_lowercase() -} - -/// Build an absolute URL for a doc item within the Starlight site. -fn item_url( - path: &str, - kind: DocItemKind, - base_url: &str, - collisions: &HashMap<String, Vec<DocItemKind>>, -) -> String { - let fs = item_fs_path(path, kind, collisions); - let route = fs.with_extension("").to_string_lossy().replace('\\', "/"); - format!("{base_url}/{route}/") -} - -/// Detect doc paths that appear with multiple different kinds (rare, but possible). -fn detect_collisions(index: &DocIndex) -> HashMap<String, Vec<DocItemKind>> { - let mut path_kinds: HashMap<String, Vec<DocItemKind>> = HashMap::new(); - for item in &index.items { - path_kinds - .entry(item.path.clone()) - .or_default() - .push(item.kind); - } - path_kinds.retain(|_, kinds| kinds.len() > 1); - path_kinds -} - -// --------------------------------------------------------------------------- -// Starlight badge mapping -// --------------------------------------------------------------------------- - -fn kind_badge(kind: DocItemKind) -> (&'static str, &'static str) { - match kind { - DocItemKind::Struct => ("struct", "note"), - DocItemKind::Enum => ("enum", "caution"), - DocItemKind::Trait => ("trait", "tip"), - DocItemKind::Contract => ("contract", "danger"), - DocItemKind::Function => ("fn", "note"), - DocItemKind::TypeAlias => ("type", "note"), - DocItemKind::Const => ("const", "note"), - DocItemKind::Module => ("mod", "note"), - DocItemKind::Impl | DocItemKind::ImplTrait => ("impl", "note"), - DocItemKind::Msg => ("msg", "note"), - DocItemKind::MsgVariant => ("msg variant", "note"), - } -} - -// --------------------------------------------------------------------------- -// Page writers -// --------------------------------------------------------------------------- - -/// Render a signature as an HTML web component. -/// -/// If `rich_signature` is non-empty, emits `<fe-signature data='...'>` with the -/// rich signature serialized as JSON. Otherwise falls back to `<fe-code-block>`. -fn render_signature_html(signature: &str, rich_signature: &[SignaturePart]) -> String { - if !rich_signature.is_empty() { - let json = serde_json::to_string(rich_signature).unwrap_or_default(); - format!( - "<fe-signature data='{}'>{}</fe-signature>", - escape_html(&json), - escape_html(signature), - ) - } else { - format!( - "<fe-code-block lang=\"fe\">{}</fe-code-block>", - escape_html(signature), - ) - } -} - -/// Write web component JS/CSS assets alongside the generated markdown. -fn write_component_assets(output_dir: &Path) -> io::Result<()> { - use crate::assets::{FE_CODE_BLOCK_JS, FE_HIGHLIGHT_CSS, FE_SIGNATURE_JS}; - - let dir = output_dir.join("_components"); - std::fs::create_dir_all(&dir)?; - std::fs::write(dir.join("fe-code-block.js"), FE_CODE_BLOCK_JS)?; - std::fs::write(dir.join("fe-signature.js"), FE_SIGNATURE_JS)?; - std::fs::write(dir.join("fe-highlight.css"), FE_HIGHLIGHT_CSS)?; - Ok(()) -} - -fn write_root_index(index: &DocIndex, output_dir: &Path, base_url: &str) -> io::Result<()> { - let mut md = String::new(); - writeln!(md, "---").unwrap(); - writeln!(md, "title: API Reference").unwrap(); - writeln!(md, "description: Fe API documentation").unwrap(); - writeln!(md, "---").unwrap(); - writeln!(md).unwrap(); - - if !index.modules.is_empty() { - writeln!(md, "## Modules\n").unwrap(); - writeln!(md, "| Module | Description |").unwrap(); - writeln!(md, "|--------|-------------|").unwrap(); - for module in &index.modules { - let url = format!("{base_url}/{}/", slug(&module.name)); - let summary = module - .items - .first() - .and_then(|i| i.summary.as_deref()) - .unwrap_or(""); - writeln!(md, "| [{}]({url}) | {summary} |", module.name).unwrap(); - } - writeln!(md).unwrap(); - } - - std::fs::write(output_dir.join("index.md"), md) -} - -fn write_module_tree( - module: &DocModuleTree, - index: &DocIndex, - output_dir: &Path, - base_url: &str, - collisions: &HashMap<String, Vec<DocItemKind>>, -) -> io::Result<()> { - let dir = output_dir.join(slug(&module.name)); - std::fs::create_dir_all(&dir)?; - - let mut md = String::new(); - writeln!(md, "---").unwrap(); - writeln!(md, "title: \"{}\"", module.name).unwrap(); - writeln!(md, "description: \"Module {}\"", module.path).unwrap(); - writeln!(md, "sidebar:").unwrap(); - writeln!(md, " label: {}", module.name).unwrap(); - writeln!(md, "---").unwrap(); - writeln!(md).unwrap(); - - // Module docs (if the module has a DocItem) - if let Some(item) = index - .items - .iter() - .find(|i| i.path == module.path && i.kind == DocItemKind::Module) - && let Some(docs) = &item.docs - { - writeln!(md, "{}\n", docs.body).unwrap(); - } - - // Group items by kind, sorted by display order - let mut by_kind: HashMap<DocItemKind, Vec<&DocModuleItem>> = HashMap::new(); - for item in &module.items { - by_kind.entry(item.kind).or_default().push(item); - } - let mut kinds: Vec<_> = by_kind.keys().copied().collect(); - kinds.sort_by_key(|k| k.display_order()); - - for kind in kinds { - let items = &by_kind[&kind]; - writeln!(md, "## {}\n", kind.plural_name()).unwrap(); - writeln!(md, "| Name | Description |").unwrap(); - writeln!(md, "|------|-------------|").unwrap(); - for item in items { - let url = item_url(&item.path, item.kind, base_url, collisions); - let summary = item.summary.as_deref().unwrap_or(""); - writeln!(md, "| [{}]({url}) | {summary} |", item.name).unwrap(); - } - writeln!(md).unwrap(); - } - - std::fs::write(dir.join("index.md"), md)?; - - // Recurse into child modules - for child in &module.children { - write_module_tree(child, index, &dir, base_url, collisions)?; - } - - Ok(()) -} - -fn write_item_page( - item: &DocItem, - _index: &DocIndex, - output_dir: &Path, - base_url: &str, - collisions: &HashMap<String, Vec<DocItemKind>>, -) -> io::Result<()> { - let fs_path = item_fs_path(&item.path, item.kind, collisions); - let full_path = output_dir.join(&fs_path); - - if let Some(parent) = full_path.parent() { - std::fs::create_dir_all(parent)?; - } - - let (badge_text, badge_variant) = kind_badge(item.kind); - - let mut md = String::new(); - - // Frontmatter - writeln!(md, "---").unwrap(); - writeln!(md, "title: \"{}\"", item.name).unwrap(); - writeln!( - md, - "description: \"{} {} in {}\"", - item.kind.display_name(), - item.name, - parent_module(&item.path) - ) - .unwrap(); - writeln!(md, "sidebar:").unwrap(); - writeln!(md, " label: {}", item.name).unwrap(); - writeln!(md, " badge:").unwrap(); - writeln!(md, " text: {badge_text}").unwrap(); - writeln!(md, " variant: {badge_variant}").unwrap(); - writeln!(md, "---").unwrap(); - writeln!(md).unwrap(); - - // Signature - if !item.signature.is_empty() { - writeln!( - md, - "{}\n", - render_signature_html(&item.signature, &item.rich_signature) - ) - .unwrap(); - } - - // Documentation body - if let Some(docs) = &item.docs { - writeln!(md, "{}", docs.body).unwrap(); - writeln!(md).unwrap(); - } - - // Children grouped by kind - render_children(&mut md, &item.children); - - // Trait implementations - render_trait_impls(&mut md, &item.trait_impls, base_url, collisions); - - // Implementors (for trait pages) - render_implementors(&mut md, &item.implementors, base_url, collisions); - - std::fs::write(full_path, md) -} - -// --------------------------------------------------------------------------- -// Section renderers -// --------------------------------------------------------------------------- - -fn render_children(md: &mut String, children: &[DocChild]) { - if children.is_empty() { - return; - } - - let mut by_kind: HashMap<DocChildKind, Vec<&DocChild>> = HashMap::new(); - for child in children { - by_kind.entry(child.kind).or_default().push(child); - } - let mut kinds: Vec<_> = by_kind.keys().copied().collect(); - kinds.sort_by_key(|k| k.display_order()); - - for kind in kinds { - let items = &by_kind[&kind]; - writeln!(md, "## {}\n", kind.plural_name()).unwrap(); - - for child in items { - writeln!(md, "### `{}`\n", child.name).unwrap(); - if !child.signature.is_empty() { - writeln!( - md, - "{}\n", - render_signature_html(&child.signature, &child.rich_signature) - ) - .unwrap(); - } - if let Some(docs) = &child.docs { - writeln!(md, "{}\n", docs.body).unwrap(); - } - } - } -} - -fn render_trait_impls( - md: &mut String, - trait_impls: &[DocTraitImpl], - _base_url: &str, - _collisions: &HashMap<String, Vec<DocItemKind>>, -) { - if trait_impls.is_empty() { - return; - } - - writeln!(md, "## Trait Implementations\n").unwrap(); - - for ti in trait_impls { - let heading = if ti.trait_name.is_empty() { - "Methods".to_string() - } else { - format!("impl {}", ti.trait_name) - }; - writeln!(md, "### {heading}\n").unwrap(); - - if !ti.signature.is_empty() { - writeln!( - md, - "{}\n", - render_signature_html(&ti.signature, &ti.rich_signature) - ) - .unwrap(); - } - - for method in &ti.methods { - writeln!(md, "#### `{}`\n", method.name).unwrap(); - if !method.signature.is_empty() { - writeln!( - md, - "{}\n", - render_signature_html(&method.signature, &method.rich_signature) - ) - .unwrap(); - } - if let Some(docs) = &method.docs { - writeln!(md, "{}\n", docs.body).unwrap(); - } - } - } -} - -fn render_implementors( - md: &mut String, - implementors: &[DocImplementor], - base_url: &str, - collisions: &HashMap<String, Vec<DocItemKind>>, -) { - if implementors.is_empty() { - return; - } - - writeln!(md, "## Implementors\n").unwrap(); - writeln!(md, "| Type | Signature |").unwrap(); - writeln!(md, "|------|-----------|").unwrap(); - for imp in implementors { - let url = item_url(&imp.type_url, DocItemKind::Struct, base_url, collisions); - let sig_cell = if !imp.rich_signature.is_empty() { - let json = serde_json::to_string(&imp.rich_signature).unwrap_or_default(); - format!( - "<fe-signature data='{}'>{}</fe-signature>", - escape_html(&json), - escape_html(&imp.signature), - ) - } else { - format!("<code>{}</code>", escape_html(&imp.signature)) - }; - writeln!(md, "| [{}]({url}) | {sig_cell} |", imp.type_name).unwrap(); - } - writeln!(md).unwrap(); -} - -/// Extract the parent module path from a fully qualified path. -fn parent_module(path: &str) -> &str { - path.rsplit_once("::").map_or(path, |(parent, _)| parent) -} - -// --------------------------------------------------------------------------- -// Tests -// --------------------------------------------------------------------------- - -#[cfg(test)] -mod tests { - use super::*; - - fn sample_index() -> DocIndex { - let mut index = DocIndex::new(); - index.add_item(DocItem { - path: "mylib::Greeter".into(), - name: "Greeter".into(), - kind: DocItemKind::Struct, - visibility: DocVisibility::Public, - docs: Some(DocContent::from_raw("A **friendly** greeter.")), - signature: "pub struct Greeter".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![], - where_bounds: vec![], - children: vec![ - DocChild { - kind: DocChildKind::Field, - name: "name".into(), - docs: Some(DocContent::from_raw("The greeter's name.")), - signature: "name: String".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - visibility: DocVisibility::Public, - }, - DocChild { - kind: DocChildKind::Method, - name: "greet".into(), - docs: Some(DocContent::from_raw("Say hello.")), - signature: "pub fn greet(self)".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - visibility: DocVisibility::Public, - }, - ], - source: None, - source_text: None, - trait_impls: vec![], - implementors: vec![], - }); - index.add_item(DocItem { - path: "mylib::hello".into(), - name: "hello".into(), - kind: DocItemKind::Function, - visibility: DocVisibility::Public, - docs: Some(DocContent::from_raw("A hello function.")), - signature: "pub fn hello()".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![], - where_bounds: vec![], - children: vec![], - source: None, - source_text: None, - trait_impls: vec![], - implementors: vec![], - }); - index.modules = vec![DocModuleTree { - name: "mylib".into(), - path: "mylib".into(), - children: vec![], - items: vec![ - DocModuleItem { - name: "Greeter".into(), - path: "mylib::Greeter".into(), - kind: DocItemKind::Struct, - summary: Some("A friendly greeter.".into()), - }, - DocModuleItem { - name: "hello".into(), - path: "mylib::hello".into(), - kind: DocItemKind::Function, - summary: Some("A hello function.".into()), - }, - ], - }]; - index - } - - #[test] - fn generates_directory_structure() { - let index = sample_index(); - let dir = std::env::temp_dir().join("fe_starlight_test"); - let _ = std::fs::remove_dir_all(&dir); - - generate(&index, &dir, "/api").unwrap(); - - assert!(dir.join("index.md").exists(), "root index"); - assert!(dir.join("mylib/index.md").exists(), "module index"); - assert!(dir.join("mylib/greeter.md").exists(), "struct page"); - assert!(dir.join("mylib/hello.md").exists(), "function page"); - - let _ = std::fs::remove_dir_all(&dir); - } - - #[test] - fn root_index_has_frontmatter() { - let index = sample_index(); - let dir = std::env::temp_dir().join("fe_starlight_root"); - let _ = std::fs::remove_dir_all(&dir); - - generate(&index, &dir, "/api").unwrap(); - - let content = std::fs::read_to_string(dir.join("index.md")).unwrap(); - assert!(content.starts_with("---\n")); - assert!(content.contains("title: API Reference")); - assert!(content.contains("[mylib]")); - - let _ = std::fs::remove_dir_all(&dir); - } - - #[test] - fn item_page_has_badge_and_signature() { - let index = sample_index(); - let dir = std::env::temp_dir().join("fe_starlight_item"); - let _ = std::fs::remove_dir_all(&dir); - - generate(&index, &dir, "/api").unwrap(); - - let content = std::fs::read_to_string(dir.join("mylib/greeter.md")).unwrap(); - assert!(content.contains("text: struct"), "should have struct badge"); - assert!( - content.contains("<fe-code-block") || content.contains("<fe-signature"), - "should use web component for signature, got:\n{content}" - ); - assert!( - content.contains("pub struct Greeter"), - "should have signature text" - ); - assert!( - !content.contains("```fe"), - "should not have fenced code blocks" - ); - assert!(content.contains("## Fields"), "should group fields"); - assert!(content.contains("### `name`"), "should have field heading"); - assert!(content.contains("## Methods"), "should group methods"); - assert!( - content.contains("### `greet`"), - "should have method heading" - ); - assert!(content.contains("**friendly**"), "should have docs body"); - - let _ = std::fs::remove_dir_all(&dir); - } - - #[test] - fn module_page_groups_by_kind() { - let index = sample_index(); - let dir = std::env::temp_dir().join("fe_starlight_mod"); - let _ = std::fs::remove_dir_all(&dir); - - generate(&index, &dir, "/api").unwrap(); - - let content = std::fs::read_to_string(dir.join("mylib/index.md")).unwrap(); - assert!( - content.contains("## Structs"), - "should have Structs section" - ); - assert!( - content.contains("## Functions"), - "should have Functions section" - ); - assert!(content.contains("[Greeter]"), "should link to Greeter"); - assert!(content.contains("[hello]"), "should link to hello"); - - let _ = std::fs::remove_dir_all(&dir); - } - - #[test] - fn writes_component_assets() { - let index = sample_index(); - let dir = std::env::temp_dir().join("fe_starlight_assets"); - let _ = std::fs::remove_dir_all(&dir); - - generate(&index, &dir, "/api").unwrap(); - - let comp = dir.join("_components"); - assert!(comp.join("fe-code-block.js").exists(), "fe-code-block.js"); - assert!(comp.join("fe-signature.js").exists(), "fe-signature.js"); - assert!(comp.join("fe-highlight.css").exists(), "fe-highlight.css"); - - // Verify content is non-empty - let cb = std::fs::read_to_string(comp.join("fe-code-block.js")).unwrap(); - assert!(cb.contains("fe-code-block"), "should contain element name"); - let sig = std::fs::read_to_string(comp.join("fe-signature.js")).unwrap(); - assert!(sig.contains("fe-signature"), "should contain element name"); - let css = std::fs::read_to_string(comp.join("fe-highlight.css")).unwrap(); - assert!(!css.is_empty(), "CSS should be non-empty"); - - let _ = std::fs::remove_dir_all(&dir); - } - - #[test] - fn item_fs_path_basic() { - let no_collisions = HashMap::new(); - assert_eq!( - item_fs_path("mylib::Foo", DocItemKind::Struct, &no_collisions), - std::path::PathBuf::from("mylib/foo.md") - ); - assert_eq!( - item_fs_path("mylib", DocItemKind::Module, &no_collisions), - std::path::PathBuf::from("mylib/index.md") - ); - } - - #[test] - fn item_fs_path_collision() { - let mut collisions = HashMap::new(); - collisions.insert( - "mylib::Foo".to_string(), - vec![DocItemKind::Struct, DocItemKind::Function], - ); - assert_eq!( - item_fs_path("mylib::Foo", DocItemKind::Struct, &collisions), - std::path::PathBuf::from("mylib/foo-struct.md") - ); - assert_eq!( - item_fs_path("mylib::Foo", DocItemKind::Function, &collisions), - std::path::PathBuf::from("mylib/foo-fn.md") - ); - } -} diff --git a/crates/fe-web/src/static_site.rs b/crates/fe-web/src/static_site.rs deleted file mode 100644 index df31ab295e..0000000000 --- a/crates/fe-web/src/static_site.rs +++ /dev/null @@ -1,283 +0,0 @@ -//! Static documentation site generator -//! -//! Produces a single `index.html` that works with `file://` — no server needed. - -use std::path::Path; - -use crate::assets; -use crate::markdown::render_markdown; -use crate::model::DocIndex; - -pub struct StaticSiteGenerator; - -impl StaticSiteGenerator { - /// Generate a static documentation site in `output_dir`. - /// - /// Produces a single `index.html` file with inlined CSS, JS, and JSON. - /// Markdown doc bodies are pre-rendered to HTML and injected as `html_body` - /// fields in the JSON (the Rust types are never modified). - pub fn generate(index: &DocIndex, output_dir: &Path) -> std::io::Result<()> { - Self::generate_with_scip(index, output_dir, None) - } - - /// Generate a static documentation site with optional embedded SCIP data. - /// - /// When `scip_json` is provided, the pre-processed SCIP JSON is embedded - /// inline so the browser can build a ScipStore for interactive symbol - /// resolution (progressive enhancement over the pre-rendered DocIndex). - /// - /// Syntax highlighting and type linking are handled entirely client-side - /// via tree-sitter WASM + ScipStore in the browser. - pub fn generate_with_scip( - index: &DocIndex, - output_dir: &Path, - scip_json: Option<&str>, - ) -> std::io::Result<()> { - Self::generate_full(index, output_dir, scip_json, None) - } - - /// Generate a static documentation site with all optional features. - /// - /// `source_link_base`: e.g. "https://github.com/org/repo/blob/abc123" - pub fn generate_full( - index: &DocIndex, - output_dir: &Path, - scip_json: Option<&str>, - source_link_base: Option<&str>, - ) -> std::io::Result<()> { - Self::generate_impl(index, output_dir, scip_json, source_link_base, true) - } - - /// Generate a split documentation site with separate files: - /// docs.json, index.html (minimal shell), fe-web.js, fe-highlight.css - /// - /// This is the composable output mode — the host site loads the files - /// individually and can override styles via normal CSS cascade. - pub fn generate_split( - index: &DocIndex, - output_dir: &Path, - scip_json: Option<&str>, - source_link_base: Option<&str>, - ) -> std::io::Result<()> { - Self::generate_impl(index, output_dir, scip_json, source_link_base, false) - } - - fn generate_impl( - index: &DocIndex, - output_dir: &Path, - scip_json: Option<&str>, - source_link_base: Option<&str>, - self_contained: bool, - ) -> std::io::Result<()> { - std::fs::create_dir_all(output_dir)?; - - // Serialize to a JSON Value so we can inject html_body fields - let mut value = serde_json::to_value(index).map_err(std::io::Error::other)?; - inject_html_bodies(&mut value); - let json = serde_json::to_string(&value).map_err(std::io::Error::other)?; - let title = index_title(index); - - if self_contained { - let html = assets::html_shell_full(&title, &json, scip_json, source_link_base); - std::fs::write(output_dir.join("index.html"), html)?; - } else { - // Write separate files - let sv = crate::model::SCHEMA_VERSION; - let cv = env!("CARGO_PKG_VERSION"); - let merged = if let Some(scip) = scip_json { - format!( - r#"{{"schema_version":{sv},"compiler_version":"{cv}","index":{json},"scip":{scip}}}"# - ) - } else { - format!(r#"{{"schema_version":{sv},"compiler_version":"{cv}","index":{json}}}"#) - }; - std::fs::write(output_dir.join("docs.json"), &merged)?; - std::fs::write(output_dir.join("fe-web.js"), assets::web_component_bundle())?; - std::fs::write( - output_dir.join("fe-highlight.css"), - assets::FE_HIGHLIGHT_CSS, - )?; - std::fs::write(output_dir.join("styles.css"), assets::STYLES_CSS)?; - - // Minimal shell that loads the separate files - let source_script = if let Some(base) = source_link_base { - format!( - "\n <script>window.FE_SOURCE_BASE = \"{}\";</script>", - crate::escape::escape_script_content(base) - ) - } else { - String::new() - }; - - let html = format!( - r#"<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>{title} - - - - - {source_script} - - -"#, - title = crate::escape::escape_html_text(&title), - source_script = source_script, - ); - std::fs::write(output_dir.join("index.html"), html)?; - } - - Ok(()) - } -} - -/// Walk the JSON and inject `html_body` next to every `docs.body` field. -/// Also injects `html_content` into each doc section for distinct rendering. -pub fn inject_html_bodies(value: &mut serde_json::Value) { - match value { - serde_json::Value::Object(map) => { - // If this object has a "docs" field with a "body", inject "html_body" - if let Some(docs) = map.get_mut("docs") - && let Some(docs_obj) = docs.as_object_mut() - { - if let Some(body) = docs_obj.get("body").and_then(|b| b.as_str()) { - let html = render_markdown(body); - docs_obj.insert("html_body".to_string(), serde_json::Value::String(html)); - } - // Render each section's content to HTML - if let Some(sections) = docs_obj.get_mut("sections") - && let Some(sections_arr) = sections.as_array_mut() - { - for section in sections_arr { - if let Some(section_obj) = section.as_object_mut() - && let Some(content) = - section_obj.get("content").and_then(|c| c.as_str()) - { - let html = render_markdown(content); - section_obj.insert( - "html_content".to_string(), - serde_json::Value::String(html), - ); - } - } - } - } - // Recurse into all values - for v in map.values_mut() { - inject_html_bodies(v); - } - } - serde_json::Value::Array(arr) => { - for v in arr { - inject_html_bodies(v); - } - } - _ => {} - } -} - -/// Derive a title from the index (use the root module name if available). -fn index_title(index: &DocIndex) -> String { - if let Some(root) = index.modules.first() { - format!("{} — Fe Documentation", root.name) - } else { - "Fe Documentation".to_string() - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::model::*; - - fn sample_index() -> DocIndex { - let mut index = DocIndex::new(); - index.add_item(DocItem { - path: "mylib::Greeter".into(), - name: "Greeter".into(), - kind: DocItemKind::Struct, - visibility: DocVisibility::Public, - docs: Some(DocContent::from_raw("A **friendly** greeter.")), - signature: "pub struct Greeter".into(), - rich_signature: vec![], - signature_span: None, - sig_scope: None, - generics: vec![], - where_bounds: vec![], - children: vec![], - source: None, - source_text: None, - trait_impls: vec![], - implementors: vec![], - }); - index.modules = vec![DocModuleTree { - name: "mylib".into(), - path: "mylib".into(), - children: vec![], - items: vec![DocModuleItem { - name: "Greeter".into(), - path: "mylib::Greeter".into(), - kind: DocItemKind::Struct, - summary: Some("A friendly greeter.".into()), - }], - }]; - index - } - - #[test] - fn generates_index_html() { - let index = sample_index(); - let dir = std::env::temp_dir().join("fe_web_static_test"); - let _ = std::fs::remove_dir_all(&dir); - - StaticSiteGenerator::generate(&index, &dir).expect("generate failed"); - - let html_path = dir.join("index.html"); - assert!(html_path.exists(), "index.html should exist"); - - let html = std::fs::read_to_string(&html_path).unwrap(); - - // Contains inlined CSS - assert!(html.contains(":root"), "should contain CSS"); - // Uses fe-doc-viewer component - assert!(html.contains("fe-doc-viewer"), "should use fe-doc-viewer"); - // Contains the JSON data - assert!(html.contains("mylib::Greeter"), "should contain item path"); - // Contains pre-rendered markdown (html_body with ) - assert!(html.contains("html_body"), "should contain html_body key"); - // In the "#.to_string(); - if let Some(pos) = html.rfind("") { - html.insert_str(pos, &connect_script); - } - - html -} - -fn effective_opt_level(optimize: Option<&str>) -> Result { - optimize.unwrap_or("1").parse() -} - -fn run_lsif(path: &Utf8PathBuf, output: Option<&Utf8PathBuf>) { - use driver::DriverDataBase; - - let mut db = DriverDataBase::default(); - - let canonical_path = match path.canonicalize_utf8() { - Ok(p) => p, - Err(_) => { - eprintln!("Error: Invalid or non-existent directory path: {path}"); - std::process::exit(1); - } - }; - - let ingot_url = match url::Url::from_directory_path(canonical_path.as_str()) { - Ok(url) => url, - Err(_) => { - eprintln!("Error: Invalid directory path: {path}"); - std::process::exit(1); - } - }; - - let had_init_diagnostics = driver::init_ingot(&mut db, &ingot_url); - if had_init_diagnostics { - eprintln!("Warning: ingot had initialization diagnostics"); - } - - let result = if let Some(output_path) = output { - let file = match std::fs::File::create(output_path.as_std_path()) { - Ok(f) => f, - Err(e) => { - eprintln!("Error creating output file: {e}"); - std::process::exit(1); - } - }; - let writer = std::io::BufWriter::new(file); - semantic_indexing::lsif::generate_lsif(&db, &ingot_url, writer) - } else { - let stdout = std::io::stdout().lock(); - let writer = std::io::BufWriter::new(stdout); - semantic_indexing::lsif::generate_lsif(&db, &ingot_url, writer) - }; - - if let Err(e) = result { - eprintln!("Error generating LSIF: {e}"); - std::process::exit(1); - } -} - -fn run_scip(path: &Utf8PathBuf, output: &Utf8PathBuf) { - use driver::DriverDataBase; - - let mut db = DriverDataBase::default(); - - let canonical_path = match path.canonicalize_utf8() { - Ok(p) => p, - Err(_) => { - eprintln!("Error: Invalid or non-existent directory path: {path}"); - std::process::exit(1); - } - }; - - let ingot_url = match url::Url::from_directory_path(canonical_path.as_str()) { - Ok(url) => url, - Err(_) => { - eprintln!("Error: Invalid directory path: {path}"); - std::process::exit(1); - } - }; - - let had_init_diagnostics = driver::init_ingot(&mut db, &ingot_url); - if had_init_diagnostics { - eprintln!("Warning: ingot had initialization diagnostics"); - } - - let result = - semantic_indexing::scip_batch::generate_scip(&db, &ingot_url).unwrap_or_else(|e| { - eprintln!("Error generating SCIP: {e}"); - std::process::exit(1); - }); - - if let Err(e) = scip::write_message_to_file(output.as_std_path(), result.index) { - eprintln!("Error writing SCIP file: {e}"); - std::process::exit(1); - } -} - -fn run_root(path: Option<&Utf8PathBuf>) { - use resolver::workspace::discover_context; - - let start = match path { - Some(p) => p.canonicalize_utf8().unwrap_or_else(|e| { - eprintln!("Error: invalid path {p}: {e}"); - std::process::exit(1); - }), - None => Utf8PathBuf::from_path_buf( - std::env::current_dir().expect("Unable to get current directory"), - ) - .expect("Expected utf8 path"), - }; - - let start_url = url::Url::from_directory_path(start.as_str()).unwrap_or_else(|_| { - // Maybe it's a file, try the parent directory - let parent = start.parent().unwrap_or(&start); - url::Url::from_directory_path(parent.as_str()).unwrap_or_else(|_| { - eprintln!("Error: invalid directory path: {start}"); - std::process::exit(1); - }) - }); - - match discover_context(&start_url, false) { - Ok(discovery) => { - if let Some(workspace_root) = &discovery.workspace_root - && let Ok(path) = workspace_root.to_file_path() - { - println!("{}", path.display()); - return; - } - if let Some(ingot_root) = discovery.ingot_roots.first() - && let Ok(path) = ingot_root.to_file_path() - { - println!("{}", path.display()); - return; - } - eprintln!("No fe.toml found in {start} or any parent directory"); - std::process::exit(1); - } - Err(e) => { - eprintln!("Error discovering project root: {e}"); - std::process::exit(1); - } - } -} - -fn run_fmt(path: Option<&Utf8PathBuf>, check: bool) { - let config = fe_fmt::Config::default(); - - // Collect files to format - let files: Vec = match path { - Some(p) if p.is_file() => vec![p.clone()], - Some(p) if p.is_dir() => collect_fe_files(p), - Some(p) => { - eprintln!("Error: Path does not exist: {p}"); - std::process::exit(1); - } - None => { - // Find project root and format all .fe files in src/ - match driver::files::find_project_root() { - Some(root) => collect_fe_files(&root.join("src")), - None => { - eprintln!( - "Error: No fe.toml found. Run from a Fe project directory or specify a path." - ); - std::process::exit(1); - } - } - } - }; - - if files.is_empty() { - eprintln!("Error: No .fe files found"); - std::process::exit(1); - } - - let mut unformatted_files = Vec::new(); - let mut error_count = 0; - - for file in &files { - match format_single_file(file, &config, check) { - FormatResult::Unchanged => {} - FormatResult::Formatted { - original, - formatted, - } => { - if check { - print_diff(file, &original, &formatted); - unformatted_files.push(file.clone()); - } - } - FormatResult::ParseError(errs) => { - eprintln!("Warning: Skipping {file} (parse errors):"); - for err in errs { - eprintln!(" {}", err.msg()); - } - } - FormatResult::IoError(err) => { - eprintln!("Error: Failed to process {file}: {err}"); - error_count += 1; - } - } - } - - if check && !unformatted_files.is_empty() { - std::process::exit(1); - } - - if error_count > 0 { - std::process::exit(1); - } -} - -fn print_diff(path: &Utf8PathBuf, original: &str, formatted: &str) { - let diff = TextDiff::from_lines(original, formatted); - - println!("{}", format!("Diff {}:", path).bold()); - for hunk in diff.unified_diff().context_radius(3).iter_hunks() { - // Print hunk header - println!("{}", format!("{}", hunk.header()).cyan()); - for change in hunk.iter_changes() { - match change.tag() { - ChangeTag::Delete => print!("{}", format!("-{}", change).red()), - ChangeTag::Insert => print!("{}", format!("+{}", change).green()), - ChangeTag::Equal => print!(" {}", change), - }; - } - } - println!(); -} - -fn collect_fe_files(dir: &Utf8PathBuf) -> Vec { - if !dir.exists() { - return Vec::new(); - } - - WalkDir::new(dir) - .into_iter() - .filter_map(|e| e.ok()) - .filter(|e| e.file_type().is_file()) - .filter(|e| e.path().extension().is_some_and(|ext| ext == "fe")) - .filter_map(|e| Utf8PathBuf::from_path_buf(e.into_path()).ok()) - .collect() -} - -enum FormatResult { - Unchanged, - Formatted { original: String, formatted: String }, - ParseError(Vec), - IoError(std::io::Error), -} - -fn format_single_file(path: &Utf8PathBuf, config: &fe_fmt::Config, check: bool) -> FormatResult { - let original = match fs::read_to_string(path.as_std_path()) { - Ok(s) => s, - Err(e) => return FormatResult::IoError(e), - }; - - let formatted = match fe_fmt::format_str(&original, config) { - Ok(f) => f, - Err(fe_fmt::FormatError::ParseErrors(errs)) => return FormatResult::ParseError(errs), - Err(fe_fmt::FormatError::Io(e)) => return FormatResult::IoError(e), - }; - - if formatted == original { - return FormatResult::Unchanged; - } - - if !check { - if let Err(e) = fs::write(path.as_std_path(), &formatted) { - return FormatResult::IoError(e); - } - println!("Formatted {}", path); - } - - FormatResult::Formatted { - original, - formatted, - } -} diff --git a/crates/fe/src/report.rs b/crates/fe/src/report.rs deleted file mode 100644 index 761fe7b166..0000000000 --- a/crates/fe/src/report.rs +++ /dev/null @@ -1,349 +0,0 @@ -use camino::Utf8PathBuf; -use std::{cell::RefCell, sync::OnceLock}; - -pub fn sanitize_filename(component: &str) -> String { - component - .chars() - .map(|ch| if ch.is_ascii_alphanumeric() { ch } else { '_' }) - .collect() -} - -pub fn normalize_report_out_path(out: &Utf8PathBuf) -> Result { - let s = out.as_str(); - if !s.ends_with(".tar.gz") { - return Err(format!( - "report output path must end with `.tar.gz`: `{out}`" - )); - } - - if !out.exists() { - return Ok(out.clone()); - } - - let base = s.strip_suffix(".tar.gz").expect("checked .tar.gz suffix"); - for idx in 1.. { - let candidate = Utf8PathBuf::from(format!("{base}-{idx}.tar.gz")); - if !candidate.exists() { - return Ok(candidate); - } - } - unreachable!() -} - -pub fn create_dir_all_utf8(path: &Utf8PathBuf) -> Result<(), String> { - std::fs::create_dir_all(path).map_err(|err| format!("failed to create dir `{path}`: {err}")) -} - -pub fn create_report_staging_dir(base: &str) -> Result { - let base = Utf8PathBuf::from(base); - let _ = std::fs::create_dir_all(&base); - let pid = std::process::id(); - let nanos = std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .map(|d| d.as_nanos()) - .unwrap_or(0); - let dir = base.join(format!("report-{pid}-{nanos}")); - create_dir_all_utf8(&dir)?; - Ok(dir) -} - -#[derive(Debug, Clone)] -pub struct ReportStaging { - pub root_dir: Utf8PathBuf, - pub temp_dir: Utf8PathBuf, -} - -pub fn create_report_staging_root(base: &str, root_name: &str) -> Result { - let temp_dir = create_report_staging_dir(base)?; - let root_dir = temp_dir.join(root_name); - create_dir_all_utf8(&root_dir)?; - Ok(ReportStaging { root_dir, temp_dir }) -} - -pub fn tar_gz_dir(staging: &Utf8PathBuf, out: &Utf8PathBuf) -> Result<(), String> { - let parent = staging - .parent() - .ok_or_else(|| "missing staging parent".to_string())?; - let name = staging - .file_name() - .ok_or_else(|| "missing staging basename".to_string())?; - - let status = std::process::Command::new("tar") - .arg("-czf") - .arg(out.as_str()) - .arg("-C") - .arg(parent.as_str()) - .arg(name) - .status() - .map_err(|err| format!("failed to run tar: {err}"))?; - - if !status.success() { - return Err(format!("tar exited with status {status}")); - } - Ok(()) -} - -pub fn copy_input_into_report(input: &Utf8PathBuf, inputs_dir: &Utf8PathBuf) -> Result<(), String> { - if input.is_file() { - let name = input - .file_name() - .map(|s| s.to_string()) - .unwrap_or_else(|| "input.fe".to_string()); - let dest = inputs_dir.join(name); - std::fs::copy(input, &dest) - .map_err(|err| format!("failed to copy `{input}` to `{dest}`: {err}"))?; - return Ok(()); - } - - if !input.is_dir() { - return Ok(()); - } - - // Keep the report small but useful: include `fe.toml` and all `.fe` sources under `src/`. - let fe_toml = input.join("fe.toml"); - if fe_toml.is_file() { - let dest = inputs_dir.join("fe.toml"); - let _ = std::fs::copy(fe_toml, dest); - } - - let src_dir = input.join("src"); - if !src_dir.is_dir() { - return Ok(()); - } - - let dest_src = inputs_dir.join("src"); - create_dir_all_utf8(&dest_src)?; - - for entry in walkdir::WalkDir::new(src_dir.as_std_path()) - .follow_links(false) - .into_iter() - .filter_map(Result::ok) - { - let path = entry.path(); - if !path.is_file() { - continue; - } - if path.extension().and_then(|s| s.to_str()) != Some("fe") { - continue; - } - let rel = match path.strip_prefix(src_dir.as_std_path()) { - Ok(rel) => rel, - Err(_) => continue, - }; - let rel = match Utf8PathBuf::from_path_buf(rel.to_path_buf()) { - Ok(p) => p, - Err(_) => continue, - }; - let dest = dest_src.join(rel); - if let Some(parent) = dest.parent() { - let _ = std::fs::create_dir_all(parent); - } - let _ = std::fs::copy(path, dest); - } - Ok(()) -} - -pub fn panic_payload_to_string(payload: &(dyn std::any::Any + Send)) -> String { - if let Some(s) = payload.downcast_ref::<&'static str>() { - (*s).to_string() - } else if let Some(s) = payload.downcast_ref::() { - s.clone() - } else { - "panic payload is not a string".to_string() - } -} - -thread_local! { - static PANIC_REPORT_PATH: RefCell> = const { RefCell::new(None) }; -} - -static PANIC_REPORT_INSTALL: OnceLock<()> = OnceLock::new(); - -fn install_panic_reporter_once() { - let _ = PANIC_REPORT_INSTALL.get_or_init(|| { - let old = std::panic::take_hook(); - std::panic::set_hook(Box::new(move |info| { - // Never panic inside a panic hook: that would abort the process and can prevent reports - // from being written. - let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { - let path = PANIC_REPORT_PATH.with(|p| p.borrow().clone()); - if let Some(path) = path { - let bt = std::backtrace::Backtrace::force_capture(); - let mut msg = String::new(); - msg.push_str("panic while running `fe`\n\n"); - msg.push_str(&format!("{info}\n\n")); - msg.push_str(&format!("backtrace:\n{bt:?}\n")); - let _ = std::fs::write(&path, msg); - } - - // Keep the default stderr output for interactive runs. - (old)(info); - })); - })); - }); -} - -pub struct PanicReportGuard { - prev: Option, -} - -impl Drop for PanicReportGuard { - fn drop(&mut self) { - let prev = self.prev.take(); - PANIC_REPORT_PATH.with(|p| { - *p.borrow_mut() = prev; - }); - } -} - -pub fn enable_panic_report(path: Utf8PathBuf) -> PanicReportGuard { - install_panic_reporter_once(); - let prev = PANIC_REPORT_PATH.with(|p| p.borrow().clone()); - PANIC_REPORT_PATH.with(|p| { - *p.borrow_mut() = Some(path); - }); - PanicReportGuard { prev } -} - -fn find_git_repo_root(start: &Utf8PathBuf) -> Option { - let mut dir = start.clone(); - loop { - if dir.join(".git").exists() { - return Some(dir); - } - let parent = dir.parent()?.to_owned(); - if parent == dir { - return None; - } - dir = parent; - } -} - -fn capture_cmd(cwd: &Utf8PathBuf, program: &str, args: &[&str]) -> Option { - let output = std::process::Command::new(program) - .args(args) - .current_dir(cwd.as_std_path()) - .output() - .ok()?; - let mut text = String::new(); - text.push_str(&String::from_utf8_lossy(&output.stdout)); - text.push_str(&String::from_utf8_lossy(&output.stderr)); - Some(text.trim().to_string()) -} - -fn write_best_effort(path: &Utf8PathBuf, contents: impl AsRef<[u8]>) { - let _ = std::fs::write(path, contents); -} - -pub fn write_report_meta(root: &Utf8PathBuf, kind: &str, suite: Option<&str>) { - let meta = root.join("meta"); - let _ = std::fs::create_dir_all(meta.as_std_path()); - - write_best_effort(&meta.join("kind.txt"), format!("{kind}\n")); - if let Some(suite) = suite { - write_best_effort(&meta.join("suite.txt"), format!("{suite}\n")); - } - - if let Ok(cwd) = std::env::current_dir() - && let Ok(cwd) = Utf8PathBuf::from_path_buf(cwd) - { - write_best_effort(&meta.join("cwd.txt"), format!("{cwd}\n")); - } - - let mut args = String::new(); - for a in std::env::args() { - args.push_str(&a); - args.push('\n'); - } - write_best_effort(&meta.join("args.txt"), args); - - let keys = ["RUST_BACKTRACE"]; - let mut env_txt = String::new(); - for k in keys { - if let Ok(v) = std::env::var(k) { - env_txt.push_str(k); - env_txt.push('='); - env_txt.push_str(&v); - env_txt.push('\n'); - } - } - if !env_txt.is_empty() { - write_best_effort(&meta.join("env.txt"), env_txt); - } - - if let Ok(manifest_dir) = - Utf8PathBuf::from_path_buf(std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))) - && let Some(repo) = find_git_repo_root(&manifest_dir) - { - let mut git_txt = String::new(); - git_txt.push_str(&format!("fe_repo: {repo}\n")); - if let Some(head) = capture_cmd(&repo, "git", &["rev-parse", "HEAD"]) { - git_txt.push_str(&format!("fe_head: {head}\n")); - } - if let Some(status) = capture_cmd(&repo, "git", &["status", "--porcelain=v1"]) { - let dirty = if status.trim().is_empty() { - "no" - } else { - "yes" - }; - git_txt.push_str(&format!("fe_dirty: {dirty}\n")); - } - - let sonatina_guess = repo.join("../sonatina"); - if sonatina_guess.exists() - && let Some(sonatina_repo) = find_git_repo_root(&sonatina_guess) - { - git_txt.push_str(&format!("\nsonatina_repo: {sonatina_repo}\n")); - if let Some(head) = capture_cmd(&sonatina_repo, "git", &["rev-parse", "HEAD"]) { - git_txt.push_str(&format!("sonatina_head: {head}\n")); - } - if let Some(status) = capture_cmd(&sonatina_repo, "git", &["status", "--porcelain=v1"]) - { - let dirty = if status.trim().is_empty() { - "no" - } else { - "yes" - }; - git_txt.push_str(&format!("sonatina_dirty: {dirty}\n")); - } - } - - write_best_effort(&meta.join("git.txt"), git_txt); - } - - if let Ok(out) = std::process::Command::new("rustc").arg("-Vv").output() - && out.status.success() - { - let mut txt = String::new(); - txt.push_str(&String::from_utf8_lossy(&out.stdout)); - txt.push_str(&String::from_utf8_lossy(&out.stderr)); - write_best_effort(&meta.join("rustc.txt"), txt); - } -} - -pub fn is_verifier_error_text(text: &str) -> bool { - let normalized = text.to_ascii_lowercase(); - normalized.contains("verifierfailed") - || normalized.contains("verificationreport") - || normalized.contains("verifier failed") -} - -#[cfg(test)] -mod tests { - use super::is_verifier_error_text; - - #[test] - fn detects_verifier_error_markers() { - assert!(is_verifier_error_text( - "internal error: VerifierFailed { report: VerificationReport { ... } }" - )); - assert!(is_verifier_error_text( - "backend verifier failed while compiling module" - )); - } - - #[test] - fn ignores_non_verifier_errors() { - assert!(!is_verifier_error_text("failed to lower MIR")); - } -} diff --git a/crates/fe/src/test/mod.rs b/crates/fe/src/test/mod.rs deleted file mode 100644 index d2d03d7f73..0000000000 --- a/crates/fe/src/test/mod.rs +++ /dev/null @@ -1,2839 +0,0 @@ -//! Test runner for Fe tests. -//! -//! Discovers functions marked with `#[test]` attribute, compiles them, and -//! executes them using revm. - -use crate::TestEmit; -use crate::dependency_diagnostics::DependencyIssues; -use crate::report::{ - PanicReportGuard, ReportStaging, copy_input_into_report, create_dir_all_utf8, - create_report_staging_root, enable_panic_report, is_verifier_error_text, - normalize_report_out_path, panic_payload_to_string, sanitize_filename, tar_gz_dir, - write_report_meta, -}; -use crate::workspace_ingot::{ - INGOT_REQUIRES_WORKSPACE_ROOT, WorkspaceMemberRef, select_workspace_member_paths, -}; -use camino::Utf8PathBuf; -use codegen::{ - ExpectedRevert, OptLevel, SonatinaTestOptions, TestMetadata, TestModuleOutput, - emit_runtime_package_sonatina_ir_optimized, emit_test_ingot_sonatina, - emit_test_module_sonatina, -}; -use colored::Colorize; -use common::{ - InputDb, - config::{Config, WorkspaceMemberSelection}, - ingot::Ingot, -}; -use contract_harness::{EvmTraceOptions, ExecutionOptions, RuntimeInstance, U256}; -use crossbeam_channel::{Receiver, Sender, TryRecvError}; -use driver::DriverDataBase; -use hir::hir_def::{HirIngot, TopLevelMod, item::ItemKind}; -use mir::{build_runtime_package, build_test_runtime_package, format_runtime_package}; -use rustc_hash::{FxHashMap, FxHashSet}; -use salsa::Setter; -use std::{ - collections::HashSet, - fmt::Write as _, - sync::Arc, - time::{Duration, Instant}, -}; -use url::Url; - -const MAX_STREAMED_SUITE_LABEL_CHARS: usize = 20; -const STREAMED_SUITE_LABEL_ELLIPSIS: &str = ".."; -const STREAMED_STATUS_COLUMN_WIDTH: usize = 16; - -#[derive(Debug, Clone, Copy, Default)] -struct TestEmitSelection { - ir: bool, - rmir: bool, -} - -impl TestEmitSelection { - fn from_requested(requested: &[TestEmit]) -> Self { - let mut selection = Self::default(); - for emit in requested { - match emit { - TestEmit::Ir => selection.ir = true, - TestEmit::Rmir => selection.rmir = true, - } - } - selection - } - - fn is_empty(self) -> bool { - !self.ir && !self.rmir - } -} - -fn install_report_panic_hook(report: &ReportContext, filename: &str) -> PanicReportGuard { - let dir = report.root_dir.join("errors"); - let _ = create_dir_all_utf8(&dir); - let path = dir.join(filename); - enable_panic_report(path) -} - -/// Result of running a single test. -#[derive(Debug, Clone)] -pub struct TestResult { - pub name: String, - pub passed: bool, - pub error_message: Option, -} - -#[derive(Debug)] -pub(super) struct TestOutcome { - result: TestResult, - logs: Vec, - trace: Option, - elapsed: Duration, -} - -fn suite_error_result(suite: &str, kind: &str, message: String) -> Vec { - vec![TestResult { - name: format!("{suite}::{kind}"), - passed: false, - error_message: Some(message), - }] -} - -pub(super) fn write_report_error(report: &ReportContext, filename: &str, contents: &str) { - let dir = report.root_dir.join("errors"); - let _ = create_dir_all_utf8(&dir); - let _ = std::fs::write(dir.join(filename), contents); -} - -fn write_codegen_report_error(report: &ReportContext, contents: &str) { - write_report_error(report, "codegen_error.txt", contents); - if is_verifier_error_text(contents) { - write_report_error(report, "verifier_error.txt", contents); - } -} - -#[derive(Debug, Clone)] -pub(super) struct ReportContext { - pub(super) root_dir: Utf8PathBuf, -} - -#[derive(Debug, Clone)] -struct SuitePlan { - index: usize, - path: Utf8PathBuf, - suite: String, - suite_key: String, - suite_report_out: Option, -} - -#[derive(Debug)] -struct SuiteRunResult { - index: usize, - path: Utf8PathBuf, - suite_key: String, - results: Vec, - aggregate_suite_staging: Option, -} - -#[derive(Debug, Clone)] -struct SingleTestJob { - suite_key: String, - case: TestMetadata, - evm_trace: Option, - report_root: Option, -} - -#[derive(Debug)] -enum JobOutcome { - Text { - suite_key: String, - text: String, - }, - Status { - suite_key: String, - kind: StreamStatusKind, - elapsed: Option, - message: String, - }, - SuitePrepared(PreparedSuite), - SingleFinished(Box), - SuiteFinished(SuiteRunResult), -} - -#[derive(Debug, Clone, Copy)] -enum StreamStatusKind { - Compiling, - Ready, - Pass, - Fail, - Error, -} - -#[derive(Debug)] -struct PreparedSuite { - plan: SuitePlan, - results: Vec, - single_jobs: Vec, - aggregate_suite_staging: Option, - build_elapsed: Duration, -} - -#[derive(Debug)] -struct SingleRunResult { - suite_key: String, - result: TestResult, - output: String, - elapsed: Duration, -} - -#[derive(Debug)] -struct SuiteState { - plan: SuitePlan, - results: Vec, - expected_singles: usize, - completed_singles: usize, - aggregate_suite_staging: Option, -} - -#[derive(Debug)] -struct DiscoverResult { - tests: Vec, -} - -#[derive(Debug)] -struct SuitePreparation { - results: Vec, - single_jobs: Vec, -} - -#[derive(Debug)] -struct WorkerSharedConfig { - show_logs: bool, - profile: String, - opt_level: OptLevel, - emit: TestEmitSelection, - debug: TestDebugOptions, - report_failed_only: bool, - aggregate_report: bool, - call_trace: bool, - multi: bool, - use_recovery: bool, -} - -#[derive(Clone, Copy)] -struct RequestedSuiteArtifacts<'a> { - source_path: &'a Utf8PathBuf, - suite_key: &'a str, - filter: Option<&'a str>, - opt_level: OptLevel, - emit: TestEmitSelection, -} - -#[derive(Clone, Debug)] -struct SuiteWorkerConfig { - shared: Arc, - filter: Option, - allow_single_steal: bool, - prefer_single_when_idle: bool, -} - -#[derive(Clone, Debug)] -struct SingleWorkerConfig { - shared: Arc, -} - -#[derive(Debug)] -struct SuiteWorkerChannels { - suite_rx: Receiver, - single_rx: Receiver, - outcome_tx: Sender, -} - -#[derive(Debug)] -struct SingleWorkerChannels { - single_rx: Receiver, - outcome_tx: Sender, -} - -#[derive(Debug)] -struct OutcomeCollectorState { - suite_runs: Vec, - pending_suites: FxHashMap, - next_suite_idx: usize, - in_flight_suites: usize, - max_in_flight_suites: usize, - suite_index_by_key: FxHashMap, - buffer_grouped_output: bool, - grouped_lines: Vec>, -} - -struct OutcomeContext<'a> { - suite_plans: &'a [SuitePlan], - suite_tx: &'a Sender, - single_tx: &'a Sender, - shared: &'a WorkerSharedConfig, - filter: Option<&'a str>, - multi: bool, - suite_label_width: usize, -} - -impl OutcomeCollectorState { - fn new( - suite_plans: &[SuitePlan], - grouped: bool, - multi: bool, - max_in_flight_suites: usize, - ) -> Self { - Self { - suite_runs: Vec::with_capacity(suite_plans.len()), - pending_suites: FxHashMap::default(), - next_suite_idx: 0, - in_flight_suites: 0, - max_in_flight_suites: max_in_flight_suites.max(1), - suite_index_by_key: suite_plans - .iter() - .map(|plan| (plan.suite_key.clone(), plan.index)) - .collect(), - buffer_grouped_output: grouped && multi, - grouped_lines: vec![Vec::new(); suite_plans.len()], - } - } - - fn queue_next_suite(&mut self, ctx: &OutcomeContext<'_>) -> Result<(), String> { - if self.next_suite_idx >= ctx.suite_plans.len() - || self.in_flight_suites >= self.max_in_flight_suites - { - return Ok(()); - } - ctx.suite_tx - .send(ctx.suite_plans[self.next_suite_idx].clone()) - .map_err(|err| format!("failed to queue suite job: {err}"))?; - self.next_suite_idx += 1; - self.in_flight_suites += 1; - Ok(()) - } - - fn queue_initial_suites( - &mut self, - ctx: &OutcomeContext<'_>, - worker_count: usize, - ) -> Result<(), String> { - for _ in 0..worker_count - .min(self.max_in_flight_suites) - .min(ctx.suite_plans.len()) - { - self.queue_next_suite(ctx)?; - } - Ok(()) - } - - fn handle_outcome( - &mut self, - outcome: JobOutcome, - ctx: &OutcomeContext<'_>, - ) -> Result<(), String> { - match outcome { - JobOutcome::Text { suite_key, text } => { - if self.buffer_grouped_output { - let suite_idx = *self.suite_index_by_key.get(&suite_key).ok_or_else(|| { - format!("received text outcome for unknown suite `{suite_key}`") - })?; - append_streamed_multi_output_lines( - &mut self.grouped_lines[suite_idx], - ctx.suite_label_width, - &suite_key, - &text, - ); - } else { - print_streamed_output(ctx.multi, ctx.suite_label_width, &suite_key, &text); - } - } - JobOutcome::Status { - suite_key, - kind, - elapsed, - message, - } => { - if self.buffer_grouped_output { - let suite_idx = *self.suite_index_by_key.get(&suite_key).ok_or_else(|| { - format!("received status outcome for unknown suite `{suite_key}`") - })?; - self.grouped_lines[suite_idx].push(format_streamed_status_line( - true, - ctx.suite_label_width, - &suite_key, - kind, - elapsed, - &message, - )); - } else { - print_streamed_status( - ctx.multi, - ctx.suite_label_width, - &suite_key, - kind, - elapsed, - &message, - ); - } - } - JobOutcome::SuiteFinished(suite_run) => { - let suite_idx = suite_run.index; - if self.in_flight_suites == 0 { - return Err(format!( - "received suite completion for `{}` with no in-flight suites", - suite_run.suite_key - )); - } - self.in_flight_suites -= 1; - self.suite_runs.push(suite_run); - if self.buffer_grouped_output { - self.flush_grouped_suite_lines(suite_idx)?; - } - self.queue_next_suite(ctx)?; - } - JobOutcome::SuitePrepared(prepared) => { - let suite_key = prepared.plan.suite_key.clone(); - let expected_singles = prepared.single_jobs.len(); - let (kind, message) = suite_preparation_status(expected_singles, &prepared.results); - self.pending_suites.insert( - suite_key.clone(), - SuiteState { - plan: prepared.plan, - results: prepared.results, - expected_singles, - completed_singles: 0, - aggregate_suite_staging: prepared.aggregate_suite_staging, - }, - ); - - for single_job in prepared.single_jobs { - ctx.single_tx - .send(single_job) - .map_err(|err| format!("failed to queue single test job: {err}"))?; - } - - if ctx.multi || matches!(kind, StreamStatusKind::Error) { - print_streamed_status( - ctx.multi, - ctx.suite_label_width, - &suite_key, - kind, - Some(prepared.build_elapsed), - &message, - ); - } - self.queue_next_suite(ctx)?; - - if expected_singles == 0 { - self.finalize_pending_suite(&suite_key, ctx)?; - } - } - JobOutcome::SingleFinished(single) => { - let single = *single; - let suite_key = single.suite_key; - let kind = if single.result.passed { - StreamStatusKind::Pass - } else { - StreamStatusKind::Fail - }; - let elapsed = single.elapsed; - let name = single.result.name.clone(); - let output = single.output; - let suite_is_complete = { - let state = self.pending_suites.get_mut(&suite_key).ok_or_else(|| { - format!("received single test outcome for unknown suite `{suite_key}`") - })?; - state.completed_singles += 1; - state.results.push(single.result); - state.completed_singles == state.expected_singles - }; - self.handle_outcome( - JobOutcome::Status { - suite_key: suite_key.clone(), - kind, - elapsed: Some(elapsed), - message: name, - }, - ctx, - )?; - self.handle_outcome( - JobOutcome::Text { - suite_key: suite_key.clone(), - text: output, - }, - ctx, - )?; - if suite_is_complete { - self.finalize_pending_suite(&suite_key, ctx)?; - } - } - } - Ok(()) - } - - fn flush_grouped_suite_lines(&mut self, suite_idx: usize) -> Result<(), String> { - let lines = self - .grouped_lines - .get_mut(suite_idx) - .ok_or_else(|| format!("received suite index out of range: {suite_idx}"))?; - for line in lines.drain(..) { - println!("{line}"); - } - Ok(()) - } - - fn finalize_pending_suite( - &mut self, - suite_key: &str, - ctx: &OutcomeContext<'_>, - ) -> Result<(), String> { - if self.in_flight_suites == 0 { - return Err(format!( - "finalized suite `{suite_key}` with no in-flight suites" - )); - } - self.in_flight_suites -= 1; - finalize_pending_suite( - &mut self.pending_suites, - &mut self.suite_runs, - suite_key, - ctx.multi, - ctx.suite_label_width, - ctx.shared, - ctx.filter, - ); - self.queue_next_suite(ctx) - } -} - -#[derive(Debug, Clone, Default)] -pub struct TestDebugOptions { - pub trace_evm: bool, - pub trace_evm_keep: usize, - pub trace_evm_stack_n: usize, - pub debug_dir: Option, -} - -impl TestDebugOptions { - fn ensure_debug_dir(&self) -> Result<(), String> { - let Some(dir) = &self.debug_dir else { - return Ok(()); - }; - std::fs::create_dir_all(dir) - .map_err(|err| format!("failed to create debug dir `{dir}`: {err}")) - } - - fn evm_trace_options_for_test( - &self, - test_suite: Option<&str>, - test_name: &str, - ) -> Result, String> { - if !self.trace_evm { - return Ok(None); - } - - let mut options = EvmTraceOptions { - keep_steps: self.trace_evm_keep.max(1), - stack_n: self.trace_evm_stack_n, - out_path: None, - write_stderr: true, - }; - - if let Some(dir) = &self.debug_dir { - let mut file = String::new(); - if let Some(suite) = test_suite { - let suite = sanitize_filename(suite); - if !suite.is_empty() { - file.push_str(&suite); - file.push_str("__"); - } - } - file.push_str(&sanitize_filename(test_name)); - if file.is_empty() { - file = "test".to_string(); - } - let path = dir.join(format!("{file}.evm_trace.txt")); - truncate_file(&path)?; - options.out_path = Some(path.into_std_path_buf()); - options.write_stderr = false; - } - - Ok(Some(options)) - } -} - -fn truncate_file(path: &Utf8PathBuf) -> Result<(), String> { - std::fs::write(path, "").map_err(|err| format!("failed to truncate `{path}`: {err}")) -} - -fn plan_suite_report_path( - dir: &Utf8PathBuf, - base: &str, - reserved: &mut FxHashSet, -) -> Utf8PathBuf { - let mut suffix = 0usize; - loop { - let file = if suffix == 0 { - format!("{base}.tar.gz") - } else { - format!("{base}-{suffix}.tar.gz") - }; - let candidate = dir.join(file); - let key = candidate.as_str().to_string(); - if !candidate.exists() && reserved.insert(key) { - return candidate; - } - suffix += 1; - } -} - -fn build_suite_plans( - input_paths: Vec, - report_dir: Option<&Utf8PathBuf>, -) -> Result, String> { - let mut plans = Vec::with_capacity(input_paths.len()); - let mut seen_suite_names: FxHashMap = FxHashMap::default(); - for (index, path) in input_paths.into_iter().enumerate() { - let suite = suite_name_for_path(&path); - let seen = seen_suite_names.entry(suite.clone()).or_insert(0); - *seen += 1; - let suite_key = if *seen == 1 { - suite.clone() - } else { - format!("{suite}-{}", seen) - }; - plans.push(SuitePlan { - index, - path, - suite, - suite_key, - suite_report_out: None, - }); - } - - if let Some(dir) = report_dir { - let mut reserved = FxHashSet::default(); - for plan in &mut plans { - let base = if plan.suite_key.is_empty() { - "tests".to_string() - } else { - sanitize_filename(&plan.suite_key) - }; - plan.suite_report_out = Some(plan_suite_report_path(dir, &base, &mut reserved)); - } - } - - Ok(plans) -} - -fn effective_jobs(requested: usize, suite_count: usize, grouped: bool) -> usize { - let requested = if requested == 0 { - std::thread::available_parallelism() - .map(|n| n.get()) - .unwrap_or(1) - } else { - requested - }; - if grouped { - requested.clamp(1, suite_count.max(1)) - } else { - requested.max(1) - } -} - -fn max_in_flight_suites( - grouped: bool, - suite_worker_count: usize, - single_worker_count: usize, -) -> usize { - if grouped || single_worker_count == 0 { - suite_worker_count.max(1) - } else { - suite_worker_count.saturating_add(1) - } -} - -fn displayed_suite_label(suite_key: &str) -> String { - if suite_key.chars().count() <= MAX_STREAMED_SUITE_LABEL_CHARS { - return suite_key.to_string(); - } - - let keep = MAX_STREAMED_SUITE_LABEL_CHARS.saturating_sub(STREAMED_SUITE_LABEL_ELLIPSIS.len()); - let mut shortened: String = suite_key.chars().take(keep).collect(); - shortened.push_str(STREAMED_SUITE_LABEL_ELLIPSIS); - shortened -} - -/// Run tests in the given path. -/// -/// # Arguments -/// * `paths` - Paths to .fe files or directories containing ingots (supports globs) -/// * `filter` - Optional filter pattern for test names -/// * `show_logs` - Whether to show event logs from test execution -/// * `report_out` - Optional report output path (`.tar.gz`) -/// -/// Returns `Ok(true)` if any tests failed, `Ok(false)` if all passed, -/// or `Err` on fatal setup errors. -#[allow(clippy::too_many_arguments)] -pub fn run_tests( - paths: &[Utf8PathBuf], - ingot: Option<&str>, - filter: Option<&str>, - jobs: usize, - grouped: bool, - show_logs: bool, - profile: &str, - opt_level: OptLevel, - emit: &[TestEmit], - debug: &TestDebugOptions, - report_out: Option<&Utf8PathBuf>, - report_dir: Option<&Utf8PathBuf>, - report_failed_only: bool, - call_trace: bool, - use_recovery: bool, -) -> Result { - let expanded_paths = expand_test_paths(paths)?; - if ingot.is_some() && expanded_paths.len() != 1 { - return Err(INGOT_REQUIRES_WORKSPACE_ROOT.to_string()); - } - let input_paths = expand_workspace_test_paths(expanded_paths, ingot)?; - let suite_plans = build_suite_plans(input_paths, report_dir)?; - if suite_plans.is_empty() { - return Ok(false); - } - let worker_count = effective_jobs(jobs, suite_plans.len(), grouped); - let multi = suite_plans.len() > 1; - let suite_label_width = suite_plans - .iter() - .map(|plan| displayed_suite_label(&plan.suite_key).chars().count()) - .max() - .unwrap_or(0); - if multi { - println!( - "running `fe test` for {} inputs (jobs={worker_count})\n", - suite_plans.len() - ); - } - - if let Some(dir) = report_dir { - create_dir_all_utf8(dir)?; - } - - let report_root = report_out - .map(|out| -> Result<_, String> { - let staging = create_run_report_staging()?; - let out = normalize_report_out_path(out)?; - Ok((out, staging)) - }) - .transpose()?; - - if let Some((_, staging)) = report_root.as_ref() { - let root = &staging.root_dir; - create_dir_all_utf8(&root.join("passed"))?; - create_dir_all_utf8(&root.join("failed"))?; - write_report_meta(root, "fe test report", None); - } - - let filter = filter.map(str::to_owned); - let shared = Arc::new(WorkerSharedConfig { - show_logs, - profile: profile.to_string(), - opt_level, - emit: TestEmitSelection::from_requested(emit), - debug: debug.clone(), - report_failed_only, - aggregate_report: report_root.is_some(), - call_trace, - multi, - use_recovery, - }); - let mut suite_runs = std::thread::scope(|scope| -> Result, String> { - let (suite_tx, suite_rx) = crossbeam_channel::unbounded::(); - let (single_tx, single_rx) = crossbeam_channel::unbounded::(); - let (outcome_tx, outcome_rx) = crossbeam_channel::unbounded::(); - let suite_worker_count = if grouped { - worker_count - } else { - worker_count.saturating_sub(1).max(1).min(suite_plans.len()) - }; - let single_worker_count = worker_count.saturating_sub(suite_worker_count); - let suite_in_flight_limit = - max_in_flight_suites(grouped, suite_worker_count, single_worker_count); - let suite_worker_cfg = SuiteWorkerConfig { - shared: Arc::clone(&shared), - filter: filter.clone(), - allow_single_steal: !grouped, - prefer_single_when_idle: single_worker_count == 0, - }; - - for _ in 0..suite_worker_count { - let cfg = suite_worker_cfg.clone(); - let channels = SuiteWorkerChannels { - suite_rx: suite_rx.clone(), - single_rx: single_rx.clone(), - outcome_tx: outcome_tx.clone(), - }; - if grouped { - scope.spawn(move || suite_worker_loop_grouped(channels, cfg)); - } else { - scope.spawn(move || suite_worker_loop_parallel(channels, cfg)); - } - } - - let single_worker_cfg = SingleWorkerConfig { - shared: Arc::clone(&shared), - }; - for _ in 0..single_worker_count { - let cfg = single_worker_cfg.clone(); - let channels = SingleWorkerChannels { - single_rx: single_rx.clone(), - outcome_tx: outcome_tx.clone(), - }; - scope.spawn(move || single_worker_loop(channels, cfg)); - } - drop(outcome_tx); - - let ctx = OutcomeContext { - suite_plans: &suite_plans, - suite_tx: &suite_tx, - single_tx: &single_tx, - shared: shared.as_ref(), - filter: filter.as_deref(), - multi, - suite_label_width, - }; - let mut collector = - OutcomeCollectorState::new(&suite_plans, grouped, multi, suite_in_flight_limit); - collector.queue_initial_suites(&ctx, suite_worker_count)?; - - while collector.suite_runs.len() < suite_plans.len() { - let outcome = outcome_rx - .recv() - .map_err(|err| format!("suite worker failed: {err}"))?; - collector.handle_outcome(outcome, &ctx)?; - } - - drop(single_tx); - drop(suite_tx); - Ok(collector.suite_runs) - })?; - - suite_runs.sort_unstable_by_key(|run| run.index); - - let mut test_results = Vec::new(); - for suite_run in suite_runs { - let SuiteRunResult { - path, - suite_key, - results, - aggregate_suite_staging, - .. - } = suite_run; - - let suite_failed = results.iter().any(|r| !r.passed); - if results.is_empty() { - eprintln!("Warning: No tests found in {path}"); - } else { - test_results.extend(results); - } - - if let Some((_, root_staging)) = &report_root - && let Some(staging) = aggregate_suite_staging - { - let status_dir = if suite_failed { "failed" } else { "passed" }; - let to = root_staging.root_dir.join(status_dir).join(&suite_key); - let _ = std::fs::remove_dir_all(&to); - match std::fs::rename(&staging.root_dir, &to) { - Ok(()) => { - let _ = std::fs::remove_dir_all(&staging.temp_dir); - } - Err(err) => { - eprintln!("Error: failed to stage suite report `{suite_key}`: {err}"); - eprintln!("Report staging directory left at `{}`", staging.temp_dir); - } - } - } - } - - if let Some((out, staging)) = report_root { - write_report_manifest( - &staging.root_dir, - opt_level, - filter.as_deref(), - &test_results, - ); - if let Err(err) = tar_gz_dir(&staging.root_dir, &out) { - eprintln!("Error: failed to write report `{out}`: {err}"); - eprintln!("Report staging directory left at `{}`", staging.temp_dir); - } else { - // Best-effort cleanup. - let _ = std::fs::remove_dir_all(&staging.temp_dir); - println!("wrote report: {out}"); - } - } - - print_summary(&test_results); - Ok(test_results.iter().any(|r| !r.passed)) -} - -fn print_streamed_output(multi: bool, suite_label_width: usize, suite_key: &str, text: &str) { - if text.is_empty() { - return; - } - if !multi { - print!("{text}"); - return; - } - - let mut lines = Vec::new(); - append_streamed_multi_output_lines(&mut lines, suite_label_width, suite_key, text); - for line in lines { - println!("{line}"); - } -} - -fn print_streamed_status( - multi: bool, - suite_label_width: usize, - suite_key: &str, - kind: StreamStatusKind, - elapsed: Option, - message: &str, -) { - println!( - "{}", - format_streamed_status_line(multi, suite_label_width, suite_key, kind, elapsed, message) - ); -} - -fn append_streamed_multi_output_lines( - lines: &mut Vec, - suite_label_width: usize, - suite_key: &str, - text: &str, -) { - if text.is_empty() { - return; - } - - let suite = format!("{:, - message: &str, -) -> String { - let status = format_streamed_status(kind, elapsed); - if !multi { - let status = colorize_streamed_status(kind, &status); - return if message.is_empty() { - status - } else { - format!("{status} {message}") - }; - } - - let status = - colorize_streamed_status(kind, &format!("{status:) -> String { - let label = match kind { - StreamStatusKind::Compiling => return "COMPILING".to_string(), - StreamStatusKind::Ready => "READY", - StreamStatusKind::Pass => "PASS ", - StreamStatusKind::Fail => "FAIL ", - StreamStatusKind::Error => "ERROR", - }; - format!( - "{label} [{}s]", - format_elapsed_seconds_cell(elapsed.unwrap_or_default()) - ) -} - -fn suite_preparation_status( - expected_singles: usize, - results: &[TestResult], -) -> (StreamStatusKind, String) { - if results.iter().any(|result| !result.passed) { - let message = results - .iter() - .find(|result| !result.passed) - .and_then(|result| result.error_message.as_deref()) - .and_then(|message| message.lines().next()) - .map(str::trim) - .filter(|message| !message.is_empty()) - .map(str::to_owned) - .unwrap_or_else(|| "suite preparation failed".to_string()); - return (StreamStatusKind::Error, message); - } - - let label = if expected_singles == 1 { - "test" - } else { - "tests" - }; - ( - StreamStatusKind::Ready, - format!("running {expected_singles} {label}"), - ) -} - -fn colorize_streamed_status(kind: StreamStatusKind, status: &str) -> String { - let colorize = |s: &str| match kind { - StreamStatusKind::Pass => format!("{}", s.green()), - StreamStatusKind::Fail | StreamStatusKind::Error => format!("{}", s.red()), - StreamStatusKind::Ready | StreamStatusKind::Compiling => format!("{}", s.blue()), - }; - if let Some(open) = status.find('[') - && let Some(close_rel) = status[open..].find(']') - { - let close = open + close_rel; - let left = &status[..open]; - let time = &status[open..=close]; - let right = &status[close + 1..]; - let left = colorize(left); - return format!("{left}{}{}", time.white(), right); - } - colorize(status) -} - -fn emit_single_outcome( - job: SingleTestJob, - outcome_tx: &Sender, - shared: &WorkerSharedConfig, -) { - let single = run_single_test_job(job, shared); - let _ = outcome_tx.send(JobOutcome::SingleFinished(Box::new(single))); -} - -fn emit_parallel_suite_outcome( - plan: SuitePlan, - outcome_tx: &Sender, - cfg: &SuiteWorkerConfig, -) { - if cfg.shared.multi { - let _ = outcome_tx.send(JobOutcome::Status { - suite_key: plan.suite_key.clone(), - kind: StreamStatusKind::Compiling, - elapsed: None, - message: plan.path.to_string(), - }); - } - let (prepared, output) = prepare_suite_job(&plan, cfg.filter.as_deref(), cfg.shared.as_ref()); - if !output.is_empty() { - let _ = outcome_tx.send(JobOutcome::Text { - suite_key: plan.suite_key.clone(), - text: output, - }); - } - let _ = outcome_tx.send(JobOutcome::SuitePrepared(prepared)); -} - -fn emit_grouped_suite_outcome( - plan: SuitePlan, - outcome_tx: &Sender, - cfg: &SuiteWorkerConfig, -) { - if cfg.shared.multi { - let _ = outcome_tx.send(JobOutcome::Status { - suite_key: plan.suite_key.clone(), - kind: StreamStatusKind::Compiling, - elapsed: None, - message: plan.path.to_string(), - }); - } - let (prepared, output) = prepare_suite_job(&plan, cfg.filter.as_deref(), cfg.shared.as_ref()); - if !output.is_empty() { - let _ = outcome_tx.send(JobOutcome::Text { - suite_key: plan.suite_key.clone(), - text: output, - }); - } - if cfg.shared.multi { - let (kind, message) = - suite_preparation_status(prepared.single_jobs.len(), &prepared.results); - let _ = outcome_tx.send(JobOutcome::Status { - suite_key: plan.suite_key.clone(), - kind, - elapsed: Some(prepared.build_elapsed), - message, - }); - } - - let mut state = SuiteState { - plan: prepared.plan, - results: prepared.results, - expected_singles: prepared.single_jobs.len(), - completed_singles: 0, - aggregate_suite_staging: prepared.aggregate_suite_staging, - }; - for single_job in prepared.single_jobs { - let single = run_single_test_job(single_job, cfg.shared.as_ref()); - let _ = outcome_tx.send(JobOutcome::Status { - suite_key: single.suite_key.clone(), - kind: if single.result.passed { - StreamStatusKind::Pass - } else { - StreamStatusKind::Fail - }, - elapsed: Some(single.elapsed), - message: single.result.name.clone(), - }); - if !single.output.is_empty() { - let _ = outcome_tx.send(JobOutcome::Text { - suite_key: single.suite_key.clone(), - text: single.output, - }); - } - state.completed_singles += 1; - state.results.push(single.result); - } - let (suite_run, output) = - finalize_suite_state(state, cfg.shared.as_ref(), cfg.filter.as_deref()); - if !output.is_empty() { - let _ = outcome_tx.send(JobOutcome::Text { - suite_key: plan.suite_key.clone(), - text: output, - }); - } - let _ = outcome_tx.send(JobOutcome::SuiteFinished(suite_run)); -} - -fn single_worker_loop(channels: SingleWorkerChannels, cfg: SingleWorkerConfig) { - while let Ok(job) = channels.single_rx.recv() { - emit_single_outcome(job, &channels.outcome_tx, cfg.shared.as_ref()); - } -} - -fn drain_pending_single_jobs( - single_rx: &Receiver, - outcome_tx: &Sender, - shared: &WorkerSharedConfig, -) { - while let Ok(job) = single_rx.recv() { - emit_single_outcome(job, outcome_tx, shared); - } -} - -fn suite_worker_loop_grouped(channels: SuiteWorkerChannels, cfg: SuiteWorkerConfig) { - while let Ok(plan) = channels.suite_rx.recv() { - emit_grouped_suite_outcome(plan, &channels.outcome_tx, &cfg); - } -} - -fn suite_worker_loop_parallel(channels: SuiteWorkerChannels, cfg: SuiteWorkerConfig) { - let SuiteWorkerChannels { - suite_rx, - single_rx, - outcome_tx, - } = channels; - loop { - if cfg.allow_single_steal - && cfg.prefer_single_when_idle - && let Ok(job) = single_rx.try_recv() - { - emit_single_outcome(job, &outcome_tx, cfg.shared.as_ref()); - continue; - } - - match suite_rx.try_recv() { - Ok(plan) => { - emit_parallel_suite_outcome(plan, &outcome_tx, &cfg); - continue; - } - Err(TryRecvError::Disconnected) => { - if cfg.allow_single_steal { - drain_pending_single_jobs(&single_rx, &outcome_tx, cfg.shared.as_ref()); - } - break; - } - Err(TryRecvError::Empty) => {} - } - - if cfg.allow_single_steal - && !cfg.prefer_single_when_idle - && let Ok(job) = single_rx.try_recv() - { - emit_single_outcome(job, &outcome_tx, cfg.shared.as_ref()); - continue; - } - - if !cfg.allow_single_steal { - match suite_rx.recv() { - Ok(plan) => emit_parallel_suite_outcome(plan, &outcome_tx, &cfg), - Err(_) => break, - } - continue; - } - - if cfg.prefer_single_when_idle { - crossbeam_channel::select_biased! { - recv(single_rx) -> single => { - match single { - Ok(job) => emit_single_outcome(job, &outcome_tx, cfg.shared.as_ref()), - Err(_) => { - match suite_rx.recv() { - Ok(plan) => emit_parallel_suite_outcome(plan, &outcome_tx, &cfg), - Err(_) => break, - } - } - } - } - recv(suite_rx) -> suite => { - match suite { - Ok(plan) => emit_parallel_suite_outcome(plan, &outcome_tx, &cfg), - Err(_) => { - drain_pending_single_jobs(&single_rx, &outcome_tx, cfg.shared.as_ref()); - break; - } - } - } - } - } else { - crossbeam_channel::select_biased! { - recv(suite_rx) -> suite => { - match suite { - Ok(plan) => emit_parallel_suite_outcome(plan, &outcome_tx, &cfg), - Err(_) => { - drain_pending_single_jobs(&single_rx, &outcome_tx, cfg.shared.as_ref()); - break; - } - } - } - recv(single_rx) -> single => { - if let Ok(job) = single { - emit_single_outcome(job, &outcome_tx, cfg.shared.as_ref()); - } - } - } - } - } -} - -fn prepare_suite_job( - plan: &SuitePlan, - filter: Option<&str>, - shared: &WorkerSharedConfig, -) -> (PreparedSuite, String) { - let mut output = String::new(); - - let suite_report_staging = if plan.suite_report_out.is_some() || shared.aggregate_report { - match create_suite_report_staging(&plan.suite_key) { - Ok(staging) => Some(staging), - Err(err) => { - return ( - PreparedSuite { - plan: plan.clone(), - results: suite_error_result(&plan.suite, "setup", err), - single_jobs: Vec::new(), - aggregate_suite_staging: None, - build_elapsed: Duration::default(), - }, - output, - ); - } - } - } else { - None - }; - - let report_ctx = if let Some(staging) = suite_report_staging.as_ref() { - let suite_dir = staging.root_dir.clone(); - write_report_meta(&suite_dir, "fe test report (suite)", Some(&plan.suite)); - let inputs_dir = suite_dir.join("inputs"); - if let Err(err) = create_dir_all_utf8(&inputs_dir).and_then(|_| { - copy_input_into_report(&plan.path, &inputs_dir)?; - Ok(()) - }) { - return ( - PreparedSuite { - plan: plan.clone(), - results: suite_error_result(&plan.suite, "setup", err), - single_jobs: Vec::new(), - aggregate_suite_staging: None, - build_elapsed: Duration::default(), - }, - output, - ); - } - Some(ReportContext { - root_dir: suite_dir, - }) - } else { - None - }; - - let mut suite_debug = shared.debug.clone(); - if report_ctx.is_some() { - suite_debug.trace_evm = true; - suite_debug.debug_dir = report_ctx.as_ref().map(|ctx| ctx.root_dir.join("debug")); - } - if let Err(err) = suite_debug.ensure_debug_dir() { - return ( - PreparedSuite { - plan: plan.clone(), - results: suite_error_result(&plan.suite, "setup", err), - single_jobs: Vec::new(), - aggregate_suite_staging: None, - build_elapsed: Duration::default(), - }, - output, - ); - } - let sonatina_options = SonatinaTestOptions { - emit_observability: report_ctx.is_some(), - }; - - let build_started = Instant::now(); - let mut db = DriverDataBase::default(); - db.compiler_options() - .set_recovery_mode(&mut db) - .to(shared.use_recovery); - db.compilation_settings() - .set_profile(&mut db) - .to(shared.profile.clone().into()); - let prep = if plan.path.is_file() && plan.path.extension() == Some("fe") { - prepare_tests_single_file( - &mut db, - &plan.path, - &plan.suite, - &plan.suite_key, - filter, - shared.opt_level, - shared.emit, - &suite_debug, - sonatina_options, - report_ctx.as_ref(), - &mut output, - ) - } else if plan.path.is_dir() { - prepare_tests_ingot( - &mut db, - &plan.path, - &plan.suite, - &plan.suite_key, - filter, - shared.opt_level, - shared.emit, - &suite_debug, - sonatina_options, - report_ctx.as_ref(), - &mut output, - ) - } else { - SuitePreparation { - results: suite_error_result( - &plan.suite, - "setup", - "Path must be either a .fe file or a directory containing fe.toml".to_string(), - ), - single_jobs: Vec::new(), - } - }; - - ( - PreparedSuite { - plan: plan.clone(), - results: prep.results, - single_jobs: prep.single_jobs, - aggregate_suite_staging: suite_report_staging, - build_elapsed: build_started.elapsed(), - }, - output, - ) -} - -fn run_single_test_job(job: SingleTestJob, shared: &WorkerSharedConfig) -> SingleRunResult { - let report_ctx = job.report_root.as_ref().map(|root| ReportContext { - root_dir: root.clone(), - }); - let case = job.case; - let outcome = compile_and_run_test( - &case, - shared.show_logs, - job.evm_trace.as_ref(), - report_ctx.as_ref(), - shared.call_trace, - ); - let elapsed = outcome.elapsed; - let mut output = String::new(); - write_case_output(&mut output, &outcome, shared.show_logs); - SingleRunResult { - suite_key: job.suite_key, - result: outcome.result, - output, - elapsed, - } -} - -fn finalize_pending_suite( - pending_suites: &mut FxHashMap, - suite_runs: &mut Vec, - suite_key: &str, - multi: bool, - suite_label_width: usize, - shared: &WorkerSharedConfig, - filter: Option<&str>, -) { - let state = pending_suites - .remove(suite_key) - .expect("suite state should be present"); - let (suite_run, output) = finalize_suite_state(state, shared, filter); - if !output.is_empty() { - print_streamed_output(multi, suite_label_width, suite_key, &output); - } - suite_runs.push(suite_run); -} - -fn finalize_suite_state( - state: SuiteState, - shared: &WorkerSharedConfig, - filter: Option<&str>, -) -> (SuiteRunResult, String) { - let mut output = String::new(); - let mut aggregate_suite_staging = state.aggregate_suite_staging; - if let Some(out) = &state.plan.suite_report_out - && let Some(staging) = aggregate_suite_staging.take() - { - let should_write = !shared.report_failed_only || state.results.iter().any(|r| !r.passed); - if should_write { - write_report_manifest(&staging.root_dir, shared.opt_level, filter, &state.results); - match tar_gz_dir(&staging.root_dir, out) { - Ok(()) => { - let _ = std::fs::remove_dir_all(&staging.temp_dir); - let _ = writeln!(&mut output, "wrote report: {out}"); - } - Err(err) => { - let _ = writeln!(&mut output, "Error: failed to write report `{out}`: {err}"); - let _ = writeln!( - &mut output, - "Report staging directory left at `{}`", - staging.temp_dir - ); - } - } - } else { - let _ = std::fs::remove_dir_all(&staging.temp_dir); - } - } - - ( - SuiteRunResult { - index: state.plan.index, - path: state.plan.path, - suite_key: state.plan.suite_key, - results: state.results, - aggregate_suite_staging, - }, - output, - ) -} - -#[allow(clippy::too_many_arguments)] -fn prepare_tests_single_file( - db: &mut DriverDataBase, - file_path: &Utf8PathBuf, - suite: &str, - suite_key: &str, - filter: Option<&str>, - opt_level: OptLevel, - emit: TestEmitSelection, - debug: &TestDebugOptions, - sonatina_options: SonatinaTestOptions, - report: Option<&ReportContext>, - output: &mut String, -) -> SuitePreparation { - let canonical = match file_path.canonicalize_utf8() { - Ok(p) => p, - Err(e) => { - return SuitePreparation { - results: suite_error_result( - suite, - "setup", - format!("Cannot canonicalize {file_path}: {e}"), - ), - single_jobs: Vec::new(), - }; - } - }; - let file_url = match Url::from_file_path(&canonical) { - Ok(url) => url, - Err(_) => { - return SuitePreparation { - results: suite_error_result( - suite, - "setup", - format!("Invalid file path: {file_path}"), - ), - single_jobs: Vec::new(), - }; - } - }; - - let content = match std::fs::read_to_string(file_path) { - Ok(content) => content, - Err(err) => { - return SuitePreparation { - results: suite_error_result( - suite, - "setup", - format!("Error reading file {file_path}: {err}"), - ), - single_jobs: Vec::new(), - }; - } - }; - - db.workspace().touch(db, file_url.clone(), Some(content)); - let Some(file) = db.workspace().get(db, &file_url) else { - return SuitePreparation { - results: suite_error_result( - suite, - "setup", - format!("Could not process file {file_path}"), - ), - single_jobs: Vec::new(), - }; - }; - let top_mod = db.top_mod(file); - - let hir_diags = db.run_on_top_mod(top_mod); - let mut has_errors = false; - let hir_has_errors = hir_diags.has_errors(db); - let mut formatted = String::new(); - if !hir_diags.is_empty() { - formatted.push_str(&hir_diags.format_diags(db)); - has_errors = true; - } - let mir_diags = if hir_has_errors { - Vec::new() - } else { - db.mir_diagnostics_for_top_mod(top_mod) - }; - if !mir_diags.is_empty() { - formatted.push_str(&db.format_complete_diagnostics(&mir_diags)); - has_errors = true; - } - if has_errors { - let _ = writeln!(output, "Compilation errors in {file_url}"); - let _ = writeln!(output); - let _ = writeln!(output, "{formatted}"); - if let Some(report) = report { - write_report_error(report, "compilation_errors.txt", &formatted); - } - return SuitePreparation { - results: suite_error_result( - suite, - "compile", - format!("Compilation errors in {file_url}"), - ), - single_jobs: Vec::new(), - }; - } - - if !has_test_functions(db, top_mod) { - return SuitePreparation { - results: Vec::new(), - single_jobs: Vec::new(), - }; - } - - maybe_write_suite_ir(db, top_mod, opt_level, report); - match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { - maybe_write_requested_suite_artifacts_for_top_mod( - db, - top_mod, - RequestedSuiteArtifacts { - source_path: file_path, - suite_key, - filter, - opt_level, - emit, - }, - output, - ) - })) { - Ok(Ok(())) => {} - Ok(Err(err)) => { - let msg = format!("Failed to emit requested test artifacts: {err}"); - let _ = writeln!(output, "{msg}"); - if let Some(report) = report { - write_codegen_report_error(report, &msg); - } - return SuitePreparation { - results: suite_error_result(suite, "codegen", msg), - single_jobs: Vec::new(), - }; - } - Err(payload) => { - let msg = format!( - "test artifact emission panicked: {}", - panic_payload_to_string(payload.as_ref()) - ); - let _ = writeln!(output, "{msg}"); - if let Some(report) = report { - write_report_error(report, "codegen_panic.txt", &msg); - } - return SuitePreparation { - results: suite_error_result(suite, "codegen", msg), - single_jobs: Vec::new(), - }; - } - } - prepare_discovered_tests( - db, - top_mod, - suite, - suite_key, - filter, - opt_level, - debug, - sonatina_options, - report, - output, - ) -} - -#[allow(clippy::too_many_arguments)] -fn prepare_tests_ingot( - db: &mut DriverDataBase, - dir_path: &Utf8PathBuf, - suite: &str, - suite_key: &str, - filter: Option<&str>, - opt_level: OptLevel, - emit: TestEmitSelection, - debug: &TestDebugOptions, - sonatina_options: SonatinaTestOptions, - report: Option<&ReportContext>, - output: &mut String, -) -> SuitePreparation { - let canonical_path = match dir_path.canonicalize_utf8() { - Ok(path) => path, - Err(_) => { - return SuitePreparation { - results: suite_error_result( - suite, - "setup", - format!("Invalid or non-existent directory path: {dir_path}"), - ), - single_jobs: Vec::new(), - }; - } - }; - - let ingot_url = match Url::from_directory_path(canonical_path.as_str()) { - Ok(url) => url, - Err(_) => { - return SuitePreparation { - results: suite_error_result( - suite, - "setup", - format!("Invalid directory path: {dir_path}"), - ), - single_jobs: Vec::new(), - }; - } - }; - - let had_init_diagnostics = driver::init_ingot(db, &ingot_url); - if had_init_diagnostics { - let msg = format!("Compilation errors while initializing ingot `{dir_path}`"); - let _ = writeln!(output, "{msg}"); - if let Some(report) = report { - write_report_error(report, "compilation_errors.txt", &msg); - } - return SuitePreparation { - results: suite_error_result(suite, "compile", msg), - single_jobs: Vec::new(), - }; - } - - let Some(ingot) = db.workspace().containing_ingot(db, ingot_url.clone()) else { - return SuitePreparation { - results: suite_error_result( - suite, - "setup", - "Could not resolve ingot from directory".to_string(), - ), - single_jobs: Vec::new(), - }; - }; - - let hir_diags = db.run_on_ingot(ingot); - let mut has_errors = false; - let hir_has_errors = hir_diags.has_errors(db); - let mut formatted = String::new(); - if !hir_diags.is_empty() { - formatted.push_str(&hir_diags.format_diags(db)); - has_errors = true; - } - let mir_diags = if hir_has_errors { - Vec::new() - } else { - db.mir_diagnostics_for_ingot(ingot) - }; - if !mir_diags.is_empty() { - formatted.push_str(&db.format_complete_diagnostics(&mir_diags)); - has_errors = true; - } - if has_errors { - let _ = writeln!(output, "{formatted}"); - if let Some(report) = report { - write_report_error(report, "compilation_errors.txt", &formatted); - } - return SuitePreparation { - results: suite_error_result(suite, "compile", "Compilation errors".to_string()), - single_jobs: Vec::new(), - }; - } - - let mut seen = HashSet::from([ingot_url.clone()]); - let dependency_errors = DependencyIssues::collect(db, &ingot_url, &mut seen); - if !dependency_errors.is_empty() { - let formatted = dependency_errors.format(db); - let _ = write!(output, "{formatted}"); - if let Some(report) = report { - write_report_error(report, "compilation_errors.txt", &formatted); - } - return SuitePreparation { - results: suite_error_result(suite, "compile", dependency_errors.message().to_string()), - single_jobs: Vec::new(), - }; - } - - let root_mod = ingot.root_mod(db); - if !ingot_has_test_functions(db, ingot) { - return SuitePreparation { - results: Vec::new(), - single_jobs: Vec::new(), - }; - } - - maybe_write_suite_ir(db, root_mod, opt_level, report); - match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { - maybe_write_requested_suite_artifacts_for_ingot( - db, - ingot, - RequestedSuiteArtifacts { - source_path: dir_path, - suite_key, - filter, - opt_level, - emit, - }, - output, - ) - })) { - Ok(Ok(())) => {} - Ok(Err(err)) => { - let msg = format!("Failed to emit requested test artifacts: {err}"); - let _ = writeln!(output, "{msg}"); - if let Some(report) = report { - write_codegen_report_error(report, &msg); - } - return SuitePreparation { - results: suite_error_result(suite, "codegen", msg), - single_jobs: Vec::new(), - }; - } - Err(payload) => { - let msg = format!( - "test artifact emission panicked: {}", - panic_payload_to_string(payload.as_ref()) - ); - let _ = writeln!(output, "{msg}"); - if let Some(report) = report { - write_report_error(report, "codegen_panic.txt", &msg); - } - return SuitePreparation { - results: suite_error_result(suite, "codegen", msg), - single_jobs: Vec::new(), - }; - } - } - prepare_ingot_discovered_tests( - db, - ingot, - suite, - suite_key, - filter, - opt_level, - debug, - sonatina_options, - report, - output, - ) -} - -#[allow(clippy::too_many_arguments)] -fn prepare_discovered_tests( - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, - suite: &str, - suite_key: &str, - filter: Option<&str>, - opt_level: OptLevel, - debug: &TestDebugOptions, - sonatina_options: SonatinaTestOptions, - report: Option<&ReportContext>, - output: &mut String, -) -> SuitePreparation { - let discovered = match discover_tests( - db, - top_mod, - suite, - filter, - opt_level, - sonatina_options, - report, - output, - ) { - Ok(discovered) => discovered, - Err(results) => { - return SuitePreparation { - results, - single_jobs: Vec::new(), - }; - } - }; - - suite_preparation_from_discovered(discovered, suite, suite_key, filter, debug, report, output) -} - -#[allow(clippy::too_many_arguments)] -fn prepare_ingot_discovered_tests( - db: &DriverDataBase, - ingot: Ingot<'_>, - suite: &str, - suite_key: &str, - filter: Option<&str>, - opt_level: OptLevel, - debug: &TestDebugOptions, - sonatina_options: SonatinaTestOptions, - report: Option<&ReportContext>, - output: &mut String, -) -> SuitePreparation { - let discovered = match discover_ingot_tests( - db, - ingot, - suite, - filter, - opt_level, - sonatina_options, - report, - output, - ) { - Ok(discovered) => discovered, - Err(results) => { - return SuitePreparation { - results, - single_jobs: Vec::new(), - }; - } - }; - - suite_preparation_from_discovered(discovered, suite, suite_key, filter, debug, report, output) -} - -#[allow(clippy::too_many_arguments)] -fn suite_preparation_from_discovered( - discovered: DiscoverResult, - suite: &str, - suite_key: &str, - filter: Option<&str>, - debug: &TestDebugOptions, - report: Option<&ReportContext>, - output: &mut String, -) -> SuitePreparation { - let report_root = report.map(|ctx| ctx.root_dir.clone()); - let mut results = Vec::new(); - let mut single_jobs = Vec::new(); - for case in discovered.tests { - if !test_case_matches_filter(&case, filter) { - continue; - } - - let evm_trace = match debug.evm_trace_options_for_test(Some(suite), &case.display_name) { - Ok(value) => value, - Err(err) => { - write_case_status_line(output, false, Duration::ZERO, &case.display_name); - let _ = writeln!(output, " {err}"); - results.push(TestResult { - name: case.display_name.clone(), - passed: false, - error_message: Some(err), - }); - continue; - } - }; - - single_jobs.push(SingleTestJob { - suite_key: suite_key.to_string(), - case, - evm_trace, - report_root: report_root.clone(), - }); - } - - SuitePreparation { - results, - single_jobs, - } -} - -/// Emit a test module with panic recovery and report integration. -/// -/// Wraps `emit_fn` in `catch_unwind`, writes error/panic info into the report -/// staging directory when present, and returns the output or an early-return -/// error result vector. -pub(super) fn emit_with_catch_unwind( - emit_fn: impl FnOnce() -> Result, - backend_label: &str, - suite: &str, - report: Option<&ReportContext>, - output: &mut String, -) -> Result> { - let _hook = report.map(|r| install_report_panic_hook(r, "codegen_panic_full.txt")); - match std::panic::catch_unwind(std::panic::AssertUnwindSafe(emit_fn)) { - Ok(Ok(output)) => Ok(output), - Ok(Err(err)) => { - let msg = format!("Failed to emit test {backend_label}: {err}"); - let _ = writeln!(output, "{msg}"); - if let Some(report) = report { - write_codegen_report_error(report, &msg); - } - Err(suite_error_result(suite, "codegen", msg)) - } - Err(payload) => { - let msg = format!( - "{backend_label} backend panicked while emitting test module: {}", - panic_payload_to_string(payload.as_ref()) - ); - let _ = writeln!(output, "{msg}"); - if let Some(report) = report { - write_report_error(report, "codegen_panic.txt", &msg); - } - Err(suite_error_result(suite, "codegen", msg)) - } - } -} - -/// Discovers `#[test]` functions, compiles them, and executes each one. -/// -/// * `db` - Driver database used for compilation. -/// * `top_mod` - Root module to scan for tests. -/// * `filter` - Optional substring filter for test names. -/// * `show_logs` - Whether to show event logs from test execution. -/// -/// Returns the collected test results. -#[allow(clippy::too_many_arguments)] -fn discover_tests( - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, - suite: &str, - filter: Option<&str>, - opt_level: OptLevel, - sonatina_options: SonatinaTestOptions, - report: Option<&ReportContext>, - output: &mut String, -) -> Result> { - let emit_result = emit_with_catch_unwind( - || emit_test_module_sonatina(db, top_mod, opt_level, sonatina_options, filter), - "Sonatina", - suite, - report, - output, - ); - let module_output = emit_result?; - - if module_output.tests.is_empty() { - return Ok(DiscoverResult { tests: Vec::new() }); - } - - Ok(DiscoverResult { - tests: module_output.tests, - }) -} - -#[allow(clippy::too_many_arguments)] -fn discover_ingot_tests( - db: &DriverDataBase, - ingot: Ingot<'_>, - suite: &str, - filter: Option<&str>, - opt_level: OptLevel, - sonatina_options: SonatinaTestOptions, - report: Option<&ReportContext>, - output: &mut String, -) -> Result> { - let emit_result = emit_with_catch_unwind( - || emit_test_ingot_sonatina(db, ingot, opt_level, sonatina_options, filter), - "Sonatina", - suite, - report, - output, - ); - let module_output = emit_result?; - - if module_output.tests.is_empty() { - return Ok(DiscoverResult { tests: Vec::new() }); - } - - Ok(DiscoverResult { - tests: module_output.tests, - }) -} - -fn write_case_output(output: &mut String, outcome: &TestOutcome, show_logs: bool) { - if !outcome.result.passed - && let Some(ref msg) = outcome.result.error_message - { - let _ = writeln!(output, " {msg}"); - } - - if let Some(trace) = &outcome.trace { - let _ = writeln!(output, "--- call trace ---"); - let _ = write!(output, "{trace}"); - let _ = writeln!(output, "--- end trace ---"); - } - - if show_logs { - if !outcome.logs.is_empty() { - for log in &outcome.logs { - let _ = writeln!(output, " log {log}"); - } - } else if outcome.result.passed { - let _ = writeln!(output, " log (none)"); - } else { - let _ = writeln!(output, " log (unavailable for failed tests)"); - } - } -} - -fn format_elapsed_seconds_cell(elapsed: Duration) -> String { - const WIDTH: usize = 6; - let seconds = elapsed.as_secs_f64(); - let whole_digits = if seconds >= 1.0 { - seconds.log10().floor() as usize + 1 - } else { - 1 - }; - let fractional_digits = WIDTH.saturating_sub(whole_digits + 1).min(4); - let rendered = if fractional_digits == 0 { - format!("{seconds:.0}") - } else { - format!("{seconds:.fractional_digits$}") - }; - format!("{rendered:>WIDTH$}") -} - -fn write_case_status_line(output: &mut String, passed: bool, elapsed: Duration, name: &str) { - let kind = if passed { - StreamStatusKind::Pass - } else { - StreamStatusKind::Fail - }; - let status = colorize_streamed_status(kind, &format_streamed_status(kind, Some(elapsed))); - let _ = writeln!(output, "{status} {name}"); -} - -pub(super) fn test_case_matches_filter(case: &TestMetadata, filter: Option<&str>) -> bool { - let Some(pattern) = filter else { - return true; - }; - case.hir_name.contains(pattern) - || case.symbol_name.contains(pattern) - || case.display_name.contains(pattern) -} - -fn test_emit_stem(suite_key: &str) -> String { - let stem = sanitize_filename(suite_key); - if stem.is_empty() { - "tests".to_string() - } else { - stem - } -} - -fn write_test_emit_artifact( - out_dir: &Utf8PathBuf, - stem: &str, - ext: &str, - contents: &str, - output: &mut String, -) -> Result<(), String> { - create_dir_all_utf8(out_dir)?; - let file_name = format!("{stem}.test.{ext}"); - let path = out_dir.join(&file_name); - std::fs::write(&path, contents).map_err(|err| format!("failed to write `{path}`: {err}"))?; - let _ = writeln!(output, "Wrote {path}"); - Ok(()) -} - -fn default_test_emit_dir(path: &Utf8PathBuf) -> Result { - let canonical = path - .canonicalize_utf8() - .map_err(|err| format!("failed to canonicalize `{path}`: {err}"))?; - if canonical.is_file() { - Ok(canonical - .parent() - .expect("canonical file should have parent") - .join("out")) - } else { - Ok(canonical.join("out")) - } -} - -fn emit_runtime_package_ir( - db: &DriverDataBase, - opt_level: OptLevel, - package: &mir::RuntimePackage<'_>, -) -> Result<(&'static str, String), String> { - Ok(( - "sona", - emit_runtime_package_sonatina_ir_optimized(db, package, codegen::EVM_LAYOUT, opt_level) - .map_err(|err| err.to_string())?, - )) -} - -fn maybe_write_requested_suite_artifacts_for_top_mod( - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, - request: RequestedSuiteArtifacts<'_>, - output: &mut String, -) -> Result<(), String> { - if request.emit.is_empty() { - return Ok(()); - } - - let package = - build_test_runtime_package(db, top_mod, request.filter).map_err(|err| err.to_string())?; - let out_dir = default_test_emit_dir(request.source_path)?; - let stem = test_emit_stem(request.suite_key); - if request.emit.ir { - let (ext, ir) = emit_runtime_package_ir(db, request.opt_level, &package)?; - write_test_emit_artifact(&out_dir, &stem, ext, &ir, output)?; - } - if request.emit.rmir { - let rmir = format_runtime_package(db, &package); - write_test_emit_artifact(&out_dir, &stem, "rmir", &rmir, output)?; - } - Ok(()) -} - -fn maybe_write_requested_suite_artifacts_for_ingot( - db: &DriverDataBase, - ingot: Ingot<'_>, - request: RequestedSuiteArtifacts<'_>, - output: &mut String, -) -> Result<(), String> { - if request.emit.is_empty() { - return Ok(()); - } - - let mut top_mods = ingot.all_modules(db).to_vec(); - top_mods.sort_by(|left, right| left.name(db).cmp(&right.name(db))); - - let mut runtime_packages = Vec::new(); - for top_mod in top_mods { - if has_test_functions(db, top_mod) { - runtime_packages.push(( - format!("{:?}", top_mod.name(db)), - build_test_runtime_package(db, top_mod, request.filter) - .map_err(|err| err.to_string())?, - )); - } - } - - if runtime_packages.is_empty() { - return Ok(()); - } - - let out_dir = default_test_emit_dir(request.source_path)?; - let stem = test_emit_stem(request.suite_key); - if request.emit.ir { - let mut ir = String::new(); - for (idx, (module_name, package)) in runtime_packages.iter().enumerate() { - if idx != 0 { - ir.push_str("\n\n"); - } - let _ = writeln!(ir, "=== {module_name} ==="); - let (_, module_ir) = emit_runtime_package_ir(db, request.opt_level, package)?; - ir.push_str(&module_ir); - } - write_test_emit_artifact(&out_dir, &stem, "sona", &ir, output)?; - } - if request.emit.rmir { - let mut rmir = String::new(); - for (idx, (module_name, package)) in runtime_packages.iter().enumerate() { - if idx != 0 { - rmir.push_str("\n\n"); - } - let _ = writeln!(rmir, "=== {module_name} ==="); - rmir.push_str(&format_runtime_package(db, package)); - } - write_test_emit_artifact(&out_dir, &stem, "rmir", &rmir, output)?; - } - Ok(()) -} - -fn maybe_write_suite_ir( - db: &DriverDataBase, - top_mod: TopLevelMod<'_>, - opt_level: OptLevel, - report: Option<&ReportContext>, -) { - let Some(report) = report else { - return; - }; - - let artifacts_dir = report.root_dir.join("artifacts"); - let _ = create_dir_all_utf8(&artifacts_dir); - - match build_runtime_package(db, top_mod) { - Ok(package) => { - let path = artifacts_dir.join("runtime_package.txt"); - let _ = std::fs::write(&path, format!("{package:#?}")); - } - Err(err) => { - let path = artifacts_dir.join("runtime_package_error.txt"); - let _ = std::fs::write(&path, format!("{err}")); - } - } - - match codegen::emit_module_sonatina_ir(db, top_mod) { - Ok(ir) => { - let path = artifacts_dir.join("sonatina_ir.txt"); - let _ = std::fs::write(&path, ir); - } - Err(err) => { - let path = artifacts_dir.join("sonatina_ir_error.txt"); - let _ = std::fs::write(&path, format!("{err}")); - } - } - - match codegen::emit_module_sonatina_ir_optimized(db, top_mod, opt_level, None) { - Ok(ir) => { - let path = artifacts_dir.join("sonatina_ir_optimized.txt"); - let _ = std::fs::write(&path, ir); - } - Err(err) => { - let path = artifacts_dir.join("sonatina_ir_optimized_error.txt"); - let _ = std::fs::write(&path, format!("{err}")); - } - } - - match codegen::validate_module_sonatina_ir(db, top_mod) { - Ok(report) => { - let path = artifacts_dir.join("sonatina_validate.txt"); - let _ = std::fs::write(&path, report); - } - Err(err) => { - let path = artifacts_dir.join("sonatina_validate_error.txt"); - let _ = std::fs::write(&path, format!("{err}")); - } - } -} - -fn suite_name_for_path(path: &Utf8PathBuf) -> String { - let raw = if path.is_file() { - path.file_stem() - .map(|s| s.to_string()) - .unwrap_or_else(|| "tests".to_string()) - } else { - path.file_name() - .map(|s| s.to_string()) - .unwrap_or_else(|| "tests".to_string()) - }; - let sanitized = sanitize_filename(&raw); - if sanitized.is_empty() { - "tests".to_string() - } else { - sanitized - } -} - -fn expand_test_paths(inputs: &[Utf8PathBuf]) -> Result, String> { - let mut expanded = Vec::new(); - let mut seen: FxHashSet = FxHashSet::default(); - - for input in inputs { - if input.exists() { - let key = input.as_str().to_string(); - if seen.insert(key) { - expanded.push(input.clone()); - } - continue; - } - - let pattern = input.as_str(); - if !looks_like_glob(pattern) { - return Err(format!("path does not exist: {input}")); - } - - let mut matches = Vec::new(); - let entries = glob::glob(pattern) - .map_err(|err| format!("invalid glob pattern `{pattern}`: {err}"))?; - for entry in entries { - let path = entry.map_err(|err| format!("glob entry error for `{pattern}`: {err}"))?; - let utf8 = Utf8PathBuf::from_path_buf(path) - .map_err(|path| format!("non-utf8 path matched by `{pattern}`: {path:?}"))?; - matches.push(utf8); - } - - if matches.is_empty() { - return Err(format!("glob pattern matched no paths: `{pattern}`")); - } - - matches.sort(); - for path in matches { - let key = path.as_str().to_string(); - if seen.insert(key) { - expanded.push(path); - } - } - } - - Ok(expanded) -} - -fn looks_like_glob(pattern: &str) -> bool { - pattern.contains('*') || pattern.contains('?') || pattern.contains('[') -} - -fn expand_workspace_test_paths( - inputs: Vec, - ingot: Option<&str>, -) -> Result, String> { - let mut expanded = Vec::new(); - let mut seen: FxHashSet = FxHashSet::default(); - let mut push_unique = |path: Utf8PathBuf| { - let key = path.as_str().to_string(); - if seen.insert(key) { - expanded.push(path); - } - }; - - for input in inputs { - if !input.is_dir() { - if ingot.is_some() { - return Err(INGOT_REQUIRES_WORKSPACE_ROOT.to_string()); - } - push_unique(input); - continue; - } - - let config_path = input.join("fe.toml"); - if !config_path.is_file() { - if ingot.is_some() { - return Err(INGOT_REQUIRES_WORKSPACE_ROOT.to_string()); - } - push_unique(input); - continue; - } - - let content = match std::fs::read_to_string(config_path.as_std_path()) { - Ok(content) => content, - Err(_) => { - if ingot.is_some() { - return Err(format!( - "`--ingot` requires a readable workspace config at `{config_path}`" - )); - } - push_unique(input); - continue; - } - }; - let config = match Config::parse(&content) { - Ok(config) => config, - Err(_) => { - if ingot.is_some() { - return Err(format!( - "`--ingot` requires a valid workspace config at `{config_path}`" - )); - } - push_unique(input); - continue; - } - }; - let Config::Workspace(workspace_config) = config else { - if ingot.is_some() { - return Err(INGOT_REQUIRES_WORKSPACE_ROOT.to_string()); - } - push_unique(input); - continue; - }; - - let canonical = input - .canonicalize_utf8() - .map_err(|err| format!("failed to canonicalize workspace path `{input}`: {err}"))?; - let workspace_url = Url::from_directory_path(canonical.as_str()) - .map_err(|_| format!("invalid workspace directory path `{input}`"))?; - let selection = if workspace_config.workspace.default_members.is_some() { - WorkspaceMemberSelection::DefaultOnly - } else { - WorkspaceMemberSelection::All - }; - let members = driver::expand_workspace_members( - &workspace_config.workspace, - &workspace_url, - selection, - ) - .map_err(|err| format!("failed to resolve workspace members in `{input}`: {err}"))?; - - let member_paths = select_workspace_member_paths( - &canonical, - &input, - members - .iter() - .filter(|member| member.url != workspace_url) - .map(|member| { - WorkspaceMemberRef::new(member.path.as_path(), member.name.as_deref()) - }), - ingot, - )?; - - if member_paths.is_empty() { - push_unique(input); - continue; - } - - for member_path in member_paths { - push_unique(member_path); - } - } - - Ok(expanded) -} - -fn has_test_functions(db: &DriverDataBase, top_mod: TopLevelMod<'_>) -> bool { - top_mod.all_funcs(db).iter().any(|func| { - ItemKind::from(*func) - .attrs(db) - .is_some_and(|attrs| attrs.has_attr(db, "test")) - }) -} - -/// Like [`has_test_functions`] but checks all modules in the ingot, not just one. -fn ingot_has_test_functions(db: &DriverDataBase, ingot: Ingot<'_>) -> bool { - ingot.all_funcs(db).iter().any(|func| { - ItemKind::from(*func) - .attrs(db) - .is_some_and(|attrs| attrs.has_attr(db, "test")) - }) -} - -fn create_run_report_staging() -> Result { - create_report_staging_root("target/fe-test-report-staging", "fe-test-report") -} - -fn create_suite_report_staging(suite: &str) -> Result { - let name = format!("fe-test-report-{}", sanitize_filename(suite)); - create_report_staging_root("target/fe-test-report-staging", &name) -} - -#[allow(clippy::too_many_arguments)] -pub(super) fn compile_and_run_test( - case: &TestMetadata, - show_logs: bool, - evm_trace: Option<&EvmTraceOptions>, - report: Option<&ReportContext>, - call_trace: bool, -) -> TestOutcome { - let started = Instant::now(); - let failure = |message: String| TestOutcome { - result: TestResult { - name: case.display_name.clone(), - passed: false, - error_message: Some(message), - }, - logs: Vec::new(), - trace: None, - elapsed: started.elapsed(), - }; - - if case.value_param_count > 0 { - return failure(format!( - "tests with value parameters are not supported (found {})", - case.value_param_count - )); - } - - if case.object_name.trim().is_empty() { - return failure(format!( - "missing test object name for `{}`", - case.display_name - )); - } - - let initial_balance = match case - .initial_balance - .as_deref() - .map(be_bytes_to_u256) - .transpose() - { - Ok(balance) => balance, - Err(err) => { - return failure(format!( - "invalid initial balance for test `{}`: {err}", - case.display_name - )); - } - }; - - if case.bytecode.is_empty() { - return failure(format!("missing test bytecode for `{}`", case.display_name)); - } - - if let Some(report) = report { - write_sonatina_case_artifacts(report, case); - } - - let bytecode = hex::encode(&case.bytecode); - let (result, logs, trace) = execute_test( - &case.display_name, - &bytecode, - show_logs, - case.expected_revert.as_ref(), - evm_trace, - call_trace, - initial_balance, - ); - TestOutcome { - result, - logs, - trace, - elapsed: started.elapsed(), - } -} - -fn write_sonatina_case_artifacts(report: &ReportContext, case: &TestMetadata) { - let dir = report - .root_dir - .join("artifacts") - .join("tests") - .join(sanitize_filename(&case.display_name)) - .join("sonatina"); - let _ = create_dir_all_utf8(&dir); - - let init_path = dir.join("initcode.hex"); - let _ = std::fs::write(&init_path, hex::encode(&case.bytecode)); - - if let Some(runtime) = extract_runtime_from_sonatina_initcode(&case.bytecode) { - let _ = std::fs::write(dir.join("runtime.bin"), runtime); - let _ = std::fs::write(dir.join("runtime.hex"), hex::encode(runtime)); - } - - if let Some(json) = &case.sonatina_observability_json { - let _ = std::fs::write(dir.join("observability.json"), json); - } -} - -fn extract_runtime_from_sonatina_initcode(init: &[u8]) -> Option<&[u8]> { - // Matches the init code produced by `fe-codegen` Sonatina tests: - // PUSHn , PUSH2 , PUSH1 0, CODECOPY, PUSHn , PUSH1 0, RETURN, - // - // Returns the appended runtime slice if parsing succeeds. - let mut idx = 0; - let push_opcode = *init.get(idx)?; - if !(0x60..=0x7f).contains(&push_opcode) { - return None; - } - let len_n = (push_opcode - 0x5f) as usize; - idx += 1; - if idx + len_n > init.len() { - return None; - } - let mut len: usize = 0; - for &b in init.get(idx..idx + len_n)? { - len = (len << 8) | (b as usize); - } - idx += len_n; - - if *init.get(idx)? != 0x61 { - return None; - } - idx += 1; - let off_hi = *init.get(idx)? as usize; - let off_lo = *init.get(idx + 1)? as usize; - let off = (off_hi << 8) | off_lo; - if off > init.len() { - return None; - } - if off + len > init.len() { - return None; - } - Some(&init[off..off + len]) -} - -fn write_report_manifest( - staging: &Utf8PathBuf, - opt_level: OptLevel, - filter: Option<&str>, - results: &[TestResult], -) { - let mut out = String::new(); - out.push_str("fe test report\n"); - out.push_str("backend: sonatina\n"); - out.push_str(&format!("opt_level: {opt_level}\n")); - out.push_str(&format!("filter: {}\n", filter.unwrap_or(""))); - out.push_str(&format!("fe_version: {}\n", env!("CARGO_PKG_VERSION"))); - out.push_str("details: see `meta/args.txt` and `meta/git.txt` for exact repro context\n"); - out.push_str("sonatina_ir: Sonatina reports include pre-opt IR at `artifacts/sonatina_ir.txt` and post-selected-opt-level IR at `artifacts/sonatina_ir_optimized.txt` (with `opt_level: 0`, both represent the same unoptimized module)\n"); - out.push_str("sonatina_observability: when available, Sonatina test artifacts include `artifacts/tests//sonatina/observability.json`\n"); - out.push_str(&format!("tests: {}\n", results.len())); - let passed = results.iter().filter(|r| r.passed).count(); - out.push_str(&format!("passed: {passed}\n")); - out.push_str(&format!("failed: {}\n", results.len() - passed)); - out.push_str("\nfailures:\n"); - for r in results.iter().filter(|r| !r.passed) { - out.push_str(&format!("- {}\n", r.name)); - if let Some(msg) = &r.error_message { - out.push_str(&format!(" {}\n", msg)); - } - } - let _ = std::fs::write(staging.join("manifest.txt"), out); -} - -/// Deploys and executes compiled test bytecode in revm. -/// -/// The test passes if the function returns normally, fails if it reverts. -/// -/// * `name` - Display name used for reporting. -/// * `bytecode_hex` - Hex-encoded init bytecode for the test object. -/// * `show_logs` - Whether to execute with log collection enabled. -/// -/// Returns the test result and any emitted logs. -fn be_bytes_to_u256(bytes: &[u8]) -> Result { - if bytes.len() > 32 { - return Err("initial balance exceeds u256"); - } - let mut buf = [0u8; 32]; - // Pad on the left (big-endian): short value goes into the low bytes. - let start = 32 - bytes.len(); - buf[start..].copy_from_slice(bytes); - Ok(U256::from_be_bytes(buf)) -} - -#[allow(clippy::too_many_arguments)] -fn execute_test( - name: &str, - bytecode_hex: &str, - show_logs: bool, - expected_revert: Option<&ExpectedRevert>, - evm_trace: Option<&EvmTraceOptions>, - call_trace: bool, - initial_balance: Option, -) -> (TestResult, Vec, Option) { - // Deploy the test contract - let (mut instance, _) = match RuntimeInstance::deploy_tracked(bytecode_hex) { - Ok(deployed) => deployed, - Err(err) => { - return ( - TestResult { - name: name.to_string(), - passed: false, - error_message: Some(format!("Failed to deploy test: {err}")), - }, - Vec::new(), - None, - ); - } - }; - // Optionally seed the test contract with ETH (opt-in via #[test(balance = N)]). - if let Some(balance) = initial_balance { - instance.fund_contract(balance); - } - - instance.set_trace_options(evm_trace.cloned()); - - // Execute the test (empty calldata since test functions take no args) - let options = ExecutionOptions::default(); - - // Capture call trace BEFORE the real execution so the cloned context - // has the right pre-call state (contract deployed but not yet called). - let trace = if call_trace { - Some(instance.call_raw_traced(&[], options)) - } else { - None - }; - - let call_result = if show_logs { - instance - .call_raw_with_logs(&[], options) - .map(|outcome| outcome.logs) - } else { - instance.call_raw(&[], options).map(|_| Vec::new()) - }; - - match (call_result, expected_revert) { - // Normal test: execution succeeded - (Ok(logs), None) => ( - TestResult { - name: name.to_string(), - passed: true, - error_message: None, - }, - logs, - trace, - ), - // Normal test: execution reverted (failure) - (Err(err), None) => ( - TestResult { - name: name.to_string(), - passed: false, - error_message: Some(format_harness_error(err)), - }, - Vec::new(), - trace, - ), - // Expected revert: execution succeeded (failure - should have reverted) - (Ok(_), Some(_)) => ( - TestResult { - name: name.to_string(), - passed: false, - error_message: Some("Expected test to revert, but it succeeded".to_string()), - }, - Vec::new(), - trace, - ), - // Expected revert: execution reverted — check revert data against expectation - (Err(contract_harness::HarnessError::Revert(data)), Some(expected)) => { - let mismatch = match expected { - ExpectedRevert::Any => None, - ExpectedRevert::Selector(sel) => { - if data.0.len() >= 4 && data.0[..4] == sel[..] { - None - } else { - Some(format!( - "Expected revert with selector 0x{}, but got revert data: {}", - hex::encode(sel), - data, - )) - } - } - ExpectedRevert::PanicCode(expected_bytes) => { - if data.0 == *expected_bytes { - None - } else { - Some(format!( - "Expected revert data 0x{}, but got: {}", - hex::encode(expected_bytes), - data, - )) - } - } - }; - match mismatch { - None => ( - TestResult { - name: name.to_string(), - passed: true, - error_message: None, - }, - Vec::new(), - trace, - ), - Some(msg) => ( - TestResult { - name: name.to_string(), - passed: false, - error_message: Some(msg), - }, - Vec::new(), - trace, - ), - } - } - // Expected revert: execution failed for a different reason (failure) - (Err(err), Some(_)) => ( - TestResult { - name: name.to_string(), - passed: false, - error_message: Some(format!( - "Expected test to revert, but it failed with: {}", - format_harness_error(err) - )), - }, - Vec::new(), - trace, - ), - } -} - -/// Formats a harness error into a human-readable message. -fn format_harness_error(err: contract_harness::HarnessError) -> String { - match err { - contract_harness::HarnessError::Revert(data) => format!("Test reverted: {data}"), - contract_harness::HarnessError::Halted { reason, gas_used } => { - format!("Test halted: {reason:?} (gas: {gas_used})") - } - other => format!("Test execution error: {other}"), - } -} - -/// Prints a summary for the completed test run. -/// -/// * `results` - Per-test results to summarize. -/// -/// Returns nothing. -fn print_summary(results: &[TestResult]) { - if results.is_empty() { - return; - } - - let passed = results.iter().filter(|r| r.passed).count(); - let failed = results.len() - passed; - - println!(); - if failed == 0 { - println!( - "test result: {}. {} passed; {} failed", - "ok".green(), - passed, - failed - ); - } else { - println!( - "test result: {}. {} passed; {} failed", - "FAILED".red(), - passed, - failed - ); - - // Print failed tests - println!(); - println!("failures:"); - for result in results.iter().filter(|r| !r.passed) { - println!(" {}", result.name); - } - } -} diff --git a/crates/fe/src/tree.rs b/crates/fe/src/tree.rs deleted file mode 100644 index a2e945cc9c..0000000000 --- a/crates/fe/src/tree.rs +++ /dev/null @@ -1,171 +0,0 @@ -use camino::Utf8PathBuf; -use common::InputDb; -use common::config::{Config, WorkspaceConfig}; -use driver::{DependencyTree, DriverDataBase, init_ingot, workspace_members}; -use resolver::workspace::discover_context; -use smol_str::SmolStr; -use url::Url; - -pub fn print_tree(path: &Utf8PathBuf) -> bool { - let mut had_errors = false; - let mut db = DriverDataBase::default(); - if let Some(name) = name_candidate(path) { - match print_workspace_member_tree_by_name(&mut db, &name) { - Ok(had_init_diagnostics) => { - had_errors |= had_init_diagnostics; - } - Err(err) => { - eprintln!("Error: {err}"); - had_errors = true; - } - } - return had_errors; - } - - let target_url = match ingot_url(path) { - Ok(url) => url, - Err(message) => { - eprintln!("Error: {message}"); - return true; - } - }; - - let had_init_diagnostics = init_ingot(&mut db, &target_url); - if had_init_diagnostics { - had_errors = true; - } - match config_from_db(&db, &target_url) { - Ok(Some(Config::Workspace(workspace_config))) => { - if let Err(err) = print_workspace_trees(&db, &workspace_config, &target_url) { - eprintln!("Error: {err}"); - had_errors = true; - } - return had_errors; - } - Ok(_) => {} - Err(err) => { - eprintln!("Error: {err}"); - had_errors = true; - } - } - - let tree = DependencyTree::build(&db, &target_url); - print!("{}", tree.display_to(common::color::ColorTarget::Stdout)); - had_errors -} - -fn ingot_url(path: &Utf8PathBuf) -> Result { - let canonical_path = path - .canonicalize_utf8() - .map_err(|_| format!("invalid or non-existent directory path: {path}"))?; - - if !canonical_path.is_dir() { - return Err(format!("{path} is not a directory")); - } - - Url::from_directory_path(canonical_path.as_str()) - .map_err(|_| format!("invalid directory path: {path}")) -} - -fn name_candidate(path: &Utf8PathBuf) -> Option { - if path.exists() { - return None; - } - let value = path.as_str(); - if value.is_empty() { - return None; - } - if value.chars().all(|c| c.is_alphanumeric() || c == '_') { - Some(value.to_string()) - } else { - None - } -} - -fn config_from_db(db: &DriverDataBase, base_url: &Url) -> Result, String> { - let config_url = base_url - .join("fe.toml") - .map_err(|_| format!("Failed to locate fe.toml for {base_url}"))?; - let Some(file) = db.workspace().get(db, &config_url) else { - return Ok(None); - }; - let config = Config::parse(file.text(db)) - .map_err(|err| format!("Failed to parse {config_url}: {err}"))?; - Ok(Some(config)) -} - -fn print_workspace_member_tree_by_name( - db: &mut DriverDataBase, - name: &str, -) -> Result { - let cwd = std::env::current_dir() - .map_err(|err| format!("Failed to read current directory: {err}"))?; - let cwd = Utf8PathBuf::from_path_buf(cwd) - .map_err(|_| "Current directory is not valid UTF-8".to_string())?; - let cwd_url = Url::from_directory_path(cwd.as_std_path()) - .map_err(|_| "Failed to convert current directory to URL".to_string())?; - let discovery = discover_context(&cwd_url, false) - .map_err(|err| format!("Failed to discover context: {err}"))?; - let workspace_url = discovery - .workspace_root - .ok_or_else(|| "No workspace config found in current directory hierarchy".to_string())?; - - let had_init_diagnostics = init_ingot(db, &workspace_url); - let mut matches = - db.dependency_graph() - .workspace_members_by_name(db, &workspace_url, &SmolStr::new(name)); - - if matches.is_empty() { - return Err(format!("No workspace member named \"{name}\"")); - } - if matches.len() > 1 { - return Err(format!( - "Multiple workspace members named \"{name}\"; specify a path instead" - )); - } - - let member = matches.remove(0); - let tree = DependencyTree::build(db, &member.url); - print!("{}", tree.display_to(common::color::ColorTarget::Stdout)); - Ok(had_init_diagnostics) -} - -fn print_workspace_trees( - db: &DriverDataBase, - workspace_config: &WorkspaceConfig, - workspace_url: &Url, -) -> Result<(), String> { - let members = workspace_members(&workspace_config.workspace, workspace_url)?; - if members.is_empty() { - let paths: Vec<&str> = workspace_config - .workspace - .members - .iter() - .map(|m| m.path.as_str()) - .collect(); - if paths.is_empty() { - eprintln!("Warning: No workspace members configured in fe.toml"); - } else { - eprintln!( - "Warning: No workspace members found. The configured member paths do not exist:\n {}", - paths.join("\n ") - ); - } - return Ok(()); - } - - for (idx, member) in members.iter().enumerate() { - if idx > 0 { - println!(); - } - let label = member - .name - .as_deref() - .map(|name| name.to_string()) - .unwrap_or_else(|| member.url.to_string()); - println!("== {label} =="); - let tree = DependencyTree::build(db, &member.url); - print!("{}", tree.display_to(common::color::ColorTarget::Stdout)); - } - Ok(()) -} diff --git a/crates/fe/src/workspace_ingot.rs b/crates/fe/src/workspace_ingot.rs deleted file mode 100644 index bc9e1ab618..0000000000 --- a/crates/fe/src/workspace_ingot.rs +++ /dev/null @@ -1,121 +0,0 @@ -use camino::{Utf8Path, Utf8PathBuf}; -use common::config::Config; - -pub const INGOT_REQUIRES_WORKSPACE_ROOT: &str = - "`--ingot` requires an input path that resolves to a workspace root"; - -#[derive(Debug, Clone, Copy)] -pub struct WorkspaceMemberRef<'a> { - path: &'a Utf8Path, - name: Option<&'a str>, -} - -impl<'a> WorkspaceMemberRef<'a> { - pub fn new(path: &'a Utf8Path, name: Option<&'a str>) -> Self { - Self { path, name } - } -} - -pub fn select_workspace_member_paths<'a>( - workspace_root: &Utf8Path, - workspace_display: &Utf8Path, - members: impl IntoIterator>, - ingot: Option<&str>, -) -> Result, String> { - let mut member_paths = members - .into_iter() - .filter(|member| { - ingot.is_none_or(|ingot| workspace_member_matches_ingot(workspace_root, *member, ingot)) - }) - .map(|member| workspace_root.join(member.path)) - .collect::>(); - member_paths.sort(); - - if let Some(ingot) = ingot - && member_paths.is_empty() - { - return Err(format!( - "No workspace member named \"{ingot}\" found in `{workspace_display}`" - )); - } - - Ok(member_paths) -} - -fn workspace_member_matches_ingot( - workspace_root: &Utf8Path, - member: WorkspaceMemberRef<'_>, - ingot: &str, -) -> bool { - if member.name == Some(ingot) { - return true; - } - - let config_path = workspace_root.join(member.path).join("fe.toml"); - let Ok(content) = std::fs::read_to_string(config_path.as_std_path()) else { - return false; - }; - let Ok(Config::Ingot(config)) = Config::parse(&content) else { - return false; - }; - config.metadata.name.as_deref() == Some(ingot) -} - -#[cfg(test)] -mod tests { - use super::{WorkspaceMemberRef, select_workspace_member_paths}; - use camino::{Utf8Path, Utf8PathBuf}; - use std::fs; - use tempfile::tempdir; - - #[test] - fn select_workspace_member_paths_does_not_match_by_directory_name() { - let temp = tempdir().expect("tempdir"); - let workspace_root = - Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).expect("workspace root utf8"); - let non_target = workspace_root.join("libs/a"); - fs::create_dir_all(non_target.as_std_path()).expect("create non-target dir"); - fs::write( - non_target.join("fe.toml").as_std_path(), - "[ingot]\nname = \"not_a\"\nversion = \"0.1.0\"\n", - ) - .expect("write non-target fe.toml"); - - let paths = select_workspace_member_paths( - &workspace_root, - &workspace_root, - [ - WorkspaceMemberRef::new(Utf8Path::new("ingots/target"), Some("a")), - WorkspaceMemberRef::new(Utf8Path::new("libs/a"), None), - ], - Some("a"), - ) - .expect("select paths"); - - assert_eq!(paths, vec![workspace_root.join("ingots/target")]); - } - - #[test] - fn select_workspace_member_paths_matches_ingot_metadata_name() { - let temp = tempdir().expect("tempdir"); - let workspace_root = - Utf8PathBuf::from_path_buf(temp.path().to_path_buf()).expect("workspace root utf8"); - let member = workspace_root.join("ingots/core"); - fs::create_dir_all(member.as_std_path()).expect("create member dir"); - fs::write( - member.join("fe.toml").as_std_path(), - "[ingot]\nname = \"app\"\nversion = \"0.1.0\"\n", - ) - .expect("write member fe.toml"); - - let paths = select_workspace_member_paths( - &workspace_root, - &workspace_root, - [WorkspaceMemberRef::new(Utf8Path::new("ingots/core"), None)], - Some("app"), - ) - .expect("select paths"); - - assert_eq!(paths, vec![workspace_root.join("ingots/core")]); - } -} diff --git a/crates/fe/tests/build_foundry.rs b/crates/fe/tests/build_foundry.rs deleted file mode 100644 index 24a1d6f2eb..0000000000 --- a/crates/fe/tests/build_foundry.rs +++ /dev/null @@ -1,452 +0,0 @@ -use std::{ - fs, - path::{Path, PathBuf}, - process::{Command, Stdio}, -}; - -use tempfile::tempdir; - -fn fe_binary_path() -> &'static str { - env!("CARGO_BIN_EXE_fe") -} - -fn render_output(output: &std::process::Output) -> String { - let mut full_output = String::new(); - if !output.stdout.is_empty() { - full_output.push_str("=== STDOUT ===\n"); - full_output.push_str(&String::from_utf8_lossy(&output.stdout)); - } - if !output.stderr.is_empty() { - if !full_output.is_empty() { - full_output.push('\n'); - } - full_output.push_str("=== STDERR ===\n"); - full_output.push_str(&String::from_utf8_lossy(&output.stderr)); - } - let exit_code = output.status.code().unwrap_or(-1); - full_output.push_str(&format!("\n=== EXIT CODE: {exit_code} ===")); - full_output -} - -fn find_executable_in_path(name: &str) -> Option { - let path = std::env::var_os("PATH")?; - for dir in std::env::split_paths(&path) { - let candidate = dir.join(name); - if candidate.is_file() { - return Some(candidate); - } - } - None -} - -fn run_fe_main_with_env(args: &[&str], extra_env: &[(&str, &str)]) -> (String, i32) { - let mut command = Command::new(fe_binary_path()); - command.args(args).env("NO_COLOR", "1"); - for (key, value) in extra_env { - command.env(key, value); - } - let output = command - .output() - .unwrap_or_else(|_| panic!("Failed to run fe {:?}", args)); - - let exit_code = output.status.code().unwrap_or(-1); - (render_output(&output), exit_code) -} - -fn write_foundry_base(root: &Path) -> Result<(), String> { - fs::create_dir_all(root.join("src")).map_err(|err| format!("create src: {err}"))?; - fs::create_dir_all(root.join("test")).map_err(|err| format!("create test: {err}"))?; - - let foundry_toml = r#"[profile.default] -src = "src" -test = "test" -fs_permissions = [{ access = "read", path = "./" }] -"#; - fs::write(root.join("foundry.toml"), foundry_toml) - .map_err(|err| format!("write foundry.toml: {err}"))?; - - Ok(()) -} - -fn write_foundry_project( - root: &Path, - deploy_rel_path: &str, - runtime_rel_path: &str, -) -> Result<(), String> { - let solidity_test = format!( - r#"// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.0; - -interface Vm {{ - function readFile(string calldata path) external returns (string memory); -}} - -contract FeBuildArtifactsTest {{ - Vm constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); - - function testBuildArtifactsDeployAndRun() public {{ - bytes memory initCode = fromHex(vm.readFile("{deploy_rel_path}")); - bytes memory expectedRuntime = fromHex(vm.readFile("{runtime_rel_path}")); - - address deployed = deploy(initCode); - require(deployed != address(0), "create failed"); - - (bool ok, bytes memory out) = deployed.staticcall( - abi.encodeWithSelector(bytes4(0x12345678)) - ); - require(ok, "call failed"); - - uint256 value = abi.decode(out, (uint256)); - require(value == 1, "unexpected return"); - - bytes memory deployedCode = deployed.code; - require( - keccak256(deployedCode) == keccak256(expectedRuntime), - "runtime mismatch" - ); - }} - - function deploy(bytes memory initCode) internal returns (address deployed) {{ - assembly {{ - deployed := create(0, add(initCode, 0x20), mload(initCode)) - }} - }} - - function fromHex(string memory s) internal pure returns (bytes memory) {{ - bytes memory strBytes = bytes(s); - uint256 start = 0; - while (start < strBytes.length && isWhitespace(strBytes[start])) {{ - start++; - }} - - if ( - start + 1 < strBytes.length && - strBytes[start] == bytes1("0") && - (strBytes[start + 1] == bytes1("x") || strBytes[start + 1] == bytes1("X")) - ) {{ - start += 2; - }} - - uint256 digits = 0; - for (uint256 i = start; i < strBytes.length; i++) {{ - if (isWhitespace(strBytes[i])) continue; - digits++; - }} - require(digits % 2 == 0, "odd hex length"); - - bytes memory out = new bytes(digits / 2); - uint256 outIndex = 0; - uint8 high = 0; - bool highNibble = true; - for (uint256 i = start; i < strBytes.length; i++) {{ - bytes1 ch = strBytes[i]; - if (isWhitespace(ch)) continue; - uint8 val = fromHexChar(ch); - if (highNibble) {{ - high = val; - highNibble = false; - }} else {{ - out[outIndex] = bytes1((high << 4) | val); - outIndex++; - highNibble = true; - }} - }} - return out; - }} - - function isWhitespace(bytes1 ch) private pure returns (bool) {{ - return ch == 0x20 || ch == 0x0a || ch == 0x0d || ch == 0x09; - }} - - function fromHexChar(bytes1 c) private pure returns (uint8) {{ - uint8 b = uint8(c); - if (b >= 48 && b <= 57) return b - 48; - if (b >= 65 && b <= 70) return b - 55; - if (b >= 97 && b <= 102) return b - 87; - revert("invalid hex"); - }} -}} -"# - ); - fs::write(root.join("test/FeBuildArtifacts.t.sol"), solidity_test) - .map_err(|err| format!("write FeBuildArtifacts.t.sol: {err}"))?; - - Ok(()) -} - -fn write_foundry_project_erc20( - root: &Path, - deploy_rel_path: &str, - runtime_rel_path: &str, -) -> Result<(), String> { - let solidity_test = format!( - r#"// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.0; - -interface Vm {{ - function readFile(string calldata path) external returns (string memory); - function prank(address msgSender) external; - function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external; -}} - -interface ICoolCoin {{ - function name() external view returns (uint256); - function symbol() external view returns (uint256); - function decimals() external view returns (uint8); - function totalSupply() external view returns (uint256); - function balanceOf(address account) external view returns (uint256); - function allowance(address owner, address spender) external view returns (uint256); - function transfer(address to, uint256 amount) external returns (bool); - function approve(address spender, uint256 amount) external returns (bool); - function transferFrom(address from, address to, uint256 amount) external returns (bool); - function mint(address to, uint256 amount) external returns (bool); -}} - -contract FeErc20ArtifactsTest {{ - Vm constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); - - event Transfer(address indexed from, address indexed to, uint256 value); - event Approval(address indexed owner, address indexed spender, uint256 value); - - function testErc20Artifacts() public {{ - bytes memory initCode = fromHex(vm.readFile("{deploy_rel_path}")); - bytes memory expectedRuntime = fromHex(vm.readFile("{runtime_rel_path}")); - - address owner = address(0x1000000000000000000000000000000000000001); - address alice = address(0x1000000000000000000000000000000000000002); - address bob = address(0x1000000000000000000000000000000000000003); - address spender = address(0x1000000000000000000000000000000000000004); - - uint256 initialSupply = 1000; - bytes memory initWithArgs = bytes.concat(initCode, abi.encode(initialSupply, owner)); - - address deployed = deploy(initWithArgs); - require(deployed != address(0), "create failed"); - - bytes memory deployedCode = deployed.code; - require( - keccak256(deployedCode) == keccak256(expectedRuntime), - "runtime mismatch" - ); - - ICoolCoin token = ICoolCoin(deployed); - require(token.totalSupply() == initialSupply, "totalSupply"); - require(token.balanceOf(owner) == initialSupply, "balanceOf(owner)"); - require(token.balanceOf(alice) == 0, "balanceOf(alice)"); - - vm.expectEmit(true, true, false, true); - emit Transfer(owner, alice, 50); - vm.prank(owner); - require(token.transfer(alice, 50), "transfer"); - require(token.balanceOf(owner) == 950, "balanceOf(owner) after transfer"); - require(token.balanceOf(alice) == 50, "balanceOf(alice) after transfer"); - - vm.expectEmit(true, true, false, true); - emit Approval(owner, spender, 100); - vm.prank(owner); - require(token.approve(spender, 100), "approve"); - require(token.allowance(owner, spender) == 100, "allowance after approve"); - - vm.expectEmit(true, true, false, true); - emit Transfer(owner, bob, 40); - vm.prank(spender); - require(token.transferFrom(owner, bob, 40), "transferFrom"); - require(token.allowance(owner, spender) == 60, "allowance after transferFrom"); - require(token.balanceOf(owner) == 910, "balanceOf(owner) after transferFrom"); - require(token.balanceOf(bob) == 40, "balanceOf(bob) after transferFrom"); - - vm.prank(spender); - require(!token.transferFrom(owner, bob, 1000), "transferFrom should fail"); - require(token.allowance(owner, spender) == 60, "allowance unchanged"); - require(token.balanceOf(owner) == 910, "owner unchanged"); - require(token.balanceOf(bob) == 40, "bob unchanged"); - - require(token.name() == 0x436f6f6c436f696e, "name"); - require(token.symbol() == 0x434f4f4c, "symbol"); - require(token.decimals() == 18, "decimals"); - - vm.expectEmit(true, true, false, true); - emit Transfer(address(0), alice, 500); - require(token.mint(alice, 500), "mint"); - require(token.totalSupply() == 1500, "totalSupply after mint"); - require(token.balanceOf(alice) == 550, "balanceOf(alice) after mint"); - }} - - function deploy(bytes memory initCode) internal returns (address deployed) {{ - assembly {{ - deployed := create(0, add(initCode, 0x20), mload(initCode)) - }} - }} - - function fromHex(string memory s) internal pure returns (bytes memory) {{ - bytes memory strBytes = bytes(s); - uint256 start = 0; - while (start < strBytes.length && isWhitespace(strBytes[start])) {{ - start++; - }} - - if ( - start + 1 < strBytes.length && - strBytes[start] == bytes1("0") && - (strBytes[start + 1] == bytes1("x") || strBytes[start + 1] == bytes1("X")) - ) {{ - start += 2; - }} - - uint256 digits = 0; - for (uint256 i = start; i < strBytes.length; i++) {{ - if (isWhitespace(strBytes[i])) continue; - digits++; - }} - require(digits % 2 == 0, "odd hex length"); - - bytes memory out = new bytes(digits / 2); - uint256 outIndex = 0; - uint8 high = 0; - bool highNibble = true; - for (uint256 i = start; i < strBytes.length; i++) {{ - bytes1 ch = strBytes[i]; - if (isWhitespace(ch)) continue; - uint8 val = fromHexChar(ch); - if (highNibble) {{ - high = val; - highNibble = false; - }} else {{ - out[outIndex] = bytes1((high << 4) | val); - outIndex++; - highNibble = true; - }} - }} - return out; - }} - - function isWhitespace(bytes1 ch) private pure returns (bool) {{ - return ch == 0x20 || ch == 0x0a || ch == 0x0d || ch == 0x09; - }} - - function fromHexChar(bytes1 c) private pure returns (uint8) {{ - uint8 b = uint8(c); - if (b >= 48 && b <= 57) return b - 48; - if (b >= 65 && b <= 70) return b - 55; - if (b >= 97 && b <= 102) return b - 87; - revert("invalid hex"); - }} -}} -"# - ); - fs::write(root.join("test/FeErc20Artifacts.t.sol"), solidity_test) - .map_err(|err| format!("write FeErc20Artifacts.t.sol: {err}"))?; - - Ok(()) -} - -#[cfg(unix)] -#[test] -#[allow(clippy::print_stderr)] -fn test_fe_build_artifacts_with_foundry() { - let Some(forge) = find_executable_in_path("forge") else { - #[allow(clippy::print_stdout)] - { - println!("skipping foundry integration test because `forge` is missing"); - } - return; - }; - let solc = std::env::var_os("FE_SOLC_PATH") - .map(PathBuf::from) - .filter(|path| path.is_file()) - .or_else(|| find_executable_in_path("solc")); - let Some(solc) = solc else { - #[allow(clippy::print_stdout)] - { - println!("skipping foundry integration test because `solc` is missing"); - } - return; - }; - - let solc_str = solc.to_str().expect("solc utf8"); - - let fixture_basic_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("tests/fixtures/cli_output/build/simple_contract.fe"); - let fixture_basic_path_str = fixture_basic_path.to_str().expect("fixture path utf8"); - let fixture_erc20_path = - PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/build_foundry/erc20.fe"); - let fixture_erc20_path_str = fixture_erc20_path.to_str().expect("fixture path utf8"); - - let temp = tempdir().expect("tempdir"); - - let forge_root = temp.path().join("forge-project"); - fs::create_dir_all(&forge_root).expect("create forge project root"); - - let out_dir = forge_root.join("fe-out"); - let out_dir_str = out_dir.to_string_lossy().to_string(); - - let (output, exit_code) = run_fe_main_with_env( - &[ - "build", - "--contract", - "Foo", - "--out-dir", - out_dir_str.as_str(), - fixture_basic_path_str, - ], - &[], - ); - assert_eq!(exit_code, 0, "fe build Foo failed:\n{output}"); - - let (output, exit_code) = run_fe_main_with_env( - &[ - "build", - "--contract", - "CoolCoin", - "--out-dir", - out_dir_str.as_str(), - fixture_erc20_path_str, - ], - &[], - ); - assert_eq!(exit_code, 0, "fe build CoolCoin failed:\n{output}"); - - for artifact in [ - out_dir.join("Foo.bin"), - out_dir.join("Foo.runtime.bin"), - out_dir.join("CoolCoin.bin"), - out_dir.join("CoolCoin.runtime.bin"), - ] { - assert!(artifact.is_file(), "expected artifact at {artifact:?}"); - } - - write_foundry_base(&forge_root).expect("write foundry project"); - write_foundry_project(&forge_root, "fe-out/Foo.bin", "fe-out/Foo.runtime.bin") - .expect("write Foo foundry test"); - write_foundry_project_erc20( - &forge_root, - "fe-out/CoolCoin.bin", - "fe-out/CoolCoin.runtime.bin", - ) - .expect("write CoolCoin foundry test"); - - let foundry_home = forge_root.join("foundry-home"); - fs::create_dir_all(&foundry_home).expect("create foundry home"); - - let forge_output = Command::new(&forge) - .args([ - "test", - "--root", - forge_root.to_str().expect("forge root utf8"), - "--use", - solc_str, - "--offline", - "-q", - ]) - .env("FOUNDRY_HOME", &foundry_home) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .output() - .expect("run forge test"); - - assert!( - forge_output.status.success(), - "forge test failed:\n{}", - render_output(&forge_output) - ); -} diff --git a/crates/fe/tests/cli_new.rs b/crates/fe/tests/cli_new.rs deleted file mode 100644 index 4e465097d8..0000000000 --- a/crates/fe/tests/cli_new.rs +++ /dev/null @@ -1,427 +0,0 @@ -use std::process::Command; - -use tempfile::TempDir; - -fn run_fe(args: &[&str], cwd: &std::path::Path) -> (String, i32) { - let output = Command::new(env!("CARGO_BIN_EXE_fe")) - .args(args) - .env("NO_COLOR", "1") - .current_dir(cwd) - .output() - .unwrap_or_else(|_| panic!("Failed to run fe {:?}", args)); - - let mut full_output = String::new(); - if !output.stdout.is_empty() { - full_output.push_str("=== STDOUT ===\n"); - full_output.push_str(&String::from_utf8_lossy(&output.stdout)); - } - if !output.stderr.is_empty() { - if !full_output.is_empty() { - full_output.push('\n'); - } - full_output.push_str("=== STDERR ===\n"); - full_output.push_str(&String::from_utf8_lossy(&output.stderr)); - } - let exit_code = output.status.code().unwrap_or(-1); - full_output.push_str(&format!("\n=== EXIT CODE: {exit_code} ===")); - (full_output, exit_code) -} - -#[test] -fn new_creates_ingot_layout() { - let tmp = TempDir::new().expect("tempdir"); - let ingot_dir = tmp.path().join("my_ingot"); - - let (output, exit_code) = run_fe(&["new", ingot_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - - let fe_toml = ingot_dir.join("fe.toml"); - assert!(fe_toml.is_file(), "missing fe.toml"); - let config = std::fs::read_to_string(&fe_toml).expect("read fe.toml"); - assert!(config.contains("[ingot]")); - assert!(config.contains("name = \"my_ingot\"")); - assert!(config.contains("version = \"0.1.0\"")); - - assert!(ingot_dir.join("src").is_dir(), "missing src/"); - let lib_fe = ingot_dir.join("src/lib.fe"); - assert!(lib_fe.is_file(), "missing src/lib.fe"); - let lib_content = std::fs::read_to_string(&lib_fe).expect("read lib.fe"); - assert!( - lib_content.contains("contract Counter"), - "expected lib.fe to contain Counter contract template, got:\n{lib_content}" - ); -} - -#[test] -fn new_allows_overriding_name_and_version() { - let tmp = TempDir::new().expect("tempdir"); - let ingot_dir = tmp.path().join("some_dir"); - - let (output, exit_code) = run_fe( - &[ - "new", - "--name", - "custom_name", - "--version", - "9.9.9", - ingot_dir.to_str().unwrap(), - ], - tmp.path(), - ); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - - let fe_toml = ingot_dir.join("fe.toml"); - let config = std::fs::read_to_string(&fe_toml).expect("read fe.toml"); - assert!(config.contains("name = \"custom_name\"")); - assert!(config.contains("version = \"9.9.9\"")); -} - -#[test] -fn new_workspace_creates_workspace_config_without_hardcoded_layout() { - let tmp = TempDir::new().expect("tempdir"); - let ws_dir = tmp.path().join("my_ws"); - - let (output, exit_code) = run_fe( - &["new", "--workspace", ws_dir.to_str().unwrap()], - tmp.path(), - ); - assert_eq!(exit_code, 0, "fe new --workspace failed:\n{output}"); - - let fe_toml = ws_dir.join("fe.toml"); - assert!(fe_toml.is_file(), "missing workspace fe.toml"); - let config = std::fs::read_to_string(&fe_toml).expect("read workspace fe.toml"); - assert!(config.contains("[workspace]")); - assert!(config.contains("name = \"my_ws\"")); - assert!(config.contains("members = []")); - - assert!( - !ws_dir.join("ingots").exists(), - "workspace new should not create an ingots/ directory" - ); -} - -#[test] -fn new_suggests_member_for_enclosing_workspace() { - let tmp = TempDir::new().expect("tempdir"); - let ws_dir = tmp.path().join("ws"); - std::fs::create_dir_all(&ws_dir).expect("create ws"); - std::fs::write( - ws_dir.join("fe.toml"), - r#"[workspace] -name = "ws" -version = "0.1.0" -members = [] -exclude = ["target"] -"#, - ) - .expect("write fe.toml"); - - let member_dir = ws_dir.join("app"); - let (output, exit_code) = run_fe(&["new", member_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - assert!( - output.contains("add \"app\" to [workspace].members"), - "expected `fe new` to print a workspace member suggestion, got:\n{output}" - ); - - let updated = std::fs::read_to_string(ws_dir.join("fe.toml")).expect("read fe.toml"); - let value: toml::Value = updated.parse().expect("parse workspace fe.toml"); - let workspace = value - .get("workspace") - .and_then(|v| v.as_table()) - .expect("workspace table"); - let members = workspace - .get("members") - .and_then(|v| v.as_array()) - .expect("members array"); - assert!( - members.is_empty(), - "expected members to remain empty (no file writes), got: {members:?}" - ); -} - -#[test] -fn new_suggests_member_for_root_level_workspace_config() { - let tmp = TempDir::new().expect("tempdir"); - let ws_dir = tmp.path().join("ws"); - std::fs::create_dir_all(&ws_dir).expect("create ws"); - std::fs::write( - ws_dir.join("fe.toml"), - r#"name = "ws" -version = "0.1.0" -members = [] -exclude = ["target"] -"#, - ) - .expect("write fe.toml"); - - let member_dir = ws_dir.join("app"); - let (output, exit_code) = run_fe(&["new", member_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - assert!( - output.contains("add \"app\" to members"), - "expected `fe new` to suggest adding the member to root-level members, got:\n{output}" - ); - - let updated = std::fs::read_to_string(ws_dir.join("fe.toml")).expect("read fe.toml"); - let value: toml::Value = updated.parse().expect("parse workspace fe.toml"); - let members = value - .get("members") - .and_then(|v| v.as_array()) - .expect("members array"); - assert!( - members.is_empty(), - "expected members to remain empty (no file writes), got: {members:?}" - ); -} - -#[test] -fn new_does_not_suggest_member_when_covered_by_existing_glob() { - let tmp = TempDir::new().expect("tempdir"); - let ws_dir = tmp.path().join("ws"); - std::fs::create_dir_all(&ws_dir).expect("create ws"); - std::fs::write( - ws_dir.join("fe.toml"), - r#"[workspace] -name = "ws" -version = "0.1.0" -members = ["ingots/*"] -exclude = ["target"] -"#, - ) - .expect("write fe.toml"); - - let member_dir = ws_dir.join("ingots").join("app"); - let (output, exit_code) = run_fe(&["new", member_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - assert!( - !output.contains("Workspace detected at"), - "expected `fe new` to skip workspace suggestion when member is covered by glob, got:\n{output}" - ); - - let updated = std::fs::read_to_string(ws_dir.join("fe.toml")).expect("read fe.toml"); - let value: toml::Value = updated.parse().expect("parse workspace fe.toml"); - let workspace = value - .get("workspace") - .and_then(|v| v.as_table()) - .expect("workspace table"); - let members = workspace - .get("members") - .and_then(|v| v.as_array()) - .expect("members array"); - assert!( - members.iter().any(|m| m.as_str() == Some("ingots/*")), - "expected members to retain glob entry, got: {members:?}" - ); - assert!( - !members.iter().any(|m| m.as_str() == Some("ingots/app")), - "expected members not to contain explicit \"ingots/app\", got: {members:?}" - ); -} - -#[test] -fn new_suggests_member_for_members_main_table() { - let tmp = TempDir::new().expect("tempdir"); - let ws_dir = tmp.path().join("ws"); - std::fs::create_dir_all(&ws_dir).expect("create ws"); - std::fs::write( - ws_dir.join("fe.toml"), - r#"[workspace] -name = "ws" -version = "0.1.0" -members = { main = [], dev = ["examples/*"] } -exclude = ["target"] -"#, - ) - .expect("write fe.toml"); - - let member_dir = ws_dir.join("app"); - let (output, exit_code) = run_fe(&["new", member_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - assert!( - output.contains("add \"app\" to [workspace].members.main"), - "expected `fe new` to print a workspace member suggestion for members.main, got:\n{output}" - ); - - let updated = std::fs::read_to_string(ws_dir.join("fe.toml")).expect("read fe.toml"); - let value: toml::Value = updated.parse().expect("parse workspace fe.toml"); - let workspace = value - .get("workspace") - .and_then(|v| v.as_table()) - .expect("workspace table"); - let members = workspace.get("members").expect("members value"); - let member_table = members.as_table().expect("members table"); - let main = member_table - .get("main") - .and_then(|v| v.as_array()) - .expect("members.main array"); - assert!( - main.is_empty(), - "expected members.main to remain empty (no file writes), got: {main:?}" - ); -} - -#[test] -fn new_errors_when_target_path_is_file() { - let tmp = TempDir::new().expect("tempdir"); - let target_file = tmp.path().join("not_a_dir"); - std::fs::write(&target_file, "hello").expect("write file"); - - let (output, exit_code) = run_fe(&["new", target_file.to_str().unwrap()], tmp.path()); - assert_ne!(exit_code, 0, "expected `fe new` to fail, got:\n{output}"); - assert!( - output.contains("exists and is a file; expected directory"), - "expected file-target error, got:\n{output}" - ); -} - -#[test] -fn new_refuses_to_overwrite_existing_fe_toml() { - let tmp = TempDir::new().expect("tempdir"); - let ingot_dir = tmp.path().join("my_ingot"); - std::fs::create_dir_all(&ingot_dir).expect("create ingot dir"); - std::fs::write( - ingot_dir.join("fe.toml"), - "[ingot]\nname = \"x\"\nversion = \"0.1.0\"\n", - ) - .expect("write fe.toml"); - - let (output, exit_code) = run_fe(&["new", ingot_dir.to_str().unwrap()], tmp.path()); - assert_ne!(exit_code, 0, "expected `fe new` to fail, got:\n{output}"); - assert!( - output.contains("Refusing to overwrite existing") && output.contains("fe.toml"), - "expected overwrite refusal for fe.toml, got:\n{output}" - ); -} - -#[test] -fn new_refuses_to_overwrite_existing_src_lib_fe() { - let tmp = TempDir::new().expect("tempdir"); - let ingot_dir = tmp.path().join("my_ingot"); - std::fs::create_dir_all(ingot_dir.join("src")).expect("create src dir"); - std::fs::write(ingot_dir.join("src/lib.fe"), "pub fn main() {}\n").expect("write lib.fe"); - - let (output, exit_code) = run_fe(&["new", ingot_dir.to_str().unwrap()], tmp.path()); - assert_ne!(exit_code, 0, "expected `fe new` to fail, got:\n{output}"); - assert!( - output.contains("Refusing to overwrite existing") - && (output.contains("src/lib.fe") || output.contains("src\\lib.fe")), - "expected overwrite refusal for src/lib.fe, got:\n{output}" - ); -} - -#[test] -fn new_does_not_print_workspace_suggestion_outside_workspace() { - let tmp = TempDir::new().expect("tempdir"); - let ingot_dir = tmp.path().join("my_ingot"); - - let (output, exit_code) = run_fe(&["new", ingot_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - assert!( - !output.contains("Workspace detected at"), - "expected no workspace suggestion outside a workspace, got:\n{output}" - ); -} - -#[test] -fn new_does_not_suggest_member_when_already_explicitly_listed() { - let tmp = TempDir::new().expect("tempdir"); - let ws_dir = tmp.path().join("ws"); - std::fs::create_dir_all(&ws_dir).expect("create ws"); - std::fs::write( - ws_dir.join("fe.toml"), - r#"[workspace] -name = "ws" -version = "0.1.0" -members = ["app"] -exclude = ["target"] -"#, - ) - .expect("write fe.toml"); - - let member_dir = ws_dir.join("app"); - let (output, exit_code) = run_fe(&["new", member_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - assert!( - !output.contains("Workspace detected at"), - "expected `fe new` to print no suggestion when member is already listed, got:\n{output}" - ); -} - -#[test] -fn new_suggests_member_for_nested_path_when_parent_dirs_do_not_exist() { - let tmp = TempDir::new().expect("tempdir"); - let ws_dir = tmp.path().join("ws"); - std::fs::create_dir_all(&ws_dir).expect("create ws"); - std::fs::write( - ws_dir.join("fe.toml"), - r#"[workspace] -name = "ws" -version = "0.1.0" -members = [] -exclude = ["target"] -"#, - ) - .expect("write fe.toml"); - - let member_dir = ws_dir.join("packages").join("app"); - let (output, exit_code) = run_fe(&["new", member_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - assert!( - output.contains("add \"packages/app\" to [workspace].members"), - "expected `fe new` to suggest the nested member path, got:\n{output}" - ); - assert!( - member_dir.join("fe.toml").is_file(), - "expected ingot fe.toml to be created" - ); - assert!( - member_dir.join("src/lib.fe").is_file(), - "expected ingot src/lib.fe to be created" - ); -} - -#[test] -fn new_warns_when_workspace_members_field_is_invalid_type() { - let tmp = TempDir::new().expect("tempdir"); - let ws_dir = tmp.path().join("ws"); - std::fs::create_dir_all(&ws_dir).expect("create ws"); - std::fs::write( - ws_dir.join("fe.toml"), - r#"[workspace] -name = "ws" -version = "0.1.0" -members = "oops" -exclude = ["target"] -"#, - ) - .expect("write fe.toml"); - - let member_dir = ws_dir.join("app"); - let (output, exit_code) = run_fe(&["new", member_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - assert!( - output.contains("failed to check workspace members"), - "expected warning when members is invalid type, got:\n{output}" - ); - assert!( - member_dir.join("fe.toml").is_file(), - "expected ingot fe.toml to be created" - ); -} - -#[test] -fn new_generated_project_passes_fe_test() { - let tmp = TempDir::new().expect("tempdir"); - let ingot_dir = tmp.path().join("my_counter"); - - let (output, exit_code) = run_fe(&["new", ingot_dir.to_str().unwrap()], tmp.path()); - assert_eq!(exit_code, 0, "fe new failed:\n{output}"); - - let (output, exit_code) = run_fe(&["test"], &ingot_dir); - assert_eq!(exit_code, 0, "fe test failed:\n{output}"); - assert!( - output.contains("test_counter") && output.contains("ok"), - "expected test_counter to pass, got:\n{output}" - ); -} diff --git a/crates/fe/tests/cli_output.rs b/crates/fe/tests/cli_output.rs deleted file mode 100644 index 7fc19d16da..0000000000 --- a/crates/fe/tests/cli_output.rs +++ /dev/null @@ -1,3196 +0,0 @@ -use dir_test::{Fixture, dir_test}; -use serde_json::Value; -use std::{fs, io::IsTerminal, path::Path, process::Command}; -use tempfile::tempdir; -use test_utils::{ - normalize::{normalize_newlines, normalize_path_separators, replace_path_token}, - snap_test, -}; - -// Helper function to normalize paths in output for portability -fn normalize_output(output: &str) -> String { - let output = normalize_newlines(output); - let output = normalize_path_separators(output.as_ref()); - - let manifest_dir = env!("CARGO_MANIFEST_DIR"); - let project_root = std::path::Path::new(manifest_dir) - .parent() - .expect("parent") - .parent() - .expect("parent"); - - let normalized = replace_path_token(&output, project_root, ""); - normalize_timing_output(&normalized) -} - -fn normalize_timing_output(output: &str) -> String { - let has_trailing_newline = output.ends_with('\n'); - let mut normalized = output - .lines() - .map(normalize_timing_line) - .collect::>() - .join("\n"); - if has_trailing_newline { - normalized.push('\n'); - } - normalized -} - -fn normalize_timing_line(line: &str) -> String { - let Some(status_idx) = ["PASS [", "FAIL [", "READY [", "ERROR ["] - .into_iter() - .filter_map(|marker| line.find(marker)) - .min() - else { - return line.to_string(); - }; - let Some(open_rel) = line[status_idx..].find('[') else { - return line.to_string(); - }; - let open = status_idx + open_rel; - let Some(close_rel) = line[open..].find(']') else { - return line.to_string(); - }; - let close = open + close_rel; - let bracket = &line[open + 1..close]; - let Some(seconds) = bracket.strip_suffix('s') else { - return line.to_string(); - }; - if seconds.is_empty() - || !seconds - .chars() - .all(|ch| ch.is_ascii_digit() || ch == '.' || ch == ' ') - { - return line.to_string(); - } - - let mut normalized = String::new(); - normalized.push_str(&line[..open]); - normalized.push_str("[