File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1318,6 +1318,17 @@ impl DetailedTomlDependency {
1318
1318
cx. warnings . push ( msg) ;
1319
1319
}
1320
1320
1321
+ if let Some ( version) = & self . version {
1322
+ if version. contains ( '+' ) {
1323
+ cx. warnings . push ( format ! (
1324
+ "version requirement `{}` for dependency `{}` \
1325
+ includes semver metadata which will be ignored, removing the \
1326
+ metadata is recommended to avoid confusion",
1327
+ version, name_in_toml
1328
+ ) ) ;
1329
+ }
1330
+ }
1331
+
1321
1332
if self . git . is_none ( ) {
1322
1333
let git_only_keys = [
1323
1334
( & self . branch , "branch" ) ,
Original file line number Diff line number Diff line change @@ -1280,3 +1280,25 @@ Caused by:
1280
1280
)
1281
1281
. run ( ) ;
1282
1282
}
1283
+
1284
+ #[ test]
1285
+ fn warn_semver_metadata ( ) {
1286
+ Package :: new ( "bar" , "1.0.0" ) . publish ( ) ;
1287
+ let p = project ( )
1288
+ . file (
1289
+ "Cargo.toml" ,
1290
+ r#"
1291
+ [package]
1292
+ name = "foo"
1293
+ version = "1.0.0"
1294
+
1295
+ [dependencies]
1296
+ bar = "1.0.0+1234"
1297
+ "# ,
1298
+ )
1299
+ . file ( "src/lib.rs" , "" )
1300
+ . build ( ) ;
1301
+ p. cargo ( "check" )
1302
+ . with_stderr_contains ( "[WARNING] version requirement `1.0.0+1234` for dependency `bar`[..]" )
1303
+ . run ( ) ;
1304
+ }
You can’t perform that action at this time.
0 commit comments