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
@@ -201,6 +198,7 @@ fn paths_add_optional_bad() {
201
198
[package]
202
199
name = "foo"
203
200
version = "0.0.1"
201
+ edition = "2021"
204
202
authors = []
205
203
206
204
[dependencies]
@@ -216,6 +214,7 @@ fn paths_add_optional_bad() {
216
214
[package]
217
215
name = "bar"
218
216
version = "0.1.0"
217
+ edition = "2021"
219
218
authors = []
220
219
221
220
[dependencies]
@@ -227,11 +226,27 @@ fn paths_add_optional_bad() {
227
226
. build ( ) ;
228
227
229
228
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
- )
229
+ . with_stderr_data ( str![ [ r#"
230
+ [LOCKING] 2 packages to latest compatible versions
231
+ [WARNING] path override for crate `bar` has altered the original list of
232
+ dependencies; the dependency on `baz` was either added or
233
+ modified to not match the previously resolved version
234
+
235
+ This is currently allowed but is known to produce buggy behavior with spurious
236
+ recompiles and changes to the crate graph. Path overrides unfortunately were
237
+ never intended to support this feature, so for now this message is just a
238
+ warning. In the future, however, this message will become a hard error.
239
+
240
+ To change the dependency graph via an override it's recommended to use the
241
+ `[patch]` feature of Cargo instead of the path override feature. This is
242
+ documented online at the url below for more information.
243
+
244
+ https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html
245
+
246
+ [CHECKING] bar v0.1.0 ([ROOT]/foo/bar2)
247
+ [CHECKING] foo v0.0.1 ([ROOT]/foo)
248
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
249
+
250
+ "# ] ] )
236
251
. run ( ) ;
237
252
}
0 commit comments