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:
Martin Robinson 2025-06-19 14:44:26 +02:00 committed by GitHub
parent 824755d868
commit f0eb29206d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 4 additions and 30 deletions

View file

@ -5,12 +5,8 @@
#![cfg_attr(crown, feature(register_tool))]
#![deny(unsafe_code)]
#![doc = "The script crate contains all matters DOM."]
// Register the linter `crown`, which is the Servo-specific linter for the script
// crate. Issue a warning if `crown` is not being used to compile, but not when
// building rustdoc or running clippy.
// Register the linter `crown`, which is the Servo-specific linter for the script crate.
#![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
#[macro_use]

View file

@ -3,12 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#![cfg_attr(crown, feature(register_tool))]
// Register the linter `crown`, which is the Servo-specific linter for the script
// crate. Issue a warning if `crown` is not being used to compile, but not when
// building rustdoc or running clippy.
// Register the linter `crown`, which is the Servo-specific linter for the script crate.
#![cfg_attr(crown, register_tool(crown))]
#![cfg_attr(any(doc, clippy), allow(unknown_lints))]
#![deny(crown_is_not_used)]
#[macro_use]
extern crate js;

View file

@ -146,8 +146,9 @@ class MachCommands(CommandBase):
# Gather Cargo build timings (https://doc.rust-lang.org/cargo/reference/timings.html).
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:
print(["Calling", "cargo", "build"] + opts)
for key in env:
print((key, env[key]))

View file

@ -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]);
}

View file

@ -35,8 +35,6 @@ mod unrooted_must_root;
#[cfg(feature = "trace_in_no_trace_lint")]
mod trace_in_no_trace;
mod crown_is_not_used;
struct MyCallbacks;
impl Callbacks for MyCallbacks {
@ -51,7 +49,6 @@ impl Callbacks for MyCallbacks {
return;
}
crown_is_not_used::register(lint_store);
#[cfg(feature = "unrooted_must_root_lint")]
unrooted_must_root::register(lint_store);
#[cfg(feature = "trace_in_no_trace_lint")]