From 01b3637f6e9c01c003f8d9f9bba6d4a6e3c780a9 Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Sat, 11 Apr 2020 10:23:33 +0200 Subject: [PATCH 1/6] coerce documentation --- src/librustc_infer/infer/at.rs | 1 - src/librustc_typeck/check/coercion.rs | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustc_infer/infer/at.rs b/src/librustc_infer/infer/at.rs index 5c62a1298b97b..d44b8f554143c 100644 --- a/src/librustc_infer/infer/at.rs +++ b/src/librustc_infer/infer/at.rs @@ -186,7 +186,6 @@ impl<'a, 'tcx> At<'a, 'tcx> { impl<'a, 'tcx> Trace<'a, 'tcx> { /// Makes `a <: b` where `a` may or may not be expected (if /// `a_is_expected` is true, then `a` is expected). - /// Makes `expected <: actual`. pub fn sub(self, a: &T, b: &T) -> InferResult<'tcx, ()> where T: Relate<'tcx>, diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 5d1a1a164855d..e3b16eaaef2a2 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -107,6 +107,7 @@ fn coerce_mutbls<'tcx>( } } +/// Do not require any adjustments, i.e. coerce `x -> x`. fn identity(_: Ty<'_>) -> Vec> { vec![] } @@ -115,6 +116,7 @@ fn simple(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec> move |target| vec![Adjustment { kind, target }] } +/// This always returns `Ok(...)`. fn success<'tcx>( adj: Vec>, target: Ty<'tcx>, @@ -133,6 +135,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { } pub fn unify(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> { + debug!("unify(a: {:?}, b: {:?}, use_lub: {})", a, b, self.use_lub); self.commit_if_ok(|_| { if self.use_lub { self.at(&self.cause, self.fcx.param_env).lub(b, a) From a08bccb3c142fb98193eed202dbdde85386dd91a Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Sat, 11 Apr 2020 18:05:02 +0200 Subject: [PATCH 2/6] handle ByRef in relate --- src/librustc_middle/ty/relate.rs | 36 +++++++++++++++++-- src/test/ui/const-generics/different_byref.rs | 11 ++++++ .../ui/const-generics/different_byref.stderr | 20 +++++++++++ .../const-generics/issues/issue-68615-adt.rs | 11 ++++++ .../issues/issue-68615-array.rs | 11 ++++++ 5 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/const-generics/different_byref.rs create mode 100644 src/test/ui/const-generics/different_byref.stderr create mode 100644 src/test/ui/const-generics/issues/issue-68615-adt.rs create mode 100644 src/test/ui/const-generics/issues/issue-68615-array.rs diff --git a/src/librustc_middle/ty/relate.rs b/src/librustc_middle/ty/relate.rs index f4f0b6c41b92f..4bfa46367d0c4 100644 --- a/src/librustc_middle/ty/relate.rs +++ b/src/librustc_middle/ty/relate.rs @@ -11,6 +11,7 @@ use crate::ty::subst::{GenericArg, GenericArgKind, SubstsRef}; use crate::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc_hir as ast; use rustc_hir::def_id::DefId; +use rustc_span::DUMMY_SP; use rustc_target::spec::abi; use std::iter; use std::rc::Rc; @@ -507,6 +508,7 @@ pub fn super_relate_consts>( a: &'tcx ty::Const<'tcx>, b: &'tcx ty::Const<'tcx>, ) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> { + debug!("{}.super_relate_consts(a = {:?}, b = {:?})", relation.tag(), a, b); let tcx = relation.tcx(); let eagerly_eval = |x: &'tcx ty::Const<'tcx>| { @@ -561,7 +563,7 @@ pub fn super_relate_consts>( } } - (a_val @ ConstValue::Slice { .. }, b_val @ ConstValue::Slice { .. }) => { + (ConstValue::Slice { .. }, ConstValue::Slice { .. }) => { let a_bytes = get_slice_bytes(&tcx, a_val); let b_bytes = get_slice_bytes(&tcx, b_val); if a_bytes == b_bytes { @@ -571,7 +573,37 @@ pub fn super_relate_consts>( } } - // FIXME(const_generics): handle `ConstValue::ByRef`. + (ConstValue::ByRef { .. }, ConstValue::ByRef { .. }) => { + match a.ty.kind { + ty::Array(..) | ty::Adt(..) | ty::Tuple(..) => { + let a_destructured = tcx.destructure_const(relation.param_env().and(a)); + let b_destructured = tcx.destructure_const(relation.param_env().and(b)); + + // Both the variant and each field have to be equal. + if a_destructured.variant == b_destructured.variant { + for (a_field, b_field) in + a_destructured.fields.iter().zip(b_destructured.fields.iter()) + { + relation.consts(a_field, b_field)?; + } + + Ok(a_val) + } else { + Err(TypeError::ConstMismatch(expected_found(relation, &a, &b))) + } + } + // FIXME(const_generics): There are probably some `TyKind`s + // which should be handled here. + _ => { + tcx.sess.delay_span_bug( + DUMMY_SP, + &format!("unexpected consts: a: {:?}, b: {:?}", a, b), + ); + Err(TypeError::ConstMismatch(expected_found(relation, &a, &b))) + } + } + } + _ => Err(TypeError::ConstMismatch(expected_found(relation, &a, &b))), }; diff --git a/src/test/ui/const-generics/different_byref.rs b/src/test/ui/const-generics/different_byref.rs new file mode 100644 index 0000000000000..c52a5b8061dbf --- /dev/null +++ b/src/test/ui/const-generics/different_byref.rs @@ -0,0 +1,11 @@ +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +struct Const {} + +fn main() { + let mut x = Const::<{ [3] }> {}; + x = Const::<{ [4] }> {}; + //~^ ERROR mismatched types + +} diff --git a/src/test/ui/const-generics/different_byref.stderr b/src/test/ui/const-generics/different_byref.stderr new file mode 100644 index 0000000000000..9ea2aace89aae --- /dev/null +++ b/src/test/ui/const-generics/different_byref.stderr @@ -0,0 +1,20 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/different_byref.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + +error[E0308]: mismatched types + --> $DIR/different_byref.rs:8:9 + | +LL | x = Const::<{ [4] }> {}; + | ^^^^^^^^^^^^^^^^^^^ expected `3usize`, found `4usize` + | + = note: expected struct `Const<[3usize]>` + found struct `Const<[4usize]>` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/issues/issue-68615-adt.rs b/src/test/ui/const-generics/issues/issue-68615-adt.rs new file mode 100644 index 0000000000000..140bb28ec5a4f --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-68615-adt.rs @@ -0,0 +1,11 @@ +// check-pass +#![feature(const_generics)] +#![allow(incomplete_features)] + +struct Const {} +type MyConst = Const<{ [] }>; + +fn main() { + let _x = Const::<{ [] }> {}; + let _y = MyConst {}; +} diff --git a/src/test/ui/const-generics/issues/issue-68615-array.rs b/src/test/ui/const-generics/issues/issue-68615-array.rs new file mode 100644 index 0000000000000..c384bc1e36d02 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-68615-array.rs @@ -0,0 +1,11 @@ +// check-pass +#![feature(const_generics)] +#![allow(incomplete_features)] + +struct Foo {} + +type MyFoo = Foo<{ [] }>; + +fn main() { + let _ = Foo::<{ [] }> {}; +} From 30b32c6570ded694362e21fc35101c106c4cd8b8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 30 Apr 2020 18:24:43 +0200 Subject: [PATCH 3/6] Miri: port error backtraces to std::backtrace --- Cargo.lock | 1 - src/librustc_middle/Cargo.toml | 1 - src/librustc_middle/lib.rs | 1 + src/librustc_middle/mir/interpret/error.rs | 20 +++++++++----------- src/librustc_mir/const_eval/error.rs | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8db306ffd5455..c8639a933f15d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3977,7 +3977,6 @@ name = "rustc_middle" version = "0.0.0" dependencies = [ "arena", - "backtrace", "bitflags", "byteorder", "log", diff --git a/src/librustc_middle/Cargo.toml b/src/librustc_middle/Cargo.toml index 8e27e03ea4ffe..398ba4d72d449 100644 --- a/src/librustc_middle/Cargo.toml +++ b/src/librustc_middle/Cargo.toml @@ -30,7 +30,6 @@ rustc_index = { path = "../librustc_index" } rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_ast = { path = "../librustc_ast" } rustc_span = { path = "../librustc_span" } -backtrace = "0.3.40" byteorder = { version = "1.3" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } measureme = "0.7.1" diff --git a/src/librustc_middle/lib.rs b/src/librustc_middle/lib.rs index 4ed03fd21ad18..9b38b43c93ae2 100644 --- a/src/librustc_middle/lib.rs +++ b/src/librustc_middle/lib.rs @@ -23,6 +23,7 @@ //! This API is completely unstable and subject to change. #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] +#![feature(backtrace)] #![feature(bool_to_option)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/librustc_middle/mir/interpret/error.rs b/src/librustc_middle/mir/interpret/error.rs index e6557c9fbd59d..32576b6bbb366 100644 --- a/src/librustc_middle/mir/interpret/error.rs +++ b/src/librustc_middle/mir/interpret/error.rs @@ -6,7 +6,6 @@ use crate::ty::query::TyCtxtAt; use crate::ty::tls; use crate::ty::{self, layout, Ty}; -use backtrace::Backtrace; use rustc_data_structures::sync::Lock; use rustc_errors::{struct_span_err, DiagnosticBuilder, ErrorReported}; use rustc_hir as hir; @@ -15,7 +14,7 @@ use rustc_macros::HashStable; use rustc_session::CtfeBacktrace; use rustc_span::{def_id::DefId, Pos, Span}; use rustc_target::abi::{Align, Size}; -use std::{any::Any, fmt, mem}; +use std::{any::Any, backtrace::Backtrace, fmt, mem}; #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, RustcEncodable, RustcDecodable)] pub enum ErrorHandled { @@ -219,16 +218,15 @@ impl fmt::Display for InterpErrorInfo<'_> { } impl InterpErrorInfo<'_> { - pub fn print_backtrace(&mut self) { - if let Some(ref mut backtrace) = self.backtrace { - print_backtrace(&mut *backtrace); + pub fn print_backtrace(&self) { + if let Some(backtrace) = self.backtrace.as_ref() { + print_backtrace(backtrace); } } } -fn print_backtrace(backtrace: &mut Backtrace) { - backtrace.resolve(); - eprintln!("\n\nAn error occurred in miri:\n{:?}", backtrace); +fn print_backtrace(backtrace: &Backtrace) { + eprintln!("\n\nAn error occurred in miri:\n{}", backtrace); } impl From for InterpErrorInfo<'_> { @@ -255,11 +253,11 @@ impl<'tcx> From> for InterpErrorInfo<'tcx> { let backtrace = match capture_backtrace { CtfeBacktrace::Disabled => None, - CtfeBacktrace::Capture => Some(Box::new(Backtrace::new_unresolved())), + CtfeBacktrace::Capture => Some(Box::new(Backtrace::force_capture())), CtfeBacktrace::Immediate => { // Print it now. - let mut backtrace = Backtrace::new_unresolved(); - print_backtrace(&mut backtrace); + let backtrace = Backtrace::force_capture(); + print_backtrace(&backtrace); None } }; diff --git a/src/librustc_mir/const_eval/error.rs b/src/librustc_mir/const_eval/error.rs index 3c3618f390c61..b165a69433db1 100644 --- a/src/librustc_mir/const_eval/error.rs +++ b/src/librustc_mir/const_eval/error.rs @@ -52,7 +52,7 @@ impl Error for ConstEvalErrKind {} /// Should be called only if the error is actually going to to be reported! pub fn error_to_const_error<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>>( ecx: &InterpCx<'mir, 'tcx, M>, - mut error: InterpErrorInfo<'tcx>, + error: InterpErrorInfo<'tcx>, ) -> ConstEvalErr<'tcx> { error.print_backtrace(); let stacktrace = ecx.generate_stacktrace(); From d0a746ecfae82c30cc9e440449fa6bd340305216 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 1 May 2020 11:33:21 +0200 Subject: [PATCH 4/6] remove AllocId generalization of Pointer --- src/librustc_middle/mir/interpret/pointer.rs | 16 ++++++---------- src/librustc_middle/mir/interpret/value.rs | 12 ++++++------ src/librustc_mir/interpret/eval_context.rs | 10 +++++----- src/librustc_mir/interpret/operand.rs | 14 +++++++------- src/librustc_mir/interpret/place.rs | 20 +++++++++----------- 5 files changed, 33 insertions(+), 39 deletions(-) diff --git a/src/librustc_middle/mir/interpret/pointer.rs b/src/librustc_middle/mir/interpret/pointer.rs index 7119cc58087f8..848c7fe61d4d7 100644 --- a/src/librustc_middle/mir/interpret/pointer.rs +++ b/src/librustc_middle/mir/interpret/pointer.rs @@ -101,18 +101,14 @@ pub trait PointerArithmetic: HasDataLayout { impl PointerArithmetic for T {} -/// `Pointer` is generic over the type that represents a reference to `Allocation`s, -/// thus making it possible for the most convenient representation to be used in -/// each context. +/// Represents a pointer in the Miri engine. /// -/// Defaults to the index based and loosely coupled `AllocId`. -/// -/// `Pointer` is also generic over the `Tag` associated with each pointer, +/// `Pointer` is generic over the `Tag` associated with each pointer, /// which is used to do provenance tracking during execution. #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)] #[derive(HashStable)] -pub struct Pointer { - pub alloc_id: Id, +pub struct Pointer { + pub alloc_id: AllocId, pub offset: Size, pub tag: Tag, } @@ -123,7 +119,7 @@ static_assert_size!(Pointer, 16); // all the Miri types. // We have to use `Debug` output for the tag, because `()` does not implement // `Display` so we cannot specialize that. -impl fmt::Debug for Pointer { +impl fmt::Debug for Pointer { default fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if f.alternate() { write!(f, "{:#?}+0x{:x}[{:?}]", self.alloc_id, self.offset.bytes(), self.tag) @@ -133,7 +129,7 @@ impl fmt::Debug for Pointer { } } // Specialization for no tag -impl fmt::Debug for Pointer<(), Id> { +impl fmt::Debug for Pointer<()> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if f.alternate() { write!(f, "{:#?}+0x{:x}", self.alloc_id, self.offset.bytes()) diff --git a/src/librustc_middle/mir/interpret/value.rs b/src/librustc_middle/mir/interpret/value.rs index 0df8a9aa9b040..ed779d52fb50c 100644 --- a/src/librustc_middle/mir/interpret/value.rs +++ b/src/librustc_middle/mir/interpret/value.rs @@ -89,7 +89,7 @@ impl<'tcx> ConstValue<'tcx> { /// of a simple value or a pointer into another `Allocation` #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)] #[derive(HashStable)] -pub enum Scalar { +pub enum Scalar { /// The raw bytes of a simple value. Raw { /// The first `size` bytes of `data` are the value. @@ -101,7 +101,7 @@ pub enum Scalar { /// A pointer into an `Allocation`. An `Allocation` in the `memory` module has a list of /// relocations, but a `Scalar` is only large enough to contain one, so we just represent the /// relocation and its associated offset together as a `Pointer` here. - Ptr(Pointer), + Ptr(Pointer), } #[cfg(target_arch = "x86_64")] @@ -109,7 +109,7 @@ static_assert_size!(Scalar, 24); // We want the `Debug` output to be readable as it is used by `derive(Debug)` for // all the Miri types. -impl fmt::Debug for Scalar { +impl fmt::Debug for Scalar { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Scalar::Ptr(ptr) => write!(f, "{:?}", ptr), @@ -542,8 +542,8 @@ impl From> for Scalar { } #[derive(Clone, Copy, Eq, PartialEq, RustcEncodable, RustcDecodable, HashStable, Hash)] -pub enum ScalarMaybeUndef { - Scalar(Scalar), +pub enum ScalarMaybeUndef { + Scalar(Scalar), Undef, } @@ -563,7 +563,7 @@ impl From> for ScalarMaybeUndef { // We want the `Debug` output to be readable as it is used by `derive(Debug)` for // all the Miri types. -impl fmt::Debug for ScalarMaybeUndef { +impl fmt::Debug for ScalarMaybeUndef { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { ScalarMaybeUndef::Undef => write!(f, ""), diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 82e1984e4623d..f668bafe0803f 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -11,7 +11,7 @@ use rustc_macros::HashStable; use rustc_middle::ich::StableHashingContext; use rustc_middle::mir; use rustc_middle::mir::interpret::{ - sign_extend, truncate, AllocId, FrameInfo, GlobalId, InterpResult, Pointer, Scalar, + sign_extend, truncate, FrameInfo, GlobalId, InterpResult, Pointer, Scalar, }; use rustc_middle::ty::layout::{self, TyAndLayout}; use rustc_middle::ty::{ @@ -103,8 +103,8 @@ pub enum StackPopCleanup { /// State of a local variable including a memoized layout #[derive(Clone, PartialEq, Eq, HashStable)] -pub struct LocalState<'tcx, Tag = (), Id = AllocId> { - pub value: LocalValue, +pub struct LocalState<'tcx, Tag = ()> { + pub value: LocalValue, /// Don't modify if `Some`, this is only used to prevent computing the layout twice #[stable_hasher(ignore)] pub layout: Cell>>, @@ -112,7 +112,7 @@ pub struct LocalState<'tcx, Tag = (), Id = AllocId> { /// Current value of a local variable #[derive(Copy, Clone, PartialEq, Eq, Debug, HashStable)] // Miri debug-prints these -pub enum LocalValue { +pub enum LocalValue { /// This local is not currently alive, and cannot be used at all. Dead, /// This local is alive but not yet initialized. It can be written to @@ -125,7 +125,7 @@ pub enum LocalValue { /// This is an optimization over just always having a pointer here; /// we can thus avoid doing an allocation when the local just stores /// immediate values *and* never has its address taken. - Live(Operand), + Live(Operand), } impl<'tcx, Tag: Copy + 'static> LocalState<'tcx, Tag> { diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index b924f20ce7cc8..a7107de6c7184 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -15,7 +15,7 @@ use rustc_target::abi::{Abi, DiscriminantKind, HasDataLayout, Integer, LayoutOf, use rustc_target::abi::{VariantIdx, Variants}; use super::{ - from_known_layout, sign_extend, truncate, AllocId, ConstValue, GlobalId, InterpCx, + from_known_layout, sign_extend, truncate, ConstValue, GlobalId, InterpCx, InterpResult, MPlaceTy, Machine, MemPlace, Place, PlaceTy, Pointer, Scalar, ScalarMaybeUndef, }; @@ -27,9 +27,9 @@ use super::{ /// In particular, thanks to `ScalarPair`, arithmetic operations and casts can be entirely /// defined on `Immediate`, and do not have to work with a `Place`. #[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable, Hash)] -pub enum Immediate { - Scalar(ScalarMaybeUndef), - ScalarPair(ScalarMaybeUndef, ScalarMaybeUndef), +pub enum Immediate { + Scalar(ScalarMaybeUndef), + ScalarPair(ScalarMaybeUndef, ScalarMaybeUndef), } impl From> for Immediate { @@ -145,9 +145,9 @@ impl<'tcx, Tag> ::std::ops::Deref for ImmTy<'tcx, Tag> { /// or still in memory. The latter is an optimization, to delay reading that chunk of /// memory and to avoid having to store arbitrary-sized data here. #[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable, Hash)] -pub enum Operand { - Immediate(Immediate), - Indirect(MemPlace), +pub enum Operand { + Immediate(Immediate), + Indirect(MemPlace), } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index ba17a0b482afc..fee9ca0c02e39 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -20,9 +20,9 @@ use super::{ #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable)] /// Information required for the sound usage of a `MemPlace`. -pub enum MemPlaceMeta { +pub enum MemPlaceMeta { /// The unsized payload (e.g. length for slices or vtable pointer for trait objects). - Meta(Scalar), + Meta(Scalar), /// `Sized` types or unsized `extern type` None, /// The address of this place may not be taken. This protects the `MemPlace` from coming from @@ -32,8 +32,8 @@ pub enum MemPlaceMeta { Poison, } -impl MemPlaceMeta { - pub fn unwrap_meta(self) -> Scalar { +impl MemPlaceMeta { + pub fn unwrap_meta(self) -> Scalar { match self { Self::Meta(s) => s, Self::None | Self::Poison => { @@ -47,9 +47,7 @@ impl MemPlaceMeta { Self::None | Self::Poison => false, } } -} -impl MemPlaceMeta { pub fn erase_tag(self) -> MemPlaceMeta<()> { match self { Self::Meta(s) => MemPlaceMeta::Meta(s.erase_tag()), @@ -60,22 +58,22 @@ impl MemPlaceMeta { } #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable)] -pub struct MemPlace { +pub struct MemPlace { /// A place may have an integral pointer for ZSTs, and since it might /// be turned back into a reference before ever being dereferenced. /// However, it may never be undef. - pub ptr: Scalar, + pub ptr: Scalar, pub align: Align, /// Metadata for unsized places. Interpretation is up to the type. /// Must not be present for sized types, but can be missing for unsized types /// (e.g., `extern type`). - pub meta: MemPlaceMeta, + pub meta: MemPlaceMeta, } #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable)] -pub enum Place { +pub enum Place { /// A place referring to a value allocated in the `Memory` system. - Ptr(MemPlace), + Ptr(MemPlace), /// To support alloc-free locals, we are able to write directly to a local. /// (Without that optimization, we'd just always be a `MemPlace`.) From 8abfb685b317aee6525107bf70b0824ea82a57ca Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 1 May 2020 11:45:05 +0200 Subject: [PATCH 5/6] remove obsolete comment Referenced was removed in 9f492fefef8d9a75f6dc27c834561fe977ca70c5 --- src/librustc_trait_selection/traits/util.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/librustc_trait_selection/traits/util.rs b/src/librustc_trait_selection/traits/util.rs index 4aceccf64ce65..eff73cf4a2d8a 100644 --- a/src/librustc_trait_selection/traits/util.rs +++ b/src/librustc_trait_selection/traits/util.rs @@ -217,7 +217,6 @@ pub fn impl_trait_ref_and_oblig<'a, 'tcx>( (impl_trait_ref, impl_obligations) } -/// See [`super::obligations_for_generics`]. pub fn predicates_for_generics<'tcx>( cause: ObligationCause<'tcx>, recursion_depth: usize, From 62ee0ea0b6b1fe60044c623066d3ea4169fed814 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 1 May 2020 12:08:16 +0200 Subject: [PATCH 6/6] fmt --- src/librustc_mir/interpret/operand.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index a7107de6c7184..e2fb9de486f09 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -15,8 +15,8 @@ use rustc_target::abi::{Abi, DiscriminantKind, HasDataLayout, Integer, LayoutOf, use rustc_target::abi::{VariantIdx, Variants}; use super::{ - from_known_layout, sign_extend, truncate, ConstValue, GlobalId, InterpCx, - InterpResult, MPlaceTy, Machine, MemPlace, Place, PlaceTy, Pointer, Scalar, ScalarMaybeUndef, + from_known_layout, sign_extend, truncate, ConstValue, GlobalId, InterpCx, InterpResult, + MPlaceTy, Machine, MemPlace, Place, PlaceTy, Pointer, Scalar, ScalarMaybeUndef, }; /// An `Immediate` represents a single immediate self-contained Rust value.