Skip to content

Commit 40d5019

Browse files
committed
Remove deduced_param_attrs
1 parent 385970f commit 40d5019

File tree

13 files changed

+4
-299
lines changed

13 files changed

+4
-299
lines changed

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

-14
Original file line numberDiff line numberDiff line change
@@ -300,20 +300,6 @@ provide! { tcx, def_id, other, cdata,
300300
.unwrap_or_else(|| panic!("{def_id:?} does not have eval_static_initializer")))
301301
}
302302
trait_def => { table }
303-
deduced_param_attrs => {
304-
// FIXME: `deduced_param_attrs` has some sketchy encoding settings,
305-
// where we don't encode unless we're optimizing, doing codegen,
306-
// and not incremental (see `encoder.rs`). I don't think this is right!
307-
cdata
308-
.root
309-
.tables
310-
.deduced_param_attrs
311-
.get(cdata, def_id.index)
312-
.map(|lazy| {
313-
&*tcx.arena.alloc_from_iter(lazy.decode((cdata, tcx)))
314-
})
315-
.unwrap_or_default()
316-
}
317303
opaque_ty_origin => { table }
318304
assumed_wf_types_for_rpitit => { table }
319305
collect_return_position_impl_trait_in_trait_tys => {

compiler/rustc_metadata/src/rmeta/encoder.rs

+1-16
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc_middle::ty::fast_reject::{self, TreatParams};
2626
use rustc_middle::ty::{AssocItemContainer, SymbolName};
2727
use rustc_middle::{bug, span_bug};
2828
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque};
29-
use rustc_session::config::{CrateType, OptLevel, TargetModifier};
29+
use rustc_session::config::{CrateType, TargetModifier};
3030
use rustc_span::hygiene::HygieneEncodeContext;
3131
use rustc_span::{
3232
ExternalSource, FileName, SourceFile, SpanData, SpanEncoder, StableSourceFileId, SyntaxContext,
@@ -1778,21 +1778,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
17781778
record!(self.tables.mir_coroutine_witnesses[def_id.to_def_id()] <- witnesses);
17791779
}
17801780
}
1781-
1782-
// Encode all the deduced parameter attributes for everything that has MIR, even for items
1783-
// that can't be inlined. But don't if we aren't optimizing in non-incremental mode, to
1784-
// save the query traffic.
1785-
if tcx.sess.opts.output_types.should_codegen()
1786-
&& tcx.sess.opts.optimize != OptLevel::No
1787-
&& tcx.sess.opts.incremental.is_none()
1788-
{
1789-
for &local_def_id in tcx.mir_keys(()) {
1790-
if let DefKind::AssocFn | DefKind::Fn = tcx.def_kind(local_def_id) {
1791-
record_array!(self.tables.deduced_param_attrs[local_def_id.to_def_id()] <-
1792-
self.tcx.deduced_param_attrs(local_def_id.to_def_id()));
1793-
}
1794-
}
1795-
}
17961781
}
17971782

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

compiler/rustc_metadata/src/rmeta/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rustc_middle::middle::lib_features::FeatureStability;
2727
use rustc_middle::middle::resolve_bound_vars::ObjectLifetimeDefault;
2828
use rustc_middle::ty::fast_reject::SimplifiedType;
2929
use rustc_middle::ty::{
30-
self, DeducedParamAttrs, ParameterizedOverTcx, Ty, TyCtxt, UnusedGenericParams,
30+
self, ParameterizedOverTcx, Ty, TyCtxt, UnusedGenericParams,
3131
};
3232
use rustc_middle::util::Providers;
3333
use rustc_middle::{mir, trivially_parameterized_over_tcx};
@@ -463,7 +463,6 @@ define_tables! {
463463
assoc_container: Table<DefIndex, ty::AssocItemContainer>,
464464
macro_definition: Table<DefIndex, LazyValue<ast::DelimArgs>>,
465465
proc_macro: Table<DefIndex, MacroKind>,
466-
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,
467466
trait_impl_trait_tys: Table<DefIndex, LazyValue<DefIdMap<ty::EarlyBinder<'static, Ty<'static>>>>>,
468467
doc_link_resolutions: Table<DefIndex, LazyValue<DocLinkResMap>>,
469468
doc_link_traits_in_scope: Table<DefIndex, LazyArray<DefId>>,

compiler/rustc_middle/src/query/erase.rs

-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ trivial! {
300300
rustc_middle::ty::Asyncness,
301301
rustc_middle::ty::AsyncDestructor,
302302
rustc_middle::ty::BoundVariableKind,
303-
rustc_middle::ty::DeducedParamAttrs,
304303
rustc_middle::ty::Destructor,
305304
rustc_middle::ty::fast_reject::SimplifiedType,
306305
rustc_middle::ty::ImplPolarity,

compiler/rustc_middle/src/query/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -2455,11 +2455,6 @@ rustc_queries! {
24552455
return_result_from_ensure_ok
24562456
}
24572457

2458-
query deduced_param_attrs(def_id: DefId) -> &'tcx [ty::DeducedParamAttrs] {
2459-
desc { |tcx| "deducing parameter attributes for {}", tcx.def_path_str(def_id) }
2460-
separate_provide_extern
2461-
}
2462-
24632458
query doc_link_resolutions(def_id: DefId) -> &'tcx DocLinkResMap {
24642459
eval_always
24652460
desc { "resolutions for documentation links for a module" }

compiler/rustc_middle/src/query/on_disk_cache.rs

-1
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,6 @@ impl_ref_decoder! {<'tcx>
809809
rustc_span::def_id::DefId,
810810
rustc_span::def_id::LocalDefId,
811811
(rustc_middle::middle::exported_symbols::ExportedSymbol<'tcx>, rustc_middle::middle::exported_symbols::SymbolExportInfo),
812-
ty::DeducedParamAttrs,
813812
}
814813

815814
//- ENCODING -------------------------------------------------------------------

compiler/rustc_middle/src/ty/codec.rs

-1
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,6 @@ impl_arena_copy_decoder! {<'tcx>
555555
rustc_span::def_id::DefId,
556556
rustc_span::def_id::LocalDefId,
557557
(rustc_middle::middle::exported_symbols::ExportedSymbol<'tcx>, rustc_middle::middle::exported_symbols::SymbolExportInfo),
558-
ty::DeducedParamAttrs,
559558
}
560559

561560
#[macro_export]

compiler/rustc_middle/src/ty/context.rs

-16
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use rustc_hir::intravisit::VisitorExt;
3737
use rustc_hir::lang_items::LangItem;
3838
use rustc_hir::{self as hir, Attribute, HirId, Node, TraitCandidate};
3939
use rustc_index::IndexVec;
40-
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
4140
use rustc_query_system::cache::WithDepNode;
4241
use rustc_query_system::dep_graph::DepNodeIndex;
4342
use rustc_query_system::ich::StableHashingContext;
@@ -3287,21 +3286,6 @@ impl<'tcx> TyCtxt<'tcx> {
32873286
}
32883287
}
32893288

3290-
/// Parameter attributes that can only be determined by examining the body of a function instead
3291-
/// of just its signature.
3292-
///
3293-
/// These can be useful for optimization purposes when a function is directly called. We compute
3294-
/// them and store them into the crate metadata so that downstream crates can make use of them.
3295-
///
3296-
/// Right now, we only have `read_only`, but `no_capture` and `no_alias` might be useful in the
3297-
/// future.
3298-
#[derive(Clone, Copy, PartialEq, Debug, Default, TyDecodable, TyEncodable, HashStable)]
3299-
pub struct DeducedParamAttrs {
3300-
/// The parameter is marked immutable in the function and contains no `UnsafeCell` (i.e. its
3301-
/// type is freeze).
3302-
pub read_only: bool,
3303-
}
3304-
33053289
pub fn provide(providers: &mut Providers) {
33063290
providers.maybe_unused_trait_imports =
33073291
|tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports;

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub use self::consts::{
6565
Value,
6666
};
6767
pub use self::context::{
68-
CtxtInterners, CurrentGcx, DeducedParamAttrs, Feed, FreeRegionInfo, GlobalCtxt, Lift, TyCtxt,
68+
CtxtInterners, CurrentGcx, Feed, FreeRegionInfo, GlobalCtxt, Lift, TyCtxt,
6969
TyCtxtFeed, tls,
7070
};
7171
pub use self::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};

compiler/rustc_middle/src/ty/parameterized.rs

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ trivially_parameterized_over_tcx! {
6666
crate::mir::ConstQualifs,
6767
ty::AssocItemContainer,
6868
ty::Asyncness,
69-
ty::DeducedParamAttrs,
7069
ty::Generics,
7170
ty::ImplPolarity,
7271
ty::ImplTraitInTraitData,

compiler/rustc_mir_transform/src/deduce_param_attrs.rs

-196
This file was deleted.

compiler/rustc_mir_transform/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ use pass_manager::{self as pm, Lint, MirLint, MirPass, WithMinOptLevel};
4747
mod check_pointers;
4848
mod cost_checker;
4949
mod cross_crate_inline;
50-
mod deduce_param_attrs;
5150
mod elaborate_drop;
5251
mod errors;
5352
mod ffi_unwind_calls;
@@ -222,7 +221,6 @@ pub fn provide(providers: &mut Providers) {
222221
mir_callgraph_reachable: inline::cycle::mir_callgraph_reachable,
223222
mir_inliner_callees: inline::cycle::mir_inliner_callees,
224223
promoted_mir,
225-
deduced_param_attrs: deduce_param_attrs::deduced_param_attrs,
226224
coroutine_by_move_body_def_id: coroutine::coroutine_by_move_body_def_id,
227225
..providers.queries
228226
};

0 commit comments

Comments
 (0)