From 6a681f5ca1ad6b37a90996353db276c8e0708285 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 1 May 2020 13:32:08 +0200 Subject: [PATCH 1/5] remove obsolete comments Referenced was removed in 8770d0f34a9bee2691517ab95803a277c453dfda --- src/librustc_infer/infer/region_constraints/mod.rs | 6 ------ 1 file changed, 6 deletions(-) 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>, From 8bdf988be21471fb56a484e7f32379e42cecc0a5 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 1 May 2020 09:30:46 -0300 Subject: [PATCH 2/5] Remove deadcode in eval_mir_constant_to_operand --- src/librustc_codegen_ssa/mir/constant.rs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) 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( From 1bab6a4db788abae8c06cfa3cb19b0027e9cd8bf Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 1 May 2020 14:39:41 +0200 Subject: [PATCH 3/5] fix Miri error message padding --- src/librustc_middle/mir/interpret/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) => { From 7a1a69911b96555396ffafe7d28a9f59912db72e Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 1 May 2020 16:35:25 +0200 Subject: [PATCH 4/5] make Stability docs a bit more readable, and fix some rustdoc warnings --- src/librustc_attr/builtin.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 { From 5f4b7a4585bd011a5b889f74170b208508b48c64 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 1 May 2020 17:53:52 +0200 Subject: [PATCH 5/5] fix doc reference Should of been in e0ce9f8c0a97e5949c9cadd220279d6969289daa, but that had a typo. --- src/librustc_hir/hir.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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,