diff --git a/Cargo.lock b/Cargo.lock index 60988e0ff4bc1..ce3fd04faf3bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3817,6 +3817,7 @@ dependencies = [ "rustc_abi", "rustc_ast", "rustc_codegen_ssa", + "rustc_crate_store", "rustc_data_structures", "rustc_errors", "rustc_fs_util", @@ -3853,6 +3854,7 @@ dependencies = [ "rustc_arena", "rustc_ast", "rustc_attr_parsing", + "rustc_crate_store", "rustc_data_structures", "rustc_errors", "rustc_fs_util", @@ -3903,6 +3905,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "rustc_crate_store" +version = "0.0.0" +dependencies = [ + "rustc_abi", + "rustc_attr_ir", + "rustc_data_structures", + "rustc_hir_id", + "rustc_macros", + "rustc_serialize", + "rustc_span", +] + [[package]] name = "rustc_data_structures" version = "0.0.0" @@ -4091,7 +4106,6 @@ name = "rustc_hir" version = "0.0.0" dependencies = [ "bitflags", - "odht", "rustc_abi", "rustc_arena", "rustc_ast", @@ -4099,7 +4113,6 @@ dependencies = [ "rustc_data_structures", "rustc_error_messages", "rustc_errors", - "rustc_hashes", "rustc_hir_id", "rustc_index", "rustc_lint_defs", @@ -4139,11 +4152,14 @@ dependencies = [ name = "rustc_hir_id" version = "0.0.0" dependencies = [ + "odht", "rustc_data_structures", + "rustc_hashes", "rustc_index", "rustc_macros", "rustc_serialize", "rustc_span", + "tracing", ] [[package]] @@ -4253,6 +4269,7 @@ dependencies = [ "rustc_codegen_llvm", "rustc_codegen_ssa", "rustc_const_eval", + "rustc_crate_store", "rustc_data_structures", "rustc_errors", "rustc_expand", @@ -4381,6 +4398,7 @@ dependencies = [ "rustc_abi", "rustc_ast", "rustc_attr_parsing", + "rustc_crate_store", "rustc_data_structures", "rustc_errors", "rustc_expand", @@ -4414,6 +4432,7 @@ dependencies = [ "rustc_arena", "rustc_ast", "rustc_ast_ir", + "rustc_crate_store", "rustc_data_structures", "rustc_error_messages", "rustc_errors", @@ -4577,6 +4596,7 @@ dependencies = [ "rustc_ast", "rustc_ast_lowering", "rustc_attr_parsing", + "rustc_crate_store", "rustc_data_structures", "rustc_errors", "rustc_expand", @@ -4642,10 +4662,10 @@ name = "rustc_public" version = "0.1.0-preview" dependencies = [ "rustc_abi", + "rustc_crate_store", "rustc_hir", "rustc_middle", "rustc_public_bridge", - "rustc_session", "rustc_span", "rustc_target", "scoped-tls", @@ -4659,11 +4679,11 @@ name = "rustc_public_bridge" version = "0.0.0" dependencies = [ "rustc_abi", + "rustc_crate_store", "rustc_data_structures", "rustc_hir", "rustc_hir_pretty", "rustc_middle", - "rustc_session", "rustc_span", "rustc_target", ] @@ -4753,7 +4773,6 @@ dependencies = [ "rustc_feature", "rustc_fs_util", "rustc_hashes", - "rustc_hir", "rustc_lint_defs", "rustc_macros", "rustc_serialize", @@ -4855,6 +4874,7 @@ dependencies = [ "itertools", "rustc_abi", "rustc_ast", + "rustc_crate_store", "rustc_data_structures", "rustc_errors", "rustc_hir", diff --git a/bootstrap.example.toml b/bootstrap.example.toml index 3752f1bcc2ce6..418c5a4a9cb81 100644 --- a/bootstrap.example.toml +++ b/bootstrap.example.toml @@ -944,6 +944,18 @@ # because bootstrap will attempt to download the JSON docs data for this commit from its CI. #rust.stdlib-semver-baseline = "" +# Enables building a wasm proc macro compatible toolchain. +# +# This requires building an additional standard library for a different target and adding it +# to the sysroot before running tests, and so needs special handling in bootstrap. Currently +# off by default. +# +# This currently opts compiletest into running/building proc-macro tests via wasm. +# +# The implementation for this has not finished landing, so you probably don't +# want to enable this right now. +#rust.wasm-proc-macros = false + # ============================================================================= # Distribution options # diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 1e0fd78b4dd75..589c5a5cb1229 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -2383,7 +2383,7 @@ pub enum AbiFromStrErr { NoExplicitUnwind, } -// NOTE: This struct is generic over the FieldIdx and VariantIdx for rust-analyzer usage. +// NOTE: This struct is generic over the FieldIdx for rust-analyzer usage. #[derive(PartialEq, Eq, Hash, Clone, Debug)] #[cfg_attr(feature = "nightly", derive(StableHash))] pub struct VariantLayout { diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index f1ebc4292ee87..ee6150322a442 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -346,7 +346,7 @@ pub struct ParenthesizedArgs { pub span: Span, /// `(A, B)` - pub inputs: ThinVec>, + pub inputs: ThinVec, /// ```text /// Foo(A, B) -> C @@ -364,7 +364,7 @@ impl ParenthesizedArgs { .inputs .iter() .cloned() - .map(|input| AngleBracketedArg::Arg(GenericArg::Type(input))) + .map(|input| AngleBracketedArg::Arg(GenericArg::Type(input.ty))) .collect(); AngleBracketedArgs { span: self.inputs_span, args } } diff --git a/compiler/rustc_ast_lowering/src/path.rs b/compiler/rustc_ast_lowering/src/path.rs index 8ac9654d4ba53..ae260c7d126ab 100644 --- a/compiler/rustc_ast_lowering/src/path.rs +++ b/compiler/rustc_ast_lowering/src/path.rs @@ -512,8 +512,8 @@ impl<'hir> LoweringContext<'_, 'hir> { // compatibility, even in contexts like an impl header where // we generally don't permit such things (see #51008). let ParenthesizedArgs { span, inputs, inputs_span, output } = data; - let inputs = self.arena.alloc_from_iter(inputs.iter().map(|ty| { - self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::FnTraitParam)) + let inputs = self.arena.alloc_from_iter(inputs.iter().map(|param| { + self.lower_ty(¶m.ty, ImplTraitContext::Disallowed(ImplTraitPosition::FnTraitParam)) })); let output_ty = match output { // Only allow `impl Trait` in return position. i.e.: diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index c630277dc77e2..f64d499d1bde0 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -1771,7 +1771,7 @@ impl Visitor<'_> for AstValidator<'_> { } } GenericArgs::Parenthesized(data) => { - walk_list!(self, visit_ty, &data.inputs); + walk_list!(self, visit_param, &data.inputs); if let FnRetTy::Ty(ty) = &data.output { // `-> Foo` syntax is essentially an associated type binding, // so it is also allowed to contain nested `impl Trait`. diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 64c0be27a2daa..672ea9e5669f0 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -1212,7 +1212,7 @@ impl<'a> PrintState<'a> for State<'a> { ast::GenericArgs::Parenthesized(data) => { self.word("("); - self.commasep(Inconsistent, &data.inputs, |s, ty| s.print_type(ty)); + self.commasep(Inconsistent, &data.inputs, |s, param| s.print_param(param, false)); self.word(")"); self.print_fn_ret_ty(&data.output); } diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index f085eba9d5307..913835a080db8 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -21,6 +21,7 @@ rustc-demangle = "0.1.28" rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } rustc_codegen_ssa = { path = "../rustc_codegen_ssa" } +rustc_crate_store = { path = "../rustc_crate_store" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_fs_util = { path = "../rustc_fs_util" } diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index e900bc1aecd46..3fe4550b6759e 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -8,6 +8,7 @@ use rustc_abi::{self as abi, ExternAbi, HasDataLayout as _}; use rustc_ast::Mutability; use rustc_codegen_ssa::common::TypeKind; use rustc_codegen_ssa::traits::*; +use rustc_crate_store::DllImport; use rustc_data_structures::stable_hash::{StableHash, StableHasher}; use rustc_hashes::Hash128; use rustc_hir::def::DefKind; @@ -15,7 +16,6 @@ use rustc_hir::def_id::DefId; use rustc_middle::bug; use rustc_middle::mir::interpret::{GlobalAlloc, PointerArithmetic, Scalar}; use rustc_middle::ty::{Instance, TyCtxt}; -use rustc_session::cstore::DllImport; use rustc_session::{PointerAuthAddressDiscriminator, PointerAuthSchema}; use tracing::debug; diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index f33d144ac5c63..d4bece718a8b9 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -16,6 +16,7 @@ rustc_abi = { path = "../rustc_abi" } rustc_arena = { path = "../rustc_arena" } rustc_ast = { path = "../rustc_ast" } rustc_attr_parsing = { path = "../rustc_attr_parsing" } +rustc_crate_store = { path = "../rustc_crate_store" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_fs_util = { path = "../rustc_fs_util" } diff --git a/compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs b/compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs index f8cc07201d10f..0c9a414fd3015 100644 --- a/compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs +++ b/compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs @@ -3,13 +3,13 @@ use std::io::{BufWriter, Write}; use std::path::{Path, PathBuf}; use rustc_abi::Endian; +use rustc_crate_store::{DllImport, DllImportSymbolType}; use rustc_data_structures::base_n::{CASE_INSENSITIVE, ToBaseN}; use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; use rustc_data_structures::stable_hash::StableHasher; use rustc_hashes::Hash128; use rustc_hir::attrs::NativeLibKind; use rustc_session::Session; -use rustc_session::cstore::{DllImport, DllImportSymbolType}; use rustc_span::Symbol; use rustc_target::spec::Arch; diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index 135faa5817516..4c99da5049e82 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -532,7 +532,8 @@ impl<'a> Linker for GccLinker<'a> { LinkOutputKind::StaticNoPicExe => { // `-static` works for both gcc wrapper and ld. self.link_or_cc_arg("-static"); - if !self.is_ld && self.is_gnu { + // noop on windows w/ gcc, warning w/ clang + if !self.is_ld && self.is_gnu && !self.sess.target.is_like_windows { self.cc_arg("-no-pie"); } } diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index bad8600905e3e..941e9d28fc7e1 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -2,6 +2,7 @@ use std::collections::hash_map::Entry::*; use rustc_abi::{CanonAbi, X86Call}; use rustc_ast::expand::allocator::{AllocatorKind, NO_ALLOC_SHIM_IS_UNSTABLE, global_fn_name}; +use rustc_crate_store::CrateDepKind; use rustc_data_structures::unord::UnordMap; use rustc_hir as hir; use rustc_hir::def::DefKind; @@ -17,7 +18,6 @@ use rustc_middle::ty::{ }; use rustc_middle::util::Providers; use rustc_session::config::CrateType; -use rustc_session::cstore::CrateDepKind; use rustc_span::Span; use rustc_symbol_mangling::mangle_internal_symbol; use rustc_target::spec::{Arch, Os, TlsModel}; diff --git a/compiler/rustc_codegen_ssa/src/common.rs b/compiler/rustc_codegen_ssa/src/common.rs index e9024b7dbe934..e2bbe6bf16505 100644 --- a/compiler/rustc_codegen_ssa/src/common.rs +++ b/compiler/rustc_codegen_ssa/src/common.rs @@ -1,12 +1,12 @@ #![allow(non_camel_case_types)] +use rustc_crate_store::{DllCallingConvention, DllImport, DllImportSymbolType}; use rustc_hir::attrs::PeImportNameType; use rustc_hir::attrs::lang_items::LangItem; use rustc_middle::mir::interpret::{GlobalAlloc, PointerArithmetic, Scalar}; use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::{self, Instance, ScalarInt, TyCtxt}; use rustc_middle::{bug, span_bug}; -use rustc_session::cstore::{DllCallingConvention, DllImport, DllImportSymbolType}; use rustc_span::Span; use rustc_target::spec::{CfgAbi, Env, Os, Target}; diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index 02ae2d50390cc..d62c5c713f9ea 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -19,6 +19,7 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; use rustc_abi::Size; +use rustc_crate_store::{self as cstore, CrateSource}; use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; use rustc_data_structures::unord::{UnordMap, UnordSet}; use rustc_hir::CRATE_HIR_ID; @@ -38,7 +39,6 @@ use rustc_serialize::opaque::{FileEncoder, MemDecoder}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_session::Session; use rustc_session::config::{CrateType, OutputFilenames, OutputType}; -use rustc_session::cstore::{self, CrateSource}; use rustc_session::lint::builtin::LINKER_MESSAGES; use rustc_span::{Span, Symbol}; @@ -207,7 +207,7 @@ bitflags::bitflags! { } } -// This is the same as `rustc_session::cstore::NativeLib`, except: +// This is the same as `rustc_crate_store::NativeLib`, except: // - (important) the `foreign_module` field is missing, because it contains a `DefId`, which can't // be encoded with `FileEncoder`. // - (less important) the `verbatim` field is a `bool` rather than an `Option`, because here diff --git a/compiler/rustc_crate_store/Cargo.toml b/compiler/rustc_crate_store/Cargo.toml new file mode 100644 index 0000000000000..7c84c26afe2dc --- /dev/null +++ b/compiler/rustc_crate_store/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "rustc_crate_store" +version = "0.0.0" +edition = "2024" + +[dependencies] +# tidy-alphabetical-start +rustc_abi = { path = "../rustc_abi" } +rustc_attr_ir = { path = "../rustc_attr_ir" } +rustc_data_structures = { path = "../rustc_data_structures" } +rustc_hir_id = { path = "../rustc_hir_id" } +rustc_macros = { path = "../rustc_macros" } +rustc_serialize = { path = "../rustc_serialize" } +rustc_span = { path = "../rustc_span" } +# tidy-alphabetical-end diff --git a/compiler/rustc_session/src/cstore.rs b/compiler/rustc_crate_store/src/cstore.rs similarity index 97% rename from compiler/rustc_session/src/cstore.rs rename to compiler/rustc_crate_store/src/cstore.rs index 0db1a645acafe..e3b339a5ce871 100644 --- a/compiler/rustc_session/src/cstore.rs +++ b/compiler/rustc_crate_store/src/cstore.rs @@ -8,16 +8,13 @@ use std::path::PathBuf; use rustc_abi::ExternAbi; use rustc_attr_ir::{CfgEntry, NativeLibKind, PeImportNameType}; use rustc_data_structures::sync::{self, AppendOnlyIndexVec, FreezeLock}; -// FIXME: Can we not depend on `rustc_hir` here? :) -use rustc_hir::definitions::{DefKey, DefPath, Definitions}; +use rustc_hir_id::definitions::{DefKey, DefPath, Definitions}; use rustc_macros::{BlobDecodable, Decodable, Encodable, StableHash}; use rustc_span::def_id::{ CrateNum, DefId, DefPathHash, LOCAL_CRATE, LocalDefId, StableCrateId, StableCrateIdMap, }; use rustc_span::{Span, Symbol}; -// lonely orphan structs and enums looking for a better home - /// Where a crate came from on the local filesystem. One of these three options /// must be non-None. #[derive(PartialEq, Clone, Debug, StableHash, Encodable, Decodable)] diff --git a/compiler/rustc_crate_store/src/lib.rs b/compiler/rustc_crate_store/src/lib.rs new file mode 100644 index 0000000000000..1f6684e7a2317 --- /dev/null +++ b/compiler/rustc_crate_store/src/lib.rs @@ -0,0 +1,3 @@ +mod cstore; + +pub use cstore::*; diff --git a/compiler/rustc_hir/Cargo.toml b/compiler/rustc_hir/Cargo.toml index 991093cd26914..11171fec141da 100644 --- a/compiler/rustc_hir/Cargo.toml +++ b/compiler/rustc_hir/Cargo.toml @@ -6,7 +6,6 @@ edition = "2024" [dependencies] # tidy-alphabetical-start bitflags = "2.9.1" -odht = { version = "0.3.1", features = ["nightly"] } rustc_abi = { path = "../rustc_abi" } rustc_arena = { path = "../rustc_arena" } rustc_ast = { path = "../rustc_ast" } @@ -14,7 +13,6 @@ rustc_attr_ir = { path = "../rustc_attr_ir" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_error_messages = { path = "../rustc_error_messages" } rustc_errors = { path = "../rustc_errors" } -rustc_hashes = { path = "../rustc_hashes" } rustc_hir_id = { path = "../rustc_hir_id" } rustc_index = { path = "../rustc_index" } rustc_lint_defs = { path = "../rustc_lint_defs" } diff --git a/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs index 3885e28133087..8fa3b0e83aafe 100644 --- a/compiler/rustc_hir/src/lib.rs +++ b/compiler/rustc_hir/src/lib.rs @@ -16,8 +16,6 @@ mod arena; pub mod def; -pub mod def_path_hash_map; -pub mod definitions; mod hir; pub mod intravisit; pub mod lints; @@ -25,9 +23,6 @@ pub mod pat_util; mod stable_hash_impls; mod target_impls; -#[cfg(test)] -mod tests; - #[doc(no_inline)] pub use hir::*; pub use rustc_attr_ir::{self as attrs, find_attr}; diff --git a/compiler/rustc_hir_id/Cargo.toml b/compiler/rustc_hir_id/Cargo.toml index c357a4f62d968..bfdfb3b04cd99 100644 --- a/compiler/rustc_hir_id/Cargo.toml +++ b/compiler/rustc_hir_id/Cargo.toml @@ -5,9 +5,12 @@ edition = "2024" [dependencies] # tidy-alphabetical-start +odht = { version = "0.3.1", features = ["nightly"] } rustc_data_structures = { path = "../rustc_data_structures" } +rustc_hashes = { path = "../rustc_hashes" } rustc_index = { path = "../rustc_index" } rustc_macros = { path = "../rustc_macros" } rustc_serialize = { path = "../rustc_serialize" } rustc_span = { path = "../rustc_span" } +tracing = "0.1" # tidy-alphabetical-end diff --git a/compiler/rustc_hir/src/def_path_hash_map.rs b/compiler/rustc_hir_id/src/def_path_hash_map.rs similarity index 100% rename from compiler/rustc_hir/src/def_path_hash_map.rs rename to compiler/rustc_hir_id/src/def_path_hash_map.rs diff --git a/compiler/rustc_hir/src/definitions.rs b/compiler/rustc_hir_id/src/definitions.rs similarity index 99% rename from compiler/rustc_hir/src/definitions.rs rename to compiler/rustc_hir_id/src/definitions.rs index 8b37ee2835e6c..b334efab351bc 100644 --- a/compiler/rustc_hir/src/definitions.rs +++ b/compiler/rustc_hir_id/src/definitions.rs @@ -12,12 +12,13 @@ use rustc_data_structures::stable_hash::StableHasher; use rustc_hashes::Hash64; use rustc_index::IndexVec; use rustc_macros::{BlobDecodable, Decodable, Encodable, extension}; -use rustc_span::def_id::LocalDefIdMap; +pub use rustc_span::def_id::DefPathHash; +use rustc_span::def_id::{ + CRATE_DEF_INDEX, CrateNum, DefIndex, LOCAL_CRATE, LocalDefId, LocalDefIdMap, StableCrateId, +}; use rustc_span::{Symbol, kw, sym}; use tracing::{debug, instrument}; -pub use crate::def_id::DefPathHash; -use crate::def_id::{CRATE_DEF_INDEX, CrateNum, DefIndex, LOCAL_CRATE, LocalDefId, StableCrateId}; use crate::def_path_hash_map::DefPathHashMap; #[derive(Debug, Default, Clone)] diff --git a/compiler/rustc_hir_id/src/lib.rs b/compiler/rustc_hir_id/src/lib.rs index 07b1cceebaf76..dce7e7fd31a36 100644 --- a/compiler/rustc_hir_id/src/lib.rs +++ b/compiler/rustc_hir_id/src/lib.rs @@ -4,6 +4,12 @@ #![feature(negative_impls)] #![feature(rustc_attrs)] +pub mod def_path_hash_map; +pub mod definitions; + +#[cfg(test)] +mod tests; + use std::fmt::{self, Debug}; use rustc_data_structures::stable_hash::{ diff --git a/compiler/rustc_hir/src/tests.rs b/compiler/rustc_hir_id/src/tests.rs similarity index 100% rename from compiler/rustc_hir/src/tests.rs rename to compiler/rustc_hir_id/src/tests.rs diff --git a/compiler/rustc_interface/Cargo.toml b/compiler/rustc_interface/Cargo.toml index 4a272867046b4..f2b3e79c72119 100644 --- a/compiler/rustc_interface/Cargo.toml +++ b/compiler/rustc_interface/Cargo.toml @@ -16,6 +16,7 @@ rustc_builtin_macros = { path = "../rustc_builtin_macros" } rustc_codegen_llvm = { path = "../rustc_codegen_llvm", optional = true } rustc_codegen_ssa = { path = "../rustc_codegen_ssa" } rustc_const_eval = { path = "../rustc_const_eval" } +rustc_crate_store = { path = "../rustc_crate_store" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_expand = { path = "../rustc_expand" } diff --git a/compiler/rustc_interface/src/diagnostics.rs b/compiler/rustc_interface/src/diagnostics.rs index 44d6073b93037..9e6d4317c98e5 100644 --- a/compiler/rustc_interface/src/diagnostics.rs +++ b/compiler/rustc_interface/src/diagnostics.rs @@ -53,6 +53,10 @@ pub(crate) struct MixedBinCrate; #[diag("cannot mix `proc-macro` crate type with others")] pub(crate) struct MixedProcMacroCrate; +#[derive(Diagnostic)] +#[diag("cannot compile `proc-macro` crate to wasm targets without -Zwasm-proc-macros")] +pub(crate) struct UnstableWasmProcMacro; + #[derive(Diagnostic)] #[diag("error writing dependencies to `{$path}`: {$error}")] pub(crate) struct ErrorWritingDependencies<'a> { diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index cdba198297201..1f834b8e8f200 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -9,6 +9,7 @@ use rustc_ast as ast; use rustc_attr_parsing::{AttributeParser, ShouldEmit}; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_codegen_ssa::{CompiledModules, CrateInfo}; +use rustc_crate_store::Untracked; use rustc_data_structures::indexmap::IndexMap; use rustc_data_structures::steal::Steal; use rustc_data_structures::sync::{ @@ -36,7 +37,6 @@ use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_em use rustc_passes::{abi_test, input_stats, layout_test}; use rustc_resolve::{Resolver, ResolverOutputs}; use rustc_session::config::{CrateType, Input, OutFileName, OutputFilenames, OutputType}; -use rustc_session::cstore::Untracked; use rustc_session::diagnostics::feature_err; use rustc_session::output::{filename_for_input, invalid_output_for_target}; use rustc_session::search_paths::PathKind; @@ -275,6 +275,12 @@ fn configure_and_expand( sess.dcx().emit_err(diagnostics::MixedProcMacroCrate); } } + + if is_proc_macro_crate && sess.target.is_like_wasm && !sess.opts.unstable_opts.wasm_proc_macros + { + sess.dcx().emit_err(diagnostics::UnstableWasmProcMacro); + } + if crate_types.contains(&CrateType::Sdylib) && !tcx.features().export_stable() { feature_err(sess, sym::export_stable, DUMMY_SP, "`sdylib` crate type is unstable").emit(); } @@ -1312,7 +1318,7 @@ pub(crate) fn start_codegen<'tcx>( // Skip crate items and just output metadata in -Z no-codegen mode. tcx.sess.dcx().abort_if_errors(); - // Linker::link will skip join_codegen in case of a CodegenResults Any value. + // Linker::link will skip join_codegen in case of a `CompiledModules` Any value. Box::new(CompiledModules { modules: vec![], allocator_module: None }) } else { codegen_backend.codegen_crate(tcx) diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index f3a6dfea5959e..548ee3f4b8e7b 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -910,6 +910,7 @@ fn test_unstable_options_tracking_hash() { tracked!(verify_llvm_ir, true); tracked!(virtual_function_elimination, true); tracked!(wasi_exec_model, Some(WasiExecModel::Reactor)); + tracked!(wasm_proc_macros, true); // tidy-alphabetical-end macro_rules! tracked_no_crate_hash { diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index f6ea8ca19ce69..23b152bd57240 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -363,7 +363,7 @@ pub fn get_codegen_backend( filename if filename.contains('.') => { load_backend_from_dylib(early_dcx, filename.as_ref()) } - "dummy" => || Box::new(DummyCodegenBackend { target_config_override: None }), + "dummy" => || Box::new(DummyCodegenBackend), #[cfg(feature = "llvm")] "llvm" => rustc_codegen_llvm::LlvmCodegenBackend::new, backend_name => get_codegen_sysroot(early_dcx, sysroot, backend_name), @@ -376,9 +376,7 @@ pub fn get_codegen_backend( unsafe { load() } } -pub struct DummyCodegenBackend { - pub target_config_override: Option TargetConfig>>, -} +pub struct DummyCodegenBackend; impl CodegenBackend for DummyCodegenBackend { fn name(&self) -> &'static str { @@ -386,10 +384,6 @@ impl CodegenBackend for DummyCodegenBackend { } fn target_config(&self, sess: &Session) -> TargetConfig { - if let Some(target_config_override) = &self.target_config_override { - return target_config_override(sess); - } - let abi_required_features = sess.target.abi_required_features(); let internal_target_features = internal_target_features::<0>( sess, diff --git a/compiler/rustc_metadata/Cargo.toml b/compiler/rustc_metadata/Cargo.toml index 2fce131e08b6a..c079a42b0fa22 100644 --- a/compiler/rustc_metadata/Cargo.toml +++ b/compiler/rustc_metadata/Cargo.toml @@ -11,6 +11,7 @@ odht = { version = "0.3.1", features = ["nightly"] } rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } rustc_attr_parsing = { path = "../rustc_attr_parsing" } +rustc_crate_store = { path = "../rustc_crate_store" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_expand = { path = "../rustc_expand" } diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 8879c175da2f9..6543b5700192e 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -7,6 +7,7 @@ use std::{cmp, env, iter}; use rustc_ast::expand::allocator::{ALLOC_ERROR_HANDLER, AllocatorKind, global_fn_name}; use rustc_ast::{self as ast, *}; +use rustc_crate_store::{CrateDepKind, CrateSource, ExternCrate, ExternCrateSource}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::owned_slice::OwnedSlice; use rustc_data_structures::svh::Svh; @@ -26,7 +27,6 @@ use rustc_session::config::{ CrateType, ExtendedTargetModifierInfo, ExternLocation, Externs, OptionsTargetModifiers, TargetModifier, }; -use rustc_session::cstore::{CrateDepKind, CrateSource, ExternCrate, ExternCrateSource}; use rustc_session::output::validate_crate_name; use rustc_session::search_paths::PathKind; use rustc_session::{Session, lint}; diff --git a/compiler/rustc_metadata/src/dependency_format.rs b/compiler/rustc_metadata/src/dependency_format.rs index 257b2a9b03884..6460e20ce211b 100644 --- a/compiler/rustc_metadata/src/dependency_format.rs +++ b/compiler/rustc_metadata/src/dependency_format.rs @@ -51,6 +51,8 @@ //! Additionally, the algorithm is geared towards finding *any* solution rather //! than finding a number of solutions (there are normally quite a few). +use rustc_crate_store::CrateDepKind; +use rustc_crate_store::LinkagePreference::{self, RequireDynamic, RequireStatic}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc_index::IndexVec; @@ -58,8 +60,6 @@ use rustc_middle::bug; use rustc_middle::middle::dependency_format::{Dependencies, DependencyList, Linkage}; use rustc_middle::ty::TyCtxt; use rustc_session::config::CrateType; -use rustc_session::cstore::CrateDepKind; -use rustc_session::cstore::LinkagePreference::{self, RequireDynamic, RequireStatic}; use rustc_span::sym; use rustc_target::spec::PanicStrategy; use tracing::info; diff --git a/compiler/rustc_metadata/src/foreign_modules.rs b/compiler/rustc_metadata/src/foreign_modules.rs index 8a6b2027083d6..0b73656f779dd 100644 --- a/compiler/rustc_metadata/src/foreign_modules.rs +++ b/compiler/rustc_metadata/src/foreign_modules.rs @@ -1,10 +1,10 @@ +use rustc_crate_store::ForeignModule; use rustc_data_structures::fx::FxIndexMap; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::DefId; use rustc_middle::query::LocalCrate; use rustc_middle::ty::TyCtxt; -use rustc_session::cstore::ForeignModule; pub(crate) fn collect(tcx: TyCtxt<'_>, LocalCrate: LocalCrate) -> FxIndexMap { let mut modules = FxIndexMap::default(); diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index f26b27399b958..687776386e36e 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -218,6 +218,7 @@ use std::ops::Deref; use std::path::{Path, PathBuf}; use std::{cmp, fmt}; +use rustc_crate_store::CrateSource; use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_data_structures::memmap::Mmap; use rustc_data_structures::owned_slice::{OwnedSlice, slice_owned}; @@ -225,7 +226,6 @@ use rustc_data_structures::svh::Svh; use rustc_errors::{DiagArgValue, IntoDiagArg}; use rustc_fs_util::try_canonicalize; use rustc_proc_macro::bridge::client::Client as ProcMacroClient; -use rustc_session::cstore::CrateSource; use rustc_session::filesearch::FileSearch; use rustc_session::search_paths::PathKind; use rustc_session::utils::CanonicalizedPath; diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 1c0d8d2affe6a..138bb55847255 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -1,5 +1,8 @@ use rustc_abi::ExternAbi; use rustc_attr_parsing::eval_config_entry; +use rustc_crate_store::{ + DllCallingConvention, DllImport, DllImportSymbolType, ForeignModule, NativeLib, +}; use rustc_data_structures::fx::FxHashSet; use rustc_hir::attrs::{NativeLibKind, PeImportNameType}; use rustc_hir::def::DefKind; @@ -9,9 +12,6 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::query::LocalCrate; use rustc_middle::ty::{self, List, Ty, TyCtxt}; use rustc_session::Session; -use rustc_session::cstore::{ - DllCallingConvention, DllImport, DllImportSymbolType, ForeignModule, NativeLib, -}; use rustc_span::Symbol; use rustc_span::def_id::{DefId, LOCAL_CRATE}; use rustc_target::spec::{Arch, BinaryFormat, CfgAbi}; diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index 3a7cffb5989fc..f4d3380594c9f 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -8,6 +8,7 @@ use std::{io, mem}; pub(super) use cstore_impl::provide; use rustc_ast as ast; +use rustc_crate_store::{CrateSource, ExternCrate}; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::owned_slice::OwnedSlice; @@ -32,7 +33,6 @@ use rustc_serialize::opaque::MemDecoder; use rustc_serialize::{Decodable, Decoder}; use rustc_session::config::TargetModifier; use rustc_session::config::mitigation_coverage::DeniedPartialMitigation; -use rustc_session::cstore::{CrateSource, ExternCrate}; use rustc_span::def_id::ModId; use rustc_span::hygiene::HygieneDecodeContext; use rustc_span::{ diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs index 3f73b14fb85ee..8fe1d6561d135 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs @@ -2,6 +2,7 @@ use std::any::Any; use std::mem; use std::sync::Arc; +use rustc_crate_store::{CrateStore, ExternCrate}; use rustc_data_structures::fx::FxHashMap; use rustc_hir::attrs::Deprecation; use rustc_hir::def::{CtorKind, DefKind}; @@ -19,7 +20,6 @@ use rustc_middle::ty::{self, TyCtxt, TypeVisitable}; use rustc_middle::util::Providers; use rustc_serialize::Decoder; use rustc_session::StableCrateId; -use rustc_session::cstore::{CrateStore, ExternCrate}; use rustc_span::def_id::ModId; use rustc_span::hygiene::ExpnId; use rustc_span::{Span, Symbol, kw}; diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs index 3273013466245..064d906293ae8 100644 --- a/compiler/rustc_metadata/src/rmeta/mod.rs +++ b/compiler/rustc_metadata/src/rmeta/mod.rs @@ -9,6 +9,7 @@ pub use encoder::{EncodedMetadata, encode_metadata, rendered_const}; pub(crate) use parameterized::ParameterizedOverTcx; use rustc_abi::{FieldIdx, ReprOptions, VariantIdx}; use rustc_ast as ast; +use rustc_crate_store::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::svh::Svh; use rustc_hir as hir; @@ -38,7 +39,6 @@ use rustc_middle::util::Providers; use rustc_serialize::opaque::FileEncoder; use rustc_session::config::mitigation_coverage::DeniedPartialMitigation; use rustc_session::config::{SymbolManglingVersion, TargetModifier}; -use rustc_session::cstore::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib}; use rustc_span::edition::Edition; use rustc_span::hygiene::{ExpnIndex, MacroKind, SyntaxContextKey}; use rustc_span::{self, ExpnData, ExpnHash, ExpnId, Ident, Span, Symbol}; diff --git a/compiler/rustc_metadata/src/rmeta/parameterized.rs b/compiler/rustc_metadata/src/rmeta/parameterized.rs index 75b86f8dda274..f19737bb936be 100644 --- a/compiler/rustc_metadata/src/rmeta/parameterized.rs +++ b/compiler/rustc_metadata/src/rmeta/parameterized.rs @@ -85,6 +85,9 @@ trivially_parameterized_over_tcx! { crate::rmeta::VariantData, rustc_abi::ReprOptions, rustc_ast::DelimArgs, + rustc_crate_store::ForeignModule, + rustc_crate_store::LinkagePreference, + rustc_crate_store::NativeLib, rustc_hir::Attribute, rustc_hir::ConstStability, rustc_hir::Constness, @@ -132,9 +135,6 @@ trivially_parameterized_over_tcx! { rustc_middle::ty::fast_reject::SimplifiedType, rustc_session::config::TargetModifier, rustc_session::config::mitigation_coverage::DeniedPartialMitigation, - rustc_session::cstore::ForeignModule, - rustc_session::cstore::LinkagePreference, - rustc_session::cstore::NativeLib, rustc_span::ExpnData, rustc_span::ExpnHash, rustc_span::ExpnId, diff --git a/compiler/rustc_middle/Cargo.toml b/compiler/rustc_middle/Cargo.toml index 55608083d3751..2d4b3ced37fd1 100644 --- a/compiler/rustc_middle/Cargo.toml +++ b/compiler/rustc_middle/Cargo.toml @@ -15,6 +15,7 @@ rustc_apfloat = "0.2.0" rustc_arena = { path = "../rustc_arena" } rustc_ast = { path = "../rustc_ast" } rustc_ast_ir = { path = "../rustc_ast_ir" } +rustc_crate_store = { path = "../rustc_crate_store" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_error_messages = { path = "../rustc_error_messages" } # Used for intra-doc links rustc_errors = { path = "../rustc_errors" } diff --git a/compiler/rustc_middle/src/ich.rs b/compiler/rustc_middle/src/ich.rs index 80db9a95c918a..1577e54a45bf7 100644 --- a/compiler/rustc_middle/src/ich.rs +++ b/compiler/rustc_middle/src/ich.rs @@ -1,11 +1,11 @@ use std::hash::Hash; +use rustc_crate_store::Untracked; use rustc_data_structures::stable_hash::{ RawDefId, RawDefPathHash, RawSpan, StableHash, StableHashControls, StableHashCtxt, StableHasher, }; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_session::Session; -use rustc_session::cstore::Untracked; use rustc_span::source_map::SourceMap; use rustc_span::{CachingSourceMapView, DUMMY_SP, Pos, Span}; diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index ca1cd2f45975f..2761ef960f10b 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -53,6 +53,9 @@ use rustc_arena::TypedArena; use rustc_ast as ast; use rustc_ast::expand::allocator::AllocatorKind; use rustc_ast::tokenstream::TokenStream; +use rustc_crate_store::{ + CrateDepKind, CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib, +}; use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_data_structures::sorted_map::SortedMap; use rustc_data_structures::steal::Steal; @@ -70,9 +73,6 @@ use rustc_lint_defs::LintId; use rustc_macros::rustc_queries; use rustc_session::Limits; use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion}; -use rustc_session::cstore::{ - CrateDepKind, CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib, -}; use rustc_session::lint::StableLintExpectationId; use rustc_span::def_id::{LOCAL_CRATE, ModId}; use rustc_span::{DUMMY_SP, LocalExpnId, Span, Spanned, Symbol}; @@ -2027,10 +2027,10 @@ rustc_queries! { // The hash should not be calculated before the `analysis` pass is complete, specifically // until `tcx.untracked().definitions.freeze()` has been called, otherwise if incremental // compilation is enabled calculating this hash can freeze this structure too early in - // compilation and cause subsequent crashes when attempting to write to `definitions` + // compilation and cause subsequent crashes when attempting to write to `definitions`. query crate_hash(_: CrateNum) -> Svh { eval_always - desc { "looking up the hash a crate" } + desc { "looking up the hash of a crate" } separate_provide_extern } diff --git a/compiler/rustc_middle/src/query/erase.rs b/compiler/rustc_middle/src/query/erase.rs index 9a6ab2732953a..7dcd364bde8bf 100644 --- a/compiler/rustc_middle/src/query/erase.rs +++ b/compiler/rustc_middle/src/query/erase.rs @@ -215,6 +215,7 @@ impl_erasable_for_types_with_no_type_params! { Result, traits::query::NoSolution>, Ty<'_>, bool, + rustc_crate_store::CrateDepKind, rustc_data_structures::svh::Svh, rustc_hir::Constness, rustc_hir::Defaultness, @@ -252,7 +253,6 @@ impl_erasable_for_types_with_no_type_params! { rustc_session::Limits, rustc_session::config::OptLevel, rustc_session::config::SymbolManglingVersion, - rustc_session::cstore::CrateDepKind, rustc_span::ExpnId, rustc_span::Span, rustc_span::Symbol, diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 136a9e6ca464e..75aa5aaaa4352 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -17,6 +17,7 @@ use std::{fmt, iter, mem}; use rustc_abi::{ExternAbi, FieldIdx, Layout, LayoutData, TargetDataLayout, VariantIdx}; use rustc_ast as ast; +use rustc_crate_store::{CrateStoreDyn, Untracked}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::intern::Interned; use rustc_data_structures::profiling::SelfProfilerRef; @@ -37,7 +38,6 @@ use rustc_hir::{self as hir, CRATE_HIR_ID, HirId, Node, TraitCandidate, find_att use rustc_index::IndexVec; use rustc_macros::Diagnostic; use rustc_session::config::CrateType; -use rustc_session::cstore::{CrateStoreDyn, Untracked}; use rustc_session::lint::Lint; use rustc_session::{IncrCompSession, Session}; use rustc_span::def_id::{CRATE_DEF_ID, DefPathHash, StableCrateId}; diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 7fdfd8479b401..4ab474fd89fe6 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -6,6 +6,7 @@ use std::ops::{Deref, DerefMut}; use rustc_abi::{ExternAbi, Size}; use rustc_apfloat::Float; use rustc_apfloat::ieee::{Double, Half, Quad, Single}; +use rustc_crate_store::{ExternCrate, ExternCrateSource}; use rustc_data_structures::Limit; use rustc_data_structures::fx::{FxIndexMap, IndexEntry}; use rustc_data_structures::unord::UnordMap; @@ -15,7 +16,6 @@ use rustc_hir::def::{self, CtorKind, DefKind, Namespace}; use rustc_hir::def_id::{DefIdMap, DefIdSet, LOCAL_CRATE, ModId}; use rustc_hir::definitions::{DefKey, DefPathDataName}; use rustc_macros::{Lift, extension}; -use rustc_session::cstore::{ExternCrate, ExternCrateSource}; use rustc_span::{Ident, RemapPathScopeComponents, Symbol, kw, sym}; use rustc_type_ir::{FieldInfo, Unnormalized, Upcast as _, elaborate}; use smallvec::SmallVec; diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index fa4850599369c..adf153b68dae6 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -866,7 +866,7 @@ impl<'tcx> TyCtxt<'tcx> { /// be shown in `impl` suggestions. /// /// [public]: TyCtxt::is_private_dep - /// [direct]: rustc_session::cstore::ExternCrate::is_direct + /// [direct]: rustc_crate_store::ExternCrate::is_direct pub fn is_user_visible_dep(self, key: CrateNum) -> bool { // `#![rustc_private]` overrides defaults to make private dependencies usable. if self.features().enabled(sym::rustc_private) { diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index c1b7af997bf25..664c089e3f153 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -407,23 +407,19 @@ impl<'a> Parser<'a> { req_name: |_, _| false, req_body: false, }; - let param = p.parse_param_general(&mode, false, false); - param.map(|param| { - if !matches!(param.pat.kind, PatKind::Missing) { - self.psess - .gated_spans - .gate(sym::named_fn_trait_parameters, param.pat.span); - } - if matches!(param.ty.kind, TyKind::CVarArgs) { - dcx.emit_err(PathFoundCVariadicParams { span: param.pat.span }); - } - if !param.attrs.is_empty() { - dcx.emit_err(PathFoundAttributeInParams { - span: param.attrs[0].span, - }); - } - param.ty - }) + let param = p.parse_param_general(&mode, false, false)?; + if !matches!(param.pat.kind, PatKind::Missing) { + self.psess + .gated_spans + .gate(sym::named_fn_trait_parameters, param.pat.span); + } + if matches!(param.ty.kind, TyKind::CVarArgs) { + dcx.emit_err(PathFoundCVariadicParams { span: param.pat.span }); + } + if !param.attrs.is_empty() { + dcx.emit_err(PathFoundAttributeInParams { span: param.attrs[0].span }); + } + Ok(param) }); let (inputs, _) = match parse_params_result { diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index f93bc1639ffed..1d2021cfe50ae 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -1451,7 +1451,7 @@ impl<'a> Parser<'a> { args: Some(Box::new(ast::GenericArgs::Parenthesized( ast::ParenthesizedArgs { span: args_lo.to(self.prev_token.span), - inputs: decl.inputs.iter().map(|a| a.ty.clone()).collect(), + inputs: decl.inputs.iter().map(|a| a.clone()).collect(), inputs_span: args_lo.until(decl.output.span()), output: decl.output.clone(), } @@ -1538,7 +1538,7 @@ impl<'a> Parser<'a> { let inputs_lo = self.token.span; let mode = FnParseMode { req_name: |_, _| false, context: FnContext::Free, req_body: false }; - let params = match self.parse_fn_params(&mode) { + let inputs = match self.parse_fn_params(&mode) { Ok(params) => params, Err(err) => { if let Some(snapshot) = snapshot { @@ -1550,7 +1550,6 @@ impl<'a> Parser<'a> { } } }; - let inputs: ThinVec<_> = params.into_iter().map(|input| input.ty).collect(); let inputs_span = inputs_lo.to(self.prev_token.span); let output = match self.parse_ret_ty(AllowPlus::No, RecoverQPath::No, RecoverReturnSign::No) { diff --git a/compiler/rustc_passes/Cargo.toml b/compiler/rustc_passes/Cargo.toml index b65a0ad404a53..7319aadf29ae2 100644 --- a/compiler/rustc_passes/Cargo.toml +++ b/compiler/rustc_passes/Cargo.toml @@ -9,6 +9,7 @@ rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } rustc_ast_lowering = { path = "../rustc_ast_lowering" } rustc_attr_parsing = { path = "../rustc_attr_parsing" } +rustc_crate_store = { path = "../rustc_crate_store" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_expand = { path = "../rustc_expand" } diff --git a/compiler/rustc_passes/src/lang_items.rs b/compiler/rustc_passes/src/lang_items.rs index d26069b07b854..86a57a4d36121 100644 --- a/compiler/rustc_passes/src/lang_items.rs +++ b/compiler/rustc_passes/src/lang_items.rs @@ -9,12 +9,12 @@ use rustc_ast as ast; use rustc_ast::visit; +use rustc_crate_store::ExternCrate; use rustc_hir::Target; use rustc_hir::attrs::lang_items::{GenericRequirement, LangItem, LanguageItems}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_middle::query::Providers; use rustc_middle::ty::{ResolverAstLowering, TyCtxt}; -use rustc_session::cstore::ExternCrate; use rustc_span::{Span, Symbol, sym}; use crate::diagnostics::{DuplicateLangItem, IncorrectCrateType, IncorrectTarget}; diff --git a/compiler/rustc_public/Cargo.toml b/compiler/rustc_public/Cargo.toml index c2b00b515adc6..95bbfd554df19 100644 --- a/compiler/rustc_public/Cargo.toml +++ b/compiler/rustc_public/Cargo.toml @@ -6,10 +6,10 @@ edition = "2024" [dependencies] # tidy-alphabetical-start rustc_abi = { path = "../rustc_abi" } +rustc_crate_store = { path = "../rustc_crate_store" } rustc_hir = { path = "../rustc_hir" } rustc_middle = { path = "../rustc_middle" } rustc_public_bridge = { path = "../rustc_public_bridge" } -rustc_session = { path = "../rustc_session" } rustc_span = { path = "../rustc_span" } rustc_target = { path = "../rustc_target" } scoped-tls = "1.0" diff --git a/compiler/rustc_public/src/unstable/convert/stable/ty.rs b/compiler/rustc_public/src/unstable/convert/stable/ty.rs index 54e11aca7da77..160487400c38c 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/ty.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/ty.rs @@ -1047,7 +1047,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::ExternAbi { } } -impl<'tcx> Stable<'tcx> for rustc_session::cstore::ForeignModule { +impl<'tcx> Stable<'tcx> for rustc_crate_store::ForeignModule { type T = crate::ty::ForeignModule; fn stable<'cx>( diff --git a/compiler/rustc_public_bridge/Cargo.toml b/compiler/rustc_public_bridge/Cargo.toml index 918de4a393cff..d131f217cc617 100644 --- a/compiler/rustc_public_bridge/Cargo.toml +++ b/compiler/rustc_public_bridge/Cargo.toml @@ -6,11 +6,11 @@ edition = "2024" [dependencies] # tidy-alphabetical-start rustc_abi = { path = "../rustc_abi" } +rustc_crate_store = { path = "../rustc_crate_store" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_hir = { path = "../rustc_hir" } rustc_hir_pretty = { path = "../rustc_hir_pretty" } rustc_middle = { path = "../rustc_middle" } -rustc_session = { path = "../rustc_session" } rustc_span = { path = "../rustc_span" } rustc_target = { path = "../rustc_target" } # tidy-alphabetical-end diff --git a/compiler/rustc_public_bridge/src/context/impls.rs b/compiler/rustc_public_bridge/src/context/impls.rs index 345e83ca21b69..70e2498ac350b 100644 --- a/compiler/rustc_public_bridge/src/context/impls.rs +++ b/compiler/rustc_public_bridge/src/context/impls.rs @@ -5,6 +5,7 @@ use std::iter; use rustc_abi::{Endian, Layout, ReprOptions}; +use rustc_crate_store::ForeignModule; use rustc_hir::Attribute; use rustc_hir::attrs::lang_items::LangItem; use rustc_hir::def::DefKind; @@ -22,7 +23,6 @@ use rustc_middle::ty::{ ValTree, VariantDef, VtblEntry, }; use rustc_middle::{mir, ty}; -use rustc_session::cstore::ForeignModule; use rustc_span::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_span::{Span, Symbol}; use rustc_target::callconv::FnAbi; diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 8b7c99e55edaa..0990bf73690ea 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -1390,7 +1390,7 @@ impl<'ast, 'ra, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tc self.resolve_fn_signature( binder, false, - p_args.inputs.iter().map(|ty| (None, &**ty)), + p_args.inputs.iter().map(|param| (None, &*param.ty)), &p_args.output, false, ); diff --git a/compiler/rustc_session/Cargo.toml b/compiler/rustc_session/Cargo.toml index f70a7069b0d93..c230c6793f0c2 100644 --- a/compiler/rustc_session/Cargo.toml +++ b/compiler/rustc_session/Cargo.toml @@ -14,7 +14,6 @@ rustc_errors = { path = "../rustc_errors" } rustc_feature = { path = "../rustc_feature" } rustc_fs_util = { path = "../rustc_fs_util" } rustc_hashes = { path = "../rustc_hashes" } -rustc_hir = { path = "../rustc_hir" } rustc_lint_defs = { path = "../rustc_lint_defs" } rustc_macros = { path = "../rustc_macros" } rustc_serialize = { path = "../rustc_serialize" } diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index e5c874503a00f..a6decd5898689 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -391,6 +391,7 @@ impl CheckCfg { ins!(sym::doc, no_values); ins!(sym::doctest, no_values); ins!(sym::miri, no_values); + ins!(sym::rust_analyzer, no_values); ins!(sym::rustfmt, no_values); ins!(sym::overflow_checks, no_values); diff --git a/compiler/rustc_session/src/lib.rs b/compiler/rustc_session/src/lib.rs index 94566c943d7ed..a2f6f7b39fe91 100644 --- a/compiler/rustc_session/src/lib.rs +++ b/compiler/rustc_session/src/lib.rs @@ -24,7 +24,6 @@ pub mod parse; pub mod utils; #[macro_use] pub mod config; -pub mod cstore; pub mod filesearch; mod macros; mod options; diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index b3023c731eeff..20d1ff55eab6e 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2979,6 +2979,8 @@ written to standard error output)"), // FIXME remove this after a couple releases wasm_c_abi: () = ((), parse_wasm_c_abi, [TRACKED], "use spec-compliant C ABI for `wasm32-unknown-unknown` (deprecated, always enabled)"), + wasm_proc_macros: bool = (false, parse_bool, [TRACKED], + "enable support for compiling and loading wasm proc macros"), write_long_types_to_disk: bool = (true, parse_bool, [UNTRACKED], "whether long type names should be written to files instead of being printed in errors"), // tidy-alphabetical-end diff --git a/compiler/rustc_trait_selection/Cargo.toml b/compiler/rustc_trait_selection/Cargo.toml index ae231c217977d..d29dbb45fa45c 100644 --- a/compiler/rustc_trait_selection/Cargo.toml +++ b/compiler/rustc_trait_selection/Cargo.toml @@ -8,6 +8,7 @@ edition = "2024" itertools = "0.15" rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } +rustc_crate_store = { path = "../rustc_crate_store" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_hir = { path = "../rustc_hir" } diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs index 24b7e93320f9c..76b4900367bde 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs @@ -7,6 +7,7 @@ pub mod suggestions; use std::{fmt, iter}; +use rustc_crate_store::{ExternCrate, ExternCrateSource}; use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_data_structures::unord::UnordSet; use rustc_errors::{Applicability, Diag, E0038, E0276, MultiSpan, struct_span_code_err}; @@ -20,7 +21,6 @@ use rustc_infer::traits::{ }; use rustc_middle::ty::print::{PrintTraitRefExt as _, with_no_trimmed_paths}; use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt as _}; -use rustc_session::cstore::{ExternCrate, ExternCrateSource}; use rustc_span::{DesugaringKind, ErrorGuaranteed, ExpnKind, Span}; use thin_vec::ThinVec; use tracing::{info, instrument}; diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 18fc19cba27d1..ec1ab7ec75f64 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -55,8 +55,13 @@ use crate::vec::Vec; /// See comment in `Arc::clone`. const MAX_REFCOUNT: usize = (isize::MAX) as usize; -/// The error in case either counter reaches above `MAX_REFCOUNT`, and we can `panic` safely. -const INTERNAL_OVERFLOW_ERROR: &str = "Arc counter overflow"; +#[cold] +#[cfg_attr(not(panic = "immediate-abort"), inline(never))] +#[cfg_attr(panic = "immediate-abort", inline)] +#[track_caller] +fn panic_arc_overflow() -> ! { + panic!("Arc counter overflow"); +} #[cfg(not(sanitize = "thread"))] macro_rules! acquire { @@ -1954,8 +1959,9 @@ impl Arc { } // We can't allow the refcount to increase much past `MAX_REFCOUNT`. - assert!(cur <= MAX_REFCOUNT, "{}", INTERNAL_OVERFLOW_ERROR); - + if cur > MAX_REFCOUNT { + panic_arc_overflow(); + } // NOTE: this code currently ignores the possibility of overflow // into usize::MAX; in general both Rc and Arc need to be adjusted // to deal with overflow. @@ -3319,7 +3325,9 @@ impl Weak { return None; } // See comments in `Arc::clone` for why we do this (for `mem::forget`). - assert!(n <= MAX_REFCOUNT, "{}", INTERNAL_OVERFLOW_ERROR); + if n > MAX_REFCOUNT { + panic_arc_overflow(); + } Some(n + 1) } diff --git a/library/compiler-builtins/compiler-builtins/src/lib.rs b/library/compiler-builtins/compiler-builtins/src/lib.rs index 9e847206caf19..e4fa6f3694e07 100644 --- a/library/compiler-builtins/compiler-builtins/src/lib.rs +++ b/library/compiler-builtins/compiler-builtins/src/lib.rs @@ -14,7 +14,6 @@ #![cfg_attr(f128_enabled, feature(f128))] #![no_builtins] #![no_std] -#![allow(unstable_name_collisions)] // FIXME(float_bits_const): remove when stable #![allow(unused_features)] #![allow(internal_features)] // `mem::swap` cannot be used because it may generate references to memcpy in unoptimized code. diff --git a/library/compiler-builtins/libm-test/src/lib.rs b/library/compiler-builtins/libm-test/src/lib.rs index f2ee03252139e..9827b231a7686 100644 --- a/library/compiler-builtins/libm-test/src/lib.rs +++ b/library/compiler-builtins/libm-test/src/lib.rs @@ -1,7 +1,6 @@ #![cfg_attr(f16_enabled, feature(f16))] #![cfg_attr(f128_enabled, feature(f128))] #![allow(clippy::unusual_byte_groupings)] // sometimes we group by sign_exp_sig -#![allow(unstable_name_collisions)] // FIXME(float_bits_const): remove when stable pub mod builtins_wrapper; pub mod domain; diff --git a/library/compiler-builtins/libm/src/lib.rs b/library/compiler-builtins/libm/src/lib.rs index 85ed5e2c9fc63..31b12235314cd 100644 --- a/library/compiler-builtins/libm/src/lib.rs +++ b/library/compiler-builtins/libm/src/lib.rs @@ -8,7 +8,6 @@ )] #![cfg_attr(f128_enabled, feature(f128))] #![cfg_attr(f16_enabled, feature(f16))] -#![allow(unstable_name_collisions)] // FIXME(float_bits_const): remove when stable #![allow(clippy::assign_op_pattern)] #![allow(clippy::deprecated_cfg_attr)] #![allow(clippy::eq_op)] diff --git a/library/core/src/num/f128.rs b/library/core/src/num/f128.rs index 4875835695e69..6ad4a21fe00d0 100644 --- a/library/core/src/num/f128.rs +++ b/library/core/src/num/f128.rs @@ -159,8 +159,7 @@ impl f128 { pub const RADIX: u32 = 2; /// The size of this float type in bits. - // #[unstable(feature = "f128", issue = "116909")] - #[unstable(feature = "float_bits_const", issue = "151073")] + #[unstable(feature = "f128", issue = "116909")] pub const BITS: u32 = 128; /// Number of significant digits in base 2. diff --git a/library/core/src/num/f16.rs b/library/core/src/num/f16.rs index 186945db9ae92..1a4e8ecb7bab3 100644 --- a/library/core/src/num/f16.rs +++ b/library/core/src/num/f16.rs @@ -153,8 +153,7 @@ impl f16 { pub const RADIX: u32 = 2; /// The size of this float type in bits. - // #[unstable(feature = "f16", issue = "116909")] - #[unstable(feature = "float_bits_const", issue = "151073")] + #[unstable(feature = "f16", issue = "116909")] pub const BITS: u32 = 16; /// Number of significant digits in base 2. diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs index 0fb6eaece1bf4..6b5f5ffd1d3e6 100644 --- a/library/core/src/num/f32.rs +++ b/library/core/src/num/f32.rs @@ -440,7 +440,7 @@ impl f32 { pub const RADIX: u32 = 2; /// The size of this float type in bits. - #[unstable(feature = "float_bits_const", issue = "151073")] + #[stable(feature = "float_bits_const", since = "CURRENT_RUSTC_VERSION")] pub const BITS: u32 = 32; /// Number of significant digits in base 2. diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index d12d0383283e9..d744d4139adc2 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -440,7 +440,7 @@ impl f64 { pub const RADIX: u32 = 2; /// The size of this float type in bits. - #[unstable(feature = "float_bits_const", issue = "151073")] + #[stable(feature = "float_bits_const", since = "CURRENT_RUSTC_VERSION")] pub const BITS: u32 = 64; /// Number of significant digits in base 2. diff --git a/library/std/src/sys/thread_local/key/unix.rs b/library/std/src/sys/thread_local/key/unix.rs index 8fa24265e432a..27c12c343aafb 100644 --- a/library/std/src/sys/thread_local/key/unix.rs +++ b/library/std/src/sys/thread_local/key/unix.rs @@ -33,8 +33,16 @@ pub fn create(dtor: Option) -> Key { #[inline] pub unsafe fn set(key: Key, value: *mut u8) { + #[cold] + fn fail() -> ! { + rtabort!("Failed to set value of thread local") + } + let r = unsafe { libc::pthread_setspecific(key, value as *mut _) }; - debug_assert_eq!(r, 0); + // May happen on memory exhaustion + if r != 0 { + fail() + } } #[inline] diff --git a/library/std/src/sys/thread_local/key/windows.rs b/library/std/src/sys/thread_local/key/windows.rs index 420b628068a3a..fdedcc97110c1 100644 --- a/library/std/src/sys/thread_local/key/windows.rs +++ b/library/std/src/sys/thread_local/key/windows.rs @@ -138,8 +138,15 @@ unsafe impl Sync for LazyKey {} #[inline] pub unsafe fn set(key: Key, val: *mut u8) { + #[cold] + fn fail() -> ! { + rtabort!("Failed to set value of thread local") + } let r = unsafe { c::TlsSetValue(key, val.cast()) }; - debug_assert_eq!(r, c::TRUE); + // According to MS documentation, `TlsSetValue` returns zero "if it fails" + if r != c::TRUE { + fail() + } } #[inline] diff --git a/library/std/src/sys/thread_local/key/xous.rs b/library/std/src/sys/thread_local/key/xous.rs index 394d1b08ece3a..6da7162fff01f 100644 --- a/library/std/src/sys/thread_local/key/xous.rs +++ b/library/std/src/sys/thread_local/key/xous.rs @@ -134,14 +134,14 @@ pub fn create(dtor: Option) -> Key { #[inline] pub unsafe fn set(key: Key, value: *mut u8) { - assert!((key < 1022) && (key >= 1)); + rtassert!((key < 1022) && (key >= 1)); let table = tls_table(); table[key] = value; } #[inline] pub unsafe fn get(key: Key) -> *mut u8 { - assert!((key < 1022) && (key >= 1)); + rtassert!((key < 1022) && (key >= 1)); tls_table()[key] } diff --git a/library/std/src/sys/thread_local/mod.rs b/library/std/src/sys/thread_local/mod.rs index cb954e475be1b..3ccfdd27ee833 100644 --- a/library/std/src/sys/thread_local/mod.rs +++ b/library/std/src/sys/thread_local/mod.rs @@ -25,7 +25,7 @@ cfg_select! { any( - all(target_family = "wasm", not(target_feature = "atomics"), not(target_os = "wasi")), + all(target_family = "wasm", not(target_feature = "atomics"), not(target_env = "p3")), target_os = "uefi", target_os = "zkvm", target_os = "trusty", @@ -56,7 +56,7 @@ cfg_select! { /// single callback that runs all of the destructors in the list. #[cfg(all( target_thread_local, - not(all(target_family = "wasm", not(target_feature = "atomics"), not(target_os = "wasi"))) + not(all(target_family = "wasm", not(target_feature = "atomics"), not(target_env = "p3"))) ))] pub(crate) mod destructors { cfg_select! { @@ -96,7 +96,7 @@ pub(crate) mod guard { pub(crate) use windows::enable; } any( - all(target_family = "wasm", not(target_os = "wasi")), + all(target_family = "wasm", not(target_env = "p3")), target_os = "uefi", target_os = "zkvm", target_os = "trusty", @@ -151,7 +151,7 @@ pub(crate) mod key { ), all(not(target_thread_local), target_vendor = "apple"), target_os = "teeos", - target_os = "wasi", + all(target_os = "wasi", target_env = "p3"), ) => { mod racy; mod unix; diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 6658087bae78c..dca3220acda55 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2277,6 +2277,14 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the builder.ensure(compile::Rustc::new(test_compiler, target)); } + // Build the standard library for wasm32-wasip2 (current target for wasm proc macros). + if builder.config.wasm_proc_macros { + builder.ensure(compile::Std::new( + test_compiler, + TargetSelection::from_user("wasm32-wasip2"), + )); + } + if suite == "debuginfo" { builder.ensure(dist::DebuggerScripts { sysroot: builder.sysroot(test_compiler).to_path_buf(), @@ -2326,6 +2334,10 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let is_rustdoc = suite == "rustdoc-ui" || suite == "rustdoc-js"; + if builder.config.wasm_proc_macros { + cmd.arg("--wasm-proc-macros"); + } + // There are (potentially) 2 `cargo`s to consider: // // - A "bootstrap" cargo, which is the same cargo used to build bootstrap itself, and is diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_bench.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_bench.snap index 165e270270702..755c0e19b8ae1 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_bench.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_bench.snap @@ -37,6 +37,7 @@ expression: bench - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_build_compiler.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_build_compiler.snap index a350c9a92c74b..924972d28e607 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_build_compiler.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_build_compiler.snap @@ -19,6 +19,7 @@ expression: build compiler - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check.snap index 5c15debc2edb7..46e00afd325d1 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check.snap @@ -21,6 +21,7 @@ expression: check - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiler.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiler.snap index 2ee6f90f68f8c..eb48e337aeb0e 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiler.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiler.snap @@ -21,6 +21,7 @@ expression: check compiler - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiletest_include_default_paths.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiletest_include_default_paths.snap index 677e45333169b..c84a6aed4eba8 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiletest_include_default_paths.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_check_compiletest_include_default_paths.snap @@ -21,6 +21,7 @@ expression: check compiletest --include-default-paths - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_clippy.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_clippy.snap index f1430e020aaa4..99db9ae7b0268 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_clippy.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_clippy.snap @@ -36,6 +36,7 @@ expression: clippy - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_fix.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_fix.snap index 28f6053d4c100..529073c5b5a55 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_fix.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_fix.snap @@ -21,6 +21,7 @@ expression: fix - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap index 59b84f4301feb..7807566751a2f 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap @@ -85,6 +85,7 @@ expression: test - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap index 29dc8ee5efcfc..7bac4c859c450 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap @@ -82,6 +82,7 @@ expression: test --skip=coverage - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap index 9240e939f946f..732b84e90a880 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap @@ -85,6 +85,7 @@ expression: test --skip=coverage-map - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap index f30be2939765a..c36a9fd752aed 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap @@ -85,6 +85,7 @@ expression: test --skip=coverage-run - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap index f1aa131eb7c3a..bf5de019af6f4 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap @@ -46,6 +46,7 @@ expression: test --skip=tests - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap index ddf45bcfdbdb1..3236872a46469 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap @@ -82,6 +82,7 @@ expression: test --skip=tests/coverage - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap index c38962f9c12b0..93d3ee139e3fb 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap @@ -30,6 +30,7 @@ expression: test --skip=tests --skip=library --skip=tidyselftest - Set({compiler/rustc_codegen_llvm}) - Set({compiler/rustc_codegen_ssa}) - Set({compiler/rustc_const_eval}) + - Set({compiler/rustc_crate_store}) - Set({compiler/rustc_data_structures}) - Set({compiler/rustc_driver}) - Set({compiler/rustc_driver_impl}) diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 3c0eb8e332030..4ae1ee53537f2 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1691,7 +1691,7 @@ mod snapshot { insta::assert_snapshot!( ctx.config("check") .path("compiler") - .render_steps(), @"[check] rustc 0 -> rustc 1 (75 crates)"); + .render_steps(), @"[check] rustc 0 -> rustc 1 (76 crates)"); } #[test] @@ -1717,7 +1717,7 @@ mod snapshot { ctx.config("check") .path("compiler") .stage(1) - .render_steps(), @"[check] rustc 0 -> rustc 1 (75 crates)"); + .render_steps(), @"[check] rustc 0 -> rustc 1 (76 crates)"); } #[test] @@ -1731,7 +1731,7 @@ mod snapshot { [build] llvm [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 - [check] rustc 1 -> rustc 2 (75 crates) + [check] rustc 1 -> rustc 2 (76 crates) "); } @@ -1747,7 +1747,7 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [check] rustc 1 -> std 1 - [check] rustc 1 -> rustc 2 (75 crates) + [check] rustc 1 -> rustc 2 (76 crates) [check] rustc 1 -> rustc 2 [check] rustc 1 -> Rustdoc 2 [check] rustc 1 -> rustc_codegen_cranelift 2 @@ -1844,7 +1844,7 @@ mod snapshot { ctx.config("check") .paths(&["library", "compiler"]) .args(&args) - .render_steps(), @"[check] rustc 0 -> rustc 1 (75 crates)"); + .render_steps(), @"[check] rustc 0 -> rustc 1 (76 crates)"); } #[test] @@ -3055,7 +3055,7 @@ mod snapshot { let ctx = TestCtx::new(); insta::assert_snapshot!(ctx.config("fix").path("compiler").render_steps(), @r" [build] llvm - [fix] rustc 0 -> rustc 1 (75 crates) + [fix] rustc 0 -> rustc 1 (76 crates) "); } } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 4bc9de932f98f..fa10de3c92fac 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -343,6 +343,8 @@ pub struct Config { pub skip_std_check_if_no_download_rustc: bool, pub exec_ctx: ExecutionContext, + + pub wasm_proc_macros: bool, } impl Config { @@ -615,6 +617,7 @@ impl Config { break_on_ice: rust_break_on_ice, rustflags: rust_rustflags, stdlib_semver_baseline: rust_stdlib_semver_baseline, + wasm_proc_macros, } = toml_rust.unwrap_or_default(); let Llvm { @@ -1611,6 +1614,7 @@ NOTE: Please add `--stage 2` to your command line, or if you're sure you want to .unwrap_or(rust_debug == Some(true)), vendor, verbose_tests, + wasm_proc_macros: wasm_proc_macros.unwrap_or(false), windows_rc: build_windows_rc.map(PathBuf::from), yarn: build_yarn.map(PathBuf::from), // tidy-alphabetical-end diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs index 33516fcbc9e4c..d0954e3ad70a5 100644 --- a/src/bootstrap/src/core/config/toml/rust.rs +++ b/src/bootstrap/src/core/config/toml/rust.rs @@ -75,6 +75,7 @@ define_config! { break_on_ice: Option = "break-on-ice", parallel_frontend_threads: Option = "parallel-frontend-threads", stdlib_semver_baseline: Option = "stdlib-semver-baseline", + wasm_proc_macros: Option = "wasm-proc-macros", } } @@ -393,6 +394,7 @@ pub fn check_incompatible_options_for_ci_rustc( bootstrap_override_lld: _, rustflags: _, stdlib_semver_baseline: _, + wasm_proc_macros: _, } = ci_rust_config; // There are two kinds of checks for CI rustc incompatible options: diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs index 3c05302950844..86fe5cf946071 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs @@ -68,7 +68,7 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build { /// by combining the primary build target, host targets, and any additional targets. For /// each target, it calls [`fill_target_compiler`] to configure the necessary compiler tools. pub fn fill_compilers(build: &mut Build) { - let targets: HashSet<_> = match build.config.cmd { + let mut targets: HashSet<_> = match build.config.cmd { // We don't need to check cross targets for these commands. crate::Subcommand::Clean { .. } | crate::Subcommand::Check { .. } @@ -90,7 +90,14 @@ pub fn fill_compilers(build: &mut Build) { } }; - for target in targets.into_iter() { + // When we intend to build wasm proc macros, we'll need to detect a toolchain for linking those + // as well. In the future it would be good to make this a no-op given that we shouldn't need to + // build any C/C++ code for wasm... + if build.config.wasm_proc_macros { + targets.insert(TargetSelection::from_user("wasm32-wasip2")); + } + + for target in targets { fill_target_compiler(build, target); } } diff --git a/src/ci/citool/src/jobs.rs b/src/ci/citool/src/jobs.rs index cc93761e9604e..8b4f66c85761a 100644 --- a/src/ci/citool/src/jobs.rs +++ b/src/ci/citool/src/jobs.rs @@ -271,7 +271,11 @@ pub enum RunType { /// Workflows that run after a push to a PR branch PullRequest, /// Try run started with @bors try - TryJob { job_patterns: Option> }, + TryJob { + job_patterns: Option>, + /// Should the limit on the number of try jobs be ignored? + nolimit: bool, + }, /// Merge attempt workflow AutoJob, /// Fake job only used for sharing Github Actions cache. @@ -289,7 +293,7 @@ fn calculate_jobs( ) -> anyhow::Result> { let (jobs, prefix, base_env) = match run_type { RunType::PullRequest => (db.pr_jobs.clone(), "PR", &db.envs.pr_env), - RunType::TryJob { job_patterns } => { + RunType::TryJob { job_patterns, nolimit } => { let jobs = if let Some(patterns) = job_patterns { let mut jobs: Vec = vec![]; let mut unknown_patterns = vec![]; @@ -311,7 +315,7 @@ fn calculate_jobs( unknown_patterns.join(", ") )); } - if jobs.len() > MAX_TRY_JOBS_COUNT { + if jobs.len() > MAX_TRY_JOBS_COUNT && !nolimit { return Err(anyhow::anyhow!( "It is only possible to schedule up to {MAX_TRY_JOBS_COUNT} custom jobs, received {} custom jobs expanded from {} pattern(s)", jobs.len(), @@ -342,7 +346,7 @@ fn calculate_jobs( // built toolchain using `rustup-toolchain-install-master`), // we inject the `DIST_TRY_BUILD` environment variable to the jobs // to tell `opt-dist` to make the build faster by skipping certain steps. - if let RunType::TryJob { job_patterns } = run_type { + if let RunType::TryJob { job_patterns, nolimit: _ } = run_type { if job_patterns.is_none() { env.insert( "DIST_TRY_BUILD".to_string(), diff --git a/src/ci/citool/src/main.rs b/src/ci/citool/src/main.rs index 8afda476ea68f..b8d8c18213948 100644 --- a/src/ci/citool/src/main.rs +++ b/src/ci/citool/src/main.rs @@ -30,6 +30,12 @@ const CI_DIRECTORY: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/.."); pub const DOCKER_DIRECTORY: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../docker"); const JOBS_YML_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../github-actions/jobs.yml"); +#[derive(Default)] +struct TryJobMetadata { + job_patterns: Vec, + nolimit: bool, +} + struct GitHubContext { event_name: String, branch_ref: String, @@ -41,12 +47,16 @@ impl GitHubContext { match (self.event_name.as_str(), self.branch_ref.as_str()) { ("pull_request", _) => Some(RunType::PullRequest), ("push", "refs/heads/automation/bors/try-perf" | "refs/heads/try-perf") => { - Some(RunType::TryJob { job_patterns: None }) + Some(RunType::TryJob { job_patterns: None, nolimit: false }) } ("push", "refs/heads/automation/bors/try") => { - let patterns = self.get_try_job_patterns(); - let patterns = if !patterns.is_empty() { Some(patterns) } else { None }; - Some(RunType::TryJob { job_patterns: patterns }) + let metadata = self.get_try_job_metadata(); + let patterns = if !metadata.job_patterns.is_empty() { + Some(metadata.job_patterns) + } else { + None + }; + Some(RunType::TryJob { job_patterns: patterns, nolimit: metadata.nolimit }) } ("push", "refs/heads/automation/bors/auto") => Some(RunType::AutoJob), ("push", "refs/heads/main") => Some(RunType::MainJob), @@ -54,25 +64,46 @@ impl GitHubContext { } } - /// Tries to parse patterns of CI jobs that should be executed - /// from the commit message of the passed GitHub context + /// Tries to parse metadata about try jobs from the commit message. + /// + /// Currently, two things can be specified. + /// + /// # Try job patterns + /// The first is a set of patterns of CI jobs that should be executed. /// /// They can be specified in the form of /// try-job: /// or /// try-job: `` /// (to avoid GitHub rendering the glob patterns as Markdown) - fn get_try_job_patterns(&self) -> Vec { - if let Some(ref msg) = self.commit_message { - msg.lines() - .filter_map(|line| line.trim().strip_prefix("try-job: ")) - // Strip backticks if present - .map(|l| l.trim_matches('`')) - .map(|l| l.trim().to_string()) - .collect() - } else { - vec![] + /// + /// # No limit + /// The second is a marker that specifies that the limit on the maximum number of allowed try + /// jobs to execute should NOT be applied. + /// + /// try-nolimit + fn get_try_job_metadata(&self) -> TryJobMetadata { + let Some(commit_msg) = &self.commit_message else { + return TryJobMetadata::default(); + }; + + let mut nolimit = false; + let mut job_patterns = vec![]; + + for line in commit_msg.lines() { + let line = line.trim(); + if line.starts_with("try-nolimit") { + nolimit = true; + continue; + } + let Some(pattern) = line.strip_prefix("try-job: ") else { + continue; + }; + // Strip backticks if present + let pattern = pattern.trim_matches('`'); + job_patterns.push(pattern.trim().to_string()); } + TryJobMetadata { job_patterns, nolimit } } } diff --git a/src/doc/rustc/src/check-cfg.md b/src/doc/rustc/src/check-cfg.md index ef791b57895ab..21c8bdfb1877f 100644 --- a/src/doc/rustc/src/check-cfg.md +++ b/src/doc/rustc/src/check-cfg.md @@ -99,7 +99,7 @@ the need to specify them manually. Well known names and values are implicitly added as long as at least one `--check-cfg` argument is present. -As of `2026-05-15T`, the list of known names is as follows: +As of `2026-08-11T`, the list of known names is as follows: @@ -113,6 +113,7 @@ As of `2026-05-15T`, the list of known names is as follows: - `panic` - `proc_macro` - `relocation_model` + - `rust_analyzer` - `rustfmt` - `sanitize` - `sanitizer_cfi_generalize_pointers` diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index 3c7577b9135e6..909bc6f356126 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -12,7 +12,7 @@ may be able to use more compact addressing modes. The specific ranges depend on target architectures and addressing modes available to them. \ For x86 more detailed description of its code models can be found in -[System V Application Binary Interface](https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf) +[System V Application Binary Interface](https://gitlab.com/x86-psABIs/x86-64-ABI/-/jobs/artifacts/master/raw/x86-64-ABI/abi.pdf?job=build) specification. Supported values for this option are: diff --git a/src/doc/unstable-book/src/compiler-flags/wasm-proc-macros.md b/src/doc/unstable-book/src/compiler-flags/wasm-proc-macros.md new file mode 100644 index 0000000000000..1f47f4373968e --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/wasm-proc-macros.md @@ -0,0 +1,8 @@ +# `wasm-proc-macros` + +This option controls whether to enable support for compiling and loading +`--crate-type=proc-macro` to/from WASM rather than the normal host dylib target. + +Currently we expect that proc macros are compiled to the `wasm32-wasip2` +target. The exact target will likely change in the future. When this flag is +passed, both regular dylib proc macros and wasm proc macros are supported. diff --git a/src/librustdoc/html/templates/print_item.html b/src/librustdoc/html/templates/print_item.html index 71764832abb45..4a257923dc53c 100644 --- a/src/librustdoc/html/templates/print_item.html +++ b/src/librustdoc/html/templates/print_item.html @@ -23,7 +23,7 @@

{% if !notable_trait_badges.is_empty() %}
{% for badge in notable_trait_badges.iter() %} - {{badge.name}} {% endfor %} diff --git a/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs b/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs index 504a867335011..cdb21a8e7082f 100644 --- a/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs +++ b/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs @@ -107,7 +107,7 @@ fn eq_generic_args(l: &GenericArgs, r: &GenericArgs) -> bool { match (l, r) { (AngleBracketed(l), AngleBracketed(r)) => over(&l.args, &r.args, eq_angle_arg), (Parenthesized(l), Parenthesized(r)) => { - over(&l.inputs, &r.inputs, |l, r| eq_ty(l, r)) && eq_fn_ret_ty(&l.output, &r.output) + over(&l.inputs, &r.inputs, eq_param) && eq_fn_ret_ty(&l.output, &r.output) }, _ => false, } @@ -855,12 +855,14 @@ fn eq_restriction_kind(l: &RestrictionKind, r: &RestrictionKind) -> bool { fn eq_fn_decl(l: &FnDecl, r: &FnDecl) -> bool { eq_fn_ret_ty(&l.output, &r.output) - && over(&l.inputs, &r.inputs, |l, r| { - l.is_placeholder == r.is_placeholder - && eq_pat(&l.pat, &r.pat) - && eq_ty(&l.ty, &r.ty) - && over(&l.attrs, &r.attrs, eq_attr) - }) + && over(&l.inputs, &r.inputs, eq_param) +} + +fn eq_param(l: &Param, r: &Param) -> bool { + l.is_placeholder == r.is_placeholder + && eq_pat(&l.pat, &r.pat) + && eq_ty(&l.ty, &r.ty) + && over(&l.attrs, &r.attrs, eq_attr) } fn eq_closure_binder(l: &ClosureBinder, r: &ClosureBinder) -> bool { diff --git a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs index efdaef24478ba..9f69c74596d50 100644 --- a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs +++ b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs @@ -486,7 +486,7 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) { FnRetTy::Default(_) => { if let Some(last) = par_args.inputs.last() { // `B` in `(A, B)` -- `)` gets stripped - ast_ty_search_pat(last).1 + ast_ty_search_pat(&last.ty).1 } else { // `(` in `()` -- `)` gets stripped Pat::Str("(") diff --git a/src/tools/compiletest/src/cli.rs b/src/tools/compiletest/src/cli.rs index 1786c68a1889c..3af7b4dfeaeac 100644 --- a/src/tools/compiletest/src/cli.rs +++ b/src/tools/compiletest/src/cli.rs @@ -281,6 +281,10 @@ struct Args { /// Ignore `//@ ignore-backends` directives. #[arg(long)] bypass_ignore_backends: bool, + /// Build proc-macros for wasm. Assumes environment is configured to support this; e.g., std is + /// already built appropriately. + #[arg(long)] + wasm_proc_macros: bool, // These values can be entered multiple times, for example: // --skip foo --skip bar @@ -503,6 +507,8 @@ pub(crate) fn parse_config(args: Vec) -> Config { gcc_supported_target_tuples, + wasm_proc_macros: args.wasm_proc_macros, + jobs: args.jobs, parallel_frontend_threads, diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index de5c50d234661..c5a631ad94589 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -766,6 +766,8 @@ pub(crate) struct Config { pub(crate) parallel_frontend_threads: u32, /// Number of times to execute each test. pub(crate) iteration_count: u32, + + pub(crate) wasm_proc_macros: bool, } impl Config { diff --git a/src/tools/compiletest/src/directives/cfg.rs b/src/tools/compiletest/src/directives/cfg.rs index b9036462f3447..19e08de1d062a 100644 --- a/src/tools/compiletest/src/directives/cfg.rs +++ b/src/tools/compiletest/src/directives/cfg.rs @@ -235,6 +235,12 @@ pub(crate) fn prepare_conditions(config: &Config) -> PreparedConditions { ); } + builder.cond( + "wasm-proc-macros", + config.wasm_proc_macros, + "when wasm-proc-macros is enabled in bootstrap.toml", + ); + // Coverage tests run the same test file in multiple modes. // If a particular test should not be run in one of the modes, ignore it // with "ignore-coverage-map" or "ignore-coverage-run". diff --git a/src/tools/compiletest/src/directives/directive_names.rs b/src/tools/compiletest/src/directives/directive_names.rs index b73e782252148..2a6783cbfbf1e 100644 --- a/src/tools/compiletest/src/directives/directive_names.rs +++ b/src/tools/compiletest/src/directives/directive_names.rs @@ -136,6 +136,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "ignore-vxworks", "ignore-wasi", "ignore-wasm", + "ignore-wasm-proc-macros", "ignore-wasm32", "ignore-wasm32-unknown-unknown", "ignore-wasm64", @@ -266,6 +267,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "only-uefi", "only-unix", "only-visionos", + "only-wasm-proc-macros", "only-wasm32", "only-wasm32-unknown-emscripten", "only-wasm32-unknown-unknown", diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 73e3b87b37aa8..8f45e037d0fc9 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1351,7 +1351,27 @@ impl<'test> TestCx<'test> { let mut aux_props = self.props.from_aux_file(&aux_path, self.variant.revision(), self.config); if aux_type == Some(AuxType::ProcMacro) { - aux_props.force_host = true; + if self.config.wasm_proc_macros { + aux_props.compile_flags.push("--target=wasm32-wasip2".to_owned()); + // Override any earlier linkers for now, otherwise we fail to build since compiletest + // thinks we're building for a different target and passes its linker (if one is + // configured). + // + // wasm32-wasip2 should in principle always be able to link with wasm-component-ld + + // wasm-ld. This does mean that rust.lld needs to be enabled to build wasm-ld wrapper + // around rust-lld. + aux_props.compile_flags.push("-Clinker=wasm-component-ld".to_owned()); + aux_props.compile_flags.push(format!( + "-Clink-arg=--wasm-ld-path={}", + self.config + .sysroot_base + .join("lib/rustlib") + .join(&self.config.host) + .join("bin/gcc-ld/wasm-ld") + )); + } else { + aux_props.force_host = true; + } } let mut aux_dir = aux_dir.to_path_buf(); if aux_type == Some(AuxType::Bin) { @@ -1576,6 +1596,11 @@ impl<'test> TestCx<'test> { }; compiler.arg(input_file); + // Enable wasm proc macros. + if self.config.wasm_proc_macros { + compiler.arg("-Zwasm-proc-macros"); + } + // Hide libstd sources from ui tests to make sure we generate the stderr // output that users will see. // Without this, we may be producing good diagnostics in-tree but users diff --git a/src/tools/compiletest/src/rustdoc_gui_test.rs b/src/tools/compiletest/src/rustdoc_gui_test.rs index 7fc37a1a4371d..88880f09837ee 100644 --- a/src/tools/compiletest/src/rustdoc_gui_test.rs +++ b/src/tools/compiletest/src/rustdoc_gui_test.rs @@ -143,5 +143,6 @@ fn incomplete_config_for_rustdoc_gui_test() -> Config { jobs: Default::default(), parallel_frontend_threads: Config::DEFAULT_PARALLEL_FRONTEND_THREADS, iteration_count: Config::DEFAULT_ITERATION_COUNT, + wasm_proc_macros: false, } } diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index 5a5acc53de766..07d64286d0c9b 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -13,6 +13,7 @@ extern crate rustc_data_structures; extern crate rustc_driver; extern crate rustc_interface; extern crate rustc_log; +extern crate rustc_metadata; extern crate rustc_middle; extern crate rustc_session; @@ -21,6 +22,7 @@ rustc_driver::override_c_allocator_in_binary!(); mod log; +use std::any::Any; use std::env; use std::num::{NonZero, NonZeroI32}; use std::ops::Range; @@ -34,6 +36,7 @@ use miri::{ TreeBorrowsParams, ValidationMode, entry_fn, run_genmc_mode, }; use rustc_codegen_ssa::traits::CodegenBackend; +use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig}; use rustc_data_structures::sync::{self, DynSync}; use rustc_driver::Compilation; use rustc_interface::interface::Config; @@ -51,6 +54,13 @@ struct MiriCompilerCalls { many_seeds: Option, } +struct MiriCodegenBackend { + native: Box, + dummy: DummyCodegenBackend, + /// Whether we are in a dependency or in the to-be-interpreted binary crate + dep: bool, +} + struct ManySeedsConfig { seeds: Range, keep_going: bool, @@ -97,39 +107,27 @@ fn run_many_seeds( /// Generates the codegen backend for code that Miri will interpret: we basically /// use the dummy backend, except that we put the LLVM backend in charge of /// target features. -fn make_miri_codegen_backend(sess: &Session) -> Box { +fn make_miri_codegen_backend(sess: &Session, dep: bool) -> Box { let early_dcx = EarlyDiagCtxt::new(sess.opts.error_format); // Use the target_config method of the default codegen backend (eg LLVM) to ensure the // calculated target features match said backend by respecting eg -Ctarget-cpu. - let target_config_backend = rustc_interface::util::get_codegen_backend( + let native_codegen_backend = rustc_interface::util::get_codegen_backend( &early_dcx, &sess.opts.sysroot, None, &sess.target, ); - target_config_backend.init(sess); + native_codegen_backend.init(sess); - Box::new(DummyCodegenBackend { - target_config_override: Some(Box::new(move |sess| { - let mut cfg = target_config_backend.target_config(sess); - // The basic types and ABI always work. - cfg.has_reliable_f16 = true; - cfg.has_reliable_f128 = true; - // We always provide the f16 intrinsics, but some are provided via the host, - // so forward its reliability. - cfg.has_reliable_f16_math = cfg!(target_has_reliable_f16_math); - // Many f128 operations are still missing. - cfg.has_reliable_f128_math = false; - cfg - })), - }) + Box::new(MiriCodegenBackend { native: native_codegen_backend, dummy: DummyCodegenBackend, dep }) } impl rustc_driver::Callbacks for MiriCompilerCalls { fn config(&mut self, config: &mut rustc_interface::interface::Config) { // We never reach codegen anyway. - config.make_codegen_backend = Some(Box::new(make_miri_codegen_backend)); + config.make_codegen_backend = + Some(Box::new(|sess| make_miri_codegen_backend(sess, /* dep */ false))); // Register our custom extra symbols. config.extra_symbols = miri::sym::EXTRA_SYMBOLS.into(); @@ -203,10 +201,71 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { tcx.dcx().abort_if_errors(); exit(return_code.get()); } else { - exit(rustc_driver::EXIT_SUCCESS); + // We want to continue here so rustc can do its usual shutdown and finalize the + // incremental session. Our custom codegen backend ensures nothing actually happens. + return Compilation::Continue; } + } +} + +impl CodegenBackend for MiriCodegenBackend { + fn name(&self) -> &'static str { + "miri" + } + + fn target_config(&self, sess: &Session) -> TargetConfig { + let native_target_config = self.native.target_config(sess); + TargetConfig { + internal_target_features: native_target_config.internal_target_features, - // Unreachable. + // The basic types and ABI always work. + has_reliable_f16: true, + has_reliable_f128: true, + // We always provide the f16 intrinsics, but some are provided via the host, + // so forward its reliability. + has_reliable_f16_math: cfg!(target_has_reliable_f16_math), + // Many f128 operations are still missing. + has_reliable_f128_math: false, + } + } + + fn target_cpu(&self, _sess: &Session) -> String { + String::new() + } + + // Everything complicated is forwarded to the dummy backend. + + fn supported_crate_types(&self, sess: &Session) -> Vec { + self.dummy.supported_crate_types(sess) + } + + fn codegen_crate<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Box { + self.dummy.codegen_crate(tcx) + } + + fn join_codegen( + &self, + ongoing_codegen: Box, + sess: &Session, + incr_comp_session: Option<&rustc_session::IncrCompSession>, + outputs: &rustc_session::config::OutputFilenames, + crate_info: &CrateInfo, + ) -> (CompiledModules, rustc_middle::dep_graph::WorkProductMap) { + self.dummy.join_codegen(ongoing_codegen, sess, incr_comp_session, outputs, crate_info) + } + + fn link( + &self, + sess: &Session, + compiled_modules: CompiledModules, + crate_info: CrateInfo, + metadata: rustc_metadata::EncodedMetadata, + outputs: &rustc_session::config::OutputFilenames, + ) { + // In the binary this should do nothing. + if self.dep { + self.dummy.link(sess, compiled_modules, crate_info, metadata, outputs) + } } } @@ -217,7 +276,8 @@ impl rustc_driver::Callbacks for MiriDepCompilerCalls { #[allow(rustc::potential_query_instability)] // rustc_codegen_ssa (where this code is copied from) also allows this lint fn config(&mut self, config: &mut Config) { // We don't need actual codegen, we just emit an rlib that Miri can later consume. - config.make_codegen_backend = Some(Box::new(make_miri_codegen_backend)); + config.make_codegen_backend = + Some(Box::new(|sess| make_miri_codegen_backend(sess, /* dep */ true))); // Avoid warnings about unsupported crate types. However, only do that we we are *not* being // queried by cargo about the supported crate types so that cargo still receives the @@ -683,4 +743,6 @@ fn main() -> ExitCode { } } run_compiler_and_exit(&rustc_args, &mut MiriCompilerCalls::new(miri_config, many_seeds)) + // Note that we *cannot* just return here, in native-lib mode we have to coordinate + // with the supervisor process! } diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index 7e8c49bf9fba0..900fc58b8cd91 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -237,7 +237,7 @@ pub fn prune_stacktrace<'tcx>( /// Report the result of a Miri execution. /// /// Returns `Some` if this was regular program termination with a given exit code and a `bool` -/// indicating whether a leak check should happen; `None` otherwise. +/// indicating whether a leak check should happen; `None` if execution was aborted with an error. pub fn report_result<'tcx>( ecx: &InterpCx<'tcx, MiriMachine<'tcx>>, res: InterpErrorInfo<'tcx>, diff --git a/src/tools/miri/src/eval.rs b/src/tools/miri/src/eval.rs index f33dc9d070971..3ba16971eca84 100644 --- a/src/tools/miri/src/eval.rs +++ b/src/tools/miri/src/eval.rs @@ -510,8 +510,8 @@ fn call_main<'tcx>( } /// Evaluates the entry function specified by `entry_id`. -/// Returns `Some(return_code)` if program execution completed. -/// Returns `None` if an evaluation error occurred. +/// Returns `Ok(())` if program execution completed with exit code 0. +/// Returns `Err(code)` if an evaluation error occurred or the program returned a non-0 exit code. pub fn eval_entry<'tcx>( tcx: TyCtxt<'tcx>, entry_id: DefId, diff --git a/src/tools/miri/tests/native-lib/pass/ptr_read_access.notrace.stderr b/src/tools/miri/tests/native-lib/pass/ptr_read_access.notrace.stderr index bc2fcac08f014..e1b6ce12fac90 100644 --- a/src/tools/miri/tests/native-lib/pass/ptr_read_access.notrace.stderr +++ b/src/tools/miri/tests/native-lib/pass/ptr_read_access.notrace.stderr @@ -14,3 +14,5 @@ LL | unsafe { print_pointer(&x) }; 1: main at tests/native-lib/pass/ptr_read_access.rs:LL:CC +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/native-lib/pass/ptr_read_access.trace.stderr b/src/tools/miri/tests/native-lib/pass/ptr_read_access.trace.stderr index c7f30c114f16a..3295eda01fffc 100644 --- a/src/tools/miri/tests/native-lib/pass/ptr_read_access.trace.stderr +++ b/src/tools/miri/tests/native-lib/pass/ptr_read_access.trace.stderr @@ -15,3 +15,5 @@ LL | unsafe { print_pointer(&x) }; 1: main at tests/native-lib/pass/ptr_read_access.rs:LL:CC +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/native-lib/pass/ptr_write_access.notrace.stderr b/src/tools/miri/tests/native-lib/pass/ptr_write_access.notrace.stderr index 15b2bc6df63fa..c86cf783f5d04 100644 --- a/src/tools/miri/tests/native-lib/pass/ptr_write_access.notrace.stderr +++ b/src/tools/miri/tests/native-lib/pass/ptr_write_access.notrace.stderr @@ -14,3 +14,5 @@ LL | unsafe { increment_int(&mut x) }; 1: main at tests/native-lib/pass/ptr_write_access.rs:LL:CC +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/native-lib/pass/ptr_write_access.trace.stderr b/src/tools/miri/tests/native-lib/pass/ptr_write_access.trace.stderr index d12a25f84b370..1c62afa09c799 100644 --- a/src/tools/miri/tests/native-lib/pass/ptr_write_access.trace.stderr +++ b/src/tools/miri/tests/native-lib/pass/ptr_write_access.trace.stderr @@ -15,3 +15,5 @@ LL | unsafe { increment_int(&mut x) }; 1: main at tests/native-lib/pass/ptr_write_access.rs:LL:CC +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr b/src/tools/miri/tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr index 09a24e1e5d74d..718ddf4e7f459 100644 --- a/src/tools/miri/tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr +++ b/src/tools/miri/tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr @@ -1,2 +1,4 @@ warning: `fcntl` was made to return an error due to isolation +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/pass-dep/libc/libc-fs-with-isolation.stderr b/src/tools/miri/tests/pass-dep/libc/libc-fs-with-isolation.stderr index b0cadfb970bf3..a3ed50bd9a65f 100644 --- a/src/tools/miri/tests/pass-dep/libc/libc-fs-with-isolation.stderr +++ b/src/tools/miri/tests/pass-dep/libc/libc-fs-with-isolation.stderr @@ -2,3 +2,5 @@ warning: `readlink` was made to return an error due to isolation warning: `$STAT` was made to return an error due to isolation +warning: 2 warnings emitted + diff --git a/src/tools/miri/tests/pass-dep/libc/libc-socket-invalid-addr.stderr b/src/tools/miri/tests/pass-dep/libc/libc-socket-invalid-addr.stderr index 4eea2b6d24fb3..ae73ce17e7ab8 100644 --- a/src/tools/miri/tests/pass-dep/libc/libc-socket-invalid-addr.stderr +++ b/src/tools/miri/tests/pass-dep/libc/libc-socket-invalid-addr.stderr @@ -6,3 +6,5 @@ LL | unsafe { libc::getaddrinfo(node_c_str.as_ptr(), service_c_str.as_pt | = note: Miri cannot return proper error information from this call; only a generic error code is being returned +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/pass-dep/libc/libc-socket-with-isolation.stderr b/src/tools/miri/tests/pass-dep/libc/libc-socket-with-isolation.stderr index 36fc0a5aac328..f7cfb6138cdcc 100644 --- a/src/tools/miri/tests/pass-dep/libc/libc-socket-with-isolation.stderr +++ b/src/tools/miri/tests/pass-dep/libc/libc-socket-with-isolation.stderr @@ -1,2 +1,4 @@ warning: `socket` was made to return an error due to isolation +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/pass-dep/shims/gettid.rs b/src/tools/miri/tests/pass-dep/shims/gettid.rs index 2522a15219148..90e456d27f523 100644 --- a/src/tools/miri/tests/pass-dep/shims/gettid.rs +++ b/src/tools/miri/tests/pass-dep/shims/gettid.rs @@ -3,6 +3,7 @@ //@ [without_isolation] compile-flags: -Zmiri-disable-isolation #![feature(linkage)] +#![allow(unused_features)] // only used on some targets fn gettid() -> u64 { cfg_select! { diff --git a/src/tools/miri/tests/pass/async-closure-drop.rs b/src/tools/miri/tests/pass/async-closure-drop.rs index d1fd92814d950..4cf25c65af9ab 100644 --- a/src/tools/miri/tests/pass/async-closure-drop.rs +++ b/src/tools/miri/tests/pass/async-closure-drop.rs @@ -1,4 +1,4 @@ -#![feature(async_fn_traits, async_trait_bounds)] +#![feature(async_trait_bounds)] use std::future::Future; use std::pin::pin; diff --git a/src/tools/miri/tests/pass/async-closure.rs b/src/tools/miri/tests/pass/async-closure.rs index 5067f1d2d8e78..c67af28b37802 100644 --- a/src/tools/miri/tests/pass/async-closure.rs +++ b/src/tools/miri/tests/pass/async-closure.rs @@ -1,5 +1,3 @@ -#![feature(async_fn_traits)] - use std::future::Future; use std::ops::{AsyncFn, AsyncFnMut, AsyncFnOnce}; use std::pin::pin; diff --git a/src/tools/miri/tests/pass/async-drop.rs b/src/tools/miri/tests/pass/async-drop.rs index 3461af5bededf..0291c74a75650 100644 --- a/src/tools/miri/tests/pass/async-drop.rs +++ b/src/tools/miri/tests/pass/async-drop.rs @@ -7,7 +7,7 @@ // please consider modifying rustc's async drop test at // `tests/ui/async-await/async-drop/async-drop-initial.rs`. -#![feature(async_drop, impl_trait_in_assoc_type)] +#![feature(async_drop)] #![allow(incomplete_features, dead_code)] // FIXME(zetanumbers): consider AsyncDestruct::async_drop cleanup tests diff --git a/src/tools/miri/tests/pass/both_borrows/basic_aliasing_model.rs b/src/tools/miri/tests/pass/both_borrows/basic_aliasing_model.rs index 5689ad0e62e2b..da984fe133689 100644 --- a/src/tools/miri/tests/pass/both_borrows/basic_aliasing_model.rs +++ b/src/tools/miri/tests/pass/both_borrows/basic_aliasing_model.rs @@ -1,7 +1,7 @@ //@revisions: stack tree tree_implicit_writes //@[tree_implicit_writes]compile-flags: -Zmiri-tree-borrows -Zmiri-tree-borrows-implicit-writes //@[tree]compile-flags: -Zmiri-tree-borrows -#![feature(allocator_api)] + use std::alloc::{Layout, alloc, dealloc}; use std::cell::Cell; use std::ptr; diff --git a/src/tools/miri/tests/pass/extern_types.stack.stderr b/src/tools/miri/tests/pass/extern_types.stack.stderr index 88825169e1cd7..c1a66d92a7241 100644 --- a/src/tools/miri/tests/pass/extern_types.stack.stderr +++ b/src/tools/miri/tests/pass/extern_types.stack.stderr @@ -7,3 +7,5 @@ LL | let x: &Foo = unsafe { &*(ptr::without_provenance::<()>(16) as *const F = help: `extern type` are not compatible with the Stacked Borrows aliasing model implemented by Miri; Miri may miss bugs in this code = help: try running with `MIRIFLAGS=-Zmiri-tree-borrows` to use the more permissive but also even more experimental Tree Borrows aliasing checks instead +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/pass/open_a_file_in_proc.stderr b/src/tools/miri/tests/pass/open_a_file_in_proc.stderr index c80b11ecb37bb..1667200204ac7 100644 --- a/src/tools/miri/tests/pass/open_a_file_in_proc.stderr +++ b/src/tools/miri/tests/pass/open_a_file_in_proc.stderr @@ -30,3 +30,5 @@ LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode a 11: main at tests/pass/open_a_file_in_proc.rs:LL:CC +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/pass/shims/env/current_dir_with_isolation.stderr b/src/tools/miri/tests/pass/shims/env/current_dir_with_isolation.stderr index 589ca65a1e47e..6133368b01859 100644 --- a/src/tools/miri/tests/pass/shims/env/current_dir_with_isolation.stderr +++ b/src/tools/miri/tests/pass/shims/env/current_dir_with_isolation.stderr @@ -2,3 +2,5 @@ warning: `$GETCWD` was made to return an error due to isolation warning: `$SETCWD` was made to return an error due to isolation +warning: 2 warnings emitted + diff --git a/src/tools/miri/tests/pass/shims/fs-with-isolation.stderr b/src/tools/miri/tests/pass/shims/fs-with-isolation.stderr index 452c5b9b772aa..abcb6221af214 100644 --- a/src/tools/miri/tests/pass/shims/fs-with-isolation.stderr +++ b/src/tools/miri/tests/pass/shims/fs-with-isolation.stderr @@ -14,3 +14,5 @@ warning: `rmdir` was made to return an error due to isolation warning: `opendir` was made to return an error due to isolation +warning: 8 warnings emitted + diff --git a/src/tools/miri/tests/pass/shims/socket-address.stderr b/src/tools/miri/tests/pass/shims/socket-address.stderr index 7091c3b6c6d5a..12b7aa1514c87 100644 --- a/src/tools/miri/tests/pass/shims/socket-address.stderr +++ b/src/tools/miri/tests/pass/shims/socket-address.stderr @@ -23,3 +23,5 @@ LL | cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &m 7: main at tests/pass/shims/socket-address.rs:LL:CC +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.stderr b/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.stderr index 171bf0c82d511..7ec8b04cfce01 100644 --- a/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.stderr +++ b/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.stderr @@ -3,3 +3,5 @@ warning: target feature `sse2` must be enabled to ensure that the ABI of the cur = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #116344 +warning: 1 warning emitted + diff --git a/src/tools/miri/tests/pass/stacked_borrows/coroutine-self-referential.rs b/src/tools/miri/tests/pass/stacked_borrows/coroutine-self-referential.rs index 72e360fe19a1f..4fef797d7c282 100644 --- a/src/tools/miri/tests/pass/stacked_borrows/coroutine-self-referential.rs +++ b/src/tools/miri/tests/pass/stacked_borrows/coroutine-self-referential.rs @@ -1,6 +1,6 @@ // See https://github.com/rust-lang/unsafe-code-guidelines/issues/148: // this fails when Stacked Borrows is strictly applied even to `!Unpin` types. -#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; diff --git a/src/tools/miri/tests/pass/tree_borrows/tree-borrows.rs b/src/tools/miri/tests/pass/tree_borrows/tree-borrows.rs index 4bcaf823e99ca..2672294220ab6 100644 --- a/src/tools/miri/tests/pass/tree_borrows/tree-borrows.rs +++ b/src/tools/miri/tests/pass/tree_borrows/tree-borrows.rs @@ -1,7 +1,6 @@ //@revisions: tree tree_implicit_writes //@[tree_implicit_writes]compile-flags: -Zmiri-tree-borrows-implicit-writes //@compile-flags: -Zmiri-tree-borrows -#![feature(allocator_api)] use std::{mem, ptr}; diff --git a/src/tools/rustfmt/src/types.rs b/src/tools/rustfmt/src/types.rs index d6a25e61008f0..9edfa2cf438fe 100644 --- a/src/tools/rustfmt/src/types.rs +++ b/src/tools/rustfmt/src/types.rs @@ -313,19 +313,14 @@ fn rewrite_segment( Ok(result) } -fn format_function_type<'a, I>( - inputs: I, +fn format_function_type( + inputs: &[ast::Param], output: &FnRetTy, variadic: bool, span: Span, context: &RewriteContext<'_>, shape: Shape, -) -> RewriteResult -where - I: ExactSizeIterator, - ::Item: Deref, - ::Target: Rewrite + Spanned + 'a, -{ +) -> RewriteResult { debug!("format_function_type {:#?}", shape); let ty_shape = match context.config.indent_style() { @@ -381,7 +376,7 @@ where } else { let items = itemize_list( context.snippet_provider, - inputs, + inputs.iter(), ")", ",", |arg| arg.span().lo(), @@ -563,14 +558,9 @@ fn rewrite_generic_args( overflow::rewrite_with_angle_brackets(context, "", args.iter(), shape, span) } } - ast::GenericArgs::Parenthesized(ref data) => format_function_type( - data.inputs.iter().map(|x| &**x), - &data.output, - false, - data.span, - context, - shape, - ), + ast::GenericArgs::Parenthesized(ref data) => { + format_function_type(&data.inputs, &data.output, false, data.span, context, shape) + } ast::GenericArgs::ParenthesizedElided(..) => Ok("(..)".to_owned()), } } @@ -1129,7 +1119,7 @@ fn rewrite_fn_ptr( }; let rewrite = format_function_type( - fn_ptr.decl.inputs.iter(), + &fn_ptr.decl.inputs, &fn_ptr.decl.output, fn_ptr.decl.c_variadic(), span, diff --git a/src/tools/rustfmt/tests/target/named-fn-trait-parameters.rs b/src/tools/rustfmt/tests/target/named-fn-trait-parameters.rs new file mode 100644 index 0000000000000..36621da20192f --- /dev/null +++ b/src/tools/rustfmt/tests/target/named-fn-trait-parameters.rs @@ -0,0 +1,15 @@ +fn allowed( + data: &str, + f1: impl Fn(msg: String), + f2: impl Fn(_: String), + f3: impl Fn(String, msg: String), + f4: impl Fn(msg: String, String), + fg: F, +) where + F: Fn(msg: String), +{ +} + +my_macro!(f(x: &str)); +my_macro!(f(x: &str) -> ()); +my_macro!(g(n: i32, m: usize) -> usize); diff --git a/tests/run-make-cargo/thumb-none-cortex-m/rmake.rs b/tests/run-make-cargo/thumb-none-cortex-m/rmake.rs index 6158b9c36da24..92b832599970b 100644 --- a/tests/run-make-cargo/thumb-none-cortex-m/rmake.rs +++ b/tests/run-make-cargo/thumb-none-cortex-m/rmake.rs @@ -18,7 +18,7 @@ use run_make_support::{cargo, cmd, env, env_var, target}; const CRATE: &str = "cortex-m"; const CRATE_URL: &str = "https://github.com/rust-embedded/cortex-m"; -const CRATE_SHA1: &str = "a448e9156e2cb1e556e5441fd65426952ef4b927"; // v0.5.0 +const CRATE_SHA1: &str = "bb4a78208323260a161e68b2498438867f971bc5"; // v0.7.7 fn main() { // FIXME: requires an internet connection https://github.com/rust-lang/rust/issues/128733 diff --git a/tests/rustdoc-gui/notable-traits.goml b/tests/rustdoc-gui/notable-traits.goml new file mode 100644 index 0000000000000..f31b83e12edf0 --- /dev/null +++ b/tests/rustdoc-gui/notable-traits.goml @@ -0,0 +1,14 @@ +// This test ensures that the notable trait badges are correctly rendered. +go-to: "file://" + |DOC_PATH| + "/test_docs/notable/struct.Wrapper.html" +show-text: true +store-css: (".notable-trait-badge-container", {"background-color": background_color}) +// The background color should be different. +assert-css-false: (".notable-trait-badge-container > a", {"background-color": |background_color|}) + +store-css: ("#trait-implementations", {"color": text_color}) +assert-css: (".notable-trait-badge-container > a", { + // The color should be the same as the "main color". + "color": |text_color|, + // Checking some additional CSS values. + "border-radius": "12px", +}) diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index bfdbe65f147f4..2bba2ac101544 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -13,6 +13,7 @@ #![feature(macro_attr)] #![feature(macro_derive)] #![feature(negative_impls)] +#![feature(doc_notable_trait)] /*! Enable the feature some-feature to enjoy @@ -813,3 +814,11 @@ pub mod tyalias { pub type Y = X; } + +pub mod notable { + #[doc(notable_trait)] + pub trait Labeled {} + + pub struct Wrapper; + impl Labeled for Wrapper {} +} diff --git a/tests/rustdoc-ui/doc-cfg-2.stderr b/tests/rustdoc-ui/doc-cfg-2.stderr index da202ea4809f1..6fc30c718a441 100644 --- a/tests/rustdoc-ui/doc-cfg-2.stderr +++ b/tests/rustdoc-ui/doc-cfg-2.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `foo` LL | #[doc(cfg(foo), cfg(bar))] | ^^^ | - = help: expected names are: `FALSE` and `test` and 33 more + = help: expected names are: `FALSE` and `test` and 34 more = help: to expect this configuration use `--check-cfg=cfg(foo)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cargo-build-script.stderr b/tests/ui/check-cfg/cargo-build-script.stderr index 9694a762a06c4..d36d0909a0ad6 100644 --- a/tests/ui/check-cfg/cargo-build-script.stderr +++ b/tests/ui/check-cfg/cargo-build-script.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `has_foo` LL | #[cfg(has_foo)] | ^^^^^^^ | - = help: expected names are: `has_bar` and 33 more + = help: expected names are: `has_bar` and 34 more = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr index 05d2a41238258..130cbc0e1ec45 100644 --- a/tests/ui/check-cfg/cargo-feature.none.stderr +++ b/tests/ui/check-cfg/cargo-feature.none.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `docsrs`, `feature`, and `test` and 33 more + = help: expected names are: `docsrs`, `feature`, and `test` and 34 more = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr index de84eb2932e7e..e6d07b82928db 100644 --- a/tests/ui/check-cfg/cargo-feature.some.stderr +++ b/tests/ui/check-cfg/cargo-feature.some.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `CONFIG_NVME`, `docsrs`, `feature`, and `test` and 33 more + = help: expected names are: `CONFIG_NVME`, `docsrs`, `feature`, and `test` and 34 more = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cfg-select.stderr b/tests/ui/check-cfg/cfg-select.stderr index e4bc800f7cc07..8769f938d3836 100644 --- a/tests/ui/check-cfg/cfg-select.stderr +++ b/tests/ui/check-cfg/cfg-select.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `invalid_cfg1` LL | invalid_cfg1 => {} | ^^^^^^^^^^^^ | - = help: expected names are: `FALSE` and `test` and 33 more + = help: expected names are: `FALSE` and `test` and 34 more = help: to expect this configuration use `--check-cfg=cfg(invalid_cfg1)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr index 50ae3d88f61df..576fa0cdbfae0 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value` LL | #[cfg(value)] | ^^^^^ | - = help: expected names are: `bar`, `bee`, `cow`, and `foo` and 33 more + = help: expected names are: `bar`, `bee`, `cow`, and `foo` and 34 more = help: to expect this configuration use `--check-cfg=cfg(value)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr index b432d46920a22..66fc5b7e2125b 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_value` LL | #[cfg(my_value)] | ^^^^^^^^ | - = help: expected names are: `bar` and `foo` and 33 more + = help: expected names are: `bar` and `foo` and 34 more = help: to expect this configuration use `--check-cfg=cfg(my_value)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr index 8c0b623d445ed..8e3825f098ff3 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 33 more + = help: expected names are: `feature` and 34 more = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr index 8c0b623d445ed..8e3825f098ff3 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 33 more + = help: expected names are: `feature` and 34 more = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/hrtb-crash.stderr b/tests/ui/check-cfg/hrtb-crash.stderr index d07dee86d680c..a07e774f5329d 100644 --- a/tests/ui/check-cfg/hrtb-crash.stderr +++ b/tests/ui/check-cfg/hrtb-crash.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `b` LL | for<#[cfg(b)] c> u8:; | ^ help: found config with similar value: `target_feature = "b"` | - = help: expected names are: `FALSE`, `docsrs`, and `test` and 33 more + = help: expected names are: `FALSE`, `docsrs`, and `test` and 34 more = help: to expect this configuration use `--check-cfg=cfg(b)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index bd0ecc2d0ac6b..4d113d37c6c68 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu` LL | #[cfg_attr(uu, unix)] | ^^ | - = help: expected names are: `feature` and 33 more + = help: expected names are: `feature` and 34 more = help: to expect this configuration use `--check-cfg=cfg(uu)` = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/nested-cfg.stderr b/tests/ui/check-cfg/nested-cfg.stderr index 19dd68753b74e..96a53b1c22ee5 100644 --- a/tests/ui/check-cfg/nested-cfg.stderr +++ b/tests/ui/check-cfg/nested-cfg.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown` LL | #[cfg(unknown)] | ^^^^^^^ | - = help: expected names are: `FALSE` and `test` and 33 more + = help: expected names are: `FALSE` and `test` and 34 more = help: to expect this configuration use `--check-cfg=cfg(unknown)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/raw-keywords.edition2015.stderr b/tests/ui/check-cfg/raw-keywords.edition2015.stderr index 46e02bfbb3ecd..53b91670b5821 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2015.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2015.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false` LL | #[cfg(r#false)] | ^^^^^^^ | - = help: expected names are: `async`, `edition2015`, `edition2021`, and `r#true` and 33 more + = help: expected names are: `async`, `edition2015`, `edition2021`, and `r#true` and 34 more = help: to expect this configuration use `--check-cfg=cfg(r#false)` = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/raw-keywords.edition2021.stderr b/tests/ui/check-cfg/raw-keywords.edition2021.stderr index 3e108debfcf8b..c5900a12ed008 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2021.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2021.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false` LL | #[cfg(r#false)] | ^^^^^^^ | - = help: expected names are: `r#async`, `edition2015`, `edition2021`, and `r#true` and 33 more + = help: expected names are: `r#async`, `edition2015`, `edition2021`, and `r#true` and 34 more = help: to expect this configuration use `--check-cfg=cfg(r#false)` = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr index 646c814ef65f6..1d5be70dbcd77 100644 --- a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr +++ b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg` LL | cfg_macro::my_lib_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 33 more + = help: expected names are: `feature` and 34 more = note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate = help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr index d38f3560063ac..1ac657131ad45 100644 --- a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr +++ b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg` LL | cfg_macro::my_lib_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 33 more + = help: expected names are: `feature` and 34 more = note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate = help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg = help: to expect this configuration use `--check-cfg=cfg(my_lib_cfg)` diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr index 3f68bca37dd5d..31685126aac8f 100644 --- a/tests/ui/check-cfg/well-known-names.stderr +++ b/tests/ui/check-cfg/well-known-names.stderr @@ -15,6 +15,7 @@ LL | #[cfg(list_all_well_known_cfgs)] `panic` `proc_macro` `relocation_model` +`rust_analyzer` `rustfmt` `sanitize` `sanitizer_cfi_generalize_pointers` diff --git a/tests/ui/check-cfg/well-known-values.rs b/tests/ui/check-cfg/well-known-values.rs index c10139570570b..54157fe6f4e46 100644 --- a/tests/ui/check-cfg/well-known-values.rs +++ b/tests/ui/check-cfg/well-known-values.rs @@ -47,6 +47,8 @@ //~^ WARN unexpected `cfg` condition value relocation_model = "_UNEXPECTED_VALUE", //~^ WARN unexpected `cfg` condition value + rust_analyzer = "_UNEXPECTED_VALUE", + //~^ WARN unexpected `cfg` condition value rustfmt = "_UNEXPECTED_VALUE", //~^ WARN unexpected `cfg` condition value sanitize = "_UNEXPECTED_VALUE", diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index 693833decc971..3d6422fe5f380 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -106,6 +106,17 @@ LL | relocation_model = "_UNEXPECTED_VALUE", warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:50:5 | +LL | rust_analyzer = "_UNEXPECTED_VALUE", + | ^^^^^^^^^^^^^---------------------- + | | + | help: remove the value + | + = note: no expected value for `rust_analyzer` + = note: see for more information about checking conditional configuration + +warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` + --> $DIR/well-known-values.rs:52:5 + | LL | rustfmt = "_UNEXPECTED_VALUE", | ^^^^^^^---------------------- | | @@ -115,7 +126,7 @@ LL | rustfmt = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:52:5 + --> $DIR/well-known-values.rs:54:5 | LL | sanitize = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -124,7 +135,7 @@ LL | sanitize = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:54:5 + --> $DIR/well-known-values.rs:56:5 | LL | target_abi = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +144,7 @@ LL | target_abi = "_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 + --> $DIR/well-known-values.rs:58:5 | LL | target_arch = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -142,7 +153,7 @@ LL | target_arch = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:58:5 + --> $DIR/well-known-values.rs:60:5 | LL | target_endian = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -151,7 +162,7 @@ LL | target_endian = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:60:5 + --> $DIR/well-known-values.rs:62:5 | LL | target_env = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -160,7 +171,7 @@ LL | target_env = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:62:5 + --> $DIR/well-known-values.rs:64:5 | LL | target_family = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -169,7 +180,7 @@ 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:66:5 + --> $DIR/well-known-values.rs:68:5 | LL | target_has_atomic = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -178,7 +189,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:68:5 + --> $DIR/well-known-values.rs:70:5 | LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -187,7 +198,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:70:5 + --> $DIR/well-known-values.rs:72:5 | LL | target_has_atomic_primitive_alignment = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -196,7 +207,7 @@ LL | target_has_atomic_primitive_alignment = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:72:5 + --> $DIR/well-known-values.rs:74:5 | LL | target_has_threads = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^---------------------- @@ -207,7 +218,7 @@ LL | target_has_threads = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:74:5 + --> $DIR/well-known-values.rs:76:5 | LL | target_object_format = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -216,7 +227,7 @@ LL | target_object_format = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:76:5 + --> $DIR/well-known-values.rs:78:5 | LL | target_os = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -225,7 +236,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:78:5 + --> $DIR/well-known-values.rs:80:5 | LL | target_pointer_width = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -234,7 +245,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:80:5 + --> $DIR/well-known-values.rs:82:5 | LL | target_thread_local = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^---------------------- @@ -245,7 +256,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:82:5 + --> $DIR/well-known-values.rs:84:5 | LL | target_vendor = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -254,7 +265,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:84:5 + --> $DIR/well-known-values.rs:86:5 | LL | ub_checks = "_UNEXPECTED_VALUE", | ^^^^^^^^^---------------------- @@ -265,7 +276,7 @@ LL | ub_checks = "_UNEXPECTED_VALUE", = note: see for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:86:5 + --> $DIR/well-known-values.rs:88:5 | LL | unix = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -276,7 +287,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:88:5 + --> $DIR/well-known-values.rs:90:5 | LL | windows = "_UNEXPECTED_VALUE", | ^^^^^^^---------------------- @@ -287,7 +298,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:94:7 + --> $DIR/well-known-values.rs:96:7 | LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` | ^^^^^^^^^^^^------- @@ -297,5 +308,5 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qnx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see for more information about checking conditional configuration -warning: 30 warnings emitted +warning: 31 warnings emitted diff --git a/tests/ui/macros/cfg.stderr b/tests/ui/macros/cfg.stderr index b4c7cd3306d26..05fdae02a0161 100644 --- a/tests/ui/macros/cfg.stderr +++ b/tests/ui/macros/cfg.stderr @@ -46,7 +46,7 @@ warning: unexpected `cfg` condition name: `foo` LL | cfg!(foo); | ^^^ | - = help: expected names are: `FALSE` and `test` and 33 more + = help: expected names are: `FALSE` and `test` and 34 more = help: to expect this configuration use `--check-cfg=cfg(foo)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/macros/cfg_select.stderr b/tests/ui/macros/cfg_select.stderr index 1a72e7a9c0ace..8e09aa4da93f3 100644 --- a/tests/ui/macros/cfg_select.stderr +++ b/tests/ui/macros/cfg_select.stderr @@ -169,7 +169,7 @@ warning: unexpected `cfg` condition name: `a` LL | a + 1 => {} | ^ help: found config with similar value: `target_feature = "a"` | - = help: expected names are: `FALSE` and `test` and 33 more + = help: expected names are: `FALSE` and `test` and 34 more = help: to expect this configuration use `--check-cfg=cfg(a)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default