mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Make the crown disabled warning clearer and less scary (#37535)
Instead of printing a Rust compilation warning, simply print a message before every build (when using `mach`) that shows the build configuration and whether or not `crown` is enabled. Fixes #32597. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
824755d868
commit
f0eb29206d
5 changed files with 4 additions and 30 deletions
|
@ -5,12 +5,8 @@
|
||||||
#![cfg_attr(crown, feature(register_tool))]
|
#![cfg_attr(crown, feature(register_tool))]
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![doc = "The script crate contains all matters DOM."]
|
#![doc = "The script crate contains all matters DOM."]
|
||||||
// Register the linter `crown`, which is the Servo-specific linter for the script
|
// Register the linter `crown`, which is the Servo-specific linter for the script crate.
|
||||||
// crate. Issue a warning if `crown` is not being used to compile, but not when
|
|
||||||
// building rustdoc or running clippy.
|
|
||||||
#![cfg_attr(crown, register_tool(crown))]
|
#![cfg_attr(crown, register_tool(crown))]
|
||||||
#![cfg_attr(any(doc, clippy), allow(unknown_lints))]
|
|
||||||
#![deny(crown_is_not_used)]
|
|
||||||
|
|
||||||
// These are used a lot so let's keep them for now
|
// These are used a lot so let's keep them for now
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -3,12 +3,8 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#![cfg_attr(crown, feature(register_tool))]
|
#![cfg_attr(crown, feature(register_tool))]
|
||||||
// Register the linter `crown`, which is the Servo-specific linter for the script
|
// Register the linter `crown`, which is the Servo-specific linter for the script crate.
|
||||||
// crate. Issue a warning if `crown` is not being used to compile, but not when
|
|
||||||
// building rustdoc or running clippy.
|
|
||||||
#![cfg_attr(crown, register_tool(crown))]
|
#![cfg_attr(crown, register_tool(crown))]
|
||||||
#![cfg_attr(any(doc, clippy), allow(unknown_lints))]
|
|
||||||
#![deny(crown_is_not_used)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate js;
|
extern crate js;
|
||||||
|
|
|
@ -146,8 +146,9 @@ class MachCommands(CommandBase):
|
||||||
# Gather Cargo build timings (https://doc.rust-lang.org/cargo/reference/timings.html).
|
# Gather Cargo build timings (https://doc.rust-lang.org/cargo/reference/timings.html).
|
||||||
opts = ["--timings"] + opts
|
opts = ["--timings"] + opts
|
||||||
|
|
||||||
|
crown_enabled = "enabled" if kwargs.get("use_crown", False) else "disabled (no JS garbage collection linting)"
|
||||||
|
print(f"Building `{build_type.directory_name()}` build with crown {crown_enabled}.")
|
||||||
if very_verbose:
|
if very_verbose:
|
||||||
print(["Calling", "cargo", "build"] + opts)
|
|
||||||
for key in env:
|
for key in env:
|
||||||
print((key, env[key]))
|
print((key, env[key]))
|
||||||
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
use rustc_lint::LintStore;
|
|
||||||
use rustc_session::declare_lint;
|
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
CROWN_IS_NOT_USED,
|
|
||||||
Deny,
|
|
||||||
"Issues a rustc warning if crown is not used in compilation"
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn register(lint_store: &mut LintStore) {
|
|
||||||
lint_store.register_lints(&[CROWN_IS_NOT_USED]);
|
|
||||||
}
|
|
|
@ -35,8 +35,6 @@ mod unrooted_must_root;
|
||||||
#[cfg(feature = "trace_in_no_trace_lint")]
|
#[cfg(feature = "trace_in_no_trace_lint")]
|
||||||
mod trace_in_no_trace;
|
mod trace_in_no_trace;
|
||||||
|
|
||||||
mod crown_is_not_used;
|
|
||||||
|
|
||||||
struct MyCallbacks;
|
struct MyCallbacks;
|
||||||
|
|
||||||
impl Callbacks for MyCallbacks {
|
impl Callbacks for MyCallbacks {
|
||||||
|
@ -51,7 +49,6 @@ impl Callbacks for MyCallbacks {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
crown_is_not_used::register(lint_store);
|
|
||||||
#[cfg(feature = "unrooted_must_root_lint")]
|
#[cfg(feature = "unrooted_must_root_lint")]
|
||||||
unrooted_must_root::register(lint_store);
|
unrooted_must_root::register(lint_store);
|
||||||
#[cfg(feature = "trace_in_no_trace_lint")]
|
#[cfg(feature = "trace_in_no_trace_lint")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue