diff options
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index f45744b4d..3bfef7693 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -25,7 +25,8 @@ import ( func NewBaseCompiler(dir, dir64 string) *baseCompiler { return &baseCompiler{ Properties: BaseCompilerProperties{ - Edition: &config.DefaultEdition, + Edition: &config.DefaultEdition, + Deny_warnings: config.DefaultDenyWarnings, }, dir: dir, dir64: dir64, @@ -33,6 +34,9 @@ func NewBaseCompiler(dir, dir64 string) *baseCompiler { } type BaseCompilerProperties struct { + // whether to pass "-D warnings" to rustc. Defaults to true. + Deny_warnings *bool + // flags to pass to rustc Flags []string `android:"path,arch_variant"` @@ -109,10 +113,14 @@ func (compiler *baseCompiler) featuresToFlags(features []string) []string { func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flags { + if Bool(compiler.Properties.Deny_warnings) { + flags.RustFlags = append(flags.RustFlags, "-D warnings") + } flags.RustFlags = append(flags.RustFlags, compiler.Properties.Flags...) flags.RustFlags = append(flags.RustFlags, compiler.featuresToFlags(compiler.Properties.Features)...) flags.RustFlags = append(flags.RustFlags, "--edition="+*compiler.Properties.Edition) flags.LinkFlags = append(flags.LinkFlags, compiler.Properties.Ld_flags...) + flags.GlobalRustFlags = append(flags.GlobalRustFlags, config.GlobalRustFlags...) flags.GlobalRustFlags = append(flags.GlobalRustFlags, ctx.toolchain().ToolchainRustFlags()) flags.GlobalLinkFlags = append(flags.GlobalLinkFlags, ctx.toolchain().ToolchainLinkFlags()) |