Skip to content

Commit 7f65393

Browse files
committed
Auto merge of #71759 - Dylan-DPC:rollup-5hncork, r=Dylan-DPC
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
2 parents a91d648 + da42f68 commit 7f65393

File tree

5 files changed

+12
-30
lines changed

5 files changed

+12
-30
lines changed

src/librustc_attr/builtin.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ pub fn find_unwind_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> Op
119119
})
120120
}
121121

122-
/// Represents the #[stable], #[unstable], #[rustc_deprecated] attributes.
122+
/// Represents the following attributes:
123+
///
124+
/// - `#[stable]`
125+
/// - `#[unstable]`
126+
/// - `#[rustc_deprecated]`
123127
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
124128
#[derive(HashStable_Generic)]
125129
pub struct Stability {
@@ -128,7 +132,7 @@ pub struct Stability {
128132
pub rustc_depr: Option<RustcDeprecation>,
129133
}
130134

131-
/// Represents the #[rustc_const_unstable] and #[rustc_const_stable] attributes.
135+
/// Represents the `#[rustc_const_unstable]` and `#[rustc_const_stable]` attributes.
132136
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
133137
#[derive(HashStable_Generic)]
134138
pub struct ConstStability {

src/librustc_codegen_ssa/mir/constant.rs

+3-19
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1616
bx: &mut Bx,
1717
constant: &mir::Constant<'tcx>,
1818
) -> Result<OperandRef<'tcx, Bx::Value>, ErrorHandled> {
19-
match constant.literal.val {
20-
// Special case unevaluated statics, because statics have an identity and thus should
21-
// use `get_static` to get at their id.
22-
// FIXME(oli-obk): can we unify this somehow, maybe by making const eval of statics
23-
// always produce `&STATIC`. This may also simplify how const eval works with statics.
24-
ty::ConstKind::Unevaluated(def_id, substs, None) if self.cx.tcx().is_static(def_id) => {
25-
assert!(substs.is_empty(), "we don't support generic statics yet");
26-
let static_ = bx.get_static(def_id);
27-
// we treat operands referring to statics as if they were `&STATIC` instead
28-
let ptr_ty = self.cx.tcx().mk_mut_ptr(self.monomorphize(&constant.literal.ty));
29-
let layout = bx.layout_of(ptr_ty);
30-
Ok(OperandRef::from_immediate_or_packed_pair(bx, static_, layout))
31-
}
32-
_ => {
33-
let val = self.eval_mir_constant(constant)?;
34-
let ty = self.monomorphize(&constant.literal.ty);
35-
Ok(OperandRef::from_const(bx, val, ty))
36-
}
37-
}
19+
let val = self.eval_mir_constant(constant)?;
20+
let ty = self.monomorphize(&constant.literal.ty);
21+
Ok(OperandRef::from_const(bx, val, ty))
3822
}
3923

4024
pub fn eval_mir_constant(

src/librustc_hir/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@ pub struct Param<'hir> {
20502050
pub struct FnDecl<'hir> {
20512051
/// The types of the function's parameters.
20522052
///
2053-
/// Additional argument data is stored in the function's [body](Body::parameters).
2053+
/// Additional argument data is stored in the function's [body](Body::params).
20542054
pub inputs: &'hir [Ty<'hir>],
20552055
pub output: FnRetTy<'hir>,
20562056
pub c_variadic: bool,

src/librustc_infer/infer/region_constraints/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,6 @@ impl Constraint<'_> {
147147
}
148148
}
149149

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

690-
/// See [`Verify::VerifyGenericBound`].
691685
pub fn verify_generic_bound(
692686
&mut self,
693687
origin: SubregionOrigin<'tcx>,

src/librustc_middle/mir/interpret/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,10 @@ impl fmt::Display for UndefinedBehaviorInfo {
439439
DerefFunctionPointer(a) => write!(f, "accessing {} which contains a function", a),
440440
ValidationFailure(ref err) => write!(f, "type validation failed: {}", err),
441441
InvalidBool(b) => {
442-
write!(f, "interpreting an invalid 8-bit value as a bool: 0x{:2x}", b)
442+
write!(f, "interpreting an invalid 8-bit value as a bool: 0x{:02x}", b)
443443
}
444444
InvalidChar(c) => {
445-
write!(f, "interpreting an invalid 32-bit value as a char: 0x{:8x}", c)
445+
write!(f, "interpreting an invalid 32-bit value as a char: 0x{:08x}", c)
446446
}
447447
InvalidDiscriminant(val) => write!(f, "enum value has invalid discriminant: {}", val),
448448
InvalidFunctionPointer(p) => {

0 commit comments

Comments
 (0)