From e8b10297b5228b7f4645bba45242416f0d86a708 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 9 Nov 2024 21:22:25 +0000 Subject: [PATCH] Fix error message for direct usage of sess.opts.crate_types --- compiler/rustc_session/src/options.rs | 2 +- tests/ui-fulldeps/internal-lints/bad_opt_access.rs | 2 +- tests/ui-fulldeps/internal-lints/bad_opt_access.stderr | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 087ba0522eb..f485e8cace5 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -130,7 +130,7 @@ top_level_options!( pub struct Options { /// The crate config requested for the session, which may be combined /// with additional crate configurations during the compile process. - #[rustc_lint_opt_deny_field_access("use `Session::crate_types` instead of this field")] + #[rustc_lint_opt_deny_field_access("use `TyCtxt::crate_types` instead of this field")] crate_types: Vec [TRACKED], optimize: OptLevel [TRACKED], /// Include the `debug_assertions` flag in dependency tracking, since it diff --git a/tests/ui-fulldeps/internal-lints/bad_opt_access.rs b/tests/ui-fulldeps/internal-lints/bad_opt_access.rs index 708c3651b87..a2a94db919d 100644 --- a/tests/ui-fulldeps/internal-lints/bad_opt_access.rs +++ b/tests/ui-fulldeps/internal-lints/bad_opt_access.rs @@ -15,7 +15,7 @@ pub fn access_bad_option(sess: Session) { //~^ ERROR use `Session::split_debuginfo` instead of this field let _ = sess.opts.crate_types; - //~^ ERROR use `Session::crate_types` instead of this field + //~^ ERROR use `TyCtxt::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 index e4145bff8be..35b179f2a3a 100644 --- a/tests/ui-fulldeps/internal-lints/bad_opt_access.stderr +++ b/tests/ui-fulldeps/internal-lints/bad_opt_access.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here LL | #![deny(rustc::bad_opt_access)] | ^^^^^^^^^^^^^^^^^^^^^ -error: use `Session::crate_types` instead of this field +error: use `TyCtxt::crate_types` instead of this field --> $DIR/bad_opt_access.rs:17:13 | LL | let _ = sess.opts.crate_types;