summaryrefslogtreecommitdiffstats
path: root/tests/ui-fulldeps/internal-lints
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui-fulldeps/internal-lints
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui-fulldeps/internal-lints')
-rw-r--r--tests/ui-fulldeps/internal-lints/bad_opt_access.rs22
-rw-r--r--tests/ui-fulldeps/internal-lints/bad_opt_access.stderr20
-rw-r--r--tests/ui-fulldeps/internal-lints/default_hash_types.rs29
-rw-r--r--tests/ui-fulldeps/internal-lints/default_hash_types.stderr39
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics.rs89
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics.stderr44
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics_incorrect.rs15
-rw-r--r--tests/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr17
-rw-r--r--tests/ui-fulldeps/internal-lints/existing_doc_keyword.rs11
-rw-r--r--tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr15
-rw-r--r--tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs46
-rw-r--r--tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr27
-rw-r--r--tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs35
-rw-r--r--tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr20
-rw-r--r--tests/ui-fulldeps/internal-lints/query_stability.rs24
-rw-r--r--tests/ui-fulldeps/internal-lints/query_stability.stderr39
-rw-r--r--tests/ui-fulldeps/internal-lints/query_stability_incorrect.rs15
-rw-r--r--tests/ui-fulldeps/internal-lints/query_stability_incorrect.stderr17
-rw-r--r--tests/ui-fulldeps/internal-lints/rustc_pass_by_value.rs118
-rw-r--r--tests/ui-fulldeps/internal-lints/rustc_pass_by_value.stderr128
-rw-r--r--tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.rs54
-rw-r--r--tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.stderr38
-rw-r--r--tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs55
-rw-r--r--tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr208
24 files changed, 1125 insertions, 0 deletions
diff --git a/tests/ui-fulldeps/internal-lints/bad_opt_access.rs b/tests/ui-fulldeps/internal-lints/bad_opt_access.rs
new file mode 100644
index 000000000..d6bd6945e
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/bad_opt_access.rs
@@ -0,0 +1,22 @@
+// compile-flags: -Z unstable-options
+
+// Test that accessing command line options by field access triggers a lint for those fields
+// that have wrapper functions which should be used.
+
+#![crate_type = "lib"]
+#![feature(rustc_private)]
+#![deny(rustc::bad_opt_access)]
+
+extern crate rustc_session;
+use rustc_session::Session;
+
+pub fn access_bad_option(sess: Session) {
+ let _ = sess.opts.cg.split_debuginfo;
+ //~^ ERROR use `Session::split_debuginfo` instead of this field
+
+ let _ = sess.opts.crate_types;
+ //~^ ERROR use `Session::crate_types` instead of this field
+
+ let _ = sess.opts.crate_name;
+ // okay!
+}
diff --git a/tests/ui-fulldeps/internal-lints/bad_opt_access.stderr b/tests/ui-fulldeps/internal-lints/bad_opt_access.stderr
new file mode 100644
index 000000000..e4145bff8
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/bad_opt_access.stderr
@@ -0,0 +1,20 @@
+error: use `Session::split_debuginfo` instead of this field
+ --> $DIR/bad_opt_access.rs:14:13
+ |
+LL | let _ = sess.opts.cg.split_debuginfo;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/bad_opt_access.rs:8:9
+ |
+LL | #![deny(rustc::bad_opt_access)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use `Session::crate_types` instead of this field
+ --> $DIR/bad_opt_access.rs:17:13
+ |
+LL | let _ = sess.opts.crate_types;
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/default_hash_types.rs b/tests/ui-fulldeps/internal-lints/default_hash_types.rs
new file mode 100644
index 000000000..795c7d2dc
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/default_hash_types.rs
@@ -0,0 +1,29 @@
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_private)]
+#![deny(rustc::default_hash_types)]
+
+extern crate rustc_data_structures;
+
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
+use std::collections::{HashMap, HashSet};
+
+mod foo {
+ pub struct HashMap;
+}
+
+fn main() {
+ let _map: HashMap<String, String> = HashMap::default();
+ //~^ ERROR prefer `FxHashMap` over `HashMap`, it has better performance
+ //~^^ ERROR prefer `FxHashMap` over `HashMap`, it has better performance
+ let _set: HashSet<String> = HashSet::default();
+ //~^ ERROR prefer `FxHashSet` over `HashSet`, it has better performance
+ //~^^ ERROR prefer `FxHashSet` over `HashSet`, it has better performance
+
+ // test that the lint doesn't also match the Fx variants themselves
+ let _fx_map: FxHashMap<String, String> = FxHashMap::default();
+ let _fx_set: FxHashSet<String> = FxHashSet::default();
+
+ // test another struct of the same name
+ let _ = foo::HashMap;
+}
diff --git a/tests/ui-fulldeps/internal-lints/default_hash_types.stderr b/tests/ui-fulldeps/internal-lints/default_hash_types.stderr
new file mode 100644
index 000000000..3cb13082f
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/default_hash_types.stderr
@@ -0,0 +1,39 @@
+error: prefer `FxHashMap` over `HashMap`, it has better performance
+ --> $DIR/default_hash_types.rs:16:41
+ |
+LL | let _map: HashMap<String, String> = HashMap::default();
+ | ^^^^^^^
+ |
+ = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary
+note: the lint level is defined here
+ --> $DIR/default_hash_types.rs:4:9
+ |
+LL | #![deny(rustc::default_hash_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: prefer `FxHashMap` over `HashMap`, it has better performance
+ --> $DIR/default_hash_types.rs:16:15
+ |
+LL | let _map: HashMap<String, String> = HashMap::default();
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary
+
+error: prefer `FxHashSet` over `HashSet`, it has better performance
+ --> $DIR/default_hash_types.rs:19:33
+ |
+LL | let _set: HashSet<String> = HashSet::default();
+ | ^^^^^^^
+ |
+ = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary
+
+error: prefer `FxHashSet` over `HashSet`, it has better performance
+ --> $DIR/default_hash_types.rs:19:15
+ |
+LL | let _set: HashSet<String> = HashSet::default();
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs
new file mode 100644
index 000000000..643e81d99
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs
@@ -0,0 +1,89 @@
+// compile-flags: -Z unstable-options
+
+#![crate_type = "lib"]
+#![feature(rustc_attrs)]
+#![feature(rustc_private)]
+#![deny(rustc::untranslatable_diagnostic)]
+#![deny(rustc::diagnostic_outside_of_impl)]
+
+extern crate rustc_errors;
+extern crate rustc_macros;
+extern crate rustc_session;
+extern crate rustc_span;
+
+use rustc_errors::{
+ AddToDiagnostic, IntoDiagnostic, Diagnostic, DiagnosticBuilder,
+ ErrorGuaranteed, Handler, fluent, SubdiagnosticMessage,
+};
+use rustc_macros::{Diagnostic, Subdiagnostic};
+use rustc_span::Span;
+
+#[derive(Diagnostic)]
+#[diag(compiletest_example)]
+struct DeriveDiagnostic {
+ #[primary_span]
+ span: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[note(compiletest_example)]
+struct Note {
+ #[primary_span]
+ span: Span,
+}
+
+pub struct UntranslatableInIntoDiagnostic;
+
+impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for UntranslatableInIntoDiagnostic {
+ fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
+ handler.struct_err("untranslatable diagnostic")
+ //~^ ERROR diagnostics should be created using translatable messages
+ }
+}
+
+pub struct TranslatableInIntoDiagnostic;
+
+impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for TranslatableInIntoDiagnostic {
+ fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
+ handler.struct_err(fluent::compiletest_example)
+ }
+}
+
+pub struct UntranslatableInAddToDiagnostic;
+
+impl AddToDiagnostic for UntranslatableInAddToDiagnostic {
+ fn add_to_diagnostic_with<F>(self, diag: &mut Diagnostic, _: F)
+ where
+ F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
+ {
+ diag.note("untranslatable diagnostic");
+ //~^ ERROR diagnostics should be created using translatable messages
+ }
+}
+
+pub struct TranslatableInAddToDiagnostic;
+
+impl AddToDiagnostic for TranslatableInAddToDiagnostic {
+ fn add_to_diagnostic_with<F>(self, diag: &mut Diagnostic, _: F)
+ where
+ F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
+ {
+ diag.note(fluent::note);
+ }
+}
+
+pub fn make_diagnostics<'a>(handler: &'a Handler) {
+ let _diag = handler.struct_err(fluent::compiletest_example);
+ //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
+
+ let _diag = handler.struct_err("untranslatable diagnostic");
+ //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
+ //~^^ ERROR diagnostics should be created using translatable messages
+}
+
+// Check that `rustc_lint_diagnostics`-annotated functions aren't themselves linted.
+
+#[rustc_lint_diagnostics]
+pub fn skipped_because_of_annotation<'a>(handler: &'a Handler) {
+ let _diag = handler.struct_err("untranslatable diagnostic"); // okay!
+}
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.stderr b/tests/ui-fulldeps/internal-lints/diagnostics.stderr
new file mode 100644
index 000000000..510d6a171
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/diagnostics.stderr
@@ -0,0 +1,44 @@
+error: diagnostics should be created using translatable messages
+ --> $DIR/diagnostics.rs:39:17
+ |
+LL | handler.struct_err("untranslatable diagnostic")
+ | ^^^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/diagnostics.rs:6:9
+ |
+LL | #![deny(rustc::untranslatable_diagnostic)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: diagnostics should be created using translatable messages
+ --> $DIR/diagnostics.rs:59:14
+ |
+LL | diag.note("untranslatable diagnostic");
+ | ^^^^
+
+error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
+ --> $DIR/diagnostics.rs:76:25
+ |
+LL | let _diag = handler.struct_err(fluent::compiletest_example);
+ | ^^^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/diagnostics.rs:7:9
+ |
+LL | #![deny(rustc::diagnostic_outside_of_impl)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
+ --> $DIR/diagnostics.rs:79:25
+ |
+LL | let _diag = handler.struct_err("untranslatable diagnostic");
+ | ^^^^^^^^^^
+
+error: diagnostics should be created using translatable messages
+ --> $DIR/diagnostics.rs:79:25
+ |
+LL | let _diag = handler.struct_err("untranslatable diagnostic");
+ | ^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.rs b/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.rs
new file mode 100644
index 000000000..99f99ffcd
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.rs
@@ -0,0 +1,15 @@
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_attrs)]
+
+#[rustc_lint_diagnostics]
+//~^ ERROR attribute should be applied to a function
+struct Foo;
+
+impl Foo {
+ #[rustc_lint_diagnostics(a)]
+ //~^ ERROR malformed `rustc_lint_diagnostics`
+ fn bar() {}
+}
+
+fn main() {}
diff --git a/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr b/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr
new file mode 100644
index 000000000..e849ca282
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/diagnostics_incorrect.stderr
@@ -0,0 +1,17 @@
+error: malformed `rustc_lint_diagnostics` attribute input
+ --> $DIR/diagnostics_incorrect.rs:10:5
+ |
+LL | #[rustc_lint_diagnostics(a)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_diagnostics]`
+
+error: attribute should be applied to a function definition
+ --> $DIR/diagnostics_incorrect.rs:5:1
+ |
+LL | #[rustc_lint_diagnostics]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | struct Foo;
+ | ----------- not a function definition
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/existing_doc_keyword.rs b/tests/ui-fulldeps/internal-lints/existing_doc_keyword.rs
new file mode 100644
index 000000000..7783dc40f
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/existing_doc_keyword.rs
@@ -0,0 +1,11 @@
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_private)]
+#![feature(rustdoc_internals)]
+
+#![crate_type = "lib"]
+
+#![deny(rustc::existing_doc_keyword)]
+
+#[doc(keyword = "tadam")] //~ ERROR
+mod tadam {}
diff --git a/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr b/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr
new file mode 100644
index 000000000..4e296fff6
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/existing_doc_keyword.stderr
@@ -0,0 +1,15 @@
+error: found non-existing keyword `tadam` used in `#[doc(keyword = \"...\")]`
+ --> $DIR/existing_doc_keyword.rs:10:1
+ |
+LL | #[doc(keyword = "tadam")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: only existing keywords are allowed in core/std
+note: the lint level is defined here
+ --> $DIR/existing_doc_keyword.rs:8:9
+ |
+LL | #![deny(rustc::existing_doc_keyword)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs
new file mode 100644
index 000000000..f6f0c0385
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs
@@ -0,0 +1,46 @@
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_private)]
+#![deny(rustc::lint_pass_impl_without_macro)]
+
+extern crate rustc_middle;
+extern crate rustc_session;
+
+use rustc_session::lint::{LintArray, LintPass};
+use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
+
+declare_lint! {
+ pub TEST_LINT,
+ Allow,
+ "test"
+}
+
+struct Foo;
+
+impl LintPass for Foo { //~ERROR implementing `LintPass` by hand
+ fn name(&self) -> &'static str {
+ "Foo"
+ }
+}
+
+macro_rules! custom_lint_pass_macro {
+ () => {
+ struct Custom;
+
+ impl LintPass for Custom { //~ERROR implementing `LintPass` by hand
+ fn name(&self) -> &'static str {
+ "Custom"
+ }
+ }
+ };
+}
+
+custom_lint_pass_macro!();
+
+struct Bar;
+
+impl_lint_pass!(Bar => [TEST_LINT]);
+
+declare_lint_pass!(Baz => [TEST_LINT]);
+
+fn main() {}
diff --git a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr
new file mode 100644
index 000000000..ad6e93334
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr
@@ -0,0 +1,27 @@
+error: implementing `LintPass` by hand
+ --> $DIR/lint_pass_impl_without_macro.rs:20:6
+ |
+LL | impl LintPass for Foo {
+ | ^^^^^^^^
+ |
+ = help: try using `declare_lint_pass!` or `impl_lint_pass!` instead
+note: the lint level is defined here
+ --> $DIR/lint_pass_impl_without_macro.rs:4:9
+ |
+LL | #![deny(rustc::lint_pass_impl_without_macro)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: implementing `LintPass` by hand
+ --> $DIR/lint_pass_impl_without_macro.rs:30:14
+ |
+LL | impl LintPass for Custom {
+ | ^^^^^^^^
+...
+LL | custom_lint_pass_macro!();
+ | ------------------------- in this macro invocation
+ |
+ = help: try using `declare_lint_pass!` or `impl_lint_pass!` instead
+ = note: this error originates in the macro `custom_lint_pass_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs b/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs
new file mode 100644
index 000000000..32b987338
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs
@@ -0,0 +1,35 @@
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_private)]
+#![deny(rustc::usage_of_qualified_ty)]
+#![allow(unused)]
+
+extern crate rustc_middle;
+
+use rustc_middle::ty::{self, Ty, TyCtxt};
+
+macro_rules! qualified_macro {
+ ($a:ident) => {
+ fn ty_in_macro(
+ ty_q: ty::Ty<'_>,
+ ty: Ty<'_>,
+ ty_ctxt_q: ty::TyCtxt<'_>,
+ ty_ctxt: TyCtxt<'_>,
+ ) {
+ println!("{}", stringify!($a));
+ }
+ };
+}
+
+fn ty_qualified(
+ ty_q: ty::Ty<'_>, //~ ERROR usage of qualified `ty::Ty<'_>`
+ ty: Ty<'_>,
+ ty_ctxt_q: ty::TyCtxt<'_>, //~ ERROR usage of qualified `ty::TyCtxt<'_>`
+ ty_ctxt: TyCtxt<'_>,
+) {
+}
+
+
+fn main() {
+ qualified_macro!(a);
+}
diff --git a/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr b/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr
new file mode 100644
index 000000000..a1056cf85
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr
@@ -0,0 +1,20 @@
+error: usage of qualified `ty::Ty<'_>`
+ --> $DIR/qualified_ty_ty_ctxt.rs:25:11
+ |
+LL | ty_q: ty::Ty<'_>,
+ | ^^^^^^^^^^ help: try importing it and using it unqualified: `Ty<'_>`
+ |
+note: the lint level is defined here
+ --> $DIR/qualified_ty_ty_ctxt.rs:4:9
+ |
+LL | #![deny(rustc::usage_of_qualified_ty)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: usage of qualified `ty::TyCtxt<'_>`
+ --> $DIR/qualified_ty_ty_ctxt.rs:27:16
+ |
+LL | ty_ctxt_q: ty::TyCtxt<'_>,
+ | ^^^^^^^^^^^^^^ help: try importing it and using it unqualified: `TyCtxt<'_>`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/query_stability.rs b/tests/ui-fulldeps/internal-lints/query_stability.rs
new file mode 100644
index 000000000..560675b44
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/query_stability.rs
@@ -0,0 +1,24 @@
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_private)]
+#![deny(rustc::potential_query_instability)]
+
+extern crate rustc_data_structures;
+
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
+
+fn main() {
+ let mut x = FxHashMap::<u32, i32>::default();
+
+ for _ in x.drain() {}
+ //~^ ERROR using `drain` can result in unstable
+
+ for _ in x.iter() {}
+ //~^ ERROR using `iter`
+
+ for _ in Some(&mut x).unwrap().iter_mut() {}
+ //~^ ERROR using `iter_mut`
+
+ for _ in x {}
+ //~^ ERROR using `into_iter`
+}
diff --git a/tests/ui-fulldeps/internal-lints/query_stability.stderr b/tests/ui-fulldeps/internal-lints/query_stability.stderr
new file mode 100644
index 000000000..ee4ef9982
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/query_stability.stderr
@@ -0,0 +1,39 @@
+error: using `drain` can result in unstable query results
+ --> $DIR/query_stability.rs:13:16
+ |
+LL | for _ in x.drain() {}
+ | ^^^^^
+ |
+ = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
+note: the lint level is defined here
+ --> $DIR/query_stability.rs:4:9
+ |
+LL | #![deny(rustc::potential_query_instability)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: using `iter` can result in unstable query results
+ --> $DIR/query_stability.rs:16:16
+ |
+LL | for _ in x.iter() {}
+ | ^^^^
+ |
+ = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
+
+error: using `iter_mut` can result in unstable query results
+ --> $DIR/query_stability.rs:19:36
+ |
+LL | for _ in Some(&mut x).unwrap().iter_mut() {}
+ | ^^^^^^^^
+ |
+ = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
+
+error: using `into_iter` can result in unstable query results
+ --> $DIR/query_stability.rs:22:14
+ |
+LL | for _ in x {}
+ | ^
+ |
+ = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/query_stability_incorrect.rs b/tests/ui-fulldeps/internal-lints/query_stability_incorrect.rs
new file mode 100644
index 000000000..f478b7332
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/query_stability_incorrect.rs
@@ -0,0 +1,15 @@
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_attrs)]
+
+#[rustc_lint_query_instability]
+//~^ ERROR attribute should be applied to a function
+struct Foo;
+
+impl Foo {
+ #[rustc_lint_query_instability(a)]
+ //~^ ERROR malformed `rustc_lint_query_instability`
+ fn bar() {}
+}
+
+fn main() {}
diff --git a/tests/ui-fulldeps/internal-lints/query_stability_incorrect.stderr b/tests/ui-fulldeps/internal-lints/query_stability_incorrect.stderr
new file mode 100644
index 000000000..3f78b39ed
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/query_stability_incorrect.stderr
@@ -0,0 +1,17 @@
+error: malformed `rustc_lint_query_instability` attribute input
+ --> $DIR/query_stability_incorrect.rs:10:5
+ |
+LL | #[rustc_lint_query_instability(a)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_query_instability]`
+
+error: attribute should be applied to a function definition
+ --> $DIR/query_stability_incorrect.rs:5:1
+ |
+LL | #[rustc_lint_query_instability]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | struct Foo;
+ | ----------- not a function definition
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.rs b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.rs
new file mode 100644
index 000000000..10bab2d88
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.rs
@@ -0,0 +1,118 @@
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_attrs)]
+#![feature(rustc_private)]
+#![deny(rustc::pass_by_value)]
+#![allow(unused)]
+
+extern crate rustc_middle;
+
+use rustc_middle::ty::{Ty, TyCtxt};
+
+fn ty_by_ref(
+ ty_val: Ty<'_>,
+ ty_ref: &Ty<'_>, //~ ERROR passing `Ty<'_>` by reference
+ ty_ctxt_val: TyCtxt<'_>,
+ ty_ctxt_ref: &TyCtxt<'_>, //~ ERROR passing `TyCtxt<'_>` by reference
+) {
+}
+
+fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {}
+//~^ ERROR passing `Ty<'_>` by reference
+//~^^ ERROR passing `TyCtxt<'_>` by reference
+
+trait T {
+ fn ty_by_ref_in_trait(
+ ty_val: Ty<'_>,
+ ty_ref: &Ty<'_>, //~ ERROR passing `Ty<'_>` by reference
+ ty_ctxt_val: TyCtxt<'_>,
+ ty_ctxt_ref: &TyCtxt<'_>, //~ ERROR passing `TyCtxt<'_>` by reference
+ );
+
+ fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>);
+ //~^ ERROR passing `Ty<'_>` by reference
+ //~^^ ERROR passing `TyCtxt<'_>` by reference
+}
+
+struct Foo;
+
+impl T for Foo {
+ fn ty_by_ref_in_trait(
+ ty_val: Ty<'_>,
+ ty_ref: &Ty<'_>,
+ ty_ctxt_val: TyCtxt<'_>,
+ ty_ctxt_ref: &TyCtxt<'_>,
+ ) {
+ }
+
+ fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {}
+}
+
+impl Foo {
+ fn ty_by_ref_assoc(
+ ty_val: Ty<'_>,
+ ty_ref: &Ty<'_>, //~ ERROR passing `Ty<'_>` by reference
+ ty_ctxt_val: TyCtxt<'_>,
+ ty_ctxt_ref: &TyCtxt<'_>, //~ ERROR passing `TyCtxt<'_>` by reference
+ ) {
+ }
+
+ fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {}
+ //~^ ERROR passing `Ty<'_>` by reference
+ //~^^ ERROR passing `TyCtxt<'_>` by reference
+}
+
+#[rustc_pass_by_value]
+enum CustomEnum {
+ A,
+ B,
+}
+
+impl CustomEnum {
+ fn test(
+ value: CustomEnum,
+ reference: &CustomEnum, //~ ERROR passing `CustomEnum` by reference
+ ) {
+ }
+}
+
+#[rustc_pass_by_value]
+struct CustomStruct {
+ s: u8,
+}
+
+#[rustc_pass_by_value]
+type CustomAlias<'a> = &'a CustomStruct; //~ ERROR passing `CustomStruct` by reference
+
+impl CustomStruct {
+ fn test(
+ value: CustomStruct,
+ reference: &CustomStruct, //~ ERROR passing `CustomStruct` by reference
+ ) {
+ }
+
+ fn test_alias(
+ value: CustomAlias,
+ reference: &CustomAlias, //~ ERROR passing `CustomAlias<'_>` by reference
+ ) {
+ }
+}
+
+#[rustc_pass_by_value]
+struct WithParameters<T, const N: usize, M = u32> {
+ slice: [T; N],
+ m: M,
+}
+
+impl<T> WithParameters<T, 1> {
+ fn test<'a>(
+ value: WithParameters<T, 1>,
+ reference: &'a WithParameters<T, 1>, //~ ERROR passing `WithParameters<T, 1>` by reference
+ reference_with_m: &WithParameters<T, 1, u32>, //~ ERROR passing `WithParameters<T, 1, u32>` by reference
+ ) -> &'a WithParameters<T, 1> {
+ //~^ ERROR passing `WithParameters<T, 1>` by reference
+ reference as &WithParameters<_, 1> //~ ERROR passing `WithParameters<_, 1>` by reference
+ }
+}
+
+fn main() {}
diff --git a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.stderr b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.stderr
new file mode 100644
index 000000000..69cf20656
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value.stderr
@@ -0,0 +1,128 @@
+error: passing `Ty<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:14:13
+ |
+LL | ty_ref: &Ty<'_>,
+ | ^^^^^^^ help: try passing by value: `Ty<'_>`
+ |
+note: the lint level is defined here
+ --> $DIR/rustc_pass_by_value.rs:5:9
+ |
+LL | #![deny(rustc::pass_by_value)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: passing `TyCtxt<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:16:18
+ |
+LL | ty_ctxt_ref: &TyCtxt<'_>,
+ | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>`
+
+error: passing `Ty<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:20:28
+ |
+LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {}
+ | ^^^^^^^ help: try passing by value: `Ty<'_>`
+
+error: passing `TyCtxt<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:20:55
+ |
+LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {}
+ | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>`
+
+error: passing `Ty<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:27:17
+ |
+LL | ty_ref: &Ty<'_>,
+ | ^^^^^^^ help: try passing by value: `Ty<'_>`
+
+error: passing `TyCtxt<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:29:22
+ |
+LL | ty_ctxt_ref: &TyCtxt<'_>,
+ | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>`
+
+error: passing `Ty<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:32:41
+ |
+LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>);
+ | ^^^^^^^ help: try passing by value: `Ty<'_>`
+
+error: passing `TyCtxt<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:32:68
+ |
+LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>);
+ | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>`
+
+error: passing `Ty<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:54:17
+ |
+LL | ty_ref: &Ty<'_>,
+ | ^^^^^^^ help: try passing by value: `Ty<'_>`
+
+error: passing `TyCtxt<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:56:22
+ |
+LL | ty_ctxt_ref: &TyCtxt<'_>,
+ | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>`
+
+error: passing `Ty<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:60:38
+ |
+LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {}
+ | ^^^^^^^ help: try passing by value: `Ty<'_>`
+
+error: passing `TyCtxt<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:60:65
+ |
+LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_>) {}
+ | ^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_>`
+
+error: passing `CustomEnum` by reference
+ --> $DIR/rustc_pass_by_value.rs:74:20
+ |
+LL | reference: &CustomEnum,
+ | ^^^^^^^^^^^ help: try passing by value: `CustomEnum`
+
+error: passing `CustomStruct` by reference
+ --> $DIR/rustc_pass_by_value.rs:85:24
+ |
+LL | type CustomAlias<'a> = &'a CustomStruct;
+ | ^^^^^^^^^^^^^^^^ help: try passing by value: `CustomStruct`
+
+error: passing `CustomStruct` by reference
+ --> $DIR/rustc_pass_by_value.rs:90:20
+ |
+LL | reference: &CustomStruct,
+ | ^^^^^^^^^^^^^ help: try passing by value: `CustomStruct`
+
+error: passing `CustomAlias<'_>` by reference
+ --> $DIR/rustc_pass_by_value.rs:96:20
+ |
+LL | reference: &CustomAlias,
+ | ^^^^^^^^^^^^ help: try passing by value: `CustomAlias<'_>`
+
+error: passing `WithParameters<T, 1>` by reference
+ --> $DIR/rustc_pass_by_value.rs:110:20
+ |
+LL | reference: &'a WithParameters<T, 1>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try passing by value: `WithParameters<T, 1>`
+
+error: passing `WithParameters<T, 1, u32>` by reference
+ --> $DIR/rustc_pass_by_value.rs:111:27
+ |
+LL | reference_with_m: &WithParameters<T, 1, u32>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try passing by value: `WithParameters<T, 1, u32>`
+
+error: passing `WithParameters<T, 1>` by reference
+ --> $DIR/rustc_pass_by_value.rs:112:10
+ |
+LL | ) -> &'a WithParameters<T, 1> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try passing by value: `WithParameters<T, 1>`
+
+error: passing `WithParameters<_, 1>` by reference
+ --> $DIR/rustc_pass_by_value.rs:114:22
+ |
+LL | reference as &WithParameters<_, 1>
+ | ^^^^^^^^^^^^^^^^^^^^^ help: try passing by value: `WithParameters<_, 1>`
+
+error: aborting due to 20 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.rs b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.rs
new file mode 100644
index 000000000..6ce67dcaf
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.rs
@@ -0,0 +1,54 @@
+// compile-flags: -Z unstable-options
+// NOTE: This test doesn't actually require `fulldeps`
+// so we could instead use it as a `ui` test.
+//
+// Considering that all other `internal-lints` are tested here
+// this seems like the cleaner solution though.
+#![feature(rustc_attrs)]
+#![deny(rustc::pass_by_value)]
+#![allow(unused)]
+
+#[rustc_pass_by_value]
+struct TyCtxt<'tcx> {
+ inner: &'tcx (),
+}
+
+impl<'tcx> TyCtxt<'tcx> {
+ fn by_value(self) {} // OK
+ fn by_ref(&self) {} //~ ERROR passing `TyCtxt<'tcx>` by reference
+}
+
+struct TyS<'tcx> {
+ inner: &'tcx (),
+}
+
+#[rustc_pass_by_value]
+type Ty<'tcx> = &'tcx TyS<'tcx>;
+
+impl<'tcx> TyS<'tcx> {
+ fn by_value(self: Ty<'tcx>) {}
+ fn by_ref(self: &Ty<'tcx>) {} //~ ERROR passing `Ty<'tcx>` by reference
+}
+
+#[rustc_pass_by_value]
+struct Foo;
+
+impl Foo {
+ fn with_ref(&self) {} //~ ERROR passing `Foo` by reference
+}
+
+#[rustc_pass_by_value]
+struct WithParameters<T, const N: usize, M = u32> {
+ slice: [T; N],
+ m: M,
+}
+
+impl<T> WithParameters<T, 1> {
+ fn with_ref(&self) {} //~ ERROR passing `WithParameters<T, 1>` by reference
+}
+
+impl<T> WithParameters<T, 1, u8> {
+ fn with_ref(&self) {} //~ ERROR passing `WithParameters<T, 1, u8>` by reference
+}
+
+fn main() {}
diff --git a/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.stderr b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.stderr
new file mode 100644
index 000000000..fb39ed60b
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/rustc_pass_by_value_self.stderr
@@ -0,0 +1,38 @@
+error: passing `TyCtxt<'tcx>` by reference
+ --> $DIR/rustc_pass_by_value_self.rs:18:15
+ |
+LL | fn by_ref(&self) {}
+ | ^^^^^ help: try passing by value: `TyCtxt<'tcx>`
+ |
+note: the lint level is defined here
+ --> $DIR/rustc_pass_by_value_self.rs:8:9
+ |
+LL | #![deny(rustc::pass_by_value)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: passing `Ty<'tcx>` by reference
+ --> $DIR/rustc_pass_by_value_self.rs:30:21
+ |
+LL | fn by_ref(self: &Ty<'tcx>) {}
+ | ^^^^^^^^^ help: try passing by value: `Ty<'tcx>`
+
+error: passing `Foo` by reference
+ --> $DIR/rustc_pass_by_value_self.rs:37:17
+ |
+LL | fn with_ref(&self) {}
+ | ^^^^^ help: try passing by value: `Foo`
+
+error: passing `WithParameters<T, 1>` by reference
+ --> $DIR/rustc_pass_by_value_self.rs:47:17
+ |
+LL | fn with_ref(&self) {}
+ | ^^^^^ help: try passing by value: `WithParameters<T, 1>`
+
+error: passing `WithParameters<T, 1, u8>` by reference
+ --> $DIR/rustc_pass_by_value_self.rs:51:17
+ |
+LL | fn with_ref(&self) {}
+ | ^^^^^ help: try passing by value: `WithParameters<T, 1, u8>`
+
+error: aborting due to 5 previous errors
+
diff --git a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs
new file mode 100644
index 000000000..3f7429a5f
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs
@@ -0,0 +1,55 @@
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_private)]
+
+extern crate rustc_middle;
+extern crate rustc_type_ir;
+
+use rustc_middle::ty::{self, Ty, TyKind};
+use rustc_type_ir::{Interner, TyKind as IrTyKind};
+
+#[deny(rustc::usage_of_ty_tykind)]
+fn main() {
+ let kind = TyKind::Bool; //~ ERROR usage of `ty::TyKind::<kind>`
+
+ match kind {
+ TyKind::Bool => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Char => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Int(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Uint(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Float(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Adt(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Foreign(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Str => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Array(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Slice(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::RawPtr(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Ref(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::FnDef(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::FnPtr(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Dynamic(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Closure(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Generator(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::GeneratorWitness(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Never => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Tuple(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Alias(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Param(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Bound(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Placeholder(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Infer(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Error(_) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ }
+
+ if let ty::Int(int_ty) = kind {}
+
+ if let TyKind::Int(int_ty) = kind {} //~ ERROR usage of `ty::TyKind::<kind>`
+
+ fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {} //~ ERROR usage of `ty::TyKind`
+
+ fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
+ //~^ ERROR usage of `ty::TyKind`
+ //~| ERROR usage of `ty::TyKind`
+ IrTyKind::Bool //~ ERROR usage of `ty::TyKind::<kind>`
+ }
+}
diff --git a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr
new file mode 100644
index 000000000..1f49d6b64
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr
@@ -0,0 +1,208 @@
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:13:16
+ |
+LL | let kind = TyKind::Bool;
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+ |
+note: the lint level is defined here
+ --> $DIR/ty_tykind_usage.rs:11:8
+ |
+LL | #[deny(rustc::usage_of_ty_tykind)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:16:9
+ |
+LL | TyKind::Bool => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:17:9
+ |
+LL | TyKind::Char => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:18:9
+ |
+LL | TyKind::Int(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:19:9
+ |
+LL | TyKind::Uint(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:20:9
+ |
+LL | TyKind::Float(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:21:9
+ |
+LL | TyKind::Adt(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:22:9
+ |
+LL | TyKind::Foreign(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:23:9
+ |
+LL | TyKind::Str => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:24:9
+ |
+LL | TyKind::Array(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:25:9
+ |
+LL | TyKind::Slice(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:26:9
+ |
+LL | TyKind::RawPtr(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:27:9
+ |
+LL | TyKind::Ref(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:28:9
+ |
+LL | TyKind::FnDef(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:29:9
+ |
+LL | TyKind::FnPtr(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:30:9
+ |
+LL | TyKind::Dynamic(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:31:9
+ |
+LL | TyKind::Closure(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:32:9
+ |
+LL | TyKind::Generator(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:33:9
+ |
+LL | TyKind::GeneratorWitness(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:34:9
+ |
+LL | TyKind::Never => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:35:9
+ |
+LL | TyKind::Tuple(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:36:9
+ |
+LL | TyKind::Alias(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:37:9
+ |
+LL | TyKind::Param(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:38:9
+ |
+LL | TyKind::Bound(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:39:9
+ |
+LL | TyKind::Placeholder(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:40:9
+ |
+LL | TyKind::Infer(..) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:41:9
+ |
+LL | TyKind::Error(_) => (),
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:46:12
+ |
+LL | if let TyKind::Int(int_ty) = kind {}
+ | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
+
+error: usage of `ty::TyKind`
+ --> $DIR/ty_tykind_usage.rs:48:24
+ |
+LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {}
+ | ^^^^^^^^^^
+ |
+ = help: try using `Ty` instead
+
+error: usage of `ty::TyKind`
+ --> $DIR/ty_tykind_usage.rs:50:37
+ |
+LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
+ | ^^^^^^^^^^^
+ |
+ = help: try using `Ty` instead
+
+error: usage of `ty::TyKind`
+ --> $DIR/ty_tykind_usage.rs:50:53
+ |
+LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
+ | ^^^^^^^^^^^
+ |
+ = help: try using `Ty` instead
+
+error: usage of `ty::TyKind::<kind>`
+ --> $DIR/ty_tykind_usage.rs:53:9
+ |
+LL | IrTyKind::Bool
+ | --------^^^^^^
+ | |
+ | help: try using `ty::<kind>` directly: `ty`
+
+error: aborting due to 32 previous errors
+