11//! Tests for `paths` overrides. 
22
3- #![ allow( deprecated) ]  
4- 
53use  cargo_test_support:: registry:: Package ; 
4+ use  cargo_test_support:: str; 
65use  cargo_test_support:: { basic_manifest,  project} ; 
76
87#[ cargo_test]  
@@ -57,12 +56,11 @@ fn broken_path_override_warns() {
5756        . build ( ) ; 
5857
5958    p. cargo ( "check" ) 
60-         . with_stderr ( 
61-             "\  
62- 
59+         . with_stderr_data ( str![ [ r#" 
60+ [UPDATING] `dummy-registry` index 
6361[LOCKING] 3 packages to latest compatible versions 
6462[ADDING] bar v0.1.0 (latest: v0.2.0) 
65- warning:  path override for crate `a` has altered the original list of
63+ [WARNING]  path override for crate `a` has altered the original list of
6664dependencies; the dependency on `bar` was either added or 
6765modified to not match the previously resolved version 
6866
@@ -78,13 +76,13 @@ documented online at the url below for more information.
7876https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html 
7977
8078[DOWNLOADING] crates ... 
81- [DOWNLOADED] [..]  
82- [CHECKING] [..]  
83- [CHECKING] [..]  
84- [CHECKING] [..]  
85- [FINISHED] [..]  
86- " , 
87-          ) 
79+ [DOWNLOADED] bar v0.2.0 (registry `dummy-registry`)  
80+ [CHECKING] bar v0.2.0  
81+ [CHECKING] a v0.0.1 ([ROOT]/foo/a2)  
82+ [CHECKING] foo v0.0.1 ([ROOT]/foo)  
83+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s  
84+ 
85+ "# ] ] ) 
8886        . run ( ) ; 
8987} 
9088
@@ -179,14 +177,13 @@ fn paths_ok_with_optional() {
179177        . build ( ) ; 
180178
181179    p. cargo ( "check" ) 
182-         . with_stderr ( 
183-             "\  
180+         . with_stderr_data ( str![ [ r#" 
184181[LOCKING] 2 packages to latest compatible versions 
185- [CHECKING] bar v0.1.0 ([..] bar2) 
186- [CHECKING] foo v0.0.1 ([..] ) 
187- [FINISHED] [..]  
188- " , 
189-          ) 
182+ [CHECKING] bar v0.1.0 ([ROOT]/foo/ bar2) 
183+ [CHECKING] foo v0.0.1 ([ROOT]/foo ) 
184+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s  
185+ 
186+ "# ] ] ) 
190187        . run ( ) ; 
191188} 
192189
@@ -227,11 +224,27 @@ fn paths_add_optional_bad() {
227224        . build ( ) ; 
228225
229226    p. cargo ( "check" ) 
230-         . with_stderr_contains ( 
231-             "\  
232- 
233- dependencies; the dependency on `baz` was either added or\  
234- , 
235-         ) 
227+         . with_stderr_data ( str![ [ r#" 
228+ [LOCKING] 2 packages to latest compatible versions 
229+ [WARNING] path override for crate `bar` has altered the original list of 
230+ dependencies; the dependency on `baz` was either added or 
231+ modified to not match the previously resolved version 
232+ 
233+ This is currently allowed but is known to produce buggy behavior with spurious 
234+ recompiles and changes to the crate graph. Path overrides unfortunately were 
235+ never intended to support this feature, so for now this message is just a 
236+ warning. In the future, however, this message will become a hard error. 
237+ 
238+ To change the dependency graph via an override it's recommended to use the 
239+ `[patch]` feature of Cargo instead of the path override feature. This is 
240+ documented online at the url below for more information. 
241+ 
242+ https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html 
243+ 
244+ [CHECKING] bar v0.1.0 ([ROOT]/foo/bar2) 
245+ [CHECKING] foo v0.0.1 ([ROOT]/foo) 
246+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s 
247+ 
248+ "# ] ] ) 
236249        . run ( ) ; 
237250} 
0 commit comments