1
1
//! Tests for `paths` overrides.
2
2
3
- #![ allow( deprecated) ]
4
-
5
3
use cargo_test_support:: registry:: Package ;
4
+ use cargo_test_support:: str;
6
5
use cargo_test_support:: { basic_manifest, project} ;
7
6
8
7
#[ cargo_test]
@@ -57,12 +56,11 @@ fn broken_path_override_warns() {
57
56
. build ( ) ;
58
57
59
58
p. cargo ( "check" )
60
- . with_stderr (
61
- "\
62
- [UPDATING] [..]
59
+ . with_stderr_data ( str![ [ r#"
60
+ [UPDATING] `dummy-registry` index
63
61
[LOCKING] 3 packages to latest compatible versions
64
62
[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
66
64
dependencies; the dependency on `bar` was either added or
67
65
modified to not match the previously resolved version
68
66
@@ -78,13 +76,13 @@ documented online at the url below for more information.
78
76
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html
79
77
80
78
[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
+ "# ] ] )
88
86
. run ( ) ;
89
87
}
90
88
@@ -179,14 +177,13 @@ fn paths_ok_with_optional() {
179
177
. build ( ) ;
180
178
181
179
p. cargo ( "check" )
182
- . with_stderr (
183
- "\
180
+ . with_stderr_data ( str![ [ r#"
184
181
[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
+ "# ] ] )
190
187
. run ( ) ;
191
188
}
192
189
@@ -227,11 +224,27 @@ fn paths_add_optional_bad() {
227
224
. build ( ) ;
228
225
229
226
p. cargo ( "check" )
230
- . with_stderr_contains (
231
- "\
232
- warning: path override for crate `bar` has altered the original list of
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
+ "# ] ] )
236
249
. run ( ) ;
237
250
}
0 commit comments