Skip to content

Commit 8c52f73

Browse files
committed
Auto merge of #151107 - JonathanBrouwer:rollup-9CIxxuZ, r=JonathanBrouwer
Rollup of 11 pull requests Successful merges: - #149408 (refactor: remove Ord bound from BinaryHeap::new etc) - #150406 (Change some `matches!(.., .. if ..)` with let-chains) - #150723 (std: move `errno` and related functions into `sys::io`) - #150877 (resolve: Refactor away the side table `decl_parent_modules`) - #150902 (Update to_uppercase docs to avoid ß->SS example) - #151034 (std: Change UEFI env vars to volatile storage) - #151036 (Better handle when trying to iterate on a `Range` of a type that isn't `Step`) - #151067 (Avoid should-fail in two ui tests and a codegen-llvm test) - #151072 (also handle ENOTTY ioctl errors when checking pidfd -> pid support) - #151077 (Recognize potential `impl<const N: usize>` to `impl<N>` mistake) - #151096 (Remove `Deref`/`DerefMut` impl for `Providers`.) Failed merges: - #150939 (resolve: Relax some asserts in glob overwriting and add tests) r? @ghost
2 parents 2fd6efc + db10879 commit 8c52f73

150 files changed

Lines changed: 1254 additions & 1143 deletions

File tree

Some content is hidden

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

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ impl CodegenBackend for GccCodegenBackend {
286286
}
287287

288288
fn provide(&self, providers: &mut Providers) {
289-
providers.global_backend_features = |tcx, ()| gcc_util::global_gcc_features(tcx.sess)
289+
providers.queries.global_backend_features =
290+
|tcx, ()| gcc_util::global_gcc_features(tcx.sess)
290291
}
291292

292293
fn codegen_crate(&self, tcx: TyCtxt<'_>) -> Box<dyn Any> {

compiler/rustc_codegen_llvm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl CodegenBackend for LlvmCodegenBackend {
264264
}
265265

266266
fn provide(&self, providers: &mut Providers) {
267-
providers.global_backend_features =
267+
providers.queries.global_backend_features =
268268
|tcx, ()| llvm_util::global_llvm_features(tcx.sess, false)
269269
}
270270

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,15 @@ fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_>, def_id: LocalDefId)
474474
}
475475

476476
pub(crate) fn provide(providers: &mut Providers) {
477-
providers.reachable_non_generics = reachable_non_generics_provider;
478-
providers.is_reachable_non_generic = is_reachable_non_generic_provider_local;
479-
providers.exported_non_generic_symbols = exported_non_generic_symbols_provider_local;
480-
providers.exported_generic_symbols = exported_generic_symbols_provider_local;
481-
providers.upstream_monomorphizations = upstream_monomorphizations_provider;
482-
providers.is_unreachable_local_definition = is_unreachable_local_definition_provider;
483-
providers.upstream_drop_glue_for = upstream_drop_glue_for_provider;
484-
providers.upstream_async_drop_glue_for = upstream_async_drop_glue_for_provider;
485-
providers.wasm_import_module_map = wasm_import_module_map;
477+
providers.queries.reachable_non_generics = reachable_non_generics_provider;
478+
providers.queries.is_reachable_non_generic = is_reachable_non_generic_provider_local;
479+
providers.queries.exported_non_generic_symbols = exported_non_generic_symbols_provider_local;
480+
providers.queries.exported_generic_symbols = exported_generic_symbols_provider_local;
481+
providers.queries.upstream_monomorphizations = upstream_monomorphizations_provider;
482+
providers.queries.is_unreachable_local_definition = is_unreachable_local_definition_provider;
483+
providers.queries.upstream_drop_glue_for = upstream_drop_glue_for_provider;
484+
providers.queries.upstream_async_drop_glue_for = upstream_async_drop_glue_for_provider;
485+
providers.queries.wasm_import_module_map = wasm_import_module_map;
486486
providers.extern_queries.is_reachable_non_generic = is_reachable_non_generic_provider_extern;
487487
providers.extern_queries.upstream_monomorphizations_for =
488488
upstream_monomorphizations_for_provider;

compiler/rustc_codegen_ssa/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ pub enum CodegenErrors {
266266

267267
pub fn provide(providers: &mut Providers) {
268268
crate::back::symbol_export::provide(providers);
269-
crate::base::provide(providers);
270-
crate::target_features::provide(providers);
271-
crate::codegen_attrs::provide(providers);
269+
crate::base::provide(&mut providers.queries);
270+
crate::target_features::provide(&mut providers.queries);
271+
crate::codegen_attrs::provide(&mut providers.queries);
272272
providers.queries.global_backend_features = |_tcx: TyCtxt<'_>, ()| vec![];
273273
}
274274

compiler/rustc_const_eval/src/check_consts/check.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -833,12 +833,13 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
833833

834834
// const-eval of `panic_display` assumes the argument is `&&str`
835835
if tcx.is_lang_item(callee, LangItem::PanicDisplay) {
836-
match args[0].node.ty(&self.ccx.body.local_decls, tcx).kind() {
837-
ty::Ref(_, ty, _) if matches!(ty.kind(), ty::Ref(_, ty, _) if ty.is_str()) =>
838-
{}
839-
_ => {
840-
self.check_op(ops::PanicNonStr);
841-
}
836+
if let ty::Ref(_, ty, _) =
837+
args[0].node.ty(&self.ccx.body.local_decls, tcx).kind()
838+
&& let ty::Ref(_, ty, _) = ty.kind()
839+
&& ty.is_str()
840+
{
841+
} else {
842+
self.check_op(ops::PanicNonStr);
842843
}
843844
// Allow this call, skip all the checks below.
844845
return;

compiler/rustc_const_eval/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ pub use self::errors::ReportErrorExt;
3030
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
3131

3232
pub fn provide(providers: &mut Providers) {
33-
const_eval::provide(providers);
34-
providers.tag_for_variant = const_eval::tag_for_variant_provider;
35-
providers.eval_to_const_value_raw = const_eval::eval_to_const_value_raw_provider;
36-
providers.eval_to_allocation_raw = const_eval::eval_to_allocation_raw_provider;
37-
providers.eval_static_initializer = const_eval::eval_static_initializer_provider;
33+
const_eval::provide(&mut providers.queries);
34+
providers.queries.tag_for_variant = const_eval::tag_for_variant_provider;
35+
providers.queries.eval_to_const_value_raw = const_eval::eval_to_const_value_raw_provider;
36+
providers.queries.eval_to_allocation_raw = const_eval::eval_to_allocation_raw_provider;
37+
providers.queries.eval_static_initializer = const_eval::eval_static_initializer_provider;
3838
providers.hooks.const_caller_location = util::caller_location::const_caller_location_provider;
39-
providers.eval_to_valtree = |tcx, ty::PseudoCanonicalInput { typing_env, value }| {
39+
providers.queries.eval_to_valtree = |tcx, ty::PseudoCanonicalInput { typing_env, value }| {
4040
const_eval::eval_to_valtree(tcx, typing_env, value)
4141
};
4242
providers.hooks.try_destructure_mir_constant_for_user_output =
4343
const_eval::try_destructure_mir_constant_for_user_output;
44-
providers.valtree_to_const_val =
44+
providers.queries.valtree_to_const_val =
4545
|tcx, cv| const_eval::valtree_to_const_value(tcx, ty::TypingEnv::fully_monomorphized(), cv);
46-
providers.check_validity_requirement = |tcx, (init_kind, param_env_and_ty)| {
46+
providers.queries.check_validity_requirement = |tcx, (init_kind, param_env_and_ty)| {
4747
util::check_validity_requirement(tcx, init_kind, param_env_and_ty)
4848
};
4949
providers.hooks.validate_scalar_in_layout =

compiler/rustc_interface/src/passes.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -880,36 +880,36 @@ pub fn write_interface<'tcx>(tcx: TyCtxt<'tcx>) {
880880

881881
pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
882882
let providers = &mut Providers::default();
883-
providers.analysis = analysis;
884-
providers.hir_crate = rustc_ast_lowering::lower_to_hir;
885-
providers.resolver_for_lowering_raw = resolver_for_lowering_raw;
886-
providers.stripped_cfg_items = |tcx, _| &tcx.resolutions(()).stripped_cfg_items[..];
887-
providers.resolutions = |tcx, ()| tcx.resolver_for_lowering_raw(()).1;
888-
providers.early_lint_checks = early_lint_checks;
889-
providers.env_var_os = env_var_os;
890-
limits::provide(providers);
891-
proc_macro_decls::provide(providers);
883+
providers.queries.analysis = analysis;
884+
providers.queries.hir_crate = rustc_ast_lowering::lower_to_hir;
885+
providers.queries.resolver_for_lowering_raw = resolver_for_lowering_raw;
886+
providers.queries.stripped_cfg_items = |tcx, _| &tcx.resolutions(()).stripped_cfg_items[..];
887+
providers.queries.resolutions = |tcx, ()| tcx.resolver_for_lowering_raw(()).1;
888+
providers.queries.early_lint_checks = early_lint_checks;
889+
providers.queries.env_var_os = env_var_os;
890+
limits::provide(&mut providers.queries);
891+
proc_macro_decls::provide(&mut providers.queries);
892892
rustc_const_eval::provide(providers);
893-
rustc_middle::hir::provide(providers);
894-
rustc_borrowck::provide(providers);
893+
rustc_middle::hir::provide(&mut providers.queries);
894+
rustc_borrowck::provide(&mut providers.queries);
895895
rustc_incremental::provide(providers);
896896
rustc_mir_build::provide(providers);
897897
rustc_mir_transform::provide(providers);
898898
rustc_monomorphize::provide(providers);
899-
rustc_privacy::provide(providers);
899+
rustc_privacy::provide(&mut providers.queries);
900900
rustc_query_impl::provide(providers);
901-
rustc_resolve::provide(providers);
902-
rustc_hir_analysis::provide(providers);
903-
rustc_hir_typeck::provide(providers);
904-
ty::provide(providers);
905-
traits::provide(providers);
906-
solve::provide(providers);
907-
rustc_passes::provide(providers);
908-
rustc_traits::provide(providers);
909-
rustc_ty_utils::provide(providers);
901+
rustc_resolve::provide(&mut providers.queries);
902+
rustc_hir_analysis::provide(&mut providers.queries);
903+
rustc_hir_typeck::provide(&mut providers.queries);
904+
ty::provide(&mut providers.queries);
905+
traits::provide(&mut providers.queries);
906+
solve::provide(&mut providers.queries);
907+
rustc_passes::provide(&mut providers.queries);
908+
rustc_traits::provide(&mut providers.queries);
909+
rustc_ty_utils::provide(&mut providers.queries);
910910
rustc_metadata::provide(providers);
911-
rustc_lint::provide(providers);
912-
rustc_symbol_mangling::provide(providers);
911+
rustc_lint::provide(&mut providers.queries);
912+
rustc_symbol_mangling::provide(&mut providers.queries);
913913
rustc_codegen_ssa::provide(providers);
914914
*providers
915915
});

compiler/rustc_lint/src/early/diagnostics/check_cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn cargo_help_sub(
7070
// `build_script_build`) to try to figure out if we are building a Cargo build script
7171

7272
let unescaped = &inst(EscapeQuotes::No);
73-
if matches!(&sess.opts.crate_name, Some(crate_name) if crate_name == "build_script_build") {
73+
if let Some("build_script_build") = sess.opts.crate_name.as_deref() {
7474
lints::UnexpectedCfgCargoHelp::lint_cfg(unescaped)
7575
} else {
7676
lints::UnexpectedCfgCargoHelp::lint_cfg_and_build_rs(unescaped, &inst(EscapeQuotes::Yes))

compiler/rustc_lint/src/transmute.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ fn check_int_to_ptr_transmute<'tcx>(
152152
return;
153153
};
154154
// bail-out if the argument is literal 0 as we have other lints for those cases
155-
if matches!(arg.kind, hir::ExprKind::Lit(hir::Lit { node: LitKind::Int(v, _), .. }) if v == 0) {
155+
if let hir::ExprKind::Lit(hir::Lit { node: LitKind::Int(v, _), .. }) = arg.kind
156+
&& v == 0
157+
{
156158
return;
157159
}
158160
// bail-out if the inner type is a ZST

compiler/rustc_metadata/src/rmeta/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,6 @@ const SYMBOL_OFFSET: u8 = 1;
585585
const SYMBOL_PREDEFINED: u8 = 2;
586586

587587
pub fn provide(providers: &mut Providers) {
588-
encoder::provide(providers);
588+
encoder::provide(&mut providers.queries);
589589
decoder::provide(providers);
590590
}

0 commit comments

Comments
 (0)