1
Fork 0

Auto merge of #129076 - matthiaskrgr:rollup-rg8mi2x, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #128410 (Migrate `remap-path-prefix-dwarf` `run-make` test to rmake)
 - #128759 (alloc: add ToString specialization for `&&str`)
 - #128873 (Add windows-targets crate to std's sysroot)
 - #129001 (chore(lib): Enhance documentation for core::fmt::Formatter's write_fm…)
 - #129061 (Use `is_lang_item` more)
 - #129062 (Remove a no-longer-true assert)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-08-14 04:17:13 +00:00
commit 9859bf27fd
38 changed files with 543 additions and 261 deletions

View file

@ -6,10 +6,9 @@ use std::ops::ControlFlow;
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{into_diag_arg_using_display, Applicability, Diag, DiagArgValue, IntoDiagArg};
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::DefId;
use rustc_hir::{PredicateOrigin, WherePredicate};
use rustc_hir::{self as hir, LangItem, PredicateOrigin, WherePredicate};
use rustc_span::{BytePos, Span};
use rustc_type_ir::TyKind::*;
@ -290,8 +289,9 @@ pub fn suggest_constraining_type_params<'a>(
let Some(param) = param else { return false };
{
let mut sized_constraints =
constraints.extract_if(|(_, def_id)| *def_id == tcx.lang_items().sized_trait());
let mut sized_constraints = constraints.extract_if(|(_, def_id)| {
def_id.is_some_and(|def_id| tcx.is_lang_item(def_id, LangItem::Sized))
});
if let Some((_, def_id)) = sized_constraints.next() {
applicability = Applicability::MaybeIncorrect;

View file

@ -838,7 +838,7 @@ impl<'tcx> Instance<'tcx> {
return None;
};
if tcx.lang_items().get(coroutine_callable_item) == Some(trait_item_id) {
if tcx.is_lang_item(trait_item_id, coroutine_callable_item) {
let ty::Coroutine(_, id_args) = *tcx.type_of(coroutine_def_id).skip_binder().kind()
else {
bug!()

View file

@ -1145,7 +1145,9 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
let term = if let Some(ty) = term.skip_binder().as_type()
&& let ty::Alias(ty::Projection, proj) = ty.kind()
&& let Some(assoc) = tcx.opt_associated_item(proj.def_id)
&& assoc.trait_container(tcx) == tcx.lang_items().coroutine_trait()
&& assoc
.trait_container(tcx)
.is_some_and(|def_id| tcx.is_lang_item(def_id, LangItem::Coroutine))
&& assoc.name == rustc_span::sym::Return
{
if let ty::Coroutine(_, args) = args.type_at(0).kind() {

View file

@ -1916,7 +1916,7 @@ impl<'tcx> Ty<'tcx> {
pub fn is_c_void(self, tcx: TyCtxt<'_>) -> bool {
match self.kind() {
ty::Adt(adt, _) => tcx.lang_items().get(LangItem::CVoid) == Some(adt.did()),
ty::Adt(adt, _) => tcx.is_lang_item(adt.did(), LangItem::CVoid),
_ => false,
}
}