@@ -165,39 +165,41 @@ struct OverrideCfg {
165
165
166
166
impl OverrideCfg {
167
167
fn from_file ( cfg : & Cfg , file : OverrideFile ) -> Result < Self > {
168
- Ok ( Self {
169
- toolchain : match ( file. toolchain . channel , file. toolchain . path ) {
170
- ( Some ( name) , None ) => Some (
171
- ( & ResolvableToolchainName :: try_from ( name) ?
172
- . resolve ( & cfg. get_default_host_triple ( ) ?) ?)
173
- . into ( ) ,
174
- ) ,
175
- ( None , Some ( path) ) => {
176
- if file. toolchain . targets . is_some ( )
177
- || file. toolchain . components . is_some ( )
178
- || file. toolchain . profile . is_some ( )
179
- {
180
- bail ! (
181
- "toolchain options are ignored for path toolchain ({})" ,
182
- path. display( )
183
- )
184
- }
185
- // We -do not- support relative paths, they permit trivial
186
- // completely arbitrary code execution in a directory.
187
- // Longer term we'll not support path based toolchains at
188
- // all, because they also permit arbitrary code execution,
189
- // though with more challenges to exploit.
190
- Some ( ( & PathBasedToolchainName :: try_from ( & path as & Path ) ?) . into ( ) )
191
- }
192
- ( Some ( channel) , Some ( path) ) => {
168
+ let toolchain_name = match ( file. toolchain . channel , file. toolchain . path ) {
169
+ ( Some ( name) , None ) => Some (
170
+ ( & ResolvableToolchainName :: try_from ( name) ?
171
+ . resolve ( & cfg. get_default_host_triple ( ) ?) ?)
172
+ . into ( ) ,
173
+ ) ,
174
+ ( None , Some ( path) ) => {
175
+ if file. toolchain . targets . is_some ( )
176
+ || file. toolchain . components . is_some ( )
177
+ || file. toolchain . profile . is_some ( )
178
+ {
193
179
bail ! (
194
- "cannot specify both channel ({}) and path ({}) simultaneously" ,
195
- channel,
180
+ "toolchain options are ignored for path toolchain ({})" ,
196
181
path. display( )
197
182
)
198
183
}
199
- ( None , None ) => None ,
200
- } ,
184
+ // We -do not- support relative paths, they permit trivial
185
+ // completely arbitrary code execution in a directory.
186
+ // Longer term we'll not support path based toolchains at
187
+ // all, because they also permit arbitrary code execution,
188
+ // though with more challenges to exploit.
189
+ Some ( ( & PathBasedToolchainName :: try_from ( & path as & Path ) ?) . into ( ) )
190
+ }
191
+ ( Some ( channel) , Some ( path) ) => {
192
+ bail ! (
193
+ "cannot specify both channel ({}) and path ({}) simultaneously" ,
194
+ channel,
195
+ path. display( )
196
+ )
197
+ }
198
+ ( None , None ) => None ,
199
+ } ;
200
+
201
+ Ok ( Self {
202
+ toolchain : toolchain_name,
201
203
components : file. toolchain . components . unwrap_or_default ( ) ,
202
204
targets : file. toolchain . targets . unwrap_or_default ( ) ,
203
205
profile : file
0 commit comments