Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #124527

Merged
merged 18 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a0a8442
Remove direct dependencies on lazy_static, once_cell and byteorder
GKFX Apr 28, 2024
ca79086
Fix #124478 - offset_of! returns a temporary
GKFX Apr 28, 2024
2348eb2
Update mir-opt tests, add proper regression test
GKFX Apr 28, 2024
8aa3c59
Move rustfmt changes out
GKFX Apr 28, 2024
254a9fb
Prohibit const prop of unions in `KnownPanicsLint`
gurry Apr 29, 2024
a25a11a
coverage: Avoid hard-coded values when visiting logical ops
Zalathar Apr 29, 2024
c8ff8a4
Pretty-print parenthesis around binary in postfix match
scrabsha Apr 22, 2024
d31b7db
[Refactor] Rename Lint and LintGroup\'s is_loaded to is_externally_lo…
blyxyas Apr 29, 2024
5776aec
Make names more accurate
compiler-errors Apr 26, 2024
7cf1c54
Actually use probes when needed and stop relying on existing outer pr…
compiler-errors Apr 26, 2024
2eb7c81
Only register candidate if it is associated w a shallow certainty
compiler-errors Apr 28, 2024
f1c53da
Rollup merge of #124269 - scrabsha:sasha/fix-124206, r=dtolnay
jieyouxu Apr 29, 2024
4355749
Rollup merge of #124415 - compiler-errors:candidates, r=lcnr
jieyouxu Apr 29, 2024
3151ad5
Rollup merge of #124475 - GKFX:more-dependency-pruning, r=oli-obk
jieyouxu Apr 29, 2024
0580588
Rollup merge of #124484 - GKFX:offset_of_must_use, r=jieyouxu
jieyouxu Apr 29, 2024
43265f5
Rollup merge of #124504 - gurry:123710-union-ICE, r=oli-obk
jieyouxu Apr 29, 2024
0797adb
Rollup merge of #124508 - Zalathar:op, r=jieyouxu
jieyouxu Apr 29, 2024
ebce31a
Rollup merge of #124522 - blyxyas:refactor-is-loaded, r=jieyouxu
jieyouxu Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Refactor] Rename Lint and LintGroup\'s is_loaded to is_externally_lo…
…aded
  • Loading branch information
blyxyas committed Apr 29, 2024
commit d31b7db8e46857853cc722de0158e73e16b09ed9
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ Available lint options:

let lint_store = unerased_lint_store(sess);
let (loaded, builtin): (Vec<_>, _) =
lint_store.get_lints().iter().cloned().partition(|&lint| lint.is_loaded);
lint_store.get_lints().iter().cloned().partition(|&lint| lint.is_externally_loaded);
let loaded = sort_lints(sess, loaded);
let builtin = sort_lints(sess, builtin);

Expand Down
18 changes: 10 additions & 8 deletions compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct LintAlias {

struct LintGroup {
lint_ids: Vec<LintId>,
is_loaded: bool,
is_externally_loaded: bool,
depr: Option<LintAlias>,
}

Expand Down Expand Up @@ -159,7 +159,9 @@ impl LintStore {
// Don't display deprecated lint groups.
depr.is_none()
})
.map(|(k, LintGroup { lint_ids, is_loaded, .. })| (*k, lint_ids.clone(), *is_loaded))
.map(|(k, LintGroup { lint_ids, is_externally_loaded, .. })| {
(*k, lint_ids.clone(), *is_externally_loaded)
})
}

pub fn register_early_pass(
Expand Down Expand Up @@ -218,7 +220,7 @@ impl LintStore {
.entry(edition.lint_name())
.or_insert(LintGroup {
lint_ids: vec![],
is_loaded: lint.is_loaded,
is_externally_loaded: lint.is_externally_loaded,
depr: None,
})
.lint_ids
Expand All @@ -231,7 +233,7 @@ impl LintStore {
.entry("future_incompatible")
.or_insert(LintGroup {
lint_ids: vec![],
is_loaded: lint.is_loaded,
is_externally_loaded: lint.is_externally_loaded,
depr: None,
})
.lint_ids
Expand All @@ -246,29 +248,29 @@ impl LintStore {
alias,
LintGroup {
lint_ids: vec![],
is_loaded: false,
is_externally_loaded: false,
depr: Some(LintAlias { name: lint_name, silent: true }),
},
);
}

pub fn register_group(
&mut self,
is_loaded: bool,
is_externally_loaded: bool,
name: &'static str,
deprecated_name: Option<&'static str>,
to: Vec<LintId>,
) {
let new = self
.lint_groups
.insert(name, LintGroup { lint_ids: to, is_loaded, depr: None })
.insert(name, LintGroup { lint_ids: to, is_externally_loaded, depr: None })
.is_none();
if let Some(deprecated) = deprecated_name {
self.lint_groups.insert(
deprecated,
LintGroup {
lint_ids: vec![],
is_loaded,
is_externally_loaded,
depr: Some(LintAlias { name, silent: false }),
},
);
Expand Down
9 changes: 5 additions & 4 deletions compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ pub struct Lint {

pub future_incompatible: Option<FutureIncompatibleInfo>,

pub is_loaded: bool,
/// `true` if this lint is being loaded by another tool (e.g. Clippy).
pub is_externally_loaded: bool,

/// `Some` if this lint is feature gated, otherwise `None`.
pub feature_gate: Option<Symbol>,
Expand Down Expand Up @@ -468,7 +469,7 @@ impl Lint {
default_level: Level::Forbid,
desc: "",
edition_lint_opts: None,
is_loaded: false,
is_externally_loaded: false,
report_in_external_macro: false,
future_incompatible: None,
feature_gate: None,
Expand Down Expand Up @@ -817,7 +818,7 @@ macro_rules! declare_lint {
name: stringify!($NAME),
default_level: $crate::$Level,
desc: $desc,
is_loaded: false,
is_externally_loaded: false,
$($v: true,)*
$(feature_gate: Some($gate),)?
$(future_incompatible: Some($crate::FutureIncompatibleInfo {
Expand Down Expand Up @@ -859,7 +860,7 @@ macro_rules! declare_tool_lint {
edition_lint_opts: None,
report_in_external_macro: $external,
future_incompatible: None,
is_loaded: true,
is_externally_loaded: true,
$(feature_gate: Some($gate),)?
crate_level_only: false,
..$crate::Lint::default_fields_for_macro()
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/statics/nested_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ pub struct Lint {
pub name: &'static str,
pub desc: &'static str,
pub report_in_external_macro: bool,
pub is_loaded: bool,
pub is_externally_loaded: bool,
pub crate_level_only: bool,
}

static FOO: &Lint = &Lint {
name: &"foo",
desc: "desc",
report_in_external_macro: false,
is_loaded: true,
is_externally_loaded: true,
crate_level_only: false,
};

Expand Down
Loading