Skip to content

Commit

Permalink
Auto merge of rust-lang#136613 - workingjubilee:rollup-ry6rw0m, r=wor…
Browse files Browse the repository at this point in the history
…kingjubilee

Rollup of 13 pull requests

Successful merges:

 - rust-lang#133932 (Avoid using make_direct_deprecated() in extern "ptx-kernel")
 - rust-lang#136269 (Pass spans around new solver)
 - rust-lang#136550 (Fix `rustc_hidden_type_of_opaques` for RPITITs with no default body)
 - rust-lang#136558 (Document minimum supported host tooling on macOS)
 - rust-lang#136563 (Clean up `Trivial*Impls` macros)
 - rust-lang#136566 (Fix link in from_fn.rs)
 - rust-lang#136573 (Document why some "type mismatches" exist)
 - rust-lang#136583 (Only highlight unmatchable parameters at the definition site)
 - rust-lang#136587 (Update browser-ui-test version to `0.20.2`)
 - rust-lang#136590 (Implement RustcInternal for RawPtrKind)
 - rust-lang#136591 (Add `rustc_hir_pretty::expr_to_string` function)
 - rust-lang#136595 (Fix `unreachable_pub` lint for hermit target)
 - rust-lang#136611 (cg_llvm: Remove the `mod llvm_` hack, which should no longer be necessary)

Failed merges:

 - rust-lang#136565 (compiler: Clean up weird `rustc_abi` reexports)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Feb 6, 2025
2 parents c753cb9 + c549268 commit 5958825
Show file tree
Hide file tree
Showing 70 changed files with 613 additions and 594 deletions.
11 changes: 3 additions & 8 deletions compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,9 @@ mod debuginfo;
mod declare;
mod errors;
mod intrinsic;

// The following is a workaround that replaces `pub mod llvm;` and that fixes issue 53912.
#[path = "llvm/mod.rs"]
mod llvm_;
pub mod llvm {
pub use super::llvm_::*;
}

// FIXME(Zalathar): Fix all the unreachable-pub warnings that would occur if
// this isn't pub, then make it not pub.
pub mod llvm;
mod llvm_util;
mod mono_item;
mod type_;
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_codegen_llvm/src/llvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ use libc::c_uint;
use rustc_abi::{Align, Size, WrappingRange};
use rustc_llvm::RustString;

pub use self::AtomicRmwBinOp::*;
pub use self::CallConv::*;
pub use self::CodeGenOptSize::*;
pub use self::IntPredicate::*;
pub use self::Linkage::*;
pub use self::MetadataType::*;
pub use self::RealPredicate::*;
pub use self::ffi::*;
use crate::common::AsCCharPtr;

Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_hir_analysis/src/collect/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ pub(crate) fn opaque_hidden_types(tcx: TyCtxt<'_>) {
}

for id in tcx.hir_crate_items(()).opaques() {
if let hir::OpaqueTyOrigin::FnReturn { parent: fn_def_id, .. }
| hir::OpaqueTyOrigin::AsyncFn { parent: fn_def_id, .. } =
tcx.hir().expect_opaque_ty(id).origin
&& let hir::Node::TraitItem(trait_item) = tcx.hir_node_by_def_id(fn_def_id)
&& let (_, hir::TraitFn::Required(..)) = trait_item.expect_fn()
{
continue;
}

let ty = tcx.type_of(id).instantiate_identity();
let span = tcx.def_span(id);
tcx.dcx().emit_err(crate::errors::TypeOf { span, ty });
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ pub fn pat_to_string(ann: &dyn PpAnn, pat: &hir::Pat<'_>) -> String {
to_string(ann, |s| s.print_pat(pat))
}

pub fn expr_to_string(ann: &dyn PpAnn, pat: &hir::Expr<'_>) -> String {
to_string(ann, |s| s.print_expr(pat))
}

impl<'a> State<'a> {
fn bclose_maybe_open(&mut self, span: rustc_span::Span, close_box: bool) {
self.maybe_print_comment(span.hi());
Expand Down
319 changes: 158 additions & 161 deletions compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Large diffs are not rendered by default.

23 changes: 19 additions & 4 deletions compiler/rustc_infer/src/infer/at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
expected,
ty::Contravariant,
actual,
self.cause.span,
)
.map(|goals| self.goals_to_obligations(goals))
} else {
Expand All @@ -163,8 +164,15 @@ impl<'a, 'tcx> At<'a, 'tcx> {
T: ToTrace<'tcx>,
{
if self.infcx.next_trait_solver {
NextSolverRelate::relate(self.infcx, self.param_env, expected, ty::Covariant, actual)
.map(|goals| self.goals_to_obligations(goals))
NextSolverRelate::relate(
self.infcx,
self.param_env,
expected,
ty::Covariant,
actual,
self.cause.span,
)
.map(|goals| self.goals_to_obligations(goals))
} else {
let mut op = TypeRelating::new(
self.infcx,
Expand Down Expand Up @@ -208,8 +216,15 @@ impl<'a, 'tcx> At<'a, 'tcx> {
T: Relate<TyCtxt<'tcx>>,
{
if self.infcx.next_trait_solver {
NextSolverRelate::relate(self.infcx, self.param_env, expected, ty::Invariant, actual)
.map(|goals| self.goals_to_obligations(goals))
NextSolverRelate::relate(
self.infcx,
self.param_env,
expected,
ty::Invariant,
actual,
self.cause.span,
)
.map(|goals| self.goals_to_obligations(goals))
} else {
let mut op = TypeRelating::new(
self.infcx,
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_infer/src/infer/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty::relate::RelateResult;
use rustc_middle::ty::relate::combine::PredicateEmittingRelation;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::{DUMMY_SP, ErrorGuaranteed};
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};

use super::{BoundRegionConversionTime, InferCtxt, RegionVariableOrigin, SubregionOrigin};

Expand Down Expand Up @@ -203,23 +203,23 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
self.probe(|_| probe())
}

fn sub_regions(&self, sub: ty::Region<'tcx>, sup: ty::Region<'tcx>) {
fn sub_regions(&self, sub: ty::Region<'tcx>, sup: ty::Region<'tcx>, span: Span) {
self.inner.borrow_mut().unwrap_region_constraints().make_subregion(
SubregionOrigin::RelateRegionParamBound(DUMMY_SP, None),
SubregionOrigin::RelateRegionParamBound(span, None),
sub,
sup,
);
}

fn equate_regions(&self, a: ty::Region<'tcx>, b: ty::Region<'tcx>) {
fn equate_regions(&self, a: ty::Region<'tcx>, b: ty::Region<'tcx>, span: Span) {
self.inner.borrow_mut().unwrap_region_constraints().make_eqregion(
SubregionOrigin::RelateRegionParamBound(DUMMY_SP, None),
SubregionOrigin::RelateRegionParamBound(span, None),
a,
b,
);
}

fn register_ty_outlives(&self, ty: Ty<'tcx>, r: ty::Region<'tcx>) {
self.register_region_obligation_with_cause(ty, r, &ObligationCause::dummy());
fn register_ty_outlives(&self, ty: Ty<'tcx>, r: ty::Region<'tcx>, span: Span) {
self.register_region_obligation_with_cause(ty, r, &ObligationCause::dummy_with_span(span));
}
}
4 changes: 0 additions & 4 deletions compiler/rustc_middle/src/infer/canonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ impl<'tcx, R> QueryResponse<'tcx, R> {
pub type QueryOutlivesConstraint<'tcx> =
(ty::OutlivesPredicate<'tcx, GenericArg<'tcx>>, ConstraintCategory<'tcx>);

TrivialTypeTraversalImpls! {
crate::infer::canonical::Certainty,
}

#[derive(Default)]
pub struct CanonicalParamEnvCache<'tcx> {
map: Lock<
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/mir/basic_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ impl<'tcx> graph::Predecessors for BasicBlocks<'tcx> {
}
}

// Done here instead of in `structural_impls.rs` because `Cache` is private, as is `basic_blocks`.
TrivialTypeTraversalImpls! { Cache }

impl<S: Encoder> Encodable<S> for Cache {
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ impl From<ReportedErrorInfo> for ErrorGuaranteed {
}
}

TrivialTypeTraversalImpls! { ErrorHandled }

pub type EvalToAllocationRawResult<'tcx> = Result<ConstAlloc<'tcx>, ErrorHandled>;
pub type EvalStaticInitializerRawResult<'tcx> = Result<ConstAllocation<'tcx>, ErrorHandled>;
pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use self::visit::TyContext;
use crate::mir::interpret::{AllocRange, Scalar};
use crate::mir::visit::MirVisitable;
use crate::ty::codec::{TyDecoder, TyEncoder};
use crate::ty::fold::{FallibleTypeFolder, TypeFoldable};
use crate::ty::print::{FmtPrinter, Printer, pretty_print_const, with_no_trimmed_paths};
use crate::ty::visit::TypeVisitableExt;
use crate::ty::{
Expand All @@ -59,7 +58,6 @@ pub mod tcx;
mod terminator;

pub mod traversal;
mod type_foldable;
pub mod visit;

pub use consts::*;
Expand Down Expand Up @@ -927,8 +925,6 @@ pub enum BindingForm<'tcx> {
RefForGuard,
}

TrivialTypeTraversalImpls! { BindingForm<'tcx> }

mod binding_form_impl {
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_query_system::ich::StableHashingContext;
Expand Down
67 changes: 0 additions & 67 deletions compiler/rustc_middle/src/mir/type_foldable.rs

This file was deleted.

4 changes: 0 additions & 4 deletions compiler/rustc_middle/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,6 @@ pub enum IsConstable {
Ctor,
}

TrivialTypeTraversalAndLiftImpls! {
IsConstable,
}

/// The 'location' at which we try to perform HIR-based wf checking.
/// This information is used to obtain an `hir::Ty`, which
/// we can walk in order to obtain precise spans for any
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ impl From<ErrorGuaranteed> for OverflowError {
}
}

TrivialTypeTraversalImpls! { OverflowError }

impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
fn from(overflow_error: OverflowError) -> SelectionError<'tcx> {
match overflow_error {
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/ty/abstract_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ impl From<ErrorGuaranteed> for NotConstEvaluatable {
}
}

TrivialTypeTraversalImpls! { NotConstEvaluatable }

pub type BoundAbstractConst<'tcx> =
Result<Option<EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed>;

Expand Down
44 changes: 21 additions & 23 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ use crate::traits::solve::{
};
use crate::ty::predicate::ExistentialPredicateStableCmpExt as _;
use crate::ty::{
self, AdtDef, AdtDefData, AdtKind, Binder, BoundConstness, Clause, Clauses, Const, GenericArg,
GenericArgs, GenericArgsRef, GenericParamDefKind, ImplPolarity, List, ListWithCachedTypeInfo,
ParamConst, ParamTy, Pattern, PatternKind, PolyExistentialPredicate, PolyFnSig, Predicate,
PredicateKind, PredicatePolarity, Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty,
TyKind, TyVid, Visibility,
self, AdtDef, AdtDefData, AdtKind, Binder, Clause, Clauses, Const, GenericArg, GenericArgs,
GenericArgsRef, GenericParamDefKind, List, ListWithCachedTypeInfo, ParamConst, ParamTy,
Pattern, PatternKind, PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind,
PredicatePolarity, Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyVid,
Visibility,
};

#[allow(rustc::usage_of_ty_tykind)]
Expand Down Expand Up @@ -2243,21 +2243,23 @@ macro_rules! nop_list_lift {
};
}

nop_lift! {type_; Ty<'a> => Ty<'tcx>}
nop_lift! {region; Region<'a> => Region<'tcx>}
nop_lift! {const_; Const<'a> => Const<'tcx>}
nop_lift! {pat; Pattern<'a> => Pattern<'tcx>}
nop_lift! {const_allocation; ConstAllocation<'a> => ConstAllocation<'tcx>}
nop_lift! {predicate; Predicate<'a> => Predicate<'tcx>}
nop_lift! {predicate; Clause<'a> => Clause<'tcx>}
nop_lift! {layout; Layout<'a> => Layout<'tcx>}

nop_list_lift! {type_lists; Ty<'a> => Ty<'tcx>}
nop_list_lift! {poly_existential_predicates; PolyExistentialPredicate<'a> => PolyExistentialPredicate<'tcx>}
nop_list_lift! {bound_variable_kinds; ty::BoundVariableKind => ty::BoundVariableKind}
nop_lift! { type_; Ty<'a> => Ty<'tcx> }
nop_lift! { region; Region<'a> => Region<'tcx> }
nop_lift! { const_; Const<'a> => Const<'tcx> }
nop_lift! { pat; Pattern<'a> => Pattern<'tcx> }
nop_lift! { const_allocation; ConstAllocation<'a> => ConstAllocation<'tcx> }
nop_lift! { predicate; Predicate<'a> => Predicate<'tcx> }
nop_lift! { predicate; Clause<'a> => Clause<'tcx> }
nop_lift! { layout; Layout<'a> => Layout<'tcx> }

nop_list_lift! { type_lists; Ty<'a> => Ty<'tcx> }
nop_list_lift! {
poly_existential_predicates; PolyExistentialPredicate<'a> => PolyExistentialPredicate<'tcx>
}
nop_list_lift! { bound_variable_kinds; ty::BoundVariableKind => ty::BoundVariableKind }

// This is the impl for `&'a GenericArgs<'a>`.
nop_list_lift! {args; GenericArg<'a> => GenericArg<'tcx>}
nop_list_lift! { args; GenericArg<'a> => GenericArg<'tcx> }

macro_rules! nop_slice_lift {
($ty:ty => $lifted:ty) => {
Expand All @@ -2277,11 +2279,7 @@ macro_rules! nop_slice_lift {
};
}

nop_slice_lift! {ty::ValTree<'a> => ty::ValTree<'tcx>}

TrivialLiftImpls! {
ImplPolarity, PredicatePolarity, Promoted, BoundConstness,
}
nop_slice_lift! { ty::ValTree<'a> => ty::ValTree<'tcx> }

macro_rules! sty_debug_print {
($fmt: expr, $ctxt: expr, $($variant: ident),*) => {{
Expand Down
Loading

0 comments on commit 5958825

Please sign in to comment.