Skip to content

Commit

Permalink
Auto merge of #71759 - Dylan-DPC:rollup-5hncork, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Rollup of 5 pull requests

Successful merges:

 - #71744 (remove obsolete comment)
 - #71747 (Remove deadcode in eval_mir_constant_to_operand)
 - #71749 (fix Miri error message padding)
 - #71752 (make Stability doc a more readable (and fix rustdoc warning))
 - #71755 (fix doc reference)

Failed merges:

r? @ghost
  • Loading branch information
bors committed May 1, 2020
2 parents a91d648 + da42f68 commit 7f65393
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 30 deletions.
8 changes: 6 additions & 2 deletions src/librustc_attr/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ pub fn find_unwind_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> Op
})
}

/// Represents the #[stable], #[unstable], #[rustc_deprecated] attributes.
/// Represents the following attributes:
///
/// - `#[stable]`
/// - `#[unstable]`
/// - `#[rustc_deprecated]`
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic)]
pub struct Stability {
Expand All @@ -128,7 +132,7 @@ pub struct Stability {
pub rustc_depr: Option<RustcDeprecation>,
}

/// Represents the #[rustc_const_unstable] and #[rustc_const_stable] attributes.
/// Represents the `#[rustc_const_unstable]` and `#[rustc_const_stable]` attributes.
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic)]
pub struct ConstStability {
Expand Down
22 changes: 3 additions & 19 deletions src/librustc_codegen_ssa/mir/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
bx: &mut Bx,
constant: &mir::Constant<'tcx>,
) -> Result<OperandRef<'tcx, Bx::Value>, ErrorHandled> {
match constant.literal.val {
// Special case unevaluated statics, because statics have an identity and thus should
// use `get_static` to get at their id.
// FIXME(oli-obk): can we unify this somehow, maybe by making const eval of statics
// always produce `&STATIC`. This may also simplify how const eval works with statics.
ty::ConstKind::Unevaluated(def_id, substs, None) if self.cx.tcx().is_static(def_id) => {
assert!(substs.is_empty(), "we don't support generic statics yet");
let static_ = bx.get_static(def_id);
// we treat operands referring to statics as if they were `&STATIC` instead
let ptr_ty = self.cx.tcx().mk_mut_ptr(self.monomorphize(&constant.literal.ty));
let layout = bx.layout_of(ptr_ty);
Ok(OperandRef::from_immediate_or_packed_pair(bx, static_, layout))
}
_ => {
let val = self.eval_mir_constant(constant)?;
let ty = self.monomorphize(&constant.literal.ty);
Ok(OperandRef::from_const(bx, val, ty))
}
}
let val = self.eval_mir_constant(constant)?;
let ty = self.monomorphize(&constant.literal.ty);
Ok(OperandRef::from_const(bx, val, ty))
}

pub fn eval_mir_constant(
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_hir/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,7 @@ pub struct Param<'hir> {
pub struct FnDecl<'hir> {
/// The types of the function's parameters.
///
/// Additional argument data is stored in the function's [body](Body::parameters).
/// Additional argument data is stored in the function's [body](Body::params).
pub inputs: &'hir [Ty<'hir>],
pub output: FnRetTy<'hir>,
pub c_variadic: bool,
Expand Down
6 changes: 0 additions & 6 deletions src/librustc_infer/infer/region_constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ impl Constraint<'_> {
}
}

/// `VerifyGenericBound(T, _, R, RS)`: the parameter type `T` (or
/// associated type) must outlive the region `R`. `T` is known to
/// outlive `RS`. Therefore, verify that `R <= RS[i]` for some
/// `i`. Inference variables may be involved (but this verification
/// step doesn't influence inference).
#[derive(Debug, Clone)]
pub struct Verify<'tcx> {
pub kind: GenericKind<'tcx>,
Expand Down Expand Up @@ -687,7 +682,6 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
}
}

/// See [`Verify::VerifyGenericBound`].
pub fn verify_generic_bound(
&mut self,
origin: SubregionOrigin<'tcx>,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_middle/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@ impl fmt::Display for UndefinedBehaviorInfo {
DerefFunctionPointer(a) => write!(f, "accessing {} which contains a function", a),
ValidationFailure(ref err) => write!(f, "type validation failed: {}", err),
InvalidBool(b) => {
write!(f, "interpreting an invalid 8-bit value as a bool: 0x{:2x}", b)
write!(f, "interpreting an invalid 8-bit value as a bool: 0x{:02x}", b)
}
InvalidChar(c) => {
write!(f, "interpreting an invalid 32-bit value as a char: 0x{:8x}", c)
write!(f, "interpreting an invalid 32-bit value as a char: 0x{:08x}", c)
}
InvalidDiscriminant(val) => write!(f, "enum value has invalid discriminant: {}", val),
InvalidFunctionPointer(p) => {
Expand Down

0 comments on commit 7f65393

Please sign in to comment.