Skip to content

Commit 85ed538

Browse files
committed
Auto merge of #63990 - Centril:rollup-q1nt0b0, r=Centril
Rollup of 11 pull requests Successful merges: - #63811 (Correctly suggest adding bounds to `impl Trait` argument) - #63933 (Resolve some small issues related to #63580) - #63938 (or-pattern: fix typo in error message) - #63945 (Recover `mut $pat` and other improvements) - #63958 (const_prop: only call error_to_const_error if we are actually showing something) - #63961 (Add Option<Span> to `require_lang_item`) - #63963 (remove the reference to __cxa_thread_atexit_impl) - #63965 (Prevent syntax error in LD linker version script) - #63968 (rustc_apfloat: make the crate #![no_std] explicitly.) - #63970 (Notify me (flip1995) when Clippy toolstate changes) - #63980 (add missing `#[repr(C)]` on the Slices union) Failed merges: - #63989 (Add Yaah to clippy toolstain notification list) r? @ghost
2 parents 3476543 + 7391009 commit 85ed538

File tree

112 files changed

+741
-296
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+741
-296
lines changed

src/libcore/str/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,6 +2170,7 @@ impl str {
21702170
#[inline(always)]
21712171
#[rustc_const_unstable(feature="const_str_as_bytes")]
21722172
pub const fn as_bytes(&self) -> &[u8] {
2173+
#[repr(C)]
21732174
union Slices<'a> {
21742175
str: &'a str,
21752176
slice: &'a [u8],

src/librustc/infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14601460
}
14611461
}
14621462

1463-
let copy_def_id = self.tcx.require_lang_item(lang_items::CopyTraitLangItem);
1463+
let copy_def_id = self.tcx.require_lang_item(lang_items::CopyTraitLangItem, None);
14641464

14651465
// this can get called from typeck (by euv), and moves_by_default
14661466
// rightly refuses to work with inference variables, but

src/librustc/middle/lang_items.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,13 @@ language_item_table! {
381381
impl<'tcx> TyCtxt<'tcx> {
382382
/// Returns the `DefId` for a given `LangItem`.
383383
/// If not found, fatally abort compilation.
384-
pub fn require_lang_item(&self, lang_item: LangItem) -> DefId {
384+
pub fn require_lang_item(&self, lang_item: LangItem, span: Option<Span>) -> DefId {
385385
self.lang_items().require(lang_item).unwrap_or_else(|msg| {
386-
self.sess.fatal(&msg)
386+
if let Some(span) = span {
387+
self.sess.span_fatal(span, &msg)
388+
} else {
389+
self.sess.fatal(&msg)
390+
}
387391
})
388392
}
389393
}

src/librustc/mir/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,13 +1733,20 @@ pub enum PlaceBase<'tcx> {
17331733
pub struct Static<'tcx> {
17341734
pub ty: Ty<'tcx>,
17351735
pub kind: StaticKind<'tcx>,
1736+
/// The `DefId` of the item this static was declared in. For promoted values, usually, this is
1737+
/// the same as the `DefId` of the `mir::Body` containing the `Place` this promoted appears in.
1738+
/// However, after inlining, that might no longer be the case as inlined `Place`s are copied
1739+
/// into the calling frame.
17361740
pub def_id: DefId,
17371741
}
17381742

17391743
#[derive(
17401744
Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, RustcEncodable, RustcDecodable,
17411745
)]
17421746
pub enum StaticKind<'tcx> {
1747+
/// Promoted references consist of an id (`Promoted`) and the substs necessary to monomorphize
1748+
/// it. Usually, these substs are just the identity substs for the item. However, the inliner
1749+
/// will adjust these substs when it inlines a function based on the substs at the callsite.
17431750
Promoted(Promoted, SubstsRef<'tcx>),
17441751
Static,
17451752
}

src/librustc/traits/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3513,7 +3513,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
35133513

35143514
// We can only make objects from sized types.
35153515
let tr = ty::TraitRef {
3516-
def_id: tcx.require_lang_item(lang_items::SizedTraitLangItem),
3516+
def_id: tcx.require_lang_item(lang_items::SizedTraitLangItem, None),
35173517
substs: tcx.mk_substs_trait(source, &[]),
35183518
};
35193519
nested.push(predicate_to_obligation(tr.to_predicate()));

src/librustc/ty/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,13 +2385,13 @@ impl<'tcx> TyCtxt<'tcx> {
23852385

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

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

src/librustc/ty/instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl<'tcx> Instance<'tcx> {
327327
}
328328

329329
pub fn resolve_drop_in_place(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> {
330-
let def_id = tcx.require_lang_item(DropInPlaceFnLangItem);
330+
let def_id = tcx.require_lang_item(DropInPlaceFnLangItem, None);
331331
let substs = tcx.intern_substs(&[ty.into()]);
332332
Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, substs).unwrap()
333333
}

src/librustc/ty/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,12 +2588,12 @@ impl<'tcx> ClosureKind {
25882588

25892589
pub fn trait_did(&self, tcx: TyCtxt<'tcx>) -> DefId {
25902590
match *self {
2591-
ClosureKind::Fn => tcx.require_lang_item(FnTraitLangItem),
2591+
ClosureKind::Fn => tcx.require_lang_item(FnTraitLangItem, None),
25922592
ClosureKind::FnMut => {
2593-
tcx.require_lang_item(FnMutTraitLangItem)
2593+
tcx.require_lang_item(FnMutTraitLangItem, None)
25942594
}
25952595
ClosureKind::FnOnce => {
2596-
tcx.require_lang_item(FnOnceTraitLangItem)
2596+
tcx.require_lang_item(FnOnceTraitLangItem, None)
25972597
}
25982598
}
25992599
}

src/librustc/ty/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ impl<'tcx> ty::TyS<'tcx> {
998998

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

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

10251025
fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
10261026
let (param_env, ty) = query.into_parts();
1027-
let trait_def_id = tcx.require_lang_item(lang_items::FreezeTraitLangItem);
1027+
let trait_def_id = tcx.require_lang_item(lang_items::FreezeTraitLangItem, None);
10281028
tcx.infer_ctxt()
10291029
.enter(|infcx| traits::type_known_to_meet_bound_modulo_regions(
10301030
&infcx,

src/librustc/ty/wf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
221221
if !subty.has_escaping_bound_vars() {
222222
let cause = self.cause(cause);
223223
let trait_ref = ty::TraitRef {
224-
def_id: self.infcx.tcx.require_lang_item(lang_items::SizedTraitLangItem),
224+
def_id: self.infcx.tcx.require_lang_item(lang_items::SizedTraitLangItem, None),
225225
substs: self.infcx.tcx.mk_substs_trait(subty, &[]),
226226
};
227227
self.out.push(traits::Obligation::new(cause, self.param_env, trait_ref.to_predicate()));

0 commit comments

Comments
 (0)