Skip to content

Commit 7cc81d0

Browse files
committed
Fix rebase fallout
1 parent 4a04b43 commit 7cc81d0

File tree

20 files changed

+54
-976
lines changed

20 files changed

+54
-976
lines changed

src/librustc/hir/lowering.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,11 +2327,9 @@ impl<'a> LoweringContext<'a> {
23272327
}
23282328
}
23292329
GenericParamKind::Const { ref ty } => {
2330-
let mut name = self.lower_ident(param.ident);
2331-
23322330
hir::GenericParam {
23332331
id: self.lower_node_id(param.id).node_id,
2334-
name: hir::ParamName::Plain(name),
2332+
name: hir::ParamName::Plain(param.ident),
23352333
span: param.ident.span,
23362334
pure_wrt_drop: attr::contains_name(&param.attrs, "may_dangle"),
23372335
attrs: self.lower_attrs(&param.attrs),

src/librustc/infer/canonical.rs

Lines changed: 0 additions & 939 deletions
This file was deleted.

src/librustc/infer/canonical/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ pub enum CanonicalTyVarKind {
110110
/// General type variable `?T` that can be unified with arbitrary types.
111111
General,
112112

113+
/// Const type variable `?C` that can be unified with const expressions.
114+
Const,
115+
113116
/// Integral type variable `?I` (that can only be unified with integral types).
114117
Int,
115118

@@ -244,9 +247,8 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
244247
CanonicalTyVarKind::General => {
245248
self.next_ty_var(TypeVariableOrigin::MiscVariable(span))
246249
}
247-
250+
CanonicalTyVarKind::Const => self.tcx.mk_const_var(self.next_const_var_id()),
248251
CanonicalTyVarKind::Int => self.tcx.mk_int_var(self.next_int_var_id()),
249-
250252
CanonicalTyVarKind::Float => self.tcx.mk_float_var(self.next_float_var_id()),
251253
};
252254
ty.into()

src/librustc/infer/canonical/query_result.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
433433
opt_values[index] = Some(*original_value);
434434
}
435435
}
436+
UnpackedKind::Const(_) => {
437+
unimplemented!() // TODO(const_generics)
438+
}
436439
}
437440
}
438441

@@ -516,6 +519,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
516519
t1, r2,
517520
))),
518521
),
522+
523+
// TODO(const_generics): does it even make sense to specify that a const outlives something?
524+
UnpackedKind::Const(_) => unimplemented!(),
519525
}
520526
}),
521527
) as Box<dyn Iterator<Item = _>>

src/librustc/mir/interpret/value.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ pub enum ConstValue<'tcx> {
1414
/// to allow HIR creation to happen for everything before needing to be able to run constant
1515
/// evaluation
1616
Unevaluated(DefId, &'tcx Substs<'tcx>),
17+
/// A const generic parameter.
18+
Param(ty::ParamConst),
1719
/// Used only for types with layout::abi::Scalar ABI and ZSTs
1820
///
1921
/// Not using the enum `Value` to encode that this must not be `Undef`
@@ -33,6 +35,7 @@ impl<'tcx> ConstValue<'tcx> {
3335
ConstValue::Unevaluated(..) |
3436
ConstValue::ByRef(..) |
3537
ConstValue::ScalarPair(..) => None,
38+
ConstValue::Param(_) => unimplemented!(), // TODO(const_generics)
3639
ConstValue::Scalar(val) => Some(val),
3740
}
3841
}

src/librustc/ty/context.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ use ich::{StableHashingContext, NodeIdHashingMode};
2727
use infer::canonical::{CanonicalVarInfo, CanonicalVarInfos};
2828
use infer::outlives::free_region_map::FreeRegionMap;
2929
use middle::cstore::CrateStoreDyn;
30-
use middle::const_val::ConstVal;
3130
use middle::cstore::EncodedMetadata;
3231
use middle::lang_items;
3332
use middle::resolve_lifetime::{self, ObjectLifetimeDefault};
3433
use middle::stability;
3534
use mir::{self, Mir, interpret};
36-
use mir::interpret::Allocation;
35+
use mir::interpret::{Allocation, ConstValue};
3736
use ty::subst::{Kind, Substs, Subst};
3837
use ty::ReprOptions;
3938
use traits;
@@ -2555,7 +2554,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
25552554
pub fn mk_const_param(self, index: u32, name: InternedString, ty: Ty<'tcx>) -> &'tcx ty::Const<'tcx> {
25562555
debug!("mk_const_param: index={} name={:?} ty={:?}", index, name, ty);
25572556
self.mk_const(ty::Const {
2558-
val: ConstVal::Param(ParamConst { index, name }),
2557+
val: ConstValue::Param(ParamConst { index, name }),
25592558
ty,
25602559
})
25612560
}

src/librustc/ty/structural_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,15 +1143,15 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
11431143
ConstValue::Unevaluated(def_id, substs) => {
11441144
ConstValue::Unevaluated(def_id, substs.fold_with(folder))
11451145
}
1146-
ConstVal::Param(param) => ConstVal::Param(param),
1146+
ConstValue::Param(param) => ConstValue::Param(param),
11471147
}
11481148
}
11491149

11501150
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
11511151
match *self {
11521152
ConstValue::Scalar(_) |
11531153
ConstValue::ScalarPair(_, _) |
1154-
ConstVal::Param(_) | // TODO(const_generics)
1154+
ConstValue::Param(_) | // TODO(const_generics)
11551155
ConstValue::ByRef(_, _) => false,
11561156
ConstValue::Unevaluated(_, substs) => substs.visit_with(visitor),
11571157
}

src/librustc/ty/util.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use ty::subst::{Substs, UnpackedKind};
2121
use ty::query::TyCtxtAt;
2222
use ty::TyKind::*;
2323
use ty::layout::{Integer, IntegerExt};
24+
use mir::interpret::ConstValue;
2425
use util::common::ErrorReported;
25-
use middle::const_val::ConstVal;
2626
use middle::lang_items;
2727

2828
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
@@ -508,9 +508,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
508508
}) => {
509509
!impl_generics.type_param(pt, self).pure_wrt_drop
510510
}
511-
UnpackedKind::Const(&ty::Const {
512-
val: ConstVal::Param(ref pc), ..
513-
}) => {
511+
UnpackedKind::Const(&ty::Const { val: ConstValue::Param(ref pc), .. }) => {
514512
!impl_generics.const_param(pc, self).pure_wrt_drop
515513
}
516514
UnpackedKind::Lifetime(_) |

src/librustc/util/ppaux.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,12 +1284,12 @@ define_print! {
12841284
}
12851285

12861286
define_print! {
1287-
('tcx) ConstVal<'tcx>, (self, f, cx) {
1287+
('tcx) ConstValue<'tcx>, (self, f, cx) {
12881288
display {
12891289
match self {
1290-
ConstVal::Value(value) => write!(f, "{:?}", value), // TODO(const_generics)
1291-
ConstVal::Unevaluated(..) => write!(f, "_"),
1292-
ConstVal::Param(ParamConst { name, .. }) => write!(f, "{}", name),
1290+
ConstValue::Unevaluated(..) => write!(f, "_"),
1291+
ConstValue::Param(ParamConst { name, .. }) => write!(f, "{}", name),
1292+
_ => write!(f, "{:?}", self), // TODO(const_generics)
12931293
}
12941294
}
12951295
}

src/librustc_codegen_llvm/mir/operand.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ impl OperandRef<'ll, 'tcx> {
9090

9191
let val = match val.val {
9292
ConstValue::Unevaluated(..) => bug!(),
93+
ConstValue::Param(_) => unimplemented!(), // TODO(const_generics)
9394
ConstValue::Scalar(x) => {
9495
let scalar = match layout.abi {
9596
layout::Abi::Scalar(ref x) => x,

0 commit comments

Comments
 (0)