Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #66208

Merged
merged 27 commits into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
900c13e
enhance the documentation of std::io::BufReader regarding potential d…
Oct 18, 2019
5b5196a
rephrase sentence regarding data loss when using BufReader::into_inner
Oct 23, 2019
05c0791
consistent handling of missing sysroot spans
RalfJung Nov 2, 2019
1808968
also adjust ignore in generated tests
RalfJung Nov 2, 2019
f66a331
When a URL hash refers to a hidden element, it makes the element visible
GuillaumeGomez Nov 5, 2019
62167c0
using 2.0.log(2.0) in examples does not make it clear which is the b…
srinivasreddy Nov 6, 2019
c965432
Ignore these tests ,since the called commands doesn't exist in VxWorks
Oct 30, 2019
24e093c
Remove old isHidden function
GuillaumeGomez Nov 7, 2019
d4527b7
Only call onHashChange instead of both functions
GuillaumeGomez Nov 7, 2019
1906c6f
Add `MaybeUninit` methods `uninit_array`, `slice_get_ref`, `slice_get…
SimonSapin Oct 18, 2019
05c14bc
Apply docs suggestions from review
SimonSapin Oct 26, 2019
639c4f7
MaybeUninit::uninit_array docs: better example
SimonSapin Oct 26, 2019
ccde510
rustc_target: inline abi::FloatTy into abi::Primitive.
eddyb Nov 7, 2019
8590b16
rustc_metadata: Move decoder/encoder/table into mod schema
petrochenkov Nov 3, 2019
8e1ae56
rustc_metadata: Privatize everything in schema and schema/table
petrochenkov Nov 3, 2019
0c9d424
rustc_metadata: Move cstore_impl into mod decoder
petrochenkov Nov 3, 2019
166d5f8
rustc_metadata: Privatize everything in decoder
petrochenkov Nov 3, 2019
2b75147
rustc_metadata: Privatize more entities
petrochenkov Nov 3, 2019
5eb1cf1
rustc_metadata: Rename `schema` to `rmeta`
petrochenkov Nov 4, 2019
32aa327
Rollup merge of #65554 - gliderkite:bufreader-doc-enhance, r=KodrAus
JohnTitor Nov 8, 2019
a00c777
Rollup merge of #65580 - SimonSapin:maybeuninit-array, r=Amanieu
JohnTitor Nov 8, 2019
9dc5d0e
Rollup merge of #66049 - RalfJung:missing-spans, r=alexcrichton
JohnTitor Nov 8, 2019
996d94a
Rollup merge of #66056 - petrochenkov:metapriv, r=eddyb
JohnTitor Nov 8, 2019
392ebad
Rollup merge of #66123 - GuillaumeGomez:no-more-hidden-elements, r=Dy…
JohnTitor Nov 8, 2019
1455381
Rollup merge of #66157 - srinivasreddy:improv, r=alexcrichton
JohnTitor Nov 8, 2019
63a4551
Rollup merge of #66165 - Wind-River:master_xyz, r=alexcrichton
JohnTitor Nov 8, 2019
1969f41
Rollup merge of #66190 - eddyb:primflt, r=Centril
JohnTitor Nov 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/etc/generate-deriving-span-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
os.path.join(os.path.dirname(__file__), '../test/ui/derives/'))

TEMPLATE = """\
// ignore-x86
// ^ due to stderr output differences
// ignore-x86 FIXME: missing sysroot spans (#53081)
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'

{error_deriving}
Expand Down
63 changes: 63 additions & 0 deletions src/libcore/mem/maybe_uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,43 @@ impl<T> MaybeUninit<T> {
MaybeUninit { uninit: () }
}

/// Create a new array of `MaybeUninit<T>` items, in an uninitialized state.
///
/// Note: in a future Rust version this method may become unnecessary
/// when array literal syntax allows
/// [repeating const expressions](https://github.com/rust-lang/rust/issues/49147).
/// The example below could then use `let mut buf = [MaybeUninit::<u8>::uninit(); 32];`.
///
/// # Examples
///
/// ```no_run
/// #![feature(maybe_uninit_uninit_array, maybe_uninit_extra, maybe_uninit_slice_assume_init)]
///
/// use std::mem::MaybeUninit;
///
/// extern "C" {
/// fn read_into_buffer(ptr: *mut u8, max_len: usize) -> usize;
/// }
///
/// /// Returns a (possibly smaller) slice of data that was actually read
/// fn read(buf: &mut [MaybeUninit<u8>]) -> &[u8] {
/// unsafe {
/// let len = read_into_buffer(buf.as_mut_ptr() as *mut u8, buf.len());
/// MaybeUninit::slice_get_ref(&buf[..len])
/// }
/// }
///
/// let mut buf: [MaybeUninit<u8>; 32] = MaybeUninit::uninit_array();
/// let data = read(&mut buf);
/// ```
#[unstable(feature = "maybe_uninit_uninit_array", issue = "0")]
#[inline(always)]
pub fn uninit_array<const LEN: usize>() -> [Self; LEN] {
unsafe {
MaybeUninit::<[MaybeUninit<T>; LEN]>::uninit().assume_init()
}
}

/// A promotable constant, equivalent to `uninit()`.
#[unstable(feature = "internal_uninit_const", issue = "0",
reason = "hack to work around promotability")]
Expand Down Expand Up @@ -692,6 +729,32 @@ impl<T> MaybeUninit<T> {
&mut *self.value
}

/// Assuming all the elements are initialized, get a slice to them.
///
/// # Safety
///
/// It is up to the caller to guarantee that the `MaybeUninit<T>` elements
/// really are in an initialized state.
/// Calling this when the content is not yet fully initialized causes undefined behavior.
#[unstable(feature = "maybe_uninit_slice_assume_init", issue = "0")]
#[inline(always)]
pub unsafe fn slice_get_ref(slice: &[Self]) -> &[T] {
&*(slice as *const [Self] as *const [T])
}

/// Assuming all the elements are initialized, get a mutable slice to them.
///
/// # Safety
///
/// It is up to the caller to guarantee that the `MaybeUninit<T>` elements
/// really are in an initialized state.
/// Calling this when the content is not yet fully initialized causes undefined behavior.
#[unstable(feature = "maybe_uninit_slice_assume_init", issue = "0")]
#[inline(always)]
pub unsafe fn slice_get_mut(slice: &mut [Self]) -> &mut [T] {
&mut *(slice as *mut [Self] as *mut [T])
}

/// Gets a pointer to the first element of the array.
#[unstable(feature = "maybe_uninit_slice", issue = "63569")]
#[inline(always)]
Expand Down
1 change: 0 additions & 1 deletion src/librustc/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ impl_stable_hash_for_spanned!(::syntax::ast::LitKind);
impl_stable_hash_for!(enum ::syntax::ast::IntTy { Isize, I8, I16, I32, I64, I128 });
impl_stable_hash_for!(enum ::syntax::ast::UintTy { Usize, U8, U16, U32, U64, U128 });
impl_stable_hash_for!(enum ::syntax::ast::FloatTy { F32, F64 });
impl_stable_hash_for!(enum ::rustc_target::abi::FloatTy { F32, F64 });
impl_stable_hash_for!(enum ::syntax::ast::Unsafety { Unsafe, Normal });
impl_stable_hash_for!(enum ::syntax::ast::Constness { Const, NotConst });
impl_stable_hash_for!(enum ::syntax::ast::Defaultness { Default, Final });
Expand Down
17 changes: 9 additions & 8 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ impl PrimitiveExt for Primitive {
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
match *self {
Int(i, signed) => i.to_ty(tcx, signed),
Float(FloatTy::F32) => tcx.types.f32,
Float(FloatTy::F64) => tcx.types.f64,
F32 => tcx.types.f32,
F64 => tcx.types.f64,
Pointer => tcx.mk_mut_ptr(tcx.mk_unit()),
}
}
Expand All @@ -144,7 +144,7 @@ impl PrimitiveExt for Primitive {
match *self {
Int(i, signed) => i.to_ty(tcx, signed),
Pointer => tcx.types.usize,
Float(..) => bug!("floats do not have an int type"),
F32 | F64 => bug!("floats do not have an int type"),
}
}
}
Expand Down Expand Up @@ -538,10 +538,10 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
ty::Uint(ity) => {
scalar(Int(Integer::from_attr(dl, attr::UnsignedInt(ity)), false))
}
ty::Float(fty) => scalar(Float(match fty {
ast::FloatTy::F32 => FloatTy::F32,
ast::FloatTy::F64 => FloatTy::F64,
})),
ty::Float(fty) => scalar(match fty {
ast::FloatTy::F32 => F32,
ast::FloatTy::F64 => F64,
}),
ty::FnPtr(_) => {
let mut ptr = scalar_unit(Pointer);
ptr.valid_range = 1..=*ptr.valid_range.end();
Expand Down Expand Up @@ -2457,7 +2457,8 @@ impl_stable_hash_for!(enum crate::ty::layout::Integer {

impl_stable_hash_for!(enum crate::ty::layout::Primitive {
Int(integer, signed),
Float(fty),
F32,
F64,
Pointer
});

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1904,8 +1904,8 @@ fn prepare_enum_metadata(

let discr_type = match discr.value {
layout::Int(t, _) => t,
layout::Float(layout::FloatTy::F32) => Integer::I32,
layout::Float(layout::FloatTy::F64) => Integer::I64,
layout::F32 => Integer::I32,
layout::F64 => Integer::I64,
layout::Pointer => cx.data_layout().ptr_sized_integer(),
}.to_ty(cx.tcx, false);

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_llvm/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use rustc::ty::layout::{self, LayoutOf, HasTyCtxt, Primitive};
use rustc::mir::interpret::GlobalId;
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
use rustc::hir;
use rustc_target::abi::{FloatTy, HasDataLayout};
use rustc_target::abi::HasDataLayout;
use syntax::ast;

use rustc_codegen_ssa::common::span_invalid_monomorphization_error;
Expand Down Expand Up @@ -163,12 +163,12 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
emit_va_arg(self, args[0], ret_ty)
}
}
Primitive::Float(FloatTy::F64) |
Primitive::F64 |
Primitive::Pointer => {
emit_va_arg(self, args[0], ret_ty)
}
// `va_arg` should never be used with the return type f32.
Primitive::Float(FloatTy::F32) => {
Primitive::F32 => {
bug!("the va_arg intrinsic does not work with `f32`")
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_llvm/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::common::*;
use crate::type_::Type;
use rustc::ty::{self, Ty, TypeFoldable};
use rustc::ty::layout::{self, Align, LayoutOf, FnAbiExt, PointeeInfo, Size, TyLayout};
use rustc_target::abi::{FloatTy, TyLayoutMethods};
use rustc_target::abi::TyLayoutMethods;
use rustc::ty::print::obsolete::DefPathBasedNames;
use rustc_codegen_ssa::traits::*;

Expand Down Expand Up @@ -300,8 +300,8 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> {
scalar: &layout::Scalar, offset: Size) -> &'a Type {
match scalar.value {
layout::Int(i, _) => cx.type_from_integer( i),
layout::Float(FloatTy::F32) => cx.type_f32(),
layout::Float(FloatTy::F64) => cx.type_f64(),
layout::F32 => cx.type_f32(),
layout::F64 => cx.type_f64(),
layout::Pointer => {
// If we know the alignment, pick something better than i8.
let pointee = if let Some(pointee) = self.pointee_info_at(cx, offset) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::cstore::{self, CStore, MetadataBlob};
use crate::locator::{self, CratePaths};
use crate::schema::{CrateRoot, CrateDep};
use crate::rmeta::{CrateRoot, CrateDep};
use rustc_data_structures::sync::{Lock, Once, AtomicCell};

use rustc::hir::def_id::CrateNum;
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_metadata/cstore.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// The crate store - a central repo for information collected about external
// crates and libraries

use crate::schema;
use crate::rmeta;
use rustc::dep_graph::DepNodeIndex;
use rustc::hir::def_id::{CrateNum, DefIndex};
use rustc::hir::map::definitions::DefPathTable;
Expand All @@ -17,7 +17,7 @@ use syntax_expand::base::SyntaxExtension;
use syntax_pos;
use proc_macro::bridge::client::ProcMacro;

pub use crate::cstore_impl::{provide, provide_extern};
pub use crate::rmeta::{provide, provide_extern};

// A map from external crate numbers (as decoded from some crate file) to
// local crate numbers (as generated during this session). Each external
Expand Down Expand Up @@ -49,7 +49,7 @@ crate struct CrateMetadata {
/// lifetime is only used behind `Lazy`, and therefore acts like an
/// universal (`for<'tcx>`), that is paired up with whichever `TyCtxt`
/// is being used to decode those values.
crate root: schema::CrateRoot<'static>,
crate root: rmeta::CrateRoot<'static>,
/// For each definition in this crate, we encode a key. When the
/// crate is loaded, we read all the keys and put them in this
/// hashmap, which gives the reverse mapping. This allows us to
Expand All @@ -59,7 +59,7 @@ crate struct CrateMetadata {
/// Trait impl data.
/// FIXME: Used only from queries and can use query cache,
/// so pre-decoding can probably be avoided.
crate trait_impls: FxHashMap<(u32, DefIndex), schema::Lazy<[DefIndex]>>,
crate trait_impls: FxHashMap<(u32, DefIndex), rmeta::Lazy<[DefIndex]>>,
/// Proc macro descriptions for this crate, if it's a proc macro crate.
crate raw_proc_macros: Option<&'static [ProcMacro]>,
/// Source maps for code from the crate.
Expand Down
6 changes: 1 addition & 5 deletions src/librustc_metadata/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@ extern crate rustc_data_structures;

pub mod error_codes;

mod encoder;
mod decoder;
mod dependency_format;
mod cstore_impl;
mod foreign_modules;
mod link_args;
mod native_libs;
mod schema;
mod table;
mod rmeta;

pub mod creader;
pub mod cstore;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@

use crate::cstore::MetadataBlob;
use crate::creader::Library;
use crate::schema::{METADATA_HEADER, rustc_version};
use crate::rmeta::{METADATA_HEADER, rustc_version};

use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::svh::Svh;
Expand Down
Loading