Skip to content
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
7 changes: 5 additions & 2 deletions crates/wit-parser/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3839,9 +3839,12 @@ impl Remap {
if !resolve
.include_stability(&include.stability, pkg_id, include.span)
.with_context(|| {
let world_name = match self.worlds[include.id.index()] {
Some(resolved_id) => resolve.worlds[resolved_id].name.as_str(),
None => "<unknown>",
};
format!(
"failed to process feature gate for included world [{}] in package [{}]",
resolve.worlds[include.id].name.as_str(),
"failed to process feature gate for included world [{world_name}] in package [{}]",
resolve.packages[*pkg_id].name
)
})?
Expand Down
12 changes: 12 additions & 0 deletions crates/wit-parser/tests/ui/parse-fail/bad-gate-record-field.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package a:b;

interface foo {
@unstable(feature = inactive)
type gated = u32;

record r {
field-a: u32,
field-b: gated,
field-c: string,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
failed to update field `field-b`: found a reference to a type which is excluded due to its feature not being activated
--> tests/ui/parse-fail/bad-gate-record-field.wit:7:10
|
7 | record r {
| ^
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package test:invalid@0.1.0;

world a {}

world b {
@since(version = 0.2.0)
include a;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
failed to process feature gate for included world [a] in package [test:invalid@0.1.0]: feature gate cannot reference unreleased version 0.2.0 of package [test:invalid@0.1.0] (current version 0.1.0)
--> tests/ui/parse-fail/bad-since-on-include.wit:7:11
|
7 | include a;
| ^
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package test:invalid@0.1.0;

@since(version = 0.2.0)
interface foo {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
failed to process feature gate for interface [foo] in package [test:invalid@0.1.0]: feature gate cannot reference unreleased version 0.2.0 of package [test:invalid@0.1.0] (current version 0.1.0)
--> tests/ui/parse-fail/bad-since-on-interface.wit:4:11
|
4 | interface foo {}
| ^--
6 changes: 6 additions & 0 deletions crates/wit-parser/tests/ui/parse-fail/bad-since-on-type.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package test:invalid@0.1.0;

interface foo {
@since(version = 0.2.0)
type t = u32;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
failed to process feature gate for type [t] in package [test:invalid@0.1.0]: feature gate cannot reference unreleased version 0.2.0 of package [test:invalid@0.1.0] (current version 0.1.0)
--> tests/ui/parse-fail/bad-since-on-type.wit:5:8
|
5 | type t = u32;
| ^
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package test:invalid@0.1.0;

world w {
@since(version = 0.2.0)
import x: func();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
failed to process world item in `w`: feature gate cannot reference unreleased version 0.2.0 of package [test:invalid@0.1.0] (current version 0.1.0)
--> tests/ui/parse-fail/bad-since-on-world-import.wit:5:10
|
5 | import x: func();
| ^
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package test:invalid@0.1.0;

@since(version = 0.2.0)
world w {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
failed to process feature gate for world [w] in package [test:invalid@0.1.0]: feature gate cannot reference unreleased version 0.2.0 of package [test:invalid@0.1.0] (current version 0.1.0)
--> tests/ui/parse-fail/bad-since-on-world.wit:4:7
|
4 | world w {}
| ^
Loading