Skip to content

Commit

Permalink
Auto merge of rust-lang#127217 - xFrednet:120924-expect-perf-implicat…
Browse files Browse the repository at this point in the history
…ions, r=<try>

[Benchmark]: lint expectations

rust-lang#120924 stabilized the `lint_reasons` feature. This resulted in some performance regressions.

This PR tries to benchmark these changes and see where they come from. It can be safely ignored :D
  • Loading branch information
bors committed Jul 1, 2024
2 parents 221e274 + d649b6b commit 9aaf02b
Show file tree
Hide file tree
Showing 65 changed files with 70 additions and 1 deletion.
3 changes: 3 additions & 0 deletions compiler/rustc_lint/src/expect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { check_expectations, ..*providers };
}

#[allow(unused)]
fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
return;

let lint_expectations = tcx.lint_expectations(());
let fulfilled_expectations = tcx.dcx().steal_fulfilled_expectation_ids();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
mod a;

mod b;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//! Tests macro_metavars_in_unsafe with default configuration
#![feature(decl_macro)]
#![warn(clippy::macro_metavars_in_unsafe)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@aux-build:../../ui/auxiliary/proc_macro_unsafe.rs
//@revisions: default disabled
//@[default] rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/undocumented_unsafe_blocks/default
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/allow_attributes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@aux-build:proc_macros.rs
#![allow(unused)]
#![warn(clippy::allow_attributes)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@aux-build:proc_macros.rs
#![deny(clippy::allow_attributes_without_reason)]
#![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)]
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/async_yields_async.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![feature(async_closure)]
#![warn(clippy::async_yields_async)]
#![allow(clippy::redundant_async_block)]
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/boxed_local.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![allow(
clippy::borrowed_box,
clippy::needless_pass_by_value,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@no-rustfix: overlapping suggestions
#![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
#![allow(
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/default_numeric_fallback_i32.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@aux-build:proc_macros.rs

#![warn(clippy::default_numeric_fallback)]
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/derive_partial_eq_without_eq.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![allow(unused)]
#![warn(clippy::derive_partial_eq_without_eq)]

Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/tests/ui/expect_tool_lint_rfc_2383.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@only-16bit

//! This file tests the `#[expect]` attribute implementation for tool lints. The same
//! file is used to test clippy and rustdoc. Any changes to this file should be synced
//! to the other test files as well.
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/implicit_return.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@aux-build: proc_macros.rs

#![warn(clippy::implicit_return)]
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/let_unit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![warn(clippy::let_unit_value)]
#![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)]

Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/macro_use_imports_expect.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@only-16bit
//@aux-build:macro_rules.rs
//@aux-build:macro_use_helper.rs
//@aux-build:proc_macro_derive.rs
//@ignore-32bit

#![allow(unused_imports, unreachable_code, unused_variables, dead_code, unused_attributes)]
#![allow(clippy::single_component_path_imports)]
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/manual_non_exhaustive_enum.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![warn(clippy::manual_non_exhaustive)]
#![allow(unused)]
//@no-rustfix
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/needless_borrow.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![allow(
unused,
non_local_definitions,
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/needless_pass_by_ref_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
clippy::ptr_arg
)]
#![warn(clippy::needless_pass_by_ref_mut)]
//@only-16bit
//@no-rustfix
use std::ptr::NonNull;

Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/tests/ui/needless_return.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@only-16bit

#![feature(yeet_expr)]
#![allow(unused)]
#![allow(
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/nonminimal_bool.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@no-rustfix: overlapping suggestions
#![allow(
unused,
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/overly_complex_bool_expr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![allow(unused, clippy::diverging_sub_expression)]
#![warn(clippy::overly_complex_bool_expr)]

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/ptr_arg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![allow(
unused,
clippy::many_single_char_names,
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/redundant_clone.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
// rustfix-only-machine-applicable
#![warn(clippy::redundant_clone)]
#![allow(
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/ref_binding_to_reference.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// FIXME: run-rustfix waiting on multi-span suggestions
//@no-rustfix
//@only-16bit
#![warn(clippy::ref_binding_to_reference)]
#![allow(clippy::needless_borrowed_reference, clippy::explicit_auto_deref)]

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/same_name_method.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![warn(clippy::same_name_method)]
#![allow(dead_code, non_camel_case_types)]

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/unsafe_derive_deserialize.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
#![warn(clippy::unsafe_derive_deserialize)]
#![allow(unused, clippy::missing_safety_doc)]

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui/used_underscore_binding.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@aux-build:proc_macro_derive.rs
#![feature(rustc_private)]
#![warn(clippy::used_underscore_binding)]
Expand Down
1 change: 1 addition & 0 deletions tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

//! This file tests the `#[expect]` attribute implementation for tool lints. The same
//! file is used to test clippy and rustdoc. Any changes to this file should be synced
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ check-pass
//@ edition: 2021
//@only-16bit

use std::future::Future;
use std::pin::Pin;
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/cfg/diagnostics-not-a-def.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@only-16bit

pub mod inner {
#[expect(unexpected_cfgs)]
pub fn i_am_here() {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
use std::ops::Deref;

pub trait Foo {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/deep-match-works.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

pub struct Wrapper<T>(T);

Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/foreign.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ check-pass
//@ aux-build: rpitit.rs
//@only-16bit

extern crate rpitit;

Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/nested-rpitit.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

use std::fmt::Display;
use std::ops::Deref;
Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/reveal.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

pub trait Foo {
fn f() -> Box<impl Sized>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
// issue: 113903

use std::ops::Deref;
Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/signature-mismatch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ edition:2021
//@ revisions: success failure
//@[success] check-pass
//@only-16bit

use std::future::Future;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

#![feature(specialization)]
#![allow(incomplete_features)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/impl-trait/in-trait/success.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

use std::fmt::Display;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@ check-pass

// this test checks that the `dead_code` lint is *NOT* being emited
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

// this test makes sure that the `unfulfilled_lint_expectations` lint
// is being emited for `foo` as foo is not dead code, it's pub
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@ check-pass
//@ revisions: allow expect

Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/expect-future_breakage-crash-issue-126521.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

// This test covers similar crashes from both #126521 and #126751.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

#[expect(drop_bounds)]
fn trigger_rustc_lints<T: Drop>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

#![warn(unused)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/rfc-2383-lint-reason/expect_inside_macro.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

#![warn(unused)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

#![warn(unused_variables)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

#![warn(unused)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore-tidy-linelength
//@only-16bit

#![warn(unused_mut)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

#[warn(unused_variables)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

//! This file tests the `#[expect]` attribute implementation for tool lints. The same
//! file is used to test clippy and rustdoc. Any changes to this file should be synced
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit
// ignore-tidy-linelength

#![warn(unused_mut)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ check-pass
//@ incremental
//@only-16bit

#![warn(unused)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ compile-flags: -Zdeduplicate-diagnostics=yes
//@only-16bit

#[forbid(unused_variables)]
//~^ NOTE `forbid` level set here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@ compile-flags: --force-warn unused_variables
//@ compile-flags: --force-warn unused_mut
//@ check-pass
//@only-16bit

fn expect_early_pass_lint() {
#[expect(while_true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@ compile-flags: --force-warn unused_variables
//@ compile-flags: --force-warn unused_mut
//@ check-pass
//@only-16bit

fn expect_early_pass_lint(terminate: bool) {
#[expect(while_true)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

fn expect_early_pass_lints() {
#[expect(while_true)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

#![warn(unused)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
//@only-16bit

#![warn(unused)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This ensures that ICEs like rust#94953 don't happen
//@ check-pass
//@ compile-flags: -Z unpretty=expanded
//@only-16bit

// This `expect` will create an expectation with an unstable expectation id
#[expect(while_true)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/proc-macro/allowed-attr-stmt-expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@ aux-build:test-macros.rs
//@ compile-flags: -Z span-debug
//@ check-pass
//@only-16bit

#![feature(proc_macro_hygiene)]
#![feature(stmt_expr_attributes)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/proc-macro/attr-stmt-expr-rpass.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ run-pass
//@only-16bit
//@ aux-build:attr-stmt-expr-rpass.rs

#![feature(stmt_expr_attributes, proc_macro_hygiene)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/proc-macro/attr-stmt-expr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ aux-build:attr-stmt-expr.rs
//@ aux-build:test-macros.rs
//@ compile-flags: -Z span-debug
//@only-16bit

#![feature(proc_macro_hygiene)]
#![feature(rustc_attrs)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/sse2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@only-16bit
//@ run-pass

#![allow(stable_features)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/target-feature/no-llvm-leaks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//@ [x86-64] compile-flags: -Ctarget-feature=+sse4.2,+rdrand --target=x86_64-unknown-linux-gnu
//@ [x86-64] needs-llvm-components: x86
//@ build-pass
//@only-16bit
#![no_core]
#![crate_type = "rlib"]
#![feature(intrinsics, rustc_attrs, no_core, lang_items, staged_api)]
Expand Down

0 comments on commit 9aaf02b

Please sign in to comment.