@@ -4131,7 +4131,6 @@ fn panic_abort_compiles_with_panic_abort() {
41314131 . run ( ) ;
41324132}
41334133
4134- #[ expect( deprecated) ]
41354134#[ cargo_test]
41364135fn compiler_json_error_format ( ) {
41374136 let p = project ( )
@@ -4160,148 +4159,98 @@ fn compiler_json_error_format() {
41604159
41614160 let output = |fresh| {
41624161 r#"
4163- {
4164- "reason":"compiler-artifact",
4165- "package_id":"path+file:///[..]/foo#0.5.0",
4166- "manifest_path": "[..]",
4167- "target":{
4168- "kind":["custom-build"],
4169- "crate_types":["bin"],
4170- "doc": false,
4171- "doctest": false,
4172- "edition": "2015",
4173- "name":"build-script-build",
4174- "src_path":"[..]build.rs",
4175- "test": false
4176- },
4177- "profile": {
4178- "debug_assertions": true,
4179- "debuginfo": 0,
4180- "opt_level": "0",
4181- "overflow_checks": true,
4182- "test": false
4183- },
4184- "executable": null,
4185- "features": [],
4186- "filenames": "{...}",
4187- "fresh": $FRESH
4188- }
4189-
4190- {
4191- "reason":"compiler-message",
4192- "package_id":"path+file:///[..]/bar#0.5.0",
4193- "manifest_path": "[..]",
4194- "target":{
4195- "kind":["lib"],
4196- "crate_types":["lib"],
4197- "doc": true,
4198- "doctest": true,
4199- "edition": "2015",
4200- "name":"bar",
4201- "src_path":"[..]lib.rs",
4202- "test": true
4203- },
4204- "message":"{...}"
4205- }
4206-
4207- {
4208- "reason":"compiler-artifact",
4209- "profile": {
4210- "debug_assertions": true,
4211- "debuginfo": 2,
4212- "opt_level": "0",
4213- "overflow_checks": true,
4214- "test": false
4215- },
4216- "executable": null,
4217- "features": [],
4218- "package_id":"path+file:///[..]/bar#0.5.0",
4219- "manifest_path": "[..]",
4220- "target":{
4221- "kind":["lib"],
4222- "crate_types":["lib"],
4223- "doc": true,
4224- "doctest": true,
4225- "edition": "2015",
4226- "name":"bar",
4227- "src_path":"[..]lib.rs",
4228- "test": true
4229- },
4230- "filenames":[
4231- "[..].rlib",
4232- "[..].rmeta"
4233- ],
4234- "fresh": $FRESH
4235- }
4236-
4237- {
4238- "reason":"build-script-executed",
4239- "package_id":"path+file:///[..]/foo#0.5.0",
4240- "linked_libs":[],
4241- "linked_paths":[],
4242- "env":[],
4243- "cfgs":["xyz"],
4244- "out_dir": "[..]target/debug/build/foo-[..]/out"
4245- }
4246-
4247- {
4248- "reason":"compiler-message",
4249- "package_id":"path+file:///[..]/foo#0.5.0",
4250- "manifest_path": "[..]",
4251- "target":{
4252- "kind":["bin"],
4253- "crate_types":["bin"],
4254- "doc": true,
4255- "doctest": false,
4256- "edition": "2015",
4257- "name":"foo",
4258- "src_path":"[..]main.rs",
4259- "test": true
4260- },
4261- "message":"{...}"
4262- }
4263-
4264- {
4265- "reason":"compiler-artifact",
4266- "package_id":"path+file:///[..]/foo#0.5.0",
4267- "manifest_path": "[..]",
4268- "target":{
4269- "kind":["bin"],
4270- "crate_types":["bin"],
4271- "doc": true,
4272- "doctest": false,
4273- "edition": "2015",
4274- "name":"foo",
4275- "src_path":"[..]main.rs",
4276- "test": true
4277- },
4278- "profile": {
4279- "debug_assertions": true,
4280- "debuginfo": 2,
4281- "opt_level": "0",
4282- "overflow_checks": true,
4283- "test": false
4284- },
4285- "executable": "[..]/foo/target/debug/foo[EXE]",
4286- "features": [],
4287- "filenames": "{...}",
4288- "fresh": $FRESH
4289- }
4290-
4291- {"reason": "build-finished", "success": true}
4292- "#
4162+ [
4163+ {
4164+ "executable": null,
4165+ "features": [],
4166+ "fresh": $FRESH,
4167+ "manifest_path": "[ROOT]/foo/Cargo.toml",
4168+ "package_id": "path+[ROOTURL]/foo#0.5.0",
4169+ "reason": "compiler-artifact",
4170+ "target": {
4171+ "kind": ["custom-build"],
4172+ "...": "{...}"
4173+ },
4174+ "...": "{...}"
4175+ },
4176+ {
4177+ "manifest_path": "[ROOT]/foo/bar/Cargo.toml",
4178+ "package_id": "path+[ROOTURL]/foo/bar#0.5.0",
4179+ "reason": "compiler-message",
4180+ "target": {
4181+ "kind": ["lib"],
4182+ "...": "{...}"
4183+ },
4184+ "...": "{...}"
4185+ },
4186+ {
4187+ "executable": null,
4188+ "features": [],
4189+ "fresh": $FRESH,
4190+ "manifest_path": "[ROOT]/foo/bar/Cargo.toml",
4191+ "package_id": "path+[ROOTURL]/foo/bar#0.5.0",
4192+ "reason": "compiler-artifact",
4193+ "target": {
4194+ "kind": ["lib"],
4195+ "...": "{...}"
4196+ },
4197+ "...": "{...}"
4198+ },
4199+ {
4200+ "cfgs": [
4201+ "xyz"
4202+ ],
4203+ "env": [],
4204+ "linked_libs": [],
4205+ "linked_paths": [],
4206+ "out_dir": "[ROOT]/foo/target/debug/build/foo-[HASH]/out",
4207+ "package_id": "path+[ROOTURL]/foo#0.5.0",
4208+ "reason": "build-script-executed"
4209+ },
4210+ {
4211+ "manifest_path": "[ROOT]/foo/Cargo.toml",
4212+ "package_id": "path+[ROOTURL]/foo#0.5.0",
4213+ "reason": "compiler-message",
4214+ "target": {
4215+ "kind": ["bin"],
4216+ "...": "{...}"
4217+ },
4218+ "...": "{...}"
4219+ },
4220+ {
4221+ "features": [],
4222+ "fresh": $FRESH,
4223+ "manifest_path": "[ROOT]/foo/Cargo.toml",
4224+ "package_id": "path+[ROOTURL]/foo#0.5.0",
4225+ "reason": "compiler-artifact",
4226+ "target": {
4227+ "kind": ["bin"],
4228+ "...": "{...}"
4229+ },
4230+ "...": "{...}"
4231+ },
4232+ {
4233+ "reason": "build-finished",
4234+ "success": true
4235+ },
4236+ "{...}"
4237+ ]
4238+ "#
42934239 . replace ( "$FRESH" , fresh)
4240+ . is_json ( )
4241+ . against_jsonlines ( )
4242+ . unordered ( )
42944243 } ;
42954244
42964245 // Use `jobs=1` to ensure that the order of messages is consistent.
42974246 p. cargo ( "build -v --message-format=json --jobs=1" )
4298- . with_json_contains_unordered ( & output ( "false" ) )
4247+ . with_stdout_data ( output ( "false" ) )
42994248 . run ( ) ;
43004249
43014250 // With fresh build, we should repeat the artifacts,
43024251 // and replay the cached compiler warnings.
43034252 p. cargo ( "build -v --message-format=json --jobs=1" )
4304- . with_json_contains_unordered ( & output ( "true" ) )
4253+ . with_stdout_data ( output ( "true" ) )
43054254 . run ( ) ;
43064255}
43074256
@@ -4321,7 +4270,6 @@ fn wrong_message_format_option() {
43214270 . run ( ) ;
43224271}
43234272
4324- #[ expect( deprecated) ]
43254273#[ cargo_test]
43264274fn message_format_json_forward_stderr ( ) {
43274275 let p = project ( )
@@ -4330,54 +4278,42 @@ fn message_format_json_forward_stderr() {
43304278 . build ( ) ;
43314279
43324280 p. cargo ( "rustc --release --bin foo --message-format JSON" )
4333- . with_json_contains_unordered (
4334- r#"
4335- {
4336- "reason":"compiler-message",
4337- "package_id":"path+file:///[..]/foo#0.5.0",
4338- "manifest_path": "[..]",
4339- "target":{
4340- "kind":["bin"],
4341- "crate_types":["bin"],
4342- "doc": true,
4343- "doctest": false,
4344- "edition": "2015",
4345- "name":"foo",
4346- "src_path":"[..]",
4347- "test": true
4348- },
4349- "message":"{...}"
4350- }
4351-
4352- {
4353- "reason":"compiler-artifact",
4354- "package_id":"path+file:///[..]/foo#0.5.0",
4355- "manifest_path": "[..]",
4356- "target":{
4357- "kind":["bin"],
4358- "crate_types":["bin"],
4359- "doc": true,
4360- "doctest": false,
4361- "edition": "2015",
4362- "name":"foo",
4363- "src_path":"[..]",
4364- "test": true
4365- },
4366- "profile":{
4367- "debug_assertions":false,
4368- "debuginfo":0,
4369- "opt_level":"3",
4370- "overflow_checks": false,
4371- "test":false
4372- },
4373- "executable": "{...}",
4374- "features":[],
4375- "filenames": "{...}",
4376- "fresh": false
4377- }
4378-
4379- {"reason": "build-finished", "success": true}
4380- "# ,
4281+ . with_stdout_data (
4282+ str![ [ r#"
4283+ [
4284+ {
4285+ "manifest_path": "[ROOT]/foo/Cargo.toml",
4286+ "message": "{...}",
4287+ "package_id": "path+[ROOTURL]/foo#0.5.0",
4288+ "reason": "compiler-message",
4289+ "target": {
4290+ "kind": ["bin"],
4291+ "...": "{...}"
4292+ },
4293+ "...": "{...}"
4294+ },
4295+ {
4296+ "features": [],
4297+ "fresh": false,
4298+ "manifest_path": "[ROOT]/foo/Cargo.toml",
4299+ "package_id": "path+[ROOTURL]/foo#0.5.0",
4300+ "reason": "compiler-artifact",
4301+ "target": {
4302+ "kind": ["bin"],
4303+ "...": "{...}"
4304+ },
4305+ "...": "{...}"
4306+ },
4307+ {
4308+ "reason": "build-finished",
4309+ "success": true
4310+ },
4311+ "{...}"
4312+ ]
4313+ "# ] ]
4314+ . is_json ( )
4315+ . against_jsonlines ( )
4316+ . unordered ( ) ,
43814317 )
43824318 . run ( ) ;
43834319}
0 commit comments