@@ -771,12 +771,11 @@ impl Merge for TomlConfig {
771771 }
772772 }
773773
774- for include_path in include. clone ( ) . unwrap_or_default ( ) {
774+ for include_path in include. clone ( ) . unwrap_or_default ( ) . iter ( ) . rev ( ) {
775+ let include_path = include_path. canonicalize ( ) . unwrap ( ) ;
776+
775777 let included_toml = Config :: get_toml ( & include_path) . unwrap_or_else ( |e| {
776- eprintln ! (
777- "ERROR: Failed to parse default config profile at '{}': {e}" ,
778- include_path. display( )
779- ) ;
778+ eprintln ! ( "ERROR: Failed to parse '{}': {e}" , include_path. display( ) ) ;
780779 exit ! ( 2 ) ;
781780 } ) ;
782781
@@ -786,7 +785,7 @@ impl Merge for TomlConfig {
786785 include_path. display( )
787786 ) ;
788787
789- self . merge ( included_extensions, included_toml, ReplaceOpt :: Override ) ;
788+ self . merge ( included_extensions, included_toml, ReplaceOpt :: IgnoreDuplicate ) ;
790789
791790 included_extensions. remove ( & include_path) ;
792791 }
@@ -1608,6 +1607,14 @@ impl Config {
16081607 toml. profile = Some ( "dist" . into ( ) ) ;
16091608 }
16101609
1610+ for include_path in toml. include . clone ( ) . unwrap_or_default ( ) . iter ( ) . rev ( ) {
1611+ let included_toml = get_toml ( include_path) . unwrap_or_else ( |e| {
1612+ eprintln ! ( "ERROR: Failed to parse '{}': {e}" , include_path. display( ) ) ;
1613+ exit ! ( 2 ) ;
1614+ } ) ;
1615+ toml. merge ( & mut Default :: default ( ) , included_toml, ReplaceOpt :: IgnoreDuplicate ) ;
1616+ }
1617+
16111618 if let Some ( include) = & toml. profile {
16121619 // Allows creating alias for profile names, allowing
16131620 // profiles to be renamed while maintaining back compatibility
@@ -1632,17 +1639,6 @@ impl Config {
16321639 toml. merge ( & mut Default :: default ( ) , included_toml, ReplaceOpt :: IgnoreDuplicate ) ;
16331640 }
16341641
1635- for include_path in toml. include . clone ( ) . unwrap_or_default ( ) {
1636- let included_toml = get_toml ( & include_path) . unwrap_or_else ( |e| {
1637- eprintln ! (
1638- "ERROR: Failed to parse default config profile at '{}': {e}" ,
1639- include_path. display( )
1640- ) ;
1641- exit ! ( 2 ) ;
1642- } ) ;
1643- toml. merge ( & mut Default :: default ( ) , included_toml, ReplaceOpt :: Override ) ;
1644- }
1645-
16461642 let mut override_toml = TomlConfig :: default ( ) ;
16471643 for option in flags. set . iter ( ) {
16481644 fn get_table ( option : & str ) -> Result < TomlConfig , toml:: de:: Error > {
0 commit comments