File tree 3 files changed +28
-6
lines changed
3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -838,7 +838,7 @@ impl BaseApp {
838
838
} ) ;
839
839
}
840
840
841
- let cargo_configs = CargoConfigs :: new ( & cargo_opts. config ) ?;
841
+ let cargo_configs = CargoConfigs :: new ( & cargo_opts. config , manifest_path . clone ( ) ) ?;
842
842
843
843
Ok ( Self {
844
844
output,
Original file line number Diff line number Diff line change @@ -138,6 +138,23 @@ pub(super) fn set_env_vars() {
138
138
// This environment variable is required to test the #[bench] fixture. Note that THIS IS FOR
139
139
// TEST CODE ONLY. NEVER USE THIS IN PRODUCTION.
140
140
std:: env:: set_var ( "RUSTC_BOOTSTRAP" , "1" ) ;
141
+
142
+ std:: env:: set_var (
143
+ "__NEXTEST_ENV_VAR_FOR_TESTING_IN_PARENT_ENV_NO_OVERRIDE" ,
144
+ "if-this-value-is-present-then-test-passed" ,
145
+ ) ;
146
+ std:: env:: set_var (
147
+ "__NEXTEST_ENV_VAR_FOR_TESTING_IN_PARENT_ENV_OVERRIDDEN" ,
148
+ "if-this-value-is-present-then-test-failed" ,
149
+ ) ;
150
+ std:: env:: set_var (
151
+ "__NEXTEST_ENV_VAR_FOR_TESTING_IN_PARENT_ENV_RELATIVE_NO_OVERRIDE" ,
152
+ "if-this-value-is-present-then-test-passed" ,
153
+ ) ;
154
+ std:: env:: set_var (
155
+ "__NEXTEST_ENV_VAR_FOR_TESTING_IN_PARENT_ENV_RELATIVE_OVERRIDDEN" ,
156
+ "if-this-value-is-present-then-test-failed" ,
157
+ ) ;
141
158
}
142
159
143
160
#[ track_caller]
Original file line number Diff line number Diff line change @@ -203,12 +203,17 @@ impl CargoConfigs {
203
203
/// Discover Cargo config files using the same algorithm that Cargo uses.
204
204
pub fn new (
205
205
cli_configs : impl IntoIterator < Item = impl AsRef < str > > ,
206
+ manifest_path : Option < Utf8PathBuf > ,
206
207
) -> Result < Self , CargoConfigError > {
207
- let cwd = std:: env:: current_dir ( )
208
- . map_err ( CargoConfigError :: GetCurrentDir )
209
- . and_then ( |cwd| {
210
- Utf8PathBuf :: try_from ( cwd) . map_err ( CargoConfigError :: CurrentDirInvalidUtf8 )
211
- } ) ?;
208
+ let cwd = match manifest_path {
209
+ Some ( manifest_path) => manifest_path. parent ( ) . map ( |path| path. to_owned ( ) ) . unwrap_or_default ( ) ,
210
+ None =>
211
+ std:: env:: current_dir ( )
212
+ . map_err ( CargoConfigError :: GetCurrentDir )
213
+ . and_then ( |cwd| {
214
+ Utf8PathBuf :: try_from ( cwd) . map_err ( CargoConfigError :: CurrentDirInvalidUtf8 )
215
+ } ) ?
216
+ } ;
212
217
let cli_configs = parse_cli_configs ( & cwd, cli_configs. into_iter ( ) ) ?;
213
218
214
219
Ok ( Self {
You can’t perform that action at this time.
0 commit comments