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

Commit e0ba2d0

Browse files
committed
Auto merge of rust-lang#112987 - compiler-errors:rollup-6anskq1, r=compiler-errors
Rollup of 8 pull requests Successful merges: - rust-lang#111087 (Implement `Sync` for `mpsc::Sender`) - rust-lang#112763 (Bump compiler_builtins) - rust-lang#112963 (Stop bubbling out hidden types from the eval obligation queries) - rust-lang#112965 (Don't emit same goal as input during `wf::unnormalized_obligations`) - rust-lang#112973 (Make sure to include default en-US ftl resources for `rustc_error` crate) - rust-lang#112981 (Fix return type notation errors with -Zlower-impl-trait-in-trait-to-assoc-ty) - rust-lang#112983 (Fix return type notation associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty) - rust-lang#112986 (Update cargo) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1d67eba + d28f037 commit e0ba2d0

File tree

56 files changed

+508
-146
lines changed

Some content is hidden

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

56 files changed

+508
-146
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,9 @@ dependencies = [
697697

698698
[[package]]
699699
name = "compiler_builtins"
700-
version = "0.1.92"
700+
version = "0.1.93"
701701
source = "registry+https://github.com/rust-lang/crates.io-index"
702-
checksum = "64518f1ae689f74db058bbfb3238dfe6eb53f59f4ae712f1ff4348628522e190"
702+
checksum = "76630810d973ecea3dbf611e1b7aecfb1012751ef1ff8de3998f89014a166781"
703703
dependencies = [
704704
"cc",
705705
"rustc-std-workspace-core",

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
9797
rustc_codegen_ssa::DEFAULT_LOCALE_RESOURCE,
9898
rustc_const_eval::DEFAULT_LOCALE_RESOURCE,
9999
rustc_error_messages::DEFAULT_LOCALE_RESOURCE,
100+
rustc_errors::DEFAULT_LOCALE_RESOURCE,
100101
rustc_expand::DEFAULT_LOCALE_RESOURCE,
101102
rustc_hir_analysis::DEFAULT_LOCALE_RESOURCE,
102103
rustc_hir_typeck::DEFAULT_LOCALE_RESOURCE,

compiler/rustc_hir_analysis/src/astconv/bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
412412
// an RPITIT (return-position impl trait in trait) or AFIT (async fn in trait).
413413
let output = tcx.fn_sig(assoc_item.def_id).skip_binder().output();
414414
let output = if let ty::Alias(ty::Projection, alias_ty) = *output.skip_binder().kind()
415-
&& tcx.def_kind(alias_ty.def_id) == DefKind::ImplTraitPlaceholder
415+
&& tcx.is_impl_trait_in_trait(alias_ty.def_id)
416416
{
417417
alias_ty
418418
} else {

compiler/rustc_hir_analysis/src/astconv/errors.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
122122

123123
let all_candidate_names: Vec<_> = all_candidates()
124124
.flat_map(|r| self.tcx().associated_items(r.def_id()).in_definition_order())
125-
.filter_map(
126-
|item| if item.kind == ty::AssocKind::Type { Some(item.name) } else { None },
127-
)
125+
.filter_map(|item| {
126+
if item.opt_rpitit_info.is_none() && item.kind == ty::AssocKind::Type {
127+
Some(item.name)
128+
} else {
129+
None
130+
}
131+
})
128132
.collect();
129133

130134
if let (Some(suggested_name), true) = (
@@ -159,9 +163,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
159163
.flat_map(|trait_def_id| {
160164
self.tcx().associated_items(*trait_def_id).in_definition_order()
161165
})
162-
.filter_map(
163-
|item| if item.kind == ty::AssocKind::Type { Some(item.name) } else { None },
164-
)
166+
.filter_map(|item| {
167+
if item.opt_rpitit_info.is_none() && item.kind == ty::AssocKind::Type {
168+
Some(item.name)
169+
} else {
170+
None
171+
}
172+
})
165173
.collect();
166174

167175
if let (Some(suggested_name), true) = (

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
10491049
}
10501050

10511051
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(ty)) => {
1052+
let ty = self.resolve_vars_if_possible(ty);
10521053
match self.tcx.sess.opts.unstable_opts.trait_solver {
10531054
TraitSolver::Classic => {
10541055
// WF predicates cannot themselves make

compiler/rustc_trait_selection/src/traits/wf.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,19 @@ pub fn unnormalized_obligations<'tcx>(
7777
param_env: ty::ParamEnv<'tcx>,
7878
arg: GenericArg<'tcx>,
7979
) -> Option<Vec<traits::PredicateObligation<'tcx>>> {
80+
debug_assert_eq!(arg, infcx.resolve_vars_if_possible(arg));
81+
82+
// However, if `arg` IS an unresolved inference variable, returns `None`,
83+
// because we are not able to make any progress at all. This is to prevent
84+
// "livelock" where we say "$0 is WF if $0 is WF".
85+
if arg.is_non_region_infer() {
86+
return None;
87+
}
88+
8089
if let ty::GenericArgKind::Lifetime(..) = arg.unpack() {
8190
return Some(vec![]);
8291
}
8392

84-
debug_assert_eq!(arg, infcx.resolve_vars_if_possible(arg));
85-
8693
let mut wf = WfPredicates {
8794
infcx,
8895
param_env,

compiler/rustc_traits/src/evaluate_obligation.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use rustc_infer::infer::TyCtxtInferExt;
22
use rustc_middle::query::Providers;
3-
use rustc_middle::traits::DefiningAnchor;
43
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
54
use rustc_span::source_map::DUMMY_SP;
65
use rustc_trait_selection::traits::query::CanonicalPredicateGoal;
@@ -18,12 +17,8 @@ fn evaluate_obligation<'tcx>(
1817
) -> Result<EvaluationResult, OverflowError> {
1918
assert!(!tcx.next_trait_solver_globally());
2019
debug!("evaluate_obligation(canonical_goal={:#?})", canonical_goal);
21-
// HACK This bubble is required for this tests to pass:
22-
// impl-trait/issue99642.rs
23-
let (ref infcx, goal, _canonical_inference_vars) = tcx
24-
.infer_ctxt()
25-
.with_opaque_type_inference(DefiningAnchor::Bubble)
26-
.build_with_canonical(DUMMY_SP, &canonical_goal);
20+
let (ref infcx, goal, _canonical_inference_vars) =
21+
tcx.infer_ctxt().build_with_canonical(DUMMY_SP, &canonical_goal);
2722
debug!("evaluate_obligation: goal={:#?}", goal);
2823
let ParamEnvAnd { param_env, value: predicate } = goal;
2924

compiler/rustc_traits/src/type_op.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use rustc_infer::infer::canonical::{Canonical, QueryResponse};
22
use rustc_infer::infer::TyCtxtInferExt;
33
use rustc_middle::query::Providers;
44
use rustc_middle::traits::query::NoSolution;
5-
use rustc_middle::traits::DefiningAnchor;
65
use rustc_middle::ty::{FnSig, Lift, PolyFnSig, Ty, TyCtxt, TypeFoldable};
76
use rustc_middle::ty::{ParamEnvAnd, Predicate};
87
use rustc_trait_selection::infer::InferCtxtBuilderExt;
@@ -106,15 +105,10 @@ fn type_op_prove_predicate<'tcx>(
106105
tcx: TyCtxt<'tcx>,
107106
canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, ProvePredicate<'tcx>>>,
108107
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> {
109-
// HACK This bubble is required for this test to pass:
110-
// impl-trait/issue-99642.rs
111-
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).enter_canonical_trait_query(
112-
&canonicalized,
113-
|ocx, key| {
114-
type_op_prove_predicate_with_cause(ocx, key, ObligationCause::dummy());
115-
Ok(())
116-
},
117-
)
108+
tcx.infer_ctxt().enter_canonical_trait_query(&canonicalized, |ocx, key| {
109+
type_op_prove_predicate_with_cause(ocx, key, ObligationCause::dummy());
110+
Ok(())
111+
})
118112
}
119113

120114
/// The core of the `type_op_prove_predicate` query: for diagnostics purposes in NLL HRTB errors,

library/std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ panic_unwind = { path = "../panic_unwind", optional = true }
1818
panic_abort = { path = "../panic_abort" }
1919
core = { path = "../core", public = true }
2020
libc = { version = "0.2.146", default-features = false, features = ['rustc-dep-of-std'], public = true }
21-
compiler_builtins = { version = "0.1.92" }
21+
compiler_builtins = { version = "0.1.93" }
2222
profiler_builtins = { path = "../profiler_builtins", optional = true }
2323
unwind = { path = "../unwind" }
2424
hashbrown = { version = "0.14", default-features = false, features = ['rustc-dep-of-std'] }

library/std/src/sync/mpsc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ pub struct Sender<T> {
347347
#[stable(feature = "rust1", since = "1.0.0")]
348348
unsafe impl<T: Send> Send for Sender<T> {}
349349

350-
#[stable(feature = "rust1", since = "1.0.0")]
351-
impl<T> !Sync for Sender<T> {}
350+
#[stable(feature = "mpsc_sender_sync", since = "CURRENT_RUSTC_VERSION")]
351+
unsafe impl<T: Send> Sync for Sender<T> {}
352352

353353
/// The sending-half of Rust's synchronous [`sync_channel`] type.
354354
///

0 commit comments

Comments
 (0)