@@ -46,31 +46,34 @@ fn direct_proxy(proc_name: &str, args: &[OsString], toolchain: &Toolchain) -> Re
46
46
// Install the entire toolchain declared in [toolchain] if it does not exist.
47
47
toolchain. install_if_nonexistent ( & description) ?;
48
48
49
- // Plugins distributed by forc have to be handled a little differently,
50
- // if one of them is called we want to check for 'forc' instead.
51
- let component_name = if Component :: is_distributed_by_forc ( proc_name) {
52
- component:: FORC
53
- } else {
54
- proc_name
55
- } ;
49
+ // If a specific version is declared, we want to call it from the
50
+ // store and not from the toolchain directory.
51
+ if let Some ( version) = to. get_component_version ( proc_name) {
52
+ let component = match Component :: resolve_from_name ( proc_name) {
53
+ Some ( component) => component,
54
+ None => {
55
+ return Err ( Error :: new (
56
+ ErrorKind :: NotFound ,
57
+ format ! ( "Component '{proc_name}' with version '{version}' not found" ) ,
58
+ )
59
+ . into ( ) ) ;
60
+ }
61
+ } ;
56
62
57
- // If a specific version is declared, we want to call it from the store and not from the toolchain directory.
58
- if let Some ( version) = to. get_component_version ( component_name) {
59
63
let store = Store :: from_env ( ) ?;
60
64
61
- if !store. has_component ( component_name , version) {
65
+ if !store. has_component ( & component . name , version) {
62
66
let download_cfg = DownloadCfg :: new (
63
- component_name ,
64
- TargetTriple :: from_component ( component_name ) ?,
67
+ & component . name ,
68
+ TargetTriple :: from_component ( & component . name ) ?,
65
69
Some ( version. clone ( ) ) ,
66
70
) ?;
67
- // Install components within [components] that are declared but missing from the store.
68
71
store. install_component ( & download_cfg) ?;
69
- } ;
72
+ }
70
73
71
74
(
72
75
store
73
- . component_dir_path ( component_name , version)
76
+ . component_dir_path ( & component . name , version)
74
77
. join ( proc_name) ,
75
78
description. to_string ( ) ,
76
79
)
@@ -94,7 +97,7 @@ fn direct_proxy(proc_name: &str, args: &[OsString], toolchain: &Toolchain) -> Re
94
97
ErrorKind :: NotFound => Err ( Error :: new (
95
98
ErrorKind :: NotFound ,
96
99
format ! (
97
- "component '{proc_name}' not found in currently active toolchain '{toolchain_name}'"
100
+ "Component '{proc_name}' not found in currently active toolchain '{toolchain_name}'"
98
101
) ,
99
102
) ) ,
100
103
_ => Err ( error) ,
0 commit comments