Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a8f09d4

Browse files
committed
Auto merge of rust-lang#126107 - workingjubilee:rollup-0h6p5sq, r=workingjubilee
Rollup of 8 pull requests Successful merges: - rust-lang#125606 (Size optimize int formatting) - rust-lang#125724 (Uplift `Relate`/`TypeRelation` into `rustc_next_trait_solver`) - rust-lang#126040 (Don't warn on fields in the `unreachable_pub` lint ) - rust-lang#126065 (mark binding undetermined if target name exist and not obtained) - rust-lang#126098 (Remove `same-lib-two-locations-no-panic` run-make test) - rust-lang#126099 (Crate loader cleanups) - rust-lang#126101 (Revert "Disallow ambiguous attributes on expressions" on nightly) - rust-lang#126103 (Improve Docs for `hir::Impl` and `hir::ImplItem`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 76e7a08 + cd4fd96 commit a8f09d4

File tree

82 files changed

+1536
-1310
lines changed

Some content is hidden

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

82 files changed

+1536
-1310
lines changed

Cargo.lock

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4201,6 +4201,7 @@ dependencies = [
42014201
"rustc_middle",
42024202
"rustc_span",
42034203
"rustc_target",
4204+
"rustc_type_ir",
42044205
"smallvec",
42054206
"tracing",
42064207
]
@@ -4392,7 +4393,6 @@ dependencies = [
43924393
"rustc_hir_pretty",
43934394
"rustc_index",
43944395
"rustc_macros",
4395-
"rustc_next_trait_solver",
43964396
"rustc_query_system",
43974397
"rustc_serialize",
43984398
"rustc_session",
@@ -4509,6 +4509,7 @@ dependencies = [
45094509
"rustc_serialize",
45104510
"rustc_type_ir",
45114511
"rustc_type_ir_macros",
4512+
"tracing",
45124513
]
45134514

45144515
[[package]]

compiler/rustc_borrowck/src/constraints/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_data_structures::graph::scc::Sccs;
22
use rustc_index::{IndexSlice, IndexVec};
33
use rustc_middle::mir::ConstraintCategory;
4-
use rustc_middle::ty::{RegionVid, VarianceDiagInfo};
4+
use rustc_middle::ty::{RegionVid, TyCtxt, VarianceDiagInfo};
55
use rustc_span::Span;
66
use std::fmt;
77
use std::ops::Index;
@@ -97,7 +97,7 @@ pub struct OutlivesConstraint<'tcx> {
9797
pub category: ConstraintCategory<'tcx>,
9898

9999
/// Variance diagnostic information
100-
pub variance_info: VarianceDiagInfo<'tcx>,
100+
pub variance_info: VarianceDiagInfo<TyCtxt<'tcx>>,
101101

102102
/// If this constraint is promoted from closure requirements.
103103
pub from_closure: bool,

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2304,5 +2304,5 @@ pub struct BlameConstraint<'tcx> {
23042304
pub category: ConstraintCategory<'tcx>,
23052305
pub from_closure: bool,
23062306
pub cause: ObligationCause<'tcx>,
2307-
pub variance_info: ty::VarianceDiagInfo<'tcx>,
2307+
pub variance_info: ty::VarianceDiagInfo<TyCtxt<'tcx>>,
23082308
}

compiler/rustc_borrowck/src/type_check/relate_tys.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use rustc_data_structures::fx::FxHashMap;
22
use rustc_errors::ErrorGuaranteed;
3+
use rustc_infer::infer::relate::{ObligationEmittingRelation, StructurallyRelateAliases};
4+
use rustc_infer::infer::relate::{Relate, RelateResult, TypeRelation};
35
use rustc_infer::infer::NllRegionVariableOrigin;
4-
use rustc_infer::infer::{ObligationEmittingRelation, StructurallyRelateAliases};
56
use rustc_infer::traits::{Obligation, PredicateObligations};
67
use rustc_middle::mir::ConstraintCategory;
78
use rustc_middle::span_bug;
89
use rustc_middle::traits::query::NoSolution;
910
use rustc_middle::traits::ObligationCause;
1011
use rustc_middle::ty::fold::FnMutDelegate;
11-
use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation};
1212
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
1313
use rustc_span::symbol::sym;
1414
use rustc_span::{Span, Symbol};
@@ -82,7 +82,7 @@ pub struct NllTypeRelating<'me, 'bccx, 'tcx> {
8282
/// - Bivariant means that it doesn't matter.
8383
ambient_variance: ty::Variance,
8484

85-
ambient_variance_info: ty::VarianceDiagInfo<'tcx>,
85+
ambient_variance_info: ty::VarianceDiagInfo<TyCtxt<'tcx>>,
8686
}
8787

8888
impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> {
@@ -296,7 +296,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> {
296296
&mut self,
297297
sup: ty::Region<'tcx>,
298298
sub: ty::Region<'tcx>,
299-
info: ty::VarianceDiagInfo<'tcx>,
299+
info: ty::VarianceDiagInfo<TyCtxt<'tcx>>,
300300
) {
301301
let sub = self.type_checker.borrowck_context.universal_regions.to_region_vid(sub);
302302
let sup = self.type_checker.borrowck_context.universal_regions.to_region_vid(sup);
@@ -314,7 +314,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> {
314314
}
315315
}
316316

317-
impl<'bccx, 'tcx> TypeRelation<'tcx> for NllTypeRelating<'_, 'bccx, 'tcx> {
317+
impl<'bccx, 'tcx> TypeRelation<TyCtxt<'tcx>> for NllTypeRelating<'_, 'bccx, 'tcx> {
318318
fn tcx(&self) -> TyCtxt<'tcx> {
319319
self.type_checker.infcx.tcx
320320
}
@@ -324,10 +324,10 @@ impl<'bccx, 'tcx> TypeRelation<'tcx> for NllTypeRelating<'_, 'bccx, 'tcx> {
324324
}
325325

326326
#[instrument(skip(self, info), level = "trace", ret)]
327-
fn relate_with_variance<T: Relate<'tcx>>(
327+
fn relate_with_variance<T: Relate<TyCtxt<'tcx>>>(
328328
&mut self,
329329
variance: ty::Variance,
330-
info: ty::VarianceDiagInfo<'tcx>,
330+
info: ty::VarianceDiagInfo<TyCtxt<'tcx>>,
331331
a: T,
332332
b: T,
333333
) -> RelateResult<'tcx, T> {
@@ -445,7 +445,7 @@ impl<'bccx, 'tcx> TypeRelation<'tcx> for NllTypeRelating<'_, 'bccx, 'tcx> {
445445
b: ty::Binder<'tcx, T>,
446446
) -> RelateResult<'tcx, ty::Binder<'tcx, T>>
447447
where
448-
T: Relate<'tcx>,
448+
T: Relate<TyCtxt<'tcx>>,
449449
{
450450
// We want that
451451
//

compiler/rustc_hir/src/hir.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2345,7 +2345,9 @@ impl ImplItemId {
23452345
}
23462346
}
23472347

2348-
/// Represents anything within an `impl` block.
2348+
/// Represents an associated item within an impl block.
2349+
///
2350+
/// Refer to [`Impl`] for an impl block declaration.
23492351
#[derive(Debug, Clone, Copy, HashStable_Generic)]
23502352
pub struct ImplItem<'hir> {
23512353
pub ident: Ident,
@@ -3327,6 +3329,10 @@ pub enum ItemKind<'hir> {
33273329
Impl(&'hir Impl<'hir>),
33283330
}
33293331

3332+
/// Represents an impl block declaration.
3333+
///
3334+
/// E.g., `impl $Type { .. }` or `impl $Trait for $Type { .. }`
3335+
/// Refer to [`ImplItem`] for an associated item within an impl block.
33303336
#[derive(Debug, Clone, Copy, HashStable_Generic)]
33313337
pub struct Impl<'hir> {
33323338
pub safety: Safety,

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use rustc_lint_defs::builtin::REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS;
1515
use rustc_middle::middle::resolve_bound_vars::ResolvedArg;
1616
use rustc_middle::middle::stability::EvalResult;
1717
use rustc_middle::span_bug;
18+
use rustc_middle::ty::error::TypeErrorToStringExt;
1819
use rustc_middle::ty::fold::BottomUpFolder;
1920
use rustc_middle::ty::layout::{LayoutError, MAX_SIMD_LANES};
2021
use rustc_middle::ty::util::{Discr, InspectCoroutineFields, IntTypeExt};

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ use rustc_errors::{codes::*, struct_span_code_err, Applicability, Diag};
4141
use rustc_hir as hir;
4242
use rustc_hir::def_id::{DefId, LocalDefId};
4343
use rustc_hir_analysis::hir_ty_lowering::HirTyLowerer;
44+
use rustc_infer::infer::relate::RelateResult;
4445
use rustc_infer::infer::{Coercion, DefineOpaqueTypes, InferOk, InferResult};
4546
use rustc_infer::traits::{IfExpressionCause, MatchExpressionArmCause};
4647
use rustc_infer::traits::{Obligation, PredicateObligation};
@@ -51,7 +52,6 @@ use rustc_middle::ty::adjustment::{
5152
Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability, PointerCoercion,
5253
};
5354
use rustc_middle::ty::error::TypeError;
54-
use rustc_middle::ty::relate::RelateResult;
5555
use rustc_middle::ty::visit::TypeVisitableExt;
5656
use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt};
5757
use rustc_session::parse::feature_err;

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use rustc_infer::infer::InferOk;
4040
use rustc_infer::traits::query::NoSolution;
4141
use rustc_infer::traits::ObligationCause;
4242
use rustc_middle::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase};
43-
use rustc_middle::ty::error::{ExpectedFound, TypeError::Sorts};
43+
use rustc_middle::ty::error::{ExpectedFound, TypeError};
4444
use rustc_middle::ty::GenericArgsRef;
4545
use rustc_middle::ty::{self, AdtKind, Ty, TypeVisitableExt};
4646
use rustc_middle::{bug, span_bug};
@@ -682,7 +682,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
682682
self.suggest_mismatched_types_on_tail(
683683
&mut err, expr, ty, e_ty, target_id,
684684
);
685-
let error = Some(Sorts(ExpectedFound { expected: ty, found: e_ty }));
685+
let error =
686+
Some(TypeError::Sorts(ExpectedFound { expected: ty, found: e_ty }));
686687
self.annotate_loop_expected_due_to_inference(err, expr, error);
687688
if let Some(val) =
688689
self.err_ctxt().ty_kind_suggestion(self.param_env, ty)

compiler/rustc_infer/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ rustc_macros = { path = "../rustc_macros" }
1818
rustc_middle = { path = "../rustc_middle" }
1919
rustc_span = { path = "../rustc_span" }
2020
rustc_target = { path = "../rustc_target" }
21+
rustc_type_ir = { path = "../rustc_type_ir" }
2122
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
2223
tracing = "0.1"
2324
# tidy-alphabetical-end

compiler/rustc_infer/src/infer/at.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
2828
use super::*;
2929

30+
use crate::infer::relate::{Relate, StructurallyRelateAliases, TypeRelation};
3031
use rustc_middle::bug;
31-
use rustc_middle::ty::relate::{Relate, TypeRelation};
3232
use rustc_middle::ty::{Const, ImplSubject};
3333

3434
/// Whether we should define opaque types or just treat them opaquely.
@@ -90,7 +90,7 @@ impl<'tcx> InferCtxt<'tcx> {
9090
}
9191
}
9292

93-
pub trait ToTrace<'tcx>: Relate<'tcx> + Copy {
93+
pub trait ToTrace<'tcx>: Relate<TyCtxt<'tcx>> + Copy {
9494
fn to_trace(
9595
cause: &ObligationCause<'tcx>,
9696
a_is_expected: bool,

0 commit comments

Comments
 (0)