diff --git a/src/librustc_attr/builtin.rs b/src/librustc_attr/builtin.rs index c2b2e7ce59f37..0a6a4821e278e 100644 --- a/src/librustc_attr/builtin.rs +++ b/src/librustc_attr/builtin.rs @@ -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 { @@ -128,7 +132,7 @@ pub struct Stability { pub rustc_depr: Option, } -/// 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 { diff --git a/src/librustc_codegen_ssa/mir/constant.rs b/src/librustc_codegen_ssa/mir/constant.rs index 298aa25f0321f..d2629b771c2af 100644 --- a/src/librustc_codegen_ssa/mir/constant.rs +++ b/src/librustc_codegen_ssa/mir/constant.rs @@ -16,25 +16,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx: &mut Bx, constant: &mir::Constant<'tcx>, ) -> Result, 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( diff --git a/src/librustc_hir/hir.rs b/src/librustc_hir/hir.rs index 654cd4980a4e1..258428d77da10 100644 --- a/src/librustc_hir/hir.rs +++ b/src/librustc_hir/hir.rs @@ -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, diff --git a/src/librustc_infer/infer/region_constraints/mod.rs b/src/librustc_infer/infer/region_constraints/mod.rs index e10b0938955af..1292e96ff98e7 100644 --- a/src/librustc_infer/infer/region_constraints/mod.rs +++ b/src/librustc_infer/infer/region_constraints/mod.rs @@ -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>, @@ -687,7 +682,6 @@ impl<'tcx> RegionConstraintCollector<'tcx> { } } - /// See [`Verify::VerifyGenericBound`]. pub fn verify_generic_bound( &mut self, origin: SubregionOrigin<'tcx>, diff --git a/src/librustc_middle/mir/interpret/error.rs b/src/librustc_middle/mir/interpret/error.rs index 40454ce3b2db8..0ab14b53e1b1f 100644 --- a/src/librustc_middle/mir/interpret/error.rs +++ b/src/librustc_middle/mir/interpret/error.rs @@ -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) => {