Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use trustfall-rustdoc-adapter to power rustdoc Trustfall playground. #306

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ members = [
"experiments/trustfall_rustdoc",
]
resolver = "2"

# Some of the experiment crates use Trustfall as an "external" dependency:
# they use a crate defined outside this repo that depends on Trustfall.
# This makes it difficult to use the local Trustfall together with the external one;
# patch all Trustfall uses to use the internal ones until we find a better solution.
[patch.crates-io]
trustfall = { path = "./trustfall" }
trustfall_core = { path = "./trustfall_core" }
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Items where lints were allowed. Not all crates have these,
# try one of: anyhow, clap, http, httparse, hyper, itertools.
# try one of: anyhow, httparse, hyper, itertools.
query {
Crate {
item {
name @output

attribute {
attr: value @output
@filter(op: "regex", value: ["$pattern"])
raw_attribute @output

content {
base @filter(op: "=", value: ["$allow_lint"])
}
}

span {
Expand All @@ -20,5 +23,5 @@ query {

vars:
{
"pattern": "#\\[allow\\(.+\\)\\]"
"allow_lint": "allow"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Structs whose names end in "Iter": not all crates have them,
# so try one of these crates: aho_corasick, arrayvec, indexmap, itertools
# so try one of these crates: arrayvec, indexmap, itertools
query {
Crate {
item {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface CrateOption {

const CRATE_OPTIONS = crateNames.map((name) => ({ label: fmtCrateName(name), value: name }));

const CrateParam = withDefault(StringParam, 'itertools-0.10.3')
const CrateParam = withDefault(StringParam, 'itertools-0.10.4')

interface PlaygroundProps {
queryWorker: Worker;
Expand Down Expand Up @@ -148,6 +148,7 @@ export default function Rustdoc(): JSX.Element {
setAsyncLoadedCrate({ status: 'ready', value: msg.name });
break;
case 'load-crate-error':
console.error(msg.message);
setAsyncLoadedCrate({ status: 'error', error: msg.message });
break;
case 'ready':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RustdocWorkerMessage, RustdocWorkerResponse } from './types';

function fetchCrateJson(filename: string): Promise<string> {
return fetch(
`https://raw.githubusercontent.com/obi1kenobi/crates-rustdoc/main/max_version/${filename}.json`
`https://raw.githubusercontent.com/obi1kenobi/crates-rustdoc/main/rustdoc-v26/max-version/${filename}.json`
).then((response) => response.text());
}

Expand Down
134 changes: 67 additions & 67 deletions experiments/browser_based_querying/src/rustdocCrates.ts
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
export default [
'aho_corasick-0.7.18',
'ansi_term-0.12.1',
'anyhow-1.0.62',
'anyhow-1.0.71',
'arrayvec-0.7.2',
'atty-0.2.14',
'autocfg-1.1.0',
'base64-0.20.0-alpha.1',
'bitflags-1.3.2',
'base64-0.21.2',
'bitflags-2.3.1',
'block_buffer-0.11.0-pre',
'byteorder-1.4.3',
'bytes-1.2.1',
'cc-1.0.73',
'bytes-1.4.0',
'cfg_if-1.0.0',
'chrono-0.4.22',
'clap-3.2.17',
'crossbeam_channel-0.5.6',
'crossbeam_deque-0.8.2',
'crossbeam_epoch-0.9.10',
'crossbeam_utils-0.8.11',
'digest-0.10.3',
'either-1.8.0',
'env_logger-0.9.0',
'chrono-0.4.26',
'clap-4.3.2',
'crossbeam_channel-0.5.8',
'crossbeam_epoch-0.9.14',
'crossbeam_utils-0.8.15',
'digest-0.11.0-pre',
'either-1.8.1',
'env_logger-0.10.0',
'fnv-1.0.7',
'futures_channel-0.3.23',
'futures_core-0.3.23',
'futures_sink-0.3.23',
'futures_task-0.3.23',
'futures_util-0.3.23',
'getrandom-0.2.7',
'hashbrown-0.12.3',
'http-0.2.8',
'httparse-1.7.1',
'hyper-0.14.20',
'indexmap-1.9.1',
'itertools-0.10.3',
'itoa-1.0.3',
'futures_channel-0.3.28',
'futures_core-0.3.28',
'futures_io-0.3.28',
'futures_sink-0.3.28',
'futures_task-0.3.28',
'futures_util-0.3.28',
'getrandom-0.2.10',
'hashbrown-0.14.0',
'httparse-1.8.0',
'hyper-1.0.0-rc.3',
'indexmap-1.9.3',
'itertools-0.10.4',
'itoa-1.0.6',
'lazy_static-1.4.0',
'libc-0.2.132',
'lock_api-0.4.7',
'log-0.4.17',
'libc-0.2.146',
'lock_api-0.4.10',
'log-0.4.18',
'memchr-2.5.0',
'memoffset-0.6.5',
'mio-0.8.4',
'num_cpus-1.13.1',
'memoffset-0.9.0',
'nom-7.1.3',
'num_cpus-1.15.0',
'num_integer-0.1.45',
'num_traits-0.2.15',
'once_cell-1.13.1',
'opaque_debug-0.3.0',
'once_cell-1.18.0',
'parking_lot-0.12.1',
'percent_encoding-2.1.0',
'percent_encoding-2.3.0',
'pin_project_lite-0.2.9',
'pkg_config-0.3.25',
'ppv_lite86-0.2.16',
'proc_macro2-1.0.43',
'proc_macro_hack-0.5.19',
'quote-1.0.21',
'pin_utils-0.1.0',
'pkg_config-0.3.27',
'proc_macro2-1.0.59',
'quote-1.0.28',
'rand-0.8.5',
'rand_core-0.6.3',
'regex-1.6.0',
'rand_core-0.6.4',
'regex-1.8.4',
'rustc_version-0.4.0',
'ryu-1.0.11',
'ryu-1.0.13',
'scopeguard-1.1.0',
'semver-1.0.13',
'semver_parser-0.10.2',
'serde-1.0.143',
'serde_derive-1.0.143',
'serde_json-1.0.83',
'slab-0.4.7',
'smallvec-1.9.0',
'socket2-0.4.4',
'semver-1.0.17',
'serde-1.0.163',
'serde_derive-1.0.163',
'serde_json-1.0.96',
'sha2-0.10.6',
'slab-0.4.8',
'smallvec-1.10.0',
'socket2-0.5.3',
'strsim-0.10.0',
'syn-1.0.99',
'termcolor-1.1.3',
'textwrap-0.15.0',
'thiserror-1.0.32',
'thiserror_impl-1.0.32',
'thread_local-1.1.4',
'time-0.3.13',
'tokio-1.20.1',
'tokio_util-0.7.3',
'toml-0.5.9',
'typenum-1.15.0',
'unicode_width-0.1.9',
'url-2.2.2',
'vec_map-0.8.2',
'syn-2.0.18',
'termcolor-1.2.0',
'textwrap-0.16.0',
'thiserror-1.0.40',
'thiserror_impl-1.0.40',
'thread_local-1.1.7',
'time-0.3.21',
'tinyvec-1.6.0',
'tokio-1.28.2',
'tokio_util-0.7.8',
'toml-0.7.4',
'tracing-0.1.37',
'tracing_core-0.1.31',
'typenum-1.16.0',
'unicode_normalization-0.1.22',
'unicode_width-0.1.10',
'unicode_xid-0.2.4',
'url-2.4.0',
'version_check-0.9.4',
'winapi-0.3.9',
];
2 changes: 1 addition & 1 deletion experiments/trustfall_rustdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ crate-type = ["cdylib", "rlib"]
default = ["console_error_panic_hook"]

[dependencies]
rustdoc-types = "0.14.0"
clap = { version = "3.2.8", features = ["derive"] }
trustfall_core = { path = "../../trustfall_core" }
trustfall_wasm = { path = "../../trustfall_wasm" }
trustfall-rustdoc-adapter = { version = ">=26.1.0,<26.2.0" }
serde_json = "1.0.82"
anyhow = "1.0.58"
wasm-bindgen = "0.2.80"
Expand Down
Loading