Auto merge of #138416 - Manishearth:rollup-fejor9p, r=Manishearth
Rollup of 12 pull requests Successful merges: - #134076 (Stabilize `std::io::ErrorKind::InvalidFilename`) - #137504 (Move methods from Map to TyCtxt, part 4.) - #138175 (Support rmeta inputs for --crate-type=bin --emit=obj) - #138259 (Disentangle `ForwardGenericParamBan` and `ConstParamTy` ribs) - #138280 (fix ICE in pretty-printing `global_asm!`) - #138318 (Rustdoc: remove a bunch of `@ts-expect-error` from main.js) - #138331 (Use `RUSTC_LINT_FLAGS` more) - #138357 (merge `TypeChecker` and `TypeVerifier`) - #138394 (remove unnecessary variant) - #138403 (Delegation: one more ICE fix for `MethodCall` generation) - #138407 (Delegation: reject C-variadics) - #138409 (Use sa_sigaction instead of sa_union.__su_sigaction for AIX) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
8536f201ff
177 changed files with 1488 additions and 1448 deletions
|
@ -509,7 +509,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
hir::MatchSource::TryDesugar(scrut_hir_id),
|
||||
) => {
|
||||
if let Some(ty::error::ExpectedFound { expected, .. }) = exp_found {
|
||||
let scrut_expr = self.tcx.hir().expect_expr(scrut_hir_id);
|
||||
let scrut_expr = self.tcx.hir_expect_expr(scrut_hir_id);
|
||||
let scrut_ty = if let hir::ExprKind::Call(_, args) = &scrut_expr.kind {
|
||||
let arg_expr = args.first().expect("try desugaring call w/out arg");
|
||||
self.typeck_results
|
||||
|
@ -548,7 +548,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
}) => match source {
|
||||
hir::MatchSource::TryDesugar(scrut_hir_id) => {
|
||||
if let Some(ty::error::ExpectedFound { expected, .. }) = exp_found {
|
||||
let scrut_expr = self.tcx.hir().expect_expr(scrut_hir_id);
|
||||
let scrut_expr = self.tcx.hir_expect_expr(scrut_hir_id);
|
||||
let scrut_ty = if let hir::ExprKind::Call(_, args) = &scrut_expr.kind {
|
||||
let arg_expr = args.first().expect("try desugaring call w/out arg");
|
||||
self.typeck_results
|
||||
|
|
|
@ -1351,7 +1351,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> {
|
|||
&& !has_impl_trait(def_id)
|
||||
// FIXME(fn_delegation): In delegation item argument spans are equal to last path
|
||||
// segment. This leads to ICE's when emitting `multipart_suggestion`.
|
||||
&& tcx.hir().opt_delegation_sig_id(expr.hir_id.owner.def_id).is_none()
|
||||
&& tcx.hir_opt_delegation_sig_id(expr.hir_id.owner.def_id).is_none()
|
||||
{
|
||||
let successor =
|
||||
method_args.get(0).map_or_else(|| (")", span.hi()), |arg| (", ", arg.span.lo()));
|
||||
|
|
|
@ -743,7 +743,7 @@ fn foo(&self) -> Self::T { String::new() }
|
|||
if let ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) = *proj_ty.self_ty().kind() {
|
||||
let opaque_local_def_id = def_id.as_local();
|
||||
let opaque_hir_ty = if let Some(opaque_local_def_id) = opaque_local_def_id {
|
||||
tcx.hir().expect_opaque_ty(opaque_local_def_id)
|
||||
tcx.hir_expect_opaque_ty(opaque_local_def_id)
|
||||
} else {
|
||||
return false;
|
||||
};
|
||||
|
|
|
@ -1023,7 +1023,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
format!(" for lifetime parameter `{name}`")
|
||||
}
|
||||
infer::UpvarRegion(ref upvar_id, _) => {
|
||||
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
|
||||
let var_name = self.tcx.hir_name(upvar_id.var_path.hir_id);
|
||||
format!(" for capture of `{var_name}` by closure")
|
||||
}
|
||||
infer::Nll(..) => bug!("NLL variable found in lexical phase"),
|
||||
|
|
|
@ -778,8 +778,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
let exp_local_id = exp_def_id.as_local()?;
|
||||
|
||||
match (
|
||||
&self.tcx.hir().expect_opaque_ty(last_local_id),
|
||||
&self.tcx.hir().expect_opaque_ty(exp_local_id),
|
||||
&self.tcx.hir_expect_opaque_ty(last_local_id),
|
||||
&self.tcx.hir_expect_opaque_ty(exp_local_id),
|
||||
) {
|
||||
(
|
||||
hir::OpaqueTy { bounds: last_bounds, .. },
|
||||
|
|
|
@ -22,7 +22,6 @@ use rustc_hir::{
|
|||
expr_needs_parens, is_range_literal,
|
||||
};
|
||||
use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferCtxt, InferOk};
|
||||
use rustc_middle::hir::map;
|
||||
use rustc_middle::traits::IsConstable;
|
||||
use rustc_middle::ty::error::TypeError;
|
||||
use rustc_middle::ty::print::{
|
||||
|
@ -93,7 +92,7 @@ impl<'a, 'tcx> CoroutineData<'a, 'tcx> {
|
|||
fn get_from_await_ty<F>(
|
||||
&self,
|
||||
visitor: AwaitsVisitor,
|
||||
hir: map::Map<'tcx>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
ty_matches: F,
|
||||
) -> Option<Span>
|
||||
where
|
||||
|
@ -102,7 +101,7 @@ impl<'a, 'tcx> CoroutineData<'a, 'tcx> {
|
|||
visitor
|
||||
.awaits
|
||||
.into_iter()
|
||||
.map(|id| hir.expect_expr(id))
|
||||
.map(|id| tcx.hir_expect_expr(id))
|
||||
.find(|await_expr| ty_matches(ty::Binder::dummy(self.0.expr_ty_adjusted(await_expr))))
|
||||
.map(|expr| expr.span)
|
||||
}
|
||||
|
@ -2180,8 +2179,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
err: &mut Diag<'_, G>,
|
||||
obligation: &PredicateObligation<'tcx>,
|
||||
) -> bool {
|
||||
let hir = self.tcx.hir();
|
||||
|
||||
// Attempt to detect an async-await error by looking at the obligation causes, looking
|
||||
// for a coroutine to be present.
|
||||
//
|
||||
|
@ -2350,7 +2347,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
|
||||
let mut interior_or_upvar_span = None;
|
||||
|
||||
let from_awaited_ty = coroutine_data.get_from_await_ty(visitor, hir, ty_matches);
|
||||
let from_awaited_ty = coroutine_data.get_from_await_ty(visitor, self.tcx, ty_matches);
|
||||
debug!(?from_awaited_ty);
|
||||
|
||||
// Avoid disclosing internal information to downstream crates.
|
||||
|
@ -2428,7 +2425,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
|
||||
// Special case the primary error message when send or sync is the trait that was
|
||||
// not implemented.
|
||||
let hir = self.tcx.hir();
|
||||
let trait_explanation = if let Some(name @ (sym::Send | sym::Sync)) =
|
||||
self.tcx.get_diagnostic_name(trait_pred.def_id())
|
||||
{
|
||||
|
@ -2455,7 +2451,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
.parent(coroutine_did)
|
||||
.as_local()
|
||||
.map(|parent_did| self.tcx.local_def_id_to_hir_id(parent_did))
|
||||
.and_then(|parent_hir_id| hir.opt_name(parent_hir_id))
|
||||
.and_then(|parent_hir_id| self.tcx.hir_opt_name(parent_hir_id))
|
||||
.map(|name| {
|
||||
format!("future returned by `{name}` is not {trait_name}")
|
||||
})?,
|
||||
|
@ -2479,7 +2475,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
.parent(coroutine_did)
|
||||
.as_local()
|
||||
.map(|parent_did| self.tcx.local_def_id_to_hir_id(parent_did))
|
||||
.and_then(|parent_hir_id| hir.opt_name(parent_hir_id))
|
||||
.and_then(|parent_hir_id| self.tcx.hir_opt_name(parent_hir_id))
|
||||
.map(|name| {
|
||||
format!("async iterator returned by `{name}` is not {trait_name}")
|
||||
})?,
|
||||
|
@ -2502,7 +2498,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
.parent(coroutine_did)
|
||||
.as_local()
|
||||
.map(|parent_did| self.tcx.local_def_id_to_hir_id(parent_did))
|
||||
.and_then(|parent_hir_id| hir.opt_name(parent_hir_id))
|
||||
.and_then(|parent_hir_id| self.tcx.hir_opt_name(parent_hir_id))
|
||||
.map(|name| {
|
||||
format!("iterator returned by `{name}` is not {trait_name}")
|
||||
})?
|
||||
|
@ -3569,7 +3565,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
ObligationCauseCode::OpaqueReturnType(expr_info) => {
|
||||
let (expr_ty, expr) = if let Some((expr_ty, hir_id)) = expr_info {
|
||||
let expr_ty = tcx.short_string(expr_ty, err.long_ty_path());
|
||||
let expr = tcx.hir().expect_expr(hir_id);
|
||||
let expr = tcx.hir_expect_expr(hir_id);
|
||||
(expr_ty, expr)
|
||||
} else if let Some(body_id) = tcx.hir_node_by_def_id(body_id).body_id()
|
||||
&& let body = tcx.hir_body(body_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue