Full Code of etaoins/arret for AI

master 3b3bae27ca72 cached
328 files
1.6 MB
418.4k tokens
2542 symbols
1 requests
Download .txt
Showing preview only (1,710K chars total). Download the full file or copy to clipboard to get everything.
Repository: etaoins/arret
Branch: master
Commit: 3b3bae27ca72
Files: 328
Total size: 1.6 MB

Directory structure:
gitextract_wp8wxvol/

├── .arret-root
├── .buildkite/
│   ├── build-and-test.sh
│   ├── llvm-assert.Dockerfile
│   ├── pipeline.yml
│   ├── sync-rustdoc.sh
│   ├── update-multiarch-manifest.sh
│   └── vscode-extension-tests.sh
├── .dockerignore
├── .github/
│   ├── CODEOWNERS
│   └── renovate.json
├── .gitignore
├── .prettierrc
├── Cargo.toml
├── Dockerfile
├── LICENSE
├── README.md
├── compiler/
│   ├── Cargo.toml
│   ├── arret_root.rs
│   ├── codegen/
│   │   ├── alloc/
│   │   │   ├── core.rs
│   │   │   ├── mod.rs
│   │   │   ├── plan.rs
│   │   │   └── types.rs
│   │   ├── analysis/
│   │   │   ├── escape.rs
│   │   │   ├── mod.rs
│   │   │   └── names.rs
│   │   ├── box_layout.rs
│   │   ├── callee.rs
│   │   ├── const_gen.rs
│   │   ├── debug_info.rs
│   │   ├── fun_gen.rs
│   │   ├── jit.rs
│   │   ├── libcstr.rs
│   │   ├── math_gen.rs
│   │   ├── mod.rs
│   │   ├── mod_gen.rs
│   │   ├── op_gen.rs
│   │   ├── panic_gen.rs
│   │   ├── program.rs
│   │   ├── range_md.rs
│   │   ├── record_struct.rs
│   │   ├── target_gen.rs
│   │   ├── target_machine.rs
│   │   └── vector_gen.rs
│   ├── context.rs
│   ├── hir/
│   │   ├── destruc.rs
│   │   ├── error.rs
│   │   ├── exports.rs
│   │   ├── import/
│   │   │   ├── filter.rs
│   │   │   ├── mod.rs
│   │   │   └── parse.rs
│   │   ├── loader.rs
│   │   ├── lowering.rs
│   │   ├── macros/
│   │   │   ├── expander.rs
│   │   │   ├── linker.rs
│   │   │   ├── matcher.rs
│   │   │   └── mod.rs
│   │   ├── mod.rs
│   │   ├── ns.rs
│   │   ├── prim.rs
│   │   ├── records.rs
│   │   ├── scope.rs
│   │   ├── types.rs
│   │   ├── util.rs
│   │   ├── var_id.rs
│   │   └── visitor.rs
│   ├── id_type.rs
│   ├── lib.rs
│   ├── mir/
│   │   ├── app_purity.rs
│   │   ├── arg_list.rs
│   │   ├── builder.rs
│   │   ├── costing.rs
│   │   ├── env_values.rs
│   │   ├── equality.rs
│   │   ├── error.rs
│   │   ├── eval_hir.rs
│   │   ├── inliner.rs
│   │   ├── intrinsic/
│   │   │   ├── bitwise.rs
│   │   │   ├── list.rs
│   │   │   ├── math.rs
│   │   │   ├── mod.rs
│   │   │   ├── num_utils.rs
│   │   │   ├── number.rs
│   │   │   ├── panics.rs
│   │   │   ├── partial_print.rs
│   │   │   ├── print.rs
│   │   │   ├── testing.rs
│   │   │   └── vector.rs
│   │   ├── mod.rs
│   │   ├── ops.rs
│   │   ├── optimise/
│   │   │   ├── duplicate_alloc_ops.rs
│   │   │   ├── mod.rs
│   │   │   └── unused_ops.rs
│   │   ├── polymorph.rs
│   │   ├── printer.rs
│   │   ├── record_field.rs
│   │   ├── ret_value.rs
│   │   ├── rust_fun.rs
│   │   ├── specific_abi_type.rs
│   │   ├── tagset.rs
│   │   ├── typred.rs
│   │   ├── value/
│   │   │   ├── arret_fun.rs
│   │   │   ├── build_reg.rs
│   │   │   ├── from_reg.rs
│   │   │   ├── list.rs
│   │   │   ├── mod.rs
│   │   │   ├── plan_phi.rs
│   │   │   ├── synthetic_fun.rs
│   │   │   ├── to_const.rs
│   │   │   └── types.rs
│   │   └── vector_member.rs
│   ├── promise.rs
│   ├── repl.rs
│   ├── reporting.rs
│   ├── rfi/
│   │   └── mod.rs
│   ├── source.rs
│   ├── tests/
│   │   ├── compile-error/
│   │   │   ├── arity.arret
│   │   │   ├── bit-shift-left-negative.arret
│   │   │   ├── bit-shift-right-overflow.arret
│   │   │   ├── destruc-errors.arret
│   │   │   ├── fn-lowering-errors.arret
│   │   │   ├── if-errors.arret
│   │   │   ├── import-parse-errors.arret
│   │   │   ├── macro-errors.arret
│   │   │   ├── misc-body-errors.arret
│   │   │   ├── misc-top-level-errors.arret
│   │   │   ├── missing-module.arret
│   │   │   ├── no-main.arret
│   │   │   ├── overflow-add.arret
│   │   │   ├── overflow-multiply.arret
│   │   │   ├── overflow-quot.arret
│   │   │   ├── overflow-subtract.arret
│   │   │   ├── quot-by-zero.arret
│   │   │   ├── record-errors.arret
│   │   │   ├── recur-errors.arret
│   │   │   ├── reference-errors.arret
│   │   │   ├── rem-by-zero.arret
│   │   │   ├── syntax-error.arret
│   │   │   ├── type-checking-errors.arret
│   │   │   ├── type-lowering-errors.arret
│   │   │   ├── vector-assoc-negative.arret
│   │   │   ├── vector-assoc-out-of-bounds.arret
│   │   │   ├── vector-ref-negative.arret
│   │   │   ├── vector-ref-out-of-bounds.arret
│   │   │   └── wrong-main-type.arret
│   │   ├── integration.rs
│   │   ├── optimise/
│   │   │   ├── application.arret
│   │   │   ├── bitwise.arret
│   │   │   ├── const.arret
│   │   │   ├── equality.arret
│   │   │   ├── inliner.arret
│   │   │   ├── list.arret
│   │   │   ├── math.arret
│   │   │   ├── number.arret
│   │   │   ├── typred.arret
│   │   │   └── vector.arret
│   │   ├── run-error/
│   │   │   ├── impure-panic.arret
│   │   │   ├── impure-panic.stderr
│   │   │   ├── infinite-to-int.arret
│   │   │   ├── infinite-to-int.stderr
│   │   │   ├── nan-to-int.arret
│   │   │   ├── nan-to-int.stderr
│   │   │   ├── overflow-add.arret
│   │   │   ├── overflow-add.stderr
│   │   │   ├── overflow-multiply.arret
│   │   │   ├── overflow-multiply.stderr
│   │   │   ├── overflow-quot.arret
│   │   │   ├── overflow-quot.stderr
│   │   │   ├── overflow-subtract.arret
│   │   │   ├── overflow-subtract.stderr
│   │   │   ├── pure-panic.arret
│   │   │   ├── pure-panic.stderr
│   │   │   ├── quot-by-zero.arret
│   │   │   ├── quot-by-zero.stderr
│   │   │   ├── rem-by-zero.arret
│   │   │   └── rem-by-zero.stderr
│   │   └── run-pass/
│   │       ├── application.arret
│   │       ├── binding.arret
│   │       ├── bitwise.arret
│   │       ├── closure-typing.arret
│   │       ├── closure.arret
│   │       ├── comments.arret
│   │       ├── conditionals.arret
│   │       ├── divergence.arret
│   │       ├── empty.arret
│   │       ├── equality.arret
│   │       ├── hash.arret
│   │       ├── list.arret
│   │       ├── macros.arret
│   │       ├── math.arret
│   │       ├── number.arret
│   │       ├── occurrence-typing.arret
│   │       ├── read.arret
│   │       ├── record.arret
│   │       ├── recursion.arret
│   │       ├── set.arret
│   │       ├── type-definitions.arret
│   │       ├── typred.arret
│   │       ├── vector.arret
│   │       └── write.arret
│   ├── ty/
│   │   ├── conv_abi.rs
│   │   ├── datum.rs
│   │   ├── intersect.rs
│   │   ├── is_a.rs
│   │   ├── list_iter.rs
│   │   ├── mod.rs
│   │   ├── pred.rs
│   │   ├── props.rs
│   │   ├── purity.rs
│   │   ├── record.rs
│   │   ├── select.rs
│   │   ├── subst.rs
│   │   ├── subtract.rs
│   │   ├── ty_args.rs
│   │   ├── unify.rs
│   │   └── var_usage.rs
│   └── typeck/
│       ├── dce.rs
│       ├── destruc.rs
│       ├── error.rs
│       ├── infer.rs
│       └── mod.rs
├── docker-compose.yml
├── docs/
│   └── language-design.md
├── driver/
│   ├── Cargo.toml
│   ├── main.rs
│   ├── subcommand/
│   │   ├── compile.rs
│   │   ├── eval.rs
│   │   ├── mod.rs
│   │   └── repl/
│   │       ├── arret_helper.rs
│   │       ├── command.rs
│   │       ├── history.rs
│   │       ├── mod.rs
│   │       └── syntax.rs
│   └── tests/
│       └── integration/
│           ├── hello-world.arret
│           └── run.sh
├── editors/
│   └── code/
│       ├── .dockerignore
│       ├── .eslintrc.yml
│       ├── .gitignore
│       ├── .vscode/
│       │   ├── launch.json
│       │   ├── settings.json
│       │   └── tasks.json
│       ├── Dockerfile
│       ├── language-configuration.json
│       ├── package.json
│       ├── src/
│       │   ├── extension.ts
│       │   └── test/
│       │       ├── colorize-fixtures/
│       │       │   └── sample.arret
│       │       ├── colorize-results/
│       │       │   └── sample_arret.json
│       │       ├── downloadVsCode.ts
│       │       ├── runTest.ts
│       │       ├── suite/
│       │       │   ├── colorization.test.ts
│       │       │   ├── extension.test.ts
│       │       │   └── index.ts
│       │       └── vsCodeVersion.ts
│       ├── syntaxes/
│       │   └── arret.tmLanguage.json
│       └── tsconfig.json
├── lsp-server/
│   ├── Cargo.toml
│   ├── capabilities.rs
│   ├── handler/
│   │   ├── mod.rs
│   │   ├── text_synchronisation.rs
│   │   └── workspace.rs
│   ├── json_rpc.rs
│   ├── main.rs
│   ├── model/
│   │   ├── document.rs
│   │   ├── mod.rs
│   │   └── workspace.rs
│   ├── session.rs
│   ├── transport/
│   │   ├── bytestream.rs
│   │   └── mod.rs
│   └── watcher/
│       ├── mod.rs
│       └── syntax.rs
├── rfi-derive/
│   ├── Cargo.toml
│   └── lib.rs
├── runtime/
│   ├── Cargo.toml
│   ├── abitype.rs
│   ├── binding.rs
│   ├── boxed/
│   │   ├── heap/
│   │   │   ├── collect.rs
│   │   │   ├── mod.rs
│   │   │   └── type_info.rs
│   │   ├── mod.rs
│   │   ├── refs.rs
│   │   └── types/
│   │       ├── char.rs
│   │       ├── field_value.rs
│   │       ├── float.rs
│   │       ├── fun.rs
│   │       ├── int.rs
│   │       ├── list.rs
│   │       ├── map.rs
│   │       ├── mod.rs
│   │       ├── record.rs
│   │       ├── record_data.rs
│   │       ├── set.rs
│   │       ├── shared_str.rs
│   │       ├── str.rs
│   │       ├── sym.rs
│   │       └── vector.rs
│   ├── callback.rs
│   ├── class_map.rs
│   ├── compiler_support.rs
│   ├── intern.rs
│   ├── lib.rs
│   ├── persistent/
│   │   ├── mod.rs
│   │   └── vector.rs
│   └── task.rs
├── runtime-syntax/
│   ├── Cargo.toml
│   ├── lib.rs
│   ├── reader.rs
│   └── writer.rs
├── stdlib/
│   ├── arret/
│   │   ├── base.arret
│   │   ├── set.arret
│   │   └── test.arret
│   └── rust/
│       ├── Cargo.toml
│       ├── bitwise.rs
│       ├── hash.rs
│       ├── lib.rs
│       ├── list.rs
│       ├── math.rs
│       ├── number.rs
│       ├── read.rs
│       ├── set.rs
│       ├── testing.rs
│       ├── vector.rs
│       └── write.rs
└── syntax/
    ├── Cargo.toml
    ├── anon_fun.rs
    ├── datum.rs
    ├── error.rs
    ├── lib.rs
    ├── parser.rs
    └── span.rs

================================================
FILE CONTENTS
================================================

================================================
FILE: .arret-root
================================================


================================================
FILE: .buildkite/build-and-test.sh
================================================
#!/bin/sh
set -eu

# Deny warnings on CI
export RUSTFLAGS="-D warnings"

echo '--- :cargo: Compiling debug'
cargo build

echo '--- :pray: Testing debug'
cargo test

echo '--- :keyboard: Testing driver'
./driver/tests/integration/run.sh target/debug/arret


================================================
FILE: .buildkite/llvm-assert.Dockerfile
================================================
ARG LLVM_VERSION=11.1.0
ARG LLVM_ROOT=/opt/llvm-11

##

FROM fedora:33 AS fedora-common

RUN dnf install -y gcc-c++
# `dnf clean all` happens in later stages

##

FROM fedora-common AS llvm-build
ARG LLVM_VERSION
ARG LLVM_ROOT

RUN dnf install -y file cmake ninja-build xz && \
  dnf clean all

WORKDIR /usr/src

RUN curl https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/llvm-11.1.0.src.tar.xz -sSL | \
  tar -Jx --no-same-owner

WORKDIR /usr/src/llvm-build

# We need to be careful to use less than 4GiB on our build agents
RUN cmake \
  -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=${LLVM_ROOT} \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DLLVM_TARGETS_TO_BUILD=AArch64 \
  -DLLVM_ENABLE_WARNINGS=OFF \
  # Disable a spammy ABI change warning on GCC 7 that `ENABLE_WARNINGS=OFF`
  # doesn't suppress.
  -DCMAKE_CXX_FLAGS=-Wno-psabi \
  -DLLVM_USE_LINKER=gold \
  ../llvm-${LLVM_VERSION}.src

RUN ninja install

##

FROM fedora-common
ARG LLVM_ROOT

COPY --from=llvm-build ${LLVM_ROOT} ${LLVM_ROOT}

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.53.0 --profile=minimal --component rustfmt

ENV PATH "/root/.cargo/bin:${PATH}"
ENV LLVM_SYS_100_PREFIX "${LLVM_ROOT}"


================================================
FILE: .buildkite/pipeline.yml
================================================
cached-ecr-build-env: &cached-ecr-build-env
  plugins:
    - seek-oss/docker-ecr-cache#v1.11.0:
        target: build-env
        cache-on:
          - Cargo.lock
    - docker#v3.9.0

docker-ghcr-login: &docker-ghcr-login
  docker-login#v2.0.1:
    server: ghcr.io
    username: etaoins
    password-env: CR_PAT

steps:
  - label: ':muscle: Test ARM64'
    agents: { queue: arm64 }
    command:
      - ./.buildkite/build-and-test.sh

      - "echo '--- :sleuth_or_spy: Checking release'"
      - RUSTFLAGS="-Copt-level=0" cargo check --release
    <<: *cached-ecr-build-env

  - label: ':ubuntu: Test AMD64'
    agents: { queue: amd64 }
    command:
      - ./.buildkite/build-and-test.sh
    <<: *cached-ecr-build-env

  - label: ':fedora: Test LLVM assert'
    branches: '!master'
    agents: { queue: arm64 }
    command:
      - "echo '--- :prettier: Checking rustfmt'"
      - cargo fmt -- --check

      - ./.buildkite/build-and-test.sh
    plugins:
      - seek-oss/docker-ecr-cache#v1.11.0:
          dockerfile: ./.buildkite/llvm-assert.Dockerfile
      - docker#v3.9.0

  - label: ':typescript: Test VS Code extension'
    agents: { queue: amd64 }
    command:
      - ./.buildkite/vscode-extension-tests.sh
    plugins:
      - seek-oss/docker-ecr-cache#v1.11.0:
          dockerfile: ./editors/code/Dockerfile
          ecr-name: build-cache/arret/vscode-extension
          cache-on:
            - ./editors/code/yarn.lock
            - ./editors/code/src/test/vsCodeVersion.ts
      - docker#v3.9.0:
          volumes:
            - '/workdir/editors/code/node_modules'
            - '/workdir/editors/code/.vscode-test'

  - wait

  - label: ':mechanical_arm: Push ARM64 REPL image'
    key: 'push-arm64-repl-image'
    branches: 'master'
    agents: { queue: arm64 }
    plugins:
      - *docker-ghcr-login
      - docker-compose#v3.9.0:
          push:
            - repl:ghcr.io/etaoins/arret-repl-arm64
          env:
            - BUILDKITE_COMMIT

  - label: ':rocket: Push AMD64 REPL image'
    key: 'push-amd64-repl-image'
    branches: 'master'
    agents: { queue: amd64 }
    plugins:
      - *docker-ghcr-login
      - docker-compose#v3.9.0:
          push:
            - repl:ghcr.io/etaoins/arret-repl-amd64
          env:
            - BUILDKITE_COMMIT

  - label: ':docker: Update multiarch manifest'
    branches: 'master'
    agents: { queue: arm64 }
    depends_on:
      - 'push-amd64-repl-image'
      - 'push-arm64-repl-image'
    command:
      - ./.buildkite/update-multiarch-manifest.sh
    plugins:
      - *docker-ghcr-login

  - label: ':rust: Check (Rust Beta)'
    branches: 'master'
    agents: { queue: arm64 }
    command:
      - "echo '--- :rust: Installing Rust beta'"
      - rustup default beta

      - "echo '--- :male-detective: Checking debug'"
      - cargo check

      - "echo '--- :female-detective: Checking release'"
      - RUSTFLAGS="-Copt-level=0" cargo check --release
    <<: *cached-ecr-build-env

  - label: ':books: Update Rustdoc'
    branches: 'master'
    agents: { queue: arm64 }
    command:
      - "echo '--- :book: Building rustdoc'"
      - cargo doc --no-deps

      - "echo '--- :rust: Installing awscli'"
      - apt-get update
      - DEBIAN_FRONTEND=noninteractive apt-get -y install awscli

      - ./.buildkite/sync-rustdoc.sh
    <<: *cached-ecr-build-env
    concurrency_group: 'update-rustdoc'
    concurrency: 1


================================================
FILE: .buildkite/sync-rustdoc.sh
================================================
#!/bin/sh

set -eu

S3_BUCKET_NAME=arret-lang-rustdoc
CLOUDFRONT_DISTRIBUTION_ID=E1FFCMKSLRZAZ

echo '--- :s3: Updating S3'
aws s3 sync --only-show-errors --delete --cache-control "max-age=3600" \
	target/doc/ "s3://${S3_BUCKET_NAME}"

echo '--- :cloudfront: Invalidating CloudFront'
aws cloudfront create-invalidation \
	--distribution-id "${CLOUDFRONT_DISTRIBUTION_ID}" \
	--paths '/*'



================================================
FILE: .buildkite/update-multiarch-manifest.sh
================================================
#!/usr/bin/env bash
set -eu

# Needed for `docker manifest`
export DOCKER_CLI_EXPERIMENTAL=enabled

manifest=ghcr.io/etaoins/arret-repl

docker manifest create -a "${manifest}" "${manifest}-arm64" "${manifest}-amd64"
docker manifest push "${manifest}"

================================================
FILE: .buildkite/vscode-extension-tests.sh
================================================
#!/usr/bin/env bash
set -eu

export DISPLAY=':99.0'
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &

cd editors/code
yarn test
yarn lint
yarn vscode:package


================================================
FILE: .dockerignore
================================================
/target/
/.git

# These are build files that aren't needed inside the Docker container. Ignore them so we don't
# trigger a recompile when experimenting with Docker
/.dockerignore
/docker-compose.yml
/Dockerfile


================================================
FILE: .github/CODEOWNERS
================================================
*	@etaoins


================================================
FILE: .github/renovate.json
================================================
{
  "extends": ["config:base", "docker:disable"],
  "cargo": {
    "enabled": true
  },
  "timezone": "Australia/Melbourne",
  "schedule": ["before 5am every 2 weeks on Sunday"],
  "prCreation": "not-pending",
  "packageRules": [
    {
      "managers": ["npm"],
      "depTypeList": ["devDependencies"],
      "packagePatterns": ["^@typescript-eslint/", "^eslint-"],
      "packageNames": ["eslint"],
      "groupName": "eslint deps"
    },
    {
      "managers": ["npm"],
      "depTypeList": ["devDependencies"],
      "packageNames": ["vsce", "vscode-test", "@types/vscode"],
      "groupName": "VS Code deps"
    },
    {
      "managers": ["npm"],
      "depTypeList": ["devDependencies"],
      "packagePatterns": ["^@types/"],
      "groupName": "npm Definitely Typed deps"
    }
  ]
}


================================================
FILE: .gitignore
================================================
/target/
/rls/
**/*.rs.bk


================================================
FILE: .prettierrc
================================================
{
  "singleQuote": true,
  "trailingComma": "all"
}


================================================
FILE: Cargo.toml
================================================
[workspace]
members = [
	"syntax",
	"compiler",
	"driver",
	"lsp-server",
	"runtime",
	"runtime-syntax",
	"rfi-derive",
	"stdlib/rust"
]

================================================
FILE: Dockerfile
================================================
FROM ubuntu:20.04 AS build-env

RUN \
  apt-get update && \
  apt-get -y install --no-install-recommends ca-certificates curl gcc zlib1g-dev libstdc++-9-dev llvm-10 llvm-10-dev && \
  apt-get clean
ENV LLVM_SYS_10_PREFIX /usr/lib/llvm-10

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.53.0 --profile=minimal
ENV PATH "/root/.cargo/bin:${PATH}"

# These are the minimum required files for `cargo fetch`
# This allows the `cargo fetch` to be cached between other source code changes
ADD Cargo.toml Cargo.lock /opt/arret/
ADD syntax/Cargo.toml /opt/arret/syntax/
ADD runtime/Cargo.toml /opt/arret/runtime/
ADD runtime-syntax/Cargo.toml /opt/arret/runtime-syntax/
ADD rfi-derive/Cargo.toml /opt/arret/rfi-derive/
ADD stdlib/rust/Cargo.toml /opt/arret/stdlib/rust/
ADD compiler/Cargo.toml /opt/arret/compiler/
ADD driver/Cargo.toml /opt/arret/driver/
ADD lsp-server/Cargo.toml /opt/arret/lsp-server/

WORKDIR /opt/arret

RUN cargo fetch
ADD . /opt/arret

###

FROM build-env as full-compiler
RUN cargo build --release

###

FROM ubuntu:20.04 AS repl

ARG vcs_ref

COPY --from=full-compiler /opt/arret/.arret-root /opt/arret/.arret-root
COPY --from=full-compiler /opt/arret/stdlib/arret /opt/arret/stdlib/arret
COPY --from=full-compiler /opt/arret/target/release/arret /opt/arret/target/release/arret
COPY --from=full-compiler /opt/arret/target/release/*.so /opt/arret/target/release/

RUN groupadd arret && useradd -r -g arret arret
USER arret:arret

WORKDIR /opt/arret
ENTRYPOINT ["/opt/arret/target/release/arret"]
CMD ["repl"]

# Label the commit that was used to build this
LABEL \
  org.label-schema.vcs-ref=$vcs_ref \
  org.label-schema.vcs-url="https://github.com/etaoins/arret"


================================================
FILE: LICENSE
================================================
                                 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.


================================================
FILE: README.md
================================================
# Arret

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Build status](https://badge.buildkite.com/bcda02e06b6795e669edae4264bdecbb11ff98b4f5afb1fa4b.svg?branch=master)](https://buildkite.com/arret/arret)

## Overview

Arret is pure functional, strongly typed language with Lisp-like syntax.
It aims to combine the expressiveness of Lisp with guarantees provided by functional programming.
The [language design documentation](./docs/language-design.md) has a high-level summary of the language's design choices.

The Arret compiler and parts of its standard library are written in Rust.
The mechanism for calling Rust code from Arret is referred to as the Rust Function Interface or RFI.
Documentation for the [`arret_runtime` crate](https://rustdoc.arret-lang.org/arret_runtime/index.html) describes the core concepts of the RFI.

## Installation

### Docker REPL Image

There is a public Docker image at `ghcr.io/etaoins/arret-repl` that runs the Arret REPL.
Whenever `cargo run repl` appears in the documentation this command can be used instead:

```shell
> docker run -ti ghcr.io/etaoins/arret-repl
```

It can also evaluate single file programs:

```shell
> cat hello-world.arret
(import [stdlib base])
(defn main! ()
  (println! "Hello, world!"))

> docker run -i ghcr.io/etaoins/arret-repl eval - < hello-world.arret
Hello, world!
```

### Build Requirements

1. A Unix-like host running on ARM64, x86-64 or x86-32.
   These are the platforms supporting lazy compilation with LLVM's ORC JIT.
1. [LLVM](http://releases.llvm.org) 10 or 11
1. [Rust](https://www.rust-lang.org)

### Building with rustup and Cargo

```shell
> curl https://sh.rustup.rs -sSf | sh
> cd ~/path/to/repo/root
> cargo run repl
```

## Usage

### REPL

The REPL provides an interactive environment for exploring Arret.
It's supported as a first class environment in Arret; the REPL is just as powerful as the compiler.

```text
> cargo run repl
arret> (length '(1 2 3 4 5))
=> 5
arret> (defn identity #{T} ([x T]) -> T x)
defined
arret> /type identity
=> (All #{T} T -> T)
arret> (identity "Hello, world!")
=> "Hello, world!"
arret> /type (identity [one two three])
=> (Vector 'one 'two 'three)
arret> /quit
```

### Compiler

Compiled programs have a `(main!)` function as their entry point:

```clojure
(import [stdlib base])

(defn main! ()
  (println! "Hello, world!"))
```

These can be compiled to a static binary by running Arret with the path name:

```sh
> cargo run compile hello-world.arret
> ./hello-world
"Hello, world!"
```

### Editors

A basic [Visual Studio Code](https://code.visualstudio.com) extension is bundled in [editors/code](./editors/code).
This uses the [Language Server](https://microsoft.github.io/language-server-protocol/) from the [lsp-server crate](./lsp-server).

```sh
# Install `arret-lsp-server`
cargo install --path lsp-server

# Install the Visual Studio code extension
cd editors/code
yarn
yarn vscode:install
```

## Examples

The Arret language is still rapidly evolving.
This makes it impractical to provide accurate documentation of the language and standard library.
However, the test programs in [run-pass](compiler/tests/run-pass) give examples of working Arret code.


================================================
FILE: compiler/Cargo.toml
================================================
[package]
name = "arret-compiler"
version = "0.1.0"
edition = "2018"
authors = ["Ryan Cumming <etaoins@gmail.com>"]

[lib]
path = "lib.rs"
crate-type = ["lib"]

[dependencies]
llvm-sys = "100"
libc = "0.2"
libloading = "0.7"
arret-syntax = { path = "../syntax" }
arret-runtime = { path = "../runtime" }
arret-runtime-syntax = { path = "../runtime-syntax" }
codespan-reporting = "0.11"
crossbeam-channel = "0.5"
termcolor = "1"

[dev-dependencies]
tempfile = "3"
num_cpus = "1.13"

================================================
FILE: compiler/arret_root.rs
================================================
use std::{env, path};

const ARRET_ROOT_ENV_VAR: &str = "ARRET_ROOT";

fn is_arret_root(path: &path::Path) -> bool {
    path.join("./.arret-root").is_file()
}

pub struct InvalidOptionError {
    invalid_path: path::PathBuf,
}

impl InvalidOptionError {
    /// Path to the invalid Arret root
    pub fn invalid_path(&self) -> &path::Path {
        &self.invalid_path
    }
}

pub struct InvalidEnvVarError {
    invalid_path: path::PathBuf,
}

impl InvalidEnvVarError {
    /// Environment variable that contained the invalid root
    pub fn env_var_name(&self) -> &'static str {
        ARRET_ROOT_ENV_VAR
    }

    /// Path to the invalid Arret root
    pub fn invalid_path(&self) -> &path::Path {
        &self.invalid_path
    }
}

pub enum FindArretRootError {
    /// Explicitly specified option was not an Arret root
    InvalidOption(InvalidOptionError),
    /// Environment variable with the given name is not an Arret root
    InvalidEnvVar(InvalidEnvVarError),
    /// Heuristic search failed
    NotFound,
}

/// Attempts to find the path to Arret root directory
///
/// The search order is:
/// 1. The `arret_root_option` parameter
/// 2. The `ARRET_ROOT` environment variable
/// 3. The path this binary was originally built in and all of its parents
/// 4. The current directory and all of its parents
pub fn find_arret_root(
    arret_root_option: Option<&str>,
) -> Result<path::PathBuf, FindArretRootError> {
    if let Some(arg_root) = arret_root_option {
        let arg_path = path::PathBuf::from(arg_root);
        if !is_arret_root(&arg_path) {
            return Err(FindArretRootError::InvalidOption(InvalidOptionError {
                invalid_path: arg_path,
            }));
        }

        return Ok(arg_path);
    }

    if let Some(env_root) = env::var_os(ARRET_ROOT_ENV_VAR) {
        let env_path = path::PathBuf::from(env_root);
        if !is_arret_root(&env_path) {
            return Err(FindArretRootError::InvalidEnvVar(InvalidEnvVarError {
                invalid_path: env_path,
            }));
        }

        return Ok(env_path);
    }

    if let Some(manifest_dir) = option_env!("CARGO_MANIFEST_DIR") {
        for candidate in path::Path::new(manifest_dir).ancestors() {
            if is_arret_root(candidate) {
                return Ok(candidate.to_owned());
            }
        }
    }

    let current_dir = env::current_dir().expect("Cannot determine current directory");
    for candidate in path::Path::new(&current_dir).ancestors() {
        if is_arret_root(candidate) {
            return Ok(candidate.to_owned());
        }
    }

    Err(FindArretRootError::NotFound)
}


================================================
FILE: compiler/codegen/alloc/core.rs
================================================
use std::{mem, ptr};

use llvm_sys::core::*;
use llvm_sys::prelude::*;
use llvm_sys::{LLVMAttributeFunctionIndex, LLVMAttributeReturnIndex, LLVMIntPredicate};

use arret_runtime::boxed;

use crate::codegen::alloc::{ActiveAlloc, AllocAtom, BoxSource};
use crate::codegen::mod_gen::ModCtx;
use crate::codegen::target_gen::TargetCtx;
use crate::libcstr;

fn init_alloced_box_header(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    alloced_box: LLVMValueRef,
    header: boxed::Header,
) {
    unsafe {
        let header_ptr = LLVMBuildStructGEP(builder, alloced_box, 0, libcstr!("header_ptr"));
        LLVMBuildStore(builder, tcx.llvm_box_header(header), header_ptr);
    }
}

fn gen_stack_alloced_box<T: boxed::ConstTagged>(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    llvm_type: LLVMTypeRef,
    value_name: &[u8],
) -> LLVMValueRef {
    unsafe {
        let type_tag = T::TYPE_TAG;

        let alloced_box = LLVMBuildAlloca(builder, llvm_type, value_name.as_ptr() as *const _);
        LLVMSetAlignment(alloced_box, mem::align_of::<T>() as u32);

        init_alloced_box_header(
            tcx,
            builder,
            alloced_box,
            boxed::Header::new(type_tag, boxed::AllocType::Stack),
        );

        alloced_box
    }
}

fn gen_heap_alloced_box<T: boxed::ConstTagged>(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_size: boxed::BoxSize,
    llvm_type: LLVMTypeRef,
    value_name: &[u8],
) -> LLVMValueRef {
    unsafe {
        assert!(
            !active_alloc.is_empty(),
            "attempt to create heap box with empty active heap allocation"
        );

        let cell_count = box_size.cell_count();

        let slot_index = active_alloc.used_cells;
        let llvm_slot = if slot_index == 0 {
            active_alloc.box_slots
        } else {
            let gep_indices = &mut [LLVMConstInt(
                LLVMInt32TypeInContext(tcx.llx),
                slot_index as u64,
                0,
            )];

            LLVMBuildInBoundsGEP(
                builder,
                active_alloc.box_slots,
                gep_indices.as_mut_ptr(),
                gep_indices.len() as u32,
                libcstr!("slot"),
            )
        };

        active_alloc.used_cells += cell_count;
        assert!(active_alloc.used_cells <= active_alloc.total_cells);

        let type_tag = T::TYPE_TAG;
        let alloced_box = LLVMBuildBitCast(
            builder,
            llvm_slot,
            LLVMPointerType(llvm_type, 0),
            value_name.as_ptr() as *const _,
        );

        init_alloced_box_header(
            tcx,
            builder,
            alloced_box,
            boxed::Header::new(type_tag, box_size.to_heap_alloc_type()),
        );

        alloced_box
    }
}

pub fn gen_alloced_box_with_llvm_type<T: boxed::ConstTagged>(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_source: BoxSource,
    llvm_type: LLVMTypeRef,
    value_name: &[u8],
) -> LLVMValueRef {
    match box_source {
        BoxSource::Stack => gen_stack_alloced_box::<T>(tcx, builder, llvm_type, value_name),
        BoxSource::Heap(box_size) => {
            gen_heap_alloced_box::<T>(tcx, builder, active_alloc, box_size, llvm_type, value_name)
        }
    }
}

pub fn gen_alloced_box<T: boxed::ConstTagged>(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_source: BoxSource,
    value_name: &[u8],
) -> LLVMValueRef {
    let llvm_type = tcx.boxed_abi_to_llvm_struct_type(&T::TYPE_TAG.into());

    gen_alloced_box_with_llvm_type::<T>(
        tcx,
        builder,
        active_alloc,
        box_source,
        llvm_type,
        value_name,
    )
}

/// Allocates cells by invoking a function at runtime
///
/// This is the slow path; it is only used when our current heap segment is full.
fn gen_runtime_heap_alloc(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    builder: LLVMBuilderRef,
    llvm_task: LLVMValueRef,
    required_cells: usize,
) -> LLVMValueRef {
    use arret_runtime::abitype;

    unsafe {
        let llvm_i32 = LLVMInt32TypeInContext(tcx.llx);
        let llvm_param_types = &mut [tcx.task_llvm_ptr_type(), llvm_i32];

        let alloc_cells_llvm_type = LLVMFunctionType(
            tcx.boxed_abi_to_llvm_ptr_type(&abitype::BoxedAbiType::Any),
            llvm_param_types.as_mut_ptr(),
            llvm_param_types.len() as u32,
            0,
        );

        let alloc_cells_fun = mcx.get_function_or_insert(
            alloc_cells_llvm_type,
            b"arret_runtime_alloc_cells\0",
            |alloc_cells_fun| {
                LLVMAddAttributeAtIndex(
                    alloc_cells_fun,
                    LLVMAttributeFunctionIndex,
                    tcx.llvm_enum_attr_for_name("cold", 0),
                );
                LLVMAddAttributeAtIndex(
                    alloc_cells_fun,
                    LLVMAttributeReturnIndex,
                    tcx.llvm_boxed_align_attr(),
                );
                LLVMAddAttributeAtIndex(
                    alloc_cells_fun,
                    LLVMAttributeReturnIndex,
                    tcx.llvm_noalias_attr(),
                );
            },
        );

        let alloc_cells_args = &mut [llvm_task, LLVMConstInt(llvm_i32, required_cells as u64, 0)];

        let runtime_box_slots = LLVMBuildCall(
            builder,
            alloc_cells_fun,
            alloc_cells_args.as_mut_ptr(),
            alloc_cells_args.len() as u32,
            libcstr!("runtime_box_slots"),
        );

        // We can dereference the entire allocation immediately
        let dereferenceable_attr = tcx.llvm_enum_attr_for_name(
            "dereferenceable",
            (mem::size_of::<boxed::Any>() * required_cells) as u64,
        );
        LLVMAddCallSiteAttribute(
            runtime_box_slots,
            LLVMAttributeReturnIndex,
            dereferenceable_attr,
        );

        runtime_box_slots
    }
}

/// Generates an `ActiveAlloc` containing the required allocations for the passed `AllocAtom`
///
/// This will first attempt a bump allocation on the task's current segment. If that fails it will
/// fallback to the runtime.
pub fn atom_into_active_alloc<'op>(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    builder: LLVMBuilderRef,
    llvm_task: LLVMValueRef,
    atom: AllocAtom<'op>,
) -> ActiveAlloc<'op> {
    use arret_runtime::abitype;

    let required_cells = atom
        .box_sources
        .iter()
        .map(|box_source| match box_source {
            BoxSource::Stack => 0,
            BoxSource::Heap(box_size) => box_size.cell_count(),
        })
        .sum();

    if required_cells == 0 {
        return ActiveAlloc {
            box_slots: ptr::null_mut(),
            total_cells: 0,
            used_cells: 0,

            box_source_iter: atom.box_sources.into_iter(),
            cond_plan_iter: atom.cond_plans.into_iter(),
        };
    }

    unsafe {
        let function = LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder));

        let mut bump_alloc_block =
            LLVMAppendBasicBlockInContext(tcx.llx, function, libcstr!("bump_alloc"));

        let mut runtime_alloc_block =
            LLVMAppendBasicBlockInContext(tcx.llx, function, libcstr!("runtime_alloc"));

        let cont_block = LLVMAppendBasicBlockInContext(tcx.llx, function, libcstr!("alloc_cont"));

        let seg_next_ptr = LLVMBuildStructGEP(builder, llvm_task, 0, libcstr!("seg_next_ptr"));
        let mut seg_old_next = LLVMBuildLoad(builder, seg_next_ptr, libcstr!("seg_old_next"));

        let gep_indices = &mut [LLVMConstInt(
            LLVMInt32TypeInContext(tcx.llx),
            required_cells as u64,
            0,
        )];
        let seg_new_next = LLVMBuildInBoundsGEP(
            builder,
            seg_old_next,
            gep_indices.as_mut_ptr(),
            gep_indices.len() as u32,
            libcstr!("seg_new_next"),
        );

        let seg_end_ptr = LLVMBuildStructGEP(builder, llvm_task, 1, libcstr!("seg_end_ptr"));
        let seg_end = LLVMBuildLoad(builder, seg_end_ptr, libcstr!("seg_end"));

        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);
        let seg_new_next_int = LLVMBuildPtrToInt(
            builder,
            seg_new_next,
            llvm_i64,
            libcstr!("seg_new_next_int"),
        );
        let seg_end_int = LLVMBuildPtrToInt(builder, seg_end, llvm_i64, libcstr!("seg_end_int"));

        let seg_has_space = LLVMBuildICmp(
            builder,
            LLVMIntPredicate::LLVMIntULE,
            seg_new_next_int,
            seg_end_int,
            libcstr!("seg_has_space"),
        );

        LLVMBuildCondBr(
            builder,
            seg_has_space,
            bump_alloc_block,
            runtime_alloc_block,
        );

        // Bump alloc succeeded; update the segment
        LLVMPositionBuilderAtEnd(builder, bump_alloc_block);
        LLVMBuildStore(builder, seg_new_next, seg_next_ptr);
        LLVMBuildBr(builder, cont_block);

        // Bump alloc failed; call the runtime
        LLVMPositionBuilderAtEnd(builder, runtime_alloc_block);
        let mut runtime_box_slots =
            gen_runtime_heap_alloc(tcx, mcx, builder, llvm_task, required_cells);
        LLVMBuildBr(builder, cont_block);

        LLVMPositionBuilderAtEnd(builder, cont_block);
        let box_slots = LLVMBuildPhi(
            builder,
            tcx.boxed_abi_to_llvm_ptr_type(&abitype::BoxedAbiType::Any),
            libcstr!("box_slots"),
        );

        LLVMAddIncoming(
            box_slots,
            &mut seg_old_next as *mut _,
            &mut bump_alloc_block as *mut _,
            1,
        );
        LLVMAddIncoming(
            box_slots,
            &mut runtime_box_slots as *mut _,
            &mut runtime_alloc_block as *mut _,
            1,
        );

        ActiveAlloc {
            box_slots,
            total_cells: required_cells,
            used_cells: 0,

            box_source_iter: atom.box_sources.into_iter(),
            cond_plan_iter: atom.cond_plans.into_iter(),
        }
    }
}


================================================
FILE: compiler/codegen/alloc/mod.rs
================================================
use std::vec;

use llvm_sys::prelude::*;

use arret_runtime::boxed;

use crate::mir::ops;

pub mod core;
pub mod plan;
pub mod types;

/// Indicates where memory for a box allocation should come from
#[derive(PartialEq, Debug, Clone, Copy)]
pub enum BoxSource {
    Stack,
    Heap(boxed::BoxSize),
}

/// Contains the sub-plans for a conditional branch
#[derive(PartialEq, Debug)]
pub struct CondPlan<'op> {
    pub true_subplan: Vec<AllocAtom<'op>>,
    pub false_subplan: Vec<AllocAtom<'op>>,
}

/// Represents a sequence of MIR ops that begin and end with the heap in a consistent state
#[derive(PartialEq, Debug, Default)]
pub struct AllocAtom<'op> {
    box_sources: Vec<BoxSource>,
    cond_plans: Vec<CondPlan<'op>>,

    ops_base: &'op [ops::Op],
    ops_count: usize,
}

impl<'op> AllocAtom<'op> {
    /// Creates a new `AllocAtom` with its ops starting at the specified slice
    fn new(ops_base: &'op [ops::Op]) -> Self {
        Self {
            ops_base,
            ..Default::default()
        }
    }

    pub fn ops(&self) -> &'op [ops::Op] {
        &self.ops_base[0..self.ops_count]
    }

    /// Increments the used size of our ops by one
    fn push_op(&mut self) {
        self.ops_count += 1
    }

    fn is_empty(&self) -> bool {
        self.ops_count == 0
    }
}

pub struct ActiveAlloc<'op> {
    box_slots: LLVMValueRef,
    total_cells: usize,
    used_cells: usize,

    box_source_iter: vec::IntoIter<BoxSource>,
    cond_plan_iter: vec::IntoIter<CondPlan<'op>>,
}

impl<'op> ActiveAlloc<'op> {
    pub fn is_empty(&self) -> bool {
        self.total_cells == self.used_cells
    }

    pub fn next_box_source(&mut self) -> BoxSource {
        self.box_source_iter.next().unwrap()
    }

    pub fn next_cond_plan(&mut self) -> CondPlan<'op> {
        self.cond_plan_iter.next().unwrap()
    }
}


================================================
FILE: compiler/codegen/alloc/plan.rs
================================================
use arret_runtime::boxed;

use crate::codegen::alloc::{AllocAtom, BoxSource, CondPlan};
use crate::codegen::analysis::escape::{CaptureKind, Captures};
use crate::codegen::target_gen::TargetCtx;
use crate::mir::ops;

struct AllocInfo {
    output_reg: ops::RegId,
    box_size: boxed::BoxSize,
}

/// Determines if an op requires the heap to be in a consistent state before it's executed
///
/// Our `AllocAtom`s cannot span these operations
fn op_needs_heap_checkpoint(tcx: &mut TargetCtx, op: &ops::Op) -> bool {
    use crate::mir::ops::OpKind;

    match op.kind() {
        OpKind::Ret(_)
        | OpKind::RetVoid
        | OpKind::Unreachable
        | OpKind::Call(_, _)
        | OpKind::Panic(_)
        | OpKind::Int64CheckedAdd(_, _)
        | OpKind::Int64CheckedSub(_, _)
        | OpKind::Int64CheckedMul(_, _)
        | OpKind::Int64CheckedDiv(_, _)
        | OpKind::Int64CheckedRem(_, _) => true,
        OpKind::Cond(cond_op) => cond_op
            .true_ops
            .iter()
            .chain(cond_op.false_ops.iter())
            // We additionally need to make sure we don't allocate in our branches. Otherwise we
            // might need to plan an allocation of a dynamic size to cover each branch. Instead
            // just start a new atom for each branch.
            .any(|op| op_needs_heap_checkpoint(tcx, op) || op_alloc_info(tcx, op).is_some()),
        _ => false,
    }
}

/// Returns the output reg for an allocating op, or `None` otherwise
fn op_alloc_info(tcx: &mut TargetCtx, op: &ops::Op) -> Option<AllocInfo> {
    use crate::mir::ops::OpKind;

    match op.kind() {
        OpKind::AllocBoxedInt(output_reg, _) => Some(AllocInfo {
            output_reg: *output_reg,
            box_size: boxed::Int::size(),
        }),
        OpKind::AllocBoxedFloat(output_reg, _) => Some(AllocInfo {
            output_reg: *output_reg,
            box_size: boxed::Float::size(),
        }),
        OpKind::AllocBoxedChar(output_reg, _) => Some(AllocInfo {
            output_reg: *output_reg,
            box_size: boxed::Char::size(),
        }),
        OpKind::AllocBoxedSym(output_reg, _) => Some(AllocInfo {
            output_reg: *output_reg,
            box_size: boxed::Sym::size(),
        }),
        OpKind::AllocBoxedPair(output_reg, _) => Some(AllocInfo {
            output_reg: *output_reg,
            box_size: boxed::Pair::<boxed::Any>::size(),
        }),
        OpKind::AllocBoxedFunThunk(output_reg, _) => Some(AllocInfo {
            output_reg: *output_reg,
            box_size: boxed::FunThunk::size(),
        }),
        OpKind::AllocBoxedRecord(output_reg, box_record_op) => {
            let record_storage = tcx
                .target_record_struct(&box_record_op.record_struct)
                .record_storage;

            Some(AllocInfo {
                output_reg: *output_reg,
                box_size: record_storage.box_size(),
            })
        }
        _ => None,
    }
}

pub fn plan_allocs<'op>(
    tcx: &mut TargetCtx,
    captures: &Captures,
    ops: &'op [ops::Op],
) -> Vec<AllocAtom<'op>> {
    use std::mem;

    let mut atoms = vec![];
    let mut current_atom = AllocAtom::new(&ops[0..]);

    for (i, op) in ops.iter().enumerate() {
        let checkpointing_op = op_needs_heap_checkpoint(tcx, op);

        if checkpointing_op && !current_atom.is_empty() {
            atoms.push(mem::replace(&mut current_atom, AllocAtom::new(&ops[i..])));
        }

        if let ops::OpKind::Cond(ops::CondOp {
            true_ops,
            false_ops,
            ..
        }) = op.kind()
        {
            current_atom.cond_plans.push(CondPlan {
                true_subplan: plan_allocs(tcx, captures, true_ops),
                false_subplan: plan_allocs(tcx, captures, false_ops),
            });
        } else if let Some(AllocInfo {
            output_reg,
            box_size,
        }) = op_alloc_info(tcx, op)
        {
            if captures.get(output_reg) == CaptureKind::Never {
                current_atom.box_sources.push(BoxSource::Stack);
            } else {
                current_atom.box_sources.push(BoxSource::Heap(box_size));
            }
        }

        current_atom.push_op();

        if checkpointing_op {
            atoms.push(mem::replace(
                &mut current_atom,
                AllocAtom::new(&ops[i + 1..]),
            ));
        }
    }

    if !current_atom.is_empty() {
        atoms.push(current_atom);
    }

    atoms
}

#[cfg(test)]
mod test {
    use super::*;

    /// Plans allocations assuming the native data layout
    fn plan_native_allocs(ops: &[ops::Op]) -> Vec<AllocAtom<'_>> {
        use llvm_sys::target_machine::*;

        use crate::codegen::target_machine::create_target_machine;
        use crate::codegen::test::initialise_test_llvm;

        initialise_test_llvm();

        let target_machine = create_target_machine(
            None,
            LLVMRelocMode::LLVMRelocDynamicNoPic,
            LLVMCodeModel::LLVMCodeModelDefault,
        );

        let mut tcx = TargetCtx::new(target_machine, false);
        let atoms = plan_allocs(&mut tcx, &Captures::new(), ops);

        unsafe {
            LLVMDisposeTargetMachine(target_machine);
        }

        atoms
    }

    #[test]
    fn empty_ops() {
        let actual_atoms = plan_native_allocs(&[]);
        assert_eq!(0, actual_atoms.len());
    }

    #[test]
    fn condless_allocs() {
        let reg1 = ops::RegId::alloc();
        let reg2 = ops::RegId::alloc();
        let reg3 = ops::RegId::alloc();
        let reg4 = ops::RegId::alloc();

        let input_ops = [
            ops::OpKind::AllocBoxedInt(reg1, reg1).into(),
            ops::OpKind::ConstBoxedTrue(reg2, ()).into(),
            ops::OpKind::RetVoid.into(),
            ops::OpKind::AllocBoxedInt(reg3, reg3).into(),
            ops::OpKind::AllocBoxedInt(reg4, reg4).into(),
        ];

        let expected_atoms = vec![
            AllocAtom {
                box_sources: vec![BoxSource::Stack],
                cond_plans: vec![],
                ops_base: &input_ops[0..],
                ops_count: 2,
            },
            AllocAtom {
                box_sources: vec![],
                cond_plans: vec![],
                ops_base: &input_ops[2..],
                ops_count: 1,
            },
            AllocAtom {
                box_sources: vec![BoxSource::Stack, BoxSource::Stack],
                cond_plans: vec![],
                ops_base: &input_ops[3..],
                ops_count: 2,
            },
        ];

        let actual_atoms = plan_native_allocs(&input_ops);

        assert_eq!(expected_atoms, actual_atoms);
    }

    #[test]
    fn non_allocating_cond() {
        let output_reg = ops::RegId::alloc();
        let true_result_reg = ops::RegId::alloc();
        let false_result_reg = ops::RegId::alloc();

        let test_reg = ops::RegId::alloc();

        let true_ops = Box::new([ops::OpKind::ConstBoxedNil(true_result_reg, ()).into()]);
        let false_ops = Box::new([ops::OpKind::ConstBoxedNil(false_result_reg, ()).into()]);

        let input_ops = [
            ops::OpKind::AllocBoxedInt(test_reg, test_reg).into(),
            ops::OpKind::Cond(ops::CondOp {
                reg_phi: Some(ops::RegPhi {
                    output_reg,
                    true_result_reg,
                    false_result_reg,
                }),
                test_reg,
                true_ops,
                false_ops,
            })
            .into(),
        ];

        let actual_atoms = plan_native_allocs(&input_ops);
        // We should place the `AllocBoxedInt` and `Cond` in the same atom
        assert_eq!(1, actual_atoms.len());
    }

    #[test]
    fn allocating_cond() {
        let output_reg = ops::RegId::alloc();
        let test_reg = ops::RegId::alloc();
        let true_result_reg = ops::RegId::alloc();
        let false_result_reg = ops::RegId::alloc();

        let true_ops = Box::new([ops::OpKind::ConstBoxedNil(true_result_reg, ()).into()]);
        let false_ops =
            Box::new([ops::OpKind::AllocBoxedInt(false_result_reg, false_result_reg).into()]);

        let input_ops = [
            ops::OpKind::AllocBoxedInt(test_reg, test_reg).into(),
            ops::OpKind::Cond(ops::CondOp {
                reg_phi: Some(ops::RegPhi {
                    output_reg,
                    true_result_reg,
                    false_result_reg,
                }),
                test_reg,
                true_ops,
                false_ops,
            })
            .into(),
        ];

        let actual_atoms = plan_native_allocs(&input_ops);
        // We should place the `AllocBoxedInt` and `Cond` in different atoms
        assert_eq!(2, actual_atoms.len());
    }
}


================================================
FILE: compiler/codegen/alloc/types.rs
================================================
use llvm_sys::core::*;
use llvm_sys::prelude::*;
use llvm_sys::LLVMAttributeReturnIndex;

use arret_runtime::boxed;

use crate::codegen::alloc::core::{gen_alloced_box, gen_alloced_box_with_llvm_type};
use crate::codegen::alloc::{ActiveAlloc, BoxSource};
use crate::codegen::mod_gen::ModCtx;
use crate::codegen::record_struct;
use crate::codegen::target_gen::TargetCtx;
use crate::libcstr;
use crate::mir::ops::RecordStructId;

pub struct PairInput {
    pub llvm_head: LLVMValueRef,
    pub llvm_rest: LLVMValueRef,
    pub llvm_list_len: LLVMValueRef,
}

pub struct FunThunkInput {
    pub llvm_captures: LLVMValueRef,
    pub llvm_entry_point: LLVMValueRef,
}

pub struct RecordInput<'rs> {
    pub record_struct: &'rs RecordStructId,
    pub llvm_fields: Box<[LLVMValueRef]>,
}

pub fn gen_alloc_int(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_source: BoxSource,
    llvm_int_value: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let alloced_int =
            gen_alloced_box::<boxed::Int>(tcx, builder, active_alloc, box_source, b"alloced_int\0");

        let value_ptr = LLVMBuildStructGEP(builder, alloced_int, 1, libcstr!("value_ptr"));
        LLVMBuildStore(builder, llvm_int_value, value_ptr);

        alloced_int
    }
}

pub fn gen_alloc_char(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_source: BoxSource,
    llvm_char_value: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let alloced_char = gen_alloced_box::<boxed::Char>(
            tcx,
            builder,
            active_alloc,
            box_source,
            b"alloced_char\0",
        );

        let value_ptr = LLVMBuildStructGEP(builder, alloced_char, 1, libcstr!("value_ptr"));
        LLVMBuildStore(builder, llvm_char_value, value_ptr);

        alloced_char
    }
}

pub fn gen_alloc_sym(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_source: BoxSource,
    llvm_interned_sym: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let alloced_sym =
            gen_alloced_box::<boxed::Sym>(tcx, builder, active_alloc, box_source, b"alloced_sym\0");

        let interned_sym_ptr =
            LLVMBuildStructGEP(builder, alloced_sym, 1, libcstr!("interned_sym_ptr"));
        LLVMBuildStore(builder, llvm_interned_sym, interned_sym_ptr);

        alloced_sym
    }
}

pub fn gen_alloc_float(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_source: BoxSource,
    llvm_float_value: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let alloced_float = gen_alloced_box::<boxed::Float>(
            tcx,
            builder,
            active_alloc,
            box_source,
            b"alloced_float\0",
        );

        let value_ptr = LLVMBuildStructGEP(builder, alloced_float, 1, libcstr!("value_ptr"));
        LLVMBuildStore(builder, llvm_float_value, value_ptr);

        alloced_float
    }
}

pub fn gen_alloc_boxed_pair(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_source: BoxSource,
    input: &PairInput,
) -> LLVMValueRef {
    let PairInput {
        llvm_head,
        llvm_rest,
        llvm_list_len,
    } = input;

    unsafe {
        let alloced_pair = gen_alloced_box::<boxed::Pair>(
            tcx,
            builder,
            active_alloc,
            box_source,
            b"alloced_pair\0",
        );

        let list_len_ptr = LLVMBuildStructGEP(builder, alloced_pair, 1, libcstr!("list_len_ptr"));
        LLVMBuildStore(builder, *llvm_list_len, list_len_ptr);

        let head_ptr = LLVMBuildStructGEP(builder, alloced_pair, 2, libcstr!("head_ptr"));
        LLVMBuildStore(builder, *llvm_head, head_ptr);

        let rest_ptr = LLVMBuildStructGEP(builder, alloced_pair, 3, libcstr!("rest_ptr"));
        LLVMBuildStore(builder, *llvm_rest, rest_ptr);

        alloced_pair
    }
}

pub fn gen_alloc_boxed_fun_thunk(
    tcx: &mut TargetCtx,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_source: BoxSource,
    input: &FunThunkInput,
) -> LLVMValueRef {
    let FunThunkInput {
        llvm_captures,
        llvm_entry_point,
    } = input;

    unsafe {
        let alloced_fun_thunk = gen_alloced_box::<boxed::FunThunk>(
            tcx,
            builder,
            active_alloc,
            box_source,
            b"alloced_fun_thunk\0",
        );

        let captures_ptr =
            LLVMBuildStructGEP(builder, alloced_fun_thunk, 1, libcstr!("captures_ptr"));
        LLVMBuildStore(builder, *llvm_captures, captures_ptr);

        let entry_point_ptr =
            LLVMBuildStructGEP(builder, alloced_fun_thunk, 2, libcstr!("entry_point_ptr"));
        LLVMBuildStore(builder, *llvm_entry_point, entry_point_ptr);

        alloced_fun_thunk
    }
}

pub fn gen_alloc_boxed_record(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    builder: LLVMBuilderRef,
    active_alloc: &mut ActiveAlloc<'_>,
    box_source: BoxSource,
    input: &RecordInput<'_>,
) -> LLVMValueRef {
    let RecordInput {
        record_struct,
        llvm_fields,
    } = input;

    let record_class_id = mcx.record_class_id_for_struct(record_struct);

    unsafe {
        let llvm_i8 = LLVMInt8TypeInContext(tcx.llx);
        let llvm_i32 = LLVMInt32TypeInContext(tcx.llx);

        let record_struct::TargetRecordStruct {
            data_layout,
            record_storage,
            llvm_data_type,
            ..
        } = *tcx.target_record_struct(record_struct);

        let may_contain_gc_refs = record_struct
            .field_abi_types
            .iter()
            .zip(llvm_fields.iter())
            .any(|(field_abi_type, llvm_field)| {
                field_abi_type.may_contain_gc_refs() && LLVMIsConstant(*llvm_field) == 0
            });

        let boxed_record_name = format!("alloced_{}_record\0", record_struct.source_name);

        let llvm_box_type = tcx.record_struct_llvm_box_type(record_struct);
        let alloced_boxed_record = gen_alloced_box_with_llvm_type::<boxed::Record>(
            tcx,
            builder,
            active_alloc,
            box_source,
            llvm_box_type,
            boxed_record_name.as_bytes(),
        );

        let may_contain_gc_refs_ptr = LLVMBuildStructGEP(
            builder,
            alloced_boxed_record,
            record_struct::CONTAINS_GC_REFS_INDEX,
            libcstr!("may_contain_gc_refs_ptr"),
        );
        let llvm_may_contain_gc_refs = LLVMConstInt(llvm_i8, may_contain_gc_refs as u64, 1);
        LLVMBuildStore(builder, llvm_may_contain_gc_refs, may_contain_gc_refs_ptr);

        let record_class_id_ptr = LLVMBuildStructGEP(
            builder,
            alloced_boxed_record,
            record_struct::RECORD_CLASS_ID_INDEX,
            libcstr!("record_class_id_ptr"),
        );

        let llvm_record_class_id = LLVMConstInt(
            tcx.record_class_id_llvm_type(),
            u64::from(record_class_id),
            1,
        );
        LLVMBuildStore(builder, llvm_record_class_id, record_class_id_ptr);

        // This is used by both inline and external records
        let record_data_gep_indices = &mut [
            LLVMConstInt(llvm_i32, 0, 0),
            LLVMConstInt(llvm_i32, u64::from(record_struct::DATA_INDEX), 0),
        ];

        let (llvm_record_data_ptr, inline_byte_len) = match (record_storage, box_source) {
            (boxed::RecordStorage::Inline(_), _) => {
                let llvm_inline_record_data_ptr = LLVMBuildInBoundsGEP(
                    builder,
                    alloced_boxed_record,
                    record_data_gep_indices.as_mut_ptr(),
                    record_data_gep_indices.len() as u32,
                    libcstr!("inline_record_data"),
                );

                let inline_byte_len = match data_layout {
                    Some(data_layout) => data_layout.size(),
                    None => 0,
                };

                (llvm_inline_record_data_ptr, inline_byte_len)
            }
            (boxed::RecordStorage::External, BoxSource::Stack) => {
                // Allocate the record data
                let llvm_stack_record_data_ptr =
                    LLVMBuildAlloca(builder, llvm_data_type, libcstr!("stack_record_data"));

                // Update our record data pointer
                let llvm_record_data_ptr_ptr = LLVMBuildInBoundsGEP(
                    builder,
                    alloced_boxed_record,
                    record_data_gep_indices.as_mut_ptr(),
                    record_data_gep_indices.len() as u32,
                    libcstr!("record_data_ptr_ptr"),
                );

                LLVMBuildStore(
                    builder,
                    llvm_stack_record_data_ptr,
                    llvm_record_data_ptr_ptr,
                );

                (
                    llvm_stack_record_data_ptr,
                    boxed::Record::EXTERNAL_INLINE_LEN as usize,
                )
            }
            (boxed::RecordStorage::External, BoxSource::Heap(_)) => {
                let data_layout = data_layout.unwrap();

                let llvm_i8 = LLVMInt8TypeInContext(tcx.llx);
                let llvm_i32 = LLVMInt32TypeInContext(tcx.llx);
                let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

                let llvm_param_types = &mut [llvm_i64, llvm_i32];

                let alloc_record_data_llvm_type = LLVMFunctionType(
                    LLVMPointerType(llvm_i8, 0),
                    llvm_param_types.as_mut_ptr(),
                    llvm_param_types.len() as u32,
                    0,
                );

                let alloc_record_data_fun = mcx.get_function_or_insert(
                    alloc_record_data_llvm_type,
                    b"arret_runtime_alloc_record_data\0",
                    |alloc_record_data_fun| {
                        LLVMAddAttributeAtIndex(
                            alloc_record_data_fun,
                            LLVMAttributeReturnIndex,
                            tcx.llvm_noalias_attr(),
                        );
                    },
                );

                let alloc_record_data_args = &mut [
                    LLVMConstInt(llvm_i64, data_layout.size() as u64, 0),
                    LLVMConstInt(llvm_i32, data_layout.align() as u64, 0),
                ];

                let llvm_untyped_record_data_ptr = LLVMBuildCall(
                    builder,
                    alloc_record_data_fun,
                    alloc_record_data_args.as_mut_ptr(),
                    alloc_record_data_args.len() as u32,
                    libcstr!("external_record_data"),
                );

                // Convert the record data pointer to the correct type
                let llvm_typed_record_data_ptr = LLVMBuildBitCast(
                    builder,
                    llvm_untyped_record_data_ptr,
                    LLVMPointerType(llvm_data_type, 0),
                    libcstr!("typed_record_data_ptr"),
                );

                // Save the record data pointer
                let llvm_record_data_ptr_ptr = LLVMBuildInBoundsGEP(
                    builder,
                    alloced_boxed_record,
                    record_data_gep_indices.as_mut_ptr(),
                    record_data_gep_indices.len() as u32,
                    libcstr!("record_data_ptr_ptr"),
                );
                LLVMBuildStore(
                    builder,
                    llvm_typed_record_data_ptr,
                    llvm_record_data_ptr_ptr,
                );

                // Save the compact layout
                let record_compact_layout_gep_indices = &mut [
                    LLVMConstInt(llvm_i32, 0, 0),
                    LLVMConstInt(
                        llvm_i32,
                        u64::from(record_struct::EXTERNAL_COMPACT_LAYOUT_INDEX),
                        0,
                    ),
                ];

                let llvm_record_compact_layout_ptr = LLVMBuildInBoundsGEP(
                    builder,
                    alloced_boxed_record,
                    record_compact_layout_gep_indices.as_mut_ptr(),
                    record_compact_layout_gep_indices.len() as u32,
                    libcstr!("record_compact_layout_ptr"),
                );
                LLVMBuildStore(
                    builder,
                    LLVMConstInt(
                        llvm_i64,
                        boxed::RecordData::alloc_layout_to_compact(Some(data_layout)),
                        0,
                    ),
                    llvm_record_compact_layout_ptr,
                );

                (
                    llvm_typed_record_data_ptr,
                    boxed::Record::EXTERNAL_INLINE_LEN as usize,
                )
            }
        };

        let inline_byte_len_ptr = LLVMBuildStructGEP(
            builder,
            alloced_boxed_record,
            record_struct::IS_INLINE_INDEX,
            libcstr!("inline_byte_len_ptr"),
        );
        let llvm_inline_byte_len = LLVMConstInt(llvm_i8, inline_byte_len as u64, 1);
        LLVMBuildStore(builder, llvm_inline_byte_len, inline_byte_len_ptr);

        for (field_index, llvm_field) in llvm_fields.iter().enumerate() {
            let field_gep_indices = &mut [
                LLVMConstInt(llvm_i32, 0, 0),
                LLVMConstInt(llvm_i32, field_index as u64, 0),
            ];

            let llvm_field_ptr = LLVMBuildInBoundsGEP(
                builder,
                llvm_record_data_ptr,
                field_gep_indices.as_mut_ptr(),
                field_gep_indices.len() as u32,
                libcstr!("init_record_field_ptr"),
            );

            LLVMBuildStore(builder, *llvm_field, llvm_field_ptr);
        }

        let boxed_record_name = format!("alloced_{}_record\0", record_struct.source_name);

        LLVMBuildBitCast(
            builder,
            alloced_boxed_record,
            tcx.boxed_abi_to_llvm_ptr_type(&boxed::TypeTag::Record.into()),
            boxed_record_name.as_ptr() as *const _,
        )
    }
}


================================================
FILE: compiler/codegen/analysis/escape.rs
================================================
use std::collections::{HashMap, HashSet};

use arret_runtime::abitype::{AbiType, ParamAbiType, ParamCapture, RetAbiType};

use crate::codegen::GenAbi;
use crate::mir::ops;

/// Describes the capture behaviour of a function parameter
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug)]
pub enum CaptureKind {
    /// This reg is always captured
    Always = 2,
    /// This reg is captured if the function's return value is captured
    ViaRet = 1,
    /// This reg is never captured
    Never = 0,
}

impl CaptureKind {
    /// Calculates the capture of a passed parameter based on the the call's return capture
    fn capture_for_call_param(self, return_capture: CaptureKind) -> CaptureKind {
        match self {
            CaptureKind::Always => CaptureKind::Always,
            CaptureKind::ViaRet => return_capture,
            CaptureKind::Never => CaptureKind::Never,
        }
    }
}

/// Tracks the captures for all regs in a function
#[derive(Debug)]
pub struct Captures {
    inner: HashMap<ops::RegId, CaptureKind>,
}

impl Captures {
    pub fn new() -> Captures {
        Captures {
            inner: HashMap::new(),
        }
    }

    /// Adds the capture of a reg to the capture state
    ///
    /// If there is an existing capture the "stronger" capture kind of the two will be used.
    pub fn add(&mut self, reg_id: ops::RegId, capture: CaptureKind) {
        use std::cmp::max;

        // It's not worthwhile to track never captures; that's the default capture type
        if capture != CaptureKind::Never {
            self.inner
                .entry(reg_id)
                .and_modify(|e| {
                    *e = max(*e, capture);
                })
                .or_insert(capture);
        }
    }

    pub fn get(&self, reg_id: ops::RegId) -> CaptureKind {
        self.inner
            .get(&reg_id)
            .cloned()
            .unwrap_or(CaptureKind::Never)
    }
}

/// Infers if a function can capture a parameter based on its return type
///
/// This is used for Rust functions where we don't have precise capture information. This uses a
/// very conservative algorithm where any function returning a box is assumed to capture all of its
/// arguments.
pub fn infer_param_capture_kind(
    ret_abi_type: &RetAbiType,
    param_abi_type: &ParamAbiType,
) -> CaptureKind {
    let returns_box = matches!(ret_abi_type, RetAbiType::Inhabited(AbiType::Boxed(_)));

    match param_abi_type.capture {
        ParamCapture::Auto => {
            if returns_box {
                CaptureKind::ViaRet
            } else {
                CaptureKind::Never
            }
        }
        ParamCapture::Always => CaptureKind::Always,
        ParamCapture::Never => CaptureKind::Never,
    }
}

fn add_static_symbol_call_captures(
    captures: &mut Captures,
    return_capture: CaptureKind,
    static_symbol_abi: &GenAbi,
    args: &[ops::RegId],
) {
    let arg_iter = args.iter();

    assert_eq!(arg_iter.len(), static_symbol_abi.params.len());
    for (arg_reg, param_abi_type) in arg_iter.zip(static_symbol_abi.params.iter()) {
        let param_capture = infer_param_capture_kind(&static_symbol_abi.ret, param_abi_type);

        captures.add(
            *arg_reg,
            param_capture.capture_for_call_param(return_capture),
        );
    }
}

struct ProgramCaptureCtx<'of> {
    private_funs: &'of HashMap<ops::PrivateFunId, ops::Fun>,
    private_fun_captures: HashMap<ops::PrivateFunId, Captures>,

    // Funs we're currently recursing in to
    recursing_private_funs: HashSet<ops::PrivateFunId>,
}

impl<'of> ProgramCaptureCtx<'of> {
    fn add_op_captures(&mut self, captures: &mut Captures, ret_type: &RetAbiType, op: &ops::Op) {
        use crate::mir::ops::OpKind;

        match op.kind() {
            OpKind::Ret(ret_reg) => {
                if let RetAbiType::Inhabited(AbiType::Boxed(_)) = ret_type {
                    // `Ret` captures boxes unconditionally
                    captures.add(*ret_reg, CaptureKind::ViaRet);
                }
            }
            OpKind::CastBoxed(reg, ops::CastBoxedOp { from_reg, .. })
            | OpKind::Alias(reg, from_reg)
            | OpKind::LoadBoxedPairHead(reg, from_reg)
            | OpKind::LoadBoxedPairRest(reg, from_reg)
            | OpKind::LoadBoxedVectorMember(
                reg,
                ops::LoadBoxedVectorMemberOp {
                    vector_reg: from_reg,
                    ..
                },
            ) => {
                captures.add(*from_reg, captures.get(*reg));
            }
            OpKind::AllocBoxedPair(
                reg,
                ops::BoxPairOp {
                    head_reg, rest_reg, ..
                },
            ) => {
                let output_capture = captures.get(*reg);
                captures.add(*head_reg, output_capture);
                captures.add(*rest_reg, output_capture);
            }
            OpKind::Cond(ops::CondOp {
                reg_phi,
                true_ops,
                false_ops,
                ..
            }) => {
                if let Some(reg_phi) = reg_phi {
                    let output_capture = captures.get(reg_phi.output_reg);

                    // Propagate captures through the phi
                    captures.add(reg_phi.true_result_reg, output_capture);
                    captures.add(reg_phi.false_result_reg, output_capture);
                }

                for op in true_ops.iter().rev().chain(false_ops.iter().rev()) {
                    self.add_op_captures(captures, ret_type, op);
                }
            }
            OpKind::Call(reg, ops::CallOp { callee, args, .. }) => {
                let return_capture = captures.get(*reg);

                match callee {
                    ops::Callee::StaticSymbol(ops::StaticSymbol { abi, .. }) => {
                        add_static_symbol_call_captures(captures, return_capture, abi, args);
                    }
                    ops::Callee::PrivateFun(private_fun_id) => {
                        let ops_fun = &self.private_funs[private_fun_id];

                        if !self.recursing_private_funs.contains(private_fun_id) {
                            let callee_captures = self.captures_for_private_fun_id(*private_fun_id);

                            for (arg_reg, param_reg) in args.iter().zip(ops_fun.param_regs.iter()) {
                                captures.add(*arg_reg, callee_captures.get(*param_reg));
                            }
                        } else {
                            // This is part of a recursive loop; assume everything is captured.

                            // While this seems like an easy way out this is probably the right
                            // thing to do. If there are many loop iterations at runtime we do
                            // not want to allocate boxes on the stack. This both prevents tail
                            // recursion and can lead to a stack overflow. By claiming that
                            // everything is captured we force them to be heap allocated.
                            for arg_reg in args.iter() {
                                captures.add(*arg_reg, CaptureKind::Always);
                            }
                        }
                    }
                    ops::Callee::BoxedFunThunk(_) => {
                        // We know nothing about the actual captures. We need to assume the worst.
                        for arg_reg in args.iter() {
                            captures.add(*arg_reg, CaptureKind::Always);
                        }
                    }
                };
            }
            OpKind::TailCall(_, ops::TailCallOp { args, .. }) => {
                // This is the same justification as the recursive case in `OpKind::Call`
                for arg_reg in args.iter() {
                    captures.add(*arg_reg, CaptureKind::Always);
                }
            }
            OpKind::MakeCallback(_, ops::MakeCallbackOp { callee, .. })
            | OpKind::AllocBoxedFunThunk(_, ops::BoxFunThunkOp { callee, .. })
            | OpKind::ConstBoxedFunThunk(_, ops::BoxFunThunkOp { callee, .. }) => {
                // We don't actually care about these captures; we just pull them in for dependencies
                if let ops::Callee::PrivateFun(private_fun_id) = callee {
                    // If we're already recursing we'll only loop if we re-enter
                    if !self.recursing_private_funs.contains(private_fun_id) {
                        self.captures_for_private_fun_id(*private_fun_id);
                    }
                }
            }
            OpKind::AllocBoxedRecord(reg, ops::BoxRecordOp { field_regs, .. }) => {
                let output_capture = captures.get(*reg);

                for field_reg in field_regs.iter() {
                    captures.add(*field_reg, output_capture);
                }
            }
            OpKind::LoadBoxedRecordField(
                reg,
                ops::LoadBoxedRecordFieldOp {
                    record_reg,
                    record_struct,
                    field_index,
                },
            ) => {
                let output_capture = captures.get(*reg);

                // Don't capture the record if we're loading a non-GCed value
                if record_struct.field_abi_types[*field_index].may_contain_gc_refs() {
                    captures.add(*record_reg, output_capture);
                }
            }
            _ => {}
        }
    }

    fn captures_for_private_fun_id(&mut self, private_fun_id: ops::PrivateFunId) -> &Captures {
        if self.private_fun_captures.contains_key(&private_fun_id) {
            return &self.private_fun_captures[&private_fun_id];
        }

        self.recursing_private_funs.insert(private_fun_id);

        let ops_fun = &self.private_funs[&private_fun_id];
        let captures = self.calc_fun_captures(ops_fun);

        self.recursing_private_funs.remove(&private_fun_id);
        self.private_fun_captures
            .entry(private_fun_id)
            .or_insert(captures)
    }

    fn calc_fun_captures(&mut self, fun: &ops::Fun) -> Captures {
        let mut captures = Captures::new();

        for op in fun.ops.iter().rev() {
            self.add_op_captures(&mut captures, &fun.abi.ret, op);
        }

        captures
    }
}

pub struct ProgramCaptures {
    pub entry_fun_captures: Captures,
    pub private_fun_captures: HashMap<ops::PrivateFunId, Captures>,
}

/// Calculates the captured registers for the passed fun and every fun it references
pub fn calc_program_captures(
    private_funs: &HashMap<ops::PrivateFunId, ops::Fun>,
    entry_fun: &ops::Fun,
) -> ProgramCaptures {
    let mut ctx = ProgramCaptureCtx {
        private_funs,
        private_fun_captures: HashMap::new(),

        recursing_private_funs: HashSet::new(),
    };

    let entry_fun_captures = ctx.calc_fun_captures(entry_fun);

    ProgramCaptures {
        private_fun_captures: ctx.private_fun_captures,
        entry_fun_captures,
    }
}

#[cfg(test)]
mod test {
    use super::*;

    use arret_runtime::boxed;

    use crate::source::EMPTY_SPAN;

    fn calc_single_fun_captures(fun: &ops::Fun) -> Captures {
        calc_program_captures(&HashMap::new(), fun).entry_fun_captures
    }

    #[test]
    fn infer_param_capture() {
        // Boxed return type can capture boxed parameter
        assert_eq!(
            CaptureKind::ViaRet,
            infer_param_capture_kind(&boxed::TypeTag::Int.into(), &boxed::TypeTag::Int.into())
        );

        // Unboxed return type cannot capture boxed parameter
        assert_eq!(
            CaptureKind::Never,
            infer_param_capture_kind(&AbiType::Bool.into(), &boxed::TypeTag::Int.into())
        );
    }

    #[test]
    fn empty_fun_captures() {
        let param_reg = ops::RegId::alloc();

        let test_fun = ops::Fun {
            span: EMPTY_SPAN,
            source_name: None,

            abi: ops::OpsAbi {
                call_conv: ops::CallConv::FastCc,
                params: Box::new([boxed::TypeTag::Int.into()]),
                ret: RetAbiType::Void,
            },
            param_regs: Box::new([param_reg]),
            ops: Box::new([]),
        };

        let captures = calc_single_fun_captures(&test_fun);
        assert_eq!(CaptureKind::Never, captures.get(param_reg));
    }

    #[test]
    fn capture_param_via_ret() {
        let capture_reg = ops::RegId::alloc();

        let test_fun = ops::Fun {
            span: EMPTY_SPAN,
            source_name: None,

            abi: ops::OpsAbi {
                call_conv: ops::CallConv::FastCc,
                params: Box::new([boxed::TypeTag::Int.into()]),
                ret: boxed::TypeTag::Int.into(),
            },
            param_regs: Box::new([capture_reg]),
            ops: Box::new([ops::OpKind::Ret(capture_reg).into()]),
        };

        let captures = calc_single_fun_captures(&test_fun);
        assert_eq!(CaptureKind::ViaRet, captures.get(capture_reg));
    }

    #[test]
    fn capture_param_via_pair() {
        let param_reg = ops::RegId::alloc();
        let ret_reg = ops::RegId::alloc();

        let test_fun = ops::Fun {
            span: EMPTY_SPAN,
            source_name: None,

            abi: ops::OpsAbi {
                call_conv: ops::CallConv::FastCc,
                params: Box::new([boxed::TypeTag::Int.into()]),
                ret: boxed::TypeTag::Pair.into(),
            },
            param_regs: Box::new([param_reg]),
            ops: Box::new([
                ops::OpKind::AllocBoxedPair(
                    ret_reg,
                    ops::BoxPairOp {
                        head_reg: param_reg,
                        rest_reg: param_reg,
                        list_len_reg: param_reg,
                    },
                )
                .into(),
                ops::OpKind::Ret(ret_reg).into(),
            ]),
        };

        let captures = calc_single_fun_captures(&test_fun);
        assert_eq!(CaptureKind::ViaRet, captures.get(param_reg));
        assert_eq!(CaptureKind::ViaRet, captures.get(ret_reg));
    }

    #[test]
    fn capture_param_via_box_thunk_call() {
        let param_reg = ops::RegId::alloc();
        let ret_reg = ops::RegId::alloc();

        let test_fun = ops::Fun {
            span: EMPTY_SPAN,
            source_name: None,

            abi: ops::OpsAbi {
                call_conv: ops::CallConv::FastCc,
                params: Box::new([boxed::TypeTag::Int.into()]),
                ret: boxed::TypeTag::Pair.into(),
            },
            param_regs: Box::new([param_reg]),
            ops: Box::new([
                ops::OpKind::Call(
                    ret_reg,
                    ops::CallOp {
                        callee: ops::Callee::BoxedFunThunk(param_reg),
                        impure: true,
                        args: Box::new([param_reg, param_reg, param_reg]),
                    },
                )
                .into(),
                ops::OpKind::Ret(ret_reg).into(),
            ]),
        };

        let captures = calc_single_fun_captures(&test_fun);
        assert_eq!(CaptureKind::Always, captures.get(param_reg));
        assert_eq!(CaptureKind::ViaRet, captures.get(ret_reg));
    }

    #[test]
    fn capture_param_via_static_symbol_call() {
        // These are passed to the first call with an unused ret
        let param_reg1 = ops::RegId::alloc();
        let param_reg2 = ops::RegId::alloc();
        let param_reg3 = ops::RegId::alloc();

        // These are passed to the second call which does have its ret captured
        let param_reg4 = ops::RegId::alloc();
        let param_reg5 = ops::RegId::alloc();
        let param_reg6 = ops::RegId::alloc();

        let unused_reg = ops::RegId::alloc();
        let ret_reg = ops::RegId::alloc();

        let static_symbol_abi = GenAbi {
            takes_task: false,
            params: Box::new([
                ParamAbiType {
                    abi_type: boxed::TypeTag::Int.into(),
                    capture: ParamCapture::Never,
                },
                ParamAbiType {
                    abi_type: boxed::TypeTag::Int.into(),
                    capture: ParamCapture::Auto,
                },
                ParamAbiType {
                    abi_type: boxed::TypeTag::Int.into(),
                    capture: ParamCapture::Always,
                },
            ]),
            ret: boxed::TypeTag::Int.into(),
        };

        let static_symbol = ops::StaticSymbol {
            symbol: "test",
            impure: true,
            abi: static_symbol_abi,
        };

        let test_fun = ops::Fun {
            span: EMPTY_SPAN,
            source_name: None,

            abi: ops::OpsAbi {
                call_conv: ops::CallConv::FastCc,
                params: Box::new([
                    boxed::TypeTag::Int.into(),
                    boxed::TypeTag::Int.into(),
                    boxed::TypeTag::Int.into(),
                    boxed::TypeTag::Int.into(),
                    boxed::TypeTag::Int.into(),
                    boxed::TypeTag::Int.into(),
                ]),
                ret: boxed::TypeTag::Int.into(),
            },
            param_regs: Box::new([param_reg1]),
            ops: Box::new([
                ops::OpKind::Call(
                    unused_reg,
                    ops::CallOp {
                        callee: ops::Callee::StaticSymbol(static_symbol.clone()),
                        impure: true,
                        args: Box::new([param_reg1, param_reg2, param_reg3]),
                    },
                )
                .into(),
                ops::OpKind::Call(
                    ret_reg,
                    ops::CallOp {
                        callee: ops::Callee::StaticSymbol(static_symbol),
                        impure: true,
                        args: Box::new([param_reg4, param_reg5, param_reg6]),
                    },
                )
                .into(),
                ops::OpKind::Ret(ret_reg).into(),
            ]),
        };

        let captures = calc_single_fun_captures(&test_fun);

        assert_eq!(CaptureKind::Never, captures.get(param_reg1));
        assert_eq!(CaptureKind::Never, captures.get(param_reg2));
        assert_eq!(CaptureKind::Always, captures.get(param_reg3));

        assert_eq!(CaptureKind::Never, captures.get(param_reg4));
        assert_eq!(CaptureKind::ViaRet, captures.get(param_reg5));
        assert_eq!(CaptureKind::Always, captures.get(param_reg6));

        assert_eq!(CaptureKind::Never, captures.get(unused_reg));
        assert_eq!(CaptureKind::ViaRet, captures.get(ret_reg));
    }

    #[test]
    fn capture_param_via_cond() {
        let param_reg = ops::RegId::alloc();
        let ret_reg = ops::RegId::alloc();

        let test_fun = ops::Fun {
            span: EMPTY_SPAN,
            source_name: None,

            abi: ops::OpsAbi {
                call_conv: ops::CallConv::FastCc,
                params: Box::new([boxed::TypeTag::Int.into()]),
                ret: boxed::TypeTag::Pair.into(),
            },
            param_regs: Box::new([param_reg]),
            ops: Box::new([
                ops::OpKind::Cond(ops::CondOp {
                    reg_phi: Some(ops::RegPhi {
                        output_reg: ret_reg,
                        true_result_reg: param_reg,
                        false_result_reg: param_reg,
                    }),
                    test_reg: param_reg,
                    true_ops: Box::new([]),
                    false_ops: Box::new([]),
                })
                .into(),
                ops::OpKind::Ret(ret_reg).into(),
            ]),
        };

        let captures = calc_single_fun_captures(&test_fun);
        assert_eq!(CaptureKind::ViaRet, captures.get(param_reg));
        assert_eq!(CaptureKind::ViaRet, captures.get(ret_reg));
    }
}


================================================
FILE: compiler/codegen/analysis/mod.rs
================================================
pub mod escape;
pub mod names;

use std::collections::{BTreeMap, HashMap};
use std::rc::Rc;

use arret_runtime::intern;

use crate::codegen::analysis::escape::Captures;
use crate::mir::ops;

pub struct AnalysedMod<'of> {
    private_funs: HashMap<ops::PrivateFunId, AnalysedFun<'of>>,
    entry_fun: AnalysedFun<'of>,
    global_interned_names: BTreeMap<Rc<str>, intern::InternedSym>,
}

pub struct AnalysedFun<'of> {
    pub ops_fun: &'of ops::Fun,
    pub captures: Captures,
}

impl<'of> AnalysedMod<'of> {
    pub fn new(
        private_funs: &'of HashMap<ops::PrivateFunId, ops::Fun>,
        entry_fun: &'of ops::Fun,
    ) -> AnalysedMod<'of> {
        // This also determines which private funs are used; private_fun_captures won't contain
        // entries for unused funs
        let escape::ProgramCaptures {
            private_fun_captures,
            entry_fun_captures,
        } = escape::calc_program_captures(private_funs, entry_fun);

        let private_funs = private_fun_captures
            .into_iter()
            .map(|(private_fun_id, captures)| {
                (
                    private_fun_id,
                    AnalysedFun {
                        ops_fun: &private_funs[&private_fun_id],
                        captures,
                    },
                )
            })
            .collect();

        let global_interned_names =
            names::calc_program_global_interned_names(&private_funs, entry_fun);

        AnalysedMod {
            private_funs,
            entry_fun: AnalysedFun {
                ops_fun: entry_fun,
                captures: entry_fun_captures,
            },
            global_interned_names,
        }
    }

    pub fn private_funs(&self) -> impl Iterator<Item = (&ops::PrivateFunId, &AnalysedFun<'of>)> {
        self.private_funs.iter()
    }

    pub fn entry_fun(&self) -> &AnalysedFun<'of> {
        &self.entry_fun
    }

    pub fn global_interned_names(&self) -> &BTreeMap<Rc<str>, intern::InternedSym> {
        &self.global_interned_names
    }
}


================================================
FILE: compiler/codegen/analysis/names.rs
================================================
use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::rc::Rc;

use arret_runtime::intern;

use super::AnalysedFun;
use crate::mir::ops;

fn add_op_global_interned_names(names: &mut BTreeSet<Rc<str>>, op: &ops::Op) {
    use ops::OpKind;

    match op.kind() {
        OpKind::ConstInternedSym(_, name) | OpKind::ConstBoxedSym(_, name) => {
            if intern::InternedSym::try_from_inline_name(name).is_none() {
                names.insert(name.clone());
            }
        }
        OpKind::Cond(ops::CondOp {
            true_ops,
            false_ops,
            ..
        }) => {
            for op in true_ops.iter().rev().chain(false_ops.iter().rev()) {
                add_op_global_interned_names(names, op);
            }
        }
        _ => {}
    }
}

fn add_fun_global_interned_names(fun: &ops::Fun, names: &mut BTreeSet<Rc<str>>) {
    for op in fun.ops.iter() {
        add_op_global_interned_names(names, op);
    }
}

/// Finds all global interned names in the program and returns them in sorted order
pub fn calc_program_global_interned_names(
    private_funs: &HashMap<ops::PrivateFunId, AnalysedFun<'_>>,
    entry_fun: &ops::Fun,
) -> BTreeMap<Rc<str>, intern::InternedSym> {
    let mut names: BTreeSet<Rc<str>> = BTreeSet::new();

    for fun in private_funs
        .values()
        .map(|af| af.ops_fun)
        .chain(std::iter::once(entry_fun))
    {
        add_fun_global_interned_names(fun, &mut names);
    }

    names
        .into_iter()
        .enumerate()
        .map(|(idx, name)| (name, intern::InternedSym::from_global_index(idx as u32)))
        .collect()
}

#[cfg(test)]
mod test {
    use super::*;

    use arret_runtime::abitype::RetAbiType;
    use arret_runtime::boxed;

    use crate::source::EMPTY_SPAN;

    #[test]
    fn simple_global_interned_names() {
        let param_reg = ops::RegId::alloc();

        let inline_reg = ops::RegId::alloc();
        let alpha_reg = ops::RegId::alloc();
        let beta_reg = ops::RegId::alloc();
        let gamma_reg = ops::RegId::alloc();

        let test_fun = ops::Fun {
            span: EMPTY_SPAN,
            source_name: None,

            abi: ops::OpsAbi {
                call_conv: ops::CallConv::FastCc,
                params: Box::new([boxed::TypeTag::Int.into()]),
                ret: RetAbiType::Void,
            },
            param_regs: Box::new([]),
            ops: Box::new([
                ops::OpKind::ConstBoxedSym(inline_reg, "inline".into()).into(),
                ops::OpKind::Cond(ops::CondOp {
                    reg_phi: None,
                    test_reg: param_reg,
                    true_ops: Box::new([ops::OpKind::ConstBoxedSym(
                        beta_reg,
                        "beta NOT INLINE".into(),
                    )
                    .into()]),
                    false_ops: Box::new([ops::OpKind::ConstInternedSym(
                        gamma_reg,
                        "gamma NOT INLINE".into(),
                    )
                    .into()]),
                })
                .into(),
                ops::OpKind::ConstBoxedSym(alpha_reg, "alpha NOT INLINE".into()).into(),
            ]),
        };

        let global_interned_names = calc_program_global_interned_names(&HashMap::new(), &test_fun);

        assert_eq!(
            [
                ("alpha NOT INLINE", 0u32),
                ("beta NOT INLINE", 1u32),
                ("gamma NOT INLINE", 2u32)
            ]
            .iter()
            .map(|(name, idx)| ((*name).into(), intern::InternedSym::from_global_index(*idx)))
            .collect::<BTreeMap<Rc<str>, _>>(),
            global_interned_names
        );
    }
}


================================================
FILE: compiler/codegen/box_layout.rs
================================================
use llvm_sys::core::*;
use llvm_sys::prelude::*;

use arret_runtime::abitype::{BoxedAbiType, EncodeBoxedAbiType, TOP_LIST_BOXED_ABI_TYPE};
use arret_runtime::boxed;
use arret_runtime::boxed::TypeTag;

use crate::codegen::record_struct;
use crate::codegen::target_gen::TargetCtx;
use crate::codegen::GenAbi;

/// Represents the runtime layout of a boxed data structure
///
/// There are many boxed ABI types that can correspond to the same type name and layout. For
/// example, all boxed pair types currently share a layout.
#[derive(Clone, Hash, PartialEq, Eq)]
pub enum BoxLayout {
    Any,
    Bool,
    Num,
    List,
    Union,
    ConstTagged(boxed::TypeTag),
}

impl BoxLayout {
    /// Returns a NULL terminated type name for the box layout
    ///
    /// This is used to make the LLVM IR more descriptive. Some boxes with identical layouts have
    /// distinct enum values and names for the purposes of making LLVM IR more readable.
    pub fn type_name(&self) -> &'static [u8] {
        match self {
            BoxLayout::Any => b"boxed_any\0",
            BoxLayout::Bool => b"boxed_bool\0",
            BoxLayout::Num => b"boxed_num\0",
            BoxLayout::List => b"boxed_list\0",
            BoxLayout::Union => b"boxed_union\0",
            BoxLayout::ConstTagged(TypeTag::Nil) => b"boxed_nil\0",
            BoxLayout::ConstTagged(TypeTag::True) => b"boxed_true\0",
            BoxLayout::ConstTagged(TypeTag::False) => b"boxed_false\0",
            BoxLayout::ConstTagged(TypeTag::Int) => b"boxed_int\0",
            BoxLayout::ConstTagged(TypeTag::Float) => b"boxed_float\0",
            BoxLayout::ConstTagged(TypeTag::Char) => b"boxed_char\0",
            BoxLayout::ConstTagged(TypeTag::Set) => b"boxed_set\0",
            BoxLayout::ConstTagged(TypeTag::Str) => b"boxed_str\0",
            BoxLayout::ConstTagged(TypeTag::Sym) => b"boxed_sym\0",
            BoxLayout::ConstTagged(TypeTag::FunThunk) => b"boxed_fun_thunk\0",
            BoxLayout::ConstTagged(TypeTag::Pair) => b"boxed_pair\0",
            BoxLayout::ConstTagged(TypeTag::Vector) => b"boxed_vector\0",
            BoxLayout::ConstTagged(TypeTag::Record) => b"boxed_record\0",
            BoxLayout::ConstTagged(TypeTag::Map) => b"boxed_map\0",
        }
    }

    /// Appends member types to the passed `Vec`
    ///
    /// This presumes `members` already contains the box header
    pub fn append_members(&self, tcx: &mut TargetCtx, members: &mut Vec<LLVMTypeRef>) {
        unsafe {
            match self {
                BoxLayout::Any => {
                    use std::mem;

                    let llvm_byte = LLVMInt8TypeInContext(tcx.llx);
                    let padding_bytes =
                        mem::size_of::<boxed::Any>() - mem::size_of::<boxed::Header>();

                    members.push(LLVMArrayType(llvm_byte, padding_bytes as u32));
                }
                BoxLayout::ConstTagged(TypeTag::Int) => {
                    members.push(LLVMInt64TypeInContext(tcx.llx));
                }
                BoxLayout::ConstTagged(TypeTag::Float) => {
                    members.push(LLVMDoubleTypeInContext(tcx.llx));
                }
                BoxLayout::ConstTagged(TypeTag::Char) => {
                    members.push(LLVMInt32TypeInContext(tcx.llx));
                }
                BoxLayout::ConstTagged(TypeTag::Str) => {
                    members.push(LLVMInt8TypeInContext(tcx.llx));
                }
                BoxLayout::ConstTagged(TypeTag::Sym) => {
                    members.push(LLVMInt64TypeInContext(tcx.llx));
                }
                BoxLayout::ConstTagged(TypeTag::FunThunk) => {
                    members.extend_from_slice(&[
                        tcx.captures_llvm_type(),
                        LLVMPointerType(tcx.fun_abi_to_llvm_type(&GenAbi::thunk_abi()), 0),
                    ]);
                }
                BoxLayout::ConstTagged(TypeTag::Pair) => {
                    let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);
                    let llvm_any_ptr = tcx.boxed_abi_to_llvm_ptr_type(&BoxedAbiType::Any);
                    let llvm_any_list_ptr =
                        tcx.boxed_abi_to_llvm_ptr_type(&TOP_LIST_BOXED_ABI_TYPE);

                    members.extend_from_slice(&[llvm_i64, llvm_any_ptr, llvm_any_list_ptr]);
                }
                BoxLayout::ConstTagged(TypeTag::Record) => {
                    record_struct::append_common_internal_members(tcx, members);
                }
                BoxLayout::List => {
                    members.push(LLVMInt64TypeInContext(tcx.llx));
                }
                BoxLayout::ConstTagged(TypeTag::Set) => {
                    let llvm_i32 = LLVMInt32TypeInContext(tcx.llx);
                    let llvm_any_ptr = tcx.boxed_abi_to_llvm_ptr_type(&BoxedAbiType::Any);

                    members.extend_from_slice(&[llvm_i32, llvm_any_ptr, llvm_any_ptr, llvm_any_ptr])
                }
                BoxLayout::ConstTagged(TypeTag::Vector) => {
                    // inline_len
                    members.push(LLVMInt32TypeInContext(tcx.llx));
                }
                BoxLayout::ConstTagged(TypeTag::Nil)
                | BoxLayout::ConstTagged(TypeTag::True)
                | BoxLayout::ConstTagged(TypeTag::False)
                | BoxLayout::ConstTagged(TypeTag::Map)
                | BoxLayout::Bool
                | BoxLayout::Num
                | BoxLayout::Union => {}
            };
        }
    }
}

impl From<&BoxedAbiType> for BoxLayout {
    fn from(boxed_abi_type: &BoxedAbiType) -> BoxLayout {
        match boxed_abi_type {
            BoxedAbiType::Any => BoxLayout::Any,

            BoxedAbiType::List(_) => BoxLayout::List,
            &boxed::Num::BOXED_ABI_TYPE => BoxLayout::Num,
            &boxed::Bool::BOXED_ABI_TYPE => BoxLayout::Bool,
            BoxedAbiType::Union(_, _) => BoxLayout::Union,

            BoxedAbiType::UniqueTagged(type_tag) => BoxLayout::ConstTagged(*type_tag),
            BoxedAbiType::Pair(_) => BoxLayout::ConstTagged(TypeTag::Pair),
            BoxedAbiType::Set(_) => BoxLayout::ConstTagged(TypeTag::Set),
            BoxedAbiType::Vector(_) => BoxLayout::ConstTagged(TypeTag::Vector),
            BoxedAbiType::Map(_, _) => BoxLayout::ConstTagged(TypeTag::Map),
        }
    }
}


================================================
FILE: compiler/codegen/callee.rs
================================================
use std::ffi;

use llvm_sys::core::*;
use llvm_sys::prelude::*;
use llvm_sys::{LLVMAttributeFunctionIndex, LLVMCallConv};

use crate::codegen::mod_gen::ModCtx;
use crate::codegen::target_gen::TargetCtx;
use crate::libcstr;
use crate::mir::ops;

pub fn gen_static_symbol_entry_point(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    static_symbol: &ops::StaticSymbol,
) -> LLVMValueRef {
    use crate::codegen::analysis::escape::{infer_param_capture_kind, CaptureKind};
    use arret_runtime::abitype::{AbiType, RetAbiType};

    let ops::StaticSymbol {
        abi,
        impure,
        symbol,
    } = static_symbol;

    let function_type = tcx.fun_abi_to_llvm_type(abi);
    let function_name = ffi::CString::new(*symbol).unwrap();

    unsafe {
        mcx.get_function_or_insert(
            function_type,
            function_name.as_bytes_with_nul(),
            |function| {
                let param_attr_offset = abi.takes_task as usize;

                for (index, param_abi_type) in abi.params.iter().enumerate() {
                    if let AbiType::Boxed(_) = param_abi_type.abi_type {
                        let no_capture = infer_param_capture_kind(&abi.ret, param_abi_type)
                            == CaptureKind::Never;

                        tcx.add_boxed_param_attrs(
                            function,
                            (param_attr_offset + index) as u32,
                            no_capture,
                        )
                    }
                }

                if !impure {
                    let speculatable_attr = tcx.llvm_enum_attr_for_name("speculatable", 0);
                    LLVMAddAttributeAtIndex(
                        function,
                        LLVMAttributeFunctionIndex,
                        speculatable_attr,
                    );
                }

                match abi.ret {
                    RetAbiType::Inhabited(AbiType::Boxed(_)) => {
                        tcx.add_boxed_return_attrs(function);
                    }
                    RetAbiType::Never => {
                        let noreturn_attr = tcx.llvm_enum_attr_for_name("noreturn", 0);
                        LLVMAddAttributeAtIndex(
                            function,
                            LLVMAttributeFunctionIndex,
                            noreturn_attr,
                        );
                    }
                    _ => {}
                }
            },
        )
    }
}

pub fn gen_boxed_fun_thunk_entry_point(
    builder: LLVMBuilderRef,
    llvm_fun_thunk: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let entry_ptr =
            LLVMBuildStructGEP(builder, llvm_fun_thunk, 2, libcstr!("fun_thunk_entry_ptr"));

        LLVMBuildLoad(builder, entry_ptr, libcstr!("fun_thunk_entry"))
    }
}

pub fn callee_takes_task(callee: &ops::Callee) -> bool {
    match callee {
        ops::Callee::BoxedFunThunk(_) => true,
        ops::Callee::PrivateFun(_) => true,
        ops::Callee::StaticSymbol(ops::StaticSymbol { abi, .. }) => abi.takes_task,
    }
}

pub fn callee_call_conv(mcx: &mut ModCtx<'_, '_, '_>, callee: &ops::Callee) -> u32 {
    match callee {
        ops::Callee::BoxedFunThunk(_) | ops::Callee::StaticSymbol(_) => {
            LLVMCallConv::LLVMCCallConv as u32
        }
        ops::Callee::PrivateFun(private_fun_id) => unsafe {
            LLVMGetFunctionCallConv(mcx.llvm_private_fun(*private_fun_id))
        },
    }
}


================================================
FILE: compiler/codegen/const_gen.rs
================================================
use std::rc::Rc;
use std::{iter, mem};

use llvm_sys::core::*;
use llvm_sys::prelude::*;
use llvm_sys::{LLVMLinkage, LLVMUnnamedAddr};

use arret_runtime::boxed;

use crate::codegen::mod_gen::ModCtx;
use crate::codegen::record_struct;
use crate::codegen::target_gen::TargetCtx;
use crate::libcstr;
use crate::mir::ops;

pub fn annotate_private_global(llvm_global: LLVMValueRef) {
    unsafe {
        LLVMSetUnnamedAddress(llvm_global, LLVMUnnamedAddr::LLVMGlobalUnnamedAddr);
        LLVMSetGlobalConstant(llvm_global, 1);
        LLVMSetLinkage(llvm_global, LLVMLinkage::LLVMPrivateLinkage)
    }
}

pub fn gen_boxed_pair(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    llvm_head: LLVMValueRef,
    llvm_rest: LLVMValueRef,
    llvm_list_len: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let type_tag = boxed::TypeTag::Pair;
        let llvm_type = tcx.boxed_abi_to_llvm_struct_type(&type_tag.into());

        let members = &mut [
            tcx.llvm_box_header(type_tag.to_const_header()),
            llvm_list_len,
            llvm_head,
            llvm_rest,
        ];

        let llvm_value =
            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32);

        let global = LLVMAddGlobal(mcx.module, llvm_type, libcstr!("const_pair"));
        LLVMSetInitializer(global, llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Pair>() as u32);

        annotate_private_global(global);
        global
    }
}

fn gen_boxed_external_str(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    value: &str,
) -> LLVMValueRef {
    unsafe {
        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

        let shared_str_members = &mut [
            // ref_count
            LLVMConstInt(llvm_i64, std::u64::MAX, 0),
            // len
            LLVMConstInt(llvm_i64, value.len() as u64, 0),
            // data
            LLVMConstStringInContext(tcx.llx, value.as_ptr() as *mut _, value.len() as u32, 1),
        ];

        let shared_str_llvm_value = LLVMConstStructInContext(
            tcx.llx,
            shared_str_members.as_mut_ptr(),
            shared_str_members.len() as u32,
            0,
        );

        let shared_str_global = LLVMAddGlobal(
            mcx.module,
            LLVMTypeOf(shared_str_llvm_value),
            libcstr!("shared_str"),
        );
        LLVMSetInitializer(shared_str_global, shared_str_llvm_value);
        annotate_private_global(shared_str_global);

        let type_tag = boxed::TypeTag::Str;
        let external_llvm_type = tcx.boxed_external_str_llvm_type();
        let llvm_i8 = LLVMInt8TypeInContext(tcx.llx);

        let external_members = &mut [
            tcx.llvm_box_header(type_tag.to_const_header()),
            LLVMConstInt(llvm_i8, boxed::Str::EXTERNAL_INLINE_BYTE_LEN as u64, 0),
            LLVMConstBitCast(
                shared_str_global,
                LLVMPointerType(tcx.shared_str_llvm_type(), 0),
            ),
        ];

        let external_llvm_value = LLVMConstNamedStruct(
            external_llvm_type,
            external_members.as_mut_ptr(),
            external_members.len() as u32,
        );

        let global = LLVMAddGlobal(mcx.module, external_llvm_type, libcstr!("const_str"));
        LLVMSetInitializer(global, external_llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Str>() as u32);
        annotate_private_global(global);

        LLVMConstBitCast(global, tcx.boxed_abi_to_llvm_ptr_type(&type_tag.into()))
    }
}

fn gen_boxed_inline_str(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    value: &str,
) -> LLVMValueRef {
    unsafe {
        const MAX_INLINE_BYTES: usize = boxed::Str::MAX_INLINE_BYTES;

        let mut inline_buffer: [u8; MAX_INLINE_BYTES] = [0; MAX_INLINE_BYTES];
        inline_buffer[0..value.len()].copy_from_slice(value.as_bytes());

        let type_tag = boxed::TypeTag::Str;
        let inline_llvm_type = tcx.boxed_inline_str_llvm_type();
        let llvm_i8 = LLVMInt8TypeInContext(tcx.llx);

        let members = &mut [
            tcx.llvm_box_header(type_tag.to_const_header()),
            LLVMConstInt(llvm_i8, value.len() as u64, 0),
            LLVMConstStringInContext(
                tcx.llx,
                inline_buffer.as_mut_ptr() as *mut _,
                MAX_INLINE_BYTES as u32,
                1,
            ),
        ];

        let inline_llvm_value =
            LLVMConstNamedStruct(inline_llvm_type, members.as_mut_ptr(), members.len() as u32);

        let global = LLVMAddGlobal(mcx.module, inline_llvm_type, libcstr!("const_str"));
        LLVMSetInitializer(global, inline_llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Str>() as u32);
        annotate_private_global(global);

        LLVMConstBitCast(global, tcx.boxed_abi_to_llvm_ptr_type(&type_tag.into()))
    }
}

pub fn gen_boxed_str(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    value: &str,
) -> LLVMValueRef {
    match boxed::Str::storage_for_byte_len(value.len()) {
        boxed::StrStorage::Inline(_) => gen_boxed_inline_str(tcx, mcx, value),
        boxed::StrStorage::External => gen_boxed_external_str(tcx, mcx, value),
    }
}

pub fn gen_boxed_sym(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    value: &str,
) -> LLVMValueRef {
    let interned_sym = mcx.intern_name(value);

    unsafe {
        let type_tag = boxed::TypeTag::Sym;
        let boxed_llvm_type = tcx.boxed_abi_to_llvm_struct_type(&type_tag.into());
        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

        let members = &mut [
            tcx.llvm_box_header(type_tag.to_const_header()),
            LLVMConstInt(llvm_i64, interned_sym.to_raw_u64(), 0),
        ];
        let boxed_llvm_value =
            LLVMConstNamedStruct(boxed_llvm_type, members.as_mut_ptr(), members.len() as u32);

        let global = LLVMAddGlobal(mcx.module, boxed_llvm_type, libcstr!("const_sym"));
        LLVMSetInitializer(global, boxed_llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Sym>() as u32);
        annotate_private_global(global);

        global
    }
}

/// Generates a table of global interned names
///
/// `names` must be pre-sorted
pub fn gen_global_interned_names<'a>(
    tcx: &mut TargetCtx,
    llvm_module: LLVMModuleRef,
    names: impl ExactSizeIterator<Item = &'a Rc<str>>,
) -> LLVMValueRef {
    unsafe {
        let names_len = names.len();
        if names_len == 0 {
            return LLVMConstPointerNull(LLVMPointerType(tcx.global_interned_name_llvm_type(), 0));
        }

        let llvm_i32 = LLVMInt32TypeInContext(tcx.llx);
        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

        let global_interned_name_llvm_type = tcx.global_interned_name_llvm_type();

        let first_element_gep_indices =
            &mut [LLVMConstInt(llvm_i32, 0, 0), LLVMConstInt(llvm_i32, 0, 0)];

        let mut llvm_names: Vec<LLVMValueRef> = names
            .map(|name| {
                let llvm_name_string = LLVMConstStringInContext(
                    tcx.llx,
                    name.as_bytes().as_ptr() as *mut _,
                    name.len() as u32,
                    1,
                );

                let name_global_name = format!("global_interned_name_{}\0", name);

                let llvm_name_global = LLVMAddGlobal(
                    llvm_module,
                    LLVMTypeOf(llvm_name_string),
                    name_global_name.as_ptr() as *const _,
                );
                LLVMSetInitializer(llvm_name_global, llvm_name_string);
                annotate_private_global(llvm_name_global);

                let llvm_name_string_ptr = LLVMConstGEP(
                    llvm_name_global,
                    first_element_gep_indices.as_mut_ptr(),
                    first_element_gep_indices.len() as u32,
                );

                let llvm_name_members = &mut [
                    LLVMConstInt(llvm_i64, name.len() as u64, 0),
                    llvm_name_string_ptr,
                ];

                LLVMConstNamedStruct(
                    global_interned_name_llvm_type,
                    llvm_name_members.as_mut_ptr(),
                    llvm_name_members.len() as u32,
                )
            })
            .collect();

        let llvm_names_array = LLVMConstArray(
            global_interned_name_llvm_type,
            llvm_names.as_mut_ptr(),
            llvm_names.len() as u32,
        );

        let global_names_members = &mut [
            // len
            LLVMConstInt(llvm_i32, names_len as u64, 0),
            // names
            llvm_names_array,
        ];

        let llvm_global_names = LLVMConstStructInContext(
            tcx.llx,
            global_names_members.as_mut_ptr(),
            global_names_members.len() as u32,
            0,
        );

        let global = LLVMAddGlobal(
            llvm_module,
            LLVMTypeOf(llvm_global_names),
            libcstr!("global_interned_names"),
        );

        LLVMSetInitializer(global, llvm_global_names);
        annotate_private_global(global);

        global
    }
}

pub fn gen_boxed_int(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    value: i64,
) -> LLVMValueRef {
    unsafe {
        let type_tag = boxed::TypeTag::Int;
        let llvm_type = tcx.boxed_abi_to_llvm_struct_type(&type_tag.into());
        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

        let box_name = format!("const_int_{}\0", value);

        let global = mcx.get_global_or_insert(llvm_type, box_name.as_bytes(), || {
            let members = &mut [
                tcx.llvm_box_header(type_tag.to_const_header()),
                LLVMConstInt(llvm_i64, value as u64, 1),
            ];

            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32)
        });

        LLVMSetAlignment(global, mem::align_of::<boxed::Int>() as u32);
        annotate_private_global(global);
        global
    }
}

pub fn gen_boxed_float(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    value: f64,
) -> LLVMValueRef {
    unsafe {
        let type_tag = boxed::TypeTag::Float;
        let llvm_type = tcx.boxed_abi_to_llvm_struct_type(&type_tag.into());
        let llvm_double = LLVMDoubleTypeInContext(tcx.llx);

        let members = &mut [
            tcx.llvm_box_header(type_tag.to_const_header()),
            LLVMConstReal(llvm_double, value),
        ];

        let llvm_value =
            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32);

        let global = LLVMAddGlobal(mcx.module, llvm_type, libcstr!("const_float"));
        LLVMSetInitializer(global, llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Float>() as u32);

        annotate_private_global(global);
        global
    }
}

pub fn gen_boxed_char(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    value: char,
) -> LLVMValueRef {
    unsafe {
        let type_tag = boxed::TypeTag::Char;
        let llvm_type = tcx.boxed_abi_to_llvm_struct_type(&type_tag.into());
        let llvm_i32 = LLVMInt32TypeInContext(tcx.llx);

        let box_name = format!("const_char_{}\0", value);

        let global = mcx.get_global_or_insert(llvm_type, box_name.as_bytes(), || {
            let members = &mut [
                tcx.llvm_box_header(type_tag.to_const_header()),
                LLVMConstInt(llvm_i32, value as u64, 1),
            ];

            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32)
        });

        LLVMSetAlignment(global, mem::align_of::<boxed::Char>() as u32);
        annotate_private_global(global);
        global
    }
}

pub fn gen_boxed_nil(tcx: &mut TargetCtx, mcx: &mut ModCtx<'_, '_, '_>) -> LLVMValueRef {
    tcx.ptr_to_singleton_box(mcx.module, boxed::TypeTag::Nil, b"ARRET_NIL\0")
}

pub fn gen_boxed_fun_thunk(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    llvm_captures: LLVMValueRef,
    llvm_entry_point: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let type_tag = boxed::TypeTag::FunThunk;
        let llvm_type = tcx.boxed_abi_to_llvm_struct_type(&type_tag.into());

        let members = &mut [
            tcx.llvm_box_header(type_tag.to_const_header()),
            llvm_captures,
            llvm_entry_point,
        ];

        let llvm_value =
            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32);

        let global = LLVMAddGlobal(mcx.module, llvm_type, libcstr!("const_fun_thunk"));
        LLVMSetInitializer(global, llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::FunThunk>() as u32);

        annotate_private_global(global);
        global
    }
}

pub fn gen_boxed_record(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    record_struct: &ops::RecordStructId,
    llvm_fields: &[LLVMValueRef],
) -> LLVMValueRef {
    let type_tag = boxed::TypeTag::Record;
    let record_class_id = mcx.record_class_id_for_struct(record_struct);

    let record_struct::TargetRecordStruct {
        data_layout,
        record_storage,
        llvm_data_type,
        ..
    } = *tcx.target_record_struct(record_struct);

    let llvm_box_type = tcx.record_struct_llvm_box_type(record_struct);

    unsafe {
        let box_name = format!("const_{}\0", record_struct.source_name);

        let llvm_data_struct = LLVMConstNamedStruct(
            llvm_data_type,
            llvm_fields.as_ptr() as *mut _,
            llvm_fields.len() as u32,
        );

        let llvm_box_header = tcx.llvm_box_header(type_tag.to_const_header());

        // Constant records by definition cannot have GC refs
        let llvm_i8 = LLVMInt8TypeInContext(tcx.llx);
        let llvm_has_gc_refs = LLVMConstInt(llvm_i8, 0, 1);

        let llvm_record_class_id = LLVMConstInt(
            tcx.record_class_id_llvm_type(),
            u64::from(record_class_id),
            1,
        );

        let llvm_box_value = if let boxed::RecordStorage::Inline(_) = record_storage {
            let llvm_inline_byte_len = LLVMConstInt(
                llvm_i8,
                match data_layout {
                    Some(data_layout) => data_layout.size() as u64,
                    None => 0,
                },
                1,
            );

            let inline_box_members = &mut [
                llvm_box_header,
                llvm_inline_byte_len,
                llvm_has_gc_refs,
                llvm_record_class_id,
                llvm_data_struct,
            ];

            LLVMConstNamedStruct(
                llvm_box_type,
                inline_box_members.as_mut_ptr(),
                inline_box_members.len() as u32,
            )
        } else {
            // Create a global containing our data and return a pointer to it
            let data_global_name = format!("const_{}_data\0", record_struct.source_name);

            let data_global = LLVMAddGlobal(
                mcx.module,
                llvm_data_type,
                data_global_name.as_ptr() as *const _,
            );
            LLVMSetInitializer(data_global, llvm_data_struct);
            annotate_private_global(data_global);

            let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);
            let external_box_members = &mut [
                llvm_box_header,
                LLVMConstInt(llvm_i8, boxed::Record::EXTERNAL_INLINE_LEN as u64, 1),
                llvm_has_gc_refs,
                llvm_record_class_id,
                data_global,
                LLVMConstInt(llvm_i64, 0, 0),
            ];

            LLVMConstNamedStruct(
                llvm_box_type,
                external_box_members.as_mut_ptr(),
                external_box_members.len() as u32,
            )
        };

        let global = LLVMAddGlobal(mcx.module, llvm_box_type, box_name.as_ptr() as *const _);
        LLVMSetInitializer(global, llvm_box_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Record>() as u32);
        annotate_private_global(global);

        LLVMConstBitCast(global, tcx.boxed_abi_to_llvm_ptr_type(&type_tag.into()))
    }
}

fn gen_persistent_vector_leaf(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    llvm_elements: &[LLVMValueRef],
) -> LLVMValueRef {
    use arret_runtime::abitype::BoxedAbiType;
    use arret_runtime::persistent::vector::GLOBAL_CONSTANT_REFCOUNT;
    use arret_runtime::persistent::vector::NODE_SIZE;

    unsafe {
        let llvm_type = tcx.persistent_vector_leaf_llvm_type();
        let llvm_any_ptr = tcx.boxed_abi_to_llvm_ptr_type(&BoxedAbiType::Any);
        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

        let mut padded_llvm_elements: Vec<LLVMValueRef> = llvm_elements
            .iter()
            .copied()
            .chain(iter::repeat(LLVMGetUndef(llvm_any_ptr)).take(NODE_SIZE - llvm_elements.len()))
            .collect();

        let mut members = vec![
            LLVMConstInt(llvm_i64, GLOBAL_CONSTANT_REFCOUNT as u64, 0),
            LLVMConstArray(
                llvm_any_ptr,
                padded_llvm_elements.as_mut_ptr(),
                padded_llvm_elements.len() as u32,
            ),
        ];

        let global = LLVMAddGlobal(mcx.module, llvm_type, libcstr!("const_vector_leaf"));

        let llvm_value =
            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32);

        LLVMSetInitializer(global, llvm_value);
        annotate_private_global(global);
        global
    }
}

fn gen_boxed_external_vector(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    llvm_elements_iter: impl ExactSizeIterator<Item = LLVMValueRef>,
) -> LLVMValueRef {
    use arret_runtime::persistent::vector::NODE_SIZE;

    let llvm_elements: Vec<LLVMValueRef> = llvm_elements_iter.collect();

    unsafe {
        let type_tag = boxed::TypeTag::Vector;
        let llvm_type = tcx.boxed_external_vector_llvm_type();

        let llvm_i32 = LLVMInt32TypeInContext(tcx.llx);
        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);
        let llvm_persistent_vector_leaf_ptr =
            LLVMPointerType(tcx.persistent_vector_leaf_llvm_type(), 0);

        let (root_ptr, tail_ptr) = if llvm_elements.len() > NODE_SIZE {
            // Need a root a tail
            (
                gen_persistent_vector_leaf(tcx, mcx, &llvm_elements[0..NODE_SIZE]),
                gen_persistent_vector_leaf(tcx, mcx, &llvm_elements[NODE_SIZE..]),
            )
        } else {
            // Need just the tail
            (
                LLVMConstPointerNull(llvm_persistent_vector_leaf_ptr),
                gen_persistent_vector_leaf(tcx, mcx, &llvm_elements),
            )
        };

        let mut members = [
            tcx.llvm_box_header(type_tag.to_const_header()),
            LLVMConstInt(
                llvm_i32,
                boxed::Vector::<boxed::Any>::EXTERNAL_INLINE_LEN as u64,
                0,
            ),
            LLVMConstInt(llvm_i64, llvm_elements.len() as u64, 0),
            root_ptr,
            tail_ptr,
        ];

        let llvm_value =
            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32);

        let global = LLVMAddGlobal(mcx.module, llvm_type, libcstr!("const_vector"));
        LLVMSetInitializer(global, llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Vector>() as u32);

        annotate_private_global(global);
        global
    }
}

fn gen_boxed_inline_vector(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    llvm_elements: impl ExactSizeIterator<Item = LLVMValueRef>,
) -> LLVMValueRef {
    use arret_runtime::abitype::BoxedAbiType;

    let elements_len = llvm_elements.len();

    unsafe {
        let type_tag = boxed::TypeTag::Vector;
        let llvm_type = tcx.boxed_inline_vector_llvm_type();
        let llvm_i32 = LLVMInt32TypeInContext(tcx.llx);
        let llvm_any_ptr = tcx.boxed_abi_to_llvm_ptr_type(&BoxedAbiType::Any);

        let mut members: Vec<LLVMValueRef> = vec![
            tcx.llvm_box_header(type_tag.to_const_header()),
            LLVMConstInt(llvm_i32, elements_len as u64, 0),
        ];

        members.extend(
            llvm_elements.chain(
                iter::repeat(LLVMGetUndef(llvm_any_ptr))
                    .take(boxed::Vector::<boxed::Any>::MAX_INLINE_LEN - elements_len),
            ),
        );

        let llvm_value =
            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32);

        let global = LLVMAddGlobal(mcx.module, llvm_type, libcstr!("const_vector"));
        LLVMSetInitializer(global, llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Vector>() as u32);

        annotate_private_global(global);
        global
    }
}

pub fn gen_boxed_vector(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    llvm_elements: impl ExactSizeIterator<Item = LLVMValueRef>,
) -> LLVMValueRef {
    use arret_runtime::persistent::vector::NODE_SIZE;

    let elements_len = llvm_elements.len();

    if elements_len <= boxed::Vector::<boxed::Any>::MAX_INLINE_LEN {
        gen_boxed_inline_vector(tcx, mcx, llvm_elements)
    } else if elements_len <= (NODE_SIZE * 2) {
        gen_boxed_external_vector(tcx, mcx, llvm_elements)
    } else {
        todo!("generating constant vector of length {}", elements_len);
    }
}

pub fn gen_boxed_set(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    llvm_elements: impl ExactSizeIterator<Item = LLVMValueRef>,
) -> LLVMValueRef {
    use arret_runtime::abitype::BoxedAbiType;

    let elements_len = llvm_elements.len();

    if elements_len > boxed::Set::<boxed::Any>::MAX_INLINE_LEN {
        todo!("generating constant set of length {}", elements_len);
    }

    unsafe {
        let type_tag = boxed::TypeTag::Set;
        let llvm_type = tcx.boxed_abi_to_llvm_struct_type(&type_tag.into());
        let llvm_i32 = LLVMInt32TypeInContext(tcx.llx);
        let llvm_any_ptr = tcx.boxed_abi_to_llvm_ptr_type(&BoxedAbiType::Any);

        let mut members: Vec<LLVMValueRef> = vec![
            tcx.llvm_box_header(type_tag.to_const_header()),
            LLVMConstInt(llvm_i32, elements_len as u64, 0),
        ];

        members.extend(
            llvm_elements.chain(
                iter::repeat(LLVMGetUndef(llvm_any_ptr))
                    .take(boxed::Set::<boxed::Any>::MAX_INLINE_LEN - elements_len),
            ),
        );

        let llvm_value =
            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32);

        let global = LLVMAddGlobal(mcx.module, llvm_type, libcstr!("const_set"));
        LLVMSetInitializer(global, llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Set>() as u32);

        annotate_private_global(global);
        global
    }
}

pub fn gen_boxed_map(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    llvm_elements: impl ExactSizeIterator<Item = (LLVMValueRef, LLVMValueRef)>,
) -> LLVMValueRef {
    if llvm_elements.len() > 0 {
        todo!("generating non-empty map");
    }

    unsafe {
        let type_tag = boxed::TypeTag::Map;
        let llvm_type = tcx.boxed_abi_to_llvm_struct_type(&type_tag.into());

        let mut members: Vec<LLVMValueRef> = vec![tcx.llvm_box_header(type_tag.to_const_header())];

        let llvm_value =
            LLVMConstNamedStruct(llvm_type, members.as_mut_ptr(), members.len() as u32);

        let global = LLVMAddGlobal(mcx.module, llvm_type, libcstr!("const_map"));
        LLVMSetInitializer(global, llvm_value);
        LLVMSetAlignment(global, mem::align_of::<boxed::Map>() as u32);

        annotate_private_global(global);
        global
    }
}


================================================
FILE: compiler/codegen/debug_info.rs
================================================
use std::collections::HashMap;
use std::os::unix::ffi::OsStrExt;
use std::{env, ffi, ptr};

use codespan_reporting::files::Files as _;

use llvm_sys::core::*;
use llvm_sys::debuginfo::*;
use llvm_sys::prelude::*;

use arret_syntax::datum::DataStr;
use arret_syntax::span::{FileId, Span};

use crate::source::SourceLoader;

pub struct DebugInfoBuilder<'sl> {
    pub llvm_dib: LLVMDIBuilderRef,

    source_loader: &'sl SourceLoader,
    current_dir: ffi::OsString,
    file_metadata: HashMap<FileId, LLVMMetadataRef>,
}

impl<'sl> DebugInfoBuilder<'sl> {
    pub fn new(
        source_loader: &'sl SourceLoader,
        optimised: bool,
        main_span: Span,
        module: LLVMModuleRef,
    ) -> DebugInfoBuilder<'sl> {
        // This is needed for all of our file metadata so the debugger can resolve relative paths
        let current_dir = env::current_dir()
            .ok()
            .map(|current_dir| current_dir.as_os_str().to_owned())
            .unwrap_or_else(ffi::OsString::new);

        let llvm_dib = unsafe { LLVMCreateDIBuilderDisallowUnresolved(module) };

        let mut di_builder = DebugInfoBuilder {
            llvm_dib,

            source_loader,
            current_dir,
            file_metadata: HashMap::new(),
        };

        di_builder.add_compile_unit_metadata(optimised, main_span);
        di_builder
    }

    fn add_compile_unit_metadata(&mut self, optimised: bool, main_span: Span) {
        let main_file_id = if let Some(file_id) = main_span.file_id() {
            file_id
        } else {
            return;
        };

        let main_file_metadata = self.file_metadata(main_file_id);

        let producer = b"arret\0";

        unsafe {
            // This is implicitly added to the LLVM module
            LLVMDIBuilderCreateCompileUnit(
                self.llvm_dib,
                LLVMDWARFSourceLanguage::LLVMDWARFSourceLanguageC,
                main_file_metadata,
                producer.as_ptr() as *const _,
                producer.len(),
                optimised as i32,                                 // `isOptimized`
                ptr::null(),                                      // `Flags`
                0,                                                // `FlagsLen`
                0,                                                // `RuntimeVer`
                ptr::null(),                                      // `SplitName`
                0,                                                // `SplitNameLen`
                LLVMDWARFEmissionKind::LLVMDWARFEmissionKindFull, // `LLVMDWARFEmissionKind::LLVMDWARFEmissionKindLineTablesOnly`,
                0,                                                // `DWOId`
                0,                                                // `SplitDebugInlining`
                0,                                                // `DebugInfoForProfiling`
            );
        }
    }

    pub fn file_metadata(&mut self, file_id: FileId) -> LLVMMetadataRef {
        if let Some(metadata) = self.file_metadata.get(&file_id) {
            return *metadata;
        }

        let filename = self.source_loader.files().name(file_id).unwrap();

        let metadata = unsafe {
            LLVMDIBuilderCreateFile(
                self.llvm_dib,
                filename.as_ptr() as *const _,
                filename.len(),
                self.current_dir.as_bytes().as_ptr() as *const _,
                self.current_dir.as_bytes().len(),
            )
        };

        self.file_metadata.insert(file_id, metadata);
        metadata
    }

    /// Returns a subroutine type containing no parameters
    pub fn placeholder_subroutine_type(
        &mut self,
        file_metadata: LLVMMetadataRef,
    ) -> LLVMMetadataRef {
        // This includes no parameter types
        unsafe {
            LLVMDIBuilderCreateSubroutineType(
                self.llvm_dib,
                file_metadata,
                ptr::null_mut(),
                0,
                LLVMDIFlagZero,
            )
        }
    }

    pub fn add_function_debug_info(
        &mut self,
        span: Span,
        source_name: Option<&DataStr>,
        llvm_function: LLVMValueRef,
    ) {
        let file_id = if let Some(file_id) = span.file_id() {
            file_id
        } else {
            return;
        };

        let location = if let Ok(location) = self
            .source_loader
            .files()
            .location(file_id, span.start() as usize)
        {
            location
        } else {
            return;
        };

        let line_index = location.line_number - 1;

        let file_metadata = self.file_metadata(file_id);

        unsafe {
            let mut linkage_name_len: usize = 0;
            let linkage_name_ptr = LLVMGetValueName2(llvm_function, &mut linkage_name_len);

            let function_metadata = LLVMDIBuilderCreateFunction(
                self.llvm_dib,
                file_metadata, // `Scope`
                source_name
                    .map(|source_name| source_name.as_ptr() as *const _)
                    .unwrap_or(linkage_name_ptr),
                source_name
                    .as_ref()
                    .map(|source_name| source_name.len())
                    .unwrap_or(linkage_name_len),
                linkage_name_ptr,
                linkage_name_len,
                file_metadata,
                line_index as u32,
                self.placeholder_subroutine_type(file_metadata),
                source_name.is_none() as i32, // `IsLocalToUnit`
                1,                            // `IsDefinition`
                line_index as u32,            // `ScopeLine`
                LLVMDIFlagZero,
                1, // `IsOptimized`
            );

            LLVMSetSubprogram(llvm_function, function_metadata);
        }
    }

    pub fn finalise(&mut self) {
        unsafe {
            LLVMDIBuilderFinalize(self.llvm_dib);
        }
    }
}

impl Drop for DebugInfoBuilder<'_> {
    fn drop(&mut self) {
        unsafe { LLVMDisposeDIBuilder(self.llvm_dib) }
    }
}


================================================
FILE: compiler/codegen/fun_gen.rs
================================================
use std::collections::HashMap;
use std::ffi;

use llvm_sys::core::*;
use llvm_sys::prelude::*;
use llvm_sys::LLVMCallConv;

use crate::mir::ops;

use crate::codegen::analysis::escape::{CaptureKind, Captures};
use crate::codegen::mod_gen::ModCtx;
use crate::codegen::target_gen::TargetCtx;
use crate::codegen::GenAbi;
use crate::libcstr;

pub(crate) struct FunCtx {
    pub regs: HashMap<ops::RegId, LLVMValueRef>,

    pub function: LLVMValueRef,
    pub builder: LLVMBuilderRef,
    pub current_task: LLVMValueRef,
}

impl FunCtx {
    pub(crate) fn new(
        function: LLVMValueRef,
        builder: LLVMBuilderRef,
        current_task: LLVMValueRef,
    ) -> FunCtx {
        FunCtx {
            regs: HashMap::new(),

            function,
            builder,
            current_task,
        }
    }
}

impl Drop for FunCtx {
    fn drop(&mut self) {
        unsafe {
            LLVMDisposeBuilder(self.builder);
        }
    }
}

pub(crate) fn declare_fun(
    tcx: &mut TargetCtx,
    llvm_module: LLVMModuleRef,
    fun: &ops::Fun,
) -> LLVMValueRef {
    let gen_abi: GenAbi = (&fun.abi).into();
    let function_type = tcx.fun_abi_to_llvm_type(&gen_abi);

    let fun_symbol = fun
        .source_name
        .as_ref()
        .map(|source_name| ffi::CString::new(source_name.as_bytes()).unwrap())
        .unwrap_or_else(|| ffi::CString::new("anon_fun").unwrap());

    unsafe {
        let llvm_fun = LLVMAddFunction(llvm_module, fun_symbol.as_ptr() as *const _, function_type);

        let llvm_call_conv = match fun.abi.call_conv {
            ops::CallConv::Ccc => LLVMCallConv::LLVMCCallConv,
            ops::CallConv::FastCc => LLVMCallConv::LLVMFastCallConv,
        };
        LLVMSetFunctionCallConv(llvm_fun, llvm_call_conv as u32);

        llvm_fun
    }
}

pub(crate) fn define_fun(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    fun: &ops::Fun,
    captures: &Captures,
    llvm_fun: LLVMValueRef,
) {
    use crate::codegen::alloc::plan::plan_allocs;
    use crate::codegen::op_gen;
    use arret_runtime::abitype::{AbiType, RetAbiType};

    let alloc_plan = plan_allocs(tcx, captures, &fun.ops);

    unsafe {
        let builder = LLVMCreateBuilderInContext(tcx.llx);
        let bb = LLVMAppendBasicBlockInContext(tcx.llx, llvm_fun, libcstr!("entry"));
        LLVMPositionBuilderAtEnd(builder, bb);

        let mut fcx = FunCtx::new(llvm_fun, builder, LLVMGetParam(llvm_fun, 0));
        fcx.regs.reserve(fun.param_regs.len());

        for (param_index, (reg, param_abi_type)) in
            fun.param_regs.iter().zip(fun.abi.params.iter()).enumerate()
        {
            // Our implicit task param shifts our params by 1
            let llvm_offset = (1 + param_index) as u32;
            fcx.regs.insert(*reg, LLVMGetParam(llvm_fun, llvm_offset));

            if let AbiType::Boxed(_) = param_abi_type {
                let no_capture = captures.get(*reg) == CaptureKind::Never;
                tcx.add_boxed_param_attrs(llvm_fun, llvm_offset, no_capture);
            }
        }

        if let RetAbiType::Inhabited(AbiType::Boxed(_)) = fun.abi.ret {
            tcx.add_boxed_return_attrs(llvm_fun);
        }

        for alloc_atom in alloc_plan {
            op_gen::gen_alloc_atom(tcx, mcx, &mut fcx, alloc_atom);
        }

        mcx.optimise_function(llvm_fun);
    }
}


================================================
FILE: compiler/codegen/jit.rs
================================================
use std::collections::HashMap;
use std::{alloc, env, ffi, io, ptr};

use llvm_sys::core::*;
use llvm_sys::execution_engine::*;
use llvm_sys::orc::*;
use llvm_sys::target_machine::*;

use arret_runtime::boxed;
use arret_runtime::class_map::ClassMap;
use arret_runtime::intern::Interner;

use crate::codegen::analysis::AnalysedMod;
use crate::codegen::mod_gen::{gen_mod, GeneratedMod};
use crate::codegen::target_gen::TargetCtx;
use crate::mir::ops;
use crate::mir::printer::print_fun;

extern "C" fn orc_sym_resolve(name_ptr: *const libc::c_char, jcx_void: *mut libc::c_void) -> u64 {
    unsafe {
        let jcx: &JitCtx = &*(jcx_void as *mut _);
        let name = ffi::CStr::from_ptr(name_ptr);
        jcx.symbols
            .get(name)
            .cloned()
            .unwrap_or_else(|| panic!("unable to lookup symbol {:?}", name))
    }
}

pub struct JitCtx {
    tcx: TargetCtx,
    orc: LLVMOrcJITStackRef,
    target_machine: LLVMTargetMachineRef,
    symbols: HashMap<ffi::CString, u64>,
    record_struct_class_ids: HashMap<ops::RecordStructId, boxed::RecordClassId>,

    module_counter: usize,
}

pub struct RegisteredRecordStruct {
    /// Allocation layout of the record's data
    pub data_layout: Option<alloc::Layout>,
    /// Record class ID that was dynamically registered in the class map
    pub record_class_id: boxed::RecordClassId,
}

impl JitCtx {
    pub fn new(optimising: bool) -> JitCtx {
        #[allow(clippy::fn_to_numeric_cast)]
        unsafe {
            use crate::codegen::target_machine::create_target_machine;
            use arret_runtime::compiler_support;

            LLVMLinkInMCJIT();

            let target_machine = create_target_machine(
                None, // Can't cross compile in the JIT
                LLVMRelocMode::LLVMRelocDefault,
                LLVMCodeModel::LLVMCodeModelJITDefault,
            );
            let orc = LLVMOrcCreateInstance(target_machine);

            let mut jcx = JitCtx {
                tcx: TargetCtx::new(target_machine, optimising),
                orc,
                target_machine,
                symbols: HashMap::new(),
                record_struct_class_ids: HashMap::new(),

                module_counter: 0,
            };

            jcx.add_symbol(b"ARRET_TRUE\0", &boxed::TRUE_INSTANCE as *const _ as u64);
            jcx.add_symbol(b"ARRET_FALSE\0", &boxed::FALSE_INSTANCE as *const _ as u64);
            jcx.add_symbol(b"ARRET_NIL\0", &boxed::NIL_INSTANCE as *const _ as u64);
            jcx.add_symbol(
                b"arret_runtime_alloc_cells\0",
                compiler_support::alloc_cells as u64,
            );
            jcx.add_symbol(
                b"arret_runtime_alloc_record_data\0",
                compiler_support::alloc_record_data as u64,
            );
            jcx.add_symbol(b"arret_runtime_equals\0", compiler_support::equals as u64);
            jcx.add_symbol(
                b"arret_runtime_panic_with_string\0",
                compiler_support::panic_with_string as u64,
            );

            jcx
        }
    }

    pub fn compile_fun(
        &mut self,
        private_funs: &HashMap<ops::PrivateFunId, ops::Fun>,
        interner: &mut Interner,
        fun: &ops::Fun,
    ) -> u64 {
        if env::var_os("ARRET_DUMP_MIR").is_some() {
            print_fun(&mut io::stdout().lock(), private_funs, fun, None).unwrap();
        }

        let tcx = &mut self.tcx;

        self.module_counter += 1;

        let module_counter = self.module_counter;
        let module_name = fun
            .source_name
            .as_ref()
            .map(|source_name| format!("JIT Module #{} for `{}`\0", module_counter, source_name))
            .unwrap_or_else(|| format!("Anonymous JIT Module #{}\0", module_counter));

        // Create the module
        let analysed_mod = AnalysedMod::new(private_funs, fun);

        unsafe {
            // Generate our Arret funs
            let GeneratedMod {
                llvm_module,
                llvm_entry_fun,
                ..
            } = gen_mod(
                tcx,
                module_name.as_bytes(),
                &analysed_mod,
                Some(interner),
                self.record_struct_class_ids.clone(),
                None,
            );

            // We need to take ownership before we transfer the module to ORC
            let mut function_name_len: usize = 0;
            let function_name_ptr = LLVMGetValueName2(llvm_entry_fun, &mut function_name_len);
            let function_name = ffi::CStr::from_ptr(function_name_ptr).to_owned();

            tcx.finish_module(llvm_module);

            let mut orc_module: LLVMOrcModuleHandle = 0;
            if !LLVMOrcAddEagerlyCompiledIR(
                self.orc,
                &mut orc_module,
                llvm_module,
                Some(orc_sym_resolve),
                self as *mut JitCtx as *mut _,
            )
            .is_null()
            {
                panic!("Unable to add module");
            }

            let mut target_address: LLVMOrcTargetAddress = 0;
            if !LLVMOrcGetSymbolAddressIn(
                self.orc,
                &mut target_address,
                orc_module,
                function_name.as_ptr() as *const _,
            )
            .is_null()
            {
                panic!("Unable to get symbol address")
            }

            target_address
        }
    }

    pub fn add_symbol(&mut self, unmangled_name: &[u8], address: u64) {
        unsafe {
            let mut mangled_pointer: *mut libc::c_char = ptr::null_mut();
            LLVMOrcGetMangledSymbol(
                self.orc,
                &mut mangled_pointer,
                unmangled_name.as_ptr() as *const _,
            );

            let mangled_string = ffi::CStr::from_ptr(mangled_pointer);
            self.symbols.insert(mangled_string.to_owned(), address);

            LLVMOrcDisposeMangledSymbol(mangled_pointer);
        }
    }

    pub fn register_record_struct(
        &mut self,
        record_struct: &ops::RecordStructId,
        class_map: &mut ClassMap,
    ) -> RegisteredRecordStruct {
        let target_record_struct = self.tcx.target_record_struct(record_struct);
        let record_class_id =
            class_map.push_dynamic_class(target_record_struct.classmap_class.clone());

        self.record_struct_class_ids
            .insert(record_struct.clone(), record_class_id);

        RegisteredRecordStruct {
            data_layout: target_record_struct.data_layout,
            record_class_id,
        }
    }
}

impl Drop for JitCtx {
    fn drop(&mut self) {
        unsafe {
            LLVMDisposeTargetMachine(self.target_machine);
            LLVMOrcDisposeInstance(self.orc);
        }
    }
}


================================================
FILE: compiler/codegen/libcstr.rs
================================================
/// Builds a static NULL terminated `*const libc::c_char` with the given contents
#[macro_export]
macro_rules! libcstr {
    ($s:expr) => {
        concat!($s, "\0").as_ptr() as *const libc::c_char
    };
}


================================================
FILE: compiler/codegen/math_gen.rs
================================================
use llvm_sys::core::*;
use llvm_sys::prelude::*;
use llvm_sys::LLVMIntPredicate;

use crate::codegen::fun_gen::FunCtx;
use crate::codegen::mod_gen::ModCtx;
use crate::codegen::panic_gen::gen_panic;
use crate::codegen::target_gen::TargetCtx;
use crate::libcstr;

pub struct CheckedIntOp {
    math_intrinsic_name: &'static [u8],
    result_name: &'static [u8],
    panic_message: &'static str,
}

pub const CHECKED_ADD: CheckedIntOp = CheckedIntOp {
    math_intrinsic_name: b"llvm.sadd.with.overflow.i64\0",
    result_name: b"sum\0",
    panic_message: "attempt to add with overflow",
};

pub const CHECKED_SUB: CheckedIntOp = CheckedIntOp {
    math_intrinsic_name: b"llvm.ssub.with.overflow.i64\0",
    result_name: b"difference\0",
    panic_message: "attempt to subtract with overflow",
};

pub const CHECKED_MUL: CheckedIntOp = CheckedIntOp {
    math_intrinsic_name: b"llvm.smul.with.overflow.i64\0",
    result_name: b"product\0",
    panic_message: "attempt to multiply with overflow",
};

pub(crate) fn gen_checked_int_math(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    fcx: &mut FunCtx,
    int_op: &'static CheckedIntOp,
    llvm_lhs: LLVMValueRef,
    llvm_rhs: LLVMValueRef,
) -> LLVMValueRef {
    let CheckedIntOp {
        math_intrinsic_name,
        result_name,
        panic_message,
    } = int_op;

    unsafe {
        let llvm_i1 = LLVMInt1TypeInContext(tcx.llx);
        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

        let mut return_type_members = [llvm_i64, llvm_i1];

        let llvm_return_type = LLVMStructTypeInContext(
            tcx.llx,
            return_type_members.as_mut_ptr(),
            return_type_members.len() as u32,
            0,
        );

        let llvm_param_types = &mut [llvm_i64, llvm_i64];

        let math_intrinsic_llvm_type = LLVMFunctionType(
            llvm_return_type,
            llvm_param_types.as_mut_ptr(),
            llvm_param_types.len() as u32,
            0,
        );

        let math_intrinsic_fun =
            mcx.get_function_or_insert(math_intrinsic_llvm_type, math_intrinsic_name, |_| {});

        let math_intrinsic_args = &mut [llvm_lhs, llvm_rhs];

        let llvm_result_with_overflow = LLVMBuildCall(
            fcx.builder,
            math_intrinsic_fun,
            math_intrinsic_args.as_mut_ptr(),
            math_intrinsic_args.len() as u32,
            libcstr!("result_with_overflow"),
        );

        let llvm_math_result = LLVMBuildExtractValue(
            fcx.builder,
            llvm_result_with_overflow,
            0,
            result_name.as_ptr() as *const _,
        );

        let llvm_overflow = LLVMBuildExtractValue(
            fcx.builder,
            llvm_result_with_overflow,
            1,
            libcstr!("overflow_flag"),
        );

        let overflow_block =
            LLVMAppendBasicBlockInContext(tcx.llx, fcx.function, libcstr!("overflow"));

        let cont_block =
            LLVMAppendBasicBlockInContext(tcx.llx, fcx.function, libcstr!("no_overflow"));

        LLVMBuildCondBr(fcx.builder, llvm_overflow, overflow_block, cont_block);

        LLVMPositionBuilderAtEnd(fcx.builder, overflow_block);
        gen_panic(tcx, mcx, fcx, panic_message);

        LLVMPositionBuilderAtEnd(fcx.builder, cont_block);
        llvm_math_result
    }
}

pub(crate) fn gen_checked_int_rem(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    fcx: &mut FunCtx,
    llvm_numer: LLVMValueRef,
    llvm_denom: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

        let denom_is_zero = LLVMBuildICmp(
            fcx.builder,
            LLVMIntPredicate::LLVMIntEQ,
            llvm_denom,
            LLVMConstInt(llvm_i64, 0, 0),
            libcstr!("denom_is_zero"),
        );

        let rem_by_zero_block =
            LLVMAppendBasicBlockInContext(tcx.llx, fcx.function, libcstr!("rem_by_zero"));

        let valid_rem_block =
            LLVMAppendBasicBlockInContext(tcx.llx, fcx.function, libcstr!("valid_rem"));

        LLVMBuildCondBr(
            fcx.builder,
            denom_is_zero,
            rem_by_zero_block,
            valid_rem_block,
        );

        LLVMPositionBuilderAtEnd(fcx.builder, rem_by_zero_block);
        gen_panic(tcx, mcx, fcx, "division by zero");

        LLVMPositionBuilderAtEnd(fcx.builder, valid_rem_block);
        LLVMBuildSRem(fcx.builder, llvm_numer, llvm_denom, libcstr!("rem"))
    }
}

pub(crate) fn gen_checked_int_div(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    fcx: &mut FunCtx,
    llvm_numer: LLVMValueRef,
    llvm_denom: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

        // Build our blocks
        let div_by_zero_block =
            LLVMAppendBasicBlockInContext(tcx.llx, fcx.function, libcstr!("div_by_zero"));

        let non_zero_denom_block =
            LLVMAppendBasicBlockInContext(tcx.llx, fcx.function, libcstr!("non_zero_denom"));

        let neg_one_denom_block =
            LLVMAppendBasicBlockInContext(tcx.llx, fcx.function, libcstr!("neg_one_denom"));

        let valid_div_block =
            LLVMAppendBasicBlockInContext(tcx.llx, fcx.function, libcstr!("valid_div_block"));

        // Test if the denominator is 0
        let denom_is_zero = LLVMBuildICmp(
            fcx.builder,
            LLVMIntPredicate::LLVMIntEQ,
            llvm_denom,
            LLVMConstInt(llvm_i64, 0, 0),
            libcstr!("denom_is_zero"),
        );

        // If the denominator 0 then raise a divide by zero error
        LLVMBuildCondBr(
            fcx.builder,
            denom_is_zero,
            div_by_zero_block,
            non_zero_denom_block,
        );

        // Test if the denominator is -1
        LLVMPositionBuilderAtEnd(fcx.builder, non_zero_denom_block);

        let denom_is_neg_one = LLVMBuildICmp(
            fcx.builder,
            LLVMIntPredicate::LLVMIntEQ,
            llvm_denom,
            LLVMConstInt(llvm_i64, std::mem::transmute(-1i64), 0),
            libcstr!("denom_is_neg_one"),
        );

        // If the denominator in -1 then we need to test the numerator
        LLVMBuildCondBr(
            fcx.builder,
            denom_is_neg_one,
            neg_one_denom_block,
            valid_div_block,
        );

        // Test if the numerator is i64::MIN
        LLVMPositionBuilderAtEnd(fcx.builder, neg_one_denom_block);

        let numer_is_int_min = LLVMBuildICmp(
            fcx.builder,
            LLVMIntPredicate::LLVMIntEQ,
            llvm_numer,
            LLVMConstInt(llvm_i64, std::mem::transmute(std::i64::MIN), 0),
            libcstr!("numer_is_int_min"),
        );

        // If denominator is -1 and numerator is i64::MIN then raise a divide by zero error
        LLVMBuildCondBr(
            fcx.builder,
            numer_is_int_min,
            div_by_zero_block,
            valid_div_block,
        );

        // Build the common panic block
        LLVMPositionBuilderAtEnd(fcx.builder, div_by_zero_block);
        gen_panic(tcx, mcx, fcx, "division by zero");

        LLVMPositionBuilderAtEnd(fcx.builder, valid_div_block);
        LLVMBuildSDiv(fcx.builder, llvm_numer, llvm_denom, libcstr!("quot"))
    }
}

pub(crate) fn gen_float_sqrt(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    fcx: &mut FunCtx,
    llvm_radicand: LLVMValueRef,
) -> LLVMValueRef {
    unsafe {
        let llvm_double = LLVMDoubleTypeInContext(tcx.llx);

        let llvm_param_types = &mut [llvm_double];

        let double_sqrt_llvm_type = LLVMFunctionType(
            llvm_double,
            llvm_param_types.as_mut_ptr(),
            llvm_param_types.len() as u32,
            0,
        );

        let double_sqrt_fun =
            mcx.get_function_or_insert(double_sqrt_llvm_type, b"llvm.sqrt.f64\0", |_| {});

        let llvm_sqrt_args = &mut [llvm_radicand];

        LLVMBuildCall(
            fcx.builder,
            double_sqrt_fun,
            llvm_sqrt_args.as_mut_ptr(),
            llvm_sqrt_args.len() as u32,
            libcstr!("sqrt"),
        )
    }
}


================================================
FILE: compiler/codegen/mod.rs
================================================
mod alloc;
mod analysis;
mod box_layout;
mod callee;
mod const_gen;
mod debug_info;
mod fun_gen;
pub(crate) mod jit;
mod libcstr;
mod math_gen;
mod mod_gen;
mod op_gen;
mod panic_gen;
pub(crate) mod program;
mod range_md;
mod record_struct;
pub(crate) mod target_gen;
mod target_machine;
mod vector_gen;

use crate::mir::ops::OpsAbi;
use arret_runtime::abitype;

#[derive(Debug, PartialEq, Clone)]
pub struct GenAbi {
    pub takes_task: bool,
    pub params: Box<[abitype::ParamAbiType]>,
    pub ret: abitype::RetAbiType,
}

impl GenAbi {
    pub fn thunk_abi() -> GenAbi {
        GenAbi {
            takes_task: true,
            params: Box::new([
                abitype::BoxedAbiType::Any.into(),
                abitype::TOP_LIST_BOXED_ABI_TYPE.into(),
            ]),
            ret: abitype::BoxedAbiType::Any.into(),
        }
    }
}

impl<'a> From<&'a OpsAbi> for GenAbi {
    fn from(ops_abi: &'a OpsAbi) -> GenAbi {
        GenAbi {
            takes_task: true,
            params: ops_abi
                .params
                .iter()
                .map(|abi_type| abi_type.clone().into())
                .collect(),
            ret: ops_abi.ret.clone(),
        }
    }
}

/// Initialises LLVM
///
/// This must be called before anything else in this module. It can only be called from a single
/// thread at once.
pub fn initialise_llvm(support_cross_compilation: bool) {
    use llvm_sys::target::*;

    unsafe {
        if support_cross_compilation {
            LLVM_InitializeAllTargetInfos();
            LLVM_InitializeAllTargets();
            LLVM_InitializeAllTargetMCs();
            LLVM_InitializeAllAsmPrinters();
        } else {
            LLVM_InitializeNativeTarget();
            LLVM_InitializeNativeAsmPrinter();
        }
    }
}

#[cfg(test)]
pub(crate) mod test {
    use super::*;
    use std::sync::Once;

    static INITIALISE_TEST_LLVM: Once = Once::new();

    pub fn initialise_test_llvm() {
        INITIALISE_TEST_LLVM.call_once(|| {
            initialise_llvm(false);
        });
    }
}


================================================
FILE: compiler/codegen/mod_gen.rs
================================================
use std::collections::HashMap;

use llvm_sys::core::*;
use llvm_sys::prelude::*;
use llvm_sys::target::*;
use llvm_sys::target_machine::*;
use llvm_sys::LLVMLinkage;

use arret_runtime::boxed::RecordClassId;
use arret_runtime::intern;

use crate::codegen::analysis::AnalysedMod;
use crate::codegen::debug_info::DebugInfoBuilder;
use crate::codegen::record_struct;
use crate::codegen::target_gen::TargetCtx;
use crate::mir::ops;
use crate::source::SourceLoader;

pub struct ModCtx<'am, 'sl, 'interner> {
    pub module: LLVMModuleRef,

    analysed_mod: &'am AnalysedMod<'am>,
    di_builder: Option<DebugInfoBuilder<'sl>>,
    llvm_private_funs: HashMap<ops::PrivateFunId, LLVMValueRef>,

    jit_interner: Option<&'interner mut intern::Interner>,

    has_jit_record_struct_class_ids: bool,
    record_struct_class_ids: HashMap<ops::RecordStructId, RecordClassId>,
    record_structs: Vec<ops::RecordStructId>,

    record_class_id_llvm_values: Vec<LLVMValueRef>,

    function_pass_manager: LLVMPassManagerRef,
}

pub struct GeneratedMod {
    pub llvm_module: LLVMModuleRef,
    pub llvm_entry_fun: LLVMValueRef,
    pub llvm_global_interned_names: LLVMValueRef,
    pub llvm_classmap_classes: LLVMValueRef,
}

impl<'am, 'sl, 'interner> ModCtx<'am, 'sl, 'interner> {
    /// Constructs a new module context with the given name
    ///
    /// Note that the module name in LLVM is not arbitrary. For instance, in the ORC JIT it will
    /// shadow exported symbol names. This identifier should be as unique and descriptive as
    /// possible.
    fn new(
        tcx: &mut TargetCtx,
        name: &[u8],
        analysed_mod: &'am AnalysedMod<'am>,
        jit_interner: Option<&'interner mut intern::Interner>,
        jit_record_struct_class_ids: HashMap<ops::RecordStructId, RecordClassId>,
        debug_source_loader: Option<&'sl SourceLoader>,
    ) -> Self {
        use crate::codegen::fun_gen::declare_fun;
        use llvm_sys::transforms::pass_manager_builder::*;

        // Hoist these out of the unsafe block
        let module;
        let function_pass_manager;
        unsafe {
            module = LLVMModuleCreateWithNameInContext(name.as_ptr() as *const _, tcx.llx);
            LLVMSetModuleDataLayout(module, tcx.target_data());

            let target_triple = LLVMGetTargetMachineTriple(tcx.target_machine());
            LLVMSetTarget(module, target_triple);
            LLVMDisposeMessage(target_triple);

            function_pass_manager = LLVMCreateFunctionPassManagerForModule(module);

            if tcx.optimising() {
                let fpmb = LLVMPassManagerBuilderCreate();
                LLVMPassManagerBuilderSetOptLevel(fpmb, 2);
                LLVMPassManagerBuilderPopulateFunctionPassManager(fpmb, function_pass_manager);
                LLVMPassManagerBuilderDispose(fpmb);
            }
        }

        let di_builder = debug_source_loader.map(|source_loader| {
            DebugInfoBuilder::new(
                source_loader,
                tcx.optimising(),
                analysed_mod.entry_fun().ops_fun.span,
                module,
            )
        });

        // Forward declare all our private funs
        // Analysis has determined all of these are used
        let llvm_private_funs = analysed_mod
            .private_funs()
            .map(|(private_fun_id, analysed_fun)| {
                let llvm_fun = declare_fun(tcx, module, analysed_fun.ops_fun);
                (*private_fun_id, llvm_fun)
            })
            .collect();

        ModCtx {
            module,

            analysed_mod,
            di_builder,
            llvm_private_funs,

            jit_interner,

            has_jit_record_struct_class_ids: !jit_record_struct_class_ids.is_empty(),
            record_struct_class_ids: jit_record_struct_class_ids,
            record_structs: vec![],
            record_class_id_llvm_values: vec![],

            function_pass_manager,
        }
    }

    pub fn intern_name(&mut self, name: &str) -> intern::InternedSym {
        if let Some(ref mut jit_interner) = self.jit_interner {
            jit_interner.intern_static(name)
        } else if let Some(interned_sym) = intern::InternedSym::try_from_inline_name(name) {
            interned_sym
        } else {
            *self
                .analysed_mod
                .global_interned_names()
                .get(name)
                .expect("encountered name not found during analysis")
        }
    }

    pub fn record_class_id_for_struct(
        &mut self,
        record_struct: &ops::RecordStructId,
    ) -> RecordClassId {
        if let Some(record_class_id) = self.record_struct_class_ids.get(record_struct) {
            return *record_class_id;
        }

        let record_class_id = self.record_structs.len() as u32;
        self.record_structs.push(record_struct.clone());

        self.record_struct_class_ids
            .insert(record_struct.clone(), record_class_id);
        record_class_id
    }

    pub fn add_record_class_id_range_metadata(&mut self, record_class_id_llvm_value: LLVMValueRef) {
        // This is a bit of a hack - we don't know the range of the record class IDs until we
        // finish generating the module.
        self.record_class_id_llvm_values
            .push(record_class_id_llvm_value);
    }

    pub fn llvm_private_fun(&self, private_fun_id: ops::PrivateFunId) -> LLVMValueRef {
        self.llvm_private_funs[&private_fun_id]
    }

    pub fn get_global_or_insert<F>(
        &mut self,
        llvm_type: LLVMTypeRef,
        name: &[u8],
        initial_value: F,
    ) -> LLVMValueRef
    where
        F: FnOnce() -> LLVMValueRef,
    {
        unsafe {
            let global = LLVMGetNamedGlobal(self.module, name.as_ptr() as *const _);

            if !global.is_null() {
                return global;
            }

            let global = LLVMAddGlobal(self.module, llvm_type, name.as_ptr() as *const _);
            LLVMSetInitializer(global, initial_value());

            global
        }
    }

    pub fn get_function_or_insert<F>(
        &mut self,
        function_type: LLVMTypeRef,
        name: &[u8],
        initialise: F,
    ) -> LLVMValueRef
    where
        F: FnOnce(LLVMValueRef),
    {
        unsafe {
            let function = LLVMGetNamedFunction(self.module, name.as_ptr() as *const _);

            if !function.is_null() {
                return function;
            }

            let function = LLVMAddFunction(self.module, name.as_ptr() as *const _, function_type);

            initialise(function);
            function
        }
    }

    pub fn optimise_function(&mut self, function: LLVMValueRef) {
        unsafe {
            LLVMRunFunctionPassManager(self.function_pass_manager, function);
        }
    }

    fn finalise_record_class_id_range_metadata(&mut self, tcx: &mut TargetCtx) {
        unsafe {
            if self.has_jit_record_struct_class_ids {
                // These are from a distinct range; it's too much effort to include them in the JIT
                // case so just skip generating metadata.
                return;
            }

            let mut llvm_range_values = [
                LLVMValueAsMetadata(LLVMConstInt(tcx.record_class_id_llvm_type(), 0, 0)),
                LLVMValueAsMetadata(LLVMConstInt(
                    tcx.record_class_id_llvm_type(),
                    self.record_structs.len() as u64,
                    0,
                )),
            ];

            let range_md_kind_id = tcx.llvm_md_kind_id_for_name("range");
            let record_class_id_range_md = LLVMMDNodeInContext2(
                tcx.llx,
                llvm_range_values.as_mut_ptr(),
                llvm_range_values.len(),
            );

            for llvm_value in self.record_class_id_llvm_values.iter() {
                LLVMSetMetadata(
                    *llvm_value,
                    range_md_kind_id,
                    LLVMMetadataAsValue(tcx.llx, record_class_id_range_md),
                );
            }
        }
    }

    /// Finalise the module and return the LLVMModuleRef
    ///
    /// This will verify the module's correctness and dump the LLVM IR to stdout if the
    /// `ARRET_DUMP_LLVM` environment variable is set
    fn into_generated_mod(mut self, tcx: &mut TargetCtx) -> GeneratedMod {
        use crate::codegen::analysis::AnalysedFun;
        use crate::codegen::const_gen::gen_global_interned_names;
        use crate::codegen::fun_gen::{declare_fun, define_fun};

        // Define our entry fun
        let AnalysedFun {
            ops_fun: entry_ops_fun,
            captures: entry_captures,
        } = self.analysed_mod.entry_fun();

        let llvm_entry_fun = declare_fun(tcx, self.module, entry_ops_fun);
        define_fun(
            tcx,
            &mut self,
            entry_ops_fun,
            entry_captures,
            llvm_entry_fun,
        );

        if let Some(ref mut di_builder) = self.di_builder {
            di_builder.add_function_debug_info(
                entry_ops_fun.span,
                entry_ops_fun.source_name.as_ref(),
                llvm_entry_fun,
            );
        }

        // Define all of our private funs
        for (private_fun_id, analysed_fun) in self.analysed_mod.private_funs() {
            let AnalysedFun { ops_fun, captures } = analysed_fun;
            let llvm_fun = self.llvm_private_funs[private_fun_id];

            define_fun(tcx, &mut self, ops_fun, captures, llvm_fun);

            if let Some(ref mut di_builder) = self.di_builder {
                di_builder.add_function_debug_info(
                    ops_fun.span,
                    ops_fun.source_name.as_ref(),
                    llvm_fun,
                );
            }

            unsafe {
                LLVMSetLinkage(llvm_fun, LLVMLinkage::LLVMPrivateLinkage);
            }
        }

        let llvm_global_interned_names = gen_global_interned_names(
            tcx,
            self.module,
            self.analysed_mod.global_interned_names().keys(),
        );

        let llvm_classmap_classes =
            record_struct::gen_classmap_classes(tcx, self.module, &self.record_structs);

        self.finalise_record_class_id_range_metadata(tcx);

        if let Some(ref mut di_builder) = self.di_builder {
            di_builder.finalise();
        }

        GeneratedMod {
            llvm_module: self.module,
            llvm_entry_fun,
            llvm_global_interned_names,
            llvm_classmap_classes,
        }
    }
}

pub fn gen_mod<'am, 'sl, 'interner>(
    tcx: &mut TargetCtx,
    name: &[u8],
    analysed_mod: &'am AnalysedMod<'am>,
    jit_interner: Option<&'interner mut intern::Interner>,
    jit_record_struct_class_ids: HashMap<ops::RecordStructId, RecordClassId>,
    debug_source_loader: Option<&'sl SourceLoader>,
) -> GeneratedMod {
    ModCtx::new(
        tcx,
        name,
        analysed_mod,
        jit_interner,
        jit_record_struct_class_ids,
        debug_source_loader,
    )
    .into_generated_mod(tcx)
}

impl Drop for ModCtx<'_, '_, '_> {
    fn drop(&mut self) {
        unsafe {
            LLVMDisposePassManager(self.function_pass_manager);
        }
    }
}


================================================
FILE: compiler/codegen/op_gen.rs
================================================
use llvm_sys::core::*;
use llvm_sys::prelude::*;
use llvm_sys::{LLVMCallConv, LLVMIntPredicate, LLVMRealPredicate};

use arret_runtime::boxed;

use crate::mir::ops::*;

use crate::codegen::fun_gen::FunCtx;
use crate::codegen::math_gen;
use crate::codegen::mod_gen::ModCtx;
use crate::codegen::panic_gen::gen_panic;
use crate::codegen::record_struct;
use crate::codegen::target_gen::TargetCtx;
use crate::codegen::{alloc, const_gen};
use crate::libcstr;

fn comparison_to_llvm_int_pred(comparison: Comparison) -> LLVMIntPredicate {
    match comparison {
        Comparison::Lt => LLVMIntPredicate::LLVMIntSLT,
        Comparison::Le => LLVMIntPredicate::LLVMIntSLE,
        Comparison::Eq => LLVMIntPredicate::LLVMIntEQ,
        Comparison::Gt => LLVMIntPredicate::LLVMIntSGT,
        Comparison::Ge => LLVMIntPredicate::LLVMIntSGE,
    }
}

fn comparison_to_llvm_real_pred(comparison: Comparison) -> LLVMRealPredicate {
    match comparison {
        Comparison::Lt => LLVMRealPredicate::LLVMRealOLT,
        Comparison::Le => LLVMRealPredicate::LLVMRealOLE,
        Comparison::Eq => LLVMRealPredicate::LLVMRealOEQ,
        Comparison::Gt => LLVMRealPredicate::LLVMRealOGT,
        Comparison::Ge => LLVMRealPredicate::LLVMRealOGE,
    }
}

fn gen_int_compare(
    fcx: &mut FunCtx,
    reg: RegId,
    comparison: Comparison,
    lhs_reg: RegId,
    rhs_reg: RegId,
    reg_name: &str,
) {
    unsafe {
        fcx.regs.insert(
            reg,
            LLVMBuildICmp(
                fcx.builder,
                comparison_to_llvm_int_pred(comparison),
                fcx.regs[&lhs_reg],
                fcx.regs[&rhs_reg],
                reg_name.as_ptr() as *const _,
            ),
        );
    }
}

fn gen_op(
    tcx: &mut TargetCtx,
    mcx: &mut ModCtx<'_, '_, '_>,
    fcx: &mut FunCtx,
    active_alloc: &mut alloc::ActiveAlloc<'_>,
    op: &Op,
) {
    unsafe {
        match &op.kind {
            OpKind::ConstBoxedNil(reg, _) => {
                let llvm_value = const_gen::gen_boxed_nil(tcx, mcx);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedTrue(reg, _) => {
                let llvm_value =
                    tcx.ptr_to_singleton_box(mcx.module, boxed::TypeTag::True, b"ARRET_TRUE\0");
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedFalse(reg, _) => {
                let llvm_value =
                    tcx.ptr_to_singleton_box(mcx.module, boxed::TypeTag::False, b"ARRET_FALSE\0");
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstInt64(reg, value) => {
                let llvm_value = LLVMConstInt(LLVMInt64TypeInContext(tcx.llx), *value as u64, 1);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstFloat(reg, value) => {
                let llvm_value = LLVMConstReal(LLVMDoubleTypeInContext(tcx.llx), *value);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstChar(reg, value) => {
                let llvm_value = LLVMConstInt(LLVMInt32TypeInContext(tcx.llx), *value as u64, 1);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBool(reg, value) => {
                let llvm_value = LLVMConstInt(LLVMInt1TypeInContext(tcx.llx), *value as u64, 1);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstInternedSym(reg, value) => {
                let interned_sym = mcx.intern_name(value);
                let llvm_value = LLVMConstInt(
                    LLVMInt64TypeInContext(tcx.llx),
                    interned_sym.to_raw_u64(),
                    1,
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstTypeTag(reg, type_tag) => {
                let llvm_value = LLVMConstInt(LLVMInt8TypeInContext(tcx.llx), *type_tag as u64, 1);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstRecordClassId(reg, record_struct) => {
                let record_class_id = mcx.record_class_id_for_struct(record_struct);
                let llvm_value = LLVMConstInt(
                    tcx.record_class_id_llvm_type(),
                    u64::from(record_class_id),
                    1,
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedInt(reg, value) => {
                let llvm_value = const_gen::gen_boxed_int(tcx, mcx, *value);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedFloat(reg, value) => {
                let llvm_value = const_gen::gen_boxed_float(tcx, mcx, *value);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedChar(reg, value) => {
                let llvm_value = const_gen::gen_boxed_char(tcx, mcx, *value);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedFunThunk(
                reg,
                BoxFunThunkOp {
                    captures_reg,
                    callee,
                },
            ) => {
                let llvm_entry_point = gen_callee_entry_point(tcx, mcx, fcx, callee);
                let llvm_env = fcx.regs[captures_reg];

                let llvm_value =
                    const_gen::gen_boxed_fun_thunk(tcx, mcx, llvm_env, llvm_entry_point);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedPair(
                reg,
                BoxPairOp {
                    head_reg,
                    rest_reg,
                    list_len_reg,
                },
            ) => {
                let llvm_head = fcx.regs[head_reg];
                let llvm_rest = fcx.regs[rest_reg];
                let llvm_list_len = fcx.regs[list_len_reg];

                let llvm_value =
                    const_gen::gen_boxed_pair(tcx, mcx, llvm_head, llvm_rest, llvm_list_len);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedStr(reg, value) => {
                let llvm_value = const_gen::gen_boxed_str(tcx, mcx, value.as_ref());
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedSym(reg, value) => {
                let llvm_value = const_gen::gen_boxed_sym(tcx, mcx, value.as_ref());
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedVector(reg, elements) => {
                let llvm_value = const_gen::gen_boxed_vector(
                    tcx,
                    mcx,
                    elements.iter().map(|element| fcx.regs[element]),
                );

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedSet(reg, elements) => {
                let llvm_value = const_gen::gen_boxed_set(
                    tcx,
                    mcx,
                    elements.iter().map(|element| fcx.regs[element]),
                );

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstBoxedMap(reg, entries) => {
                let llvm_value = const_gen::gen_boxed_map(
                    tcx,
                    mcx,
                    entries
                        .iter()
                        .map(|(key, value)| (fcx.regs[key], fcx.regs[value])),
                );

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::ConstCastBoxed(reg, CastBoxedOp { from_reg, to_type }) => {
                let from_llvm_value = fcx.regs[from_reg];
                let to_llvm_type = tcx.boxed_abi_to_llvm_ptr_type(to_type);
                let to_llvm_value = LLVMConstBitCast(from_llvm_value, to_llvm_type);

                fcx.regs.insert(*reg, to_llvm_value);
            }
            OpKind::CastBoxed(reg, CastBoxedOp { from_reg, to_type }) => {
                let from_llvm_value = fcx.regs[from_reg];
                let to_llvm_type = tcx.boxed_abi_to_llvm_ptr_type(to_type);

                let to_llvm_value = LLVMBuildBitCast(
                    fcx.builder,
                    from_llvm_value,
                    to_llvm_type,
                    libcstr!("box_bitcast"),
                );
                fcx.regs.insert(*reg, to_llvm_value);
            }
            OpKind::Alias(reg, from_reg) => {
                let from_llvm_value = fcx.regs[from_reg];
                fcx.regs.insert(*reg, from_llvm_value);
            }
            OpKind::Call(reg, CallOp { callee, args, .. }) => {
                use crate::codegen::callee;

                let llvm_fun = gen_callee_entry_point(tcx, mcx, fcx, callee);
                let takes_task = callee::callee_takes_task(callee);

                let task_reg_iter = Some(fcx.current_task).filter(|_| takes_task).into_iter();
                let mut llvm_args = task_reg_iter
                    .chain(args.iter().map(|param_reg| fcx.regs[param_reg]))
                    .collect::<Vec<LLVMValueRef>>();

                let llvm_ret = LLVMBuildCall(
                    fcx.builder,
                    llvm_fun,
                    llvm_args.as_mut_ptr(),
                    llvm_args.len() as u32,
                    libcstr!(""),
                );

                let call_conv = callee::callee_call_conv(mcx, callee);
                LLVMSetInstructionCallConv(llvm_ret, call_conv);

                fcx.regs.insert(*reg, llvm_ret);
            }
            OpKind::TailCall(reg, TailCallOp { args, .. }) => {
                let mut llvm_args = std::iter::once(fcx.current_task)
                    .chain(args.iter().map(|param_reg| fcx.regs[param_reg]))
                    .collect::<Vec<LLVMValueRef>>();

                let llvm_ret = LLVMBuildCall(
                    fcx.builder,
                    fcx.function,
                    llvm_args.as_mut_ptr(),
                    llvm_args.len() as u32,
                    libcstr!(""),
                );

                LLVMSetTailCall(llvm_ret, 1);
                LLVMSetInstructionCallConv(llvm_ret, LLVMCallConv::LLVMFastCallConv as u32);

                fcx.regs.insert(*reg, llvm_ret);
            }
            OpKind::Ret(reg) => {
                let llvm_value = fcx.regs[reg];
                LLVMBuildRet(fcx.builder, llvm_value);
            }
            OpKind::RetVoid => {
                LLVMBuildRetVoid(fcx.builder);
            }
            OpKind::Unreachable => {
                LLVMBuildUnreachable(fcx.builder);
            }
            OpKind::Panic(message) => {
                gen_panic(tcx, mcx, fcx, message);
            }
            OpKind::LoadBoxedTypeTag(
                reg,
                LoadBoxedTypeTagOp {
                    subject_reg,
                    possible_type_tags,
                },
            ) => {
                use crate::codegen::range_md::int_range_md_node;

                let llvm_any = fcx.regs[subject_reg];
                let gep_indices = &mut [
                    LLVMConstInt(LLVMInt32TypeInContext(tcx.llx), 0, 0),
                    LLVMConstInt(LLVMInt32TypeInContext(tcx.llx), 0, 0),
                    LLVMConstInt(LLVMInt32TypeInContext(tcx.llx), 0, 0),
                ];

                let llvm_type_tag_ptr = LLVMBuildInBoundsGEP(
                    fcx.builder,
                    llvm_any,
                    gep_indices.as_mut_ptr(),
                    gep_indices.len() as u32,
                    libcstr!("type_tag_ptr"),
                );

                let llvm_type_tag =
                    LLVMBuildLoad(fcx.builder, llvm_type_tag_ptr, libcstr!("type_tag"));

                let llvm_i8 = LLVMInt8TypeInContext(tcx.llx);
                let possible_type_tag_md = int_range_md_node(
                    tcx.llx,
                    llvm_i8,
                    possible_type_tags
                        .into_iter()
                        .map(|type_tag| type_tag as i64),
                );

                let range_md_kind_id = tcx.llvm_md_kind_id_for_name("range");
                LLVMSetMetadata(
                    llvm_type_tag,
                    range_md_kind_id,
                    LLVMMetadataAsValue(tcx.llx, possible_type_tag_md),
                );

                tcx.add_invariant_load_metadata(llvm_type_tag);
                fcx.regs.insert(*reg, llvm_type_tag);
            }
            OpKind::LoadBoxedListLen(
                reg,
                LoadBoxedListLenOp {
                    list_reg,
                    min_list_len,
                },
            ) => {
                let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

                let llvm_list = fcx.regs[list_reg];
                let list_len_ptr =
                    LLVMBuildStructGEP(fcx.builder, llvm_list, 1, libcstr!("list_len_ptr"));

                let llvm_list_len = LLVMBuildLoad(fcx.builder, list_len_ptr, libcstr!("list_len"));
                tcx.add_invariant_load_metadata(llvm_list_len);

                // Every list element needs at least one pair. This means there's a maximum list
                // length that can fit in our address space.
                let max_list_len = std::u64::MAX / std::mem::size_of::<boxed::Pair>() as u64;

                let mut llvm_range_values = [
                    LLVMValueAsMetadata(LLVMConstInt(llvm_i64, *min_list_len as u64, 0)),
                    LLVMValueAsMetadata(LLVMConstInt(llvm_i64, max_list_len + 1, 0)),
                ];

                let range_md_kind_id = tcx.llvm_md_kind_id_for_name("list_len_range");
                let list_len_range_md = LLVMMDNodeInContext2(
                    tcx.llx,
                    llvm_range_values.as_mut_ptr(),
                    llvm_range_values.len(),
                );
                LLVMSetMetadata(
                    llvm_list_len,
                    range_md_kind_id,
                    LLVMMetadataAsValue(tcx.llx, list_len_range_md),
                );

                fcx.regs.insert(*reg, llvm_list_len);
            }
            OpKind::LoadBoxedPairHead(reg, pair_reg) => {
                let llvm_pair = fcx.regs[pair_reg];
                let head_ptr = LLVMBuildStructGEP(fcx.builder, llvm_pair, 2, libcstr!("head_ptr"));

                let llvm_head = LLVMBuildLoad(fcx.builder, head_ptr, libcstr!("head"));
                tcx.add_invariant_load_metadata(llvm_head);
                tcx.add_boxed_load_metadata(llvm_head);

                fcx.regs.insert(*reg, llvm_head);
            }
            OpKind::LoadBoxedPairRest(reg, pair_reg) => {
                let llvm_pair = fcx.regs[pair_reg];
                let head_ptr = LLVMBuildStructGEP(fcx.builder, llvm_pair, 3, libcstr!("rest_ptr"));

                let llvm_rest = LLVMBuildLoad(fcx.builder, head_ptr, libcstr!("rest"));
                tcx.add_invariant_load_metadata(llvm_rest);
                tcx.add_boxed_load_metadata(llvm_rest);

                fcx.regs.insert(*reg, llvm_rest);
            }
            OpKind::LoadBoxedIntValue(reg, boxed_int_reg) => {
                let llvm_boxed_int = fcx.regs[boxed_int_reg];
                let value_ptr =
                    LLVMBuildStructGEP(fcx.builder, llvm_boxed_int, 1, libcstr!("int_value_ptr"));

                let llvm_value = LLVMBuildLoad(fcx.builder, value_ptr, libcstr!("int_value"));
                tcx.add_invariant_load_metadata(llvm_value);

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::LoadBoxedSymInterned(reg, boxed_sym_reg) => {
                let llvm_boxed_sym = fcx.regs[boxed_sym_reg];
                let value_ptr = LLVMBuildStructGEP(
                    fcx.builder,
                    llvm_boxed_sym,
                    1,
                    libcstr!("interned_sym_ptr"),
                );

                let llvm_value = LLVMBuildLoad(fcx.builder, value_ptr, libcstr!("interned_sym"));
                tcx.add_invariant_load_metadata(llvm_value);

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::LoadBoxedFloatValue(reg, boxed_float_reg) => {
                let llvm_boxed_float = fcx.regs[boxed_float_reg];
                let value_ptr = LLVMBuildStructGEP(
                    fcx.builder,
                    llvm_boxed_float,
                    1,
                    libcstr!("float_value_ptr"),
                );

                let llvm_value = LLVMBuildLoad(fcx.builder, value_ptr, libcstr!("float_value"));
                tcx.add_invariant_load_metadata(llvm_value);

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::LoadBoxedCharValue(reg, boxed_char_reg) => {
                let llvm_boxed_char = fcx.regs[boxed_char_reg];
                let value_ptr =
                    LLVMBuildStructGEP(fcx.builder, llvm_boxed_char, 1, libcstr!("char_value_ptr"));

                let llvm_value = LLVMBuildLoad(fcx.builder, value_ptr, libcstr!("char_value"));

                tcx.add_invariant_load_metadata(llvm_value);
                tcx.add_char_codepoint_range_metadata(llvm_value);

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::LoadBoxedFunThunkCaptures(reg, boxed_fun_thunk_reg) => {
                let llvm_boxed_fun_thunk = fcx.regs[boxed_fun_thunk_reg];

                let captures_ptr = LLVMBuildStructGEP(
                    fcx.builder,
                    llvm_boxed_fun_thunk,
                    1,
                    libcstr!("boxed_fun_thunk_captures_ptr"),
                );
                let llvm_value = LLVMBuildLoad(
                    fcx.builder,
                    captures_ptr,
                    libcstr!("boxed_fun_thunk_captures"),
                );

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::LoadBoxedRecordClassId(reg, boxed_record_reg) => {
                let llvm_boxed_record = fcx.regs[boxed_record_reg];
                let value_ptr = LLVMBuildStructGEP(
                    fcx.builder,
                    llvm_boxed_record,
                    record_struct::RECORD_CLASS_ID_INDEX,
                    libcstr!("record_class_id_ptr"),
                );

                let llvm_value = LLVMBuildLoad(fcx.builder, value_ptr, libcstr!("record_class_id"));

                mcx.add_record_class_id_range_metadata(llvm_value);
                tcx.add_invariant_load_metadata(llvm_value);

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::LoadBoxedRecordField(reg, load_boxed_record_field_op) => {
                let LoadBoxedRecordFieldOp {
                    record_reg,
                    record_struct,
                    field_index,
                } = load_boxed_record_field_op;

                let record_struct::TargetRecordStruct { record_storage, .. } =
                    *tcx.target_record_struct(record_struct);

                let boxed_record_name = format!("boxed_{}_record\0", record_struct.source_name);

                let boxed_record_ptr_type =
                    LLVMPointerType(tcx.record_struct_llvm_box_type(record_struct), 0);

                let llvm_boxed_record = LLVMBuildBitCast(
                    fcx.builder,
                    fcx.regs[record_reg],
                    boxed_record_ptr_type,
                    boxed_record_name.as_ptr() as *const _,
                );

                let field_ptr = record_struct::gen_record_field_ptr(
                    tcx,
                    fcx.builder,
                    record_storage,
                    llvm_boxed_record,
                    *field_index,
                    b"record_field_ptr\0",
                );

                let llvm_value =
                    LLVMBuildLoad(fcx.builder, field_ptr, libcstr!("record_field_value"));
                tcx.add_invariant_load_metadata(llvm_value);

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::LoadBoxedVectorLen(reg, vector_reg) => {
                use crate::codegen::vector_gen::load_boxed_vector_len;

                let llvm_boxed_vector = fcx.regs[vector_reg];
                let llvm_vector_len = load_boxed_vector_len(tcx, fcx, llvm_boxed_vector);

                fcx.regs.insert(*reg, llvm_vector_len);
            }
            OpKind::LoadBoxedVectorMember(
                reg,
                LoadBoxedVectorMemberOp {
                    vector_reg,
                    known_vector_len,
                    member_index,
                },
            ) => {
                use crate::codegen::vector_gen::load_boxed_vector_member;

                let llvm_boxed_vector = fcx.regs[vector_reg];

                let llvm_vector_member = load_boxed_vector_member(
                    tcx,
                    fcx,
                    llvm_boxed_vector,
                    *known_vector_len,
                    *member_index,
                );

                fcx.regs.insert(*reg, llvm_vector_member);
            }
            OpKind::Cond(cond_op) => {
                let cond_alloc_plan = active_alloc.next_cond_plan();
                gen_cond(tcx, mcx, fcx, cond_op, cond_alloc_plan);
            }
            OpKind::AllocBoxedInt(reg, int_reg) => {
                let box_source = active_alloc.next_box_source();

                let llvm_int = fcx.regs[int_reg];
                let llvm_alloced = alloc::types::gen_alloc_int(
                    tcx,
                    fcx.builder,
                    active_alloc,
                    box_source,
                    llvm_int,
                );

                fcx.regs.insert(*reg, llvm_alloced);
            }
            OpKind::AllocBoxedFloat(reg, float_reg) => {
                let box_source = active_alloc.next_box_source();

                let llvm_float = fcx.regs[float_reg];
                let llvm_alloced = alloc::types::gen_alloc_float(
                    tcx,
                    fcx.builder,
                    active_alloc,
                    box_source,
                    llvm_float,
                );

                fcx.regs.insert(*reg, llvm_alloced);
            }
            OpKind::AllocBoxedChar(reg, char_reg) => {
                let box_source = active_alloc.next_box_source();

                let llvm_char = fcx.regs[char_reg];
                let llvm_alloced = alloc::types::gen_alloc_char(
                    tcx,
                    fcx.builder,
                    active_alloc,
                    box_source,
                    llvm_char,
                );

                fcx.regs.insert(*reg, llvm_alloced);
            }
            OpKind::AllocBoxedSym(reg, interned_sym_reg) => {
                let box_source = active_alloc.next_box_source();

                let llvm_interned_sym = fcx.regs[interned_sym_reg];
                let llvm_alloced = alloc::types::gen_alloc_sym(
                    tcx,
                    fcx.builder,
                    active_alloc,
                    box_source,
                    llvm_interned_sym,
                );

                fcx.regs.insert(*reg, llvm_alloced);
            }
            OpKind::AllocBoxedPair(
                reg,
                BoxPairOp {
                    head_reg,
                    rest_reg,
                    list_len_reg,
                },
            ) => {
                let box_source = active_alloc.next_box_source();

                let input = alloc::types::PairInput {
                    llvm_head: fcx.regs[head_reg],
                    llvm_rest: fcx.regs[rest_reg],
                    llvm_list_len: fcx.regs[list_len_reg],
                };

                let llvm_value = alloc::types::gen_alloc_boxed_pair(
                    tcx,
                    fcx.builder,
                    active_alloc,
                    box_source,
                    &input,
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::AllocBoxedFunThunk(
                reg,
                BoxFunThunkOp {
                    captures_reg,
                    callee,
                },
            ) => {
                let box_source = active_alloc.next_box_source();

                let input = alloc::types::FunThunkInput {
                    llvm_captures: fcx.regs[captures_reg],
                    llvm_entry_point: gen_callee_entry_point(tcx, mcx, fcx, callee),
                };

                let llvm_value = alloc::types::gen_alloc_boxed_fun_thunk(
                    tcx,
                    fcx.builder,
                    active_alloc,
                    box_source,
                    &input,
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::IntCompare(
                reg,
                CompareOp {
                    comparison,
                    lhs_reg,
                    rhs_reg,
                },
            ) => {
                let reg_name = if comparison == &Comparison::Eq {
                    "int_equal\0"
                } else {
                    "int_compare\0"
                };

                gen_int_compare(fcx, *reg, *comparison, *lhs_reg, *rhs_reg, reg_name)
            }
            OpKind::BoolEqual(reg, BinaryOp { lhs_reg, rhs_reg }) => gen_int_compare(
                fcx,
                *reg,
                Comparison::Eq,
                *lhs_reg,
                *rhs_reg,
                "bool_equal\0",
            ),
            OpKind::CharEqual(reg, BinaryOp { lhs_reg, rhs_reg }) => gen_int_compare(
                fcx,
                *reg,
                Comparison::Eq,
                *lhs_reg,
                *rhs_reg,
                "char_equal\0",
            ),
            OpKind::InternedSymEqual(reg, BinaryOp { lhs_reg, rhs_reg }) => gen_int_compare(
                fcx,
                *reg,
                Comparison::Eq,
                *lhs_reg,
                *rhs_reg,
                "interned_sym_equal\0",
            ),
            OpKind::TypeTagEqual(reg, BinaryOp { lhs_reg, rhs_reg }) => gen_int_compare(
                fcx,
                *reg,
                Comparison::Eq,
                *lhs_reg,
                *rhs_reg,
                "type_tag_equal\0",
            ),
            OpKind::RecordClassIdEqual(reg, BinaryOp { lhs_reg, rhs_reg }) => gen_int_compare(
                fcx,
                *reg,
                Comparison::Eq,
                *lhs_reg,
                *rhs_reg,
                "record_class_id_equal\0",
            ),
            OpKind::FloatCompare(
                reg,
                CompareOp {
                    comparison,
                    lhs_reg,
                    rhs_reg,
                },
            ) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let reg_name = if comparison == &Comparison::Eq {
                    "float_equal\0"
                } else {
                    "float_compare\0"
                };

                let llvm_value = LLVMBuildFCmp(
                    fcx.builder,
                    comparison_to_llvm_real_pred(*comparison),
                    llvm_lhs,
                    llvm_rhs,
                    reg_name.as_ptr() as *const _,
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::BoxIdentical(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];
                let llvm_i64 = LLVMInt64TypeInContext(tcx.llx);

                let i64_lhs =
                    LLVMBuildPtrToInt(fcx.builder, llvm_lhs, llvm_i64, libcstr!("lhs_as_int"));

                let i64_rhs =
                    LLVMBuildPtrToInt(fcx.builder, llvm_rhs, llvm_i64, libcstr!("rhs_as_int"));

                let llvm_value = LLVMBuildICmp(
                    fcx.builder,
                    LLVMIntPredicate::LLVMIntEQ,
                    i64_lhs,
                    i64_rhs,
                    libcstr!("box_identical"),
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64ToFloat(reg, int64_reg) => {
                let llvm_i64 = fcx.regs[int64_reg];

                let llvm_double = LLVMBuildSIToFP(
                    fcx.builder,
                    llvm_i64,
                    LLVMDoubleTypeInContext(tcx.llx),
                    libcstr!("i64_as_double"),
                );

                fcx.regs.insert(*reg, llvm_double);
            }
            OpKind::FloatAdd(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value =
                    LLVMBuildFAdd(fcx.builder, llvm_lhs, llvm_rhs, libcstr!("float_sum"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64Add(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value = LLVMBuildNUWAdd(fcx.builder, llvm_lhs, llvm_rhs, libcstr!("sum"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64CheckedAdd(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value = math_gen::gen_checked_int_math(
                    tcx,
                    mcx,
                    fcx,
                    &math_gen::CHECKED_ADD,
                    llvm_lhs,
                    llvm_rhs,
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::FloatMul(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value =
                    LLVMBuildFMul(fcx.builder, llvm_lhs, llvm_rhs, libcstr!("float_product"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64CheckedMul(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value = math_gen::gen_checked_int_math(
                    tcx,
                    mcx,
                    fcx,
                    &math_gen::CHECKED_MUL,
                    llvm_lhs,
                    llvm_rhs,
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::FloatSub(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value = LLVMBuildFSub(
                    fcx.builder,
                    llvm_lhs,
                    llvm_rhs,
                    libcstr!("float_difference"),
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64CheckedSub(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value = math_gen::gen_checked_int_math(
                    tcx,
                    mcx,
                    fcx,
                    &math_gen::CHECKED_SUB,
                    llvm_lhs,
                    llvm_rhs,
                );
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::FloatDiv(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value =
                    LLVMBuildFDiv(fcx.builder, llvm_lhs, llvm_rhs, libcstr!("float_quotient"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64Div(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_numer = fcx.regs[lhs_reg];
                let llvm_denom = fcx.regs[rhs_reg];

                let llvm_value =
                    LLVMBuildSDiv(fcx.builder, llvm_numer, llvm_denom, libcstr!("quot"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64CheckedDiv(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_numer = fcx.regs[lhs_reg];
                let llvm_denom = fcx.regs[rhs_reg];

                let llvm_value =
                    math_gen::gen_checked_int_div(tcx, mcx, fcx, llvm_numer, llvm_denom);

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64Rem(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_numer = fcx.regs[lhs_reg];
                let llvm_denom = fcx.regs[rhs_reg];

                let llvm_value =
                    LLVMBuildSRem(fcx.builder, llvm_numer, llvm_denom, libcstr!("rem"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64CheckedRem(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_numer = fcx.regs[lhs_reg];
                let llvm_denom = fcx.regs[rhs_reg];

                let llvm_value =
                    math_gen::gen_checked_int_rem(tcx, mcx, fcx, llvm_numer, llvm_denom);

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::FloatSqrt(reg, radicand) => {
                let llvm_radicand = fcx.regs[radicand];

                let llvm_value = math_gen::gen_float_sqrt(tcx, mcx, fcx, llvm_radicand);
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64BitwiseAnd(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value = LLVMBuildAnd(fcx.builder, llvm_lhs, llvm_rhs, libcstr!("int_and"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64BitwiseOr(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value = LLVMBuildOr(fcx.builder, llvm_lhs, llvm_rhs, libcstr!("int_or"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64BitwiseXor(reg, BinaryOp { lhs_reg, rhs_reg }) => {
                let llvm_lhs = fcx.regs[lhs_reg];
                let llvm_rhs = fcx.regs[rhs_reg];

                let llvm_value = LLVMBuildXor(fcx.builder, llvm_lhs, llvm_rhs, libcstr!("int_xor"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64BitwiseNot(reg, int_reg) => {
                let llvm_int = fcx.regs[int_reg];

                let llvm_value = LLVMBuildNot(fcx.builder, llvm_int, libcstr!("int_not"));
                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64ShiftLeft(reg, ShiftOp { int_reg, bit_count }) => {
                let llvm_int = fcx.regs[int_reg];

                let llvm_value = LLVMBuildShl(
                    fcx.builder,
                    llvm_int,
                    LLVMConstInt(LLVMInt64TypeInContext(tcx.llx), *bit_count as u64, 0),
                    libcstr!("int_shl"),
                );

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64ArithmeticShiftRight(reg, ShiftOp { int_reg, bit_count }) => {
                let llvm_int = fcx.regs[int_reg];

                let llvm_value = LLVMBuildAShr(
                    fcx.builder,
                    llvm_int,
                    LLVMConstInt(LLVMInt64TypeInContext(tcx.llx), *bit_count as u64, 0),
                    libcstr!("int_ashr"),
                );

                fcx.regs.insert(*reg, llvm_value);
            }
            OpKind::Int64LogicalShiftRight(reg, ShiftOp { int_reg, bit_count }) => {
                let llvm_int = fcx.regs[int_reg];

                let llvm_value = LLVMBuildLShr(
                    fcx.builder,
                    llvm_int,
                    LLVMConstInt(LLVMInt64TypeInContext(tcx.llx), *bit_count as u64, 0),
                    libcstr!("int_lshr"),
                );

                fcx.regs.inse
Download .txt
gitextract_wp8wxvol/

├── .arret-root
├── .buildkite/
│   ├── build-and-test.sh
│   ├── llvm-assert.Dockerfile
│   ├── pipeline.yml
│   ├── sync-rustdoc.sh
│   ├── update-multiarch-manifest.sh
│   └── vscode-extension-tests.sh
├── .dockerignore
├── .github/
│   ├── CODEOWNERS
│   └── renovate.json
├── .gitignore
├── .prettierrc
├── Cargo.toml
├── Dockerfile
├── LICENSE
├── README.md
├── compiler/
│   ├── Cargo.toml
│   ├── arret_root.rs
│   ├── codegen/
│   │   ├── alloc/
│   │   │   ├── core.rs
│   │   │   ├── mod.rs
│   │   │   ├── plan.rs
│   │   │   └── types.rs
│   │   ├── analysis/
│   │   │   ├── escape.rs
│   │   │   ├── mod.rs
│   │   │   └── names.rs
│   │   ├── box_layout.rs
│   │   ├── callee.rs
│   │   ├── const_gen.rs
│   │   ├── debug_info.rs
│   │   ├── fun_gen.rs
│   │   ├── jit.rs
│   │   ├── libcstr.rs
│   │   ├── math_gen.rs
│   │   ├── mod.rs
│   │   ├── mod_gen.rs
│   │   ├── op_gen.rs
│   │   ├── panic_gen.rs
│   │   ├── program.rs
│   │   ├── range_md.rs
│   │   ├── record_struct.rs
│   │   ├── target_gen.rs
│   │   ├── target_machine.rs
│   │   └── vector_gen.rs
│   ├── context.rs
│   ├── hir/
│   │   ├── destruc.rs
│   │   ├── error.rs
│   │   ├── exports.rs
│   │   ├── import/
│   │   │   ├── filter.rs
│   │   │   ├── mod.rs
│   │   │   └── parse.rs
│   │   ├── loader.rs
│   │   ├── lowering.rs
│   │   ├── macros/
│   │   │   ├── expander.rs
│   │   │   ├── linker.rs
│   │   │   ├── matcher.rs
│   │   │   └── mod.rs
│   │   ├── mod.rs
│   │   ├── ns.rs
│   │   ├── prim.rs
│   │   ├── records.rs
│   │   ├── scope.rs
│   │   ├── types.rs
│   │   ├── util.rs
│   │   ├── var_id.rs
│   │   └── visitor.rs
│   ├── id_type.rs
│   ├── lib.rs
│   ├── mir/
│   │   ├── app_purity.rs
│   │   ├── arg_list.rs
│   │   ├── builder.rs
│   │   ├── costing.rs
│   │   ├── env_values.rs
│   │   ├── equality.rs
│   │   ├── error.rs
│   │   ├── eval_hir.rs
│   │   ├── inliner.rs
│   │   ├── intrinsic/
│   │   │   ├── bitwise.rs
│   │   │   ├── list.rs
│   │   │   ├── math.rs
│   │   │   ├── mod.rs
│   │   │   ├── num_utils.rs
│   │   │   ├── number.rs
│   │   │   ├── panics.rs
│   │   │   ├── partial_print.rs
│   │   │   ├── print.rs
│   │   │   ├── testing.rs
│   │   │   └── vector.rs
│   │   ├── mod.rs
│   │   ├── ops.rs
│   │   ├── optimise/
│   │   │   ├── duplicate_alloc_ops.rs
│   │   │   ├── mod.rs
│   │   │   └── unused_ops.rs
│   │   ├── polymorph.rs
│   │   ├── printer.rs
│   │   ├── record_field.rs
│   │   ├── ret_value.rs
│   │   ├── rust_fun.rs
│   │   ├── specific_abi_type.rs
│   │   ├── tagset.rs
│   │   ├── typred.rs
│   │   ├── value/
│   │   │   ├── arret_fun.rs
│   │   │   ├── build_reg.rs
│   │   │   ├── from_reg.rs
│   │   │   ├── list.rs
│   │   │   ├── mod.rs
│   │   │   ├── plan_phi.rs
│   │   │   ├── synthetic_fun.rs
│   │   │   ├── to_const.rs
│   │   │   └── types.rs
│   │   └── vector_member.rs
│   ├── promise.rs
│   ├── repl.rs
│   ├── reporting.rs
│   ├── rfi/
│   │   └── mod.rs
│   ├── source.rs
│   ├── tests/
│   │   ├── compile-error/
│   │   │   ├── arity.arret
│   │   │   ├── bit-shift-left-negative.arret
│   │   │   ├── bit-shift-right-overflow.arret
│   │   │   ├── destruc-errors.arret
│   │   │   ├── fn-lowering-errors.arret
│   │   │   ├── if-errors.arret
│   │   │   ├── import-parse-errors.arret
│   │   │   ├── macro-errors.arret
│   │   │   ├── misc-body-errors.arret
│   │   │   ├── misc-top-level-errors.arret
│   │   │   ├── missing-module.arret
│   │   │   ├── no-main.arret
│   │   │   ├── overflow-add.arret
│   │   │   ├── overflow-multiply.arret
│   │   │   ├── overflow-quot.arret
│   │   │   ├── overflow-subtract.arret
│   │   │   ├── quot-by-zero.arret
│   │   │   ├── record-errors.arret
│   │   │   ├── recur-errors.arret
│   │   │   ├── reference-errors.arret
│   │   │   ├── rem-by-zero.arret
│   │   │   ├── syntax-error.arret
│   │   │   ├── type-checking-errors.arret
│   │   │   ├── type-lowering-errors.arret
│   │   │   ├── vector-assoc-negative.arret
│   │   │   ├── vector-assoc-out-of-bounds.arret
│   │   │   ├── vector-ref-negative.arret
│   │   │   ├── vector-ref-out-of-bounds.arret
│   │   │   └── wrong-main-type.arret
│   │   ├── integration.rs
│   │   ├── optimise/
│   │   │   ├── application.arret
│   │   │   ├── bitwise.arret
│   │   │   ├── const.arret
│   │   │   ├── equality.arret
│   │   │   ├── inliner.arret
│   │   │   ├── list.arret
│   │   │   ├── math.arret
│   │   │   ├── number.arret
│   │   │   ├── typred.arret
│   │   │   └── vector.arret
│   │   ├── run-error/
│   │   │   ├── impure-panic.arret
│   │   │   ├── impure-panic.stderr
│   │   │   ├── infinite-to-int.arret
│   │   │   ├── infinite-to-int.stderr
│   │   │   ├── nan-to-int.arret
│   │   │   ├── nan-to-int.stderr
│   │   │   ├── overflow-add.arret
│   │   │   ├── overflow-add.stderr
│   │   │   ├── overflow-multiply.arret
│   │   │   ├── overflow-multiply.stderr
│   │   │   ├── overflow-quot.arret
│   │   │   ├── overflow-quot.stderr
│   │   │   ├── overflow-subtract.arret
│   │   │   ├── overflow-subtract.stderr
│   │   │   ├── pure-panic.arret
│   │   │   ├── pure-panic.stderr
│   │   │   ├── quot-by-zero.arret
│   │   │   ├── quot-by-zero.stderr
│   │   │   ├── rem-by-zero.arret
│   │   │   └── rem-by-zero.stderr
│   │   └── run-pass/
│   │       ├── application.arret
│   │       ├── binding.arret
│   │       ├── bitwise.arret
│   │       ├── closure-typing.arret
│   │       ├── closure.arret
│   │       ├── comments.arret
│   │       ├── conditionals.arret
│   │       ├── divergence.arret
│   │       ├── empty.arret
│   │       ├── equality.arret
│   │       ├── hash.arret
│   │       ├── list.arret
│   │       ├── macros.arret
│   │       ├── math.arret
│   │       ├── number.arret
│   │       ├── occurrence-typing.arret
│   │       ├── read.arret
│   │       ├── record.arret
│   │       ├── recursion.arret
│   │       ├── set.arret
│   │       ├── type-definitions.arret
│   │       ├── typred.arret
│   │       ├── vector.arret
│   │       └── write.arret
│   ├── ty/
│   │   ├── conv_abi.rs
│   │   ├── datum.rs
│   │   ├── intersect.rs
│   │   ├── is_a.rs
│   │   ├── list_iter.rs
│   │   ├── mod.rs
│   │   ├── pred.rs
│   │   ├── props.rs
│   │   ├── purity.rs
│   │   ├── record.rs
│   │   ├── select.rs
│   │   ├── subst.rs
│   │   ├── subtract.rs
│   │   ├── ty_args.rs
│   │   ├── unify.rs
│   │   └── var_usage.rs
│   └── typeck/
│       ├── dce.rs
│       ├── destruc.rs
│       ├── error.rs
│       ├── infer.rs
│       └── mod.rs
├── docker-compose.yml
├── docs/
│   └── language-design.md
├── driver/
│   ├── Cargo.toml
│   ├── main.rs
│   ├── subcommand/
│   │   ├── compile.rs
│   │   ├── eval.rs
│   │   ├── mod.rs
│   │   └── repl/
│   │       ├── arret_helper.rs
│   │       ├── command.rs
│   │       ├── history.rs
│   │       ├── mod.rs
│   │       └── syntax.rs
│   └── tests/
│       └── integration/
│           ├── hello-world.arret
│           └── run.sh
├── editors/
│   └── code/
│       ├── .dockerignore
│       ├── .eslintrc.yml
│       ├── .gitignore
│       ├── .vscode/
│       │   ├── launch.json
│       │   ├── settings.json
│       │   └── tasks.json
│       ├── Dockerfile
│       ├── language-configuration.json
│       ├── package.json
│       ├── src/
│       │   ├── extension.ts
│       │   └── test/
│       │       ├── colorize-fixtures/
│       │       │   └── sample.arret
│       │       ├── colorize-results/
│       │       │   └── sample_arret.json
│       │       ├── downloadVsCode.ts
│       │       ├── runTest.ts
│       │       ├── suite/
│       │       │   ├── colorization.test.ts
│       │       │   ├── extension.test.ts
│       │       │   └── index.ts
│       │       └── vsCodeVersion.ts
│       ├── syntaxes/
│       │   └── arret.tmLanguage.json
│       └── tsconfig.json
├── lsp-server/
│   ├── Cargo.toml
│   ├── capabilities.rs
│   ├── handler/
│   │   ├── mod.rs
│   │   ├── text_synchronisation.rs
│   │   └── workspace.rs
│   ├── json_rpc.rs
│   ├── main.rs
│   ├── model/
│   │   ├── document.rs
│   │   ├── mod.rs
│   │   └── workspace.rs
│   ├── session.rs
│   ├── transport/
│   │   ├── bytestream.rs
│   │   └── mod.rs
│   └── watcher/
│       ├── mod.rs
│       └── syntax.rs
├── rfi-derive/
│   ├── Cargo.toml
│   └── lib.rs
├── runtime/
│   ├── Cargo.toml
│   ├── abitype.rs
│   ├── binding.rs
│   ├── boxed/
│   │   ├── heap/
│   │   │   ├── collect.rs
│   │   │   ├── mod.rs
│   │   │   └── type_info.rs
│   │   ├── mod.rs
│   │   ├── refs.rs
│   │   └── types/
│   │       ├── char.rs
│   │       ├── field_value.rs
│   │       ├── float.rs
│   │       ├── fun.rs
│   │       ├── int.rs
│   │       ├── list.rs
│   │       ├── map.rs
│   │       ├── mod.rs
│   │       ├── record.rs
│   │       ├── record_data.rs
│   │       ├── set.rs
│   │       ├── shared_str.rs
│   │       ├── str.rs
│   │       ├── sym.rs
│   │       └── vector.rs
│   ├── callback.rs
│   ├── class_map.rs
│   ├── compiler_support.rs
│   ├── intern.rs
│   ├── lib.rs
│   ├── persistent/
│   │   ├── mod.rs
│   │   └── vector.rs
│   └── task.rs
├── runtime-syntax/
│   ├── Cargo.toml
│   ├── lib.rs
│   ├── reader.rs
│   └── writer.rs
├── stdlib/
│   ├── arret/
│   │   ├── base.arret
│   │   ├── set.arret
│   │   └── test.arret
│   └── rust/
│       ├── Cargo.toml
│       ├── bitwise.rs
│       ├── hash.rs
│       ├── lib.rs
│       ├── list.rs
│       ├── math.rs
│       ├── number.rs
│       ├── read.rs
│       ├── set.rs
│       ├── testing.rs
│       ├── vector.rs
│       └── write.rs
└── syntax/
    ├── Cargo.toml
    ├── anon_fun.rs
    ├── datum.rs
    ├── error.rs
    ├── lib.rs
    ├── parser.rs
    └── span.rs
Download .txt
Showing preview only (200K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2542 symbols across 188 files)

FILE: compiler/arret_root.rs
  constant ARRET_ROOT_ENV_VAR (line 3) | const ARRET_ROOT_ENV_VAR: &str = "ARRET_ROOT";
  function is_arret_root (line 5) | fn is_arret_root(path: &path::Path) -> bool {
  type InvalidOptionError (line 9) | pub struct InvalidOptionError {
    method invalid_path (line 15) | pub fn invalid_path(&self) -> &path::Path {
  type InvalidEnvVarError (line 20) | pub struct InvalidEnvVarError {
    method env_var_name (line 26) | pub fn env_var_name(&self) -> &'static str {
    method invalid_path (line 31) | pub fn invalid_path(&self) -> &path::Path {
  type FindArretRootError (line 36) | pub enum FindArretRootError {
  function find_arret_root (line 52) | pub fn find_arret_root(

FILE: compiler/codegen/alloc/core.rs
  function init_alloced_box_header (line 14) | fn init_alloced_box_header(
  function gen_stack_alloced_box (line 26) | fn gen_stack_alloced_box<T: boxed::ConstTagged>(
  function gen_heap_alloced_box (line 49) | fn gen_heap_alloced_box<T: boxed::ConstTagged>(
  function gen_alloced_box_with_llvm_type (line 106) | pub fn gen_alloced_box_with_llvm_type<T: boxed::ConstTagged>(
  function gen_alloced_box (line 122) | pub fn gen_alloced_box<T: boxed::ConstTagged>(
  function gen_runtime_heap_alloc (line 144) | fn gen_runtime_heap_alloc(
  function atom_into_active_alloc (line 215) | pub fn atom_into_active_alloc<'op>(

FILE: compiler/codegen/alloc/mod.rs
  type BoxSource (line 15) | pub enum BoxSource {
  type CondPlan (line 22) | pub struct CondPlan<'op> {
  type AllocAtom (line 29) | pub struct AllocAtom<'op> {
  function new (line 39) | fn new(ops_base: &'op [ops::Op]) -> Self {
  function ops (line 46) | pub fn ops(&self) -> &'op [ops::Op] {
  function push_op (line 51) | fn push_op(&mut self) {
  function is_empty (line 55) | fn is_empty(&self) -> bool {
  type ActiveAlloc (line 60) | pub struct ActiveAlloc<'op> {
  function is_empty (line 70) | pub fn is_empty(&self) -> bool {
  function next_box_source (line 74) | pub fn next_box_source(&mut self) -> BoxSource {
  function next_cond_plan (line 78) | pub fn next_cond_plan(&mut self) -> CondPlan<'op> {

FILE: compiler/codegen/alloc/plan.rs
  type AllocInfo (line 8) | struct AllocInfo {
  function op_needs_heap_checkpoint (line 16) | fn op_needs_heap_checkpoint(tcx: &mut TargetCtx, op: &ops::Op) -> bool {
  function op_alloc_info (line 43) | fn op_alloc_info(tcx: &mut TargetCtx, op: &ops::Op) -> Option<AllocInfo> {
  function plan_allocs (line 85) | pub fn plan_allocs<'op>(
  function plan_native_allocs (line 146) | fn plan_native_allocs(ops: &[ops::Op]) -> Vec<AllocAtom<'_>> {
  function empty_ops (line 171) | fn empty_ops() {
  function condless_allocs (line 177) | fn condless_allocs() {
  function non_allocating_cond (line 218) | fn non_allocating_cond() {
  function allocating_cond (line 249) | fn allocating_cond() {

FILE: compiler/codegen/alloc/types.rs
  type PairInput (line 15) | pub struct PairInput {
  type FunThunkInput (line 21) | pub struct FunThunkInput {
  type RecordInput (line 26) | pub struct RecordInput<'rs> {
  function gen_alloc_int (line 31) | pub fn gen_alloc_int(
  function gen_alloc_char (line 49) | pub fn gen_alloc_char(
  function gen_alloc_sym (line 72) | pub fn gen_alloc_sym(
  function gen_alloc_float (line 91) | pub fn gen_alloc_float(
  function gen_alloc_boxed_pair (line 114) | pub fn gen_alloc_boxed_pair(
  function gen_alloc_boxed_fun_thunk (line 149) | pub fn gen_alloc_boxed_fun_thunk(
  function gen_alloc_boxed_record (line 182) | pub fn gen_alloc_boxed_record(

FILE: compiler/codegen/analysis/escape.rs
  type CaptureKind (line 10) | pub enum CaptureKind {
    method capture_for_call_param (line 21) | fn capture_for_call_param(self, return_capture: CaptureKind) -> Captur...
  type Captures (line 32) | pub struct Captures {
    method new (line 37) | pub fn new() -> Captures {
    method add (line 46) | pub fn add(&mut self, reg_id: ops::RegId, capture: CaptureKind) {
    method get (line 60) | pub fn get(&self, reg_id: ops::RegId) -> CaptureKind {
  function infer_param_capture_kind (line 73) | pub fn infer_param_capture_kind(
  function add_static_symbol_call_captures (line 92) | fn add_static_symbol_call_captures(
  type ProgramCaptureCtx (line 111) | struct ProgramCaptureCtx<'of> {
  function add_op_captures (line 120) | fn add_op_captures(&mut self, captures: &mut Captures, ret_type: &RetAbi...
  function captures_for_private_fun_id (line 251) | fn captures_for_private_fun_id(&mut self, private_fun_id: ops::PrivateFu...
  function calc_fun_captures (line 267) | fn calc_fun_captures(&mut self, fun: &ops::Fun) -> Captures {
  type ProgramCaptures (line 278) | pub struct ProgramCaptures {
  function calc_program_captures (line 284) | pub fn calc_program_captures(
  function calc_single_fun_captures (line 311) | fn calc_single_fun_captures(fun: &ops::Fun) -> Captures {
  function infer_param_capture (line 316) | fn infer_param_capture() {
  function empty_fun_captures (line 331) | fn empty_fun_captures() {
  function capture_param_via_ret (line 352) | fn capture_param_via_ret() {
  function capture_param_via_pair (line 373) | fn capture_param_via_pair() {
  function capture_param_via_box_thunk_call (line 407) | fn capture_param_via_box_thunk_call() {
  function capture_param_via_static_symbol_call (line 441) | fn capture_param_via_static_symbol_call() {
  function capture_param_via_cond (line 535) | fn capture_param_via_cond() {

FILE: compiler/codegen/analysis/mod.rs
  type AnalysedMod (line 12) | pub struct AnalysedMod<'of> {
  type AnalysedFun (line 18) | pub struct AnalysedFun<'of> {
  function new (line 24) | pub fn new(
  function private_funs (line 61) | pub fn private_funs(&self) -> impl Iterator<Item = (&ops::PrivateFunId, ...
  function entry_fun (line 65) | pub fn entry_fun(&self) -> &AnalysedFun<'of> {
  function global_interned_names (line 69) | pub fn global_interned_names(&self) -> &BTreeMap<Rc<str>, intern::Intern...

FILE: compiler/codegen/analysis/names.rs
  function add_op_global_interned_names (line 9) | fn add_op_global_interned_names(names: &mut BTreeSet<Rc<str>>, op: &ops:...
  function add_fun_global_interned_names (line 31) | fn add_fun_global_interned_names(fun: &ops::Fun, names: &mut BTreeSet<Rc...
  function calc_program_global_interned_names (line 38) | pub fn calc_program_global_interned_names(
  function simple_global_interned_names (line 69) | fn simple_global_interned_names() {

FILE: compiler/codegen/box_layout.rs
  type BoxLayout (line 17) | pub enum BoxLayout {
    method type_name (line 31) | pub fn type_name(&self) -> &'static [u8] {
    method append_members (line 58) | pub fn append_members(&self, tcx: &mut TargetCtx, members: &mut Vec<LL...
    method from (line 128) | fn from(boxed_abi_type: &BoxedAbiType) -> BoxLayout {

FILE: compiler/codegen/callee.rs
  function gen_static_symbol_entry_point (line 12) | pub fn gen_static_symbol_entry_point(
  function gen_boxed_fun_thunk_entry_point (line 77) | pub fn gen_boxed_fun_thunk_entry_point(
  function callee_takes_task (line 89) | pub fn callee_takes_task(callee: &ops::Callee) -> bool {
  function callee_call_conv (line 97) | pub fn callee_call_conv(mcx: &mut ModCtx<'_, '_, '_>, callee: &ops::Call...

FILE: compiler/codegen/const_gen.rs
  function annotate_private_global (line 16) | pub fn annotate_private_global(llvm_global: LLVMValueRef) {
  function gen_boxed_pair (line 24) | pub fn gen_boxed_pair(
  function gen_boxed_external_str (line 54) | fn gen_boxed_external_str(
  function gen_boxed_inline_str (line 114) | fn gen_boxed_inline_str(
  function gen_boxed_str (line 152) | pub fn gen_boxed_str(
  function gen_boxed_sym (line 163) | pub fn gen_boxed_sym(
  function gen_global_interned_names (line 194) | pub fn gen_global_interned_names<'a>(
  function gen_boxed_int (line 284) | pub fn gen_boxed_int(
  function gen_boxed_float (line 311) | pub fn gen_boxed_float(
  function gen_boxed_char (line 338) | pub fn gen_boxed_char(
  function gen_boxed_nil (line 365) | pub fn gen_boxed_nil(tcx: &mut TargetCtx, mcx: &mut ModCtx<'_, '_, '_>) ...
  function gen_boxed_fun_thunk (line 369) | pub fn gen_boxed_fun_thunk(
  function gen_boxed_record (line 397) | pub fn gen_boxed_record(
  function gen_persistent_vector_leaf (line 497) | fn gen_persistent_vector_leaf(
  function gen_boxed_external_vector (line 537) | fn gen_boxed_external_vector(
  function gen_boxed_inline_vector (line 593) | fn gen_boxed_inline_vector(
  function gen_boxed_vector (line 632) | pub fn gen_boxed_vector(
  function gen_boxed_set (line 650) | pub fn gen_boxed_set(
  function gen_boxed_map (line 693) | pub fn gen_boxed_map(

FILE: compiler/codegen/debug_info.rs
  type DebugInfoBuilder (line 16) | pub struct DebugInfoBuilder<'sl> {
  function new (line 25) | pub fn new(
  function add_compile_unit_metadata (line 51) | fn add_compile_unit_metadata(&mut self, optimised: bool, main_span: Span) {
  function file_metadata (line 84) | pub fn file_metadata(&mut self, file_id: FileId) -> LLVMMetadataRef {
  function placeholder_subroutine_type (line 106) | pub fn placeholder_subroutine_type(
  function add_function_debug_info (line 122) | pub fn add_function_debug_info(
  function finalise (line 178) | pub fn finalise(&mut self) {
  method drop (line 186) | fn drop(&mut self) {

FILE: compiler/codegen/fun_gen.rs
  type FunCtx (line 16) | pub(crate) struct FunCtx {
    method new (line 25) | pub(crate) fn new(
  method drop (line 41) | fn drop(&mut self) {
  function declare_fun (line 48) | pub(crate) fn declare_fun(
  function define_fun (line 75) | pub(crate) fn define_fun(

FILE: compiler/codegen/jit.rs
  function orc_sym_resolve (line 19) | extern "C" fn orc_sym_resolve(name_ptr: *const libc::c_char, jcx_void: *...
  type JitCtx (line 30) | pub struct JitCtx {
    method new (line 48) | pub fn new(optimising: bool) -> JitCtx {
    method compile_fun (line 94) | pub fn compile_fun(
    method add_symbol (line 169) | pub fn add_symbol(&mut self, unmangled_name: &[u8], address: u64) {
    method register_record_struct (line 185) | pub fn register_record_struct(
  type RegisteredRecordStruct (line 40) | pub struct RegisteredRecordStruct {
  method drop (line 205) | fn drop(&mut self) {

FILE: compiler/codegen/math_gen.rs
  type CheckedIntOp (line 11) | pub struct CheckedIntOp {
  constant CHECKED_ADD (line 17) | pub const CHECKED_ADD: CheckedIntOp = CheckedIntOp {
  constant CHECKED_SUB (line 23) | pub const CHECKED_SUB: CheckedIntOp = CheckedIntOp {
  constant CHECKED_MUL (line 29) | pub const CHECKED_MUL: CheckedIntOp = CheckedIntOp {
  function gen_checked_int_math (line 35) | pub(crate) fn gen_checked_int_math(
  function gen_checked_int_rem (line 114) | pub(crate) fn gen_checked_int_rem(
  function gen_checked_int_div (line 153) | pub(crate) fn gen_checked_int_div(
  function gen_float_sqrt (line 240) | pub(crate) fn gen_float_sqrt(

FILE: compiler/codegen/mod.rs
  type GenAbi (line 25) | pub struct GenAbi {
    method thunk_abi (line 32) | pub fn thunk_abi() -> GenAbi {
    method from (line 45) | fn from(ops_abi: &'a OpsAbi) -> GenAbi {
  function initialise_llvm (line 62) | pub fn initialise_llvm(support_cross_compilation: bool) {
  function initialise_test_llvm (line 85) | pub fn initialise_test_llvm() {

FILE: compiler/codegen/mod_gen.rs
  type ModCtx (line 19) | pub struct ModCtx<'am, 'sl, 'interner> {
  type GeneratedMod (line 37) | pub struct GeneratedMod {
  function new (line 50) | fn new(
  function intern_name (line 119) | pub fn intern_name(&mut self, name: &str) -> intern::InternedSym {
  function record_class_id_for_struct (line 133) | pub fn record_class_id_for_struct(
  function add_record_class_id_range_metadata (line 149) | pub fn add_record_class_id_range_metadata(&mut self, record_class_id_llv...
  function llvm_private_fun (line 156) | pub fn llvm_private_fun(&self, private_fun_id: ops::PrivateFunId) -> LLV...
  function get_global_or_insert (line 160) | pub fn get_global_or_insert<F>(
  function get_function_or_insert (line 183) | pub fn get_function_or_insert<F>(
  function optimise_function (line 206) | pub fn optimise_function(&mut self, function: LLVMValueRef) {
  function finalise_record_class_id_range_metadata (line 212) | fn finalise_record_class_id_range_metadata(&mut self, tcx: &mut TargetCt...
  function into_generated_mod (line 250) | fn into_generated_mod(mut self, tcx: &mut TargetCtx) -> GeneratedMod {
  function gen_mod (line 322) | pub fn gen_mod<'am, 'sl, 'interner>(
  method drop (line 342) | fn drop(&mut self) {

FILE: compiler/codegen/op_gen.rs
  function comparison_to_llvm_int_pred (line 18) | fn comparison_to_llvm_int_pred(comparison: Comparison) -> LLVMIntPredica...
  function comparison_to_llvm_real_pred (line 28) | fn comparison_to_llvm_real_pred(comparison: Comparison) -> LLVMRealPredi...
  function gen_int_compare (line 38) | fn gen_int_compare(
  function gen_op (line 60) | fn gen_op(
  function gen_cond_branch (line 1022) | fn gen_cond_branch(
  function gen_cond (line 1050) | fn gen_cond(
  function gen_callee_entry_point (line 1120) | fn gen_callee_entry_point(
  function gen_alloc_atom (line 1140) | pub(crate) fn gen_alloc_atom(

FILE: compiler/codegen/panic_gen.rs
  function gen_panic (line 10) | pub(crate) fn gen_panic(

FILE: compiler/codegen/program.rs
  type OutputType (line 20) | pub enum OutputType {
  type Options (line 29) | pub struct Options<'target> {
  function new (line 36) | pub fn new() -> Options<'static> {
  function with_target_triple (line 44) | pub fn with_target_triple(self, target_triple: Option<&'target str>) -> ...
  function with_llvm_opt (line 51) | pub fn with_llvm_opt(self, llvm_opt: bool) -> Options<'target> {
  function with_output_type (line 55) | pub fn with_output_type(self, output_type: OutputType) -> Options<'targe...
  function output_type (line 62) | pub fn output_type(&self) -> OutputType {
  method default (line 68) | fn default() -> Options<'static> {
  function arret_main_llvm_type (line 73) | fn arret_main_llvm_type(tcx: &mut TargetCtx) -> LLVMTypeRef {
  function c_main_llvm_type (line 86) | fn c_main_llvm_type(tcx: &mut TargetCtx) -> LLVMTypeRef {
  function program_to_module (line 103) | fn program_to_module(
  function target_triple_to_cc_args (line 179) | fn target_triple_to_cc_args(target_triple: &str) -> Vec<&str> {
  function gen_program (line 193) | pub fn gen_program(

FILE: compiler/codegen/range_md.rs
  type Int (line 7) | type Int = i64;
  type IntRangeIter (line 9) | struct IntRangeIter<I>
  type Item (line 20) | type Item = Range<Int>;
  method next (line 22) | fn next(&mut self) -> Option<Range<Int>> {
  function find_int_ranges (line 36) | fn find_int_ranges(input: impl Iterator<Item = Int>) -> impl Iterator<It...
  function int_range_md_node (line 45) | pub fn int_range_md_node(
  function empty (line 66) | fn empty() {
  function single_value (line 72) | fn single_value() {
  function single_range (line 80) | fn single_range() {
  function multi_range (line 88) | fn multi_range() {

FILE: compiler/codegen/record_struct.rs
  constant IS_INLINE_INDEX (line 15) | pub const IS_INLINE_INDEX: u32 = 1;
  constant CONTAINS_GC_REFS_INDEX (line 16) | pub const CONTAINS_GC_REFS_INDEX: u32 = 2;
  constant RECORD_CLASS_ID_INDEX (line 17) | pub const RECORD_CLASS_ID_INDEX: u32 = 3;
  constant DATA_INDEX (line 18) | pub const DATA_INDEX: u32 = 4;
  constant EXTERNAL_COMPACT_LAYOUT_INDEX (line 19) | pub const EXTERNAL_COMPACT_LAYOUT_INDEX: u32 = 5;
  function append_common_internal_members (line 22) | pub fn append_common_internal_members(tcx: &mut TargetCtx, members: &mut...
  type TargetRecordStruct (line 36) | pub struct TargetRecordStruct {
    method from_mir_record_struct (line 44) | pub fn from_mir_record_struct(
  function gen_classmap_classes (line 104) | pub fn gen_classmap_classes(
  function gen_record_field_ptr (line 204) | pub fn gen_record_field_ptr(

FILE: compiler/codegen/target_gen.rs
  function llvm_enum_attr_for_name (line 19) | fn llvm_enum_attr_for_name(
  function llvm_md_kind_id_for_name (line 31) | fn llvm_md_kind_id_for_name(llx: LLVMContextRef, md_name: &str) -> u32 {
  function llvm_i64_md_node (line 35) | fn llvm_i64_md_node(llx: LLVMContextRef, values: &[u64]) -> LLVMMetadata...
  type CachedTypes (line 50) | struct CachedTypes {
  type TargetCtx (line 83) | pub struct TargetCtx {
    method new (line 113) | pub fn new(target_machine: LLVMTargetMachineRef, optimising: bool) -> ...
    method optimising (line 168) | pub fn optimising(&self) -> bool {
    method target_machine (line 172) | pub fn target_machine(&self) -> LLVMTargetMachineRef {
    method target_data (line 176) | pub fn target_data(&self) -> LLVMTargetDataRef {
    method task_llvm_ptr_type (line 180) | pub fn task_llvm_ptr_type(&mut self) -> LLVMTypeRef {
    method global_interned_name_llvm_type (line 193) | pub fn global_interned_name_llvm_type(&mut self) -> LLVMTypeRef {
    method classmap_field_llvm_type (line 211) | pub fn classmap_field_llvm_type(&mut self) -> LLVMTypeRef {
    method classmap_class_llvm_type (line 229) | pub fn classmap_class_llvm_type(&mut self) -> LLVMTypeRef {
    method captures_llvm_type (line 233) | pub fn captures_llvm_type(&mut self) -> LLVMTypeRef {
    method record_class_id_llvm_type (line 237) | pub fn record_class_id_llvm_type(&self) -> LLVMTypeRef {
    method box_header_llvm_type (line 241) | fn box_header_llvm_type(&mut self) -> LLVMTypeRef {
    method shared_str_llvm_type (line 254) | pub fn shared_str_llvm_type(&mut self) -> LLVMTypeRef {
    method boxed_external_str_llvm_type (line 277) | pub fn boxed_external_str_llvm_type(&mut self) -> LLVMTypeRef {
    method boxed_inline_str_llvm_type (line 300) | pub fn boxed_inline_str_llvm_type(&mut self) -> LLVMTypeRef {
    method persistent_vector_leaf_llvm_type (line 322) | pub fn persistent_vector_leaf_llvm_type(&mut self) -> LLVMTypeRef {
    method boxed_external_vector_llvm_type (line 343) | pub fn boxed_external_vector_llvm_type(&mut self) -> LLVMTypeRef {
    method boxed_inline_vector_llvm_type (line 371) | pub fn boxed_inline_vector_llvm_type(&mut self) -> LLVMTypeRef {
    method boxed_abi_to_llvm_struct_type (line 397) | pub fn boxed_abi_to_llvm_struct_type(&mut self, boxed_abi_type: &Boxed...
    method callback_entry_point_llvm_type (line 419) | fn callback_entry_point_llvm_type(
    method callback_llvm_type (line 450) | pub fn callback_llvm_type(&mut self, entry_point_llvm_type: LLVMTypeRe...
    method boxed_abi_to_llvm_ptr_type (line 459) | pub fn boxed_abi_to_llvm_ptr_type(&mut self, boxed_abi_type: &BoxedAbi...
    method abi_to_llvm_type (line 463) | pub fn abi_to_llvm_type(&mut self, abi_type: &AbiType) -> LLVMTypeRef {
    method ret_abi_to_llvm_type (line 481) | fn ret_abi_to_llvm_type(&mut self, ret_abi_type: &RetAbiType) -> LLVMT...
    method fun_abi_to_llvm_type (line 488) | pub fn fun_abi_to_llvm_type(&mut self, fun_abi: &GenAbi) -> LLVMTypeRef {
    method target_record_struct (line 514) | pub fn target_record_struct<'a>(
    method record_struct_llvm_box_type (line 530) | pub fn record_struct_llvm_box_type(
    method ptr_to_singleton_box (line 585) | pub fn ptr_to_singleton_box(
    method llvm_box_header (line 616) | pub fn llvm_box_header(&mut self, header: boxed::Header) -> LLVMValueR...
    method llvm_enum_attr_for_name (line 630) | pub fn llvm_enum_attr_for_name(
    method llvm_md_kind_id_for_name (line 638) | pub fn llvm_md_kind_id_for_name(&mut self, md_name: &str) -> u32 {
    method llvm_boxed_align_attr (line 642) | pub fn llvm_boxed_align_attr(&self) -> LLVMAttributeRef {
    method llvm_noalias_attr (line 646) | pub fn llvm_noalias_attr(&self) -> LLVMAttributeRef {
    method add_invariant_load_metadata (line 650) | pub fn add_invariant_load_metadata(&self, loaded_value: LLVMValueRef) {
    method add_char_codepoint_range_metadata (line 661) | pub fn add_char_codepoint_range_metadata(&mut self, llvm_value: LLVMVa...
    method add_boxed_param_attrs (line 686) | pub fn add_boxed_param_attrs(
    method add_boxed_return_attrs (line 709) | pub fn add_boxed_return_attrs(&mut self, function: LLVMValueRef) {
    method add_boxed_load_metadata (line 721) | pub fn add_boxed_load_metadata(&mut self, loaded_value: LLVMValueRef) {
    method finish_module (line 739) | pub fn finish_module(&mut self, module: LLVMModuleRef) {
  method drop (line 766) | fn drop(&mut self) {

FILE: compiler/codegen/target_machine.rs
  type TripleString (line 6) | enum TripleString {
    method as_ptr (line 12) | fn as_ptr(&self) -> *const libc::c_char {
  method drop (line 21) | fn drop(&mut self) {
  function create_target_machine (line 30) | pub fn create_target_machine(

FILE: compiler/codegen/vector_gen.rs
  function load_boxed_external_vector_len (line 11) | fn load_boxed_external_vector_len(
  function load_boxed_vector_len (line 45) | pub(crate) fn load_boxed_vector_len(
  function load_boxed_inline_vector_member (line 160) | fn load_boxed_inline_vector_member(
  function load_boxed_external_vector_member (line 192) | fn load_boxed_external_vector_member(
  function load_boxed_vector_member (line 270) | pub(crate) fn load_boxed_vector_member(

FILE: compiler/context.rs
  type ModuleImports (line 33) | pub(crate) type ModuleImports = HashMap<ModuleName, Arc<Module>>;
  type LinkedLibrary (line 35) | pub struct LinkedLibrary {
    method target_path (line 41) | pub fn target_path(&self) -> &path::Path {
  type Module (line 49) | pub(crate) struct Module {
    method hash (line 70) | fn hash<H: hash::Hasher>(&self, state: &mut H) {
  method eq (line 62) | fn eq(&self, other: &Self) -> bool {
  type CachedModule (line 75) | type CachedModule = Result<Arc<Module>, Vec<Diagnostic<FileId>>>;
  type UncachedModule (line 76) | type UncachedModule = Result<Module, Vec<Diagnostic<FileId>>>;
  function transitive_deps (line 81) | fn transitive_deps(imports: &ModuleImports) -> HashSet<Arc<Module>> {
  function prims_to_module (line 91) | pub(crate) fn prims_to_module(exports: Exports) -> Module {
  function rfi_library_to_module (line 105) | fn rfi_library_to_module(span: Span, rfi_library: rfi::Library) -> Module {
  type CompileCtx (line 172) | pub struct CompileCtx {
    method new (line 183) | pub fn new(package_paths: PackagePaths, enable_optimisations: bool) ->...
    method package_paths (line 213) | pub fn package_paths(&self) -> &PackagePaths {
    method enable_optimisations (line 217) | pub fn enable_optimisations(&self) -> bool {
    method source_loader (line 221) | pub fn source_loader(&self) -> &SourceLoader {
    method rfi_loader (line 225) | pub(crate) fn rfi_loader(&self) -> &rfi::Loader {
    method get_module_by_name (line 234) | fn get_module_by_name(&self, span: Span, module_name: ModuleName) -> C...
    method source_file_to_module (line 251) | pub(crate) fn source_file_to_module(&self, source_file: &SourceFile) -...
    method imports_for_data (line 262) | pub(crate) fn imports_for_data<'a>(
    method data_to_module (line 299) | fn data_to_module(&self, data: &[Datum]) -> UncachedModule {

FILE: compiler/hir/destruc.rs
  type Destruc (line 9) | pub enum Destruc<P: hir::Phase> {
  type List (line 15) | pub struct List<P: hir::Phase> {
  function new (line 21) | pub fn new(fixed: Vec<Destruc<P>>, rest: Option<Box<Scalar<P>>>) -> List...
  function fixed (line 25) | pub fn fixed(&self) -> &Vec<Destruc<P>> {
  function rest (line 29) | pub fn rest(&self) -> &Option<Box<Scalar<P>>> {
  type Scalar (line 35) | pub struct Scalar<P: hir::Phase> {
  function new (line 43) | pub fn new(local_id: Option<hir::LocalId>, source_name: DataStr, ty: P::...
  function local_id (line 51) | pub fn local_id(&self) -> &Option<hir::LocalId> {
  function source_name (line 55) | pub fn source_name(&self) -> &DataStr {
  function ty (line 59) | pub fn ty(&self) -> &P::DeclType {
  function subst_list_destruc (line 64) | pub fn subst_list_destruc(
  function subst_scalar_destruc (line 81) | pub fn subst_scalar_destruc(
  function subst_destruc (line 103) | pub fn subst_destruc(
  function poly_for_list_destruc (line 115) | pub fn poly_for_list_destruc(list: &List<hir::Inferred>) -> ty::List<ty:...
  function poly_for_destruc (line 126) | pub fn poly_for_destruc(destruc: &Destruc<hir::Inferred>) -> ty::Ref<ty:...

FILE: compiler/hir/error.rs
  type ExpectedSym (line 17) | pub struct ExpectedSym {
  type PolyArgIsNotTy (line 23) | pub struct PolyArgIsNotTy {
  type PolyArgIsNotPure (line 30) | pub struct PolyArgIsNotPure {
  type ExpectedPolyPurityArg (line 36) | pub struct ExpectedPolyPurityArg {
  type ErrorKind (line 42) | pub enum ErrorKind {
  type Error (line 109) | pub struct Error {
    method new (line 117) | pub fn new(span: Span, kind: ErrorKind) -> Error {
    method kind (line 124) | pub fn kind(&self) -> &ErrorKind {
    method from_module_io (line 128) | pub fn from_module_io(span: Span, path: &path::Path, error: &io::Error...
    method with_macro_invocation_span (line 135) | pub fn with_macro_invocation_span(self, span: Span) -> Error {
    method fmt (line 632) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
    method from (line 639) | fn from(err: SyntaxError) -> Error {
  type Result (line 114) | pub type Result<T, E = Error> = result::Result<T, E>;
  function from (line 144) | fn from(error: Error) -> Diagnostic<FileId> {
  function from (line 645) | fn from(error: Error) -> Vec<Error> {

FILE: compiler/hir/exports.rs
  type Exports (line 9) | pub type Exports = HashMap<DataStr, Binding>;
  function prims_exports (line 11) | pub fn prims_exports() -> Exports {
  function tys_exports (line 18) | pub fn tys_exports() -> Exports {

FILE: compiler/hir/import/filter.rs
  type Result (line 7) | type Result<T> = result::Result<T, Vec<Error>>;
  function apply_filter (line 9) | fn apply_filter(filter: ParsedFilter, exports: &Exports) -> Result<Expor...
  function filter_imported_exports (line 72) | pub fn filter_imported_exports(

FILE: compiler/hir/import/mod.rs
  function try_extract_import_set (line 15) | pub fn try_extract_import_set(datum: &Datum) -> Option<&[Datum]> {
  function collect_imported_module_names (line 30) | pub fn collect_imported_module_names<'a>(
  type Result (line 74) | type Result<T> = result::Result<T, Vec<Error>>;
  function exports_for_import_set (line 76) | fn exports_for_import_set(datum: &str) -> Result<Exports> {
  function assert_exports_prim (line 93) | fn assert_exports_prim(exports: &Exports, name: &'static str, expected_p...
  function basic_import (line 108) | fn basic_import() {
  function package_not_found (line 117) | fn package_not_found() {
  function only_filter (line 127) | fn only_filter() {
  function exclude_filter (line 142) | fn exclude_filter() {
  function rename_filter (line 157) | fn rename_filter() {
  function prefix_filter (line 172) | fn prefix_filter() {
  function prefixed_filter (line 181) | fn prefixed_filter() {

FILE: compiler/hir/import/parse.rs
  type Result (line 10) | type Result<T> = result::Result<T, Error>;
  type ParsedImportSet (line 12) | pub enum ParsedImportSet {
    method into_spanned_module_name (line 18) | pub fn into_spanned_module_name(self) -> (Span, ModuleName) {
    method spanned_module_name (line 25) | pub fn spanned_module_name(&self) -> (Span, &ModuleName) {
    method module_name (line 32) | pub fn module_name(&self) -> &ModuleName {
  type ParsedFilter (line 37) | pub enum ParsedFilter {
  function parse_module_name (line 44) | fn parse_module_name(span: Span, name: &[Datum]) -> Result<ModuleName> {
  function parse_filter (line 64) | fn parse_filter(
  function parse_import_set (line 147) | pub fn parse_import_set(import_set_datum: &Datum) -> Result<ParsedImport...

FILE: compiler/hir/loader.rs
  type PackagePath (line 12) | pub struct PackagePath {
  type PackagePaths (line 18) | pub struct PackagePaths {
    method empty (line 23) | pub fn empty() -> PackagePaths {
    method with_stdlib (line 30) | pub fn with_stdlib(arret_root_dir: &path::Path, target_triple: Option<...
    method test_paths (line 51) | pub fn test_paths(target_triple: Option<&str>) -> PackagePaths {
    method add_package (line 56) | pub fn add_package(&mut self, package_name: &str, path: PackagePath) {
  type ModuleName (line 62) | pub struct ModuleName {
    method new (line 75) | pub fn new(package_name: DataStr, path: Vec<DataStr>, terminal_name: D...
    method is_rfi (line 83) | pub fn is_rfi(&self) -> bool {
    method terminal_name (line 87) | pub fn terminal_name(&self) -> &DataStr {
  type LoadedModule (line 69) | pub enum LoadedModule {
  function load_module_by_name (line 92) | pub fn load_module_by_name(
  function load_stdlib_module (line 144) | fn load_stdlib_module(name: &'static str) -> Result<LoadedModule> {
  function load_stdlib_base (line 152) | fn load_stdlib_base() {
  function load_stdlib_rust (line 163) | fn load_stdlib_rust() {
  function load_stdlib_missing (line 177) | fn load_stdlib_missing() {

FILE: compiler/hir/lowering.rs
  type LoweredModule (line 34) | pub struct LoweredModule {
  type DeferredDef (line 42) | struct DeferredDef {
  type DeferredExport (line 49) | struct DeferredExport {
  type DeferredModulePrim (line 54) | enum DeferredModulePrim {
    method with_macro_invocation_span (line 60) | fn with_macro_invocation_span(self, span: Span) -> DeferredModulePrim {
  type LoweredReplDatum (line 71) | pub(crate) enum LoweredReplDatum {
  function lower_user_compile_error (line 83) | fn lower_user_compile_error(span: Span, arg_iter: NsDataIter) -> Error {
  function lower_macro (line 94) | fn lower_macro(
  function lower_defmacro (line 130) | fn lower_defmacro(scope: &mut Scope<'_>, span: Span, mut arg_iter: NsDat...
  function lower_letmacro (line 144) | fn lower_letmacro(
  function lower_type (line 153) | fn lower_type(scope: &mut Scope<'_>, self_datum: NsDatum, ty_datum: NsDa...
  function lower_deftype (line 161) | fn lower_deftype(scope: &mut Scope<'_>, span: Span, mut arg_iter: NsData...
  function lower_lettype (line 172) | fn lower_lettype(
  function lower_defrecord (line 181) | fn lower_defrecord(scope: &mut Scope<'_>, span: Span, mut arg_iter: NsDa...
  function lower_letrecord (line 192) | fn lower_letrecord(
  function lower_ident_destruc (line 202) | fn lower_ident_destruc(
  function lower_scalar_destruc (line 221) | fn lower_scalar_destruc(
  function lower_list_destruc (line 244) | fn lower_list_destruc(
  function lower_destruc (line 263) | fn lower_destruc(
  function lower_let_like (line 291) | fn lower_let_like<B, C, O>(
  function lower_body (line 334) | fn lower_body(
  function lower_let (line 362) | fn lower_let(
  function lower_fun (line 390) | fn lower_fun(
  function lower_expr_prim_apply (line 460) | fn lower_expr_prim_apply(
  function lower_expr_apply (line 503) | fn lower_expr_apply(
  function lower_recur (line 531) | fn lower_recur(
  function lower_expr (line 556) | fn lower_expr(lia: &LocalIdAlloc, scope: &Scope<'_>, datum: NsDatum) -> ...
  function lower_module_prim_apply (line 621) | fn lower_module_prim_apply(
  function lower_module_def (line 669) | fn lower_module_def(
  function insert_import_bindings (line 710) | fn insert_import_bindings(
  function lower_data (line 737) | pub(crate) fn lower_data(
  function resolve_deferred_def (line 826) | fn resolve_deferred_def(
  function lower_repl_datum (line 847) | pub(crate) fn lower_repl_datum(
  function import_statement_for_module (line 898) | fn import_statement_for_module(names: &[&'static str]) -> Datum {
  function module_for_str (line 915) | fn module_for_str(data_str: &str) -> Result<LoweredModule> {
  function expr_for_str (line 959) | pub fn expr_for_str(data_str: &str) -> Expr<Lowered> {
  function self_quoting_bool (line 982) | fn self_quoting_bool() {
  function self_quoting_empty_list (line 991) | fn self_quoting_empty_list() {
  function quoted_datum_shorthand (line 1000) | fn quoted_datum_shorthand() {
  function quoted_datum_explicit (line 1009) | fn quoted_datum_explicit() {
  function self_evaluating_keyword (line 1018) | fn self_evaluating_keyword() {
  function wildcard_let (line 1027) | fn wildcard_let() {
  function empty_fn (line 1048) | fn empty_fn() {
  function empty_fn_with_purity (line 1068) | fn empty_fn_with_purity() {
  function empty_fn_with_ret_ty (line 1089) | fn empty_fn_with_ret_ty() {
  function fixed_expr_apply (line 1111) | fn fixed_expr_apply() {
  function rest_expr_apply (line 1131) | fn rest_expr_apply() {
  function recur_expr (line 1151) | fn recur_expr() {
  function if_expr (line 1173) | fn if_expr() {
  function expand_trivial_macro (line 1192) | fn expand_trivial_macro() {
  function mutual_module_def (line 1203) | fn mutual_module_def() {
  function type_predicate (line 1215) | fn type_predicate() {
  function equality_predicate (line 1224) | fn equality_predicate() {

FILE: compiler/hir/macros/expander.rs
  type ExpandCursor (line 13) | struct ExpandCursor<'data, 'links> {
  type ExpandCtx (line 21) | struct ExpandCtx<'scope, 'parent> {
  function new (line 28) | fn new(scope: &'scope mut Scope<'parent>, module_id: Option<ModuleId>) -...
  function expand_ident (line 36) | fn expand_ident(
  function expand_zero_or_more (line 80) | fn expand_zero_or_more(
  function expand_slice (line 111) | fn expand_slice(
  function expand_list (line 137) | fn expand_list(
  function expand_datum (line 151) | fn expand_datum(
  function expand_rule (line 169) | pub fn expand_rule<'scope, 'parent, 'data>(

FILE: compiler/hir/macros/linker.rs
  type TemplateIdent (line 13) | pub enum TemplateIdent {
  type VarLinks (line 26) | pub struct VarLinks {
    method subpattern_index (line 34) | pub fn subpattern_index(&self) -> usize {
    method template_ident (line 39) | pub fn template_ident(&self, i: usize) -> &TemplateIdent {
    method subtemplates (line 44) | pub fn subtemplates(&self) -> &[VarLinks] {
  type FoundVars (line 50) | struct FoundVars<'data> {
  function new (line 57) | fn new(span: Span) -> Self {
  type FindVarsInputType (line 68) | enum FindVarsInputType {
  type FindVarsCtx (line 73) | struct FindVarsCtx<'data> {
  type FindVarsResult (line 78) | type FindVarsResult = result::Result<(), Error>;
  function new (line 81) | fn new(input_type: FindVarsInputType) -> Self {
  function visit_ident (line 98) | fn visit_ident(
  function visit_zero_or_more (line 126) | fn visit_zero_or_more(
  function visit_datum (line 138) | fn visit_datum(
  function visit_seq (line 155) | fn visit_seq(
  function visit_list (line 188) | fn visit_list(
  function visit_set (line 209) | fn visit_set(
  function link_template_ident (line 230) | fn link_template_ident(
  function link_found_vars (line 251) | fn link_found_vars(
  function link_rule_vars (line 323) | pub fn link_rule_vars(

FILE: compiler/hir/macros/matcher.rs
  type MatchData (line 7) | pub struct MatchData<'data> {
  function new (line 14) | fn new() -> MatchData<'data> {
  function var (line 21) | pub fn var(&self, i: usize) -> &'data NsDatum {
  function subpattern (line 25) | pub fn subpattern(&self, i: usize) -> &[MatchData<'data>] {
  type MatchCtx (line 30) | struct MatchCtx<'data> {
  type Result (line 34) | type Result<T> = result::Result<T, ()>;
  function new (line 37) | fn new() -> Self {
  function match_ident (line 43) | fn match_ident(&mut self, pattern_ident: &'data Ident, arg: &'data NsDat...
  function match_datum (line 55) | fn match_datum(&mut self, pattern: &'data NsDatum, arg: &'data NsDatum) ...
  function match_zero_or_more (line 79) | fn match_zero_or_more(&mut self, pattern: &'data NsDatum, args: &'data [...
  function match_slice (line 104) | fn match_slice(&mut self, mut patterns: &'data [NsDatum], mut args: &'da...
  function visit_rule (line 144) | fn visit_rule(
  function match_rule (line 157) | pub fn match_rule<'data>(

FILE: compiler/hir/macros/mod.rs
  type Rule (line 18) | pub struct Rule {
  type Macro (line 26) | pub struct Macro {
    method new (line 31) | pub fn new(rules: Box<[Rule]>) -> Arc<Self> {
  function starts_with_zero_or_more (line 36) | fn starts_with_zero_or_more(data: &[NsDatum]) -> bool {
  function get_escaped_ident (line 43) | fn get_escaped_ident(data: &[NsDatum]) -> Option<&Ident> {
  function lower_macro_rule_datum (line 54) | fn lower_macro_rule_datum(
  function lower_macro_rules (line 97) | pub fn lower_macro_rules(
  function expand_macro (line 110) | pub fn expand_macro<'s, 'p>(

FILE: compiler/hir/mod.rs
  type DeclTy (line 34) | pub enum DeclTy {
    method from (line 40) | fn from(ty: Ty<ty::Poly>) -> Self {
    method from (line 46) | fn from(poly: ty::Ref<ty::Poly>) -> Self {
  type DeclPurity (line 56) | pub enum DeclPurity {
    method from (line 62) | fn from(poly: purity::Ref) -> Self {
    method from (line 69) | fn from(purity: purity::Purity) -> Self {
  type Phase (line 74) | pub trait Phase: Clone + std::cmp::PartialEq + std::fmt::Debug {
    type Purity (line 84) | type Purity = purity::Ref;
    type DeclType (line 85) | type DeclType = ty::Ref<ty::Poly>;
    type ResultType (line 86) | type ResultType = ty::Ref<ty::Poly>;
    type TyArgs (line 87) | type TyArgs = ty::ty_args::TyArgs<ty::Poly>;
    type Purity (line 93) | type Purity = DeclPurity;
    type DeclType (line 94) | type DeclType = DeclTy;
    type ResultType (line 95) | type ResultType = ();
    type TyArgs (line 96) | type TyArgs = ();
  type Inferred (line 82) | pub struct Inferred {}
  type Lowered (line 91) | pub struct Lowered {}
  type Fun (line 100) | pub struct Fun<P: Phase> {
  type Cond (line 116) | pub struct Cond<P: Phase> {
  type Let (line 124) | pub struct Let<P: Phase> {
  type App (line 132) | pub struct App<P: Phase> {
  type Recur (line 141) | pub struct Recur<P: Phase> {
  type FieldAccessor (line 148) | pub struct FieldAccessor {
  type Expr (line 155) | pub struct Expr<P: Phase> {
  function from (line 161) | fn from(datum: Datum) -> Expr<Lowered> {
  type ExprKind (line 167) | pub enum ExprKind<P: Phase> {
  function from (line 192) | fn from(kind: ExprKind<Lowered>) -> Expr<Lowered> {
  type Def (line 201) | pub struct Def<P: Phase> {

FILE: compiler/hir/ns.rs
  type Ident (line 11) | pub struct Ident {
    method new (line 17) | pub fn new(ns_id: NsId, data_name: DataStr) -> Ident {
    method ns_id (line 21) | pub fn ns_id(&self) -> NsId {
    method name (line 25) | pub fn name(&self) -> &DataStr {
    method into_name (line 29) | pub fn into_name(self) -> DataStr {
    method is_underscore (line 33) | pub fn is_underscore(&self) -> bool {
    method is_ellipsis (line 37) | pub fn is_ellipsis(&self) -> bool {
    method is_ampersand (line 41) | pub fn is_ampersand(&self) -> bool {
    method with_ns_id (line 45) | pub fn with_ns_id(&self, new_ns_id: NsId) -> Ident {
  type NsDatum (line 54) | pub enum NsDatum {
    method map_syntax_data (line 69) | fn map_syntax_data(vs: &[Datum]) -> Box<[NsDatum]> {
    method from_syntax_datum (line 73) | pub fn from_syntax_datum(value: &Datum) -> NsDatum {
    method map_nsdata (line 99) | fn map_nsdata(vs: Box<[NsDatum]>) -> Box<[Datum]> {
    method into_syntax_datum (line 106) | pub fn into_syntax_datum(self) -> Datum {
    method span (line 128) | pub fn span(&self) -> Span {
    method description (line 144) | pub fn description(&self) -> &'static str {
  type NsDataIter (line 174) | pub type NsDataIter = vec::IntoIter<NsDatum>;

FILE: compiler/hir/records.rs
  type LoweredRecordCons (line 15) | enum LoweredRecordCons {
  function lower_record_field_decl (line 20) | fn lower_record_field_decl(scope: &Scope<'_>, field_datum: NsDatum) -> R...
  function lower_record_cons_decl (line 53) | fn lower_record_cons_decl<F>(cons_datum: NsDatum, error_kind_cons: F) ->...
  function lower_record (line 81) | pub fn lower_record(

FILE: compiler/hir/scope.rs
  type Binding (line 17) | pub enum Binding {
    method description (line 32) | pub fn description(&self) -> &'static str {
    method import_from (line 46) | pub fn import_from(&self, module_id: ModuleId) -> Binding {
  type SpannedBinding (line 55) | pub struct SpannedBinding {
  type Scope (line 60) | pub struct Scope<'parent> {
  function root_ns_id (line 68) | pub fn root_ns_id() -> NsId {
  function new_with_entries (line 73) | pub fn new_with_entries<I>(entries: I) -> Scope<'static>
  function root (line 97) | pub fn root() -> Scope<'static> {
  function new_with_primitives (line 104) | pub fn new_with_primitives() -> Scope<'static> {
  function child (line 116) | pub fn child(&'parent self) -> Scope<'parent> {
  function get_datum (line 127) | pub fn get_datum<'a>(&'a self, datum: &NsDatum) -> Option<&'a Binding> {
  function get (line 136) | pub fn get<'a>(&'a self, ident: &Ident) -> Option<&'a Binding> {
  function get_or_err (line 147) | pub fn get_or_err<'a>(&'a self, span: Span, ident: &Ident) -> Result<&'a...
  function insert_binding (line 153) | pub fn insert_binding(
  function insert_bindings (line 163) | pub fn insert_bindings<I>(&mut self, span: Span, new_bindings: I) -> Res...
  function replace_binding (line 193) | pub fn replace_binding(&mut self, span: Span, ident: Ident, binding: Bin...
  function insert_local (line 203) | pub fn insert_local(
  function bound_idents (line 213) | pub fn bound_idents(&self) -> impl Iterator<Item = &Ident> {
  function alloc_ns_id (line 220) | pub fn alloc_ns_id(&mut self) -> NsId {
  function into_exported_bindings (line 227) | pub fn into_exported_bindings(self) -> HashMap<Ident, SpannedBinding> {
  function import_bindings (line 231) | pub fn import_bindings(

FILE: compiler/hir/types.rs
  type TyCons (line 20) | pub enum TyCons {
  type PolymorphicVar (line 32) | pub enum PolymorphicVar {
  type LoweredPolymorphicVar (line 39) | struct LoweredPolymorphicVar {
  function lower_polymorphic_var (line 44) | fn lower_polymorphic_var(scope: &Scope<'_>, tvar_datum: NsDatum) -> Resu...
  function lower_list_cons (line 122) | fn lower_list_cons(scope: &Scope<'_>, mut arg_iter: NsDataIter) -> Resul...
  function lower_fun_cons (line 137) | fn lower_fun_cons(
  function lower_ty_cons_apply (line 162) | fn lower_ty_cons_apply(
  function lower_record_ty_cons_purity_arg (line 213) | fn lower_record_ty_cons_purity_arg(
  function lower_record_ty_cons_apply (line 231) | fn lower_record_ty_cons_apply(
  function lower_literal_vec (line 297) | fn lower_literal_vec(literal_data: Vec<NsDatum>) -> Result<Vec<ty::Ref<t...
  function lower_literal (line 301) | fn lower_literal(datum: NsDatum) -> Result<ty::Ref<ty::Poly>> {
  function lower_ident (line 318) | fn lower_ident(scope: &Scope<'_>, span: Span, ident: &Ident) -> Result<t...
  function lower_polymorphic_poly (line 327) | fn lower_polymorphic_poly(
  function lower_poly_data_iter (line 363) | fn lower_poly_data_iter(
  function lower_poly (line 408) | pub fn lower_poly(scope: &Scope<'_>, datum: NsDatum) -> Result<ty::Ref<t...
  function bind_polymorphic_vars (line 416) | fn bind_polymorphic_vars(
  function lower_polymorphic_var_set (line 441) | pub fn lower_polymorphic_var_set(
  function lower_polymorphic_var_list (line 472) | pub fn lower_polymorphic_var_list(
  function try_lower_purity (line 490) | pub fn try_lower_purity(scope: &Scope<'_>, datum: &NsDatum) -> Option<pu...
  constant TY_EXPORTS (line 521) | pub const TY_EXPORTS: &[(&str, Binding)] = &[
  function push_list_parts (line 560) | fn push_list_parts<M: ty::Pm>(list_parts: &mut Vec<String>, list_ref: &t...
  function str_for_bounds (line 572) | fn str_for_bounds(bound_pvars: &[purity::PVarId], bound_tvars: &[ty::TVa...
  function str_for_record_poly_arg (line 589) | fn str_for_record_poly_arg<M: ty::Pm>(
  function str_for_ty (line 603) | fn str_for_ty<M: ty::Pm>(ty: &Ty<M>) -> String {
  function str_for_ty_ref (line 716) | pub fn str_for_ty_ref<M: ty::Pm>(ty_ref: &ty::Ref<M>) -> String {
  function str_for_purity (line 723) | pub fn str_for_purity(purity: &purity::Ref) -> String {
  function poly_for_str (line 732) | pub fn poly_for_str(datum_str: &str) -> ty::Ref<ty::Poly> {
  function tvar_bounded_by (line 757) | pub fn tvar_bounded_by(bound: ty::Ref<ty::Poly>) -> ty::Ref<ty::Poly> {
  function assert_ty_for_str (line 770) | fn assert_ty_for_str(expected: Ty<ty::Poly>, datum_str: &str) {
  function assert_exact_str_repr (line 780) | fn assert_exact_str_repr(datum_str: &str) {
  function true_literal (line 785) | fn true_literal() {
  function false_literal (line 793) | fn false_literal() {
  function sym_literal (line 801) | fn sym_literal() {
  function keyword_literal (line 809) | fn keyword_literal() {
  function empty_list_literal (line 820) | fn empty_list_literal() {
  function quoted_list_literal (line 828) | fn quoted_list_literal() {
  function empty_vector_literal (line 841) | fn empty_vector_literal() {
  function vector_literal (line 849) | fn vector_literal() {
  function ty_ref (line 861) | fn ty_ref() {
  function fixed_list_cons (line 869) | fn fixed_list_cons() {
  function rest_list_cons (line 882) | fn rest_list_cons() {
  function vectorof_cons (line 895) | fn vectorof_cons() {
  function vector_cons (line 905) | fn vector_cons() {
  function pure_fun (line 917) | fn pure_fun() {
  function impure_fun (line 931) | fn impure_fun() {
  function fixed_fun (line 945) | fn fixed_fun() {
  function rest_impure_fun (line 959) | fn rest_impure_fun() {
  function top_impure_fun (line 973) | fn top_impure_fun() {
  function type_predicate (line 982) | fn type_predicate() {
  function equality_predicate (line 990) | fn equality_predicate() {
  function set_cons (line 998) | fn set_cons() {
  function map_cons (line 1008) | fn map_cons() {
  function merged_union_cons (line 1019) | fn merged_union_cons() {
  function simpifying_str_for_ty_ref (line 1027) | fn simpifying_str_for_ty_ref() {
  function polymorphic_fun_str (line 1035) | fn polymorphic_fun_str() {
  function singleton_record_type (line 1040) | fn singleton_record_type() {
  function poly_record_type (line 1058) | fn poly_record_type() {

FILE: compiler/hir/util.rs
  function try_take_rest_arg (line 10) | pub fn try_take_rest_arg(data_iter: &mut NsDataIter) -> Option<NsDatum> {
  function expect_arg_count (line 29) | pub fn expect_arg_count(
  function expect_one_arg (line 44) | pub fn expect_one_arg(span: Span, mut iter: NsDataIter) -> Result<NsDatu...
  function expect_spanned_ns_ident (line 49) | pub fn expect_spanned_ns_ident(datum: NsDatum, usage: &'static str) -> R...
  function expect_ns_ident (line 66) | pub fn expect_ns_ident(datum: NsDatum, usage: &'static str) -> Result<Id...
  function expect_spanned_ident (line 70) | pub fn expect_spanned_ident<'a>(
  function expect_ident (line 92) | pub fn expect_ident<'a>(datum: &'a Datum, usage: &'static str) -> Result...

FILE: compiler/hir/var_id.rs
  type LocalId (line 10) | pub struct LocalId(NonZeroU32);
  type ExportId (line 14) | pub struct ExportId(ModuleId, LocalId);
    method new (line 17) | pub fn new(module_id: ModuleId, local_id: LocalId) -> Self {
    method module_id (line 21) | pub fn module_id(self) -> ModuleId {
    method local_id (line 25) | pub fn local_id(self) -> LocalId {
  type LocalIdAlloc (line 30) | pub struct LocalIdAlloc {
    method new (line 35) | pub fn new() -> Self {
    method alloc (line 42) | pub fn alloc(&self) -> LocalId {
    method alloc_mut (line 47) | pub fn alloc_mut(&mut self) -> LocalId {

FILE: compiler/hir/visitor.rs
  function visit_exprs (line 4) | pub fn visit_exprs<'a, P: hir::Phase, F>(expr: &'a hir::Expr<P>, visitor...

FILE: compiler/id_type.rs
  type ArcId (line 125) | pub struct ArcId<T> {
  function new (line 130) | pub fn new(value: T) -> Self {
  method clone (line 138) | fn clone(&self) -> Self {
  type Target (line 146) | type Target = T;
  function deref (line 148) | fn deref(&self) -> &T {
  method eq (line 154) | fn eq(&self, other: &Self) -> bool {
  function hash (line 162) | fn hash<H: hash::Hasher>(&self, state: &mut H) {
  method partial_cmp (line 168) | fn partial_cmp(&self, other: &ArcId<T>) -> Option<std::cmp::Ordering> {
  method cmp (line 174) | fn cmp(&self, other: &ArcId<T>) -> std::cmp::Ordering {
  function fmt (line 180) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {

FILE: compiler/lib.rs
  type EvaluableProgram (line 38) | pub struct EvaluableProgram {
  function include_imports (line 45) | fn include_imports(
  function program_to_evaluable (line 71) | pub fn program_to_evaluable(

FILE: compiler/mir/app_purity.rs
  function resolve_ref_to_purity (line 7) | fn resolve_ref_to_purity(
  function fun_app_purity (line 24) | pub fn fun_app_purity(

FILE: compiler/mir/arg_list.rs
  type LoadedArgList (line 12) | pub struct LoadedArgList {
  function build_load_arg_list_value (line 26) | pub fn build_load_arg_list_value(
  function build_save_arg_list_to_regs (line 87) | pub fn build_save_arg_list_to_regs<'a>(

FILE: compiler/mir/builder.rs
  type Builder (line 7) | pub struct Builder {
    method new (line 50) | pub fn new() -> Builder {
    method alloc_local (line 54) | pub fn alloc_local(&mut self) -> BuiltReg {
    method push_reg (line 58) | pub fn push_reg<F, P>(&mut self, span: Span, kind_cons: F, kind_param:...
    method push (line 75) | pub fn push(&mut self, span: Span, kind: OpKind) {
    method append (line 79) | pub fn append(&mut self, ops: impl IntoIterator<Item = Op>) {
    method into_ops (line 83) | pub fn into_ops(self) -> Box<[Op]> {
    method push_cond (line 87) | pub fn push_cond<T, F>(
    method cast_boxed (line 122) | pub fn cast_boxed(
    method cast_boxed_cond (line 142) | pub fn cast_boxed_cond(
  type BuiltReg (line 12) | pub enum BuiltReg {
    method into_reg_id (line 18) | pub fn into_reg_id(self) -> RegId {
    method is_const (line 24) | pub fn is_const(self) -> bool {
    method fmt (line 39) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  method from (line 33) | fn from(built_reg: BuiltReg) -> RegId {
  method default (line 158) | fn default() -> Builder {
  type TryToBuilder (line 163) | pub trait TryToBuilder {
    method try_to_builder (line 164) | fn try_to_builder(&mut self) -> Option<&mut Builder>;
    method try_to_builder (line 168) | fn try_to_builder(&mut self) -> Option<&mut Builder> {
    method try_to_builder (line 174) | fn try_to_builder(&mut self) -> Option<&mut Builder> {

FILE: compiler/mir/costing.rs
  type OpCost (line 4) | pub type OpCost = u32;
  type OpCostFactor (line 7) | pub type OpCostFactor = f32;
  function cost_for_op_category (line 13) | pub fn cost_for_op_category(category: ops::OpCategory) -> OpCost {
  function cost_for_op (line 35) | fn cost_for_op(op: &ops::Op) -> OpCost {
  function cost_for_ops (line 67) | pub fn cost_for_ops<'o>(ops: impl Iterator<Item = &'o ops::Op>) -> OpCost {

FILE: compiler/mir/env_values.rs
  type Values (line 13) | type Values = Box<[(hir::LocalId, Value)]>;
  type CapturesRepr (line 17) | enum CapturesRepr {
  type EnvValues (line 25) | pub struct EnvValues {
    method empty (line 32) | pub fn empty() -> EnvValues {
  function can_reference_local_regs (line 41) | fn can_reference_local_regs(value: &Value) -> bool {
  function calculate_env_values (line 60) | pub fn calculate_env_values(
  function save_to_captures_reg (line 116) | pub fn save_to_captures_reg(
  function load_from_current_fun (line 163) | pub fn load_from_current_fun(
  function load_from_env_param (line 177) | pub fn load_from_env_param(

FILE: compiler/mir/equality.rs
  type EqualityResult (line 19) | pub enum EqualityResult {
    method from_bool_reg (line 25) | fn from_bool_reg(reg: BuiltReg) -> EqualityResult {
  method from (line 31) | fn from(er: EqualityResult) -> Value {
  function runtime_compare (line 40) | fn runtime_compare(
  function build_native_compare (line 83) | fn build_native_compare<F>(
  function build_record_equality (line 108) | fn build_record_equality(
  function build_bool_equality (line 210) | fn build_bool_equality(
  function values_statically_equal (line 280) | pub fn values_statically_equal(
  function eval_equality (line 353) | pub fn eval_equality(

FILE: compiler/mir/error.rs
  type Panic (line 11) | pub struct Panic {
    method new (line 17) | pub fn new(span: Span, message: String) -> Panic {
    method fmt (line 77) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type Error (line 26) | pub enum Error {
    method with_macro_invocation_span (line 37) | pub fn with_macro_invocation_span(self, span: Span) -> Error {
  type Result (line 34) | pub type Result<T> = result::Result<T, Error>;
  function from (line 49) | fn from(error: Error) -> Self {
  function from (line 69) | fn from(error: Error) -> Self {

FILE: compiler/mir/eval_hir.rs
  type RustFunKey (line 38) | struct RustFunKey {
  type ArretFunKey (line 44) | struct ArretFunKey {
  type EvaledRecordClass (line 50) | pub struct EvaledRecordClass {
  type EvalHirCtx (line 56) | pub struct EvalHirCtx {
    method new (line 199) | pub fn new(optimising: bool) -> EvalHirCtx {
    method destruc_scalar (line 223) | fn destruc_scalar<F>(
    method destruc_list (line 235) | fn destruc_list<F>(
    method destruc_value (line 256) | fn destruc_value<F>(
    method destruc_source_name (line 272) | fn destruc_source_name(destruc: &hir::destruc::Destruc<hir::Inferred>)...
    method eval_local_ref (line 281) | fn eval_local_ref(&self, fcx: &FunCtx<'_>, local_id: hir::LocalId) -> ...
    method eval_do (line 298) | fn eval_do(
    method eval_let (line 311) | fn eval_let(
    method eval_lit (line 327) | fn eval_lit(&mut self, literal: &Datum) -> Value {
    method synthetic_funs (line 331) | pub(super) fn synthetic_funs(&mut self) -> &mut SyntheticFuns {
    method build_arret_fun_app (line 335) | pub(super) fn build_arret_fun_app(
    method inline_arret_fun_app (line 409) | pub(super) fn inline_arret_fun_app(
    method eval_arret_fun_app (line 449) | fn eval_arret_fun_app(
    method eval_ty_pred_app (line 477) | fn eval_ty_pred_app(
    method eval_eq_pred_app (line 490) | fn eval_eq_pred_app(
    method eval_record_cons_app (line 506) | fn eval_record_cons_app(
    method eval_field_accessor_app (line 524) | fn eval_field_accessor_app(
    method rust_fun_to_jit_boxed (line 540) | pub fn rust_fun_to_jit_boxed(&mut self, rust_fun: Arc<rfi::Fun>) -> Gc...
    method jit_thunk_for_rust_fun (line 551) | fn jit_thunk_for_rust_fun(&mut self, rust_fun: &rfi::Fun) -> boxed::Th...
    method register_rust_fun_with_jit (line 580) | pub fn register_rust_fun_with_jit(&mut self, rust_fun: &rfi::Fun) {
    method id_for_rust_fun (line 593) | fn id_for_rust_fun(
    method rust_fun_to_thunk_reg (line 618) | pub fn rust_fun_to_thunk_reg(
    method rust_fun_to_callback_reg (line 642) | pub fn rust_fun_to_callback_reg(
    method call_native_fun (line 667) | fn call_native_fun<F>(span: Span, block: F) -> Result<Value>
    method eval_rust_fun_app (line 687) | fn eval_rust_fun_app(
    method eval_const_fun_thunk_app (line 774) | fn eval_const_fun_thunk_app(
    method build_reg_fun_thunk_app (line 802) | fn build_reg_fun_thunk_app(
    method eval_value_app (line 855) | fn eval_value_app(
    method eval_app (line 908) | fn eval_app(
    method eval_recur (line 974) | fn eval_recur(
    method eval_cond (line 1111) | fn eval_cond(
    method build_cond_branch (line 1139) | fn build_cond_branch(
    method build_cond (line 1153) | fn build_cond(
    method eval_arret_fun (line 1282) | fn eval_arret_fun(
    method arret_fun_to_jit_boxed (line 1302) | pub fn arret_fun_to_jit_boxed(
    method jit_thunk_for_arret_fun (line 1322) | fn jit_thunk_for_arret_fun(&mut self, arret_fun: &value::ArretFun) -> ...
    method id_for_arret_fun (line 1350) | fn id_for_arret_fun(
    method evaled_record_class_for_cons (line 1375) | pub fn evaled_record_class_for_cons(
    method cons_for_jit_record_class_id (line 1414) | pub fn cons_for_jit_record_class_id(
    method arret_fun_to_thunk_reg (line 1421) | pub fn arret_fun_to_thunk_reg(
    method arret_fun_to_callback_reg (line 1459) | pub fn arret_fun_to_callback_reg(
    method ops_for_arret_fun (line 1488) | pub(super) fn ops_for_arret_fun(
    method ops_for_callback_to_thunk_adapter (line 1587) | fn ops_for_callback_to_thunk_adapter(
    method thunk_reg_to_callback_reg (line 1629) | pub fn thunk_reg_to_callback_reg(
    method jit_boxed_to_fun_value (line 1661) | pub fn jit_boxed_to_fun_value(&self, boxed_thunk: Gc<boxed::FunThunk>)...
    method visit_module_defs (line 1665) | pub fn visit_module_defs<'a>(
    method consume_module_defs (line 1693) | pub fn consume_module_defs(
    method should_collect (line 1721) | pub fn should_collect(&self) -> bool {
    method collect_garbage (line 1726) | pub fn collect_garbage(&mut self) {
    method eval_expr_with_source_name (line 1759) | fn eval_expr_with_source_name(
    method eval_expr (line 1800) | pub fn eval_expr(
    method consume_expr_with_source_name (line 1809) | fn consume_expr_with_source_name(
    method consume_expr (line 1824) | pub fn consume_expr(
    method eval_main_fun (line 1834) | pub fn eval_main_fun(&mut self, main_export_id: hir::ExportId) -> Resu...
    method into_built_program (line 1856) | pub fn into_built_program(mut self, main_export_id: hir::ExportId) -> ...
    method value_to_const (line 1885) | pub fn value_to_const(&mut self, value: &Value) -> Option<Gc<boxed::An...
  type TailCallCtx (line 78) | struct TailCallCtx {
  type RecurSelf (line 83) | struct RecurSelf<'af> {
  type FunCtx (line 90) | pub struct FunCtx<'rs> {
  function new (line 105) | pub fn new(module_id: Option<ModuleId>) -> FunCtx<'static> {
  function monomorphise (line 117) | pub fn monomorphise(&self, poly: &ty::Ref<ty::Poly>) -> ty::Ref<ty::Mono> {
  type BuiltCondBranch (line 122) | struct BuiltCondBranch {
  type BuiltProgram (line 127) | pub struct BuiltProgram {
    method is_empty (line 134) | pub fn is_empty(&self) -> bool {
  type ApplyArgs (line 146) | pub(super) struct ApplyArgs<'tyargs> {
  function merge_apply_purity_into_scope (line 151) | fn merge_apply_purity_into_scope(
  function merge_apply_ty_args_into_scope (line 172) | fn merge_apply_ty_args_into_scope(
  method as_heap (line 1892) | fn as_heap(&self) -> &boxed::Heap {
  method as_heap_mut (line 1896) | fn as_heap_mut(&mut self) -> &mut boxed::Heap {
  method as_interner (line 1902) | fn as_interner(&self) -> &Interner {

FILE: compiler/mir/inliner.rs
  constant MAX_INLINE_DEPTH (line 21) | const MAX_INLINE_DEPTH: usize = 16;
  type ApplyCookie (line 27) | pub struct ApplyCookie {
    method new (line 33) | pub fn new(heap: &Heap, arret_fun: &value::ArretFun, arg_list_value: &...
  type ApplyStack (line 44) | pub struct ApplyStack {
    method new (line 49) | pub fn new() -> ApplyStack {
    method with_apply_cookie (line 53) | fn with_apply_cookie(&self, apply_cookie: ApplyCookie) -> ApplyStack {
  function inline_preference_factor_for_value (line 75) | fn inline_preference_factor_for_value(arg_value: &Value) -> OpCostFactor {
  function inline_preference_factor_for_arg_list_value (line 94) | fn inline_preference_factor_for_arg_list_value(arg_list_value: &Value) -...
  function inline_preference_factor_for_env_values (line 107) | fn inline_preference_factor_for_env_values(env_values: &EnvValues) -> Op...
  function calc_inline_preference_factor (line 116) | fn calc_inline_preference_factor(
  function hash_value (line 128) | fn hash_value<H: Hasher>(heap: &Heap, value: &Value, state: &mut H) {
  function hash_for_arg_list_value (line 192) | fn hash_for_arg_list_value(heap: &Heap, arg_list_value: &Value) -> u64 {
  function cond_inline (line 217) | pub(super) fn cond_inline<'a>(

FILE: compiler/mir/intrinsic/bitwise.rs
  function fold_bitwise_operands (line 16) | fn fold_bitwise_operands<O>(
  function bit_shift_op (line 51) | fn bit_shift_op<O>(
  function bit_and (line 90) | pub fn bit_and(
  function bit_or (line 107) | pub fn bit_or(
  function bit_xor (line 124) | pub fn bit_xor(
  function bit_not (line 141) | pub fn bit_not(
  function bit_shift_left (line 161) | pub fn bit_shift_left(
  function bit_shift_right (line 176) | pub fn bit_shift_right(
  function unsigned_bit_shift_right (line 191) | pub fn unsigned_bit_shift_right(

FILE: compiler/mir/intrinsic/list.rs
  function length (line 11) | pub fn length(
  function cons (line 57) | pub fn cons(
  function repeat (line 71) | pub fn repeat(

FILE: compiler/mir/intrinsic/math.rs
  function fold_float_operands (line 40) | fn fold_float_operands<F>(
  function fold_num_operands (line 70) | fn fold_num_operands<I, F>(
  function reduce_operands (line 132) | fn reduce_operands<I, F>(
  function reduce_assoc_operands (line 165) | fn reduce_assoc_operands<I, F>(
  function add (line 194) | pub fn add(
  function mul (line 212) | pub fn mul(
  function sub (line 230) | pub fn sub(
  function div (line 269) | pub fn div(
  function int_division_op (line 321) | fn int_division_op<CI, UI>(
  function quot (line 370) | pub fn quot(
  function rem (line 386) | pub fn rem(
  function sqrt (line 402) | pub fn sqrt(

FILE: compiler/mir/intrinsic/mod.rs
  type BuildOutcome (line 40) | pub enum BuildOutcome {

FILE: compiler/mir/intrinsic/num_utils.rs
  type NumOperand (line 14) | pub enum NumOperand {
    method try_from_value (line 23) | pub fn try_from_value(
  function num_value_to_float_reg (line 44) | pub fn num_value_to_float_reg(
  function try_value_to_i64 (line 121) | pub fn try_value_to_i64(value: Value) -> Option<i64> {

FILE: compiler/mir/intrinsic/number.rs
  function build_operand_pair_compare (line 19) | fn build_operand_pair_compare(
  function build_operand_iter_compare (line 80) | fn build_operand_iter_compare(
  function compare_operand_list (line 129) | fn compare_operand_list(
  function int (line 155) | pub fn int(
  function float (line 172) | pub fn float(
  function num_lt (line 189) | pub fn num_lt(
  function num_le (line 204) | pub fn num_le(
  function num_eq (line 219) | pub fn num_eq(
  function num_gt (line 234) | pub fn num_gt(
  function num_ge (line 249) | pub fn num_ge(

FILE: compiler/mir/intrinsic/panics.rs
  function panics (line 11) | pub fn panics(

FILE: compiler/mir/intrinsic/partial_print.rs
  type PartialPrint (line 11) | pub enum PartialPrint {
    method into_arg_list_value (line 18) | pub fn into_arg_list_value(self, ehx: &mut EvalHirCtx) -> Value {
  function partial_pretty_print (line 32) | pub fn partial_pretty_print(

FILE: compiler/mir/intrinsic/print.rs
  function print (line 14) | pub fn print(
  function print_str (line 29) | pub fn print_str(

FILE: compiler/mir/intrinsic/testing.rs
  function ideal_polymorph_abi_for_arret_fun (line 16) | fn ideal_polymorph_abi_for_arret_fun(arret_fun: &value::ArretFun) -> Pol...
  function add_ops_categories (line 27) | fn add_ops_categories<'a>(
  function op_category_to_string (line 41) | fn op_category_to_string(category: ops::OpCategory) -> &'static str {
  function fn_op_categories (line 60) | pub fn fn_op_categories(

FILE: compiler/mir/intrinsic/vector.rs
  function vector_length (line 13) | pub fn vector_length(
  function vector_ref (line 48) | pub fn vector_ref(

FILE: compiler/mir/mod.rs
  type Expr (line 29) | type Expr = hir::Expr<hir::Inferred>;

FILE: compiler/mir/ops.rs
  type CallConv (line 18) | pub enum CallConv {
  type OpsAbi (line 31) | pub struct OpsAbi {
    method thunk_abi (line 38) | pub fn thunk_abi() -> OpsAbi {
  type StaticSymbol (line 53) | pub struct StaticSymbol {
  type Callee (line 64) | pub enum Callee {
  type RecordStruct (line 74) | pub struct RecordStruct {
    method new (line 82) | pub fn new(source_name: DataStr, field_abi_types: Box<[abitype::AbiTyp...
  type RecordStructId (line 79) | pub type RecordStructId = ArcId<RecordStruct>;
  type CallOp (line 91) | pub struct CallOp {
  type TailCallOp (line 98) | pub struct TailCallOp {
  type BoxPairOp (line 104) | pub struct BoxPairOp {
  type BoxFunThunkOp (line 111) | pub struct BoxFunThunkOp {
  type BoxRecordOp (line 117) | pub struct BoxRecordOp {
  type LoadBoxedRecordFieldOp (line 123) | pub struct LoadBoxedRecordFieldOp {
  type LoadBoxedVectorMemberOp (line 130) | pub struct LoadBoxedVectorMemberOp {
  type CastBoxedOp (line 138) | pub struct CastBoxedOp {
  type RegPhi (line 144) | pub struct RegPhi {
  type CondOp (line 151) | pub struct CondOp {
  type BinaryOp (line 159) | pub struct BinaryOp {
  type CompareOp (line 165) | pub struct CompareOp {
  type LoadBoxedTypeTagOp (line 172) | pub struct LoadBoxedTypeTagOp {
  type LoadBoxedListLenOp (line 178) | pub struct LoadBoxedListLenOp {
  type MakeCallbackOp (line 184) | pub struct MakeCallbackOp {
  type ShiftOp (line 190) | pub struct ShiftOp {
  type Comparison (line 196) | pub enum Comparison {
  type OpKind (line 205) | pub enum OpKind {
    method output_reg (line 320) | pub fn output_reg(&self) -> Option<RegId> {
    method add_input_regs (line 405) | pub fn add_input_regs(&self, coll: &mut impl Extend<RegId>) {
    method const_output (line 586) | pub fn const_output(&self) -> bool {
    method has_side_effects (line 595) | pub fn has_side_effects(&self) -> bool {
    method is_terminator (line 610) | pub fn is_terminator(&self) -> bool {
    method category (line 615) | pub fn category(&self) -> OpCategory {
  type OpCategory (line 304) | pub enum OpCategory {
  type Op (line 709) | pub struct Op {
    method new (line 715) | pub fn new(span: Span, kind: OpKind) -> Op {
    method span (line 719) | pub fn span(&self) -> Span {
    method kind (line 723) | pub fn kind(&self) -> &OpKind {
    method from (line 744) | fn from(op_kind: OpKind) -> Self {
  type Fun (line 728) | pub struct Fun {
  function output_reg (line 750) | fn output_reg() {
  function has_side_effects (line 759) | fn has_side_effects() {
  function const_output (line 794) | fn const_output() {
  function ret_input_regs (line 818) | fn ret_input_regs() {
  function cond_input_regs (line 829) | fn cond_input_regs() {

FILE: compiler/mir/optimise/duplicate_alloc_ops.rs
  function visit_simple_alloc_op_kind (line 5) | fn visit_simple_alloc_op_kind(
  function remove_branch_redundant_alloc_ops (line 23) | fn remove_branch_redundant_alloc_ops(
  function remove_redundant_alloc_ops (line 58) | pub fn remove_redundant_alloc_ops(ops: &mut [ops::Op]) {
  function test_box_different_native_regs (line 70) | fn test_box_different_native_regs() {
  function test_box_same_native_regs (line 96) | fn test_box_same_native_regs() {
  function test_reboxing (line 127) | fn test_reboxing() {
  function test_cond_branch (line 157) | fn test_cond_branch() {

FILE: compiler/mir/optimise/mod.rs
  function optimise_fun (line 7) | pub fn optimise_fun(fun: ops::Fun) -> ops::Fun {
  function optimise_inlined_fun (line 18) | pub fn optimise_inlined_fun(ops: Box<[ops::Op]>, return_value: &Value) -...

FILE: compiler/mir/optimise/unused_ops.rs
  function remove_unused_cond_ops (line 6) | fn remove_unused_cond_ops(
  function remove_unused_branch_ops (line 57) | fn remove_unused_branch_ops(
  function remove_unused_fun_ops (line 94) | pub fn remove_unused_fun_ops(ops: Box<[ops::Op]>) -> Box<[ops::Op]> {
  function add_value_used_regs (line 101) | fn add_value_used_regs(value: &Value, used_regs: &mut HashSet<ops::RegId...
  function remove_unused_value_ops (line 134) | pub fn remove_unused_value_ops(ops: Box<[ops::Op]>, value: &Value) -> Bo...
  function empty_ops (line 146) | fn empty_ops() {
  function simple_unused (line 152) | fn simple_unused() {
  function fully_used_cond (line 175) | fn fully_used_cond() {
  function partially_used_cond (line 208) | fn partially_used_cond() {
  function output_only_cond (line 256) | fn output_only_cond() {
  function output_unused_cond (line 305) | fn output_unused_cond() {
  function fully_unused_cond (line 344) | fn fully_unused_cond() {

FILE: compiler/mir/polymorph.rs
  type PolymorphAbi (line 12) | pub struct PolymorphAbi {
    method thunk_abi (line 23) | pub fn thunk_abi() -> PolymorphAbi {
    method param_ty_ref (line 36) | pub fn param_ty_ref<M: ty::Pm>(&self) -> ty::List<M> {
    method from (line 61) | fn from(abi_type: callback::EntryPointAbiType) -> Self {
  function from (line 75) | fn from(polymorph_abi: PolymorphAbi) -> Self {
  function polymorph_abi_for_list_ty (line 91) | pub fn polymorph_abi_for_list_ty<M: ty::Pm>(
  function polymorph_abi_param_ty_ref (line 124) | fn polymorph_abi_param_ty_ref() {

FILE: compiler/mir/printer.rs
  function span_to_human_location (line 15) | fn span_to_human_location(source_loader: Option<&SourceLoader>, span: Sp...
  function private_fun_to_string (line 30) | fn private_fun_to_string(
  function callee_to_string (line 41) | fn callee_to_string(
  function callee_to_gen_abi (line 55) | fn callee_to_gen_abi(
  function box_pair_op_to_string (line 66) | fn box_pair_op_to_string(
  function box_fun_thunk_op_to_string (line 81) | fn box_fun_thunk_op_to_string(
  function box_record_op_to_string (line 95) | fn box_record_op_to_string(
  function comparison_to_str (line 116) | fn comparison_to_str(comparison: ops::Comparison) -> &'static str {
  function print_cond_branch (line 126) | fn print_cond_branch(
  function print_branch (line 146) | fn print_branch(
  function print_fun (line 881) | pub fn print_fun(
  function print_program (line 926) | pub fn print_program(

FILE: compiler/mir/record_field.rs
  function load_record_field (line 12) | pub fn load_record_field(

FILE: compiler/mir/ret_value.rs
  function build_value_ret (line 14) | pub fn build_value_ret(
  function ret_reg_to_value (line 43) | pub fn ret_reg_to_value(ret_reg: BuiltReg, ret_abi: abitype::RetAbiType)...

FILE: compiler/mir/rust_fun.rs
  function rust_fun_purity_upper_bound (line 16) | pub fn rust_fun_purity_upper_bound(rust_fun: &rfi::Fun) -> Purity {
  function build_rust_fun_app (line 28) | pub fn build_rust_fun_app(
  function ops_for_rust_fun (line 91) | pub fn ops_for_rust_fun(

FILE: compiler/mir/specific_abi_type.rs
  constant ANY_BOXED_ABI_TYPE (line 9) | const ANY_BOXED_ABI_TYPE: abitype::BoxedAbiType = abitype::BoxedAbiType:...
  constant TOP_RECORD_BOXED_ABI_TYPE (line 11) | const TOP_RECORD_BOXED_ABI_TYPE: abitype::BoxedAbiType =
  function specific_boxed_abi_type_for_type_tag (line 14) | fn specific_boxed_abi_type_for_type_tag(type_tag: TypeTag) -> &'static a...
  function specific_abi_type_for_type_tag (line 36) | fn specific_abi_type_for_type_tag(type_tag: TypeTag) -> abitype::AbiType {
  function specific_boxed_abi_type_for_type_tags (line 48) | fn specific_boxed_abi_type_for_type_tags(
  function specific_boxed_abi_type_for_ty_ref (line 68) | pub fn specific_boxed_abi_type_for_ty_ref<M: ty::Pm>(
  function specific_abi_type_for_type_tags (line 74) | fn specific_abi_type_for_type_tags(possible_type_tags: TypeTagSet) -> ab...
  function specific_abi_type_for_ty_ref (line 88) | pub fn specific_abi_type_for_ty_ref<M: ty::Pm>(ty_ref: &ty::Ref<M>) -> a...
  function specific_ret_abi_type_for_ty_ref (line 116) | pub fn specific_ret_abi_type_for_ty_ref<M: ty::Pm>(ty_ref: &ty::Ref<M>) ...
  function specific_type_for_values (line 124) | fn specific_type_for_values<'v, F, T>(
  function specific_boxed_abi_type_for_values (line 141) | pub fn specific_boxed_abi_type_for_values<'v>(
  function specific_abi_type_for_values (line 148) | pub fn specific_abi_type_for_values<'v>(
  function specific_abi_type_for_value (line 155) | pub fn specific_abi_type_for_value(value: &Value) -> abitype::AbiType {
  function assert_abi_type_for_str (line 166) | fn assert_abi_type_for_str(abi_type: abitype::AbiType, ty_str: &'static ...
  function test_specific_abi_type_for_ty_ref (line 172) | fn test_specific_abi_type_for_ty_ref() {

FILE: compiler/mir/tagset.rs
  constant INNER_BITS (line 8) | const INNER_BITS: u8 = 32;
  type Inner (line 9) | type Inner = u32;
  type TypeTagSet (line 12) | pub struct TypeTagSet(Inner);
    method new (line 16) | pub fn new() -> TypeTagSet {
    method all (line 20) | pub fn all() -> TypeTagSet {
    method is_empty (line 24) | pub fn is_empty(self) -> bool {
    method len (line 28) | pub fn len(self) -> usize {
    method insert (line 32) | pub fn insert(&mut self, type_tag: TypeTag) {
    method is_subset (line 38) | pub fn is_subset(self, superset: Self) -> bool {
    method is_disjoint (line 42) | pub fn is_disjoint(self, other: Self) -> bool {
    method intersection (line 46) | pub fn intersection(self, other: Self) -> TypeTagSet {
    method union (line 50) | pub fn union(self, other: Self) -> TypeTagSet {
    method contains (line 54) | pub fn contains(self, type_tag: TypeTag) -> bool {
    method into_iter (line 62) | pub fn into_iter(self) -> impl Iterator<Item = TypeTag> {
    method fmt (line 71) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::E...
    method from (line 79) | fn from(type_tag: TypeTag) -> TypeTagSet {
    method from (line 90) | fn from(ty_ref: &'a ty::Ref<M>) -> TypeTagSet {
    method from (line 129) | fn from(boxed_abi_type: &'a abitype::BoxedAbiType) -> TypeTagSet {
    method from (line 146) | fn from(abi_type: &'a abitype::AbiType) -> TypeTagSet {
    method from (line 162) | fn from(abi_type: abitype::AbiType) -> TypeTagSet {
    method from_iter (line 168) | fn from_iter<I: IntoIterator<Item = TypeTag>>(iter: I) -> TypeTagSet {
    method from_iter (line 178) | fn from_iter<I: IntoIterator<Item = &'a TypeTag>>(iter: I) -> TypeTagS...
    type Output (line 184) | type Output = Self;
    method bitor (line 186) | fn bitor(self, rhs: Self) -> Self {
    type Output (line 192) | type Output = Self;
    method bitand (line 194) | fn bitand(self, rhs: Self) -> Self {
  function basic_operations (line 206) | fn basic_operations() {
  function set_into_iter (line 238) | fn set_into_iter() {
  function from_ty_ref (line 261) | fn from_ty_ref() {

FILE: compiler/mir/typred.rs
  function type_tags_for_test_ty (line 20) | fn type_tags_for_test_ty(test_ty: &ty::pred::TestTy) -> TypeTagSet {
  function build_load_type_tag (line 48) | fn build_load_type_tag(
  function build_is_type_tag (line 67) | fn build_is_type_tag(
  function eval_tagged_ty_pred (line 85) | fn eval_tagged_ty_pred(
  function eval_record_ty_pred (line 150) | fn eval_record_ty_pred(
  function eval_ty_pred (line 285) | pub fn eval_ty_pred(

FILE: compiler/mir/value/arret_fun.rs
  type ArretFunConsts (line 14) | struct ArretFunConsts {
  type ArretFun (line 23) | pub struct ArretFun {
    method new (line 29) | pub fn new(
    method id (line 48) | pub fn id(&self) -> ArretFunId {
    method module_id (line 55) | pub fn module_id(&self) -> Option<ModuleId> {
    method source_name (line 59) | pub fn source_name(&self) -> &Option<DataStr> {
    method env_ty_args (line 63) | pub fn env_ty_args(&self) -> &TyArgs<ty::Mono> {
    method env_values (line 67) | pub fn env_values(&self) -> &EnvValues {
    method env_values_mut (line 71) | pub fn env_values_mut(&mut self) -> &mut EnvValues {
    method fun_expr (line 75) | pub fn fun_expr(&self) -> &hir::Fun<hir::Inferred> {
    method with_env_values (line 79) | pub fn with_env_values(&self, env_values: EnvValues) -> ArretFun {
    method has_multiple_usages (line 90) | pub fn has_multiple_usages(&self) -> bool {

FILE: compiler/mir/value/build_reg.rs
  type RestLen (line 15) | enum RestLen {
  function const_to_reg (line 20) | fn const_to_reg(
  function list_to_reg (line 257) | fn list_to_reg(
  function record_to_reg (line 352) | fn record_to_reg(
  function record_field_value_to_const_reg (line 393) | fn record_field_value_to_const_reg(
  function reg_to_boxed_reg (line 419) | pub fn reg_to_boxed_reg(
  function boxed_to_bool (line 490) | fn boxed_to_bool(
  function reg_to_reg (line 532) | fn reg_to_reg(
  function thunk_reg_to_reg (line 575) | fn thunk_reg_to_reg(
  function arret_fun_to_reg (line 591) | fn arret_fun_to_reg(
  function rust_fun_to_reg (line 612) | fn rust_fun_to_reg(
  function value_to_reg (line 633) | pub fn value_to_reg(

FILE: compiler/mir/value/from_reg.rs
  function reg_to_value_with_constraints (line 13) | fn reg_to_value_with_constraints<M>(
  function reg_to_value (line 57) | pub fn reg_to_value<M>(
  function refine_reg_value_with_arret_ty (line 76) | pub fn refine_reg_value_with_arret_ty<M>(

FILE: compiler/mir/value/list.rs
  type ListValueLen (line 11) | pub enum ListValueLen {
    method lower_bound (line 17) | pub fn lower_bound(&self) -> usize {
    type Output (line 26) | type Output = ListValueLen;
    method add (line 28) | fn add(self, other: ListValueLen) -> ListValueLen {
  function list_value_len (line 39) | pub fn list_value_len(value: &Value) -> ListValueLen {
  type UnsizedListIterator (line 77) | pub struct UnsizedListIterator {
    method new (line 83) | pub fn new(value: Value) -> Self {
    method next_unchecked (line 95) | pub fn next_unchecked(&mut self, b: &mut impl TryToBuilder, span: Span...
    method into_rest (line 142) | pub fn into_rest(self) -> Value {
    method build_rest_next (line 146) | fn build_rest_next(
  type SizedListIterator (line 169) | pub struct SizedListIterator {
    method try_new (line 175) | pub fn try_new(value: &Value) -> Option<Self> {
    method next (line 187) | pub fn next(&mut self, b: &mut impl TryToBuilder, span: Span) -> Optio...
    method into_rest (line 197) | pub fn into_rest(self) -> Value {
    method len (line 201) | pub fn len(&self) -> usize {
    method is_empty (line 205) | pub fn is_empty(&self) -> bool {
  function list_len (line 220) | fn list_len() {
  function const_unsized_list_iter (line 290) | fn const_unsized_list_iter() {
  function fixed_list_value_unsized_iter (line 316) | fn fixed_list_value_unsized_iter() {

FILE: compiler/mir/value/mod.rs
  type RegValue (line 26) | pub struct RegValue {
    method new (line 34) | pub fn new(reg: BuiltReg, abi_type: abitype::AbiType) -> RegValue {
  type Value (line 45) | pub enum Value {
    method unsized_list_iter (line 61) | pub fn unsized_list_iter(&self) -> list::UnsizedListIterator {
    method into_unsized_list_iter (line 65) | pub fn into_unsized_list_iter(self) -> list::UnsizedListIterator {
    method try_sized_list_iter (line 69) | pub fn try_sized_list_iter(&self) -> Option<list::SizedListIterator> {
    method from (line 75) | fn from(boxed_ref: Gc<T>) -> Self {
    method from (line 81) | fn from(reg_value: RegValue) -> Self {
  function visit_value_root (line 86) | pub fn visit_value_root(strong_pass: &mut boxed::collect::StrongPass, va...

FILE: compiler/mir/value/plan_phi.rs
  function plan_phi_abi_type (line 6) | pub fn plan_phi_abi_type(lhs: &Value, rhs: &Value) -> abitype::AbiType {

FILE: compiler/mir/value/synthetic_fun.rs
  type ExprParam (line 18) | struct ExprParam {
  function wrap_poly_expr_in_arret_fun (line 23) | fn wrap_poly_expr_in_arret_fun(
  function wrap_mono_expr_in_arret_fun (line 97) | fn wrap_mono_expr_in_arret_fun(
  function new_eq_pred_arret_fun (line 114) | fn new_eq_pred_arret_fun(span: Span) -> value::ArretFun {
  function new_ty_pred_arret_fun (line 140) | fn new_ty_pred_arret_fun(span: Span, test_ty: ty::pred::TestTy) -> value...
  function new_record_cons_arret_fun (line 160) | fn new_record_cons_arret_fun(span: Span, cons: &record::ConsId) -> value...
  function new_field_accessor_arret_fun (line 193) | fn new_field_accessor_arret_fun(
  type SyntheticFuns (line 231) | pub struct SyntheticFuns {
    method new (line 239) | pub fn new() -> Self {
    method eq_pred_arret_fun (line 248) | pub fn eq_pred_arret_fun(&mut self) -> &value::ArretFun {
    method ty_pred_arret_fun (line 253) | pub fn ty_pred_arret_fun(&mut self, test_ty: ty::pred::TestTy) -> &val...
    method record_cons_arret_fun (line 259) | pub fn record_cons_arret_fun(&mut self, cons: &record::ConsId) -> &val...
    method field_accessor_arret_fun (line 265) | pub fn field_accessor_arret_fun(

FILE: compiler/mir/value/to_const.rs
  function record_to_const (line 12) | fn record_to_const(
  function list_to_const (line 96) | pub fn list_to_const(
  function value_to_const (line 126) | pub fn value_to_const(ehx: &mut EvalHirCtx, value: &Value) -> Option<Gc<...

FILE: compiler/mir/value/types.rs
  type TypeHint (line 21) | pub enum TypeHint {
  type FoundRecordConses (line 36) | enum FoundRecordConses<'a> {
  function find_record_conses_for_ty_ref (line 43) | fn find_record_conses_for_ty_ref<M>(ty_ref: &ty::Ref<M>) -> FoundRecordC...
  function type_hint_for_ty_ref (line 79) | pub fn type_hint_for_ty_ref<M>(ty_ref: &ty::Ref<M>) -> TypeHint
  function known_record_cons_for_value (line 102) | pub fn known_record_cons_for_value<'a>(
  function known_vector_len_for_value (line 123) | pub fn known_vector_len_for_value(value: &Value) -> Option<usize> {
  function type_hint_for_value (line 139) | pub fn type_hint_for_value(ehx: &EvalHirCtx, value: &Value) -> TypeHint {
  function possible_type_tags_for_value (line 155) | pub fn possible_type_tags_for_value(value: &Value) -> TypeTagSet {
  function value_with_arret_ty (line 184) | pub fn value_with_arret_ty<F>(
  function test_find_record_conses_for_ty_ref (line 212) | fn test_find_record_conses_for_ty_ref() {

FILE: compiler/mir/vector_member.rs
  function vector_member_type (line 9) | fn vector_member_type(vector_value: &Value) -> &abitype::BoxedAbiType {
  function load_vector_member (line 24) | pub fn load_vector_member(

FILE: compiler/promise.rs
  type Inner (line 5) | struct Inner<T>
  type Completer (line 14) | struct Completer<T>
  function set (line 26) | pub fn set(self, new_value: T) {
  type Promise (line 40) | struct Promise<T>
  function value (line 52) | pub fn value(&self) -> T {
  function promise (line 67) | fn promise<T>() -> (Completer<T>, Promise<T>)
  function completed (line 85) | fn completed<T>(value: T) -> Promise<T>
  type PromiseMap (line 100) | pub struct PromiseMap<K, V>
  function new (line 114) | pub fn new(values: impl IntoIterator<Item = (K, V)>) -> Self {
  function get_or_insert_with (line 124) | pub fn get_or_insert_with<F>(&self, key: K, func: F) -> V

FILE: compiler/repl.rs
  type EvalKind (line 26) | pub enum EvalKind {
  type EvaledExprValue (line 37) | pub struct EvaledExprValue {
  type EvaledLine (line 52) | pub enum EvaledLine {
  type ReplEngine (line 69) | struct ReplEngine<'ccx> {
  function new (line 80) | fn new(ccx: &'ccx CompileCtx) -> Self {
  function bound_names (line 93) | fn bound_names(&self) -> Vec<DataStr> {
  function visit_module_tree (line 107) | fn visit_module_tree(
  function eval_line (line 131) | fn eval_line(
  type ReplCtx (line 255) | pub struct ReplCtx {
    method new (line 267) | pub fn new(ccx: Arc<CompileCtx>) -> Self {
    method send_line (line 295) | pub fn send_line(&self, input: String, kind: EvalKind) -> Result<(), E...
    method receive_result (line 304) | pub fn receive_result(&self) -> Result<EvaledLine, Vec<Diagnostic<File...
  type EngineDisconnected (line 261) | pub struct EngineDisconnected;
  function eval_line_sync (line 313) | fn eval_line_sync(
  function assert_defs (line 322) | fn assert_defs(rcx: &mut ReplCtx, line: &'static str) {
  function assert_empty (line 331) | fn assert_empty(rcx: &mut ReplCtx, line: &'static str) {
  function assert_expr (line 338) | fn assert_expr(
  function basic_session (line 365) | fn basic_session() {

FILE: compiler/reporting.rs
  type LocTrace (line 9) | pub struct LocTrace {
    method new (line 15) | pub fn new(origin: Span, macro_invocation: Option<Span>) -> LocTrace {
    method with_macro_invocation (line 22) | pub fn with_macro_invocation(self, macro_invocation: Span) -> LocTrace {
    method origin (line 29) | pub fn origin(&self) -> Span {
    method macro_invocation (line 33) | pub fn macro_invocation(&self) -> Option<Span> {
    method label_macro_invocation (line 37) | pub fn label_macro_invocation(&self, mut diagnostic: Diagnostic<FileId...
    method from (line 52) | fn from(span: Span) -> LocTrace {
  function errors_to_diagnostics (line 60) | pub fn errors_to_diagnostics<E: Into<Diagnostic<FileId>>>(
  function diagnostic_for_syntax_error (line 70) | pub fn diagnostic_for_syntax_error(error: &arret_syntax::error::Error) -...
  function new_primary_label (line 99) | pub fn new_primary_label(span: Span, message: impl Into<String>) -> Labe...
  function new_secondary_label (line 103) | pub fn new_secondary_label(span: Span, message: impl Into<String>) -> La...
  function emit_diagnostics_to_stderr (line 111) | pub fn emit_diagnostics_to_stderr(

FILE: compiler/rfi/mod.rs
  type Library (line 18) | pub struct Library {
    method fmt (line 25) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type Fun (line 31) | pub struct Fun {
    method intrinsic_name (line 48) | pub fn intrinsic_name(&self) -> Option<&'static str> {
    method span (line 52) | pub fn span(&self) -> Span {
    method arret_fun_type (line 56) | pub fn arret_fun_type(&self) -> &ty::Fun {
    method symbol (line 60) | pub fn symbol(&self) -> &'static str {
    method entry_point (line 64) | pub fn entry_point(&self) -> usize {
    method takes_task (line 68) | pub fn takes_task(&self) -> bool {
    method params (line 72) | pub fn params(&self) -> &'static [abitype::ParamAbiType] {
    method has_rest (line 76) | pub fn has_rest(&self) -> bool {
    method ret (line 80) | pub fn ret(&self) -> &'static abitype::RetAbiType {
  type Loader (line 85) | pub struct Loader {
    method new (line 151) | pub fn new() -> Loader {
    method process_rust_fun (line 157) | fn process_rust_fun(
    method load (line 249) | pub fn load(
  function ensure_types_compatible (line 93) | fn ensure_types_compatible<T>(
  type LibType (line 119) | enum LibType {
  function build_rfi_lib_path (line 124) | fn build_rfi_lib_path(base: &path::Path, package_name: &str, lib_type: L...
  function binding_fun_to_poly_type (line 347) | fn binding_fun_to_poly_type(rust_fun: &'static binding::RustFun) -> Resu...
  function assert_valid_binding_fun (line 356) | fn assert_valid_binding_fun(rust_fun: &'static binding::RustFun) {
  function assert_binding_fun_error (line 360) | fn assert_binding_fun_error(expected_kind: &ErrorKind, rust_fun: &'stati...
  function exact_rust_fun (line 368) | fn exact_rust_fun() {
  function inexact_rust_fun_with_rest (line 384) | fn inexact_rust_fun_with_rest() {
  function void_rust_fun (line 402) | fn void_rust_fun() {
  function diverging_fun (line 418) | fn diverging_fun() {
  function polymorphic_rust_fun (line 431) | fn polymorphic_rust_fun() {
  function incompatible_polymorphic_rust_fun (line 447) | fn incompatible_polymorphic_rust_fun() {
  function unbound_arret_type (line 466) | fn unbound_arret_type() {
  function non_fun_type (line 483) | fn non_fun_type() {
  function non_list_rust_rest_param (line 500) | fn non_list_rust_rest_param() {
  function mismatched_fixed_param_count (line 517) | fn mismatched_fixed_param_count() {
  function incompatible_fixed_param_type (line 541) | fn incompatible_fixed_param_type() {
  function incompatible_ret_type (line 560) | fn incompatible_ret_type() {

FILE: compiler/source.rs
  constant EMPTY_SPAN (line 11) | pub const EMPTY_SPAN: Span = Span::new(None, 0, 0);
  type SourceText (line 14) | pub enum SourceText {
    method as_ref (line 20) | fn as_ref(&self) -> &str {
    method from (line 29) | fn from(s: Arc<str>) -> Self {
    method from (line 35) | fn from(s: String) -> Self {
    method from (line 41) | fn from(s: &'static str) -> Self {
  type SourceFile (line 46) | pub struct SourceFile {
    method file_id (line 53) | pub fn file_id(&self) -> FileId {
    method source (line 57) | pub fn source(&self) -> &'_ str {
    method parsed (line 61) | pub fn parsed(&self) -> Result<&[Datum], arret_syntax::error::Error> {
    method fmt (line 70) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
  type ReportableFile (line 75) | struct ReportableFile {
    method name (line 82) | fn name(&self) -> String {
    method source (line 86) | fn source(&self) -> &str {
    method line_index (line 90) | fn line_index(&self, offset: usize) -> usize {
    method line_range (line 100) | fn line_range(&self, line_index: usize) -> Option<Range<usize>> {
  type SourceLoader (line 114) | pub struct SourceLoader {
    method new (line 119) | pub fn new() -> Self {
    method load_path (line 124) | pub fn load_path(&self, path: &path::Path) -> Result<SourceFile, io::E...
    method load_string (line 134) | pub fn load_string(&self, filename: OsString, source: impl Into<Source...
    method reserve (line 162) | pub fn reserve(&self, additional: usize) {
    method files (line 169) | pub fn files(&self) -> ReportableFiles<'_> {
  type ReportableFiles (line 176) | pub struct ReportableFiles<'a> {
  function get_file (line 181) | fn get_file(&self, file_id: FileId) -> Option<&ReportableFile> {
  type CodespanResult (line 186) | type CodespanResult<T> = Result<T, CodespanError>;
  type FileId (line 189) | type FileId = FileId;
  type Source (line 190) | type Source = &'a str;
  type Name (line 191) | type Name = String;
  function name (line 193) | fn name(&self, file_id: FileId) -> CodespanResult<String> {
  function source (line 199) | fn source(&self, file_id: FileId) -> CodespanResult<&str> {
  function line_index (line 205) | fn line_index(&self, file_id: FileId, offset: usize) -> CodespanResult<u...
  function line_range (line 211) | fn line_range(&self, file_id: FileId, line_index: usize) -> CodespanResu...

FILE: compiler/tests/integration.rs
  type RunOutput (line 19) | struct RunOutput {
  type RunType (line 25) | enum RunType {
    method expected_output (line 31) | fn expected_output(&self) -> &RunOutput {
  type TestType (line 40) | enum TestType {
  type ExpectedSpan (line 47) | enum ExpectedSpan {
    method matches (line 53) | fn matches(&self, actual_file_id: FileId, actual_range: Range<usize>) ...
  type ExpectedDiagnostic (line 70) | struct ExpectedDiagnostic {
    method matches (line 77) | fn matches(&self, actual: &Diagnostic<FileId>) -> bool {
    method to_error_diagnostic (line 93) | fn to_error_diagnostic(&self) -> Diagnostic<FileId> {
  function take_severity (line 118) | fn take_severity(marker_string: &str) -> (Severity, &str) {
  function severity_name (line 134) | fn severity_name(severity: Severity) -> &'static str {
  function extract_expected_diagnostics (line 144) | fn extract_expected_diagnostics(
  function unexpected_diag_to_error_diagnostic (line 204) | fn unexpected_diag_to_error_diagnostic(unexpected_diag: Diagnostic<FileI...
  function exit_with_run_output_difference (line 230) | fn exit_with_run_output_difference(
  function result_for_single_test (line 271) | fn result_for_single_test(
  function run_single_pass_test (line 381) | fn run_single_pass_test(
  function run_single_compile_fail_test (line 396) | fn run_single_compile_fail_test(
  function run_single_test (line 450) | fn run_single_test(ccx: &CompileCtx, input_path: &path::Path, test_type:...
  function entry_is_arret_source (line 465) | fn entry_is_arret_source(entry: &fs::DirEntry) -> bool {
  function read_or_empty_vec (line 473) | fn read_or_empty_vec(filename: &path::Path) -> Result<Vec<u8>, io::Error> {
  function entry_to_compile_test_tuple (line 481) | fn entry_to_compile_test_tuple(
  function entry_to_run_test_tuple (line 494) | fn entry_to_run_test_tuple<RT>(
  function integration (line 520) | fn integration() {

FILE: compiler/ty/conv_abi.rs
  function type_tag_to_ty (line 8) | fn type_tag_to_ty<M: ty::Pm>(type_tag: boxed::TypeTag) -> Ty<M> {
  type ConvertableAbiType (line 32) | pub trait ConvertableAbiType {
    method to_ty_ref (line 33) | fn to_ty_ref<M: ty::Pm>(&self) -> ty::Ref<M>;
    method to_rust_str (line 34) | fn to_rust_str(&self) -> String;
    method to_ty_ref (line 38) | fn to_ty_ref<M: ty::Pm>(&self) -> ty::Ref<M> {
    method to_rust_str (line 52) | fn to_rust_str(&self) -> String {
    method to_ty_ref (line 68) | fn to_ty_ref<M: ty::Pm>(&self) -> ty::Ref<M> {
    method to_rust_str (line 94) | fn to_rust_str(&self) -> String {
    method to_ty_ref (line 113) | fn to_ty_ref<M: ty::Pm>(&self) -> ty::Ref<M> {
    method to_rust_str (line 123) | fn to_rust_str(&self) -> String {
    method to_ty_ref (line 135) | fn to_ty_ref<M: ty::Pm>(&self) -> ty::Ref<M> {
    method to_rust_str (line 139) | fn to_rust_str(&self) -> String {
    method to_ty_ref (line 155) | fn to_ty_ref<M: ty::Pm>(&self) -> ty::Ref<M> {
    method to_rust_str (line 171) | fn to_rust_str(&self) -> String {
  function pair_abi_type (line 195) | fn pair_abi_type() {
  function bool_abi_type (line 210) | fn bool_abi_type() {
  function nil_abi_type (line 223) | fn nil_abi_type() {
  function callback_abi_type (line 236) | fn callback_abi_type() {
  function captured_int_abi_type (line 257) | fn captured_int_abi_type() {

FILE: compiler/ty/datum.rs
  function ty_ref_for_datum (line 6) | pub fn ty_ref_for_datum<M: ty::Pm>(datum: &Datum) -> ty::Ref<M> {
  function assert_poly_for_str (line 40) | fn assert_poly_for_str(ty_str: &str, datum_str: &str) {
  function trivial_types (line 48) | fn trivial_types() {
  function bool_literal (line 56) | fn bool_literal() {
  function sym_literal (line 62) | fn sym_literal() {
  function fixed_list (line 67) | fn fixed_list() {
  function fixed_vec (line 73) | fn fixed_vec() {
  function fixed_set (line 79) | fn fixed_set() {
  function fixed_map (line 85) | fn fixed_map() {

FILE: compiler/ty/intersect.rs
  type Error (line 15) | pub enum Error {
  type Result (line 19) | type Result<S> = result::Result<S, Error>;
  function flatten_ref_intersect (line 24) | fn flatten_ref_intersect<M: ty::Pm>(ref1: &ty::Ref<M>, ref2: &ty::Ref<M>...
  function unify_list (line 46) | fn unify_list(
  function intersect_union_iter (line 60) | fn intersect_union_iter<'a, M, I>(lefts: &[ty::Ref<M>], rights: I) -> Re...
  function intersect_ty_ref_iter (line 85) | fn intersect_ty_ref_iter<'a, M, I>(mut ty_refs: I) -> Result<ty::Ref<M>>
  function intersect_record_field_purities (line 102) | fn intersect_record_field_purities<M: ty::Pm>(
  function intersect_record_field_ty_refs (line 127) | fn intersect_record_field_ty_refs<M: ty::Pm>(
  function intersect_record_instance (line 152) | fn intersect_record_instance<M: ty::Pm>(
  function non_subty_intersect (line 201) | fn non_subty_intersect<M: ty::Pm>(
  function intersect_list (line 319) | pub fn intersect_list<M: ty::Pm>(list1: &ty::List<M>, list2: &ty::List<M...
  function intersect_ty_refs (line 342) | pub fn intersect_ty_refs<M: ty::Pm>(
  function intersect_purity_refs (line 370) | pub fn intersect_purity_refs(purity1: &purity::Ref, purity2: &purity::Re...
  function assert_disjoint_poly (line 385) | fn assert_disjoint_poly(poly1: &ty::Ref<ty::Poly>, poly2: &ty::Ref<ty::P...
  function assert_merged_poly (line 392) | fn assert_merged_poly(
  function assert_disjoint (line 411) | fn assert_disjoint(ty_str1: &str, ty_str2: &str) {
  function assert_merged (line 418) | fn assert_merged(expected_str: &str, ty_str1: &str, ty_str2: &str) {
  function assert_disjoint_iter (line 426) | fn assert_disjoint_iter(ty_strs: &[&str]) {
  function assert_merged_iter (line 435) | fn assert_merged_iter(expected_str: &str, ty_strs: &[&str]) {
  function disjoint_types (line 443) | fn disjoint_types() {
  function simple_subtypes (line 448) | fn simple_subtypes() {
  function union_types (line 455) | fn union_types() {
  function intersect_types (line 466) | fn intersect_types() {
  function map_types (line 484) | fn map_types() {
  function set_types (line 494) | fn set_types() {
  function list_types (line 504) | fn list_types() {
  function vec_types (line 517) | fn vec_types() {
  function top_fun_types (line 524) | fn top_fun_types() {
  function fun_types (line 530) | fn fun_types() {
  function ty_pred_types (line 540) | fn ty_pred_types() {
  function eq_pred_types (line 548) | fn eq_pred_types() {
  function unbounded_poly_var (line 555) | fn unbounded_poly_var() {
  function bounded_poly_vars (line 587) | fn bounded_poly_vars() {
  function polymorphic_funs (line 608) | fn polymorphic_funs() {
  function intersect_iter (line 631) | fn intersect_iter() {
  function record_instances (line 639) | fn record_instances() {

FILE: compiler/ty/is_a.rs
  function top_fun_is_a (line 9) | fn top_fun_is_a(sub_top_fun: &ty::TopFun, par_top_fun: &ty::TopFun) -> b...
  function list_is_a (line 14) | fn list_is_a<M: ty::Pm>(sub_list: &ty::List<M>, par_list: &ty::List<M>) ...
  function record_field_is_a (line 37) | fn record_field_is_a<F, R>(variance: Variance, is_a: &F, sub: &R, par: &...
  function record_instance_is_a (line 48) | fn record_instance_is_a<M: ty::Pm>(
  function monomorphic_fun_is_a (line 75) | fn monomorphic_fun_is_a(sub_fun: &ty::Fun, par_fun: &ty::Fun) -> bool {
  function fun_is_a (line 81) | fn fun_is_a(sub_fun: &ty::Fun, par_fun: &ty::Fun) -> bool {
  function ty_is_a (line 90) | fn ty_is_a<M: ty::Pm>(
  function tvar_is_bounded_by (line 202) | fn tvar_is_bounded_by(sub_tvar: &ty::TVarId, parent_tvar: &ty::TVarId) -...
  function purity_ref_is_a (line 213) | fn purity_ref_is_a(sub: &purity::Ref, parent: &purity::Ref) -> bool {
  function inst_polymorphic_fun (line 219) | fn inst_polymorphic_fun(sub_fun: &ty::Fun, par_top_fun: &ty::TopFun) -> ...
  function ty_ref_is_a (line 229) | pub fn ty_ref_is_a<M: ty::Pm>(sub: &ty::Ref<M>, parent: &ty::Ref<M>) -> ...
  function ty_refs_equivalent (line 275) | pub fn ty_refs_equivalent<M: ty::Pm>(ty_ref1: &ty::Ref<M>, ty_ref2: &ty:...
  function purity_refs_equivalent (line 282) | pub fn purity_refs_equivalent(purity_ref1: &purity::Ref, purity_ref2: &p...
  function sym_types (line 294) | fn sym_types() {
  function set_types (line 311) | fn set_types() {
  function map_types (line 324) | fn map_types() {
  function union_types (line 341) | fn union_types() {
  function intersect_types (line 366) | fn intersect_types() {
  function any_and_never_types (line 410) | fn any_and_never_types() {
  function list_types (line 423) | fn list_types() {
  function vec_types (line 449) | fn vec_types() {
  function num_types (line 467) | fn num_types() {
  function fun_types (line 481) | fn fun_types() {
  function ty_pred_types (line 496) | fn ty_pred_types() {
  function eq_pred_type (line 519) | fn eq_pred_type() {
  function bool_types (line 537) | fn bool_types() {
  function poly_bool_types (line 548) | fn poly_bool_types() {
  function unbounded_poly_vars (line 559) | fn unbounded_poly_vars() {
  function bounded_poly_vars (line 571) | fn bounded_poly_vars() {
  function related_poly_bounds (line 595) | fn related_poly_bounds() {
  function polymorphic_funs (line 613) | fn polymorphic_funs() {
  function polymorphic_purity_funs (line 682) | fn polymorphic_purity_funs() {
  function distinct_record_cons_instances (line 694) | fn distinct_record_cons_instances() {
  function same_cons_record_instances (line 727) | fn same_cons_record_instances() {

FILE: compiler/ty/list_iter.rs
  type ListIterator (line 6) | pub struct ListIterator<'list, M: ty::Pm> {
  function new (line 12) | pub fn new(list: &'list ty::List<M>) -> ListIterator<'list, M> {
  function try_new_from_ty_ref (line 19) | pub fn try_new_from_ty_ref(ty_ref: &'list ty::Ref<M>) -> Option<ListIter...
  function fixed_len (line 26) | pub fn fixed_len(&self) -> usize {
  function has_rest (line 30) | pub fn has_rest(&self) -> bool {
  function tail_type (line 34) | pub fn tail_type(self) -> ty::List<M> {
  function collect_rest (line 38) | pub fn collect_rest(self) -> ty::Ref<M> {
  type Item (line 50) | type Item = &'list ty::Ref<M>;
  method next (line 52) | fn next(&mut self) -> Option<&'list ty::Ref<M>> {

FILE: compiler/ty/mod.rs
  type TVar (line 26) | pub struct TVar {
    method new (line 36) | pub fn new(span: Span, source_name: DataStr, bound: Ref<Poly>) -> TVar...
    method span (line 44) | pub fn span(&self) -> Span {
    method source_name (line 48) | pub fn source_name(&self) -> &str {
    method bound (line 52) | pub fn bound(&self) -> &Ref<Poly> {
  type TVarId (line 32) | pub type TVarId = ArcId<TVar>;
  type TVars (line 33) | pub type TVars = Vec<TVarId>;
  type Pm (line 58) | pub trait Pm: PartialEq + Clone + Copy + Sized + fmt::Debug {
    method resolve_ref_to_ty (line 60) | fn resolve_ref_to_ty(ty_ref: &Ref<Self>) -> &Ty<Self>;
    method resolve_ref_to_ty (line 66) | fn resolve_ref_to_ty(ty_ref: &Ref<Mono>) -> &Ty<Mono> {
    method resolve_ref_to_ty (line 77) | fn resolve_ref_to_ty(ty_ref: &Ref<Poly>) -> &Ty<Poly> {
  type Mono (line 64) | pub enum Mono {}
  type Poly (line 75) | pub struct Poly {}
  type Ref (line 86) | pub enum Ref<M: Pm> {
  function try_to_fixed (line 93) | pub fn try_to_fixed(&self) -> Option<&Ty<M>> {
  function from_vec (line 104) | pub fn from_vec(mut members: Vec<Self>) -> Self {
  function find_member (line 115) | pub fn find_member<'a, F, T>(&'a self, f: F) -> Option<T>
  function resolve_to_ty (line 130) | pub fn resolve_to_ty(&self) -> &Ty<M> {
  function is_never (line 134) | pub fn is_never(&self) -> bool {
  function as_ty (line 140) | pub fn as_ty(&self) -> &Ty<Mono> {
  function into_ty (line 149) | pub fn into_ty(self) -> Ty<Mono> {
  function from (line 160) | fn from(ty: Ty<M>) -> Self {
  function from (line 166) | fn from(tvar: TVarId) -> Self {
  type Ty (line 172) | pub enum Ty<M: Pm> {
  function unit (line 209) | pub fn unit() -> Ty<M> {
  function never (line 214) | pub fn never() -> Ty<M> {
  function is_never (line 219) | pub fn is_never(&self) -> bool {
  type Map (line 225) | pub struct Map<M: Pm> {
  function new (line 231) | pub fn new(key: Ref<M>, value: Ref<M>) -> Map<M> {
  function key (line 235) | pub fn key(&self) -> &Ref<M> {
  function value (line 239) | pub fn value(&self) -> &Ref<M> {
  function from (line 245) | fn from(map: Map<M>) -> Self {
  function from (line 251) | fn from(map: Map<M>) -> Self {
  type List (line 257) | pub struct List<M: Pm> {
  function new (line 264) | pub fn new(fixed: Box<[Ref<M>]>, rest: Ref<M>) -> List<M> {
  function new_uniform (line 272) | pub fn new_uniform(rest: Ref<M>) -> List<M> {
  function new_tuple (line 280) | pub fn new_tuple(fixed: Box<[Ref<M>]>) -> List<M> {
  function empty (line 288) | pub fn empty() -> List<M> {
  function fixed (line 292) | pub fn fixed(&self) -> &[Ref<M>] {
  function rest (line 299) | pub fn rest(&self) -> &Ref<M> {
  function size_range (line 303) | pub fn size_range(&self) -> Range<usize> {
  function has_disjoint_arity (line 311) | pub fn has_disjoint_arity(&self, other: &Self) -> bool {
  function is_empty (line 319) | pub fn is_empty(&self) -> bool {
  function has_rest (line 324) | pub fn has_rest(&self) -> bool {
  function from (line 330) | fn from(list: List<M>) -> Self {
  function from (line 336) | fn from(list: List<M>) -> Self {
  type TopFun (line 342) | pub struct TopFun {
    method new (line 349) | pub fn new(purity: purity::Ref, ret: Ref<Poly>) -> TopFun {
    method new_for_pred (line 354) | pub fn new_for_pred() -> TopFun {
    method purity (line 358) | pub fn purity(&self) -> &purity::Ref {
    method ret (line 362) | pub fn ret(&self) -> &Ref<Poly> {
  function from (line 368) | fn from(top_fun: TopFun) -> Self {
  function from (line 374) | fn from(top_fun: TopFun) -> Self {
  type Fun (line 380) | pub struct Fun {
    method new (line 388) | pub fn new(pvars: purity::PVars, tvars: TVars, top_fun: TopFun, params...
    method new_mono (line 398) | pub fn new_mono(params: List<Poly>, purity: purity::Ref, ret: Ref<Poly...
    method new_for_main (line 408) | pub fn new_for_main() -> Fun {
    method new_for_ty_pred (line 420) | pub fn new_for_ty_pred() -> Fun {
    method new_for_eq_pred (line 433) | pub fn new_for_eq_pred() -> Fun {
    method pvars (line 442) | pub fn pvars(&self) -> &[purity::PVarId] {
    method tvars (line 446) | pub fn tvars(&self) -> &[TVarId] {
    method top_fun (line 450) | pub fn top_fun(&self) -> &TopFun {
    method purity (line 454) | pub fn purity(&self) -> &purity::Ref {
    method params (line 458) | pub fn params(&self) -> &List<Poly> {
    method ret (line 462) | pub fn ret(&self) -> &Ref<Poly> {
    method has_polymorphic_vars (line 466) | pub fn has_polymorphic_vars(&self) -> bool {
    method with_polymorphic_vars (line 470) | pub fn with_polymorphic_vars(self, pvars: purity::PVars, tvars: TVars)...
  function from (line 480) | fn from(fun: Fun) -> Self {
  function from (line 486) | fn from(fun: Fun) -> Self {

FILE: compiler/ty/pred.rs
  type TestTy (line 9) | pub enum TestTy {
    method match_subject_ref (line 28) | pub fn match_subject_ref<M: ty::Pm>(&self, ty_ref: &ty::Ref<M>) -> Opt...
    method to_ty (line 108) | pub fn to_ty(&self) -> Ty<ty::Poly> {
    method fmt (line 140) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::E...
  function assert_test_ty_will_match (line 167) | fn assert_test_ty_will_match(test_ty: &TestTy, subject_ref: impl Into<ty...
  function assert_test_ty_may_match (line 176) | fn assert_test_ty_may_match(test_ty: &TestTy, subject_ref: impl Into<ty:...
  function assert_test_ty_wont_match (line 185) | fn assert_test_ty_wont_match(test_ty: &TestTy, subject_ref: impl Into<ty...
  function assert_trivial_test_ty (line 194) | fn assert_trivial_test_ty(expected_ty: Ty<ty::Poly>, test_ty: TestTy) {
  function sym_test_ty (line 208) | fn sym_test_ty() {
  function str_test_ty (line 217) | fn str_test_ty() {
  function bool_test_ty (line 222) | fn bool_test_ty() {
  function num_test_ty (line 231) | fn num_test_ty() {
  function int_test_ty (line 241) | fn int_test_ty() {
  function float_test_ty (line 250) | fn float_test_ty() {
  function char_test_ty (line 259) | fn char_test_ty() {
  function list_test_ty (line 264) | fn list_test_ty() {
  function vector_test_ty (line 269) | fn vector_test_ty() {
  function set_test_ty (line 278) | fn set_test_ty() {
  function map_test_ty (line 283) | fn map_test_ty() {
  function fun_test_ty (line 291) | fn fun_test_ty() {
  function nil_test_ty (line 300) | fn nil_test_ty() {
  function top_record_test_ty (line 309) | fn top_record_test_ty() {
  function record_class_test_ty (line 334) | fn record_class_test_ty() {
  function union_subject_ref (line 374) | fn union_subject_ref() {
  function intersect_subject_ref (line 396) | fn intersect_subject_ref() {

FILE: compiler/ty/props.rs
  function ty_has_subtypes (line 6) | fn ty_has_subtypes<M: ty::Pm>(ty: &Ty<M>) -> bool {
  function has_subtypes (line 58) | pub fn has_subtypes<M: ty::Pm>(ty_ref: &ty::Ref<M>) -> bool {
  function ty_is_literal (line 65) | fn ty_is_literal<M: ty::Pm>(ty: &Ty<M>) -> bool {
  function is_literal (line 74) | pub fn is_literal<M: ty::Pm>(ty_ref: &ty::Ref<M>) -> bool {
  function str_has_subtypes (line 90) | fn str_has_subtypes(datum_str: &str) -> bool {
  function str_is_literal (line 95) | fn str_is_literal(datum_str: &str) -> bool {
  function poly_subtypes (line 101) | fn poly_subtypes() {
  function poly_literal (line 137) | fn poly_literal() {
  function mono_record_type (line 168) | fn mono_record_type() {
  function poly_record_type (line 185) | fn poly_record_type() {

FILE: compiler/ty/purity.rs
  type Purity (line 7) | pub enum Purity {
  type PVar (line 13) | pub struct PVar {
    method new (line 22) | pub fn new(span: Span, source_name: DataStr) -> PVarId {
    method span (line 26) | pub fn span(&self) -> Span {
    method source_name (line 30) | pub fn source_name(&self) -> &str {
  type PVarId (line 18) | pub type PVarId = ArcId<PVar>;
  type PVars (line 19) | pub type PVars = Vec<PVarId>;
  type Ref (line 36) | pub enum Ref {
    method from (line 42) | fn from(purity: Purity) -> Self {
    method from (line 48) | fn from(pvar: PVarId) -> Self {

FILE: compiler/ty/record.rs
  type Field (line 14) | pub struct Field {
    method new (line 21) | pub fn new(span: Span, name: DataStr, ty_ref: ty::Ref<ty::Poly>) -> Se...
    method span (line 26) | pub fn span(&self) -> Span {
    method name (line 34) | pub fn name(&self) -> &DataStr {
    method ty_ref (line 39) | pub fn ty_ref(&self) -> &ty::Ref<ty::Poly> {
    method accessor_fun_type (line 44) | pub fn accessor_fun_type(&self, cons_id: &ConsId) -> ty::Fun {
  type PolyParam (line 62) | pub enum PolyParam {
    method variance (line 75) | pub fn variance(&self) -> Variance {
  type Cons (line 92) | pub struct Cons {
    method new (line 101) | pub fn new(
    method span (line 118) | pub fn span(&self) -> Span {
    method ty_cons_name (line 126) | pub fn ty_cons_name(&self) -> &DataStr {
    method value_cons_name (line 131) | pub fn value_cons_name(&self) -> &DataStr {
    method poly_params (line 136) | pub fn poly_params(&self) -> &[PolyParam] {
    method is_singleton (line 146) | pub fn is_singleton(&self) -> bool {
    method fields (line 151) | pub fn fields(&self) -> &[Field] {
    method identity_ty_args (line 156) | pub fn identity_ty_args(&self) -> TyArgs<ty::Poly> {
    method value_cons_fun_type (line 180) | pub fn value_cons_fun_type(cons_id: &ConsId) -> ty::Fun {
  type ConsId (line 199) | pub type ConsId = ArcId<Cons>;
  function from (line 202) | fn from(cons_id: ConsId) -> Self {
  function from (line 208) | fn from(cons_id: ConsId) -> Self {
  type Instance (line 214) | pub struct Instance<M: ty::Pm> {
  function new (line 220) | pub fn new(cons: ConsId, ty_args: TyArgs<M>) -> Self {
  function cons (line 225) | pub fn cons(&self) -> &ConsId {
  function ty_args (line 232) | pub fn ty_args(&self) -> &TyArgs<M> {
  function from (line 238) | fn from(instance: Instance<M>) -> Self {
  function from (line 244) | fn from(instance: Instance<M>) -> Self {

FILE: compiler/ty/select.rs
  type Error (line 11) | pub enum Error<'vars> {
  type SelectCtx (line 23) | pub struct SelectCtx<'vars> {
  function new (line 32) | pub fn new(
  function add_evidence_top_fun (line 44) | fn add_evidence_top_fun(&mut self, target_top_fun: &ty::TopFun, evidence...
  function add_evidence_fun (line 49) | fn add_evidence_fun(&mut self, target_top_fun: &ty::TopFun, evidence_fun...
  function add_evidence_record (line 68) | fn add_evidence_record(
  function add_evidence_list (line 88) | fn add_evidence_list(
  function add_evidence_never (line 115) | fn add_evidence_never(&mut self, target_ty: &Ty<ty::Poly>) {
  function add_evidence_ty (line 139) | fn add_evidence_ty(
  function add_var_evidence (line 208) | fn add_var_evidence(&mut self, tvar: &ty::TVarId, evidence_poly: &ty::Re...
  function add_evidence (line 223) | pub fn add_evidence(
  function add_evidence_purity (line 237) | pub fn add_evidence_purity(
  function into_poly_ty_args (line 261) | pub fn into_poly_ty_args(mut self) -> TyArgs<ty::Poly> {
  function into_complete_poly_ty_args (line 286) | pub fn into_complete_poly_ty_args(mut self) -> Result<TyArgs<ty::Poly>, ...
  type TestScope (line 319) | struct TestScope {
    method new (line 327) | fn new(polymorphic_str: &str) -> TestScope {
    method poly_for_str (line 353) | fn poly_for_str(&self, poly_str: &str) -> ty::Ref<ty::Poly> {
    method purity_for_str (line 360) | fn purity_for_str(&self, poly_str: &str) -> purity::Ref {
    method select_ctx (line 367) | fn select_ctx(&self) -> SelectCtx<'_> {
  function assert_unselected_type (line 372) | fn assert_unselected_type(ctx: &SelectCtx<'_>, poly_var: &ty::Ref<ty::Po...
  function assert_selected_type (line 382) | fn assert_selected_type(
  function assert_unselected_purity (line 396) | fn assert_unselected_purity(ctx: &SelectCtx<'_>, poly_var: &purity::Ref) {
  function assert_selected_purity (line 406) | fn assert_selected_purity(
  function trivial_tvar (line 424) | fn trivial_tvar() {
  function poly_conflicing_tvar (line 439) | fn poly_conflicing_tvar() {
  function set_types (line 458) | fn set_types() {
  function map_types (line 472) | fn map_types() {
  function fixed_list_types (line 488) | fn fixed_list_types() {
  function listof_types (line 504) | fn listof_types() {
  function listof_from_fixed_list (line 518) | fn listof_from_fixed_list() {
  function listof_from_list_union (line 532) | fn listof_from_list_union() {
  function fixed_vector_types (line 546) | fn fixed_vector_types() {
  function vectorof_types (line 562) | fn vectorof_types() {
  function vectorof_from_fixed_vector (line 576) | fn vectorof_from_fixed_vector() {
  function union_types (line 590) | fn union_types() {
  function bounded_union_types (line 604) | fn bounded_union_types() {
  function top_fun_types (line 627) | fn top_fun_types() {
  function top_fun_purities (line 641) | fn top_fun_purities() {
  function top_fun_from_fun (line 662) | fn top_fun_from_fun() {
  function top_fun_from_poly_fun (line 676) | fn top_fun_from_poly_fun() {
  function top_fun_from_ty_pred (line 694) | fn top_fun_from_ty_pred() {
  function top_fun_from_eq_pred (line 708) | fn top_fun_from_eq_pred() {
  function fun_types (line 719) | fn fun_types() {
  function fun_purities (line 736) | fn fun_purities() {
  function fun_purity_conflict (line 751) | fn fun_purity_conflict() {
  function fun_type_from_ty_pred (line 771) | fn fun_type_from_ty_pred() {
  function fun_type_from_eq_pred (line 784) | fn fun_type_from_eq_pred() {
  function ty_pred_purity (line 797) | fn ty_pred_purity() {

FILE: compiler/ty/subst.rs
  function subst_ty_ref_slice (line 7) | fn subst_ty_ref_slice<S>(stx: &S, inputs: &[ty::Ref<S::InputPM>]) -> Box...
  function subst_list (line 14) | fn subst_list<S>(stx: &S, list: &ty::List<S::InputPM>) -> ty::List<S::Ou...
  function subst_record_instance (line 24) | fn subst_record_instance<S>(
  function subst_top_fun (line 51) | fn subst_top_fun<S>(stx: &S, top_fun: &ty::TopFun) -> ty::TopFun
  function subst_fun (line 63) | fn subst_fun<S>(stx: &S, fun: &ty::Fun) -> ty::Fun
  function subst_ty (line 78) | fn subst_ty<S>(stx: &S, ty: &Ty<S::InputPM>) -> Ty<S::OutputPM>
  type Substitution (line 113) | trait Substitution {
    method subst_purity_ref (line 118) | fn subst_purity_ref(&self, poly: &purity::Ref) -> purity::Ref;
    method subst_ty_ref (line 119) | fn subst_ty_ref(&self, input: &ty::Ref<Self::InputPM>) -> ty::Ref<Self...
    method as_poly_subst (line 120) | fn as_poly_subst(&self) -> &Self::AsPolySubst;
    type InputPM (line 124) | type InputPM = ty::Poly;
    type OutputPM (line 125) | type OutputPM = ty::Poly;
    type AsPolySubst (line 126) | type AsPolySubst = Self;
    method subst_purity_ref (line 128) | fn subst_purity_ref(&self, poly: &purity::Ref) -> purity::Ref {
    method subst_ty_ref (line 141) | fn subst_ty_ref(&self, poly: &ty::Ref<ty::Poly>) -> ty::Ref<ty::Poly> {
    method as_poly_subst (line 154) | fn as_poly_subst(&self) -> &Self {
    type InputPM (line 162) | type InputPM = ty::Poly;
    type OutputPM (line 163) | type OutputPM = ty::Poly;
    type AsPolySubst (line 164) | type AsPolySubst = Self;
    method subst_purity_ref (line 166) | fn subst_purity_ref(&self, poly: &purity::Ref) -> purity::Ref {
    method subst_ty_ref (line 170) | fn subst_ty_ref(&self, poly: &ty::Ref<ty::Poly>) -> ty::Ref<ty::Poly> {
    method as_poly_subst (line 174) | fn as_poly_subst(&self) -> &Self {
    type InputPM (line 192) | type InputPM = ty::Mono;
    type OutputPM (line 193) | type OutputPM = ty::Poly;
    type AsPolySubst (line 194) | type AsPolySubst = PolyIdentity;
    method subst_purity_ref (line 196) | fn subst_purity_ref(&self, poly: &purity::Ref) -> purity::Ref {
    method subst_ty_ref (line 200) | fn subst_ty_ref(&self, mono: &ty::Ref<ty::Mono>) -> ty::Ref<ty::Poly> {
    method as_poly_subst (line 204) | fn as_poly_subst(&self) -> &PolyIdentity {
    type InputPM (line 224) | type InputPM = ty::Poly;
    type OutputPM (line 225) | type OutputPM = ty::Mono;
    type AsPolySubst (line 226) | type AsPolySubst = PartialMonomorphise<'tyargs>;
    method subst_purity_ref (line 228) | fn subst_purity_ref(&self, poly: &purity::Ref) -> purity::Ref {
    method subst_ty_ref (line 245) | fn subst_ty_ref(&self, poly: &ty::Ref<ty::Poly>) -> ty::Ref<ty::Mono> {
    method as_poly_subst (line 262) | fn as_poly_subst(&self) -> &PartialMonomorphise<'tyargs> {
    type InputPM (line 272) | type InputPM = ty::Poly;
    type OutputPM (line 273) | type OutputPM = ty::Poly;
    type AsPolySubst (line 274) | type AsPolySubst = Self;
    method subst_purity_ref (line 276) | fn subst_purity_ref(&self, poly: &purity::Ref) -> purity::Ref {
    method subst_ty_ref (line 289) | fn subst_ty_ref(&self, poly: &ty::Ref<ty::Poly>) -> ty::Ref<ty::Poly> {
    method as_poly_subst (line 302) | fn as_poly_subst(&self) -> &Self {
  type PolyIdentity (line 159) | struct PolyIdentity {}
  type MonoToPoly (line 179) | struct MonoToPoly {
    method new (line 184) | fn new() -> MonoToPoly {
  type Monomorphise (line 209) | struct Monomorphise<'tyargs> {
  function new (line 215) | fn new(mta: &'tyargs TyArgs<ty::Mono>) -> Monomorphise<'tyargs> {
  type PartialMonomorphise (line 267) | struct PartialMonomorphise<'tyargs> {
  function subst_poly (line 307) | pub fn subst_poly(pta: &TyArgs<ty::Poly>, poly: &ty::Ref<ty::Poly>) -> t...
  function subst_poly_fun (line 311) | pub fn subst_poly_fun(pta: &TyArgs<ty::Poly>, fun: &ty::Fun) -> ty::Fun {
  function subst_purity (line 315) | pub fn subst_purity(pta: &TyArgs<ty::Poly>, purity: &purity::Ref) -> pur...
  function monomorphise (line 319) | pub fn monomorphise(mta: &TyArgs<ty::Mono>, poly: &ty::Ref<ty::Poly>) ->...
  function monomorphise_purity (line 324) | pub fn monomorphise_purity(mta: &TyArgs<ty::Mono>, poly: &purity::Ref) -...
  function monomorphise_list (line 329) | pub fn monomorphise_list(mta: &TyArgs<ty::Mono>, poly: &ty::List<ty::Pol...

FILE: compiler/ty/subtract.rs
  function subtract_ref_iters (line 4) | fn subtract_ref_iters<'a, I, M>(minuend_iter: I, subtrahend_ref: &ty::Re...
  function subtract_tys (line 14) | fn subtract_tys<M: ty::Pm>(
  function subtract_ty_refs (line 70) | pub fn subtract_ty_refs<M: ty::Pm>(
  function assert_subtraction (line 111) | fn assert_subtraction(expected_str: &str, minuend_str: &str, subrahend_s...
  function trivial_subtraction (line 121) | fn trivial_subtraction() {
  function bool_subtraction (line 127) | fn bool_subtraction() {
  function num_subtraction (line 133) | fn num_subtraction() {
  function union_subtraction (line 139) | fn union_subtraction() {
  function list_subtraction (line 149) | fn list_subtraction() {
  function poly_substraction (line 154) | fn poly_substraction() {
  function poly_record_type (line 183) | fn poly_record_type() {

FILE: compiler/ty/ty_args.rs
  type TyArgs (line 9) | pub struct TyArgs<M: ty::Pm> {
  function new (line 15) | pub fn new(
  function empty (line 25) | pub fn empty() -> Self {
  function pvar_purities (line 32) | pub fn pvar_purities(&self) -> &HashMap<purity::PVarId, purity::Ref> {
  function tvar_types (line 36) | pub fn tvar_types(&self) -> &HashMap<ty::TVarId, ty::Ref<M>> {
  function from_upper_bound (line 43) | pub fn from_upper_bound(pvars: &[purity::PVarId], tvars: &[ty::TVarId]) ...

FILE: compiler/ty/unify.rs
  type UnifiedTy (line 23) | enum UnifiedTy<M: ty::Pm> {
  type UnifiedList (line 37) | pub enum UnifiedList<M: ty::Pm> {
  function unify_ty_refs (line 42) | fn unify_ty_refs<M: ty::Pm>(ref1: &ty::Ref<M>, ref2: &ty::Ref<M>) -> Uni...
  function try_list_to_exact_pair (line 56) | fn try_list_to_exact_pair<M: ty::Pm>(list: &ty::List<M>) -> Option<&ty::...
  function union_push (line 67) | fn union_push<M: ty::Pm>(output_members: &mut Vec<ty::Ref<M>>, new_membe...
  function union_extend (line 88) | fn union_extend<M, I>(existing_members: Vec<ty::Ref<M>>, new_members: I)...
  function unify_top_fun (line 102) | fn unify_top_fun<M: ty::Pm>(top_fun1: &ty::TopFun, top_fun2: &ty::TopFun...
  function unify_fun (line 109) | fn unify_fun<M: ty::Pm>(fun1: &ty::Fun, fun2: &ty::Fun) -> UnifiedTy<M> {
  function unify_record_field_purities (line 130) | fn unify_record_field_purities<M: ty::Pm>(
  function unify_record_field_ty_refs (line 155) | fn unify_record_field_ty_refs<M: ty::Pm>(
  function unify_record_instance (line 183) | fn unify_record_instance<M: ty::Pm>(
  function unify_ty (line 238) | fn unify_ty<M: ty::Pm>(
  function unify_purity_refs (line 360) | pub fn unify_purity_refs(purity1: &purity::Ref, purity2: &purity::Ref) -...
  function unify_to_ty_ref (line 377) | pub fn unify_to_ty_ref<M: ty::Pm>(ty_ref1: &ty::Ref<M>, ty_ref2: &ty::Re...
  function unify_ty_ref_iter (line 385) | pub fn unify_ty_ref_iter<M, I>(new_members: I) -> ty::Ref<M>
  function unify_list (line 393) | pub fn unify_list<M: ty::Pm>(list1: &ty::List<M>, list2: &ty::List<M>) -...
  function assert_discerned (line 437) | fn assert_discerned(ty_str1: &str, ty_str2: &str) {
  function assert_merged (line 444) | fn assert_merged(expected_str: &str, ty_str1: &str, ty_str2: &str) {
  function assert_merged_iter (line 457) | fn assert_merged_iter(expected_str: &str, ty_strs: &[&str]) {
  function disjoint_types (line 465) | fn disjoint_types() {
  function two_sym_types (line 470) | fn two_sym_types() {
  function literal_sym_and_any_sym (line 475) | fn literal_sym_and_any_sym() {
  function two_bool_types (line 480) | fn two_bool_types() {
  function num_types (line 485) | fn num_types() {
  function top_fun_types (line 492) | fn top_fun_types() {
  function fun_types (line 497) | fn fun_types() {
  function ty_pred_types (line 509) | fn ty_pred_types() {
  function eq_pred_type (line 517) | fn eq_pred_type() {
  function set_types (line 524) | fn set_types() {
  function map_types (line 530) | fn map_types() {
  function union_types (line 539) | fn union_types() {
  function unify_iter (line 571) | fn unify_iter() {
  function list_types (line 587) | fn list_types() {
  function vec_types (line 603) | fn vec_types() {
  function polymorphic_funs (line 609) | fn polymorphic_funs() {
  function purity_refs (line 631) | fn purity_refs() {
  function related_poly_bounds (line 666) | fn related_poly_bounds() {
  function record_instances (line 692) | fn record_instances() {

FILE: compiler/ty/var_usage.rs
  type Variance (line 17) | pub enum Variance {
    type Output (line 27) | type Output = Variance;
    method mul (line 40) | fn mul(self, rhs: Variance) -> Variance {
    method bitand_assign (line 55) | fn bitand_assign(&mut self, rhs: Variance) {
  type VarUsages (line 63) | pub struct VarUsages {
    method new (line 176) | pub fn new() -> Self {
    method add_poly_usages (line 180) | pub fn add_poly_usages(&mut self, poly_ref: &ty::Ref<ty::Poly>) {
    method pvar_variance (line 184) | pub fn pvar_variance(&self, pvar: &purity::PVarId) -> Option<Variance> {
    method tvar_variance (line 188) | pub fn tvar_variance(&self, tvar: &ty::TVarId) -> Option<Variance> {
  function visit_list (line 68) | fn visit_list(var_usages: &mut VarUsages, polarity: Variance, list: &ty:...
  function visit_top_fun (line 76) | fn visit_top_fun(var_usages: &mut VarUsages, polarity: Variance, top_fun...
  function visit_ty (line 80) | fn visit_ty(var_usages: &mut VarUsages, polarity: Variance, poly_ty: &Ty...
  function visit_purity (line 147) | fn visit_purity(var_usages: &mut VarUsages, polarity: Variance, purity_r...
  function visit_poly (line 160) | fn visit_poly(var_usages: &mut VarUsages, polarity: Variance, poly_ref: ...
  function test_variance_mul (line 201) | fn test_variance_mul() {
  function convariant_usage (line 219) | fn convariant_usage() {
  function contravariant_usage (line 229) | fn contravariant_usage() {
  function invariant_usage (line 250) | fn invariant_usage() {

FILE: compiler/typeck/dce.rs
  function expr_can_side_effect (line 9) | pub fn expr_can_side_effect(expr: &hir::Expr<hir::Inferred>) -> bool {
  function pure_app_expr (line 59) | fn pure_app_expr() {
  function impure_app_expr (line 83) | fn impure_app_expr() {

FILE: compiler/typeck/destruc.rs
  function type_for_decl_list_destruc (line 7) | pub fn type_for_decl_list_destruc(
  function type_for_decl_destruc (line 39) | pub fn type_for_decl_destruc(
  function visit_scalar_locals (line 58) | fn visit_scalar_locals<F>(scalar: &destruc::Scalar<hir::Lowered>, visito...
  function visit_locals (line 70) | pub fn visit_locals<F>(

FILE: compiler/typeck/error.rs
  type WantedArity (line 14) | pub struct WantedArity {
    method new (line 20) | pub fn new(fixed_len: usize, has_rest: bool) -> WantedArity {
    method fmt (line 29) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type IsNotRetTy (line 39) | pub struct IsNotRetTy {
    method new (line 46) | pub fn new(
  type ErrorKind (line 60) | pub enum ErrorKind {
  type Error (line 77) | pub struct Error {
    method new (line 83) | pub fn new(span: Span, kind: ErrorKind) -> Error {
    method new_with_loc_trace (line 87) | pub fn new_with_loc_trace(loc_trace: LocTrace, kind: ErrorKind) -> Err...
    method kind (line 91) | pub fn kind(&self) -> &ErrorKind {
    method with_macro_invocation_span (line 95) | pub fn with_macro_invocation_span(self, span: Span) -> Error {
  function from (line 104) | fn from(error: Error) -> Self {
  function from (line 254) | fn from(error: Error) -> Self {
  method fmt (line 262) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

FILE: compiler/typeck/infer.rs
  type Result (line 23) | type Result<T> = result::Result<T, Error>;
  type InferredNode (line 26) | pub struct InferredNode {
    method is_divergent (line 34) | fn is_divergent(&self) -> bool {
    method into_expr (line 38) | pub fn into_expr(self) -> hir::Expr<hir::Inferred> {
    method result_ty (line 42) | pub fn result_ty(&self) -> &ty::Ref<ty::Poly> {
  type NodeBool (line 48) | enum NodeBool {
  type VarTypeCond (line 53) | struct VarTypeCond {
    method with_when (line 60) | fn with_when(self, when: NodeBool) -> VarTypeCond {
    method into_inverted (line 64) | fn into_inverted(self) -> VarTypeCond {
  type FunApp (line 82) | struct FunApp {
  type VarType (line 88) | enum VarType {
  type PurityVar (line 110) | enum PurityVar {
    method into_poly (line 155) | fn into_poly(self) -> purity::Ref {
  type RetExprResultUse (line 116) | struct RetExprResultUse<'a> {
  type ResultUse (line 125) | enum ResultUse<'a> {
  function required_type (line 140) | fn required_type(&self) -> &'a ty::Ref<ty::Poly> {
  function is_used (line 149) | fn is_used(&self) -> bool {
  type InputDef (line 163) | enum InputDef {
  type InferredLocals (line 168) | pub type InferredLocals = HashMap<hir::LocalId, ty::Ref<ty::Poly>>;
  type InferredModuleVars (line 169) | pub type InferredModuleVars = HashMap<ModuleId, Arc<InferredLocals>>;
  type InferredModule (line 171) | pub struct InferredModule {
  type RecursiveDefsCtx (line 176) | struct RecursiveDefsCtx<'types> {
  function try_to_bool (line 191) | fn try_to_bool(poly: &ty::Ref<ty::Poly>) -> Option<bool> {
  function unify_app_purity (line 198) | fn unify_app_purity(pv: &mut PurityVar, app_purity: &purity::Ref) {
  function error_kind_for_type_error (line 205) | fn error_kind_for_type_error(
  function ensure_is_a (line 239) | fn ensure_is_a(
  function member_type_for_poly_list (line 257) | fn member_type_for_poly_list(
  function keep_exprs_for_side_effects (line 290) | fn keep_exprs_for_side_effects(
  function new (line 314) | fn new(
  function new_local_ref_node (line 357) | fn new_local_ref_node(
  function insert_free_ty (line 392) | fn insert_free_ty(&mut self, initial_type: ty::Ref<ty::Poly>) -> FreeTyId {
  function visit_lit (line 396) | fn visit_lit(&mut self, result_use: &ResultUse<'_>, datum: Datum) -> Res...
  function with_type_conds_applied (line 413) | fn with_type_conds_applied<F, R>(
  function visit_cond (line 453) | fn visit_cond(
  function visit_ty_pred (line 573) | fn visit_ty_pred(
  function visit_eq_pred (line 591) | fn visit_eq_pred(&self, result_use: &ResultUse<'_>, span: Span) -> Resul...
  function visit_record_cons (line 604) | fn visit_record_cons(
  function visit_field_accessor (line 622) | fn visit_field_accessor(
  function type_for_free_ref (line 642) | fn type_for_free_ref(
  function visit_export_ref (line 659) | fn visit_export_ref(
  function visit_local_ref (line 681) | fn visit_local_ref(
  function visit_do (line 726) | fn visit_do(
  function visit_fun (line 791) | fn visit_fun(
  function visit_fun_app (line 948) | fn visit_fun_app(
  function visit_recur (line 1127) | fn visit_recur(
  function visit_fixed_ty_pred_app (line 1219) | fn visit_fixed_ty_pred_app(
  function visit_rest_ty_pred_app (line 1312) | fn visit_rest_ty_pred_app(
  function visit_fixed_eq_pred_app (line 1381) | fn visit_fixed_eq_pred_app(
  function visit_app (line 1550) | fn visit_app(
  function visit_let (line 1635) | fn visit_let(
  function visit_rust_fun (line 1693) | fn visit_rust_fun(
  function visit_expr_with_self_local_id (line 1714) | fn visit_expr_with_self_local_id(
  function visit_expr (line 1756) | fn visit_expr(
  function destruc_scalar_value (line 1765) | fn destruc_scalar_value(
  function destruc_rest_value (line 1792) | fn destruc_rest_value(
  function destruc_list_value (line 1822) | fn destruc_list_value(
  function destruc_value (line 1845) | fn destruc_value(
  function visit_def (line 1863) | fn visit_def(&mut self, hir_def: hir::Def<hir::Lowered>) -> Result<hir::...
  function recurse_into_def_id (line 1909) | fn recurse_into_def_id(&mut self, def_id: InputDefId) -> Result<()> {
  function into_inferred_module (line 1924) | fn into_inferred_module(mut self) -> result::Result<InferredModule, Vec<...
  function ensure_main_type (line 1963) | pub fn ensure_main_type(
  function infer_module (line 1998) | pub fn infer_module(
  function infer_repl_expr (line 2005) | pub fn infer_repl_expr(
  function type_for_expr (line 2021) | fn type_for_expr(
  function assert_type_for_expr (line 2034) | fn assert_type_for_expr(ty_str: &str, expr_str: &str) {
  function assert_constrained_type_for_expr (line 2041) | fn assert_constrained_type_for_expr(expected_ty_str: &str, expr_str: &st...
  function assert_type_error (line 2049) | fn assert_type_error(err: &Error, expr_str: &str) {
  function literal_expr (line 2055) | fn literal_expr() {
  function do_expr (line 2060) | fn do_expr() {
  function cond_expr (line 2069) | fn cond_expr() {
  function fun_expr (line 2080) | fn fun_expr() {
  function app_types (line 2129) | fn app_types() {
  function recur_expr (line 2163) | fn recur_expr() {
  function app_purity (line 2188) | fn app_purity() {
  function impure_app_within_pure (line 2200) | fn impure_app_within_pure() {
  function too_many_args (line 2213) | fn too_many_args() {
  function not_enough_args (line 2223) | fn not_enough_args() {
  function list_destruc (line 2233) | fn list_destruc() {
  function var_ref (line 2242) | fn var_ref() {
  function ty_pred (line 2247) | fn ty_pred() {
  function eq_pred (line 2255) | fn eq_pred() {

FILE: driver/main.rs
  constant ARRET_FILE_EXTENSION (line 11) | const ARRET_FILE_EXTENSION: &str = ".arret";
  function input_arg_to_source_file (line 13) | fn input_arg_to_source_file(
  function main (line 33) | fn main() {

FILE: driver/subcommand/compile.rs
  constant MIR_OUTPUT_TYPE (line 10) | const MIR_OUTPUT_TYPE: arret_compiler::OutputType = arret_compiler::Outp...
  function try_compile_input_file (line 12) | fn try_compile_input_file(
  function compile_input_file (line 50) | pub fn compile_input_file(

FILE: driver/subcommand/eval.rs
  function try_eval_input_file (line 7) | fn try_eval_input_file(
  function eval_input_file (line 22) | pub fn eval_input_file(ccx: &CompileCtx, input_file: &arret_compiler::So...

FILE: driver/subcommand/repl/arret_helper.rs
  constant UNBOUND_COMPLETIONS (line 13) | const UNBOUND_COMPLETIONS: &[&str] = &[
  type ArretHelper (line 25) | pub struct ArretHelper {
    method new (line 46) | pub fn new(mut bound_names: Vec<DataStr>) -> ArretHelper {
    type Candidate (line 57) | type Candidate = String;
    method complete (line 59) | fn complete(
    type Hint (line 107) | type Hint = String;
    method hint (line 109) | fn hint(&self, line: &str, pos: usize, _: &rustyline::Context<'_>) -> ...
    method highlight (line 147) | fn highlight<'l>(&self, line: &'l str, _pos: usize) -> Cow<'l, str> {
    method highlight_prompt (line 175) | fn highlight_prompt<'b, 's: 'b, 'p: 'b>(
    method highlight_hint (line 184) | fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str> {
    method highlight_char (line 198) | fn highlight_char(&self, line: &str, _pos: usize) -> bool {
    method validate (line 208) | fn validate(
  function sorted_strings_prefixed_by (line 29) | fn sorted_strings_prefixed_by<'a, T: AsRef<str>>(
  function assert_sorted_strings_prefixed_by (line 225) | fn assert_sorted_strings_prefixed_by(
  function sorted_strings_prefixed_by_empty (line 239) | fn sorted_strings_prefixed_by_empty() {
  function sorted_strings_prefixed_by_missing_at_beginning (line 245) | fn sorted_strings_prefixed_by_missing_at_beginning() {
  function sorted_strings_prefixed_by_missing_in_middle (line 252) | fn sorted_strings_prefixed_by_missing_in_middle() {
  function sorted_strings_prefixed_by_missing_at_end (line 259) | fn sorted_strings_prefixed_by_missing_at_end() {
  function sorted_strings_prefixed_by_only_self (line 266) | fn sorted_strings_prefixed_by_only_self() {
  function strings_prefixed_by_only_other (line 272) | fn strings_prefixed_by_only_other() {
  function strings_prefixed_by_self_and_other (line 279) | fn strings_prefixed_by_self_and_other() {

FILE: driver/subcommand/repl/command.rs
  constant TYPE_ONLY_PREFIX (line 1) | pub const TYPE_ONLY_PREFIX: &str = "/type ";
  constant QUIT_COMMAND (line 2) | pub const QUIT_COMMAND: &str = "/quit";
  constant HELP_COMMAND (line 3) | pub const HELP_COMMAND: &str = "/help";
  type ParsedCommand (line 5) | pub enum ParsedCommand {
  function parse_command (line 12) | pub fn parse_command(mut line: String) -> ParsedCommand {

FILE: driver/subcommand/repl/history.rs
  function repl_history_path (line 6) | pub fn repl_history_path() -> Option<path::PathBuf> {

FILE: driver/subcommand/repl/mod.rs
  constant PROMPT (line 19) | const PROMPT: &str = "arret> ";
  function interactive_loop (line 21) | pub fn interactive_loop(ccx: Arc<CompileCtx>, include_path: Option<path:...

FILE: driver/subcommand/repl/syntax.rs
  constant MAXIMUM_PARSED_LINE_LEN (line 11) | pub const MAXIMUM_PARSED_LINE_LEN: usize = 512;
  function error_for_line (line 13) | pub fn error_for_line(mut line: &str) -> Option<arret_syntax::error::Err...
  function error_context_for_eol (line 36) | pub fn error_context_for_eol(line: &str) -> Option<arret_syntax::error::...

FILE: editors/code/src/test/downloadVsCode.ts
  function main (line 5) | async function main(): Promise<void> {

FILE: editors/code/src/test/runTest.ts
  function main (line 7) | async function main(): Promise<void> {

FILE: editors/code/src/test/suite/index.ts
  function run (line 5) | function run(): Promise<void> {

FILE: editors/code/src/test/vsCodeVersion.ts
  constant VSCODE_VERSION (line 1) | const VSCODE_VERSION = '1.60.0';

FILE: lsp-server/capabilities.rs
  function server_capabilities (line 1) | pub fn server_capabilities() -> lsp_types::ServerCapabilities {

FILE: lsp-server/handler/mod.rs
  type SyncNotificationHandler (line 13) | pub trait SyncNotificationHandler {
    method handle (line 16) | fn handle(state: &mut State, params: <Self::Notification as LspNotific...
  function handle_non_lifecycle_request (line 49) | pub fn handle_non_lifecycle_request(_state: &mut State, request: Request...

FILE: lsp-server/handler/text_synchronisation.rs
  type DidOpenTextDocumentHandler (line 8) | pub struct DidOpenTextDocumentHandler;
  type Notification (line 11) | type Notification = lsp_types::notification::DidOpenTextDocument;
  method handle (line 13) | fn handle(state: &mut State, params: lsp_types::DidOpenTextDocumentParam...
  type DidChangeTextDocumentHandler (line 26) | pub struct DidChangeTextDocumentHandler;
  type Notification (line 29) | type Notification = lsp_types::notification::DidChangeTextDocument;
  method handle (line 31) | fn handle(state: &mut State, params: lsp_types::DidChangeTextDocumentPar...
  type DidCloseTextDocumentHandler (line 85) | pub struct DidCloseTextDocumentHandler;
  type Notification (line 88) | type Notification = lsp_types::notification::DidCloseTextDocument;
  method handle (line 90) | fn handle(state: &mut State, params: lsp_types::DidCloseTextDocumentPara...

FILE: lsp-server/handler/workspace.rs
  type DidChangeWorkspaceFoldersHandler (line 7) | pub struct DidChangeWorkspaceFoldersHandler;
  type Notification (line 10) | type Notification = lsp_types::notification::DidChangeWorkspaceFolders;
  method handle (line 12) | fn handle(state: &mut State, params: lsp_types::DidChangeWorkspaceFolder...

FILE: lsp-server/json_rpc.rs
  type ErrorCode (line 6) | pub enum ErrorCode {
  type ClientMessage (line 14) | pub enum ClientMessage {
    method from (line 20) | fn from(request: Request) -> ClientMessage {
    method from (line 26) | fn from(notification: Notification) -> ClientMessage {
  type ServerMessage (line 33) | pub enum ServerMessage {
    method from (line 39) | fn from(response: Response) -> ServerMessage {
    method from (line 45) | fn from(notification: Notification) -> ServerMessage {
  type Notification (line 51) | pub struct Notification {
    method new (line 57) | pub fn new(method: impl Into<String>, params: impl Serialize) -> Self {
    method new_lsp (line 64) | pub fn new_lsp<N>(params: N::Params) -> Self
  type IdRepr (line 75) | enum IdRepr {
  type RequestId (line 82) | pub struct RequestId(IdRepr);
    method from (line 85) | fn from(id: u64) -> RequestId {
    method from (line 91) | fn from(id: String) -> RequestId {
  type Request (line 97) | pub struct Request {
    method new (line 105) | pub fn new(id: RequestId, method: impl Into<String>, params: impl Seri...
    method new_lsp (line 114) | pub fn new_lsp<N>(id: RequestId, params: N::Params) -> Self
  type Response (line 124) | pub struct Response {
    method new_ok (line 141) | pub fn new_ok(id: RequestId, result: impl Serialize) -> Response {
    method new_err (line 149) | pub fn new_err(id: RequestId, code: ErrorCode, message: impl Into<Stri...
  type ResponseError (line 133) | pub struct ResponseError {

FILE: lsp-server/main.rs
  function main (line 12) | async fn main() -> Result<(), ()> {

FILE: lsp-server/model/document.rs
  type Document (line 4) | pub struct Document {
    method new (line 17) | pub fn new(version: i32, text: String) -> Document {
    method with_range_edit (line 26) | pub fn with_range_edit(
    method version (line 74) | pub fn version(&self) -> i32 {
    method text (line 79) | pub fn text(&self) -> &str {
    method span_to_range (line 84) | pub fn span_to_range(&self, span: Span) -> lsp_types::Range {
    method offset_to_position (line 92) | pub fn offset_to_position(&self, offset: usize) -> lsp_types::Position {
    method position_to_offset (line 114) | fn position_to_offset(&self, position: lsp_types::Position) -> Option<...
  function line_offsets_for_str (line 10) | fn line_offsets_for_str(source: &str) -> Vec<usize> {
  function assert_consistency (line 141) | fn assert_consistency(doc: &Document) {
  function test_positions (line 146) | fn test_positions() {
  function test_append_to_empty (line 191) | fn test_append_to_empty() {
  function test_append_to_line (line 214) | fn test_append_to_line() {
  function test_erase_all (line 237) | fn test_erase_all() {
  function test_replace_line (line 260) | fn test_replace_line() {
  function test_insert_line (line 283) | fn test_insert_line() {
  function test_delete_line (line 306) | fn test_delete_line() {
  function test_delete_utf16 (line 329) | fn test_delete_utf16() {

FILE: lsp-server/model/workspace.rs
  type Workspace (line 2) | pub struct Workspace {
    method new (line 7) | pub fn new(name: String) -> Workspace {

FILE: lsp-server/session.rs
  type State (line 13) | pub struct State {
    method new (line 20) | fn new(
    method shutdown (line 46) | async fn shutdown(self) {
  function create_initialize_response (line 51) | pub fn create_initialize_response() -> lsp_types::InitializeResult {
  function run (line 65) | pub async fn run(connection: Connection) -> Result<(), ()> {
  type TestSession (line 187) | struct TestSession<F>
  function run_test_session (line 196) | fn run_test_session() -> TestSession<impl Future<Output = Result<(), ()>...
  function expect_response (line 212) | fn expect_response(server_message: ServerMessage) -> Response {
  function test_clean_lifecycle (line 222) | async fn test_clean_lifecycle() {

FILE: lsp-server/transport/bytestream.rs
  function parse_header_line (line 8) | fn parse_header_line(header_line: &str) -> (String, String) {
  function create_connection (line 41) | pub fn create_connection(
  function test_happy_recv_notification (line 131) | async fn test_happy_recv_notification() {

FILE: lsp-server/transport/mod.rs
  type Connection (line 7) | pub struct Connection {

FILE: lsp-server/watcher/mod.rs
  type DocumentWatcher (line 9) | pub trait DocumentWatcher {
    method did_open (line 11) | fn did_open(&mut self, _url: &lsp_types::Url, _document: &Arc<Document...
    method did_change (line 14) | fn did_change(&mut self, _url: &lsp_types::Url, _document: &Arc<Docume...
    method did_close (line 17) | fn did_close(&mut self, _url: &lsp_types::Url) {}

FILE: lsp-server/watcher/syntax.rs
  function syntax_diagnostics_for_document (line 13) | fn syntax_diagnostics_for_document(
  type DocumentTask (line 58) | struct DocumentTask {
    method new (line 64) | pub fn new(
    method did_change (line 105) | fn did_change(&self, document: Arc<Document>) {
    method shutdown (line 111) | async fn shutdown(self) {
  type SyntaxWatcher (line 119) | pub struct SyntaxWatcher {
    method new (line 125) | pub fn new(outgoing: mpsc::Sender<ServerMessage>) -> SyntaxWatcher {
    method shutdown (line 132) | pub async fn shutdown(self) {
  method did_open (line 146) | fn did_open(&mut self, url: &lsp_types::Url, document: &Arc<Document>) {
  method did_change (line 153) | fn did_change(&mut self, url: &lsp_types::Url, document: &Arc<Document>) {
  method did_close (line 159) | fn did_close(&mut self, url: &lsp_types::Url) {
  function correct_document_diagnostics (line 169) | fn correct_document_diagnostics() {
  function missing_delimiter_diagnostics (line 179) | fn missing_delimiter_diagnostics() {
  function unsupported_character_diagnostics (line 241) | fn unsupported_character_diagnostics() {

FILE: rfi-derive/lib.rs
  function arg_is_task (line 9) | fn arg_is_task(arg: &syn::PatType) -> bool {
  function rust_fun (line 32) | pub fn rust_fun(

FILE: runtime-syntax/reader.rs
  function box_syntax_datum (line 8) | pub fn box_syntax_datum(heap: &mut impl boxed::AsHeap, datum: &Datum) ->...

FILE: runtime-syntax/writer.rs
  function write_escaped_str (line 30) | fn write_escaped_str(w: &mut dyn Write, source: &str) -> Result<()> {
  function write_boxed_seq (line 43) | fn write_boxed_seq(
  function write_boxed_map (line 62) | fn write_boxed_map(
  function write_char (line 86) | fn write_char(w: &mut dyn Write, c: char) -> Result<()> {
  function write_float (line 98) | fn write_float(w: &mut dyn Write, f: f64) -> Result<()> {
  function write_interned_sym (line 117) | fn write_interned_sym(
  function write_record (line 134) | fn write_record(w: &mut dyn Write, heap: &impl AsHeap, record: &boxed::R...
  function write_boxed (line 163) | pub fn write_boxed(w: &mut dyn Write, heap: &impl AsHeap, any_ref: Gc<bo...
  function pretty_print_boxed (line 201) | pub fn pretty_print_boxed(write: &mut dyn Write, heap: &impl AsHeap, any...
  function string_for_boxed (line 227) | fn string_for_boxed(heap: &boxed::Heap, any_ref: Gc<boxed::Any>) -> Stri...
  function assert_write (line 235) | fn assert_write(heap: &mut boxed::Heap, expected: &'static str, any_ref:...
  function bools (line 251) | fn bools() {
  function ints (line 258) | fn ints() {
  function floats (line 272) | fn floats() {
  function sym (line 294) | fn sym() {
  function lists (line 305) | fn lists() {
  function vectors (line 320) | fn vectors() {
  function chars (line 337) | fn chars() {
  function strings (line 358) | fn strings() {

FILE: runtime/abitype.rs
  type BoxedAbiType (line 12) | pub enum BoxedAbiType {
    method from (line 163) | fn from(type_tag: boxed::TypeTag) -> BoxedAbiType {
    method into_abi_type (line 169) | pub fn into_abi_type(self) -> AbiType {
  constant TOP_LIST_BOXED_ABI_TYPE (line 23) | pub const TOP_LIST_BOXED_ABI_TYPE: BoxedAbiType = BoxedAbiType::List(&Bo...
  type AbiType (line 27) | pub enum AbiType {
    method from (line 175) | fn from(type_tag: boxed::TypeTag) -> AbiType {
    method from (line 181) | fn from(boxed_abi_type: BoxedAbiType) -> AbiType {
    method into_ret_abi_type (line 187) | pub fn into_ret_abi_type(self) -> RetAbiType {
    method into_param_abi_type (line 191) | pub fn into_param_abi_type(self) -> ParamAbiType {
    method may_contain_gc_refs (line 203) | pub fn may_contain_gc_refs(&self) -> bool {
  type ParamCapture (line 62) | pub enum ParamCapture {
  type ParamAbiType (line 72) | pub struct ParamAbiType {
    method from (line 212) | fn from(type_tag: boxed::TypeTag) -> ParamAbiType {
    method from (line 221) | fn from(boxed_abi_type: BoxedAbiType) -> ParamAbiType {
    method from (line 227) | fn from(abi_type: AbiType) -> ParamAbiType {
  type RetAbiType (line 78) | pub enum RetAbiType {
    method from (line 233) | fn from(type_tag: boxed::TypeTag) -> RetAbiType {
    method from (line 241) | fn from(boxed_abi_type: BoxedAbiType) -> RetAbiType {
    method from (line 247) | fn from(abi_type: AbiType) -> RetAbiType {
  type EncodeAbiType (line 84) | pub trait EncodeAbiType {
    constant ABI_TYPE (line 85) | const ABI_TYPE: AbiType;
    constant PARAM_CAPTURE (line 87) | const PARAM_CAPTURE: ParamCapture = ParamCapture::Never;
    constant PARAM_ABI_TYPE (line 89) | const PARAM_ABI_TYPE: ParamAbiType = ParamAbiType {
    constant ABI_TYPE (line 96) | const ABI_TYPE: AbiType = AbiType::Float;
    constant ABI_TYPE (line 100) | const ABI_TYPE: AbiType = AbiType::Int;
    constant ABI_TYPE (line 104) | const ABI_TYPE: AbiType = AbiType::Char;
    constant ABI_TYPE (line 108) | const ABI_TYPE: AbiType = AbiType::Bool;
    constant ABI_TYPE (line 115) | const ABI_TYPE: AbiType = AbiType::Boxed(T::BOXED_ABI_TYPE);
    constant PARAM_CAPTURE (line 116) | const PARAM_CAPTURE: ParamCapture = ParamCapture::Auto;
    constant ABI_TYPE (line 123) | const ABI_TYPE: AbiType = AbiType::Boxed(T::BOXED_ABI_TYPE);
    constant PARAM_CAPTURE (line 124) | const PARAM_CAPTURE: ParamCapture = ParamCapture::Never;
    constant ABI_TYPE (line 131) | const ABI_TYPE: AbiType = AbiType::Boxed(T::BOXED_ABI_TYPE);
    constant PARAM_CAPTURE (line 132) | const PARAM_CAPTURE: ParamCapture = ParamCapture::Always;
    constant ABI_TYPE (line 139) | const ABI_TYPE: AbiType = AbiType::Callback(&F::ENTRY_POINT_ABI_TYPE);
  type EncodeBoxedAbiType (line 142) | pub trait EncodeBoxedAbiType {
    constant BOXED_ABI_TYPE (line 143) | const BOXED_ABI_TYPE: BoxedAbiType;
  type EncodeRetAbiType (line 146) | pub trait EncodeRetAbiType {
    constant RET_ABI_TYPE (line 147) | const RET_ABI_TYPE: RetAbiType;
    constant RET_ABI_TYPE (line 151) | const RET_ABI_TYPE: RetAbiType = RetAbiType::Inhabited(Self::ABI_TYPE);
    constant RET_ABI_TYPE (line 155) | const RET_ABI_TYPE: RetAbiType = RetAbiType::Void;
    constant RET_ABI_TYPE (line 159) | const RET_ABI_TYPE: RetAbiType = RetAbiType::Never;

FILE: runtime/binding.rs
  type RustFun (line 9) | pub struct RustFun {
  type RustExports (line 17) | pub type RustExports = &'static [(&'static str, &'static RustFun)];
  type Never (line 20) | pub enum Never {}

FILE: runtime/boxed/heap/collect.rs
  type ForwardingCell (line 15) | struct ForwardingCell {
  type StrongPass (line 26) | pub struct StrongPass {
    method new (line 33) | pub fn new(old_heap: Heap) -> StrongPass {
    method into_weak_pass (line 43) | pub fn into_weak_pass(self) -> WeakPass {
    method into_new_heap (line 51) | pub fn into_new_heap(self) -> Heap {
    method visit_box (line 58) | pub fn visit_box<T: Boxed>(&mut self, box_ref: &mut Gc<T>) {
    method move_box_to_new_heap (line 63) | fn move_box_to_new_heap(new_heap: &mut Heap, box_ref: &mut Gc<boxed::A...
    method visit_interned_sym (line 99) | fn visit_interned_sym(old_heap: &Heap, new_heap: &mut Heap, interned_s...
    method visit_any_box (line 107) | fn visit_any_box(old_heap: &Heap, new_heap: &mut Heap, mut box_ref: &m...
  type WeakPass (line 194) | pub struct WeakPass {
    method into_new_heap (line 202) | pub fn into_new_heap(self) -> Heap {
    method new_heap_ref_for (line 212) | pub fn new_heap_ref_for<T: Boxed>(&self, boxed: Gc<T>) -> Option<Gc<T>> {
    method new_heap_any_ref_for (line 218) | fn new_heap_any_ref_for(&self, box_ref: Gc<boxed::Any>) -> Option<Gc<b...
  function simple_collect (line 240) | fn simple_collect() {
  function sym_collect (line 283) | fn sym_collect() {
  function list_collect (line 307) | fn list_collect() {
  function vector_collect (line 341) | fn vector_collect() {

FILE: runtime/boxed/heap/mod.rs
  type Segment (line 16) | pub struct Segment {
    method with_capacity (line 33) | fn with_capacity(count: usize) -> Segment {
    method alloc_cells (line 54) | fn alloc_cells(&mut self, count: usize) -> Option<*mut Any> {
    method len (line 69) | fn len(&self) -> usize {
  type Heap (line 24) | pub struct Heap {
    constant DEFAULT_SEGMENT_CAPACITY (line 106) | const DEFAULT_SEGMENT_CAPACITY: usize = 1024;
    constant DEFAULT_CAPACITY (line 109) | const DEFAULT_CAPACITY: usize = Self::DEFAULT_SEGMENT_CAPACITY;
    method empty (line 112) | pub fn empty() -> Heap {
    method new (line 117) | pub fn new(type_info: TypeInfo, count: usize) -> Heap {
    method should_collect (line 129) | pub fn should_collect(&self) -> bool {
    method save_len_at_gc (line 134) | fn save_len_at_gc(&mut self) {
    method alloc_cells (line 139) | pub fn alloc_cells(&mut self, count: usize) -> *mut Any {
    method type_info (line 159) | pub fn type_info(&self) -> &TypeInfo {
    method type_info_mut (line 164) | pub fn type_info_mut(&mut self) -> &mut TypeInfo {
    method len (line 169) | pub fn len(&self) -> usize {
    method is_empty (line 175) | pub fn is_empty(&self) -> bool {
    method place_box (line 180) | pub fn place_box<T: Boxed>(&mut self, boxed: T) -> Gc<T> {
  method drop (line 76) | fn drop(&mut self) {
  method default (line 202) | fn default() -> Self {
  type AsHeap (line 208) | pub trait AsHeap {
    method as_heap (line 210) | fn as_heap(&self) -> &Heap;
    method as_heap_mut (line 213) | fn as_heap_mut(&mut self) -> &mut Heap;
    method as_heap (line 217) | fn as_heap(&self) -> &Heap {
    method as_heap_mut (line 221) | fn as_heap_mut(&mut self) -> &mut Heap {
  method as_interner (line 227) | fn as_interner(&self) -> &Interner {
  function basic_alloc (line 237) | fn basic_alloc() {

FILE: runtime/boxed/heap/type_info.rs
  type TypeInfo (line 9) | pub struct TypeInfo {
    method new (line 16) | pub fn new(interner: Interner, class_map: ClassMap) -> TypeInfo {
    method empty (line 24) | pub fn empty() -> TypeInfo {
    method clone_for_collect_garbage (line 29) | pub fn clone_for_collect_garbage(&self) -> Self {
    method interner (line 37) | pub fn interner(&self) -> &Interner {
    method interner_mut (line 42) | pub fn interner_mut(&mut self) -> &mut Interner {
    method class_map (line 47) | pub fn class_map(&self) -> &ClassMap {
    method class_map_mut (line 52) | pub fn class_map_mut(&mut self) -> &mut ClassMap {
  method as_interner (line 58) | fn as_interner(&self) -> &Interner {

FILE: runtime/boxed/mod.rs
  type BoxSize (line 51) | pub enum BoxSize {
    method cell_count (line 60) | pub fn cell_count(self) -> usize {
    method to_heap_alloc_type (line 68) | pub fn to_heap_alloc_type(self) -> AllocType {
  type AllocType (line 79) | pub enum AllocType {
    method to_heap_box_size (line 102) | pub fn to_heap_box_size(self) -> Option<BoxSize> {
  type Header (line 114) | pub struct Header {
    method new (line 121) | pub fn new(type_tag: TypeTag, alloc_type: AllocType) -> Header {
    method type_tag (line 129) | pub fn type_tag(self) -> TypeTag {
    method alloc_type (line 134) | pub fn alloc_type(self) -> AllocType {
  type PartialEqInHeap (line 143) | pub trait PartialEqInHeap {
    method eq_in_heap (line 147) | fn eq_in_heap(&self, heap: &Heap, other: &Self) -> bool;
    method eq_in_heap (line 154) | fn eq_in_heap(&self, _heap: &Heap, other: &Self) -> bool {
  type HashInHeap (line 162) | pub trait HashInHeap {
    method hash_in_heap (line 164) | fn hash_in_heap<H: Hasher>(&self, heap: &Heap, state: &mut H);
    method hash_in_heap (line 171) | fn hash_in_heap<H: Hasher>(&self, _heap: &Heap, state: &mut H) {
  type Boxed (line 180) | pub trait Boxed: Sized + PartialEqInHeap + HashInHeap + fmt::Debug {
    method as_any_ref (line 182) | fn as_any_ref(&self) -> Gc<Any> {
    method header (line 187) | fn header(&self) -> Header {
  constant BOXED_ABI_TYPE (line 193) | const BOXED_ABI_TYPE: BoxedAbiType = BoxedAbiType::Any;
  type ConstTagged (line 202) | pub trait ConstTagged: Boxed {
    constant TYPE_TAG (line 204) | const TYPE_TAG: TypeTag;
  type DistinctTagged (line 214) | pub trait DistinctTagged: Boxed {
    method has_tag (line 216) | fn has_tag(type_tag: TypeTag) -> bool;
  type UniqueTagged (line 225) | pub trait UniqueTagged: ConstTagged + DistinctTagged {}
  constant BOXED_ABI_TYPE (line 228) | const BOXED_ABI_TYPE: BoxedAbiType = BoxedAbiType::UniqueTagged(T::TYPE_...
  method to_boxed_abi_type (line 284) | pub fn to_boxed_abi_type(self) -> BoxedAbiType {
  method to_const_header (line 289) | pub fn to_const_header(self) -> Header {
  method to_heap_header (line 294) | pub fn to_heap_header(self, box_size: BoxSize) -> Header {
  method singleton_ref (line 547) | pub fn singleton_ref(value: bool) -> Gc<Bool> {
  method as_bool (line 556) | pub fn as_bool(&self) -> bool {
  function sizes (line 570) | fn sizes() {
  function downcast_ref (line 578) | fn downcast_ref() {
  function as_tagged (line 589) | fn as_tagged() {
  function any_equality (line 602) | fn any_equality() {
  function any_fmt_debug (line 621) | fn any_fmt_debug() {
  function union_types (line 630) | fn union_types() {

FILE: runtime/boxed/refs.rs
  type Gc (line 15) | pub struct Gc<T: Boxed> {
  method clone (line 21) | fn clone(&self) -> Self {
  type Target (line 29) | type Target = T;
  method deref (line 30) | fn deref(&self) -> &T {
  function new (line 40) | pub unsafe fn new(ptr: *const T) -> Gc<T> {
  function cast (line 50) | pub unsafe fn cast<U: Boxed>(self) -> Gc<U> {
  function as_ptr (line 57) | pub fn as_ptr(self) -> *const T {
  function as_mut_ptr (line 62) | pub(super) fn as_mut_ptr(self) -> *mut T {
  method eq (line 71) | fn eq(&self, other: &Gc<T>) -> bool {
  function hash (line 82) | fn hash<H: hash::Hasher>(&self, state: &mut H) {
  function fmt (line 91) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Err...

FILE: runtime/boxed/types/char.rs
  type Char (line 11) | pub struct Char {
    method new (line 21) | pub fn new(heap: &mut impl AsHeap, value: char) -> Gc<Char> {
    method size (line 29) | pub fn size() -> BoxSize {
    method value (line 34) | pub fn value(&self) -> char {
    method fmt (line 53) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::E...
  method eq (line 40) | fn eq(&self, other: &Char) -> bool {
  method hash (line 46) | fn hash<H: Hasher>(&self, state: &mut H) {
  function sizes (line 65) | fn sizes() {
  function equality (line 70) | fn equality() {
  function fmt_debug (line 82) | fn fmt_debug() {

FILE: runtime/boxed/types/field_value.rs
  type FieldValue (line 11) | pub enum FieldValue {
  type FieldGcRef (line 26) | pub(crate) enum FieldGcRef {
  method eq_in_heap (line 32) | fn eq_in_heap(&self, heap: &boxed::Heap, other: &FieldValue) -> bool {
  method hash_in_heap (line 46) | fn hash_in_heap<H: Hasher>(&self, heap: &boxed::Heap, state: &mut H) {
  type FieldValueIter (line 66) | pub struct FieldValueIter<'cm> {
  type Item (line 72) | type Item = FieldValue;
  method next (line 74) | fn next(&mut self) -> Option<FieldValue> {
  type FieldGcRefIter (line 98) | pub(crate) struct FieldGcRefIter<'cm> {
  function empty (line 104) | pub(crate) fn empty() -> FieldGcRefIter<'static> {
  type Item (line 113) | type Item = FieldGcRef;
  method next (line 115) | fn next(&mut self) -> Option<FieldGcRef> {

FILE: runtime/boxed/types/float.rs
  type Float (line 9) | pub struct Float {
    method new (line 19) | pub fn new(heap: &mut impl AsHeap, value: f64) -> Gc<Float> {
    method size (line 27) | pub fn size() -> BoxSize {
    method value (line 32) | pub fn value(&self) -> f64 {
    method fmt (line 59) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::E...
  method eq (line 38) | fn eq(&self, other: &Float) -> bool {
  method hash (line 44) | fn hash<H: Hasher>(&self, state: &mut H) {
  function calc_hash (line 70) | fn calc_hash(value: f64) -> u64 {
  function sizes (line 82) | fn sizes() {
  function equality (line 87) | fn equality() {
  function hash (line 99) | fn hash() {
  function fmt_debug (line 109) | fn fmt_debug() {

FILE: runtime/boxed/types/fun.rs
  type Captures (line 14) | pub type Captures = Gc<Any>;
  type ThunkEntry (line 17) | pub type ThunkEntry = extern "C" fn(&mut task::Task, Captures, Gc<Any>) ...
  type FunThunk (line 26) | pub struct FunThunk {
    method new (line 37) | pub fn new(heap: &mut impl AsHeap, captures: Captures, entry: ThunkEnt...
    method size (line 46) | pub fn size() -> BoxSize {
    method apply (line 51) | pub fn apply(&self, task: &mut task::Task, arg_list: Gc<Any>) -> Gc<An...
    method fmt (line 73) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::E...
  method eq (line 57) | fn eq(&self, _: &FunThunk) -> bool {
  method hash (line 66) | fn hash<H: Hasher>(&self, state: &mut H) {
  function identity_entry (line 85) | extern "C" fn identity_entry(
  function return_42_entry (line 93) | extern "C" fn return_42_entry(
  function sizes (line 102) | fn sizes() {
  function equality (line 107) | fn equality() {

FILE: runtime/boxed/types/int.rs
  type Int (line 9) | pub struct Int {
    method new (line 19) | pub fn new(heap: &mut impl AsHeap, value: i64) -> Gc<Int> {
    method size (line 27) | pub fn size() -> BoxSize {
    method value (line 32) | pub fn value(&self) -> i64 {
    method fmt (line 51) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::E...
  method eq (line 38) | fn eq(&self, other: &Int) -> bool {
  method hash (line 44) | fn hash<H: Hasher>(&self, state: &mut H) {
  function sizes (line 63) | fn sizes() {
  function equality (line 68) | fn equality() {
  function fmt_debug (line 80) | fn fmt_debug() {

FILE: runtime/boxed/types/list.rs
  type Pair (line 12) | pub struct Pair<T: Boxed = Any> {
  constant BOXED_ABI_TYPE (line 24) | const BOXED_ABI_TYPE: BoxedAbiType = BoxedAbiType::Pair(&T::BOXED_ABI_TY...
  function new (line 29) | pub fn new(heap: &mut impl AsHeap, head: Gc<T>, rest: Gc<List<T>>) -> Gc...
  function size (line 39) | pub fn size() -> BoxSize {
  function len (line 46) | pub fn len(&self) -> usize {
  function is_empty (line 51) | pub fn is_empty(&self) -> bool {
  function head (line 57) | pub fn head(&self) -> Gc<T> {
  function rest (line 62) | pub fn rest(&self) -> Gc<List<T>> {
  function as_list_ref (line 67) | pub fn as_list_ref(&self) -> Gc<List<T>> {
  method eq_in_heap (line 73) | fn eq_in_heap(&self, heap: &Heap, rhs: &Pair<T>) -> bool {
  method hash_in_heap (line 79) | fn hash_in_heap<H: Hasher>(&self, task: &Heap, state: &mut H) {
  function fmt (line 87) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Err...
  type List (line 97) | pub struct List<T: Boxed = Any> {
  method has_tag (line 106) | fn has_tag(type_tag: TypeTag) -> bool {
  constant BOXED_ABI_TYPE (line 115) | const BOXED_ABI_TYPE: BoxedAbiType = BoxedAbiType::List(&T::BOXED_ABI_TY...
  type ListSubtype (line 119) | pub enum ListSubtype<'a, T: Boxed> {
  function new (line 128) | pub fn new(heap: &mut impl AsHeap, elems: impl ExactSizeIterator<Item = ...
  function new_with_tail (line 133) | pub fn new_with_tail(
  function empty (line 175) | pub fn empty() -> Gc<List<T>> {
  function from_values (line 180) | pub fn from_values<V, F>(
  function as_subtype (line 195) | pub fn as_subtype(&self) -> ListSubtype<'_, T> {
  function len (line 208) | pub fn len(&self) -> usize {
  function is_empty (line 213) | pub fn is_empty(&self) -> bool {
  function iter (line 218) | pub fn iter(&self) -> ListIterator<T> {
  method eq_in_heap (line 226) | fn eq_in_heap(&self, heap: &Heap, other: &List<T>) -> bool {
  method hash_in_heap (line 238) | fn hash_in_heap<H: Hasher>(&self, heap: &Heap, state: &mut H) {
  function fmt (line 247) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Err...
  type ListIterator (line 254) | pub struct ListIterator<T: Boxed> {
  type Item (line 259) | type Item = Gc<T>;
  method next (line 261) | fn next(&mut self) -> Option<Gc<T>> {
  method size_hint (line 274) | fn size_hint(&self) -> (usize, Option<usize>) {
  type Nil (line 285) | pub struct Nil {
  method eq (line 304) | fn eq(&self, _: &Nil) -> bool {
  method hash (line 310) | fn hash<H: Hasher>(&self, state: &mut H) {
  function sizes (line 324) | fn sizes() {
  function equality (line 331) | fn equality() {
  function fmt_debug (line 345) | fn fmt_debug() {
  function construct_and_iter (line 356) | fn construct_and_iter() {

FILE: runtime/boxed/types/map.rs
  type Map (line 11) | pub struct Map<K: Boxed = Any, V: Boxed = Any> {
  function new (line 21) | pub fn new(
  function from_values (line 37) | pub fn from_values<T, F>(
  function size (line 57) | pub fn size() -> BoxSize {
  function is_empty (line 62) | pub fn is_empty(&self) -> bool {
  function len (line 67) | pub fn len(&self) -> usize {
  function iter (line 72) | pub fn iter(&self) -> impl Iterator<Item = (Gc<K>, Gc<V>)> + '_ {
  method eq_in_heap (line 78) | fn eq_in_heap(&self, _heap: &Heap, _other: &Map<K, V>) -> bool {
  method hash_in_heap (line 85) | fn hash_in_heap<H: Hasher>(&self, _heap: &Heap, state: &mut H) {
  function fmt (line 91) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Err...
  constant BOXED_ABI_TYPE (line 103) | const BOXED_ABI_TYPE: BoxedAbiType = BoxedAbiType::Map(&K::BOXED_ABI_TYP...
  function sizes (line 112) | fn sizes() {

FILE: runtime/boxed/types/record.rs
  type RecordClassId (line 13) | pub type RecordClassId = u32;
  type RecordHeader (line 16) | struct RecordHeader {
  type RecordStorage (line 25) | pub enum RecordStorage {
    method box_size (line 34) | pub fn box_size(self) -> BoxSize {
  type Record (line 44) | pub struct Record {
    constant MAX_INLINE_BYTES (line 53) | pub const MAX_INLINE_BYTES: usize = 24;
    constant EXTERNAL_INLINE_LEN (line 56) | pub const EXTERNAL_INLINE_LEN: u8 = (Self::MAX_INLINE_BYTES as u8) + 1;
    constant INLINE_DATA_ALIGNMENT (line 59) | const INLINE_DATA_ALIGNMENT: usize = 8;
    method new (line 62) | pub fn new(heap: &mut impl AsHeap, class_id: RecordClassId, data: Reco...
    method storage_for_data_layout (line 81) | pub fn storage_for_data_layout(data_layout: Option<alloc::Layout>) -> ...
    method class_id (line 100) | pub fn class_id(&self) -> RecordClassId {
    method field_values (line 105) | pub fn field_values<'cm>(&self, heap: &'cm Heap) -> FieldValueIter<'cm> {
    method field_gc_refs (line 117) | pub(crate) fn field_gc_refs<'cm>(&mut self, heap: &'cm Heap) -> FieldG...
    method data_ptr (line 133) | fn data_ptr(&self) -> *const u8 {
    method is_empty (line 140) | fn is_empty(&self) -> bool {
    method is_inline (line 144) | fn is_inline(&self) -> bool {
    method as_repr (line 148) | fn as_repr(&self) -> Repr<'_> {
    method as_repr_mut (line 156) | fn as_repr_mut(&mut self) -> ReprMut<'_> {
    method fmt (line 195) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::E...
  method eq_in_heap (line 166) | fn eq_in_heap(&self, heap: &Heap, other: &Record) -> bool {
  method hash_in_heap (line 182) | fn hash_in_heap<H: Hasher>(&self, heap: &Heap, state: &mut H) {
  type InlineRecord (line 201) | struct InlineRecord {
    method new (line 207) | fn new(box_size: BoxSize, class_id: RecordClassId, data: RecordData) -...
  type ExternalRecord (line 239) | struct ExternalRecord {
    method new (line 245) | fn new(box_size: BoxSize, class_id: RecordClassId, data: RecordData) -...
  type Repr (line 262) | enum Repr<'a> {
  type ReprMut (line 267) | enum ReprMut<'a> {
  method drop (line 273) | fn drop(&mut self) {
  function sizes (line 290) | fn sizes() {
  function equality (line 297) | fn equality() {
  function fmt_debug (line 309) | fn fmt_debug() {

FILE: runtime/boxed/types/record_data.rs
  type RecordData (line 5) | pub struct RecordData {
    method empty (line 12) | pub fn empty() -> Self {
    method alloc (line 17) | pub fn alloc(data_layout: Option<alloc::Layout>) -> Self {
    method as_ptr (line 30) | pub fn as_ptr(&self) -> *const u8 {
    method as_mut_ptr (line 35) | pub fn as_mut_ptr(&mut self) -> *mut u8 {
    method layout (line 40) | pub fn layout(&self) -> Option<alloc::Layout> {
    method alloc_layout_to_compact (line 47) | pub fn alloc_layout_to_compact(alloc_layout: Option<alloc::Layout>) ->...
    method compact_to_alloc_layout (line 57) | fn compact_to_alloc_layout(input: u64) -> Option<alloc::Layout> {
  method drop (line 70) | fn drop(&mut self) {
  function test_alloc_layout_to_u64 (line 84) | fn test_alloc_layout_to_u64() {

FILE: runtime/boxed/types/set.rs
  constant MAX_16BYTE_INLINE_LEN (line 10) | const MAX_16BYTE_INLINE_LEN: usize = (16 - 8) / mem::size_of::<Gc<Any>>();
  constant MAX_32BYTE_INLINE_LEN (line 11) | const MAX_32BYTE_INLINE_LEN: usize = (32 - 8) / mem::size_of::<Gc<Any>>();
  type SetStorage (line 15) | pub enum SetStorage {
    method box_size (line 24) | pub fn box_size(self) -> BoxSize {
  type Set (line 36) | pub struct Set<T: Boxed = Any> {
  constant MAX_INLINE_LEN (line 47) | pub const MAX_INLINE_LEN: usize = MAX_32BYTE_INLINE_LEN;
  constant EXTERNAL_INLINE_LEN (line 50) | pub const EXTERNAL_INLINE_LEN: u32 = (Self::MAX_INLINE_LEN as u32) + 1;
  function new (line 53) | pub fn new(heap: &mut impl AsHeap, values: impl ExactSizeIterator<Item =...
  function storage_for_element_len (line 84) | fn storage_for_element_len(len: usize) -> SetStorage {
  function from_values (line 98) | pub fn from_values<V, F>(
  function is_inline (line 112) | fn is_inline(&self) -> bool {
  function as_repr (line 116) | fn as_repr(&self) -> Repr<'_, T> {
  function as_repr_mut (line 124) | fn as_repr_mut(&mut self) -> ReprMut<'_, T> {
  function len (line 133) | pub fn len(&self) -> usize {
  function is_empty (line 141) | pub fn is_empty(&self) -> bool {
  function contains (line 146) | pub fn contains(&self, heap: &Heap, value: &Gc<T>) -> bool {
  function iter (line 154) | pub fn iter<'a>(&'a self) -> Box<dyn ExactSizeIterator<Item = Gc<T>> + '...
  function is_subset (line 163) | pub fn is_subset(&self, heap: &Heap, other: &Set<T>) -> bool {
  method eq_in_heap (line 187) | fn eq_in_heap(&self, heap: &Heap, other: &Set<T>) -> bool {
  method hash_in_heap (line 201) | fn hash_in_heap<H: Hasher>(&self, heap: &Heap, state: &mut H) {
  function fmt (line 210) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Err...
  constant BOXED_ABI_TYPE (line 221) | const BOXED_ABI_TYPE: BoxedAbiType = BoxedAbiType::Set(&T::BOXED_ABI_TYPE);
  type InlineSet (line 225) | pub struct InlineSet<T: Boxed> {
  function new (line 232) | fn new(header: Header, hashed_values: Vec<(u64, Gc<T>)>) -> InlineSet<T> {
  function len (line 248) | fn len(&self) -> usize {
  function iter (line 252) | fn iter(&self) -> impl ExactSizeIterator<Item = Gc<T>> + '_ {
  function contains (line 258) | fn contains(&self, heap: &Heap, value: &Gc<T>) -> bool {
  function eq_in_heap (line 262) | fn eq_in_heap(&self, heap: &Heap, other: &InlineSet<T>) -> bool {
  function hash_in_heap (line 272) | fn hash_in_heap<H: Hasher>(&self, heap: &Heap, state: &mut H) {
  type ExternalSet (line 282) | pub struct ExternalSet<T: Boxed> {
  function new (line 289) | fn new(header: Header, sorted_hashed_values: Vec<(u64, Gc<T>)>) -> Exter...
  function len (line 297) | fn len(&self) -> usize {
  function iter (line 301) | fn iter(&self) -> impl ExactSizeIterator<Item = &Gc<T>> {
  function contains (line 305) | fn contains(&self, heap: &Heap, needle_value: &Gc<T>) -> bool {
  function is_subset (line 358) | fn is_subset(&self, heap: &Heap, other: &ExternalSet<T>) -> bool {
  function eq_in_heap (line 393) | fn eq_in_heap(&self, heap: &Heap, other: &ExternalSet<T>) -> bool {
  function hash_in_heap (line 406) | fn hash_in_heap<H: Hasher>(&self, _: &Heap, state: &mut H) {
  type Repr (line 417) | enum Repr<'a, T: Boxed> {
  type ReprMut (line 422) | enum ReprMut<'a, T: Boxed> {
  method drop (line 428) | fn drop(&mut self) {
  function sizes (line 449) | fn sizes() {
  function inline_equality (line 456) | fn inline_equality() {
  function inline_contains (line 482) | fn inline_contains() {
  function external_equality (line 511) | fn external_equality() {
  function external_contains (line 544) | fn external_contains() {
  function subset (line 584) | fn subset() {

FILE: runtime/boxed/types/shared_str.rs
  constant GLOBAL_CONSTANT_REFCOUNT (line 5) | const GLOBAL_CONSTANT_REFCOUNT: u64 = std::u64::MAX;
  type DataHeader (line 11) | struct DataHeader {
  type SharedStrData (line 18) | struct SharedStrData {
    method new (line 25) | fn new(value: &str) -> *mut SharedStrData {
    method as_str (line 45) | fn as_str(&self) -> &str {
    method layout_for_byte_len (line 52) | fn layout_for_byte_len(len: usize) -> alloc::Layout {
    method is_global_constant (line 61) | fn is_global_constant(&self) -> bool {
    method take_ref (line 67) | fn take_ref(&mut self) -> *mut SharedStrData {
    method release_ref (line 83) | unsafe fn release_ref(&mut self) {
  type SharedStr (line 107) | pub(super) struct SharedStr {
    method new (line 112) | pub(super) fn new(value: &str) -> SharedStr {
    method as_str (line 119) | pub(super) fn as_str(&self) -> &str {
    method from (line 125) | fn from(value: &str) -> SharedStr {
  method clone (line 131) | fn clone(&self) -> SharedStr {
  method drop (line 141) | fn drop(&mut self) {
  function construction (line 153) | fn construction() {
  function cloning (line 162) | fn cloning() {

FILE: runtime/boxed/types/str.rs
  type StrStorage (line 10) | pub enum StrStorage {
    method box_size (line 19) | pub fn box_size(self) -> BoxSize {
  type Str (line 29) | pub struct Str {
    constant MAX_INLINE_BYTES (line 40) | pub const MAX_INLINE_BYTES: usize = 29;
    constant EXTERNAL_INLINE_BYTE_LEN (line 43) | pub const EXTERNAL_INLINE_BYTE_LEN: u8 = (Self::MAX_INLINE_BYTES as u8...
    method new (line 46) | pub fn new(heap: &mut impl AsHeap, value: &str) -> Gc<Str> {
    method storage_for_byte_len (line 61) | pub fn storage_for_byte_len(len: usize) -> StrStorage {
    method is_inline (line 72) | fn is_inline(&self) -> bool {
    method as_repr (line 76) | fn as_repr(&self) -> Repr<'_> {
    method as_repr_mut (line 84) | fn as_repr_mut(&mut self) -> ReprMut<'_> {
    method as_str (line 93) | pub fn as_str(&self) -> &str {
    method fmt (line 115) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::E...
  method eq (line 102) | fn eq(&self, other: &Str) -> bool {
  method hash (line 108) | fn hash<H: Hasher>(&self, state: &mut H) {
  method drop (line 121) | fn drop(&mut self) {
  type InlineStr (line 135) | struct InlineStr {
    method new (line 142) | fn new(header: Header, value: &str) -> InlineStr {
    method as_utf8 (line 160) | fn as_utf8(&self) -> &[u8] {
    method as_str (line 170) | fn as_str(&self) -> &str {
  type ExternalStr (line 177) | struct ExternalStr {
    method new (line 186) | fn new(header: Header, value: &str) -> ExternalStr {
  type Repr (line 196) | enum Repr<'a> {
  type ReprMut (line 201) | enum ReprMut<'a> {
  function sizes (line 213) | fn sizes() {
  function equality (line 220) | fn equality() {
  function fmt_debug (line 232) | fn fmt_debug() {
  function round_trip (line 240) | fn round_trip() {

FILE: runtime/boxed/types/sym.rs
  type Sym (line 11) | pub struct Sym {
    method new (line 23) | pub fn new(heap: &mut impl AsHeap, value: &str) -> Gc<Sym> {
    method from_interned_sym (line 30) | pub fn from_interned_sym(heap: &mut impl AsHeap, interned: InternedSym...
    method size (line 40) | pub fn size() -> BoxSize {
    method name (line 48) | pub fn name<'a>(&'a self, interner: &'a impl AsInterner) -> &'a str {
    method interned (line 53) | pub fn interned(&self) -> InternedSym {
    method interned_mut (line 58) | pub(crate) fn interned_mut(&mut self) -> &mut InternedSym {
    method fmt (line 77) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::E...
  method eq (line 64) | fn eq(&self, other: &Sym) -> bool {
  method hash (line 70) | fn hash<H: Hasher>(&self, state: &mut H) {
  function sizes (line 89) | fn sizes() {
  function equality (line 94) | fn equality() {
  function fmt_debug (line 106) | fn fmt_debug() {

FILE: runtime/boxed/types/vector.rs
  constant MAX_16BYTE_INLINE_LEN (line 10) | const MAX_16BYTE_INLINE_LEN: usize = (16 - 8) / mem::size_of::<Gc<Any>>();
  constant MAX_32BYTE_INLINE_LEN (line 11) | const MAX_32BYTE_INLINE_LEN: usize = (32 - 8) / mem::size_of::<Gc<Any>>();
  constant EXTERNAL_INLINE_LEN (line 13) | const EXTERNAL_INLINE_LEN: u32 = (MAX_32BYTE_INLINE_LEN + 1) as u32;
  type VectorStorage (line 17) | pub enum VectorStorage {
    method box_size (line 26) | pub fn box_size(self) -> BoxSize {
  type Vector (line 38) | pub struct Vector<T: Boxed = Any> {
  constant MAX_INLINE_LEN (line 49) | pub const MAX_INLINE_LEN: usize = MAX_32BYTE_INLINE_LEN;
  constant EXTERNAL_INLINE_LEN (line 52) | pub const EXTERNAL_INLINE_LEN: u32 = (Self::MAX_INLINE_LEN as u32) + 1;
  function new (line 55) | pub fn new(
  function storage_for_element_len (line 73) | fn storage_for_element_len(len: usize) -> VectorStorage {
  function from_values (line 87) | pub fn from_values<V, F>(
  function is_inline (line 101) | fn is_inline(&self) -> bool {
  function as_repr (line 105) | fn as_repr(&self) -> Repr<'_, T> {
  function as_repr_mut (line 113) | fn as_repr_mut(&mut self) -> ReprMut<'_, T> {
  function len (line 122) | pub fn len(&self) -> usize {
  function is_empty (line 130) | pub fn is_empty(&self) -> bool {
  function get (line 135) | pub fn get(&self, index: usize) -> Option<Gc<T>> {
  function iter (line 143) | pub fn iter<'a>(&'a self) -> Box<(dyn ExactSizeIterator<Item = Gc<T>> + ...
  function assoc (line 151) | pub fn assoc(&self, heap: &mut impl AsHeap, index: usize, value: Gc<T>) ...
  function append (line 179) | pub fn append(&self, heap: &mut impl AsHeap, other: Gc<Vector<T>>) -> Gc...
  function extend (line 188) | pub fn extend(
  function take (line 219) | pub fn take(&self, heap: &mut impl AsHeap, count: usize) -> Gc<Vector<T>> {
  function visit_mut_elements (line 243) | pub(crate) fn visit_mut_elements<F>(&mut self, visitor: &mut F)
  method eq_in_heap (line 259) | fn eq_in_heap(&self, heap: &Heap, other: &Vector<T>) -> bool {
  method hash_in_heap (line 271) | fn hash_in_heap<H: Hasher>(&self, heap: &Heap, state: &mut H) {
  function fmt (line 281) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Err...
  constant BOXED_ABI_TYPE (line 292) | const BOXED_ABI_TYPE: BoxedAbiType = BoxedAbiType::Vector(&T::BOXED_ABI_...
  type InlineVector (line 296) | pub struct InlineVector<T: Boxed> {
  function new (line 303) | fn new(header: Header, values: impl ExactSizeIterator<Item = Gc<T>>) -> ...
  function iter (line 319) | fn iter(&self) -> impl ExactSizeIterator<Item = Gc<T>> + '_ {
  function iter_mut (line 325) | fn iter_mut<'a>(&'a mut self) -> impl ExactSizeIterator<Item = &mut Gc<T...
  function get (line 331) | fn get(&self, index: usize) -> Option<Gc<T>> {
  type ExternalVector (line 341) | pub struct ExternalVector<T: Boxed> {
  function new (line 348) | fn new(header: Header, values: impl ExactSizeIterator<Item = Gc<T>>) -> ...
  type Repr (line 357) | enum Repr<'a, T: Boxed> {
  type ReprMut (line 362) | enum ReprMut<'a, T: Boxed> {
  method drop (line 368) | fn drop(&mut self) {
  function sizes (line 389) | fn sizes() {
  function equality (line 396) | fn equality() {
  function fmt_debug (line 418) | fn fmt_debug() {

FILE: runtime/callback.rs
  type Callback (line 16) | pub struct Callback<F>
  function captures (line 29) | pub fn captures(&self) -> boxed::Captures {
  type EntryPointAbiType (line 38) | pub struct EntryPointAbiType {
  type EncodeEntryPointAbiType (line 50) | pub trait EncodeEntryPointAbiType: Copy {
    constant ENTRY_POINT_ABI_TYPE (line 52) | const ENTRY_POINT_ABI_TYPE: EntryPointAbiType;
  function encode_entry_point_abi_type (line 103) | fn encode_entry_point_abi_type() {

FILE: runtime/class_map.rs
  type FieldType (line 13) | pub enum FieldType {
    method from_abi_type (line 23) | pub fn from_abi_type(abi_type: &abitype::AbiType) -> Self {
  type Field (line 41) | pub struct Field {
    method new (line 49) | pub fn new(field_type: FieldType, offset: usize) -> Field {
    method field_type (line 58) | pub fn field_type(self) -> FieldType {
    method offset (line 63) | pub fn offset(self) -> usize {
    method is_last (line 68) | pub fn is_last(self) -> bool {
  type ClassRef (line 76) | pub struct ClassRef<'a> {
  function is_empty (line 83) | pub fn is_empty(self) -> bool {
  function field_iter (line 88) | pub fn field_iter(self) -> FieldIterator<'a> {
  type BoxedClass (line 100) | pub struct BoxedClass {
    method from_fields (line 106) | pub fn from_fields(fields_iter: impl Iterator<Item = Field>) -> Self {
    method as_ref (line 115) | pub fn as_ref(&self) -> ClassRef<'_> {
  type FieldIterator (line 128) | pub struct FieldIterator<'a> {
  function empty (line 134) | pub fn empty() -> FieldIterator<'static> {
  type Item (line 143) | type Item = Field;
  method next (line 145) | fn next(&mut self) -> Option<Field> {
  type ClassMap (line 165) | pub struct ClassMap {
    constant DYNAMIC_RECORD_CLASS_ID_BASE (line 171) | const DYNAMIC_RECORD_CLASS_ID_BASE: RecordClassId = 1u32 << 30;
    method empty (line 174) | pub fn empty() -> ClassMap {
    method with_const_classes (line 179) | pub(crate) fn with_const_classes(const_classes: *const ClassRef<'stati...
    method push_dynamic_class (line 187) | pub fn push_dynamic_class(&mut self, boxed_class: BoxedClass) -> Recor...
    method class_for_record_class_id (line 196) | pub fn class_for_record_class_id(&self, record_class_id: RecordClassId...

FILE: runtime/compiler_support.rs
  type TaskEntry (line 18) | type TaskEntry = extern "C" fn(&mut Task);
  function launch_task (line 21) | pub unsafe extern "C" fn launch_task(
  function alloc_cells (line 44) | pub extern "C" fn alloc_cells(task: &mut Task, count: u32) -> *mut boxed...
  function alloc_record_data (line 49) | pub extern "C" fn alloc_record_data(size: u64, align: u32) -> *mut u8 {
  function equals (line 57) | pub extern "C" fn equals(task: &Task, lhs: Gc<boxed::Any>, rhs: Gc<boxed...
  function panic_with_string (line 62) | pub unsafe extern "C" fn panic_with_string(

FILE: runtime/intern.rs
  constant INLINE_FILL_BYTE (line 24) | const INLINE_FILL_BYTE: u8 = 0x80;
  constant LOCAL_INDEXED_FLAG (line 25) | const LOCAL_INDEXED_FLAG: u8 = 0x81;
  constant GLOBAL_INDEXED_FLAG (line 26) | const GLOBAL_INDEXED_FLAG: u8 = 0x82;
  constant INLINE_SIZE (line 28) | const INLINE_SIZE: usize = 8;
  type RawGlobalNames (line 31) | pub struct RawGlobalNames {
  type GlobalName (line 37) | struct GlobalName {
    method as_str (line 43) | fn as_str(&self) -> &str {
  type InternedIndexed (line 54) | struct InternedIndexed {
  type InternedInline (line 62) | struct InternedInline {
    method as_str (line 67) | fn as_str(&self) -> &str {
  type InternedRepr (line 87) | enum InternedRepr<'a> {
  method try_from_inline_name (line 98) | pub fn try_from_inline_name(name: &str) -> Option<InternedSym> {
  method from_global_index (line 120) | pub fn from_global_index(index: u32) -> InternedSym {
  method from_local_index (line 130) | pub fn from_local_index(index: u32) -> InternedSym {
  method to_raw_u64 (line 140) | pub fn to_raw_u64(self) -> u64 {
  method repr (line 144) | fn repr(&self) -> InternedRepr<'_> {
  method eq (line 156) | fn eq(&self, other: &InternedSym) -> bool {
  method hash (line 164) | fn hash<H: Hasher>(&self, state: &mut H) {
  method fmt (line 172) | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Err...
  type Interner (line 183) | pub struct Interner {
    method new (line 192) | pub fn new() -> Interner {
    method with_global_names (line 205) | pub unsafe fn with_global_names(raw_global_names: *const RawGlobalName...
    method lookup_global_name (line 219) | fn lookup_global_name(&mut self, name: &str) -> Option<InternedSym> {
    method intern (line 231) | pub fn intern(&mut self, name: &str) -> InternedSym {
    method intern_static (line 264) | pub fn intern_static(&mut self, name: &str) -> InternedSym {
    method unintern (line 274) | pub fn unintern<'a>(&'a self, interned: &'a InternedSym) -> &'a str {
    method clone_for_collect_garbage (line 287) | pub(crate) fn clone_for_collect_garbage(&self) -> Self {
  method default (line 320) | fn default() -> Interner {
  type AsInterner (line 326) | pub trait AsInterner {
    method as_interner (line 328) | fn as_interner(&self) -> &Interner;
    method as_interner (line 332) | fn as_interner(&self) -> &Interner {
  function sizes (line 343) | fn sizes() {
  function equality (line 350) | fn equality() {
  function fmt_debug (line 369) | fn fmt_debug() {
  function roundtrip (line 380) | fn roundtrip() {
  function clone_for_collect_garbage (line 404) | fn clone_for_collect_garbage() {

FILE: runtime/persistent/vector.rs
  constant GLOBAL_CONSTANT_REFCOUNT (line 7) | pub const GLOBAL_CONSTANT_REFCOUNT: u64 = std::u64::MAX;
  constant TRIE_RADIX (line 9) | const TRIE_RADIX: u32 = 5;
  constant NODE_SIZE (line 10) | pub const NODE_SIZE: usize = 1 << TRIE_RADIX;
  constant LEVEL_MASK (line 11) | const LEVEL_MASK: usize = (1 << TRIE_RADIX) - 1;
  type Vector (line 27) | pub struct Vector<T>
  function new (line 40) | pub fn new(values: impl ExactSizeIterator<Item = T>) -> Self {
  function len (line 50) | pub fn len(&self) -> usize {
  function is_empty (line 54) | pub fn is_empty(&self) -> bool {
  function push_leaf (line 59) | fn push_leaf(&self, leaf: *const Node<T>, added_elements: u64) -> Vector...
  function get (line 92) | pub fn get(&self, index: usize) -> Option<T> {
  function take (line 101) | pub fn take(&self, count: usize) -> Vector<T> {
  function get_leaf (line 135) | fn get_leaf(&self, index: usize) -> *const Node<T> {
  function assoc (line 144) | pub fn assoc(&self, index: usize, value: T) -> Vector<T> {
  function iter (line 176) | pub fn iter(&self) -> impl ExactSizeIterator<Item = T> + '_ {
  function extend (line 184) | pub fn extend(&self, mut values: impl ExactSizeIterator<Item = T>) -> Ve...
  function visit_mut_elements (line 255) | pub(crate) fn visit_mut_elements<F>(&mut self, visitor: &mut F)
  function trie_size (line 276) | fn trie_size(&self) -> usize {
  function trie_size_for_len (line 280) | fn trie_size_for_len(len: usize) -> usize {
  function tail_size (line 287) | fn tail_size(&self) -> usize {
  function tail_size_for_len (line 291) | fn tail_size_for_len(len: usize) -> usize {
  function tail_offset (line 296) | fn tail_offset(&self) -> usize {
  function trie_depth (line 301) | fn trie_depth(trie_size: usize) -> u32 {
  method drop (line 315) | fn drop(&mut self) {
  type Node (line 332) | struct Node<T>
  function new_leaf (line 344) | fn new_leaf(elements: [MaybeUninit<T>; NODE_SIZE]) -> *const Node<T> {
  function new_branch (line 360) | fn new_branch(elements: [*const Node<T>; NODE_SIZE]) -> *const Node<T> {
  function new_chain (line 377) | fn new_chain(leaf_node: *const Node<T>, remaining_depth: u32) -> *const ...
  function get_leaf (line 391) | fn get_leaf(&self, remaining_depth: u32, index: usize) -> *const Node<T> {
  function assoc_value (line 402) | fn assoc_value(&self, remaining_depth: u32, index: usize, value: T) -> *...
  function push_leaf (line 434) | fn push_leaf(
  function is_global_constant (line 469) | fn is_global_constant(&self) -> bool {
  function take_ptr_ref (line 473) | fn take_ptr_ref(self_ptr: *const Node<T>) -> *const Node<T> {
  function release_ptr_ref (line 486) | unsafe fn release_ptr_ref(self_ptr: *const Node<T>, depth: u32) {
  function visit_mut_elements (line 522) | fn visit_mut_elements<F>(
  type Iter (line 566) | struct Iter<'a, T>
  type Item (line 579) | type Item = T;
  method next (line 581) | fn next(&mut self) -> Option<T> {
  method size_hint (line 598) | fn size_hint(&self) -> (usize, Option<usize>) {
  method clone (line 611) | fn clone(&self) -> Self {
  function assert_nodes_deallocated (line 626) | fn assert_nodes_deallocated<T>(block: T)
  function tail_only_vector (line 658) | fn tail_only_vector() {
  function extended_one_level_vector (line 687) | fn extended_one_level_vector() {
  function extended_two_level_vector (line 716) | fn extended_two_level_vector() {
  function initialised_three_level_vector (line 756) | fn initialised_three_level_vector() {
  function vector_extend (line 806) | fn vector_extend() {

FILE: runtime/task.rs
  type Task (line 17) | pub struct Task {
    constant DEFAULT_CAPACITY (line 22) | const DEFAULT_CAPACITY: usize = 32;
    method new (line 25) | pub fn new() -> Task {
    method with_type_info (line 29) | pub(crate) fn with_type_info(type_info: TypeInfo) -> Task {
    method heap (line 36) | pub fn heap(&self) -> &Heap {
    method heap_mut (line 41) | pub fn heap_mut(&mut self) -> &mut Heap {
    method panic (line 48) | pub fn panic(&mut self, message: String) -> Never {
  method default (line 65) | fn default() -> Task {
  method as_heap (line 71) | fn as_heap(&self) -> &Heap {
  method as_heap_mut (line 75) | fn as_heap_mut(&mut self) -> &mut Heap {

FILE: stdlib/rust/bitwise.rs
  function stdlib_bit_and (line 7) | pub fn stdlib_bit_and(lhs: i64, rhs: i64, rest: Gc<boxed::List<boxed::In...
  function stdlib_bit_or (line 12) | pub fn stdlib_bit_or(lhs: i64, rhs: i64, rest: Gc<boxed::List<boxed::Int...
  function stdlib_bit_xor (line 17) | pub fn stdlib_bit_xor(lhs: i64, rhs: i64, rest: Gc<boxed::List<boxed::In...
  function stdlib_bit_not (line 22) | pub fn stdlib_bit_not(val: i64) -> i64 {
  function stdlib_bit_shift_left (line 27) | pub fn stdlib_bit_shift_left(task: &mut Task, val: i64, bit_count: i64) ...
  function stdlib_bit_shift_right (line 38) | pub fn stdlib_bit_shift_right(task: &mut Task, val: i64, bit_count: i64)...
  function stdlib_unsigned_bit_shift_right (line 49) | pub fn stdlib_unsigned_bit_shift_right(task: &mut Task, val: i64, bit_co...

FILE: stdlib/rust/hash.rs
  function stdlib_hash (line 12) | pub fn stdlib_hash(task: &mut Task, input: Gc<boxed::Any>) -> i64 {

FILE: stdlib/rust/lib.rs
  function panic_common (line 44) | pub fn panic_common(task: &mut Task, values: Gc<boxed::List<boxed::Any>>...
  function stdlib_panic (line 57) | pub fn stdlib_panic(task: &mut Task, values: Gc<boxed::List<boxed::Any>>...
  function stdlib_panic_impure (line 62) | pub fn stdlib_panic_impure(task: &mut Task, values: Gc<boxed::List<boxed...
  function stdlib_exit (line 67) | pub fn stdlib_exit(exit_code: i64) {

FILE: stdlib/rust/list.rs
  function stdlib_length (line 9) | pub fn stdlib_length(input: Gc<boxed::List<boxed::Any>>) -> i64 {
  function stdlib_cons (line 14) | pub fn stdlib_cons(
  function stdlib_map (line 23) | pub fn stdlib_map(
  function stdlib_filter (line 37) | pub fn stdlib_filter(
  function stdlib_some_p (line 51) | pub fn stdlib_some_p(
  function stdlib_every_p (line 60) | pub fn stdlib_every_p(
  function stdlib_fold (line 69) | pub fn stdlib_fold(
  function stdlib_concat (line 83) | pub fn stdlib_concat(
  function stdlib_take (line 112) | pub fn stdlib_take(
  function stdlib_reverse (line 122) | pub fn stdlib_reverse(
  function stdlib_repeat (line 131) | pub fn stdlib_repeat(

FILE: stdlib/rust/math.rs
  function fold_float_op (line 7) | fn fold_float_op<FR>(
  function fold_num_op (line 33) | fn fold_num_op<IR, FR>(
  function stdlib_add (line 69) | pub fn stdlib_add(
  function stdlib_mul (line 88) | pub fn stdlib_mul(
  function stdlib_sub (line 107) | pub fn stdlib_sub(
  function stdlib_div (line 140) | pub fn stdlib_div(initial_float: f64, rest: Gc<boxed::List<boxed::Float>...
  function stdlib_quot (line 154) | pub fn stdlib_quot(task: &mut Task, numerator: i64, denominator: i64) ->...
  function stdlib_rem (line 165) | pub fn stdlib_rem(task: &mut Task, numerator: i64, denominator: i64) -> ...
  function stdlib_sqrt (line 176) | pub fn stdlib_sqrt(radicand: f64) -> f64 {

FILE: stdlib/rust/number.rs
  function compare_nums (line 6) | fn compare_nums<IC, FC>(
  function stdlib_float (line 47) | pub fn stdlib_float(input: Gc<boxed::Num>) -> f64 {
  function stdlib_int (line 55) | pub fn stdlib_int(task: &mut Task, input: Gc<boxed::Num>) -> i64 {
  function stdlib_num_lt (line 79) | pub fn stdlib_num_lt(initial: Gc<boxed::Num>, rest: Gc<boxed::List<boxed...
  function stdlib_num_le (line 84) | pub fn stdlib_num_le(initial: Gc<boxed::Num>, rest: Gc<boxed::List<boxed...
  function stdlib_num_eq (line 89) | pub fn stdlib_num_eq(initial: Gc<boxed::Num>, rest: Gc<boxed::List<boxed...
  function stdlib_num_gt (line 94) | pub fn stdlib_num_gt(initial: Gc<boxed::Num>, rest: Gc<boxed::List<boxed...
  function stdlib_num_ge (line 99) | pub fn stdlib_num_ge(initial: Gc<boxed::Num>, rest: Gc<boxed::List<boxed...

FILE: stdlib/rust/read.rs
  function stdlib_read_str (line 11) | pub fn stdlib_read_str(task: &mut Task, edn_str: Gc<boxed::Str>) -> Gc<b...

FILE: stdlib/rust/set.rs
  function stdlib_set (line 7) | pub fn stdlib_set(
  function stdlib_set_contains_p (line 15) | pub fn stdlib_set_contains_p(
  function stdlib_set_length (line 24) | pub fn stdlib_set_length(set: Gc<boxed::Set<boxed::Any>>) -> i64 {
  function stdlib_set_to_list (line 29) | pub fn stdlib_set_to_list(
  function stdlib_subset_p (line 37) | pub fn stdlib_subset_p(

FILE: stdlib/rust/testing.rs
  function stdlib_black_box (line 10) | pub fn stdlib_black_box(value: Gc<boxed::Any>) -> Gc<boxed::Any> {
  function stdlib_black_box_impure (line 15) | pub fn stdlib_black_box_impure(value: Gc<boxed::Any>) -> Gc<boxed::Any> {
  function stdlib_heap_alloc_count (line 20) | pub fn stdlib_heap_alloc_count(
  function stdlib_fn_op_categories (line 34) | pub fn stdlib_fn_op_categories(_value: Gc<boxed::FunThunk>) -> Gc<boxed:...

FILE: stdlib/rust/vector.rs
  function stdlib_vector (line 7) | pub fn stdlib_vector(
  function stdlib_vector_ref (line 15) | pub fn stdlib_vector_ref(
  function stdlib_vector_length (line 41) | pub fn stdlib_vector_length(vector: Gc<boxed::Vector<boxed::Any>>) -> i64 {
  function stdlib_vector_to_list (line 46) | pub fn stdlib_vector_to_list(
  function stdlib_vector_assoc (line 54) | pub fn stdlib_vector_assoc(
  function stdlib_vector_append (line 80) | pub fn stdlib_vector_append(
  function stdlib_vector_extend (line 96) | pub fn stdlib_vector_extend(
  function stdlib_vector_take (line 105) | pub fn stdlib_vector_take(

FILE: stdlib/rust/write.rs
  function pretty_print_common (line 10) | fn pretty_print_common(
  function write_boxed_common (line 20) | fn write_boxed_common(
  function stdlib_print (line 37) | pub fn stdlib_print(task: &mut Task, values: Gc<boxed::List<boxed::Any>>) {
  function stdlib_println (line 45) | pub fn stdlib_println(task: &mut Task, values: Gc<boxed::List<boxed::Any...
  function stdlib_write (line 54) | pub fn stdlib_write(task: &mut Task, values: Gc<boxed::List<boxed::Any>>) {
  function stdlib_writeln (line 62) | pub fn stdlib_writeln(task: &mut Task, values: Gc<boxed::List<boxed::Any...
  function stdlib_print_str (line 71) | pub fn stdlib_print_str(task: &mut Task, values: Gc<boxed::List<boxed::A...
  function stdlib_write_str (line 82) | pub fn stdlib_write_str(task: &mut Task, values: Gc<boxed::List<boxed::A...

FILE: syntax/anon_fun.rs
  type FoundArity (line 5) | struct FoundArity {
  function visit_arg_literals (line 11) | fn visit_arg_literals(found_arity: &mut FoundArity, datum: Datum) -> Res...
  function convert_anon_fun (line 52) | pub fn convert_anon_fun(outer_span: Span, body_data: impl Iterator<Item ...
  function empty_fun (line 96) | fn empty_fun() {
  function one_arg_fun (line 119) | fn one_arg_fun() {
  function two_arg_fun (line 148) | fn two_arg_fun() {
  function rest_fun (line 185) | fn rest_fun() {

FILE: syntax/datum.rs
  type DataStr (line 5) | pub type DataStr = Arc<str>;
  type Datum (line 8) | pub enum Datum {
    method span (line 22) | pub fn span(&self) -> Span {
    method description (line 37) | pub fn description(&self) -> &'static str {

FILE: syntax/error.rs
  type Error (line 10) | pub struct Error {
    method new (line 16) | pub fn new(span: Span, kind: ErrorKind) -> Error {
    method kind (line 20) | pub fn kind(&self) -> &ErrorKind {
    method span (line 24) | pub fn span(&self) -> Span {
  method fmt (line 32) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type ErrorKind (line 39) | pub enum ErrorKind {
    method message (line 54) | pub fn message(&self) -> String {
    method within_context (line 80) | pub fn within_context(&self) -> Option<WithinContext> {
  type Result (line 88) | pub type Result<T> = result::Result<T, Error>;
  type WithinContext (line 92) | pub enum WithinContext {
    method description (line 107) | pub fn description(&self) -> &'static str {
    method expected_next (line 123) | pub fn expected_next(&self) -> Option<ExpectedNext> {
    method open_char_span (line 135) | pub fn open_char_span(&self) -> Option<Span> {
  type ExpectedNext (line 149) | pub enum ExpectedNext {
    method close_char (line 159) | pub fn close_char(self) -> char {
    method description (line 169) | pub fn description(self) -> String {

FILE: syntax/parser.rs
  function data_from_str_with_span_offset (line 5) | pub fn data_from_str_with_span_offset(
  function data_from_str (line 13) | pub fn data_from_str(file_id: Option<FileId>, s: &str) -> Result<Vec<Dat...
  function datum_from_str_with_span_offset (line 17) | pub fn datum_from_str_with_span_offset(
  function datum_from_str (line 25) | pub fn datum_from_str(file_id: Option<FileId>, s: &str) -> Result<Datum> {
  function is_whitespace (line 29) | fn is_whitespace(c: char) -> bool {
  function is_identifier_char (line 33) | pub fn is_identifier_char(c: char) -> bool {
  type Parser (line 45) | pub struct Parser<'input> {
  function from_str (line 52) | fn from_str(file_id: Option<FileId>, input: &'input str, span_offset: By...
  function eof_err (line 60) | fn eof_err(&self, within: WithinContext) -> Error {
  function peek_char (line 69) | fn peek_char(&mut self, within: WithinContext) -> Result<char> {
  function peek_nth_char (line 76) | fn peek_nth_char(&mut self, i: usize, within: WithinContext) -> Result<c...
  function eat_bytes (line 83) | fn eat_bytes(&mut self, count: usize) {
  function consume_char (line 88) | fn consume_char(&mut self, within: WithinContext) -> Result<char> {
  function skip_until_non_whitespace (line 106) | fn skip_until_non_whitespace(&mut self, within: WithinContext) -> Result...
  function consume_until (line 133) | fn consume_until<T>(&mut self, predicate: T) -> (Span, &str)
  function consume_while (line 153) | fn consume_while<T>(&mut self, mut predicate: T) -> (Span, &str)
  function capture_span (line 160) | fn capture_span<F, R>(&mut self, block: F) -> (Span, R)
  function parse_num (line 171) | fn parse_num(&mut self) -> Result<Datum> {
  function parse_symbolic_float (line 214) | fn parse_symbolic_float(&mut self) -> Result<Datum> {
  function parse_signed_num_or_symbol (line 233) | fn parse_signed_num_or_symbol(&mut self) -> Result<Datum> {
  function parse_char (line 245) | fn parse_char(&mut self) -> Result<Datum> {
  function parse_dispatch (line 284) | fn parse_dispatch(&mut self) -> Result<Datum> {
  function parse_seq (line 304) | fn parse_seq<F>(&mut self, terminator: char, make_ec: F) -> Result<Vec<D...
  function parse_list (line 329) | fn parse_list(&mut self) -> Result<Datum> {
  function parse_vector (line 335) | fn parse_vector(&mut self) -> Result<Datum> {
  function parse_map (line 341) | fn parse_map(&mut self) -> Result<Datum> {
  function parse_set (line 360) | fn parse_set(&mut self) -> Result<Datum> {
  function parse_anon_fun (line 372) | fn parse_anon_fun(&mut self) -> Result<Datum> {
  function parse_quote_escape (line 387) | fn parse_quote_escape(&mut self) -> Result<char> {
  function parse_string (line 417) | fn parse_string(&mut self) -> Result<Datum> {
  function parse_identifier (line 443) | fn parse_identifier(&mut self, within: WithinContext) -> Result<Datum> {
  function parse_symbol_shorthand (line 461) | fn parse_symbol_shorthand(&mut self, expansion: &str) -> Result<Datum> {
  function parse_datum_starting_with (line 479) | fn parse_datum_starting_with(&mut self, c: char, within: WithinContext) ...
  function parse_datum (line 494) | fn parse_datum(&mut self) -> Result<Datum> {
  function parse_data (line 501) | fn parse_data(&mut self) -> Result<Vec<Datum>> {
  function whole_str_span (line 527) | fn whole_str_span(v: &str) -> Span {
  function bool_datum (line 532) | fn bool_datum() {
  function list_datum (line 561) | fn list_datum() {
  function vector_datum (line 617) | fn vector_datum() {
  function symbol_datum (line 655) | fn symbol_datum() {
  function keyword_symbol_datum (line 680) | fn keyword_symbol_datum() {
  function string_datum (line 690) | fn string_datum() {
  function char_datum (line 728) | fn char_datum() {
  function int_datum (line 765) | fn int_datum() {
  function float_datum (line 801) | fn float_datum() {
  function map_datum (line 832) | fn map_datum() {
  function set_datum (line 875) | fn set_datum() {
  function quote_shorthand (line 915) | fn quote_shorthand() {
  function unsupported_dispatch (line 961) | fn unsupported_dispatch() {
  function datum_comment (line 976) | fn datum_comment() {
  function multiple_data (line 1000) | fn multiple_data() {

FILE: syntax/span.rs
  type FileId (line 4) | pub type FileId = NonZeroU32;
  type ByteIndex (line 5) | pub type ByteIndex = u32;
  type Span (line 8) | pub struct Span {
    method new (line 15) | pub const fn new(file_id: Option<FileId>, start: ByteIndex, end: ByteI...
    method from_str (line 23) | pub const fn from_str(file_id: Option<FileId>, s: &str) -> Self {
    method file_id (line 31) | pub fn file_id(&self) -> Option<FileId
Condensed preview — 328 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,738K chars).
[
  {
    "path": ".arret-root",
    "chars": 0,
    "preview": ""
  },
  {
    "path": ".buildkite/build-and-test.sh",
    "chars": 255,
    "preview": "#!/bin/sh\nset -eu\n\n# Deny warnings on CI\nexport RUSTFLAGS=\"-D warnings\"\n\necho '--- :cargo: Compiling debug'\ncargo build\n"
  },
  {
    "path": ".buildkite/llvm-assert.Dockerfile",
    "chars": 1226,
    "preview": "ARG LLVM_VERSION=11.1.0\nARG LLVM_ROOT=/opt/llvm-11\n\n##\n\nFROM fedora:33 AS fedora-common\n\nRUN dnf install -y gcc-c++\n# `d"
  },
  {
    "path": ".buildkite/pipeline.yml",
    "chars": 3404,
    "preview": "cached-ecr-build-env: &cached-ecr-build-env\n  plugins:\n    - seek-oss/docker-ecr-cache#v1.11.0:\n        target: build-en"
  },
  {
    "path": ".buildkite/sync-rustdoc.sh",
    "chars": 389,
    "preview": "#!/bin/sh\n\nset -eu\n\nS3_BUCKET_NAME=arret-lang-rustdoc\nCLOUDFRONT_DISTRIBUTION_ID=E1FFCMKSLRZAZ\n\necho '--- :s3: Updating "
  },
  {
    "path": ".buildkite/update-multiarch-manifest.sh",
    "chars": 251,
    "preview": "#!/usr/bin/env bash\nset -eu\n\n# Needed for `docker manifest`\nexport DOCKER_CLI_EXPERIMENTAL=enabled\n\nmanifest=ghcr.io/eta"
  },
  {
    "path": ".buildkite/vscode-extension-tests.sh",
    "chars": 168,
    "preview": "#!/usr/bin/env bash\nset -eu\n\nexport DISPLAY=':99.0'\n/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &\n\ncd edito"
  },
  {
    "path": ".dockerignore",
    "chars": 212,
    "preview": "/target/\n/.git\n\n# These are build files that aren't needed inside the Docker container. Ignore them so we don't\n# trigge"
  },
  {
    "path": ".github/CODEOWNERS",
    "chars": 11,
    "preview": "*\t@etaoins\n"
  },
  {
    "path": ".github/renovate.json",
    "chars": 795,
    "preview": "{\n  \"extends\": [\"config:base\", \"docker:disable\"],\n  \"cargo\": {\n    \"enabled\": true\n  },\n  \"timezone\": \"Australia/Melbour"
  },
  {
    "path": ".gitignore",
    "chars": 26,
    "preview": "/target/\n/rls/\n**/*.rs.bk\n"
  },
  {
    "path": ".prettierrc",
    "chars": 52,
    "preview": "{\n  \"singleQuote\": true,\n  \"trailingComma\": \"all\"\n}\n"
  },
  {
    "path": "Cargo.toml",
    "chars": 136,
    "preview": "[workspace]\nmembers = [\n\t\"syntax\",\n\t\"compiler\",\n\t\"driver\",\n\t\"lsp-server\",\n\t\"runtime\",\n\t\"runtime-syntax\",\n\t\"rfi-derive\",\n"
  },
  {
    "path": "Dockerfile",
    "chars": 1706,
    "preview": "FROM ubuntu:20.04 AS build-env\n\nRUN \\\n  apt-get update && \\\n  apt-get -y install --no-install-recommends ca-certificates"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "README.md",
    "chars": 3268,
    "preview": "# Arret\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache"
  },
  {
    "path": "compiler/Cargo.toml",
    "chars": 479,
    "preview": "[package]\nname = \"arret-compiler\"\nversion = \"0.1.0\"\nedition = \"2018\"\nauthors = [\"Ryan Cumming <etaoins@gmail.com>\"]\n\n[li"
  },
  {
    "path": "compiler/arret_root.rs",
    "chars": 2641,
    "preview": "use std::{env, path};\n\nconst ARRET_ROOT_ENV_VAR: &str = \"ARRET_ROOT\";\n\nfn is_arret_root(path: &path::Path) -> bool {\n   "
  },
  {
    "path": "compiler/codegen/alloc/core.rs",
    "chars": 10262,
    "preview": "use std::{mem, ptr};\n\nuse llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::{LLVMAttributeFunctionIndex, LLVMAt"
  },
  {
    "path": "compiler/codegen/alloc/mod.rs",
    "chars": 1833,
    "preview": "use std::vec;\n\nuse llvm_sys::prelude::*;\n\nuse arret_runtime::boxed;\n\nuse crate::mir::ops;\n\npub mod core;\npub mod plan;\np"
  },
  {
    "path": "compiler/codegen/alloc/plan.rs",
    "chars": 8787,
    "preview": "use arret_runtime::boxed;\n\nuse crate::codegen::alloc::{AllocAtom, BoxSource, CondPlan};\nuse crate::codegen::analysis::es"
  },
  {
    "path": "compiler/codegen/alloc/types.rs",
    "chars": 14282,
    "preview": "use llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::LLVMAttributeReturnIndex;\n\nuse arret_runtime::boxed;\n\nuse"
  },
  {
    "path": "compiler/codegen/analysis/escape.rs",
    "chars": 20028,
    "preview": "use std::collections::{HashMap, HashSet};\n\nuse arret_runtime::abitype::{AbiType, ParamAbiType, ParamCapture, RetAbiType}"
  },
  {
    "path": "compiler/codegen/analysis/mod.rs",
    "chars": 2047,
    "preview": "pub mod escape;\npub mod names;\n\nuse std::collections::{BTreeMap, HashMap};\nuse std::rc::Rc;\n\nuse arret_runtime::intern;\n"
  },
  {
    "path": "compiler/codegen/analysis/names.rs",
    "chars": 3694,
    "preview": "use std::collections::{BTreeMap, BTreeSet, HashMap};\nuse std::rc::Rc;\n\nuse arret_runtime::intern;\n\nuse super::AnalysedFu"
  },
  {
    "path": "compiler/codegen/box_layout.rs",
    "chars": 6333,
    "preview": "use llvm_sys::core::*;\nuse llvm_sys::prelude::*;\n\nuse arret_runtime::abitype::{BoxedAbiType, EncodeBoxedAbiType, TOP_LIS"
  },
  {
    "path": "compiler/codegen/callee.rs",
    "chars": 3472,
    "preview": "use std::ffi;\n\nuse llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::{LLVMAttributeFunctionIndex, LLVMCallConv}"
  },
  {
    "path": "compiler/codegen/const_gen.rs",
    "chars": 23786,
    "preview": "use std::rc::Rc;\nuse std::{iter, mem};\n\nuse llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::{LLVMLinkage, LLV"
  },
  {
    "path": "compiler/codegen/debug_info.rs",
    "chars": 6099,
    "preview": "use std::collections::HashMap;\nuse std::os::unix::ffi::OsStrExt;\nuse std::{env, ffi, ptr};\n\nuse codespan_reporting::file"
  },
  {
    "path": "compiler/codegen/fun_gen.rs",
    "chars": 3349,
    "preview": "use std::collections::HashMap;\nuse std::ffi;\n\nuse llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::LLVMCallCon"
  },
  {
    "path": "compiler/codegen/jit.rs",
    "chars": 6780,
    "preview": "use std::collections::HashMap;\nuse std::{alloc, env, ffi, io, ptr};\n\nuse llvm_sys::core::*;\nuse llvm_sys::execution_engi"
  },
  {
    "path": "compiler/codegen/libcstr.rs",
    "chars": 207,
    "preview": "/// Builds a static NULL terminated `*const libc::c_char` with the given contents\n#[macro_export]\nmacro_rules! libcstr {"
  },
  {
    "path": "compiler/codegen/math_gen.rs",
    "chars": 8160,
    "preview": "use llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::LLVMIntPredicate;\n\nuse crate::codegen::fun_gen::FunCtx;\nu"
  },
  {
    "path": "compiler/codegen/mod.rs",
    "chars": 2049,
    "preview": "mod alloc;\nmod analysis;\nmod box_layout;\nmod callee;\nmod const_gen;\nmod debug_info;\nmod fun_gen;\npub(crate) mod jit;\nmod"
  },
  {
    "path": "compiler/codegen/mod_gen.rs",
    "chars": 11230,
    "preview": "use std::collections::HashMap;\n\nuse llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::target::*;\nuse llvm_sys::"
  },
  {
    "path": "compiler/codegen/op_gen.rs",
    "chars": 43093,
    "preview": "use llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::{LLVMCallConv, LLVMIntPredicate, LLVMRealPredicate};\n\nuse"
  },
  {
    "path": "compiler/codegen/panic_gen.rs",
    "chars": 2729,
    "preview": "use llvm_sys::core::*;\nuse llvm_sys::LLVMAttributeFunctionIndex;\n\nuse crate::codegen::const_gen::annotate_private_global"
  },
  {
    "path": "compiler/codegen/program.rs",
    "chars": 8643,
    "preview": "use std::collections::HashMap;\nuse std::ffi::{CStr, CString};\nuse std::sync::Arc;\nuse std::{env, fs, io, path, process, "
  },
  {
    "path": "compiler/codegen/range_md.rs",
    "chars": 2484,
    "preview": "use std::iter;\nuse std::ops::Range;\n\nuse llvm_sys::core::*;\nuse llvm_sys::prelude::*;\n\ntype Int = i64;\n\nstruct IntRangeI"
  },
  {
    "path": "compiler/codegen/record_struct.rs",
    "chars": 9208,
    "preview": "use std::alloc;\n\nuse llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::target::*;\n\nuse arret_runtime::boxed;\nus"
  },
  {
    "path": "compiler/codegen/target_gen.rs",
    "chars": 25813,
    "preview": "use std::collections::HashMap;\n\nuse llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::target::*;\nuse llvm_sys::"
  },
  {
    "path": "compiler/codegen/target_machine.rs",
    "chars": 1899,
    "preview": "use std::{ffi, ptr};\n\nuse llvm_sys::core::*;\nuse llvm_sys::target_machine::*;\n\nenum TripleString {\n    Cross(ffi::CStrin"
  },
  {
    "path": "compiler/codegen/vector_gen.rs",
    "chars": 8627,
    "preview": "use llvm_sys::core::*;\nuse llvm_sys::prelude::*;\nuse llvm_sys::LLVMIntPredicate;\n\nuse arret_runtime::boxed;\n\nuse crate::"
  },
  {
    "path": "compiler/context.rs",
    "chars": 10056,
    "preview": "use crate::hir::PackagePaths;\nuse crate::rfi;\nuse crate::source::SourceLoader;\n\nuse std::collections::{HashMap, HashSet}"
  },
  {
    "path": "compiler/hir/destruc.rs",
    "chars": 3399,
    "preview": "use arret_syntax::datum::DataStr;\nuse arret_syntax::span::Span;\n\nuse crate::hir;\nuse crate::ty;\nuse crate::ty::Ty;\n\n#[de"
  },
  {
    "path": "compiler/hir/error.rs",
    "chars": 25765,
    "preview": "use std::{error, fmt, io, iter, path, result};\n\nuse codespan_reporting::diagnostic::Diagnostic;\n\nuse arret_syntax::datum"
  },
  {
    "path": "compiler/hir/exports.rs",
    "chars": 527,
    "preview": "use std::collections::HashMap;\n\nuse arret_syntax::datum::DataStr;\n\nuse crate::hir::prim::PRIM_EXPORTS;\nuse crate::hir::s"
  },
  {
    "path": "compiler/hir/import/filter.rs",
    "chars": 2795,
    "preview": "use std::result;\n\nuse crate::hir::error::{Error, ErrorKind};\nuse crate::hir::exports::Exports;\nuse crate::hir::import::p"
  },
  {
    "path": "compiler/hir/import/mod.rs",
    "chars": 5875,
    "preview": "mod filter;\nmod parse;\n\nuse std::collections::HashMap;\n\nuse arret_syntax::datum::Datum;\nuse arret_syntax::span::Span;\n\nu"
  },
  {
    "path": "compiler/hir/import/parse.rs",
    "chars": 5658,
    "preview": "use std::result;\n\nuse arret_syntax::datum::{DataStr, Datum};\nuse arret_syntax::span::Span;\n\nuse crate::hir::error::{Erro"
  },
  {
    "path": "compiler/hir/loader.rs",
    "chars": 5189,
    "preview": "use std::collections::HashMap;\nuse std::path;\n\nuse arret_syntax::datum::DataStr;\nuse arret_syntax::span::Span;\n\nuse crat"
  },
  {
    "path": "compiler/hir/lowering.rs",
    "chars": 37334,
    "preview": "use std::collections::HashMap;\n\nuse codespan_reporting::diagnostic::Diagnostic;\n\nuse arret_syntax::datum::Datum;\nuse arr"
  },
  {
    "path": "compiler/hir/macros/expander.rs",
    "chars": 5775,
    "preview": "use std::collections::HashMap;\nuse std::sync::Arc;\n\nuse arret_syntax::span::Span;\n\nuse crate::context::ModuleId;\nuse cra"
  },
  {
    "path": "compiler/hir/macros/linker.rs",
    "chars": 10221,
    "preview": "use std::collections::HashMap;\nuse std::result;\n\nuse arret_syntax::span::Span;\n\nuse crate::hir::error::{Error, ErrorKind"
  },
  {
    "path": "compiler/hir/macros/matcher.rs",
    "chars": 5163,
    "preview": "use std::result;\n\nuse crate::hir::macros::{get_escaped_ident, starts_with_zero_or_more, Rule};\nuse crate::hir::ns::{Iden"
  },
  {
    "path": "compiler/hir/macros/mod.rs",
    "chars": 3336,
    "preview": "mod expander;\nmod linker;\nmod matcher;\n\nuse std::sync::Arc;\n\nuse arret_syntax::span::Span;\n\nuse crate::context::ModuleId"
  },
  {
    "path": "compiler/hir/mod.rs",
    "chars": 5092,
    "preview": "pub(crate) mod destruc;\npub(crate) mod error;\npub(crate) mod exports;\npub(crate) mod import;\npub(crate) mod loader;\npub("
  },
  {
    "path": "compiler/hir/ns.rs",
    "chars": 5537,
    "preview": "use std::vec;\n\nuse arret_syntax::datum::{DataStr, Datum};\nuse arret_syntax::span::Span;\n\nuse crate::hir::scope::Scope;\n\n"
  },
  {
    "path": "compiler/hir/prim.rs",
    "chars": 1279,
    "preview": "use crate::hir::scope::Binding;\n\nmacro_rules! export_prims {\n    ( $( ($n:expr, $i:ident) ),* ) => {\n        #[derive(Cl"
  },
  {
    "path": "compiler/hir/records.rs",
    "chars": 7890,
    "preview": "use arret_syntax::datum::DataStr;\nuse arret_syntax::span::Span;\n\nuse crate::hir::error::{Error, ErrorKind, Result};\nuse "
  },
  {
    "path": "compiler/hir/scope.rs",
    "chars": 7524,
    "preview": "use std::collections::HashMap;\nuse std::sync::Arc;\n\nuse arret_syntax::span::Span;\n\nuse crate::context::ModuleId;\nuse cra"
  },
  {
    "path": "compiler/hir/types.rs",
    "chars": 34226,
    "preview": "use arret_syntax::span::Span;\n\nuse crate::hir::error::{\n    Error, ErrorKind, ExpectedPolyPurityArg, PolyArgIsNotPure, P"
  },
  {
    "path": "compiler/hir/util.rs",
    "chars": 2542,
    "preview": "use arret_syntax::datum::{DataStr, Datum};\nuse arret_syntax::span::Span;\n\nuse crate::hir::error::{Error, ErrorKind, Expe"
  },
  {
    "path": "compiler/hir/var_id.rs",
    "chars": 1478,
    "preview": "use std::num::NonZeroU32;\nuse std::sync::atomic::{AtomicU32, Ordering};\n\nuse crate::context::ModuleId;\n\n/// Identifier f"
  },
  {
    "path": "compiler/hir/visitor.rs",
    "chars": 1895,
    "preview": "use crate::hir;\n\n/// Visits an expression and all of its subexpressions\npub fn visit_exprs<'a, P: hir::Phase, F>(expr: &"
  },
  {
    "path": "compiler/id_type.rs",
    "chars": 5166,
    "preview": "use std::sync::Arc;\nuse std::{fmt, hash, ops};\n\n/// Builds a new ID type based off indexing in to a `Vec` lookup table\n/"
  },
  {
    "path": "compiler/lib.rs",
    "chars": 3594,
    "preview": "#![warn(clippy::all)]\n#![warn(rust_2018_idioms)]\n\n#[macro_use]\nmod id_type;\n\nmod arret_root;\nmod codegen;\nmod context;\nm"
  },
  {
    "path": "compiler/mir/app_purity.rs",
    "chars": 1108,
    "preview": "use std::collections::HashMap;\n\nuse crate::ty;\nuse crate::ty::purity;\nuse crate::ty::purity::Purity;\n\nfn resolve_ref_to_"
  },
  {
    "path": "compiler/mir/arg_list.rs",
    "chars": 3259,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::abitype;\n\nuse crate::mir::builder::{Builder, BuiltReg};\nuse crate::mir"
  },
  {
    "path": "compiler/mir/builder.rs",
    "chars": 4138,
    "preview": "use std::fmt;\n\nuse crate::mir::ops::{CastBoxedOp, CondOp, Op, OpKind, RegId, RegPhi};\nuse arret_runtime::abitype;\nuse ar"
  },
  {
    "path": "compiler/mir/costing.rs",
    "chars": 2687,
    "preview": "use crate::mir::ops;\n\n/// Abstract unit for measuring the runtime cost of ops\npub type OpCost = u32;\n\n/// Abstract unit "
  },
  {
    "path": "compiler/mir/env_values.rs",
    "chars": 7412,
    "preview": "use std::collections::HashMap;\n\nuse arret_syntax::datum::DataStr;\nuse arret_syntax::span::Span;\n\nuse crate::hir;\nuse cra"
  },
  {
    "path": "compiler/mir/equality.rs",
    "chars": 15567,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::abitype;\nuse arret_runtime::boxed;\nuse arret_runtime::boxed::prelude::"
  },
  {
    "path": "compiler/mir/error.rs",
    "chars": 2018,
    "preview": "use std::{error, fmt, result};\n\nuse codespan_reporting::diagnostic::Diagnostic;\n\nuse arret_syntax::span::{FileId, Span};"
  },
  {
    "path": "compiler/mir/eval_hir.rs",
    "chars": 63291,
    "preview": "use std::collections::HashMap;\nuse std::sync::Arc;\nuse std::{alloc, ffi, panic};\n\nuse arret_runtime::boxed;\nuse arret_ru"
  },
  {
    "path": "compiler/mir/inliner.rs",
    "chars": 10546,
    "preview": "use std::hash::{Hash, Hasher};\n\nuse arret_syntax::span::Span;\n\nuse arret_runtime::boxed::prelude::*;\nuse arret_runtime::"
  },
  {
    "path": "compiler/mir/intrinsic/bitwise.rs",
    "chars": 4627,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::abitype;\n\nuse crate::mir::builder::Builder;\nuse crate::mir::error::Res"
  },
  {
    "path": "compiler/mir/intrinsic/list.rs",
    "chars": 2704,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::boxed;\n\nuse crate::mir::builder::Builder;\nuse crate::mir::error::Resul"
  },
  {
    "path": "compiler/mir/intrinsic/math.rs",
    "chars": 12104,
    "preview": "//! Intrinsics for math operations on numbers\n//!\n//! This strives to match the behaviour of the stdlib in term of opera"
  },
  {
    "path": "compiler/mir/intrinsic/mod.rs",
    "chars": 2760,
    "preview": "mod bitwise;\nmod list;\nmod math;\nmod num_utils;\nmod number;\nmod panics;\nmod partial_print;\nmod print;\nmod testing;\nmod v"
  },
  {
    "path": "compiler/mir/intrinsic/num_utils.rs",
    "chars": 4078,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::abitype;\nuse arret_runtime::boxed;\n\nuse crate::mir::builder::{Builder,"
  },
  {
    "path": "compiler/mir/intrinsic/number.rs",
    "chars": 6973,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::abitype;\nuse arret_runtime::boxed;\nuse arret_runtime::boxed::prelude::"
  },
  {
    "path": "compiler/mir/intrinsic/panics.rs",
    "chars": 989,
    "preview": "use arret_syntax::span::Span;\n\nuse crate::mir::builder::Builder;\nuse crate::mir::error::{Error, Result};\nuse crate::mir:"
  },
  {
    "path": "compiler/mir/intrinsic/partial_print.rs",
    "chars": 3099,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::boxed;\n\nuse crate::mir::builder::Builder;\nuse crate::mir::eval_hir::Ev"
  },
  {
    "path": "compiler/mir/intrinsic/print.rs",
    "chars": 1287,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::boxed;\n\nuse crate::mir::builder::Builder;\nuse crate::mir::error::Resul"
  },
  {
    "path": "compiler/mir/intrinsic/testing.rs",
    "chars": 2862,
    "preview": "use std::collections::BTreeSet;\n\nuse arret_syntax::span::Span;\n\nuse arret_runtime::boxed;\n\nuse crate::mir::builder::Buil"
  },
  {
    "path": "compiler/mir/intrinsic/vector.rs",
    "chars": 2108,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::boxed;\n\nuse crate::mir::builder::Builder;\nuse crate::mir::error::Resul"
  },
  {
    "path": "compiler/mir/mod.rs",
    "chars": 472,
    "preview": "mod app_purity;\nmod arg_list;\nmod builder;\nmod costing;\nmod env_values;\nmod equality;\npub mod error;\npub mod eval_hir;\nm"
  },
  {
    "path": "compiler/mir/ops.rs",
    "chars": 25556,
    "preview": "use std::rc::Rc;\n\nuse arret_runtime::abitype;\nuse arret_runtime::boxed;\n\nuse arret_syntax::datum::DataStr;\nuse arret_syn"
  },
  {
    "path": "compiler/mir/optimise/duplicate_alloc_ops.rs",
    "chars": 7699,
    "preview": "use std::collections::HashMap;\n\nuse crate::mir::ops;\n\nfn visit_simple_alloc_op_kind(\n    op_kind: &mut ops::OpKind,\n    "
  },
  {
    "path": "compiler/mir/optimise/mod.rs",
    "chars": 707,
    "preview": "use crate::mir::ops;\nuse crate::mir::value::Value;\n\nmod duplicate_alloc_ops;\nmod unused_ops;\n\npub fn optimise_fun(fun: o"
  },
  {
    "path": "compiler/mir/optimise/unused_ops.rs",
    "chars": 12156,
    "preview": "use std::collections::HashSet;\n\nuse crate::mir::ops;\nuse crate::mir::value::Value;\n\nfn remove_unused_cond_ops(\n    cond_"
  },
  {
    "path": "compiler/mir/polymorph.rs",
    "chars": 4253,
    "preview": "use arret_runtime::abitype;\nuse arret_runtime::callback;\n\nuse crate::mir::ops;\nuse crate::ty;\nuse crate::ty::Ty;\n\n/// Po"
  },
  {
    "path": "compiler/mir/printer.rs",
    "chars": 32195,
    "preview": "use std::collections::HashMap;\nuse std::io::{Result, Write};\nuse std::iter;\n\nuse codespan_reporting::files::Files as _;\n"
  },
  {
    "path": "compiler/mir/record_field.rs",
    "chars": 2601,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::boxed;\nuse arret_runtime::boxed::prelude::*;\n\nuse crate::mir::builder:"
  },
  {
    "path": "compiler/mir/ret_value.rs",
    "chars": 1657,
    "preview": "use arret_runtime::abitype;\nuse arret_syntax::span::Span;\n\nuse crate::mir::builder::{Builder, BuiltReg};\nuse crate::mir:"
  },
  {
    "path": "compiler/mir/rust_fun.rs",
    "chars": 3593,
    "preview": "use arret_syntax::span::Span;\n\nuse crate::codegen::GenAbi;\nuse crate::mir::builder::Builder;\nuse crate::mir::error::{Err"
  },
  {
    "path": "compiler/mir/specific_abi_type.rs",
    "chars": 7831,
    "preview": "use arret_runtime::abitype;\nuse arret_runtime::boxed::TypeTag;\n\nuse crate::mir::tagset::TypeTagSet;\nuse crate::mir::valu"
  },
  {
    "path": "compiler/mir/tagset.rs",
    "chars": 9013,
    "preview": "use std::{fmt, iter, ops};\n\nuse crate::ty;\nuse crate::ty::Ty;\nuse arret_runtime::abitype;\nuse arret_runtime::boxed::{Typ"
  },
  {
    "path": "compiler/mir/typred.rs",
    "chars": 9651,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::abitype;\nuse arret_runtime::boxed;\nuse arret_runtime::boxed::prelude::"
  },
  {
    "path": "compiler/mir/value/arret_fun.rs",
    "chars": 2370,
    "preview": "use std::rc::Rc;\n\nuse arret_syntax::datum::DataStr;\n\nuse crate::context::ModuleId;\nuse crate::hir;\nuse crate::mir::env_v"
  },
  {
    "path": "compiler/mir/value/build_reg.rs",
    "chars": 24573,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::abitype;\nuse arret_runtime::boxed;\nuse arret_runtime::boxed::refs::Gc;"
  },
  {
    "path": "compiler/mir/value/from_reg.rs",
    "chars": 2442,
    "preview": "use arret_runtime::abitype;\nuse arret_runtime::boxed;\nuse arret_runtime::boxed::prelude::*;\n\nuse crate::mir::builder::Bu"
  },
  {
    "path": "compiler/mir/value/list.rs",
    "chars": 10262,
    "preview": "use std::vec;\n\nuse arret_syntax::span::Span;\n\nuse crate::mir::builder::{Builder, TryToBuilder};\nuse crate::mir::value;\nu"
  },
  {
    "path": "compiler/mir/value/mod.rs",
    "chars": 2835,
    "preview": "mod arret_fun;\npub mod build_reg;\npub mod from_reg;\npub mod list;\npub mod plan_phi;\npub mod synthetic_fun;\npub mod to_co"
  },
  {
    "path": "compiler/mir/value/plan_phi.rs",
    "chars": 2486,
    "preview": "use arret_runtime::abitype;\nuse arret_runtime::boxed;\n\nuse crate::mir::value::Value;\n\npub fn plan_phi_abi_type(lhs: &Val"
  },
  {
    "path": "compiler/mir/value/synthetic_fun.rs",
    "chars": 7590,
    "preview": "use std::collections::HashMap;\n\nuse arret_syntax::datum::DataStr;\nuse arret_syntax::span::Span;\n\nuse crate::hir;\nuse cra"
  },
  {
    "path": "compiler/mir/value/to_const.rs",
    "chars": 6906,
    "preview": "use arret_runtime::boxed;\nuse arret_runtime::boxed::prelude::*;\nuse arret_runtime::boxed::refs::Gc;\nuse arret_runtime::b"
  },
  {
    "path": "compiler/mir/value/types.rs",
    "chars": 9897,
    "preview": "use arret_runtime::boxed;\nuse arret_runtime::boxed::prelude::*;\n\nuse crate::mir::eval_hir::EvalHirCtx;\nuse crate::mir::t"
  },
  {
    "path": "compiler/mir/vector_member.rs",
    "chars": 1781,
    "preview": "use arret_syntax::span::Span;\n\nuse arret_runtime::abitype;\n\nuse crate::mir::builder::Builder;\nuse crate::mir::eval_hir::"
  },
  {
    "path": "compiler/promise.rs",
    "chars": 3904,
    "preview": "use std::collections::HashMap;\nuse std::ops::Deref;\nuse std::sync::{Arc, Condvar, Mutex, RwLock};\n\nstruct Inner<T>\nwhere"
  },
  {
    "path": "compiler/repl.rs",
    "chars": 13235,
    "preview": "use std::collections::{HashMap, HashSet};\nuse std::sync::Arc;\nuse std::thread;\n\nuse codespan_reporting::diagnostic::Diag"
  },
  {
    "path": "compiler/reporting.rs",
    "chars": 3995,
    "preview": "use codespan_reporting::diagnostic::{Diagnostic, Label};\n\nuse arret_syntax::span::{FileId, Span};\n\nuse crate::source::So"
  },
  {
    "path": "compiler/rfi/mod.rs",
    "chars": 18771,
    "preview": "use std::ffi::OsString;\nuse std::sync::Arc;\nuse std::{fmt, path};\n\nuse arret_syntax::datum::Datum;\nuse arret_syntax::spa"
  },
  {
    "path": "compiler/source.rs",
    "chars": 5748,
    "preview": "use std::ffi::OsString;\nuse std::ops::Range;\nuse std::sync::{Arc, RwLock, RwLockReadGuard};\nuse std::{fmt, fs, io, path}"
  },
  {
    "path": "compiler/tests/compile-error/arity.arret",
    "chars": 1044,
    "preview": "(import [stdlib base])\n\n(defn not-enough-fixed (_) ())\n(def _ (not-enough-fixed))\n      ;^^^^^^^^^^^^^^^^^^ ERROR incorr"
  },
  {
    "path": "compiler/tests/compile-error/bit-shift-left-negative.arret",
    "chars": 148,
    "preview": "(import [stdlib base])\n\n(def _ (bit-shift-left 0 -1))\n      ;^^^^^^^^^^^^^^^^^^^^^ ERROR shift left by negative bit coun"
  },
  {
    "path": "compiler/tests/compile-error/bit-shift-right-overflow.arret",
    "chars": 153,
    "preview": "(import [stdlib base])\n\n(def _ (bit-shift-right 0 65))\n      ;^^^^^^^^^^^^^^^^^^^^^^ ERROR shift right by 65 bits exceed"
  },
  {
    "path": "compiler/tests/compile-error/destruc-errors.arret",
    "chars": 758,
    "preview": "(import [stdlib base])\n\n(def [x y] [1 2])\n       ;^ ERROR unable to resolve `y`\n\n(def [x / y] [1 2 3])\n    ;^^^^^^^ ERRO"
  },
  {
    "path": "compiler/tests/compile-error/fn-lowering-errors.arret",
    "chars": 333,
    "preview": "(import [stdlib base])\n\n(def _ (fn))\n      ;^^^^ ERROR parameter declaration missing\n\n(def _ (fn #{A}))\n      ;^^^^^^^^^"
  },
  {
    "path": "compiler/tests/compile-error/if-errors.arret",
    "chars": 221,
    "preview": "(import [stdlib base])\n\n(def _ (if))            ;~ ERROR wrong argument count; expected 3\n(def _ (if true))       ;~ ERR"
  },
  {
    "path": "compiler/tests/compile-error/import-parse-errors.arret",
    "chars": 777,
    "preview": "(import (unknown [stdlib base]))\n        ;^^^^^^^ ERROR expected import filter keyword, found symbol\n\n(import (:rename ["
  },
  {
    "path": "compiler/tests/compile-error/macro-errors.arret",
    "chars": 1981,
    "preview": "(import [arret internal primitives])\n\n(defmacro 1 (macro-rules))\n         ;^ ERROR expected symbol, found integer\n\n(defm"
  },
  {
    "path": "compiler/tests/compile-error/misc-body-errors.arret",
    "chars": 655,
    "preview": "(import [stdlib base])\n\n(defn too-many-quote-args ()\n  (quote 1 2 3))\n ;^^^^^^^^^^^^^ ERROR wrong argument count; expect"
  },
  {
    "path": "compiler/tests/compile-error/misc-top-level-errors.arret",
    "chars": 869,
    "preview": "(import [stdlib base])\n\n(import (:only [stdlib base] do))\n       ;^^^^^^^^^^^^^^^^^^^^^^^^ ERROR duplicate definition\n\n1"
  },
  {
    "path": "compiler/tests/compile-error/missing-module.arret",
    "chars": 126,
    "preview": "(import [package does not exist]) ;~ ERROR package not found\n(import [stdlib module does not exist]) ;~ ERROR module not"
  },
  {
    "path": "compiler/tests/compile-error/no-main.arret",
    "chars": 51,
    "preview": " ;~ ERROR no main! function defined in entry module"
  },
  {
    "path": "compiler/tests/compile-error/overflow-add.arret",
    "chars": 171,
    "preview": "(import [stdlib base])\n\n(def maximum-int 9223372036854775807)\n(def _ (+ maximum-int 1))\n      ;^^^^^^^^^^^^^^^^^ ERROR a"
  },
  {
    "path": "compiler/tests/compile-error/overflow-multiply.arret",
    "chars": 176,
    "preview": "(import [stdlib base])\n\n(def maximum-int 9223372036854775807)\n(def _ (* maximum-int 2))\n      ;^^^^^^^^^^^^^^^^^ ERROR a"
  },
  {
    "path": "compiler/tests/compile-error/overflow-quot.arret",
    "chars": 248,
    "preview": "(import [stdlib base])\n\n(def minimum-int -9223372036854775808)\n\n; This message isn't quite right but it's not worth dist"
  },
  {
    "path": "compiler/tests/compile-error/overflow-subtract.arret",
    "chars": 178,
    "preview": "(import [stdlib base])\n\n(def minimum-int -9223372036854775808)\n(def _ (- minimum-int 1))\n      ;^^^^^^^^^^^^^^^^^ ERROR "
  },
  {
    "path": "compiler/tests/compile-error/quot-by-zero.arret",
    "chars": 107,
    "preview": "(import [stdlib base])\n\n(def _ (quot 1 0))\n      ;^^^^^^^^^^ ERROR division by zero\n\n(defn main! () ->! ())"
  },
  {
    "path": "compiler/tests/compile-error/record-errors.arret",
    "chars": 2164,
    "preview": "(import [stdlib base])\n\n(defrecord foo) ;~ ERROR wrong argument count; expected 2\n\n(defrecord :keyword ())\n          ;^^"
  },
  {
    "path": "compiler/tests/compile-error/recur-errors.arret",
    "chars": 487,
    "preview": "(import [stdlib base])\n\n(defn non-tail-reverse #{T} ([lst (List & T)]) -> (List & T)\n  (if (nil? lst)\n    lst\n    (conca"
  },
  {
    "path": "compiler/tests/compile-error/reference-errors.arret",
    "chars": 436,
    "preview": "(import [stdlib base])\n\n(def _ nopenopenope)\n      ;^^^^^^^^^^^^ ERROR unable to resolve `nopenopenope`\n\n(def _ Str)\n   "
  },
  {
    "path": "compiler/tests/compile-error/rem-by-zero.arret",
    "chars": 105,
    "preview": "(import [stdlib base])\n\n(def _ (rem 1 0))\n      ;^^^^^^^^^ ERROR division by zero\n\n(defn main! () ->! ())"
  },
  {
    "path": "compiler/tests/compile-error/syntax-error.arret",
    "chars": 75,
    "preview": "(this is invalid]\n               ;^ ERROR unexpected `]` while parsing list"
  },
  {
    "path": "compiler/tests/compile-error/type-checking-errors.arret",
    "chars": 3460,
    "preview": "(import [stdlib base])\n\n(def [wrong-ascription Int] 'foo)\n                            ;^^^ ERROR mismatched types\n\n(def "
  },
  {
    "path": "compiler/tests/compile-error/type-lowering-errors.arret",
    "chars": 896,
    "preview": "(import [stdlib base])\n\n(deftype _ unbound)\n          ;^^^^^^^ ERROR unable to resolve `unbound`\n\n(deftype _ (unbound))\n"
  },
  {
    "path": "compiler/tests/compile-error/vector-assoc-negative.arret",
    "chars": 145,
    "preview": "(import [stdlib base])\n\n(def _ (vector-assoc [1 2 3] -5 0))\n      ;^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR index -5 is negativ"
  },
  {
    "path": "compiler/tests/compile-error/vector-assoc-out-of-bounds.arret",
    "chars": 167,
    "preview": "(import [stdlib base])\n\n(def _ (vector-assoc [1 2 3] 3 0))\n      ;^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR index 3 out of bounds"
  },
  {
    "path": "compiler/tests/compile-error/vector-ref-negative.arret",
    "chars": 137,
    "preview": "(import [stdlib base])\n\n(def _ (vector-ref [1 2 3] -5))\n      ;^^^^^^^^^^^^^^^^^^^^^^^ ERROR index -5 is negative\n\n(defn"
  },
  {
    "path": "compiler/tests/compile-error/vector-ref-out-of-bounds.arret",
    "chars": 159,
    "preview": "(import [stdlib base])\n\n(def _ (vector-ref [1 2 3] 5))\n      ;^^^^^^^^^^^^^^^^^^^^^^ ERROR index 5 out of bounds for vec"
  },
  {
    "path": "compiler/tests/compile-error/wrong-main-type.arret",
    "chars": 74,
    "preview": "(import [stdlib base])\n\n(defn main! () -> Int 1) ;~ ERROR mismatched types"
  },
  {
    "path": "compiler/tests/integration.rs",
    "chars": 18069,
    "preview": "#![warn(clippy::all)]\n#![warn(rust_2018_idioms)]\n\nuse std::io::Write;\nuse std::ops::Range;\nuse std::sync::Arc;\nuse std::"
  },
  {
    "path": "compiler/tests/optimise/application.arret",
    "chars": 246,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  ; Even if the outer function is impure we should "
  },
  {
    "path": "compiler/tests/optimise/bitwise.arret",
    "chars": 659,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  (assert-fn-doesnt-contain-op! :call (fn ([lhs Int"
  },
  {
    "path": "compiler/tests/optimise/const.arret",
    "chars": 298,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  ; Make sure we pass a constant list when calling "
  },
  {
    "path": "compiler/tests/optimise/equality.arret",
    "chars": 1984,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defmacro assert-native-compare-fn! (macro-rules\n  [(f)\n    (do\n      (as"
  },
  {
    "path": "compiler/tests/optimise/inliner.arret",
    "chars": 663,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn recursive-member? ([item Any] [l (List & Any)]) -> Bool\n  (if (nil?"
  },
  {
    "path": "compiler/tests/optimise/list.arret",
    "chars": 494,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  ; This should just need to load the length from t"
  },
  {
    "path": "compiler/tests/optimise/math.arret",
    "chars": 1925,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  ; This should just pass the value through directl"
  },
  {
    "path": "compiler/tests/optimise/number.arret",
    "chars": 1542,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  ; This should be the identity function for `Int`\n"
  },
  {
    "path": "compiler/tests/optimise/typred.arret",
    "chars": 411,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn test-record-ty-preds! () ->! ()\n  (letrecord [RecordOne (record-one"
  },
  {
    "path": "compiler/tests/optimise/vector.arret",
    "chars": 530,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  ; This should just need to load the length from t"
  },
  {
    "path": "compiler/tests/run-error/impure-panic.arret",
    "chars": 147,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  (panic! \"Impure \" \\p \\a (black-box! \\n) (black-bo"
  },
  {
    "path": "compiler/tests/run-error/impure-panic.stderr",
    "chars": 14,
    "preview": "Impure panic!\n"
  },
  {
    "path": "compiler/tests/run-error/infinite-to-int.arret",
    "chars": 115,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  (black-box! (int (black-box! ##-Inf)))\n  ())"
  },
  {
    "path": "compiler/tests/run-error/infinite-to-int.stderr",
    "chars": 54,
    "preview": "Float value `-inf` is infinite; cannot convert to Int\n"
  },
  {
    "path": "compiler/tests/run-error/nan-to-int.arret",
    "chars": 114,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  (black-box! (int (black-box! ##NaN)))\n  ())"
  },
  {
    "path": "compiler/tests/run-error/nan-to-int.stderr",
    "chars": 57,
    "preview": "Float value `NaN` is not a number; cannot convert to Int\n"
  },
  {
    "path": "compiler/tests/run-error/overflow-add.arret",
    "chars": 159,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(def maximum-int 9223372036854775807)\n\n(defn main! () ->! ()\n  (black-box"
  },
  {
    "path": "compiler/tests/run-error/overflow-add.stderr",
    "chars": 29,
    "preview": "attempt to add with overflow\n"
  },
  {
    "path": "compiler/tests/run-error/overflow-multiply.arret",
    "chars": 159,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(def maximum-int 9223372036854775807)\n\n(defn main! () ->! ()\n  (black-box"
  },
  {
    "path": "compiler/tests/run-error/overflow-multiply.stderr",
    "chars": 34,
    "preview": "attempt to multiply with overflow\n"
  },
  {
    "path": "compiler/tests/run-error/overflow-quot.arret",
    "chars": 164,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(def minimum-int -9223372036854775808)\n\n(defn main! () ->! ()\n  (black-bo"
  },
  {
    "path": "compiler/tests/run-error/overflow-quot.stderr",
    "chars": 17,
    "preview": "division by zero\n"
  },
  {
    "path": "compiler/tests/run-error/overflow-subtract.arret",
    "chars": 160,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(def minimum-int -9223372036854775808)\n\n(defn main! () ->! ()\n  (black-bo"
  },
  {
    "path": "compiler/tests/run-error/overflow-subtract.stderr",
    "chars": 34,
    "preview": "attempt to subtract with overflow\n"
  },
  {
    "path": "compiler/tests/run-error/pure-panic.arret",
    "chars": 142,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  (panic \"Pure \" \\p \\a (black-box \\n) (black-box \\i"
  },
  {
    "path": "compiler/tests/run-error/pure-panic.stderr",
    "chars": 12,
    "preview": "Pure panic!\n"
  },
  {
    "path": "compiler/tests/run-error/quot-by-zero.arret",
    "chars": 113,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  (black-box! (quot 1 (black-box! 0)))\n  ())"
  },
  {
    "path": "compiler/tests/run-error/quot-by-zero.stderr",
    "chars": 17,
    "preview": "division by zero\n"
  },
  {
    "path": "compiler/tests/run-error/rem-by-zero.arret",
    "chars": 112,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn main! () ->! ()\n  (black-box! (rem 1 (black-box! 0)))\n  ())"
  },
  {
    "path": "compiler/tests/run-error/rem-by-zero.stderr",
    "chars": 17,
    "preview": "division by zero\n"
  },
  {
    "path": "compiler/tests/run-pass/application.arret",
    "chars": 1533,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n; Applying a fun with correct polymorphic purity inside a pure context\n(d"
  },
  {
    "path": "compiler/tests/run-pass/binding.arret",
    "chars": 273,
    "preview": "(import [stdlib base])\n\n; Ensure values can be passed through a multi-binding let\n(def [_ :original]\n  (let [x :original"
  },
  {
    "path": "compiler/tests/run-pass/bitwise.arret",
    "chars": 1295,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn test-bit-and! () ->! ()\n  (assert-eq! 8 (bit-and 12 9))\n  (assert-e"
  },
  {
    "path": "compiler/tests/run-pass/closure-typing.arret",
    "chars": 262,
    "preview": "(import [stdlib base])\n\n(defn direct-required-type ()\n  (let [[closure (Sym -> Sym)] (fn (x) x)]\n    (ann closure (Sym -"
  },
  {
    "path": "compiler/tests/run-pass/closure.arret",
    "chars": 1532,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n; This is a monomorphic, fixed arity form of `(constantly)`\n(defn return-"
  },
  {
    "path": "compiler/tests/run-pass/comments.arret",
    "chars": 193,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n; This is a line comment\n\n#_\"This is an ignored form\"\n\n(defn main! () ->!"
  },
  {
    "path": "compiler/tests/run-pass/conditionals.arret",
    "chars": 407,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn pos-neg-or-zero ([n Int]) -> (U 'positive 'negative 'zero)\n  (cond\n"
  },
  {
    "path": "compiler/tests/run-pass/divergence.arret",
    "chars": 2013,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n; This needs a `(do)` wrapper otherwise reverse type propagation will com"
  },
  {
    "path": "compiler/tests/run-pass/empty.arret",
    "chars": 39,
    "preview": "(import [stdlib base])\n\n(defn main! ())"
  },
  {
    "path": "compiler/tests/run-pass/equality.arret",
    "chars": 3667,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn arg-is-self-equal (arg) -> Bool\n  ; This is very tempting to simpif"
  },
  {
    "path": "compiler/tests/run-pass/hash.arret",
    "chars": 1366,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn assert-eq-hash! ([left Any] [right Any]) ->! ()\n  (assert-eq! (hash"
  },
  {
    "path": "compiler/tests/run-pass/list.arret",
    "chars": 4384,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn test-length! () ->! ()\n  (assert-eq! 0 (length ()))\n  (assert-eq! 4"
  },
  {
    "path": "compiler/tests/run-pass/macros.arret",
    "chars": 3435,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n; Make sure _ discards the macro\n(defmacro _ (macro-rules))\n(defmacro _ ("
  },
  {
    "path": "compiler/tests/run-pass/math.arret",
    "chars": 2574,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn test-add! () ->! ()\n  (assert-eq! 4 (+ 4))\n\n  (assert-eq! 7 (+ 4 (b"
  },
  {
    "path": "compiler/tests/run-pass/number.arret",
    "chars": 4700,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn test-zero? () ->! ()\n  (assert-eq! true (zero? 0))\n  (assert-eq! tr"
  },
  {
    "path": "compiler/tests/run-pass/occurrence-typing.arret",
    "chars": 2273,
    "preview": "(import [stdlib base])\n\n(defn test-type-in-branches ([test Bool])\n  (if test\n    (ann test true)\n    (ann test false)))\n"
  },
  {
    "path": "compiler/tests/run-pass/read.arret",
    "chars": 1383,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn test-read-str! () ->! ()\n  (assert-eq! 1 (read-str \"1\"))\n\n  (assert"
  },
  {
    "path": "compiler/tests/run-pass/record.arret",
    "chars": 6011,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn test-poly-records! () ->! ()\n  (letrecord [(Record A) (record [poly"
  },
  {
    "path": "compiler/tests/run-pass/recursion.arret",
    "chars": 2547,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn recursive-reverse #{T} ([lst (List & T)]) -> (List & T)\n  (if (nil?"
  },
  {
    "path": "compiler/tests/run-pass/set.arret",
    "chars": 1965,
    "preview": "(import [stdlib base])\n(import [stdlib set])\n(import [stdlib test])\n\n(defn test-set! () ->! ()\n  (assert-eq! #{} (set))\n"
  },
  {
    "path": "compiler/tests/run-pass/type-definitions.arret",
    "chars": 176,
    "preview": "(import [stdlib base])\n\n; Make sure _ eats the type\n(deftype _ Int)\n(deftype _ Float)\n\n(defn takes-int ([x Int])\n  (lett"
  },
  {
    "path": "compiler/tests/run-pass/typred.arret",
    "chars": 3394,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn test-tagged-ty-preds! () ->! ()\n  (assert-eq! true (any? (black-box"
  },
  {
    "path": "compiler/tests/run-pass/vector.arret",
    "chars": 3742,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n; This is our node size + 1\n; It's represented as a persistent vector wit"
  },
  {
    "path": "compiler/tests/run-pass/write.arret",
    "chars": 1188,
    "preview": "(import [stdlib base])\n(import [stdlib test])\n\n(defn test-write-to-stdout! () ->! ()\n  ; This is dumb but it makes us pr"
  },
  {
    "path": "compiler/ty/conv_abi.rs",
    "chars": 9257,
    "preview": "use arret_runtime::callback;\nuse arret_runtime::{abitype, boxed};\n\nuse crate::ty;\nuse crate::ty::purity::Purity;\nuse cra"
  }
]

// ... and 128 more files (download for full content)

About this extraction

This page contains the full source code of the etaoins/arret GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 328 files (1.6 MB), approximately 418.4k tokens, and a symbol index with 2542 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!