@@ -195,6 +195,18 @@ fn make_config_symlink_to_config_toml_relative() {
195
195
t ! ( symlink_file( Path :: new( "config.toml" ) , & symlink_path) ) ;
196
196
}
197
197
198
+ fn rename_config_toml_to_config_replacing_with_symlink ( ) {
199
+ let root = paths:: root ( ) ;
200
+ t ! ( fs:: rename(
201
+ root. join( ".cargo/config.toml" ) ,
202
+ root. join( ".cargo/config" )
203
+ ) ) ;
204
+ t ! ( symlink_file(
205
+ Path :: new( "config" ) ,
206
+ & root. join( ".cargo/config.toml" )
207
+ ) ) ;
208
+ }
209
+
198
210
#[ track_caller]
199
211
pub fn assert_error < E : Borrow < anyhow:: Error > > ( error : E , msgs : & str ) {
200
212
let causes = error
@@ -344,6 +356,36 @@ f1 = 1
344
356
assert_match ( expected, & output) ;
345
357
}
346
358
359
+ #[ cargo_test]
360
+ fn config_ambiguous_filename_symlink_doesnt_warn_backward ( ) {
361
+ // Windows requires special permissions to create symlinks.
362
+ // If we don't have permission, just skip this test.
363
+ if !symlink_supported ( ) {
364
+ return ;
365
+ } ;
366
+
367
+ write_config_toml (
368
+ "\
369
+ [foo]
370
+ f1 = 1
371
+ " ,
372
+ ) ;
373
+
374
+ rename_config_toml_to_config_replacing_with_symlink ( ) ;
375
+
376
+ let gctx = new_gctx ( ) ;
377
+
378
+ assert_eq ! ( gctx. get:: <Option <i32 >>( "foo.f1" ) . unwrap( ) , Some ( 1 ) ) ;
379
+
380
+ // It should NOT have warned for this situation.
381
+ // But, currently it does!
382
+ let output = read_output ( gctx) ;
383
+ let expected = "\
384
+ [WARNING] both `[..]/.cargo/config` and `[..]/.cargo/config.toml` exist. Using `[..]/.cargo/config`
385
+ " ;
386
+ assert_match ( expected, & output) ;
387
+ }
388
+
347
389
#[ cargo_test]
348
390
fn config_ambiguous_filename ( ) {
349
391
write_config_extless (
0 commit comments