From 26e69a88167bd68ad65b22d5ca013f1270b163be Mon Sep 17 00:00:00 2001 From: klensy Date: Sun, 3 Dec 2023 14:02:31 +0300 Subject: [PATCH 01/40] compiler: replace cstr macro with c str literals in compiler and few other c str replacements --- Cargo.lock | 11 ------ compiler/rustc_codegen_llvm/Cargo.toml | 1 - compiler/rustc_codegen_llvm/src/allocator.rs | 2 +- compiler/rustc_codegen_llvm/src/back/lto.rs | 2 +- compiler/rustc_codegen_llvm/src/back/write.rs | 11 +++--- compiler/rustc_codegen_llvm/src/base.rs | 6 ++-- compiler/rustc_codegen_llvm/src/builder.rs | 16 +++------ compiler/rustc_codegen_llvm/src/consts.rs | 7 ++-- compiler/rustc_codegen_llvm/src/context.rs | 34 +++++++++---------- .../rustc_codegen_llvm/src/debuginfo/gdb.rs | 7 ++-- .../src/debuginfo/metadata.rs | 7 ++-- .../rustc_codegen_llvm/src/debuginfo/mod.rs | 7 ++-- compiler/rustc_codegen_llvm/src/lib.rs | 1 + src/tools/tidy/src/deps.rs | 1 - 14 files changed, 42 insertions(+), 71 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 75c5f78e2b648..4db3d2e461b79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -869,16 +869,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "cstr" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c11a39d776a3b35896711da8a04dc1835169dcd36f710878187637314e47941b" -dependencies = [ - "proc-macro2", - "quote", -] - [[package]] name = "ctrlc" version = "3.4.0" @@ -3585,7 +3575,6 @@ name = "rustc_codegen_llvm" version = "0.0.0" dependencies = [ "bitflags 1.3.2", - "cstr", "itertools", "libc", "measureme", diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index 580ef9b06e703..7122c055e7ea7 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -9,7 +9,6 @@ test = false [dependencies] # tidy-alphabetical-start bitflags = "1.0" -cstr = "0.2" itertools = "0.11" libc = "0.2" measureme = "10.0.0" diff --git a/compiler/rustc_codegen_llvm/src/allocator.rs b/compiler/rustc_codegen_llvm/src/allocator.rs index 798014d668e22..8a82a156f3cee 100644 --- a/compiler/rustc_codegen_llvm/src/allocator.rs +++ b/compiler/rustc_codegen_llvm/src/allocator.rs @@ -146,7 +146,7 @@ fn create_wrapper_function( } llvm::LLVMRustSetVisibility(callee, llvm::Visibility::Hidden); - let llbb = llvm::LLVMAppendBasicBlockInContext(llcx, llfn, "entry\0".as_ptr().cast()); + let llbb = llvm::LLVMAppendBasicBlockInContext(llcx, llfn, c"entry".as_ptr().cast()); let llbuilder = llvm::LLVMCreateBuilderInContext(llcx); llvm::LLVMPositionBuilderAtEnd(llbuilder, llbb); diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index db297425b03bf..eab3d0718880e 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -631,7 +631,7 @@ pub(crate) fn run_pass_manager( llvm::LLVMRustAddModuleFlag( module.module_llvm.llmod(), llvm::LLVMModFlagBehavior::Error, - "LTOPostLink\0".as_ptr().cast(), + c"LTOPostLink".as_ptr().cast(), 1, ); } diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 1a567c0fce816..54c915210c431 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -916,6 +916,7 @@ fn target_is_aix(cgcx: &CodegenContext) -> bool { cgcx.opts.target_triple.triple().contains("-aix") } +//FIXME use c string literals here too pub(crate) fn bitcode_section_name(cgcx: &CodegenContext) -> &'static str { if target_is_apple(cgcx) { "__LLVM,__bitcode\0" @@ -994,7 +995,7 @@ unsafe fn embed_bitcode( let llglobal = llvm::LLVMAddGlobal( llmod, common::val_ty(llconst), - "rustc.embedded.module\0".as_ptr().cast(), + c"rustc.embedded.module".as_ptr().cast(), ); llvm::LLVMSetInitializer(llglobal, llconst); @@ -1007,15 +1008,15 @@ unsafe fn embed_bitcode( let llglobal = llvm::LLVMAddGlobal( llmod, common::val_ty(llconst), - "rustc.embedded.cmdline\0".as_ptr().cast(), + c"rustc.embedded.cmdline".as_ptr().cast(), ); llvm::LLVMSetInitializer(llglobal, llconst); let section = if is_apple { - "__LLVM,__cmdline\0" + c"__LLVM,__cmdline" } else if is_aix { - ".info\0" + c".info" } else { - ".llvmcmd\0" + c".llvmcmd" }; llvm::LLVMSetSection(llglobal, section.as_ptr().cast()); llvm::LLVMRustSetLinkage(llglobal, llvm::Linkage::PrivateLinkage); diff --git a/compiler/rustc_codegen_llvm/src/base.rs b/compiler/rustc_codegen_llvm/src/base.rs index b659fd02eecf6..5dc271ccddb7c 100644 --- a/compiler/rustc_codegen_llvm/src/base.rs +++ b/compiler/rustc_codegen_llvm/src/base.rs @@ -19,8 +19,6 @@ use crate::context::CodegenCx; use crate::llvm; use crate::value::Value; -use cstr::cstr; - use rustc_codegen_ssa::base::maybe_create_entry_wrapper; use rustc_codegen_ssa::mono_item::MonoItemExt; use rustc_codegen_ssa::traits::*; @@ -110,11 +108,11 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen // Create the llvm.used and llvm.compiler.used variables. if !cx.used_statics.borrow().is_empty() { - cx.create_used_variable_impl(cstr!("llvm.used"), &*cx.used_statics.borrow()); + cx.create_used_variable_impl(c"llvm.used", &*cx.used_statics.borrow()); } if !cx.compiler_used_statics.borrow().is_empty() { cx.create_used_variable_impl( - cstr!("llvm.compiler.used"), + c"llvm.compiler.used", &*cx.compiler_used_statics.borrow(), ); } diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index 7b259055d40b5..69ddccd5d6281 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -7,7 +7,6 @@ use crate::llvm_util; use crate::type_::Type; use crate::type_of::LayoutLlvmExt; use crate::value::Value; -use cstr::cstr; use libc::{c_char, c_uint}; use rustc_codegen_ssa::common::{IntPredicate, RealPredicate, SynchronizationScope, TypeKind}; use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue}; @@ -27,7 +26,6 @@ use rustc_target::abi::{self, call::FnAbi, Align, Size, WrappingRange}; use rustc_target::spec::{HasTargetSpec, SanitizerSet, Target}; use smallvec::SmallVec; use std::borrow::Cow; -use std::ffi::CStr; use std::iter; use std::ops::Deref; use std::ptr; @@ -47,13 +45,10 @@ impl Drop for Builder<'_, '_, '_> { } } -// FIXME(eddyb) use a checked constructor when they become `const fn`. -const EMPTY_C_STR: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"\0") }; - /// Empty string, to be used where LLVM expects an instruction name, indicating /// that the instruction is to be left unnamed (i.e. numbered, in textual IR). // FIXME(eddyb) pass `&CStr` directly to FFI once it's a thin pointer. -const UNNAMED: *const c_char = EMPTY_C_STR.as_ptr(); +const UNNAMED: *const c_char = c"".as_ptr(); impl<'ll, 'tcx> BackendTypes for Builder<'_, 'll, 'tcx> { type Value = as BackendTypes>::Value; @@ -1003,14 +998,13 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { } fn cleanup_pad(&mut self, parent: Option<&'ll Value>, args: &[&'ll Value]) -> Funclet<'ll> { - let name = cstr!("cleanuppad"); let ret = unsafe { llvm::LLVMBuildCleanupPad( self.llbuilder, parent, args.as_ptr(), args.len() as c_uint, - name.as_ptr(), + c"cleanuppad".as_ptr(), ) }; Funclet::new(ret.expect("LLVM does not have support for cleanuppad")) @@ -1024,14 +1018,13 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { } fn catch_pad(&mut self, parent: &'ll Value, args: &[&'ll Value]) -> Funclet<'ll> { - let name = cstr!("catchpad"); let ret = unsafe { llvm::LLVMBuildCatchPad( self.llbuilder, parent, args.as_ptr(), args.len() as c_uint, - name.as_ptr(), + c"catchpad".as_ptr(), ) }; Funclet::new(ret.expect("LLVM does not have support for catchpad")) @@ -1043,14 +1036,13 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { unwind: Option<&'ll BasicBlock>, handlers: &[&'ll BasicBlock], ) -> &'ll Value { - let name = cstr!("catchswitch"); let ret = unsafe { llvm::LLVMBuildCatchSwitch( self.llbuilder, parent, unwind, handlers.len() as c_uint, - name.as_ptr(), + c"catchswitch".as_ptr(), ) }; let ret = ret.expect("LLVM does not have support for catchswitch"); diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs index b6bc5395bf6b3..3d6678c0b1221 100644 --- a/compiler/rustc_codegen_llvm/src/consts.rs +++ b/compiler/rustc_codegen_llvm/src/consts.rs @@ -8,7 +8,6 @@ use crate::llvm::{self, True}; use crate::type_::Type; use crate::type_of::LayoutLlvmExt; use crate::value::Value; -use cstr::cstr; use rustc_codegen_ssa::traits::*; use rustc_hir::def_id::DefId; use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; @@ -476,9 +475,9 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> { .all(|&byte| byte == 0); let sect_name = if all_bytes_are_zero { - cstr!("__DATA,__thread_bss") + c"__DATA,__thread_bss" } else { - cstr!("__DATA,__thread_data") + c"__DATA,__thread_data" }; llvm::LLVMSetSection(g, sect_name.as_ptr()); } @@ -507,7 +506,7 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> { let val = llvm::LLVMMetadataAsValue(self.llcx, meta); llvm::LLVMAddNamedMetadataOperand( self.llmod, - "wasm.custom_sections\0".as_ptr().cast(), + c"wasm.custom_sections".as_ptr().cast(), val, ); } diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 92a8c00510b94..da110f4dd54e9 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -8,7 +8,6 @@ use crate::llvm_util; use crate::type_::Type; use crate::value::Value; -use cstr::cstr; use rustc_codegen_ssa::base::{wants_msvc_seh, wants_wasm_eh}; use rustc_codegen_ssa::errors as ssa_errors; use rustc_codegen_ssa::traits::*; @@ -214,13 +213,13 @@ pub unsafe fn create_module<'ll>( // If skipping the PLT is enabled, we need to add some module metadata // to ensure intrinsic calls don't use it. if !sess.needs_plt() { - let avoid_plt = "RtLibUseGOT\0".as_ptr().cast(); + let avoid_plt = c"RtLibUseGOT".as_ptr().cast(); llvm::LLVMRustAddModuleFlag(llmod, llvm::LLVMModFlagBehavior::Warning, avoid_plt, 1); } // Enable canonical jump tables if CFI is enabled. (See https://reviews.llvm.org/D65629.) if sess.is_sanitizer_cfi_canonical_jump_tables_enabled() && sess.is_sanitizer_cfi_enabled() { - let canonical_jump_tables = "CFI Canonical Jump Tables\0".as_ptr().cast(); + let canonical_jump_tables = c"CFI Canonical Jump Tables".as_ptr().cast(); llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Override, @@ -231,7 +230,7 @@ pub unsafe fn create_module<'ll>( // Enable LTO unit splitting if specified or if CFI is enabled. (See https://reviews.llvm.org/D53891.) if sess.is_split_lto_unit_enabled() || sess.is_sanitizer_cfi_enabled() { - let enable_split_lto_unit = "EnableSplitLTOUnit\0".as_ptr().cast(); + let enable_split_lto_unit = c"EnableSplitLTOUnit".as_ptr().cast(); llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Override, @@ -242,7 +241,7 @@ pub unsafe fn create_module<'ll>( // Add "kcfi" module flag if KCFI is enabled. (See https://reviews.llvm.org/D119296.) if sess.is_sanitizer_kcfi_enabled() { - let kcfi = "kcfi\0".as_ptr().cast(); + let kcfi = c"kcfi".as_ptr().cast(); llvm::LLVMRustAddModuleFlag(llmod, llvm::LLVMModFlagBehavior::Override, kcfi, 1); } @@ -255,7 +254,7 @@ pub unsafe fn create_module<'ll>( llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Warning, - "cfguard\0".as_ptr() as *const _, + c"cfguard".as_ptr() as *const _, 1, ) } @@ -264,7 +263,7 @@ pub unsafe fn create_module<'ll>( llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Warning, - "cfguard\0".as_ptr() as *const _, + c"cfguard".as_ptr() as *const _, 2, ) } @@ -282,26 +281,26 @@ pub unsafe fn create_module<'ll>( llvm::LLVMRustAddModuleFlag( llmod, behavior, - "branch-target-enforcement\0".as_ptr().cast(), + c"branch-target-enforcement".as_ptr().cast(), bti.into(), ); llvm::LLVMRustAddModuleFlag( llmod, behavior, - "sign-return-address\0".as_ptr().cast(), + c"sign-return-address".as_ptr().cast(), pac_ret.is_some().into(), ); let pac_opts = pac_ret.unwrap_or(PacRet { leaf: false, key: PAuthKey::A }); llvm::LLVMRustAddModuleFlag( llmod, behavior, - "sign-return-address-all\0".as_ptr().cast(), + c"sign-return-address-all".as_ptr().cast(), pac_opts.leaf.into(), ); llvm::LLVMRustAddModuleFlag( llmod, behavior, - "sign-return-address-with-bkey\0".as_ptr().cast(), + c"sign-return-address-with-bkey".as_ptr().cast(), u32::from(pac_opts.key == PAuthKey::B), ); } else { @@ -317,7 +316,7 @@ pub unsafe fn create_module<'ll>( llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Override, - "cf-protection-branch\0".as_ptr().cast(), + c"cf-protection-branch".as_ptr().cast(), 1, ) } @@ -325,7 +324,7 @@ pub unsafe fn create_module<'ll>( llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Override, - "cf-protection-return\0".as_ptr().cast(), + c"cf-protection-return".as_ptr().cast(), 1, ) } @@ -334,7 +333,7 @@ pub unsafe fn create_module<'ll>( llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Error, - "Virtual Function Elim\0".as_ptr().cast(), + c"Virtual Function Elim".as_ptr().cast(), 1, ); } @@ -344,7 +343,7 @@ pub unsafe fn create_module<'ll>( llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Warning, - "ehcontguard\0".as_ptr() as *const _, + c"ehcontguard".as_ptr() as *const _, 1, ) } @@ -362,7 +361,7 @@ pub unsafe fn create_module<'ll>( ); llvm::LLVMAddNamedMetadataOperand( llmod, - cstr!("llvm.ident").as_ptr(), + c"llvm.ident".as_ptr(), llvm::LLVMMDNodeInContext(llcx, &name_metadata, 1), ); @@ -510,14 +509,13 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { } pub(crate) fn create_used_variable_impl(&self, name: &'static CStr, values: &[&'ll Value]) { - let section = cstr!("llvm.metadata"); let array = self.const_array(self.type_ptr(), values); unsafe { let g = llvm::LLVMAddGlobal(self.llmod, self.val_ty(array), name.as_ptr()); llvm::LLVMSetInitializer(g, array); llvm::LLVMRustSetLinkage(g, llvm::Linkage::AppendingLinkage); - llvm::LLVMSetSection(g, section.as_ptr()); + llvm::LLVMSetSection(g, c"llvm.metadata".as_ptr()); } } } diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs b/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs index 425e935bc9f2e..d82b1e1e721ba 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs @@ -30,14 +30,13 @@ pub fn insert_reference_to_gdb_debug_scripts_section_global(bx: &mut Builder<'_, /// Allocates the global variable responsible for the .debug_gdb_scripts binary /// section. pub fn get_or_insert_gdb_debug_scripts_section_global<'ll>(cx: &CodegenCx<'ll, '_>) -> &'ll Value { - let c_section_var_name = "__rustc_debug_gdb_scripts_section__\0"; - let section_var_name = &c_section_var_name[..c_section_var_name.len() - 1]; + let c_section_var_name = c"__rustc_debug_gdb_scripts_section__"; + let section_var_name = c_section_var_name.to_str().unwrap(); let section_var = unsafe { llvm::LLVMGetNamedGlobal(cx.llmod, c_section_var_name.as_ptr().cast()) }; section_var.unwrap_or_else(|| { - let section_name = b".debug_gdb_scripts\0"; let mut section_contents = Vec::new(); // Add the pretty printers for the standard library first. @@ -70,7 +69,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global<'ll>(cx: &CodegenCx<'ll, ' let section_var = cx .define_global(section_var_name, llvm_type) .unwrap_or_else(|| bug!("symbol `{}` is already defined", section_var_name)); - llvm::LLVMSetSection(section_var, section_name.as_ptr().cast()); + llvm::LLVMSetSection(section_var, c".debug_gdb_scripts".as_ptr().cast()); llvm::LLVMSetInitializer(section_var, cx.const_bytes(section_contents)); llvm::LLVMSetGlobalConstant(section_var, llvm::True); llvm::LLVMSetUnnamedAddress(section_var, llvm::UnnamedAddr::Global); diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index cf78fc56b498c..7c0abbcce1d0c 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -20,7 +20,6 @@ use crate::llvm::debuginfo::{ }; use crate::value::Value; -use cstr::cstr; use rustc_codegen_ssa::debuginfo::type_names::cpp_like_debuginfo; use rustc_codegen_ssa::debuginfo::type_names::VTableNameKind; use rustc_codegen_ssa::traits::*; @@ -854,7 +853,6 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>( use rustc_session::RemapFileNameExt; let name_in_debuginfo = name_in_debuginfo.to_string_lossy(); let work_dir = tcx.sess.opts.working_dir.for_codegen(tcx.sess).to_string_lossy(); - let flags = "\0"; let output_filenames = tcx.output_filenames(()); let split_name = if tcx.sess.target_can_use_split_dwarf() { output_filenames @@ -897,7 +895,7 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>( producer.as_ptr().cast(), producer.len(), tcx.sess.opts.optimize != config::OptLevel::No, - flags.as_ptr().cast(), + c"".as_ptr().cast(), 0, // NB: this doesn't actually have any perceptible effect, it seems. LLVM will instead // put the path supplied to `MCSplitDwarfFile` into the debug info of the final @@ -926,8 +924,7 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>( ); let val = llvm::LLVMMetadataAsValue(debug_context.llcontext, gcov_metadata); - let llvm_gcov_ident = cstr!("llvm.gcov"); - llvm::LLVMAddNamedMetadataOperand(debug_context.llmod, llvm_gcov_ident.as_ptr(), val); + llvm::LLVMAddNamedMetadataOperand(debug_context.llmod, c"llvm.gcov".as_ptr(), val); } return unit_metadata; diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs index 4832b147a5444..6e63c368daaa1 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs @@ -112,7 +112,7 @@ impl<'ll, 'tcx> CodegenUnitDebugContext<'ll, 'tcx> { llvm::LLVMRustAddModuleFlag( self.llmod, llvm::LLVMModFlagBehavior::Warning, - "Dwarf Version\0".as_ptr().cast(), + c"Dwarf Version".as_ptr().cast(), dwarf_version, ); } else { @@ -120,17 +120,16 @@ impl<'ll, 'tcx> CodegenUnitDebugContext<'ll, 'tcx> { llvm::LLVMRustAddModuleFlag( self.llmod, llvm::LLVMModFlagBehavior::Warning, - "CodeView\0".as_ptr().cast(), + c"CodeView".as_ptr().cast(), 1, ) } // Prevent bitcode readers from deleting the debug info. - let ptr = "Debug Info Version\0".as_ptr(); llvm::LLVMRustAddModuleFlag( self.llmod, llvm::LLVMModFlagBehavior::Warning, - ptr.cast(), + c"Debug Info Version".as_ptr().cast(), llvm::LLVMRustDebugMetadataVersion(), ); } diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 915cf31de08fb..53d4e9f9ce5a1 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -8,6 +8,7 @@ #![feature(rustdoc_internals)] #![doc(rust_logo)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] +#![cfg_attr(bootstrap, feature(c_str_literals))] #![feature(exact_size_is_empty)] #![feature(extern_types)] #![feature(hash_raw_entry)] diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 1f8edd7937b49..551fd00f70284 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -210,7 +210,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "crossbeam-epoch", "crossbeam-utils", "crypto-common", - "cstr", "darling", "darling_core", "darling_macro", From c0134887d2b4cbac421babcd40710cc9b755f931 Mon Sep 17 00:00:00 2001 From: klensy Date: Sun, 3 Dec 2023 14:24:25 +0300 Subject: [PATCH 02/40] library: use c string literals --- library/std/src/lib.rs | 1 + library/std/src/sys/unix/args.rs | 16 +++++++++------- library/std/src/sys/unix/fs.rs | 2 +- library/std/src/sys/unix/mod.rs | 7 +++---- .../std/src/sys/unix/process/process_common.rs | 9 ++++----- library/std/src/sys/unix/thread.rs | 3 +-- library/std/src/sys/windows/c.rs | 4 ++-- library/std/src/sys/windows/compat.rs | 6 +++--- library/std/src/sys/windows/mod.rs | 4 ++-- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 52b1fe822d6c2..d08f0b1c9d0b3 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -308,6 +308,7 @@ // // Library features (core): // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(c_str_literals))] #![feature(char_internals)] #![feature(core_intrinsics)] #![feature(core_io_borrowed_buf)] diff --git a/library/std/src/sys/unix/args.rs b/library/std/src/sys/unix/args.rs index 2da17fabcd64d..9f7dcc0416e52 100644 --- a/library/std/src/sys/unix/args.rs +++ b/library/std/src/sys/unix/args.rs @@ -244,13 +244,15 @@ mod imp { let mut res = Vec::new(); unsafe { - let process_info_sel = sel_registerName("processInfo\0".as_ptr()); - let arguments_sel = sel_registerName("arguments\0".as_ptr()); - let utf8_sel = sel_registerName("UTF8String\0".as_ptr()); - let count_sel = sel_registerName("count\0".as_ptr()); - let object_at_sel = sel_registerName("objectAtIndex:\0".as_ptr()); - - let klass = objc_getClass("NSProcessInfo\0".as_ptr()); + let process_info_sel = + sel_registerName(c"processInfo".as_ptr() as *const libc::c_uchar); + let arguments_sel = sel_registerName(c"arguments".as_ptr() as *const libc::c_uchar); + let utf8_sel = sel_registerName(c"UTF8String".as_ptr() as *const libc::c_uchar); + let count_sel = sel_registerName(c"count".as_ptr() as *const libc::c_uchar); + let object_at_sel = + sel_registerName(c"objectAtIndex:".as_ptr() as *const libc::c_uchar); + + let klass = objc_getClass(c"NSProcessInfo".as_ptr() as *const libc::c_uchar); let info = objc_msgSend(klass, process_info_sel); let args = objc_msgSend(info, arguments_sel); diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index e3455cfef3380..72e7b1b1fc306 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -1140,7 +1140,7 @@ impl File { cfg_has_statx! { if let Some(ret) = unsafe { try_statx( fd, - b"\0" as *const _ as *const c_char, + c"".as_ptr() as *const c_char, libc::AT_EMPTY_PATH | libc::AT_STATX_SYNC_AS_STAT, libc::STATX_ALL, ) } { diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 4b28f6feba5a5..b5da5f870ec12 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -1,6 +1,5 @@ #![allow(missing_docs, nonstandard_style)] -use crate::ffi::CStr; use crate::io::ErrorKind; pub use self::rand::hashmap_random_keys; @@ -75,7 +74,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { // thread-id for the main thread and so renaming the main thread will rename the // process and we only want to enable this on platforms we've tested. if cfg!(target_os = "macos") { - thread::Thread::set_name(&CStr::from_bytes_with_nul_unchecked(b"main\0")); + thread::Thread::set_name(&c"main"); } unsafe fn sanitize_standard_fds() { @@ -127,7 +126,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { if pfd.revents & libc::POLLNVAL == 0 { continue; } - if open64("/dev/null\0".as_ptr().cast(), libc::O_RDWR, 0) == -1 { + if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { // If the stream is closed but we failed to reopen it, abort the // process. Otherwise we wouldn't preserve the safety of // operations on the corresponding Rust object Stdin, Stdout, or @@ -157,7 +156,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { use libc::open64; for fd in 0..3 { if libc::fcntl(fd, libc::F_GETFD) == -1 && errno() == libc::EBADF { - if open64("/dev/null\0".as_ptr().cast(), libc::O_RDWR, 0) == -1 { + if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { // If the stream is closed but we failed to reopen it, abort the // process. Otherwise we wouldn't preserve the safety of // operations on the corresponding Rust object Stdin, Stdout, or diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs index bac32d9e60e11..c5f04fb8b3b1a 100644 --- a/library/std/src/sys/unix/process/process_common.rs +++ b/library/std/src/sys/unix/process/process_common.rs @@ -24,11 +24,11 @@ cfg_if::cfg_if! { if #[cfg(target_os = "fuchsia")] { // fuchsia doesn't have /dev/null } else if #[cfg(target_os = "redox")] { - const DEV_NULL: &str = "null:\0"; + const DEV_NULL: &CStr = c"null:"; } else if #[cfg(target_os = "vxworks")] { - const DEV_NULL: &str = "/null\0"; + const DEV_NULL: &CStr = c"/null"; } else { - const DEV_NULL: &str = "/dev/null\0"; + const DEV_NULL: &CStr = c"/dev/null"; } } @@ -481,8 +481,7 @@ impl Stdio { let mut opts = OpenOptions::new(); opts.read(readable); opts.write(!readable); - let path = unsafe { CStr::from_ptr(DEV_NULL.as_ptr() as *const _) }; - let fd = File::open_c(&path, &opts)?; + let fd = File::open_c(DEV_NULL, &opts)?; Ok((ChildStdio::Owned(fd.into_inner()), None)) } diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index 29db9468e5f64..76b96bb37df1c 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -163,10 +163,9 @@ impl Thread { #[cfg(target_os = "netbsd")] pub fn set_name(name: &CStr) { unsafe { - let cname = CStr::from_bytes_with_nul_unchecked(b"%s\0".as_slice()); let res = libc::pthread_setname_np( libc::pthread_self(), - cname.as_ptr(), + c"%s".as_ptr(), name.as_ptr() as *mut libc::c_void, ); debug_assert_eq!(res, 0); diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs index 7435b21be4c90..d55d9bace811c 100644 --- a/library/std/src/sys/windows/c.rs +++ b/library/std/src/sys/windows/c.rs @@ -324,7 +324,7 @@ pub unsafe fn NtWriteFile( // Functions that aren't available on every version of Windows that we support, // but we still use them and just provide some form of a fallback implementation. compat_fn_with_fallback! { - pub static KERNEL32: &CStr = ansi_str!("kernel32"); + pub static KERNEL32: &CStr = c"kernel32"; // >= Win10 1607 // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription @@ -357,7 +357,7 @@ compat_fn_optional! { } compat_fn_with_fallback! { - pub static NTDLL: &CStr = ansi_str!("ntdll"); + pub static NTDLL: &CStr = c"ntdll"; pub fn NtCreateKeyedEvent( KeyedEventHandle: LPHANDLE, diff --git a/library/std/src/sys/windows/compat.rs b/library/std/src/sys/windows/compat.rs index e28dd49353678..f60b3a2c700f2 100644 --- a/library/std/src/sys/windows/compat.rs +++ b/library/std/src/sys/windows/compat.rs @@ -225,9 +225,9 @@ macro_rules! compat_fn_optional { /// Load all needed functions from "api-ms-win-core-synch-l1-2-0". pub(super) fn load_synch_functions() { fn try_load() -> Option<()> { - const MODULE_NAME: &CStr = ansi_str!("api-ms-win-core-synch-l1-2-0"); - const WAIT_ON_ADDRESS: &CStr = ansi_str!("WaitOnAddress"); - const WAKE_BY_ADDRESS_SINGLE: &CStr = ansi_str!("WakeByAddressSingle"); + const MODULE_NAME: &CStr = c"api-ms-win-core-synch-l1-2-0"; + const WAIT_ON_ADDRESS: &CStr = c"WaitOnAddress"; + const WAKE_BY_ADDRESS_SINGLE: &CStr = c"WakeByAddressSingle"; // Try loading the library and all the required functions. // If any step fails, then they all fail. diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs index 9c83d6eb8bf68..8b722f01a5d30 100644 --- a/library/std/src/sys/windows/mod.rs +++ b/library/std/src/sys/windows/mod.rs @@ -1,6 +1,6 @@ #![allow(missing_docs, nonstandard_style)] -use crate::ffi::{CStr, OsStr, OsString}; +use crate::ffi::{OsStr, OsString}; use crate::io::ErrorKind; use crate::mem::MaybeUninit; use crate::os::windows::ffi::{OsStrExt, OsStringExt}; @@ -63,7 +63,7 @@ pub unsafe fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) { // Normally, `thread::spawn` will call `Thread::set_name` but since this thread already // exists, we have to call it ourselves. - thread::Thread::set_name(CStr::from_bytes_with_nul_unchecked(b"main\0")); + thread::Thread::set_name(&c"main"); } // SAFETY: must be called only once during runtime cleanup. From 520662eb2ac157bf4bfcda83838c9dac89c9daf4 Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 9 Dec 2023 15:19:08 -0500 Subject: [PATCH 03/40] fix --dry-run when the change-id warning is printed --- src/bootstrap/src/bin/main.rs | 2 +- src/bootstrap/src/core/config/config.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index 952ef40ed424d..3d593392e79f4 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -143,7 +143,7 @@ fn check_version(config: &Config) -> Option { "update `config.toml` to use `change-id = {latest_change_id}` instead" )); - if io::stdout().is_terminal() { + if io::stdout().is_terminal() && !config.dry_run() { t!(fs::write(warned_id_path, latest_change_id.to_string())); } } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 22e8ce8365b1f..02b596f2b5aab 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1741,7 +1741,7 @@ impl Config { config } - pub(crate) fn dry_run(&self) -> bool { + pub fn dry_run(&self) -> bool { match self.dry_run { DryRun::Disabled => false, DryRun::SelfCheck | DryRun::UserSelected => true, From f38d1e971dcba3a3e9739d0d5aaf5f14329118bd Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Mon, 4 Dec 2023 20:42:41 +0000 Subject: [PATCH 04/40] global param_env canonicalization cache --- .../src/infer/canonical/canonicalizer.rs | 94 ++++++++++++++++--- compiler/rustc_infer/src/infer/combine.rs | 2 +- compiler/rustc_middle/src/infer/canonical.rs | 37 ++++++++ compiler/rustc_middle/src/query/mod.rs | 4 +- compiler/rustc_middle/src/ty/context.rs | 5 +- .../rustc_trait_selection/src/traits/misc.rs | 8 +- 6 files changed, 128 insertions(+), 22 deletions(-) diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index 473a3965885fe..d3ab3c0afe21c 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -35,13 +35,13 @@ impl<'tcx> InferCtxt<'tcx> { /// [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html#canonicalizing-the-query pub fn canonicalize_query( &self, - value: V, + value: ty::ParamEnvAnd<'tcx, V>, query_state: &mut OriginalQueryValues<'tcx>, - ) -> Canonical<'tcx, V> + ) -> Canonical<'tcx, ty::ParamEnvAnd<'tcx, V>> where V: TypeFoldable>, { - Canonicalizer::canonicalize(value, self, self.tcx, &CanonicalizeAllFreeRegions, query_state) + self.canonicalize_query_with_mode(value, query_state, &CanonicalizeAllFreeRegions) } /// Like [Self::canonicalize_query], but preserves distinct universes. For @@ -126,19 +126,52 @@ impl<'tcx> InferCtxt<'tcx> { /// handling of `'static` regions (e.g. trait evaluation). pub fn canonicalize_query_keep_static( &self, - value: V, + value: ty::ParamEnvAnd<'tcx, V>, query_state: &mut OriginalQueryValues<'tcx>, - ) -> Canonical<'tcx, V> + ) -> Canonical<'tcx, ty::ParamEnvAnd<'tcx, V>> where V: TypeFoldable>, { - Canonicalizer::canonicalize( + self.canonicalize_query_with_mode( + value, + query_state, + &CanonicalizeFreeRegionsOtherThanStatic, + ) + } + + fn canonicalize_query_with_mode( + &self, + value: ty::ParamEnvAnd<'tcx, V>, + query_state: &mut OriginalQueryValues<'tcx>, + canonicalize_region_mode: &dyn CanonicalizeMode, + ) -> Canonical<'tcx, ty::ParamEnvAnd<'tcx, V>> + where + V: TypeFoldable>, + { + let (param_env, value) = value.into_parts(); + let base = self.tcx.canonical_param_env_cache.get_or_insert( + param_env, + query_state, + |query_state| { + Canonicalizer::canonicalize( + param_env, + self, + self.tcx, + &CanonicalizeFreeRegionsOtherThanStatic, + query_state, + ) + }, + ); + + Canonicalizer::canonicalize_with_base( + base, value, self, self.tcx, - &CanonicalizeFreeRegionsOtherThanStatic, + canonicalize_region_mode, query_state, ) + .unchecked_map(|(param_env, value)| param_env.and(value)) } } @@ -567,6 +600,33 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { canonicalize_region_mode: &dyn CanonicalizeMode, query_state: &mut OriginalQueryValues<'tcx>, ) -> Canonical<'tcx, V> + where + V: TypeFoldable>, + { + let base = Canonical { + max_universe: ty::UniverseIndex::ROOT, + variables: List::empty(), + value: (), + }; + Canonicalizer::canonicalize_with_base( + base, + value, + infcx, + tcx, + canonicalize_region_mode, + query_state, + ) + .unchecked_map(|((), val)| val) + } + + fn canonicalize_with_base( + base: Canonical<'tcx, U>, + value: V, + infcx: &InferCtxt<'tcx>, + tcx: TyCtxt<'tcx>, + canonicalize_region_mode: &dyn CanonicalizeMode, + query_state: &mut OriginalQueryValues<'tcx>, + ) -> Canonical<'tcx, (U, V)> where V: TypeFoldable>, { @@ -578,12 +638,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { // Fast path: nothing that needs to be canonicalized. if !value.has_type_flags(needs_canonical_flags) { - let canon_value = Canonical { - max_universe: ty::UniverseIndex::ROOT, - variables: List::empty(), - value, - }; - return canon_value; + return base.unchecked_map(|b| (b, value)); } let mut canonicalizer = Canonicalizer { @@ -591,11 +646,20 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { tcx, canonicalize_mode: canonicalize_region_mode, needs_canonical_flags, - variables: SmallVec::new(), + variables: SmallVec::from_slice(base.variables), query_state, indices: FxHashMap::default(), binder_index: ty::INNERMOST, }; + if canonicalizer.query_state.var_values.spilled() { + canonicalizer.indices = canonicalizer + .query_state + .var_values + .iter() + .enumerate() + .map(|(i, &kind)| (kind, BoundVar::new(i))) + .collect(); + } let out_value = value.fold_with(&mut canonicalizer); // Once we have canonicalized `out_value`, it should not @@ -612,7 +676,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { .max() .unwrap_or(ty::UniverseIndex::ROOT); - Canonical { max_universe, variables: canonical_variables, value: out_value } + Canonical { max_universe, variables: canonical_variables, value: (base.value, out_value) } } /// Creates a canonical variable replacing `kind` from the input, diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs index bab21bc237a79..6608fdab9d087 100644 --- a/compiler/rustc_infer/src/infer/combine.rs +++ b/compiler/rustc_infer/src/infer/combine.rs @@ -172,7 +172,7 @@ impl<'tcx> InferCtxt<'tcx> { // two const param's types are able to be equal has to go through a canonical query with the actual logic // in `rustc_trait_selection`. let canonical = self.canonicalize_query( - (relation.param_env(), a.ty(), b.ty()), + relation.param_env().and((a.ty(), b.ty())), &mut OriginalQueryValues::default(), ); self.tcx.check_tys_might_be_eq(canonical).map_err(|_| { diff --git a/compiler/rustc_middle/src/infer/canonical.rs b/compiler/rustc_middle/src/infer/canonical.rs index ef5a1caadb7bd..9208cd5febb12 100644 --- a/compiler/rustc_middle/src/infer/canonical.rs +++ b/compiler/rustc_middle/src/infer/canonical.rs @@ -21,11 +21,14 @@ //! //! [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html +use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::sync::Lock; use rustc_macros::HashStable; use rustc_type_ir::Canonical as IrCanonical; use rustc_type_ir::CanonicalVarInfo as IrCanonicalVarInfo; pub use rustc_type_ir::{CanonicalTyVarKind, CanonicalVarKind}; use smallvec::SmallVec; +use std::collections::hash_map::Entry; use std::ops::Index; use crate::infer::MemberConstraint; @@ -291,3 +294,37 @@ impl<'tcx> Index for CanonicalVarValues<'tcx> { &self.var_values[value.as_usize()] } } + +#[derive(Default)] +pub struct CanonicalParamEnvCache<'tcx> { + map: Lock< + FxHashMap< + ty::ParamEnv<'tcx>, + (Canonical<'tcx, ty::ParamEnv<'tcx>>, OriginalQueryValues<'tcx>), + >, + >, +} + +impl<'tcx> CanonicalParamEnvCache<'tcx> { + pub fn get_or_insert( + &self, + key: ty::ParamEnv<'tcx>, + state: &mut OriginalQueryValues<'tcx>, + canonicalize_op: impl FnOnce( + &mut OriginalQueryValues<'tcx>, + ) -> Canonical<'tcx, ty::ParamEnv<'tcx>>, + ) -> Canonical<'tcx, ty::ParamEnv<'tcx>> { + match self.map.borrow().entry(key) { + Entry::Occupied(e) => { + let (canonical, state_cached) = e.get(); + state.clone_from(state_cached); + canonical.clone() + } + Entry::Vacant(e) => { + let canonical = canonicalize_op(state); + e.insert((canonical.clone(), state.clone())); + canonical + } + } + } +} diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 03f3ceb8d1733..a69bff6ed8cae 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -2177,7 +2177,9 @@ rustc_queries! { /// Used in `super_combine_consts` to ICE if the type of the two consts are definitely not going to end up being /// equal to eachother. This might return `Ok` even if the types are not equal, but will never return `Err` if /// the types might be equal. - query check_tys_might_be_eq(arg: Canonical<'tcx, (ty::ParamEnv<'tcx>, Ty<'tcx>, Ty<'tcx>)>) -> Result<(), NoSolution> { + query check_tys_might_be_eq( + arg: Canonical<'tcx, ty::ParamEnvAnd<'tcx, (Ty<'tcx>, Ty<'tcx>)>> + ) -> Result<(), NoSolution> { desc { "check whether two const param are definitely not equal to eachother"} } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index eb6fde83fcc8f..da2bdf4d93e12 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -6,7 +6,7 @@ pub mod tls; use crate::arena::Arena; use crate::dep_graph::{DepGraph, DepKindStruct}; -use crate::infer::canonical::{CanonicalVarInfo, CanonicalVarInfos}; +use crate::infer::canonical::{CanonicalParamEnvCache, CanonicalVarInfo, CanonicalVarInfos}; use crate::lint::struct_lint_level; use crate::metadata::ModChild; use crate::middle::codegen_fn_attrs::CodegenFnAttrs; @@ -653,6 +653,8 @@ pub struct GlobalCtxt<'tcx> { pub new_solver_evaluation_cache: solve::EvaluationCache<'tcx>, pub new_solver_coherence_evaluation_cache: solve::EvaluationCache<'tcx>, + pub canonical_param_env_cache: CanonicalParamEnvCache<'tcx>, + /// Data layout specification for the current target. pub data_layout: TargetDataLayout, @@ -817,6 +819,7 @@ impl<'tcx> TyCtxt<'tcx> { evaluation_cache: Default::default(), new_solver_evaluation_cache: Default::default(), new_solver_coherence_evaluation_cache: Default::default(), + canonical_param_env_cache: Default::default(), data_layout, alloc_map: Lock::new(interpret::AllocMap::new()), } diff --git a/compiler/rustc_trait_selection/src/traits/misc.rs b/compiler/rustc_trait_selection/src/traits/misc.rs index 2f2411310a9a0..cf4fa233768ac 100644 --- a/compiler/rustc_trait_selection/src/traits/misc.rs +++ b/compiler/rustc_trait_selection/src/traits/misc.rs @@ -9,7 +9,7 @@ use rustc_infer::infer::canonical::Canonical; use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt}; use rustc_infer::traits::query::NoSolution; use rustc_infer::{infer::outlives::env::OutlivesEnvironment, traits::FulfillmentError}; -use rustc_middle::ty::{self, AdtDef, GenericArg, List, ParamEnv, Ty, TyCtxt, TypeVisitableExt}; +use rustc_middle::ty::{self, AdtDef, GenericArg, List, Ty, TyCtxt, TypeVisitableExt}; use rustc_span::DUMMY_SP; use super::outlives_bounds::InferCtxtExt; @@ -209,10 +209,10 @@ pub fn all_fields_implement_trait<'tcx>( pub fn check_tys_might_be_eq<'tcx>( tcx: TyCtxt<'tcx>, - canonical: Canonical<'tcx, (ParamEnv<'tcx>, Ty<'tcx>, Ty<'tcx>)>, + canonical: Canonical<'tcx, ty::ParamEnvAnd<'tcx, (Ty<'tcx>, Ty<'tcx>)>>, ) -> Result<(), NoSolution> { - let (infcx, (param_env, ty_a, ty_b), _) = - tcx.infer_ctxt().build_with_canonical(DUMMY_SP, &canonical); + let (infcx, key, _) = tcx.infer_ctxt().build_with_canonical(DUMMY_SP, &canonical); + let (param_env, (ty_a, ty_b)) = key.into_parts(); let ocx = ObligationCtxt::new(&infcx); let result = ocx.eq(&ObligationCause::dummy(), param_env, ty_a, ty_b); From 85338197d402e0d94f9113bef4e3343921f3391d Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Wed, 6 Dec 2023 09:30:33 +0000 Subject: [PATCH 05/40] don't store OriginalQueryValues::universe_map ParamEnv is canonicalized in *queries input* rather than query response. In such case we don't "preserve universes" of canonical variable. This means that `universe_map` always has the default value, which is wasteful to store in the cache. --- .../src/infer/canonical/canonicalizer.rs | 1 + compiler/rustc_middle/src/infer/canonical.rs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index d3ab3c0afe21c..ed4de39000038 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -150,6 +150,7 @@ impl<'tcx> InferCtxt<'tcx> { { let (param_env, value) = value.into_parts(); let base = self.tcx.canonical_param_env_cache.get_or_insert( + self.tcx, param_env, query_state, |query_state| { diff --git a/compiler/rustc_middle/src/infer/canonical.rs b/compiler/rustc_middle/src/infer/canonical.rs index 9208cd5febb12..c231a0f0b6477 100644 --- a/compiler/rustc_middle/src/infer/canonical.rs +++ b/compiler/rustc_middle/src/infer/canonical.rs @@ -300,7 +300,7 @@ pub struct CanonicalParamEnvCache<'tcx> { map: Lock< FxHashMap< ty::ParamEnv<'tcx>, - (Canonical<'tcx, ty::ParamEnv<'tcx>>, OriginalQueryValues<'tcx>), + (Canonical<'tcx, ty::ParamEnv<'tcx>>, &'tcx [GenericArg<'tcx>]), >, >, } @@ -308,21 +308,28 @@ pub struct CanonicalParamEnvCache<'tcx> { impl<'tcx> CanonicalParamEnvCache<'tcx> { pub fn get_or_insert( &self, + tcx: TyCtxt<'tcx>, key: ty::ParamEnv<'tcx>, state: &mut OriginalQueryValues<'tcx>, canonicalize_op: impl FnOnce( &mut OriginalQueryValues<'tcx>, ) -> Canonical<'tcx, ty::ParamEnv<'tcx>>, ) -> Canonical<'tcx, ty::ParamEnv<'tcx>> { + assert_eq!(state.var_values.len(), 0); + assert_eq!(state.universe_map.len(), 1); + debug_assert_eq!(&*state.universe_map, &[ty::UniverseIndex::ROOT]); + match self.map.borrow().entry(key) { Entry::Occupied(e) => { - let (canonical, state_cached) = e.get(); - state.clone_from(state_cached); + let (canonical, var_values) = e.get(); + state.var_values.extend_from_slice(var_values); canonical.clone() } Entry::Vacant(e) => { let canonical = canonicalize_op(state); - e.insert((canonical.clone(), state.clone())); + let OriginalQueryValues { var_values, universe_map } = state; + assert_eq!(universe_map.len(), 1); + e.insert((canonical.clone(), tcx.arena.alloc_slice(var_values))); canonical } } From a1459c3fca5f9b35918d576a7bf79ce15d279719 Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Wed, 6 Dec 2023 07:22:44 +0000 Subject: [PATCH 06/40] fix small perf regressions --- compiler/rustc_middle/src/infer/canonical.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_middle/src/infer/canonical.rs b/compiler/rustc_middle/src/infer/canonical.rs index c231a0f0b6477..232c84158efd8 100644 --- a/compiler/rustc_middle/src/infer/canonical.rs +++ b/compiler/rustc_middle/src/infer/canonical.rs @@ -34,7 +34,7 @@ use std::ops::Index; use crate::infer::MemberConstraint; use crate::mir::ConstraintCategory; use crate::ty::GenericArg; -use crate::ty::{self, BoundVar, List, Region, Ty, TyCtxt}; +use crate::ty::{self, BoundVar, List, Region, Ty, TyCtxt, TypeFlags, TypeVisitableExt}; pub type Canonical<'tcx, V> = IrCanonical, V>; @@ -315,6 +315,16 @@ impl<'tcx> CanonicalParamEnvCache<'tcx> { &mut OriginalQueryValues<'tcx>, ) -> Canonical<'tcx, ty::ParamEnv<'tcx>>, ) -> Canonical<'tcx, ty::ParamEnv<'tcx>> { + if !key.has_type_flags( + TypeFlags::HAS_INFER | TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_FREE_REGIONS, + ) { + return Canonical { + max_universe: ty::UniverseIndex::ROOT, + variables: List::empty(), + value: key, + }; + } + assert_eq!(state.var_values.len(), 0); assert_eq!(state.universe_map.len(), 1); debug_assert_eq!(&*state.universe_map, &[ty::UniverseIndex::ROOT]); From fafe66d4383c7d5b071b9cc5bf5f4efda23a1a08 Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Tue, 5 Dec 2023 15:13:08 +0000 Subject: [PATCH 07/40] don't resolve regions in query input fixes a soundness regression described in the PR description. --- .../src/infer/canonical/canonicalizer.rs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index ed4de39000038..69cc0713b2539 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -202,8 +202,21 @@ impl CanonicalizeMode for CanonicalizeQueryResponse { fn canonicalize_free_region<'tcx>( &self, canonicalizer: &mut Canonicalizer<'_, 'tcx>, - r: ty::Region<'tcx>, + mut r: ty::Region<'tcx>, ) -> ty::Region<'tcx> { + if let ty::ReVar(vid) = *r { + r = canonicalizer + .infcx + .inner + .borrow_mut() + .unwrap_region_constraints() + .opportunistic_resolve_var(canonicalizer.tcx, vid); + debug!( + "canonical: region var found with vid {vid:?}, \ + opportunistically resolved to {r:?}", + ); + }; + match *r { ty::ReLateParam(_) | ty::ReErased | ty::ReStatic | ty::ReEarlyParam(..) => r, @@ -381,25 +394,12 @@ impl<'cx, 'tcx> TypeFolder> for Canonicalizer<'cx, 'tcx> { } } - ty::ReVar(vid) => { - let resolved = self - .infcx - .inner - .borrow_mut() - .unwrap_region_constraints() - .opportunistic_resolve_var(self.tcx, vid); - debug!( - "canonical: region var found with vid {vid:?}, \ - opportunistically resolved to {resolved:?}", - ); - self.canonicalize_mode.canonicalize_free_region(self, resolved) - } - ty::ReStatic | ty::ReEarlyParam(..) | ty::ReError(_) | ty::ReLateParam(_) | ty::RePlaceholder(..) + | ty::ReVar(_) | ty::ReErased => self.canonicalize_mode.canonicalize_free_region(self, r), } } From 7e4c4271f44055b4dbd6f09aad19624254d67f22 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Dec 2023 13:40:24 +0100 Subject: [PATCH 08/40] fix computing the dynamic alignment of packed structs with dyn trait tails --- compiler/rustc_codegen_ssa/src/size_of_val.rs | 62 ++++++++++++------- .../src/interpret/eval_context.rs | 43 ++++++------- .../tests/pass/packed-struct-dyn-trait.rs | 21 +++++++ tests/ui/packed/dyn-trait.rs | 21 +++++++ 4 files changed, 99 insertions(+), 48 deletions(-) create mode 100644 src/tools/miri/tests/pass/packed-struct-dyn-trait.rs create mode 100644 tests/ui/packed/dyn-trait.rs diff --git a/compiler/rustc_codegen_ssa/src/size_of_val.rs b/compiler/rustc_codegen_ssa/src/size_of_val.rs index b8a4949d59ff9..087836ca37de0 100644 --- a/compiler/rustc_codegen_ssa/src/size_of_val.rs +++ b/compiler/rustc_codegen_ssa/src/size_of_val.rs @@ -84,10 +84,13 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( debug!("DST {} layout: {:?}", t, layout); let i = layout.fields.count() - 1; - let sized_size = layout.fields.offset(i).bytes(); + let unsized_offset_unadjusted = layout.fields.offset(i).bytes(); let sized_align = layout.align.abi.bytes(); - debug!("DST {} statically sized prefix size: {} align: {}", t, sized_size, sized_align); - let sized_size = bx.const_usize(sized_size); + debug!( + "DST {} offset of dyn field: {}, statically sized align: {}", + t, unsized_offset_unadjusted, sized_align + ); + let unsized_offset_unadjusted = bx.const_usize(unsized_offset_unadjusted); let sized_align = bx.const_usize(sized_align); // Recurse to get the size of the dynamically sized field (must be @@ -95,26 +98,26 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( let field_ty = layout.field(bx, i).ty; let (unsized_size, mut unsized_align) = size_and_align_of_dst(bx, field_ty, info); - // FIXME (#26403, #27023): We should be adding padding - // to `sized_size` (to accommodate the `unsized_align` - // required of the unsized field that follows) before - // summing it with `sized_size`. (Note that since #26403 - // is unfixed, we do not yet add the necessary padding - // here. But this is where the add would go.) - - // Return the sum of sizes and max of aligns. - let size = bx.add(sized_size, unsized_size); - - // Packed types ignore the alignment of their fields. - if let ty::Adt(def, _) = t.kind() { - if def.repr().packed() { - unsized_align = sized_align; + // # First compute the dynamic alignment + + // For packed types, we need to cap the alignment. + if let ty::Adt(def, _) = t.kind() + && let Some(packed) = def.repr().pack + { + if packed.bytes() == 1 { + // We know this will be capped to 1. + unsized_align = bx.const_usize(1); + } else { + // We have to dynamically compute `min(unsized_align, packed)`. + let packed = bx.const_usize(packed.bytes()); + let cmp = bx.icmp(IntPredicate::IntULT, unsized_align, packed); + unsized_align = bx.select(cmp, unsized_align, packed); } } // Choose max of two known alignments (combined value must // be aligned according to more restrictive of the two). - let align = match ( + let full_align = match ( bx.const_to_opt_u128(sized_align, false), bx.const_to_opt_u128(unsized_align, false), ) { @@ -129,6 +132,19 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( } }; + // # Then compute the dynamic size + + // The full formula for the size would be: + // let unsized_offset_adjusted = unsized_offset_unadjusted.align_to(unsized_align); + // let full_size = (unsized_offset_adjusted + unsized_size).align_to(full_align); + // However, `unsized_size` is a multiple of `unsized_align`. + // Therefore, we can equivalently do the `align_to(unsized_align)` *after* adding `unsized_size`: + // let full_size = (unsized_offset_unadjusted + unsized_size).align_to(unsized_align).align_to(full_align); + // Furthermore, `align >= unsized_align`, and therefore we only need to do: + // let full_size = (unsized_offset_unadjusted + unsized_size).align_to(full_align); + + let full_size = bx.add(unsized_offset_unadjusted, unsized_size); + // Issue #27023: must add any necessary padding to `size` // (to make it a multiple of `align`) before returning it. // @@ -140,12 +156,12 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( // // `(size + (align-1)) & -align` let one = bx.const_usize(1); - let addend = bx.sub(align, one); - let add = bx.add(size, addend); - let neg = bx.neg(align); - let size = bx.and(add, neg); + let addend = bx.sub(full_align, one); + let add = bx.add(full_size, addend); + let neg = bx.neg(full_align); + let full_size = bx.and(add, neg); - (size, align) + (full_size, full_align) } _ => bug!("size_and_align_of_dst: {t} not supported"), } diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index bbebf329d2659..847d6503f20d8 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -686,14 +686,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { assert!(layout.fields.count() > 0); trace!("DST layout: {:?}", layout); - let sized_size = layout.fields.offset(layout.fields.count() - 1); + let unsized_offset_unadjusted = layout.fields.offset(layout.fields.count() - 1); let sized_align = layout.align.abi; - trace!( - "DST {} statically sized prefix size: {:?} align: {:?}", - layout.ty, - sized_size, - sized_align - ); // Recurse to get the size of the dynamically sized field (must be // the last field). Can't have foreign types here, how would we @@ -707,36 +701,35 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { return Ok(None); }; - // FIXME (#26403, #27023): We should be adding padding - // to `sized_size` (to accommodate the `unsized_align` - // required of the unsized field that follows) before - // summing it with `sized_size`. (Note that since #26403 - // is unfixed, we do not yet add the necessary padding - // here. But this is where the add would go.) - - // Return the sum of sizes and max of aligns. - let size = sized_size + unsized_size; // `Size` addition + // # First compute the dynamic alignment - // Packed types ignore the alignment of their fields. + // Packed type alignment needs to be capped. if let ty::Adt(def, _) = layout.ty.kind() { - if def.repr().packed() { - unsized_align = sized_align; + if let Some(packed) = def.repr().pack { + unsized_align = unsized_align.min(packed); } } // Choose max of two known alignments (combined value must // be aligned according to more restrictive of the two). - let align = sized_align.max(unsized_align); + let full_align = sized_align.max(unsized_align); + + // # Then compute the dynamic size - // Issue #27023: must add any necessary padding to `size` - // (to make it a multiple of `align`) before returning it. - let size = size.align_to(align); + let unsized_offset_adjusted = unsized_offset_unadjusted.align_to(unsized_align); + let full_size = (unsized_offset_adjusted + unsized_size).align_to(full_align); + + // Just for our sanitiy's sake, assert that this is equal to what codegen would compute. + assert_eq!( + full_size, + (unsized_offset_unadjusted + unsized_size).align_to(full_align) + ); // Check if this brought us over the size limit. - if size > self.max_size_of_val() { + if full_size > self.max_size_of_val() { throw_ub!(InvalidMeta(InvalidMetaKind::TooBig)); } - Ok(Some((size, align))) + Ok(Some((full_size, full_align))) } ty::Dynamic(_, _, ty::Dyn) => { let vtable = metadata.unwrap_meta().to_pointer(self)?; diff --git a/src/tools/miri/tests/pass/packed-struct-dyn-trait.rs b/src/tools/miri/tests/pass/packed-struct-dyn-trait.rs new file mode 100644 index 0000000000000..bb73c26c18a0d --- /dev/null +++ b/src/tools/miri/tests/pass/packed-struct-dyn-trait.rs @@ -0,0 +1,21 @@ +// run-pass +use std::ptr::addr_of; + +// When the unsized tail is a `dyn Trait`, its alignments is only dynamically known. This means the +// packed(2) needs to be applied at runtime: the actual alignment of the field is `min(2, +// usual_alignment)`. Here we check that we do this right by comparing size, alignment, and field +// offset before and after unsizing. +fn main() { + #[repr(C, packed(2))] + struct Packed(u8, core::mem::ManuallyDrop); + + let p = Packed(0, core::mem::ManuallyDrop::new(1)); + let p: &Packed = &p; + let sized = (core::mem::size_of_val(p), core::mem::align_of_val(p)); + let sized_offset = unsafe { addr_of!(p.1).cast::().offset_from(addr_of!(p.0)) }; + let p: &Packed = p; + let un_sized = (core::mem::size_of_val(p), core::mem::align_of_val(p)); + let un_sized_offset = unsafe { addr_of!(p.1).cast::().offset_from(addr_of!(p.0)) }; + assert_eq!(sized, un_sized); + assert_eq!(sized_offset, un_sized_offset); +} diff --git a/tests/ui/packed/dyn-trait.rs b/tests/ui/packed/dyn-trait.rs new file mode 100644 index 0000000000000..bb73c26c18a0d --- /dev/null +++ b/tests/ui/packed/dyn-trait.rs @@ -0,0 +1,21 @@ +// run-pass +use std::ptr::addr_of; + +// When the unsized tail is a `dyn Trait`, its alignments is only dynamically known. This means the +// packed(2) needs to be applied at runtime: the actual alignment of the field is `min(2, +// usual_alignment)`. Here we check that we do this right by comparing size, alignment, and field +// offset before and after unsizing. +fn main() { + #[repr(C, packed(2))] + struct Packed(u8, core::mem::ManuallyDrop); + + let p = Packed(0, core::mem::ManuallyDrop::new(1)); + let p: &Packed = &p; + let sized = (core::mem::size_of_val(p), core::mem::align_of_val(p)); + let sized_offset = unsafe { addr_of!(p.1).cast::().offset_from(addr_of!(p.0)) }; + let p: &Packed = p; + let un_sized = (core::mem::size_of_val(p), core::mem::align_of_val(p)); + let un_sized_offset = unsafe { addr_of!(p.1).cast::().offset_from(addr_of!(p.0)) }; + assert_eq!(sized, un_sized); + assert_eq!(sized_offset, un_sized_offset); +} From 981c4e3ce6f3d89f681fbb0de753d03425c6a209 Mon Sep 17 00:00:00 2001 From: Lukasz Anforowicz Date: Wed, 13 Dec 2023 21:14:18 +0000 Subject: [PATCH 09/40] Add unstable `-Zdefault-hidden-visibility` cmdline flag for `rustc`. The new flag has been described in the Major Change Proposal at https://github.com/rust-lang/compiler-team/issues/656 --- compiler/rustc_codegen_gcc/src/allocator.rs | 2 +- compiler/rustc_codegen_llvm/src/allocator.rs | 6 ++-- compiler/rustc_codegen_llvm/src/declare.rs | 4 +-- compiler/rustc_interface/src/tests.rs | 1 + .../rustc_monomorphize/src/partitioning.rs | 2 +- compiler/rustc_session/src/options.rs | 2 ++ compiler/rustc_session/src/session.rs | 8 +++++ compiler/rustc_target/src/spec/mod.rs | 6 +++- .../default-hidden-visibility.md | 12 +++++++ tests/codegen/default-hidden-visibility.rs | 31 +++++++++++++++++++ 10 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 src/doc/unstable-book/src/compiler-flags/default-hidden-visibility.md create mode 100644 tests/codegen/default-hidden-visibility.rs diff --git a/compiler/rustc_codegen_gcc/src/allocator.rs b/compiler/rustc_codegen_gcc/src/allocator.rs index c8c098e2973f0..7c7044830f3d4 100644 --- a/compiler/rustc_codegen_gcc/src/allocator.rs +++ b/compiler/rustc_codegen_gcc/src/allocator.rs @@ -90,7 +90,7 @@ fn create_wrapper_function( .collect(); let func = context.new_function(None, FunctionType::Exported, output.unwrap_or(void), &args, from_name, false); - if tcx.sess.target.options.default_hidden_visibility { + if tcx.sess.default_hidden_visibility() { #[cfg(feature="master")] func.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden)); } diff --git a/compiler/rustc_codegen_llvm/src/allocator.rs b/compiler/rustc_codegen_llvm/src/allocator.rs index 798014d668e22..7acd18d69edda 100644 --- a/compiler/rustc_codegen_llvm/src/allocator.rs +++ b/compiler/rustc_codegen_llvm/src/allocator.rs @@ -76,7 +76,7 @@ pub(crate) unsafe fn codegen( // __rust_alloc_error_handler_should_panic let name = OomStrategy::SYMBOL; let ll_g = llvm::LLVMRustGetOrInsertGlobal(llmod, name.as_ptr().cast(), name.len(), i8); - if tcx.sess.target.default_hidden_visibility { + if tcx.sess.default_hidden_visibility() { llvm::LLVMRustSetVisibility(ll_g, llvm::Visibility::Hidden); } let val = tcx.sess.opts.unstable_opts.oom.should_panic(); @@ -85,7 +85,7 @@ pub(crate) unsafe fn codegen( let name = NO_ALLOC_SHIM_IS_UNSTABLE; let ll_g = llvm::LLVMRustGetOrInsertGlobal(llmod, name.as_ptr().cast(), name.len(), i8); - if tcx.sess.target.default_hidden_visibility { + if tcx.sess.default_hidden_visibility() { llvm::LLVMRustSetVisibility(ll_g, llvm::Visibility::Hidden); } let llval = llvm::LLVMConstInt(i8, 0, False); @@ -130,7 +130,7 @@ fn create_wrapper_function( None }; - if tcx.sess.target.default_hidden_visibility { + if tcx.sess.default_hidden_visibility() { llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden); } if tcx.sess.must_emit_unwind_tables() { diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs index 164b12cf8d411..78c0725a63784 100644 --- a/compiler/rustc_codegen_llvm/src/declare.rs +++ b/compiler/rustc_codegen_llvm/src/declare.rs @@ -84,7 +84,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { fn_type: &'ll Type, ) -> &'ll Value { // Declare C ABI functions with the visibility used by C by default. - let visibility = if self.tcx.sess.target.default_hidden_visibility { + let visibility = if self.tcx.sess.default_hidden_visibility() { llvm::Visibility::Hidden } else { llvm::Visibility::Default @@ -107,7 +107,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { unnamed: llvm::UnnamedAddr, fn_type: &'ll Type, ) -> &'ll Value { - let visibility = if self.tcx.sess.target.default_hidden_visibility { + let visibility = if self.tcx.sess.default_hidden_visibility() { llvm::Visibility::Hidden } else { llvm::Visibility::Default diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index ce58b2ab06170..25fa2b375473e 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -748,6 +748,7 @@ fn test_unstable_options_tracking_hash() { tracked!(cross_crate_inline_threshold, InliningThreshold::Always); tracked!(debug_info_for_profiling, true); tracked!(debug_macros, true); + tracked!(default_hidden_visibility, Some(true)); tracked!(dep_info_omit_d_target, true); tracked!(dual_proc_macros, true); tracked!(dwarf_version, Some(5)); diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index c2b307910e42b..e06935d4e4762 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -883,7 +883,7 @@ fn mono_item_visibility<'tcx>( } fn default_visibility(tcx: TyCtxt<'_>, id: DefId, is_generic: bool) -> Visibility { - if !tcx.sess.target.default_hidden_visibility { + if !tcx.sess.default_hidden_visibility() { return Visibility::Default; } diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index d666c5d4d702c..a3835c085dac7 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1552,6 +1552,8 @@ options! { "compress debug info sections (none, zlib, zstd, default: none)"), deduplicate_diagnostics: bool = (true, parse_bool, [UNTRACKED], "deduplicate identical diagnostics (default: yes)"), + default_hidden_visibility: Option = (None, parse_opt_bool, [TRACKED], + "overrides the `default_hidden_visibility` setting of the target"), dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED], "in dep-info output, omit targets for tracking dependencies of the dep-info files \ themselves (default: no)"), diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 24c7459392abe..69b861ea38068 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -961,6 +961,14 @@ impl Session { termize::dimensions().map_or(default_column_width, |(w, _)| w) } } + + /// Whether the default visibility of symbols should be "hidden" rather than "default". + pub fn default_hidden_visibility(&self) -> bool { + self.opts + .unstable_opts + .default_hidden_visibility + .unwrap_or(self.target.options.default_hidden_visibility) + } } // JUSTIFICATION: defn of the suggested wrapper fns diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 24893bda9e7c4..a78df69f187ee 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -2094,7 +2094,11 @@ pub struct TargetOptions { pub no_builtins: bool, /// The default visibility for symbols in this target should be "hidden" - /// rather than "default" + /// rather than "default". + /// + /// This value typically shouldn't be accessed directly, but through + /// the `rustc_session::Session::default_hidden_visibility` method, which + /// allows `rustc` users to override this setting using cmdline flags. pub default_hidden_visibility: bool, /// Whether a .debug_gdb_scripts section will be added to the output object file diff --git a/src/doc/unstable-book/src/compiler-flags/default-hidden-visibility.md b/src/doc/unstable-book/src/compiler-flags/default-hidden-visibility.md new file mode 100644 index 0000000000000..579add4a9d985 --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/default-hidden-visibility.md @@ -0,0 +1,12 @@ +# `default-hidden-visibility` + +The tracking issue for this feature is: https://github.com/rust-lang/compiler-team/issues/656 + +------------------------ + +This flag can be used to override the target's +[`default_hidden_visibility`](https://doc.rust-lang.org/beta/nightly-rustc/rustc_target/spec/struct.TargetOptions.html#structfield.default_hidden_visibility) +setting. +Using `-Zdefault_hidden_visibility=yes` is roughly equivalent to Clang's +[`-fvisibility=hidden`](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fvisibility) +cmdline flag. diff --git a/tests/codegen/default-hidden-visibility.rs b/tests/codegen/default-hidden-visibility.rs new file mode 100644 index 0000000000000..9e5e545f0d939 --- /dev/null +++ b/tests/codegen/default-hidden-visibility.rs @@ -0,0 +1,31 @@ +// Verifies that `Session::default_hidden_visibility` is affected when using the related cmdline +// flag. This is a regression test for https://github.com/rust-lang/compiler-team/issues/656. See +// also https://github.com/rust-lang/rust/issues/73295 and +// https://github.com/rust-lang/rust/issues/37530. + +// revisions:DEFAULT YES NO +//[YES] compile-flags: -Zdefault-hidden-visibility=yes +//[NO] compile-flags: -Zdefault-hidden-visibility=no + +// The test scenario is specifically about visibility of symbols exported out of dynamically linked +// libraries. +#![crate_type = "dylib"] + +// The test scenario needs to use a Rust-public, but non-explicitly-exported symbol +// (e.g. the test doesn't use `#[no_mangle]`, because currently it implies that +// the symbol should be exported; we don't want that - we want to test the *default* +// export setting instead). +#[used] +pub static tested_symbol: [u8; 6] = *b"foobar"; + +// Exact LLVM IR differs depending on the target triple (e.g. `hidden constant` +// vs `internal constant` vs `constant`). Because of this, we only apply the +// specific test expectations below to one specific target triple. If needed, +// additional targets can be covered by adding copies of this test file with +// a different `only-X` directive. +// +// only-x86_64-unknown-linux-gnu + +// DEFAULT: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = constant +// YES: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = hidden constant +// NO: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = constant From 3b55869615d320f7d505e0fd9326be14830c6c52 Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Thu, 7 Dec 2023 03:40:19 +0000 Subject: [PATCH 10/40] make infcx optional in canonicalizer This doesn't change behavior. It should prevent unintentional resolution of inference variables during canonicalization, which previously caused a soundness bug. See PR description for more. --- .../src/infer/canonical/canonicalizer.rs | 80 ++++++++----------- compiler/rustc_middle/src/infer/canonical.rs | 12 ++- 2 files changed, 45 insertions(+), 47 deletions(-) diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index 69cc0713b2539..ebb726e4d3236 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -60,7 +60,7 @@ impl<'tcx> InferCtxt<'tcx> { { Canonicalizer::canonicalize( value, - self, + Some(self), self.tcx, &CanonicalizeAllFreeRegionsPreservingUniverses, query_state, @@ -99,7 +99,7 @@ impl<'tcx> InferCtxt<'tcx> { let mut query_state = OriginalQueryValues::default(); Canonicalizer::canonicalize( value, - self, + Some(self), self.tcx, &CanonicalizeQueryResponse, &mut query_state, @@ -113,7 +113,7 @@ impl<'tcx> InferCtxt<'tcx> { let mut query_state = OriginalQueryValues::default(); Canonicalizer::canonicalize( value, - self, + Some(self), self.tcx, &CanonicalizeUserTypeAnnotation, &mut query_state, @@ -153,11 +153,11 @@ impl<'tcx> InferCtxt<'tcx> { self.tcx, param_env, query_state, - |query_state| { + |tcx, param_env, query_state| { Canonicalizer::canonicalize( param_env, - self, - self.tcx, + None, + tcx, &CanonicalizeFreeRegionsOtherThanStatic, query_state, ) @@ -167,7 +167,7 @@ impl<'tcx> InferCtxt<'tcx> { Canonicalizer::canonicalize_with_base( base, value, - self, + Some(self), self.tcx, canonicalize_region_mode, query_state, @@ -204,9 +204,10 @@ impl CanonicalizeMode for CanonicalizeQueryResponse { canonicalizer: &mut Canonicalizer<'_, 'tcx>, mut r: ty::Region<'tcx>, ) -> ty::Region<'tcx> { + let infcx = canonicalizer.infcx.unwrap(); + if let ty::ReVar(vid) = *r { - r = canonicalizer - .infcx + r = infcx .inner .borrow_mut() .unwrap_region_constraints() @@ -226,7 +227,8 @@ impl CanonicalizeMode for CanonicalizeQueryResponse { ), ty::ReVar(vid) => { - let universe = canonicalizer.region_var_universe(vid); + let universe = + infcx.inner.borrow_mut().unwrap_region_constraints().var_universe(vid); canonicalizer.canonical_var_for_region( CanonicalVarInfo { kind: CanonicalVarKind::Region(universe) }, r, @@ -319,7 +321,7 @@ impl CanonicalizeMode for CanonicalizeAllFreeRegionsPreservingUniverses { canonicalizer: &mut Canonicalizer<'_, 'tcx>, r: ty::Region<'tcx>, ) -> ty::Region<'tcx> { - let universe = canonicalizer.infcx.universe_of_region(r); + let universe = canonicalizer.infcx.unwrap().universe_of_region(r); canonicalizer.canonical_var_for_region( CanonicalVarInfo { kind: CanonicalVarKind::Region(universe) }, r, @@ -356,7 +358,8 @@ impl CanonicalizeMode for CanonicalizeFreeRegionsOtherThanStatic { } struct Canonicalizer<'cx, 'tcx> { - infcx: &'cx InferCtxt<'tcx>, + /// Set to `None` to disable the resolution of inference variables. + infcx: Option<&'cx InferCtxt<'tcx>>, tcx: TyCtxt<'tcx>, variables: SmallVec<[CanonicalVarInfo<'tcx>; 8]>, query_state: &'cx mut OriginalQueryValues<'tcx>, @@ -410,14 +413,14 @@ impl<'cx, 'tcx> TypeFolder> for Canonicalizer<'cx, 'tcx> { // We need to canonicalize the *root* of our ty var. // This is so that our canonical response correctly reflects // any equated inference vars correctly! - let root_vid = self.infcx.root_var(vid); + let root_vid = self.infcx.unwrap().root_var(vid); if root_vid != vid { - t = Ty::new_var(self.infcx.tcx, root_vid); + t = Ty::new_var(self.tcx, root_vid); vid = root_vid; } debug!("canonical: type var found with vid {:?}", vid); - match self.infcx.probe_ty_var(vid) { + match self.infcx.unwrap().probe_ty_var(vid) { // `t` could be a float / int variable; canonicalize that instead. Ok(t) => { debug!("(resolved to {:?})", t); @@ -442,7 +445,7 @@ impl<'cx, 'tcx> TypeFolder> for Canonicalizer<'cx, 'tcx> { } ty::Infer(ty::IntVar(vid)) => { - let nt = self.infcx.opportunistic_resolve_int_var(vid); + let nt = self.infcx.unwrap().opportunistic_resolve_int_var(vid); if nt != t { return self.fold_ty(nt); } else { @@ -453,7 +456,7 @@ impl<'cx, 'tcx> TypeFolder> for Canonicalizer<'cx, 'tcx> { } } ty::Infer(ty::FloatVar(vid)) => { - let nt = self.infcx.opportunistic_resolve_float_var(vid); + let nt = self.infcx.unwrap().opportunistic_resolve_float_var(vid); if nt != t { return self.fold_ty(nt); } else { @@ -524,14 +527,14 @@ impl<'cx, 'tcx> TypeFolder> for Canonicalizer<'cx, 'tcx> { // We need to canonicalize the *root* of our const var. // This is so that our canonical response correctly reflects // any equated inference vars correctly! - let root_vid = self.infcx.root_const_var(vid); + let root_vid = self.infcx.unwrap().root_const_var(vid); if root_vid != vid { - ct = ty::Const::new_var(self.infcx.tcx, root_vid, ct.ty()); + ct = ty::Const::new_var(self.tcx, root_vid, ct.ty()); vid = root_vid; } debug!("canonical: const var found with vid {:?}", vid); - match self.infcx.probe_const_var(vid) { + match self.infcx.unwrap().probe_const_var(vid) { Ok(c) => { debug!("(resolved to {:?})", c); return self.fold_const(c); @@ -552,8 +555,8 @@ impl<'cx, 'tcx> TypeFolder> for Canonicalizer<'cx, 'tcx> { } } ty::ConstKind::Infer(InferConst::EffectVar(vid)) => { - match self.infcx.probe_effect_var(vid) { - Some(value) => return self.fold_const(value.as_const(self.infcx.tcx)), + match self.infcx.unwrap().probe_effect_var(vid) { + Some(value) => return self.fold_const(value.as_const(self.tcx)), None => { return self.canonicalize_const_var( CanonicalVarInfo { kind: CanonicalVarKind::Effect }, @@ -596,7 +599,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { /// `canonicalize_query` and `canonicalize_response`. fn canonicalize( value: V, - infcx: &InferCtxt<'tcx>, + infcx: Option<&InferCtxt<'tcx>>, tcx: TyCtxt<'tcx>, canonicalize_region_mode: &dyn CanonicalizeMode, query_state: &mut OriginalQueryValues<'tcx>, @@ -623,7 +626,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { fn canonicalize_with_base( base: Canonical<'tcx, U>, value: V, - infcx: &InferCtxt<'tcx>, + infcx: Option<&InferCtxt<'tcx>>, tcx: TyCtxt<'tcx>, canonicalize_region_mode: &dyn CanonicalizeMode, query_state: &mut OriginalQueryValues<'tcx>, @@ -826,11 +829,6 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { ) } - /// Returns the universe in which `vid` is defined. - fn region_var_universe(&self, vid: ty::RegionVid) -> ty::UniverseIndex { - self.infcx.inner.borrow_mut().unwrap_region_constraints().var_universe(vid) - } - /// Creates a canonical variable (with the given `info`) /// representing the region `r`; return a region referencing it. fn canonical_var_for_region( @@ -848,14 +846,9 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { /// *that*. Otherwise, create a new canonical variable for /// `ty_var`. fn canonicalize_ty_var(&mut self, info: CanonicalVarInfo<'tcx>, ty_var: Ty<'tcx>) -> Ty<'tcx> { - let infcx = self.infcx; - let bound_to = infcx.shallow_resolve(ty_var); - if bound_to != ty_var { - self.fold_ty(bound_to) - } else { - let var = self.canonical_var(info, ty_var.into()); - Ty::new_bound(self.tcx, self.binder_index, var.into()) - } + debug_assert!(!self.infcx.is_some_and(|infcx| ty_var != infcx.shallow_resolve(ty_var))); + let var = self.canonical_var(info, ty_var.into()); + Ty::new_bound(self.tcx, self.binder_index, var.into()) } /// Given a type variable `const_var` of the given kind, first check @@ -867,13 +860,10 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { info: CanonicalVarInfo<'tcx>, const_var: ty::Const<'tcx>, ) -> ty::Const<'tcx> { - let infcx = self.infcx; - let bound_to = infcx.shallow_resolve(const_var); - if bound_to != const_var { - self.fold_const(bound_to) - } else { - let var = self.canonical_var(info, const_var.into()); - ty::Const::new_bound(self.tcx, self.binder_index, var, self.fold_ty(const_var.ty())) - } + debug_assert!( + !self.infcx.is_some_and(|infcx| const_var != infcx.shallow_resolve(const_var)) + ); + let var = self.canonical_var(info, const_var.into()); + ty::Const::new_bound(self.tcx, self.binder_index, var, self.fold_ty(const_var.ty())) } } diff --git a/compiler/rustc_middle/src/infer/canonical.rs b/compiler/rustc_middle/src/infer/canonical.rs index 232c84158efd8..59593ae1c6334 100644 --- a/compiler/rustc_middle/src/infer/canonical.rs +++ b/compiler/rustc_middle/src/infer/canonical.rs @@ -306,12 +306,20 @@ pub struct CanonicalParamEnvCache<'tcx> { } impl<'tcx> CanonicalParamEnvCache<'tcx> { + /// Gets the cached canonical form of `key` or executes + /// `canonicalize_op` and caches the result if not present. + /// + /// `canonicalize_op` is intentionally not allowed to be a closure to + /// statically prevent it from capturing `InferCtxt` and resolving + /// inference variables, which invalidates the cache. pub fn get_or_insert( &self, tcx: TyCtxt<'tcx>, key: ty::ParamEnv<'tcx>, state: &mut OriginalQueryValues<'tcx>, - canonicalize_op: impl FnOnce( + canonicalize_op: fn( + TyCtxt<'tcx>, + ty::ParamEnv<'tcx>, &mut OriginalQueryValues<'tcx>, ) -> Canonical<'tcx, ty::ParamEnv<'tcx>>, ) -> Canonical<'tcx, ty::ParamEnv<'tcx>> { @@ -336,7 +344,7 @@ impl<'tcx> CanonicalParamEnvCache<'tcx> { canonical.clone() } Entry::Vacant(e) => { - let canonical = canonicalize_op(state); + let canonical = canonicalize_op(tcx, key, state); let OriginalQueryValues { var_values, universe_map } = state; assert_eq!(universe_map.len(), 1); e.insert((canonical.clone(), tcx.arena.alloc_slice(var_values))); From e452c949128f636bfa201af6445f9247a99db13e Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Wed, 6 Dec 2023 16:56:59 +0000 Subject: [PATCH 11/40] remove canonicalize_query_preserving_universes unused! --- .../src/infer/canonical/canonicalizer.rs | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index ebb726e4d3236..5b00ef42211e8 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -44,29 +44,6 @@ impl<'tcx> InferCtxt<'tcx> { self.canonicalize_query_with_mode(value, query_state, &CanonicalizeAllFreeRegions) } - /// Like [Self::canonicalize_query], but preserves distinct universes. For - /// example, canonicalizing `&'?0: Trait<'?1>`, where `'?0` is in `U1` and - /// `'?1` is in `U3` would be canonicalized to have `?0` in `U1` and `'?1` - /// in `U2`. - /// - /// This is used for Chalk integration. - pub fn canonicalize_query_preserving_universes( - &self, - value: V, - query_state: &mut OriginalQueryValues<'tcx>, - ) -> Canonical<'tcx, V> - where - V: TypeFoldable>, - { - Canonicalizer::canonicalize( - value, - Some(self), - self.tcx, - &CanonicalizeAllFreeRegionsPreservingUniverses, - query_state, - ) - } - /// Canonicalizes a query *response* `V`. When we canonicalize a /// query response, we only canonicalize unbound inference /// variables, and we leave other free regions alone. So, @@ -313,30 +290,6 @@ impl CanonicalizeMode for CanonicalizeAllFreeRegions { } } -struct CanonicalizeAllFreeRegionsPreservingUniverses; - -impl CanonicalizeMode for CanonicalizeAllFreeRegionsPreservingUniverses { - fn canonicalize_free_region<'tcx>( - &self, - canonicalizer: &mut Canonicalizer<'_, 'tcx>, - r: ty::Region<'tcx>, - ) -> ty::Region<'tcx> { - let universe = canonicalizer.infcx.unwrap().universe_of_region(r); - canonicalizer.canonical_var_for_region( - CanonicalVarInfo { kind: CanonicalVarKind::Region(universe) }, - r, - ) - } - - fn any(&self) -> bool { - true - } - - fn preserve_universes(&self) -> bool { - true - } -} - struct CanonicalizeFreeRegionsOtherThanStatic; impl CanonicalizeMode for CanonicalizeFreeRegionsOtherThanStatic { From aa36c35296561db171939a6dc95279214fca3775 Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Wed, 13 Dec 2023 19:12:24 +0000 Subject: [PATCH 12/40] rustdoc: avoid ParamEnv with infer vars ParamEnv's with inference variabels are invalid. --- src/librustdoc/clean/blanket_impl.rs | 3 +-- src/librustdoc/clean/mod.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index dad2aa4061d6c..4da85885d67cf 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -14,7 +14,6 @@ pub(crate) struct BlanketImplFinder<'a, 'tcx> { impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { pub(crate) fn get_blanket_impls(&mut self, item_def_id: DefId) -> Vec { let cx = &mut self.cx; - let param_env = cx.tcx.param_env(item_def_id); let ty = cx.tcx.type_of(item_def_id); trace!("get_blanket_impls({ty:?})"); @@ -40,7 +39,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { let infcx = cx.tcx.infer_ctxt().build(); let args = infcx.fresh_args_for_item(DUMMY_SP, item_def_id); let impl_ty = ty.instantiate(infcx.tcx, args); - let param_env = EarlyBinder::bind(param_env).instantiate(infcx.tcx, args); + let param_env = ty::ParamEnv::empty(); let impl_args = infcx.fresh_args_for_item(DUMMY_SP, impl_def_id); let impl_trait_ref = trait_ref.instantiate(infcx.tcx, impl_args); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 688751627f3ee..fb706c664ed0d 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -26,7 +26,7 @@ use rustc_middle::middle::resolve_bound_vars as rbv; use rustc_middle::ty::fold::TypeFolder; use rustc_middle::ty::GenericArgsRef; use rustc_middle::ty::TypeVisitableExt; -use rustc_middle::ty::{self, AdtKind, EarlyBinder, Ty, TyCtxt}; +use rustc_middle::ty::{self, AdtKind, Ty, TyCtxt}; use rustc_middle::{bug, span_bug}; use rustc_span::hygiene::{AstPass, MacroKind}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; From 43a0f5550626a4639f34bbd8d6f39673b1ae4b91 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 14 Dec 2023 15:47:03 +1100 Subject: [PATCH 13/40] Remove unused `Handler::treat_err_as_bug`. --- compiler/rustc_errors/src/lib.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index daa8a7706eb47..db573cd931de0 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -585,11 +585,6 @@ impl Handler { self } - pub fn treat_err_as_bug(mut self, treat_err_as_bug: NonZeroUsize) -> Self { - self.inner.get_mut().flags.treat_err_as_bug = Some(treat_err_as_bug); - self - } - pub fn with_flags(mut self, flags: HandlerFlags) -> Self { self.inner.get_mut().flags = flags; self From dc05a30996987b9a1a78184a5dc173b19404f1ab Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 13 Dec 2023 14:36:07 +1100 Subject: [PATCH 14/40] Inline and remove `HandlerInner::emit_diag_at_span`. It has a single call site. --- compiler/rustc_errors/src/lib.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index db573cd931de0..3718fd535f516 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1575,14 +1575,10 @@ impl HandlerInner { #[track_caller] fn span_bug(&mut self, sp: impl Into, msg: impl Into) -> ! { - self.emit_diag_at_span(Diagnostic::new(Bug, msg.into()), sp); + self.emit_diagnostic(Diagnostic::new(Bug, msg.into()).set_span(sp)); panic::panic_any(ExplicitBug); } - fn emit_diag_at_span(&mut self, mut diag: Diagnostic, sp: impl Into) { - self.emit_diagnostic(diag.set_span(sp)); - } - fn failure_note(&mut self, msg: impl Into) { self.emit_diagnostic(&mut Diagnostic::new(FailureNote, msg)); } From 7bdb227567398bed342697ea1f76f2cb34c9a7c2 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 13 Dec 2023 15:19:34 +1100 Subject: [PATCH 15/40] Avoid `struct_diagnostic` where possible. It's necessary for `derive(Diagnostic)`, but is best avoided elsewhere because there are clearer alternatives. This required adding `Handler::struct_almost_fatal`. --- compiler/rustc_builtin_macros/src/errors.rs | 4 ++-- compiler/rustc_codegen_llvm/src/errors.rs | 3 ++- compiler/rustc_errors/src/lib.rs | 19 +++++++++++++++++-- compiler/rustc_mir_transform/src/errors.rs | 2 +- compiler/rustc_parse/src/errors.rs | 4 ++-- compiler/rustc_session/src/errors.rs | 2 +- compiler/rustc_session/src/parse.rs | 11 +---------- 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/errors.rs index 0a3af2c2e1330..3d02cd72e5479 100644 --- a/compiler/rustc_builtin_macros/src/errors.rs +++ b/compiler/rustc_builtin_macros/src/errors.rs @@ -453,7 +453,7 @@ impl<'a> IntoDiagnostic<'a> for EnvNotDefinedWithUserMessage { rustc::untranslatable_diagnostic, reason = "cannot translate user-provided messages" )] - let mut diag = handler.struct_diagnostic(self.msg_from_user.to_string()); + let mut diag = handler.struct_err(self.msg_from_user.to_string()); diag.set_span(self.span); diag } @@ -804,7 +804,7 @@ pub(crate) struct AsmClobberNoReg { impl<'a> IntoDiagnostic<'a> for AsmClobberNoReg { fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> { let mut diag = - handler.struct_diagnostic(crate::fluent_generated::builtin_macros_asm_clobber_no_reg); + handler.struct_err(crate::fluent_generated::builtin_macros_asm_clobber_no_reg); diag.set_span(self.spans.clone()); // eager translation as `span_labels` takes `AsRef` let lbl1 = handler.eagerly_translate_to_string( diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index 57ea13ddcd6a8..e6e37a0233547 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -107,7 +107,8 @@ impl IntoDiagnostic<'_, FatalError> for ParseTargetMachineConfig<'_> { let (message, _) = diag.styled_message().first().expect("`LlvmError` with no message"); let message = handler.eagerly_translate_to_string(message.clone(), diag.args()); - let mut diag = handler.struct_diagnostic(fluent::codegen_llvm_parse_target_machine_config); + let mut diag = + handler.struct_almost_fatal(fluent::codegen_llvm_parse_target_machine_config); diag.set_arg("error", message); diag } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 3718fd535f516..4093daba4b4fe 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -722,7 +722,12 @@ impl Handler { self.inner.borrow_mut().emit_stashed_diagnostics() } - /// Construct a builder with the `msg` at the level appropriate for the specific `EmissionGuarantee`. + /// Construct a builder with the `msg` at the level appropriate for the + /// specific `EmissionGuarantee`. + /// + /// Note: this is necessary for `derive(Diagnostic)`, but shouldn't be used + /// outside of that. Instead use `struct_err`, `struct_warn`, etc., which + /// make the diagnostic kind clearer. #[rustc_lint_diagnostics] #[track_caller] pub fn struct_diagnostic( @@ -937,13 +942,23 @@ impl Handler { result } - /// Construct a builder at the `Error` level with the `msg`. + /// Construct a builder at the `Fatal` level with the `msg`. #[rustc_lint_diagnostics] #[track_caller] pub fn struct_fatal(&self, msg: impl Into) -> DiagnosticBuilder<'_, !> { DiagnosticBuilder::new(self, Level::Fatal, msg) } + /// Construct a builder at the `Fatal` level with the `msg`, that doesn't abort. + #[rustc_lint_diagnostics] + #[track_caller] + pub fn struct_almost_fatal( + &self, + msg: impl Into, + ) -> DiagnosticBuilder<'_, FatalError> { + DiagnosticBuilder::new(self, Level::Fatal, msg) + } + /// Construct a builder at the `Help` level with the `msg`. #[rustc_lint_diagnostics] pub fn struct_help(&self, msg: impl Into) -> DiagnosticBuilder<'_, ()> { diff --git a/compiler/rustc_mir_transform/src/errors.rs b/compiler/rustc_mir_transform/src/errors.rs index 2358661738a55..dbf27ea60f836 100644 --- a/compiler/rustc_mir_transform/src/errors.rs +++ b/compiler/rustc_mir_transform/src/errors.rs @@ -65,7 +65,7 @@ pub(crate) struct RequiresUnsafe { impl<'sess> IntoDiagnostic<'sess> for RequiresUnsafe { #[track_caller] fn into_diagnostic(self, handler: &'sess Handler) -> DiagnosticBuilder<'sess, ErrorGuaranteed> { - let mut diag = handler.struct_diagnostic(fluent::mir_transform_requires_unsafe); + let mut diag = handler.struct_err(fluent::mir_transform_requires_unsafe); diag.code(rustc_errors::DiagnosticId::Error("E0133".to_string())); diag.set_span(self.span); diag.span_label(self.span, self.details.label()); diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index bc53ab83439d1..c51a5c095ee2f 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -1046,7 +1046,7 @@ impl<'a> IntoDiagnostic<'a> for ExpectedIdentifier { ) -> rustc_errors::DiagnosticBuilder<'a, ErrorGuaranteed> { let token_descr = TokenDescription::from_token(&self.token); - let mut diag = handler.struct_diagnostic(match token_descr { + let mut diag = handler.struct_err(match token_descr { Some(TokenDescription::ReservedIdentifier) => { fluent::parse_expected_identifier_found_reserved_identifier_str } @@ -1103,7 +1103,7 @@ impl<'a> IntoDiagnostic<'a> for ExpectedSemi { ) -> rustc_errors::DiagnosticBuilder<'a, ErrorGuaranteed> { let token_descr = TokenDescription::from_token(&self.token); - let mut diag = handler.struct_diagnostic(match token_descr { + let mut diag = handler.struct_err(match token_descr { Some(TokenDescription::ReservedIdentifier) => { fluent::parse_expected_semi_found_reserved_identifier_str } diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index 7eed59709c8de..aab7595ef6ef4 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -19,7 +19,7 @@ impl<'a> IntoDiagnostic<'a> for FeatureGateError { self, handler: &'a rustc_errors::Handler, ) -> rustc_errors::DiagnosticBuilder<'a, ErrorGuaranteed> { - let mut diag = handler.struct_diagnostic(self.explain); + let mut diag = handler.struct_err(self.explain); diag.set_span(self.span); diag.code(error_code!(E0658)); diag diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 881e1de6755c5..525f00f5cd044 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -14,7 +14,7 @@ use rustc_data_structures::sync::{AppendOnlyVec, Lock, Lrc}; use rustc_errors::{emitter::SilentEmitter, Handler}; use rustc_errors::{ fallback_fluent_bundle, Diagnostic, DiagnosticBuilder, DiagnosticId, DiagnosticMessage, - EmissionGuarantee, ErrorGuaranteed, IntoDiagnostic, MultiSpan, Noted, StashKey, + ErrorGuaranteed, IntoDiagnostic, MultiSpan, Noted, StashKey, }; use rustc_feature::{find_feature_issue, GateIssue, UnstableFeatures}; use rustc_span::edition::Edition; @@ -390,13 +390,4 @@ impl ParseSess { pub fn struct_fatal(&self, msg: impl Into) -> DiagnosticBuilder<'_, !> { self.span_diagnostic.struct_fatal(msg) } - - #[rustc_lint_diagnostics] - #[track_caller] - pub fn struct_diagnostic( - &self, - msg: impl Into, - ) -> DiagnosticBuilder<'_, G> { - self.span_diagnostic.struct_diagnostic(msg) - } } From e3b7ecc1efc7170fe418e99e071598e7e14aebe1 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 13 Dec 2023 16:03:54 +1100 Subject: [PATCH 16/40] Remove one use of `span_bug_no_panic`. It's unclear why this is used here. All entries in the third column of `UNICODE_ARRAY` are covered by `ASCII_ARRAY`, so if the lookup fails it's a genuine compiler bug. It was added way back in #29837, for no clear reason. This commit changes it to `span_bug`, which is more typical. --- compiler/rustc_parse/src/lexer/unicode_chars.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_parse/src/lexer/unicode_chars.rs b/compiler/rustc_parse/src/lexer/unicode_chars.rs index bbfb160ebf7cb..0dc6068895500 100644 --- a/compiler/rustc_parse/src/lexer/unicode_chars.rs +++ b/compiler/rustc_parse/src/lexer/unicode_chars.rs @@ -350,8 +350,7 @@ pub(super) fn check_for_substitution( let Some((_, ascii_name, token)) = ASCII_ARRAY.iter().find(|&&(s, _, _)| s == ascii_str) else { let msg = format!("substitution character not found for '{ch}'"); - reader.sess.span_diagnostic.span_bug_no_panic(span, msg); - return (None, None); + reader.sess.span_diagnostic.span_bug(span, msg); }; // special help suggestion for "directed" double quotes From 5d87d8307f460a16167416a0e808bcb1c74295b4 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 14 Dec 2023 09:50:47 +0100 Subject: [PATCH 17/40] interpret: extend comment on the inhabitedness check in downcast --- .../src/interpret/projection.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/compiler/rustc_const_eval/src/interpret/projection.rs b/compiler/rustc_const_eval/src/interpret/projection.rs index 0f3b6b25c6157..9a034ba22b989 100644 --- a/compiler/rustc_const_eval/src/interpret/projection.rs +++ b/compiler/rustc_const_eval/src/interpret/projection.rs @@ -208,6 +208,24 @@ where if layout.abi.is_uninhabited() { // `read_discriminant` should have excluded uninhabited variants... but ConstProp calls // us on dead code. + // In the future we might want to allow this to permit code like this: + // (this is a Rust/MIR pseudocode mix) + // ``` + // enum Option2 { + // Some(i32, !), + // None, + // } + // + // fn panic() -> ! { panic!() } + // + // let x: Option2; + // x.Some.0 = 42; + // x.Some.1 = panic(); + // SetDiscriminant(x, Some); + // ``` + // However, for now we don't generate such MIR, and this check here *has* found real + // bugs (see https://github.com/rust-lang/rust/issues/115145), so we will keep rejecting + // it. throw_inval!(ConstPropNonsense) } // This cannot be `transmute` as variants *can* have a smaller size than the entire enum. From bb7c483e48ea992f3759fb643962e1e706c8c029 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Dec 2023 09:54:14 +0100 Subject: [PATCH 18/40] Update to LLVM 17.0.6 --- .gitmodules | 2 +- src/llvm-project | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index f5025097a18dc..9bb68b37081f5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -33,7 +33,7 @@ [submodule "src/llvm-project"] path = src/llvm-project url = https://github.com/rust-lang/llvm-project.git - branch = rustc/17.0-2023-09-19 + branch = rustc/17.0-2023-12-14 shallow = true [submodule "src/doc/embedded-book"] path = src/doc/embedded-book diff --git a/src/llvm-project b/src/llvm-project index 7738295178045..17a687b23d223 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 7738295178045041669876bf32b0543ec8319a5c +Subproject commit 17a687b23d22332fce6ba0aade180a30d06cfa62 From fc7221689e6dcb32dbf72befa465d851d92263d8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 13 Dec 2023 12:14:46 +0100 Subject: [PATCH 19/40] Use Map instead of Object for source files and search index --- src/librustdoc/html/render/search_index.rs | 2 +- src/librustdoc/html/render/write_shared.rs | 19 +-- src/librustdoc/html/static/js/search.js | 141 +++++++++----------- src/librustdoc/html/static/js/src-script.js | 8 +- 4 files changed, 77 insertions(+), 93 deletions(-) diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index b3ae720fcf609..a1029320d2d27 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -488,7 +488,7 @@ pub(crate) fn build_index<'tcx>( // Collect the index into a string format!( - r#""{}":{}"#, + r#"["{}",{}]"#, krate.name(tcx), serde_json::to_string(&CrateData { doc: crate_doc, diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index b04776e91dc74..4b5d1c0d87c7f 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -167,23 +167,24 @@ pub(super) fn write_shared( let mut krates = Vec::new(); if path.exists() { - let prefix = format!("\"{krate}\""); + let prefix = format!("[\"{krate}\""); for line in BufReader::new(File::open(path)?).lines() { let line = line?; - if !line.starts_with('"') { + if !line.starts_with("[\"") { continue; } if line.starts_with(&prefix) { continue; } - if line.ends_with(",\\") { + if line.ends_with("],\\") { ret.push(line[..line.len() - 2].to_string()); } else { // Ends with "\\" (it's the case for the last added crate line) ret.push(line[..line.len() - 1].to_string()); } krates.push( - line.split('"') + line[1..] // We skip the `[` parent at the beginning of the line. + .split('"') .find(|s| !s.is_empty()) .map(|s| s.to_owned()) .unwrap_or_else(String::new), @@ -285,7 +286,7 @@ pub(super) fn write_shared( let (mut all_sources, _krates) = try_err!(collect_json(&dst, krate.name(cx.tcx()).as_str()), &dst); all_sources.push(format!( - r#""{}":{}"#, + r#"["{}",{}]"#, &krate.name(cx.tcx()), hierarchy .to_json_string() @@ -296,9 +297,9 @@ pub(super) fn write_shared( .replace("\\\"", "\\\\\"") )); all_sources.sort(); - let mut v = String::from("var srcIndex = JSON.parse('{\\\n"); + let mut v = String::from("const srcIndex = new Map(JSON.parse('[\\\n"); v.push_str(&all_sources.join(",\\\n")); - v.push_str("\\\n}');\ncreateSrcSidebar();\n"); + v.push_str("\\\n]'));\ncreateSrcSidebar();\n"); Ok(v.into_bytes()) }; write_invocation_specific("src-files.js", &make_sources)?; @@ -316,11 +317,11 @@ pub(super) fn write_shared( // with rustdoc running in parallel. all_indexes.sort(); write_invocation_specific("search-index.js", &|| { - let mut v = String::from("var searchIndex = JSON.parse('{\\\n"); + let mut v = String::from("const searchIndex = new Map(JSON.parse('[\\\n"); v.push_str(&all_indexes.join(",\\\n")); v.push_str( r#"\ -}'); +]')); if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)}; if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; "#, diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 6fce7650b4c14..ccb54e14a5cb2 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -80,10 +80,6 @@ const longItemTypes = [ const TY_GENERIC = itemTypes.indexOf("generic"); const ROOT_PATH = typeof window !== "undefined" ? window.rootPath : "../"; -function hasOwnPropertyRustdoc(obj, property) { - return Object.prototype.hasOwnProperty.call(obj, property); -} - // In the search display, allows to switch between tabs. function printTab(nb) { let iter = 0; @@ -1074,7 +1070,7 @@ function initSearch(rawSearchIndex) { if (elem && elem.value !== "all crates" && - hasOwnPropertyRustdoc(rawSearchIndex, elem.value) + rawSearchIndex.has(elem.value) ) { return elem.value; } @@ -2524,11 +2520,10 @@ ${item.displayPath}${name}\ } let crates = ""; - const crates_list = Object.keys(rawSearchIndex); - if (crates_list.length > 1) { + if (rawSearchIndex.size > 1) { crates = " in 
"; @@ -2945,81 +2940,70 @@ ${item.displayPath}${name}\ // Function type fingerprints are 128-bit bloom filters that are used to // estimate the distance between function and query. // This loop counts the number of items to allocate a fingerprint for. - for (const crate in rawSearchIndex) { - if (!hasOwnPropertyRustdoc(rawSearchIndex, crate)) { - continue; - } + for (const crate of rawSearchIndex.values()) { // Each item gets an entry in the fingerprint array, and the crate // does, too - id += rawSearchIndex[crate].t.length + 1; + id += crate.t.length + 1; } functionTypeFingerprint = new Uint32Array((id + 1) * 4); // This loop actually generates the search item indexes, including // normalized names, type signature objects and fingerprints, and aliases. id = 0; - for (const crate in rawSearchIndex) { - if (!hasOwnPropertyRustdoc(rawSearchIndex, crate)) { - continue; - } - - let crateSize = 0; - - /** - * The raw search data for a given crate. `n`, `t`, `d`, `i`, and `f` - * are arrays with the same length. `q`, `a`, and `c` use a sparse - * representation for compactness. - * - * `n[i]` contains the name of an item. - * - * `t[i]` contains the type of that item - * (as a string of characters that represent an offset in `itemTypes`). - * - * `d[i]` contains the description of that item. - * - * `q` contains the full paths of the items. For compactness, it is a set of - * (index, path) pairs used to create a map. If a given index `i` is - * not present, this indicates "same as the last index present". - * - * `i[i]` contains an item's parent, usually a module. For compactness, - * it is a set of indexes into the `p` array. - * - * `f[i]` contains function signatures, or `0` if the item isn't a function. - * Functions are themselves encoded as arrays. The first item is a list of - * types representing the function's inputs, and the second list item is a list - * of types representing the function's output. Tuples are flattened. - * Types are also represented as arrays; the first item is an index into the `p` - * array, while the second is a list of types representing any generic parameters. - * - * b[i] contains an item's impl disambiguator. This is only present if an item - * is defined in an impl block and, the impl block's type has more than one associated - * item with the same name. - * - * `a` defines aliases with an Array of pairs: [name, offset], where `offset` - * points into the n/t/d/q/i/f arrays. - * - * `doc` contains the description of the crate. - * - * `p` is a list of path/type pairs. It is used for parents and function parameters. - * - * `c` is an array of item indices that are deprecated. - * - * @type {{ - * doc: string, - * a: Object, - * n: Array, - * t: String, - * d: Array, - * q: Array<[Number, string]>, - * i: Array, - * f: Array, - * p: Array, - * b: Array<[Number, String]>, - * c: Array - * }} - */ - const crateCorpus = rawSearchIndex[crate]; - + /** + * The raw search data for a given crate. `n`, `t`, `d`, `i`, and `f` + * are arrays with the same length. `q`, `a`, and `c` use a sparse + * representation for compactness. + * + * `n[i]` contains the name of an item. + * + * `t[i]` contains the type of that item + * (as a string of characters that represent an offset in `itemTypes`). + * + * `d[i]` contains the description of that item. + * + * `q` contains the full paths of the items. For compactness, it is a set of + * (index, path) pairs used to create a map. If a given index `i` is + * not present, this indicates "same as the last index present". + * + * `i[i]` contains an item's parent, usually a module. For compactness, + * it is a set of indexes into the `p` array. + * + * `f[i]` contains function signatures, or `0` if the item isn't a function. + * Functions are themselves encoded as arrays. The first item is a list of + * types representing the function's inputs, and the second list item is a list + * of types representing the function's output. Tuples are flattened. + * Types are also represented as arrays; the first item is an index into the `p` + * array, while the second is a list of types representing any generic parameters. + * + * b[i] contains an item's impl disambiguator. This is only present if an item + * is defined in an impl block and, the impl block's type has more than one associated + * item with the same name. + * + * `a` defines aliases with an Array of pairs: [name, offset], where `offset` + * points into the n/t/d/q/i/f arrays. + * + * `doc` contains the description of the crate. + * + * `p` is a list of path/type pairs. It is used for parents and function parameters. + * + * `c` is an array of item indices that are deprecated. + * + * @type {{ + * doc: string, + * a: Object, + * n: Array, + * t: String, + * d: Array, + * q: Array<[Number, string]>, + * i: Array, + * f: Array, + * p: Array, + * b: Array<[Number, String]>, + * c: Array + * }} + */ + for (const [crate, crateCorpus] of rawSearchIndex) { searchWords.push(crate); // This object should have exactly the same set of fields as the "row" // object defined below. Your JavaScript runtime will thank you. @@ -3145,14 +3129,13 @@ ${item.displayPath}${name}\ id += 1; searchIndex.push(row); lastPath = row.path; - crateSize += 1; } if (aliases) { const currentCrateAliases = new Map(); ALIASES.set(crate, currentCrateAliases); for (const alias_name in aliases) { - if (!hasOwnPropertyRustdoc(aliases, alias_name)) { + if (!Object.prototype.hasOwnProperty.call(aliases, alias_name)) { continue; } @@ -3168,7 +3151,7 @@ ${item.displayPath}${name}\ } } } - currentIndex += crateSize; + currentIndex += itemTypes.length; } return searchWords; } @@ -3377,7 +3360,7 @@ if (typeof window !== "undefined") { } else { // Running in Node, not a browser. Run initSearch just to produce the // exports. - initSearch({}); + initSearch(new Map()); } diff --git a/src/librustdoc/html/static/js/src-script.js b/src/librustdoc/html/static/js/src-script.js index 679c2341f02ba..27b5cf1e2aef3 100644 --- a/src/librustdoc/html/static/js/src-script.js +++ b/src/librustdoc/html/static/js/src-script.js @@ -118,10 +118,10 @@ function createSrcSidebar() { title.className = "title"; title.innerText = "Files"; sidebar.appendChild(title); - Object.keys(srcIndex).forEach(key => { - srcIndex[key][NAME_OFFSET] = key; - hasFoundFile = createDirEntry(srcIndex[key], sidebar, "", hasFoundFile); - }); + for (const [key, source] of srcIndex) { + source[NAME_OFFSET] = key; + hasFoundFile = createDirEntry(source, sidebar, "", hasFoundFile); + } container.appendChild(sidebar); // Focus on the current file in the source files sidebar. From 428395e064587fe12794d868eb3efce91f300558 Mon Sep 17 00:00:00 2001 From: Urgau Date: Tue, 12 Dec 2023 21:47:20 +0100 Subject: [PATCH 20/40] Move rustc_codegen_ssa target features to rustc_target --- compiler/rustc_codegen_gcc/src/gcc_util.rs | 8 +- compiler/rustc_codegen_gcc/src/lib.rs | 5 +- compiler/rustc_codegen_llvm/src/llvm_util.rs | 15 +- .../rustc_codegen_ssa/src/target_features.rs | 434 +----------------- compiler/rustc_target/src/lib.rs | 1 + compiler/rustc_target/src/target_features.rs | 429 +++++++++++++++++ 6 files changed, 450 insertions(+), 442 deletions(-) create mode 100644 compiler/rustc_target/src/target_features.rs diff --git a/compiler/rustc_codegen_gcc/src/gcc_util.rs b/compiler/rustc_codegen_gcc/src/gcc_util.rs index 1248fdcd2599c..2aa84f26797c3 100644 --- a/compiler/rustc_codegen_gcc/src/gcc_util.rs +++ b/compiler/rustc_codegen_gcc/src/gcc_util.rs @@ -2,12 +2,10 @@ use gccjit::Context; use smallvec::{smallvec, SmallVec}; -use rustc_codegen_ssa::target_features::{ - supported_target_features, tied_target_features, RUSTC_SPECIFIC_FEATURES, -}; use rustc_data_structures::fx::FxHashMap; use rustc_middle::bug; use rustc_session::Session; +use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES; use crate::errors::{PossibleFeature, TargetFeatureDisableOrEnable, UnknownCTargetFeature, UnknownCTargetFeaturePrefix}; @@ -44,7 +42,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> // Given a map from target_features to whether they are enabled or disabled, // ensure only valid combinations are allowed. pub fn check_tied_features(sess: &Session, features: &FxHashMap<&str, bool>) -> Option<&'static [&'static str]> { - for tied in tied_target_features(sess) { + for tied in sess.target.tied_target_features() { // Tied features must be set to the same value, or not set at all let mut tied_iter = tied.iter(); let enabled = features.get(tied_iter.next().unwrap()); diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index d54057615d2d8..0ececc5dda0a9 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -97,7 +97,6 @@ use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen}; use rustc_codegen_ssa::base::codegen_crate; use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig, TargetMachineFactoryFn}; use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule}; -use rustc_codegen_ssa::target_features::supported_target_features; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::sync::IntoDynSyncSend; use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods}; @@ -397,7 +396,9 @@ fn to_gcc_opt_level(optlevel: Option) -> OptimizationLevel { } pub fn target_features(sess: &Session, allow_unstable: bool, target_info: &LockedTargetInfo) -> Vec { - supported_target_features(sess) + sess + .target + .supported_target_features() .iter() .filter_map( |&(feature, gate)| { diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 93cb7327a017e..08519723eba4f 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -5,9 +5,6 @@ use crate::errors::{ }; use crate::llvm; use libc::c_int; -use rustc_codegen_ssa::target_features::{ - supported_target_features, tied_target_features, RUSTC_SPECIFIC_FEATURES, -}; use rustc_codegen_ssa::traits::PrintBackendInfo; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::small_c_str::SmallCStr; @@ -17,6 +14,7 @@ use rustc_session::config::{PrintKind, PrintRequest}; use rustc_session::Session; use rustc_span::symbol::Symbol; use rustc_target::spec::{MergeFunctions, PanicStrategy}; +use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES; use std::ffi::{c_char, c_void, CStr, CString}; use std::path::Path; @@ -278,7 +276,7 @@ pub fn check_tied_features( features: &FxHashMap<&str, bool>, ) -> Option<&'static [&'static str]> { if !features.is_empty() { - for tied in tied_target_features(sess) { + for tied in sess.target.tied_target_features() { // Tied features must be set to the same value, or not set at all let mut tied_iter = tied.iter(); let enabled = features.get(tied_iter.next().unwrap()); @@ -294,7 +292,8 @@ pub fn check_tied_features( /// Must express features in the way Rust understands them pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec { let target_machine = create_informational_target_machine(sess); - supported_target_features(sess) + sess.target + .supported_target_features() .iter() .filter_map(|&(feature, gate)| { if sess.is_nightly_build() || allow_unstable || gate.is_stable() { @@ -362,7 +361,9 @@ fn llvm_target_features(tm: &llvm::TargetMachine) -> Vec<(&str, &str)> { fn print_target_features(out: &mut dyn PrintBackendInfo, sess: &Session, tm: &llvm::TargetMachine) { let mut llvm_target_features = llvm_target_features(tm); let mut known_llvm_target_features = FxHashSet::<&'static str>::default(); - let mut rustc_target_features = supported_target_features(sess) + let mut rustc_target_features = sess + .target + .supported_target_features() .iter() .map(|(feature, _gate)| { // LLVM asserts that these are sorted. LLVM and Rust both use byte comparison for these strings. @@ -515,7 +516,7 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec Option { - match self { - Stable => None, - Unstable(s) => Some(s), - } - } - - pub fn is_stable(self) -> bool { - matches!(self, Stable) - } -} - -// Here we list target features that rustc "understands": they can be used in `#[target_feature]` -// and `#[cfg(target_feature)]`. They also do not trigger any warnings when used with -// `-Ctarget-feature`. -// -// When adding features to the below lists -// check whether they're named already elsewhere in rust -// e.g. in stdarch and whether the given name matches LLVM's -// if it doesn't, to_llvm_feature in llvm_util in rustc_codegen_llvm needs to be adapted. -// -// Also note that all target features listed here must be purely additive: for target_feature 1.1 to -// be sound, we can never allow features like `+soft-float` (on x86) to be controlled on a -// per-function level, since we would then allow safe calls from functions with `+soft-float` to -// functions without that feature! -// -// When adding a new feature, be particularly mindful of features that affect function ABIs. Those -// need to be treated very carefully to avoid introducing unsoundness! This often affects features -// that enable/disable hardfloat support (see https://github.com/rust-lang/rust/issues/116344 for an -// example of this going wrong), but features enabling new SIMD registers are also a concern (see -// https://github.com/rust-lang/rust/issues/116558 for an example of this going wrong). -// -// Stabilizing a target feature requires t-lang approval. - -const ARM_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - ("aclass", Unstable(sym::arm_target_feature)), - ("aes", Unstable(sym::arm_target_feature)), - ("crc", Unstable(sym::arm_target_feature)), - ("d32", Unstable(sym::arm_target_feature)), - ("dotprod", Unstable(sym::arm_target_feature)), - ("dsp", Unstable(sym::arm_target_feature)), - ("fp-armv8", Unstable(sym::arm_target_feature)), - ("i8mm", Unstable(sym::arm_target_feature)), - ("mclass", Unstable(sym::arm_target_feature)), - ("neon", Unstable(sym::arm_target_feature)), - ("rclass", Unstable(sym::arm_target_feature)), - ("sha2", Unstable(sym::arm_target_feature)), - // This is needed for inline assembly, but shouldn't be stabilized as-is - // since it should be enabled per-function using #[instruction_set], not - // #[target_feature]. - ("thumb-mode", Unstable(sym::arm_target_feature)), - ("thumb2", Unstable(sym::arm_target_feature)), - ("trustzone", Unstable(sym::arm_target_feature)), - ("v5te", Unstable(sym::arm_target_feature)), - ("v6", Unstable(sym::arm_target_feature)), - ("v6k", Unstable(sym::arm_target_feature)), - ("v6t2", Unstable(sym::arm_target_feature)), - ("v7", Unstable(sym::arm_target_feature)), - ("v8", Unstable(sym::arm_target_feature)), - ("vfp2", Unstable(sym::arm_target_feature)), - ("vfp3", Unstable(sym::arm_target_feature)), - ("vfp4", Unstable(sym::arm_target_feature)), - ("virtualization", Unstable(sym::arm_target_feature)), - // tidy-alphabetical-end -]; - -const AARCH64_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - // FEAT_AES - ("aes", Stable), - // FEAT_BF16 - ("bf16", Stable), - // FEAT_BTI - ("bti", Stable), - // FEAT_CRC - ("crc", Stable), - // FEAT_DIT - ("dit", Stable), - // FEAT_DotProd - ("dotprod", Stable), - // FEAT_DPB - ("dpb", Stable), - // FEAT_DPB2 - ("dpb2", Stable), - // FEAT_F32MM - ("f32mm", Stable), - // FEAT_F64MM - ("f64mm", Stable), - // FEAT_FCMA - ("fcma", Stable), - // FEAT_FHM - ("fhm", Stable), - // FEAT_FLAGM - ("flagm", Stable), - // FEAT_FP16 - ("fp16", Stable), - // FEAT_FRINTTS - ("frintts", Stable), - // FEAT_I8MM - ("i8mm", Stable), - // FEAT_JSCVT - ("jsconv", Stable), - // FEAT_LOR - ("lor", Stable), - // FEAT_LSE - ("lse", Stable), - // FEAT_MTE - ("mte", Stable), - // FEAT_AdvSimd & FEAT_FP - ("neon", Stable), - // FEAT_PAUTH (address authentication) - ("paca", Stable), - // FEAT_PAUTH (generic authentication) - ("pacg", Stable), - // FEAT_PAN - ("pan", Stable), - // FEAT_PMUv3 - ("pmuv3", Stable), - // FEAT_RAND - ("rand", Stable), - // FEAT_RAS - ("ras", Stable), - // FEAT_RCPC - ("rcpc", Stable), - // FEAT_RCPC2 - ("rcpc2", Stable), - // FEAT_RDM - ("rdm", Stable), - // FEAT_SB - ("sb", Stable), - // FEAT_SHA1 & FEAT_SHA256 - ("sha2", Stable), - // FEAT_SHA512 & FEAT_SHA3 - ("sha3", Stable), - // FEAT_SM3 & FEAT_SM4 - ("sm4", Stable), - // FEAT_SPE - ("spe", Stable), - // FEAT_SSBS - ("ssbs", Stable), - // FEAT_SVE - ("sve", Stable), - // FEAT_SVE2 - ("sve2", Stable), - // FEAT_SVE2_AES - ("sve2-aes", Stable), - // FEAT_SVE2_BitPerm - ("sve2-bitperm", Stable), - // FEAT_SVE2_SHA3 - ("sve2-sha3", Stable), - // FEAT_SVE2_SM4 - ("sve2-sm4", Stable), - // FEAT_TME - ("tme", Stable), - ("v8.1a", Unstable(sym::aarch64_ver_target_feature)), - ("v8.2a", Unstable(sym::aarch64_ver_target_feature)), - ("v8.3a", Unstable(sym::aarch64_ver_target_feature)), - ("v8.4a", Unstable(sym::aarch64_ver_target_feature)), - ("v8.5a", Unstable(sym::aarch64_ver_target_feature)), - ("v8.6a", Unstable(sym::aarch64_ver_target_feature)), - ("v8.7a", Unstable(sym::aarch64_ver_target_feature)), - // FEAT_VHE - ("vh", Stable), - // tidy-alphabetical-end -]; - -const AARCH64_TIED_FEATURES: &[&[&str]] = &[ - &["paca", "pacg"], // Together these represent `pauth` in LLVM -]; - -const X86_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - ("adx", Stable), - ("aes", Stable), - ("avx", Stable), - ("avx2", Stable), - ("avx512bf16", Unstable(sym::avx512_target_feature)), - ("avx512bitalg", Unstable(sym::avx512_target_feature)), - ("avx512bw", Unstable(sym::avx512_target_feature)), - ("avx512cd", Unstable(sym::avx512_target_feature)), - ("avx512dq", Unstable(sym::avx512_target_feature)), - ("avx512er", Unstable(sym::avx512_target_feature)), - ("avx512f", Unstable(sym::avx512_target_feature)), - ("avx512ifma", Unstable(sym::avx512_target_feature)), - ("avx512pf", Unstable(sym::avx512_target_feature)), - ("avx512vbmi", Unstable(sym::avx512_target_feature)), - ("avx512vbmi2", Unstable(sym::avx512_target_feature)), - ("avx512vl", Unstable(sym::avx512_target_feature)), - ("avx512vnni", Unstable(sym::avx512_target_feature)), - ("avx512vp2intersect", Unstable(sym::avx512_target_feature)), - ("avx512vpopcntdq", Unstable(sym::avx512_target_feature)), - ("bmi1", Stable), - ("bmi2", Stable), - ("cmpxchg16b", Stable), - ("ermsb", Unstable(sym::ermsb_target_feature)), - ("f16c", Stable), - ("fma", Stable), - ("fxsr", Stable), - ("gfni", Unstable(sym::avx512_target_feature)), - ("lzcnt", Stable), - ("movbe", Stable), - ("pclmulqdq", Stable), - ("popcnt", Stable), - ("rdrand", Stable), - ("rdseed", Stable), - ("rtm", Unstable(sym::rtm_target_feature)), - ("sha", Stable), - ("sse", Stable), - ("sse2", Stable), - ("sse3", Stable), - ("sse4.1", Stable), - ("sse4.2", Stable), - ("sse4a", Unstable(sym::sse4a_target_feature)), - ("ssse3", Stable), - ("tbm", Unstable(sym::tbm_target_feature)), - ("vaes", Unstable(sym::avx512_target_feature)), - ("vpclmulqdq", Unstable(sym::avx512_target_feature)), - ("xsave", Stable), - ("xsavec", Stable), - ("xsaveopt", Stable), - ("xsaves", Stable), - // tidy-alphabetical-end -]; - -const HEXAGON_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - ("hvx", Unstable(sym::hexagon_target_feature)), - ("hvx-length128b", Unstable(sym::hexagon_target_feature)), - // tidy-alphabetical-end -]; - -const POWERPC_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - ("altivec", Unstable(sym::powerpc_target_feature)), - ("power10-vector", Unstable(sym::powerpc_target_feature)), - ("power8-altivec", Unstable(sym::powerpc_target_feature)), - ("power8-vector", Unstable(sym::powerpc_target_feature)), - ("power9-altivec", Unstable(sym::powerpc_target_feature)), - ("power9-vector", Unstable(sym::powerpc_target_feature)), - ("vsx", Unstable(sym::powerpc_target_feature)), - // tidy-alphabetical-end -]; - -const MIPS_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - ("fp64", Unstable(sym::mips_target_feature)), - ("msa", Unstable(sym::mips_target_feature)), - ("virt", Unstable(sym::mips_target_feature)), - // tidy-alphabetical-end -]; - -const RISCV_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - ("a", Stable), - ("c", Stable), - ("d", Unstable(sym::riscv_target_feature)), - ("e", Unstable(sym::riscv_target_feature)), - ("f", Unstable(sym::riscv_target_feature)), - ("fast-unaligned-access", Unstable(sym::riscv_target_feature)), - ("m", Stable), - ("relax", Unstable(sym::riscv_target_feature)), - ("v", Unstable(sym::riscv_target_feature)), - ("zba", Stable), - ("zbb", Stable), - ("zbc", Stable), - ("zbkb", Stable), - ("zbkc", Stable), - ("zbkx", Stable), - ("zbs", Stable), - ("zdinx", Unstable(sym::riscv_target_feature)), - ("zfh", Unstable(sym::riscv_target_feature)), - ("zfhmin", Unstable(sym::riscv_target_feature)), - ("zfinx", Unstable(sym::riscv_target_feature)), - ("zhinx", Unstable(sym::riscv_target_feature)), - ("zhinxmin", Unstable(sym::riscv_target_feature)), - ("zk", Stable), - ("zkn", Stable), - ("zknd", Stable), - ("zkne", Stable), - ("zknh", Stable), - ("zkr", Stable), - ("zks", Stable), - ("zksed", Stable), - ("zksh", Stable), - ("zkt", Stable), - // tidy-alphabetical-end -]; - -const WASM_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - ("atomics", Unstable(sym::wasm_target_feature)), - ("bulk-memory", Unstable(sym::wasm_target_feature)), - ("exception-handling", Unstable(sym::wasm_target_feature)), - ("multivalue", Unstable(sym::wasm_target_feature)), - ("mutable-globals", Unstable(sym::wasm_target_feature)), - ("nontrapping-fptoint", Unstable(sym::wasm_target_feature)), - ("reference-types", Unstable(sym::wasm_target_feature)), - ("relaxed-simd", Unstable(sym::wasm_target_feature)), - ("sign-ext", Unstable(sym::wasm_target_feature)), - ("simd128", Stable), - // tidy-alphabetical-end -]; - -const BPF_ALLOWED_FEATURES: &[(&str, Stability)] = &[("alu32", Unstable(sym::bpf_target_feature))]; - -const CSKY_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - ("10e60", Unstable(sym::csky_target_feature)), - ("2e3", Unstable(sym::csky_target_feature)), - ("3e3r1", Unstable(sym::csky_target_feature)), - ("3e3r2", Unstable(sym::csky_target_feature)), - ("3e3r3", Unstable(sym::csky_target_feature)), - ("3e7", Unstable(sym::csky_target_feature)), - ("7e10", Unstable(sym::csky_target_feature)), - ("cache", Unstable(sym::csky_target_feature)), - ("doloop", Unstable(sym::csky_target_feature)), - ("dsp1e2", Unstable(sym::csky_target_feature)), - ("dspe60", Unstable(sym::csky_target_feature)), - ("e1", Unstable(sym::csky_target_feature)), - ("e2", Unstable(sym::csky_target_feature)), - ("edsp", Unstable(sym::csky_target_feature)), - ("elrw", Unstable(sym::csky_target_feature)), - ("float1e2", Unstable(sym::csky_target_feature)), - ("float1e3", Unstable(sym::csky_target_feature)), - ("float3e4", Unstable(sym::csky_target_feature)), - ("float7e60", Unstable(sym::csky_target_feature)), - ("floate1", Unstable(sym::csky_target_feature)), - ("hard-tp", Unstable(sym::csky_target_feature)), - ("high-registers", Unstable(sym::csky_target_feature)), - ("hwdiv", Unstable(sym::csky_target_feature)), - ("mp", Unstable(sym::csky_target_feature)), - ("mp1e2", Unstable(sym::csky_target_feature)), - ("nvic", Unstable(sym::csky_target_feature)), - ("trust", Unstable(sym::csky_target_feature)), - ("vdsp2e60f", Unstable(sym::csky_target_feature)), - ("vdspv1", Unstable(sym::csky_target_feature)), - ("vdspv2", Unstable(sym::csky_target_feature)), - // tidy-alphabetical-end - //fpu - // tidy-alphabetical-start - ("fdivdu", Unstable(sym::csky_target_feature)), - ("fpuv2_df", Unstable(sym::csky_target_feature)), - ("fpuv2_sf", Unstable(sym::csky_target_feature)), - ("fpuv3_df", Unstable(sym::csky_target_feature)), - ("fpuv3_hf", Unstable(sym::csky_target_feature)), - ("fpuv3_hi", Unstable(sym::csky_target_feature)), - ("fpuv3_sf", Unstable(sym::csky_target_feature)), - ("hard-float", Unstable(sym::csky_target_feature)), - ("hard-float-abi", Unstable(sym::csky_target_feature)), - // tidy-alphabetical-end -]; - -const LOONGARCH_ALLOWED_FEATURES: &[(&str, Stability)] = &[ - // tidy-alphabetical-start - ("d", Unstable(sym::loongarch_target_feature)), - ("f", Unstable(sym::loongarch_target_feature)), - ("lasx", Unstable(sym::loongarch_target_feature)), - ("lbt", Unstable(sym::loongarch_target_feature)), - ("lsx", Unstable(sym::loongarch_target_feature)), - ("lvz", Unstable(sym::loongarch_target_feature)), - ("ual", Unstable(sym::loongarch_target_feature)), - // tidy-alphabetical-end -]; - -/// When rustdoc is running, provide a list of all known features so that all their respective -/// primitives may be documented. -/// -/// IMPORTANT: If you're adding another feature list above, make sure to add it to this iterator! -pub fn all_known_features() -> impl Iterator { - std::iter::empty() - .chain(ARM_ALLOWED_FEATURES.iter()) - .chain(AARCH64_ALLOWED_FEATURES.iter()) - .chain(X86_ALLOWED_FEATURES.iter()) - .chain(HEXAGON_ALLOWED_FEATURES.iter()) - .chain(POWERPC_ALLOWED_FEATURES.iter()) - .chain(MIPS_ALLOWED_FEATURES.iter()) - .chain(RISCV_ALLOWED_FEATURES.iter()) - .chain(WASM_ALLOWED_FEATURES.iter()) - .chain(BPF_ALLOWED_FEATURES.iter()) - .chain(CSKY_ALLOWED_FEATURES) - .chain(LOONGARCH_ALLOWED_FEATURES) - .cloned() -} - -pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Stability)] { - match &*sess.target.arch { - "arm" => ARM_ALLOWED_FEATURES, - "aarch64" => AARCH64_ALLOWED_FEATURES, - "x86" | "x86_64" => X86_ALLOWED_FEATURES, - "hexagon" => HEXAGON_ALLOWED_FEATURES, - "mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_ALLOWED_FEATURES, - "powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES, - "riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES, - "wasm32" | "wasm64" => WASM_ALLOWED_FEATURES, - "bpf" => BPF_ALLOWED_FEATURES, - "csky" => CSKY_ALLOWED_FEATURES, - "loongarch64" => LOONGARCH_ALLOWED_FEATURES, - _ => &[], - } -} - -pub fn tied_target_features(sess: &Session) -> &'static [&'static [&'static str]] { - match &*sess.target.arch { - "aarch64" => AARCH64_TIED_FEATURES, - _ => &[], - } -} - pub fn from_target_feature( tcx: TyCtxt<'_>, attr: &ast::Attribute, @@ -562,9 +136,13 @@ pub(crate) fn provide(providers: &mut Providers) { if tcx.sess.opts.actually_rustdoc { // rustdoc needs to be able to document functions that use all the features, so // whitelist them all - all_known_features().map(|(a, b)| (a.to_string(), b.as_feature_name())).collect() + rustc_target::target_features::all_known_features() + .map(|(a, b)| (a.to_string(), b.as_feature_name())) + .collect() } else { - supported_target_features(tcx.sess) + tcx.sess + .target + .supported_target_features() .iter() .map(|&(a, b)| (a.to_string(), b.as_feature_name())) .collect() diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs index e17b81d465235..257c6777996fc 100644 --- a/compiler/rustc_target/src/lib.rs +++ b/compiler/rustc_target/src/lib.rs @@ -35,6 +35,7 @@ pub mod abi; pub mod asm; pub mod json; pub mod spec; +pub mod target_features; #[cfg(test)] mod tests; diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs new file mode 100644 index 0000000000000..5f5de57dd1d87 --- /dev/null +++ b/compiler/rustc_target/src/target_features.rs @@ -0,0 +1,429 @@ +use rustc_span::symbol::sym; +use rustc_span::symbol::Symbol; + +/// Features that control behaviour of rustc, rather than the codegen. +pub const RUSTC_SPECIFIC_FEATURES: &[&str] = &["crt-static"]; + +/// Stability information for target features. +#[derive(Debug, Clone, Copy)] +pub enum Stability { + /// This target feature is stable, it can be used in `#[target_feature]` and + /// `#[cfg(target_feature)]`. + Stable, + /// This target feature is unstable; using it in `#[target_feature]` or `#[cfg(target_feature)]` + /// requires enabling the given nightly feature. + Unstable(Symbol), +} +use Stability::*; + +impl Stability { + pub fn as_feature_name(self) -> Option { + match self { + Stable => None, + Unstable(s) => Some(s), + } + } + + pub fn is_stable(self) -> bool { + matches!(self, Stable) + } +} + +// Here we list target features that rustc "understands": they can be used in `#[target_feature]` +// and `#[cfg(target_feature)]`. They also do not trigger any warnings when used with +// `-Ctarget-feature`. +// +// When adding features to the below lists +// check whether they're named already elsewhere in rust +// e.g. in stdarch and whether the given name matches LLVM's +// if it doesn't, to_llvm_feature in llvm_util in rustc_codegen_llvm needs to be adapted. +// +// Also note that all target features listed here must be purely additive: for target_feature 1.1 to +// be sound, we can never allow features like `+soft-float` (on x86) to be controlled on a +// per-function level, since we would then allow safe calls from functions with `+soft-float` to +// functions without that feature! +// +// When adding a new feature, be particularly mindful of features that affect function ABIs. Those +// need to be treated very carefully to avoid introducing unsoundness! This often affects features +// that enable/disable hardfloat support (see https://github.com/rust-lang/rust/issues/116344 for an +// example of this going wrong), but features enabling new SIMD registers are also a concern (see +// https://github.com/rust-lang/rust/issues/116558 for an example of this going wrong). +// +// Stabilizing a target feature requires t-lang approval. + +const ARM_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + ("aclass", Unstable(sym::arm_target_feature)), + ("aes", Unstable(sym::arm_target_feature)), + ("crc", Unstable(sym::arm_target_feature)), + ("d32", Unstable(sym::arm_target_feature)), + ("dotprod", Unstable(sym::arm_target_feature)), + ("dsp", Unstable(sym::arm_target_feature)), + ("fp-armv8", Unstable(sym::arm_target_feature)), + ("i8mm", Unstable(sym::arm_target_feature)), + ("mclass", Unstable(sym::arm_target_feature)), + ("neon", Unstable(sym::arm_target_feature)), + ("rclass", Unstable(sym::arm_target_feature)), + ("sha2", Unstable(sym::arm_target_feature)), + // This is needed for inline assembly, but shouldn't be stabilized as-is + // since it should be enabled per-function using #[instruction_set], not + // #[target_feature]. + ("thumb-mode", Unstable(sym::arm_target_feature)), + ("thumb2", Unstable(sym::arm_target_feature)), + ("trustzone", Unstable(sym::arm_target_feature)), + ("v5te", Unstable(sym::arm_target_feature)), + ("v6", Unstable(sym::arm_target_feature)), + ("v6k", Unstable(sym::arm_target_feature)), + ("v6t2", Unstable(sym::arm_target_feature)), + ("v7", Unstable(sym::arm_target_feature)), + ("v8", Unstable(sym::arm_target_feature)), + ("vfp2", Unstable(sym::arm_target_feature)), + ("vfp3", Unstable(sym::arm_target_feature)), + ("vfp4", Unstable(sym::arm_target_feature)), + ("virtualization", Unstable(sym::arm_target_feature)), + // tidy-alphabetical-end +]; + +const AARCH64_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + // FEAT_AES + ("aes", Stable), + // FEAT_BF16 + ("bf16", Stable), + // FEAT_BTI + ("bti", Stable), + // FEAT_CRC + ("crc", Stable), + // FEAT_DIT + ("dit", Stable), + // FEAT_DotProd + ("dotprod", Stable), + // FEAT_DPB + ("dpb", Stable), + // FEAT_DPB2 + ("dpb2", Stable), + // FEAT_F32MM + ("f32mm", Stable), + // FEAT_F64MM + ("f64mm", Stable), + // FEAT_FCMA + ("fcma", Stable), + // FEAT_FHM + ("fhm", Stable), + // FEAT_FLAGM + ("flagm", Stable), + // FEAT_FP16 + ("fp16", Stable), + // FEAT_FRINTTS + ("frintts", Stable), + // FEAT_I8MM + ("i8mm", Stable), + // FEAT_JSCVT + ("jsconv", Stable), + // FEAT_LOR + ("lor", Stable), + // FEAT_LSE + ("lse", Stable), + // FEAT_MTE + ("mte", Stable), + // FEAT_AdvSimd & FEAT_FP + ("neon", Stable), + // FEAT_PAUTH (address authentication) + ("paca", Stable), + // FEAT_PAUTH (generic authentication) + ("pacg", Stable), + // FEAT_PAN + ("pan", Stable), + // FEAT_PMUv3 + ("pmuv3", Stable), + // FEAT_RAND + ("rand", Stable), + // FEAT_RAS + ("ras", Stable), + // FEAT_RCPC + ("rcpc", Stable), + // FEAT_RCPC2 + ("rcpc2", Stable), + // FEAT_RDM + ("rdm", Stable), + // FEAT_SB + ("sb", Stable), + // FEAT_SHA1 & FEAT_SHA256 + ("sha2", Stable), + // FEAT_SHA512 & FEAT_SHA3 + ("sha3", Stable), + // FEAT_SM3 & FEAT_SM4 + ("sm4", Stable), + // FEAT_SPE + ("spe", Stable), + // FEAT_SSBS + ("ssbs", Stable), + // FEAT_SVE + ("sve", Stable), + // FEAT_SVE2 + ("sve2", Stable), + // FEAT_SVE2_AES + ("sve2-aes", Stable), + // FEAT_SVE2_BitPerm + ("sve2-bitperm", Stable), + // FEAT_SVE2_SHA3 + ("sve2-sha3", Stable), + // FEAT_SVE2_SM4 + ("sve2-sm4", Stable), + // FEAT_TME + ("tme", Stable), + ("v8.1a", Unstable(sym::aarch64_ver_target_feature)), + ("v8.2a", Unstable(sym::aarch64_ver_target_feature)), + ("v8.3a", Unstable(sym::aarch64_ver_target_feature)), + ("v8.4a", Unstable(sym::aarch64_ver_target_feature)), + ("v8.5a", Unstable(sym::aarch64_ver_target_feature)), + ("v8.6a", Unstable(sym::aarch64_ver_target_feature)), + ("v8.7a", Unstable(sym::aarch64_ver_target_feature)), + // FEAT_VHE + ("vh", Stable), + // tidy-alphabetical-end +]; + +const AARCH64_TIED_FEATURES: &[&[&str]] = &[ + &["paca", "pacg"], // Together these represent `pauth` in LLVM +]; + +const X86_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + ("adx", Stable), + ("aes", Stable), + ("avx", Stable), + ("avx2", Stable), + ("avx512bf16", Unstable(sym::avx512_target_feature)), + ("avx512bitalg", Unstable(sym::avx512_target_feature)), + ("avx512bw", Unstable(sym::avx512_target_feature)), + ("avx512cd", Unstable(sym::avx512_target_feature)), + ("avx512dq", Unstable(sym::avx512_target_feature)), + ("avx512er", Unstable(sym::avx512_target_feature)), + ("avx512f", Unstable(sym::avx512_target_feature)), + ("avx512ifma", Unstable(sym::avx512_target_feature)), + ("avx512pf", Unstable(sym::avx512_target_feature)), + ("avx512vbmi", Unstable(sym::avx512_target_feature)), + ("avx512vbmi2", Unstable(sym::avx512_target_feature)), + ("avx512vl", Unstable(sym::avx512_target_feature)), + ("avx512vnni", Unstable(sym::avx512_target_feature)), + ("avx512vp2intersect", Unstable(sym::avx512_target_feature)), + ("avx512vpopcntdq", Unstable(sym::avx512_target_feature)), + ("bmi1", Stable), + ("bmi2", Stable), + ("cmpxchg16b", Stable), + ("ermsb", Unstable(sym::ermsb_target_feature)), + ("f16c", Stable), + ("fma", Stable), + ("fxsr", Stable), + ("gfni", Unstable(sym::avx512_target_feature)), + ("lzcnt", Stable), + ("movbe", Stable), + ("pclmulqdq", Stable), + ("popcnt", Stable), + ("rdrand", Stable), + ("rdseed", Stable), + ("rtm", Unstable(sym::rtm_target_feature)), + ("sha", Stable), + ("sse", Stable), + ("sse2", Stable), + ("sse3", Stable), + ("sse4.1", Stable), + ("sse4.2", Stable), + ("sse4a", Unstable(sym::sse4a_target_feature)), + ("ssse3", Stable), + ("tbm", Unstable(sym::tbm_target_feature)), + ("vaes", Unstable(sym::avx512_target_feature)), + ("vpclmulqdq", Unstable(sym::avx512_target_feature)), + ("xsave", Stable), + ("xsavec", Stable), + ("xsaveopt", Stable), + ("xsaves", Stable), + // tidy-alphabetical-end +]; + +const HEXAGON_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + ("hvx", Unstable(sym::hexagon_target_feature)), + ("hvx-length128b", Unstable(sym::hexagon_target_feature)), + // tidy-alphabetical-end +]; + +const POWERPC_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + ("altivec", Unstable(sym::powerpc_target_feature)), + ("power10-vector", Unstable(sym::powerpc_target_feature)), + ("power8-altivec", Unstable(sym::powerpc_target_feature)), + ("power8-vector", Unstable(sym::powerpc_target_feature)), + ("power9-altivec", Unstable(sym::powerpc_target_feature)), + ("power9-vector", Unstable(sym::powerpc_target_feature)), + ("vsx", Unstable(sym::powerpc_target_feature)), + // tidy-alphabetical-end +]; + +const MIPS_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + ("fp64", Unstable(sym::mips_target_feature)), + ("msa", Unstable(sym::mips_target_feature)), + ("virt", Unstable(sym::mips_target_feature)), + // tidy-alphabetical-end +]; + +const RISCV_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + ("a", Stable), + ("c", Stable), + ("d", Unstable(sym::riscv_target_feature)), + ("e", Unstable(sym::riscv_target_feature)), + ("f", Unstable(sym::riscv_target_feature)), + ("fast-unaligned-access", Unstable(sym::riscv_target_feature)), + ("m", Stable), + ("relax", Unstable(sym::riscv_target_feature)), + ("v", Unstable(sym::riscv_target_feature)), + ("zba", Stable), + ("zbb", Stable), + ("zbc", Stable), + ("zbkb", Stable), + ("zbkc", Stable), + ("zbkx", Stable), + ("zbs", Stable), + ("zdinx", Unstable(sym::riscv_target_feature)), + ("zfh", Unstable(sym::riscv_target_feature)), + ("zfhmin", Unstable(sym::riscv_target_feature)), + ("zfinx", Unstable(sym::riscv_target_feature)), + ("zhinx", Unstable(sym::riscv_target_feature)), + ("zhinxmin", Unstable(sym::riscv_target_feature)), + ("zk", Stable), + ("zkn", Stable), + ("zknd", Stable), + ("zkne", Stable), + ("zknh", Stable), + ("zkr", Stable), + ("zks", Stable), + ("zksed", Stable), + ("zksh", Stable), + ("zkt", Stable), + // tidy-alphabetical-end +]; + +const WASM_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + ("atomics", Unstable(sym::wasm_target_feature)), + ("bulk-memory", Unstable(sym::wasm_target_feature)), + ("exception-handling", Unstable(sym::wasm_target_feature)), + ("multivalue", Unstable(sym::wasm_target_feature)), + ("mutable-globals", Unstable(sym::wasm_target_feature)), + ("nontrapping-fptoint", Unstable(sym::wasm_target_feature)), + ("reference-types", Unstable(sym::wasm_target_feature)), + ("relaxed-simd", Unstable(sym::wasm_target_feature)), + ("sign-ext", Unstable(sym::wasm_target_feature)), + ("simd128", Stable), + // tidy-alphabetical-end +]; + +const BPF_ALLOWED_FEATURES: &[(&str, Stability)] = &[("alu32", Unstable(sym::bpf_target_feature))]; + +const CSKY_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + ("10e60", Unstable(sym::csky_target_feature)), + ("2e3", Unstable(sym::csky_target_feature)), + ("3e3r1", Unstable(sym::csky_target_feature)), + ("3e3r2", Unstable(sym::csky_target_feature)), + ("3e3r3", Unstable(sym::csky_target_feature)), + ("3e7", Unstable(sym::csky_target_feature)), + ("7e10", Unstable(sym::csky_target_feature)), + ("cache", Unstable(sym::csky_target_feature)), + ("doloop", Unstable(sym::csky_target_feature)), + ("dsp1e2", Unstable(sym::csky_target_feature)), + ("dspe60", Unstable(sym::csky_target_feature)), + ("e1", Unstable(sym::csky_target_feature)), + ("e2", Unstable(sym::csky_target_feature)), + ("edsp", Unstable(sym::csky_target_feature)), + ("elrw", Unstable(sym::csky_target_feature)), + ("float1e2", Unstable(sym::csky_target_feature)), + ("float1e3", Unstable(sym::csky_target_feature)), + ("float3e4", Unstable(sym::csky_target_feature)), + ("float7e60", Unstable(sym::csky_target_feature)), + ("floate1", Unstable(sym::csky_target_feature)), + ("hard-tp", Unstable(sym::csky_target_feature)), + ("high-registers", Unstable(sym::csky_target_feature)), + ("hwdiv", Unstable(sym::csky_target_feature)), + ("mp", Unstable(sym::csky_target_feature)), + ("mp1e2", Unstable(sym::csky_target_feature)), + ("nvic", Unstable(sym::csky_target_feature)), + ("trust", Unstable(sym::csky_target_feature)), + ("vdsp2e60f", Unstable(sym::csky_target_feature)), + ("vdspv1", Unstable(sym::csky_target_feature)), + ("vdspv2", Unstable(sym::csky_target_feature)), + // tidy-alphabetical-end + //fpu + // tidy-alphabetical-start + ("fdivdu", Unstable(sym::csky_target_feature)), + ("fpuv2_df", Unstable(sym::csky_target_feature)), + ("fpuv2_sf", Unstable(sym::csky_target_feature)), + ("fpuv3_df", Unstable(sym::csky_target_feature)), + ("fpuv3_hf", Unstable(sym::csky_target_feature)), + ("fpuv3_hi", Unstable(sym::csky_target_feature)), + ("fpuv3_sf", Unstable(sym::csky_target_feature)), + ("hard-float", Unstable(sym::csky_target_feature)), + ("hard-float-abi", Unstable(sym::csky_target_feature)), + // tidy-alphabetical-end +]; + +const LOONGARCH_ALLOWED_FEATURES: &[(&str, Stability)] = &[ + // tidy-alphabetical-start + ("d", Unstable(sym::loongarch_target_feature)), + ("f", Unstable(sym::loongarch_target_feature)), + ("lasx", Unstable(sym::loongarch_target_feature)), + ("lbt", Unstable(sym::loongarch_target_feature)), + ("lsx", Unstable(sym::loongarch_target_feature)), + ("lvz", Unstable(sym::loongarch_target_feature)), + ("ual", Unstable(sym::loongarch_target_feature)), + // tidy-alphabetical-end +]; + +/// When rustdoc is running, provide a list of all known features so that all their respective +/// primitives may be documented. +/// +/// IMPORTANT: If you're adding another feature list above, make sure to add it to this iterator! +pub fn all_known_features() -> impl Iterator { + std::iter::empty() + .chain(ARM_ALLOWED_FEATURES.iter()) + .chain(AARCH64_ALLOWED_FEATURES.iter()) + .chain(X86_ALLOWED_FEATURES.iter()) + .chain(HEXAGON_ALLOWED_FEATURES.iter()) + .chain(POWERPC_ALLOWED_FEATURES.iter()) + .chain(MIPS_ALLOWED_FEATURES.iter()) + .chain(RISCV_ALLOWED_FEATURES.iter()) + .chain(WASM_ALLOWED_FEATURES.iter()) + .chain(BPF_ALLOWED_FEATURES.iter()) + .chain(CSKY_ALLOWED_FEATURES) + .chain(LOONGARCH_ALLOWED_FEATURES) + .cloned() +} + +impl super::spec::Target { + pub fn supported_target_features(&self) -> &'static [(&'static str, Stability)] { + match &*self.arch { + "arm" => ARM_ALLOWED_FEATURES, + "aarch64" => AARCH64_ALLOWED_FEATURES, + "x86" | "x86_64" => X86_ALLOWED_FEATURES, + "hexagon" => HEXAGON_ALLOWED_FEATURES, + "mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_ALLOWED_FEATURES, + "powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES, + "riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES, + "wasm32" | "wasm64" => WASM_ALLOWED_FEATURES, + "bpf" => BPF_ALLOWED_FEATURES, + "csky" => CSKY_ALLOWED_FEATURES, + "loongarch64" => LOONGARCH_ALLOWED_FEATURES, + _ => &[], + } + } + + pub fn tied_target_features(&self) -> &'static [&'static [&'static str]] { + match &*self.arch { + "aarch64" => AARCH64_TIED_FEATURES, + _ => &[], + } + } +} From acac133997cf46a78c8f86fbc112ee525fbf6522 Mon Sep 17 00:00:00 2001 From: Urgau Date: Tue, 12 Dec 2023 22:04:48 +0100 Subject: [PATCH 21/40] Use all the known features in check-cfg --- compiler/rustc_session/src/config.rs | 6 ++-- tests/ui/check-cfg/well-known-values.rs | 3 +- tests/ui/check-cfg/well-known-values.stderr | 34 +++++++++++++-------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 8dc9a29c2ad03..fa5e8e5f60d6d 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1485,10 +1485,8 @@ impl CheckCfg { ins!(sym::sanitizer_cfi_generalize_pointers, no_values); ins!(sym::sanitizer_cfi_normalize_integers, no_values); - // rustc_codegen_ssa has a list of known target features and their - // stability, but we should allow any target feature as a new target or - // rustc version may introduce new target features. - ins!(sym::target_feature, || ExpectedValues::Any); + ins!(sym::target_feature, empty_values) + .extend(rustc_target::target_features::all_known_features().map(|(f, _sb)| Symbol::intern(f))); // sym::target_* { diff --git a/tests/ui/check-cfg/well-known-values.rs b/tests/ui/check-cfg/well-known-values.rs index 39a470c202ff1..acdbf2ef6463c 100644 --- a/tests/ui/check-cfg/well-known-values.rs +++ b/tests/ui/check-cfg/well-known-values.rs @@ -51,7 +51,8 @@ //~^ WARN unexpected `cfg` condition value target_family = "_UNEXPECTED_VALUE", //~^ WARN unexpected `cfg` condition value - target_feature = "_UNEXPECTED_VALUE", // currently *any* values are "expected" + target_feature = "_UNEXPECTED_VALUE", + //~^ WARN unexpected `cfg` condition value target_has_atomic = "_UNEXPECTED_VALUE", //~^ WARN unexpected `cfg` condition value target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index 1e92639fd1110..66fde17ba23ad 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -152,7 +152,17 @@ LL | target_family = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:55:5 + --> $DIR/well-known-values.rs:54:5 + | +LL | target_feature = "_UNEXPECTED_VALUE", + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512er`, `avx512f`, `avx512ifma`, `avx512pf`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `f`, `f16c`, `f32mm`, `f64mm`, `fast-unaligned-access`, `fcma`, `fdivdu`, `fhm`, `flagm`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lasx`, `lbt`, `lor`, `lse`, `lsx`, `lvz`, `lzcnt`, `m`, `mclass`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sign-ext`, `simd128`, `sm4`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `sve`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, `zkt` + = help: to expect this configuration use `--check-cfg=cfg(target_feature, values("_UNEXPECTED_VALUE"))` + = note: see for more information about checking conditional configuration + +warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` + --> $DIR/well-known-values.rs:56:5 | LL | target_has_atomic = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -162,7 +172,7 @@ LL | target_has_atomic = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:57:5 + --> $DIR/well-known-values.rs:58:5 | LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -172,7 +182,7 @@ LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:59:5 + --> $DIR/well-known-values.rs:60:5 | LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -182,7 +192,7 @@ LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:61:5 + --> $DIR/well-known-values.rs:62:5 | LL | target_os = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -192,7 +202,7 @@ LL | target_os = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:63:5 + --> $DIR/well-known-values.rs:64:5 | LL | target_pointer_width = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -202,7 +212,7 @@ LL | target_pointer_width = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:65:5 + --> $DIR/well-known-values.rs:66:5 | LL | target_thread_local = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^---------------------- @@ -214,7 +224,7 @@ LL | target_thread_local = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:67:5 + --> $DIR/well-known-values.rs:68:5 | LL | target_vendor = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -224,7 +234,7 @@ LL | target_vendor = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:69:5 + --> $DIR/well-known-values.rs:70:5 | LL | test = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -236,7 +246,7 @@ LL | test = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:71:5 + --> $DIR/well-known-values.rs:72:5 | LL | unix = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -248,7 +258,7 @@ LL | unix = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:73:5 + --> $DIR/well-known-values.rs:74:5 | LL | windows = "_UNEXPECTED_VALUE", | ^^^^^^^---------------------- @@ -260,7 +270,7 @@ LL | windows = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `linuz` - --> $DIR/well-known-values.rs:79:7 + --> $DIR/well-known-values.rs:80:7 | LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` | ^^^^^^^^^^^^------- @@ -271,5 +281,5 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` = help: to expect this configuration use `--check-cfg=cfg(target_os, values("linuz"))` = note: see for more information about checking conditional configuration -warning: 25 warnings emitted +warning: 26 warnings emitted From c355040a5cf5a50d3bf03b4efa34180daa1bb170 Mon Sep 17 00:00:00 2001 From: Urgau Date: Tue, 12 Dec 2023 22:17:41 +0100 Subject: [PATCH 22/40] Don't forget pure rustc target features in check-cfg --- compiler/rustc_session/src/config.rs | 8 ++++++-- tests/ui/check-cfg/well-known-values.rs | 3 +++ tests/ui/check-cfg/well-known-values.stderr | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index fa5e8e5f60d6d..ae0911ea3be35 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1485,8 +1485,12 @@ impl CheckCfg { ins!(sym::sanitizer_cfi_generalize_pointers, no_values); ins!(sym::sanitizer_cfi_normalize_integers, no_values); - ins!(sym::target_feature, empty_values) - .extend(rustc_target::target_features::all_known_features().map(|(f, _sb)| Symbol::intern(f))); + ins!(sym::target_feature, empty_values).extend( + rustc_target::target_features::all_known_features() + .map(|(f, _sb)| f) + .chain(rustc_target::target_features::RUSTC_SPECIFIC_FEATURES.iter().cloned()) + .map(Symbol::intern), + ); // sym::target_* { diff --git a/tests/ui/check-cfg/well-known-values.rs b/tests/ui/check-cfg/well-known-values.rs index acdbf2ef6463c..21268bf10d5c0 100644 --- a/tests/ui/check-cfg/well-known-values.rs +++ b/tests/ui/check-cfg/well-known-values.rs @@ -91,6 +91,9 @@ fn target_os_linux_misspell() {} #[cfg(target_os = "linux")] fn target_os_linux() {} +#[cfg(target_feature = "crt-static")] // pure rustc feature +fn target_feature() {} + #[cfg(target_has_atomic = "8")] fn target_has_atomic_8() {} diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index 66fde17ba23ad..4f708e62cd3c5 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -157,7 +157,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_feature = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512er`, `avx512f`, `avx512ifma`, `avx512pf`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `f`, `f16c`, `f32mm`, `f64mm`, `fast-unaligned-access`, `fcma`, `fdivdu`, `fhm`, `flagm`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lasx`, `lbt`, `lor`, `lse`, `lsx`, `lvz`, `lzcnt`, `m`, `mclass`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sign-ext`, `simd128`, `sm4`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `sve`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, `zkt` + = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512er`, `avx512f`, `avx512ifma`, `avx512pf`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `f`, `f16c`, `f32mm`, `f64mm`, `fast-unaligned-access`, `fcma`, `fdivdu`, `fhm`, `flagm`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lasx`, `lbt`, `lor`, `lse`, `lsx`, `lvz`, `lzcnt`, `m`, `mclass`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sign-ext`, `simd128`, `sm4`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `sve`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, `zkt` = help: to expect this configuration use `--check-cfg=cfg(target_feature, values("_UNEXPECTED_VALUE"))` = note: see for more information about checking conditional configuration From 3ea1331f51014a6610b9c6940db62139f6f3cc86 Mon Sep 17 00:00:00 2001 From: Urgau Date: Tue, 12 Dec 2023 23:26:45 +0100 Subject: [PATCH 23/40] Fix target_feature config in portable-simd --- library/portable-simd/crates/core_simd/src/swizzle_dyn.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs b/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs index bd8a38e350d3b..dac013cc98dc7 100644 --- a/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs +++ b/library/portable-simd/crates/core_simd/src/swizzle_dyn.rs @@ -55,7 +55,7 @@ where 16 => transize(vqtbl1q_u8, self, idxs), #[cfg(all(target_feature = "avx2", not(target_feature = "avx512vbmi")))] 32 => transize_raw(avx2_pshufb, self, idxs), - #[cfg(target_feature = "avx512vl,avx512vbmi")] + #[cfg(all(target_feature = "avx512vl", target_feature = "avx512vbmi"))] 32 => transize(x86::_mm256_permutexvar_epi8, self, idxs), // Notable absence: avx512bw shuffle // If avx512bw is available, odds of avx512vbmi are good From 5d97ada1eca831936257598bd60f1857091ec4b7 Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 14 Dec 2023 13:00:23 +0100 Subject: [PATCH 24/40] rename `-Ztrait-solver` to `-Znext-solver` --- compiler/rustc_interface/src/tests.rs | 12 +-- compiler/rustc_middle/src/ty/context.rs | 8 +- compiler/rustc_session/src/config.rs | 25 ++++--- compiler/rustc_session/src/options.rs | 73 +++++++++++-------- .../src/solve/eval_ctxt/mod.rs | 7 +- .../src/solve/inspect/build.rs | 2 +- .../src/traits/engine.rs | 23 +++--- .../error_reporting/type_err_ctxt_ext.rs | 41 ++++++----- 8 files changed, 102 insertions(+), 89 deletions(-) diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 25fa2b375473e..d96b1ba88f5ec 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -6,10 +6,9 @@ use rustc_session::config::{ build_configuration, build_session_options, rustc_optgroups, BranchProtection, CFGuard, Cfg, DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation, Externs, FunctionReturn, InliningThreshold, Input, InstrumentCoverage, InstrumentXRay, - LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli, MirSpanview, OomStrategy, Options, - OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes, Polonius, - ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion, TraitSolver, - WasiExecModel, + LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli, MirSpanview, NextSolverConfig, + OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes, Polonius, + ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, SymbolManglingVersion, WasiExecModel, }; use rustc_session::lint::Level; use rustc_session::search_paths::SearchPath; @@ -781,6 +780,10 @@ fn test_unstable_options_tracking_hash() { tracked!(mir_opt_level, Some(4)); tracked!(move_size_limit, Some(4096)); tracked!(mutable_noalias, false); + tracked!( + next_solver, + Some(NextSolverConfig { coherence: true, globally: false, dump_tree: Default::default() }) + ); tracked!(no_generate_arange_section, true); tracked!(no_jump_tables, true); tracked!(no_link, true); @@ -822,7 +825,6 @@ fn test_unstable_options_tracking_hash() { tracked!(thir_unsafeck, true); tracked!(tiny_const_eval_limit, true); tracked!(tls_model, Some(TlsModel::GeneralDynamic)); - tracked!(trait_solver, TraitSolver::NextCoherence); tracked!(translate_remapped_path_to_local_path, false); tracked!(trap_unreachable, Some(false)); tracked!(treat_err_as_bug, NonZeroUsize::new(1)); diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 6aa0016650d5c..8faf581134339 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2240,15 +2240,11 @@ impl<'tcx> TyCtxt<'tcx> { } pub fn next_trait_solver_globally(self) -> bool { - self.sess.opts.unstable_opts.trait_solver == rustc_session::config::TraitSolver::Next + self.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.globally) } pub fn next_trait_solver_in_coherence(self) -> bool { - matches!( - self.sess.opts.unstable_opts.trait_solver, - rustc_session::config::TraitSolver::Next - | rustc_session::config::TraitSolver::NextCoherence - ) + self.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.coherence) } pub fn is_impl_trait_in_trait(self, def_id: DefId) -> bool { diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 8dc9a29c2ad03..6fda18d87e39b 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -755,13 +755,14 @@ pub enum PrintKind { } #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum TraitSolver { - /// Classic trait solver in `rustc_trait_selection::traits::select` - Classic, - /// Experimental trait solver in `rustc_trait_selection::solve` - Next, - /// Use the new trait solver during coherence - NextCoherence, +pub struct NextSolverConfig { + /// Whether the new trait solver should be enabled in coherence. + pub coherence: bool, + /// Whether the new trait solver should be enabled everywhere. + /// This is only `true` if `coherence` is also enabled. + pub globally: bool, + /// Whether to dump proof trees after computing a proof tree. + pub dump_tree: DumpSolverProofTree, } #[derive(Default, Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -3220,10 +3221,10 @@ pub(crate) mod dep_tracking { use super::{ BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FunctionReturn, InliningThreshold, InstrumentCoverage, InstrumentXRay, - LinkerPluginLto, LocationDetail, LtoCli, OomStrategy, OptLevel, OutFileName, OutputType, - OutputTypes, Polonius, RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm, - SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion, TraitSolver, TrimmedDefPaths, - WasiExecModel, + LinkerPluginLto, LocationDetail, LtoCli, NextSolverConfig, OomStrategy, OptLevel, + OutFileName, OutputType, OutputTypes, Polonius, RemapPathScopeComponents, ResolveDocLinks, + SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion, + TrimmedDefPaths, WasiExecModel, }; use crate::lint; use crate::utils::NativeLib; @@ -3326,7 +3327,7 @@ pub(crate) mod dep_tracking { BranchProtection, OomStrategy, LanguageIdentifier, - TraitSolver, + NextSolverConfig, Polonius, InliningThreshold, FunctionReturn, diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index a3835c085dac7..e8ca556aa420d 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -396,8 +396,7 @@ mod desc { pub const parse_instrument_xray: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`"; pub const parse_unpretty: &str = "`string` or `string=string`"; pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number"; - pub const parse_trait_solver: &str = - "one of the supported solver modes (`classic`, `next`, or `next-coherence`)"; + pub const parse_next_solver_config: &str = "a comma separated list of solver configurations: `globally` (default), `coherence`, `dump-tree`, `dump-tree-on-error"; pub const parse_lto: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted"; pub const parse_linker_plugin_lto: &str = @@ -429,7 +428,6 @@ mod desc { "a `,` separated combination of `bti`, `b-key`, `pac-ret`, or `leaf`"; pub const parse_proc_macro_execution_strategy: &str = "one of supported execution strategies (`same-thread`, or `cross-thread`)"; - pub const parse_dump_solver_proof_tree: &str = "one of: `always`, `on-request`, `on-error`"; pub const parse_remap_path_scope: &str = "comma separated list of scopes: `macro`, `diagnostics`, `unsplit-debuginfo`, `split-debuginfo`, `split-debuginfo-path`, `object`, `all`"; pub const parse_inlining_threshold: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a non-negative number"; @@ -1032,15 +1030,48 @@ mod parse { } } - pub(crate) fn parse_trait_solver(slot: &mut TraitSolver, v: Option<&str>) -> bool { - match v { - Some("classic") => *slot = TraitSolver::Classic, - Some("next") => *slot = TraitSolver::Next, - Some("next-coherence") => *slot = TraitSolver::NextCoherence, - // default trait solver is subject to change.. - Some("default") => *slot = TraitSolver::Classic, - _ => return false, + pub(crate) fn parse_next_solver_config( + slot: &mut Option, + v: Option<&str>, + ) -> bool { + if let Some(config) = v { + let mut coherence = false; + let mut globally = true; + let mut dump_tree = None; + for c in config.split(',') { + match c { + "globally" => globally = true, + "coherence" => { + globally = false; + coherence = true; + } + "dump-tree" => { + if dump_tree.replace(DumpSolverProofTree::Always).is_some() { + return false; + } + } + "dump-tree-on-error" => { + if dump_tree.replace(DumpSolverProofTree::OnError).is_some() { + return false; + } + } + _ => return false, + } + } + + *slot = Some(NextSolverConfig { + coherence: coherence || globally, + globally, + dump_tree: dump_tree.unwrap_or_default(), + }); + } else { + *slot = Some(NextSolverConfig { + coherence: true, + globally: true, + dump_tree: Default::default(), + }); } + true } @@ -1305,19 +1336,6 @@ mod parse { true } - pub(crate) fn parse_dump_solver_proof_tree( - slot: &mut DumpSolverProofTree, - v: Option<&str>, - ) -> bool { - match v { - None | Some("always") => *slot = DumpSolverProofTree::Always, - Some("never") => *slot = DumpSolverProofTree::Never, - Some("on-error") => *slot = DumpSolverProofTree::OnError, - _ => return false, - }; - true - } - pub(crate) fn parse_inlining_threshold(slot: &mut InliningThreshold, v: Option<&str>) -> bool { match v { Some("always" | "yes") => { @@ -1591,9 +1609,6 @@ options! { "output statistics about monomorphization collection"), dump_mono_stats_format: DumpMonoStatsFormat = (DumpMonoStatsFormat::Markdown, parse_dump_mono_stats, [UNTRACKED], "the format to use for -Z dump-mono-stats (`markdown` (default) or `json`)"), - dump_solver_proof_tree: DumpSolverProofTree = (DumpSolverProofTree::Never, parse_dump_solver_proof_tree, [UNTRACKED], - "dump a proof tree for every goal evaluated by the new trait solver. If the flag is specified without any options after it - then it defaults to `always`. If the flag is not specified at all it defaults to `on-request`."), dwarf_version: Option = (None, parse_opt_number, [TRACKED], "version of DWARF debug information to emit (default: 2 or 4, depending on platform)"), dylib_lto: bool = (false, parse_bool, [UNTRACKED], @@ -1722,6 +1737,8 @@ options! { "the size at which the `large_assignments` lint starts to be emitted"), mutable_noalias: bool = (true, parse_bool, [TRACKED], "emit noalias metadata for mutable references (default: yes)"), + next_solver: Option = (None, parse_next_solver_config, [TRACKED], + "enable and configure the next generation trait solver used by rustc"), nll_facts: bool = (false, parse_bool, [UNTRACKED], "dump facts from NLL analysis into side files (default: no)"), nll_facts_dir: String = ("nll-facts".to_string(), parse_string, [UNTRACKED], @@ -1922,8 +1939,6 @@ written to standard error output)"), "for every macro invocation, print its name and arguments (default: no)"), track_diagnostics: bool = (false, parse_bool, [UNTRACKED], "tracks where in rustc a diagnostic was emitted"), - trait_solver: TraitSolver = (TraitSolver::Classic, parse_trait_solver, [TRACKED], - "specify the trait solver mode used by rustc (default: classic)"), // Diagnostics are considered side-effects of a query (see `QuerySideEffects`) and are saved // alongside query results and changes to translation options can affect diagnostics - so // translation options should be tracked. diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs index b3e7a63c972c1..ce20fa030d8aa 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs @@ -200,9 +200,10 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> { let result = f(&mut ecx); let tree = ecx.inspect.finalize(); - if let (Some(tree), DumpSolverProofTree::Always) = - (&tree, infcx.tcx.sess.opts.unstable_opts.dump_solver_proof_tree) - { + if let (Some(tree), DumpSolverProofTree::Always) = ( + &tree, + infcx.tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default(), + ) { let mut lock = std::io::stdout().lock(); let _ = lock.write_fmt(format_args!("{tree:?}\n")); let _ = lock.flush(); diff --git a/compiler/rustc_trait_selection/src/solve/inspect/build.rs b/compiler/rustc_trait_selection/src/solve/inspect/build.rs index 0d46df44c9106..c857aae572d1b 100644 --- a/compiler/rustc_trait_selection/src/solve/inspect/build.rs +++ b/compiler/rustc_trait_selection/src/solve/inspect/build.rs @@ -265,7 +265,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> { GenerateProofTree::Never => ProofTreeBuilder::new_noop(), GenerateProofTree::IfEnabled => { let opts = &tcx.sess.opts.unstable_opts; - match opts.dump_solver_proof_tree { + match opts.next_solver.map(|c| c.dump_tree).unwrap_or_default() { DumpSolverProofTree::Always => ProofTreeBuilder::new_root(), // `OnError` is handled by reevaluating goals in error // reporting with `GenerateProofTree::Yes`. diff --git a/compiler/rustc_trait_selection/src/traits/engine.rs b/compiler/rustc_trait_selection/src/traits/engine.rs index 67718d0a34848..013a50f9fa1c8 100644 --- a/compiler/rustc_trait_selection/src/traits/engine.rs +++ b/compiler/rustc_trait_selection/src/traits/engine.rs @@ -25,7 +25,6 @@ use rustc_middle::ty::ToPredicate; use rustc_middle::ty::TypeFoldable; use rustc_middle::ty::Variance; use rustc_middle::ty::{self, Ty, TyCtxt}; -use rustc_session::config::TraitSolver; pub trait TraitEngineExt<'tcx> { fn new(infcx: &InferCtxt<'tcx>) -> Box; @@ -33,18 +32,16 @@ pub trait TraitEngineExt<'tcx> { impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> { fn new(infcx: &InferCtxt<'tcx>) -> Box { - match (infcx.tcx.sess.opts.unstable_opts.trait_solver, infcx.next_trait_solver()) { - (TraitSolver::Classic, false) | (TraitSolver::NextCoherence, false) => { - Box::new(FulfillmentContext::new(infcx)) - } - (TraitSolver::Classic | TraitSolver::Next | TraitSolver::NextCoherence, true) => { - Box::new(NextFulfillmentCtxt::new(infcx)) - } - (TraitSolver::Next, false) => bug!( - "incompatible combination of -Ztrait-solver flag ({:?}) and InferCtxt::next_trait_solver ({:?})", - infcx.tcx.sess.opts.unstable_opts.trait_solver, - infcx.next_trait_solver() - ), + if infcx.next_trait_solver() { + Box::new(NextFulfillmentCtxt::new(infcx)) + } else { + let new_solver_globally = + infcx.tcx.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.globally); + assert!( + !new_solver_globally, + "using old solver even though new solver is enabled globally" + ); + Box::new(FulfillmentContext::new(infcx)) } } } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index 7f6e48f4464c3..9d8aaf4e64352 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -37,7 +37,7 @@ use rustc_middle::ty::{ self, SubtypePredicate, ToPolyTraitRef, ToPredicate, TraitRef, Ty, TyCtxt, TypeFoldable, TypeVisitable, TypeVisitableExt, }; -use rustc_session::config::{DumpSolverProofTree, TraitSolver}; +use rustc_session::config::DumpSolverProofTree; use rustc_session::Limit; use rustc_span::def_id::LOCAL_CRATE; use rustc_span::symbol::sym; @@ -370,7 +370,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ) { let tcx = self.tcx; - if tcx.sess.opts.unstable_opts.dump_solver_proof_tree == DumpSolverProofTree::OnError { + if tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default() + == DumpSolverProofTree::OnError + { dump_proof_tree(root_obligation, self.infcx); } @@ -812,23 +814,20 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(ty)) => { let ty = self.resolve_vars_if_possible(ty); - match self.tcx.sess.opts.unstable_opts.trait_solver { - TraitSolver::Classic => { - // WF predicates cannot themselves make - // errors. They can only block due to - // ambiguity; otherwise, they always - // degenerate into other obligations - // (which may fail). - span_bug!(span, "WF predicate not satisfied for {:?}", ty); - } - TraitSolver::Next | TraitSolver::NextCoherence => { - // FIXME: we'll need a better message which takes into account - // which bounds actually failed to hold. - self.tcx.sess.struct_span_err( - span, - format!("the type `{ty}` is not well-formed"), - ) - } + if self.tcx.sess.opts.unstable_opts.next_solver.is_some() { + // FIXME: we'll need a better message which takes into account + // which bounds actually failed to hold. + self.tcx.sess.struct_span_err( + span, + format!("the type `{ty}` is not well-formed"), + ) + } else { + // WF predicates cannot themselves make + // errors. They can only block due to + // ambiguity; otherwise, they always + // degenerate into other obligations + // (which may fail). + span_bug!(span, "WF predicate not satisfied for {:?}", ty); } } @@ -1562,7 +1561,9 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { #[instrument(skip(self), level = "debug")] fn report_fulfillment_error(&self, error: &FulfillmentError<'tcx>) { - if self.tcx.sess.opts.unstable_opts.dump_solver_proof_tree == DumpSolverProofTree::OnError { + if self.tcx.sess.opts.unstable_opts.next_solver.map(|c| c.dump_tree).unwrap_or_default() + == DumpSolverProofTree::OnError + { dump_proof_tree(&error.root_obligation, self.infcx); } From 11d16c4082be25fd42b48b37e199f18b4dfe51ed Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 14 Dec 2023 13:11:28 +0100 Subject: [PATCH 25/40] update use of feature flags --- compiler/rustc_borrowck/src/region_infer/opaque_types.rs | 2 +- compiler/rustc_borrowck/src/type_check/mod.rs | 2 +- .../rustc_codegen_cranelift/example/gen_block_iterate.rs | 2 +- compiler/rustc_hir_analysis/src/check/compare_impl_item.rs | 4 ++-- compiler/rustc_hir_typeck/src/coercion.rs | 2 +- compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs | 2 +- compiler/rustc_infer/src/infer/canonical/mod.rs | 2 +- compiler/rustc_infer/src/infer/canonical/substitute.rs | 2 +- compiler/rustc_infer/src/traits/mod.rs | 2 +- compiler/rustc_middle/src/traits/solve/cache.rs | 2 +- compiler/rustc_middle/src/ty/fast_reject.rs | 2 +- compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs | 2 +- compiler/rustc_trait_selection/src/solve/mod.rs | 5 ++--- compiler/rustc_trait_selection/src/solve/trait_goals.rs | 2 +- compiler/rustc_trait_selection/src/traits/coherence.rs | 4 ++-- .../src/traits/error_reporting/type_err_ctxt_ext.rs | 2 +- compiler/rustc_trait_selection/src/traits/mod.rs | 4 ++-- compiler/rustc_trait_selection/src/traits/project.rs | 2 +- .../src/traits/query/evaluate_obligation.rs | 2 +- .../src/traits/query/type_op/normalize.rs | 2 +- .../rustc_trait_selection/src/traits/structural_normalize.rs | 2 +- src/tools/compiletest/src/runtest.rs | 4 ++-- tests/ui/associated-inherent-types/inference.rs | 2 +- .../async-await/normalize-output-in-signature-deduction.rs | 2 +- .../normalizing-self-auto-trait-issue-109924.rs | 2 +- tests/ui/auto-traits/issue-23080-2.rs | 2 +- tests/ui/closures/infer-signature-from-impl.rs | 2 +- tests/ui/coherence/coherence-overlap-downstream-inherent.rs | 2 +- tests/ui/coherence/coherence-overlap-downstream.rs | 2 +- tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs | 2 +- tests/ui/coherence/coherence-overlap-issue-23516.rs | 2 +- tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs | 2 +- tests/ui/coherence/normalize-for-errors.rs | 2 +- tests/ui/coherence/occurs-check/associated-type.rs | 2 +- tests/ui/coherence/occurs-check/opaques.rs | 2 +- tests/ui/coinduction/canonicalization-rerun.rs | 2 +- .../ui/const-generics/defaults/default-param-wf-concrete.rs | 2 +- tests/ui/consts/const-len-underflow-separate-spans.rs | 2 +- tests/ui/coroutine/clone-rpit.rs | 2 +- tests/ui/coroutine/gen_block_is_iter.rs | 2 +- tests/ui/coroutine/gen_block_iterate.rs | 2 +- tests/ui/coroutine/non-static-is-unpin.rs | 2 +- tests/ui/coroutine/static-not-unpin.rs | 2 +- tests/ui/dyn-star/box.rs | 2 +- tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs | 2 +- tests/ui/dyn-star/param-env-region-infer.rs | 2 +- tests/ui/error-codes/E0476.rs | 2 +- tests/ui/for/issue-20605.rs | 4 ++-- tests/ui/generic-associated-types/issue-102114.rs | 2 +- tests/ui/higher-ranked/leak-check-in-selection.rs | 2 +- tests/ui/higher-ranked/trait-bounds/fn-ptr.rs | 2 +- tests/ui/higher-ranked/trait-bounds/future.rs | 2 +- tests/ui/higher-ranked/trait-bounds/issue-95230.rs | 2 +- tests/ui/impl-trait/auto-trait-coherence.rs | 2 +- tests/ui/impl-trait/autoderef.rs | 2 +- tests/ui/impl-trait/erased-regions-in-hidden-ty.rs | 2 +- tests/ui/impl-trait/in-trait/object-safety-sized.rs | 2 +- tests/ui/impl-trait/in-trait/opaque-variances.rs | 2 +- tests/ui/impl-trait/issue-103181-1.rs | 2 +- tests/ui/impl-trait/recursive-coroutine.rs | 2 +- tests/ui/impl-trait/reveal-during-codegen.rs | 2 +- tests/ui/impl-trait/two_tait_defining_each_other.rs | 2 +- tests/ui/impl-trait/two_tait_defining_each_other2.rs | 2 +- tests/ui/impl-trait/two_tait_defining_each_other3.rs | 2 +- tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs | 2 +- tests/ui/inference/type-infer-generalize-ty-var.rs | 2 +- tests/ui/issues/issue-13167.rs | 2 +- tests/ui/issues/issue-15734.rs | 2 +- tests/ui/lazy-type-alias/coerce-behind-lazy.rs | 2 +- tests/ui/never_type/never-from-impl-is-reserved.rs | 2 +- tests/ui/nll/issue-53119.rs | 2 +- tests/ui/object-safety/call-when-assoc-ty-is-sized.rs | 2 +- tests/ui/panics/abort-on-panic.rs | 2 +- .../manual-self-impl-for-unsafe-obj.rs | 2 +- .../specialization-default-items-drop-coherence.rs | 4 ++-- tests/ui/traits/deny-builtin-object-impl.rs | 2 +- tests/ui/traits/issue-24010.rs | 2 +- tests/ui/traits/new-solver/alias-bound-preference.rs | 2 +- tests/ui/traits/new-solver/alias-bound-unsound.rs | 2 +- tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs | 2 +- .../traits/new-solver/alias-relate/deeply-nested-no-hang.rs | 2 +- .../alias-relate/opaque-hidden-ty-is-rigid-alias.rs | 2 +- tests/ui/traits/new-solver/alias-sub.rs | 2 +- .../traits/new-solver/alias_eq_cant_be_furthur_normalized.rs | 2 +- .../alias_eq_dont_use_normalizes_to_if_substs_eq.rs | 2 +- tests/ui/traits/new-solver/alias_eq_simple.rs | 2 +- .../traits/new-solver/alias_eq_substs_eq_not_intercrate.rs | 2 +- tests/ui/traits/new-solver/array-default.rs | 2 +- .../assembly/assemble-normalizing-self-ty-impl-ambiguity.rs | 2 +- .../new-solver/assembly/runaway-impl-candidate-selection.rs | 2 +- tests/ui/traits/new-solver/async.rs | 2 +- tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs | 2 +- tests/ui/traits/new-solver/borrowck-error.rs | 2 +- tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs | 2 +- .../ui/traits/new-solver/canonical-int-var-eq-in-response.rs | 2 +- .../ui/traits/new-solver/canonical-ty-var-eq-in-response.rs | 2 +- tests/ui/traits/new-solver/canonicalize-effect-var.rs | 2 +- .../ui/traits/new-solver/cast-checks-handling-projections.rs | 2 +- tests/ui/traits/new-solver/closure-inference-guidance.rs | 2 +- tests/ui/traits/new-solver/closure-substs-ambiguity.rs | 2 +- tests/ui/traits/new-solver/coherence/issue-102048.rs | 2 +- .../coherence/trait_ref_is_knowable-norm-overflow.rs | 2 +- .../coherence/trait_ref_is_knowable-normalization-1.rs | 2 +- .../coherence/trait_ref_is_knowable-normalization-2.rs | 2 +- .../coherence/trait_ref_is_knowable-normalization-3.rs | 2 +- tests/ui/traits/new-solver/const-param-placeholder.rs | 2 +- tests/ui/traits/new-solver/coroutine.rs | 2 +- .../cycles/coinduction/fixpoint-exponential-growth.rs | 2 +- .../cycles/coinduction/incompleteness-unstable-result.rs | 2 +- .../new-solver/cycles/double-cycle-inductive-coinductive.rs | 2 +- .../new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs | 2 +- tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs | 2 +- tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs | 2 +- .../inductive-cycle-discarded-coinductive-constraints.rs | 2 +- tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.rs | 2 +- tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs | 2 +- .../traits/new-solver/cycles/leak-check-coinductive-cycle.rs | 2 +- tests/ui/traits/new-solver/cycles/provisional-result-done.rs | 2 +- .../deduce-closure-signature-after-normalization.rs | 2 +- tests/ui/traits/new-solver/deduce-ty-from-object.rs | 2 +- tests/ui/traits/new-solver/dedup-regions.rs | 2 +- tests/ui/traits/new-solver/destruct.rs | 2 +- tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs | 2 +- tests/ui/traits/new-solver/dont-elaborate-for-projections.rs | 2 +- tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs | 2 +- .../new-solver/dont-loop-fulfill-on-region-constraints.rs | 2 +- tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs | 2 +- tests/ui/traits/new-solver/dont-remap-tait-substs.rs | 2 +- .../traits/new-solver/dont-type_of-tait-in-defining-scope.rs | 2 +- tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs | 2 +- tests/ui/traits/new-solver/elaborate-item-bounds.rs | 2 +- tests/ui/traits/new-solver/equating-projection-cyclically.rs | 2 +- .../escaping-bound-vars-in-writeback-normalization.rs | 2 +- tests/ui/traits/new-solver/float-canonical.rs | 2 +- tests/ui/traits/new-solver/fn-trait-closure.rs | 2 +- tests/ui/traits/new-solver/fn-trait.rs | 2 +- .../generalize/generalize-proj-new-universe-index-1.rs | 2 +- .../generalize/generalize-proj-new-universe-index-2.rs | 2 +- .../new-solver/generalize/occurs-check-nested-alias.rs | 2 +- tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs | 2 +- tests/ui/traits/new-solver/int-var-alias-eq.rs | 2 +- tests/ui/traits/new-solver/int-var-is-send.rs | 2 +- tests/ui/traits/new-solver/iter-filter-projection.rs | 2 +- tests/ui/traits/new-solver/lazy-nested-obligations-1.rs | 2 +- tests/ui/traits/new-solver/lazy-nested-obligations-2.rs | 2 +- tests/ui/traits/new-solver/lazy-nested-obligations-3.rs | 2 +- .../traits/new-solver/member-constraints-in-root-universe.rs | 2 +- tests/ui/traits/new-solver/more-object-bound.rs | 2 +- tests/ui/traits/new-solver/nested-alias-bound.rs | 2 +- .../new-solver/nested-obligations-with-bound-vars-gat.rs | 2 +- .../ui/traits/new-solver/normalize-async-closure-in-trait.rs | 2 +- tests/ui/traits/new-solver/normalize-param-env-1.rs | 2 +- tests/ui/traits/new-solver/normalize-param-env-2.rs | 2 +- tests/ui/traits/new-solver/normalize-param-env-3.rs | 2 +- tests/ui/traits/new-solver/normalize-rcvr-for-inherent.rs | 2 +- tests/ui/traits/new-solver/normalize-unsize-rhs.rs | 2 +- tests/ui/traits/new-solver/normalized-const-built-in-op.rs | 2 +- .../normalizes_to_ignores_unnormalizable_candidate.rs | 4 ++-- .../new-solver/object-soundness-requires-generalization.rs | 2 +- tests/ui/traits/new-solver/object-unsafety.rs | 4 ++-- tests/ui/traits/new-solver/opportunistic-region-resolve.rs | 2 +- .../ui/traits/new-solver/overflow/exponential-trait-goals.rs | 2 +- tests/ui/traits/new-solver/overflow/global-cache.rs | 2 +- .../new-solver/overflow/recursion-limit-zero-issue-115351.rs | 2 +- .../new-solver/overflow/recursive-self-normalization-2.rs | 2 +- .../new-solver/overflow/recursive-self-normalization.rs | 2 +- .../new-solver/param-candidate-doesnt-shadow-project.rs | 2 +- tests/ui/traits/new-solver/param-discr-kind.rs | 2 +- tests/ui/traits/new-solver/pointee.rs | 2 +- tests/ui/traits/new-solver/pointer-like.rs | 2 +- .../ui/traits/new-solver/prefer-candidate-no-constraints.rs | 2 +- tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs | 2 +- tests/ui/traits/new-solver/projection-discr-kind.rs | 2 +- .../new-solver/projection/param-env-trait-candidate-1.rs | 2 +- .../new-solver/projection/param-env-trait-candidate-2.rs | 2 +- tests/ui/traits/new-solver/slice-match-byte-lit.rs | 2 +- tests/ui/traits/new-solver/specialization-transmute.rs | 2 +- tests/ui/traits/new-solver/specialization-unconstrained.rs | 2 +- tests/ui/traits/new-solver/stall-num-var-auto-trait.rs | 2 +- tests/ui/traits/new-solver/structural-resolve-field.rs | 2 +- tests/ui/traits/new-solver/tait-eq-proj-2.rs | 2 +- tests/ui/traits/new-solver/tait-eq-proj.rs | 2 +- tests/ui/traits/new-solver/tait-eq-tait.rs | 2 +- tests/ui/traits/new-solver/temporary-ambiguity.rs | 2 +- .../new-solver/trait-upcast-lhs-needs-normalization.rs | 2 +- tests/ui/traits/new-solver/try-example.rs | 2 +- .../two-projection-param-candidates-are-ambiguous.rs | 2 +- .../ui/traits/new-solver/unevaluated-const-impl-trait-ref.rs | 2 +- tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs | 2 +- tests/ui/traits/new-solver/unsize-although-ambiguous.rs | 2 +- tests/ui/traits/new-solver/unsize-good.rs | 2 +- tests/ui/traits/new-solver/upcast-right-substs.rs | 2 +- tests/ui/traits/new-solver/upcast-wrong-substs.rs | 2 +- tests/ui/traits/new-solver/winnow-specializing-impls.rs | 2 +- tests/ui/traits/non-lifetime-via-dyn-builtin.rs | 2 +- tests/ui/traits/reservation-impl/coherence-conflict.rs | 2 +- tests/ui/traits/reservation-impl/no-use.rs | 2 +- tests/ui/traits/reservation-impl/non-lattice-ok.rs | 2 +- tests/ui/traits/reservation-impl/ok.rs | 2 +- tests/ui/traits/trait-upcasting/fewer-associated.rs | 2 +- tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs | 2 +- tests/ui/traits/trait-upcasting/issue-11515.rs | 2 +- tests/ui/traits/trait-upcasting/normalization.rs | 2 +- tests/ui/traits/trait-upcasting/type-checking-test-1.rs | 2 +- .../ui/traits/trait-upcasting/upcast-through-struct-tail.rs | 2 +- tests/ui/transmutability/primitives/bool-mut.rs | 2 +- tests/ui/transmutability/primitives/bool.rs | 2 +- tests/ui/transmutability/primitives/numbers.rs | 2 +- tests/ui/transmutability/primitives/unit.rs | 2 +- tests/ui/type-alias-impl-trait/assoc-type-const.rs | 2 +- tests/ui/type-alias-impl-trait/cross_inference.rs | 2 +- .../type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs | 2 +- tests/ui/type-alias-impl-trait/issue-78450.rs | 2 +- tests/ui/type-alias-impl-trait/normalize-hidden-types.rs | 2 +- .../rpit_tait_equality_in_canonical_query.rs | 2 +- tests/ui/type-alias-impl-trait/wf-in-associated-type.rs | 2 +- tests/ui/unsized/issue-71659.rs | 2 +- tests/ui/unsized/issue-75899.rs | 2 +- 218 files changed, 227 insertions(+), 228 deletions(-) diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs index c93cfa78832a2..3764e4c400865 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs @@ -315,7 +315,7 @@ fn check_opaque_type_well_formed<'tcx>( parent_def_id = tcx.local_parent(parent_def_id); } - // FIXME(-Ztrait-solver=next): We probably should use `DefiningAnchor::Error` + // FIXME(-Znext-solver): We probably should use `DefiningAnchor::Error` // and prepopulate this `InferCtxt` with known opaque values, rather than // using the `Bind` anchor here. For now it's fine. let infcx = tcx diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index e782221a4c223..891fc0bfd020a 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -1003,7 +1003,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { reported_errors: Default::default(), }; - // FIXME(-Ztrait-solver=next): A bit dubious that we're only registering + // FIXME(-Znext-solver): A bit dubious that we're only registering // predefined opaques in the typeck root. if infcx.next_trait_solver() && !infcx.tcx.is_typeck_child(body.source.def_id()) { checker.register_predefined_opaques_in_new_solver(); diff --git a/compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs b/compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs index 14bd23e77ea01..25bfe542d228a 100644 --- a/compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs +++ b/compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs @@ -1,7 +1,7 @@ // Copied from https://github.com/rust-lang/rust/blob/46455dc65069387f2dc46612f13fd45452ab301a/tests/ui/coroutine/gen_block_iterate.rs // revisions: next old //compile-flags: --edition 2024 -Zunstable-options -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // run-pass #![feature(gen_blocks)] diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs index 82419d782cd98..00302ec831cef 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -320,7 +320,7 @@ fn compare_method_predicate_entailment<'tcx>( if check_implied_wf == CheckImpliedWfMode::Check && !(impl_sig, trait_sig).references_error() { // Select obligations to make progress on inference before processing // the wf obligation below. - // FIXME(-Ztrait-solver=next): Not needed when the hack below is removed. + // FIXME(-Znext-solver): Not needed when the hack below is removed. let errors = ocx.select_where_possible(); if !errors.is_empty() { let reported = infcx.err_ctxt().report_fulfillment_errors(errors); @@ -333,7 +333,7 @@ fn compare_method_predicate_entailment<'tcx>( // trigger the lint. Instead, let's only consider type outlives and // region outlives obligations. // - // FIXME(-Ztrait-solver=next): Try removing this hack again once + // FIXME(-Znext-solver): Try removing this hack again once // the new solver is stable. let mut wf_args: smallvec::SmallVec<[_; 4]> = unnormalized_impl_sig.inputs_and_output.iter().map(|ty| ty.into()).collect(); diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index d571e04a49ac8..22af79e02a70f 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -1019,7 +1019,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// Returns false if the coercion creates any obligations that result in /// errors. pub fn can_coerce(&self, expr_ty: Ty<'tcx>, target: Ty<'tcx>) -> bool { - // FIXME(-Ztrait-solver=next): We need to structurally resolve both types here. + // FIXME(-Znext-solver): We need to structurally resolve both types here. let source = self.resolve_vars_with_obligations(expr_ty); debug!("coercion::can_with_predicates({:?} -> {:?})", source, target); diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 572a3312506c7..7744f75121eec 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -83,7 +83,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// version (resolve_vars_if_possible), this version will /// also select obligations if it seems useful, in an effort /// to get more type information. - // FIXME(-Ztrait-solver=next): A lot of the calls to this method should + // FIXME(-Znext-solver): A lot of the calls to this method should // probably be `try_structurally_resolve_type` or `structurally_resolve_type` instead. #[instrument(skip(self), level = "debug", ret)] pub(in super::super) fn resolve_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> { diff --git a/compiler/rustc_infer/src/infer/canonical/mod.rs b/compiler/rustc_infer/src/infer/canonical/mod.rs index 3c4c4644fe6ef..386fdb09ba5d5 100644 --- a/compiler/rustc_infer/src/infer/canonical/mod.rs +++ b/compiler/rustc_infer/src/infer/canonical/mod.rs @@ -101,7 +101,7 @@ impl<'tcx> InferCtxt<'tcx> { /// variable, then you'll get a new inference variable; if it is a /// universally quantified variable, you get a placeholder. /// - /// FIXME(-Ztrait-solver=next): This is public because it's used by the + /// FIXME(-Znext-solver): This is public because it's used by the /// new trait solver which has a different canonicalization routine. /// We should somehow deduplicate all of this. pub fn instantiate_canonical_var( diff --git a/compiler/rustc_infer/src/infer/canonical/substitute.rs b/compiler/rustc_infer/src/infer/canonical/substitute.rs index f368b30fbd193..e0b97bb160cab 100644 --- a/compiler/rustc_infer/src/infer/canonical/substitute.rs +++ b/compiler/rustc_infer/src/infer/canonical/substitute.rs @@ -11,7 +11,7 @@ use rustc_middle::ty::fold::{FnMutDelegate, TypeFoldable}; use rustc_middle::ty::GenericArgKind; use rustc_middle::ty::{self, TyCtxt}; -/// FIXME(-Ztrait-solver=next): This or public because it is shared with the +/// FIXME(-Znext-solver): This or public because it is shared with the /// new trait solver implementation. We should deduplicate canonicalization. pub trait CanonicalExt<'tcx, V> { /// Instantiate the wrapped value, replacing each canonical value diff --git a/compiler/rustc_infer/src/traits/mod.rs b/compiler/rustc_infer/src/traits/mod.rs index a26e676c52175..b9be178916cf5 100644 --- a/compiler/rustc_infer/src/traits/mod.rs +++ b/compiler/rustc_infer/src/traits/mod.rs @@ -135,7 +135,7 @@ pub enum FulfillmentErrorCode<'tcx> { CodeSubtypeError(ExpectedFound>, TypeError<'tcx>), // always comes from a SubtypePredicate CodeConstEquateError(ExpectedFound>, TypeError<'tcx>), CodeAmbiguity { - /// Overflow reported from the new solver `-Ztrait-solver=next`, which will + /// Overflow reported from the new solver `-Znext-solver`, which will /// be reported as an regular error as opposed to a fatal error. overflow: bool, }, diff --git a/compiler/rustc_middle/src/traits/solve/cache.rs b/compiler/rustc_middle/src/traits/solve/cache.rs index e9e9cc418a6d6..4f90af0a27c07 100644 --- a/compiler/rustc_middle/src/traits/solve/cache.rs +++ b/compiler/rustc_middle/src/traits/solve/cache.rs @@ -5,7 +5,7 @@ use rustc_data_structures::sync::Lock; use rustc_query_system::cache::WithDepNode; use rustc_query_system::dep_graph::DepNodeIndex; use rustc_session::Limit; -/// The trait solver cache used by `-Ztrait-solver=next`. +/// The trait solver cache used by `-Znext-solver`. /// /// FIXME(@lcnr): link to some official documentation of how /// this works. diff --git a/compiler/rustc_middle/src/ty/fast_reject.rs b/compiler/rustc_middle/src/ty/fast_reject.rs index f95ceeff1507a..38a9cabca972e 100644 --- a/compiler/rustc_middle/src/ty/fast_reject.rs +++ b/compiler/rustc_middle/src/ty/fast_reject.rs @@ -62,7 +62,7 @@ pub enum TreatParams { /// /// N.B. during deep rejection, this acts identically to `ForLookup`. /// - /// FIXME(-Ztrait-solver=next): Remove this variant and cleanup + /// FIXME(-Znext-solver): Remove this variant and cleanup /// the code. NextSolverLookup, } diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs index ce20fa030d8aa..8cdd8a2861296 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs @@ -422,7 +422,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> { self.compute_const_evaluatable_goal(Goal { param_env, predicate: ct }) } ty::PredicateKind::ConstEquate(_, _) => { - bug!("ConstEquate should not be emitted when `-Ztrait-solver=next` is active") + bug!("ConstEquate should not be emitted when `-Znext-solver` is active") } ty::PredicateKind::NormalizesTo(predicate) => { self.compute_normalizes_to_goal(Goal { param_env, predicate }) diff --git a/compiler/rustc_trait_selection/src/solve/mod.rs b/compiler/rustc_trait_selection/src/solve/mod.rs index f45473e06dc89..1e58106e3533c 100644 --- a/compiler/rustc_trait_selection/src/solve/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/mod.rs @@ -1,7 +1,6 @@ //! The next-generation trait solver, currently still WIP. //! -//! As a user of rust, you can use `-Ztrait-solver=next` or `next-coherence` -//! to enable the new trait solver always, or just within coherence, respectively. +//! As a user of rust, you can use `-Znext-solver` to enable the new trait solver. //! //! As a developer of rustc, you shouldn't be using the new trait //! solver without asking the trait-system-refactor-initiative, but it can @@ -248,7 +247,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { return None; } - // FIXME(-Ztrait-solver=next): We should instead try to find a `Certainty::Yes` response with + // FIXME(-Znext-solver): We should instead try to find a `Certainty::Yes` response with // a subset of the constraints that all the other responses have. let one = responses[0]; if responses[1..].iter().all(|&resp| resp == one) { diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs index 5807f7c6153cf..9536fde7c93d1 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs @@ -445,7 +445,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { return Err(NoSolution); } - // FIXME(-Ztrait-solver=next): Implement this when we get const working in the new solver + // FIXME(-Znext-solver): Implement this when we get const working in the new solver // `Destruct` is automatically implemented for every type in // non-const environments. diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index db4d4a93e54f9..88ebea700210b 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -855,7 +855,7 @@ where } fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow { - // Need to lazily normalize here in with `-Ztrait-solver=next-coherence`. + // Need to lazily normalize here in with `-Znext-solver=coherence`. let ty = match (self.lazily_normalize_ty)(ty) { Ok(ty) => ty, Err(err) => return ControlFlow::Break(OrphanCheckEarlyExit::NormalizationFailure(err)), @@ -1069,7 +1069,7 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a, 'tcx> { let lazily_normalize_ty = |ty: Ty<'tcx>| { let mut fulfill_cx = >::new(infcx); if matches!(ty.kind(), ty::Alias(..)) { - // FIXME(-Ztrait-solver=next-coherence): we currently don't + // FIXME(-Znext-solver=coherence): we currently don't // normalize opaque types here, resulting in diverging behavior // for TAITs. match infcx diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index 9d8aaf4e64352..3b50645a275cc 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -1669,7 +1669,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ) .into(), }; - // FIXME(-Ztrait-solver=next): For diagnostic purposes, it would be nice + // FIXME(-Znext-solver): For diagnostic purposes, it would be nice // to deeply normalize this type. let normalized_term = ocx.normalize(&obligation.cause, obligation.param_env, unnormalized_term); diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 64d2b5fc1598e..8c5f1e9071545 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -315,7 +315,7 @@ pub fn normalize_param_env_or_error<'tcx>( // We do not normalize types here as there is no backwards compatibility requirement // for us to do so. // - // FIXME(-Ztrait-solver=next): remove this hack since we have deferred projection equality + // FIXME(-Znext-solver): remove this hack since we have deferred projection equality predicate.fold_with(&mut ConstNormalizer(tcx)) }), ) @@ -386,7 +386,7 @@ pub fn normalize_param_env_or_error<'tcx>( /// Normalize a type and process all resulting obligations, returning any errors. /// -/// FIXME(-Ztrait-solver=next): This should be replaced by `At::deeply_normalize` +/// FIXME(-Znext-solver): This should be replaced by `At::deeply_normalize` /// which has the same behavior with the new solver. Because using a separate /// fulfillment context worsens caching in the old solver, `At::deeply_normalize` /// is still lazy with the old solver as it otherwise negatively impacts perf. diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index a08e35b566f44..4c3eb05819f33 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -67,7 +67,7 @@ pub trait NormalizeExt<'tcx> { /// same goals in both a temporary and the shared context which negatively impacts /// performance as these don't share caching. /// - /// FIXME(-Ztrait-solver=next): This has the same behavior as `traits::fully_normalize` + /// FIXME(-Znext-solver): This has the same behavior as `traits::fully_normalize` /// in the new solver, but because of performance reasons, we currently reuse an /// existing fulfillment context in the old solver. Once we also eagerly prove goals with /// the old solver or have removed the old solver, remove `traits::fully_normalize` and diff --git a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs index 04b3119323fac..d812d537d8c1d 100644 --- a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs +++ b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs @@ -72,7 +72,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> { let mut fulfill_cx = crate::solve::FulfillmentCtxt::new(self); fulfill_cx.register_predicate_obligation(self, obligation.clone()); // True errors - // FIXME(-Ztrait-solver=next): Overflows are reported as ambig here, is that OK? + // FIXME(-Znext-solver): Overflows are reported as ambig here, is that OK? if !fulfill_cx.select_where_possible(self).is_empty() { Ok(EvaluationResult::EvaluatedToErr) } else if !fulfill_cx.select_all_or_error(self).is_empty() { diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs index 9559f5002f63b..ddf00ecfb65b5 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs @@ -29,7 +29,7 @@ where ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result { - // FIXME(-Ztrait-solver=next): shouldn't be using old normalizer + // FIXME(-Znext-solver): shouldn't be using old normalizer Ok(ocx.normalize(&ObligationCause::dummy(), key.param_env, key.value.value)) } } diff --git a/compiler/rustc_trait_selection/src/traits/structural_normalize.rs b/compiler/rustc_trait_selection/src/traits/structural_normalize.rs index 32de8feda8171..b9ab26fe2fede 100644 --- a/compiler/rustc_trait_selection/src/traits/structural_normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/structural_normalize.rs @@ -22,7 +22,7 @@ impl<'tcx> StructurallyNormalizeExt<'tcx> for At<'_, 'tcx> { assert!(!ty.is_ty_var(), "should have resolved vars before calling"); if self.infcx.next_trait_solver() { - // FIXME(-Ztrait-solver=next): correctly handle + // FIXME(-Znext-solver): correctly handle // overflow here. for _ in 0..256 { let ty::Alias(ty::Projection | ty::Inherent | ty::Weak, alias) = *ty.kind() else { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 055671afd14d3..5d53a4d28f2e2 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2543,10 +2543,10 @@ impl<'test> TestCx<'test> { rustc.args(&["-Zpolonius"]); } Some(CompareMode::NextSolver) => { - rustc.args(&["-Ztrait-solver=next"]); + rustc.args(&["-Znext-solver"]); } Some(CompareMode::NextSolverCoherence) => { - rustc.args(&["-Ztrait-solver=next-coherence"]); + rustc.args(&["-Znext-solver=coherence"]); } Some(CompareMode::SplitDwarf) if self.config.target.contains("windows") => { rustc.args(&["-Csplit-debuginfo=unpacked", "-Zunstable-options"]); diff --git a/tests/ui/associated-inherent-types/inference.rs b/tests/ui/associated-inherent-types/inference.rs index 66f879c5a71d9..054034b4c2897 100644 --- a/tests/ui/associated-inherent-types/inference.rs +++ b/tests/ui/associated-inherent-types/inference.rs @@ -1,7 +1,7 @@ // Testing inference capabilities. // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(inherent_associated_types)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/normalize-output-in-signature-deduction.rs b/tests/ui/async-await/normalize-output-in-signature-deduction.rs index 960065a83a45d..e07fe9e98ecf4 100644 --- a/tests/ui/async-await/normalize-output-in-signature-deduction.rs +++ b/tests/ui/async-await/normalize-output-in-signature-deduction.rs @@ -1,6 +1,6 @@ // edition:2021 // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs index e581e5ffda7c3..6097c7f1073ed 100644 --- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs +++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs @@ -1,7 +1,7 @@ // revisions: current next //[current] known-bug: #109924 //[next] check-pass -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // edition:2021 #![feature(return_type_notation)] diff --git a/tests/ui/auto-traits/issue-23080-2.rs b/tests/ui/auto-traits/issue-23080-2.rs index 882b8f3938428..d63cd9d5dd601 100644 --- a/tests/ui/auto-traits/issue-23080-2.rs +++ b/tests/ui/auto-traits/issue-23080-2.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(auto_traits)] #![feature(negative_impls)] diff --git a/tests/ui/closures/infer-signature-from-impl.rs b/tests/ui/closures/infer-signature-from-impl.rs index 6e8c94177bf66..8b18e4ef9e743 100644 --- a/tests/ui/closures/infer-signature-from-impl.rs +++ b/tests/ui/closures/infer-signature-from-impl.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver //[next] known-bug: trait-system-refactor-initiative#71 //[current] check-pass diff --git a/tests/ui/coherence/coherence-overlap-downstream-inherent.rs b/tests/ui/coherence/coherence-overlap-downstream-inherent.rs index 2c3ef4fd3f718..94a7ecbe11f15 100644 --- a/tests/ui/coherence/coherence-overlap-downstream-inherent.rs +++ b/tests/ui/coherence/coherence-overlap-downstream-inherent.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // Tests that we consider `T: Sugar + Fruit` to be ambiguous, even // though no impls are found. diff --git a/tests/ui/coherence/coherence-overlap-downstream.rs b/tests/ui/coherence/coherence-overlap-downstream.rs index a4e559604a001..171b2a32fc53c 100644 --- a/tests/ui/coherence/coherence-overlap-downstream.rs +++ b/tests/ui/coherence/coherence-overlap-downstream.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // Tests that we consider `T: Sugar + Fruit` to be ambiguous, even // though no impls are found. diff --git a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs index a7c90a6b8c8d0..6f5cc98049174 100644 --- a/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs +++ b/tests/ui/coherence/coherence-overlap-issue-23516-inherent.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // Tests that we consider `Box: !Sugar` to be ambiguous, even // though we see no impl of `Sugar` for `Box`. Therefore, an overlap diff --git a/tests/ui/coherence/coherence-overlap-issue-23516.rs b/tests/ui/coherence/coherence-overlap-issue-23516.rs index c846d39716bbd..4daaed4366f81 100644 --- a/tests/ui/coherence/coherence-overlap-issue-23516.rs +++ b/tests/ui/coherence/coherence-overlap-issue-23516.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // Tests that we consider `Box: !Sugar` to be ambiguous, even // though we see no impl of `Sugar` for `Box`. Therefore, an overlap diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs index 743e80d3f1818..0f785b4e5f6d0 100644 --- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs +++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver struct S; diff --git a/tests/ui/coherence/normalize-for-errors.rs b/tests/ui/coherence/normalize-for-errors.rs index 367d34251ae30..30723518bce9e 100644 --- a/tests/ui/coherence/normalize-for-errors.rs +++ b/tests/ui/coherence/normalize-for-errors.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver struct MyType; trait MyTrait {} diff --git a/tests/ui/coherence/occurs-check/associated-type.rs b/tests/ui/coherence/occurs-check/associated-type.rs index 909551f65be49..227b668478513 100644 --- a/tests/ui/coherence/occurs-check/associated-type.rs +++ b/tests/ui/coherence/occurs-check/associated-type.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // A regression test for #105787 diff --git a/tests/ui/coherence/occurs-check/opaques.rs b/tests/ui/coherence/occurs-check/opaques.rs index 9d31a3dc82da9..2fa9dcebfdec4 100644 --- a/tests/ui/coherence/occurs-check/opaques.rs +++ b/tests/ui/coherence/occurs-check/opaques.rs @@ -1,5 +1,5 @@ //revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // A regression test for #105787 diff --git a/tests/ui/coinduction/canonicalization-rerun.rs b/tests/ui/coinduction/canonicalization-rerun.rs index c68895fc4e63e..bbd8d802630ac 100644 --- a/tests/ui/coinduction/canonicalization-rerun.rs +++ b/tests/ui/coinduction/canonicalization-rerun.rs @@ -1,6 +1,6 @@ // check-pass // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // If we use canonical goals during trait solving we have to reevaluate // the root goal of a cycle until we hit a fixpoint. diff --git a/tests/ui/const-generics/defaults/default-param-wf-concrete.rs b/tests/ui/const-generics/defaults/default-param-wf-concrete.rs index 09a00dd8e701b..aa3307b92e43c 100644 --- a/tests/ui/const-generics/defaults/default-param-wf-concrete.rs +++ b/tests/ui/const-generics/defaults/default-param-wf-concrete.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver struct Foo; //~^ ERROR evaluation of constant value failed diff --git a/tests/ui/consts/const-len-underflow-separate-spans.rs b/tests/ui/consts/const-len-underflow-separate-spans.rs index 55704b641543b..bd37be2157617 100644 --- a/tests/ui/consts/const-len-underflow-separate-spans.rs +++ b/tests/ui/consts/const-len-underflow-separate-spans.rs @@ -3,7 +3,7 @@ // overall context for what caused the evaluation. // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver const ONE: usize = 1; const TWO: usize = 2; diff --git a/tests/ui/coroutine/clone-rpit.rs b/tests/ui/coroutine/clone-rpit.rs index e0061e1c6bb33..cbd28f88fcb83 100644 --- a/tests/ui/coroutine/clone-rpit.rs +++ b/tests/ui/coroutine/clone-rpit.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // check-pass #![feature(coroutines, coroutine_trait, coroutine_clone)] diff --git a/tests/ui/coroutine/gen_block_is_iter.rs b/tests/ui/coroutine/gen_block_is_iter.rs index 92625cf7c2843..d43eef4a18d7d 100644 --- a/tests/ui/coroutine/gen_block_is_iter.rs +++ b/tests/ui/coroutine/gen_block_is_iter.rs @@ -1,6 +1,6 @@ // revisions: next old //compile-flags: --edition 2024 -Zunstable-options -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // check-pass #![feature(gen_blocks)] diff --git a/tests/ui/coroutine/gen_block_iterate.rs b/tests/ui/coroutine/gen_block_iterate.rs index 18e1bb8877233..8e72b00d99d5d 100644 --- a/tests/ui/coroutine/gen_block_iterate.rs +++ b/tests/ui/coroutine/gen_block_iterate.rs @@ -1,6 +1,6 @@ // revisions: next old //compile-flags: --edition 2024 -Zunstable-options -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // run-pass #![feature(gen_blocks)] diff --git a/tests/ui/coroutine/non-static-is-unpin.rs b/tests/ui/coroutine/non-static-is-unpin.rs index d77fe659f083b..238e49bbfdf23 100644 --- a/tests/ui/coroutine/non-static-is-unpin.rs +++ b/tests/ui/coroutine/non-static-is-unpin.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // run-pass #![feature(coroutines, coroutine_trait)] diff --git a/tests/ui/coroutine/static-not-unpin.rs b/tests/ui/coroutine/static-not-unpin.rs index 6ce78046dcc89..f27183d11db49 100644 --- a/tests/ui/coroutine/static-not-unpin.rs +++ b/tests/ui/coroutine/static-not-unpin.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(coroutines)] diff --git a/tests/ui/dyn-star/box.rs b/tests/ui/dyn-star/box.rs index 87c8356a174ed..8b2f46bd1b244 100644 --- a/tests/ui/dyn-star/box.rs +++ b/tests/ui/dyn-star/box.rs @@ -1,7 +1,7 @@ // run-pass // revisions: current next //[current] compile-flags: -C opt-level=0 -//[next] compile-flags: -Ztrait-solver=next -C opt-level=0 +//[next] compile-flags: -Znext-solver -C opt-level=0 #![feature(dyn_star)] #![allow(incomplete_features)] diff --git a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs index 9846f87142457..dffe6ae8a363c 100644 --- a/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs +++ b/tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(dyn_star)] #![allow(incomplete_features)] diff --git a/tests/ui/dyn-star/param-env-region-infer.rs b/tests/ui/dyn-star/param-env-region-infer.rs index 50dec94d25b3c..1e33177776570 100644 --- a/tests/ui/dyn-star/param-env-region-infer.rs +++ b/tests/ui/dyn-star/param-env-region-infer.rs @@ -1,7 +1,7 @@ // revisions: current // incremental -// FIXME(-Ztrait-solver=next): THis currently results in unstable query results: +// FIXME(-Znext-solver): THis currently results in unstable query results: // `normalizes-to(opaque, opaque)` changes from `Maybe(Ambiguous)` to `Maybe(Overflow)` // once the hidden type of the opaque is already defined to be itself. diff --git a/tests/ui/error-codes/E0476.rs b/tests/ui/error-codes/E0476.rs index e9afc7567260f..d87916198c564 100644 --- a/tests/ui/error-codes/E0476.rs +++ b/tests/ui/error-codes/E0476.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next-coherence +//[next] compile-flags: -Znext-solver=coherence #![feature(coerce_unsized)] #![feature(unsize)] diff --git a/tests/ui/for/issue-20605.rs b/tests/ui/for/issue-20605.rs index 50d4c3fddb549..8ae9494faf8b0 100644 --- a/tests/ui/for/issue-20605.rs +++ b/tests/ui/for/issue-20605.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } @@ -13,7 +13,7 @@ fn changer<'a>(mut things: Box>) { //[next]~| ERROR the type `Option<< as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed //[next]~| ERROR the size for values of type `< as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time //[next]~| ERROR type `< as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced - // FIXME(-Ztrait-solver=next): these error messages are horrible and have to be + // FIXME(-Znext-solver): these error messages are horrible and have to be // improved before we stabilize the new solver. } diff --git a/tests/ui/generic-associated-types/issue-102114.rs b/tests/ui/generic-associated-types/issue-102114.rs index bb6622c0a5fb7..bb6369d7f8ff3 100644 --- a/tests/ui/generic-associated-types/issue-102114.rs +++ b/tests/ui/generic-associated-types/issue-102114.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver trait A { type B<'b>; diff --git a/tests/ui/higher-ranked/leak-check-in-selection.rs b/tests/ui/higher-ranked/leak-check-in-selection.rs index e8d6cff856c9e..5b36902ffdfe8 100644 --- a/tests/ui/higher-ranked/leak-check-in-selection.rs +++ b/tests/ui/higher-ranked/leak-check-in-selection.rs @@ -1,6 +1,6 @@ // run-pass // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![allow(coherence_leak_check)] trait Trait: Sized { diff --git a/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs b/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs index adb19c035bce6..41f24dde01adc 100644 --- a/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs +++ b/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs @@ -1,5 +1,5 @@ // revisions: classic next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver //[next] check-pass fn ice() diff --git a/tests/ui/higher-ranked/trait-bounds/future.rs b/tests/ui/higher-ranked/trait-bounds/future.rs index 61d86a9cb2390..baeb56e5d78cd 100644 --- a/tests/ui/higher-ranked/trait-bounds/future.rs +++ b/tests/ui/higher-ranked/trait-bounds/future.rs @@ -1,7 +1,7 @@ // ignore-tidy-linelength // edition:2021 // revisions: classic next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver //[next] check-pass //[classic] known-bug: #112347 //[classic] build-fail diff --git a/tests/ui/higher-ranked/trait-bounds/issue-95230.rs b/tests/ui/higher-ranked/trait-bounds/issue-95230.rs index 49a1584d54e0b..027644a280b0f 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-95230.rs +++ b/tests/ui/higher-ranked/trait-bounds/issue-95230.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver //[old] check-pass //[next] known-bug: #109764 diff --git a/tests/ui/impl-trait/auto-trait-coherence.rs b/tests/ui/impl-trait/auto-trait-coherence.rs index a5cd01a87ffc9..e4226b2007483 100644 --- a/tests/ui/impl-trait/auto-trait-coherence.rs +++ b/tests/ui/impl-trait/auto-trait-coherence.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // Tests that type alias impls traits do not leak auto-traits for // the purposes of coherence checking diff --git a/tests/ui/impl-trait/autoderef.rs b/tests/ui/impl-trait/autoderef.rs index cd2cdd9e3b3cf..48ff8be6549fe 100644 --- a/tests/ui/impl-trait/autoderef.rs +++ b/tests/ui/impl-trait/autoderef.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // check-pass use std::path::Path; diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs index 698123a932d04..b1f36fc247fe1 100644 --- a/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs +++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs @@ -1,6 +1,6 @@ // revisions: current next // compile-flags: -Zverbose -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // normalize-stderr-test "DefId\([^\)]+\)" -> "DefId(..)" #![feature(rustc_attrs)] diff --git a/tests/ui/impl-trait/in-trait/object-safety-sized.rs b/tests/ui/impl-trait/in-trait/object-safety-sized.rs index 35afe80c97f42..1a23493a94d6b 100644 --- a/tests/ui/impl-trait/in-trait/object-safety-sized.rs +++ b/tests/ui/impl-trait/in-trait/object-safety-sized.rs @@ -1,6 +1,6 @@ // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver fn main() { diff --git a/tests/ui/impl-trait/in-trait/opaque-variances.rs b/tests/ui/impl-trait/in-trait/opaque-variances.rs index 60bfab0deb582..63e56051d1a8d 100644 --- a/tests/ui/impl-trait/in-trait/opaque-variances.rs +++ b/tests/ui/impl-trait/in-trait/opaque-variances.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver fn foo<'a: 'a>(x: &'a Vec) -> impl Sized { () diff --git a/tests/ui/impl-trait/issue-103181-1.rs b/tests/ui/impl-trait/issue-103181-1.rs index 5154abcd69070..14c813cf00fde 100644 --- a/tests/ui/impl-trait/issue-103181-1.rs +++ b/tests/ui/impl-trait/issue-103181-1.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // edition:2021 mod hyper { diff --git a/tests/ui/impl-trait/recursive-coroutine.rs b/tests/ui/impl-trait/recursive-coroutine.rs index f0bee4f120ffe..b82fe134a4069 100644 --- a/tests/ui/impl-trait/recursive-coroutine.rs +++ b/tests/ui/impl-trait/recursive-coroutine.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; diff --git a/tests/ui/impl-trait/reveal-during-codegen.rs b/tests/ui/impl-trait/reveal-during-codegen.rs index 11463772eb38c..7b2ca9c33f6d6 100644 --- a/tests/ui/impl-trait/reveal-during-codegen.rs +++ b/tests/ui/impl-trait/reveal-during-codegen.rs @@ -1,6 +1,6 @@ // build-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver fn test() -> Option { Some("") diff --git a/tests/ui/impl-trait/two_tait_defining_each_other.rs b/tests/ui/impl-trait/two_tait_defining_each_other.rs index b43a7cabd0589..6a9e33500e513 100644 --- a/tests/ui/impl-trait/two_tait_defining_each_other.rs +++ b/tests/ui/impl-trait/two_tait_defining_each_other.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver //[next] check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.rs b/tests/ui/impl-trait/two_tait_defining_each_other2.rs index 817de109fbe95..8a79af19776b7 100644 --- a/tests/ui/impl-trait/two_tait_defining_each_other2.rs +++ b/tests/ui/impl-trait/two_tait_defining_each_other2.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(type_alias_impl_trait)] type A = impl Foo; //[current]~ ERROR unconstrained opaque type diff --git a/tests/ui/impl-trait/two_tait_defining_each_other3.rs b/tests/ui/impl-trait/two_tait_defining_each_other3.rs index 6fb9e6e718898..55def937f4860 100644 --- a/tests/ui/impl-trait/two_tait_defining_each_other3.rs +++ b/tests/ui/impl-trait/two_tait_defining_each_other3.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver //[next] check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs index c177655c5acf5..27c8f30ec3269 100644 --- a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs +++ b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs @@ -1,5 +1,5 @@ // A test exploiting the bug behind #25860 except with -// implied trait bounds which currently don't exist without `-Ztrait-solver=chalk`. +// implied trait bounds which currently don't exist. use std::marker::PhantomData; struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) where diff --git a/tests/ui/inference/type-infer-generalize-ty-var.rs b/tests/ui/inference/type-infer-generalize-ty-var.rs index 8b4a8c32bb225..6bf3c61ada84e 100644 --- a/tests/ui/inference/type-infer-generalize-ty-var.rs +++ b/tests/ui/inference/type-infer-generalize-ty-var.rs @@ -1,6 +1,6 @@ // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![allow(non_upper_case_globals)] #![allow(dead_code)] diff --git a/tests/ui/issues/issue-13167.rs b/tests/ui/issues/issue-13167.rs index 9a9f129ec3ab6..747f652d4af0c 100644 --- a/tests/ui/issues/issue-13167.rs +++ b/tests/ui/issues/issue-13167.rs @@ -1,7 +1,7 @@ // check-pass // pretty-expanded FIXME #23616 // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver use std::slice; diff --git a/tests/ui/issues/issue-15734.rs b/tests/ui/issues/issue-15734.rs index 27410d4c3b08e..77517f6181394 100644 --- a/tests/ui/issues/issue-15734.rs +++ b/tests/ui/issues/issue-15734.rs @@ -1,6 +1,6 @@ // run-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver use std::ops::Index; diff --git a/tests/ui/lazy-type-alias/coerce-behind-lazy.rs b/tests/ui/lazy-type-alias/coerce-behind-lazy.rs index 745eadb9625ca..ec9a67399756b 100644 --- a/tests/ui/lazy-type-alias/coerce-behind-lazy.rs +++ b/tests/ui/lazy-type-alias/coerce-behind-lazy.rs @@ -1,6 +1,6 @@ // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(lazy_type_alias)] //~^ WARN the feature `lazy_type_alias` is incomplete diff --git a/tests/ui/never_type/never-from-impl-is-reserved.rs b/tests/ui/never_type/never-from-impl-is-reserved.rs index f358e045cf019..97fac59149b98 100644 --- a/tests/ui/never_type/never-from-impl-is-reserved.rs +++ b/tests/ui/never_type/never-from-impl-is-reserved.rs @@ -1,7 +1,7 @@ // check that the `for T: From` impl is reserved // revisions: current next -//[next] compile-flags: -Ztrait-solver=next-coherence +//[next] compile-flags: -Znext-solver=coherence #![feature(never_type)] diff --git a/tests/ui/nll/issue-53119.rs b/tests/ui/nll/issue-53119.rs index 015b72367f1d7..d19a9a0327cf6 100644 --- a/tests/ui/nll/issue-53119.rs +++ b/tests/ui/nll/issue-53119.rs @@ -1,6 +1,6 @@ // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver use std::ops::Deref; diff --git a/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs b/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs index 0b30a88fdd42c..21dda7b8c9bd8 100644 --- a/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs +++ b/tests/ui/object-safety/call-when-assoc-ty-is-sized.rs @@ -1,6 +1,6 @@ // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver trait Foo { type Bar<'a> diff --git a/tests/ui/panics/abort-on-panic.rs b/tests/ui/panics/abort-on-panic.rs index 7fbee85ffd14f..ff31fc2431740 100644 --- a/tests/ui/panics/abort-on-panic.rs +++ b/tests/ui/panics/abort-on-panic.rs @@ -1,6 +1,6 @@ // run-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![allow(unused_must_use)] #![feature(c_unwind)] diff --git a/tests/ui/rfcs/rfc-2027-object-safe-for-dispatch/manual-self-impl-for-unsafe-obj.rs b/tests/ui/rfcs/rfc-2027-object-safe-for-dispatch/manual-self-impl-for-unsafe-obj.rs index c27e8c4b01972..c7665affb992b 100644 --- a/tests/ui/rfcs/rfc-2027-object-safe-for-dispatch/manual-self-impl-for-unsafe-obj.rs +++ b/tests/ui/rfcs/rfc-2027-object-safe-for-dispatch/manual-self-impl-for-unsafe-obj.rs @@ -1,7 +1,7 @@ // Check that we can manually implement an object-unsafe trait for its trait object. // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // run-pass #![feature(object_safe_for_dispatch)] diff --git a/tests/ui/specialization/specialization-default-items-drop-coherence.rs b/tests/ui/specialization/specialization-default-items-drop-coherence.rs index 44c598f19cb9b..37903c210714e 100644 --- a/tests/ui/specialization/specialization-default-items-drop-coherence.rs +++ b/tests/ui/specialization/specialization-default-items-drop-coherence.rs @@ -1,6 +1,6 @@ // revisions: classic coherence next -//[next] compile-flags: -Ztrait-solver=next -//[coherence] compile-flags: -Ztrait-solver=next-coherence +//[next] compile-flags: -Znext-solver +//[coherence] compile-flags: -Znext-solver=coherence //[classic] check-pass //[classic] known-bug: #105782 diff --git a/tests/ui/traits/deny-builtin-object-impl.rs b/tests/ui/traits/deny-builtin-object-impl.rs index dce03a43b682a..d0eb6382e411f 100644 --- a/tests/ui/traits/deny-builtin-object-impl.rs +++ b/tests/ui/traits/deny-builtin-object-impl.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(rustc_attrs)] diff --git a/tests/ui/traits/issue-24010.rs b/tests/ui/traits/issue-24010.rs index fd7d6751d5c7b..1eaa5bf0c6792 100644 --- a/tests/ui/traits/issue-24010.rs +++ b/tests/ui/traits/issue-24010.rs @@ -1,6 +1,6 @@ // run-pass // revisions: classic next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver trait Foo: Fn(i32) -> i32 + Send {} diff --git a/tests/ui/traits/new-solver/alias-bound-preference.rs b/tests/ui/traits/new-solver/alias-bound-preference.rs index e4e0f634ef76e..1c6e12096105c 100644 --- a/tests/ui/traits/new-solver/alias-bound-preference.rs +++ b/tests/ui/traits/new-solver/alias-bound-preference.rs @@ -1,5 +1,5 @@ // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // run-pass // A test for https://github.com/rust-lang/trait-system-refactor-initiative/issues/45. diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.rs b/tests/ui/traits/new-solver/alias-bound-unsound.rs index ab84e3875e299..565bfe1186e2a 100644 --- a/tests/ui/traits/new-solver/alias-bound-unsound.rs +++ b/tests/ui/traits/new-solver/alias-bound-unsound.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Makes sure that alias bounds are not unsound! diff --git a/tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs b/tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs index 4bfb6323a5366..aa7c94791a739 100644 --- a/tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs +++ b/tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver trait Foo { type Gat<'a> diff --git a/tests/ui/traits/new-solver/alias-relate/deeply-nested-no-hang.rs b/tests/ui/traits/new-solver/alias-relate/deeply-nested-no-hang.rs index 4abce7b57d50d..91cfda37adf63 100644 --- a/tests/ui/traits/new-solver/alias-relate/deeply-nested-no-hang.rs +++ b/tests/ui/traits/new-solver/alias-relate/deeply-nested-no-hang.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // regression test for trait-system-refactor-initiative#68 trait Identity { type Assoc: ?Sized; diff --git a/tests/ui/traits/new-solver/alias-relate/opaque-hidden-ty-is-rigid-alias.rs b/tests/ui/traits/new-solver/alias-relate/opaque-hidden-ty-is-rigid-alias.rs index 29a73e1a96799..88bbd13f9a2d7 100644 --- a/tests/ui/traits/new-solver/alias-relate/opaque-hidden-ty-is-rigid-alias.rs +++ b/tests/ui/traits/new-solver/alias-relate/opaque-hidden-ty-is-rigid-alias.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver fn test(x: T::Item) -> impl Sized { x diff --git a/tests/ui/traits/new-solver/alias-sub.rs b/tests/ui/traits/new-solver/alias-sub.rs index 30c1981a92ece..f7f23a024dd0e 100644 --- a/tests/ui/traits/new-solver/alias-sub.rs +++ b/tests/ui/traits/new-solver/alias-sub.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Trait { diff --git a/tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs b/tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs index dc726ba51f94f..04d1b949692cd 100644 --- a/tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs +++ b/tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check that a goal such as `alias-eq(::Assoc, ::Assoc)` // succeeds with a constraint that `?0 = bool` diff --git a/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs b/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs index 3c7fc7403b119..48157192a10bc 100644 --- a/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs +++ b/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // (should not pass, should be turned into a coherence-only test) diff --git a/tests/ui/traits/new-solver/alias_eq_simple.rs b/tests/ui/traits/new-solver/alias_eq_simple.rs index 6792cf3ce35ab..21ad1a4fa3c2f 100644 --- a/tests/ui/traits/new-solver/alias_eq_simple.rs +++ b/tests/ui/traits/new-solver/alias_eq_simple.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // test that the new solver can handle `alias-eq(::Assoc, u32)` diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs index 204f6e8b0719e..4717aa80499a4 100644 --- a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs +++ b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check that a `alias-eq(::Assoc, ::Assoc)` goal fails // during coherence. We must not incorrectly constrain `?a` and `?b` to be diff --git a/tests/ui/traits/new-solver/array-default.rs b/tests/ui/traits/new-solver/array-default.rs index 5077137b09b4b..6bfbce7d433d2 100644 --- a/tests/ui/traits/new-solver/array-default.rs +++ b/tests/ui/traits/new-solver/array-default.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass fn has_default() where [(); N]: Default {} diff --git a/tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs b/tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs index 826e8c1e0b131..4401abd07834a 100644 --- a/tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs +++ b/tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // Checks that we do not get ambiguity by considering an impl diff --git a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.rs b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.rs index 1dca86d3630b1..1edc1a8c58c7d 100644 --- a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.rs +++ b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // In the new solver, we are trying to select `::Item: Debug`, // which, naively can be unified with every impl of `Debug` if we're not careful. diff --git a/tests/ui/traits/new-solver/async.rs b/tests/ui/traits/new-solver/async.rs index 155b71eb74991..5833c052234be 100644 --- a/tests/ui/traits/new-solver/async.rs +++ b/tests/ui/traits/new-solver/async.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // edition: 2021 // revisions: pass fail //[pass] check-pass diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs index 6b54718e35c92..d4010a55244f6 100644 --- a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs +++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // edition: 2021 // revisions: pass fail //[pass] check-pass diff --git a/tests/ui/traits/new-solver/borrowck-error.rs b/tests/ui/traits/new-solver/borrowck-error.rs index 4787a2c7e1192..25f1445941b10 100644 --- a/tests/ui/traits/new-solver/borrowck-error.rs +++ b/tests/ui/traits/new-solver/borrowck-error.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver use std::collections::HashMap; diff --git a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs index ba473653ecfe3..eab25214d635c 100644 --- a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs +++ b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(fn_traits)] #![feature(unboxed_closures)] diff --git a/tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs b/tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs index 4b013983a4a84..ea2740523c9ba 100644 --- a/tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs +++ b/tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Mirror { diff --git a/tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs b/tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs index d1c6b1077e8ef..b1e4a9e58cfbb 100644 --- a/tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs +++ b/tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver trait Mirror { type Item; diff --git a/tests/ui/traits/new-solver/canonicalize-effect-var.rs b/tests/ui/traits/new-solver/canonicalize-effect-var.rs index 35b69ed1a6b03..4a13ba37303bf 100644 --- a/tests/ui/traits/new-solver/canonicalize-effect-var.rs +++ b/tests/ui/traits/new-solver/canonicalize-effect-var.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #![feature(effects)] diff --git a/tests/ui/traits/new-solver/cast-checks-handling-projections.rs b/tests/ui/traits/new-solver/cast-checks-handling-projections.rs index 3b261062f782e..406b4dc1211f2 100644 --- a/tests/ui/traits/new-solver/cast-checks-handling-projections.rs +++ b/tests/ui/traits/new-solver/cast-checks-handling-projections.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass fn main() { diff --git a/tests/ui/traits/new-solver/closure-inference-guidance.rs b/tests/ui/traits/new-solver/closure-inference-guidance.rs index d2ad0cc0316e3..8175b92f882bc 100644 --- a/tests/ui/traits/new-solver/closure-inference-guidance.rs +++ b/tests/ui/traits/new-solver/closure-inference-guidance.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass fn foo(i: isize) -> isize { i + 1 } diff --git a/tests/ui/traits/new-solver/closure-substs-ambiguity.rs b/tests/ui/traits/new-solver/closure-substs-ambiguity.rs index 48432f4020f87..cc9ee58f27fd7 100644 --- a/tests/ui/traits/new-solver/closure-substs-ambiguity.rs +++ b/tests/ui/traits/new-solver/closure-substs-ambiguity.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass fn main() { diff --git a/tests/ui/traits/new-solver/coherence/issue-102048.rs b/tests/ui/traits/new-solver/coherence/issue-102048.rs index 11636bfeb5509..600e63d4d445f 100644 --- a/tests/ui/traits/new-solver/coherence/issue-102048.rs +++ b/tests/ui/traits/new-solver/coherence/issue-102048.rs @@ -17,7 +17,7 @@ // that to `i32`. We then try to unify `i32` from `impl1` with `u32` from `impl2` which fails, // causing coherence to consider these two impls distinct. -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver pub trait Trait {} pub trait WithAssoc1<'a> { diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs index b39ae0333ad31..af471b5e19345 100644 --- a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs +++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Coherence should handle overflow while normalizing for // `trait_ref_is_knowable` correctly. diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs index c38e3baf5b465..e6ffb55b4416b 100644 --- a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs +++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Id { diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs index 2d53266db09d5..d16f9d22ce087 100644 --- a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs +++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass use std::future::{Future, IntoFuture}; diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs index 2f27de4e4f4da..90de6b847d08c 100644 --- a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs +++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Id { diff --git a/tests/ui/traits/new-solver/const-param-placeholder.rs b/tests/ui/traits/new-solver/const-param-placeholder.rs index a83102a4cddae..c22bc54cfcab4 100644 --- a/tests/ui/traits/new-solver/const-param-placeholder.rs +++ b/tests/ui/traits/new-solver/const-param-placeholder.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // revisions: pass fail //[pass] check-pass diff --git a/tests/ui/traits/new-solver/coroutine.rs b/tests/ui/traits/new-solver/coroutine.rs index af16f70fb56c7..727e235685960 100644 --- a/tests/ui/traits/new-solver/coroutine.rs +++ b/tests/ui/traits/new-solver/coroutine.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // edition: 2021 // revisions: pass fail //[pass] check-pass diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs index 07c7d4fb29c70..947b52da7c204 100644 --- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs +++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Proving `W: Trait` instantiates `?0` with `(W, W)` and then // proves `W: Trait` and `W: Trait`, resulting in a coinductive cycle. diff --git a/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs b/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs index 0cd14f05c8d98..a3c07b98722d4 100644 --- a/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs +++ b/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(rustc_attrs)] // This test is incredibly subtle. At its core the goal is to get a coinductive cycle, diff --git a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs index 5617e45adf6ab..0f19bc2c59222 100644 --- a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs +++ b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(rustc_attrs)] // Test that having both an inductive and a coinductive cycle diff --git a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs index 2790639234060..c7e2e2d5e040b 100644 --- a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs +++ b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(rustc_attrs)] // Check that we correctly rerun the trait solver for heads of cycles, diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs index cda98789886c2..fdc7afea378fa 100644 --- a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs +++ b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(trivial_bounds, marker_trait_attr)] #![allow(trivial_bounds)] // This previously triggered a bug in the provisional cache. diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs index d4851eb694bef..d6d9762bb73dd 100644 --- a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs +++ b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #![feature(trivial_bounds, marker_trait_attr)] #![allow(trivial_bounds)] diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs b/tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs index 530e6d0ecf322..a32f7a13a03ac 100644 --- a/tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs +++ b/tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(rustc_attrs, marker_trait_attr)] #[rustc_coinductive] trait Trait {} diff --git a/tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.rs b/tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.rs index 062c6ae98d56b..efeb8d0231e25 100644 --- a/tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.rs +++ b/tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // This currently hangs if we do not erase constraints from // overflow. diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs index f06b98a79cfe3..f2f6e009d5413 100644 --- a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs +++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(rustc_attrs, trivial_bounds)] // We have to be careful here: diff --git a/tests/ui/traits/new-solver/cycles/leak-check-coinductive-cycle.rs b/tests/ui/traits/new-solver/cycles/leak-check-coinductive-cycle.rs index a6d3187267303..9ff362ec882f1 100644 --- a/tests/ui/traits/new-solver/cycles/leak-check-coinductive-cycle.rs +++ b/tests/ui/traits/new-solver/cycles/leak-check-coinductive-cycle.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #![feature(rustc_attrs)] diff --git a/tests/ui/traits/new-solver/cycles/provisional-result-done.rs b/tests/ui/traits/new-solver/cycles/provisional-result-done.rs index 589d34dd7abb1..0f3b84ce52005 100644 --- a/tests/ui/traits/new-solver/cycles/provisional-result-done.rs +++ b/tests/ui/traits/new-solver/cycles/provisional-result-done.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // This tests checks that we update results in the provisional cache when diff --git a/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs b/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs index 51f62bc2312b1..08f26686b2f20 100644 --- a/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs +++ b/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Foo { diff --git a/tests/ui/traits/new-solver/deduce-ty-from-object.rs b/tests/ui/traits/new-solver/deduce-ty-from-object.rs index 7398bce7b61cf..b627fd720e313 100644 --- a/tests/ui/traits/new-solver/deduce-ty-from-object.rs +++ b/tests/ui/traits/new-solver/deduce-ty-from-object.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver fn main() { let x: Box> = Box::new(std::iter::empty()); diff --git a/tests/ui/traits/new-solver/dedup-regions.rs b/tests/ui/traits/new-solver/dedup-regions.rs index f376f39a5a662..dd406333f2790 100644 --- a/tests/ui/traits/new-solver/dedup-regions.rs +++ b/tests/ui/traits/new-solver/dedup-regions.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass struct A(*mut ()); diff --git a/tests/ui/traits/new-solver/destruct.rs b/tests/ui/traits/new-solver/destruct.rs index 30d7777b78aa0..5093344e4b6b4 100644 --- a/tests/ui/traits/new-solver/destruct.rs +++ b/tests/ui/traits/new-solver/destruct.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #![feature(const_trait_impl)] diff --git a/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs b/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs index c2ac80459caac..da07869f3b63e 100644 --- a/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs +++ b/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass use std::fmt::Display; diff --git a/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs b/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs index e608250063c0b..9123871db9790 100644 --- a/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs +++ b/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Iter<'a, I: 'a>: Iterator {} diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs index b9798c79d5e1b..1e1ef8c23a2fd 100644 --- a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs +++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next-coherence +// compile-flags: -Znext-solver=coherence // Makes sure we don't ICE on associated const projection when the feature gate // is not enabled, since we should avoid encountering ICEs on stable if possible. diff --git a/tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs b/tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs index b241e3bf86521..a85098a95ad6c 100644 --- a/tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs +++ b/tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Eq<'a, 'b, T> {} diff --git a/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs b/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs index 19a6fa990ff14..fd1682cd61acb 100644 --- a/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs +++ b/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Test that we don't incorrectly leak unconstrained inference variables // if the projection contained an error. This caused an ICE in writeback. diff --git a/tests/ui/traits/new-solver/dont-remap-tait-substs.rs b/tests/ui/traits/new-solver/dont-remap-tait-substs.rs index 309bee8aa8c2c..b089f0df3c786 100644 --- a/tests/ui/traits/new-solver/dont-remap-tait-substs.rs +++ b/tests/ui/traits/new-solver/dont-remap-tait-substs.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // Makes sure we don't prepopulate the MIR typeck of `define` diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs index 08f14d7494d79..a1f38e69e53ef 100644 --- a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs +++ b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs @@ -1,5 +1,5 @@ // revisions: is_send not_send -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver //[is_send] check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs b/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs index af35a6195e007..bb1c24a001fb4 100644 --- a/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs +++ b/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // Test that selection prefers the builtin trait object impl for `Any` diff --git a/tests/ui/traits/new-solver/elaborate-item-bounds.rs b/tests/ui/traits/new-solver/elaborate-item-bounds.rs index 076aefcf8fc60..0f1f6c0445c1f 100644 --- a/tests/ui/traits/new-solver/elaborate-item-bounds.rs +++ b/tests/ui/traits/new-solver/elaborate-item-bounds.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Foo { diff --git a/tests/ui/traits/new-solver/equating-projection-cyclically.rs b/tests/ui/traits/new-solver/equating-projection-cyclically.rs index 845597e9ce198..e7c80cfd797d7 100644 --- a/tests/ui/traits/new-solver/equating-projection-cyclically.rs +++ b/tests/ui/traits/new-solver/equating-projection-cyclically.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver trait Test { type Assoc; diff --git a/tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs b/tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs index 29784c32a1b69..77bedc351e75d 100644 --- a/tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs +++ b/tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Trivial { diff --git a/tests/ui/traits/new-solver/float-canonical.rs b/tests/ui/traits/new-solver/float-canonical.rs index b8748cd433b18..90d75bacbf413 100644 --- a/tests/ui/traits/new-solver/float-canonical.rs +++ b/tests/ui/traits/new-solver/float-canonical.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass fn foo(x: f64) { diff --git a/tests/ui/traits/new-solver/fn-trait-closure.rs b/tests/ui/traits/new-solver/fn-trait-closure.rs index bd65737ee3989..cd2ae1f6fb2af 100644 --- a/tests/ui/traits/new-solver/fn-trait-closure.rs +++ b/tests/ui/traits/new-solver/fn-trait-closure.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass fn require_fn(_: impl Fn() -> i32) {} diff --git a/tests/ui/traits/new-solver/fn-trait.rs b/tests/ui/traits/new-solver/fn-trait.rs index 0a19e62655348..1e3d8a21c7ccf 100644 --- a/tests/ui/traits/new-solver/fn-trait.rs +++ b/tests/ui/traits/new-solver/fn-trait.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver fn require_fn(_: impl Fn() -> i32) {} diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs index b0b9b6bbd2063..4a70bd5f8154b 100644 --- a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs +++ b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // A minimization of an ambiguity when using typenum. See diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs index 94d645a98592c..70758e7deaace 100644 --- a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs +++ b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // known-bug: trait-system-refactor-initiative#60 // Generalizing a projection containing an inference variable diff --git a/tests/ui/traits/new-solver/generalize/occurs-check-nested-alias.rs b/tests/ui/traits/new-solver/generalize/occurs-check-nested-alias.rs index 02ac091c0a8a4..e51508d684f9c 100644 --- a/tests/ui/traits/new-solver/generalize/occurs-check-nested-alias.rs +++ b/tests/ui/traits/new-solver/generalize/occurs-check-nested-alias.rs @@ -3,7 +3,7 @@ // Currently always fails to generalize the outer alias, even if it // is treated as rigid by `alias-relate`. -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver //[next] known-bug: trait-system-refactor-initiative#8 #![crate_type = "lib"] #![allow(unused)] diff --git a/tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs b/tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs index c886aeeda3e46..b87210d7fb390 100644 --- a/tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs +++ b/tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Trait<'a> { diff --git a/tests/ui/traits/new-solver/int-var-alias-eq.rs b/tests/ui/traits/new-solver/int-var-alias-eq.rs index 790197e2d97f5..26ba7f8e511e1 100644 --- a/tests/ui/traits/new-solver/int-var-alias-eq.rs +++ b/tests/ui/traits/new-solver/int-var-alias-eq.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // HIR typeck ends up equating `::Output == ?0i`. // Want to make sure that we emit an alias-eq goal for this, diff --git a/tests/ui/traits/new-solver/int-var-is-send.rs b/tests/ui/traits/new-solver/int-var-is-send.rs index 083aa90e1f64e..d8b963f20084a 100644 --- a/tests/ui/traits/new-solver/int-var-is-send.rs +++ b/tests/ui/traits/new-solver/int-var-is-send.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass fn needs_send(_: impl Send) {} diff --git a/tests/ui/traits/new-solver/iter-filter-projection.rs b/tests/ui/traits/new-solver/iter-filter-projection.rs index 8fb62323aa5a7..f948831ad52c6 100644 --- a/tests/ui/traits/new-solver/iter-filter-projection.rs +++ b/tests/ui/traits/new-solver/iter-filter-projection.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass use std::{iter, slice}; diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-1.rs b/tests/ui/traits/new-solver/lazy-nested-obligations-1.rs index af00cbb3ba827..f9e73a93c271d 100644 --- a/tests/ui/traits/new-solver/lazy-nested-obligations-1.rs +++ b/tests/ui/traits/new-solver/lazy-nested-obligations-1.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Issue 94358 fn foo(_: C) diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs index 20f504928c703..b85f9d9736c5c 100644 --- a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs +++ b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass pub trait With { diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-3.rs b/tests/ui/traits/new-solver/lazy-nested-obligations-3.rs index baf3995724023..5fb4832dd08ca 100644 --- a/tests/ui/traits/new-solver/lazy-nested-obligations-3.rs +++ b/tests/ui/traits/new-solver/lazy-nested-obligations-3.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Issue 96750 use std::marker::PhantomData; diff --git a/tests/ui/traits/new-solver/member-constraints-in-root-universe.rs b/tests/ui/traits/new-solver/member-constraints-in-root-universe.rs index 97c4430586447..16e95e94ce5d3 100644 --- a/tests/ui/traits/new-solver/member-constraints-in-root-universe.rs +++ b/tests/ui/traits/new-solver/member-constraints-in-root-universe.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Trait { diff --git a/tests/ui/traits/new-solver/more-object-bound.rs b/tests/ui/traits/new-solver/more-object-bound.rs index bb730b18ef77b..8522f034d87df 100644 --- a/tests/ui/traits/new-solver/more-object-bound.rs +++ b/tests/ui/traits/new-solver/more-object-bound.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // From #80800 trait SuperTrait { diff --git a/tests/ui/traits/new-solver/nested-alias-bound.rs b/tests/ui/traits/new-solver/nested-alias-bound.rs index c365902dbe5e8..2e3de0ac66d05 100644 --- a/tests/ui/traits/new-solver/nested-alias-bound.rs +++ b/tests/ui/traits/new-solver/nested-alias-bound.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait A { diff --git a/tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs b/tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs index 92bad959095d2..94c6c2856806a 100644 --- a/tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs +++ b/tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Issue 96230 use std::fmt::Debug; diff --git a/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs b/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs index cc16cc871695a..b58db2be841cc 100644 --- a/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs +++ b/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // edition:2021 diff --git a/tests/ui/traits/new-solver/normalize-param-env-1.rs b/tests/ui/traits/new-solver/normalize-param-env-1.rs index b02a5d623307a..92d4051378b84 100644 --- a/tests/ui/traits/new-solver/normalize-param-env-1.rs +++ b/tests/ui/traits/new-solver/normalize-param-env-1.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Issue 108933 trait Add { diff --git a/tests/ui/traits/new-solver/normalize-param-env-2.rs b/tests/ui/traits/new-solver/normalize-param-env-2.rs index 7c2cebdd2002f..ce084651bfb6e 100644 --- a/tests/ui/traits/new-solver/normalize-param-env-2.rs +++ b/tests/ui/traits/new-solver/normalize-param-env-2.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Issue 92505 trait A { diff --git a/tests/ui/traits/new-solver/normalize-param-env-3.rs b/tests/ui/traits/new-solver/normalize-param-env-3.rs index ce2974b2a16f4..e15e1155a1a09 100644 --- a/tests/ui/traits/new-solver/normalize-param-env-3.rs +++ b/tests/ui/traits/new-solver/normalize-param-env-3.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Issue 100177 trait GenericTrait {} diff --git a/tests/ui/traits/new-solver/normalize-rcvr-for-inherent.rs b/tests/ui/traits/new-solver/normalize-rcvr-for-inherent.rs index d70534feb072f..d308b1695f532 100644 --- a/tests/ui/traits/new-solver/normalize-rcvr-for-inherent.rs +++ b/tests/ui/traits/new-solver/normalize-rcvr-for-inherent.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // Verify that we can assemble inherent impl candidates on a possibly diff --git a/tests/ui/traits/new-solver/normalize-unsize-rhs.rs b/tests/ui/traits/new-solver/normalize-unsize-rhs.rs index 1bb5c9b4111a7..6ca82d1b872c7 100644 --- a/tests/ui/traits/new-solver/normalize-unsize-rhs.rs +++ b/tests/ui/traits/new-solver/normalize-unsize-rhs.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait A {} diff --git a/tests/ui/traits/new-solver/normalized-const-built-in-op.rs b/tests/ui/traits/new-solver/normalized-const-built-in-op.rs index 2443e51781391..0fffe7b4369a8 100644 --- a/tests/ui/traits/new-solver/normalized-const-built-in-op.rs +++ b/tests/ui/traits/new-solver/normalized-const-built-in-op.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass const fn foo() { diff --git a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs index 46343241b4528..7dc87daccd98b 100644 --- a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs +++ b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs @@ -1,5 +1,5 @@ // [no_self_infer] check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // revisions: self_infer no_self_infer // checks that the new solver is smart enough to infer `?0 = U` when solving: @@ -7,7 +7,7 @@ // with `normalizes-to( as Trait>::Assoc, u8)` in the paramenv even when // there is a separate `Vec: Trait` bound in the paramenv. // -// FIXME(-Ztrait-solver=next) +// FIXME(-Znext-solver) // This could also compile for `normalizes-to(::Assoc, u8)` but // we currently immediately consider a goal ambiguous if the self type is an // inference variable. diff --git a/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs b/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs index d02dada72c916..6e709d9ae8ecc 100644 --- a/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs +++ b/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // ignore-test trait Trait { diff --git a/tests/ui/traits/new-solver/object-unsafety.rs b/tests/ui/traits/new-solver/object-unsafety.rs index da843c91478bb..8aae7217398cd 100644 --- a/tests/ui/traits/new-solver/object-unsafety.rs +++ b/tests/ui/traits/new-solver/object-unsafety.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver trait Setup { type From: Copy; @@ -17,7 +17,7 @@ pub fn copy_any(t: &T) -> T { //~| ERROR the type ` as Setup>::From` is not well-formed //~| ERROR the size for values of type ` as Setup>::From` cannot be known at compilation time - // FIXME(-Ztrait-solver=next): These error messages are horrible and some of them + // FIXME(-Znext-solver): These error messages are horrible and some of them // are even simple fallout from previous error. } diff --git a/tests/ui/traits/new-solver/opportunistic-region-resolve.rs b/tests/ui/traits/new-solver/opportunistic-region-resolve.rs index 2610789cd485a..d852332d0e59e 100644 --- a/tests/ui/traits/new-solver/opportunistic-region-resolve.rs +++ b/tests/ui/traits/new-solver/opportunistic-region-resolve.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #![feature(rustc_attrs)] diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs index 3d2e70a639f50..a465bcecfe076 100644 --- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs +++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver trait Trait {} diff --git a/tests/ui/traits/new-solver/overflow/global-cache.rs b/tests/ui/traits/new-solver/overflow/global-cache.rs index adc03da04a850..fe4032ca62eaf 100644 --- a/tests/ui/traits/new-solver/overflow/global-cache.rs +++ b/tests/ui/traits/new-solver/overflow/global-cache.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Check that we consider the reached depth of global cache // entries when detecting overflow. We would otherwise be unstable diff --git a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs index 539c9614e8288..52a17a1428133 100644 --- a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs +++ b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs @@ -2,7 +2,7 @@ //~| ERROR overflow evaluating the requirement `Self: Trait` // This is a non-regression test for issue #115351, where a recursion limit of 0 caused an ICE. -// compile-flags: -Ztrait-solver=next --crate-type=lib +// compile-flags: -Znext-solver --crate-type=lib // check-fail #![recursion_limit = "0"] diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.rs b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.rs index 3e10b2b595eb8..327ef865de9c6 100644 --- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.rs +++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver trait Foo1 { type Assoc1; diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs index 36ef856a46632..f45d208e6667f 100644 --- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs +++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver trait Foo { type Assoc; diff --git a/tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs b/tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs index bdf999ec5dd00..f67b073c53c5c 100644 --- a/tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs +++ b/tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Foo { diff --git a/tests/ui/traits/new-solver/param-discr-kind.rs b/tests/ui/traits/new-solver/param-discr-kind.rs index e319ddea106bc..c66b0b9f45f8a 100644 --- a/tests/ui/traits/new-solver/param-discr-kind.rs +++ b/tests/ui/traits/new-solver/param-discr-kind.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass fn foo(x: T) { diff --git a/tests/ui/traits/new-solver/pointee.rs b/tests/ui/traits/new-solver/pointee.rs index 93c0542ace4bf..a56df549a8d36 100644 --- a/tests/ui/traits/new-solver/pointee.rs +++ b/tests/ui/traits/new-solver/pointee.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #![feature(ptr_metadata)] diff --git a/tests/ui/traits/new-solver/pointer-like.rs b/tests/ui/traits/new-solver/pointer-like.rs index 98630176976f5..f6cc718c6e218 100644 --- a/tests/ui/traits/new-solver/pointer-like.rs +++ b/tests/ui/traits/new-solver/pointer-like.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(pointer_like_trait)] diff --git a/tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs b/tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs index 6f8164f3a40f0..a47f819f1928f 100644 --- a/tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs +++ b/tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Foo {} diff --git a/tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs b/tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs index 909b33ec3d5a5..f8c0223e1876e 100644 --- a/tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs +++ b/tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Foo<'a> {} diff --git a/tests/ui/traits/new-solver/projection-discr-kind.rs b/tests/ui/traits/new-solver/projection-discr-kind.rs index 20296b287b17e..bf557f8633a04 100644 --- a/tests/ui/traits/new-solver/projection-discr-kind.rs +++ b/tests/ui/traits/new-solver/projection-discr-kind.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Check that `::Discriminant` doesn't normalize // to itself and cause overflow/ambiguity. diff --git a/tests/ui/traits/new-solver/projection/param-env-trait-candidate-1.rs b/tests/ui/traits/new-solver/projection/param-env-trait-candidate-1.rs index e36d574efe264..b337c06737421 100644 --- a/tests/ui/traits/new-solver/projection/param-env-trait-candidate-1.rs +++ b/tests/ui/traits/new-solver/projection/param-env-trait-candidate-1.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // See https://github.com/rust-lang/trait-system-refactor-initiative/issues/1 // a minimization of a pattern in core. diff --git a/tests/ui/traits/new-solver/projection/param-env-trait-candidate-2.rs b/tests/ui/traits/new-solver/projection/param-env-trait-candidate-2.rs index c8050997a1d2a..db8dc1eb9bed2 100644 --- a/tests/ui/traits/new-solver/projection/param-env-trait-candidate-2.rs +++ b/tests/ui/traits/new-solver/projection/param-env-trait-candidate-2.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // See https://github.com/rust-lang/trait-system-refactor-initiative/issues/1, // a minimization of a pattern in core. diff --git a/tests/ui/traits/new-solver/slice-match-byte-lit.rs b/tests/ui/traits/new-solver/slice-match-byte-lit.rs index 4f848062595da..1edc9f1e8e95e 100644 --- a/tests/ui/traits/new-solver/slice-match-byte-lit.rs +++ b/tests/ui/traits/new-solver/slice-match-byte-lit.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass fn test(s: &[u8]) { diff --git a/tests/ui/traits/new-solver/specialization-transmute.rs b/tests/ui/traits/new-solver/specialization-transmute.rs index fac7d76f8cf5f..58b62f52dfdb2 100644 --- a/tests/ui/traits/new-solver/specialization-transmute.rs +++ b/tests/ui/traits/new-solver/specialization-transmute.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(specialization)] //~^ WARN the feature `specialization` is incomplete diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.rs b/tests/ui/traits/new-solver/specialization-unconstrained.rs index 7fd753109be2d..950fb1512bc2e 100644 --- a/tests/ui/traits/new-solver/specialization-unconstrained.rs +++ b/tests/ui/traits/new-solver/specialization-unconstrained.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver #![feature(specialization)] //~^ WARN the feature `specialization` is incomplete diff --git a/tests/ui/traits/new-solver/stall-num-var-auto-trait.rs b/tests/ui/traits/new-solver/stall-num-var-auto-trait.rs index 0539c3a4292fe..f5bf985cdb2dd 100644 --- a/tests/ui/traits/new-solver/stall-num-var-auto-trait.rs +++ b/tests/ui/traits/new-solver/stall-num-var-auto-trait.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // revisions: fallback constrain //[constrain] check-pass diff --git a/tests/ui/traits/new-solver/structural-resolve-field.rs b/tests/ui/traits/new-solver/structural-resolve-field.rs index 01899c9ad645f..b247e237534a6 100644 --- a/tests/ui/traits/new-solver/structural-resolve-field.rs +++ b/tests/ui/traits/new-solver/structural-resolve-field.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #[derive(Default)] diff --git a/tests/ui/traits/new-solver/tait-eq-proj-2.rs b/tests/ui/traits/new-solver/tait-eq-proj-2.rs index 77ea8bc246e64..7873ba0d7bac7 100644 --- a/tests/ui/traits/new-solver/tait-eq-proj-2.rs +++ b/tests/ui/traits/new-solver/tait-eq-proj-2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/traits/new-solver/tait-eq-proj.rs b/tests/ui/traits/new-solver/tait-eq-proj.rs index 01ef2ec953aeb..871e8e1e9fcba 100644 --- a/tests/ui/traits/new-solver/tait-eq-proj.rs +++ b/tests/ui/traits/new-solver/tait-eq-proj.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/traits/new-solver/tait-eq-tait.rs b/tests/ui/traits/new-solver/tait-eq-tait.rs index 70d9dc0eaa8ae..2629a124c3a9b 100644 --- a/tests/ui/traits/new-solver/tait-eq-tait.rs +++ b/tests/ui/traits/new-solver/tait-eq-tait.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // Not exactly sure if this is the inference behavior we *want*, diff --git a/tests/ui/traits/new-solver/temporary-ambiguity.rs b/tests/ui/traits/new-solver/temporary-ambiguity.rs index c6c11a1a1de18..6102de7e446d6 100644 --- a/tests/ui/traits/new-solver/temporary-ambiguity.rs +++ b/tests/ui/traits/new-solver/temporary-ambiguity.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass // Checks that we don't explode when we assemble >1 candidate for a goal. diff --git a/tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs b/tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs index 79114b93b78df..2a482f7466865 100644 --- a/tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs +++ b/tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver pub trait A {} pub trait B: A {} diff --git a/tests/ui/traits/new-solver/try-example.rs b/tests/ui/traits/new-solver/try-example.rs index e826f3a00599b..92b0b59788104 100644 --- a/tests/ui/traits/new-solver/try-example.rs +++ b/tests/ui/traits/new-solver/try-example.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver use std::error::Error; diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs index 3c7fc0d813d0d..d25e372b5d896 100644 --- a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs +++ b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // When we're solving `::Assoc = i32`, we actually first solve // `::Assoc = ?1t`, then unify `?1t` with `i32`. That goal diff --git a/tests/ui/traits/new-solver/unevaluated-const-impl-trait-ref.rs b/tests/ui/traits/new-solver/unevaluated-const-impl-trait-ref.rs index 26c595bc97428..77a169d48deac 100644 --- a/tests/ui/traits/new-solver/unevaluated-const-impl-trait-ref.rs +++ b/tests/ui/traits/new-solver/unevaluated-const-impl-trait-ref.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // revisions: works fails //[works] check-pass diff --git a/tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs b/tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs index bcfc747ebb170..f66bf0b87ec8b 100644 --- a/tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs +++ b/tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass struct Foo(*mut ()); diff --git a/tests/ui/traits/new-solver/unsize-although-ambiguous.rs b/tests/ui/traits/new-solver/unsize-although-ambiguous.rs index 431988a5fffa9..8217701b9f8e0 100644 --- a/tests/ui/traits/new-solver/unsize-although-ambiguous.rs +++ b/tests/ui/traits/new-solver/unsize-although-ambiguous.rs @@ -1,5 +1,5 @@ // check-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver use std::fmt::Display; diff --git a/tests/ui/traits/new-solver/unsize-good.rs b/tests/ui/traits/new-solver/unsize-good.rs index 87ed9cfd10ae4..04ebe66f21c27 100644 --- a/tests/ui/traits/new-solver/unsize-good.rs +++ b/tests/ui/traits/new-solver/unsize-good.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass #![feature(unsized_tuple_coercion)] diff --git a/tests/ui/traits/new-solver/upcast-right-substs.rs b/tests/ui/traits/new-solver/upcast-right-substs.rs index 97eb189d5c730..5e4d958c89591 100644 --- a/tests/ui/traits/new-solver/upcast-right-substs.rs +++ b/tests/ui/traits/new-solver/upcast-right-substs.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // check-pass trait Foo: Bar + Bar {} diff --git a/tests/ui/traits/new-solver/upcast-wrong-substs.rs b/tests/ui/traits/new-solver/upcast-wrong-substs.rs index 3376f9787d36c..0cd253007fc54 100644 --- a/tests/ui/traits/new-solver/upcast-wrong-substs.rs +++ b/tests/ui/traits/new-solver/upcast-wrong-substs.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver trait Foo: Bar + Bar {} diff --git a/tests/ui/traits/new-solver/winnow-specializing-impls.rs b/tests/ui/traits/new-solver/winnow-specializing-impls.rs index 06f64de74030c..d70a915961161 100644 --- a/tests/ui/traits/new-solver/winnow-specializing-impls.rs +++ b/tests/ui/traits/new-solver/winnow-specializing-impls.rs @@ -1,5 +1,5 @@ // build-pass -// compile-flags: -Ztrait-solver=next +// compile-flags: -Znext-solver // Tests that the specializing impl `<() as Foo>` holds during codegen. diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.rs b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs index 9a8a5ced2e250..996cd295dc4c1 100644 --- a/tests/ui/traits/non-lifetime-via-dyn-builtin.rs +++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // check-pass #![feature(non_lifetime_binders)] diff --git a/tests/ui/traits/reservation-impl/coherence-conflict.rs b/tests/ui/traits/reservation-impl/coherence-conflict.rs index 6bbd90f94dc39..cdea162d64a47 100644 --- a/tests/ui/traits/reservation-impl/coherence-conflict.rs +++ b/tests/ui/traits/reservation-impl/coherence-conflict.rs @@ -1,6 +1,6 @@ // check that reservation impls are accounted for in negative reasoning. // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(rustc_attrs)] trait MyTrait {} diff --git a/tests/ui/traits/reservation-impl/no-use.rs b/tests/ui/traits/reservation-impl/no-use.rs index 864f1791fd0a7..10aad3605ea3b 100644 --- a/tests/ui/traits/reservation-impl/no-use.rs +++ b/tests/ui/traits/reservation-impl/no-use.rs @@ -1,6 +1,6 @@ // check that reservation impls can't be used as normal impls in positive reasoning. // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(rustc_attrs)] trait MyTrait { fn foo(&self); } diff --git a/tests/ui/traits/reservation-impl/non-lattice-ok.rs b/tests/ui/traits/reservation-impl/non-lattice-ok.rs index 7787904d9b22d..9a3c2b4f991ee 100644 --- a/tests/ui/traits/reservation-impl/non-lattice-ok.rs +++ b/tests/ui/traits/reservation-impl/non-lattice-ok.rs @@ -34,7 +34,7 @@ // check that reservation impls can't be used as normal impls in positive reasoning. // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(rustc_attrs, never_type)] diff --git a/tests/ui/traits/reservation-impl/ok.rs b/tests/ui/traits/reservation-impl/ok.rs index 8ff6645a2b3d3..2d945f6adebd8 100644 --- a/tests/ui/traits/reservation-impl/ok.rs +++ b/tests/ui/traits/reservation-impl/ok.rs @@ -4,7 +4,7 @@ // but still. // revisions: old next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(rustc_attrs)] diff --git a/tests/ui/traits/trait-upcasting/fewer-associated.rs b/tests/ui/traits/trait-upcasting/fewer-associated.rs index 937818aac58e8..e7ca6fa5208ec 100644 --- a/tests/ui/traits/trait-upcasting/fewer-associated.rs +++ b/tests/ui/traits/trait-upcasting/fewer-associated.rs @@ -1,7 +1,7 @@ // check-pass // issue: 114035 // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver trait A: B { type Assoc; diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs index 4b730dab7ccaf..5a493fd48b3f9 100644 --- a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs +++ b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver trait Super { type Assoc; diff --git a/tests/ui/traits/trait-upcasting/issue-11515.rs b/tests/ui/traits/trait-upcasting/issue-11515.rs index 66ab1ce260a45..a1edb53ec37b5 100644 --- a/tests/ui/traits/trait-upcasting/issue-11515.rs +++ b/tests/ui/traits/trait-upcasting/issue-11515.rs @@ -1,6 +1,6 @@ // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver struct Test { func: Box, diff --git a/tests/ui/traits/trait-upcasting/normalization.rs b/tests/ui/traits/trait-upcasting/normalization.rs index c57640e7e3467..b594969483a8c 100644 --- a/tests/ui/traits/trait-upcasting/normalization.rs +++ b/tests/ui/traits/trait-upcasting/normalization.rs @@ -1,7 +1,7 @@ // check-pass // issue: 114113 // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver trait Mirror { type Assoc; diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-1.rs b/tests/ui/traits/trait-upcasting/type-checking-test-1.rs index 3b6ec3b65e75a..7d3deeeaa6173 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-1.rs +++ b/tests/ui/traits/trait-upcasting/type-checking-test-1.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver trait Foo: Bar + Bar {} trait Bar { diff --git a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs index 9981d43606293..f8cf793e4a49c 100644 --- a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs +++ b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs @@ -1,6 +1,6 @@ // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver struct Wrapper(T); diff --git a/tests/ui/transmutability/primitives/bool-mut.rs b/tests/ui/transmutability/primitives/bool-mut.rs index 49dbe90e4b8b3..6ee168d1a718c 100644 --- a/tests/ui/transmutability/primitives/bool-mut.rs +++ b/tests/ui/transmutability/primitives/bool-mut.rs @@ -1,5 +1,5 @@ // check-fail -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/primitives/bool.rs b/tests/ui/transmutability/primitives/bool.rs index 654e7b47edecc..ac4024b7f333f 100644 --- a/tests/ui/transmutability/primitives/bool.rs +++ b/tests/ui/transmutability/primitives/bool.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/primitives/numbers.rs b/tests/ui/transmutability/primitives/numbers.rs index e980e91ed06a6..1afc7d677ee5b 100644 --- a/tests/ui/transmutability/primitives/numbers.rs +++ b/tests/ui/transmutability/primitives/numbers.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![crate_type = "lib"] #![feature(transmutability)] diff --git a/tests/ui/transmutability/primitives/unit.rs b/tests/ui/transmutability/primitives/unit.rs index 12eac175106e6..5ea96cf8ba7a9 100644 --- a/tests/ui/transmutability/primitives/unit.rs +++ b/tests/ui/transmutability/primitives/unit.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver //! The unit type, `()`, should be one byte. diff --git a/tests/ui/type-alias-impl-trait/assoc-type-const.rs b/tests/ui/type-alias-impl-trait/assoc-type-const.rs index 6632a3450e5d6..e385fe045fc90 100644 --- a/tests/ui/type-alias-impl-trait/assoc-type-const.rs +++ b/tests/ui/type-alias-impl-trait/assoc-type-const.rs @@ -3,7 +3,7 @@ // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(impl_trait_in_assoc_type)] trait UnwrapItemsExt<'a, const C: usize> { diff --git a/tests/ui/type-alias-impl-trait/cross_inference.rs b/tests/ui/type-alias-impl-trait/cross_inference.rs index 5eaf0ddda994a..c5ef75fee61a6 100644 --- a/tests/ui/type-alias-impl-trait/cross_inference.rs +++ b/tests/ui/type-alias-impl-trait/cross_inference.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs b/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs index 386b77d4d1618..af1c18bbb59c8 100644 --- a/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs +++ b/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs @@ -2,7 +2,7 @@ // Tests that we don't ICE when we have a trait impl on a TAIT. // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/type-alias-impl-trait/issue-78450.rs b/tests/ui/type-alias-impl-trait/issue-78450.rs index 236e9f4e88cec..c51dfb6782b7a 100644 --- a/tests/ui/type-alias-impl-trait/issue-78450.rs +++ b/tests/ui/type-alias-impl-trait/issue-78450.rs @@ -1,6 +1,6 @@ // check-pass // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(impl_trait_in_assoc_type)] diff --git a/tests/ui/type-alias-impl-trait/normalize-hidden-types.rs b/tests/ui/type-alias-impl-trait/normalize-hidden-types.rs index 8d80546444ada..371cac6da7cd9 100644 --- a/tests/ui/type-alias-impl-trait/normalize-hidden-types.rs +++ b/tests/ui/type-alias-impl-trait/normalize-hidden-types.rs @@ -1,7 +1,7 @@ // Regression test for #112691 // // revisions: current next -// [next] compile-flags: -Ztrait-solver=next +// [next] compile-flags: -Znext-solver // [next] check-pass // [current]: known-bug: #112691 diff --git a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs index 0f0002f7797e4..222841f346715 100644 --- a/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs +++ b/tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs @@ -6,7 +6,7 @@ //! have a situation where the RPIT gets constrained outside its anchor. // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver //[next] check-pass //[current] known-bug: #108498 diff --git a/tests/ui/type-alias-impl-trait/wf-in-associated-type.rs b/tests/ui/type-alias-impl-trait/wf-in-associated-type.rs index b966ca4bff0e7..22e2b0efd1f34 100644 --- a/tests/ui/type-alias-impl-trait/wf-in-associated-type.rs +++ b/tests/ui/type-alias-impl-trait/wf-in-associated-type.rs @@ -2,7 +2,7 @@ // // revisions: pass pass_next fail // [pass] check-pass -// [pass_next] compile-flags: -Ztrait-solver=next +// [pass_next] compile-flags: -Znext-solver // [pass_next] check-pass // [fail] check-fail diff --git a/tests/ui/unsized/issue-71659.rs b/tests/ui/unsized/issue-71659.rs index db5c2e205aa13..65a867caf8f70 100644 --- a/tests/ui/unsized/issue-71659.rs +++ b/tests/ui/unsized/issue-71659.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver #![feature(unsize)] diff --git a/tests/ui/unsized/issue-75899.rs b/tests/ui/unsized/issue-75899.rs index 7194310329157..56c8a72bfcc01 100644 --- a/tests/ui/unsized/issue-75899.rs +++ b/tests/ui/unsized/issue-75899.rs @@ -1,5 +1,5 @@ // revisions: current next -//[next] compile-flags: -Ztrait-solver=next +//[next] compile-flags: -Znext-solver // check-pass trait Trait {} From 094707087171bb698d47aba807cd7d78c58e63ab Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 14 Dec 2023 14:47:41 +0100 Subject: [PATCH 26/40] consistently use "next solver" instead of "new solver" --- compiler/rustc_borrowck/src/type_check/mod.rs | 4 ++-- compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs | 2 +- compiler/rustc_trait_selection/src/solve/search_graph.rs | 6 +++--- .../src/traits/query/type_op/ascribe_user_type.rs | 2 +- .../rustc_trait_selection/src/traits/query/type_op/eq.rs | 2 +- .../src/traits/query/type_op/implied_outlives_bounds.rs | 2 +- .../rustc_trait_selection/src/traits/query/type_op/mod.rs | 4 ++-- .../src/traits/query/type_op/normalize.rs | 2 +- .../src/traits/query/type_op/outlives.rs | 2 +- .../src/traits/query/type_op/prove_predicate.rs | 2 +- .../src/traits/query/type_op/subtype.rs | 2 +- .../{new-solver => next-solver}/alias-bound-preference.rs | 0 .../{new-solver => next-solver}/alias-bound-unsound.rs | 0 .../{new-solver => next-solver}/alias-bound-unsound.stderr | 0 .../alias-eq-in-canonical-response.rs | 0 .../alias-relate/deeply-nested-no-hang.rs | 0 .../alias-relate/opaque-hidden-ty-is-rigid-alias.rs | 0 tests/ui/traits/{new-solver => next-solver}/alias-sub.rs | 0 .../alias_eq_cant_be_furthur_normalized.rs | 0 .../alias_eq_dont_use_normalizes_to_if_substs_eq.rs | 0 .../traits/{new-solver => next-solver}/alias_eq_simple.rs | 0 .../alias_eq_substs_eq_not_intercrate.rs | 0 .../alias_eq_substs_eq_not_intercrate.stderr | 0 .../ui/traits/{new-solver => next-solver}/array-default.rs | 0 .../assembly/assemble-normalizing-self-ty-impl-ambiguity.rs | 0 .../assembly/runaway-impl-candidate-selection.rs | 0 .../assembly/runaway-impl-candidate-selection.stderr | 0 .../ui/traits/{new-solver => next-solver}/async.fail.stderr | 0 tests/ui/traits/{new-solver => next-solver}/async.rs | 0 .../auto-with-drop_tracking_mir.fail.stderr | 0 .../auto-with-drop_tracking_mir.rs | 0 .../ui/traits/{new-solver => next-solver}/borrowck-error.rs | 0 .../{new-solver => next-solver}/borrowck-error.stderr | 0 .../builtin-fn-must-return-sized.rs | 0 .../builtin-fn-must-return-sized.stderr | 0 .../canonical-int-var-eq-in-response.rs | 0 .../canonical-ty-var-eq-in-response.rs | 0 .../{new-solver => next-solver}/canonicalize-effect-var.rs | 0 .../cast-checks-handling-projections.rs | 0 .../closure-inference-guidance.rs | 0 .../{new-solver => next-solver}/closure-substs-ambiguity.rs | 0 .../{new-solver => next-solver}/coherence/issue-102048.rs | 0 .../coherence/issue-102048.stderr | 0 .../coherence/trait_ref_is_knowable-norm-overflow.rs | 0 .../coherence/trait_ref_is_knowable-norm-overflow.stderr | 0 .../coherence/trait_ref_is_knowable-normalization-1.rs | 0 .../coherence/trait_ref_is_knowable-normalization-2.rs | 0 .../coherence/trait_ref_is_knowable-normalization-3.rs | 0 .../const-param-placeholder.fail.stderr | 0 .../{new-solver => next-solver}/const-param-placeholder.rs | 0 .../{new-solver => next-solver}/coroutine.fail.stderr | 0 tests/ui/traits/{new-solver => next-solver}/coroutine.rs | 0 .../cycles/coinduction/fixpoint-exponential-growth.rs | 0 .../cycles/coinduction/fixpoint-exponential-growth.stderr | 0 .../cycles/coinduction/incompleteness-unstable-result.rs | 0 .../coinduction/incompleteness-unstable-result.stderr | 0 .../cycles/double-cycle-inductive-coinductive.rs | 0 .../cycles/double-cycle-inductive-coinductive.stderr | 0 .../cycles/fixpoint-rerun-all-cycle-heads.rs | 0 .../cycles/fixpoint-rerun-all-cycle-heads.stderr | 0 .../cycles/inductive-cycle-but-err.rs | 0 .../cycles/inductive-cycle-but-err.stderr | 0 .../cycles/inductive-cycle-but-ok.rs | 0 .../inductive-cycle-discarded-coinductive-constraints.rs | 0 .../cycles/inductive-fixpoint-hang.rs | 0 .../cycles/inductive-fixpoint-hang.stderr | 0 .../cycles/inductive-not-on-stack.rs | 0 .../cycles/inductive-not-on-stack.stderr | 0 .../cycles/leak-check-coinductive-cycle.rs | 0 .../cycles/provisional-result-done.rs | 0 .../deduce-closure-signature-after-normalization.rs | 0 .../{new-solver => next-solver}/deduce-ty-from-object.rs | 0 .../ui/traits/{new-solver => next-solver}/dedup-regions.rs | 0 tests/ui/traits/{new-solver => next-solver}/destruct.rs | 0 .../{new-solver => next-solver}/dont-coerce-infer-to-dyn.rs | 0 .../dont-elaborate-for-projections.rs | 0 .../dont-ice-on-assoc-projection.rs | 0 .../dont-ice-on-assoc-projection.stderr | 0 .../dont-loop-fulfill-on-region-constraints.rs | 0 .../dont-normalize-proj-with-error.rs | 0 .../dont-normalize-proj-with-error.stderr | 0 .../{new-solver => next-solver}/dont-remap-tait-substs.rs | 0 .../dont-type_of-tait-in-defining-scope.not_send.stderr | 0 .../dont-type_of-tait-in-defining-scope.rs | 0 .../{new-solver => next-solver}/dyn-any-dont-prefer-impl.rs | 0 .../{new-solver => next-solver}/elaborate-item-bounds.rs | 0 .../equating-projection-cyclically.rs | 0 .../escaping-bound-vars-in-writeback-normalization.rs | 0 .../traits/{new-solver => next-solver}/float-canonical.rs | 0 .../traits/{new-solver => next-solver}/fn-trait-closure.rs | 0 tests/ui/traits/{new-solver => next-solver}/fn-trait.rs | 0 tests/ui/traits/{new-solver => next-solver}/fn-trait.stderr | 0 .../generalize/generalize-proj-new-universe-index-1.rs | 0 .../generalize/generalize-proj-new-universe-index-2.rs | 0 .../generalize/generalize-proj-new-universe-index-2.stderr | 0 .../generalize/occurs-check-nested-alias.next.stderr | 0 .../generalize/occurs-check-nested-alias.rs | 0 .../{new-solver => next-solver}/higher-ranked-dyn-bounds.rs | 0 .../traits/{new-solver => next-solver}/int-var-alias-eq.rs | 0 .../traits/{new-solver => next-solver}/int-var-is-send.rs | 0 .../{new-solver => next-solver}/iter-filter-projection.rs | 0 .../lazy-nested-obligations-1.rs | 0 .../lazy-nested-obligations-2.rs | 0 .../lazy-nested-obligations-3.rs | 0 .../member-constraints-in-root-universe.rs | 0 .../traits/{new-solver => next-solver}/more-object-bound.rs | 0 .../{new-solver => next-solver}/more-object-bound.stderr | 0 .../negative-coherence-bounds.rs | 0 .../negative-coherence-bounds.stderr | 0 .../{new-solver => next-solver}/nested-alias-bound.rs | 0 .../nested-obligations-with-bound-vars-gat.rs | 0 .../normalize-async-closure-in-trait.rs | 0 .../{new-solver => next-solver}/normalize-param-env-1.rs | 0 .../{new-solver => next-solver}/normalize-param-env-2.rs | 0 .../{new-solver => next-solver}/normalize-param-env-3.rs | 0 .../normalize-rcvr-for-inherent.rs | 0 .../{new-solver => next-solver}/normalize-unsize-rhs.rs | 0 .../normalized-const-built-in-op.rs | 0 .../normalizes_to_ignores_unnormalizable_candidate.rs | 0 ...es_to_ignores_unnormalizable_candidate.self_infer.stderr | 0 .../object-soundness-requires-generalization.rs | 0 .../traits/{new-solver => next-solver}/object-unsafety.rs | 0 .../{new-solver => next-solver}/object-unsafety.stderr | 0 .../opportunistic-region-resolve.rs | 0 .../overflow/exponential-trait-goals.rs | 0 .../overflow/exponential-trait-goals.stderr | 0 .../{new-solver => next-solver}/overflow/global-cache.rs | 0 .../overflow/global-cache.stderr | 0 .../overflow/recursion-limit-zero-issue-115351.rs | 0 .../overflow/recursion-limit-zero-issue-115351.stderr | 0 .../overflow/recursive-self-normalization-2.rs | 0 .../overflow/recursive-self-normalization-2.stderr | 0 .../overflow/recursive-self-normalization.rs | 0 .../overflow/recursive-self-normalization.stderr | 0 .../param-candidate-doesnt-shadow-project.rs | 0 .../traits/{new-solver => next-solver}/param-discr-kind.rs | 0 tests/ui/traits/{new-solver => next-solver}/pointee.rs | 0 tests/ui/traits/{new-solver => next-solver}/pointer-like.rs | 0 .../traits/{new-solver => next-solver}/pointer-like.stderr | 0 .../prefer-candidate-no-constraints.rs | 0 .../prefer-param-env-on-ambiguity.rs | 0 .../{new-solver => next-solver}/projection-discr-kind.rs | 0 .../projection-discr-kind.stderr | 0 .../{new-solver => next-solver}/slice-match-byte-lit.rs | 0 .../{new-solver => next-solver}/specialization-transmute.rs | 0 .../specialization-transmute.stderr | 0 .../specialization-unconstrained.rs | 0 .../specialization-unconstrained.stderr | 0 .../stall-num-var-auto-trait.fallback.stderr | 0 .../{new-solver => next-solver}/stall-num-var-auto-trait.rs | 0 .../{new-solver => next-solver}/structural-resolve-field.rs | 0 .../ui/traits/{new-solver => next-solver}/tait-eq-proj-2.rs | 2 +- tests/ui/traits/{new-solver => next-solver}/tait-eq-proj.rs | 0 tests/ui/traits/{new-solver => next-solver}/tait-eq-tait.rs | 0 .../{new-solver => next-solver}/temporary-ambiguity.rs | 0 .../trait-upcast-lhs-needs-normalization.rs | 0 tests/ui/traits/{new-solver => next-solver}/try-example.rs | 0 .../two-projection-param-candidates-are-ambiguous.rs | 0 .../two-projection-param-candidates-are-ambiguous.stderr | 0 .../unevaluated-const-impl-trait-ref.fails.stderr | 0 .../unevaluated-const-impl-trait-ref.rs | 0 .../{new-solver => next-solver}/unsafe-auto-trait-impl.rs | 0 .../unsize-although-ambiguous.rs | 0 tests/ui/traits/{new-solver => next-solver}/unsize-good.rs | 0 .../{new-solver => next-solver}/upcast-right-substs.rs | 0 .../{new-solver => next-solver}/upcast-wrong-substs.rs | 0 .../{new-solver => next-solver}/upcast-wrong-substs.stderr | 0 .../winnow-specializing-impls.rs | 0 168 files changed, 16 insertions(+), 16 deletions(-) rename tests/ui/traits/{new-solver => next-solver}/alias-bound-preference.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias-bound-unsound.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias-bound-unsound.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/alias-eq-in-canonical-response.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias-relate/deeply-nested-no-hang.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias-relate/opaque-hidden-ty-is-rigid-alias.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias-sub.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias_eq_cant_be_furthur_normalized.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias_eq_dont_use_normalizes_to_if_substs_eq.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias_eq_simple.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias_eq_substs_eq_not_intercrate.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/alias_eq_substs_eq_not_intercrate.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/array-default.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/assembly/runaway-impl-candidate-selection.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/assembly/runaway-impl-candidate-selection.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/async.fail.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/async.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/auto-with-drop_tracking_mir.fail.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/auto-with-drop_tracking_mir.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/borrowck-error.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/borrowck-error.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/builtin-fn-must-return-sized.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/builtin-fn-must-return-sized.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/canonical-int-var-eq-in-response.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/canonical-ty-var-eq-in-response.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/canonicalize-effect-var.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cast-checks-handling-projections.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/closure-inference-guidance.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/closure-substs-ambiguity.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/coherence/issue-102048.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/coherence/issue-102048.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/coherence/trait_ref_is_knowable-norm-overflow.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/coherence/trait_ref_is_knowable-norm-overflow.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/coherence/trait_ref_is_knowable-normalization-1.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/coherence/trait_ref_is_knowable-normalization-2.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/coherence/trait_ref_is_knowable-normalization-3.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/const-param-placeholder.fail.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/const-param-placeholder.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/coroutine.fail.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/coroutine.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/coinduction/fixpoint-exponential-growth.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/coinduction/fixpoint-exponential-growth.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/coinduction/incompleteness-unstable-result.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/coinduction/incompleteness-unstable-result.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/double-cycle-inductive-coinductive.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/double-cycle-inductive-coinductive.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/fixpoint-rerun-all-cycle-heads.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/fixpoint-rerun-all-cycle-heads.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/inductive-cycle-but-err.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/inductive-cycle-but-err.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/inductive-cycle-but-ok.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/inductive-cycle-discarded-coinductive-constraints.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/inductive-fixpoint-hang.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/inductive-fixpoint-hang.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/inductive-not-on-stack.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/inductive-not-on-stack.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/leak-check-coinductive-cycle.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/cycles/provisional-result-done.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/deduce-closure-signature-after-normalization.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/deduce-ty-from-object.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/dedup-regions.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/destruct.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-coerce-infer-to-dyn.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-elaborate-for-projections.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-ice-on-assoc-projection.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-ice-on-assoc-projection.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-loop-fulfill-on-region-constraints.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-normalize-proj-with-error.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-normalize-proj-with-error.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-remap-tait-substs.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-type_of-tait-in-defining-scope.not_send.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/dont-type_of-tait-in-defining-scope.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/dyn-any-dont-prefer-impl.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/elaborate-item-bounds.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/equating-projection-cyclically.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/escaping-bound-vars-in-writeback-normalization.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/float-canonical.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/fn-trait-closure.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/fn-trait.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/fn-trait.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/generalize/generalize-proj-new-universe-index-1.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/generalize/generalize-proj-new-universe-index-2.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/generalize/generalize-proj-new-universe-index-2.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/generalize/occurs-check-nested-alias.next.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/generalize/occurs-check-nested-alias.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/higher-ranked-dyn-bounds.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/int-var-alias-eq.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/int-var-is-send.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/iter-filter-projection.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/lazy-nested-obligations-1.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/lazy-nested-obligations-2.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/lazy-nested-obligations-3.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/member-constraints-in-root-universe.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/more-object-bound.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/more-object-bound.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/negative-coherence-bounds.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/negative-coherence-bounds.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/nested-alias-bound.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/nested-obligations-with-bound-vars-gat.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/normalize-async-closure-in-trait.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/normalize-param-env-1.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/normalize-param-env-2.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/normalize-param-env-3.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/normalize-rcvr-for-inherent.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/normalize-unsize-rhs.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/normalized-const-built-in-op.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/normalizes_to_ignores_unnormalizable_candidate.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/object-soundness-requires-generalization.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/object-unsafety.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/object-unsafety.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/opportunistic-region-resolve.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/exponential-trait-goals.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/exponential-trait-goals.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/global-cache.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/global-cache.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/recursion-limit-zero-issue-115351.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/recursion-limit-zero-issue-115351.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/recursive-self-normalization-2.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/recursive-self-normalization-2.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/recursive-self-normalization.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/overflow/recursive-self-normalization.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/param-candidate-doesnt-shadow-project.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/param-discr-kind.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/pointee.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/pointer-like.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/pointer-like.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/prefer-candidate-no-constraints.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/prefer-param-env-on-ambiguity.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/projection-discr-kind.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/projection-discr-kind.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/slice-match-byte-lit.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/specialization-transmute.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/specialization-transmute.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/specialization-unconstrained.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/specialization-unconstrained.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/stall-num-var-auto-trait.fallback.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/stall-num-var-auto-trait.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/structural-resolve-field.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/tait-eq-proj-2.rs (87%) rename tests/ui/traits/{new-solver => next-solver}/tait-eq-proj.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/tait-eq-tait.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/temporary-ambiguity.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/trait-upcast-lhs-needs-normalization.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/try-example.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/two-projection-param-candidates-are-ambiguous.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/two-projection-param-candidates-are-ambiguous.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/unevaluated-const-impl-trait-ref.fails.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/unevaluated-const-impl-trait-ref.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/unsafe-auto-trait-impl.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/unsize-although-ambiguous.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/unsize-good.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/upcast-right-substs.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/upcast-wrong-substs.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/upcast-wrong-substs.stderr (100%) rename tests/ui/traits/{new-solver => next-solver}/winnow-specializing-impls.rs (100%) diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 891fc0bfd020a..98c21693cf0a0 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -1006,13 +1006,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { // FIXME(-Znext-solver): A bit dubious that we're only registering // predefined opaques in the typeck root. if infcx.next_trait_solver() && !infcx.tcx.is_typeck_child(body.source.def_id()) { - checker.register_predefined_opaques_in_new_solver(); + checker.register_predefined_opaques_for_next_solver(); } checker } - pub(super) fn register_predefined_opaques_in_new_solver(&mut self) { + pub(super) fn register_predefined_opaques_for_next_solver(&mut self) { // OK to use the identity arguments for each opaque type key, since // we remap opaques from HIR typeck back to their definition params. let opaques: Vec<_> = self diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs index 8cdd8a2861296..cafb858794afb 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs @@ -378,7 +378,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> { // // This assert was removed as it did not hold for goals constraining // an inference variable to a recursive alias, e.g. in - // tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs. + // tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs. // // Once we have decided on how to handle trait-system-refactor-initiative#75, // we should re-add an assert here. diff --git a/compiler/rustc_trait_selection/src/solve/search_graph.rs b/compiler/rustc_trait_selection/src/solve/search_graph.rs index 71adebffc1513..2a08b80e02aa9 100644 --- a/compiler/rustc_trait_selection/src/solve/search_graph.rs +++ b/compiler/rustc_trait_selection/src/solve/search_graph.rs @@ -38,7 +38,7 @@ struct StackEntry<'tcx> { /// If we were to use that result when later trying to prove another cycle /// participant, we can end up with unstable query results. /// - /// See tests/ui/new-solver/coinduction/incompleteness-unstable-result.rs for + /// See tests/ui/next-solver/coinduction/incompleteness-unstable-result.rs for /// an example of where this is needed. cycle_participants: FxHashSet>, } @@ -237,7 +237,7 @@ impl<'tcx> SearchGraph<'tcx> { // in unstable results due to incompleteness. // // However, a test for this would be an even more complex version of - // tests/ui/traits/new-solver/coinduction/incompleteness-unstable-result.rs. + // tests/ui/traits/next-solver/coinduction/incompleteness-unstable-result.rs. // I did not bother to write such a test and we have no regression test // for this. It would be good to have such a test :) #[allow(rustc::potential_query_instability)] @@ -248,7 +248,7 @@ impl<'tcx> SearchGraph<'tcx> { // until we reach a fixpoint. It is not enough to simply retry the // `root` goal of this cycle. // - // See tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs + // See tests/ui/traits/next-solver/cycles/fixpoint-rerun-all-cycle-heads.rs // for an example. self.stack[stack_depth].has_been_used = true; return if let Some(result) = self.stack[stack_depth].provisional_result { diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs index 302b6016e5ea6..152ceeee86995 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs @@ -26,7 +26,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> { tcx.type_op_ascribe_user_type(canonicalized) } - fn perform_locally_in_new_solver( + fn perform_locally_with_next_solver( ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result { diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/eq.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/eq.rs index f65893088066e..57e649f3e43d0 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/eq.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/eq.rs @@ -23,7 +23,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> { tcx.type_op_eq(canonicalized) } - fn perform_locally_in_new_solver( + fn perform_locally_with_next_solver( ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result { diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs index f9b8ea32d8926..10528696b2d70 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs @@ -50,7 +50,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> { tcx.implied_outlives_bounds(canonicalized) } - fn perform_locally_in_new_solver( + fn perform_locally_with_next_solver( ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result { diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs index cd09aaff2d97d..272f1a54f819b 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs @@ -89,7 +89,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable> + 't /// make sure to feed it predefined opaque types and the defining anchor /// and that would require duplicating all of the tcx queries. Instead, /// just perform these ops locally. - fn perform_locally_in_new_solver( + fn perform_locally_with_next_solver( ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result; @@ -149,7 +149,7 @@ where if infcx.next_trait_solver() { return Ok(scrape_region_constraints( infcx, - |ocx| QueryTypeOp::perform_locally_in_new_solver(ocx, self), + |ocx| QueryTypeOp::perform_locally_with_next_solver(ocx, self), "query type op", span, )? diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs index ddf00ecfb65b5..3b33f6e6144a1 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs @@ -25,7 +25,7 @@ where T::type_op_method(tcx, canonicalized) } - fn perform_locally_in_new_solver( + fn perform_locally_with_next_solver( ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result { diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs index f2c1243f931b8..07587e3741181 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs @@ -42,7 +42,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> { tcx.dropck_outlives(canonicalized) } - fn perform_locally_in_new_solver( + fn perform_locally_with_next_solver( ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result { diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs index 789ef647246e9..e21ede47f6d60 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs @@ -40,7 +40,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> { tcx.type_op_prove_predicate(canonicalized) } - fn perform_locally_in_new_solver( + fn perform_locally_with_next_solver( ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result { diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/subtype.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/subtype.rs index 10976d5cd7162..ae11b0825bd0e 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/subtype.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/subtype.rs @@ -20,7 +20,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Subtype<'tcx> { tcx.type_op_subtype(canonicalized) } - fn perform_locally_in_new_solver( + fn perform_locally_with_next_solver( ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result { diff --git a/tests/ui/traits/new-solver/alias-bound-preference.rs b/tests/ui/traits/next-solver/alias-bound-preference.rs similarity index 100% rename from tests/ui/traits/new-solver/alias-bound-preference.rs rename to tests/ui/traits/next-solver/alias-bound-preference.rs diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.rs b/tests/ui/traits/next-solver/alias-bound-unsound.rs similarity index 100% rename from tests/ui/traits/new-solver/alias-bound-unsound.rs rename to tests/ui/traits/next-solver/alias-bound-unsound.rs diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.stderr b/tests/ui/traits/next-solver/alias-bound-unsound.stderr similarity index 100% rename from tests/ui/traits/new-solver/alias-bound-unsound.stderr rename to tests/ui/traits/next-solver/alias-bound-unsound.stderr diff --git a/tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs b/tests/ui/traits/next-solver/alias-eq-in-canonical-response.rs similarity index 100% rename from tests/ui/traits/new-solver/alias-eq-in-canonical-response.rs rename to tests/ui/traits/next-solver/alias-eq-in-canonical-response.rs diff --git a/tests/ui/traits/new-solver/alias-relate/deeply-nested-no-hang.rs b/tests/ui/traits/next-solver/alias-relate/deeply-nested-no-hang.rs similarity index 100% rename from tests/ui/traits/new-solver/alias-relate/deeply-nested-no-hang.rs rename to tests/ui/traits/next-solver/alias-relate/deeply-nested-no-hang.rs diff --git a/tests/ui/traits/new-solver/alias-relate/opaque-hidden-ty-is-rigid-alias.rs b/tests/ui/traits/next-solver/alias-relate/opaque-hidden-ty-is-rigid-alias.rs similarity index 100% rename from tests/ui/traits/new-solver/alias-relate/opaque-hidden-ty-is-rigid-alias.rs rename to tests/ui/traits/next-solver/alias-relate/opaque-hidden-ty-is-rigid-alias.rs diff --git a/tests/ui/traits/new-solver/alias-sub.rs b/tests/ui/traits/next-solver/alias-sub.rs similarity index 100% rename from tests/ui/traits/new-solver/alias-sub.rs rename to tests/ui/traits/next-solver/alias-sub.rs diff --git a/tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs b/tests/ui/traits/next-solver/alias_eq_cant_be_furthur_normalized.rs similarity index 100% rename from tests/ui/traits/new-solver/alias_eq_cant_be_furthur_normalized.rs rename to tests/ui/traits/next-solver/alias_eq_cant_be_furthur_normalized.rs diff --git a/tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs b/tests/ui/traits/next-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs similarity index 100% rename from tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs rename to tests/ui/traits/next-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.rs diff --git a/tests/ui/traits/new-solver/alias_eq_simple.rs b/tests/ui/traits/next-solver/alias_eq_simple.rs similarity index 100% rename from tests/ui/traits/new-solver/alias_eq_simple.rs rename to tests/ui/traits/next-solver/alias_eq_simple.rs diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs b/tests/ui/traits/next-solver/alias_eq_substs_eq_not_intercrate.rs similarity index 100% rename from tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs rename to tests/ui/traits/next-solver/alias_eq_substs_eq_not_intercrate.rs diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr b/tests/ui/traits/next-solver/alias_eq_substs_eq_not_intercrate.stderr similarity index 100% rename from tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr rename to tests/ui/traits/next-solver/alias_eq_substs_eq_not_intercrate.stderr diff --git a/tests/ui/traits/new-solver/array-default.rs b/tests/ui/traits/next-solver/array-default.rs similarity index 100% rename from tests/ui/traits/new-solver/array-default.rs rename to tests/ui/traits/next-solver/array-default.rs diff --git a/tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs b/tests/ui/traits/next-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs similarity index 100% rename from tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs rename to tests/ui/traits/next-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs diff --git a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.rs b/tests/ui/traits/next-solver/assembly/runaway-impl-candidate-selection.rs similarity index 100% rename from tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.rs rename to tests/ui/traits/next-solver/assembly/runaway-impl-candidate-selection.rs diff --git a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr b/tests/ui/traits/next-solver/assembly/runaway-impl-candidate-selection.stderr similarity index 100% rename from tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr rename to tests/ui/traits/next-solver/assembly/runaway-impl-candidate-selection.stderr diff --git a/tests/ui/traits/new-solver/async.fail.stderr b/tests/ui/traits/next-solver/async.fail.stderr similarity index 100% rename from tests/ui/traits/new-solver/async.fail.stderr rename to tests/ui/traits/next-solver/async.fail.stderr diff --git a/tests/ui/traits/new-solver/async.rs b/tests/ui/traits/next-solver/async.rs similarity index 100% rename from tests/ui/traits/new-solver/async.rs rename to tests/ui/traits/next-solver/async.rs diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr b/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr similarity index 100% rename from tests/ui/traits/new-solver/auto-with-drop_tracking_mir.fail.stderr rename to tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.rs similarity index 100% rename from tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs rename to tests/ui/traits/next-solver/auto-with-drop_tracking_mir.rs diff --git a/tests/ui/traits/new-solver/borrowck-error.rs b/tests/ui/traits/next-solver/borrowck-error.rs similarity index 100% rename from tests/ui/traits/new-solver/borrowck-error.rs rename to tests/ui/traits/next-solver/borrowck-error.rs diff --git a/tests/ui/traits/new-solver/borrowck-error.stderr b/tests/ui/traits/next-solver/borrowck-error.stderr similarity index 100% rename from tests/ui/traits/new-solver/borrowck-error.stderr rename to tests/ui/traits/next-solver/borrowck-error.stderr diff --git a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs b/tests/ui/traits/next-solver/builtin-fn-must-return-sized.rs similarity index 100% rename from tests/ui/traits/new-solver/builtin-fn-must-return-sized.rs rename to tests/ui/traits/next-solver/builtin-fn-must-return-sized.rs diff --git a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr b/tests/ui/traits/next-solver/builtin-fn-must-return-sized.stderr similarity index 100% rename from tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr rename to tests/ui/traits/next-solver/builtin-fn-must-return-sized.stderr diff --git a/tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs b/tests/ui/traits/next-solver/canonical-int-var-eq-in-response.rs similarity index 100% rename from tests/ui/traits/new-solver/canonical-int-var-eq-in-response.rs rename to tests/ui/traits/next-solver/canonical-int-var-eq-in-response.rs diff --git a/tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs b/tests/ui/traits/next-solver/canonical-ty-var-eq-in-response.rs similarity index 100% rename from tests/ui/traits/new-solver/canonical-ty-var-eq-in-response.rs rename to tests/ui/traits/next-solver/canonical-ty-var-eq-in-response.rs diff --git a/tests/ui/traits/new-solver/canonicalize-effect-var.rs b/tests/ui/traits/next-solver/canonicalize-effect-var.rs similarity index 100% rename from tests/ui/traits/new-solver/canonicalize-effect-var.rs rename to tests/ui/traits/next-solver/canonicalize-effect-var.rs diff --git a/tests/ui/traits/new-solver/cast-checks-handling-projections.rs b/tests/ui/traits/next-solver/cast-checks-handling-projections.rs similarity index 100% rename from tests/ui/traits/new-solver/cast-checks-handling-projections.rs rename to tests/ui/traits/next-solver/cast-checks-handling-projections.rs diff --git a/tests/ui/traits/new-solver/closure-inference-guidance.rs b/tests/ui/traits/next-solver/closure-inference-guidance.rs similarity index 100% rename from tests/ui/traits/new-solver/closure-inference-guidance.rs rename to tests/ui/traits/next-solver/closure-inference-guidance.rs diff --git a/tests/ui/traits/new-solver/closure-substs-ambiguity.rs b/tests/ui/traits/next-solver/closure-substs-ambiguity.rs similarity index 100% rename from tests/ui/traits/new-solver/closure-substs-ambiguity.rs rename to tests/ui/traits/next-solver/closure-substs-ambiguity.rs diff --git a/tests/ui/traits/new-solver/coherence/issue-102048.rs b/tests/ui/traits/next-solver/coherence/issue-102048.rs similarity index 100% rename from tests/ui/traits/new-solver/coherence/issue-102048.rs rename to tests/ui/traits/next-solver/coherence/issue-102048.rs diff --git a/tests/ui/traits/new-solver/coherence/issue-102048.stderr b/tests/ui/traits/next-solver/coherence/issue-102048.stderr similarity index 100% rename from tests/ui/traits/new-solver/coherence/issue-102048.stderr rename to tests/ui/traits/next-solver/coherence/issue-102048.stderr diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.rs similarity index 100% rename from tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs rename to tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.rs diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr similarity index 100% rename from tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr rename to tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-normalization-1.rs similarity index 100% rename from tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs rename to tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-normalization-1.rs diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-normalization-2.rs similarity index 100% rename from tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs rename to tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-normalization-2.rs diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-normalization-3.rs similarity index 100% rename from tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs rename to tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-normalization-3.rs diff --git a/tests/ui/traits/new-solver/const-param-placeholder.fail.stderr b/tests/ui/traits/next-solver/const-param-placeholder.fail.stderr similarity index 100% rename from tests/ui/traits/new-solver/const-param-placeholder.fail.stderr rename to tests/ui/traits/next-solver/const-param-placeholder.fail.stderr diff --git a/tests/ui/traits/new-solver/const-param-placeholder.rs b/tests/ui/traits/next-solver/const-param-placeholder.rs similarity index 100% rename from tests/ui/traits/new-solver/const-param-placeholder.rs rename to tests/ui/traits/next-solver/const-param-placeholder.rs diff --git a/tests/ui/traits/new-solver/coroutine.fail.stderr b/tests/ui/traits/next-solver/coroutine.fail.stderr similarity index 100% rename from tests/ui/traits/new-solver/coroutine.fail.stderr rename to tests/ui/traits/next-solver/coroutine.fail.stderr diff --git a/tests/ui/traits/new-solver/coroutine.rs b/tests/ui/traits/next-solver/coroutine.rs similarity index 100% rename from tests/ui/traits/new-solver/coroutine.rs rename to tests/ui/traits/next-solver/coroutine.rs diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs b/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs rename to tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.rs diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr similarity index 100% rename from tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr rename to tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr diff --git a/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs rename to tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs diff --git a/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.stderr b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr similarity index 100% rename from tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.stderr rename to tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr diff --git a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs b/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs rename to tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.rs diff --git a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr b/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr similarity index 100% rename from tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr rename to tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr diff --git a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs b/tests/ui/traits/next-solver/cycles/fixpoint-rerun-all-cycle-heads.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs rename to tests/ui/traits/next-solver/cycles/fixpoint-rerun-all-cycle-heads.rs diff --git a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr b/tests/ui/traits/next-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr similarity index 100% rename from tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr rename to tests/ui/traits/next-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs b/tests/ui/traits/next-solver/cycles/inductive-cycle-but-err.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs rename to tests/ui/traits/next-solver/cycles/inductive-cycle-but-err.rs diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.stderr b/tests/ui/traits/next-solver/cycles/inductive-cycle-but-err.stderr similarity index 100% rename from tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.stderr rename to tests/ui/traits/next-solver/cycles/inductive-cycle-but-err.stderr diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs b/tests/ui/traits/next-solver/cycles/inductive-cycle-but-ok.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs rename to tests/ui/traits/next-solver/cycles/inductive-cycle-but-ok.rs diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs b/tests/ui/traits/next-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs rename to tests/ui/traits/next-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs diff --git a/tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.rs b/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.rs rename to tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.rs diff --git a/tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.stderr b/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr similarity index 100% rename from tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.stderr rename to tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs rename to tests/ui/traits/next-solver/cycles/inductive-not-on-stack.rs diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr similarity index 100% rename from tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr rename to tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr diff --git a/tests/ui/traits/new-solver/cycles/leak-check-coinductive-cycle.rs b/tests/ui/traits/next-solver/cycles/leak-check-coinductive-cycle.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/leak-check-coinductive-cycle.rs rename to tests/ui/traits/next-solver/cycles/leak-check-coinductive-cycle.rs diff --git a/tests/ui/traits/new-solver/cycles/provisional-result-done.rs b/tests/ui/traits/next-solver/cycles/provisional-result-done.rs similarity index 100% rename from tests/ui/traits/new-solver/cycles/provisional-result-done.rs rename to tests/ui/traits/next-solver/cycles/provisional-result-done.rs diff --git a/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs b/tests/ui/traits/next-solver/deduce-closure-signature-after-normalization.rs similarity index 100% rename from tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs rename to tests/ui/traits/next-solver/deduce-closure-signature-after-normalization.rs diff --git a/tests/ui/traits/new-solver/deduce-ty-from-object.rs b/tests/ui/traits/next-solver/deduce-ty-from-object.rs similarity index 100% rename from tests/ui/traits/new-solver/deduce-ty-from-object.rs rename to tests/ui/traits/next-solver/deduce-ty-from-object.rs diff --git a/tests/ui/traits/new-solver/dedup-regions.rs b/tests/ui/traits/next-solver/dedup-regions.rs similarity index 100% rename from tests/ui/traits/new-solver/dedup-regions.rs rename to tests/ui/traits/next-solver/dedup-regions.rs diff --git a/tests/ui/traits/new-solver/destruct.rs b/tests/ui/traits/next-solver/destruct.rs similarity index 100% rename from tests/ui/traits/new-solver/destruct.rs rename to tests/ui/traits/next-solver/destruct.rs diff --git a/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs b/tests/ui/traits/next-solver/dont-coerce-infer-to-dyn.rs similarity index 100% rename from tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs rename to tests/ui/traits/next-solver/dont-coerce-infer-to-dyn.rs diff --git a/tests/ui/traits/new-solver/dont-elaborate-for-projections.rs b/tests/ui/traits/next-solver/dont-elaborate-for-projections.rs similarity index 100% rename from tests/ui/traits/new-solver/dont-elaborate-for-projections.rs rename to tests/ui/traits/next-solver/dont-elaborate-for-projections.rs diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs b/tests/ui/traits/next-solver/dont-ice-on-assoc-projection.rs similarity index 100% rename from tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs rename to tests/ui/traits/next-solver/dont-ice-on-assoc-projection.rs diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr b/tests/ui/traits/next-solver/dont-ice-on-assoc-projection.stderr similarity index 100% rename from tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr rename to tests/ui/traits/next-solver/dont-ice-on-assoc-projection.stderr diff --git a/tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs b/tests/ui/traits/next-solver/dont-loop-fulfill-on-region-constraints.rs similarity index 100% rename from tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs rename to tests/ui/traits/next-solver/dont-loop-fulfill-on-region-constraints.rs diff --git a/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs b/tests/ui/traits/next-solver/dont-normalize-proj-with-error.rs similarity index 100% rename from tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs rename to tests/ui/traits/next-solver/dont-normalize-proj-with-error.rs diff --git a/tests/ui/traits/new-solver/dont-normalize-proj-with-error.stderr b/tests/ui/traits/next-solver/dont-normalize-proj-with-error.stderr similarity index 100% rename from tests/ui/traits/new-solver/dont-normalize-proj-with-error.stderr rename to tests/ui/traits/next-solver/dont-normalize-proj-with-error.stderr diff --git a/tests/ui/traits/new-solver/dont-remap-tait-substs.rs b/tests/ui/traits/next-solver/dont-remap-tait-substs.rs similarity index 100% rename from tests/ui/traits/new-solver/dont-remap-tait-substs.rs rename to tests/ui/traits/next-solver/dont-remap-tait-substs.rs diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.not_send.stderr similarity index 100% rename from tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr rename to tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.not_send.stderr diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs b/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.rs similarity index 100% rename from tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs rename to tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.rs diff --git a/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs b/tests/ui/traits/next-solver/dyn-any-dont-prefer-impl.rs similarity index 100% rename from tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs rename to tests/ui/traits/next-solver/dyn-any-dont-prefer-impl.rs diff --git a/tests/ui/traits/new-solver/elaborate-item-bounds.rs b/tests/ui/traits/next-solver/elaborate-item-bounds.rs similarity index 100% rename from tests/ui/traits/new-solver/elaborate-item-bounds.rs rename to tests/ui/traits/next-solver/elaborate-item-bounds.rs diff --git a/tests/ui/traits/new-solver/equating-projection-cyclically.rs b/tests/ui/traits/next-solver/equating-projection-cyclically.rs similarity index 100% rename from tests/ui/traits/new-solver/equating-projection-cyclically.rs rename to tests/ui/traits/next-solver/equating-projection-cyclically.rs diff --git a/tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs b/tests/ui/traits/next-solver/escaping-bound-vars-in-writeback-normalization.rs similarity index 100% rename from tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs rename to tests/ui/traits/next-solver/escaping-bound-vars-in-writeback-normalization.rs diff --git a/tests/ui/traits/new-solver/float-canonical.rs b/tests/ui/traits/next-solver/float-canonical.rs similarity index 100% rename from tests/ui/traits/new-solver/float-canonical.rs rename to tests/ui/traits/next-solver/float-canonical.rs diff --git a/tests/ui/traits/new-solver/fn-trait-closure.rs b/tests/ui/traits/next-solver/fn-trait-closure.rs similarity index 100% rename from tests/ui/traits/new-solver/fn-trait-closure.rs rename to tests/ui/traits/next-solver/fn-trait-closure.rs diff --git a/tests/ui/traits/new-solver/fn-trait.rs b/tests/ui/traits/next-solver/fn-trait.rs similarity index 100% rename from tests/ui/traits/new-solver/fn-trait.rs rename to tests/ui/traits/next-solver/fn-trait.rs diff --git a/tests/ui/traits/new-solver/fn-trait.stderr b/tests/ui/traits/next-solver/fn-trait.stderr similarity index 100% rename from tests/ui/traits/new-solver/fn-trait.stderr rename to tests/ui/traits/next-solver/fn-trait.stderr diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs b/tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-1.rs similarity index 100% rename from tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs rename to tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-1.rs diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs b/tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.rs similarity index 100% rename from tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs rename to tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.rs diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr b/tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.stderr similarity index 100% rename from tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr rename to tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.stderr diff --git a/tests/ui/traits/new-solver/generalize/occurs-check-nested-alias.next.stderr b/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.next.stderr similarity index 100% rename from tests/ui/traits/new-solver/generalize/occurs-check-nested-alias.next.stderr rename to tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.next.stderr diff --git a/tests/ui/traits/new-solver/generalize/occurs-check-nested-alias.rs b/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs similarity index 100% rename from tests/ui/traits/new-solver/generalize/occurs-check-nested-alias.rs rename to tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs diff --git a/tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs b/tests/ui/traits/next-solver/higher-ranked-dyn-bounds.rs similarity index 100% rename from tests/ui/traits/new-solver/higher-ranked-dyn-bounds.rs rename to tests/ui/traits/next-solver/higher-ranked-dyn-bounds.rs diff --git a/tests/ui/traits/new-solver/int-var-alias-eq.rs b/tests/ui/traits/next-solver/int-var-alias-eq.rs similarity index 100% rename from tests/ui/traits/new-solver/int-var-alias-eq.rs rename to tests/ui/traits/next-solver/int-var-alias-eq.rs diff --git a/tests/ui/traits/new-solver/int-var-is-send.rs b/tests/ui/traits/next-solver/int-var-is-send.rs similarity index 100% rename from tests/ui/traits/new-solver/int-var-is-send.rs rename to tests/ui/traits/next-solver/int-var-is-send.rs diff --git a/tests/ui/traits/new-solver/iter-filter-projection.rs b/tests/ui/traits/next-solver/iter-filter-projection.rs similarity index 100% rename from tests/ui/traits/new-solver/iter-filter-projection.rs rename to tests/ui/traits/next-solver/iter-filter-projection.rs diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-1.rs b/tests/ui/traits/next-solver/lazy-nested-obligations-1.rs similarity index 100% rename from tests/ui/traits/new-solver/lazy-nested-obligations-1.rs rename to tests/ui/traits/next-solver/lazy-nested-obligations-1.rs diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs b/tests/ui/traits/next-solver/lazy-nested-obligations-2.rs similarity index 100% rename from tests/ui/traits/new-solver/lazy-nested-obligations-2.rs rename to tests/ui/traits/next-solver/lazy-nested-obligations-2.rs diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-3.rs b/tests/ui/traits/next-solver/lazy-nested-obligations-3.rs similarity index 100% rename from tests/ui/traits/new-solver/lazy-nested-obligations-3.rs rename to tests/ui/traits/next-solver/lazy-nested-obligations-3.rs diff --git a/tests/ui/traits/new-solver/member-constraints-in-root-universe.rs b/tests/ui/traits/next-solver/member-constraints-in-root-universe.rs similarity index 100% rename from tests/ui/traits/new-solver/member-constraints-in-root-universe.rs rename to tests/ui/traits/next-solver/member-constraints-in-root-universe.rs diff --git a/tests/ui/traits/new-solver/more-object-bound.rs b/tests/ui/traits/next-solver/more-object-bound.rs similarity index 100% rename from tests/ui/traits/new-solver/more-object-bound.rs rename to tests/ui/traits/next-solver/more-object-bound.rs diff --git a/tests/ui/traits/new-solver/more-object-bound.stderr b/tests/ui/traits/next-solver/more-object-bound.stderr similarity index 100% rename from tests/ui/traits/new-solver/more-object-bound.stderr rename to tests/ui/traits/next-solver/more-object-bound.stderr diff --git a/tests/ui/traits/new-solver/negative-coherence-bounds.rs b/tests/ui/traits/next-solver/negative-coherence-bounds.rs similarity index 100% rename from tests/ui/traits/new-solver/negative-coherence-bounds.rs rename to tests/ui/traits/next-solver/negative-coherence-bounds.rs diff --git a/tests/ui/traits/new-solver/negative-coherence-bounds.stderr b/tests/ui/traits/next-solver/negative-coherence-bounds.stderr similarity index 100% rename from tests/ui/traits/new-solver/negative-coherence-bounds.stderr rename to tests/ui/traits/next-solver/negative-coherence-bounds.stderr diff --git a/tests/ui/traits/new-solver/nested-alias-bound.rs b/tests/ui/traits/next-solver/nested-alias-bound.rs similarity index 100% rename from tests/ui/traits/new-solver/nested-alias-bound.rs rename to tests/ui/traits/next-solver/nested-alias-bound.rs diff --git a/tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs b/tests/ui/traits/next-solver/nested-obligations-with-bound-vars-gat.rs similarity index 100% rename from tests/ui/traits/new-solver/nested-obligations-with-bound-vars-gat.rs rename to tests/ui/traits/next-solver/nested-obligations-with-bound-vars-gat.rs diff --git a/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs b/tests/ui/traits/next-solver/normalize-async-closure-in-trait.rs similarity index 100% rename from tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs rename to tests/ui/traits/next-solver/normalize-async-closure-in-trait.rs diff --git a/tests/ui/traits/new-solver/normalize-param-env-1.rs b/tests/ui/traits/next-solver/normalize-param-env-1.rs similarity index 100% rename from tests/ui/traits/new-solver/normalize-param-env-1.rs rename to tests/ui/traits/next-solver/normalize-param-env-1.rs diff --git a/tests/ui/traits/new-solver/normalize-param-env-2.rs b/tests/ui/traits/next-solver/normalize-param-env-2.rs similarity index 100% rename from tests/ui/traits/new-solver/normalize-param-env-2.rs rename to tests/ui/traits/next-solver/normalize-param-env-2.rs diff --git a/tests/ui/traits/new-solver/normalize-param-env-3.rs b/tests/ui/traits/next-solver/normalize-param-env-3.rs similarity index 100% rename from tests/ui/traits/new-solver/normalize-param-env-3.rs rename to tests/ui/traits/next-solver/normalize-param-env-3.rs diff --git a/tests/ui/traits/new-solver/normalize-rcvr-for-inherent.rs b/tests/ui/traits/next-solver/normalize-rcvr-for-inherent.rs similarity index 100% rename from tests/ui/traits/new-solver/normalize-rcvr-for-inherent.rs rename to tests/ui/traits/next-solver/normalize-rcvr-for-inherent.rs diff --git a/tests/ui/traits/new-solver/normalize-unsize-rhs.rs b/tests/ui/traits/next-solver/normalize-unsize-rhs.rs similarity index 100% rename from tests/ui/traits/new-solver/normalize-unsize-rhs.rs rename to tests/ui/traits/next-solver/normalize-unsize-rhs.rs diff --git a/tests/ui/traits/new-solver/normalized-const-built-in-op.rs b/tests/ui/traits/next-solver/normalized-const-built-in-op.rs similarity index 100% rename from tests/ui/traits/new-solver/normalized-const-built-in-op.rs rename to tests/ui/traits/next-solver/normalized-const-built-in-op.rs diff --git a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs b/tests/ui/traits/next-solver/normalizes_to_ignores_unnormalizable_candidate.rs similarity index 100% rename from tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.rs rename to tests/ui/traits/next-solver/normalizes_to_ignores_unnormalizable_candidate.rs diff --git a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr b/tests/ui/traits/next-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr similarity index 100% rename from tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr rename to tests/ui/traits/next-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr diff --git a/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs b/tests/ui/traits/next-solver/object-soundness-requires-generalization.rs similarity index 100% rename from tests/ui/traits/new-solver/object-soundness-requires-generalization.rs rename to tests/ui/traits/next-solver/object-soundness-requires-generalization.rs diff --git a/tests/ui/traits/new-solver/object-unsafety.rs b/tests/ui/traits/next-solver/object-unsafety.rs similarity index 100% rename from tests/ui/traits/new-solver/object-unsafety.rs rename to tests/ui/traits/next-solver/object-unsafety.rs diff --git a/tests/ui/traits/new-solver/object-unsafety.stderr b/tests/ui/traits/next-solver/object-unsafety.stderr similarity index 100% rename from tests/ui/traits/new-solver/object-unsafety.stderr rename to tests/ui/traits/next-solver/object-unsafety.stderr diff --git a/tests/ui/traits/new-solver/opportunistic-region-resolve.rs b/tests/ui/traits/next-solver/opportunistic-region-resolve.rs similarity index 100% rename from tests/ui/traits/new-solver/opportunistic-region-resolve.rs rename to tests/ui/traits/next-solver/opportunistic-region-resolve.rs diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs b/tests/ui/traits/next-solver/overflow/exponential-trait-goals.rs similarity index 100% rename from tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs rename to tests/ui/traits/next-solver/overflow/exponential-trait-goals.rs diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr similarity index 100% rename from tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr rename to tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr diff --git a/tests/ui/traits/new-solver/overflow/global-cache.rs b/tests/ui/traits/next-solver/overflow/global-cache.rs similarity index 100% rename from tests/ui/traits/new-solver/overflow/global-cache.rs rename to tests/ui/traits/next-solver/overflow/global-cache.rs diff --git a/tests/ui/traits/new-solver/overflow/global-cache.stderr b/tests/ui/traits/next-solver/overflow/global-cache.stderr similarity index 100% rename from tests/ui/traits/new-solver/overflow/global-cache.stderr rename to tests/ui/traits/next-solver/overflow/global-cache.stderr diff --git a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs b/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs similarity index 100% rename from tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs rename to tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs diff --git a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr b/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.stderr similarity index 100% rename from tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr rename to tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.stderr diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.rs b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs similarity index 100% rename from tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.rs rename to tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr similarity index 100% rename from tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr rename to tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs b/tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs similarity index 100% rename from tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs rename to tests/ui/traits/next-solver/overflow/recursive-self-normalization.rs diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr b/tests/ui/traits/next-solver/overflow/recursive-self-normalization.stderr similarity index 100% rename from tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr rename to tests/ui/traits/next-solver/overflow/recursive-self-normalization.stderr diff --git a/tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs b/tests/ui/traits/next-solver/param-candidate-doesnt-shadow-project.rs similarity index 100% rename from tests/ui/traits/new-solver/param-candidate-doesnt-shadow-project.rs rename to tests/ui/traits/next-solver/param-candidate-doesnt-shadow-project.rs diff --git a/tests/ui/traits/new-solver/param-discr-kind.rs b/tests/ui/traits/next-solver/param-discr-kind.rs similarity index 100% rename from tests/ui/traits/new-solver/param-discr-kind.rs rename to tests/ui/traits/next-solver/param-discr-kind.rs diff --git a/tests/ui/traits/new-solver/pointee.rs b/tests/ui/traits/next-solver/pointee.rs similarity index 100% rename from tests/ui/traits/new-solver/pointee.rs rename to tests/ui/traits/next-solver/pointee.rs diff --git a/tests/ui/traits/new-solver/pointer-like.rs b/tests/ui/traits/next-solver/pointer-like.rs similarity index 100% rename from tests/ui/traits/new-solver/pointer-like.rs rename to tests/ui/traits/next-solver/pointer-like.rs diff --git a/tests/ui/traits/new-solver/pointer-like.stderr b/tests/ui/traits/next-solver/pointer-like.stderr similarity index 100% rename from tests/ui/traits/new-solver/pointer-like.stderr rename to tests/ui/traits/next-solver/pointer-like.stderr diff --git a/tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs b/tests/ui/traits/next-solver/prefer-candidate-no-constraints.rs similarity index 100% rename from tests/ui/traits/new-solver/prefer-candidate-no-constraints.rs rename to tests/ui/traits/next-solver/prefer-candidate-no-constraints.rs diff --git a/tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs b/tests/ui/traits/next-solver/prefer-param-env-on-ambiguity.rs similarity index 100% rename from tests/ui/traits/new-solver/prefer-param-env-on-ambiguity.rs rename to tests/ui/traits/next-solver/prefer-param-env-on-ambiguity.rs diff --git a/tests/ui/traits/new-solver/projection-discr-kind.rs b/tests/ui/traits/next-solver/projection-discr-kind.rs similarity index 100% rename from tests/ui/traits/new-solver/projection-discr-kind.rs rename to tests/ui/traits/next-solver/projection-discr-kind.rs diff --git a/tests/ui/traits/new-solver/projection-discr-kind.stderr b/tests/ui/traits/next-solver/projection-discr-kind.stderr similarity index 100% rename from tests/ui/traits/new-solver/projection-discr-kind.stderr rename to tests/ui/traits/next-solver/projection-discr-kind.stderr diff --git a/tests/ui/traits/new-solver/slice-match-byte-lit.rs b/tests/ui/traits/next-solver/slice-match-byte-lit.rs similarity index 100% rename from tests/ui/traits/new-solver/slice-match-byte-lit.rs rename to tests/ui/traits/next-solver/slice-match-byte-lit.rs diff --git a/tests/ui/traits/new-solver/specialization-transmute.rs b/tests/ui/traits/next-solver/specialization-transmute.rs similarity index 100% rename from tests/ui/traits/new-solver/specialization-transmute.rs rename to tests/ui/traits/next-solver/specialization-transmute.rs diff --git a/tests/ui/traits/new-solver/specialization-transmute.stderr b/tests/ui/traits/next-solver/specialization-transmute.stderr similarity index 100% rename from tests/ui/traits/new-solver/specialization-transmute.stderr rename to tests/ui/traits/next-solver/specialization-transmute.stderr diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.rs b/tests/ui/traits/next-solver/specialization-unconstrained.rs similarity index 100% rename from tests/ui/traits/new-solver/specialization-unconstrained.rs rename to tests/ui/traits/next-solver/specialization-unconstrained.rs diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.stderr b/tests/ui/traits/next-solver/specialization-unconstrained.stderr similarity index 100% rename from tests/ui/traits/new-solver/specialization-unconstrained.stderr rename to tests/ui/traits/next-solver/specialization-unconstrained.stderr diff --git a/tests/ui/traits/new-solver/stall-num-var-auto-trait.fallback.stderr b/tests/ui/traits/next-solver/stall-num-var-auto-trait.fallback.stderr similarity index 100% rename from tests/ui/traits/new-solver/stall-num-var-auto-trait.fallback.stderr rename to tests/ui/traits/next-solver/stall-num-var-auto-trait.fallback.stderr diff --git a/tests/ui/traits/new-solver/stall-num-var-auto-trait.rs b/tests/ui/traits/next-solver/stall-num-var-auto-trait.rs similarity index 100% rename from tests/ui/traits/new-solver/stall-num-var-auto-trait.rs rename to tests/ui/traits/next-solver/stall-num-var-auto-trait.rs diff --git a/tests/ui/traits/new-solver/structural-resolve-field.rs b/tests/ui/traits/next-solver/structural-resolve-field.rs similarity index 100% rename from tests/ui/traits/new-solver/structural-resolve-field.rs rename to tests/ui/traits/next-solver/structural-resolve-field.rs diff --git a/tests/ui/traits/new-solver/tait-eq-proj-2.rs b/tests/ui/traits/next-solver/tait-eq-proj-2.rs similarity index 87% rename from tests/ui/traits/new-solver/tait-eq-proj-2.rs rename to tests/ui/traits/next-solver/tait-eq-proj-2.rs index 7873ba0d7bac7..a3df053dd8325 100644 --- a/tests/ui/traits/new-solver/tait-eq-proj-2.rs +++ b/tests/ui/traits/next-solver/tait-eq-proj-2.rs @@ -3,7 +3,7 @@ #![feature(type_alias_impl_trait)] -// Similar to tests/ui/traits/new-solver/tait-eq-proj.rs +// Similar to tests/ui/traits/next-solver/tait-eq-proj.rs // but check the alias-sub relation in the other direction. type Tait = impl Iterator; diff --git a/tests/ui/traits/new-solver/tait-eq-proj.rs b/tests/ui/traits/next-solver/tait-eq-proj.rs similarity index 100% rename from tests/ui/traits/new-solver/tait-eq-proj.rs rename to tests/ui/traits/next-solver/tait-eq-proj.rs diff --git a/tests/ui/traits/new-solver/tait-eq-tait.rs b/tests/ui/traits/next-solver/tait-eq-tait.rs similarity index 100% rename from tests/ui/traits/new-solver/tait-eq-tait.rs rename to tests/ui/traits/next-solver/tait-eq-tait.rs diff --git a/tests/ui/traits/new-solver/temporary-ambiguity.rs b/tests/ui/traits/next-solver/temporary-ambiguity.rs similarity index 100% rename from tests/ui/traits/new-solver/temporary-ambiguity.rs rename to tests/ui/traits/next-solver/temporary-ambiguity.rs diff --git a/tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs b/tests/ui/traits/next-solver/trait-upcast-lhs-needs-normalization.rs similarity index 100% rename from tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs rename to tests/ui/traits/next-solver/trait-upcast-lhs-needs-normalization.rs diff --git a/tests/ui/traits/new-solver/try-example.rs b/tests/ui/traits/next-solver/try-example.rs similarity index 100% rename from tests/ui/traits/new-solver/try-example.rs rename to tests/ui/traits/next-solver/try-example.rs diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs b/tests/ui/traits/next-solver/two-projection-param-candidates-are-ambiguous.rs similarity index 100% rename from tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.rs rename to tests/ui/traits/next-solver/two-projection-param-candidates-are-ambiguous.rs diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr b/tests/ui/traits/next-solver/two-projection-param-candidates-are-ambiguous.stderr similarity index 100% rename from tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr rename to tests/ui/traits/next-solver/two-projection-param-candidates-are-ambiguous.stderr diff --git a/tests/ui/traits/new-solver/unevaluated-const-impl-trait-ref.fails.stderr b/tests/ui/traits/next-solver/unevaluated-const-impl-trait-ref.fails.stderr similarity index 100% rename from tests/ui/traits/new-solver/unevaluated-const-impl-trait-ref.fails.stderr rename to tests/ui/traits/next-solver/unevaluated-const-impl-trait-ref.fails.stderr diff --git a/tests/ui/traits/new-solver/unevaluated-const-impl-trait-ref.rs b/tests/ui/traits/next-solver/unevaluated-const-impl-trait-ref.rs similarity index 100% rename from tests/ui/traits/new-solver/unevaluated-const-impl-trait-ref.rs rename to tests/ui/traits/next-solver/unevaluated-const-impl-trait-ref.rs diff --git a/tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs b/tests/ui/traits/next-solver/unsafe-auto-trait-impl.rs similarity index 100% rename from tests/ui/traits/new-solver/unsafe-auto-trait-impl.rs rename to tests/ui/traits/next-solver/unsafe-auto-trait-impl.rs diff --git a/tests/ui/traits/new-solver/unsize-although-ambiguous.rs b/tests/ui/traits/next-solver/unsize-although-ambiguous.rs similarity index 100% rename from tests/ui/traits/new-solver/unsize-although-ambiguous.rs rename to tests/ui/traits/next-solver/unsize-although-ambiguous.rs diff --git a/tests/ui/traits/new-solver/unsize-good.rs b/tests/ui/traits/next-solver/unsize-good.rs similarity index 100% rename from tests/ui/traits/new-solver/unsize-good.rs rename to tests/ui/traits/next-solver/unsize-good.rs diff --git a/tests/ui/traits/new-solver/upcast-right-substs.rs b/tests/ui/traits/next-solver/upcast-right-substs.rs similarity index 100% rename from tests/ui/traits/new-solver/upcast-right-substs.rs rename to tests/ui/traits/next-solver/upcast-right-substs.rs diff --git a/tests/ui/traits/new-solver/upcast-wrong-substs.rs b/tests/ui/traits/next-solver/upcast-wrong-substs.rs similarity index 100% rename from tests/ui/traits/new-solver/upcast-wrong-substs.rs rename to tests/ui/traits/next-solver/upcast-wrong-substs.rs diff --git a/tests/ui/traits/new-solver/upcast-wrong-substs.stderr b/tests/ui/traits/next-solver/upcast-wrong-substs.stderr similarity index 100% rename from tests/ui/traits/new-solver/upcast-wrong-substs.stderr rename to tests/ui/traits/next-solver/upcast-wrong-substs.stderr diff --git a/tests/ui/traits/new-solver/winnow-specializing-impls.rs b/tests/ui/traits/next-solver/winnow-specializing-impls.rs similarity index 100% rename from tests/ui/traits/new-solver/winnow-specializing-impls.rs rename to tests/ui/traits/next-solver/winnow-specializing-impls.rs From fa03289ddfc15d4582a866e66c9003fc6fc11a9f Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 14 Dec 2023 14:59:32 +0100 Subject: [PATCH 27/40] review --- .../src/traits/error_reporting/type_err_ctxt_ext.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index 3b50645a275cc..b3bb0a9fcb770 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -814,7 +814,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(ty)) => { let ty = self.resolve_vars_if_possible(ty); - if self.tcx.sess.opts.unstable_opts.next_solver.is_some() { + if self.next_trait_solver() { // FIXME: we'll need a better message which takes into account // which bounds actually failed to hold. self.tcx.sess.struct_span_err( From 5a8d6e784d0c3551039b7c96391938a2ce006257 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Dec 2023 15:52:47 +0100 Subject: [PATCH 28/40] Fix bootstrap test failures There are a number of fixes here: * if-unchanged is supposed to be the default for channel=dev, but actually used different logic. Make sure it is the same. * If no llvm section was specified at all, different logic was also used. Go through the standard helper. * Some more assertions should depend on if_unchanged. --- src/bootstrap/src/core/config/config.rs | 36 ++++++++++++------------- src/bootstrap/src/tests/config.rs | 6 ++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index c3db5641ea47e..0c0f3909edf8c 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1791,8 +1791,7 @@ impl Config { config.llvm_link_shared.set(Some(true)); } } else { - config.llvm_from_ci = config.channel == "dev" - && crate::core::build_steps::llvm::is_ci_llvm_available(&config, false); + config.llvm_from_ci = config.parse_download_ci_llvm(None, false); } if let Some(t) = toml.target { @@ -2337,29 +2336,30 @@ impl Config { download_ci_llvm: Option, asserts: bool, ) -> bool { + let if_unchanged = || { + // Git is needed to track modifications here, but tarball source is not available. + // If not modified here or built through tarball source, we maintain consistency + // with '"if available"'. + if !self.rust_info.is_from_tarball() + && self + .last_modified_commit(&["src/llvm-project"], "download-ci-llvm", true) + .is_none() + { + // there are some untracked changes in the the given paths. + false + } else { + llvm::is_ci_llvm_available(&self, asserts) + } + }; match download_ci_llvm { - None => self.channel == "dev" && llvm::is_ci_llvm_available(&self, asserts), + None => self.channel == "dev" && if_unchanged(), Some(StringOrBool::Bool(b)) => b, // FIXME: "if-available" is deprecated. Remove this block later (around mid 2024) // to not break builds between the recent-to-old checkouts. Some(StringOrBool::String(s)) if s == "if-available" => { llvm::is_ci_llvm_available(&self, asserts) } - Some(StringOrBool::String(s)) if s == "if-unchanged" => { - // Git is needed to track modifications here, but tarball source is not available. - // If not modified here or built through tarball source, we maintain consistency - // with '"if available"'. - if !self.rust_info.is_from_tarball() - && self - .last_modified_commit(&["src/llvm-project"], "download-ci-llvm", true) - .is_none() - { - // there are some untracked changes in the the given paths. - false - } else { - llvm::is_ci_llvm_available(&self, asserts) - } - } + Some(StringOrBool::String(s)) if s == "if-unchanged" => if_unchanged(), Some(StringOrBool::String(other)) => { panic!("unrecognized option for download-ci-llvm: {:?}", other) } diff --git a/src/bootstrap/src/tests/config.rs b/src/bootstrap/src/tests/config.rs index c24d57fb8f82c..6f43234388266 100644 --- a/src/bootstrap/src/tests/config.rs +++ b/src/bootstrap/src/tests/config.rs @@ -31,10 +31,10 @@ fn download_ci_llvm() { assert_eq!(parse_llvm(""), if_unchanged); assert_eq!(parse_llvm("rust.channel = \"dev\""), if_unchanged); assert!(!parse_llvm("rust.channel = \"stable\"")); - assert!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\"")); - assert!(parse_llvm( + assert_eq!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\""), if_unchanged); + assert_eq!(parse_llvm( "llvm.assertions = true \r\n build.build = \"x86_64-unknown-linux-gnu\" \r\n llvm.download-ci-llvm = \"if-unchanged\"" - )); + ), if_unchanged); assert!(!parse_llvm( "llvm.assertions = true \r\n build.build = \"aarch64-apple-darwin\" \r\n llvm.download-ci-llvm = \"if-unchanged\"" )); From 601d52a7031f0f57562b661c99d30b4035d7b4af Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Dec 2023 16:05:39 +0100 Subject: [PATCH 29/40] Include an additional cherry-pick --- src/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm-project b/src/llvm-project index 17a687b23d223..2c4de6c2492d5 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 17a687b23d22332fce6ba0aade180a30d06cfa62 +Subproject commit 2c4de6c2492d5530de3f19f41d8f88ba984c2fe2 From 82ee18c4ea3709ef5472064ee4b44cf35b865e34 Mon Sep 17 00:00:00 2001 From: ouz-a Date: Mon, 27 Nov 2023 18:40:00 +0300 Subject: [PATCH 30/40] add stable_mir output test --- compiler/stable_mir/src/mir/pretty.rs | 43 +++- src/tools/tidy/src/ui_tests.rs | 2 +- tests/ui/stable-mir-print/basic_function.rs | 15 ++ .../ui/stable-mir-print/basic_function.stdout | 234 ++++++++++++++++++ 4 files changed, 280 insertions(+), 14 deletions(-) create mode 100644 tests/ui/stable-mir-print/basic_function.rs create mode 100644 tests/ui/stable-mir-print/basic_function.stdout diff --git a/compiler/stable_mir/src/mir/pretty.rs b/compiler/stable_mir/src/mir/pretty.rs index 3a0eed521dc6e..576087498abfa 100644 --- a/compiler/stable_mir/src/mir/pretty.rs +++ b/compiler/stable_mir/src/mir/pretty.rs @@ -58,18 +58,35 @@ pub fn pretty_statement(statement: &StatementKind) -> String { pretty.push_str(format!(" _{} = ", place.local).as_str()); pretty.push_str(format!("{}", &pretty_rvalue(rval)).as_str()); } - StatementKind::FakeRead(_, _) => todo!(), - StatementKind::SetDiscriminant { .. } => todo!(), - StatementKind::Deinit(_) => todo!(), - StatementKind::StorageLive(_) => todo!(), - StatementKind::StorageDead(_) => todo!(), - StatementKind::Retag(_, _) => todo!(), - StatementKind::PlaceMention(_) => todo!(), - StatementKind::AscribeUserType { .. } => todo!(), - StatementKind::Coverage(_) => todo!(), - StatementKind::Intrinsic(_) => todo!(), - StatementKind::ConstEvalCounter => (), - StatementKind::Nop => (), + // FIXME: Add rest of the statements + StatementKind::FakeRead(_, _) => { + return String::from("StatementKind::FakeRead:Unimplemented"); + } + StatementKind::SetDiscriminant { .. } => { + return String::from("StatementKind::SetDiscriminant:Unimplemented"); + } + StatementKind::Deinit(_) => return String::from("StatementKind::Deinit:Unimplemented"), + StatementKind::StorageLive(_) => { + return String::from("StatementKind::StorageLive:Unimplemented"); + } + StatementKind::StorageDead(_) => { + return String::from("StatementKind::StorageDead:Unimplemented"); + } + StatementKind::Retag(_, _) => return String::from("StatementKind::Retag:Unimplemented"), + StatementKind::PlaceMention(_) => { + return String::from("StatementKind::PlaceMention:Unimplemented"); + } + StatementKind::AscribeUserType { .. } => { + return String::from("StatementKind::AscribeUserType:Unimplemented"); + } + StatementKind::Coverage(_) => return String::from("StatementKind::Coverage:Unimplemented"), + StatementKind::Intrinsic(_) => { + return String::from("StatementKind::Intrinsic:Unimplemented"); + } + StatementKind::ConstEvalCounter => { + return String::from("StatementKind::ConstEvalCounter:Unimplemented"); + } + StatementKind::Nop => return String::from("StatementKind::Nop:Unimplemented"), } pretty } @@ -355,7 +372,7 @@ pub fn pretty_rvalue(rval: &Rvalue) -> String { pretty.push_str(" "); pretty.push_str(&pretty_ty(cnst.ty().kind())); } - Rvalue::ShallowInitBox(_, _) => todo!(), + Rvalue::ShallowInitBox(_, _) => (), Rvalue::ThreadLocalRef(item) => { pretty.push_str("thread_local_ref"); pretty.push_str(format!("{:#?}", item).as_str()); diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 40149f8f1c3b6..dfa386b49de7c 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -11,7 +11,7 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. const ISSUES_ENTRY_LIMIT: usize = 1852; -const ROOT_ENTRY_LIMIT: usize = 866; +const ROOT_ENTRY_LIMIT: usize = 867; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ "rs", // test source files diff --git a/tests/ui/stable-mir-print/basic_function.rs b/tests/ui/stable-mir-print/basic_function.rs new file mode 100644 index 0000000000000..6394edcbb7847 --- /dev/null +++ b/tests/ui/stable-mir-print/basic_function.rs @@ -0,0 +1,15 @@ +// compile-flags: -Z unpretty=stable-mir -Z mir-opt-level=3 +// check-pass +// only-x86_64 + +fn foo(i:i32) -> i32 { + i + 1 +} + +fn bar(vec: &mut Vec) -> Vec { + let mut new_vec = vec.clone(); + new_vec.push(1); + new_vec +} + +fn main(){} diff --git a/tests/ui/stable-mir-print/basic_function.stdout b/tests/ui/stable-mir-print/basic_function.stdout new file mode 100644 index 0000000000000..d9b33a4257c2c --- /dev/null +++ b/tests/ui/stable-mir-print/basic_function.stdout @@ -0,0 +1,234 @@ +// WARNING: This is highly experimental output it's intended for stable-mir developers only. +// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir. +fn foo(_0: i32) -> i32 { + let mut _0: (i32, bool); +} + bb0: { + _2 = 1 Add const 1_i32 + assert(!move _2 bool),"attempt to compute `{} + {}`, which would overflow", 1, const 1_i32) -> [success: bb1, unwind continue] + } + bb1: { + _0 = move _2 + return + } +fn bar(_0: &mut Ty { + id: 10, + kind: RigidTy( + Adt( + AdtDef( + DefId { + id: 3, + name: "std::vec::Vec", + }, + ), + GenericArgs( + [ + Type( + Ty { + id: 11, + kind: Param( + ParamTy { + index: 0, + name: "T", + }, + ), + }, + ), + Type( + Ty { + id: 12, + kind: Param( + ParamTy { + index: 1, + name: "A", + }, + ), + }, + ), + ], + ), + ), + ), +}) -> Ty { + id: 10, + kind: RigidTy( + Adt( + AdtDef( + DefId { + id: 3, + name: "std::vec::Vec", + }, + ), + GenericArgs( + [ + Type( + Ty { + id: 11, + kind: Param( + ParamTy { + index: 0, + name: "T", + }, + ), + }, + ), + Type( + Ty { + id: 12, + kind: Param( + ParamTy { + index: 1, + name: "A", + }, + ), + }, + ), + ], + ), + ), + ), +} { + let mut _0: Ty { + id: 10, + kind: RigidTy( + Adt( + AdtDef( + DefId { + id: 3, + name: "std::vec::Vec", + }, + ), + GenericArgs( + [ + Type( + Ty { + id: 11, + kind: Param( + ParamTy { + index: 0, + name: "T", + }, + ), + }, + ), + Type( + Ty { + id: 12, + kind: Param( + ParamTy { + index: 1, + name: "A", + }, + ), + }, + ), + ], + ), + ), + ), +}; + let mut _1: &Ty { + id: 10, + kind: RigidTy( + Adt( + AdtDef( + DefId { + id: 3, + name: "std::vec::Vec", + }, + ), + GenericArgs( + [ + Type( + Ty { + id: 11, + kind: Param( + ParamTy { + index: 0, + name: "T", + }, + ), + }, + ), + Type( + Ty { + id: 12, + kind: Param( + ParamTy { + index: 1, + name: "A", + }, + ), + }, + ), + ], + ), + ), + ), +}; + let _2: (); + let mut _3: &mut Ty { + id: 10, + kind: RigidTy( + Adt( + AdtDef( + DefId { + id: 3, + name: "std::vec::Vec", + }, + ), + GenericArgs( + [ + Type( + Ty { + id: 11, + kind: Param( + ParamTy { + index: 0, + name: "T", + }, + ), + }, + ), + Type( + Ty { + id: 12, + kind: Param( + ParamTy { + index: 1, + name: "A", + }, + ), + }, + ), + ], + ), + ), + ), +}; +} + bb0: { + _3 = refShared1 + _2 = const as Clone>::clone(move _3) -> [return: bb1, unwind continue] + } + bb1: { + _5 = refMut { + kind: TwoPhaseBorrow, +}2 + _4 = const Vec::::push(move _5, const 1_i32) -> [return: bb2, unwind: bb3] + } + bb2: { + _0 = move _2 + return + } + bb3: { + drop(_2) -> [return: bb4, unwind terminate] + } + bb4: { + resume + } +fn main() -> () { +} + bb0: { + return + } From 4cb2a281cbf7e56f54c0c5864c9c290c22ab1e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Thu, 14 Dec 2023 15:40:50 +0000 Subject: [PATCH 31/40] update measureme to 10.1.2 to deduplicate parking_lot --- Cargo.lock | 43 +++++++++---------------------------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a5bdc14fe998c..98c030b3996a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -548,7 +548,7 @@ dependencies = [ "futures", "if_chain", "itertools", - "parking_lot 0.12.1", + "parking_lot", "quote", "regex", "rustc_tools_util", @@ -2356,13 +2356,13 @@ dependencies = [ [[package]] name = "measureme" -version = "10.1.1" +version = "10.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1930d162935fecd56fc4e0f6729eb3483bac1264542eb4ea31570b86a434b6bc" +checksum = "45e381dcdad44c3c435f8052b08c5c4a1449c48ab56f312345eae12d7a693dbe" dependencies = [ "log", "memmap2", - "parking_lot 0.11.2", + "parking_lot", "perf-event-open-sys", "rustc-hash", "smallvec", @@ -2780,17 +2780,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -2798,21 +2787,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -3682,7 +3657,7 @@ dependencies = [ "libc", "measureme", "memmap2", - "parking_lot 0.12.1", + "parking_lot", "portable-atomic", "rustc-hash", "rustc-rayon", @@ -4417,7 +4392,7 @@ dependencies = [ name = "rustc_query_system" version = "0.0.0" dependencies = [ - "parking_lot 0.12.1", + "parking_lot", "rustc-rayon-core", "rustc_ast", "rustc_data_structures", @@ -5134,7 +5109,7 @@ checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ "new_debug_unreachable", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "phf_shared", "precomputed-hash", "serde", @@ -5659,7 +5634,7 @@ dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "regex", "sharded-slab", "smallvec", From 2ddd8b4f190822ab4805bae7008264eb118ba748 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Tue, 12 Dec 2023 16:09:50 +0100 Subject: [PATCH 32/40] rustc_codegen_ssa: Remove trailing spaces in Display impl for CguReuse Otherwise errors will look like this: error: CGU-reuse for `cgu_invalidated_via_import-bar` is `PreLto ` but should be `PostLto ` --- compiler/rustc_codegen_ssa/src/assert_module_sources.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/assert_module_sources.rs b/compiler/rustc_codegen_ssa/src/assert_module_sources.rs index 3d479c5c22d2f..01d1b1059b91c 100644 --- a/compiler/rustc_codegen_ssa/src/assert_module_sources.rs +++ b/compiler/rustc_codegen_ssa/src/assert_module_sources.rs @@ -199,8 +199,8 @@ impl fmt::Display for CguReuse { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { CguReuse::No => write!(f, "No"), - CguReuse::PreLto => write!(f, "PreLto "), - CguReuse::PostLto => write!(f, "PostLto "), + CguReuse::PreLto => write!(f, "PreLto"), + CguReuse::PostLto => write!(f, "PostLto"), } } } From 05b64a84a3cd85bf0b8ab4fcb1dc2b34fea521d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Thu, 14 Dec 2023 16:05:46 +0000 Subject: [PATCH 33/40] remove `instant` from allowed dependencies --- src/tools/tidy/src/deps.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 2081d1b3b075b..3bfe811b58e6d 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -254,7 +254,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "icu_provider_macros", "ident_case", "indexmap", - "instant", "intl-memoizer", "intl_pluralrules", "is-terminal", From 3c17514ae98f758bee1eb2578297a3bc16137875 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 14 Dec 2023 18:34:29 +0000 Subject: [PATCH 34/40] Use the Waker::noop API in tests --- .../in-trait/async-default-fn-overridden.rs | 24 ++++------------- ...ont-project-to-specializable-projection.rs | 25 ++++-------------- ...project-to-specializable-projection.stderr | 26 +++++++++++++++---- tests/ui/coroutine/async_gen_fn_iter.rs | 24 ++++------------- tests/ui/dyn-star/dispatch-on-pin-mut.rs | 24 ++++------------- 5 files changed, 41 insertions(+), 82 deletions(-) diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs index c8fd2d8f6c2de..491dfcc6ae0fd 100644 --- a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs +++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs @@ -1,6 +1,7 @@ // run-pass // edition:2021 +#![feature(noop_waker)] use std::future::Future; @@ -32,33 +33,18 @@ async fn async_main() { // ------------------------------------------------------------------------- // // Implementation Details Below... -use std::pin::Pin; +use std::pin::pin; use std::task::*; -pub fn noop_waker() -> Waker { - let raw = RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE); - - // SAFETY: the contracts for RawWaker and RawWakerVTable are upheld - unsafe { Waker::from_raw(raw) } -} - -const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop); - -unsafe fn noop_clone(_p: *const ()) -> RawWaker { - RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE) -} - -unsafe fn noop(_p: *const ()) {} - fn main() { - let mut fut = async_main(); + let mut fut = pin!(async_main()); // Poll loop, just to test the future... - let waker = noop_waker(); + let waker = Waker::noop(); let ctx = &mut Context::from_waker(&waker); loop { - match unsafe { Pin::new_unchecked(&mut fut).poll(ctx) } { + match fut.as_mut().poll(ctx) { Poll::Pending => {} Poll::Ready(()) => break, } diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs index 18b0fa4856dbd..f21abf012ba99 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs @@ -2,6 +2,7 @@ // known-bug: #108309 #![feature(min_specialization)] +#![feature(noop_waker)] struct MyStruct; @@ -35,34 +36,18 @@ async fn indirection(x: T) -> &'static str { // ------------------------------------------------------------------------- // // Implementation Details Below... -use std::future::Future; -use std::pin::Pin; +use std::pin::{pin, Pin}; use std::task::*; -pub fn noop_waker() -> Waker { - let raw = RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE); - - // SAFETY: the contracts for RawWaker and RawWakerVTable are upheld - unsafe { Waker::from_raw(raw) } -} - -const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop); - -unsafe fn noop_clone(_p: *const ()) -> RawWaker { - RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE) -} - -unsafe fn noop(_p: *const ()) {} - fn main() { - let mut fut = async_main(); + let mut fut = pin!(async_main()); // Poll loop, just to test the future... - let waker = noop_waker(); + let waker = Waker::noop(); let ctx = &mut Context::from_waker(&waker); loop { - match unsafe { Pin::new_unchecked(&mut fut).poll(ctx) } { + match fut.as_mut().poll(ctx) { Poll::Pending => {} Poll::Ready(()) => break, } diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr index 5e2be08623b97..0560cd9c5fe11 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -1,11 +1,11 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/dont-project-to-specializable-projection.rs:13:5 + --> $DIR/dont-project-to-specializable-projection.rs:14:5 | LL | default async fn foo(_: T) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found future | note: type in trait - --> $DIR/dont-project-to-specializable-projection.rs:9:5 + --> $DIR/dont-project-to-specializable-projection.rs:10:5 | LL | async fn foo(_: T) -> &'static str; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,13 +13,29 @@ LL | async fn foo(_: T) -> &'static str; found signature `fn(_) -> impl Future` error: async associated function in trait cannot be specialized - --> $DIR/dont-project-to-specializable-projection.rs:13:5 + --> $DIR/dont-project-to-specializable-projection.rs:14:5 | LL | default async fn foo(_: T) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: specialization behaves in inconsistent and surprising ways with async functions in traits, and for now is disallowed -error: aborting due to 2 previous errors +error[E0599]: no method named `poll` found for struct `Pin<&mut impl Future>` in the current scope + --> $DIR/dont-project-to-specializable-projection.rs:50:28 + | +LL | match fut.as_mut().poll(ctx) { + | ^^^^ method not found in `Pin<&mut impl Future>` + --> $SRC_DIR/core/src/future/future.rs:LL:COL + | + = note: the method is available for `Pin<&mut impl Future>` here + | + = help: items from traits can only be used if the trait is in scope +help: the following trait is implemented but not in scope; perhaps add a `use` for it: + | +LL + use std::future::Future; + | + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0053`. +Some errors have detailed explanations: E0053, E0599. +For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/coroutine/async_gen_fn_iter.rs b/tests/ui/coroutine/async_gen_fn_iter.rs index 4fa29e1095a14..ec6464d004877 100644 --- a/tests/ui/coroutine/async_gen_fn_iter.rs +++ b/tests/ui/coroutine/async_gen_fn_iter.rs @@ -3,6 +3,7 @@ // run-pass #![feature(gen_blocks, async_iterator)] +#![feature(noop_waker)] // make sure that a ridiculously simple async gen fn works as an iterator. @@ -42,7 +43,7 @@ async fn async_main() { // ------------------------------------------------------------------------- // // Implementation Details Below... -use std::pin::Pin; +use std::pin::{Pin, pin}; use std::task::*; use std::async_iter::AsyncIterator; use std::future::Future; @@ -69,30 +70,15 @@ impl<'s, S: AsyncIterator> Future for Next<'s, S> where S: Unpin { } } -pub fn noop_waker() -> Waker { - let raw = RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE); - - // SAFETY: the contracts for RawWaker and RawWakerVTable are upheld - unsafe { Waker::from_raw(raw) } -} - -const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop); - -unsafe fn noop_clone(_p: *const ()) -> RawWaker { - RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE) -} - -unsafe fn noop(_p: *const ()) {} - fn main() { - let mut fut = async_main(); + let mut fut = pin!(async_main()); // Poll loop, just to test the future... - let waker = noop_waker(); + let waker = Waker::noop(); let ctx = &mut Context::from_waker(&waker); loop { - match unsafe { Pin::new_unchecked(&mut fut).poll(ctx) } { + match fut.as_mut().poll(ctx) { Poll::Pending => {} Poll::Ready(()) => break, } diff --git a/tests/ui/dyn-star/dispatch-on-pin-mut.rs b/tests/ui/dyn-star/dispatch-on-pin-mut.rs index 5774c8b2a6722..c4ae279e6c11e 100644 --- a/tests/ui/dyn-star/dispatch-on-pin-mut.rs +++ b/tests/ui/dyn-star/dispatch-on-pin-mut.rs @@ -4,6 +4,7 @@ #![feature(dyn_star)] //~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes +#![feature(noop_waker)] use std::future::Future; @@ -18,33 +19,18 @@ async fn async_main() { // ------------------------------------------------------------------------- // // Implementation Details Below... -use std::pin::Pin; use std::task::*; - -pub fn noop_waker() -> Waker { - let raw = RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE); - - // SAFETY: the contracts for RawWaker and RawWakerVTable are upheld - unsafe { Waker::from_raw(raw) } -} - -const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop); - -unsafe fn noop_clone(_p: *const ()) -> RawWaker { - RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE) -} - -unsafe fn noop(_p: *const ()) {} +use std::pin::pin; fn main() { - let mut fut = async_main(); + let mut fut = pin!(async_main()); // Poll loop, just to test the future... - let waker = noop_waker(); + let waker = Waker::noop(); let ctx = &mut Context::from_waker(&waker); loop { - match unsafe { Pin::new_unchecked(&mut fut).poll(ctx) } { + match fut.as_mut().poll(ctx) { Poll::Pending => {} Poll::Ready(()) => break, } From 929d632b541cb52c23e1b768bb8c3f88bf9b5955 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 13 Dec 2023 14:11:09 +0000 Subject: [PATCH 35/40] Unconditionally register alias-relate in projection goal --- .../src/solve/project_goals.rs | 34 +++++++++++++------ .../closure-signature-inference-2.rs | 21 ++++++++++++ .../closure-signature-inference.rs | 15 ++++++++ ...eneralize-proj-new-universe-index-2.stderr | 14 ++++++-- .../projection/param-env-trait-candidate-1.rs | 0 .../projection/param-env-trait-candidate-2.rs | 0 6 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 tests/ui/traits/next-solver/closure-signature-inference-2.rs create mode 100644 tests/ui/traits/next-solver/closure-signature-inference.rs rename tests/ui/traits/{new-solver => next-solver}/projection/param-env-trait-candidate-1.rs (100%) rename tests/ui/traits/{new-solver => next-solver}/projection/param-env-trait-candidate-2.rs (100%) diff --git a/compiler/rustc_trait_selection/src/solve/project_goals.rs b/compiler/rustc_trait_selection/src/solve/project_goals.rs index 0b80969c307c8..d0e92a54cebbc 100644 --- a/compiler/rustc_trait_selection/src/solve/project_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/project_goals.rs @@ -8,16 +8,28 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { &mut self, goal: Goal<'tcx, ProjectionPredicate<'tcx>>, ) -> QueryResult<'tcx> { - match goal.predicate.term.unpack() { - ty::TermKind::Ty(term) => { - let alias = goal.predicate.projection_ty.to_ty(self.tcx()); - self.eq(goal.param_env, alias, term)?; - self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) - } - // FIXME(associated_const_equality): actually do something here. - ty::TermKind::Const(_) => { - self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) - } - } + let tcx = self.tcx(); + let projection_term = match goal.predicate.term.unpack() { + ty::TermKind::Ty(_) => goal.predicate.projection_ty.to_ty(tcx).into(), + ty::TermKind::Const(_) => ty::Const::new_unevaluated( + tcx, + ty::UnevaluatedConst::new( + goal.predicate.projection_ty.def_id, + goal.predicate.projection_ty.args, + ), + tcx.type_of(goal.predicate.projection_ty.def_id) + .instantiate(tcx, goal.predicate.projection_ty.args), + ) + .into(), + }; + self.add_goal(goal.with( + tcx, + ty::PredicateKind::AliasRelate( + projection_term, + goal.predicate.term, + ty::AliasRelationDirection::Equate, + ), + )); + self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) } } diff --git a/tests/ui/traits/next-solver/closure-signature-inference-2.rs b/tests/ui/traits/next-solver/closure-signature-inference-2.rs new file mode 100644 index 0000000000000..8fece7ba91f17 --- /dev/null +++ b/tests/ui/traits/next-solver/closure-signature-inference-2.rs @@ -0,0 +1,21 @@ +// compile-flags: -Znext-solver +// check-pass + +fn map U>(f: F) { + f(T::default()); +} + +fn main() { + map::(|x| x.to_string()); + // PREVIOUSLY when confirming the `map` call, we register: + // + // (1.) ?F: FnOnce<(i32,)> + // (2.) >::Output projects-to ?U + // + // While (1.) is ambiguous, (2.) immediately gets processed + // and we infer `?U := >::Output`. + // + // Thus, the only pending obligation that remains is (1.). + // Since it is a trait obligation, we don't use it to deduce + // the closure signature, and we fail! +} diff --git a/tests/ui/traits/next-solver/closure-signature-inference.rs b/tests/ui/traits/next-solver/closure-signature-inference.rs new file mode 100644 index 0000000000000..355fc790229d0 --- /dev/null +++ b/tests/ui/traits/next-solver/closure-signature-inference.rs @@ -0,0 +1,15 @@ +// compile-flags: -Znext-solver +// check-pass + +struct A; +impl A { + fn hi(self) {} +} + +fn hello() -> Result<(A,), ()> { + Err(()) +} + +fn main() { + let x = hello().map(|(x,)| x.hi()); +} diff --git a/tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.stderr b/tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.stderr index e4922b0c3e902..4548ab1e2972a 100644 --- a/tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.stderr +++ b/tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.stderr @@ -1,8 +1,18 @@ -error[E0284]: type annotations needed: cannot satisfy `<::Assoc as WithAssoc< as Id>::Assoc>>::Assoc normalizes-to <>::Assoc as Id>::Assoc` +error[E0284]: type annotations needed --> $DIR/generalize-proj-new-universe-index-2.rs:74:5 | LL | bound::<::Assoc, as Id>::Assoc, _>() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<::Assoc as WithAssoc< as Id>::Assoc>>::Assoc normalizes-to <>::Assoc as Id>::Assoc` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `V` declared on the function `bound` + | + = note: cannot satisfy `<::Assoc as WithAssoc< as Id>::Assoc>>::Assoc == _` +note: required by a bound in `bound` + --> $DIR/generalize-proj-new-universe-index-2.rs:69:21 + | +LL | fn bound() + | ----- required by a bound in this function +LL | where +LL | T: WithAssoc, + | ^^^^^^^^^ required by this bound in `bound` error: aborting due to 1 previous error diff --git a/tests/ui/traits/new-solver/projection/param-env-trait-candidate-1.rs b/tests/ui/traits/next-solver/projection/param-env-trait-candidate-1.rs similarity index 100% rename from tests/ui/traits/new-solver/projection/param-env-trait-candidate-1.rs rename to tests/ui/traits/next-solver/projection/param-env-trait-candidate-1.rs diff --git a/tests/ui/traits/new-solver/projection/param-env-trait-candidate-2.rs b/tests/ui/traits/next-solver/projection/param-env-trait-candidate-2.rs similarity index 100% rename from tests/ui/traits/new-solver/projection/param-env-trait-candidate-2.rs rename to tests/ui/traits/next-solver/projection/param-env-trait-candidate-2.rs From 19d28a4f28ad8125775e73e97e8bab2b2229f4e1 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 14 Dec 2023 12:26:15 +1100 Subject: [PATCH 36/40] Change `msg: impl Into` for bug diagnostics. To `msg: impl Into`, like all the other diagnostics. For consistency. --- compiler/rustc_errors/src/lib.rs | 14 +++++++------- compiler/rustc_expand/src/base.rs | 2 +- compiler/rustc_middle/src/ty/sty.rs | 6 ++++-- compiler/rustc_parse/src/parser/diagnostics.rs | 4 ++-- compiler/rustc_session/src/session.rs | 2 +- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 4093daba4b4fe..aae2910537a35 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1033,7 +1033,7 @@ impl Handler { self.emit_diag_at_span(Diagnostic::new_with_code(Warning(None), Some(code), msg), span); } - pub fn span_bug(&self, span: impl Into, msg: impl Into) -> ! { + pub fn span_bug(&self, span: impl Into, msg: impl Into) -> ! { self.inner.borrow_mut().span_bug(span, msg) } @@ -1045,7 +1045,7 @@ impl Handler { pub fn span_delayed_bug( &self, sp: impl Into, - msg: impl Into, + msg: impl Into, ) -> ErrorGuaranteed { let mut inner = self.inner.borrow_mut(); @@ -1056,10 +1056,10 @@ impl Handler { inner.err_count + inner.lint_err_count + inner.delayed_bug_count() + 1 >= c.get() }) { // FIXME: don't abort here if report_delayed_bugs is off - inner.span_bug(sp, msg.into()); + inner.span_bug(sp, msg); } - let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg.into()); - diagnostic.set_span(sp.into()); + let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg); + diagnostic.set_span(sp); inner.emit_diagnostic(&mut diagnostic).unwrap() } @@ -1589,8 +1589,8 @@ impl HandlerInner { } #[track_caller] - fn span_bug(&mut self, sp: impl Into, msg: impl Into) -> ! { - self.emit_diagnostic(Diagnostic::new(Bug, msg.into()).set_span(sp)); + fn span_bug(&mut self, sp: impl Into, msg: impl Into) -> ! { + self.emit_diagnostic(Diagnostic::new(Bug, msg).set_span(sp)); panic::panic_any(ExplicitBug); } diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index 11db4bb401762..d75556ac7c4d5 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -1145,7 +1145,7 @@ impl<'a> ExtCtxt<'a> { pub fn span_err>(&self, sp: S, msg: impl Into) { self.sess.diagnostic().span_err(sp, msg); } - pub fn span_bug>(&self, sp: S, msg: impl Into) -> ! { + pub fn span_bug>(&self, sp: S, msg: impl Into) -> ! { self.sess.diagnostic().span_bug(sp, msg); } pub fn trace_macros_diag(&mut self) { diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 50a1b85b16918..297a0be6a27cb 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -15,7 +15,9 @@ use hir::def::DefKind; use polonius_engine::Atom; use rustc_data_structures::captures::Captures; use rustc_data_structures::intern::Interned; -use rustc_errors::{DiagnosticArgValue, ErrorGuaranteed, IntoDiagnosticArg, MultiSpan}; +use rustc_errors::{ + DiagnosticArgValue, DiagnosticMessage, ErrorGuaranteed, IntoDiagnosticArg, MultiSpan, +}; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::LangItem; @@ -2005,7 +2007,7 @@ impl<'tcx> Ty<'tcx> { pub fn new_error_with_message>( tcx: TyCtxt<'tcx>, span: S, - msg: impl Into, + msg: impl Into, ) -> Ty<'tcx> { let reported = tcx.sess.span_delayed_bug(span, msg); Ty::new(tcx, Error(reported)) diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 5295172b25e77..221fc70d9ff70 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -249,8 +249,8 @@ impl<'a> Parser<'a> { self.diagnostic().struct_span_err(sp, m) } - pub fn span_bug>(&self, sp: S, m: impl Into) -> ! { - self.diagnostic().span_bug(sp, m) + pub fn span_bug>(&self, sp: S, msg: impl Into) -> ! { + self.diagnostic().span_bug(sp, msg) } pub(super) fn diagnostic(&self) -> &'a Handler { diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 24c7459392abe..233e56e0c449d 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -632,7 +632,7 @@ impl Session { pub fn span_delayed_bug>( &self, sp: S, - msg: impl Into, + msg: impl Into, ) -> ErrorGuaranteed { self.diagnostic().span_delayed_bug(sp, msg) } From b0d5b442e952eb7b51361d4a3a6d11aff10d1cc0 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 13 Dec 2023 16:36:57 +1100 Subject: [PATCH 37/40] Avoid `DiagnosticBuilder::::new` calls. The `Handler` functions that directly emit diagnostics can be more easily implemented using `struct_foo(msg).emit()`. This mirrors `Handler::emit_err` which just does `create_err(err).emit()`. `Handler::bug` is not converted because of weirdness involving conflation bugs and fatal errors with `EmissionGuarantee`. I'll fix that later. --- compiler/rustc_errors/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index aae2910537a35..068d2aaba1546 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1101,22 +1101,22 @@ impl Handler { #[rustc_lint_diagnostics] pub fn fatal(&self, msg: impl Into) -> ! { - DiagnosticBuilder::::new(self, Fatal, msg).emit().raise() + self.struct_fatal(msg).emit() } #[rustc_lint_diagnostics] pub fn err(&self, msg: impl Into) -> ErrorGuaranteed { - DiagnosticBuilder::::new(self, Error { lint: false }, msg).emit() + self.struct_err(msg).emit() } #[rustc_lint_diagnostics] pub fn warn(&self, msg: impl Into) { - DiagnosticBuilder::<()>::new(self, Warning(None), msg).emit(); + self.struct_warn(msg).emit() } #[rustc_lint_diagnostics] pub fn note(&self, msg: impl Into) { - DiagnosticBuilder::<()>::new(self, Note, msg).emit(); + self.struct_note(msg).emit() } pub fn bug(&self, msg: impl Into) -> ! { From 2c2c7f13a65f22969adf52a8040fb1bed842fb94 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 13 Dec 2023 17:15:58 +1100 Subject: [PATCH 38/40] Remove `Handler::emit_diag_at_span`. Compare `Handler::warn` and `Handler::span_warn`. Conceptually they are almost identical. But their implementations are weirdly different. `warn`: - calls `DiagnosticBuilder::<()>::new(self, Warning(None), msg)`, then `emit()` - which calls `G::diagnostic_builder_emit_producing_guarantee(self)` - which calls `handler.emit_diagnostic(&mut db.inner.diagnostic)` `span_warn`: - calls `self.emit_diag_at_span(Diagnostic::new(Warning(None), msg), span)` - which calls `self.emit_diagnostic(diag.set_span(sp))` I.e. they both end up at `emit_diagnostic`, but take very different routes to get there. This commit changes `span_*` and similar ones to not use `emit_diag_at_span`. Instead they just call `struct_span_*` + `emit`. Some nice side-effects of this: - `span_fatal` and `span_fatal_with_code` don't need `FatalError.raise()`, because `emit` does that. - `span_err` and `span_err_with_code` doesn't need `unwrap`. - `struct_span_note`'s `span` arg type is changed from `Span` to `impl Into` like all the other functions. --- compiler/rustc_errors/src/lib.rs | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 068d2aaba1546..508fa7c2e8e3a 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -975,8 +975,7 @@ impl Handler { #[rustc_lint_diagnostics] #[track_caller] pub fn span_fatal(&self, span: impl Into, msg: impl Into) -> ! { - self.emit_diag_at_span(Diagnostic::new(Fatal, msg), span); - FatalError.raise() + self.struct_span_fatal(span, msg).emit() } #[rustc_lint_diagnostics] @@ -987,8 +986,7 @@ impl Handler { msg: impl Into, code: DiagnosticId, ) -> ! { - self.emit_diag_at_span(Diagnostic::new_with_code(Fatal, Some(code), msg), span); - FatalError.raise() + self.struct_span_fatal_with_code(span, msg, code).emit() } #[rustc_lint_diagnostics] @@ -998,7 +996,7 @@ impl Handler { span: impl Into, msg: impl Into, ) -> ErrorGuaranteed { - self.emit_diag_at_span(Diagnostic::new(Error { lint: false }, msg), span).unwrap() + self.struct_span_err(span, msg).emit() } #[rustc_lint_diagnostics] @@ -1009,17 +1007,13 @@ impl Handler { msg: impl Into, code: DiagnosticId, ) -> ErrorGuaranteed { - self.emit_diag_at_span( - Diagnostic::new_with_code(Error { lint: false }, Some(code), msg), - span, - ) - .unwrap() + self.struct_span_err_with_code(span, msg, code).emit() } #[rustc_lint_diagnostics] #[track_caller] pub fn span_warn(&self, span: impl Into, msg: impl Into) { - self.emit_diag_at_span(Diagnostic::new(Warning(None), msg), span); + self.struct_span_warn(span, msg).emit() } #[rustc_lint_diagnostics] @@ -1030,7 +1024,7 @@ impl Handler { msg: impl Into, code: DiagnosticId, ) { - self.emit_diag_at_span(Diagnostic::new_with_code(Warning(None), Some(code), msg), span); + self.struct_span_warn_with_code(span, msg, code).emit() } pub fn span_bug(&self, span: impl Into, msg: impl Into) -> ! { @@ -1078,20 +1072,20 @@ impl Handler { #[track_caller] pub fn span_bug_no_panic(&self, span: impl Into, msg: impl Into) { - self.emit_diag_at_span(Diagnostic::new(Bug, msg), span); + self.emit_diagnostic(Diagnostic::new(Bug, msg).set_span(span)); } #[track_caller] #[rustc_lint_diagnostics] pub fn span_note(&self, span: impl Into, msg: impl Into) { - self.emit_diag_at_span(Diagnostic::new(Note, msg), span); + self.struct_span_note(span, msg).emit() } #[track_caller] #[rustc_lint_diagnostics] pub fn struct_span_note( &self, - span: Span, + span: impl Into, msg: impl Into, ) -> DiagnosticBuilder<'_, ()> { let mut db = DiagnosticBuilder::new(self, Note, msg); @@ -1337,14 +1331,6 @@ impl Handler { note.into_diagnostic(self) } - fn emit_diag_at_span( - &self, - mut diag: Diagnostic, - sp: impl Into, - ) -> Option { - self.emit_diagnostic(diag.set_span(sp)) - } - pub fn emit_artifact_notification(&self, path: &Path, artifact_type: &str) { self.inner.borrow_mut().emitter.emit_artifact_notification(path, artifact_type); } From 9a7841251115c79fe7e1c12e2e5d637e19ad940a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 14 Dec 2023 14:13:35 +1100 Subject: [PATCH 39/40] Split `Handler::emit_diagnostic` in two. Currently, `emit_diagnostic` takes `&mut self`. This commit changes it so `emit_diagnostic` takes `self` and the new `emit_diagnostic_without_consuming` function takes `&mut self`. I find the distinction useful. The former case is much more common, and avoids a bunch of `mut` and `&mut` occurrences. We can also restrict the latter with `pub(crate)` which is nice. --- compiler/rustc_borrowck/src/lib.rs | 4 +- compiler/rustc_codegen_ssa/src/back/write.rs | 2 +- .../src/transform/check_consts/check.rs | 4 +- .../rustc_errors/src/diagnostic_builder.rs | 20 ++++---- compiler/rustc_errors/src/emitter.rs | 2 +- compiler/rustc_errors/src/lib.rs | 51 +++++++++++++------ .../rustc_expand/src/proc_macro_server.rs | 2 +- compiler/rustc_hir_typeck/src/writeback.rs | 4 +- compiler/rustc_parse/src/lib.rs | 8 +-- .../rustc_query_system/src/dep_graph/graph.rs | 4 +- src/tools/miri/src/diagnostics.rs | 2 +- src/tools/rustfmt/src/parse/session.rs | 6 +-- 12 files changed, 64 insertions(+), 45 deletions(-) diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 3d3fd412ae0d1..7e0e598cd9f7d 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -2502,8 +2502,8 @@ mod error { if !self.errors.buffered.is_empty() { self.errors.buffered.sort_by_key(|diag| diag.sort_span); - for mut diag in self.errors.buffered.drain(..) { - self.infcx.tcx.sess.diagnostic().emit_diagnostic(&mut diag); + for diag in self.errors.buffered.drain(..) { + self.infcx.tcx.sess.diagnostic().emit_diagnostic(diag); } } diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 618a72272e58f..40fd8c5c1d692 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1848,7 +1848,7 @@ impl SharedEmitterMain { d.code(code); } d.replace_args(diag.args); - handler.emit_diagnostic(&mut d); + handler.emit_diagnostic(d); } Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => { let msg = msg.strip_prefix("error: ").unwrap_or(&msg).to_string(); diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index 5380d3071d6c6..bb17602d3ba01 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -277,8 +277,8 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> { // "secondary" errors if they occurred. let secondary_errors = mem::take(&mut self.secondary_errors); if self.error_emitted.is_none() { - for mut error in secondary_errors { - self.tcx.sess.diagnostic().emit_diagnostic(&mut error); + for error in secondary_errors { + self.tcx.sess.diagnostic().emit_diagnostic(error); } } else { assert!(self.tcx.sess.has_errors().is_some()); diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index b8bd86a72e4df..315e47c097156 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -132,7 +132,7 @@ impl EmissionGuarantee for ErrorGuaranteed { DiagnosticBuilderState::Emittable(handler) => { db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation; - let guar = handler.emit_diagnostic(&mut db.inner.diagnostic); + let guar = handler.emit_diagnostic_without_consuming(&mut db.inner.diagnostic); // Only allow a guarantee if the `level` wasn't switched to a // non-error - the field isn't `pub`, but the whole `Diagnostic` @@ -181,7 +181,7 @@ impl EmissionGuarantee for () { DiagnosticBuilderState::Emittable(handler) => { db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation; - handler.emit_diagnostic(&mut db.inner.diagnostic); + handler.emit_diagnostic_without_consuming(&mut db.inner.diagnostic); } // `.emit()` was previously called, disallowed from repeating it. DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => {} @@ -207,7 +207,7 @@ impl EmissionGuarantee for Noted { // First `.emit()` call, the `&Handler` is still available. DiagnosticBuilderState::Emittable(handler) => { db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation; - handler.emit_diagnostic(&mut db.inner.diagnostic); + handler.emit_diagnostic_without_consuming(&mut db.inner.diagnostic); } // `.emit()` was previously called, disallowed from repeating it. DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => {} @@ -236,7 +236,7 @@ impl EmissionGuarantee for Bug { DiagnosticBuilderState::Emittable(handler) => { db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation; - handler.emit_diagnostic(&mut db.inner.diagnostic); + handler.emit_diagnostic_without_consuming(&mut db.inner.diagnostic); } // `.emit()` was previously called, disallowed from repeating it. DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => {} @@ -260,7 +260,7 @@ impl EmissionGuarantee for ! { DiagnosticBuilderState::Emittable(handler) => { db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation; - handler.emit_diagnostic(&mut db.inner.diagnostic); + handler.emit_diagnostic_without_consuming(&mut db.inner.diagnostic); } // `.emit()` was previously called, disallowed from repeating it. DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => {} @@ -284,7 +284,7 @@ impl EmissionGuarantee for rustc_span::fatal_error::FatalError { DiagnosticBuilderState::Emittable(handler) => { db.inner.state = DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation; - handler.emit_diagnostic(&mut db.inner.diagnostic); + handler.emit_diagnostic_without_consuming(&mut db.inner.diagnostic); } // `.emit()` was previously called, disallowed from repeating it. DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => {} @@ -365,7 +365,9 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> { } } - /// Emit the diagnostic. + /// Emit the diagnostic. Does not consume `self`, which may be surprising, + /// but there are various places that rely on continuing to use `self` + /// after calling `emit`. #[track_caller] pub fn emit(&mut self) -> G { G::diagnostic_builder_emit_producing_guarantee(self) @@ -640,13 +642,13 @@ impl Drop for DiagnosticBuilderInner<'_> { // No `.emit()` or `.cancel()` calls. DiagnosticBuilderState::Emittable(handler) => { if !panicking() { - handler.emit_diagnostic(&mut Diagnostic::new( + handler.emit_diagnostic(Diagnostic::new( Level::Bug, DiagnosticMessage::from( "the following error was constructed but not emitted", ), )); - handler.emit_diagnostic(&mut self.diagnostic); + handler.emit_diagnostic_without_consuming(&mut self.diagnostic); panic!("error was constructed but not emitted"); } } diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 3f257fdd9cf27..379883a0c18b7 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -581,7 +581,7 @@ impl Emitter for SilentEmitter { if let Some(ref note) = self.fatal_note { d.note(note.clone()); } - self.fatal_handler.emit_diagnostic(&mut d); + self.fatal_handler.emit_diagnostic(d); } } } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 508fa7c2e8e3a..cf73c638d85e1 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1054,7 +1054,7 @@ impl Handler { } let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg); diagnostic.set_span(sp); - inner.emit_diagnostic(&mut diagnostic).unwrap() + inner.emit_diagnostic(diagnostic).unwrap() } // FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`, that's @@ -1064,7 +1064,7 @@ impl Handler { let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg); if inner.flags.report_delayed_bugs { - inner.emit_diagnostic(&mut diagnostic); + inner.emit_diagnostic_without_consuming(&mut diagnostic); } let backtrace = std::backtrace::Backtrace::capture(); inner.good_path_delayed_bugs.push(DelayedDiagnostic::with_backtrace(diagnostic, backtrace)); @@ -1072,7 +1072,9 @@ impl Handler { #[track_caller] pub fn span_bug_no_panic(&self, span: impl Into, msg: impl Into) { - self.emit_diagnostic(Diagnostic::new(Bug, msg).set_span(span)); + let mut diag = Diagnostic::new(Bug, msg); + diag.set_span(span); + self.emit_diagnostic(diag); } #[track_caller] @@ -1185,10 +1187,10 @@ impl Handler { DiagnosticMessage::Str(warnings), )), (_, 0) => { - inner.emit_diagnostic(&mut Diagnostic::new(Fatal, errors)); + inner.emit_diagnostic(Diagnostic::new(Fatal, errors)); } (_, _) => { - inner.emit_diagnostic(&mut Diagnostic::new(Fatal, format!("{errors}; {warnings}"))); + inner.emit_diagnostic(Diagnostic::new(Fatal, format!("{errors}; {warnings}"))); } } @@ -1255,8 +1257,17 @@ impl Handler { self.inner.borrow_mut().emitter.emit_diagnostic(&db); } - pub fn emit_diagnostic(&self, diagnostic: &mut Diagnostic) -> Option { - self.inner.borrow_mut().emit_diagnostic(diagnostic) + pub fn emit_diagnostic(&self, mut diagnostic: Diagnostic) -> Option { + self.emit_diagnostic_without_consuming(&mut diagnostic) + } + + // It's unfortunate this exists. `emit_diagnostic` is preferred, because it + // consumes the diagnostic, thus ensuring it is emitted just once. + pub(crate) fn emit_diagnostic_without_consuming( + &self, + diagnostic: &mut Diagnostic, + ) -> Option { + self.inner.borrow_mut().emit_diagnostic_without_consuming(diagnostic) } pub fn emit_err<'a>(&'a self, err: impl IntoDiagnostic<'a>) -> ErrorGuaranteed { @@ -1370,7 +1381,7 @@ impl Handler { // Here the diagnostic is given back to `emit_diagnostic` where it was first // intercepted. Now it should be processed as usual, since the unstable expectation // id is now stable. - inner.emit_diagnostic(&mut diag); + inner.emit_diagnostic(diag); } } @@ -1412,7 +1423,7 @@ impl HandlerInner { let has_errors = self.has_errors(); let diags = self.stashed_diagnostics.drain(..).map(|x| x.1).collect::>(); let mut reported = None; - for mut diag in diags { + for diag in diags { // Decrement the count tracking the stash; emitting will increment it. if diag.is_error() { if matches!(diag.level, Level::Error { lint: true }) { @@ -1432,14 +1443,20 @@ impl HandlerInner { } } } - let reported_this = self.emit_diagnostic(&mut diag); + let reported_this = self.emit_diagnostic(diag); reported = reported.or(reported_this); } reported } - // FIXME(eddyb) this should ideally take `diagnostic` by value. - fn emit_diagnostic(&mut self, diagnostic: &mut Diagnostic) -> Option { + fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option { + self.emit_diagnostic_without_consuming(&mut diagnostic) + } + + fn emit_diagnostic_without_consuming( + &mut self, + diagnostic: &mut Diagnostic, + ) -> Option { if matches!(diagnostic.level, Level::Error { .. } | Level::Fatal) && self.treat_err_as_bug() { diagnostic.level = Level::Bug; @@ -1576,12 +1593,14 @@ impl HandlerInner { #[track_caller] fn span_bug(&mut self, sp: impl Into, msg: impl Into) -> ! { - self.emit_diagnostic(Diagnostic::new(Bug, msg).set_span(sp)); + let mut diag = Diagnostic::new(Bug, msg); + diag.set_span(sp); + self.emit_diagnostic(diag); panic::panic_any(ExplicitBug); } fn failure_note(&mut self, msg: impl Into) { - self.emit_diagnostic(&mut Diagnostic::new(FailureNote, msg)); + self.emit_diagnostic(Diagnostic::new(FailureNote, msg)); } fn flush_delayed( @@ -1613,7 +1632,7 @@ impl HandlerInner { if no_bugs { // Put the overall explanation before the `DelayedBug`s, to // frame them better (e.g. separate warnings from them). - self.emit_diagnostic(&mut Diagnostic::new(Bug, explanation)); + self.emit_diagnostic(Diagnostic::new(Bug, explanation)); no_bugs = false; } @@ -1628,7 +1647,7 @@ impl HandlerInner { } bug.level = Level::Bug; - self.emit_diagnostic(&mut bug); + self.emit_diagnostic(bug); } // Panic with `DelayedBugPanic` to avoid "unexpected panic" messages. diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index 5308e338d7f8b..d2c26668ea83a 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -502,7 +502,7 @@ impl server::FreeFunctions for Rustc<'_, '_> { None, ); } - self.sess().span_diagnostic.emit_diagnostic(&mut diag); + self.sess().span_diagnostic.emit_diagnostic(diag); } } diff --git a/compiler/rustc_hir_typeck/src/writeback.rs b/compiler/rustc_hir_typeck/src/writeback.rs index 1609c036fbd95..5e562d9453f15 100644 --- a/compiler/rustc_hir_typeck/src/writeback.rs +++ b/compiler/rustc_hir_typeck/src/writeback.rs @@ -504,8 +504,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { if !errors_buffer.is_empty() { errors_buffer.sort_by_key(|diag| diag.span.primary_span()); - for mut diag in errors_buffer { - self.tcx().sess.diagnostic().emit_diagnostic(&mut diag); + for diag in errors_buffer { + self.tcx().sess.diagnostic().emit_diagnostic(diag); } } } diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 95352dbdc134f..9887a85e6a40c 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -51,8 +51,8 @@ macro_rules! panictry_buffer { match $e { Ok(e) => e, Err(errs) => { - for mut e in errs { - $handler.emit_diagnostic(&mut e); + for e in errs { + $handler.emit_diagnostic(e); } FatalError.raise() } @@ -165,8 +165,8 @@ fn try_file_to_source_file( fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option) -> Lrc { match try_file_to_source_file(sess, path, spanopt) { Ok(source_file) => source_file, - Err(mut d) => { - sess.span_diagnostic.emit_diagnostic(&mut d); + Err(d) => { + sess.span_diagnostic.emit_diagnostic(d); FatalError.raise(); } } diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index bc09972185a62..3b8ccb67bbefd 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -926,8 +926,8 @@ impl DepGraphData { let handle = qcx.dep_context().sess().diagnostic(); - for mut diagnostic in side_effects.diagnostics { - handle.emit_diagnostic(&mut diagnostic); + for diagnostic in side_effects.diagnostics { + handle.emit_diagnostic(diagnostic); } } } diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index ef394b163103b..e0f5914497502 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -512,7 +512,7 @@ pub fn report_msg<'tcx>( } } - handler.emit_diagnostic(&mut err); + handler.emit_diagnostic(err); } impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { diff --git a/src/tools/rustfmt/src/parse/session.rs b/src/tools/rustfmt/src/parse/session.rs index 0573df9de2f6d..06f9c4c624336 100644 --- a/src/tools/rustfmt/src/parse/session.rs +++ b/src/tools/rustfmt/src/parse/session.rs @@ -284,10 +284,8 @@ impl ParseSess { // Methods that should be restricted within the parse module. impl ParseSess { pub(super) fn emit_diagnostics(&self, diagnostics: Vec) { - for mut diagnostic in diagnostics { - self.parse_sess - .span_diagnostic - .emit_diagnostic(&mut diagnostic); + for diagnostic in diagnostics { + self.parse_sess.span_diagnostic.emit_diagnostic(diagnostic); } } From 7c5d692a4ef619c7be3fe061719014cc05d74d0a Mon Sep 17 00:00:00 2001 From: The Miri Conjob Bot Date: Fri, 15 Dec 2023 04:54:30 +0000 Subject: [PATCH 40/40] Preparing for merge from rustc --- src/tools/miri/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index 0e75e593a996a..e82b7f841543a 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -e6d1b0ec9859e6f5c29aaa3b6525fb625bf354ad +604f185fae9a4b0edf7e28f616a0f53880f8f074