initial cleanup

This commit is contained in:
Bastian Kauschke 2020-05-05 17:57:23 +02:00
parent 93d15b9480
commit c3a0cba1c1
7 changed files with 11 additions and 8 deletions

View File

@ -558,7 +558,7 @@ declare_features! (
/// Allow negative trait implementations.
(active, negative_impls, "1.44.0", Some(68318), None),
/// Lazily evaluate constants. Which allows constants to depend on type parameters.
(active, lazy_normalization_consts, "1.44.0", Some(60471), None),

View File

@ -595,8 +595,8 @@ where
b = self.infcx.shallow_resolve(b);
}
match (a.val, b.val) {
(_, ty::ConstKind::Infer(InferConst::Var(_))) if D::forbid_inference_vars() => {
match b.val {
ty::ConstKind::Infer(InferConst::Var(_)) if D::forbid_inference_vars() => {
// Forbid inference variables in the RHS.
bug!("unexpected inference var {:?}", b)
}

View File

@ -870,7 +870,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
instrument_mcount: bool = (false, parse_bool, [TRACKED],
"insert function instrument code for mcount-based tracing (default: no)"),
keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
"lazily evaluate constants (experimental)"),
"keep hygiene data after analysis (default: no)"),
link_native_libraries: bool = (true, parse_bool, [UNTRACKED],
"link native libraries in the linker invocation (default: yes)"),
link_only: bool = (false, parse_bool, [TRACKED],

View File

@ -616,7 +616,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
)
}
ty::Predicate::ConstEquate(..) => {
// Errors for `ConstEquate` predicates show up as
// `SelectionError::ConstEvalFailure`,

View File

@ -539,7 +539,10 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
Ok(val) => Ok(Const::from_value(self.selcx.tcx(), val, c.ty)),
Err(ErrorHandled::TooGeneric) => {
stalled_on.append(
&mut substs.types().filter_map(|ty| TyOrConstInferVar::maybe_from_ty(ty)).collect(),
&mut substs
.types()
.filter_map(|ty| TyOrConstInferVar::maybe_from_ty(ty))
.collect(),
);
Err(ProcessResult::Unchanged)
}

View File

@ -17,7 +17,8 @@ use rustc_errors::{Applicability, FatalError};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_middle::ty::subst::{GenericArg, InternalSubsts, Subst};
use rustc_middle::ty::{self, Predicate, ToPredicate, Ty, TyCtxt, TypeFoldable, TypeVisitor, WithConstness};
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeVisitor, WithConstness};
use rustc_middle::ty::{Predicate, ToPredicate};
use rustc_session::lint::builtin::WHERE_CLAUSES_OBJECT_SAFETY;
use rustc_span::symbol::Symbol;
use rustc_span::Span;

View File

@ -1168,7 +1168,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
Node::AnonConst(_) => {
if tcx.features().lazy_normalization_consts {
let parent_id = tcx.hir().get_parent_item(hir_id);
Some(tcx.hir().local_def_id(parent_id))
Some(tcx.hir().local_def_id(parent_id).to_def_id())
} else {
None
}