File tree 3 files changed +19
-3
lines changed
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 38
38
"make_static_lib_symlink" ,
39
39
"relativize" ,
40
40
)
41
+ load ("//rust/settings:incompatible.bzl" , "IncompatibleFlagInfo" )
41
42
42
43
BuildInfo = _BuildInfo
43
44
@@ -966,7 +967,7 @@ def construct_arguments(
966
967
rustc_flags .add (linker_script , format = "--codegen=link-arg=-T%s" )
967
968
968
969
if hasattr (attr , "_experimental_toolchain_generated_sysroot" ):
969
- if attr ._experimental_toolchain_generated_sysroot [BuildSettingInfo ]. value == True :
970
+ if attr ._experimental_toolchain_generated_sysroot [IncompatibleFlagInfo ]. enabled == True :
970
971
rustc_flags .add ("--sysroot" , toolchain .sysroot )
971
972
972
973
# Tell Rustc where to find the standard library (or libcore)
Original file line number Diff line number Diff line change 1
1
load ("@bazel_skylib//:bzl_library.bzl" , "bzl_library" )
2
2
load ("@bazel_skylib//rules:common_settings.bzl" , "bool_flag" , "string_flag" )
3
+ load (":incompatible.bzl" , "incompatible_flag" )
3
4
4
5
package (default_visibility = ["//visibility:public" ])
5
6
@@ -65,7 +66,8 @@ bzl_library(
65
66
)
66
67
67
68
# A flag to set rustc --sysroot flag to the sysroot generated by rust_toolchain
68
- bool_flag (
69
+ incompatible_flag (
69
70
name = "experimental_toolchain_generated_sysroot" ,
70
- build_setting_default = True ,
71
+ build_setting_default = False ,
72
+ issue = "https://github.com/bazelbuild/rules_rust/issues/2039" ,
71
73
)
Original file line number Diff line number Diff line change @@ -36,12 +36,25 @@ def _toolchain_adds_rustc_flags_impl(ctx):
36
36
"Found exec toolchain flag ({}) in rustc flags: {}" .format (EXEC_TOOLCHAIN_FLAG , action .argv ),
37
37
)
38
38
39
+ asserts .true (
40
+ env ,
41
+ "--sysroot" in action .argv ,
42
+ "Missing --sysroot flag" ,
43
+ )
44
+
45
+ asserts .true (
46
+ env ,
47
+ action .argv [action .argv .index ("--sysroot" ) + 1 ].endswith ("test/toolchain/rust_extra_flags_toolchain" ),
48
+ "--sysroot does not set to directory generated by rust_toolchain" ,
49
+ )
50
+
39
51
return analysistest .end (env )
40
52
41
53
toolchain_adds_rustc_flags_test = analysistest .make (
42
54
_toolchain_adds_rustc_flags_impl ,
43
55
config_settings = {
44
56
str (Label ("//:extra_rustc_flags" )): [CONFIG_FLAG ],
57
+ str (Label ("//rust/settings:experimental_toolchain_generated_sysroot" )): True ,
45
58
},
46
59
)
47
60
You can’t perform that action at this time.
0 commit comments