Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
04db063
Don't build the library and standard library before documenting them
jyn514 Sep 5, 2021
76e09eb
Do not unshallow -- already done by other code
Mark-Simulacrum Sep 6, 2021
c9d46eb
Rework DepthFirstSearch API
nikomatsakis Nov 23, 2020
2987f4b
WIP state
BoxyUwU Sep 6, 2021
9b29138
as casts and block exprs
BoxyUwU Sep 6, 2021
4483c2b
dont support blocks
BoxyUwU Sep 6, 2021
47b16f4
bless stderr
BoxyUwU Sep 6, 2021
c170dcf
tidy
BoxyUwU Sep 6, 2021
08e8644
move thir visitor to rustc_middle
BoxyUwU Sep 6, 2021
fc63e9a
dont build abstract const for monomorphic consts
BoxyUwU Sep 6, 2021
4cbcb09
handle `ExprKind::NeverToAny`
BoxyUwU Sep 6, 2021
1f57f8b
remove `WorkNode`
BoxyUwU Sep 6, 2021
15101c8
remove debug stmts
BoxyUwU Sep 7, 2021
406d2ab
rename mir -> thir around abstract consts
BoxyUwU Sep 7, 2021
79be080
remove comment
BoxyUwU Sep 7, 2021
955e2b2
nits
BoxyUwU Sep 7, 2021
8c7954d
add a `CastKind` to `Node::Cast`
BoxyUwU Sep 7, 2021
3212734
resolve `from_hir_call` FIXME
BoxyUwU Sep 7, 2021
cd2915e
fmt
BoxyUwU Sep 7, 2021
fd9bb30
CI please
BoxyUwU Sep 7, 2021
c86c634
Allow missing code examples in trait impls.
hnj2 Sep 8, 2021
8295e4a
add test for builtin types N + N unifying with fn call
BoxyUwU Sep 9, 2021
44e6f2e
Remove unnecessary `Cache.*_did` fields
camelid Aug 22, 2021
294510e
rustc: Remove local variable IDs from `Export`s
petrochenkov Sep 5, 2021
03f9fe2
explicitly link to external `ena` docs
lcnr Sep 11, 2021
df281ee
Only take `tcx` when it's all that's needed
camelid Aug 27, 2021
0bb1c28
rustdoc: Get symbol for `TyParam` directly
camelid Aug 23, 2021
6a84d34
Create a valid `Res` in `external_path()`
camelid Aug 24, 2021
c2207f5
Remove unused `hir_id` parameter from `resolve_type`
camelid Aug 27, 2021
5321b35
Fix redundant arguments in `external_path()`
camelid Sep 11, 2021
913764d
Remove unnecessary `is_trait` argument
camelid Sep 11, 2021
280fc2d
rustdoc: Cleanup a pattern match in `external_generic_args()`
camelid Sep 11, 2021
f00af15
Rollup merge of #88675 - jyn514:faster-doc, r=Mark-Simulacrum
Manishearth Sep 12, 2021
68bb06a
Rollup merge of #88677 - petrochenkov:exportid, r=davidtwco
Manishearth Sep 12, 2021
ae14fc4
Rollup merge of #88699 - Mark-Simulacrum:fixes-cherry-picker, r=pietr…
Manishearth Sep 12, 2021
4972d14
Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnr
Manishearth Sep 12, 2021
543b8c0
Rollup merge of #88711 - Mark-Simulacrum:fix-dfs-bug, r=jackh726
Manishearth Sep 12, 2021
c134e96
Rollup merge of #88745 - hnj2:allow-trait-impl-missing-code, r=Guilla…
Manishearth Sep 12, 2021
49a7f5f
Rollup merge of #88810 - camelid:cleanup-pt1, r=jyn514
Manishearth Sep 12, 2021
d6b179b
Rollup merge of #88813 - lcnr:ena-docs, r=jyn514
Manishearth Sep 12, 2021
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename mir -> thir around abstract consts
  • Loading branch information
BoxyUwU committed Sep 9, 2021
commit 406d2ab95de0e90f45e00f6c1be1e4e7912aa153
9 changes: 5 additions & 4 deletions compiler/rustc_metadata/src/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use rustc_middle::middle::cstore::{ForeignModule, LinkagePreference, NativeLib};
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
use rustc_middle::mir::{self, Body, Promoted};
use rustc_middle::thir;
use rustc_middle::ty::codec::TyDecoder;
use rustc_middle::ty::{self, Ty, TyCtxt, Visibility};
use rustc_serialize::{opaque, Decodable, Decoder};
Expand Down Expand Up @@ -540,7 +541,7 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span {
}
}

impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] {
impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] {
fn decode(d: &mut DecodeContext<'a, 'tcx>) -> Result<Self, String> {
ty::codec::RefDecodable::decode(d)
}
Expand Down Expand Up @@ -1198,14 +1199,14 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
.decode((self, tcx))
}

fn get_mir_abstract_const(
fn get_thir_abstract_const(
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex,
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
self.root
.tables
.mir_abstract_consts
.thir_abstract_consts
.get(self, id)
.map_or(Ok(None), |v| Ok(Some(v.decode((self, tcx)))))
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
optimized_mir => { tcx.arena.alloc(cdata.get_optimized_mir(tcx, def_id.index)) }
mir_for_ctfe => { tcx.arena.alloc(cdata.get_mir_for_ctfe(tcx, def_id.index)) }
promoted_mir => { tcx.arena.alloc(cdata.get_promoted_mir(tcx, def_id.index)) }
mir_abstract_const => { cdata.get_mir_abstract_const(tcx, def_id.index) }
thir_abstract_const => { cdata.get_thir_abstract_const(tcx, def_id.index) }
unused_generic_params => { cdata.get_unused_generic_params(def_id.index) }
const_param_default => { tcx.mk_const(cdata.get_const_param_default(tcx, def_id.index)) }
mir_const_qualif => { cdata.mir_const_qualif(def_id.index) }
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use rustc_middle::middle::exported_symbols::{
metadata_symbol_name, ExportedSymbol, SymbolExportLevel,
};
use rustc_middle::mir::interpret;
use rustc_middle::thir;
use rustc_middle::traits::specialization_graph;
use rustc_middle::ty::codec::TyEncoder;
use rustc_middle::ty::{self, SymbolName, Ty, TyCtxt};
Expand Down Expand Up @@ -344,7 +345,7 @@ impl<'a, 'tcx> TyEncoder<'tcx> for EncodeContext<'a, 'tcx> {
}
}

impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] {
impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] {
fn encode(&self, s: &mut EncodeContext<'a, 'tcx>) -> opaque::EncodeResult {
(**self).encode(s)
}
Expand Down Expand Up @@ -1304,9 +1305,10 @@ impl EncodeContext<'a, 'tcx> {
if encode_const {
record!(self.tables.mir_for_ctfe[def_id.to_def_id()] <- self.tcx.mir_for_ctfe(def_id));

let abstract_const = self.tcx.mir_abstract_const(def_id);
// FIXME this feels wrong to have in `encode_mir`
let abstract_const = self.tcx.thir_abstract_const(def_id);
if let Ok(Some(abstract_const)) = abstract_const {
record!(self.tables.mir_abstract_consts[def_id.to_def_id()] <- abstract_const);
record!(self.tables.thir_abstract_consts[def_id.to_def_id()] <- abstract_const);
}
}
record!(self.tables.promoted_mir[def_id.to_def_id()] <- self.tcx.promoted_mir(def_id));
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_metadata/src/rmeta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use rustc_middle::hir::exports::Export;
use rustc_middle::middle::cstore::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib};
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
use rustc_middle::mir;
use rustc_middle::thir;
use rustc_middle::ty::{self, ReprOptions, Ty};
use rustc_serialize::opaque::Encoder;
use rustc_session::config::SymbolManglingVersion;
Expand Down Expand Up @@ -305,7 +306,7 @@ define_tables! {
mir: Table<DefIndex, Lazy!(mir::Body<'tcx>)>,
mir_for_ctfe: Table<DefIndex, Lazy!(mir::Body<'tcx>)>,
promoted_mir: Table<DefIndex, Lazy!(IndexVec<mir::Promoted, mir::Body<'tcx>>)>,
mir_abstract_consts: Table<DefIndex, Lazy!(&'tcx [mir::abstract_const::Node<'tcx>])>,
thir_abstract_consts: Table<DefIndex, Lazy!(&'tcx [thir::abstract_const::Node<'tcx>])>,
const_defaults: Table<DefIndex, Lazy<rustc_middle::ty::Const<'tcx>>>,
unused_generic_params: Table<DefIndex, Lazy<FiniteBitSet<u32>>>,
// `def_keys` and `def_path_hashes` represent a lazy version of a
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ use self::graph_cyclic_cache::GraphIsCyclicCache;
use self::predecessors::{PredecessorCache, Predecessors};
pub use self::query::*;

pub mod abstract_const;
pub mod coverage;
mod generic_graph;
pub mod generic_graphviz;
Expand Down
9 changes: 5 additions & 4 deletions compiler/rustc_middle/src/mir/query.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Values computed by queries that use MIR.

use crate::mir::{abstract_const, Body, Promoted};
use crate::mir::{Body, Promoted};
use crate::thir::abstract_const;
use crate::ty::{self, Ty, TyCtxt};
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::vec_map::VecMap;
Expand Down Expand Up @@ -433,14 +434,14 @@ impl<'tcx> TyCtxt<'tcx> {
}

#[inline]
pub fn mir_abstract_const_opt_const_arg(
pub fn thir_abstract_const_opt_const_arg(
self,
def: ty::WithOptConstParam<DefId>,
) -> Result<Option<&'tcx [abstract_const::Node<'tcx>]>, ErrorReported> {
if let Some((did, param_did)) = def.as_const_arg() {
self.mir_abstract_const_of_const_arg((did, param_did))
self.thir_abstract_const_of_const_arg((did, param_did))
} else {
self.mir_abstract_const(def.did)
self.thir_abstract_const(def.did)
}
}
}
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,17 @@ rustc_queries! {
}

/// Try to build an abstract representation of the given constant.
query mir_abstract_const(
query thir_abstract_const(
key: DefId
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
desc {
|tcx| "building an abstract representation for {}", tcx.def_path_str(key),
}
}
/// Try to build an abstract representation of the given constant.
query mir_abstract_const_of_const_arg(
query thir_abstract_const_of_const_arg(
key: (LocalDefId, DefId)
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
desc {
|tcx|
"building an abstract representation for the const argument {}",
Expand Down
Loading