-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[target-spec] actually deserialize target_family and target_endian co…
…rrectly Oof, this is a pretty bad bug -- we weren't deserializing these correctly. Add some spot checks, some snapshot tests, and remove some old `rustc_version` code.
- Loading branch information
1 parent
21593e4
commit 92d25d5
Showing
8 changed files
with
129 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
target-spec-miette/tests/snapshot/custom-invalid/input/invalid-endian.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"arch": "powerpc64", | ||
"abi-return-struct-as-int": true, | ||
"cpu": "ppc64", | ||
"crt-objects-fallback": "false", | ||
"crt-static-respected": true, | ||
"data-layout": "E-m:e-Fn32-i64:64-n32:64", | ||
"default-dwarf-version": 2, | ||
"dynamic-linking": true, | ||
"has-rpath": true, | ||
"has-thread-local": true, | ||
"is-builtin": true, | ||
"linker-flavor": "gnu-cc", | ||
"llvm-target": "powerpc64-unknown-freebsd", | ||
"max-atomic-width": 64, | ||
"metadata": { | ||
"description": "PPC64 FreeBSD (ELFv1 and ELFv2)", | ||
"host_tools": true, | ||
"std": true, | ||
"tier": 3 | ||
}, | ||
"os": "freebsd", | ||
"position-independent-executables": true, | ||
"pre-link-args": { | ||
"gnu-cc": ["-m64"], | ||
"gnu-lld-cc": ["-m64"] | ||
}, | ||
"relro-level": "full", | ||
"stack-probes": { | ||
"kind": "inline" | ||
}, | ||
"target-endian": "middle", | ||
"target-family": ["unix"], | ||
"target-mcount": "_mcount", | ||
"target-pointer-width": "64" | ||
} |
36 changes: 36 additions & 0 deletions
36
target-spec-miette/tests/snapshot/custom-invalid/input/invalid-family.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"arch": "powerpc64", | ||
"abi-return-struct-as-int": true, | ||
"cpu": "ppc64", | ||
"crt-objects-fallback": "false", | ||
"crt-static-respected": true, | ||
"data-layout": "E-m:e-Fn32-i64:64-n32:64", | ||
"default-dwarf-version": 2, | ||
"dynamic-linking": true, | ||
"has-rpath": true, | ||
"has-thread-local": true, | ||
"is-builtin": true, | ||
"linker-flavor": "gnu-cc", | ||
"llvm-target": "powerpc64-unknown-freebsd", | ||
"max-atomic-width": 64, | ||
"metadata": { | ||
"description": "PPC64 FreeBSD (ELFv1 and ELFv2)", | ||
"host_tools": true, | ||
"std": true, | ||
"tier": 3 | ||
}, | ||
"os": "freebsd", | ||
"position-independent-executables": true, | ||
"pre-link-args": { | ||
"gnu-cc": ["-m64"], | ||
"gnu-lld-cc": ["-m64"] | ||
}, | ||
"relro-level": "full", | ||
"stack-probes": { | ||
"kind": "inline" | ||
}, | ||
"target-endian": "big", | ||
"target-family": "none", | ||
"target-mcount": "_mcount", | ||
"target-pointer-width": "64" | ||
} |
15 changes: 15 additions & 0 deletions
15
target-spec-miette/tests/snapshot/custom-invalid/output/invalid-endian.json-display.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
source: target-spec-miette/tests/snapshot/custom.rs | ||
expression: "format!(\"{:?}\", miette::Report::new_boxed(diagnostic))" | ||
snapshot_kind: text | ||
--- | ||
× error deserializing custom target JSON for `my-target` | ||
╰─▶ unknown variant `middle`, expected `little` or `big` at line 32 column | ||
29 | ||
╭─[32:29] | ||
31 │ }, | ||
32 │ "target-endian": "middle", | ||
· ▲ | ||
· ╰── unknown variant `middle`, expected `little` or `big` | ||
33 │ "target-family": ["unix"], | ||
╰──── |
14 changes: 14 additions & 0 deletions
14
target-spec-miette/tests/snapshot/custom-invalid/output/invalid-family.json-display.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
source: target-spec-miette/tests/snapshot/custom.rs | ||
expression: "format!(\"{:?}\", miette::Report::new_boxed(diagnostic))" | ||
snapshot_kind: text | ||
--- | ||
× error deserializing custom target JSON for `my-target` | ||
╰─▶ invalid type: string "none", expected a sequence at line 33 column 27 | ||
╭─[33:27] | ||
32 │ "target-endian": "big", | ||
33 │ "target-family": "none", | ||
· ▲ | ||
· ╰── invalid type: string "none", expected a sequence | ||
34 │ "target-mcount": "_mcount", | ||
╰──── |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters