Skip to content

Commit 5958825

Browse files
committed
Auto merge of #136613 - workingjubilee:rollup-ry6rw0m, r=workingjubilee
Rollup of 13 pull requests Successful merges: - #133932 (Avoid using make_direct_deprecated() in extern "ptx-kernel") - #136269 (Pass spans around new solver) - #136550 (Fix `rustc_hidden_type_of_opaques` for RPITITs with no default body) - #136558 (Document minimum supported host tooling on macOS) - #136563 (Clean up `Trivial*Impls` macros) - #136566 (Fix link in from_fn.rs) - #136573 (Document why some "type mismatches" exist) - #136583 (Only highlight unmatchable parameters at the definition site) - #136587 (Update browser-ui-test version to `0.20.2`) - #136590 (Implement RustcInternal for RawPtrKind) - #136591 (Add `rustc_hir_pretty::expr_to_string` function) - #136595 (Fix `unreachable_pub` lint for hermit target) - #136611 (cg_llvm: Remove the `mod llvm_` hack, which should no longer be necessary) Failed merges: - #136565 (compiler: Clean up weird `rustc_abi` reexports) r? `@ghost` `@rustbot` modify labels: rollup
2 parents c753cb9 + c549268 commit 5958825

File tree

70 files changed

+613
-594
lines changed

Some content is hidden

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

70 files changed

+613
-594
lines changed

compiler/rustc_codegen_llvm/src/lib.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,9 @@ mod debuginfo;
7171
mod declare;
7272
mod errors;
7373
mod intrinsic;
74-
75-
// The following is a workaround that replaces `pub mod llvm;` and that fixes issue 53912.
76-
#[path = "llvm/mod.rs"]
77-
mod llvm_;
78-
pub mod llvm {
79-
pub use super::llvm_::*;
80-
}
81-
74+
// FIXME(Zalathar): Fix all the unreachable-pub warnings that would occur if
75+
// this isn't pub, then make it not pub.
76+
pub mod llvm;
8277
mod llvm_util;
8378
mod mono_item;
8479
mod type_;

compiler/rustc_codegen_llvm/src/llvm/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ use libc::c_uint;
1010
use rustc_abi::{Align, Size, WrappingRange};
1111
use rustc_llvm::RustString;
1212

13-
pub use self::AtomicRmwBinOp::*;
1413
pub use self::CallConv::*;
1514
pub use self::CodeGenOptSize::*;
16-
pub use self::IntPredicate::*;
17-
pub use self::Linkage::*;
1815
pub use self::MetadataType::*;
19-
pub use self::RealPredicate::*;
2016
pub use self::ffi::*;
2117
use crate::common::AsCCharPtr;
2218

compiler/rustc_hir_analysis/src/collect/dump.rs

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ pub(crate) fn opaque_hidden_types(tcx: TyCtxt<'_>) {
1111
}
1212

1313
for id in tcx.hir_crate_items(()).opaques() {
14+
if let hir::OpaqueTyOrigin::FnReturn { parent: fn_def_id, .. }
15+
| hir::OpaqueTyOrigin::AsyncFn { parent: fn_def_id, .. } =
16+
tcx.hir().expect_opaque_ty(id).origin
17+
&& let hir::Node::TraitItem(trait_item) = tcx.hir_node_by_def_id(fn_def_id)
18+
&& let (_, hir::TraitFn::Required(..)) = trait_item.expect_fn()
19+
{
20+
continue;
21+
}
22+
1423
let ty = tcx.type_of(id).instantiate_identity();
1524
let span = tcx.def_span(id);
1625
tcx.dcx().emit_err(crate::errors::TypeOf { span, ty });

compiler/rustc_hir_pretty/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ pub fn pat_to_string(ann: &dyn PpAnn, pat: &hir::Pat<'_>) -> String {
321321
to_string(ann, |s| s.print_pat(pat))
322322
}
323323

324+
pub fn expr_to_string(ann: &dyn PpAnn, pat: &hir::Expr<'_>) -> String {
325+
to_string(ann, |s| s.print_expr(pat))
326+
}
327+
324328
impl<'a> State<'a> {
325329
fn bclose_maybe_open(&mut self, span: rustc_span::Span, close_box: bool) {
326330
self.maybe_print_comment(span.hi());

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+158-161
Large diffs are not rendered by default.

compiler/rustc_infer/src/infer/at.rs

+19-4
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
137137
expected,
138138
ty::Contravariant,
139139
actual,
140+
self.cause.span,
140141
)
141142
.map(|goals| self.goals_to_obligations(goals))
142143
} else {
@@ -163,8 +164,15 @@ impl<'a, 'tcx> At<'a, 'tcx> {
163164
T: ToTrace<'tcx>,
164165
{
165166
if self.infcx.next_trait_solver {
166-
NextSolverRelate::relate(self.infcx, self.param_env, expected, ty::Covariant, actual)
167-
.map(|goals| self.goals_to_obligations(goals))
167+
NextSolverRelate::relate(
168+
self.infcx,
169+
self.param_env,
170+
expected,
171+
ty::Covariant,
172+
actual,
173+
self.cause.span,
174+
)
175+
.map(|goals| self.goals_to_obligations(goals))
168176
} else {
169177
let mut op = TypeRelating::new(
170178
self.infcx,
@@ -208,8 +216,15 @@ impl<'a, 'tcx> At<'a, 'tcx> {
208216
T: Relate<TyCtxt<'tcx>>,
209217
{
210218
if self.infcx.next_trait_solver {
211-
NextSolverRelate::relate(self.infcx, self.param_env, expected, ty::Invariant, actual)
212-
.map(|goals| self.goals_to_obligations(goals))
219+
NextSolverRelate::relate(
220+
self.infcx,
221+
self.param_env,
222+
expected,
223+
ty::Invariant,
224+
actual,
225+
self.cause.span,
226+
)
227+
.map(|goals| self.goals_to_obligations(goals))
213228
} else {
214229
let mut op = TypeRelating::new(
215230
self.infcx,

compiler/rustc_infer/src/infer/context.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_middle::ty::fold::TypeFoldable;
55
use rustc_middle::ty::relate::RelateResult;
66
use rustc_middle::ty::relate::combine::PredicateEmittingRelation;
77
use rustc_middle::ty::{self, Ty, TyCtxt};
8-
use rustc_span::{DUMMY_SP, ErrorGuaranteed};
8+
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
99

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

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

206-
fn sub_regions(&self, sub: ty::Region<'tcx>, sup: ty::Region<'tcx>) {
206+
fn sub_regions(&self, sub: ty::Region<'tcx>, sup: ty::Region<'tcx>, span: Span) {
207207
self.inner.borrow_mut().unwrap_region_constraints().make_subregion(
208-
SubregionOrigin::RelateRegionParamBound(DUMMY_SP, None),
208+
SubregionOrigin::RelateRegionParamBound(span, None),
209209
sub,
210210
sup,
211211
);
212212
}
213213

214-
fn equate_regions(&self, a: ty::Region<'tcx>, b: ty::Region<'tcx>) {
214+
fn equate_regions(&self, a: ty::Region<'tcx>, b: ty::Region<'tcx>, span: Span) {
215215
self.inner.borrow_mut().unwrap_region_constraints().make_eqregion(
216-
SubregionOrigin::RelateRegionParamBound(DUMMY_SP, None),
216+
SubregionOrigin::RelateRegionParamBound(span, None),
217217
a,
218218
b,
219219
);
220220
}
221221

222-
fn register_ty_outlives(&self, ty: Ty<'tcx>, r: ty::Region<'tcx>) {
223-
self.register_region_obligation_with_cause(ty, r, &ObligationCause::dummy());
222+
fn register_ty_outlives(&self, ty: Ty<'tcx>, r: ty::Region<'tcx>, span: Span) {
223+
self.register_region_obligation_with_cause(ty, r, &ObligationCause::dummy_with_span(span));
224224
}
225225
}

compiler/rustc_middle/src/infer/canonical.rs

-4
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ impl<'tcx, R> QueryResponse<'tcx, R> {
142142
pub type QueryOutlivesConstraint<'tcx> =
143143
(ty::OutlivesPredicate<'tcx, GenericArg<'tcx>>, ConstraintCategory<'tcx>);
144144

145-
TrivialTypeTraversalImpls! {
146-
crate::infer::canonical::Certainty,
147-
}
148-
149145
#[derive(Default)]
150146
pub struct CanonicalParamEnvCache<'tcx> {
151147
map: Lock<

compiler/rustc_middle/src/mir/basic_blocks.rs

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ impl<'tcx> graph::Predecessors for BasicBlocks<'tcx> {
163163
}
164164
}
165165

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

168169
impl<S: Encoder> Encodable<S> for Cache {

compiler/rustc_middle/src/mir/interpret/error.rs

-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ impl From<ReportedErrorInfo> for ErrorGuaranteed {
9595
}
9696
}
9797

98-
TrivialTypeTraversalImpls! { ErrorHandled }
99-
10098
pub type EvalToAllocationRawResult<'tcx> = Result<ConstAlloc<'tcx>, ErrorHandled>;
10199
pub type EvalStaticInitializerRawResult<'tcx> = Result<ConstAllocation<'tcx>, ErrorHandled>;
102100
pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;

compiler/rustc_middle/src/mir/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use self::visit::TyContext;
3434
use crate::mir::interpret::{AllocRange, Scalar};
3535
use crate::mir::visit::MirVisitable;
3636
use crate::ty::codec::{TyDecoder, TyEncoder};
37-
use crate::ty::fold::{FallibleTypeFolder, TypeFoldable};
3837
use crate::ty::print::{FmtPrinter, Printer, pretty_print_const, with_no_trimmed_paths};
3938
use crate::ty::visit::TypeVisitableExt;
4039
use crate::ty::{
@@ -59,7 +58,6 @@ pub mod tcx;
5958
mod terminator;
6059

6160
pub mod traversal;
62-
mod type_foldable;
6361
pub mod visit;
6462

6563
pub use consts::*;
@@ -927,8 +925,6 @@ pub enum BindingForm<'tcx> {
927925
RefForGuard,
928926
}
929927

930-
TrivialTypeTraversalImpls! { BindingForm<'tcx> }
931-
932928
mod binding_form_impl {
933929
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
934930
use rustc_query_system::ich::StableHashingContext;

compiler/rustc_middle/src/mir/type_foldable.rs

-67
This file was deleted.

compiler/rustc_middle/src/traits/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,6 @@ pub enum IsConstable {
427427
Ctor,
428428
}
429429

430-
TrivialTypeTraversalAndLiftImpls! {
431-
IsConstable,
432-
}
433-
434430
/// The 'location' at which we try to perform HIR-based wf checking.
435431
/// This information is used to obtain an `hir::Ty`, which
436432
/// we can walk in order to obtain precise spans for any

compiler/rustc_middle/src/traits/select.rs

-2
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,6 @@ impl From<ErrorGuaranteed> for OverflowError {
260260
}
261261
}
262262

263-
TrivialTypeTraversalImpls! { OverflowError }
264-
265263
impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
266264
fn from(overflow_error: OverflowError) -> SelectionError<'tcx> {
267265
match overflow_error {

compiler/rustc_middle/src/ty/abstract_const.rs

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ impl From<ErrorGuaranteed> for NotConstEvaluatable {
3030
}
3131
}
3232

33-
TrivialTypeTraversalImpls! { NotConstEvaluatable }
34-
3533
pub type BoundAbstractConst<'tcx> =
3634
Result<Option<EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed>;
3735

compiler/rustc_middle/src/ty/context.rs

+21-23
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ use crate::traits::solve::{
7676
};
7777
use crate::ty::predicate::ExistentialPredicateStableCmpExt as _;
7878
use crate::ty::{
79-
self, AdtDef, AdtDefData, AdtKind, Binder, BoundConstness, Clause, Clauses, Const, GenericArg,
80-
GenericArgs, GenericArgsRef, GenericParamDefKind, ImplPolarity, List, ListWithCachedTypeInfo,
81-
ParamConst, ParamTy, Pattern, PatternKind, PolyExistentialPredicate, PolyFnSig, Predicate,
82-
PredicateKind, PredicatePolarity, Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty,
83-
TyKind, TyVid, Visibility,
79+
self, AdtDef, AdtDefData, AdtKind, Binder, Clause, Clauses, Const, GenericArg, GenericArgs,
80+
GenericArgsRef, GenericParamDefKind, List, ListWithCachedTypeInfo, ParamConst, ParamTy,
81+
Pattern, PatternKind, PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind,
82+
PredicatePolarity, Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyVid,
83+
Visibility,
8484
};
8585

8686
#[allow(rustc::usage_of_ty_tykind)]
@@ -2243,21 +2243,23 @@ macro_rules! nop_list_lift {
22432243
};
22442244
}
22452245

2246-
nop_lift! {type_; Ty<'a> => Ty<'tcx>}
2247-
nop_lift! {region; Region<'a> => Region<'tcx>}
2248-
nop_lift! {const_; Const<'a> => Const<'tcx>}
2249-
nop_lift! {pat; Pattern<'a> => Pattern<'tcx>}
2250-
nop_lift! {const_allocation; ConstAllocation<'a> => ConstAllocation<'tcx>}
2251-
nop_lift! {predicate; Predicate<'a> => Predicate<'tcx>}
2252-
nop_lift! {predicate; Clause<'a> => Clause<'tcx>}
2253-
nop_lift! {layout; Layout<'a> => Layout<'tcx>}
2254-
2255-
nop_list_lift! {type_lists; Ty<'a> => Ty<'tcx>}
2256-
nop_list_lift! {poly_existential_predicates; PolyExistentialPredicate<'a> => PolyExistentialPredicate<'tcx>}
2257-
nop_list_lift! {bound_variable_kinds; ty::BoundVariableKind => ty::BoundVariableKind}
2246+
nop_lift! { type_; Ty<'a> => Ty<'tcx> }
2247+
nop_lift! { region; Region<'a> => Region<'tcx> }
2248+
nop_lift! { const_; Const<'a> => Const<'tcx> }
2249+
nop_lift! { pat; Pattern<'a> => Pattern<'tcx> }
2250+
nop_lift! { const_allocation; ConstAllocation<'a> => ConstAllocation<'tcx> }
2251+
nop_lift! { predicate; Predicate<'a> => Predicate<'tcx> }
2252+
nop_lift! { predicate; Clause<'a> => Clause<'tcx> }
2253+
nop_lift! { layout; Layout<'a> => Layout<'tcx> }
2254+
2255+
nop_list_lift! { type_lists; Ty<'a> => Ty<'tcx> }
2256+
nop_list_lift! {
2257+
poly_existential_predicates; PolyExistentialPredicate<'a> => PolyExistentialPredicate<'tcx>
2258+
}
2259+
nop_list_lift! { bound_variable_kinds; ty::BoundVariableKind => ty::BoundVariableKind }
22582260

22592261
// This is the impl for `&'a GenericArgs<'a>`.
2260-
nop_list_lift! {args; GenericArg<'a> => GenericArg<'tcx>}
2262+
nop_list_lift! { args; GenericArg<'a> => GenericArg<'tcx> }
22612263

22622264
macro_rules! nop_slice_lift {
22632265
($ty:ty => $lifted:ty) => {
@@ -2277,11 +2279,7 @@ macro_rules! nop_slice_lift {
22772279
};
22782280
}
22792281

2280-
nop_slice_lift! {ty::ValTree<'a> => ty::ValTree<'tcx>}
2281-
2282-
TrivialLiftImpls! {
2283-
ImplPolarity, PredicatePolarity, Promoted, BoundConstness,
2284-
}
2282+
nop_slice_lift! { ty::ValTree<'a> => ty::ValTree<'tcx> }
22852283

22862284
macro_rules! sty_debug_print {
22872285
($fmt: expr, $ctxt: expr, $($variant: ident),*) => {{

0 commit comments

Comments
 (0)