Skip to content

Commit 1b50ea9

Browse files
committed
Auto merge of #110401 - fee1-dead-contrib:rollup-1f2smz2, r=fee1-dead
Rollup of 3 pull requests Successful merges: - #109665 (Remove `remap_env_constness` in queries) - #110345 (Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.) - #110396 (Use lint via `lint_defs` instead of `lints`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 18109d5 + 7fb14ae commit 1b50ea9

File tree

22 files changed

+79
-137
lines changed

22 files changed

+79
-137
lines changed

Cargo.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -4775,7 +4775,7 @@ dependencies = [
47754775
"rustc_hir",
47764776
"rustc_index",
47774777
"rustc_infer",
4778-
"rustc_lint",
4778+
"rustc_lint_defs",
47794779
"rustc_macros",
47804780
"rustc_middle",
47814781
"rustc_session",

compiler/rustc_hir_analysis/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ rustc_span = { path = "../rustc_span" }
2323
rustc_index = { path = "../rustc_index" }
2424
rustc_infer = { path = "../rustc_infer" }
2525
rustc_trait_selection = { path = "../rustc_trait_selection" }
26-
rustc_lint = { path = "../rustc_lint" }
26+
rustc_lint_defs = { path = "../rustc_lint_defs" }
2727
rustc_type_ir = { path = "../rustc_type_ir" }
2828
rustc_feature = { path = "../rustc_feature" }
2929
thin-vec = "0.2.12"

compiler/rustc_hir_analysis/src/check/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_infer::infer::opaque_types::ConstrainOpaqueTypeRegionVisitor;
1515
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
1616
use rustc_infer::infer::{DefiningAnchor, RegionVariableOrigin, TyCtxtInferExt};
1717
use rustc_infer::traits::{Obligation, TraitEngineExt as _};
18-
use rustc_lint::builtin::REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS;
18+
use rustc_lint_defs::builtin::REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS;
1919
use rustc_middle::hir::nested_filter;
2020
use rustc_middle::middle::stability::EvalResult;
2121
use rustc_middle::ty::layout::{LayoutError, MAX_SIMD_LANES};

compiler/rustc_hir_analysis/src/variance/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
105105
if let ty::RegionKind::ReEarlyBound(ebr) = r.kind() {
106106
self.variances[ebr.index as usize] = ty::Invariant;
107107
}
108-
r.super_visit_with(self)
108+
ControlFlow::Continue(())
109109
}
110110

111111
#[instrument(level = "trace", skip(self), ret)]

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_hir::intravisit::Visitor;
1313
use rustc_middle::hir::nested_filter;
1414
use rustc_middle::ty::error::ExpectedFound;
1515
use rustc_middle::ty::print::RegionHighlightMode;
16-
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor};
16+
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitor};
1717
use rustc_span::Span;
1818

1919
use std::ops::ControlFlow;
@@ -81,7 +81,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
8181
self.highlight.highlighting_region(r, self.counter);
8282
self.counter += 1;
8383
}
84-
r.super_visit_with(self)
84+
ControlFlow::Continue(())
8585
}
8686
}
8787

compiler/rustc_macros/src/query.rs

-8
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ struct QueryModifiers {
112112
/// Use a separate query provider for local and extern crates
113113
separate_provide_extern: Option<Ident>,
114114

115-
/// Always remap the ParamEnv's constness before hashing.
116-
remap_env_constness: Option<Ident>,
117-
118115
/// Generate a `feed` method to set the query's value from another query.
119116
feedable: Option<Ident>,
120117
}
@@ -130,7 +127,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
130127
let mut eval_always = None;
131128
let mut depth_limit = None;
132129
let mut separate_provide_extern = None;
133-
let mut remap_env_constness = None;
134130
let mut feedable = None;
135131

136132
while !input.is_empty() {
@@ -189,8 +185,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
189185
try_insert!(depth_limit = modifier);
190186
} else if modifier == "separate_provide_extern" {
191187
try_insert!(separate_provide_extern = modifier);
192-
} else if modifier == "remap_env_constness" {
193-
try_insert!(remap_env_constness = modifier);
194188
} else if modifier == "feedable" {
195189
try_insert!(feedable = modifier);
196190
} else {
@@ -211,7 +205,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
211205
eval_always,
212206
depth_limit,
213207
separate_provide_extern,
214-
remap_env_constness,
215208
feedable,
216209
})
217210
}
@@ -332,7 +325,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
332325
eval_always,
333326
depth_limit,
334327
separate_provide_extern,
335-
remap_env_constness,
336328
);
337329

338330
if modifiers.cache.is_some() {

compiler/rustc_middle/src/infer/canonical.rs

-8
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,6 @@ impl<'tcx, R> Canonical<'tcx, QueryResponse<'tcx, R>> {
348348
}
349349
}
350350

351-
impl<'tcx, R> Canonical<'tcx, ty::ParamEnvAnd<'tcx, R>> {
352-
#[inline]
353-
pub fn without_const(mut self) -> Self {
354-
self.value = self.value.without_const();
355-
self
356-
}
357-
}
358-
359351
impl<'tcx, V> Canonical<'tcx, V> {
360352
/// Allows you to map the `value` of a canonical while keeping the
361353
/// same set of bound variables.

compiler/rustc_middle/src/query/mod.rs

-25
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,6 @@ rustc_queries! {
10941094
key: ty::ParamEnvAnd<'tcx, mir::ConstantKind<'tcx>>
10951095
) -> Option<mir::DestructuredConstant<'tcx>> {
10961096
desc { "destructuring MIR constant"}
1097-
remap_env_constness
10981097
}
10991098

11001099
/// Dereference a constant reference or raw pointer and turn the result into a constant
@@ -1103,7 +1102,6 @@ rustc_queries! {
11031102
key: ty::ParamEnvAnd<'tcx, mir::ConstantKind<'tcx>>
11041103
) -> mir::ConstantKind<'tcx> {
11051104
desc { "dereferencing MIR constant" }
1106-
remap_env_constness
11071105
}
11081106

11091107
query const_caller_location(key: (rustc_span::Symbol, u32, u32)) -> ConstValue<'tcx> {
@@ -1346,32 +1344,26 @@ rustc_queries! {
13461344
/// `ty.is_copy()`, etc, since that will prune the environment where possible.
13471345
query is_copy_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
13481346
desc { "computing whether `{}` is `Copy`", env.value }
1349-
remap_env_constness
13501347
}
13511348
/// Query backing `Ty::is_sized`.
13521349
query is_sized_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
13531350
desc { "computing whether `{}` is `Sized`", env.value }
1354-
remap_env_constness
13551351
}
13561352
/// Query backing `Ty::is_freeze`.
13571353
query is_freeze_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
13581354
desc { "computing whether `{}` is freeze", env.value }
1359-
remap_env_constness
13601355
}
13611356
/// Query backing `Ty::is_unpin`.
13621357
query is_unpin_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
13631358
desc { "computing whether `{}` is `Unpin`", env.value }
1364-
remap_env_constness
13651359
}
13661360
/// Query backing `Ty::needs_drop`.
13671361
query needs_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
13681362
desc { "computing whether `{}` needs drop", env.value }
1369-
remap_env_constness
13701363
}
13711364
/// Query backing `Ty::has_significant_drop_raw`.
13721365
query has_significant_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
13731366
desc { "computing whether `{}` has a significant drop", env.value }
1374-
remap_env_constness
13751367
}
13761368

13771369
/// Query backing `Ty::is_structural_eq_shallow`.
@@ -1411,7 +1403,6 @@ rustc_queries! {
14111403
) -> Result<ty::layout::TyAndLayout<'tcx>, ty::layout::LayoutError<'tcx>> {
14121404
depth_limit
14131405
desc { "computing layout of `{}`", key.value }
1414-
remap_env_constness
14151406
}
14161407

14171408
/// Compute a `FnAbi` suitable for indirect calls, i.e. to `fn` pointers.
@@ -1422,7 +1413,6 @@ rustc_queries! {
14221413
key: ty::ParamEnvAnd<'tcx, (ty::PolyFnSig<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
14231414
) -> Result<&'tcx abi::call::FnAbi<'tcx, Ty<'tcx>>, ty::layout::FnAbiError<'tcx>> {
14241415
desc { "computing call ABI of `{}` function pointers", key.value.0 }
1425-
remap_env_constness
14261416
}
14271417

14281418
/// Compute a `FnAbi` suitable for declaring/defining an `fn` instance, and for
@@ -1434,7 +1424,6 @@ rustc_queries! {
14341424
key: ty::ParamEnvAnd<'tcx, (ty::Instance<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
14351425
) -> Result<&'tcx abi::call::FnAbi<'tcx, Ty<'tcx>>, ty::layout::FnAbiError<'tcx>> {
14361426
desc { "computing call ABI of `{}`", key.value.0 }
1437-
remap_env_constness
14381427
}
14391428

14401429
query dylib_dependency_formats(_: CrateNum)
@@ -1937,15 +1926,13 @@ rustc_queries! {
19371926
NoSolution,
19381927
> {
19391928
desc { "normalizing `{}`", goal.value.value }
1940-
remap_env_constness
19411929
}
19421930

19431931
/// Do not call this query directly: invoke `try_normalize_erasing_regions` instead.
19441932
query try_normalize_generic_arg_after_erasing_regions(
19451933
goal: ParamEnvAnd<'tcx, GenericArg<'tcx>>
19461934
) -> Result<GenericArg<'tcx>, NoSolution> {
19471935
desc { "normalizing `{}`", goal.value }
1948-
remap_env_constness
19491936
}
19501937

19511938
query implied_outlives_bounds(
@@ -1955,7 +1942,6 @@ rustc_queries! {
19551942
NoSolution,
19561943
> {
19571944
desc { "computing implied outlives bounds for `{}`", goal.value.value }
1958-
remap_env_constness
19591945
}
19601946

19611947
/// Do not call this query directly:
@@ -1967,7 +1953,6 @@ rustc_queries! {
19671953
NoSolution,
19681954
> {
19691955
desc { "computing dropck types for `{}`", goal.value.value }
1970-
remap_env_constness
19711956
}
19721957

19731958
/// Do not call this query directly: invoke `infcx.predicate_may_hold()` or
@@ -1995,7 +1980,6 @@ rustc_queries! {
19951980
NoSolution,
19961981
> {
19971982
desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal.value.value }
1998-
remap_env_constness
19991983
}
20001984

20011985
/// Do not call this query directly: part of the `Eq` type-op
@@ -2006,7 +1990,6 @@ rustc_queries! {
20061990
NoSolution,
20071991
> {
20081992
desc { "evaluating `type_op_eq` `{:?}`", goal.value.value }
2009-
remap_env_constness
20101993
}
20111994

20121995
/// Do not call this query directly: part of the `Subtype` type-op
@@ -2017,7 +2000,6 @@ rustc_queries! {
20172000
NoSolution,
20182001
> {
20192002
desc { "evaluating `type_op_subtype` `{:?}`", goal.value.value }
2020-
remap_env_constness
20212003
}
20222004

20232005
/// Do not call this query directly: part of the `ProvePredicate` type-op
@@ -2038,7 +2020,6 @@ rustc_queries! {
20382020
NoSolution,
20392021
> {
20402022
desc { "normalizing `{}`", goal.value.value.value }
2041-
remap_env_constness
20422023
}
20432024

20442025
/// Do not call this query directly: part of the `Normalize` type-op
@@ -2049,7 +2030,6 @@ rustc_queries! {
20492030
NoSolution,
20502031
> {
20512032
desc { "normalizing `{:?}`", goal.value.value.value }
2052-
remap_env_constness
20532033
}
20542034

20552035
/// Do not call this query directly: part of the `Normalize` type-op
@@ -2060,7 +2040,6 @@ rustc_queries! {
20602040
NoSolution,
20612041
> {
20622042
desc { "normalizing `{:?}`", goal.value.value.value }
2063-
remap_env_constness
20642043
}
20652044

20662045
/// Do not call this query directly: part of the `Normalize` type-op
@@ -2071,7 +2050,6 @@ rustc_queries! {
20712050
NoSolution,
20722051
> {
20732052
desc { "normalizing `{:?}`", goal.value.value.value }
2074-
remap_env_constness
20752053
}
20762054

20772055
query subst_and_check_impossible_predicates(key: (DefId, SubstsRef<'tcx>)) -> bool {
@@ -2093,7 +2071,6 @@ rustc_queries! {
20932071
goal: CanonicalTyGoal<'tcx>
20942072
) -> MethodAutoderefStepsResult<'tcx> {
20952073
desc { "computing autoderef types for `{}`", goal.value.value }
2096-
remap_env_constness
20972074
}
20982075

20992076
query supported_target_features(_: CrateNum) -> &'tcx FxHashMap<String, Option<Symbol>> {
@@ -2138,7 +2115,6 @@ rustc_queries! {
21382115
key: ty::ParamEnvAnd<'tcx, (DefId, SubstsRef<'tcx>)>
21392116
) -> Result<Option<ty::Instance<'tcx>>, ErrorGuaranteed> {
21402117
desc { "resolving instance `{}`", ty::Instance::new(key.value.0, key.value.1) }
2141-
remap_env_constness
21422118
}
21432119

21442120
query resolve_instance_of_const_arg(
@@ -2148,7 +2124,6 @@ rustc_queries! {
21482124
"resolving instance of the const argument `{}`",
21492125
ty::Instance::new(key.value.0.to_def_id(), key.value.2),
21502126
}
2151-
remap_env_constness
21522127
}
21532128

21542129
query reveal_opaque_types_in_bounds(key: &'tcx ty::List<ty::Predicate<'tcx>>) -> &'tcx ty::List<ty::Predicate<'tcx>> {

compiler/rustc_middle/src/ty/fold.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ where
3737
}
3838

3939
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
40-
let r = r.super_fold_with(self);
40+
// This one is a little different, because `super_fold_with` is not
41+
// implemented on non-recursive `Region`.
4142
(self.lt_op)(r)
4243
}
4344

compiler/rustc_middle/src/ty/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1850,12 +1850,6 @@ impl<'tcx, T> ParamEnvAnd<'tcx, T> {
18501850
pub fn into_parts(self) -> (ParamEnv<'tcx>, T) {
18511851
(self.param_env, self.value)
18521852
}
1853-
1854-
#[inline]
1855-
pub fn without_const(mut self) -> Self {
1856-
self.param_env = self.param_env.without_const();
1857-
self
1858-
}
18591853
}
18601854

18611855
#[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable)]

compiler/rustc_middle/src/ty/print/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2518,7 +2518,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
25182518
self.used_region_names.insert(name);
25192519
}
25202520

2521-
r.super_visit_with(self)
2521+
ControlFlow::Continue(())
25222522
}
25232523

25242524
// We collect types in order to prevent really large types from compiling for

compiler/rustc_middle/src/ty/query.rs

-14
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,6 @@ macro_rules! separate_provide_extern_default {
202202
};
203203
}
204204

205-
macro_rules! opt_remap_env_constness {
206-
([][$name:ident]) => {};
207-
([(remap_env_constness) $($rest:tt)*][$name:ident]) => {
208-
let $name = $name.without_const();
209-
};
210-
([$other:tt $($modifiers:tt)*][$name:ident]) => {
211-
opt_remap_env_constness!([$($modifiers)*][$name])
212-
};
213-
}
214-
215205
macro_rules! define_callbacks {
216206
(
217207
$($(#[$attr:meta])*
@@ -353,7 +343,6 @@ macro_rules! define_callbacks {
353343
#[inline(always)]
354344
pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
355345
let key = key.into_query_param();
356-
opt_remap_env_constness!([$($modifiers)*][key]);
357346

358347
match try_get_cached(self.tcx, &self.tcx.query_system.caches.$name, &key) {
359348
Some(_) => return,
@@ -372,7 +361,6 @@ macro_rules! define_callbacks {
372361
#[inline(always)]
373362
pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
374363
let key = key.into_query_param();
375-
opt_remap_env_constness!([$($modifiers)*][key]);
376364

377365
match try_get_cached(self.tcx, &self.tcx.query_system.caches.$name, &key) {
378366
Some(_) => return,
@@ -402,7 +390,6 @@ macro_rules! define_callbacks {
402390
pub fn $name(self, key: query_helper_param_ty!($($K)*)) -> $V
403391
{
404392
let key = key.into_query_param();
405-
opt_remap_env_constness!([$($modifiers)*][key]);
406393

407394
restore::<$V>(match try_get_cached(self.tcx, &self.tcx.query_system.caches.$name, &key) {
408395
Some(value) => value,
@@ -492,7 +479,6 @@ macro_rules! define_feedable {
492479
#[inline(always)]
493480
pub fn $name(self, value: query_provided::$name<'tcx>) -> $V {
494481
let key = self.key().into_query_param();
495-
opt_remap_env_constness!([$($modifiers)*][key]);
496482

497483
let tcx = self.tcx;
498484
let erased = query_provided_to_value::$name(tcx, value);

0 commit comments

Comments
 (0)