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 11 pull requests #63990

Merged
merged 32 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2d438d6
Correctly suggest adding bounds to `impl Trait` argument
estebank Aug 22, 2019
055f7e2
Extend comment
estebank Aug 23, 2019
5cc1559
token: refactor with is_non_raw_ident_where.
Centril Aug 27, 2019
e49b958
Simplify with Symbol/Token::is_book_lit.
Centril Aug 27, 2019
f908aa9
recover on 'mut ' and improve recovery for keywords.
Centril Aug 27, 2019
3b2c147
remove the reference to __cxa_thread_atexit_impl
bpangWR Aug 27, 2019
dbbe336
Ensure 'let mut ;' where ':pat' is banned.
Centril Aug 27, 2019
7677d1f
const_prop: only call error_to_const_error if we are actually showing…
RalfJung Aug 27, 2019
42e895d
Improve 'mut ' diagnostic.
Centril Aug 27, 2019
cce631a
Merge pull request #9 from Wind-River/V7LIBC-948
BaoshanPang Aug 27, 2019
82f2b37
Add Option<Span> to `require_lang_item`
JohnTitor Aug 27, 2019
8c921be
Apply review comments
JohnTitor Aug 27, 2019
ede7a77
Remove `sized` spans
JohnTitor Aug 27, 2019
6f67bbc
or-pattern: fix typo in error message
tshepang Aug 28, 2019
42bd6fa
Prevent syntax error in ld linker version script
loganwendholt Aug 28, 2019
0006216
rustc_apfloat: make the crate #![no_std] explicitly.
eddyb Aug 28, 2019
cca64e7
Add some comments to `mir::Static` and `mir::StaticKind`
wesleywiser Aug 27, 2019
30b29ab
Simplify `maybe_get_optimized_mir` and `maybe_get_promoted_mir`
wesleywiser Aug 27, 2019
009cce8
Extract `Decoder::entry_unless_proc_macro()`
wesleywiser Aug 28, 2019
8cf3921
Notify me (flip1995) when Clippy toolstate changes
flip1995 Aug 28, 2019
080fdb8
add missing `#[repr(C)]` on a union
DutchGhost Aug 28, 2019
4cae33a
Rollup merge of #63811 - estebank:impl-trait-arg, r=cramertj
Centril Aug 29, 2019
b6df827
Rollup merge of #63933 - wesleywiser:cleanup_from_move_promoted, r=ol…
Centril Aug 29, 2019
eb4ac32
Rollup merge of #63938 - tshepang:typo, r=Centril
Centril Aug 29, 2019
52c3846
Rollup merge of #63945 - Centril:recover-mut-pat, r=estebank
Centril Aug 29, 2019
99d271f
Rollup merge of #63958 - RalfJung:silence-const-prop, r=oli-obk
Centril Aug 29, 2019
d4757d5
Rollup merge of #63961 - JohnTitor:improve-require-lang-item, r=estebank
Centril Aug 29, 2019
f0e2895
Rollup merge of #63963 - Wind-River:master_003, r=alexcrichton
Centril Aug 29, 2019
1c4a9a9
Rollup merge of #63965 - loganwendholt:linker-script-fix, r=michaelwo…
Centril Aug 29, 2019
75c8c21
Rollup merge of #63968 - eddyb:apfloat-nostd, r=matthewjasper
Centril Aug 29, 2019
e3028db
Rollup merge of #63970 - flip1995:notify_clippy, r=oli-obk
Centril Aug 29, 2019
7391009
Rollup merge of #63980 - DutchGhost:master, r=cramertj
Centril Aug 29, 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
1 change: 1 addition & 0 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2170,6 +2170,7 @@ impl str {
#[inline(always)]
#[rustc_const_unstable(feature="const_str_as_bytes")]
pub const fn as_bytes(&self) -> &[u8] {
#[repr(C)]
union Slices<'a> {
str: &'a str,
slice: &'a [u8],
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}
}

let copy_def_id = self.tcx.require_lang_item(lang_items::CopyTraitLangItem);
let copy_def_id = self.tcx.require_lang_item(lang_items::CopyTraitLangItem, None);

// this can get called from typeck (by euv), and moves_by_default
// rightly refuses to work with inference variables, but
Expand Down
8 changes: 6 additions & 2 deletions src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,13 @@ language_item_table! {
impl<'tcx> TyCtxt<'tcx> {
/// Returns the `DefId` for a given `LangItem`.
/// If not found, fatally abort compilation.
pub fn require_lang_item(&self, lang_item: LangItem) -> DefId {
pub fn require_lang_item(&self, lang_item: LangItem, span: Option<Span>) -> DefId {
self.lang_items().require(lang_item).unwrap_or_else(|msg| {
self.sess.fatal(&msg)
if let Some(span) = span {
self.sess.span_fatal(span, &msg)
} else {
self.sess.fatal(&msg)
}
})
}
}
7 changes: 7 additions & 0 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1733,13 +1733,20 @@ pub enum PlaceBase<'tcx> {
pub struct Static<'tcx> {
pub ty: Ty<'tcx>,
pub kind: StaticKind<'tcx>,
/// The `DefId` of the item this static was declared in. For promoted values, usually, this is
/// the same as the `DefId` of the `mir::Body` containing the `Place` this promoted appears in.
/// However, after inlining, that might no longer be the case as inlined `Place`s are copied
/// into the calling frame.
pub def_id: DefId,
}

#[derive(
Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, RustcEncodable, RustcDecodable,
)]
pub enum StaticKind<'tcx> {
/// Promoted references consist of an id (`Promoted`) and the substs necessary to monomorphize
/// it. Usually, these substs are just the identity substs for the item. However, the inliner
/// will adjust these substs when it inlines a function based on the substs at the callsite.
Promoted(Promoted, SubstsRef<'tcx>),
Static,
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3513,7 +3513,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {

// We can only make objects from sized types.
let tr = ty::TraitRef {
def_id: tcx.require_lang_item(lang_items::SizedTraitLangItem),
def_id: tcx.require_lang_item(lang_items::SizedTraitLangItem, None),
substs: tcx.mk_substs_trait(source, &[]),
};
nested.push(predicate_to_obligation(tr.to_predicate()));
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2385,13 +2385,13 @@ impl<'tcx> TyCtxt<'tcx> {

#[inline]
pub fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx> {
let def_id = self.require_lang_item(lang_items::OwnedBoxLangItem);
let def_id = self.require_lang_item(lang_items::OwnedBoxLangItem, None);
self.mk_generic_adt(def_id, ty)
}

#[inline]
pub fn mk_maybe_uninit(self, ty: Ty<'tcx>) -> Ty<'tcx> {
let def_id = self.require_lang_item(lang_items::MaybeUninitLangItem);
let def_id = self.require_lang_item(lang_items::MaybeUninitLangItem, None);
self.mk_generic_adt(def_id, ty)
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl<'tcx> Instance<'tcx> {
}

pub fn resolve_drop_in_place(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> {
let def_id = tcx.require_lang_item(DropInPlaceFnLangItem);
let def_id = tcx.require_lang_item(DropInPlaceFnLangItem, None);
let substs = tcx.intern_substs(&[ty.into()]);
Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, substs).unwrap()
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2588,12 +2588,12 @@ impl<'tcx> ClosureKind {

pub fn trait_did(&self, tcx: TyCtxt<'tcx>) -> DefId {
match *self {
ClosureKind::Fn => tcx.require_lang_item(FnTraitLangItem),
ClosureKind::Fn => tcx.require_lang_item(FnTraitLangItem, None),
ClosureKind::FnMut => {
tcx.require_lang_item(FnMutTraitLangItem)
tcx.require_lang_item(FnMutTraitLangItem, None)
}
ClosureKind::FnOnce => {
tcx.require_lang_item(FnOnceTraitLangItem)
tcx.require_lang_item(FnOnceTraitLangItem, None)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ impl<'tcx> ty::TyS<'tcx> {

fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
let (param_env, ty) = query.into_parts();
let trait_def_id = tcx.require_lang_item(lang_items::CopyTraitLangItem);
let trait_def_id = tcx.require_lang_item(lang_items::CopyTraitLangItem, None);
tcx.infer_ctxt()
.enter(|infcx| traits::type_known_to_meet_bound_modulo_regions(
&infcx,
Expand All @@ -1011,7 +1011,7 @@ fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>)

fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
let (param_env, ty) = query.into_parts();
let trait_def_id = tcx.require_lang_item(lang_items::SizedTraitLangItem);
let trait_def_id = tcx.require_lang_item(lang_items::SizedTraitLangItem, None);
tcx.infer_ctxt()
.enter(|infcx| traits::type_known_to_meet_bound_modulo_regions(
&infcx,
Expand All @@ -1024,7 +1024,7 @@ fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>)

fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
let (param_env, ty) = query.into_parts();
let trait_def_id = tcx.require_lang_item(lang_items::FreezeTraitLangItem);
let trait_def_id = tcx.require_lang_item(lang_items::FreezeTraitLangItem, None);
tcx.infer_ctxt()
.enter(|infcx| traits::type_known_to_meet_bound_modulo_regions(
&infcx,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
if !subty.has_escaping_bound_vars() {
let cause = self.cause(cause);
let trait_ref = ty::TraitRef {
def_id: self.infcx.tcx.require_lang_item(lang_items::SizedTraitLangItem),
def_id: self.infcx.tcx.require_lang_item(lang_items::SizedTraitLangItem, None),
substs: self.infcx.tcx.mk_substs_trait(subty, &[]),
};
self.out.push(traits::Obligation::new(cause, self.param_env, trait_ref.to_predicate()));
Expand Down
16 changes: 8 additions & 8 deletions src/librustc_apfloat/ieee.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use crate::{Category, ExpInt, IEK_INF, IEK_NAN, IEK_ZERO};
use crate::{Float, FloatConvert, ParseError, Round, Status, StatusAnd};

use core::cmp::{self, Ordering};
use core::convert::TryFrom;
use core::fmt::{self, Write};
use core::marker::PhantomData;
use core::mem;
use core::ops::Neg;
use smallvec::{SmallVec, smallvec};
use std::cmp::{self, Ordering};
use std::convert::TryFrom;
use std::fmt::{self, Write};
use std::marker::PhantomData;
use std::mem;
use std::ops::Neg;

#[must_use]
pub struct IeeeFloat<S> {
Expand Down Expand Up @@ -2287,8 +2287,8 @@ impl Loss {
/// Implementation details of IeeeFloat significands, such as big integer arithmetic.
/// As a rule of thumb, no functions in this module should dynamically allocate.
mod sig {
use std::cmp::Ordering;
use std::mem;
use core::cmp::Ordering;
use core::mem;
use super::{ExpInt, Limb, LIMB_BITS, limbs_for_bits, Loss};

pub(super) fn is_all_zeros(limbs: &[Limb]) -> bool {
Expand Down
36 changes: 20 additions & 16 deletions src/librustc_apfloat/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@
//! This API is completely unstable and subject to change.

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![no_std]
#![forbid(unsafe_code)]

#![feature(nll)]

use std::cmp::Ordering;
use std::fmt;
use std::ops::{Neg, Add, Sub, Mul, Div, Rem};
use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
use std::str::FromStr;
#[macro_use]
extern crate alloc;

use core::cmp::Ordering;
use core::fmt;
use core::ops::{Neg, Add, Sub, Mul, Div, Rem};
use core::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
use core::str::FromStr;

bitflags::bitflags! {
/// IEEE-754R 7: Default exception handling.
Expand Down Expand Up @@ -587,7 +591,7 @@ macro_rules! float_common_impls {
}
}

impl<$t> ::std::str::FromStr for $ty<$t> where Self: Float {
impl<$t> ::core::str::FromStr for $ty<$t> where Self: Float {
type Err = ParseError;
fn from_str(s: &str) -> Result<Self, ParseError> {
Self::from_str_r(s, Round::NearestTiesToEven).map(|x| x.value)
Expand All @@ -596,66 +600,66 @@ macro_rules! float_common_impls {

// Rounding ties to the nearest even, by default.

impl<$t> ::std::ops::Add for $ty<$t> where Self: Float {
impl<$t> ::core::ops::Add for $ty<$t> where Self: Float {
type Output = StatusAnd<Self>;
fn add(self, rhs: Self) -> StatusAnd<Self> {
self.add_r(rhs, Round::NearestTiesToEven)
}
}

impl<$t> ::std::ops::Sub for $ty<$t> where Self: Float {
impl<$t> ::core::ops::Sub for $ty<$t> where Self: Float {
type Output = StatusAnd<Self>;
fn sub(self, rhs: Self) -> StatusAnd<Self> {
self.sub_r(rhs, Round::NearestTiesToEven)
}
}

impl<$t> ::std::ops::Mul for $ty<$t> where Self: Float {
impl<$t> ::core::ops::Mul for $ty<$t> where Self: Float {
type Output = StatusAnd<Self>;
fn mul(self, rhs: Self) -> StatusAnd<Self> {
self.mul_r(rhs, Round::NearestTiesToEven)
}
}

impl<$t> ::std::ops::Div for $ty<$t> where Self: Float {
impl<$t> ::core::ops::Div for $ty<$t> where Self: Float {
type Output = StatusAnd<Self>;
fn div(self, rhs: Self) -> StatusAnd<Self> {
self.div_r(rhs, Round::NearestTiesToEven)
}
}

impl<$t> ::std::ops::Rem for $ty<$t> where Self: Float {
impl<$t> ::core::ops::Rem for $ty<$t> where Self: Float {
type Output = StatusAnd<Self>;
fn rem(self, rhs: Self) -> StatusAnd<Self> {
self.c_fmod(rhs)
}
}

impl<$t> ::std::ops::AddAssign for $ty<$t> where Self: Float {
impl<$t> ::core::ops::AddAssign for $ty<$t> where Self: Float {
fn add_assign(&mut self, rhs: Self) {
*self = (*self + rhs).value;
}
}

impl<$t> ::std::ops::SubAssign for $ty<$t> where Self: Float {
impl<$t> ::core::ops::SubAssign for $ty<$t> where Self: Float {
fn sub_assign(&mut self, rhs: Self) {
*self = (*self - rhs).value;
}
}

impl<$t> ::std::ops::MulAssign for $ty<$t> where Self: Float {
impl<$t> ::core::ops::MulAssign for $ty<$t> where Self: Float {
fn mul_assign(&mut self, rhs: Self) {
*self = (*self * rhs).value;
}
}

impl<$t> ::std::ops::DivAssign for $ty<$t> where Self: Float {
impl<$t> ::core::ops::DivAssign for $ty<$t> where Self: Float {
fn div_assign(&mut self, rhs: Self) {
*self = (*self / rhs).value;
}
}

impl<$t> ::std::ops::RemAssign for $ty<$t> where Self: Float {
impl<$t> ::core::ops::RemAssign for $ty<$t> where Self: Float {
fn rem_assign(&mut self, rhs: Self) {
*self = (*self % rhs).value;
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_apfloat/ppc.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::{Category, ExpInt, Float, FloatConvert, Round, ParseError, Status, StatusAnd};
use crate::ieee;

use std::cmp::Ordering;
use std::fmt;
use std::ops::Neg;
use core::cmp::Ordering;
use core::fmt;
use core::ops::Neg;

#[must_use]
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
Expand Down
11 changes: 7 additions & 4 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,13 @@ impl<'a> Linker for GccLinker<'a> {
// Write an LD version script
let res: io::Result<()> = try {
let mut f = BufWriter::new(File::create(&path)?);
writeln!(f, "{{\n global:")?;
for sym in self.info.exports[&crate_type].iter() {
debug!(" {};", sym);
writeln!(f, " {};", sym)?;
writeln!(f, "{{")?;
if !self.info.exports[&crate_type].is_empty() {
writeln!(f, " global:")?;
for sym in self.info.exports[&crate_type].iter() {
debug!(" {};", sym);
writeln!(f, " {};", sym)?;
}
}
writeln!(f, "\n local:\n *;\n}};")?;
};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(cx: &'
let arg_argv = param_argv;

let (start_fn, args) = if use_start_lang_item {
let start_def_id = cx.tcx().require_lang_item(StartFnLangItem);
let start_def_id = cx.tcx().require_lang_item(StartFnLangItem, None);
let start_fn = callee::resolve_and_get_fn(
cx,
start_def_id,
Expand Down
20 changes: 2 additions & 18 deletions src/librustc_metadata/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,8 @@ provide! { <'tcx> tcx, def_id, other, cdata,
bug!("coerce_unsized_info: `{:?}` is missing its info", def_id);
})
}
optimized_mir => {
let mir = cdata.maybe_get_optimized_mir(tcx, def_id.index).unwrap_or_else(|| {
bug!("get_optimized_mir: missing MIR for `{:?}`", def_id)
});

let mir = tcx.arena.alloc(mir);

mir
}
promoted_mir => {
let promoted = cdata.maybe_get_promoted_mir(tcx, def_id.index).unwrap_or_else(|| {
bug!("get_promoted_mir: missing promoted MIR for `{:?}`", def_id)
});

let promoted = tcx.arena.alloc(promoted);

promoted
}
optimized_mir => { tcx.arena.alloc(cdata.get_optimized_mir(tcx, def_id.index)) }
promoted_mir => { tcx.arena.alloc(cdata.get_promoted_mir(tcx, def_id.index)) }
mir_const_qualif => {
(cdata.mir_const_qualif(def_id.index), tcx.arena.alloc(BitSet::new_empty(0)))
}
Expand Down
Loading