Skip to content

Commit c577d29

Browse files
committed
fix
1 parent 5b1b00e commit c577d29

50 files changed

Lines changed: 1302 additions & 552 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@v5
1616

1717
- name: Install Rust
1818
uses: dtolnay/rust-toolchain@stable
@@ -24,3 +24,23 @@ jobs:
2424

2525
- name: Check
2626
run: cargo run --quiet --bin rss -- test --all
27+
28+
# The `test --all` manifest builds the default feature set; the native
29+
# (Cranelift) JIT tier is behind the off-by-default `native-jit` feature, so
30+
# run the rsscript suite with it enabled to keep the NativeJit and deopt
31+
# backends in the no-gap differential.
32+
native-jit:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v5
38+
39+
- name: Install Rust
40+
uses: dtolnay/rust-toolchain@stable
41+
42+
- name: Install nextest
43+
uses: taiki-e/install-action@nextest
44+
45+
- name: Test (native-jit)
46+
run: cargo nextest run -p rsscript --features native-jit --no-fail-fast

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v4
24+
uses: actions/checkout@v5
2525

2626
- name: Install Rust
2727
uses: dtolnay/rust-toolchain@stable

.github/workflows/rsscript-review-action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@v5
1616

1717
- name: Install Rust
1818
uses: dtolnay/rust-toolchain@stable

BUGS.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ reproduced; the HIGH items were additionally re-verified by hand.
1313
> - **RSS-5 / RSS-10:** the original single-line struct bodies (`{ first: T second: T }`)
1414
> additionally tripped a field-separator quirk that masked the documented symptom; with
1515
> idiomatic newline-separated fields both bugs reproduce exactly as described and are fixed.
16-
> - Separately discovered (not one of the 11, left open): matching on a borrowed
16+
> - Separately discovered (not one of the 11): matching on a borrowed
1717
> `read Option<T>`/`Result<…>` param and using the bound payload by value
18-
> (`match o { Some(s) => return s }`) lowers to `&T` and fails rustc E0308. Pre-existing
19-
> at `f5fab92`; independent of the RSS-4 fix.
18+
> (`match o { Some(s) => return s }`) lowered to `&T` and failed rustc E0308.
19+
> **FIXED:** the lowerer now rebinds a by-ref match's single payload to an owned
20+
> value — `*x` for a `Copy` payload, `x.clone()` for any other cloneable type
21+
> (resources, which aren't `Clone`, stay borrowed and are rejected by the resource
22+
> move rules). Covers built-in `Option`/`Result` and single-field user variants.
23+
> Regression test: `vm_eval_parity::parity_borrowed_match_payload_used_by_value`.
2024
2125
Run recipe used for all repros:
2226

crates/reir/src/format.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,13 @@ pub fn format_sarif(reconciliations: &[Reconciliation]) -> String {
510510
.as_ref()
511511
.map(|capability| {
512512
let mut parts = vec![format!("{:?}", capability.category)];
513-
for value in [&capability.provider, &capability.service, &capability.action]
514-
.into_iter()
515-
.flatten()
513+
for value in [
514+
&capability.provider,
515+
&capability.service,
516+
&capability.action,
517+
]
518+
.into_iter()
519+
.flatten()
516520
{
517521
parts.push(value.clone());
518522
}
@@ -1629,7 +1633,9 @@ mod tests {
16291633
let sarif = format_sarif(&[missing_reconciliation()]);
16301634
let value: serde_json::Value = serde_json::from_str(&sarif).expect("valid SARIF JSON");
16311635
assert_eq!(value["version"], "2.1.0");
1632-
let results = value["runs"][0]["results"].as_array().expect("results array");
1636+
let results = value["runs"][0]["results"]
1637+
.as_array()
1638+
.expect("results array");
16331639
assert_eq!(results.len(), 1);
16341640
assert_eq!(results[0]["ruleId"], "missing_capability");
16351641
assert_eq!(results[0]["level"], "error");

crates/reir/src/main.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,7 @@ fn try_run_collect(args: &[String]) -> Result<ExitCode, CliError> {
269269
let error_diagnostics = bundle
270270
.facts
271271
.iter()
272-
.filter(|fact| {
273-
fact.kind == reir::FactKind::Diagnostic && fact.unknown_reason.is_some()
274-
})
272+
.filter(|fact| fact.kind == reir::FactKind::Diagnostic && fact.unknown_reason.is_some())
275273
.count();
276274
if error_diagnostics > 0 {
277275
return Err(CliError::usage(format!(
@@ -321,9 +319,7 @@ fn try_run_report_pr(args: &[String]) -> Result<(ExitCode, String), CliError> {
321319
"--sarif" => sarif = true,
322320
"--fail-on-unknown" => cli.fail_on_unknown = Some(true),
323321
"--fail-on-excess" => cli.fail_on_excess = Some(true),
324-
"--require-verified-capabilities" => {
325-
cli.require_verified_capabilities = Some(true)
326-
}
322+
"--require-verified-capabilities" => cli.require_verified_capabilities = Some(true),
327323
"--allow-missing" => cli.fail_on_missing = Some(false),
328324
unknown => {
329325
return Err(CliError::usage(format!(

crates/reir/src/reconciliation.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,10 @@ mod tests {
380380
..required[0].clone()
381381
}];
382382
let results = reconcile_capabilities(&required, &granted);
383-
assert!(results.iter().any(|r| matches!(
384-
r.kind,
385-
ReconciliationKind::MissingCapability
386-
)));
383+
assert!(
384+
results
385+
.iter()
386+
.any(|r| matches!(r.kind, ReconciliationKind::MissingCapability))
387+
);
387388
}
388389
}

crates/reir/tests/report_pr_cli.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ fn report_pr_cli_matches_s3_demo_golden_comment() {
9898
.output()
9999
.expect("reir report-pr command should run");
100100

101-
let expected = fs::read_to_string(workspace.join("examples/demos/s3-iam-reir/expected/pr-comment.md"))
102-
.expect("golden PR comment should be readable");
101+
let expected =
102+
fs::read_to_string(workspace.join("examples/demos/s3-iam-reir/expected/pr-comment.md"))
103+
.expect("golden PR comment should be readable");
103104
let stdout = String::from_utf8(report_pr.stdout).expect("report-pr stdout should be utf-8");
104105
assert_eq!(stdout, expected);
105106
assert!(

crates/rsscript/src/analyzer.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4636,7 +4636,6 @@ fn generic_namespace_args(namespace: &str) -> Option<(&str, Vec<&str>)> {
46364636
Some((root, split_top_level_type_args(args)))
46374637
}
46384638

4639-
46404639
fn effect_name(effect: &EffectDecl) -> &str {
46414640
match effect {
46424641
EffectDecl::Name(name) | EffectDecl::Retains(name) => name,
@@ -5880,8 +5879,6 @@ fn builtin_value_type_name(name: &str) -> Option<&'static str> {
58805879
}
58815880
}
58825881

5883-
5884-
58855882
fn constructor_pattern_is_irrefutable(pattern: &MatchPattern) -> bool {
58865883
match pattern {
58875884
MatchPattern::Binding { .. } | MatchPattern::Wildcard(_) => true,

crates/rsscript/src/capability.rs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,21 @@ use CapabilityRisk::{High, Low, Medium};
4444
pub const CAPABILITY_CATEGORIES: &[CapabilityCategory] = &[
4545
cat("network.client", High, "Make outbound network connections"),
4646
cat("network.server", High, "Serve requests on a bound address"),
47-
cat("network.public_ingress", High, "Accept traffic from a public ingress"),
48-
cat("network.egress", High, "Send traffic to an external destination"),
49-
cat("filesystem.read", Medium, "Read files or directory contents"),
47+
cat(
48+
"network.public_ingress",
49+
High,
50+
"Accept traffic from a public ingress",
51+
),
52+
cat(
53+
"network.egress",
54+
High,
55+
"Send traffic to an external destination",
56+
),
57+
cat(
58+
"filesystem.read",
59+
Medium,
60+
"Read files or directory contents",
61+
),
5062
cat("filesystem.write", High, "Create, modify, or delete files"),
5163
cat("object_storage.read", Medium, "Read from object storage"),
5264
cat("object_storage.write", High, "Write to object storage"),
@@ -65,9 +77,21 @@ pub const CAPABILITY_CATEGORIES: &[CapabilityCategory] = &[
6577
cat("compute.regex", Low, "Evaluate a regular expression"),
6678
cat("process.args", Low, "Read process arguments"),
6779
cat("process.spawn", High, "Spawn or exec subprocesses"),
68-
cat("identity.assume", High, "Assume an identity / capability role"),
69-
cat("identity.grant", High, "Grant an identity / capability role"),
70-
cat("runtime.native", High, "Cross an unclassified native boundary"),
80+
cat(
81+
"identity.assume",
82+
High,
83+
"Assume an identity / capability role",
84+
),
85+
cat(
86+
"identity.grant",
87+
High,
88+
"Grant an identity / capability role",
89+
),
90+
cat(
91+
"runtime.native",
92+
High,
93+
"Cross an unclassified native boundary",
94+
),
7195
cat("runtime.unsafe", High, "Execute unsafe runtime code"),
7296
cat("build.execute", High, "Execute code at build time"),
7397
cat("build.network", High, "Access the network at build time"),

0 commit comments

Comments
 (0)