Skip to content

Commit

Permalink
Auto merge of #110401 - fee1-dead-contrib:rollup-1f2smz2, r=fee1-dead
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Apr 16, 2023
2 parents 18109d5 + 7fb14ae commit 1b50ea9
Show file tree
Hide file tree
Showing 22 changed files with 79 additions and 137 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4775,7 +4775,7 @@ dependencies = [
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_lint",
"rustc_lint_defs",
"rustc_macros",
"rustc_middle",
"rustc_session",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rustc_span = { path = "../rustc_span" }
rustc_index = { path = "../rustc_index" }
rustc_infer = { path = "../rustc_infer" }
rustc_trait_selection = { path = "../rustc_trait_selection" }
rustc_lint = { path = "../rustc_lint" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
rustc_type_ir = { path = "../rustc_type_ir" }
rustc_feature = { path = "../rustc_feature" }
thin-vec = "0.2.12"
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use rustc_infer::infer::opaque_types::ConstrainOpaqueTypeRegionVisitor;
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::infer::{DefiningAnchor, RegionVariableOrigin, TyCtxtInferExt};
use rustc_infer::traits::{Obligation, TraitEngineExt as _};
use rustc_lint::builtin::REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS;
use rustc_lint_defs::builtin::REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS;
use rustc_middle::hir::nested_filter;
use rustc_middle::middle::stability::EvalResult;
use rustc_middle::ty::layout::{LayoutError, MAX_SIMD_LANES};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/variance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
if let ty::RegionKind::ReEarlyBound(ebr) = r.kind() {
self.variances[ebr.index as usize] = ty::Invariant;
}
r.super_visit_with(self)
ControlFlow::Continue(())
}

#[instrument(level = "trace", skip(self), ret)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_hir::intravisit::Visitor;
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::error::ExpectedFound;
use rustc_middle::ty::print::RegionHighlightMode;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor};
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitor};
use rustc_span::Span;

use std::ops::ControlFlow;
Expand Down Expand Up @@ -81,7 +81,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
self.highlight.highlighting_region(r, self.counter);
self.counter += 1;
}
r.super_visit_with(self)
ControlFlow::Continue(())
}
}

Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_macros/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ struct QueryModifiers {
/// Use a separate query provider for local and extern crates
separate_provide_extern: Option<Ident>,

/// Always remap the ParamEnv's constness before hashing.
remap_env_constness: Option<Ident>,

/// Generate a `feed` method to set the query's value from another query.
feedable: Option<Ident>,
}
Expand All @@ -130,7 +127,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
let mut eval_always = None;
let mut depth_limit = None;
let mut separate_provide_extern = None;
let mut remap_env_constness = None;
let mut feedable = None;

while !input.is_empty() {
Expand Down Expand Up @@ -189,8 +185,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
try_insert!(depth_limit = modifier);
} else if modifier == "separate_provide_extern" {
try_insert!(separate_provide_extern = modifier);
} else if modifier == "remap_env_constness" {
try_insert!(remap_env_constness = modifier);
} else if modifier == "feedable" {
try_insert!(feedable = modifier);
} else {
Expand All @@ -211,7 +205,6 @@ fn parse_query_modifiers(input: ParseStream<'_>) -> Result<QueryModifiers> {
eval_always,
depth_limit,
separate_provide_extern,
remap_env_constness,
feedable,
})
}
Expand Down Expand Up @@ -332,7 +325,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
eval_always,
depth_limit,
separate_provide_extern,
remap_env_constness,
);

if modifiers.cache.is_some() {
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_middle/src/infer/canonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,6 @@ impl<'tcx, R> Canonical<'tcx, QueryResponse<'tcx, R>> {
}
}

impl<'tcx, R> Canonical<'tcx, ty::ParamEnvAnd<'tcx, R>> {
#[inline]
pub fn without_const(mut self) -> Self {
self.value = self.value.without_const();
self
}
}

impl<'tcx, V> Canonical<'tcx, V> {
/// Allows you to map the `value` of a canonical while keeping the
/// same set of bound variables.
Expand Down
25 changes: 0 additions & 25 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,6 @@ rustc_queries! {
key: ty::ParamEnvAnd<'tcx, mir::ConstantKind<'tcx>>
) -> Option<mir::DestructuredConstant<'tcx>> {
desc { "destructuring MIR constant"}
remap_env_constness
}

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

query const_caller_location(key: (rustc_span::Symbol, u32, u32)) -> ConstValue<'tcx> {
Expand Down Expand Up @@ -1346,32 +1344,26 @@ rustc_queries! {
/// `ty.is_copy()`, etc, since that will prune the environment where possible.
query is_copy_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
desc { "computing whether `{}` is `Copy`", env.value }
remap_env_constness
}
/// Query backing `Ty::is_sized`.
query is_sized_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
desc { "computing whether `{}` is `Sized`", env.value }
remap_env_constness
}
/// Query backing `Ty::is_freeze`.
query is_freeze_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
desc { "computing whether `{}` is freeze", env.value }
remap_env_constness
}
/// Query backing `Ty::is_unpin`.
query is_unpin_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
desc { "computing whether `{}` is `Unpin`", env.value }
remap_env_constness
}
/// Query backing `Ty::needs_drop`.
query needs_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
desc { "computing whether `{}` needs drop", env.value }
remap_env_constness
}
/// Query backing `Ty::has_significant_drop_raw`.
query has_significant_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
desc { "computing whether `{}` has a significant drop", env.value }
remap_env_constness
}

/// Query backing `Ty::is_structural_eq_shallow`.
Expand Down Expand Up @@ -1411,7 +1403,6 @@ rustc_queries! {
) -> Result<ty::layout::TyAndLayout<'tcx>, ty::layout::LayoutError<'tcx>> {
depth_limit
desc { "computing layout of `{}`", key.value }
remap_env_constness
}

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

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

query dylib_dependency_formats(_: CrateNum)
Expand Down Expand Up @@ -1937,15 +1926,13 @@ rustc_queries! {
NoSolution,
> {
desc { "normalizing `{}`", goal.value.value }
remap_env_constness
}

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

query implied_outlives_bounds(
Expand All @@ -1955,7 +1942,6 @@ rustc_queries! {
NoSolution,
> {
desc { "computing implied outlives bounds for `{}`", goal.value.value }
remap_env_constness
}

/// Do not call this query directly:
Expand All @@ -1967,7 +1953,6 @@ rustc_queries! {
NoSolution,
> {
desc { "computing dropck types for `{}`", goal.value.value }
remap_env_constness
}

/// Do not call this query directly: invoke `infcx.predicate_may_hold()` or
Expand Down Expand Up @@ -1995,7 +1980,6 @@ rustc_queries! {
NoSolution,
> {
desc { "evaluating `type_op_ascribe_user_type` `{:?}`", goal.value.value }
remap_env_constness
}

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

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

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

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

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

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

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

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

query resolve_instance_of_const_arg(
Expand All @@ -2148,7 +2124,6 @@ rustc_queries! {
"resolving instance of the const argument `{}`",
ty::Instance::new(key.value.0.to_def_id(), key.value.2),
}
remap_env_constness
}

query reveal_opaque_types_in_bounds(key: &'tcx ty::List<ty::Predicate<'tcx>>) -> &'tcx ty::List<ty::Predicate<'tcx>> {
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/ty/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ where
}

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

Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1850,12 +1850,6 @@ impl<'tcx, T> ParamEnvAnd<'tcx, T> {
pub fn into_parts(self) -> (ParamEnv<'tcx>, T) {
(self.param_env, self.value)
}

#[inline]
pub fn without_const(mut self) -> Self {
self.param_env = self.param_env.without_const();
self
}
}

#[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2518,7 +2518,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
self.used_region_names.insert(name);
}

r.super_visit_with(self)
ControlFlow::Continue(())
}

// We collect types in order to prevent really large types from compiling for
Expand Down
14 changes: 0 additions & 14 deletions compiler/rustc_middle/src/ty/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,6 @@ macro_rules! separate_provide_extern_default {
};
}

macro_rules! opt_remap_env_constness {
([][$name:ident]) => {};
([(remap_env_constness) $($rest:tt)*][$name:ident]) => {
let $name = $name.without_const();
};
([$other:tt $($modifiers:tt)*][$name:ident]) => {
opt_remap_env_constness!([$($modifiers)*][$name])
};
}

macro_rules! define_callbacks {
(
$($(#[$attr:meta])*
Expand Down Expand Up @@ -353,7 +343,6 @@ macro_rules! define_callbacks {
#[inline(always)]
pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
let key = key.into_query_param();
opt_remap_env_constness!([$($modifiers)*][key]);

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

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

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

let tcx = self.tcx;
let erased = query_provided_to_value::$name(tcx, value);
Expand Down
Loading

0 comments on commit 1b50ea9

Please sign in to comment.