Skip to content

Commit 931d3bf

Browse files
Auto merge of #146309 - cjgillot:no-deduce-attrs, r=<try>
Remove deduce_param_attrs.
2 parents 55b9b4d + 864f644 commit 931d3bf

File tree

16 files changed

+7
-297
lines changed

16 files changed

+7
-297
lines changed

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,6 @@ provide! { tcx, def_id, other, cdata,
282282
.unwrap_or_else(|| panic!("{def_id:?} does not have eval_static_initializer")))
283283
}
284284
trait_def => { table }
285-
deduced_param_attrs => {
286-
// FIXME: `deduced_param_attrs` has some sketchy encoding settings,
287-
// where we don't encode unless we're optimizing, doing codegen,
288-
// and not incremental (see `encoder.rs`). I don't think this is right!
289-
cdata
290-
.root
291-
.tables
292-
.deduced_param_attrs
293-
.get(cdata, def_id.index)
294-
.map(|lazy| {
295-
&*tcx.arena.alloc_from_iter(lazy.decode((cdata, tcx)))
296-
})
297-
.unwrap_or_default()
298-
}
299285
opaque_ty_origin => { table }
300286
assumed_wf_types_for_rpitit => { table }
301287
collect_return_position_impl_trait_in_trait_tys => {

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rustc_middle::ty::codec::TyEncoder;
2727
use rustc_middle::ty::fast_reject::{self, TreatParams};
2828
use rustc_middle::{bug, span_bug};
2929
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque};
30-
use rustc_session::config::{CrateType, OptLevel, TargetModifier};
30+
use rustc_session::config::{CrateType, TargetModifier};
3131
use rustc_span::hygiene::HygieneEncodeContext;
3232
use rustc_span::{
3333
ByteSymbol, ExternalSource, FileName, SourceFile, SpanData, SpanEncoder, StableSourceFileId,
@@ -1822,21 +1822,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
18221822
record!(self.tables.mir_coroutine_witnesses[def_id.to_def_id()] <- witnesses);
18231823
}
18241824
}
1825-
1826-
// Encode all the deduced parameter attributes for everything that has MIR, even for items
1827-
// that can't be inlined. But don't if we aren't optimizing in non-incremental mode, to
1828-
// save the query traffic.
1829-
if tcx.sess.opts.output_types.should_codegen()
1830-
&& tcx.sess.opts.optimize != OptLevel::No
1831-
&& tcx.sess.opts.incremental.is_none()
1832-
{
1833-
for &local_def_id in tcx.mir_keys(()) {
1834-
if let DefKind::AssocFn | DefKind::Fn = tcx.def_kind(local_def_id) {
1835-
record_array!(self.tables.deduced_param_attrs[local_def_id.to_def_id()] <-
1836-
self.tcx.deduced_param_attrs(local_def_id.to_def_id()));
1837-
}
1838-
}
1839-
}
18401825
}
18411826

18421827
#[instrument(level = "debug", skip(self))]

compiler/rustc_metadata/src/rmeta/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_middle::middle::lib_features::FeatureStability;
2929
use rustc_middle::middle::resolve_bound_vars::ObjectLifetimeDefault;
3030
use rustc_middle::mir;
3131
use rustc_middle::ty::fast_reject::SimplifiedType;
32-
use rustc_middle::ty::{self, DeducedParamAttrs, Ty, TyCtxt, UnusedGenericParams};
32+
use rustc_middle::ty::{self, Ty, TyCtxt, UnusedGenericParams};
3333
use rustc_middle::util::Providers;
3434
use rustc_serialize::opaque::FileEncoder;
3535
use rustc_session::config::{SymbolManglingVersion, TargetModifier};
@@ -462,7 +462,6 @@ define_tables! {
462462
assoc_container: Table<DefIndex, ty::AssocItemContainer>,
463463
macro_definition: Table<DefIndex, LazyValue<ast::DelimArgs>>,
464464
proc_macro: Table<DefIndex, MacroKind>,
465-
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,
466465
trait_impl_trait_tys: Table<DefIndex, LazyValue<DefIdMap<ty::EarlyBinder<'static, Ty<'static>>>>>,
467466
doc_link_resolutions: Table<DefIndex, LazyValue<DocLinkResMap>>,
468467
doc_link_traits_in_scope: Table<DefIndex, LazyArray<DefId>>,

compiler/rustc_metadata/src/rmeta/parameterized.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ trivially_parameterized_over_tcx! {
105105
rustc_middle::ty::AssocItemContainer,
106106
rustc_middle::ty::AsyncDestructor,
107107
rustc_middle::ty::Asyncness,
108-
rustc_middle::ty::DeducedParamAttrs,
109108
rustc_middle::ty::Destructor,
110109
rustc_middle::ty::Generics,
111110
rustc_middle::ty::ImplTraitInTraitData,

compiler/rustc_middle/src/query/erase.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ trivial! {
323323
rustc_middle::ty::AsyncDestructor,
324324
rustc_middle::ty::BoundVariableKind,
325325
rustc_middle::ty::AnonConstKind,
326-
rustc_middle::ty::DeducedParamAttrs,
327326
rustc_middle::ty::Destructor,
328327
rustc_middle::ty::fast_reject::SimplifiedType,
329328
rustc_middle::ty::ImplPolarity,

compiler/rustc_middle/src/query/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,11 +2656,6 @@ rustc_queries! {
26562656
return_result_from_ensure_ok
26572657
}
26582658

2659-
query deduced_param_attrs(def_id: DefId) -> &'tcx [ty::DeducedParamAttrs] {
2660-
desc { |tcx| "deducing parameter attributes for {}", tcx.def_path_str(def_id) }
2661-
separate_provide_extern
2662-
}
2663-
26642659
query doc_link_resolutions(def_id: DefId) -> &'tcx DocLinkResMap {
26652660
eval_always
26662661
desc { "resolutions for documentation links for a module" }

compiler/rustc_middle/src/query/on_disk_cache.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,6 @@ impl_ref_decoder! {<'tcx>
799799
rustc_span::def_id::DefId,
800800
rustc_span::def_id::LocalDefId,
801801
(rustc_middle::middle::exported_symbols::ExportedSymbol<'tcx>, rustc_middle::middle::exported_symbols::SymbolExportInfo),
802-
ty::DeducedParamAttrs,
803802
}
804803

805804
//- ENCODING -------------------------------------------------------------------

compiler/rustc_middle/src/ty/codec.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,6 @@ impl_arena_copy_decoder! {<'tcx>
577577
rustc_span::def_id::DefId,
578578
rustc_span::def_id::LocalDefId,
579579
(rustc_middle::middle::exported_symbols::ExportedSymbol<'tcx>, rustc_middle::middle::exported_symbols::SymbolExportInfo),
580-
ty::DeducedParamAttrs,
581580
}
582581

583582
#[macro_export]

compiler/rustc_middle/src/ty/context.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ use rustc_hir::intravisit::VisitorExt;
4040
use rustc_hir::lang_items::LangItem;
4141
use rustc_hir::{self as hir, Attribute, HirId, Node, TraitCandidate, find_attr};
4242
use rustc_index::IndexVec;
43-
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
4443
use rustc_query_system::cache::WithDepNode;
4544
use rustc_query_system::dep_graph::DepNodeIndex;
4645
use rustc_query_system::ich::StableHashingContext;
@@ -3495,21 +3494,6 @@ impl<'tcx> TyCtxt<'tcx> {
34953494
}
34963495
}
34973496

3498-
/// Parameter attributes that can only be determined by examining the body of a function instead
3499-
/// of just its signature.
3500-
///
3501-
/// These can be useful for optimization purposes when a function is directly called. We compute
3502-
/// them and store them into the crate metadata so that downstream crates can make use of them.
3503-
///
3504-
/// Right now, we only have `read_only`, but `no_capture` and `no_alias` might be useful in the
3505-
/// future.
3506-
#[derive(Clone, Copy, PartialEq, Debug, Default, TyDecodable, TyEncodable, HashStable)]
3507-
pub struct DeducedParamAttrs {
3508-
/// The parameter is marked immutable in the function and contains no `UnsafeCell` (i.e. its
3509-
/// type is freeze).
3510-
pub read_only: bool,
3511-
}
3512-
35133497
pub fn provide(providers: &mut Providers) {
35143498
providers.is_panic_runtime =
35153499
|tcx, LocalCrate| contains_name(tcx.hir_krate_attrs(), sym::panic_runtime);

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ pub use self::consts::{
7777
ExprKind, ScalarInt, UnevaluatedConst, ValTree, ValTreeKind, Value,
7878
};
7979
pub use self::context::{
80-
CtxtInterners, CurrentGcx, DeducedParamAttrs, Feed, FreeRegionInfo, GlobalCtxt, Lift, TyCtxt,
81-
TyCtxtFeed, tls,
80+
CtxtInterners, CurrentGcx, Feed, FreeRegionInfo, GlobalCtxt, Lift, TyCtxt, TyCtxtFeed, tls,
8281
};
8382
pub use self::fold::*;
8483
pub use self::instance::{Instance, InstanceKind, ReifyReason, UnusedGenericParams};

0 commit comments

Comments
 (0)