Skip to content

Commit

Permalink
Merge branch 'canary' into fix-vercel-og-license
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi authored Jan 10, 2025
2 parents a212a36 + ae431f2 commit ca8f428
Show file tree
Hide file tree
Showing 13,037 changed files with 1,439,523 additions and 961,125 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 8 additions & 1 deletion .alexrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
"invalid",
"remains",
"special",
"white"
"white",
"deno",
"digitalocean",
"flightcontrol",
"fly.io",
"github",
"railway",
"sst"
]
}
40 changes: 29 additions & 11 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,55 @@
[env]
CARGO_WORKSPACE_DIR = { value = "", relative = true }
TURBO_PNPM_WORKSPACE_DIR = { value = "", relative = true }

[build]
[alias]
xtask = "run --package xtask --"

[build]
rustflags = [
"--cfg",
"tokio_unstable",
"-Zshare-generics=y", # make the current crate share its generic instantiations
"-Zthreads=8", # parallel frontend https://blog.rust-lang.org/2023/11/09/parallel-rustc.html
"-Csymbol-mangling-version=v0",
]
rustdocflags = []

[target.x86_64-pc-windows-msvc]
linker = "rust-lld"
rustflags = ["-C", "target-feature=+crt-static"]

[target.i686-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-pc-windows-msvc]
linker = "rust-lld"

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
[target.'cfg(target_os = "macos")']
linker = "rust-lld"

[target.'cfg(all(target_os = "linux", target_env = "gnu"))']
rustflags = [
"--cfg",
"tokio_unstable",
"-Zshare-generics=y",
"-Zthreads=8",
"-Zunstable-options",
"-Csymbol-mangling-version=v0",
"-Ctarget-feature=-crt-static",
"-Clink-arg=-lgcc",
"-Clinker-flavor=gnu-lld-cc",
"-Clink-self-contained=+linker",
]

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.'cfg(all())']
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
rustflags = [
"--cfg",
"tokio_unstable",
"-Zshare-generics=y",
"-Csymbol-mangling-version=v0",
"-Ctarget-feature=-crt-static",
"-Clink-arg=-lgcc",
]

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
42 changes: 42 additions & 0 deletions .config/ast-grep/rule-tests/__snapshots__/no-context-snapshot.yml

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

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

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

11 changes: 11 additions & 0 deletions .config/ast-grep/rule-tests/no-context-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id: no-context
valid:
- 'let chunking_context = ChunkingContext::new();'
- 'struct Foo { chunking_context: Context };'
- 'foo(|chunking_context| context)'
- 'fn foo(chunking_context: ChunkingContext) -> u32 { 5 };'
invalid:
- 'let context = ChunkingContext::new();'
- 'struct Foo { context: Context };'
- 'foo(|context| context)'
- 'fn foo(context: ChunkingContext) -> u32 { 5 };'
20 changes: 20 additions & 0 deletions .config/ast-grep/rule-tests/resolved-vc-in-return-type-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
id: resolved-vc-in-return-type
valid:
- |
pub async fn ignore_this(x: ResolvedVc<MyType>) -> Result<ResolvedVc<MyType>> {}
- |
pub trait OtherTrait() {
fn ignore_this() -> ResolvedVc<MyType>;
}
invalid:
- |
#[turbo_tasks::function]
pub async fn flag_this(x: ResolvedVc<MyType>) -> ResolvedVc<MyType> {}
- |
#[turbo_tasks::function]
pub async fn flag_this_too(x: ResolvedVc<MyType>) -> Result<ResolvedVc<MyType>> {}
- |
#[turbo_tasks::value_trait]
pub trait ValueTrait() {
fn flag_this() -> ResolvedVc<MyType>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
id: resolved-vc-in-trait-arguments
valid:
- |
#[turbo_tasks::value_trait]
pub trait Example {
fn write_to_disk(self: Vc<Self>);
fn write_to_disk(self: ResolvedVc<Self>) {}
}
invalid:
- |
#[turbo_tasks::value_trait]
pub trait Example {
fn write_to_disk(self: ResolvedVc<Self>);
}
File renamed without changes.
22 changes: 22 additions & 0 deletions .config/ast-grep/rules/no-context.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json

id: no-context
message: Don't name variables `context`.
note: Use a more specific name, such as chunking_context, asset_context, etc.
severity: error
language: Rust
rule:
regex: \bcontext\b
any:
- all:
- inside:
any:
- kind: closure_parameters
- kind: parameter
- kind: function_item
- kind: let_declaration
- kind: identifier
- all:
- kind: field_identifier
- inside:
kind: field_declaration
52 changes: 52 additions & 0 deletions .config/ast-grep/rules/resolved-vc-in-return-type.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json

id: resolved-vc-in-return-type
message: Returning a `ResolvedVc` in a turbo task is not recommended. Consider replacing `$TYPE` in `$FN_NAME` with `$RESOLVED_VC` instead.
severity: warning # error, warning, info, hint
language: Rust
rule:
any:
# turbo tasks function
- all:
- pattern:
context: 'let x: ResolvedVc<$A> = 1;'
selector: generic_type
- pattern: $TYPE
inside:
kind: function_item
field: return_type
stopBy: end
follows:
pattern: '#[turbo_tasks::function]'
has:
kind: identifier
pattern: $FN_NAME
# turbo tasks value trait
- all:
- pattern:
context: 'let x: ResolvedVc<$A> = 1;'
selector: generic_type
- pattern: $TYPE
inside:
kind: function_signature_item
field: return_type
stopBy: end
inside:
inside:
kind: trait_item
follows:
pattern: '#[turbo_tasks::value_trait]'
has:
kind: identifier
pattern: $FN_NAME
rewriters:
- id: rewrite-vc
rule:
pattern: $TYPE
fix: Vc<$A>
transform:
RESOLVED_VC:
rewrite:
rewriters: [rewrite-vc]
source: $TYPE
fix: $RESOLVED_VC
20 changes: 20 additions & 0 deletions .config/ast-grep/rules/resolved-vc-in-trait.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json

id: resolved-vc-in-trait-arguments
message: Using `ResolvedVc` in a turbo tasks trait is unsound. Consider making `$FN_NAME` take `Vc` instead.
severity: warning # error, warning, info, hint
language: Rust
rule:
pattern:
context: 'let x: ResolvedVc<$A> = 1;'
selector: generic_type
inside:
kind: function_signature_item
stopBy: end
pattern: fn $FN_NAME($_ARGS)
inside:
inside:
kind: trait_item
follows:
pattern: '#[turbo_tasks::value_trait]'
fix: Vc<$A>
Loading

0 comments on commit ca8f428

Please sign in to comment.