diff options
1062 files changed, 9941 insertions, 7115 deletions
diff --git a/.gitignore b/.gitignore index ddc8dad95e8..2184e04f16b 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,8 @@ no_llvm_build /library/target /src/bootstrap/target /src/tools/x/target +# Created by `x vendor` +/vendor # Created by default with `src/ci/docker/run.sh` /obj/ # Created by nix dev shell / .envrc diff --git a/Cargo.lock b/Cargo.lock index d31ef9c4b17..e9ee3c6b36e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3317,6 +3317,7 @@ dependencies = [ "rand 0.8.5", "rand_xoshiro", "rustc_data_structures", + "rustc_hashes", "rustc_index", "rustc_macros", "rustc_serialize", @@ -3544,6 +3545,7 @@ dependencies = [ "rustc_errors", "rustc_fluent_macro", "rustc_fs_util", + "rustc_hashes", "rustc_hir", "rustc_index", "rustc_llvm", @@ -3586,6 +3588,7 @@ dependencies = [ "rustc_errors", "rustc_fluent_macro", "rustc_fs_util", + "rustc_hashes", "rustc_hir", "rustc_hir_pretty", "rustc_incremental", @@ -3658,6 +3661,7 @@ dependencies = [ "rustc-stable-hash", "rustc_arena", "rustc_graphviz", + "rustc_hashes", "rustc_index", "rustc_macros", "rustc_serialize", @@ -3768,6 +3772,7 @@ dependencies = [ "rustc_error_codes", "rustc_error_messages", "rustc_fluent_macro", + "rustc_hashes", "rustc_hir", "rustc_index", "rustc_lexer", @@ -3841,6 +3846,13 @@ name = "rustc_graphviz" version = "0.0.0" [[package]] +name = "rustc_hashes" +version = "0.0.0" +dependencies = [ + "rustc-stable-hash", +] + +[[package]] name = "rustc_hir" version = "0.0.0" dependencies = [ @@ -3849,6 +3861,7 @@ dependencies = [ "rustc_arena", "rustc_ast", "rustc_data_structures", + "rustc_hashes", "rustc_index", "rustc_macros", "rustc_serialize", @@ -4169,6 +4182,7 @@ dependencies = [ "rustc_feature", "rustc_fluent_macro", "rustc_graphviz", + "rustc_hashes", "rustc_hir", "rustc_hir_pretty", "rustc_index", @@ -4405,6 +4419,7 @@ dependencies = [ "measureme", "rustc_data_structures", "rustc_errors", + "rustc_hashes", "rustc_hir", "rustc_index", "rustc_middle", @@ -4428,6 +4443,7 @@ dependencies = [ "rustc_errors", "rustc_feature", "rustc_fluent_macro", + "rustc_hashes", "rustc_hir", "rustc_index", "rustc_macros", @@ -4488,6 +4504,7 @@ name = "rustc_serialize" version = "0.0.0" dependencies = [ "indexmap", + "rustc_hashes", "rustc_macros", "smallvec", "tempfile", @@ -4508,6 +4525,7 @@ dependencies = [ "rustc_feature", "rustc_fluent_macro", "rustc_fs_util", + "rustc_hashes", "rustc_hir", "rustc_lint_defs", "rustc_macros", @@ -4549,6 +4567,7 @@ dependencies = [ "md-5", "rustc_arena", "rustc_data_structures", + "rustc_hashes", "rustc_index", "rustc_macros", "rustc_serialize", @@ -4568,6 +4587,7 @@ dependencies = [ "rustc_abi", "rustc_data_structures", "rustc_errors", + "rustc_hashes", "rustc_hir", "rustc_middle", "rustc_session", @@ -4663,6 +4683,7 @@ dependencies = [ "rustc_data_structures", "rustc_errors", "rustc_fluent_macro", + "rustc_hashes", "rustc_hir", "rustc_index", "rustc_infer", @@ -6195,16 +6216,11 @@ dependencies = [ [[package]] name = "windows-bindgen" -version = "0.58.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cd28d93c692351f3a6e5615567c56756e330bee1c99c6bdd57bfc5ab15f589" +checksum = "9b7fb600834d7e868f6e5bb748a86101427330fafbf9485c331b9d5f562d54a5" dependencies = [ - "proc-macro2", "rayon", - "serde", - "serde_json", - "syn 2.0.96", - "windows-metadata", ] [[package]] @@ -6286,12 +6302,6 @@ dependencies = [ ] [[package]] -name = "windows-metadata" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e837f3c3012cfe9e7086302a93f441a7999439be1ad4c530d55d2f6d2921809" - -[[package]] name = "windows-result" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/RELEASES.md b/RELEASES.md index 1dd3fbea613..038d7ca639f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,134 @@ +Version 1.85.0 (2025-02-20) +========================== + +<a id="1.85.0-Language"></a> + +Language +-------- +- [The 2024 Edition is now stable.](https://github.com/rust-lang/rust/pull/133349) + See [the edition guide](https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html) for more details. +- [Stabilize async closures](https://github.com/rust-lang/rust/pull/132706) + See [RFC 3668](https://rust-lang.github.io/rfcs/3668-async-closures.html) for more details. +- [Stabilize `#[diagnostic::do_not_recommend]`](https://github.com/rust-lang/rust/pull/132056) +- [Add `unpredictable_function_pointer_comparisons` lint to warn against function pointer comparisons](https://github.com/rust-lang/rust/pull/118833) +- [Lint on combining `#[no_mangle]` and `#[export_name]` attributes.](https://github.com/rust-lang/rust/pull/131558) + +<a id="1.85.0-Compiler"></a> + +Compiler +-------- +- [The unstable flag `-Zpolymorphize` has been removed](https://github.com/rust-lang/rust/pull/133883), see https://github.com/rust-lang/compiler-team/issues/810 for some background. + +<a id="1.85.0-Platform-Support"></a> + +Platform Support +---------------- +- [Promote `powerpc64le-unknown-linux-musl` to tier 2 with host tools](https://github.com/rust-lang/rust/pull/133801) + +Refer to Rust's [platform support page][platform-support-doc] +for more information on Rust's tiered platform support. + +<a id="1.85.0-Libraries"></a> + +Libraries +--------- +- [Panics in the standard library now have a leading `library/` in their path](https://github.com/rust-lang/rust/pull/132390) +- [`std::env::home_dir()` on Windows now ignores the non-standard `$HOME` environment variable](https://github.com/rust-lang/rust/pull/132515) + + It will be un-deprecated in a subsequent release. +- [Add `AsyncFn*` to the prelude in all editions.](https://github.com/rust-lang/rust/pull/132611) + +<a id="1.85.0-Stabilized-APIs"></a> + +Stabilized APIs +--------------- + +- [`BuildHasherDefault::new`](https://doc.rust-lang.org/stable/std/hash/struct.BuildHasherDefault.html#method.new) +- [`ptr::fn_addr_eq`](https://doc.rust-lang.org/std/ptr/fn.fn_addr_eq.html) +- [`io::ErrorKind::QuotaExceeded`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.QuotaExceeded) +- [`io::ErrorKind::CrossesDevices`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.CrossesDevices) +- [`{float}::midpoint`](https://doc.rust-lang.org/core/primitive.f32.html#method.midpoint) +- [Unsigned `{integer}::midpoint`](https://doc.rust-lang.org/std/primitive.u64.html#method.midpoint) +- [`NonZeroU*::midpoint`](https://doc.rust-lang.org/std/num/type.NonZeroU32.html#method.midpoint) +- [impl `std::iter::Extend` for tuples with arity 1 through 12](https://doc.rust-lang.org/stable/std/iter/trait.Extend.html#impl-Extend%3C(A,)%3E-for-(EA,)) +- [`FromIterator<(A, ...)>` for tuples with arity 1 through 12](https://doc.rust-lang.org/stable/std/iter/trait.FromIterator.html#impl-FromIterator%3C(EA,)%3E-for-(A,)) +- [`std::task::Waker::noop`](https://doc.rust-lang.org/stable/std/task/struct.Waker.html#method.noop) + +These APIs are now stable in const contexts: + +- [`mem::size_of_val`](https://doc.rust-lang.org/stable/std/mem/fn.size_of_val.html) +- [`mem::align_of_val`](https://doc.rust-lang.org/stable/std/mem/fn.align_of_val.html) +- [`Layout::for_value`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.for_value) +- [`Layout::align_to`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.align_to) +- [`Layout::pad_to_align`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.pad_to_align) +- [`Layout::extend`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.extend) +- [`Layout::array`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.array) +- [`std::mem::swap`](https://doc.rust-lang.org/stable/std/mem/fn.swap.html) +- [`std::ptr::swap`](https://doc.rust-lang.org/stable/std/ptr/fn.swap.html) +- [`NonNull::new`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.new) +- [`HashMap::with_hasher`](https://doc.rust-lang.org/stable/std/collections/struct.HashMap.html#method.with_hasher) +- [`HashSet::with_hasher`](https://doc.rust-lang.org/stable/std/collections/struct.HashSet.html#method.with_hasher) +- [`BuildHasherDefault::new`](https://doc.rust-lang.org/stable/std/hash/struct.BuildHasherDefault.html#method.new) +- [`<float>::recip`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.recip) +- [`<float>::to_degrees`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.to_degrees) +- [`<float>::to_radians`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.to_radians) +- [`<float>::max`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.max) +- [`<float>::min`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.min) +- [`<float>::clamp`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.clamp) +- [`<float>::abs`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.abs) +- [`<float>::signum`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.signum) +- [`<float>::copysign`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.copysign) +- [`MaybeUninit::write`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.write) + +<a id="1.85.0-Cargo"></a> + +Cargo +----- +- [Add future-incompatibility warning against keywords in cfgs and add raw-idents](https://github.com/rust-lang/cargo/pull/14671/) +- [Stabilize higher precedence trailing flags](https://github.com/rust-lang/cargo/pull/14900/) +- [Pass `CARGO_CFG_FEATURE` to build scripts](https://github.com/rust-lang/cargo/pull/14902/) + +<a id="1.85.0-Rustdoc"></a> + +Rustdoc +----- +- [Doc comment on impl blocks shows the first line, even when the impl block is collapsed](https://github.com/rust-lang/rust/pull/132155) + +<a id="1.85.0-Compatibility-Notes"></a> + +Compatibility Notes +------------------- +- [`rustc` no longer treats the `test` cfg as a well known check-cfg](https://github.com/rust-lang/rust/pull/131729), instead it is up to the build systems and users of `--check-cfg`[^check-cfg] to set it as a well known cfg using `--check-cfg=cfg(test)`. + + This is done to enable build systems like Cargo to set it conditionally, as not all source files are suitable for unit tests. + [Cargo (for now) unconditionally sets the `test` cfg as a well known cfg](https://github.com/rust-lang/cargo/pull/14963). + [^check-cfg]: https://doc.rust-lang.org/nightly/rustc/check-cfg.html +- [Disable potentially incorrect type inference if there are trivial and non-trivial where-clauses](https://github.com/rust-lang/rust/pull/132325) +- `std::env::home_dir()` has been deprecated for years, because it can give surprising results in some Windows configurations if the `HOME` environment variable is set (which is not the normal configuration on Windows). We had previously avoided changing its behavior, out of concern for compatibility with code depending on this non-standard configuration. Given how long this function has been deprecated, we're now fixing its behavior as a bugfix. A subsequent release will remove the deprecation for this function. +- [Make `core::ffi::c_char` signedness more closely match that of the platform-default `char`](https://github.com/rust-lang/rust/pull/132975) + + This changed `c_char` from an `i8` to `u8` or vice versa on many Tier 2 and 3 + targets (mostly Arm and RISC-V embedded targets). The new definition may + result in compilation failures but fixes compatibility issues with C. + + The `libc` crate matches this change as of its 0.2.169 release. +- [When compiling a nested `macro_rules` macro from an external crate, the content of the inner `macro_rules` is now built with the edition of the external crate, not the local crate.](https://github.com/rust-lang/rust/pull/133274) +- [Increase `sparcv9-sun-solaris` and `x86_64-pc-solaris` Solaris baseline to 11.4.](https://github.com/rust-lang/rust/pull/133293) +- [Show `abi_unsupported_vector_types` lint in future breakage reports](https://github.com/rust-lang/rust/pull/133374) +- [Error if multiple super-trait instantiations of `dyn Trait` need associated types to be specified but only one is provided](https://github.com/rust-lang/rust/pull/133392) +- [Change `powerpc64-ibm-aix` default `codemodel` to large](https://github.com/rust-lang/rust/pull/133811) + +<a id="1.85.0-Internal-Changes"></a> + +Internal Changes +---------------- + +These changes do not affect any public interfaces of Rust, but they represent +significant improvements to the performance or internals of rustc and related +tools. + +- [Build `x86_64-unknown-linux-gnu` with LTO for C/C++ code (e.g., `jemalloc`)](https://github.com/rust-lang/rust/pull/134690) + Version 1.84.1 (2025-01-30) ========================== diff --git a/compiler/rustc_abi/Cargo.toml b/compiler/rustc_abi/Cargo.toml index 1013f1d3958..3d6f4a6a109 100644 --- a/compiler/rustc_abi/Cargo.toml +++ b/compiler/rustc_abi/Cargo.toml @@ -9,6 +9,7 @@ bitflags = "2.4.1" rand = { version = "0.8.4", default-features = false, optional = true } rand_xoshiro = { version = "0.6.0", optional = true } rustc_data_structures = { path = "../rustc_data_structures", optional = true } +rustc_hashes = { path = "../rustc_hashes" } rustc_index = { path = "../rustc_index", default-features = false } rustc_macros = { path = "../rustc_macros", optional = true } rustc_serialize = { path = "../rustc_serialize", optional = true } diff --git a/compiler/rustc_abi/src/layout.rs b/compiler/rustc_abi/src/layout.rs index b8773f9ff38..45cd0b517f6 100644 --- a/compiler/rustc_abi/src/layout.rs +++ b/compiler/rustc_abi/src/layout.rs @@ -2,6 +2,7 @@ use std::fmt::{self, Write}; use std::ops::{Bound, Deref}; use std::{cmp, iter}; +use rustc_hashes::Hash64; use rustc_index::Idx; use tracing::debug; @@ -133,7 +134,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> { size, max_repr_align: None, unadjusted_abi_align: align.abi, - randomization_seed: combined_seed, + randomization_seed: Hash64::new(combined_seed), } } @@ -226,7 +227,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> { size: Size::ZERO, max_repr_align: None, unadjusted_abi_align: dl.i8_align.abi, - randomization_seed: 0, + randomization_seed: Hash64::ZERO, } } @@ -1058,7 +1059,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> { // unsizable tail fields are excluded so that we use the same seed for the sized and unsized layouts. let field_seed = fields_excluding_tail .iter() - .fold(0u64, |acc, f| acc.wrapping_add(f.randomization_seed)); + .fold(Hash64::ZERO, |acc, f| acc.wrapping_add(f.randomization_seed)); if optimize_field_order && fields.len() > 1 { // If `-Z randomize-layout` was enabled for the type definition we can shuffle @@ -1072,7 +1073,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> { // `ReprOptions.field_shuffle_seed` is a deterministic seed we can use to randomize field // ordering. let mut rng = rand_xoshiro::Xoshiro128StarStar::seed_from_u64( - field_seed.wrapping_add(repr.field_shuffle_seed), + field_seed.wrapping_add(repr.field_shuffle_seed).as_u64(), ); // Shuffle the ordering of the fields. diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index da1c706d67c..dbb4bed5cdd 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -50,6 +50,7 @@ use std::str::FromStr; use bitflags::bitflags; #[cfg(feature = "nightly")] use rustc_data_structures::stable_hasher::StableOrd; +use rustc_hashes::Hash64; use rustc_index::{Idx, IndexSlice, IndexVec}; #[cfg(feature = "nightly")] use rustc_macros::{Decodable_Generic, Encodable_Generic, HashStable_Generic}; @@ -140,7 +141,7 @@ pub struct ReprOptions { /// hash without loss, but it does pay the price of being larger. /// Everything's a tradeoff, a 64-bit seed should be sufficient for our /// purposes (primarily `-Z randomize-layout`) - pub field_shuffle_seed: u64, + pub field_shuffle_seed: Hash64, } impl ReprOptions { @@ -1727,7 +1728,7 @@ pub struct LayoutData<FieldIdx: Idx, VariantIdx: Idx> { /// transmuted to `Foo<U>` we aim to create probalistically distinct seeds so that Foo can choose /// to reorder its fields based on that information. The current implementation is a conservative /// approximation of this goal. - pub randomization_seed: u64, + pub randomization_seed: Hash64, } impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> { @@ -1781,7 +1782,7 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> { align, max_repr_align: None, unadjusted_abi_align: align.abi, - randomization_seed, + randomization_seed: Hash64::new(randomization_seed), } } } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index facc9414b20..1c777111896 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -407,7 +407,7 @@ fn compute_hir_hash( .iter_enumerated() .filter_map(|(def_id, info)| { let info = info.as_owner()?; - let def_path_hash = tcx.hir().def_path_hash(def_id); + let def_path_hash = tcx.hir_def_path_hash(def_id); Some((def_path_hash, info)) }) .collect(); @@ -497,7 +497,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { "adding a def'n for node-id {:?} and def kind {:?} but a previous def'n exists: {:?}", node_id, def_kind, - self.tcx.hir().def_key(self.local_def_id(node_id)), + self.tcx.hir_def_key(self.local_def_id(node_id)), ); let def_id = self.tcx.at(span).create_def(parent, name, def_kind).def_id(); diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 6269728e67f..59c76cb7f2b 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -14,7 +14,7 @@ use rustc_errors::codes::*; use rustc_errors::{Applicability, Diag, MultiSpan, struct_span_code_err}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::intravisit::{Map, Visitor, walk_block, walk_expr}; +use rustc_hir::intravisit::{Visitor, walk_block, walk_expr}; use rustc_hir::{CoroutineDesugaring, CoroutineKind, CoroutineSource, LangItem, PatField}; use rustc_middle::bug; use rustc_middle::hir::nested_filter::OnlyBodies; @@ -348,13 +348,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { expr: Option<&'hir hir::Expr<'hir>>, pat: Option<&'hir hir::Pat<'hir>>, parent_pat: Option<&'hir hir::Pat<'hir>>, - hir: rustc_middle::hir::map::Map<'hir>, + tcx: TyCtxt<'hir>, } impl<'hir> Visitor<'hir> for ExpressionFinder<'hir> { type NestedFilter = OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.hir + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, e: &'hir hir::Expr<'hir>) { @@ -396,7 +396,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { expr: None, pat: None, parent_pat: None, - hir, + tcx: self.infcx.tcx, }; finder.visit_expr(expr); if let Some(span) = span @@ -1082,7 +1082,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { ] { for (destination, sp) in elements { if let Ok(hir_id) = destination.target_id - && let hir::Node::Expr(expr) = tcx.hir().hir_node(hir_id) + && let hir::Node::Expr(expr) = tcx.hir_node(hir_id) && !matches!( sp.desugaring_kind(), Some(DesugaringKind::ForLoop | DesugaringKind::WhileLoop) @@ -1437,7 +1437,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let Some(hir_generics) = tcx .typeck_root_def_id(self.mir_def_id().to_def_id()) .as_local() - .and_then(|def_id| tcx.hir().get_generics(def_id)) + .and_then(|def_id| tcx.hir_get_generics(def_id)) else { return; }; @@ -1889,7 +1889,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { fn suggest_copy_for_type_in_cloned_ref(&self, err: &mut Diag<'infcx>, place: Place<'tcx>) { let tcx = self.infcx.tcx; - let hir = tcx.hir(); let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return }; struct FindUselessClone<'tcx> { @@ -1917,7 +1916,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let mut expr_finder = FindUselessClone::new(tcx, self.mir_def_id()); - let body = hir.body(body_id).value; + let body = tcx.hir_body(body_id).value; expr_finder.visit_expr(body); struct Holds<'tcx> { @@ -2106,7 +2105,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let tcx = self.infcx.tcx; let body_id = tcx.hir_node(self.mir_hir_id()).body_id()?; let mut expr_finder = FindExprBySpan::new(span, tcx); - expr_finder.visit_expr(tcx.hir().body(body_id).value); + expr_finder.visit_expr(tcx.hir_body(body_id).value); expr_finder.result } @@ -2258,7 +2257,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { ) { let issue_span = issued_spans.args_or_use(); let tcx = self.infcx.tcx; - let hir = tcx.hir(); let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return }; let typeck_results = tcx.typeck(self.mir_def_id()); @@ -2346,7 +2344,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { pat_span: None, head: None, }; - finder.visit_expr(hir.body(body_id).value); + finder.visit_expr(tcx.hir_body(body_id).value); if let Some(body_expr) = finder.body_expr && let Some(loop_span) = finder.loop_span @@ -2454,10 +2452,10 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { // Get the body the error happens in let Some(body_id) = tcx.hir_node(self.mir_hir_id()).body_id() else { return }; - let body_expr = hir.body(body_id).value; + let body_expr = tcx.hir_body(body_id).value; struct ClosureFinder<'hir> { - hir: rustc_middle::hir::map::Map<'hir>, + tcx: TyCtxt<'hir>, borrow_span: Span, res: Option<(&'hir hir::Expr<'hir>, &'hir hir::Closure<'hir>)>, /// The path expression with the `borrow_span` span @@ -2466,8 +2464,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { impl<'hir> Visitor<'hir> for ClosureFinder<'hir> { type NestedFilter = OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.hir + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, ex: &'hir hir::Expr<'hir>) { @@ -2493,7 +2491,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { // Find the closure that most tightly wraps `capture_kind_span` let mut finder = - ClosureFinder { hir, borrow_span: capture_kind_span, res: None, error_path: None }; + ClosureFinder { tcx, borrow_span: capture_kind_span, res: None, error_path: None }; finder.visit_expr(body_expr); let Some((closure_expr, closure)) = finder.res else { return }; @@ -2558,7 +2556,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { } let mut finder = VariableUseFinder { local_id, spans: Vec::new() }; - finder.visit_expr(hir.body(closure.body).value); + finder.visit_expr(tcx.hir_body(closure.body).value); spans = finder.spans; } else { @@ -3211,7 +3209,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { if let Some(scope) = self.body.source_scopes.get(source_info.scope) && let ClearCrossCrate::Set(scope_data) = &scope.local_data && let Some(id) = self.infcx.tcx.hir_node(scope_data.lint_root).body_id() - && let hir::ExprKind::Block(block, _) = self.infcx.tcx.hir().body(id).value.kind + && let hir::ExprKind::Block(block, _) = self.infcx.tcx.hir_body(id).value.kind { for stmt in block.stmts { let mut visitor = NestedStatementVisitor { diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index 3e474225afd..a88b27f2476 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -75,10 +75,10 @@ impl<'tcx> BorrowExplanation<'tcx> { if let Some(span) = borrow_span { let def_id = body.source.def_id(); - if let Some(node) = tcx.hir().get_if_local(def_id) + if let Some(node) = tcx.hir_get_if_local(def_id) && let Some(body_id) = node.body_id() { - let body = tcx.hir().body(body_id); + let body = tcx.hir_body(body_id); let mut expr_finder = FindExprBySpan::new(span, tcx); expr_finder.visit_expr(body.value); if let Some(mut expr) = expr_finder.result { @@ -256,8 +256,8 @@ impl<'tcx> BorrowExplanation<'tcx> { impl<'hir> rustc_hir::intravisit::Visitor<'hir> for FindLetExpr<'hir> { type NestedFilter = rustc_middle::hir::nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, expr: &'hir hir::Expr<'hir>) { if let hir::ExprKind::If(cond, _conseq, _alt) @@ -308,9 +308,9 @@ impl<'tcx> BorrowExplanation<'tcx> { suggest_rewrite_if_let(tcx, expr, &pat, init, conseq, alt, err); } else if let Some((old, new)) = multiple_borrow_span && let def_id = body.source.def_id() - && let Some(node) = tcx.hir().get_if_local(def_id) + && let Some(node) = tcx.hir_get_if_local(def_id) && let Some(body_id) = node.body_id() - && let hir_body = tcx.hir().body(body_id) + && let hir_body = tcx.hir_body(body_id) && let mut expr_finder = (FindLetExpr { span: old, result: None, tcx }) && let Some((let_expr_span, let_expr_pat, let_expr_init)) = { expr_finder.visit_expr(hir_body.value); diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index df83ac985c6..07ea369c5c7 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -1220,7 +1220,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { .tcx .typeck_root_def_id(self.mir_def_id().to_def_id()) .as_local() - .and_then(|def_id| self.infcx.tcx.hir().get_generics(def_id)) + .and_then(|def_id| self.infcx.tcx.hir_get_generics(def_id)) && let spans = hir_generics .predicates .iter() diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 58c5c2fd774..38f22473edf 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -7,7 +7,7 @@ use rustc_hir::intravisit::Visitor; use rustc_hir::{self as hir, CaptureBy, ExprKind, HirId, Node}; use rustc_middle::bug; use rustc_middle::mir::*; -use rustc_middle::ty::{self, Ty}; +use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_mir_dataflow::move_paths::{LookupResult, MovePathIndex}; use rustc_span::{BytePos, ExpnKind, MacroKind, Span}; use rustc_trait_selection::error_reporting::traits::FindExprBySpan; @@ -347,7 +347,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { // Find the closure that captured the binding. let mut expr_finder = FindExprBySpan::new(args_span, tcx); expr_finder.include_closures = true; - expr_finder.visit_expr(tcx.hir().body(body_id).value); + expr_finder.visit_expr(tcx.hir_body(body_id).value); let Some(closure_expr) = expr_finder.result else { return }; let ExprKind::Closure(closure) = closure_expr.kind else { return }; // We'll only suggest cloning the binding if it's a `move` closure. @@ -357,7 +357,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let use_span = use_spans.var_or_use(); let mut expr_finder = FindExprBySpan::new(use_span, tcx); expr_finder.include_closures = true; - expr_finder.visit_expr(tcx.hir().body(body_id).value); + expr_finder.visit_expr(tcx.hir_body(body_id).value); let Some(use_expr) = expr_finder.result else { return }; let parent = tcx.parent_hir_node(use_expr.hir_id); if let Node::Expr(expr) = parent @@ -690,7 +690,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { /// make it bind by reference instead (if possible) struct BindingFinder<'tcx> { typeck_results: &'tcx ty::TypeckResults<'tcx>, - hir: rustc_middle::hir::map::Map<'tcx>, + tcx: TyCtxt<'tcx>, /// Input: the span of the pattern we're finding bindings in pat_span: Span, /// Input: the spans of the bindings we're providing suggestions for @@ -709,8 +709,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { impl<'tcx> Visitor<'tcx> for BindingFinder<'tcx> { type NestedFilter = rustc_middle::hir::nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.hir + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) -> Self::Result { @@ -782,7 +782,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let typeck_results = self.infcx.tcx.typeck(self.mir_def_id()); let mut finder = BindingFinder { typeck_results, - hir, + tcx: self.infcx.tcx, pat_span, binding_spans, found_pat: false, diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index 706dd7135f7..fc782ce6424 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -936,11 +936,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { fn expected_fn_found_fn_mut_call(&self, err: &mut Diag<'_>, sp: Span, act: &str) { err.span_label(sp, format!("cannot {act}")); - let hir = self.infcx.tcx.hir(); + let tcx = self.infcx.tcx; + let hir = tcx.hir(); let closure_id = self.mir_hir_id(); - let closure_span = self.infcx.tcx.def_span(self.mir_def_id()); - let fn_call_id = self.infcx.tcx.parent_hir_id(closure_id); - let node = self.infcx.tcx.hir_node(fn_call_id); + let closure_span = tcx.def_span(self.mir_def_id()); + let fn_call_id = tcx.parent_hir_id(closure_id); + let node = tcx.hir_node(fn_call_id); let def_id = hir.enclosing_body_owner(fn_call_id); let mut look_at_return = true; @@ -951,7 +952,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { return None; }; - let typeck_results = self.infcx.tcx.typeck(def_id); + let typeck_results = tcx.typeck(def_id); match kind { hir::ExprKind::Call(expr, args) => { @@ -980,7 +981,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { .map(|(pos, _)| pos) .next(); - let arg = match hir.get_if_local(callee_def_id) { + let arg = match tcx.hir_get_if_local(callee_def_id) { Some( hir::Node::Item(hir::Item { ident, kind: hir::ItemKind::Fn { sig, .. }, .. @@ -1022,7 +1023,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { if look_at_return && hir.get_fn_id_for_return_block(closure_id).is_some() { // ...otherwise we are probably in the tail expression of the function, point at the // return type. - match self.infcx.tcx.hir_node_by_def_id(hir.get_parent_item(fn_call_id).def_id) { + match tcx.hir_node_by_def_id(hir.get_parent_item(fn_call_id).def_id) { hir::Node::Item(hir::Item { ident, kind: hir::ItemKind::Fn { sig, .. }, .. }) @@ -1050,9 +1051,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { fn suggest_using_iter_mut(&self, err: &mut Diag<'_>) { let source = self.body.source; - let hir = self.infcx.tcx.hir(); if let InstanceKind::Item(def_id) = source.instance - && let Some(Node::Expr(hir::Expr { hir_id, kind, .. })) = hir.get_if_local(def_id) + && let Some(Node::Expr(hir::Expr { hir_id, kind, .. })) = + self.infcx.tcx.hir_get_if_local(def_id) && let ExprKind::Closure(hir::Closure { kind: hir::ClosureKind::Closure, .. }) = kind && let Node::Expr(expr) = self.infcx.tcx.parent_hir_node(*hir_id) { diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 552d9d1d3f9..d3c91cbdee9 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -14,7 +14,10 @@ use rustc_infer::infer::{NllRegionVariableOrigin, RelateParamBound}; use rustc_middle::bug; use rustc_middle::hir::place::PlaceBase; use rustc_middle::mir::{AnnotationSource, ConstraintCategory, ReturnConstraint}; -use rustc_middle::ty::{self, GenericArgs, Region, RegionVid, Ty, TyCtxt, TypeVisitor}; +use rustc_middle::ty::fold::fold_regions; +use rustc_middle::ty::{ + self, GenericArgs, Region, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitor, +}; use rustc_span::{Ident, Span, kw}; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::error_reporting::infer::nice_region_error::{ @@ -147,9 +150,7 @@ pub(crate) enum RegionErrorKind<'tcx> { pub(crate) struct ErrorConstraintInfo<'tcx> { // fr: outlived_fr pub(super) fr: RegionVid, - pub(super) fr_is_local: bool, pub(super) outlived_fr: RegionVid, - pub(super) outlived_fr_is_local: bool, // Category and span for best blame constraint pub(super) category: ConstraintCategory<'tcx>, @@ -185,6 +186,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { } } + /// Map the regions in the type to named regions, where possible. + fn name_regions<T>(&self, tcx: TyCtxt<'tcx>, ty: T) -> T + where + T: TypeFoldable<TyCtxt<'tcx>>, + { + fold_regions(tcx, ty, |region, _| match *region { + ty::ReVar(vid) => self.to_error_region(vid).unwrap_or(region), + _ => region, + }) + } + /// Returns `true` if a closure is inferred to be an `FnMut` closure. fn is_closure_fn_mut(&self, fr: RegionVid) -> bool { if let Some(ty::ReLateParam(late_param)) = self.to_error_region(fr).as_deref() @@ -207,7 +219,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { lower_bound: RegionVid, ) { let mut suggestions = vec![]; - let hir = self.infcx.tcx.hir(); + let tcx = self.infcx.tcx; // find generic associated types in the given region 'lower_bound' let gat_id_and_generics = self @@ -216,12 +228,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { .map(|placeholder| { if let Some(id) = placeholder.bound.kind.get_id() && let Some(placeholder_id) = id.as_local() - && let gat_hir_id = self.infcx.tcx.local_def_id_to_hir_id(placeholder_id) - && let Some(generics_impl) = self - .infcx - .tcx - .parent_hir_node(self.infcx.tcx.parent_hir_id(gat_hir_id)) - .generics() + && let gat_hir_id = tcx.local_def_id_to_hir_id(placeholder_id) + && let Some(generics_impl) = + tcx.parent_hir_node(tcx.parent_hir_id(gat_hir_id)).generics() { Some((gat_hir_id, generics_impl)) } else { @@ -242,7 +251,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { }; if bound_generic_params .iter() - .rfind(|bgp| self.infcx.tcx.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id) + .rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id) .is_some() { for bound in *bounds { @@ -258,7 +267,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { return; }; diag.span_note(*trait_span, fluent::borrowck_limitations_implies_static); - let Some(generics_fn) = hir.get_generics(self.body.source.def_id().expect_local()) + let Some(generics_fn) = tcx.hir_get_generics(self.body.source.def_id().expect_local()) else { return; }; @@ -316,7 +325,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let type_test_span = type_test.span; if let Some(lower_bound_region) = lower_bound_region { - let generic_ty = self.regioncx.name_regions( + let generic_ty = self.name_regions( self.infcx.tcx, type_test.generic_kind.to_ty(self.infcx.tcx), ); @@ -325,7 +334,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { self.body.source.def_id().expect_local(), type_test_span, Some(origin), - self.regioncx.name_regions(self.infcx.tcx, type_test.generic_kind), + self.name_regions(self.infcx.tcx, type_test.generic_kind), lower_bound_region, )); } else { @@ -356,9 +365,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { } RegionErrorKind::UnexpectedHiddenRegion { span, hidden_ty, key, member_region } => { - let named_ty = self.regioncx.name_regions(self.infcx.tcx, hidden_ty); - let named_key = self.regioncx.name_regions(self.infcx.tcx, key); - let named_region = self.regioncx.name_regions(self.infcx.tcx, member_region); + let named_ty = + self.regioncx.name_regions_for_member_constraint(self.infcx.tcx, hidden_ty); + let named_key = + self.regioncx.name_regions_for_member_constraint(self.infcx.tcx, key); + let named_region = self + .regioncx + .name_regions_for_member_constraint(self.infcx.tcx, member_region); let diag = unexpected_hidden_region_diagnostic( self.infcx, self.mir_def_id(), @@ -471,14 +484,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { fr_is_local, outlived_fr_is_local, category ); - let errci = ErrorConstraintInfo { - fr, - outlived_fr, - fr_is_local, - outlived_fr_is_local, - category, - span: cause.span, - }; + let errci = ErrorConstraintInfo { fr, outlived_fr, category, span: cause.span }; let mut diag = match (category, fr_is_local, outlived_fr_is_local) { (ConstraintCategory::Return(kind), true, false) if self.is_closure_fn_mut(fr) => { @@ -680,11 +686,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { && self.regioncx.universal_regions().defining_ty.is_fn_def()) || self.regioncx.universal_regions().defining_ty.is_const() { - return self.report_general_error(&ErrorConstraintInfo { - fr_is_local: true, - outlived_fr_is_local: false, - ..*errci - }); + return self.report_general_error(errci); } let mut diag = @@ -762,15 +764,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { /// ``` #[allow(rustc::diagnostic_outside_of_impl)] // FIXME fn report_general_error(&self, errci: &ErrorConstraintInfo<'tcx>) -> Diag<'infcx> { - let ErrorConstraintInfo { - fr, - fr_is_local, - outlived_fr, - outlived_fr_is_local, - span, - category, - .. - } = errci; + let ErrorConstraintInfo { fr, outlived_fr, span, category, .. } = errci; let mir_def_name = self.infcx.tcx.def_descr(self.mir_def_id().to_def_id()); @@ -789,19 +783,22 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let outlived_fr_name = self.give_region_a_name(*outlived_fr).unwrap(); outlived_fr_name.highlight_region_name(&mut diag); - let err_category = match (category, outlived_fr_is_local, fr_is_local) { - (ConstraintCategory::Return(_), true, _) => LifetimeReturnCategoryErr::WrongReturn { + let err_category = if matches!(category, ConstraintCategory::Return(_)) + && self.regioncx.universal_regions().is_local_free_region(*outlived_fr) + { + LifetimeReturnCategoryErr::WrongReturn { span: *span, mir_def_name, outlived_fr_name, fr_name: &fr_name, - }, - _ => LifetimeReturnCategoryErr::ShortReturn { + } + } else { + LifetimeReturnCategoryErr::ShortReturn { span: *span, category_desc: category.description(), free_region_name: &fr_name, outlived_fr_name, - }, + } }; diag.subdiagnostic(err_category); @@ -1162,7 +1159,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { if ocx.select_all_or_error().is_empty() && count > 0 { diag.span_suggestion_verbose( - tcx.hir().body(*body).value.peel_blocks().span.shrink_to_lo(), + tcx.hir_body(*body).value.peel_blocks().span.shrink_to_lo(), fluent::borrowck_dereference_suggestion, "*".repeat(count), Applicability::MachineApplicable, diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs index 9c19f8b3ad8..54f9e82dbb8 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs @@ -204,7 +204,13 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// that the regions produced are in fact equal to the named region they are /// replaced with. This is fine because this function is only to improve the /// region names in error messages. - pub(crate) fn name_regions<T>(&self, tcx: TyCtxt<'tcx>, ty: T) -> T + /// + /// This differs from `MirBorrowckCtxt::name_regions` since it is particularly + /// lax with mapping region vids that are *shorter* than a universal region to + /// that universal region. This is useful for member region constraints since + /// we want to suggest a universal region name to capture even if it's technically + /// not equal to the error region. + pub(crate) fn name_regions_for_member_constraint<T>(&self, tcx: TyCtxt<'tcx>, ty: T) -> T where T: TypeFoldable<TyCtxt<'tcx>>, { diff --git a/compiler/rustc_codegen_cranelift/.github/workflows/main.yml b/compiler/rustc_codegen_cranelift/.github/workflows/main.yml index a8333df77e6..61a4c1270c9 100644 --- a/compiler/rustc_codegen_cranelift/.github/workflows/main.yml +++ b/compiler/rustc_codegen_cranelift/.github/workflows/main.yml @@ -188,8 +188,8 @@ jobs: fail-fast: false matrix: include: - # FIXME update at some point in the future once most distros use a newer glibc - - os: ubuntu-20.04 + # Intentionally using an older ubuntu version to lower the glibc requirements of the distributed cg_clif + - os: ubuntu-22.04 env: TARGET_TRIPLE: x86_64-unknown-linux-gnu - os: macos-latest diff --git a/compiler/rustc_codegen_cranelift/rust-toolchain b/compiler/rustc_codegen_cranelift/rust-toolchain index 8d423319fa9..481903c6afb 100644 --- a/compiler/rustc_codegen_cranelift/rust-toolchain +++ b/compiler/rustc_codegen_cranelift/rust-toolchain @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2025-02-07" +channel = "nightly-2025-02-15" components = ["rust-src", "rustc-dev", "llvm-tools"] profile = "minimal" diff --git a/compiler/rustc_codegen_cranelift/rustfmt.toml b/compiler/rustc_codegen_cranelift/rustfmt.toml index d9e6ac3d543..f31fa9c76ab 100644 --- a/compiler/rustc_codegen_cranelift/rustfmt.toml +++ b/compiler/rustc_codegen_cranelift/rustfmt.toml @@ -3,8 +3,9 @@ ignore = [ ] # Matches rustfmt.toml of rustc -version = "Two" +style_edition = "2024" use_small_heuristics = "Max" merge_derives = false group_imports = "StdExternalCrate" imports_granularity = "Module" +use_field_init_shorthand = true diff --git a/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs b/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs index 7594a53fc75..b28c4c9539c 100644 --- a/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs +++ b/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs @@ -195,7 +195,7 @@ pub(super) fn from_casted_value<'tcx>( // It may also be smaller for example when the type is a wrapper around an integer with a // larger alignment than the integer. std::cmp::max(abi_param_size, layout_size), - u32::try_from(layout.align.pref.bytes()).unwrap(), + u32::try_from(layout.align.abi.bytes()).unwrap(), ); let mut offset = 0; let mut block_params_iter = block_params.iter().copied(); diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs index 534557fcd41..766278d8718 100644 --- a/compiler/rustc_codegen_cranelift/src/common.rs +++ b/compiler/rustc_codegen_cranelift/src/common.rs @@ -382,6 +382,11 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> { } pub(crate) fn create_stack_slot(&mut self, size: u32, align: u32) -> Pointer { + assert!( + size % align == 0, + "size must be a multiple of alignment (size={size}, align={align})" + ); + let abi_align = if self.tcx.sess.target.arch == "s390x" { 8 } else { 16 }; if align <= abi_align { let stack_slot = self.bcx.create_sized_stack_slot(StackSlotData { @@ -403,7 +408,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> { align_shift: 4, }); let base_ptr = self.bcx.ins().stack_addr(self.pointer_type, stack_slot, 0); - let misalign_offset = self.bcx.ins().urem_imm(base_ptr, i64::from(align)); + let misalign_offset = self.bcx.ins().band_imm(base_ptr, i64::from(align - 1)); let realign_offset = self.bcx.ins().irsub_imm(misalign_offset, i64::from(align)); Pointer::new(self.bcx.ins().iadd(base_ptr, realign_offset)) } diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs index f3a8623e216..bba6567774d 100644 --- a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs @@ -304,7 +304,7 @@ impl DebugContext { entry.set(gimli::DW_AT_decl_file, AttributeValue::FileIndex(Some(file_id))); entry.set(gimli::DW_AT_decl_line, AttributeValue::Udata(line)); - entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(static_layout.align.pref.bytes())); + entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(static_layout.align.abi.bytes())); let mut expr = Expression::new(); expr.op_addr(address_for_data(data_id)); diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/types.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/types.rs index a2f6691cdd2..017d7784dc0 100644 --- a/compiler/rustc_codegen_cranelift/src/debuginfo/types.rs +++ b/compiler/rustc_codegen_cranelift/src/debuginfo/types.rs @@ -166,7 +166,7 @@ impl DebugContext { let tuple_entry = self.dwarf.unit.get_mut(tuple_type_id); tuple_entry.set(gimli::DW_AT_name, AttributeValue::StringRef(self.dwarf.strings.add(name))); tuple_entry.set(gimli::DW_AT_byte_size, AttributeValue::Udata(layout.size.bytes())); - tuple_entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(layout.align.pref.bytes())); + tuple_entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(layout.align.abi.bytes())); for (i, (ty, dw_ty)) in components.into_iter().enumerate() { let member_id = self.dwarf.unit.add(tuple_type_id, gimli::DW_TAG_member); @@ -179,7 +179,7 @@ impl DebugContext { member_entry.set( gimli::DW_AT_alignment, AttributeValue::Udata( - FullyMonomorphizedLayoutCx(tcx).layout_of(ty).align.pref.bytes(), + FullyMonomorphizedLayoutCx(tcx).layout_of(ty).align.abi.bytes(), ), ); member_entry.set( diff --git a/compiler/rustc_codegen_cranelift/src/driver/jit.rs b/compiler/rustc_codegen_cranelift/src/driver/jit.rs index 2e713171ae0..57c88f4b0f9 100644 --- a/compiler/rustc_codegen_cranelift/src/driver/jit.rs +++ b/compiler/rustc_codegen_cranelift/src/driver/jit.rs @@ -124,7 +124,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, codegen_mode: CodegenMode, jit_args: Vec< crate::constant::codegen_static(tcx, &mut jit_module, def_id); } MonoItem::GlobalAsm(item_id) => { - let item = tcx.hir().item(item_id); + let item = tcx.hir_item(item_id); tcx.dcx().span_fatal(item.span, "Global asm is not supported in JIT mode"); } } diff --git a/compiler/rustc_codegen_cranelift/src/global_asm.rs b/compiler/rustc_codegen_cranelift/src/global_asm.rs index c0a3ce84d52..54745b0d8c1 100644 --- a/compiler/rustc_codegen_cranelift/src/global_asm.rs +++ b/compiler/rustc_codegen_cranelift/src/global_asm.rs @@ -15,7 +15,7 @@ use rustc_target::asm::InlineAsmArch; use crate::prelude::*; pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String, item_id: ItemId) { - let item = tcx.hir().item(item_id); + let item = tcx.hir_item(item_id); if let rustc_hir::ItemKind::GlobalAsm(asm) = item.kind { let is_x86 = matches!(tcx.sess.asm_arch.unwrap(), InlineAsmArch::X86 | InlineAsmArch::X86_64); diff --git a/compiler/rustc_codegen_cranelift/src/inline_asm.rs b/compiler/rustc_codegen_cranelift/src/inline_asm.rs index f2b0ec977c6..310b226814d 100644 --- a/compiler/rustc_codegen_cranelift/src/inline_asm.rs +++ b/compiler/rustc_codegen_cranelift/src/inline_asm.rs @@ -871,7 +871,8 @@ fn call_inline_asm<'tcx>( inputs: Vec<(Size, Value)>, outputs: Vec<(Size, CPlace<'tcx>)>, ) { - let stack_slot = fx.create_stack_slot(u32::try_from(slot_size.bytes()).unwrap(), 16); + let stack_slot = + fx.create_stack_slot(u32::try_from(slot_size.bytes().next_multiple_of(16)).unwrap(), 16); let inline_asm_func = fx .module diff --git a/compiler/rustc_codegen_cranelift/src/value_and_place.rs b/compiler/rustc_codegen_cranelift/src/value_and_place.rs index c17d1f30fbe..a9b8e1bd393 100644 --- a/compiler/rustc_codegen_cranelift/src/value_and_place.rs +++ b/compiler/rustc_codegen_cranelift/src/value_and_place.rs @@ -101,7 +101,7 @@ impl<'tcx> CValue<'tcx> { /// The is represented by a dangling pointer of suitable alignment. pub(crate) fn zst(layout: TyAndLayout<'tcx>) -> CValue<'tcx> { assert!(layout.is_zst()); - CValue::by_ref(crate::Pointer::dangling(layout.align.pref), layout) + CValue::by_ref(crate::Pointer::dangling(layout.align.abi), layout) } pub(crate) fn layout(&self) -> TyAndLayout<'tcx> { @@ -392,7 +392,7 @@ impl<'tcx> CPlace<'tcx> { assert!(layout.is_sized()); if layout.size.bytes() == 0 { return CPlace { - inner: CPlaceInner::Addr(Pointer::dangling(layout.align.pref), None), + inner: CPlaceInner::Addr(Pointer::dangling(layout.align.abi), None), layout, }; } @@ -405,7 +405,7 @@ impl<'tcx> CPlace<'tcx> { let stack_slot = fx.create_stack_slot( u32::try_from(layout.size.bytes()).unwrap(), - u32::try_from(layout.align.pref.bytes()).unwrap(), + u32::try_from(layout.align.abi.bytes()).unwrap(), ); CPlace { inner: CPlaceInner::Addr(stack_slot, None), layout } } diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 1c3d6cc899a..b8e37b60480 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -665,6 +665,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { a + b } + // TODO(antoyo): should we also override the `unchecked_` versions? fn sub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { self.gcc_sub(a, b) } @@ -832,31 +833,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { set_rvalue_location(self, self.gcc_not(a)) } - fn unchecked_sadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { - set_rvalue_location(self, self.gcc_add(a, b)) - } - - fn unchecked_uadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { - set_rvalue_location(self, self.gcc_add(a, b)) - } - - fn unchecked_ssub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { - set_rvalue_location(self, self.gcc_sub(a, b)) - } - - fn unchecked_usub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { - // TODO(antoyo): should generate poison value? - set_rvalue_location(self, self.gcc_sub(a, b)) - } - - fn unchecked_smul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { - set_rvalue_location(self, self.gcc_mul(a, b)) - } - - fn unchecked_umul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { - set_rvalue_location(self, self.gcc_mul(a, b)) - } - fn fadd_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> { // NOTE: it seems like we cannot enable fast-mode for a single operation in GCC. set_rvalue_location(self, lhs + rhs) diff --git a/compiler/rustc_codegen_llvm/Cargo.toml b/compiler/rustc_codegen_llvm/Cargo.toml index 94f21ac5f57..a8172270548 100644 --- a/compiler/rustc_codegen_llvm/Cargo.toml +++ b/compiler/rustc_codegen_llvm/Cargo.toml @@ -25,6 +25,7 @@ rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } rustc_fs_util = { path = "../rustc_fs_util" } +rustc_hashes = { path = "../rustc_hashes" } rustc_hir = { path = "../rustc_hir" } rustc_index = { path = "../rustc_index" } rustc_llvm = { path = "../rustc_llvm" } diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index acae0b444c0..57f09b1fa2f 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -421,6 +421,37 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { unchecked_umul(x, y) => LLVMBuildNUWMul, } + fn unchecked_suadd(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value { + unsafe { + let add = llvm::LLVMBuildAdd(self.llbuilder, a, b, UNNAMED); + if llvm::LLVMIsAInstruction(add).is_some() { + llvm::LLVMSetNUW(add, True); + llvm::LLVMSetNSW(add, True); + } + add + } + } + fn unchecked_susub(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value { + unsafe { + let sub = llvm::LLVMBuildSub(self.llbuilder, a, b, UNNAMED); + if llvm::LLVMIsAInstruction(sub).is_some() { + llvm::LLVMSetNUW(sub, True); + llvm::LLVMSetNSW(sub, True); + } + sub + } + } + fn unchecked_sumul(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value { + unsafe { + let mul = llvm::LLVMBuildMul(self.llbuilder, a, b, UNNAMED); + if llvm::LLVMIsAInstruction(mul).is_some() { + llvm::LLVMSetNUW(mul, True); + llvm::LLVMSetNSW(mul, True); + } + mul + } + } + fn or_disjoint(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value { unsafe { let or = llvm::LLVMBuildOr(self.llbuilder, a, b, UNNAMED); diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index 78b3a7f8541..f17d98fa242 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -7,7 +7,8 @@ use rustc_abi::{AddressSpace, HasDataLayout}; use rustc_ast::Mutability; use rustc_codegen_ssa::common::TypeKind; use rustc_codegen_ssa::traits::*; -use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hashes::Hash128; use rustc_hir::def_id::DefId; use rustc_middle::bug; use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar}; diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 7fe527a4c07..e7952bc95e7 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -194,6 +194,12 @@ pub(crate) unsafe fn create_module<'ll>( target_data_layout = target_data_layout.replace("-i128:128", ""); } } + if llvm_version < (21, 0, 0) { + if sess.target.arch == "nvptx64" { + // LLVM 21 updated the default layout on nvptx: https://github.com/llvm/llvm-project/pull/124961 + target_data_layout = target_data_layout.replace("e-p6:32:32-i64", "e-i64"); + } + } // Ensure the data-layout values hardcoded remain the defaults. { diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 618fdb09d4d..3b0187b9d37 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -1430,6 +1430,8 @@ unsafe extern "C" { // Extra flags on arithmetic pub(crate) fn LLVMSetIsDisjoint(Instr: &Value, IsDisjoint: Bool); + pub(crate) fn LLVMSetNUW(ArithInst: &Value, HasNUW: Bool); + pub(crate) fn LLVMSetNSW(ArithInst: &Value, HasNSW: Bool); // Memory pub(crate) fn LLVMBuildAlloca<'a>( diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index 2afc1efc1b3..963d9258be6 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -25,6 +25,7 @@ rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } rustc_fs_util = { path = "../rustc_fs_util" } +rustc_hashes = { path = "../rustc_hashes" } rustc_hir = { path = "../rustc_hir" } rustc_hir_pretty = { path = "../rustc_hir_pretty" } rustc_incremental = { path = "../rustc_incremental" } diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index 05d6ff35751..e3ace01c1eb 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -1776,6 +1776,7 @@ fn exported_symbols_for_non_proc_macro(tcx: TyCtxt<'_>, crate_type: CrateType) - symbols.push(symbol_export::exporting_symbol_name_for_instance_in_crate( tcx, symbol, cnum, )); + symbol_export::extend_exported_symbols(&mut symbols, tcx, symbol, cnum); } }); diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 1dbaffaa577..12ee872d531 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -10,9 +10,10 @@ use rustc_middle::middle::exported_symbols::{ ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel, metadata_symbol_name, }; use rustc_middle::query::LocalCrate; -use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolName, TyCtxt}; +use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolName, Ty, TyCtxt}; use rustc_middle::util::Providers; use rustc_session::config::{CrateType, OomStrategy}; +use rustc_target::callconv::Conv; use rustc_target::spec::{SanitizerSet, TlsModel}; use tracing::debug; @@ -584,6 +585,42 @@ pub(crate) fn symbol_name_for_instance_in_crate<'tcx>( } } +fn calling_convention_for_symbol<'tcx>( + tcx: TyCtxt<'tcx>, + symbol: ExportedSymbol<'tcx>, +) -> (Conv, &'tcx [rustc_target::callconv::ArgAbi<'tcx, Ty<'tcx>>]) { + let instance = match symbol { + ExportedSymbol::NonGeneric(def_id) | ExportedSymbol::Generic(def_id, _) + if tcx.is_static(def_id) => + { + None + } + ExportedSymbol::NonGeneric(def_id) => Some(Instance::mono(tcx, def_id)), + ExportedSymbol::Generic(def_id, args) => Some(Instance::new(def_id, args)), + // DropGlue always use the Rust calling convention and thus follow the target's default + // symbol decoration scheme. + ExportedSymbol::DropGlue(..) => None, + // AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the + // target's default symbol decoration scheme. + ExportedSymbol::AsyncDropGlueCtorShim(..) => None, + // NoDefId always follow the target's default symbol decoration scheme. + ExportedSymbol::NoDefId(..) => None, + // ThreadLocalShim always follow the target's default symbol decoration scheme. + ExportedSymbol::ThreadLocalShim(..) => None, + }; + + instance + .map(|i| { + tcx.fn_abi_of_instance( + ty::TypingEnv::fully_monomorphized().as_query_input((i, ty::List::empty())), + ) + .unwrap_or_else(|_| bug!("fn_abi_of_instance({i:?}) failed")) + }) + .map(|fnabi| (fnabi.conv, &fnabi.args[..])) + // FIXME(workingjubilee): why don't we know the convention here? + .unwrap_or((Conv::Rust, &[])) +} + /// This is the symbol name of the given instance as seen by the linker. /// /// On 32-bit Windows symbols are decorated according to their calling conventions. @@ -592,8 +629,6 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>( symbol: ExportedSymbol<'tcx>, instantiating_crate: CrateNum, ) -> String { - use rustc_target::callconv::Conv; - let mut undecorated = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate); // thread local will not be a function call, @@ -617,35 +652,7 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>( _ => return undecorated, }; - let instance = match symbol { - ExportedSymbol::NonGeneric(def_id) | ExportedSymbol::Generic(def_id, _) - if tcx.is_static(def_id) => - { - None - } - ExportedSymbol::NonGeneric(def_id) => Some(Instance::mono(tcx, def_id)), - ExportedSymbol::Generic(def_id, args) => Some(Instance::new(def_id, args)), - // DropGlue always use the Rust calling convention and thus follow the target's default - // symbol decoration scheme. - ExportedSymbol::DropGlue(..) => None, - // AsyncDropGlueCtorShim always use the Rust calling convention and thus follow the - // target's default symbol decoration scheme. - ExportedSymbol::AsyncDropGlueCtorShim(..) => None, - // NoDefId always follow the target's default symbol decoration scheme. - ExportedSymbol::NoDefId(..) => None, - // ThreadLocalShim always follow the target's default symbol decoration scheme. - ExportedSymbol::ThreadLocalShim(..) => None, - }; - - let (conv, args) = instance - .map(|i| { - tcx.fn_abi_of_instance( - ty::TypingEnv::fully_monomorphized().as_query_input((i, ty::List::empty())), - ) - .unwrap_or_else(|_| bug!("fn_abi_of_instance({i:?}) failed")) - }) - .map(|fnabi| (fnabi.conv, &fnabi.args[..])) - .unwrap_or((Conv::Rust, &[])); + let (conv, args) = calling_convention_for_symbol(tcx, symbol); // Decorate symbols with prefixes, suffixes and total number of bytes of arguments. // Reference: https://docs.microsoft.com/en-us/cpp/build/reference/decorated-names?view=msvc-170 @@ -677,6 +684,27 @@ pub(crate) fn exporting_symbol_name_for_instance_in_crate<'tcx>( maybe_emutls_symbol_name(tcx, symbol, &undecorated).unwrap_or(undecorated) } +/// On amdhsa, `gpu-kernel` functions have an associated metadata object with a `.kd` suffix. +/// Add it to the symbols list for all kernel functions, so that it is exported in the linked +/// object. +pub(crate) fn extend_exported_symbols<'tcx>( + symbols: &mut Vec<String>, + tcx: TyCtxt<'tcx>, + symbol: ExportedSymbol<'tcx>, + instantiating_crate: CrateNum, +) { + let (conv, _) = calling_convention_for_symbol(tcx, symbol); + + if conv != Conv::GpuKernel || tcx.sess.target.os != "amdhsa" { + return; + } + + let undecorated = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate); + + // Add the symbol for the kernel descriptor (with .kd suffix) + symbols.push(format!("{undecorated}.kd")); +} + fn maybe_emutls_symbol_name<'tcx>( tcx: TyCtxt<'tcx>, symbol: ExportedSymbol<'tcx>, diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs index 53953b089c6..84703a0a156 100644 --- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs +++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs @@ -15,7 +15,8 @@ use std::fmt::Write; use rustc_abi::Integer; use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::stable_hasher::{Hash64, HashStable, StableHasher}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hashes::Hash64; use rustc_hir::def_id::DefId; use rustc_hir::definitions::{DefPathData, DefPathDataName, DisambiguatedDefPathData}; use rustc_hir::{CoroutineDesugaring, CoroutineKind, CoroutineSource, Mutability}; diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index 3b7fefee80a..4c5b183cfe9 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -435,18 +435,22 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { scalar: abi::Scalar, backend_ty: Bx::Type, ) { - if matches!(self.cx.sess().opts.optimize, OptLevel::No) - // For now, the critical niches are all over `Int`eger values. - // Should floating-point values or pointers ever get more complex - // niches, then this code will probably want to handle them too. - || !matches!(scalar.primitive(), abi::Primitive::Int(..)) - || scalar.is_always_valid(self.cx) - { + if matches!(self.cx.sess().opts.optimize, OptLevel::No) || scalar.is_always_valid(self.cx) { return; } - let range = scalar.valid_range(self.cx); - bx.assume_integer_range(imm, backend_ty, range); + match scalar.primitive() { + abi::Primitive::Int(..) => { + let range = scalar.valid_range(self.cx); + bx.assume_integer_range(imm, backend_ty, range); + } + abi::Primitive::Pointer(abi::AddressSpace::DATA) + if !scalar.valid_range(self.cx).contains(0) => + { + bx.assume_nonnull(imm); + } + abi::Primitive::Pointer(..) | abi::Primitive::Float(..) => {} + } } pub(crate) fn codegen_rvalue_unsized( diff --git a/compiler/rustc_codegen_ssa/src/mono_item.rs b/compiler/rustc_codegen_ssa/src/mono_item.rs index 6749bc63327..5f95b6615bd 100644 --- a/compiler/rustc_codegen_ssa/src/mono_item.rs +++ b/compiler/rustc_codegen_ssa/src/mono_item.rs @@ -35,7 +35,7 @@ impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> { cx.codegen_static(def_id); } MonoItem::GlobalAsm(item_id) => { - let item = cx.tcx().hir().item(item_id); + let item = cx.tcx().hir_item(item_id); if let hir::ItemKind::GlobalAsm(asm) = item.kind { let operands: Vec<_> = asm .operands diff --git a/compiler/rustc_codegen_ssa/src/size_of_val.rs b/compiler/rustc_codegen_ssa/src/size_of_val.rs index 71a2f916db5..ac2366340fb 100644 --- a/compiler/rustc_codegen_ssa/src/size_of_val.rs +++ b/compiler/rustc_codegen_ssa/src/size_of_val.rs @@ -45,14 +45,9 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( // The info in this case is the length of the str, so the size is that // times the unit size. ( - // All slice sizes must fit into `isize`, so this multiplication cannot (signed) - // wrap. - // NOTE: ideally, we want the effects of both `unchecked_smul` and `unchecked_umul` - // (resulting in `mul nsw nuw` in LLVM IR), since we know that the multiplication - // cannot signed wrap, and that both operands are non-negative. But at the time of - // writing, the `LLVM-C` binding can't do this, and it doesn't seem to enable any - // further optimizations. - bx.unchecked_smul(info.unwrap(), bx.const_usize(unit.size.bytes())), + // All slice sizes must fit into `isize`, so this multiplication cannot + // wrap -- neither signed nor unsigned. + bx.unchecked_sumul(info.unwrap(), bx.const_usize(unit.size.bytes())), bx.const_usize(unit.align.abi.bytes()), ) } diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs index b7dcf16fa2b..2c843e2f5e4 100644 --- a/compiler/rustc_codegen_ssa/src/traits/builder.rs +++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs @@ -159,12 +159,35 @@ pub trait BuilderMethods<'a, 'tcx>: /// must be interpreted as unsigned and can be assumed to be less than the size of the left /// operand. fn ashr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; - fn unchecked_sadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; - fn unchecked_uadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; - fn unchecked_ssub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; - fn unchecked_usub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; - fn unchecked_smul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; - fn unchecked_umul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; + fn unchecked_sadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { + self.add(lhs, rhs) + } + fn unchecked_uadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { + self.add(lhs, rhs) + } + fn unchecked_suadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { + self.unchecked_sadd(lhs, rhs) + } + fn unchecked_ssub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { + self.sub(lhs, rhs) + } + fn unchecked_usub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { + self.sub(lhs, rhs) + } + fn unchecked_susub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { + self.unchecked_ssub(lhs, rhs) + } + fn unchecked_smul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { + self.mul(lhs, rhs) + } + fn unchecked_umul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { + self.mul(lhs, rhs) + } + fn unchecked_sumul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { + // Which to default to is a fairly arbitrary choice, + // but this is what slice layout was using before. + self.unchecked_smul(lhs, rhs) + } fn and(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; fn or(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; /// Defaults to [`Self::or`], but guarantees `(lhs & rhs) == 0` so some backends @@ -243,6 +266,19 @@ pub trait BuilderMethods<'a, 'tcx>: self.assume(cmp); } + /// Emits an `assume` that the `val` of pointer type is non-null. + /// + /// You may want to check the optimization level before bothering calling this. + fn assume_nonnull(&mut self, val: Self::Value) { + // Arguably in LLVM it'd be better to emit an assume operand bundle instead + // <https://llvm.org/docs/LangRef.html#assume-operand-bundles> + // but this works fine for all backends. + + let null = self.const_null(self.type_ptr()); + let is_null = self.icmp(IntPredicate::IntNE, val, null); + self.assume(is_null); + } + fn range_metadata(&mut self, load: Self::Value, range: WrappingRange); fn nonnull_metadata(&mut self, load: Self::Value); diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs index cdf706f3752..29f819cca1f 100644 --- a/compiler/rustc_const_eval/src/interpret/call.rs +++ b/compiler/rustc_const_eval/src/interpret/call.rs @@ -241,7 +241,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { interp_ok(caller == callee) } - fn check_argument_compat( + /// Returns a `bool` saying whether the two arguments are ABI-compatible. + pub fn check_argument_compat( &self, caller_abi: &ArgAbi<'tcx, Ty<'tcx>>, callee_abi: &ArgAbi<'tcx, Ty<'tcx>>, diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml index a8f83ca13e2..1705af1e210 100644 --- a/compiler/rustc_data_structures/Cargo.toml +++ b/compiler/rustc_data_structures/Cargo.toml @@ -18,6 +18,7 @@ rustc-rayon = { version = "0.5.1", features = ["indexmap"] } rustc-stable-hash = { version = "0.1.0", features = ["nightly"] } rustc_arena = { path = "../rustc_arena" } rustc_graphviz = { path = "../rustc_graphviz" } +rustc_hashes = { path = "../rustc_hashes" } rustc_index = { path = "../rustc_index", package = "rustc_index" } rustc_macros = { path = "../rustc_macros" } rustc_serialize = { path = "../rustc_serialize" } diff --git a/compiler/rustc_data_structures/src/fingerprint.rs b/compiler/rustc_data_structures/src/fingerprint.rs index 16c66824c5b..c7c0d0ab072 100644 --- a/compiler/rustc_data_structures/src/fingerprint.rs +++ b/compiler/rustc_data_structures/src/fingerprint.rs @@ -1,10 +1,9 @@ use std::hash::{Hash, Hasher}; +use rustc_hashes::Hash64; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; -use crate::stable_hasher::{ - FromStableHash, Hash64, StableHasherHash, impl_stable_traits_for_trivial_type, -}; +use crate::stable_hasher::{FromStableHash, StableHasherHash, impl_stable_traits_for_trivial_type}; #[cfg(test)] mod tests; diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index 6ef73debadd..66d3834d857 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -84,7 +84,6 @@ pub mod vec_cache; pub mod work_queue; mod atomic_ref; -mod hashes; /// This calls the passed function while ensuring it won't be inlined into the caller. #[inline(never)] diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index 9cd0cc499ca..ffbe54d6206 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -10,12 +10,11 @@ use smallvec::SmallVec; #[cfg(test)] mod tests; +use rustc_hashes::{Hash64, Hash128}; pub use rustc_stable_hash::{ FromStableHash, SipHasher128Hash as StableHasherHash, StableSipHasher128 as StableHasher, }; -pub use crate::hashes::{Hash64, Hash128}; - /// Something that implements `HashStable<CTX>` can be hashed in a way that is /// stable across multiple compilation sessions. /// diff --git a/compiler/rustc_data_structures/src/tagged_ptr/tests.rs b/compiler/rustc_data_structures/src/tagged_ptr/tests.rs index b1bdee18d6d..9c1e4cefa69 100644 --- a/compiler/rustc_data_structures/src/tagged_ptr/tests.rs +++ b/compiler/rustc_data_structures/src/tagged_ptr/tests.rs @@ -1,7 +1,8 @@ use std::ptr; +use rustc_hashes::Hash128; + use super::*; -use crate::hashes::Hash128; use crate::stable_hasher::{HashStable, StableHasher}; /// A tag type used in [`TaggedRef`] tests. diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 2bcc33241df..a2ddff7183e 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -667,11 +667,12 @@ fn print_crate_info( return Compilation::Continue; }; let t_outputs = rustc_interface::util::build_output_filenames(attrs, sess); - let id = rustc_session::output::find_crate_name(sess, attrs); + let crate_name = passes::get_crate_name(sess, attrs); let crate_types = collect_crate_types(sess, attrs); for &style in &crate_types { - let fname = - rustc_session::output::filename_for_input(sess, style, id, &t_outputs); + let fname = rustc_session::output::filename_for_input( + sess, style, crate_name, &t_outputs, + ); println_info!("{}", fname.as_path().file_name().unwrap().to_string_lossy()); } } @@ -680,8 +681,7 @@ fn print_crate_info( // no crate attributes, print out an error and exit return Compilation::Continue; }; - let id = rustc_session::output::find_crate_name(sess, attrs); - println_info!("{id}"); + println_info!("{}", passes::get_crate_name(sess, attrs)); } Cfg => { let mut cfgs = sess diff --git a/compiler/rustc_driver_impl/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs index 576b1c76823..093ee659bb4 100644 --- a/compiler/rustc_driver_impl/src/pretty.rs +++ b/compiler/rustc_driver_impl/src/pretty.rs @@ -273,7 +273,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) { let attrs = |id| hir_map.attrs(id); pprust_hir::print_crate( sm, - hir_map.root_module(), + tcx.hir_root_module(), src_name, src, &attrs, @@ -294,7 +294,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) { } HirTree => { debug!("pretty printing HIR tree"); - format!("{:#?}", ex.tcx().hir().krate()) + format!("{:#?}", ex.tcx().hir_crate(())) } Mir => { let mut out = Vec::new(); diff --git a/compiler/rustc_errors/Cargo.toml b/compiler/rustc_errors/Cargo.toml index fbb6a1cc475..434f8c1c767 100644 --- a/compiler/rustc_errors/Cargo.toml +++ b/compiler/rustc_errors/Cargo.toml @@ -14,6 +14,7 @@ rustc_data_structures = { path = "../rustc_data_structures" } rustc_error_codes = { path = "../rustc_error_codes" } rustc_error_messages = { path = "../rustc_error_messages" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } +rustc_hashes = { path = "../rustc_hashes" } rustc_hir = { path = "../rustc_hir" } rustc_index = { path = "../rustc_index" } rustc_lexer = { path = "../rustc_lexer" } diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 4824dc098ad..634afacf539 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1976,13 +1976,16 @@ impl HumanEmitter { Some(Style::HeaderMsg), ); + let other_suggestions = suggestions.len().saturating_sub(MAX_SUGGESTIONS); + let mut row_num = 2; for (i, (complete, parts, highlights, _)) in - suggestions.iter().enumerate().take(MAX_SUGGESTIONS) + suggestions.into_iter().enumerate().take(MAX_SUGGESTIONS) { debug!(?complete, ?parts, ?highlights); - let has_deletion = parts.iter().any(|p| p.is_deletion(sm) || p.is_replacement(sm)); + let has_deletion = + parts.iter().any(|p| p.is_deletion(sm) || p.is_destructive_replacement(sm)); let is_multiline = complete.lines().count() > 1; if i == 0 { @@ -2167,7 +2170,7 @@ impl HumanEmitter { self.draw_code_line( &mut buffer, &mut row_num, - highlight_parts, + &highlight_parts, line_pos + line_start, line, show_code_change, @@ -2213,7 +2216,12 @@ impl HumanEmitter { if let DisplaySuggestion::Diff | DisplaySuggestion::Underline | DisplaySuggestion::Add = show_code_change { - for part in parts { + for mut part in parts { + // If this is a replacement of, e.g. `"a"` into `"ab"`, adjust the + // suggestion and snippet to look as if we just suggested to add + // `"b"`, which is typically much easier for the user to understand. + part.trim_trivial_replacements(sm); + let snippet = if let Ok(snippet) = sm.span_to_snippet(part.span) { snippet } else { @@ -2376,9 +2384,12 @@ impl HumanEmitter { row_num = row + 1; } } - if suggestions.len() > MAX_SUGGESTIONS { - let others = suggestions.len() - MAX_SUGGESTIONS; - let msg = format!("and {} other candidate{}", others, pluralize!(others)); + if other_suggestions > 0 { + let msg = format!( + "and {} other candidate{}", + other_suggestions, + pluralize!(other_suggestions) + ); buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle); } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 9af17db9a6e..6fce1fade26 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -58,12 +58,13 @@ pub use emitter::ColorConfig; use emitter::{DynEmitter, Emitter, is_case_difference, is_different}; use rustc_data_structures::AtomicRef; use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; -use rustc_data_structures::stable_hasher::{Hash128, StableHasher}; +use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::{DynSend, Lock}; pub use rustc_error_messages::{ DiagMessage, FluentBundle, LanguageIdentifier, LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagMessage, fallback_fluent_bundle, fluent_bundle, }; +use rustc_hashes::Hash128; use rustc_lint_defs::LintExpectationId; pub use rustc_lint_defs::{Applicability, listify, pluralize}; use rustc_macros::{Decodable, Encodable}; @@ -230,10 +231,40 @@ impl SubstitutionPart { !self.snippet.is_empty() && self.replaces_meaningful_content(sm) } + /// Whether this is a replacement that overwrites source with a snippet + /// in a way that isn't a superset of the original string. For example, + /// replacing "abc" with "abcde" is not destructive, but replacing it + /// it with "abx" is, since the "c" character is lost. + pub fn is_destructive_replacement(&self, sm: &SourceMap) -> bool { + self.is_replacement(sm) + && !sm.span_to_snippet(self.span).is_ok_and(|snippet| { + self.snippet.trim_start().starts_with(snippet.trim_start()) + || self.snippet.trim_end().ends_with(snippet.trim_end()) + }) + } + fn replaces_meaningful_content(&self, sm: &SourceMap) -> bool { sm.span_to_snippet(self.span) .map_or(!self.span.is_empty(), |snippet| !snippet.trim().is_empty()) } + + /// Try to turn a replacement into an addition when the span that is being + /// overwritten matches either the prefix or suffix of the replacement. + fn trim_trivial_replacements(&mut self, sm: &SourceMap) { + if self.snippet.is_empty() { + return; + } + let Ok(snippet) = sm.span_to_snippet(self.span) else { + return; + }; + if self.snippet.starts_with(&snippet) { + self.span = self.span.shrink_to_hi(); + self.snippet = self.snippet[snippet.len()..].to_string(); + } else if self.snippet.ends_with(&snippet) { + self.span = self.span.shrink_to_lo(); + self.snippet = self.snippet[..self.snippet.len() - snippet.len()].to_string(); + } + } } impl CodeSuggestion { diff --git a/compiler/rustc_expand/src/module.rs b/compiler/rustc_expand/src/module.rs index 9c35b26772b..e925052c607 100644 --- a/compiler/rustc_expand/src/module.rs +++ b/compiler/rustc_expand/src/module.rs @@ -183,12 +183,12 @@ pub(crate) fn mod_file_path_from_attr( let first_path = attrs.iter().find(|at| at.has_name(sym::path))?; let Some(path_sym) = first_path.value_str() else { // This check is here mainly to catch attempting to use a macro, - // such as #[path = concat!(...)]. This isn't currently supported - // because otherwise the InvocationCollector would need to defer - // loading a module until the #[path] attribute was expanded, and - // it doesn't support that (and would likely add a bit of - // complexity). Usually bad forms are checked in AstValidator (via - // `check_builtin_attribute`), but by the time that runs the macro + // such as `#[path = concat!(...)]`. This isn't supported because + // otherwise the `InvocationCollector` would need to defer loading + // a module until the `#[path]` attribute was expanded, and it + // doesn't support that (and would likely add a bit of complexity). + // Usually bad forms are checked during semantic analysis via + // `TyCtxt::check_mod_attrs`), but by the time that runs the macro // is expanded, and it doesn't give an error. validate_attr::emit_fatal_malformed_builtin_attribute(&sess.psess, first_path, sym::path); }; diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index eb5fac96af2..8eb9bf15829 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -1149,7 +1149,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ "the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite", ), rustc_attr!( - TEST, pattern_complexity, CrateLevel, template!(NameValueStr: "N"), + TEST, pattern_complexity_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing, EncodeCrossCrate::No, ), ]; diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index a638a845c07..e852f239aa2 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -227,7 +227,7 @@ declare_features! ( /// Allows using `#[omit_gdb_pretty_printer_section]`. (internal, omit_gdb_pretty_printer_section, "1.5.0", None), /// Set the maximum pattern complexity allowed (not limited by default). - (internal, pattern_complexity, "1.78.0", None), + (internal, pattern_complexity_limit, "1.78.0", None), /// Allows using pattern types. (internal, pattern_types, "1.79.0", Some(123646)), /// Allows using `#[prelude_import]` on glob `use` items. diff --git a/compiler/rustc_hashes/Cargo.toml b/compiler/rustc_hashes/Cargo.toml new file mode 100644 index 00000000000..c2bae2fe8cb --- /dev/null +++ b/compiler/rustc_hashes/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "rustc_hashes" +version = "0.0.0" +edition = "2021" + +[dependencies] +# tidy-alphabetical-start +rustc-stable-hash = { version = "0.1.0" } +# tidy-alphabetical-end diff --git a/compiler/rustc_data_structures/src/hashes.rs b/compiler/rustc_hashes/src/lib.rs index 8f4639fc2e6..3755caaaa29 100644 --- a/compiler/rustc_data_structures/src/hashes.rs +++ b/compiler/rustc_hashes/src/lib.rs @@ -1,6 +1,8 @@ //! rustc encodes a lot of hashes. If hashes are stored as `u64` or `u128`, a `derive(Encodable)` //! will apply varint encoding to the hashes, which is less efficient than directly encoding the 8 -//! or 16 bytes of the hash. +//! or 16 bytes of the hash. And if that hash depends on the `StableCrateHash` (which most in rustc +//! do), the varint encoding will make the number of bytes encoded fluctuate between compiler +//! versions. //! //! The types in this module represent 64-bit or 128-bit hashes produced by a `StableHasher`. //! `Hash64` and `Hash128` expose some utility functions to encourage users to not extract the inner @@ -14,10 +16,9 @@ use std::fmt; use std::ops::BitXorAssign; -use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; - -use crate::stable_hasher::{FromStableHash, StableHasherHash}; +use rustc_stable_hash::{FromStableHash, SipHasher128Hash as StableHasherHash}; +/// A `u64` but encoded with a fixed size; for hashes this encoding is more compact than `u64`. #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct Hash64 { inner: u64, @@ -35,26 +36,17 @@ impl Hash64 { pub fn as_u64(self) -> u64 { self.inner } -} -impl BitXorAssign<u64> for Hash64 { #[inline] - fn bitxor_assign(&mut self, rhs: u64) { - self.inner ^= rhs; - } -} - -impl<S: Encoder> Encodable<S> for Hash64 { - #[inline] - fn encode(&self, s: &mut S) { - s.emit_raw_bytes(&self.inner.to_le_bytes()); + pub fn wrapping_add(self, other: Self) -> Self { + Self { inner: self.inner.wrapping_add(other.inner) } } } -impl<D: Decoder> Decodable<D> for Hash64 { +impl BitXorAssign<u64> for Hash64 { #[inline] - fn decode(d: &mut D) -> Self { - Self { inner: u64::from_le_bytes(d.read_raw_bytes(8).try_into().unwrap()) } + fn bitxor_assign(&mut self, rhs: u64) { + self.inner ^= rhs; } } @@ -79,6 +71,7 @@ impl fmt::LowerHex for Hash64 { } } +/// A `u128` but encoded with a fixed size; for hashes this encoding is more compact than `u128`. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)] pub struct Hash128 { inner: u128, @@ -96,6 +89,11 @@ impl std::hash::Hash for Hash128 { impl Hash128 { #[inline] + pub fn new(n: u128) -> Self { + Self { inner: n } + } + + #[inline] pub fn truncate(self) -> Hash64 { Hash64 { inner: self.inner as u64 } } @@ -111,20 +109,6 @@ impl Hash128 { } } -impl<S: Encoder> Encodable<S> for Hash128 { - #[inline] - fn encode(&self, s: &mut S) { - s.emit_raw_bytes(&self.inner.to_le_bytes()); - } -} - -impl<D: Decoder> Decodable<D> for Hash128 { - #[inline] - fn decode(d: &mut D) -> Self { - Self { inner: u128::from_le_bytes(d.read_raw_bytes(16).try_into().unwrap()) } - } -} - impl FromStableHash for Hash128 { type Hash = StableHasherHash; diff --git a/compiler/rustc_hir/Cargo.toml b/compiler/rustc_hir/Cargo.toml index 5bfc4756ec6..b1516e53173 100644 --- a/compiler/rustc_hir/Cargo.toml +++ b/compiler/rustc_hir/Cargo.toml @@ -10,6 +10,7 @@ rustc_abi = { path = "../rustc_abi" } rustc_arena = { path = "../rustc_arena" } rustc_ast = { path = "../rustc_ast" } 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" } diff --git a/compiler/rustc_hir/src/def_path_hash_map.rs b/compiler/rustc_hir/src/def_path_hash_map.rs index 9a6dee1e511..35c6e57b877 100644 --- a/compiler/rustc_hir/src/def_path_hash_map.rs +++ b/compiler/rustc_hir/src/def_path_hash_map.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::stable_hasher::Hash64; +use rustc_hashes::Hash64; use rustc_span::def_id::DefIndex; #[derive(Clone, Default)] diff --git a/compiler/rustc_hir/src/definitions.rs b/compiler/rustc_hir/src/definitions.rs index dc527240f74..08a0a5225e7 100644 --- a/compiler/rustc_hir/src/definitions.rs +++ b/compiler/rustc_hir/src/definitions.rs @@ -7,8 +7,9 @@ use std::fmt::{self, Write}; use std::hash::Hash; -use rustc_data_structures::stable_hasher::{Hash64, StableHasher}; +use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::unord::UnordMap; +use rustc_hashes::Hash64; use rustc_index::IndexVec; use rustc_macros::{Decodable, Encodable}; use rustc_span::{Symbol, kw, sym}; diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index f632041dba9..949f8daa4dc 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -18,7 +18,7 @@ //! within one another. //! - Example: Examine each expression to look for its type and do some check or other. //! - How: Implement `intravisit::Visitor` and override the `NestedFilter` type to -//! `nested_filter::OnlyBodies` (and implement `nested_visit_map`), and use +//! `nested_filter::OnlyBodies` (and implement `maybe_tcx`), and use //! `tcx.hir().visit_all_item_likes_in_crate(&mut visitor)`. Within your //! `intravisit::Visitor` impl, implement methods like `visit_expr()` (don't forget to invoke //! `intravisit::walk_expr()` to keep walking the subparts). @@ -30,7 +30,7 @@ //! - Example: Lifetime resolution, which wants to bring lifetimes declared on the //! impl into scope while visiting the impl-items, and then back out again. //! - How: Implement `intravisit::Visitor` and override the `NestedFilter` type to -//! `nested_filter::All` (and implement `nested_visit_map`). Walk your crate with +//! `nested_filter::All` (and implement `maybe_tcx`). Walk your crate with //! `tcx.hir().walk_toplevel_module(visitor)` invoked on `tcx.hir().krate()`. //! - Pro: Visitor methods for any kind of HIR node, not just item-like things. //! - Pro: Preserves nesting information @@ -106,45 +106,43 @@ impl<'a> FnKind<'a> { } } -/// An abstract representation of the HIR `rustc_middle::hir::map::Map`. -pub trait Map<'hir> { +/// HIR things retrievable from `TyCtxt`, avoiding an explicit dependence on +/// `TyCtxt`. The only impls are for `!` (where these functions are never +/// called) and `TyCtxt` (in `rustc_middle`). +pub trait HirTyCtxt<'hir> { /// Retrieves the `Node` corresponding to `id`. fn hir_node(&self, hir_id: HirId) -> Node<'hir>; - fn hir_node_by_def_id(&self, def_id: LocalDefId) -> Node<'hir>; - fn body(&self, id: BodyId) -> &'hir Body<'hir>; - fn item(&self, id: ItemId) -> &'hir Item<'hir>; - fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem<'hir>; - fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem<'hir>; - fn foreign_item(&self, id: ForeignItemId) -> &'hir ForeignItem<'hir>; + fn hir_body(&self, id: BodyId) -> &'hir Body<'hir>; + fn hir_item(&self, id: ItemId) -> &'hir Item<'hir>; + fn hir_trait_item(&self, id: TraitItemId) -> &'hir TraitItem<'hir>; + fn hir_impl_item(&self, id: ImplItemId) -> &'hir ImplItem<'hir>; + fn hir_foreign_item(&self, id: ForeignItemId) -> &'hir ForeignItem<'hir>; } -// Used when no map is actually available, forcing manual implementation of nested visitors. -impl<'hir> Map<'hir> for ! { +// Used when no tcx is actually available, forcing manual implementation of nested visitors. +impl<'hir> HirTyCtxt<'hir> for ! { fn hir_node(&self, _: HirId) -> Node<'hir> { - *self; + unreachable!(); } - fn hir_node_by_def_id(&self, _: LocalDefId) -> Node<'hir> { - *self; + fn hir_body(&self, _: BodyId) -> &'hir Body<'hir> { + unreachable!(); } - fn body(&self, _: BodyId) -> &'hir Body<'hir> { - *self; + fn hir_item(&self, _: ItemId) -> &'hir Item<'hir> { + unreachable!(); } - fn item(&self, _: ItemId) -> &'hir Item<'hir> { - *self; + fn hir_trait_item(&self, _: TraitItemId) -> &'hir TraitItem<'hir> { + unreachable!(); } - fn trait_item(&self, _: TraitItemId) -> &'hir TraitItem<'hir> { - *self; + fn hir_impl_item(&self, _: ImplItemId) -> &'hir ImplItem<'hir> { + unreachable!(); } - fn impl_item(&self, _: ImplItemId) -> &'hir ImplItem<'hir> { - *self; - } - fn foreign_item(&self, _: ForeignItemId) -> &'hir ForeignItem<'hir> { - *self; + fn hir_foreign_item(&self, _: ForeignItemId) -> &'hir ForeignItem<'hir> { + unreachable!(); } } pub mod nested_filter { - use super::Map; + use super::HirTyCtxt; /// Specifies what nested things a visitor wants to visit. By "nested /// things", we are referring to bits of HIR that are not directly embedded @@ -159,7 +157,7 @@ pub mod nested_filter { /// See the comments at [`rustc_hir::intravisit`] for more details on the overall /// visit strategy. pub trait NestedFilter<'hir> { - type Map: Map<'hir>; + type MaybeTyCtxt: HirTyCtxt<'hir>; /// Whether the visitor visits nested "item-like" things. /// E.g., item, impl-item. @@ -175,10 +173,10 @@ pub mod nested_filter { /// /// Use this if you are only walking some particular kind of tree /// (i.e., a type, or fn signature) and you don't want to thread a - /// HIR map around. + /// `tcx` around. pub struct None(()); impl NestedFilter<'_> for None { - type Map = !; + type MaybeTyCtxt = !; const INTER: bool = false; const INTRA: bool = false; } @@ -203,18 +201,18 @@ use nested_filter::NestedFilter; /// to monitor future changes to `Visitor` in case a new method with a /// new default implementation gets introduced.) pub trait Visitor<'v>: Sized { - // this type should not be overridden, it exists for convenient usage as `Self::Map` - type Map: Map<'v> = <Self::NestedFilter as NestedFilter<'v>>::Map; + // This type should not be overridden, it exists for convenient usage as `Self::MaybeTyCtxt`. + type MaybeTyCtxt: HirTyCtxt<'v> = <Self::NestedFilter as NestedFilter<'v>>::MaybeTyCtxt; /////////////////////////////////////////////////////////////////////////// // Nested items. /// Override this type to control which nested HIR are visited; see /// [`NestedFilter`] for details. If you override this type, you - /// must also override [`nested_visit_map`](Self::nested_visit_map). + /// must also override [`maybe_tcx`](Self::maybe_tcx). /// /// **If for some reason you want the nested behavior, but don't - /// have a `Map` at your disposal:** then override the + /// have a `tcx` at your disposal:** then override the /// `visit_nested_XXX` methods. If a new `visit_nested_XXX` variant is /// added in the future, it will cause a panic which can be detected /// and fixed appropriately. @@ -226,9 +224,9 @@ pub trait Visitor<'v>: Sized { /// If `type NestedFilter` is set to visit nested items, this method /// must also be overridden to provide a map to retrieve nested items. - fn nested_visit_map(&mut self) -> Self::Map { + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { panic!( - "nested_visit_map must be implemented or consider using \ + "maybe_tcx must be implemented or consider using \ `type NestedFilter = nested_filter::None` (the default)" ); } @@ -240,10 +238,10 @@ pub trait Visitor<'v>: Sized { /// "deep" visit patterns described at /// [`rustc_hir::intravisit`]. The only reason to override /// this method is if you want a nested pattern but cannot supply a - /// [`Map`]; see `nested_visit_map` for advice. + /// `TyCtxt`; see `maybe_tcx` for advice. fn visit_nested_item(&mut self, id: ItemId) -> Self::Result { if Self::NestedFilter::INTER { - let item = self.nested_visit_map().item(id); + let item = self.maybe_tcx().hir_item(id); try_visit!(self.visit_item(item)); } Self::Result::output() @@ -254,7 +252,7 @@ pub trait Visitor<'v>: Sized { /// method. fn visit_nested_trait_item(&mut self, id: TraitItemId) -> Self::Result { if Self::NestedFilter::INTER { - let item = self.nested_visit_map().trait_item(id); + let item = self.maybe_tcx().hir_trait_item(id); try_visit!(self.visit_trait_item(item)); } Self::Result::output() @@ -265,7 +263,7 @@ pub trait Visitor<'v>: Sized { /// method. fn visit_nested_impl_item(&mut self, id: ImplItemId) -> Self::Result { if Self::NestedFilter::INTER { - let item = self.nested_visit_map().impl_item(id); + let item = self.maybe_tcx().hir_impl_item(id); try_visit!(self.visit_impl_item(item)); } Self::Result::output() @@ -276,7 +274,7 @@ pub trait Visitor<'v>: Sized { /// method. fn visit_nested_foreign_item(&mut self, id: ForeignItemId) -> Self::Result { if Self::NestedFilter::INTER { - let item = self.nested_visit_map().foreign_item(id); + let item = self.maybe_tcx().hir_foreign_item(id); try_visit!(self.visit_foreign_item(item)); } Self::Result::output() @@ -287,7 +285,7 @@ pub trait Visitor<'v>: Sized { /// `Self::NestedFilter`. fn visit_nested_body(&mut self, id: BodyId) -> Self::Result { if Self::NestedFilter::INTRA { - let body = self.nested_visit_map().body(id); + let body = self.maybe_tcx().hir_body(id); try_visit!(self.visit_body(body)); } Self::Result::output() diff --git a/compiler/rustc_hir/src/tests.rs b/compiler/rustc_hir/src/tests.rs index e0e63d183c6..0837444ffdb 100644 --- a/compiler/rustc_hir/src/tests.rs +++ b/compiler/rustc_hir/src/tests.rs @@ -1,6 +1,6 @@ #![allow(rustc::symbol_intern_string_literal)] -use rustc_data_structures::stable_hasher::Hash64; +use rustc_hashes::Hash64; use rustc_span::def_id::{DefPathHash, StableCrateId}; use rustc_span::edition::Edition; use rustc_span::{Symbol, create_session_globals_then}; diff --git a/compiler/rustc_hir_analysis/src/bounds.rs b/compiler/rustc_hir_analysis/src/bounds.rs deleted file mode 100644 index 9b02651a8bd..00000000000 --- a/compiler/rustc_hir_analysis/src/bounds.rs +++ /dev/null @@ -1,100 +0,0 @@ -//! Bounds are restrictions applied to some types after they've been lowered from the HIR to the -//! [`rustc_middle::ty`] form. - -use rustc_hir::LangItem; -use rustc_middle::ty::{self, Ty, TyCtxt, Upcast}; -use rustc_span::Span; - -/// Collects together a list of type bounds. These lists of bounds occur in many places -/// in Rust's syntax: -/// -/// ```text -/// trait Foo: Bar + Baz { } -/// ^^^^^^^^^ supertrait list bounding the `Self` type parameter -/// -/// fn foo<T: Bar + Baz>() { } -/// ^^^^^^^^^ bounding the type parameter `T` -/// -/// impl dyn Bar + Baz -/// ^^^^^^^^^ bounding the type-erased dynamic type -/// ``` -/// -/// Our representation is a bit mixed here -- in some cases, we -/// include the self type (e.g., `trait_bounds`) but in others we do not -#[derive(Default, PartialEq, Eq, Clone, Debug)] -pub(crate) struct Bounds<'tcx> { - clauses: Vec<(ty::Clause<'tcx>, Span)>, -} - -impl<'tcx> Bounds<'tcx> { - pub(crate) fn push_region_bound( - &mut self, - tcx: TyCtxt<'tcx>, - region: ty::PolyTypeOutlivesPredicate<'tcx>, - span: Span, - ) { - self.clauses - .push((region.map_bound(|p| ty::ClauseKind::TypeOutlives(p)).upcast(tcx), span)); - } - - pub(crate) fn push_trait_bound( - &mut self, - tcx: TyCtxt<'tcx>, - bound_trait_ref: ty::PolyTraitRef<'tcx>, - span: Span, - polarity: ty::PredicatePolarity, - ) { - let clause = ( - bound_trait_ref - .map_bound(|trait_ref| { - ty::ClauseKind::Trait(ty::TraitPredicate { trait_ref, polarity }) - }) - .upcast(tcx), - span, - ); - // FIXME(-Znext-solver): We can likely remove this hack once the new trait solver lands. - if tcx.is_lang_item(bound_trait_ref.def_id(), LangItem::Sized) { - self.clauses.insert(0, clause); - } else { - self.clauses.push(clause); - } - } - - pub(crate) fn push_projection_bound( - &mut self, - tcx: TyCtxt<'tcx>, - projection: ty::PolyProjectionPredicate<'tcx>, - span: Span, - ) { - self.clauses.push(( - projection.map_bound(|proj| ty::ClauseKind::Projection(proj)).upcast(tcx), - span, - )); - } - - pub(crate) fn push_sized(&mut self, tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, span: Span) { - let sized_def_id = tcx.require_lang_item(LangItem::Sized, Some(span)); - let trait_ref = ty::TraitRef::new(tcx, sized_def_id, [ty]); - // Preferable to put this obligation first, since we report better errors for sized ambiguity. - self.clauses.insert(0, (trait_ref.upcast(tcx), span)); - } - - /// Push a `const` or `~const` bound as a `HostEffect` predicate. - pub(crate) fn push_const_bound( - &mut self, - tcx: TyCtxt<'tcx>, - bound_trait_ref: ty::PolyTraitRef<'tcx>, - constness: ty::BoundConstness, - span: Span, - ) { - if tcx.is_const_trait(bound_trait_ref.def_id()) { - self.clauses.push((bound_trait_ref.to_host_effect_clause(tcx, constness), span)); - } else { - tcx.dcx().span_delayed_bug(span, "tried to lower {host:?} bound for non-const trait"); - } - } - - pub(crate) fn clauses(&self) -> impl Iterator<Item = (ty::Clause<'tcx>, Span)> + '_ { - self.clauses.iter().cloned() - } -} diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 71a10ad3a0c..bc0fd4b705d 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -124,7 +124,7 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b for field in &def.non_enum_variant().fields { if !allowed_union_or_unsafe_field(tcx, field.ty(tcx, args), typing_env, span) { - let (field_span, ty_span) = match tcx.hir().get_if_local(field.did) { + let (field_span, ty_span) = match tcx.hir_get_if_local(field.did) { // We are currently checking the type this field came from, so it must be local. Some(Node::Field(field)) => (field.span, field.ty.span), _ => unreachable!("mir field has to correspond to hir field"), @@ -435,8 +435,8 @@ fn best_definition_site_of_opaque<'tcx>( impl<'tcx> intravisit::Visitor<'tcx> for TaitConstraintLocator<'tcx> { type NestedFilter = nested_filter::All; type Result = ControlFlow<(Span, LocalDefId)>; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) -> Self::Result { if let hir::ExprKind::Closure(closure) = ex.kind { @@ -880,7 +880,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) { .emit(); } - let item = tcx.hir().foreign_item(item.id); + let item = tcx.hir_foreign_item(item.id); match &item.kind { hir::ForeignItemKind::Fn(sig, _, _) => { require_c_abi_if_c_variadic(tcx, sig.decl, abi, item.span); @@ -1494,7 +1494,7 @@ fn detect_discriminant_duplicate<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>) // In the case the discriminant is both a duplicate and overflowed, let the user know if let hir::Node::AnonConst(expr) = tcx.hir_node_by_def_id(discr_def_id.expect_local()) - && let hir::ExprKind::Lit(lit) = &tcx.hir().body(expr.body).value.kind + && let hir::ExprKind::Lit(lit) = &tcx.hir_body(expr.body).value.kind && let rustc_ast::LitKind::Int(lit_value, _int_kind) = &lit.node && *lit_value != dis.val { diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs index bb5087e864c..84d5ec4a1e5 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -658,11 +658,10 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>( "method `{}` has an incompatible return type for trait", trait_m.name ); - let hir = tcx.hir(); infcx.err_ctxt().note_type_err( &mut diag, &cause, - hir.get_if_local(impl_m.def_id) + tcx.hir_get_if_local(impl_m.def_id) .and_then(|node| node.fn_decl()) .map(|decl| (decl.output.span(), Cow::from("return type in trait"), false)), Some(param_env.and(infer::ValuePairs::Terms(ExpectedFound { @@ -1123,15 +1122,14 @@ fn check_region_bounds_on_impl_item<'tcx>( // the moment, give a kind of vague error message. if trait_params != impl_params { let span = tcx - .hir() - .get_generics(impl_m.def_id.expect_local()) + .hir_get_generics(impl_m.def_id.expect_local()) .expect("expected impl item to have generics or else we can't compare them") .span; let mut generics_span = None; let mut bounds_span = vec![]; let mut where_span = None; - if let Some(trait_node) = tcx.hir().get_if_local(trait_m.def_id) + if let Some(trait_node) = tcx.hir_get_if_local(trait_m.def_id) && let Some(trait_generics) = trait_node.generics() { generics_span = Some(trait_generics.span); @@ -1146,7 +1144,7 @@ fn check_region_bounds_on_impl_item<'tcx>( } } } - if let Some(impl_node) = tcx.hir().get_if_local(impl_m.def_id) + if let Some(impl_node) = tcx.hir_get_if_local(impl_m.def_id) && let Some(impl_generics) = impl_node.generics() { let mut impl_bounds = 0; diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs index 0e9e9b48ab3..4973d848959 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs @@ -96,7 +96,7 @@ pub(crate) fn check_refining_return_position_impl_trait_in_trait<'tcx>( // This opaque also needs to be from the impl method -- otherwise, // it's a refinement to a TAIT. - if !tcx.hir().get_if_local(impl_opaque.def_id).is_some_and(|node| { + if !tcx.hir_get_if_local(impl_opaque.def_id).is_some_and(|node| { matches!( node.expect_opaque_ty().origin, hir::OpaqueTyOrigin::AsyncFn { parent, .. } | hir::OpaqueTyOrigin::FnReturn { parent, .. } @@ -327,7 +327,7 @@ fn report_mismatched_rpitit_signature<'tcx>( hir::FnRetTy::Return(ty) => (ty.span, ty.span, "", ""), }; let trait_return_span = - tcx.hir().get_if_local(trait_m_def_id).map(|node| match node.fn_decl().unwrap().output { + tcx.hir_get_if_local(trait_m_def_id).map(|node| match node.fn_decl().unwrap().output { hir::FnRetTy::DefaultReturn(_) => tcx.def_span(trait_m_def_id), hir::FnRetTy::Return(ty) => ty.span, }); diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index 96b33bdd250..7b3c3ea2bb4 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -129,7 +129,7 @@ fn get_owner_return_paths( let hir_id = tcx.local_def_id_to_hir_id(def_id); let parent_id = tcx.hir().get_parent_item(hir_id).def_id; tcx.hir_node_by_def_id(parent_id).body_id().map(|body_id| { - let body = tcx.hir().body(body_id); + let body = tcx.hir_body(body_id); let mut visitor = ReturnsVisitor::default(); visitor.visit_body(body); (parent_id, visitor) diff --git a/compiler/rustc_hir_analysis/src/check/region.rs b/compiler/rustc_hir_analysis/src/check/region.rs index d43c65c0023..88dd40ba289 100644 --- a/compiler/rustc_hir_analysis/src/check/region.rs +++ b/compiler/rustc_hir_analysis/src/check/region.rs @@ -424,7 +424,7 @@ fn resolve_expr<'tcx>(visitor: &mut ScopeResolutionVisitor<'tcx>, expr: &'tcx hi // that share the parent environment. We handle const blocks in // `visit_inline_const`. hir::ExprKind::Closure(&hir::Closure { body, .. }) => { - let body = visitor.tcx.hir().body(body); + let body = visitor.tcx.hir_body(body); visitor.visit_body(body); } hir::ExprKind::AssignOp(_, left_expr, right_expr) => { @@ -906,7 +906,7 @@ impl<'tcx> Visitor<'tcx> for ScopeResolutionVisitor<'tcx> { resolve_local(self, Some(l.pat), l.init) } fn visit_inline_const(&mut self, c: &'tcx hir::ConstBlock) { - let body = self.tcx.hir().body(c.body); + let body = self.tcx.hir_body(c.body); self.visit_body(body); } } diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index 4218f4ef0c1..01b4a5649f1 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -1163,7 +1163,7 @@ fn check_type_defn<'tcx>( // be refactored to check the instantiate-ability of the code better. if let Some(def_id) = def_id.as_local() && let hir::Node::AnonConst(anon) = tcx.hir_node_by_def_id(def_id) - && let expr = &tcx.hir().body(anon.body).value + && let expr = &tcx.hir_body(anon.body).value && let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind && let Res::Def(DefKind::ConstParam, _def_id) = path.res { diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index 9da57c330c5..b46b805f0a9 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -679,7 +679,7 @@ fn infringing_fields_error<'tcx>( suggest_constraining_type_params( tcx, - tcx.hir().get_generics(impl_did).expect("impls always have generics"), + tcx.hir_get_generics(impl_did).expect("impls always have generics"), &mut err, bounds .iter() diff --git a/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs b/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs index a86dede48bf..1805e2438af 100644 --- a/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs +++ b/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs @@ -25,7 +25,7 @@ pub(crate) fn crate_inherent_impls( let mut collect = InherentCollect { tcx, impls_map: Default::default() }; let mut res = Ok(()); - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { res = res.and(collect.check_item(id)); } diff --git a/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs b/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs index c72f6201831..dc616576c9c 100644 --- a/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs +++ b/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs @@ -18,7 +18,7 @@ pub(crate) fn crate_inherent_impls_overlap_check( ) -> Result<(), ErrorGuaranteed> { let mut inherent_overlap_checker = InherentOverlapChecker { tcx }; let mut res = Ok(()); - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { res = res.and(inherent_overlap_checker.check_item(id)); } res diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 12623779956..75ea207a06b 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -277,8 +277,8 @@ fn reject_placeholder_type_signatures_in_item<'tcx>( impl<'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { @@ -669,7 +669,7 @@ fn get_new_lifetime_name<'tcx>( #[instrument(level = "debug", skip_all)] fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) { - let it = tcx.hir().item(item_id); + let it = tcx.hir_item(item_id); debug!(item = %it.ident, id = %it.hir_id()); let def_id = item_id.owner_id.def_id; let icx = ItemCtxt::new(tcx, def_id); @@ -683,7 +683,7 @@ fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) { | hir::ItemKind::GlobalAsm(_) => {} hir::ItemKind::ForeignMod { items, .. } => { for item in *items { - let item = tcx.hir().foreign_item(item.id); + let item = tcx.hir_foreign_item(item.id); tcx.ensure_ok().generics_of(item.owner_id); tcx.ensure_ok().type_of(item.owner_id); tcx.ensure_ok().predicates_of(item.owner_id); @@ -790,7 +790,7 @@ fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) { } fn lower_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) { - let trait_item = tcx.hir().trait_item(trait_item_id); + let trait_item = tcx.hir_trait_item(trait_item_id); let def_id = trait_item_id.owner_id; tcx.ensure_ok().generics_of(def_id); let icx = ItemCtxt::new(tcx, def_id.def_id); @@ -865,7 +865,7 @@ fn lower_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::ImplItemId) { tcx.ensure_ok().generics_of(def_id); tcx.ensure_ok().type_of(def_id); tcx.ensure_ok().predicates_of(def_id); - let impl_item = tcx.hir().impl_item(impl_item_id); + let impl_item = tcx.hir_impl_item(impl_item_id); let icx = ItemCtxt::new(tcx, def_id.def_id); match impl_item.kind { hir::ImplItemKind::Fn(..) => { @@ -1769,7 +1769,7 @@ fn coroutine_for_closure(tcx: TyCtxt<'_>, def_id: LocalDefId) -> DefId { .. }), .. - } = tcx.hir().body(body).value + } = tcx.hir_body(body).value else { bug!() }; diff --git a/compiler/rustc_hir_analysis/src/collect/dump.rs b/compiler/rustc_hir_analysis/src/collect/dump.rs index 41f8465ae91..63c445fa6a3 100644 --- a/compiler/rustc_hir_analysis/src/collect/dump.rs +++ b/compiler/rustc_hir_analysis/src/collect/dump.rs @@ -52,7 +52,7 @@ pub(crate) fn predicates_and_item_bounds(tcx: TyCtxt<'_>) { } pub(crate) fn def_parents(tcx: TyCtxt<'_>) { - for iid in tcx.hir().items() { + for iid in tcx.hir_free_items() { let did = iid.owner_id.def_id; if tcx.has_attr(did, sym::rustc_dump_def_parents) { struct AnonConstFinder<'tcx> { @@ -63,8 +63,8 @@ pub(crate) fn def_parents(tcx: TyCtxt<'_>) { impl<'tcx> intravisit::Visitor<'tcx> for AnonConstFinder<'tcx> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_anon_const(&mut self, c: &'tcx rustc_hir::AnonConst) { @@ -77,7 +77,7 @@ pub(crate) fn def_parents(tcx: TyCtxt<'_>) { // the `rustc_dump_def_parents` attribute to the anon const so it would not be possible // to see what its def parent is. let mut anon_ct_finder = AnonConstFinder { tcx, anon_consts: vec![] }; - intravisit::walk_item(&mut anon_ct_finder, tcx.hir().item(iid)); + intravisit::walk_item(&mut anon_ct_finder, tcx.hir_item(iid)); for did in [did].into_iter().chain(anon_ct_finder.anon_consts) { let span = tcx.def_span(did); @@ -99,14 +99,14 @@ pub(crate) fn def_parents(tcx: TyCtxt<'_>) { } pub(crate) fn vtables<'tcx>(tcx: TyCtxt<'tcx>) { - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { let def_id = id.owner_id.def_id; let Some(attr) = tcx.get_attr(def_id, sym::rustc_dump_vtable) else { continue; }; - let vtable_entries = match tcx.hir().item(id).kind { + let vtable_entries = match tcx.hir_item(id).kind { hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }) => { let trait_ref = tcx.impl_trait_ref(def_id).unwrap().instantiate_identity(); if trait_ref.has_non_region_param() { diff --git a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs index 41c4cfbaa82..1c1a246cc15 100644 --- a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs +++ b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs @@ -13,7 +13,6 @@ use tracing::{debug, instrument}; use super::ItemCtxt; use super::predicates_of::assert_only_contains_predicates_from; -use crate::bounds::Bounds; use crate::hir_ty_lowering::{HirTyLowerer, PredicateFilter}; /// For associated types we include both bounds written on the type @@ -38,7 +37,7 @@ fn associated_type_bounds<'tcx>( ); let icx = ItemCtxt::new(tcx, assoc_item_def_id); - let mut bounds = Bounds::default(); + let mut bounds = Vec::new(); icx.lowerer().lower_bounds(item_ty, hir_bounds, &mut bounds, ty::List::empty(), filter); // Associated types are implicitly sized unless a `?Sized` bound is found match filter { @@ -68,7 +67,7 @@ fn associated_type_bounds<'tcx>( ) }); - let all_bounds = tcx.arena.alloc_from_iter(bounds.clauses().chain(bounds_from_parent)); + let all_bounds = tcx.arena.alloc_from_iter(bounds.into_iter().chain(bounds_from_parent)); debug!( "associated_type_bounds({}) = {:?}", tcx.def_path_str(assoc_item_def_id.to_def_id()), @@ -327,7 +326,7 @@ fn opaque_type_bounds<'tcx>( ) -> &'tcx [(ty::Clause<'tcx>, Span)] { ty::print::with_reduced_queries!({ let icx = ItemCtxt::new(tcx, opaque_def_id); - let mut bounds = Bounds::default(); + let mut bounds = Vec::new(); icx.lowerer().lower_bounds(item_ty, hir_bounds, &mut bounds, ty::List::empty(), filter); // Opaque types are implicitly sized unless a `?Sized` bound is found match filter { @@ -343,7 +342,7 @@ fn opaque_type_bounds<'tcx>( } debug!(?bounds); - tcx.arena.alloc_from_iter(bounds.clauses()) + tcx.arena.alloc_slice(&bounds) }) } diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index d94383d6f3d..70e7451a5fb 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -13,7 +13,6 @@ use rustc_span::{DUMMY_SP, Ident, Span}; use tracing::{debug, instrument, trace}; use super::item_bounds::explicit_item_bounds_with_filter; -use crate::bounds::Bounds; use crate::collect::ItemCtxt; use crate::constrained_generic_params as cgp; use crate::delegation::inherit_predicates_for_delegation_item; @@ -178,7 +177,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen // on a trait we must also consider the bounds that follow the trait's name, // like `trait Foo: A + B + C`. if let Some(self_bounds) = is_trait { - let mut bounds = Bounds::default(); + let mut bounds = Vec::new(); icx.lowerer().lower_bounds( tcx.types.self_param, self_bounds, @@ -186,7 +185,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen ty::List::empty(), PredicateFilter::All, ); - predicates.extend(bounds.clauses()); + predicates.extend(bounds); } // In default impls, we can assume that the self type implements @@ -209,7 +208,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen GenericParamKind::Lifetime { .. } => (), GenericParamKind::Type { .. } => { let param_ty = icx.lowerer().lower_ty_param(param.hir_id); - let mut bounds = Bounds::default(); + let mut bounds = Vec::new(); // Params are implicitly sized unless a `?Sized` bound is found icx.lowerer().add_sized_bound( &mut bounds, @@ -219,7 +218,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen param.span, ); trace!(?bounds); - predicates.extend(bounds.clauses()); + predicates.extend(bounds); trace!(?predicates); } hir::GenericParamKind::Const { .. } => { @@ -264,7 +263,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen } } - let mut bounds = Bounds::default(); + let mut bounds = Vec::new(); icx.lowerer().lower_bounds( ty, bound_pred.bounds, @@ -272,7 +271,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen bound_vars, PredicateFilter::All, ); - predicates.extend(bounds.clauses()); + predicates.extend(bounds); } hir::WherePredicateKind::RegionPredicate(region_pred) => { @@ -627,7 +626,7 @@ pub(super) fn implied_predicates_with_filter<'tcx>( let icx = ItemCtxt::new(tcx, trait_def_id); let self_param_ty = tcx.types.self_param; - let mut bounds = Bounds::default(); + let mut bounds = Vec::new(); icx.lowerer().lower_bounds(self_param_ty, superbounds, &mut bounds, ty::List::empty(), filter); let where_bounds_that_match = @@ -635,7 +634,7 @@ pub(super) fn implied_predicates_with_filter<'tcx>( // Combine the two lists to form the complete set of superbounds: let implied_bounds = - &*tcx.arena.alloc_from_iter(bounds.clauses().chain(where_bounds_that_match)); + &*tcx.arena.alloc_from_iter(bounds.into_iter().chain(where_bounds_that_match)); debug!(?implied_bounds); // Now require that immediate supertraits are lowered, which will, in @@ -904,7 +903,7 @@ impl<'tcx> ItemCtxt<'tcx> { param_def_id: LocalDefId, filter: PredicateFilter, ) -> Vec<(ty::Clause<'tcx>, Span)> { - let mut bounds = Bounds::default(); + let mut bounds = Vec::new(); for predicate in hir_generics.predicates { let hir_id = predicate.hir_id; @@ -938,7 +937,7 @@ impl<'tcx> ItemCtxt<'tcx> { ); } - bounds.clauses().collect() + bounds } } @@ -1007,7 +1006,7 @@ pub(super) fn const_conditions<'tcx>( }; let icx = ItemCtxt::new(tcx, def_id); - let mut bounds = Bounds::default(); + let mut bounds = Vec::new(); for pred in generics.predicates { match pred.kind { @@ -1027,12 +1026,12 @@ pub(super) fn const_conditions<'tcx>( } if let Some((def_id, supertraits)) = trait_def_id_and_supertraits { - bounds.push_const_bound( - tcx, - ty::Binder::dummy(ty::TraitRef::identity(tcx, def_id.to_def_id())), - ty::BoundConstness::Maybe, + // We've checked above that the trait is conditionally const. + bounds.push(( + ty::Binder::dummy(ty::TraitRef::identity(tcx, def_id.to_def_id())) + .to_host_effect_clause(tcx, ty::BoundConstness::Maybe), DUMMY_SP, - ); + )); icx.lowerer().lower_bounds( tcx.types.self_param, @@ -1045,7 +1044,7 @@ pub(super) fn const_conditions<'tcx>( ty::ConstConditions { parent: has_parent.then(|| tcx.local_parent(def_id).to_def_id()), - predicates: tcx.arena.alloc_from_iter(bounds.clauses().map(|(clause, span)| { + predicates: tcx.arena.alloc_from_iter(bounds.into_iter().map(|(clause, span)| { ( clause.kind().map_bound(|clause| match clause { ty::ClauseKind::HostEffect(ty::HostEffectPredicate { diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs index c03a1f6240f..5a8a2f1fe28 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -422,12 +422,12 @@ enum NonLifetimeBinderAllowed { impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_nested_body(&mut self, body: hir::BodyId) { - let body = self.tcx.hir().body(body); + let body = self.tcx.hir_body(body); self.with(Scope::Body { id: body.id(), s: self.scope }, |this| { this.visit_body(body); }); @@ -1049,7 +1049,7 @@ fn object_lifetime_default(tcx: TyCtxt<'_>, param_def_id: LocalDefId) -> ObjectL match param.source { hir::GenericParamSource::Generics => { let parent_def_id = tcx.local_parent(param_def_id); - let generics = tcx.hir().get_generics(parent_def_id).unwrap(); + let generics = tcx.hir_get_generics(parent_def_id).unwrap(); let param_hir_id = tcx.local_def_id_to_hir_id(param_def_id); let param = generics.params.iter().find(|p| p.hir_id == param_hir_id).unwrap(); @@ -1250,7 +1250,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { if let Some(hir::PredicateOrigin::ImplTrait) = where_bound_origin && let hir::LifetimeName::Param(param_id) = lifetime_ref.res && let Some(generics) = - self.tcx.hir().get_generics(self.tcx.local_parent(param_id)) + self.tcx.hir_get_generics(self.tcx.local_parent(param_id)) && let Some(param) = generics.params.iter().find(|p| p.def_id == param_id) && param.is_elided_lifetime() && !self.tcx.asyncness(lifetime_ref.hir_id.owner.def_id).is_async() @@ -1264,7 +1264,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { ); if let Some(generics) = - self.tcx.hir().get_generics(lifetime_ref.hir_id.owner.def_id) + self.tcx.hir_get_generics(lifetime_ref.hir_id.owner.def_id) { let new_param_sugg = if let Some(span) = generics.span_for_lifetime_suggestion() { @@ -2266,7 +2266,7 @@ fn is_late_bound_map( owner_id: hir::OwnerId, ) -> Option<&FxIndexSet<hir::ItemLocalId>> { let sig = tcx.hir().fn_sig_by_hir_id(owner_id.into())?; - let generics = tcx.hir().get_generics(owner_id.def_id)?; + let generics = tcx.hir_get_generics(owner_id.def_id)?; let mut late_bound = FxIndexSet::default(); diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 4e12db190fd..293a095b41d 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -451,7 +451,7 @@ fn infer_placeholder_type<'tcx>( ); } else { with_forced_trimmed_paths!(err.span_note( - tcx.hir().body(body_id).value.span, + tcx.hir_body(body_id).value.span, format!("however, the inferred type `{ty}` cannot be named"), )); } @@ -494,7 +494,7 @@ fn infer_placeholder_type<'tcx>( ); } else { with_forced_trimmed_paths!(diag.span_note( - tcx.hir().body(body_id).value.span, + tcx.hir_body(body_id).value.span, format!("however, the inferred type `{ty}` cannot be named"), )); } diff --git a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs index e2b9fe0f9f7..88d4acbdd8d 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs @@ -298,8 +298,8 @@ impl TaitConstraintLocator<'_> { impl<'tcx> intravisit::Visitor<'tcx> for TaitConstraintLocator<'tcx> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) { if let hir::ExprKind::Closure(closure) = ex.kind { @@ -441,8 +441,8 @@ impl RpitConstraintChecker<'_> { impl<'tcx> intravisit::Visitor<'tcx> for RpitConstraintChecker<'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) { if let hir::ExprKind::Closure(closure) = ex.kind { diff --git a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs index b2501d647a5..681e8e36d58 100644 --- a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs @@ -451,7 +451,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { ) }); - let fn_sig = self.tcx.hir().get_if_local(self.def_id).and_then(hir::Node::fn_sig); + let fn_sig = self.tcx.hir_get_if_local(self.def_id).and_then(hir::Node::fn_sig); let is_used_in_input = |def_id| { fn_sig.is_some_and(|fn_sig| { fn_sig.decl.inputs.iter().any(|ty| match ty.kind { diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs index ef6167907b5..75c97001c32 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs @@ -8,7 +8,7 @@ use rustc_hir::HirId; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_middle::bug; -use rustc_middle::ty::{self as ty, IsSuggestable, Ty, TyCtxt}; +use rustc_middle::ty::{self as ty, IsSuggestable, Ty, TyCtxt, Upcast}; use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym}; use rustc_trait_selection::traits; use rustc_type_ir::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor}; @@ -16,7 +16,6 @@ use smallvec::SmallVec; use tracing::{debug, instrument}; use super::errors::GenericsArgsErrExtend; -use crate::bounds::Bounds; use crate::errors; use crate::hir_ty_lowering::{ AssocItemQSelf, FeedConstTy, HirTyLowerer, PredicateFilter, RegionInferReason, @@ -28,7 +27,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { /// Doesn't add the bound if the HIR bounds contain any of `Sized`, `?Sized` or `!Sized`. pub(crate) fn add_sized_bound( &self, - bounds: &mut Bounds<'tcx>, + bounds: &mut Vec<(ty::Clause<'tcx>, Span)>, self_ty: Ty<'tcx>, hir_bounds: &'tcx [hir::GenericBound<'tcx>], self_ty_where_predicates: Option<(LocalDefId, &'tcx [hir::WherePredicate<'tcx>])>, @@ -113,10 +112,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { if seen_sized_unbound || seen_negative_sized_bound || seen_positive_sized_bound { // There was in fact a `?Sized`, `!Sized` or explicit `Sized` bound; // we don't need to do anything. - } else if sized_def_id.is_some() { + } else if let Some(sized_def_id) = sized_def_id { // There was no `?Sized`, `!Sized` or explicit `Sized` bound; // add `Sized` if it's available. - bounds.push_sized(tcx, self_ty, span); + let trait_ref = ty::TraitRef::new(tcx, sized_def_id, [self_ty]); + // Preferable to put this obligation first, since we report better errors for sized ambiguity. + bounds.insert(0, (trait_ref.upcast(tcx), span)); } } @@ -146,7 +147,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { &self, param_ty: Ty<'tcx>, hir_bounds: I, - bounds: &mut Bounds<'tcx>, + bounds: &mut Vec<(ty::Clause<'tcx>, Span)>, bound_vars: &'tcx ty::List<ty::BoundVariableKind>, predicate_filter: PredicateFilter, ) where @@ -189,14 +190,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } let region = self.lower_lifetime(lifetime, RegionInferReason::OutlivesBound); - bounds.push_region_bound( - self.tcx(), - ty::Binder::bind_with_vars( - ty::OutlivesPredicate(param_ty, region), - bound_vars, - ), - lifetime.ident.span, + let bound = ty::Binder::bind_with_vars( + ty::ClauseKind::TypeOutlives(ty::OutlivesPredicate(param_ty, region)), + bound_vars, ); + bounds.push((bound.upcast(self.tcx()), lifetime.ident.span)); } hir::GenericBound::Use(..) => { // We don't actually lower `use` into the type layer. @@ -219,7 +217,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { hir_ref_id: hir::HirId, trait_ref: ty::PolyTraitRef<'tcx>, constraint: &hir::AssocItemConstraint<'tcx>, - bounds: &mut Bounds<'tcx>, + bounds: &mut Vec<(ty::Clause<'tcx>, Span)>, duplicates: &mut FxIndexMap<DefId, Span>, path_span: Span, predicate_filter: PredicateFilter, @@ -389,14 +387,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { PredicateFilter::All | PredicateFilter::SelfOnly | PredicateFilter::SelfAndAssociatedTypeBounds => { - bounds.push_projection_bound( - tcx, - projection_term.map_bound(|projection_term| ty::ProjectionPredicate { + let bound = projection_term.map_bound(|projection_term| { + ty::ClauseKind::Projection(ty::ProjectionPredicate { projection_term, term, - }), - constraint.span, - ); + }) + }); + bounds.push((bound.upcast(tcx), constraint.span)); } // SelfTraitThatDefines is only interested in trait predicates. PredicateFilter::SelfTraitThatDefines(_) => {} diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs index a8b37fa5054..830dca0d3cd 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs @@ -17,7 +17,6 @@ use smallvec::{SmallVec, smallvec}; use tracing::{debug, instrument}; use super::HirTyLowerer; -use crate::bounds::Bounds; use crate::hir_ty_lowering::{ GenericArgCountMismatch, GenericArgCountResult, PredicateFilter, RegionInferReason, }; @@ -36,7 +35,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { let tcx = self.tcx(); let dummy_self = tcx.types.trait_object_dummy_self; - let mut user_written_bounds = Bounds::default(); + let mut user_written_bounds = Vec::new(); let mut potential_assoc_types = Vec::new(); for trait_bound in hir_bounds.iter() { if let hir::BoundPolarity::Maybe(_) = trait_bound.modifiers.polarity { @@ -60,15 +59,17 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } let (trait_bounds, mut projection_bounds) = - traits::expand_trait_aliases(tcx, user_written_bounds.clauses()); + traits::expand_trait_aliases(tcx, user_written_bounds.iter().copied()); let (regular_traits, mut auto_traits): (Vec<_>, Vec<_>) = trait_bounds .into_iter() .partition(|(trait_ref, _)| !tcx.trait_is_auto(trait_ref.def_id())); // We don't support empty trait objects. if regular_traits.is_empty() && auto_traits.is_empty() { - let guar = - self.report_trait_object_with_no_traits_error(span, user_written_bounds.clauses()); + let guar = self.report_trait_object_with_no_traits_error( + span, + user_written_bounds.iter().copied(), + ); return Ty::new_error(tcx, guar); } // We don't support >1 principal @@ -84,7 +85,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { // Check that there are no gross dyn-compatibility violations; // most importantly, that the supertraits don't contain `Self`, // to avoid ICEs. - for (clause, span) in user_written_bounds.clauses() { + for (clause, span) in user_written_bounds { if let Some(trait_pred) = clause.as_trait_clause() { let violations = hir_ty_lowering_dyn_compatibility_violations(tcx, trait_pred.def_id()); diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs index 7eb982a3179..d2789cc0fd6 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs @@ -225,7 +225,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { && let item_def_id = tcx.hir().get_parent_item(tcx.local_def_id_to_hir_id(ty_param_def_id)) // FIXME: ...which obviously won't have any generics. - && let Some(generics) = tcx.hir().get_generics(item_def_id.def_id) + && let Some(generics) = tcx.hir_get_generics(item_def_id.def_id) { // FIXME: Suggest adding supertrait bounds if we have a `Self` type param. // FIXME(trait_alias): Suggest adding `Self: Trait` to diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs index 43137397870..cc28b8780c6 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs @@ -110,7 +110,7 @@ fn generic_arg_mismatch_err( err.help(format!("`{}` is a function item, not a type", tcx.item_name(id))); err.help("function item types cannot be named directly"); } else if let hir::ConstArgKind::Anon(anon) = cnst.kind - && let body = tcx.hir().body(anon.body) + && let body = tcx.hir_body(anon.body) && let rustc_hir::ExprKind::Path(rustc_hir::QPath::Resolved(_, path)) = body.value.kind && let Res::Def(DefKind::Fn { .. }, id) = path.res diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 88323db6dda..7dce8b9b60f 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -49,9 +49,9 @@ use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw}; use rustc_trait_selection::infer::InferCtxtExt; use rustc_trait_selection::traits::wf::object_region_bounds; use rustc_trait_selection::traits::{self, ObligationCtxt}; +use rustc_type_ir::Upcast; use tracing::{debug, instrument}; -use crate::bounds::Bounds; use crate::check::check_abi_fn_ptr; use crate::errors::{AmbiguousLifetimeBound, BadReturnTypeNotation, InvalidBaseType}; use crate::hir_ty_lowering::errors::{GenericsArgsErrExtend, prohibit_assoc_item_constraint}; @@ -691,7 +691,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { constness: hir::BoundConstness, polarity: hir::BoundPolarity, self_ty: Ty<'tcx>, - bounds: &mut Bounds<'tcx>, + bounds: &mut Vec<(ty::Clause<'tcx>, Span)>, predicate_filter: PredicateFilter, ) -> GenericArgCountResult { let trait_def_id = trait_ref.trait_def_id().unwrap_or_else(|| FatalError.raise()); @@ -720,6 +720,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { bound_vars, ); + debug!(?poly_trait_ref); + let polarity = match polarity { rustc_ast::BoundPolarity::Positive => ty::PredicatePolarity::Positive, rustc_ast::BoundPolarity::Negative(_) => ty::PredicatePolarity::Negative, @@ -741,6 +743,26 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } }; + // We deal with const conditions later. + match predicate_filter { + PredicateFilter::All + | PredicateFilter::SelfOnly + | PredicateFilter::SelfTraitThatDefines(..) + | PredicateFilter::SelfAndAssociatedTypeBounds => { + let bound = poly_trait_ref.map_bound(|trait_ref| { + ty::ClauseKind::Trait(ty::TraitPredicate { trait_ref, polarity }) + }); + let bound = (bound.upcast(tcx), span); + // FIXME(-Znext-solver): We can likely remove this hack once the new trait solver lands. + if tcx.is_lang_item(trait_def_id, rustc_hir::LangItem::Sized) { + bounds.insert(0, bound); + } else { + bounds.push(bound); + } + } + PredicateFilter::ConstIfConst | PredicateFilter::SelfConstIfConst => {} + } + if let hir::BoundConstness::Always(span) | hir::BoundConstness::Maybe(span) = constness && !self.tcx().is_const_trait(trait_def_id) { @@ -765,58 +787,53 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { suggestion_pre, suggestion, }); - } - - match predicate_filter { - // This is only concerned with trait predicates. - PredicateFilter::SelfTraitThatDefines(..) => { - bounds.push_trait_bound(tcx, poly_trait_ref, span, polarity); - } - PredicateFilter::All - | PredicateFilter::SelfOnly - | PredicateFilter::SelfAndAssociatedTypeBounds => { - debug!(?poly_trait_ref); - bounds.push_trait_bound(tcx, poly_trait_ref, span, polarity); - - match constness { - hir::BoundConstness::Always(span) => { - if polarity == ty::PredicatePolarity::Positive { - bounds.push_const_bound( - tcx, - poly_trait_ref, - ty::BoundConstness::Const, - span, - ); + } else { + match predicate_filter { + // This is only concerned with trait predicates. + PredicateFilter::SelfTraitThatDefines(..) => {} + PredicateFilter::All + | PredicateFilter::SelfOnly + | PredicateFilter::SelfAndAssociatedTypeBounds => { + match constness { + hir::BoundConstness::Always(span) => { + if polarity == ty::PredicatePolarity::Positive { + bounds.push(( + poly_trait_ref + .to_host_effect_clause(tcx, ty::BoundConstness::Const), + span, + )); + } } + hir::BoundConstness::Maybe(_) => { + // We don't emit a const bound here, since that would mean that we + // unconditionally need to prove a `HostEffect` predicate, even when + // the predicates are being instantiated in a non-const context. This + // is instead handled in the `const_conditions` query. + } + hir::BoundConstness::Never => {} } - hir::BoundConstness::Maybe(_) => { - // We don't emit a const bound here, since that would mean that we - // unconditionally need to prove a `HostEffect` predicate, even when - // the predicates are being instantiated in a non-const context. This - // is instead handled in the `const_conditions` query. - } - hir::BoundConstness::Never => {} } - } - // On the flip side, when filtering `ConstIfConst` bounds, we only need to convert - // `~const` bounds. All other predicates are handled in their respective queries. - // - // Note that like `PredicateFilter::SelfOnly`, we don't need to do any filtering - // here because we only call this on self bounds, and deal with the recursive case - // in `lower_assoc_item_constraint`. - PredicateFilter::ConstIfConst | PredicateFilter::SelfConstIfConst => match constness { - hir::BoundConstness::Maybe(span) => { - if polarity == ty::PredicatePolarity::Positive { - bounds.push_const_bound( - tcx, - poly_trait_ref, - ty::BoundConstness::Maybe, - span, - ); + // On the flip side, when filtering `ConstIfConst` bounds, we only need to convert + // `~const` bounds. All other predicates are handled in their respective queries. + // + // Note that like `PredicateFilter::SelfOnly`, we don't need to do any filtering + // here because we only call this on self bounds, and deal with the recursive case + // in `lower_assoc_item_constraint`. + PredicateFilter::ConstIfConst | PredicateFilter::SelfConstIfConst => { + match constness { + hir::BoundConstness::Maybe(span) => { + if polarity == ty::PredicatePolarity::Positive { + bounds.push(( + poly_trait_ref + .to_host_effect_clause(tcx, ty::BoundConstness::Maybe), + span, + )); + } + } + hir::BoundConstness::Always(_) | hir::BoundConstness::Never => {} } } - hir::BoundConstness::Always(_) | hir::BoundConstness::Never => {} - }, + } } let mut dup_constraints = FxIndexMap::default(); @@ -1976,7 +1993,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { if let Some(hir::Node::Item(&hir::Item { kind: hir::ItemKind::Impl(impl_), .. - })) = tcx.hir().get_if_local(def_id) + })) = tcx.hir_get_if_local(def_id) { err.span_note(impl_.self_ty.span, "not a concrete type"); } @@ -2213,7 +2230,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { fn lower_anon_const(&self, anon: &AnonConst) -> Const<'tcx> { let tcx = self.tcx(); - let expr = &tcx.hir().body(anon.body).value; + let expr = &tcx.hir_body(anon.body).value; debug!(?expr); let ty = tcx @@ -2382,7 +2399,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { // Impl trait in bindings lower as an infer var with additional // set of type bounds. let self_ty = self.ty_infer(None, hir_ty.span); - let mut bounds = Bounds::default(); + let mut bounds = Vec::new(); self.lower_bounds( self_ty, hir_bounds.iter(), @@ -2390,11 +2407,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { ty::List::empty(), PredicateFilter::All, ); - self.register_trait_ascription_bounds( - bounds.clauses().collect(), - hir_ty.hir_id, - hir_ty.span, - ); + self.register_trait_ascription_bounds(bounds, hir_ty.hir_id, hir_ty.span); self_ty } // If we encounter a type relative path with RTN generics, then it must have diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 8a529e9c686..886360dfb6c 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -80,7 +80,6 @@ This API is completely unstable and subject to change. pub mod check; pub mod autoderef; -mod bounds; mod check_unused; mod coherence; mod collect; diff --git a/compiler/rustc_hir_analysis/src/outlives/dump.rs b/compiler/rustc_hir_analysis/src/outlives/dump.rs index ab50d9e86ef..4233896c372 100644 --- a/compiler/rustc_hir_analysis/src/outlives/dump.rs +++ b/compiler/rustc_hir_analysis/src/outlives/dump.rs @@ -3,7 +3,7 @@ use rustc_middle::ty::{self, TyCtxt}; use rustc_span::sym; pub(crate) fn inferred_outlives(tcx: TyCtxt<'_>) { - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { if !tcx.has_attr(id.owner_id, sym::rustc_outlives) { continue; } diff --git a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs index 036163b9f14..a0faa5e8429 100644 --- a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs +++ b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs @@ -28,7 +28,7 @@ pub(super) fn infer_predicates( let mut predicates_added = false; // Visit all the crates and infer predicates - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { let item_did = id.owner_id; debug!("InferVisitor::visit_item(item={:?})", item_did); diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 57df3127a02..34124a6aa11 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -24,8 +24,8 @@ use rustc_span::source_map::SourceMap; use rustc_span::{FileName, Ident, Span, Symbol, kw}; use {rustc_ast as ast, rustc_hir as hir}; -pub fn id_to_string(map: &dyn rustc_hir::intravisit::Map<'_>, hir_id: HirId) -> String { - to_string(&map, |s| s.print_node(map.hir_node(hir_id))) +pub fn id_to_string(cx: &dyn rustc_hir::intravisit::HirTyCtxt<'_>, hir_id: HirId) -> String { + to_string(&cx, |s| s.print_node(cx.hir_node(hir_id))) } pub enum AnnNode<'a> { @@ -54,15 +54,15 @@ pub trait PpAnn { fn post(&self, _state: &mut State<'_>, _node: AnnNode<'_>) {} } -impl PpAnn for &dyn rustc_hir::intravisit::Map<'_> { +impl PpAnn for &dyn rustc_hir::intravisit::HirTyCtxt<'_> { fn nested(&self, state: &mut State<'_>, nested: Nested) { match nested { - Nested::Item(id) => state.print_item(self.item(id)), - Nested::TraitItem(id) => state.print_trait_item(self.trait_item(id)), - Nested::ImplItem(id) => state.print_impl_item(self.impl_item(id)), - Nested::ForeignItem(id) => state.print_foreign_item(self.foreign_item(id)), - Nested::Body(id) => state.print_expr(self.body(id).value), - Nested::BodyParamPat(id, i) => state.print_pat(self.body(id).params[i].pat), + Nested::Item(id) => state.print_item(self.hir_item(id)), + Nested::TraitItem(id) => state.print_trait_item(self.hir_trait_item(id)), + Nested::ImplItem(id) => state.print_impl_item(self.hir_impl_item(id)), + Nested::ForeignItem(id) => state.print_foreign_item(self.hir_foreign_item(id)), + Nested::Body(id) => state.print_expr(self.hir_body(id).value), + Nested::BodyParamPat(id, i) => state.print_pat(self.hir_body(id).params[i].pat), } } } diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index f2d0b911731..bccde782264 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -708,8 +708,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && let Res::Local(_) = path.res && let [segment] = &path.segments { - for id in self.tcx.hir().items() { - if let Some(node) = self.tcx.hir().get_if_local(id.owner_id.into()) + for id in self.tcx.hir_free_items() { + if let Some(node) = self.tcx.hir_get_if_local(id.owner_id.into()) && let hir::Node::Item(item) = node && let hir::ItemKind::Fn { .. } = item.kind && item.ident.name == segment.ident.name diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index 43124f44ca6..71a0664bbdf 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -51,7 +51,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expected: Expectation<'tcx>, ) -> Ty<'tcx> { let tcx = self.tcx; - let body = tcx.hir().body(closure.body); + let body = tcx.hir_body(closure.body); let expr_def_id = closure.def_id; // It's always helpful for inference if we know the kind of diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index ad378367e30..c8433d0cb5b 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -1891,7 +1891,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { kind: hir::ExprKind::Closure(&hir::Closure { body, .. }), .. }) = parent - && !matches!(fcx.tcx.hir().body(body).value.kind, hir::ExprKind::Block(..)) + && !matches!(fcx.tcx.hir_body(body).value.kind, hir::ExprKind::Block(..)) { fcx.suggest_missing_semicolon(&mut err, expr, expected, true); } diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index 85e949952f8..2f7f9148023 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -727,7 +727,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ident, kind: hir::ItemKind::Static(ty, ..) | hir::ItemKind::Const(ty, ..), .. - })) = self.tcx.hir().get_if_local(*def_id) + })) = self.tcx.hir_get_if_local(*def_id) { primary_span = ty.span; secondary_span = ident.span; @@ -1173,7 +1173,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(hir::Impl { self_ty, .. }), .. - })) = self.tcx.hir().get_if_local(*alias_to) + })) = self.tcx.hir_get_if_local(*alias_to) { err.span_label(self_ty.span, "this is the type of the `Self` literal"); } diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 9ccd6746087..a41ad94f95e 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -1801,7 +1801,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { block: &'tcx hir::ConstBlock, expected: Expectation<'tcx>, ) -> Ty<'tcx> { - let body = self.tcx.hir().body(block.body); + let body = self.tcx.hir_body(block.body); // Create a new function context. let def_id = block.def_id; diff --git a/compiler/rustc_hir_typeck/src/fallback.rs b/compiler/rustc_hir_typeck/src/fallback.rs index 4618c5d3849..ce6f7420e5b 100644 --- a/compiler/rustc_hir_typeck/src/fallback.rs +++ b/compiler/rustc_hir_typeck/src/fallback.rs @@ -687,7 +687,7 @@ impl<'tcx> Visitor<'tcx> for AnnotateUnitFallbackVisitor<'_, 'tcx> { if let hir::ExprKind::Closure(&hir::Closure { body, .. }) | hir::ExprKind::ConstBlock(hir::ConstBlock { body, .. }) = expr.kind { - self.visit_body(self.fcx.tcx.hir().body(body))?; + self.visit_body(self.fcx.tcx.hir_body(body))?; } // Try to suggest adding an explicit qself `()` to a trait method path. diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 1113f7f7095..ff41a080d62 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -640,7 +640,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let witness = Ty::new_coroutine_witness(self.tcx, expr_def_id.to_def_id(), args); // Unify `interior` with `witness` and collect all the resulting obligations. - let span = self.tcx.hir().body(body_id).value.span; + let span = self.tcx.hir_body(body_id).value.span; let ty::Infer(ty::InferTy::TyVar(_)) = interior.kind() else { span_bug!(span, "coroutine interior witness not infer: {:?}", interior.kind()) }; diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 77081548d11..c0af5ea7bbf 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -2056,7 +2056,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { match node { Node::Item(&hir::Item { kind: hir::ItemKind::Fn { body: body_id, .. }, .. }) | Node::ImplItem(&hir::ImplItem { kind: hir::ImplItemKind::Fn(_, body_id), .. }) => { - let body = self.tcx.hir().body(body_id); + let body = self.tcx.hir_body(body_id); if let ExprKind::Block(block, _) = &body.value.kind { return Some(block.span); } @@ -2512,11 +2512,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } err.span_note(spans, format!("{} defined here", self.tcx.def_descr(def_id))); - } else if let Some(hir::Node::Expr(e)) = self.tcx.hir().get_if_local(def_id) + } else if let Some(hir::Node::Expr(e)) = self.tcx.hir_get_if_local(def_id) && let hir::ExprKind::Closure(hir::Closure { body, .. }) = &e.kind { let param = expected_idx - .and_then(|expected_idx| self.tcx.hir().body(*body).params.get(expected_idx)); + .and_then(|expected_idx| self.tcx.hir_body(*body).params.get(expected_idx)); let (kind, span) = if let Some(param) = param { // Try to find earlier invocations of this closure to find if the type mismatch // is because of inference. If we find one, point at them. @@ -2650,7 +2650,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { is_method: bool, ) -> Option<(IndexVec<ExpectedIdx, (Option<GenericIdx>, FnParam<'_>)>, &hir::Generics<'_>)> { - let (sig, generics, body_id, param_names) = match self.tcx.hir().get_if_local(def_id)? { + let (sig, generics, body_id, param_names) = match self.tcx.hir_get_if_local(def_id)? { hir::Node::TraitItem(&hir::TraitItem { generics, kind: hir::TraitItemKind::Fn(sig, trait_fn), @@ -2695,7 +2695,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { match (body_id, param_names) { (Some(_), Some(_)) | (None, None) => unreachable!(), (Some(body), None) => { - let params = self.tcx.hir().body(body).params; + let params = self.tcx.hir_body(body).params; let params = params.get(is_method as usize..params.len() - sig.decl.c_variadic as usize)?; debug_assert_eq!(params.len(), fn_inputs.len()); @@ -2725,8 +2725,8 @@ struct FindClosureArg<'tcx> { impl<'tcx> Visitor<'tcx> for FindClosureArg<'tcx> { type NestedFilter = rustc_middle::hir::nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) { diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 4ec8d0b1f60..05c76b3c568 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -1813,7 +1813,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); let owner = self.tcx.hir().enclosing_body_owner(expr.hir_id); if let ty::Param(param) = expected_ty.kind() - && let Some(generics) = self.tcx.hir().get_generics(owner) + && let Some(generics) = self.tcx.hir_get_generics(owner) { suggest_constraining_type_params( self.tcx, @@ -1933,7 +1933,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .. } = init { - let hir::Body { value: body_expr, .. } = self.tcx.hir().body(*body_id); + let hir::Body { value: body_expr, .. } = self.tcx.hir_body(*body_id); self.note_type_is_not_clone_inner_expr(body_expr) } else { expr diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index 02fbd46173c..9d5184acb3c 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -123,7 +123,7 @@ fn typeck_with_inspect<'tcx>( let body_id = node.body_id().unwrap_or_else(|| { span_bug!(span, "can't type-check body of {:?}", def_id); }); - let body = tcx.hir().body(body_id); + let body = tcx.hir_body(body_id); let param_env = tcx.param_env(def_id); diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 6c4ad65be6a..1ca8b59db22 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -1091,7 +1091,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { continue; } - match self.tcx.hir().get_if_local(item_def_id) { + match self.tcx.hir_get_if_local(item_def_id) { // Unmet obligation comes from a `derive` macro, point at it once to // avoid multiple span labels pointing at the same place. Some(Node::Item(hir::Item { @@ -3753,19 +3753,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { hir::TraitFn::Required([ident, ..]) => { ident.name == kw::SelfLower } - hir::TraitFn::Provided(body_id) => self - .tcx - .hir() - .body(*body_id) - .params - .first() - .is_some_and(|param| { - matches!( - param.pat.kind, - hir::PatKind::Binding(_, _, ident, _) - if ident.name == kw::SelfLower - ) - }), + hir::TraitFn::Provided(body_id) => { + self.tcx.hir_body(*body_id).params.first().is_some_and( + |param| { + matches!( + param.pat.kind, + hir::PatKind::Binding(_, _, ident, _) + if ident.name == kw::SelfLower + ) + }, + ) + } _ => false, }; @@ -3833,20 +3831,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Some(param) = param_type { let generics = self.tcx.generics_of(self.body_id.to_def_id()); let type_param = generics.type_param(param, self.tcx); - let hir = self.tcx.hir(); + let tcx = self.tcx; if let Some(def_id) = type_param.def_id.as_local() { - let id = self.tcx.local_def_id_to_hir_id(def_id); + let id = tcx.local_def_id_to_hir_id(def_id); // Get the `hir::Param` to verify whether it already has any bounds. // We do this to avoid suggesting code that ends up as `T: FooBar`, // instead we suggest `T: Foo + Bar` in that case. - match self.tcx.hir_node(id) { + match tcx.hir_node(id) { Node::GenericParam(param) => { enum Introducer { Plus, Colon, Nothing, } - let hir_generics = hir.get_generics(id.owner.def_id).unwrap(); + let hir_generics = tcx.hir_get_generics(id.owner.def_id).unwrap(); let trait_def_ids: DefIdSet = hir_generics .bounds_for_param(def_id) .flat_map(|bp| bp.bounds.iter()) @@ -3866,8 +3864,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let candidate_strs: Vec<_> = candidates .iter() .map(|cand| { - let cand_path = self.tcx.def_path_str(cand.def_id); - let cand_params = &self.tcx.generics_of(cand.def_id).own_params; + let cand_path = tcx.def_path_str(cand.def_id); + let cand_params = &tcx.generics_of(cand.def_id).own_params; let cand_args: String = cand_params .iter() .skip(1) @@ -3960,9 +3958,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestions( sp, message(format!("add {article} supertrait for")), - candidates.iter().map(|t| { - format!("{} {}", sep, self.tcx.def_path_str(t.def_id),) - }), + candidates + .iter() + .map(|t| format!("{} {}", sep, tcx.def_path_str(t.def_id),)), Applicability::MaybeIncorrect, ); return; diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 7c2a2b3fdf7..cd07666ca6c 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -1231,7 +1231,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ident: Ident, ) -> bool { match opt_def_id { - Some(def_id) => match self.tcx.hir().get_if_local(def_id) { + Some(def_id) => match self.tcx.hir_get_if_local(def_id) { Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(_, _, body_id), .. diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs index b54e430a9d9..871d08137b3 100644 --- a/compiler/rustc_hir_typeck/src/upvar.rs +++ b/compiler/rustc_hir_typeck/src/upvar.rs @@ -143,7 +143,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InferBorrowKindVisitor<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) { match expr.kind { hir::ExprKind::Closure(&hir::Closure { capture_clause, body: body_id, .. }) => { - let body = self.fcx.tcx.hir().body(body_id); + let body = self.fcx.tcx.hir_body(body_id); self.visit_body(body); self.fcx.analyze_closure(expr.hir_id, expr.span, body_id, body, capture_clause); } @@ -154,7 +154,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InferBorrowKindVisitor<'a, 'tcx> { } fn visit_inline_const(&mut self, c: &'tcx hir::ConstBlock) { - let body = self.fcx.tcx.hir().body(c.body); + let body = self.fcx.tcx.hir_body(c.body); self.visit_body(body); } } diff --git a/compiler/rustc_hir_typeck/src/writeback.rs b/compiler/rustc_hir_typeck/src/writeback.rs index 1bf5b19d68d..dbcf9915790 100644 --- a/compiler/rustc_hir_typeck/src/writeback.rs +++ b/compiler/rustc_hir_typeck/src/writeback.rs @@ -249,7 +249,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { fn visit_const_block(&mut self, span: Span, anon_const: &hir::ConstBlock) { self.visit_node_id(span, anon_const.hir_id); - let body = self.tcx().hir().body(anon_const.body); + let body = self.tcx().hir_body(anon_const.body); self.visit_body(body); } } @@ -266,7 +266,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> { fn visit_expr(&mut self, e: &'tcx hir::Expr<'tcx>) { match e.kind { hir::ExprKind::Closure(&hir::Closure { body, .. }) => { - let body = self.fcx.tcx.hir().body(body); + let body = self.fcx.tcx.hir_body(body); for param in body.params { self.visit_node_id(e.span, param.hir_id); } diff --git a/compiler/rustc_incremental/src/assert_dep_graph.rs b/compiler/rustc_incremental/src/assert_dep_graph.rs index 569034954c3..c2f9ebc5262 100644 --- a/compiler/rustc_incremental/src/assert_dep_graph.rs +++ b/compiler/rustc_incremental/src/assert_dep_graph.rs @@ -174,8 +174,8 @@ impl<'tcx> IfThisChanged<'tcx> { impl<'tcx> Visitor<'tcx> for IfThisChanged<'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs index 30590bf5d3c..a95599e7a86 100644 --- a/compiler/rustc_incremental/src/persist/dirty_clean.rs +++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs @@ -455,8 +455,8 @@ impl<'tcx> FindAllAttrs<'tcx> { impl<'tcx> intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_attribute(&mut self, attr: &'tcx Attribute) { diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index 4ea171ab4a9..19cca48af61 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -117,8 +117,9 @@ use rustc_data_structures::{base_n, flock}; use rustc_fs_util::{LinkOrCopy, link_or_copy, try_canonicalize}; use rustc_middle::bug; use rustc_session::config::CrateType; -use rustc_session::output::{collect_crate_types, find_crate_name}; +use rustc_session::output::collect_crate_types; use rustc_session::{Session, StableCrateId}; +use rustc_span::Symbol; use tracing::debug; use crate::errors; @@ -211,7 +212,7 @@ pub fn in_incr_comp_dir(incr_comp_session_dir: &Path, file_name: &str) -> PathBu /// The garbage collection will take care of it. /// /// [`rustc_interface::queries::dep_graph`]: ../../rustc_interface/struct.Queries.html#structfield.dep_graph -pub(crate) fn prepare_session_directory(sess: &Session) { +pub(crate) fn prepare_session_directory(sess: &Session, crate_name: Symbol) { if sess.opts.incremental.is_none() { return; } @@ -221,7 +222,7 @@ pub(crate) fn prepare_session_directory(sess: &Session) { debug!("prepare_session_directory"); // {incr-comp-dir}/{crate-name-and-disambiguator} - let crate_dir = crate_path(sess); + let crate_dir = crate_path(sess, crate_name); debug!("crate-dir: {}", crate_dir.display()); create_dir(sess, &crate_dir, "crate"); @@ -594,10 +595,9 @@ fn string_to_timestamp(s: &str) -> Result<SystemTime, &'static str> { Ok(UNIX_EPOCH + duration) } -fn crate_path(sess: &Session) -> PathBuf { +fn crate_path(sess: &Session, crate_name: Symbol) -> PathBuf { let incr_dir = sess.opts.incremental.as_ref().unwrap().clone(); - let crate_name = find_crate_name(sess, &[]); let crate_types = collect_crate_types(sess, &[]); let stable_crate_id = StableCrateId::new( crate_name, diff --git a/compiler/rustc_incremental/src/persist/load.rs b/compiler/rustc_incremental/src/persist/load.rs index 48df84f3d09..7977bcc6891 100644 --- a/compiler/rustc_incremental/src/persist/load.rs +++ b/compiler/rustc_incremental/src/persist/load.rs @@ -11,6 +11,7 @@ use rustc_serialize::Decodable; use rustc_serialize::opaque::MemDecoder; use rustc_session::Session; use rustc_session::config::IncrementalStateAssertion; +use rustc_span::Symbol; use tracing::{debug, warn}; use super::data::*; @@ -203,9 +204,9 @@ pub fn load_query_result_cache(sess: &Session) -> Option<OnDiskCache> { /// Setups the dependency graph by loading an existing graph from disk and set up streaming of a /// new graph to an incremental session directory. -pub fn setup_dep_graph(sess: &Session) -> DepGraph { +pub fn setup_dep_graph(sess: &Session, crate_name: Symbol) -> DepGraph { // `load_dep_graph` can only be called after `prepare_session_directory`. - prepare_session_directory(sess); + prepare_session_directory(sess, crate_name); let res = sess.opts.build_dep_graph().then(|| load_dep_graph(sess)); diff --git a/compiler/rustc_interface/messages.ftl b/compiler/rustc_interface/messages.ftl index 31123625369..adc7ed54e14 100644 --- a/compiler/rustc_interface/messages.ftl +++ b/compiler/rustc_interface/messages.ftl @@ -6,6 +6,10 @@ interface_abi_required_feature_issue = for more information, see issue #116344 < interface_cant_emit_mir = could not emit MIR: {$error} +interface_crate_name_does_not_match = `--crate-name` and `#[crate_name]` are required to match, but `{$crate_name}` != `{$attr_crate_name}` + +interface_crate_name_invalid = crate names cannot start with a `-`, but `{$crate_name}` has a leading hyphen + interface_emoji_identifier = identifiers cannot contain emoji: `{$ident}` @@ -29,6 +33,10 @@ interface_ignoring_out_dir = ignoring --out-dir flag due to -o flag interface_input_file_would_be_overwritten = the input file "{$path}" would be overwritten by the generated executable +interface_limit_invalid = + `limit` must be a non-negative integer + .label = {$error_str} + interface_mixed_bin_crate = cannot mix `bin` crate type with others diff --git a/compiler/rustc_interface/src/errors.rs b/compiler/rustc_interface/src/errors.rs index b62950d6709..ca4e556dcdb 100644 --- a/compiler/rustc_interface/src/errors.rs +++ b/compiler/rustc_interface/src/errors.rs @@ -5,6 +5,21 @@ use rustc_macros::Diagnostic; use rustc_span::{Span, Symbol}; #[derive(Diagnostic)] +#[diag(interface_crate_name_does_not_match)] +pub(crate) struct CrateNameDoesNotMatch { + #[primary_span] + pub(crate) span: Span, + pub(crate) crate_name: Symbol, + pub(crate) attr_crate_name: Symbol, +} + +#[derive(Diagnostic)] +#[diag(interface_crate_name_invalid)] +pub(crate) struct CrateNameInvalid<'a> { + pub(crate) crate_name: &'a str, +} + +#[derive(Diagnostic)] #[diag(interface_ferris_identifier)] pub struct FerrisIdentifier { #[primary_span] @@ -112,3 +127,13 @@ pub(crate) struct AbiRequiredTargetFeature<'a> { pub feature: &'a str, pub enabled: &'a str, } + +#[derive(Diagnostic)] +#[diag(interface_limit_invalid)] +pub(crate) struct LimitInvalid<'a> { + #[primary_span] + pub span: Span, + #[label] + pub value_span: Span, + pub error_str: &'a str, +} diff --git a/compiler/rustc_interface/src/lib.rs b/compiler/rustc_interface/src/lib.rs index a2a29612e48..54cd341698f 100644 --- a/compiler/rustc_interface/src/lib.rs +++ b/compiler/rustc_interface/src/lib.rs @@ -10,6 +10,7 @@ mod callbacks; pub mod errors; pub mod interface; +mod limits; pub mod passes; mod proc_macro_decls; mod queries; diff --git a/compiler/rustc_middle/src/middle/limits.rs b/compiler/rustc_interface/src/limits.rs index 8a367a947d1..3de513797e3 100644 --- a/compiler/rustc_middle/src/middle/limits.rs +++ b/compiler/rustc_interface/src/limits.rs @@ -1,61 +1,58 @@ //! Registering limits: -//! * recursion_limit, -//! * move_size_limit, and -//! * type_length_limit +//! - recursion_limit: there are various parts of the compiler that must impose arbitrary limits +//! on how deeply they recurse to prevent stack overflow. +//! - move_size_limit +//! - type_length_limit +//! - pattern_complexity_limit //! -//! There are various parts of the compiler that must impose arbitrary limits -//! on how deeply they recurse to prevent stack overflow. Users can override -//! this via an attribute on the crate like `#![recursion_limit="22"]`. This pass -//! just peeks and looks for that attribute. +//! Users can override these limits via an attribute on the crate like +//! `#![recursion_limit="22"]`. This pass just looks for those attributes. use std::num::IntErrorKind; use rustc_ast::attr::AttributeExt; +use rustc_middle::bug; +use rustc_middle::query::Providers; use rustc_session::{Limit, Limits, Session}; use rustc_span::{Symbol, sym}; -use crate::error::LimitInvalid; -use crate::query::Providers; +use crate::errors::LimitInvalid; -pub fn provide(providers: &mut Providers) { +pub(crate) fn provide(providers: &mut Providers) { providers.limits = |tcx, ()| Limits { recursion_limit: get_recursion_limit(tcx.hir().krate_attrs(), tcx.sess), move_size_limit: get_limit( tcx.hir().krate_attrs(), tcx.sess, sym::move_size_limit, - tcx.sess.opts.unstable_opts.move_size_limit.unwrap_or(0), + Limit::new(tcx.sess.opts.unstable_opts.move_size_limit.unwrap_or(0)), ), type_length_limit: get_limit( tcx.hir().krate_attrs(), tcx.sess, sym::type_length_limit, - 2usize.pow(24), + Limit::new(2usize.pow(24)), + ), + pattern_complexity_limit: get_limit( + tcx.hir().krate_attrs(), + tcx.sess, + sym::pattern_complexity_limit, + Limit::unlimited(), ), } } -pub fn get_recursion_limit(krate_attrs: &[impl AttributeExt], sess: &Session) -> Limit { - get_limit(krate_attrs, sess, sym::recursion_limit, 128) +// This one is separate because it must be read prior to macro expansion. +pub(crate) fn get_recursion_limit(krate_attrs: &[impl AttributeExt], sess: &Session) -> Limit { + get_limit(krate_attrs, sess, sym::recursion_limit, Limit::new(128)) } fn get_limit( krate_attrs: &[impl AttributeExt], sess: &Session, name: Symbol, - default: usize, + default: Limit, ) -> Limit { - match get_limit_size(krate_attrs, sess, name) { - Some(size) => Limit::new(size), - None => Limit::new(default), - } -} - -pub fn get_limit_size( - krate_attrs: &[impl AttributeExt], - sess: &Session, - name: Symbol, -) -> Option<usize> { for attr in krate_attrs { if !attr.has_name(name) { continue; @@ -63,7 +60,7 @@ pub fn get_limit_size( if let Some(sym) = attr.value_str() { match sym.as_str().parse() { - Ok(n) => return Some(n), + Ok(n) => return Limit::new(n), Err(e) => { let error_str = match e.kind() { IntErrorKind::PosOverflow => "`limit` is too large", @@ -84,5 +81,5 @@ pub fn get_limit_size( } } } - None + default } diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index e5adcdb244f..d7d183e17ed 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -28,16 +28,18 @@ use rustc_passes::{abi_test, input_stats, layout_test}; use rustc_resolve::Resolver; use rustc_session::config::{CrateType, Input, OutFileName, OutputFilenames, OutputType}; use rustc_session::cstore::Untracked; -use rustc_session::output::{collect_crate_types, filename_for_input, find_crate_name}; +use rustc_session::output::{collect_crate_types, filename_for_input}; use rustc_session::search_paths::PathKind; use rustc_session::{Limit, Session}; -use rustc_span::{ErrorGuaranteed, FileName, SourceFileHash, SourceFileHashAlgorithm, Symbol, sym}; +use rustc_span::{ + ErrorGuaranteed, FileName, SourceFileHash, SourceFileHashAlgorithm, Span, Symbol, sym, +}; use rustc_target::spec::PanicStrategy; use rustc_trait_selection::traits; use tracing::{info, instrument}; use crate::interface::Compiler; -use crate::{errors, proc_macro_decls, util}; +use crate::{errors, limits, proc_macro_decls, util}; pub fn parse<'a>(sess: &'a Session) -> ast::Crate { let krate = sess @@ -685,6 +687,7 @@ pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| { |tcx, _| tcx.arena.alloc_from_iter(tcx.resolutions(()).stripped_cfg_items.steal()); providers.resolutions = |tcx, ()| tcx.resolver_for_lowering_raw(()).1; providers.early_lint_checks = early_lint_checks; + limits::provide(providers); proc_macro_decls::provide(providers); rustc_const_eval::provide(providers); rustc_middle::hir::provide(providers); @@ -725,8 +728,7 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>( let pre_configured_attrs = rustc_expand::config::pre_configure_attrs(sess, &krate.attrs); - // parse `#[crate_name]` even if `--crate-name` was passed, to make sure it matches. - let crate_name = find_crate_name(sess, &pre_configured_attrs); + let crate_name = get_crate_name(sess, &pre_configured_attrs); let crate_types = collect_crate_types(sess, &pre_configured_attrs); let stable_crate_id = StableCrateId::new( crate_name, @@ -735,7 +737,7 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>( sess.cfg_version, ); let outputs = util::build_output_filenames(&pre_configured_attrs, sess); - let dep_graph = setup_dep_graph(sess); + let dep_graph = setup_dep_graph(sess, crate_name); let cstore = FreezeLock::new(Box::new(CStore::new(compiler.codegen_backend.metadata_loader())) as _); @@ -1080,23 +1082,85 @@ pub(crate) fn start_codegen<'tcx>( codegen } -fn get_recursion_limit(krate_attrs: &[ast::Attribute], sess: &Session) -> Limit { - if let Some(attr) = krate_attrs - .iter() - .find(|attr| attr.has_name(sym::recursion_limit) && attr.value_str().is_none()) +/// Compute and validate the crate name. +pub fn get_crate_name(sess: &Session, krate_attrs: &[ast::Attribute]) -> Symbol { + // We validate *all* occurrences of `#![crate_name]`, pick the first find and + // if a crate name was passed on the command line via `--crate-name` we enforce + // that they match. + // We perform the validation step here instead of later to ensure it gets run + // in all code paths that require the crate name very early on, namely before + // macro expansion. + + let attr_crate_name = + validate_and_find_value_str_builtin_attr(sym::crate_name, sess, krate_attrs); + + let validate = |name, span| { + rustc_session::output::validate_crate_name(sess, name, span); + name + }; + + if let Some(crate_name) = &sess.opts.crate_name { + let crate_name = Symbol::intern(crate_name); + if let Some((attr_crate_name, span)) = attr_crate_name + && attr_crate_name != crate_name + { + sess.dcx().emit_err(errors::CrateNameDoesNotMatch { + span, + crate_name, + attr_crate_name, + }); + } + return validate(crate_name, None); + } + + if let Some((crate_name, span)) = attr_crate_name { + return validate(crate_name, Some(span)); + } + + if let Input::File(ref path) = sess.io.input + && let Some(file_stem) = path.file_stem().and_then(|s| s.to_str()) { - // This is here mainly to check for using a macro, such as - // #![recursion_limit = foo!()]. That is not supported since that - // would require expanding this while in the middle of expansion, - // which needs to know the limit before expanding. Otherwise, - // validation would normally be caught in AstValidator (via - // `check_builtin_attribute`), but by the time that runs the macro - // is expanded, and it doesn't give an error. - validate_attr::emit_fatal_malformed_builtin_attribute( - &sess.psess, - attr, - sym::recursion_limit, - ); + if file_stem.starts_with('-') { + sess.dcx().emit_err(errors::CrateNameInvalid { crate_name: file_stem }); + } else { + return validate(Symbol::intern(&file_stem.replace('-', "_")), None); + } + } + + sym::rust_out +} + +fn get_recursion_limit(krate_attrs: &[ast::Attribute], sess: &Session) -> Limit { + // We don't permit macro calls inside of the attribute (e.g., #![recursion_limit = `expand!()`]) + // because that would require expanding this while in the middle of expansion, which needs to + // know the limit before expanding. + let _ = validate_and_find_value_str_builtin_attr(sym::recursion_limit, sess, krate_attrs); + crate::limits::get_recursion_limit(krate_attrs, sess) +} + +/// Validate *all* occurrences of the given "[value-str]" built-in attribute and return the first find. +/// +/// This validator is intended for built-in attributes whose value needs to be known very early +/// during compilation (namely, before macro expansion) and it mainly exists to reject macro calls +/// inside of the attributes, such as in `#![name = expand!()]`. Normal attribute validation happens +/// during semantic analysis via [`TyCtxt::check_mod_attrs`] which happens *after* macro expansion +/// when such macro calls (here: `expand`) have already been expanded and we can no longer check for +/// their presence. +/// +/// [value-str]: ast::Attribute::value_str +fn validate_and_find_value_str_builtin_attr( + name: Symbol, + sess: &Session, + krate_attrs: &[ast::Attribute], +) -> Option<(Symbol, Span)> { + let mut result = None; + // Validate *all* relevant attributes, not just the first occurrence. + for attr in ast::attr::filter_by_name(krate_attrs, name) { + let Some(value) = attr.value_str() else { + validate_attr::emit_fatal_malformed_builtin_attribute(&sess.psess, attr, name) + }; + // Choose the first occurrence as our result. + result.get_or_insert((value, attr.span)); } - rustc_middle::middle::limits::get_recursion_limit(krate_attrs, sess) + result } diff --git a/compiler/rustc_interface/src/proc_macro_decls.rs b/compiler/rustc_interface/src/proc_macro_decls.rs index 82593dbc2b7..00600abb5f1 100644 --- a/compiler/rustc_interface/src/proc_macro_decls.rs +++ b/compiler/rustc_interface/src/proc_macro_decls.rs @@ -7,7 +7,7 @@ use rustc_span::sym; fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> { let mut decls = None; - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { let attrs = tcx.hir().attrs(id.hir_id()); if attr::contains_name(attrs, sym::rustc_proc_macro_decls) { decls = Some(id.owner_id.def_id); diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index e900ec14fca..bc2aae7cd87 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -433,11 +433,11 @@ pub(crate) fn check_attr_crate_type( } } else { // This is here mainly to check for using a macro, such as - // #![crate_type = foo!()]. That is not supported since the + // `#![crate_type = foo!()]`. That is not supported since the // crate type needs to be known very early in compilation long // before expansion. Otherwise, validation would normally be - // caught in AstValidator (via `check_builtin_attribute`), but - // by the time that runs the macro is expanded, and it doesn't + // caught during semantic analysis via `TyCtxt::check_mod_attrs`, + // but by the time that runs the macro is expanded, and it doesn't // give an error. validate_attr::emit_fatal_malformed_builtin_attribute( &sess.psess, diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 480d97e377a..dbe24c9cdf2 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -439,11 +439,11 @@ lint_invalid_crate_type_value = invalid `crate_type` value .suggestion = did you mean # FIXME: we should ordinalize $valid_up_to when we add support for doing so -lint_invalid_from_utf8_checked = calls to `{$method}` with a invalid literal always return an error +lint_invalid_from_utf8_checked = calls to `{$method}` with an invalid literal always return an error .label = the literal was valid UTF-8 up to the {$valid_up_to} bytes # FIXME: we should ordinalize $valid_up_to when we add support for doing so -lint_invalid_from_utf8_unchecked = calls to `{$method}` with a invalid literal are undefined behavior +lint_invalid_from_utf8_unchecked = calls to `{$method}` with an invalid literal are undefined behavior .label = the literal was valid UTF-8 up to the {$valid_up_to} bytes lint_invalid_nan_comparisons_eq_ne = incorrect NaN comparison, NaN cannot be directly compared to itself diff --git a/compiler/rustc_lint/src/async_closures.rs b/compiler/rustc_lint/src/async_closures.rs index 5d40b8ab2ee..02fb22bf782 100644 --- a/compiler/rustc_lint/src/async_closures.rs +++ b/compiler/rustc_lint/src/async_closures.rs @@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for AsyncClosureUsage { return; }; - let mut body = cx.tcx.hir().body(body).value; + let mut body = cx.tcx.hir_body(body).value; // Only peel blocks that have no expressions. while let hir::ExprKind::Block(&hir::Block { stmts: [], expr: Some(tail), .. }, None) = diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index ecd40a52e75..e449f110613 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1057,7 +1057,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems { check_no_mangle_on_generic_fn( no_mangle_attr, Some(generics), - cx.tcx.hir().get_generics(it.id.owner_id.def_id).unwrap(), + cx.tcx.hir_get_generics(it.id.owner_id.def_id).unwrap(), it.span, ); } diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index a67b404e6e1..c74158102c7 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -928,7 +928,7 @@ impl<'tcx> LateContext<'tcx> { while let hir::ExprKind::Path(ref qpath) = expr.kind && let Some(parent_node) = match self.qpath_res(qpath, expr.hir_id) { Res::Local(hir_id) => Some(self.tcx.parent_hir_node(hir_id)), - Res::Def(_, def_id) => self.tcx.hir().get_if_local(def_id), + Res::Def(_, def_id) => self.tcx.hir_get_if_local(def_id), _ => None, } && let Some(init) = match parent_node { @@ -936,7 +936,7 @@ impl<'tcx> LateContext<'tcx> { hir::Node::LetStmt(hir::LetStmt { init, .. }) => *init, hir::Node::Item(item) => match item.kind { hir::ItemKind::Const(.., body_id) | hir::ItemKind::Static(.., body_id) => { - Some(self.tcx.hir().body(body_id).value) + Some(self.tcx.hir_body(body_id).value) } _ => None, }, diff --git a/compiler/rustc_lint/src/default_could_be_derived.rs b/compiler/rustc_lint/src/default_could_be_derived.rs index bae9defa687..59e38a882dd 100644 --- a/compiler/rustc_lint/src/default_could_be_derived.rs +++ b/compiler/rustc_lint/src/default_could_be_derived.rs @@ -76,10 +76,8 @@ impl<'tcx> LateLintPass<'tcx> for DefaultCouldBeDerived { // We now know we have a manually written definition of a `<Type as Default>::default()`. - let hir = cx.tcx.hir(); - let type_def_id = def.did(); - let body = hir.body(body_id); + let body = cx.tcx.hir_body(body_id); // FIXME: evaluate bodies with statements and evaluate bindings to see if they would be // derivable. @@ -92,7 +90,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultCouldBeDerived { // Keep a mapping of field name to `hir::FieldDef` for every field in the type. We'll use // these to check for things like checking whether it has a default or using its span for // suggestions. - let orig_fields = match hir.get_if_local(type_def_id) { + let orig_fields = match cx.tcx.hir_get_if_local(type_def_id) { Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Struct(hir::VariantData::Struct { fields, recovered: _ }, _generics), @@ -183,7 +181,7 @@ fn mk_lint( if removed_all_fields { let msg = "to avoid divergence in behavior between `Struct { .. }` and \ `<Struct as Default>::default()`, derive the `Default`"; - if let Some(hir::Node::Item(impl_)) = tcx.hir().get_if_local(impl_def_id) { + if let Some(hir::Node::Item(impl_)) = tcx.hir_get_if_local(impl_def_id) { diag.multipart_suggestion_verbose( msg, vec![ diff --git a/compiler/rustc_lint/src/for_loops_over_fallibles.rs b/compiler/rustc_lint/src/for_loops_over_fallibles.rs index 0a5c52d65ec..59390b7e420 100644 --- a/compiler/rustc_lint/src/for_loops_over_fallibles.rs +++ b/compiler/rustc_lint/src/for_loops_over_fallibles.rs @@ -155,7 +155,7 @@ fn suggest_question_mark<'tcx>( // Check that the function/closure/constant we are in has a `Result` type. // Otherwise suggesting using `?` may not be a good idea. { - let ty = cx.typeck_results().expr_ty(cx.tcx.hir().body(body_id).value); + let ty = cx.typeck_results().expr_ty(cx.tcx.hir_body(body_id).value); let ty::Adt(ret_adt, ..) = ty.kind() else { return false }; if !cx.tcx.is_diagnostic_item(sym::Result, ret_adt.did()) { return false; diff --git a/compiler/rustc_lint/src/invalid_from_utf8.rs b/compiler/rustc_lint/src/invalid_from_utf8.rs index 0081374922e..11eb079ddc0 100644 --- a/compiler/rustc_lint/src/invalid_from_utf8.rs +++ b/compiler/rustc_lint/src/invalid_from_utf8.rs @@ -70,12 +70,20 @@ impl<'tcx> LateLintPass<'tcx> for InvalidFromUtf8 { sym::str_from_utf8_mut, sym::str_from_utf8_unchecked, sym::str_from_utf8_unchecked_mut, + sym::str_inherent_from_utf8, + sym::str_inherent_from_utf8_mut, + sym::str_inherent_from_utf8_unchecked, + sym::str_inherent_from_utf8_unchecked_mut, ] .contains(&diag_item) { let lint = |label, utf8_error: Utf8Error| { let method = diag_item.as_str().strip_prefix("str_").unwrap(); - let method = format!("std::str::{method}"); + let method = if let Some(method) = method.strip_prefix("inherent_") { + format!("str::{method}") + } else { + format!("std::str::{method}") + }; let valid_up_to = utf8_error.valid_up_to(); let is_unchecked_variant = diag_item.as_str().contains("unchecked"); diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index 3ee908ba9bf..f17570e4a81 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -84,8 +84,8 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas /// Because lints are scoped lexically, we want to walk nested /// items in the context of the outer item, so enable /// deep-walking. - fn nested_visit_map(&mut self) -> Self::Map { - self.context.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.context.tcx } fn visit_nested_body(&mut self, body_id: hir::BodyId) { @@ -99,7 +99,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas self.context.cached_typeck_results.set(None); } - let body = self.context.tcx.hir().body(body_id); + let body = self.context.tcx.hir_body(body_id); self.visit_body(body); self.context.enclosing_body = old_enclosing_body; @@ -191,7 +191,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas // in order for `check_fn` to be able to use them. let old_enclosing_body = self.context.enclosing_body.replace(body_id); let old_cached_typeck_results = self.context.cached_typeck_results.take(); - let body = self.context.tcx.hir().body(body_id); + let body = self.context.tcx.hir_body(body_id); lint_callback!(self, check_fn, fk, decl, body, span, id); hir_visit::walk_fn(self, fk, decl, body_id, id); self.context.enclosing_body = old_enclosing_body; diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 5a4ed68440a..7e13205bbf1 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -270,8 +270,8 @@ impl<'tcx> LintLevelsBuilder<'_, LintLevelQueryMap<'tcx>> { impl<'tcx> Visitor<'tcx> for LintLevelsBuilder<'_, LintLevelQueryMap<'tcx>> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.provider.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.provider.tcx } fn visit_param(&mut self, param: &'tcx hir::Param<'tcx>) { @@ -365,8 +365,8 @@ impl<'tcx> LintLevelMaximum<'tcx> { impl<'tcx> Visitor<'tcx> for LintLevelMaximum<'tcx> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } /// FIXME(blyxyas): In a future revision, we should also graph #![allow]s, diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 5a00ac005db..7b43aac90c7 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -1,5 +1,4 @@ use std::iter; -use std::ops::ControlFlow; use rustc_ast as ast; use rustc_ast::util::{classify, parser}; @@ -781,29 +780,6 @@ trait UnusedDelimLint { right_pos: Option<BytePos>, is_kw: bool, ) { - // If `value` has `ExprKind::Err`, unused delim lint can be broken. - // For example, the following code caused ICE. - // This is because the `ExprKind::Call` in `value` has `ExprKind::Err` as its argument - // and this leads to wrong spans. #104897 - // - // ``` - // fn f(){(print!(á - // ``` - use rustc_ast::visit::{Visitor, walk_expr}; - struct ErrExprVisitor; - impl<'ast> Visitor<'ast> for ErrExprVisitor { - type Result = ControlFlow<()>; - fn visit_expr(&mut self, expr: &'ast ast::Expr) -> ControlFlow<()> { - if let ExprKind::Err(_) = expr.kind { - ControlFlow::Break(()) - } else { - walk_expr(self, expr) - } - } - } - if ErrExprVisitor.visit_expr(value).is_break() { - return; - } let spans = match value.kind { ast::ExprKind::Block(ref block, None) if let [stmt] = block.stmts.as_slice() => stmt .span diff --git a/compiler/rustc_metadata/src/foreign_modules.rs b/compiler/rustc_metadata/src/foreign_modules.rs index 154eb684f11..24689ea61d0 100644 --- a/compiler/rustc_metadata/src/foreign_modules.rs +++ b/compiler/rustc_metadata/src/foreign_modules.rs @@ -10,13 +10,13 @@ pub(crate) fn collect(tcx: TyCtxt<'_>, LocalCrate: LocalCrate) -> FxIndexMap<Def let mut modules = FxIndexMap::default(); // We need to collect all the `ForeignMod`, even if they are empty. - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { if !matches!(tcx.def_kind(id.owner_id), DefKind::ForeignMod) { continue; } let def_id = id.owner_id.to_def_id(); - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); if let hir::ItemKind::ForeignMod { abi, items } = item.kind { let foreign_items = items.iter().map(|it| it.id.owner_id.to_def_id()).collect(); diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 81fb918c604..1ac2f6e81e5 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1940,7 +1940,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { bug!("Unknown proc-macro type for item {:?}", id); }; - let mut def_key = self.tcx.hir().def_key(id); + let mut def_key = self.tcx.hir_def_key(id); def_key.disambiguated_data.data = DefPathData::MacroNs(name); let def_id = id.to_def_id(); @@ -2076,7 +2076,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { let mut trait_impls: FxIndexMap<DefId, Vec<(DefIndex, Option<SimplifiedType>)>> = FxIndexMap::default(); - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { let DefKind::Impl { of_trait } = tcx.def_kind(id.owner_id) else { continue; }; @@ -2272,10 +2272,7 @@ impl<D: Decoder> Decodable<D> for EncodedMetadata { let len = d.read_usize(); let mmap = if len > 0 { let mut mmap = MmapMut::map_anon(len).unwrap(); - for _ in 0..len { - (&mut mmap[..]).write_all(&[d.read_u8()]).unwrap(); - } - mmap.flush().unwrap(); + mmap.copy_from_slice(d.read_raw_bytes(len)); Some(mmap.make_read_only().unwrap()) } else { None @@ -2413,7 +2410,6 @@ pub(crate) fn provide(providers: &mut Providers) { /// use a different method for pretty-printing. Ideally this function /// should only ever be used as a fallback. pub fn rendered_const<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body<'_>, def_id: LocalDefId) -> String { - let hir = tcx.hir(); let value = body.value; #[derive(PartialEq, Eq)] @@ -2470,7 +2466,7 @@ pub fn rendered_const<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body<'_>, def_id: Loc // Otherwise we prefer pretty-printing to get rid of extraneous whitespace, comments and // other formatting artifacts. - Literal | Simple => id_to_string(&hir, body.id().hir_id), + Literal | Simple => id_to_string(&tcx, body.id().hir_id), // FIXME: Omit the curly braces if the enclosing expression is an array literal // with a repeated element (an `ExprKind::Repeat`) as in such case it diff --git a/compiler/rustc_middle/Cargo.toml b/compiler/rustc_middle/Cargo.toml index de722e62043..1b6a174c093 100644 --- a/compiler/rustc_middle/Cargo.toml +++ b/compiler/rustc_middle/Cargo.toml @@ -22,6 +22,7 @@ rustc_errors = { path = "../rustc_errors" } rustc_feature = { path = "../rustc_feature" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } rustc_graphviz = { path = "../rustc_graphviz" } +rustc_hashes = { path = "../rustc_hashes" } rustc_hir = { path = "../rustc_hir" } rustc_hir_pretty = { path = "../rustc_hir_pretty" } rustc_index = { path = "../rustc_index" } diff --git a/compiler/rustc_middle/messages.ftl b/compiler/rustc_middle/messages.ftl index 09c16222be1..dcfa81dab25 100644 --- a/compiler/rustc_middle/messages.ftl +++ b/compiler/rustc_middle/messages.ftl @@ -81,10 +81,6 @@ middle_failed_writing_file = middle_layout_references_error = the type has an unknown layout -middle_limit_invalid = - `limit` must be a non-negative integer - .label = {$error_str} - middle_opaque_hidden_type_mismatch = concrete type differs from previous defining opaque type use .label = expected `{$self_ty}`, got `{$other_ty}` diff --git a/compiler/rustc_middle/src/error.rs b/compiler/rustc_middle/src/error.rs index 91b18295b43..c53e3d54cc4 100644 --- a/compiler/rustc_middle/src/error.rs +++ b/compiler/rustc_middle/src/error.rs @@ -68,16 +68,6 @@ pub enum TypeMismatchReason { } #[derive(Diagnostic)] -#[diag(middle_limit_invalid)] -pub(crate) struct LimitInvalid<'a> { - #[primary_span] - pub span: Span, - #[label] - pub value_span: Span, - pub error_str: &'a str, -} - -#[derive(Diagnostic)] #[diag(middle_recursion_limit_reached)] #[help] pub(crate) struct RecursionLimitReached<'tcx> { diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map.rs index 83c7bb0f52f..b44f14315d7 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map.rs @@ -93,7 +93,7 @@ impl<'hir> Iterator for ParentOwnerIterator<'hir> { return None; } - let parent_id = self.map.def_key(self.current_id.owner.def_id).parent; + let parent_id = self.map.tcx.hir_def_key(self.current_id.owner.def_id).parent; let parent_id = parent_id.map_or(CRATE_OWNER_ID, |local_def_index| { let def_id = LocalDefId { local_def_index }; self.map.tcx.local_def_id_to_hir_id(def_id).owner @@ -164,76 +164,74 @@ impl<'tcx> TyCtxt<'tcx> { pub fn parent_hir_node(self, hir_id: HirId) -> Node<'tcx> { self.hir_node(self.parent_hir_id(hir_id)) } -} - -impl<'hir> Map<'hir> { - #[inline] - pub fn krate(self) -> &'hir Crate<'hir> { - self.tcx.hir_crate(()) - } #[inline] - pub fn root_module(self) -> &'hir Mod<'hir> { - match self.tcx.hir_owner_node(CRATE_OWNER_ID) { + pub fn hir_root_module(self) -> &'tcx Mod<'tcx> { + match self.hir_owner_node(CRATE_OWNER_ID) { OwnerNode::Crate(item) => item, _ => bug!(), } } #[inline] - pub fn items(self) -> impl Iterator<Item = ItemId> + 'hir { - self.tcx.hir_crate_items(()).free_items.iter().copied() + pub fn hir_free_items(self) -> impl Iterator<Item = ItemId> + 'tcx { + self.hir_crate_items(()).free_items.iter().copied() } #[inline] - pub fn module_items(self, module: LocalModDefId) -> impl Iterator<Item = ItemId> + 'hir { - self.tcx.hir_module_items(module).free_items() + pub fn hir_module_free_items( + self, + module: LocalModDefId, + ) -> impl Iterator<Item = ItemId> + 'tcx { + self.hir_module_items(module).free_items() } - pub fn def_key(self, def_id: LocalDefId) -> DefKey { + pub fn hir_def_key(self, def_id: LocalDefId) -> DefKey { // Accessing the DefKey is ok, since it is part of DefPathHash. - self.tcx.definitions_untracked().def_key(def_id) + self.definitions_untracked().def_key(def_id) } - pub fn def_path(self, def_id: LocalDefId) -> DefPath { + pub fn hir_def_path(self, def_id: LocalDefId) -> DefPath { // Accessing the DefPath is ok, since it is part of DefPathHash. - self.tcx.definitions_untracked().def_path(def_id) + self.definitions_untracked().def_path(def_id) } #[inline] - pub fn def_path_hash(self, def_id: LocalDefId) -> DefPathHash { + pub fn hir_def_path_hash(self, def_id: LocalDefId) -> DefPathHash { // Accessing the DefPathHash is ok, it is incr. comp. stable. - self.tcx.definitions_untracked().def_path_hash(def_id) + self.definitions_untracked().def_path_hash(def_id) } - pub fn get_if_local(self, id: DefId) -> Option<Node<'hir>> { - id.as_local().map(|id| self.tcx.hir_node_by_def_id(id)) + pub fn hir_get_if_local(self, id: DefId) -> Option<Node<'tcx>> { + id.as_local().map(|id| self.hir_node_by_def_id(id)) } - pub fn get_generics(self, id: LocalDefId) -> Option<&'hir Generics<'hir>> { - self.tcx.opt_hir_owner_node(id)?.generics() + pub fn hir_get_generics(self, id: LocalDefId) -> Option<&'tcx Generics<'tcx>> { + self.opt_hir_owner_node(id)?.generics() } - pub fn item(self, id: ItemId) -> &'hir Item<'hir> { - self.tcx.hir_owner_node(id.owner_id).expect_item() + pub fn hir_item(self, id: ItemId) -> &'tcx Item<'tcx> { + self.hir_owner_node(id.owner_id).expect_item() } - pub fn trait_item(self, id: TraitItemId) -> &'hir TraitItem<'hir> { - self.tcx.hir_owner_node(id.owner_id).expect_trait_item() + pub fn hir_trait_item(self, id: TraitItemId) -> &'tcx TraitItem<'tcx> { + self.hir_owner_node(id.owner_id).expect_trait_item() } - pub fn impl_item(self, id: ImplItemId) -> &'hir ImplItem<'hir> { - self.tcx.hir_owner_node(id.owner_id).expect_impl_item() + pub fn hir_impl_item(self, id: ImplItemId) -> &'tcx ImplItem<'tcx> { + self.hir_owner_node(id.owner_id).expect_impl_item() } - pub fn foreign_item(self, id: ForeignItemId) -> &'hir ForeignItem<'hir> { - self.tcx.hir_owner_node(id.owner_id).expect_foreign_item() + pub fn hir_foreign_item(self, id: ForeignItemId) -> &'tcx ForeignItem<'tcx> { + self.hir_owner_node(id.owner_id).expect_foreign_item() } - pub fn body(self, id: BodyId) -> &'hir Body<'hir> { - self.tcx.hir_owner_nodes(id.hir_id.owner).bodies[&id.hir_id.local_id] + pub fn hir_body(self, id: BodyId) -> &'tcx Body<'tcx> { + self.hir_owner_nodes(id.hir_id.owner).bodies[&id.hir_id.local_id] } +} +impl<'hir> Map<'hir> { #[track_caller] pub fn fn_decl_by_hir_id(self, hir_id: HirId) -> Option<&'hir FnDecl<'hir>> { self.tcx.hir_node(hir_id).fn_decl() @@ -271,7 +269,7 @@ impl<'hir> Map<'hir> { /// Given a `LocalDefId`, returns the `BodyId` associated with it, /// if the node is a body owner, otherwise returns `None`. pub fn maybe_body_owned_by(self, id: LocalDefId) -> Option<&'hir Body<'hir>> { - Some(self.body(self.tcx.hir_node_by_def_id(id).body_id()?)) + Some(self.tcx.hir_body(self.tcx.hir_node_by_def_id(id).body_id()?)) } /// Given a body owner's id, returns the `BodyId` associated with it. @@ -288,7 +286,7 @@ impl<'hir> Map<'hir> { } pub fn body_param_names(self, id: BodyId) -> impl Iterator<Item = Ident> + 'hir { - self.body(id).params.iter().map(|arg| match arg.pat.kind { + self.tcx.hir_body(id).params.iter().map(|arg| match arg.pat.kind { PatKind::Binding(_, _, ident, _) => ident, _ => Ident::empty(), }) @@ -410,7 +408,7 @@ impl<'hir> Map<'hir> { where V: Visitor<'hir>, { - let krate = self.krate(); + let krate = self.tcx.hir_crate(()); for info in krate.owners.iter() { if let MaybeOwner::Owner(info) = info { for attrs in info.attrs.map.values() { @@ -436,13 +434,21 @@ impl<'hir> Map<'hir> { V: Visitor<'hir>, { let krate = self.tcx.hir_crate_items(()); - walk_list!(visitor, visit_item, krate.free_items().map(|id| self.item(id))); - walk_list!(visitor, visit_trait_item, krate.trait_items().map(|id| self.trait_item(id))); - walk_list!(visitor, visit_impl_item, krate.impl_items().map(|id| self.impl_item(id))); + walk_list!(visitor, visit_item, krate.free_items().map(|id| self.tcx.hir_item(id))); + walk_list!( + visitor, + visit_trait_item, + krate.trait_items().map(|id| self.tcx.hir_trait_item(id)) + ); + walk_list!( + visitor, + visit_impl_item, + krate.impl_items().map(|id| self.tcx.hir_impl_item(id)) + ); walk_list!( visitor, visit_foreign_item, - krate.foreign_items().map(|id| self.foreign_item(id)) + krate.foreign_items().map(|id| self.tcx.hir_foreign_item(id)) ); V::Result::output() } @@ -454,13 +460,21 @@ impl<'hir> Map<'hir> { V: Visitor<'hir>, { let module = self.tcx.hir_module_items(module); - walk_list!(visitor, visit_item, module.free_items().map(|id| self.item(id))); - walk_list!(visitor, visit_trait_item, module.trait_items().map(|id| self.trait_item(id))); - walk_list!(visitor, visit_impl_item, module.impl_items().map(|id| self.impl_item(id))); + walk_list!(visitor, visit_item, module.free_items().map(|id| self.tcx.hir_item(id))); + walk_list!( + visitor, + visit_trait_item, + module.trait_items().map(|id| self.tcx.hir_trait_item(id)) + ); + walk_list!( + visitor, + visit_impl_item, + module.impl_items().map(|id| self.tcx.hir_impl_item(id)) + ); walk_list!( visitor, visit_foreign_item, - module.foreign_items().map(|id| self.foreign_item(id)) + module.foreign_items().map(|id| self.tcx.hir_foreign_item(id)) ); V::Result::output() } @@ -921,7 +935,7 @@ impl<'hir> Map<'hir> { Node::Variant(variant) => variant.span, Node::Field(field) => field.span, Node::AnonConst(constant) => constant.span, - Node::ConstBlock(constant) => self.body(constant.body).value.span, + Node::ConstBlock(constant) => self.tcx.hir_body(constant.body).value.span, Node::ConstArg(const_arg) => const_arg.span(), Node::Expr(expr) => expr.span, Node::ExprField(field) => field.span, @@ -1014,39 +1028,35 @@ impl<'hir> Map<'hir> { } } -impl<'hir> intravisit::Map<'hir> for Map<'hir> { - fn hir_node(&self, hir_id: HirId) -> Node<'hir> { - self.tcx.hir_node(hir_id) - } - - fn hir_node_by_def_id(&self, def_id: LocalDefId) -> Node<'hir> { - self.tcx.hir_node_by_def_id(def_id) +impl<'tcx> intravisit::HirTyCtxt<'tcx> for TyCtxt<'tcx> { + fn hir_node(&self, hir_id: HirId) -> Node<'tcx> { + (*self).hir_node(hir_id) } - fn body(&self, id: BodyId) -> &'hir Body<'hir> { - (*self).body(id) + fn hir_body(&self, id: BodyId) -> &'tcx Body<'tcx> { + (*self).hir_body(id) } - fn item(&self, id: ItemId) -> &'hir Item<'hir> { - (*self).item(id) + fn hir_item(&self, id: ItemId) -> &'tcx Item<'tcx> { + (*self).hir_item(id) } - fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem<'hir> { - (*self).trait_item(id) + fn hir_trait_item(&self, id: TraitItemId) -> &'tcx TraitItem<'tcx> { + (*self).hir_trait_item(id) } - fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem<'hir> { - (*self).impl_item(id) + fn hir_impl_item(&self, id: ImplItemId) -> &'tcx ImplItem<'tcx> { + (*self).hir_impl_item(id) } - fn foreign_item(&self, id: ForeignItemId) -> &'hir ForeignItem<'hir> { - (*self).foreign_item(id) + fn hir_foreign_item(&self, id: ForeignItemId) -> &'tcx ForeignItem<'tcx> { + (*self).hir_foreign_item(id) } } impl<'tcx> pprust_hir::PpAnn for TyCtxt<'tcx> { fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) { - pprust_hir::PpAnn::nested(&(&self.hir() as &dyn intravisit::Map<'_>), state, nested) + pprust_hir::PpAnn::nested(&(self as &dyn intravisit::HirTyCtxt<'_>), state, nested) } } @@ -1333,8 +1343,8 @@ impl<'tcx> ItemCollector<'tcx> { impl<'hir> Visitor<'hir> for ItemCollector<'hir> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_item(&mut self, item: &'hir Item<'hir>) { diff --git a/compiler/rustc_middle/src/hir/nested_filter.rs b/compiler/rustc_middle/src/hir/nested_filter.rs index adbe81bb22c..e18c28a8eac 100644 --- a/compiler/rustc_middle/src/hir/nested_filter.rs +++ b/compiler/rustc_middle/src/hir/nested_filter.rs @@ -1,5 +1,7 @@ use rustc_hir::intravisit::nested_filter::NestedFilter; +use crate::ty::TyCtxt; + /// Do not visit nested item-like things, but visit nested things /// that are inside of an item-like. /// @@ -12,8 +14,8 @@ use rustc_hir::intravisit::nested_filter::NestedFilter; /// and to have the visitor that visits the contents of each item /// using this setting. pub struct OnlyBodies(()); -impl<'hir> NestedFilter<'hir> for OnlyBodies { - type Map = crate::hir::map::Map<'hir>; +impl<'tcx> NestedFilter<'tcx> for OnlyBodies { + type MaybeTyCtxt = TyCtxt<'tcx>; const INTER: bool = false; const INTRA: bool = true; } @@ -24,8 +26,8 @@ impl<'hir> NestedFilter<'hir> for OnlyBodies { /// process everything within their lexical context. Typically you /// kick off the visit by doing `walk_krate()`. pub struct All(()); -impl<'hir> NestedFilter<'hir> for All { - type Map = crate::hir::map::Map<'hir>; +impl<'tcx> NestedFilter<'tcx> for All { + type MaybeTyCtxt = TyCtxt<'tcx>; const INTER: bool = true; const INTRA: bool = true; } diff --git a/compiler/rustc_middle/src/middle/mod.rs b/compiler/rustc_middle/src/middle/mod.rs index 692fe027c49..9f71971ea08 100644 --- a/compiler/rustc_middle/src/middle/mod.rs +++ b/compiler/rustc_middle/src/middle/mod.rs @@ -30,12 +30,7 @@ pub mod lib_features { } } } -pub mod limits; pub mod privacy; pub mod region; pub mod resolve_bound_vars; pub mod stability; - -pub fn provide(providers: &mut crate::query::Providers) { - limits::provide(providers); -} diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 63e20fb0d64..795cfcef2d3 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -49,7 +49,6 @@ pub mod generic_graphviz; pub mod graphviz; pub mod interpret; pub mod mono; -pub mod patch; pub mod pretty; mod query; mod statement; diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs index d4a9aac3733..4a21b6ad237 100644 --- a/compiler/rustc_middle/src/mir/mono.rs +++ b/compiler/rustc_middle/src/mir/mono.rs @@ -6,8 +6,9 @@ use rustc_attr_parsing::InlineAttr; use rustc_data_structures::base_n::{BaseNString, CASE_INSENSITIVE, ToBaseN}; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxIndexMap; -use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher, ToStableHashKey}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; use rustc_data_structures::unord::UnordMap; +use rustc_hashes::Hash128; use rustc_hir::ItemId; use rustc_hir::def_id::{CrateNum, DefId, DefIdSet, LOCAL_CRATE}; use rustc_index::Idx; diff --git a/compiler/rustc_middle/src/mir/tcx.rs b/compiler/rustc_middle/src/mir/tcx.rs index af23c8b2ea7..862f78d7259 100644 --- a/compiler/rustc_middle/src/mir/tcx.rs +++ b/compiler/rustc_middle/src/mir/tcx.rs @@ -86,6 +86,14 @@ impl<'tcx> PlaceTy<'tcx> { } } + pub fn multi_projection_ty( + self, + tcx: TyCtxt<'tcx>, + elems: &[PlaceElem<'tcx>], + ) -> PlaceTy<'tcx> { + elems.iter().fold(self, |place_ty, &elem| place_ty.projection_ty(tcx, elem)) + } + /// Convenience wrapper around `projection_ty_core` for /// `PlaceElem`, where we can just use the `Ty` that is already /// stored inline on field projection elems. @@ -167,11 +175,7 @@ impl<'tcx> Place<'tcx> { where D: HasLocalDecls<'tcx>, { - projection - .iter() - .fold(PlaceTy::from_ty(local_decls.local_decls()[local].ty), |place_ty, &elem| { - place_ty.projection_ty(tcx, elem) - }) + PlaceTy::from_ty(local_decls.local_decls()[local].ty).multi_projection_ty(tcx, projection) } pub fn ty<D: ?Sized>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> PlaceTy<'tcx> diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 478ac19d199..cd81890598e 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -116,7 +116,7 @@ rustc_queries! { } query early_lint_checks(_: ()) { - desc { "perform lints prior to macro expansion" } + desc { "perform lints prior to AST lowering" } } query resolutions(_: ()) -> &'tcx ty::ResolverGlobalCtxt { diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index cb8dc692148..ea2b610a727 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2168,6 +2168,10 @@ impl<'tcx> TyCtxt<'tcx> { self.limits(()).move_size_limit } + pub fn pattern_complexity_limit(self) -> Limit { + self.limits(()).pattern_complexity_limit + } + /// All traits in the crate graph, including those not visible to the user. pub fn all_traits(self) -> impl Iterator<Item = DefId> + 'tcx { iter::once(LOCAL_CRATE) diff --git a/compiler/rustc_middle/src/ty/generic_args.rs b/compiler/rustc_middle/src/ty/generic_args.rs index fd84d75b53f..56a38a84c9f 100644 --- a/compiler/rustc_middle/src/ty/generic_args.rs +++ b/compiler/rustc_middle/src/ty/generic_args.rs @@ -495,7 +495,7 @@ impl<'tcx> GenericArgs<'tcx> { self.iter().filter_map(|k| k.as_const()) } - /// Returns generic arguments that are not lifetimes or host effect params. + /// Returns generic arguments that are not lifetimes. #[inline] pub fn non_erasable_generics( &'tcx self, diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index e5a4e38c875..bbb8a9fa671 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -11,6 +11,7 @@ use rustc_error_messages::DiagMessage; use rustc_errors::{ Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level, }; +use rustc_hashes::Hash64; use rustc_hir::LangItem; use rustc_hir::def_id::DefId; use rustc_index::IndexVec; @@ -778,7 +779,7 @@ where size: Size::ZERO, max_repr_align: None, unadjusted_abi_align: tcx.data_layout.i8_align.abi, - randomization_seed: 0, + randomization_seed: Hash64::ZERO, }) } diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 52cb8f57a88..7beb6d84044 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1487,8 +1487,7 @@ impl<'tcx> TyCtxt<'tcx> { // Generate a deterministically-derived seed from the item's path hash // to allow for cross-crate compilation to actually work - let mut field_shuffle_seed = - self.def_path_hash(did.to_def_id()).0.to_smaller_hash().as_u64(); + let mut field_shuffle_seed = self.def_path_hash(did.to_def_id()).0.to_smaller_hash(); // If the user defined a custom seed for layout randomization, xor the item's // path hash with the user defined seed, this will allowing determinism while @@ -2168,7 +2167,6 @@ pub fn provide(providers: &mut Providers) { util::provide(providers); print::provide(providers); super::util::bug::provide(providers); - super::middle::provide(providers); *providers = Providers { trait_impls_of: trait_def::trait_impls_of_provider, incoherent_impls: trait_def::incoherent_impls_provider, diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 7166c284c3d..11b430dd358 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -3299,13 +3299,12 @@ define_print_and_forward_display! { fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, Namespace, DefId)) { // Iterate all local crate items no matter where they are defined. - let hir = tcx.hir(); - for id in hir.items() { + for id in tcx.hir_free_items() { if matches!(tcx.def_kind(id.owner_id), DefKind::Use) { continue; } - let item = hir.item(id); + let item = tcx.hir_item(id); if item.ident.name == kw::Empty { continue; } diff --git a/compiler/rustc_middle/src/ty/trait_def.rs b/compiler/rustc_middle/src/ty/trait_def.rs index 743ea33b20a..b84cc57234f 100644 --- a/compiler/rustc_middle/src/ty/trait_def.rs +++ b/compiler/rustc_middle/src/ty/trait_def.rs @@ -267,7 +267,7 @@ pub(super) fn incoherent_impls_provider(tcx: TyCtxt<'_>, simp: SimplifiedType) - pub(super) fn traits_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> &[DefId] { let mut traits = Vec::new(); - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { if matches!(tcx.def_kind(id.owner_id), DefKind::Trait | DefKind::TraitAlias) { traits.push(id.owner_id.to_def_id()) } @@ -278,7 +278,7 @@ pub(super) fn traits_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> &[DefId] { pub(super) fn trait_impls_in_crate_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> &[DefId] { let mut trait_impls = Vec::new(); - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { if matches!(tcx.def_kind(id.owner_id), DefKind::Impl { .. }) && tcx.impl_trait_ref(id.owner_id).is_some() { diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index 94bd359f6eb..88d57498542 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -5,9 +5,10 @@ use std::{fmt, iter}; use rustc_abi::{ExternAbi, Float, Integer, IntegerType, Size}; use rustc_apfloat::Float as _; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::ErrorGuaranteed; +use rustc_hashes::Hash128; use rustc_hir as hir; use rustc_hir::def::{CtorOf, DefKind, Res}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId}; diff --git a/compiler/rustc_middle/src/values.rs b/compiler/rustc_middle/src/values.rs index 433f7542bd7..9450ce7ec44 100644 --- a/compiler/rustc_middle/src/values.rs +++ b/compiler/rustc_middle/src/values.rs @@ -53,7 +53,7 @@ impl<'tcx> Value<TyCtxt<'tcx>> for ty::Binder<'_, ty::FnSig<'_>> { let arity = if let Some(frame) = cycle_error.cycle.get(0) && frame.query.dep_kind == dep_kinds::fn_sig && let Some(def_id) = frame.query.def_id - && let Some(node) = tcx.hir().get_if_local(def_id) + && let Some(node) = tcx.hir_get_if_local(def_id) && let Some(sig) = node.fn_sig() { sig.decl.inputs.len() diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 1bd33475e60..8b6fcec3837 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -759,7 +759,7 @@ impl UnsafeOpKind { }); let unsafe_not_inherited_note = if should_suggest { suggest_unsafe_block.then(|| { - let body_span = tcx.hir().body(parent_owner.body_id().unwrap()).value.span; + let body_span = tcx.hir_body(parent_owner.body_id().unwrap()).value.span; UnsafeNotInheritedLintNote { signature_span: tcx.def_span(parent_id.def_id), body_span, diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 07bdc59756a..f1753be845d 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -601,8 +601,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NonExhaustivePatternsTypeNo let def_span = self .cx .tcx - .hir() - .get_if_local(def.did()) + .hir_get_if_local(def.did()) .and_then(|node| node.ident()) .map(|ident| ident.span) .unwrap_or_else(|| self.cx.tcx.def_span(def.did())); @@ -1113,9 +1112,6 @@ pub(crate) struct Rust2024IncompatiblePatSugg { pub(crate) suggestion: Vec<(Span, String)>, pub(crate) ref_pattern_count: usize, pub(crate) binding_mode_count: usize, - /// Internal state: the ref-mutability of the default binding mode at the subpattern being - /// lowered, with the span where it was introduced. `None` for a by-value default mode. - pub(crate) default_mode_span: Option<(Span, ty::Mutability)>, /// Labels for where incompatibility-causing by-ref default binding modes were introduced. pub(crate) default_mode_labels: FxIndexMap<Span, ty::Mutability>, } diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 697cb7cf37a..1e738801011 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -10,7 +10,6 @@ use rustc_hir::{self as hir, BindingMode, ByRef, HirId}; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::Level; use rustc_middle::bug; -use rustc_middle::middle::limits::get_limit_size; use rustc_middle::thir::visit::Visitor; use rustc_middle::thir::*; use rustc_middle::ty::print::with_no_trimmed_paths; @@ -25,7 +24,7 @@ use rustc_session::lint::builtin::{ }; use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::hygiene::DesugaringKind; -use rustc_span::{Ident, Span, sym}; +use rustc_span::{Ident, Span}; use rustc_trait_selection::infer::InferCtxtExt; use tracing::instrument; @@ -404,18 +403,11 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> { arms: &[MatchArm<'p, 'tcx>], scrut_ty: Ty<'tcx>, ) -> Result<UsefulnessReport<'p, 'tcx>, ErrorGuaranteed> { - let pattern_complexity_limit = - get_limit_size(cx.tcx.hir().krate_attrs(), cx.tcx.sess, sym::pattern_complexity); - let report = rustc_pattern_analysis::rustc::analyze_match( - &cx, - &arms, - scrut_ty, - pattern_complexity_limit, - ) - .map_err(|err| { - self.error = Err(err); - err - })?; + let report = + rustc_pattern_analysis::rustc::analyze_match(&cx, &arms, scrut_ty).map_err(|err| { + self.error = Err(err); + err + })?; // Warn unreachable subpatterns. for (arm, is_useful) in report.arm_usefulness.iter() { @@ -1498,7 +1490,7 @@ fn report_adt_defined_here<'tcx>( return None; }; let adt_def_span = - tcx.hir().get_if_local(def.did()).and_then(|node| node.ident()).map(|ident| ident.span); + tcx.hir_get_if_local(def.did()).and_then(|node| node.ident()).map(|ident| ident.span); let adt_def_span = if point_at_non_local_ty { adt_def_span.unwrap_or_else(|| tcx.def_span(def.did())) } else { diff --git a/compiler/rustc_mir_build/src/thir/pattern/migration.rs b/compiler/rustc_mir_build/src/thir/pattern/migration.rs new file mode 100644 index 00000000000..bd7787b643d --- /dev/null +++ b/compiler/rustc_mir_build/src/thir/pattern/migration.rs @@ -0,0 +1,182 @@ +//! Automatic migration of Rust 2021 patterns to a form valid in both Editions 2021 and 2024. + +use rustc_data_structures::fx::FxIndexMap; +use rustc_errors::MultiSpan; +use rustc_hir::{BindingMode, ByRef, HirId, Mutability}; +use rustc_lint as lint; +use rustc_middle::span_bug; +use rustc_middle::ty::{self, Rust2024IncompatiblePatInfo, Ty, TyCtxt}; +use rustc_span::{Ident, Span}; + +use crate::errors::{Rust2024IncompatiblePat, Rust2024IncompatiblePatSugg}; +use crate::fluent_generated as fluent; + +/// For patterns flagged for migration during HIR typeck, this handles constructing and emitting +/// a diagnostic suggestion. +pub(super) struct PatMigration<'a> { + suggestion: Vec<(Span, String)>, + ref_pattern_count: usize, + binding_mode_count: usize, + /// Internal state: the ref-mutability of the default binding mode at the subpattern being + /// lowered, with the span where it was introduced. `None` for a by-value default mode. + default_mode_span: Option<(Span, ty::Mutability)>, + /// Labels for where incompatibility-causing by-ref default binding modes were introduced. + // FIXME(ref_pat_eat_one_layer_2024_structural): To track the default binding mode, we duplicate + // logic from HIR typeck (in order to avoid needing to store all changes to the dbm in + // TypeckResults). Since the default binding mode acts differently under this feature gate, the + // labels will be wrong. + default_mode_labels: FxIndexMap<Span, Mutability>, + /// Information collected from typeck, including spans for subpatterns invalid in Rust 2024. + info: &'a Rust2024IncompatiblePatInfo, +} + +impl<'a> PatMigration<'a> { + pub(super) fn new(info: &'a Rust2024IncompatiblePatInfo) -> Self { + PatMigration { + suggestion: Vec::new(), + ref_pattern_count: 0, + binding_mode_count: 0, + default_mode_span: None, + default_mode_labels: Default::default(), + info, + } + } + + /// On Rust 2024, this emits a hard error. On earlier Editions, this emits the + /// future-incompatibility lint `rust_2024_incompatible_pat`. + pub(super) fn emit<'tcx>(self, tcx: TyCtxt<'tcx>, pat_id: HirId) { + let mut spans = + MultiSpan::from_spans(self.info.primary_labels.iter().map(|(span, _)| *span).collect()); + for (span, label) in self.info.primary_labels.iter() { + spans.push_span_label(*span, label.clone()); + } + let sugg = Rust2024IncompatiblePatSugg { + suggest_eliding_modes: self.info.suggest_eliding_modes, + suggestion: self.suggestion, + ref_pattern_count: self.ref_pattern_count, + binding_mode_count: self.binding_mode_count, + default_mode_labels: self.default_mode_labels, + }; + // If a relevant span is from at least edition 2024, this is a hard error. + let is_hard_error = spans.primary_spans().iter().any(|span| span.at_least_rust_2024()); + if is_hard_error { + let mut err = + tcx.dcx().struct_span_err(spans, fluent::mir_build_rust_2024_incompatible_pat); + if let Some(info) = lint::builtin::RUST_2024_INCOMPATIBLE_PAT.future_incompatible { + // provide the same reference link as the lint + err.note(format!("for more information, see {}", info.reference)); + } + err.arg("bad_modifiers", self.info.bad_modifiers); + err.arg("bad_ref_pats", self.info.bad_ref_pats); + err.arg("is_hard_error", true); + err.subdiagnostic(sugg); + err.emit(); + } else { + tcx.emit_node_span_lint( + lint::builtin::RUST_2024_INCOMPATIBLE_PAT, + pat_id, + spans, + Rust2024IncompatiblePat { + sugg, + bad_modifiers: self.info.bad_modifiers, + bad_ref_pats: self.info.bad_ref_pats, + is_hard_error, + }, + ); + } + } + + /// Tracks when we're lowering a pattern that implicitly dereferences the scrutinee. + /// This should only be called when the pattern type adjustments list `adjustments` is + /// non-empty. Returns the prior default binding mode; this should be followed by a call to + /// [`PatMigration::leave_ref`] to restore it when we leave the pattern. + pub(super) fn visit_implicit_derefs<'tcx>( + &mut self, + pat_span: Span, + adjustments: &[Ty<'tcx>], + ) -> Option<(Span, Mutability)> { + let implicit_deref_mutbls = adjustments.iter().map(|ref_ty| { + let &ty::Ref(_, _, mutbl) = ref_ty.kind() else { + span_bug!(pat_span, "pattern implicitly dereferences a non-ref type"); + }; + mutbl + }); + + if !self.info.suggest_eliding_modes { + // If we can't fix the pattern by eliding modifiers, we'll need to make the pattern + // fully explicit. i.e. we'll need to suggest reference patterns for this. + let suggestion_str: String = + implicit_deref_mutbls.clone().map(|mutbl| mutbl.ref_prefix_str()).collect(); + self.suggestion.push((pat_span.shrink_to_lo(), suggestion_str)); + self.ref_pattern_count += adjustments.len(); + } + + // Remember if this changed the default binding mode, in case we want to label it. + let min_mutbl = implicit_deref_mutbls.min().unwrap(); + if self.default_mode_span.is_none_or(|(_, old_mutbl)| min_mutbl < old_mutbl) { + // This changes the default binding mode to `ref` or `ref mut`. Return the old mode so + // it can be reinstated when we leave the pattern. + self.default_mode_span.replace((pat_span, min_mutbl)) + } else { + // This does not change the default binding mode; it was already `ref` or `ref mut`. + self.default_mode_span + } + } + + /// Tracks the default binding mode when we're lowering a `&` or `&mut` pattern. + /// Returns the prior default binding mode; this should be followed by a call to + /// [`PatMigration::leave_ref`] to restore it when we leave the pattern. + pub(super) fn visit_explicit_deref(&mut self) -> Option<(Span, Mutability)> { + if let Some((default_mode_span, default_ref_mutbl)) = self.default_mode_span { + // If this eats a by-ref default binding mode, label the binding mode. + self.default_mode_labels.insert(default_mode_span, default_ref_mutbl); + } + // Set the default binding mode to by-value and return the old default binding mode so it + // can be reinstated when we leave the pattern. + self.default_mode_span.take() + } + + /// Restores the default binding mode after lowering a pattern that could change it. + /// This should follow a call to either [`PatMigration::visit_explicit_deref`] or + /// [`PatMigration::visit_implicit_derefs`]. + pub(super) fn leave_ref(&mut self, old_mode_span: Option<(Span, Mutability)>) { + self.default_mode_span = old_mode_span + } + + /// Determines if a binding is relevant to the diagnostic and adjusts the notes/suggestion if + /// so. Bindings are relevant if they have a modifier under a by-ref default mode (invalid in + /// Rust 2024) or if we need to suggest a binding modifier for them. + pub(super) fn visit_binding( + &mut self, + pat_span: Span, + mode: BindingMode, + explicit_ba: BindingMode, + ident: Ident, + ) { + if explicit_ba != BindingMode::NONE + && let Some((default_mode_span, default_ref_mutbl)) = self.default_mode_span + { + // If this overrides a by-ref default binding mode, label the binding mode. + self.default_mode_labels.insert(default_mode_span, default_ref_mutbl); + // If our suggestion is to elide redundnt modes, this will be one of them. + if self.info.suggest_eliding_modes { + self.suggestion.push((pat_span.with_hi(ident.span.lo()), String::new())); + self.binding_mode_count += 1; + } + } + if !self.info.suggest_eliding_modes + && explicit_ba.0 == ByRef::No + && let ByRef::Yes(mutbl) = mode.0 + { + // If we can't fix the pattern by eliding modifiers, we'll need to make the pattern + // fully explicit. i.e. we'll need to suggest reference patterns for this. + let sugg_str = match mutbl { + Mutability::Not => "ref ", + Mutability::Mut => "ref mut ", + }; + self.suggestion + .push((pat_span.with_lo(ident.span.lo()).shrink_to_lo(), sugg_str.to_owned())); + self.binding_mode_count += 1; + } + } +} diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index 83fef7b0de6..8dc3f998e09 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -2,18 +2,17 @@ mod check_match; mod const_to_pat; +mod migration; use std::cmp::Ordering; use std::sync::Arc; use rustc_abi::{FieldIdx, Integer}; -use rustc_errors::MultiSpan; use rustc_errors::codes::*; use rustc_hir::def::{CtorOf, DefKind, Res}; use rustc_hir::pat_util::EnumerateAndAdjustIterator; -use rustc_hir::{self as hir, ByRef, Mutability, RangeEnd}; +use rustc_hir::{self as hir, RangeEnd}; use rustc_index::Idx; -use rustc_lint as lint; use rustc_middle::mir::interpret::LitToConstInput; use rustc_middle::thir::{ Ascription, FieldPat, LocalVarId, Pat, PatKind, PatRange, PatRangeBoundary, @@ -26,8 +25,8 @@ use rustc_span::{ErrorGuaranteed, Span}; use tracing::{debug, instrument}; pub(crate) use self::check_match::check_match; +use self::migration::PatMigration; use crate::errors::*; -use crate::fluent_generated as fluent; struct PatCtxt<'a, 'tcx> { tcx: TyCtxt<'tcx>, @@ -35,7 +34,7 @@ struct PatCtxt<'a, 'tcx> { typeck_results: &'a ty::TypeckResults<'tcx>, /// Used by the Rust 2024 migration lint. - rust_2024_migration_suggestion: Option<Rust2024IncompatiblePatSugg>, + rust_2024_migration: Option<PatMigration<'a>>, } pub(super) fn pat_from_hir<'a, 'tcx>( @@ -44,59 +43,19 @@ pub(super) fn pat_from_hir<'a, 'tcx>( typeck_results: &'a ty::TypeckResults<'tcx>, pat: &'tcx hir::Pat<'tcx>, ) -> Box<Pat<'tcx>> { - let migration_info = typeck_results.rust_2024_migration_desugared_pats().get(pat.hir_id); let mut pcx = PatCtxt { tcx, typing_env, typeck_results, - rust_2024_migration_suggestion: migration_info.and_then(|info| { - Some(Rust2024IncompatiblePatSugg { - suggest_eliding_modes: info.suggest_eliding_modes, - suggestion: Vec::new(), - ref_pattern_count: 0, - binding_mode_count: 0, - default_mode_span: None, - default_mode_labels: Default::default(), - }) - }), + rust_2024_migration: typeck_results + .rust_2024_migration_desugared_pats() + .get(pat.hir_id) + .map(PatMigration::new), }; let result = pcx.lower_pattern(pat); debug!("pat_from_hir({:?}) = {:?}", pat, result); - if let Some(info) = migration_info - && let Some(sugg) = pcx.rust_2024_migration_suggestion - { - let mut spans = - MultiSpan::from_spans(info.primary_labels.iter().map(|(span, _)| *span).collect()); - for (span, label) in &info.primary_labels { - spans.push_span_label(*span, label.clone()); - } - // If a relevant span is from at least edition 2024, this is a hard error. - let is_hard_error = spans.primary_spans().iter().any(|span| span.at_least_rust_2024()); - if is_hard_error { - let mut err = - tcx.dcx().struct_span_err(spans, fluent::mir_build_rust_2024_incompatible_pat); - if let Some(lint_info) = lint::builtin::RUST_2024_INCOMPATIBLE_PAT.future_incompatible { - // provide the same reference link as the lint - err.note(format!("for more information, see {}", lint_info.reference)); - } - err.arg("bad_modifiers", info.bad_modifiers); - err.arg("bad_ref_pats", info.bad_ref_pats); - err.arg("is_hard_error", true); - err.subdiagnostic(sugg); - err.emit(); - } else { - tcx.emit_node_span_lint( - lint::builtin::RUST_2024_INCOMPATIBLE_PAT, - pat.hir_id, - spans, - Rust2024IncompatiblePat { - sugg, - bad_modifiers: info.bad_modifiers, - bad_ref_pats: info.bad_ref_pats, - is_hard_error, - }, - ); - } + if let Some(m) = pcx.rust_2024_migration { + m.emit(tcx, pat.hir_id); } result } @@ -106,31 +65,13 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { let adjustments: &[Ty<'tcx>] = self.typeck_results.pat_adjustments().get(pat.hir_id).map_or(&[], |v| &**v); + // Track the default binding mode for the Rust 2024 migration suggestion. let mut opt_old_mode_span = None; - if let Some(s) = &mut self.rust_2024_migration_suggestion + if let Some(s) = &mut self.rust_2024_migration && !adjustments.is_empty() { - let implicit_deref_mutbls = adjustments.iter().map(|ref_ty| { - let &ty::Ref(_, _, mutbl) = ref_ty.kind() else { - span_bug!(pat.span, "pattern implicitly dereferences a non-ref type"); - }; - mutbl - }); - - if !s.suggest_eliding_modes { - let suggestion_str: String = - implicit_deref_mutbls.clone().map(|mutbl| mutbl.ref_prefix_str()).collect(); - s.suggestion.push((pat.span.shrink_to_lo(), suggestion_str)); - s.ref_pattern_count += adjustments.len(); - } - - // Remember if this changed the default binding mode, in case we want to label it. - let min_mutbl = implicit_deref_mutbls.min().unwrap(); - if s.default_mode_span.is_none_or(|(_, old_mutbl)| min_mutbl < old_mutbl) { - opt_old_mode_span = Some(s.default_mode_span); - s.default_mode_span = Some((pat.span, min_mutbl)); - } - }; + opt_old_mode_span = s.visit_implicit_derefs(pat.span, adjustments); + } // When implicit dereferences have been inserted in this pattern, the unadjusted lowered // pattern has the type that results *after* dereferencing. For example, in this code: @@ -169,10 +110,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { }) }); - if let Some(s) = &mut self.rust_2024_migration_suggestion - && let Some(old_mode_span) = opt_old_mode_span + if let Some(s) = &mut self.rust_2024_migration + && !adjustments.is_empty() { - s.default_mode_span = old_mode_span; + s.leave_ref(opt_old_mode_span); } adjusted_pat @@ -189,7 +130,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { // Lower the endpoint into a temporary `PatKind` that will then be // deconstructed to obtain the constant value and other data. - let mut kind: PatKind<'tcx> = self.lower_lit(expr); + let mut kind: PatKind<'tcx> = self.lower_pat_expr(expr); // Unpeel any ascription or inline-const wrapper nodes. loop { @@ -353,7 +294,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { hir::PatKind::Never => PatKind::Never, - hir::PatKind::Expr(value) => self.lower_lit(value), + hir::PatKind::Expr(value) => self.lower_pat_expr(value), hir::PatKind::Range(ref lo_expr, ref hi_expr, end) => { let (lo_expr, hi_expr) = (lo_expr.as_deref(), hi_expr.as_deref()); @@ -368,16 +309,11 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { } hir::PatKind::Ref(subpattern, _) => { // Track the default binding mode for the Rust 2024 migration suggestion. - let old_mode_span = self.rust_2024_migration_suggestion.as_mut().and_then(|s| { - if let Some((default_mode_span, default_ref_mutbl)) = s.default_mode_span { - // If this eats a by-ref default binding mode, label the binding mode. - s.default_mode_labels.insert(default_mode_span, default_ref_mutbl); - } - s.default_mode_span.take() - }); + let opt_old_mode_span = + self.rust_2024_migration.as_mut().and_then(|s| s.visit_explicit_deref()); let subpattern = self.lower_pattern(subpattern); - if let Some(s) = &mut self.rust_2024_migration_suggestion { - s.default_mode_span = old_mode_span; + if let Some(s) = &mut self.rust_2024_migration { + s.leave_ref(opt_old_mode_span); } PatKind::Deref { subpattern } } @@ -408,32 +344,8 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { .get(pat.hir_id) .expect("missing binding mode"); - if let Some(s) = &mut self.rust_2024_migration_suggestion { - if explicit_ba != hir::BindingMode::NONE - && let Some((default_mode_span, default_ref_mutbl)) = s.default_mode_span - { - // If this overrides a by-ref default binding mode, label the binding mode. - s.default_mode_labels.insert(default_mode_span, default_ref_mutbl); - // If our suggestion is to elide redundnt modes, this will be one of them. - if s.suggest_eliding_modes { - s.suggestion.push((pat.span.with_hi(ident.span.lo()), String::new())); - s.binding_mode_count += 1; - } - } - if !s.suggest_eliding_modes - && explicit_ba.0 == ByRef::No - && let ByRef::Yes(mutbl) = mode.0 - { - let sugg_str = match mutbl { - Mutability::Not => "ref ", - Mutability::Mut => "ref mut ", - }; - s.suggestion.push(( - pat.span.with_lo(ident.span.lo()).shrink_to_lo(), - sugg_str.to_owned(), - )); - s.binding_mode_count += 1; - } + if let Some(s) = &mut self.rust_2024_migration { + s.visit_binding(pat.span, mode, explicit_ba, ident); } // A ref x pattern is the same node used for x, and as such it has @@ -638,54 +550,57 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { let ty = self.typeck_results.node_type(id); let res = self.typeck_results.qpath_res(qpath, id); - let pat_from_kind = |kind| Box::new(Pat { span, ty, kind }); - - let (def_id, is_associated_const) = match res { - Res::Def(DefKind::Const, def_id) => (def_id, false), - Res::Def(DefKind::AssocConst, def_id) => (def_id, true), + let (def_id, user_ty) = match res { + Res::Def(DefKind::Const, def_id) => (def_id, None), + Res::Def(DefKind::AssocConst, def_id) => { + (def_id, self.typeck_results.user_provided_types().get(id)) + } - _ => return pat_from_kind(self.lower_variant_or_leaf(res, id, span, ty, vec![])), + _ => { + // The path isn't the name of a constant, so it must actually + // be a unit struct or unit variant (e.g. `Option::None`). + let kind = self.lower_variant_or_leaf(res, id, span, ty, vec![]); + return Box::new(Pat { span, ty, kind }); + } }; + // Lower the named constant to a THIR pattern. let args = self.typeck_results.node_args(id); let c = ty::Const::new_unevaluated(self.tcx, ty::UnevaluatedConst { def: def_id, args }); let subpattern = self.const_to_pat(c, ty, id, span); - let pattern = Box::new(Pat { - span, - ty, - kind: PatKind::ExpandedConstant { subpattern, def_id, is_inline: false }, - }); - if !is_associated_const { - return pattern; - } + // Wrap the pattern in a marker node to indicate that it is the result + // of lowering a named constant. This marker is used for improved + // diagnostics in some situations, but has no effect at runtime. + let mut pattern = { + let kind = PatKind::ExpandedConstant { subpattern, def_id, is_inline: false }; + Box::new(Pat { span, ty, kind }) + }; - let user_provided_types = self.typeck_results.user_provided_types(); - if let Some(&user_ty) = user_provided_types.get(id) { + // If this is an associated constant with an explicit user-written + // type, add an ascription node (e.g. `<Foo<'a> as MyTrait>::CONST`). + if let Some(&user_ty) = user_ty { let annotation = CanonicalUserTypeAnnotation { user_ty: Box::new(user_ty), span, inferred_ty: self.typeck_results.node_type(id), }; - Box::new(Pat { - span, - kind: PatKind::AscribeUserType { - subpattern: pattern, - ascription: Ascription { - annotation, - // Note that use `Contravariant` here. See the - // `variance` field documentation for details. - variance: ty::Contravariant, - }, + let kind = PatKind::AscribeUserType { + subpattern: pattern, + ascription: Ascription { + annotation, + // Note that we use `Contravariant` here. See the + // `variance` field documentation for details. + variance: ty::Contravariant, }, - ty, - }) - } else { - pattern + }; + pattern = Box::new(Pat { span, kind, ty }); } + + pattern } - /// Converts inline const patterns. + /// Lowers an inline const block (e.g. `const { 1 + 1 }`) to a pattern. fn lower_inline_const( &mut self, block: &'tcx hir::ConstBlock, @@ -705,14 +620,17 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { let ct = ty::UnevaluatedConst { def: def_id.to_def_id(), args }; let subpattern = self.const_to_pat(ty::Const::new_unevaluated(self.tcx, ct), ty, id, span); + + // Wrap the pattern in a marker node to indicate that it is the result + // of lowering an inline const block. PatKind::ExpandedConstant { subpattern, def_id: def_id.to_def_id(), is_inline: true } } - /// Converts literals, paths and negation of literals to patterns. - /// The special case for negation exists to allow things like `-128_i8` - /// which would overflow if we tried to evaluate `128_i8` and then negate - /// afterwards. - fn lower_lit(&mut self, expr: &'tcx hir::PatExpr<'tcx>) -> PatKind<'tcx> { + /// Lowers the kinds of "expression" that can appear in a HIR pattern: + /// - Paths (e.g. `FOO`, `foo::BAR`, `Option::None`) + /// - Inline const blocks (e.g. `const { 1 + 1 }`) + /// - Literals, possibly negated (e.g. `-128u8`, `"hello"`) + fn lower_pat_expr(&mut self, expr: &'tcx hir::PatExpr<'tcx>) -> PatKind<'tcx> { let (lit, neg) = match &expr.kind { hir::PatExprKind::Path(qpath) => { return self.lower_path(qpath, expr.hir_id, expr.span).kind; diff --git a/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs b/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs index e5cddd0e5e4..496a342cf4c 100644 --- a/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs +++ b/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs @@ -3,7 +3,26 @@ use rustc_middle::mir::{self, Body, Location, Terminator, TerminatorKind}; use tracing::debug; use super::move_paths::{InitKind, LookupResult, MoveData, MovePathIndex}; -use crate::elaborate_drops::DropFlagState; + +/// The value of an inserted drop flag. +#[derive(Debug, PartialEq, Eq, Copy, Clone)] +pub enum DropFlagState { + /// The tracked value is initialized and needs to be dropped when leaving its scope. + Present, + + /// The tracked value is uninitialized or was moved out of and does not need to be dropped when + /// leaving its scope. + Absent, +} + +impl DropFlagState { + pub fn value(self) -> bool { + match self { + DropFlagState::Present => true, + DropFlagState::Absent => false, + } + } +} pub fn move_path_children_matching<'tcx, F>( move_data: &MoveData<'tcx>, diff --git a/compiler/rustc_mir_dataflow/src/impls/initialized.rs b/compiler/rustc_mir_dataflow/src/impls/initialized.rs index 760f94af52d..3be450a0b3f 100644 --- a/compiler/rustc_mir_dataflow/src/impls/initialized.rs +++ b/compiler/rustc_mir_dataflow/src/impls/initialized.rs @@ -9,7 +9,7 @@ use rustc_middle::ty::util::Discr; use rustc_middle::ty::{self, TyCtxt}; use tracing::{debug, instrument}; -use crate::elaborate_drops::DropFlagState; +use crate::drop_flag_effects::DropFlagState; use crate::framework::SwitchIntTarget; use crate::move_paths::{HasMoveData, InitIndex, InitKind, LookupResult, MoveData, MovePathIndex}; use crate::{ diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs index 0cc79b0c939..a8a56baa1ff 100644 --- a/compiler/rustc_mir_dataflow/src/lib.rs +++ b/compiler/rustc_mir_dataflow/src/lib.rs @@ -15,7 +15,7 @@ use rustc_middle::ty; // Please change the public `use` directives cautiously, as they might be used by external tools. // See issue #120130. pub use self::drop_flag_effects::{ - drop_flag_effects_for_function_entry, drop_flag_effects_for_location, + DropFlagState, drop_flag_effects_for_function_entry, drop_flag_effects_for_location, move_path_children_matching, on_all_children_bits, on_lookup_result_bits, }; pub use self::framework::{ @@ -26,7 +26,6 @@ use self::move_paths::MoveData; pub mod debuginfo; mod drop_flag_effects; -pub mod elaborate_drops; mod errors; mod framework; pub mod impls; diff --git a/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs b/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs index 8716fd1c098..b33326cb873 100644 --- a/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs +++ b/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs @@ -1,8 +1,8 @@ -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; use tracing::debug; +use crate::patch::MirPatch; use crate::util; /// This pass moves values being dropped that are within a packed diff --git a/compiler/rustc_mir_transform/src/add_subtyping_projections.rs b/compiler/rustc_mir_transform/src/add_subtyping_projections.rs index e41f47db545..b5cd4133459 100644 --- a/compiler/rustc_mir_transform/src/add_subtyping_projections.rs +++ b/compiler/rustc_mir_transform/src/add_subtyping_projections.rs @@ -1,8 +1,9 @@ -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; +use crate::patch::MirPatch; + pub(super) struct Subtyper; struct SubTypeChecker<'a, 'tcx> { diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs index a9bdbeb9cb8..afc49c5cc54 100644 --- a/compiler/rustc_mir_transform/src/coroutine.rs +++ b/compiler/rustc_mir_transform/src/coroutine.rs @@ -1061,9 +1061,8 @@ fn insert_switch<'tcx>( } fn elaborate_coroutine_drops<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - use rustc_middle::mir::patch::MirPatch; - use rustc_mir_dataflow::elaborate_drops::{Unwind, elaborate_drop}; - + use crate::elaborate_drop::{Unwind, elaborate_drop}; + use crate::patch::MirPatch; use crate::shim::DropShimElaborator; // Note that `elaborate_drops` only drops the upvars of a coroutine, and diff --git a/compiler/rustc_mir_transform/src/coverage/mod.rs b/compiler/rustc_mir_transform/src/coverage/mod.rs index e195681bc92..264995efe8f 100644 --- a/compiler/rustc_mir_transform/src/coverage/mod.rs +++ b/compiler/rustc_mir_transform/src/coverage/mod.rs @@ -10,7 +10,6 @@ mod unexpand; use rustc_hir as hir; use rustc_hir::intravisit::{Visitor, walk_expr}; -use rustc_middle::hir::map::Map; use rustc_middle::hir::nested_filter; use rustc_middle::mir::coverage::{ CoverageKind, DecisionInfo, FunctionCoverageInfo, Mapping, MappingKind, @@ -291,7 +290,7 @@ fn extract_hir_info<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> ExtractedHir let hir_node = tcx.hir_node_by_def_id(def_id); let fn_body_id = hir_node.body_id().expect("HIR node is a function with body"); - let hir_body = tcx.hir().body(fn_body_id); + let hir_body = tcx.hir_body(fn_body_id); let maybe_fn_sig = hir_node.fn_sig(); let is_async_fn = maybe_fn_sig.is_some_and(|fn_sig| fn_sig.header.is_async()); @@ -348,7 +347,7 @@ fn extract_hole_spans_from_hir<'tcx>( hir_body: &hir::Body<'tcx>, ) -> Vec<Span> { struct HolesVisitor<'hir, F> { - hir: Map<'hir>, + tcx: TyCtxt<'hir>, visit_hole_span: F, } @@ -360,8 +359,8 @@ fn extract_hole_spans_from_hir<'tcx>( /// items contained within them. type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.hir + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_item(&mut self, item: &'hir hir::Item<'hir>) { @@ -388,7 +387,7 @@ fn extract_hole_spans_from_hir<'tcx>( let mut hole_spans = vec![]; let mut visitor = HolesVisitor { - hir: tcx.hir(), + tcx, visit_hole_span: |hole_span| { // Discard any holes that aren't directly visible within the body span. if body_span.contains(hole_span) && body_span.eq_ctxt(hole_span) { diff --git a/compiler/rustc_mir_transform/src/deref_separator.rs b/compiler/rustc_mir_transform/src/deref_separator.rs index a54bdaa4075..bc914ea6564 100644 --- a/compiler/rustc_mir_transform/src/deref_separator.rs +++ b/compiler/rustc_mir_transform/src/deref_separator.rs @@ -1,9 +1,10 @@ -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::visit::NonUseContext::VarDebugInfo; use rustc_middle::mir::visit::{MutVisitor, PlaceContext}; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; +use crate::patch::MirPatch; + pub(super) struct Derefer; struct DerefChecker<'a, 'tcx> { diff --git a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs index eb335a1e4a7..57f7893be1b 100644 --- a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs +++ b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs @@ -1,11 +1,11 @@ use std::fmt::Debug; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::{Ty, TyCtxt}; use tracing::trace; use super::simplify::simplify_cfg; +use crate::patch::MirPatch; /// This pass optimizes something like /// ```ignore (syntax-highlighting-only) diff --git a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs index 6d3b5d9851b..5c344a80688 100644 --- a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs +++ b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs @@ -4,12 +4,13 @@ use rustc_abi::FieldIdx; use rustc_hir::def_id::DefId; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::*; use rustc_middle::span_bug; use rustc_middle::ty::{Ty, TyCtxt}; +use crate::patch::MirPatch; + /// Constructs the types used when accessing a Box's pointer fn build_ptr_tys<'tcx>( tcx: TyCtxt<'tcx>, diff --git a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drop.rs index c1c47ecccf3..2de55e38052 100644 --- a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drop.rs @@ -3,7 +3,6 @@ use std::{fmt, iter, mem}; use rustc_abi::{FIRST_VARIANT, FieldIdx, VariantIdx}; use rustc_hir::lang_items::LangItem; use rustc_index::Idx; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::span_bug; use rustc_middle::ty::adjustment::PointerCoercion; @@ -13,29 +12,11 @@ use rustc_span::DUMMY_SP; use rustc_span::source_map::Spanned; use tracing::{debug, instrument}; -/// The value of an inserted drop flag. -#[derive(Debug, PartialEq, Eq, Copy, Clone)] -pub enum DropFlagState { - /// The tracked value is initialized and needs to be dropped when leaving its scope. - Present, - - /// The tracked value is uninitialized or was moved out of and does not need to be dropped when - /// leaving its scope. - Absent, -} - -impl DropFlagState { - pub fn value(self) -> bool { - match self { - DropFlagState::Present => true, - DropFlagState::Absent => false, - } - } -} +use crate::patch::MirPatch; /// Describes how/if a value should be dropped. #[derive(Debug)] -pub enum DropStyle { +pub(crate) enum DropStyle { /// The value is already dead at the drop location, no drop will be executed. Dead, @@ -56,7 +37,7 @@ pub enum DropStyle { /// Which drop flags to affect/check with an operation. #[derive(Debug)] -pub enum DropFlagMode { +pub(crate) enum DropFlagMode { /// Only affect the top-level drop flag, not that of any contained fields. Shallow, /// Affect all nested drop flags in addition to the top-level one. @@ -65,7 +46,7 @@ pub enum DropFlagMode { /// Describes if unwinding is necessary and where to unwind to if a panic occurs. #[derive(Copy, Clone, Debug)] -pub enum Unwind { +pub(crate) enum Unwind { /// Unwind to this block. To(BasicBlock), /// Already in an unwind path, any panic will cause an abort. @@ -98,7 +79,7 @@ impl Unwind { } } -pub trait DropElaborator<'a, 'tcx>: fmt::Debug { +pub(crate) trait DropElaborator<'a, 'tcx>: fmt::Debug { /// The type representing paths that can be moved out of. /// /// Users can move out of individual fields of a struct, such as `a.b.c`. This type is used to @@ -108,6 +89,7 @@ pub trait DropElaborator<'a, 'tcx>: fmt::Debug { // Accessors + fn patch_ref(&self) -> &MirPatch<'tcx>; fn patch(&mut self) -> &mut MirPatch<'tcx>; fn body(&self) -> &'a Body<'tcx>; fn tcx(&self) -> TyCtxt<'tcx>; @@ -177,7 +159,7 @@ where /// value. /// /// When this returns, the MIR patch in the `elaborator` contains the necessary changes. -pub fn elaborate_drop<'b, 'tcx, D>( +pub(crate) fn elaborate_drop<'b, 'tcx, D>( elaborator: &mut D, source_info: SourceInfo, place: Place<'tcx>, @@ -199,7 +181,14 @@ where { #[instrument(level = "trace", skip(self), ret)] fn place_ty(&self, place: Place<'tcx>) -> Ty<'tcx> { - place.ty(self.elaborator.body(), self.tcx()).ty + if place.local < self.elaborator.body().local_decls.next_index() { + place.ty(self.elaborator.body(), self.tcx()).ty + } else { + // We don't have a slice with all the locals, since some are in the patch. + tcx::PlaceTy::from_ty(self.elaborator.patch_ref().local_ty(place.local)) + .multi_projection_ty(self.elaborator.tcx(), place.projection) + .ty + } } fn tcx(&self) -> TyCtxt<'tcx> { @@ -429,12 +418,26 @@ where let unique_place = self.tcx().mk_place_field(self.place, FieldIdx::ZERO, unique_ty); let nonnull_place = self.tcx().mk_place_field(unique_place, FieldIdx::ZERO, nonnull_ty); - let ptr_place = self.tcx().mk_place_field(nonnull_place, FieldIdx::ZERO, ptr_ty); - let interior = self.tcx().mk_place_deref(ptr_place); + let ptr_local = self.new_temp(ptr_ty); + + let interior = self.tcx().mk_place_deref(Place::from(ptr_local)); let interior_path = self.elaborator.deref_subpath(self.path); - self.drop_subpath(interior, interior_path, succ, unwind) + let do_drop_bb = self.drop_subpath(interior, interior_path, succ, unwind); + + let setup_bbd = BasicBlockData { + statements: vec![self.assign( + Place::from(ptr_local), + Rvalue::Cast(CastKind::Transmute, Operand::Copy(nonnull_place), ptr_ty), + )], + terminator: Some(Terminator { + kind: TerminatorKind::Goto { target: do_drop_bb }, + source_info: self.source_info, + }), + is_cleanup: unwind.is_cleanup(), + }; + self.elaborator.patch().new_block(setup_bbd) } #[instrument(level = "debug", ret)] diff --git a/compiler/rustc_mir_transform/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drops.rs index cb869160c80..ab6aafab446 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drops.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drops.rs @@ -3,21 +3,20 @@ use std::fmt; use rustc_abi::{FieldIdx, VariantIdx}; use rustc_index::IndexVec; use rustc_index::bit_set::DenseBitSet; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; -use rustc_mir_dataflow::elaborate_drops::{ - DropElaborator, DropFlagMode, DropFlagState, DropStyle, Unwind, elaborate_drop, -}; use rustc_mir_dataflow::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces}; use rustc_mir_dataflow::move_paths::{LookupResult, MoveData, MovePathIndex}; use rustc_mir_dataflow::{ - Analysis, MoveDataTypingEnv, ResultsCursor, on_all_children_bits, on_lookup_result_bits, + Analysis, DropFlagState, MoveDataTypingEnv, ResultsCursor, on_all_children_bits, + on_lookup_result_bits, }; use rustc_span::Span; use tracing::{debug, instrument}; use crate::deref_separator::deref_finder; +use crate::elaborate_drop::{DropElaborator, DropFlagMode, DropStyle, Unwind, elaborate_drop}; +use crate::patch::MirPatch; /// During MIR building, Drop terminators are inserted in every place where a drop may occur. /// However, in this phase, the presence of these terminators does not guarantee that a destructor @@ -139,6 +138,10 @@ impl InitializationData<'_, '_> { impl<'a, 'tcx> DropElaborator<'a, 'tcx> for ElaborateDropsCtxt<'a, 'tcx> { type Path = MovePathIndex; + fn patch_ref(&self) -> &MirPatch<'tcx> { + &self.patch + } + fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch } diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 397d21a857f..46abdcb2a87 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -49,10 +49,12 @@ mod check_pointers; mod cost_checker; mod cross_crate_inline; mod deduce_param_attrs; +mod elaborate_drop; mod errors; mod ffi_unwind_calls; mod lint; mod lint_tail_expr_drop_order; +mod patch; mod shim; mod ssa; diff --git a/compiler/rustc_mir_transform/src/match_branches.rs b/compiler/rustc_mir_transform/src/match_branches.rs index 500116580d5..9db37bf5a07 100644 --- a/compiler/rustc_mir_transform/src/match_branches.rs +++ b/compiler/rustc_mir_transform/src/match_branches.rs @@ -2,7 +2,6 @@ use std::iter; use rustc_abi::Integer; use rustc_index::IndexSlice; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::layout::{IntegerExt, TyAndLayout}; use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt}; @@ -10,6 +9,7 @@ use rustc_type_ir::TyKind::*; use tracing::instrument; use super::simplify::simplify_cfg; +use crate::patch::MirPatch; pub(super) struct MatchBranchSimplification; diff --git a/compiler/rustc_middle/src/mir/patch.rs b/compiler/rustc_mir_transform/src/patch.rs index 748797fbb8d..b4f6fa514a4 100644 --- a/compiler/rustc_middle/src/mir/patch.rs +++ b/compiler/rustc_mir_transform/src/patch.rs @@ -1,11 +1,13 @@ +use rustc_index::{Idx, IndexVec}; +use rustc_middle::mir::*; +use rustc_middle::ty::Ty; +use rustc_span::Span; use tracing::debug; -use crate::mir::*; - /// This struct represents a patch to MIR, which can add /// new statements and basic blocks and patch over block /// terminators. -pub struct MirPatch<'tcx> { +pub(crate) struct MirPatch<'tcx> { patch_map: IndexVec<BasicBlock, Option<TerminatorKind<'tcx>>>, new_blocks: Vec<BasicBlockData<'tcx>>, new_statements: Vec<(Location, StatementKind<'tcx>)>, @@ -22,7 +24,7 @@ pub struct MirPatch<'tcx> { } impl<'tcx> MirPatch<'tcx> { - pub fn new(body: &Body<'tcx>) -> Self { + pub(crate) fn new(body: &Body<'tcx>) -> Self { let mut result = MirPatch { patch_map: IndexVec::from_elem(None, &body.basic_blocks), new_blocks: vec![], @@ -69,7 +71,7 @@ impl<'tcx> MirPatch<'tcx> { result } - pub fn resume_block(&mut self) -> BasicBlock { + pub(crate) fn resume_block(&mut self) -> BasicBlock { if let Some(bb) = self.resume_block { return bb; } @@ -86,7 +88,7 @@ impl<'tcx> MirPatch<'tcx> { bb } - pub fn unreachable_cleanup_block(&mut self) -> BasicBlock { + pub(crate) fn unreachable_cleanup_block(&mut self) -> BasicBlock { if let Some(bb) = self.unreachable_cleanup_block { return bb; } @@ -103,7 +105,7 @@ impl<'tcx> MirPatch<'tcx> { bb } - pub fn unreachable_no_cleanup_block(&mut self) -> BasicBlock { + pub(crate) fn unreachable_no_cleanup_block(&mut self) -> BasicBlock { if let Some(bb) = self.unreachable_no_cleanup_block { return bb; } @@ -120,7 +122,7 @@ impl<'tcx> MirPatch<'tcx> { bb } - pub fn terminate_block(&mut self, reason: UnwindTerminateReason) -> BasicBlock { + pub(crate) fn terminate_block(&mut self, reason: UnwindTerminateReason) -> BasicBlock { if let Some((cached_bb, cached_reason)) = self.terminate_block && reason == cached_reason { @@ -139,19 +141,11 @@ impl<'tcx> MirPatch<'tcx> { bb } - pub fn is_patched(&self, bb: BasicBlock) -> bool { + pub(crate) fn is_patched(&self, bb: BasicBlock) -> bool { self.patch_map[bb].is_some() } - pub fn terminator_loc(&self, body: &Body<'tcx>, bb: BasicBlock) -> Location { - let offset = match bb.index().checked_sub(body.basic_blocks.len()) { - Some(index) => self.new_blocks[index].statements.len(), - None => body[bb].statements.len(), - }; - Location { block: bb, statement_index: offset } - } - - pub fn new_local_with_info( + pub(crate) fn new_local_with_info( &mut self, ty: Ty<'tcx>, span: Span, @@ -165,14 +159,22 @@ impl<'tcx> MirPatch<'tcx> { Local::new(index) } - pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local { + pub(crate) fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local { let index = self.next_local; self.next_local += 1; self.new_locals.push(LocalDecl::new(ty, span)); Local::new(index) } - pub fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock { + /// Returns the type of a local that's newly-added in the patch. + pub(crate) fn local_ty(&self, local: Local) -> Ty<'tcx> { + let local = local.as_usize(); + assert!(local < self.next_local); + let new_local_idx = self.new_locals.len() - (self.next_local - local); + self.new_locals[new_local_idx].ty + } + + pub(crate) fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock { let block = BasicBlock::new(self.patch_map.len()); debug!("MirPatch: new_block: {:?}: {:?}", block, data); self.new_blocks.push(data); @@ -180,22 +182,22 @@ impl<'tcx> MirPatch<'tcx> { block } - pub fn patch_terminator(&mut self, block: BasicBlock, new: TerminatorKind<'tcx>) { + pub(crate) fn patch_terminator(&mut self, block: BasicBlock, new: TerminatorKind<'tcx>) { assert!(self.patch_map[block].is_none()); debug!("MirPatch: patch_terminator({:?}, {:?})", block, new); self.patch_map[block] = Some(new); } - pub fn add_statement(&mut self, loc: Location, stmt: StatementKind<'tcx>) { + pub(crate) fn add_statement(&mut self, loc: Location, stmt: StatementKind<'tcx>) { debug!("MirPatch: add_statement({:?}, {:?})", loc, stmt); self.new_statements.push((loc, stmt)); } - pub fn add_assign(&mut self, loc: Location, place: Place<'tcx>, rv: Rvalue<'tcx>) { + pub(crate) fn add_assign(&mut self, loc: Location, place: Place<'tcx>, rv: Rvalue<'tcx>) { self.add_statement(loc, StatementKind::Assign(Box::new((place, rv)))); } - pub fn apply(self, body: &mut Body<'tcx>) { + pub(crate) fn apply(self, body: &mut Body<'tcx>) { debug!( "MirPatch: {:?} new temps, starting from index {}: {:?}", self.new_locals.len(), @@ -241,14 +243,14 @@ impl<'tcx> MirPatch<'tcx> { } } - pub fn source_info_for_index(data: &BasicBlockData<'_>, loc: Location) -> SourceInfo { + fn source_info_for_index(data: &BasicBlockData<'_>, loc: Location) -> SourceInfo { match data.statements.get(loc.statement_index) { Some(stmt) => stmt.source_info, None => data.terminator().source_info, } } - pub fn source_info_for_location(&self, body: &Body<'tcx>, loc: Location) -> SourceInfo { + pub(crate) fn source_info_for_location(&self, body: &Body<'tcx>, loc: Location) -> SourceInfo { let data = match loc.block.index().checked_sub(body.basic_blocks.len()) { Some(new) => &self.new_blocks[new], None => &body[loc.block], diff --git a/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs b/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs index 9cdd52bec7b..1dd34005d66 100644 --- a/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs +++ b/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs @@ -1,10 +1,11 @@ use rustc_index::bit_set::DenseBitSet; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; use rustc_target::spec::PanicStrategy; use tracing::debug; +use crate::patch::MirPatch; + /// A pass that removes noop landing pads and replaces jumps to them with /// `UnwindAction::Continue`. This is important because otherwise LLVM generates /// terrible code for these. diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index f7ec0f740d3..34074a84e28 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -6,7 +6,6 @@ use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::lang_items::LangItem; use rustc_index::{Idx, IndexVec}; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::query::Providers; use rustc_middle::ty::adjustment::PointerCoercion; @@ -14,11 +13,12 @@ use rustc_middle::ty::{ self, CoroutineArgs, CoroutineArgsExt, EarlyBinder, GenericArgs, Ty, TyCtxt, }; use rustc_middle::{bug, span_bug}; -use rustc_mir_dataflow::elaborate_drops::{self, DropElaborator, DropFlagMode, DropStyle}; use rustc_span::source_map::Spanned; use rustc_span::{DUMMY_SP, Span}; use tracing::{debug, instrument}; +use crate::elaborate_drop::{DropElaborator, DropFlagMode, DropStyle, Unwind, elaborate_drop}; +use crate::patch::MirPatch; use crate::{ abort_unwinding_calls, add_call_guards, add_moves_for_packed_drops, deref_separator, inline, instsimplify, mentioned_items, pass_manager as pm, remove_noop_landing_pads, simplify, @@ -283,13 +283,13 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option<Ty<'tcx>>) DropShimElaborator { body: &body, patch: MirPatch::new(&body), tcx, typing_env }; let dropee = tcx.mk_place_deref(dropee_ptr); let resume_block = elaborator.patch.resume_block(); - elaborate_drops::elaborate_drop( + elaborate_drop( &mut elaborator, source_info, dropee, (), return_block, - elaborate_drops::Unwind::To(resume_block), + Unwind::To(resume_block), START_BLOCK, ); elaborator.patch @@ -350,6 +350,9 @@ impl fmt::Debug for DropShimElaborator<'_, '_> { impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { type Path = (); + fn patch_ref(&self) -> &MirPatch<'tcx> { + &self.patch + } fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch } diff --git a/compiler/rustc_mir_transform/src/sroa.rs b/compiler/rustc_mir_transform/src/sroa.rs index 92e5c8a9ca4..28de99f9193 100644 --- a/compiler/rustc_mir_transform/src/sroa.rs +++ b/compiler/rustc_mir_transform/src/sroa.rs @@ -4,13 +4,14 @@ use rustc_hir::LangItem; use rustc_index::IndexVec; use rustc_index::bit_set::{DenseBitSet, GrowableBitSet}; use rustc_middle::bug; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::visit::*; use rustc_middle::mir::*; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_mir_dataflow::value_analysis::{excluded_locals, iter_fields}; use tracing::{debug, instrument}; +use crate::patch::MirPatch; + pub(super) struct ScalarReplacementOfAggregates; impl<'tcx> crate::MirPass<'tcx> for ScalarReplacementOfAggregates { diff --git a/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs index 1ff7043ed14..6ccec5b6f21 100644 --- a/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs +++ b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs @@ -3,7 +3,6 @@ use rustc_abi::Variants; use rustc_data_structures::fx::FxHashSet; use rustc_middle::bug; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::{ BasicBlock, BasicBlockData, BasicBlocks, Body, Local, Operand, Rvalue, StatementKind, TerminatorKind, @@ -12,6 +11,8 @@ use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::{Ty, TyCtxt}; use tracing::trace; +use crate::patch::MirPatch; + pub(super) struct UnreachableEnumBranching; fn get_discriminant_local(terminator: &TerminatorKind<'_>) -> Option<Local> { diff --git a/compiler/rustc_mir_transform/src/unreachable_prop.rs b/compiler/rustc_mir_transform/src/unreachable_prop.rs index 1e5d9469c03..13fb5b3e56f 100644 --- a/compiler/rustc_mir_transform/src/unreachable_prop.rs +++ b/compiler/rustc_mir_transform/src/unreachable_prop.rs @@ -6,10 +6,11 @@ use rustc_abi::Size; use rustc_data_structures::fx::FxHashSet; use rustc_middle::bug; use rustc_middle::mir::interpret::Scalar; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; +use crate::patch::MirPatch; + pub(super) struct UnreachablePropagation; impl crate::MirPass<'_> for UnreachablePropagation { diff --git a/compiler/rustc_monomorphize/messages.ftl b/compiler/rustc_monomorphize/messages.ftl index 540ce7cc4ce..463c42b69b1 100644 --- a/compiler/rustc_monomorphize/messages.ftl +++ b/compiler/rustc_monomorphize/messages.ftl @@ -1,17 +1,17 @@ monomorphize_abi_error_disabled_vector_type_call = - this function call uses a SIMD vector type that (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled in the caller + this function call uses SIMD vector type `{$ty}` which (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled in the caller .label = function called here .help = consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable="{$required_feature}")]`) monomorphize_abi_error_disabled_vector_type_def = - this function definition uses a SIMD vector type that (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled + this function definition uses SIMD vector type `{$ty}` which (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled .label = function defined here .help = consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable="{$required_feature}")]`) monomorphize_abi_error_unsupported_vector_type_call = - this function call uses a SIMD vector type that is not currently supported with the chosen ABI + this function call uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI .label = function called here monomorphize_abi_error_unsupported_vector_type_def = - this function definition uses a SIMD vector type that is not currently supported with the chosen ABI + this function definition uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI .label = function defined here monomorphize_couldnt_dump_mono_stats = diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index ae31ed59391..1195c25e130 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -478,7 +478,7 @@ fn collect_items_rec<'tcx>( ); recursion_depth_reset = None; - let item = tcx.hir().item(item_id); + let item = tcx.hir_item(item_id); if let hir::ItemKind::GlobalAsm(asm) = item.kind { for (op, op_sp) in asm.operands { match op { @@ -1509,6 +1509,13 @@ impl<'v> RootCollector<'_, 'v> { } _ => unreachable!(), }; + let Ok(instance) = self.tcx.try_normalize_erasing_regions( + ty::TypingEnv::fully_monomorphized(), + instance, + ) else { + // Don't ICE on an impossible-to-normalize closure. + return; + }; let mono_item = create_fn_mono_item(self.tcx, instance, DUMMY_SP); if mono_item.node.is_instantiable(self.tcx) { self.output.push(mono_item); diff --git a/compiler/rustc_monomorphize/src/errors.rs b/compiler/rustc_monomorphize/src/errors.rs index fc8d63b5888..75687a80b82 100644 --- a/compiler/rustc_monomorphize/src/errors.rs +++ b/compiler/rustc_monomorphize/src/errors.rs @@ -1,6 +1,7 @@ use std::path::PathBuf; use rustc_macros::{Diagnostic, LintDiagnostic}; +use rustc_middle::ty::Ty; use rustc_span::{Span, Symbol}; #[derive(Diagnostic)] @@ -75,6 +76,7 @@ pub(crate) struct AbiErrorDisabledVectorTypeDef<'a> { #[label] pub span: Span, pub required_feature: &'a str, + pub ty: Ty<'a>, } #[derive(LintDiagnostic)] @@ -84,18 +86,21 @@ pub(crate) struct AbiErrorDisabledVectorTypeCall<'a> { #[label] pub span: Span, pub required_feature: &'a str, + pub ty: Ty<'a>, } #[derive(LintDiagnostic)] #[diag(monomorphize_abi_error_unsupported_vector_type_def)] -pub(crate) struct AbiErrorUnsupportedVectorTypeDef { +pub(crate) struct AbiErrorUnsupportedVectorTypeDef<'a> { #[label] pub span: Span, + pub ty: Ty<'a>, } #[derive(LintDiagnostic)] #[diag(monomorphize_abi_error_unsupported_vector_type_call)] -pub(crate) struct AbiErrorUnsupportedVectorTypeCall { +pub(crate) struct AbiErrorUnsupportedVectorTypeCall<'a> { #[label] pub span: Span, + pub ty: Ty<'a>, } diff --git a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs index a0be7f11d70..36cd3e00b76 100644 --- a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs +++ b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs @@ -34,7 +34,7 @@ fn do_check_abi<'tcx>( tcx: TyCtxt<'tcx>, abi: &FnAbi<'tcx, Ty<'tcx>>, target_feature_def: DefId, - mut emit_err: impl FnMut(Option<&'static str>), + mut emit_err: impl FnMut(Ty<'tcx>, Option<&'static str>), ) { let feature_def = tcx.sess.target.features_for_correct_vector_abi(); let codegen_attrs = tcx.codegen_fn_attrs(target_feature_def); @@ -45,7 +45,7 @@ fn do_check_abi<'tcx>( let feature = match feature_def.iter().find(|(bits, _)| size.bits() <= *bits) { Some((_, feature)) => feature, None => { - emit_err(None); + emit_err(arg_abi.layout.ty, None); continue; } }; @@ -53,7 +53,7 @@ fn do_check_abi<'tcx>( if !tcx.sess.unstable_target_features.contains(&feature_sym) && !codegen_attrs.target_features.iter().any(|x| x.name == feature_sym) { - emit_err(Some(&feature)); + emit_err(arg_abi.layout.ty, Some(&feature)); } } } @@ -69,21 +69,21 @@ fn check_instance_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) { // function. return; }; - do_check_abi(tcx, abi, instance.def_id(), |required_feature| { + do_check_abi(tcx, abi, instance.def_id(), |ty, required_feature| { let span = tcx.def_span(instance.def_id()); if let Some(required_feature) = required_feature { tcx.emit_node_span_lint( ABI_UNSUPPORTED_VECTOR_TYPES, CRATE_HIR_ID, span, - AbiErrorDisabledVectorTypeDef { span, required_feature }, + AbiErrorDisabledVectorTypeDef { span, required_feature, ty }, ); } else { tcx.emit_node_span_lint( ABI_UNSUPPORTED_VECTOR_TYPES, CRATE_HIR_ID, span, - AbiErrorUnsupportedVectorTypeDef { span }, + AbiErrorUnsupportedVectorTypeDef { span, ty }, ); } }) @@ -123,20 +123,20 @@ fn check_call_site_abi<'tcx>( // ABI failed to compute; this will not get through codegen. return; }; - do_check_abi(tcx, callee_abi, caller.def_id(), |required_feature| { + do_check_abi(tcx, callee_abi, caller.def_id(), |ty, required_feature| { if let Some(required_feature) = required_feature { tcx.emit_node_span_lint( ABI_UNSUPPORTED_VECTOR_TYPES, CRATE_HIR_ID, span, - AbiErrorDisabledVectorTypeCall { span, required_feature }, + AbiErrorDisabledVectorTypeCall { span, required_feature, ty }, ); } else { tcx.emit_node_span_lint( ABI_UNSUPPORTED_VECTOR_TYPES, CRATE_HIR_ID, span, - AbiErrorUnsupportedVectorTypeCall { span }, + AbiErrorUnsupportedVectorTypeCall { span, ty }, ); } }); diff --git a/compiler/rustc_parse/messages.ftl b/compiler/rustc_parse/messages.ftl index d50bd18a1d7..563081c7240 100644 --- a/compiler/rustc_parse/messages.ftl +++ b/compiler/rustc_parse/messages.ftl @@ -743,9 +743,6 @@ parse_single_colon_import_path = expected `::`, found `:` .suggestion = use double colon .note = import paths are delimited using `::` -parse_single_colon_struct_type = found single colon in a struct field type path - .suggestion = write a path separator here - parse_static_with_generics = static items may not have generic parameters parse_struct_literal_body_without_path = diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 8f0e29c2769..dc03d6f9521 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -3072,14 +3072,6 @@ pub(crate) struct BadItemKind { } #[derive(Diagnostic)] -#[diag(parse_single_colon_struct_type)] -pub(crate) struct SingleColonStructType { - #[primary_span] - #[suggestion(code = "::", applicability = "maybe-incorrect", style = "verbose")] - pub span: Span, -} - -#[derive(Diagnostic)] #[diag(parse_macro_rules_missing_bang)] pub(crate) struct MacroRulesMissingBang { #[primary_span] diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 637ed2774a2..c923717ecaf 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -2043,9 +2043,6 @@ impl<'a> Parser<'a> { } self.expect_field_ty_separator()?; let ty = self.parse_ty()?; - if self.token == token::Colon && self.look_ahead(1, |t| *t != token::Colon) { - self.dcx().emit_err(errors::SingleColonStructType { span: self.token.span }); - } let default = if self.token == token::Eq { self.bump(); let const_expr = self.parse_expr_anon_const()?; diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index ea464fc8ebb..1de452dcf39 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -754,9 +754,9 @@ impl<'a> Parser<'a> { self.is_keyword_ahead(0, &[kw::Const]) && self.look_ahead(1, |t| match &t.kind { // async closures do not work with const closures, so we do not parse that here. - token::Ident(kw::Move | kw::Static, _) | token::OrOr | token::BinOp(token::Or) => { - true - } + token::Ident(kw::Move | kw::Static, IdentIsRaw::No) + | token::OrOr + | token::BinOp(token::Or) => true, _ => false, }) } diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 64bcb1a5a36..8ce749ec814 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -1472,17 +1472,6 @@ impl<'a> Parser<'a> { let mut last_non_comma_dotdot_span = None; while self.token != token::CloseDelim(Delimiter::Brace) { - let attrs = match self.parse_outer_attributes() { - Ok(attrs) => attrs, - Err(err) => { - if let Some(delayed) = delayed_err { - delayed.emit(); - } - return Err(err); - } - }; - let lo = self.token.span; - // check that a comma comes after every field if !ate_comma { let err = if self.token == token::At { @@ -1585,6 +1574,17 @@ impl<'a> Parser<'a> { } } + let attrs = match self.parse_outer_attributes() { + Ok(attrs) => attrs, + Err(err) => { + if let Some(delayed) = delayed_err { + delayed.emit(); + } + return Err(err); + } + }; + let lo = self.token.span; + let field = self.collect_tokens(None, attrs, ForceCollect::No, |this, attrs| { let field = match this.parse_pat_field(lo, attrs) { Ok(field) => Ok(field), diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 576711e6677..b241aa892db 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -246,8 +246,19 @@ impl<'a> Parser<'a> { segments.push(segment); if self.is_import_coupler() || !self.eat_path_sep() { - if style == PathStyle::Expr - && self.may_recover() + let ok_for_recovery = self.may_recover() + && match style { + PathStyle::Expr => true, + PathStyle::Type if let Some((ident, _)) = self.prev_token.ident() => { + self.token == token::Colon + && ident.as_str().chars().all(|c| c.is_lowercase()) + && self.token.span.lo() == self.prev_token.span.hi() + && self + .look_ahead(1, |token| self.token.span.hi() == token.span.lo()) + } + _ => false, + }; + if ok_for_recovery && self.token == token::Colon && self.look_ahead(1, |token| token.is_ident() && !token.is_reserved_ident()) { diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index f578708b40c..396a0cbc889 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -627,7 +627,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { fn check_object_lifetime_default(&self, hir_id: HirId) { let tcx = self.tcx; if let Some(owner_id) = hir_id.as_owner() - && let Some(generics) = tcx.hir().get_generics(owner_id.def_id) + && let Some(generics) = tcx.hir_get_generics(owner_id.def_id) { for p in generics.params { let hir::GenericParamKind::Type { .. } = p.kind else { continue }; @@ -2606,8 +2606,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> { impl<'tcx> Visitor<'tcx> for CheckAttrVisitor<'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_item(&mut self, item: &'tcx Item<'tcx>) { @@ -2740,9 +2740,8 @@ fn check_invalid_crate_level_attr(tcx: TyCtxt<'_>, attrs: &[Attribute]) { for attr_to_check in ATTRS_TO_CHECK { if attr.has_name(*attr_to_check) { let item = tcx - .hir() - .items() - .map(|id| tcx.hir().item(id)) + .hir_free_items() + .map(|id| tcx.hir_item(id)) .find(|item| !item.span.is_dummy()) // Skip prelude `use`s .map(|item| errors::ItemFollowingInnerAttr { span: item.ident.span, diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 95f18eaa7ef..696cc79bfeb 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -531,7 +531,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { fn impl_item_with_used_self(&mut self, impl_id: hir::ItemId, impl_item_id: LocalDefId) -> bool { if let TyKind::Path(hir::QPath::Resolved(_, path)) = - self.tcx.hir().item(impl_id).expect_impl().self_ty.kind + self.tcx.hir_item(impl_id).expect_impl().self_ty.kind && let Res::Def(def_kind, def_id) = path.res && let Some(local_def_id) = def_id.as_local() && matches!(def_kind, DefKind::Struct | DefKind::Enum | DefKind::Union) @@ -559,7 +559,7 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { fn visit_nested_body(&mut self, body: hir::BodyId) { let old_maybe_typeck_results = self.maybe_typeck_results.replace(self.tcx.typeck_body(body)); - let body = self.tcx.hir().body(body); + let body = self.tcx.hir_body(body); self.visit_body(body); self.maybe_typeck_results = old_maybe_typeck_results; } @@ -750,7 +750,7 @@ fn check_item<'tcx>( match tcx.def_kind(id.owner_id) { DefKind::Enum => { - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); if let hir::ItemKind::Enum(ref enum_def, _) = item.kind { if let Some(comes_from_allow) = allow_dead_code { worklist.extend( @@ -772,7 +772,7 @@ fn check_item<'tcx>( .iter() .filter_map(|def_id| def_id.as_local()); - let ty_is_pub = ty_ref_to_pub_struct(tcx, tcx.hir().item(id).expect_impl().self_ty); + let ty_is_pub = ty_ref_to_pub_struct(tcx, tcx.hir_item(id).expect_impl().self_ty); // And we access the Map here to get HirId from LocalDefId for local_def_id in local_def_ids { @@ -805,7 +805,7 @@ fn check_item<'tcx>( } } DefKind::Struct => { - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); if let hir::ItemKind::Struct(ref variant_data, _) = item.kind && let Some(ctor_def_id) = variant_data.ctor_def_id() { @@ -827,7 +827,7 @@ fn check_trait_item( ) { use hir::TraitItemKind::{Const, Fn}; if matches!(tcx.def_kind(id.owner_id), DefKind::AssocConst | DefKind::AssocFn) { - let trait_item = tcx.hir().trait_item(id); + let trait_item = tcx.hir_trait_item(id); if matches!(trait_item.kind, Const(_, Some(_)) | Fn(..)) && let Some(comes_from_allow) = has_allow_dead_code_or_lang_attr(tcx, trait_item.owner_id.def_id) diff --git a/compiler/rustc_passes/src/entry.rs b/compiler/rustc_passes/src/entry.rs index 22291c9282d..c2225ea1e64 100644 --- a/compiler/rustc_passes/src/entry.rs +++ b/compiler/rustc_passes/src/entry.rs @@ -37,7 +37,7 @@ fn entry_fn(tcx: TyCtxt<'_>, (): ()) -> Option<(DefId, EntryFnType)> { let mut ctxt = EntryContext { tcx, rustc_main_fn: None, non_main_fns: Vec::new() }; - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { check_and_search_item(id, &mut ctxt); } diff --git a/compiler/rustc_passes/src/hir_id_validator.rs b/compiler/rustc_passes/src/hir_id_validator.rs index 74038b24dcc..43f2f892e77 100644 --- a/compiler/rustc_passes/src/hir_id_validator.rs +++ b/compiler/rustc_passes/src/hir_id_validator.rs @@ -61,7 +61,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> { if max != self.hir_ids_seen.len() - 1 { let hir = self.tcx.hir(); - let pretty_owner = hir.def_path(owner.def_id).to_string_no_crate_verbose(); + let pretty_owner = self.tcx.hir_def_path(owner.def_id).to_string_no_crate_verbose(); let missing_items: Vec<_> = (0..=max as u32) .map(|i| ItemLocalId::from_u32(i)) @@ -105,8 +105,8 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> { impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_nested_item(&mut self, id: hir::ItemId) { @@ -138,8 +138,8 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { format!( "HirIdValidator: The recorded owner of {} is {} instead of {}", self.tcx.hir().node_to_string(hir_id), - self.tcx.hir().def_path(hir_id.owner.def_id).to_string_no_crate_verbose(), - self.tcx.hir().def_path(owner.def_id).to_string_no_crate_verbose() + self.tcx.hir_def_path(hir_id.owner.def_id).to_string_no_crate_verbose(), + self.tcx.hir_def_path(owner.def_id).to_string_no_crate_verbose() ) }); } diff --git a/compiler/rustc_passes/src/input_stats.rs b/compiler/rustc_passes/src/input_stats.rs index f7cae89852e..e60dcc807c9 100644 --- a/compiler/rustc_passes/src/input_stats.rs +++ b/compiler/rustc_passes/src/input_stats.rs @@ -7,7 +7,6 @@ use rustc_ast::{self as ast, NodeId, visit as ast_visit}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::thousands::format_with_underscores; use rustc_hir::{self as hir, AmbigArg, HirId, intravisit as hir_visit}; -use rustc_middle::hir::map::Map; use rustc_middle::ty::TyCtxt; use rustc_span::Span; use rustc_span::def_id::LocalDefId; @@ -56,17 +55,14 @@ impl Node { /// a `visit_*` method for, and so we cannot measure these, which is /// unfortunate. struct StatCollector<'k> { - krate: Option<Map<'k>>, + tcx: Option<TyCtxt<'k>>, nodes: FxHashMap<&'static str, Node>, seen: FxHashSet<HirId>, } pub fn print_hir_stats(tcx: TyCtxt<'_>) { - let mut collector = StatCollector { - krate: Some(tcx.hir()), - nodes: FxHashMap::default(), - seen: FxHashSet::default(), - }; + let mut collector = + StatCollector { tcx: Some(tcx), nodes: FxHashMap::default(), seen: FxHashSet::default() }; tcx.hir().walk_toplevel_module(&mut collector); tcx.hir().walk_attributes(&mut collector); collector.print("HIR STATS", "hir-stats"); @@ -76,7 +72,7 @@ pub fn print_ast_stats(krate: &ast::Crate, title: &str, prefix: &str) { use rustc_ast::visit::Visitor; let mut collector = - StatCollector { krate: None, nodes: FxHashMap::default(), seen: FxHashSet::default() }; + StatCollector { tcx: None, nodes: FxHashMap::default(), seen: FxHashSet::default() }; collector.visit_crate(krate); collector.print(title, prefix); } @@ -205,27 +201,27 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_nested_item(&mut self, id: hir::ItemId) { - let nested_item = self.krate.unwrap().item(id); + let nested_item = self.tcx.unwrap().hir_item(id); self.visit_item(nested_item) } fn visit_nested_trait_item(&mut self, trait_item_id: hir::TraitItemId) { - let nested_trait_item = self.krate.unwrap().trait_item(trait_item_id); + let nested_trait_item = self.tcx.unwrap().hir_trait_item(trait_item_id); self.visit_trait_item(nested_trait_item) } fn visit_nested_impl_item(&mut self, impl_item_id: hir::ImplItemId) { - let nested_impl_item = self.krate.unwrap().impl_item(impl_item_id); + let nested_impl_item = self.tcx.unwrap().hir_impl_item(impl_item_id); self.visit_impl_item(nested_impl_item) } fn visit_nested_foreign_item(&mut self, id: hir::ForeignItemId) { - let nested_foreign_item = self.krate.unwrap().foreign_item(id); + let nested_foreign_item = self.tcx.unwrap().hir_foreign_item(id); self.visit_foreign_item(nested_foreign_item); } fn visit_nested_body(&mut self, body_id: hir::BodyId) { - let nested_body = self.krate.unwrap().body(body_id); + let nested_body = self.tcx.unwrap().hir_body(body_id); self.visit_body(nested_body) } diff --git a/compiler/rustc_passes/src/lib_features.rs b/compiler/rustc_passes/src/lib_features.rs index 600c46eb3d0..09d59e1f717 100644 --- a/compiler/rustc_passes/src/lib_features.rs +++ b/compiler/rustc_passes/src/lib_features.rs @@ -129,8 +129,8 @@ impl<'tcx> LibFeatureCollector<'tcx> { impl<'tcx> Visitor<'tcx> for LibFeatureCollector<'tcx> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_attribute(&mut self, attr: &'tcx Attribute) { diff --git a/compiler/rustc_passes/src/loops.rs b/compiler/rustc_passes/src/loops.rs index 6eef0b926a1..0fd980af0b5 100644 --- a/compiler/rustc_passes/src/loops.rs +++ b/compiler/rustc_passes/src/loops.rs @@ -87,8 +87,8 @@ pub(crate) fn provide(providers: &mut Providers) { impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_anon_const(&mut self, c: &'hir hir::AnonConst) { diff --git a/compiler/rustc_passes/src/naked_functions.rs b/compiler/rustc_passes/src/naked_functions.rs index 875b6edb58c..cb17b0f6cf5 100644 --- a/compiler/rustc_passes/src/naked_functions.rs +++ b/compiler/rustc_passes/src/naked_functions.rs @@ -45,7 +45,7 @@ fn check_mod_naked_functions(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) { _ => continue, }; - let body = tcx.hir().body(body_id); + let body = tcx.hir_body(body_id); if tcx.has_attr(def_id, sym::naked) { check_abi(tcx, def_id, fn_header.abi); @@ -259,8 +259,8 @@ struct CheckNakedAsmInNakedFn<'tcx> { impl<'tcx> Visitor<'tcx> for CheckNakedAsmInNakedFn<'tcx> { type NestedFilter = OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) { diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index 7788adb6e17..1fe44bd3d21 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -66,7 +66,7 @@ impl<'tcx> Visitor<'tcx> for ReachableContext<'tcx> { fn visit_nested_body(&mut self, body: hir::BodyId) { let old_maybe_typeck_results = self.maybe_typeck_results.replace(self.tcx.typeck_body(body)); - let body = self.tcx.hir().body(body); + let body = self.tcx.hir_body(body); self.visit_body(body); self.maybe_typeck_results = old_maybe_typeck_results; } diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index fd30d0d4867..d045e61d1d4 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -394,8 +394,8 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { /// deep-walking. type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_item(&mut self, i: &'tcx Item<'tcx>) { @@ -616,8 +616,8 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> { impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_item(&mut self, i: &'tcx Item<'tcx>) { @@ -756,8 +756,8 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> { /// Because stability levels are scoped lexically, we want to walk /// nested items in the context of the outer item, so enable /// deep-walking. - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs index 2694cf472f4..0b1e954d64d 100644 --- a/compiler/rustc_pattern_analysis/src/rustc.rs +++ b/compiler/rustc_pattern_analysis/src/rustc.rs @@ -1084,12 +1084,16 @@ pub fn analyze_match<'p, 'tcx>( tycx: &RustcPatCtxt<'p, 'tcx>, arms: &[MatchArm<'p, 'tcx>], scrut_ty: Ty<'tcx>, - pattern_complexity_limit: Option<usize>, ) -> Result<UsefulnessReport<'p, 'tcx>, ErrorGuaranteed> { let scrut_ty = tycx.reveal_opaque_ty(scrut_ty); let scrut_validity = PlaceValidity::from_bool(tycx.known_valid_scrutinee); - let report = - compute_match_usefulness(tycx, arms, scrut_ty, scrut_validity, pattern_complexity_limit)?; + let report = compute_match_usefulness( + tycx, + arms, + scrut_ty, + scrut_validity, + tycx.tcx.pattern_complexity_limit().0, + )?; // Run the non_exhaustive_omitted_patterns lint. Only run on refutable patterns to avoid hitting // `if let`s. Only run if the match is exhaustive otherwise the error is redundant. diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index cc09cd491af..1dff76141da 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -795,20 +795,21 @@ struct UsefulnessCtxt<'a, 'p, Cx: PatCx> { /// Track information about the usefulness of branch patterns (see definition of "branch /// pattern" at [`BranchPatUsefulness`]). branch_usefulness: FxHashMap<PatId, BranchPatUsefulness<'p, Cx>>, - complexity_limit: Option<usize>, + // Ideally this field would have type `Limit`, but this crate is used by + // rust-analyzer which cannot have a dependency on `Limit`, because `Limit` + // is from crate `rustc_session` which uses unstable Rust features. + complexity_limit: usize, complexity_level: usize, } impl<'a, 'p, Cx: PatCx> UsefulnessCtxt<'a, 'p, Cx> { fn increase_complexity_level(&mut self, complexity_add: usize) -> Result<(), Cx::Error> { self.complexity_level += complexity_add; - if self - .complexity_limit - .is_some_and(|complexity_limit| complexity_limit < self.complexity_level) - { - return self.tycx.complexity_exceeded(); + if self.complexity_level <= self.complexity_limit { + Ok(()) + } else { + self.tycx.complexity_exceeded() } - Ok(()) } } @@ -1834,7 +1835,7 @@ pub fn compute_match_usefulness<'p, Cx: PatCx>( arms: &[MatchArm<'p, Cx>], scrut_ty: Cx::Ty, scrut_validity: PlaceValidity, - complexity_limit: Option<usize>, + complexity_limit: usize, ) -> Result<UsefulnessReport<'p, Cx>, Cx::Error> { let mut cx = UsefulnessCtxt { tycx, diff --git a/compiler/rustc_pattern_analysis/tests/common/mod.rs b/compiler/rustc_pattern_analysis/tests/common/mod.rs index cd697632d1b..23560ad6419 100644 --- a/compiler/rustc_pattern_analysis/tests/common/mod.rs +++ b/compiler/rustc_pattern_analysis/tests/common/mod.rs @@ -124,7 +124,7 @@ pub fn compute_match_usefulness<'p>( arms: &[MatchArm<'p, Cx>], ty: Ty, scrut_validity: PlaceValidity, - complexity_limit: Option<usize>, + complexity_limit: usize, ) -> Result<UsefulnessReport<'p, Cx>, ()> { init_tracing(); rustc_pattern_analysis::usefulness::compute_match_usefulness( diff --git a/compiler/rustc_pattern_analysis/tests/complexity.rs b/compiler/rustc_pattern_analysis/tests/complexity.rs index 43b585bc533..abd1ec24d93 100644 --- a/compiler/rustc_pattern_analysis/tests/complexity.rs +++ b/compiler/rustc_pattern_analysis/tests/complexity.rs @@ -14,7 +14,7 @@ fn check(patterns: &[DeconstructedPat<Cx>], complexity_limit: usize) -> Result<( let ty = *patterns[0].ty(); let arms: Vec<_> = patterns.iter().map(|pat| MatchArm { pat, has_guard: false, arm_data: () }).collect(); - compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, Some(complexity_limit)) + compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, complexity_limit) .map(|_report| ()) } diff --git a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs index 0d80042a850..61ce0fd11e7 100644 --- a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs +++ b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs @@ -14,7 +14,8 @@ fn check(patterns: Vec<DeconstructedPat<Cx>>) -> Vec<WitnessPat<Cx>> { let arms: Vec<_> = patterns.iter().map(|pat| MatchArm { pat, has_guard: false, arm_data: () }).collect(); let report = - compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, None).unwrap(); + compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, usize::MAX) + .unwrap(); report.non_exhaustiveness_witnesses } diff --git a/compiler/rustc_pattern_analysis/tests/intersection.rs b/compiler/rustc_pattern_analysis/tests/intersection.rs index a852056b6a6..45674338efd 100644 --- a/compiler/rustc_pattern_analysis/tests/intersection.rs +++ b/compiler/rustc_pattern_analysis/tests/intersection.rs @@ -14,7 +14,8 @@ fn check(patterns: Vec<DeconstructedPat<Cx>>) -> Vec<Vec<usize>> { let arms: Vec<_> = patterns.iter().map(|pat| MatchArm { pat, has_guard: false, arm_data: () }).collect(); let report = - compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, None).unwrap(); + compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, usize::MAX) + .unwrap(); report.arm_intersections.into_iter().map(|bitset| bitset.iter().collect()).collect() } diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 3842b7035e5..b8490da26f4 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -1036,7 +1036,7 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> { return; } let old_maybe_typeck_results = self.maybe_typeck_results.replace(new_typeck_results); - self.visit_body(self.tcx.hir().body(body_id)); + self.visit_body(self.tcx.hir_body(body_id)); self.maybe_typeck_results = old_maybe_typeck_results; } @@ -1161,7 +1161,7 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> { fn visit_nested_body(&mut self, body_id: hir::BodyId) { let old_maybe_typeck_results = self.maybe_typeck_results.replace(self.tcx.typeck_body(body_id)); - self.visit_body(self.tcx.hir().body(body_id)); + self.visit_body(self.tcx.hir_body(body_id)); self.maybe_typeck_results = old_maybe_typeck_results; } @@ -1599,7 +1599,7 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> { self.check(def_id, item_visibility, effective_vis).generics().bounds(); } DefKind::Trait => { - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); if let hir::ItemKind::Trait(.., trait_item_refs) = item.kind { self.check_unnameable(item.owner_id.def_id, effective_vis); @@ -1630,7 +1630,7 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> { self.check(def_id, item_visibility, effective_vis).generics().predicates(); } DefKind::Enum => { - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); if let hir::ItemKind::Enum(ref def, _) = item.kind { self.check_unnameable(item.owner_id.def_id, effective_vis); @@ -1647,10 +1647,10 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> { } // Subitems of foreign modules have their own publicity. DefKind::ForeignMod => { - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); if let hir::ItemKind::ForeignMod { items, .. } = item.kind { for foreign_item in items { - let foreign_item = tcx.hir().foreign_item(foreign_item.id); + let foreign_item = tcx.hir_foreign_item(foreign_item.id); let ev = self.get(foreign_item.owner_id.def_id); let vis = tcx.local_visibility(foreign_item.owner_id.def_id); @@ -1668,7 +1668,7 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> { } // Subitems of structs and unions have their own publicity. DefKind::Struct | DefKind::Union => { - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); if let hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) = item.kind { @@ -1695,7 +1695,7 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> { // A trait impl is public when both its type and its trait are public // Subitems of trait impls have inherited publicity. DefKind::Impl { .. } => { - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); if let hir::ItemKind::Impl(impl_) = item.kind { let impl_vis = ty::Visibility::of_impl::<false>( item.owner_id.def_id, @@ -1788,7 +1788,7 @@ fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) { } for id in module.free_items() { - if let ItemKind::Impl(i) = tcx.hir().item(id).kind { + if let ItemKind::Impl(i) = tcx.hir_item(id).kind { if let Some(item) = i.of_trait { let trait_ref = tcx.impl_trait_ref(id.owner_id.def_id).unwrap(); let trait_ref = trait_ref.instantiate_identity(); @@ -1885,7 +1885,7 @@ fn check_private_in_public(tcx: TyCtxt<'_>, (): ()) { // Check for private types in public interfaces. let mut checker = PrivateItemsInPublicInterfacesChecker { tcx, effective_visibilities }; - for id in tcx.hir().items() { + for id in tcx.hir_free_items() { checker.check_item(id); } } diff --git a/compiler/rustc_query_impl/Cargo.toml b/compiler/rustc_query_impl/Cargo.toml index 8b0cc9d726b..fd1d21b6a89 100644 --- a/compiler/rustc_query_impl/Cargo.toml +++ b/compiler/rustc_query_impl/Cargo.toml @@ -8,6 +8,7 @@ edition = "2021" measureme = "11" rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } +rustc_hashes = { path = "../rustc_hashes" } rustc_hir = { path = "../rustc_hir" } rustc_index = { path = "../rustc_index" } rustc_middle = { path = "../rustc_middle" } diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index e95c186f6b6..f98d6421307 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -4,10 +4,11 @@ use std::num::NonZero; -use rustc_data_structures::stable_hasher::{Hash64, HashStable, StableHasher}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lock; use rustc_data_structures::unord::UnordMap; use rustc_errors::DiagInner; +use rustc_hashes::Hash64; use rustc_index::Idx; use rustc_middle::bug; use rustc_middle::dep_graph::{ diff --git a/compiler/rustc_query_system/Cargo.toml b/compiler/rustc_query_system/Cargo.toml index a42329b4614..d9560f3eb0f 100644 --- a/compiler/rustc_query_system/Cargo.toml +++ b/compiler/rustc_query_system/Cargo.toml @@ -13,6 +13,7 @@ rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_feature = { path = "../rustc_feature" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } +rustc_hashes = { path = "../rustc_hashes" } rustc_hir = { path = "../rustc_hir" } rustc_index = { path = "../rustc_index" } rustc_macros = { path = "../rustc_macros" } diff --git a/compiler/rustc_query_system/src/query/mod.rs b/compiler/rustc_query_system/src/query/mod.rs index 82c51193a19..7490a3f3503 100644 --- a/compiler/rustc_query_system/src/query/mod.rs +++ b/compiler/rustc_query_system/src/query/mod.rs @@ -11,9 +11,9 @@ mod caches; pub use self::caches::{DefIdCache, DefaultCache, QueryCache, SingleCache, VecCache}; mod config; -use rustc_data_structures::stable_hasher::Hash64; use rustc_data_structures::sync::Lock; use rustc_errors::DiagInner; +use rustc_hashes::Hash64; use rustc_hir::def::DefKind; use rustc_macros::{Decodable, Encodable}; use rustc_span::Span; diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs index fecb9735019..52aaab77ebe 100644 --- a/compiler/rustc_resolve/src/rustdoc.rs +++ b/compiler/rustc_resolve/src/rustdoc.rs @@ -7,7 +7,7 @@ use pulldown_cmark::{ use rustc_ast as ast; use rustc_ast::attr::AttributeExt; use rustc_ast::util::comments::beautify_doc_string; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; use rustc_middle::ty::TyCtxt; use rustc_span::def_id::DefId; use rustc_span::{DUMMY_SP, InnerSpan, Span, Symbol, kw, sym}; @@ -422,9 +422,11 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> { ); let mut links = Vec::new(); + let mut refids = FxHashSet::default(); + while let Some(event) = event_iter.next() { match event { - Event::Start(Tag::Link { link_type, dest_url, title: _, id: _ }) + Event::Start(Tag::Link { link_type, dest_url, title: _, id }) if may_be_doc_link(link_type) => { if matches!( @@ -439,6 +441,12 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> { links.push(display_text); } } + if matches!( + link_type, + LinkType::Reference | LinkType::Shortcut | LinkType::Collapsed + ) { + refids.insert(id); + } links.push(preprocess_link(&dest_url)); } @@ -446,6 +454,12 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> { } } + for (label, refdef) in event_iter.reference_definitions().iter() { + if !refids.contains(label) { + links.push(preprocess_link(&refdef.dest)); + } + } + links } diff --git a/compiler/rustc_serialize/Cargo.toml b/compiler/rustc_serialize/Cargo.toml index 8bf98c16361..a6815c7a447 100644 --- a/compiler/rustc_serialize/Cargo.toml +++ b/compiler/rustc_serialize/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] # tidy-alphabetical-start indexmap = "2.0.0" +rustc_hashes = { path = "../rustc_hashes" } smallvec = { version = "1.8.1", features = ["union", "may_dangle"] } thin-vec = "0.2.12" # tidy-alphabetical-end diff --git a/compiler/rustc_serialize/src/serialize.rs b/compiler/rustc_serialize/src/serialize.rs index db8555edd0f..1eefd76f92b 100644 --- a/compiler/rustc_serialize/src/serialize.rs +++ b/compiler/rustc_serialize/src/serialize.rs @@ -10,6 +10,7 @@ use std::path; use std::rc::Rc; use std::sync::Arc; +use rustc_hashes::{Hash64, Hash128}; use smallvec::{Array, SmallVec}; use thin_vec::ThinVec; @@ -716,3 +717,31 @@ impl<D: Decoder, T: Decodable<D>> Decodable<D> for Arc<[T]> { vec.into() } } + +impl<S: Encoder> Encodable<S> for Hash64 { + #[inline] + fn encode(&self, s: &mut S) { + s.emit_raw_bytes(&self.as_u64().to_le_bytes()); + } +} + +impl<S: Encoder> Encodable<S> for Hash128 { + #[inline] + fn encode(&self, s: &mut S) { + s.emit_raw_bytes(&self.as_u128().to_le_bytes()); + } +} + +impl<D: Decoder> Decodable<D> for Hash64 { + #[inline] + fn decode(d: &mut D) -> Self { + Self::new(u64::from_le_bytes(d.read_raw_bytes(8).try_into().unwrap())) + } +} + +impl<D: Decoder> Decodable<D> for Hash128 { + #[inline] + fn decode(d: &mut D) -> Self { + Self::new(u128::from_le_bytes(d.read_raw_bytes(16).try_into().unwrap())) + } +} diff --git a/compiler/rustc_session/Cargo.toml b/compiler/rustc_session/Cargo.toml index b9c535df4bd..31892c13438 100644 --- a/compiler/rustc_session/Cargo.toml +++ b/compiler/rustc_session/Cargo.toml @@ -14,6 +14,7 @@ rustc_errors = { path = "../rustc_errors" } rustc_feature = { path = "../rustc_feature" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } 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" } diff --git a/compiler/rustc_session/messages.ftl b/compiler/rustc_session/messages.ftl index e5fba8cc5a2..74b8087e077 100644 --- a/compiler/rustc_session/messages.ftl +++ b/compiler/rustc_session/messages.ftl @@ -8,12 +8,8 @@ session_cannot_mix_and_match_sanitizers = `-Zsanitizer={$first}` is incompatible session_cli_feature_diagnostic_help = add `-Zcrate-attr="feature({$feature})"` to the command-line options to enable -session_crate_name_does_not_match = `--crate-name` and `#[crate_name]` are required to match, but `{$s}` != `{$name}` - session_crate_name_empty = crate name must not be empty -session_crate_name_invalid = crate names cannot start with a `-`, but `{$s}` has a leading hyphen - session_embed_source_insufficient_dwarf_version = `-Zembed-source=y` requires at least `-Z dwarf-version=5` but DWARF version is {$dwarf_version} session_embed_source_requires_debug_info = `-Zembed-source=y` requires debug information to be enabled @@ -52,8 +48,8 @@ session_instrumentation_not_supported = {$us} instrumentation is not supported f session_int_literal_too_large = integer literal is too large .note = value exceeds limit of `{$limit}` -session_invalid_character_in_create_name = invalid character `{$character}` in crate name: `{$crate_name}` -session_invalid_character_in_create_name_help = you can either pass `--crate-name` on the command line or add `#![crate_name="…"]` to set the crate name +session_invalid_character_in_crate_name = invalid character {$character} in crate name: `{$crate_name}` + .help = you can either pass `--crate-name` on the command line or add `#![crate_name = "…"]` to set the crate name session_invalid_float_literal_suffix = invalid suffix `{$suffix}` for float literal .label = invalid suffix `{$suffix}` diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 7d473b86ff5..85ef69ea2b7 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -2934,9 +2934,9 @@ pub(crate) mod dep_tracking { use rustc_abi::Align; use rustc_data_structures::fx::FxIndexMap; - use rustc_data_structures::stable_hasher::Hash64; use rustc_errors::LanguageIdentifier; use rustc_feature::UnstableFeatures; + use rustc_hashes::Hash64; use rustc_span::RealFileName; use rustc_span::edition::Edition; use rustc_target::spec::{ diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index aa9ebdd9cea..231ca434962 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -29,7 +29,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; use rustc_lint_defs::BuiltinLintDiag; use rustc_lint_defs::builtin::EXPLICIT_BUILTIN_CFGS_IN_FLAGS; use rustc_span::{Symbol, sym}; -use rustc_target::spec::{PanicStrategy, RelocModel, SanitizerSet, TARGETS, Target, TargetTuple}; +use rustc_target::spec::{PanicStrategy, RelocModel, SanitizerSet, Target}; use crate::Session; use crate::config::{CrateType, FmtDebug}; @@ -432,11 +432,7 @@ impl CheckCfg { panic!("unable to get all the check-cfg values buckets"); }; - for target in TARGETS - .iter() - .map(|target| Target::expect_builtin(&TargetTuple::from_tuple(target))) - .chain(iter::once(current_target.clone())) - { + for target in Target::builtins().chain(iter::once(current_target.clone())) { values_target_abi.insert(Symbol::intern(&target.options.abi)); values_target_arch.insert(Symbol::intern(&target.arch)); values_target_endian.insert(Symbol::intern(target.options.endian.as_str())); diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index 75c3b2c7a85..71d8dbe44fe 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -213,21 +213,6 @@ pub(crate) struct FileWriteFail<'a> { } #[derive(Diagnostic)] -#[diag(session_crate_name_does_not_match)] -pub(crate) struct CrateNameDoesNotMatch { - #[primary_span] - pub(crate) span: Span, - pub(crate) s: Symbol, - pub(crate) name: Symbol, -} - -#[derive(Diagnostic)] -#[diag(session_crate_name_invalid)] -pub(crate) struct CrateNameInvalid<'a> { - pub(crate) s: &'a str, -} - -#[derive(Diagnostic)] #[diag(session_crate_name_empty)] pub(crate) struct CrateNameEmpty { #[primary_span] @@ -235,20 +220,14 @@ pub(crate) struct CrateNameEmpty { } #[derive(Diagnostic)] -#[diag(session_invalid_character_in_create_name)] +#[diag(session_invalid_character_in_crate_name)] pub(crate) struct InvalidCharacterInCrateName { #[primary_span] pub(crate) span: Option<Span>, pub(crate) character: char, pub(crate) crate_name: Symbol, - #[subdiagnostic] - pub(crate) crate_name_help: Option<InvalidCrateNameHelp>, -} - -#[derive(Subdiagnostic)] -pub(crate) enum InvalidCrateNameHelp { - #[help(session_invalid_character_in_create_name_help)] - AddCrateName, + #[help] + pub(crate) help: Option<()>, } #[derive(Subdiagnostic)] diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 35819f896c5..351dad3f3e4 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -7,9 +7,9 @@ use std::str; use rustc_abi::Align; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::profiling::TimePassesFormat; -use rustc_data_structures::stable_hasher::Hash64; use rustc_errors::{ColorConfig, LanguageIdentifier, TerminalUrl}; use rustc_feature::UnstableFeatures; +use rustc_hashes::Hash64; use rustc_macros::{Decodable, Encodable}; use rustc_span::edition::Edition; use rustc_span::{RealFileName, SourceFileHashAlgorithm}; diff --git a/compiler/rustc_session/src/output.rs b/compiler/rustc_session/src/output.rs index ff0419d06bf..b37a80274c0 100644 --- a/compiler/rustc_session/src/output.rs +++ b/compiler/rustc_session/src/output.rs @@ -2,15 +2,12 @@ use std::path::Path; -use rustc_ast::{self as ast, attr}; +use rustc_ast as ast; use rustc_span::{Span, Symbol, sym}; use crate::Session; -use crate::config::{self, CrateType, Input, OutFileName, OutputFilenames, OutputType}; -use crate::errors::{ - self, CrateNameDoesNotMatch, CrateNameEmpty, CrateNameInvalid, FileIsNotWriteable, - InvalidCharacterInCrateName, InvalidCrateNameHelp, -}; +use crate::config::{self, CrateType, OutFileName, OutputFilenames, OutputType}; +use crate::errors::{self, CrateNameEmpty, FileIsNotWriteable, InvalidCharacterInCrateName}; pub fn out_filename( sess: &Session, @@ -49,69 +46,31 @@ fn is_writeable(p: &Path) -> bool { } } -pub fn find_crate_name(sess: &Session, attrs: &[ast::Attribute]) -> Symbol { - let validate = |s: Symbol, span: Option<Span>| { - validate_crate_name(sess, s, span); - s - }; - - // Look in attributes 100% of the time to make sure the attribute is marked - // as used. After doing this, however, we still prioritize a crate name from - // the command line over one found in the #[crate_name] attribute. If we - // find both we ensure that they're the same later on as well. - let attr_crate_name = - attr::find_by_name(attrs, sym::crate_name).and_then(|at| at.value_str().map(|s| (at, s))); - - if let Some(ref s) = sess.opts.crate_name { - let s = Symbol::intern(s); - if let Some((attr, name)) = attr_crate_name { - if name != s { - sess.dcx().emit_err(CrateNameDoesNotMatch { span: attr.span, s, name }); - } - } - return validate(s, None); - } +/// Validate the given crate name. +/// +/// Note that this validation is more permissive than identifier parsing. It considers +/// non-empty sequences of alphanumeric and underscore characters to be valid crate names. +/// Most notably, it accepts names starting with a numeric character like `0`! +/// +/// Furthermore, this shouldn't be taken as the canonical crate name validator. +/// Other places may use a more restrictive grammar (e.g., identifier or ASCII identifier). +pub fn validate_crate_name(sess: &Session, crate_name: Symbol, span: Option<Span>) { + let mut guar = None; - if let Some((attr, s)) = attr_crate_name { - return validate(s, Some(attr.span)); - } - if let Input::File(ref path) = sess.io.input { - if let Some(s) = path.file_stem().and_then(|s| s.to_str()) { - if s.starts_with('-') { - sess.dcx().emit_err(CrateNameInvalid { s }); - } else { - return validate(Symbol::intern(&s.replace('-', "_")), None); - } - } + if crate_name.is_empty() { + guar = Some(sess.dcx().emit_err(CrateNameEmpty { span })); } - sym::rust_out -} - -pub fn validate_crate_name(sess: &Session, s: Symbol, sp: Option<Span>) { - let mut guar = None; - { - if s.is_empty() { - guar = Some(sess.dcx().emit_err(CrateNameEmpty { span: sp })); - } - for c in s.as_str().chars() { - if c.is_alphanumeric() { - continue; - } - if c == '_' { - continue; - } - guar = Some(sess.dcx().emit_err(InvalidCharacterInCrateName { - span: sp, - character: c, - crate_name: s, - crate_name_help: if sp.is_none() { - Some(InvalidCrateNameHelp::AddCrateName) - } else { - None - }, - })); + for c in crate_name.as_str().chars() { + if c.is_alphanumeric() || c == '_' { + continue; } + guar = Some(sess.dcx().emit_err(InvalidCharacterInCrateName { + span, + character: c, + crate_name, + help: span.is_none().then_some(()), + })); } if let Some(guar) = guar { diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index f795ad1ee17..c4d45ee02ee 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -67,6 +67,11 @@ impl Limit { Limit(value) } + /// Create a new unlimited limit. + pub fn unlimited() -> Self { + Limit(usize::MAX) + } + /// Check that `value` is within the limit. Ensures that the same comparisons are used /// throughout the compiler, as mismatches can cause ICEs, see #72540. #[inline] @@ -119,6 +124,8 @@ pub struct Limits { pub move_size_limit: Limit, /// The maximum length of types during monomorphization. pub type_length_limit: Limit, + /// The maximum pattern complexity allowed (internal only). + pub pattern_complexity_limit: Limit, } pub struct CompilerIO { diff --git a/compiler/rustc_span/Cargo.toml b/compiler/rustc_span/Cargo.toml index 781fe6a11fe..991c75cc98d 100644 --- a/compiler/rustc_span/Cargo.toml +++ b/compiler/rustc_span/Cargo.toml @@ -12,6 +12,7 @@ itoa = "1.0" md5 = { package = "md-5", version = "0.10.0" } rustc_arena = { path = "../rustc_arena" } 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" } diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs index f61ce37131e..641bac88ad0 100644 --- a/compiler/rustc_span/src/def_id.rs +++ b/compiler/rustc_span/src/def_id.rs @@ -3,10 +3,9 @@ use std::hash::{BuildHasherDefault, Hash, Hasher}; use rustc_data_structures::AtomicRef; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::stable_hasher::{ - Hash64, HashStable, StableHasher, StableOrd, ToStableHashKey, -}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey}; use rustc_data_structures::unhash::Unhasher; +use rustc_hashes::Hash64; use rustc_index::Idx; use rustc_macros::{Decodable, Encodable, HashStable_Generic}; use rustc_serialize::{Decodable, Encodable}; diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index 2910bcdf51d..9bf1d305e54 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -33,9 +33,10 @@ use std::sync::Arc; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_data_structures::stable_hasher::{Hash64, HashStable, HashingControls, StableHasher}; +use rustc_data_structures::stable_hasher::{HashStable, HashingControls, StableHasher}; use rustc_data_structures::sync::{Lock, WorkerLocal}; use rustc_data_structures::unhash::UnhashMap; +use rustc_hashes::Hash64; use rustc_index::IndexVec; use rustc_macros::{Decodable, Encodable, HashStable_Generic}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 0e146baef37..695edc956cd 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -87,9 +87,10 @@ use std::sync::Arc; use std::{fmt, iter}; use md5::{Digest, Md5}; -use rustc_data_structures::stable_hasher::{Hash64, Hash128, HashStable, StableHasher}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::{FreezeLock, FreezeWriteGuard, Lock}; use rustc_data_structures::unord::UnordMap; +use rustc_hashes::{Hash64, Hash128}; use sha1::Sha1; use sha2::Sha256; diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 62723e385cf..94039089480 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -104,6 +104,8 @@ symbols! { Gen: "gen", // >= 2024 Edition only Try: "try", // >= 2018 Edition only + // NOTE: When adding new keywords, consider adding them to the ui/parser/raw/raw-idents.rs test. + // "Lifetime keywords": regular keywords with a leading `'`. // Matching predicates: `is_any_keyword` UnderscoreLifetime: "'_", @@ -1512,7 +1514,7 @@ symbols! { path_main_separator, path_to_pathbuf, pathbuf_as_path, - pattern_complexity, + pattern_complexity_limit, pattern_parentheses, pattern_type, pattern_types, @@ -1973,6 +1975,10 @@ symbols! { str_from_utf8_mut, str_from_utf8_unchecked, str_from_utf8_unchecked_mut, + str_inherent_from_utf8, + str_inherent_from_utf8_mut, + str_inherent_from_utf8_unchecked, + str_inherent_from_utf8_unchecked_mut, str_len, str_split_whitespace, str_starts_with, diff --git a/compiler/rustc_symbol_mangling/Cargo.toml b/compiler/rustc_symbol_mangling/Cargo.toml index 1fb647cab5b..4c51c908f54 100644 --- a/compiler/rustc_symbol_mangling/Cargo.toml +++ b/compiler/rustc_symbol_mangling/Cargo.toml @@ -11,6 +11,7 @@ rustc-demangle = "0.1.21" rustc_abi = { path = "../rustc_abi" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } +rustc_hashes = { path = "../rustc_hashes" } rustc_hir = { path = "../rustc_hir" } rustc_middle = { path = "../rustc_middle" } rustc_session = { path = "../rustc_session" } diff --git a/compiler/rustc_symbol_mangling/src/hashed.rs b/compiler/rustc_symbol_mangling/src/hashed.rs index 07c5f544792..e965e6a7d53 100644 --- a/compiler/rustc_symbol_mangling/src/hashed.rs +++ b/compiler/rustc_symbol_mangling/src/hashed.rs @@ -1,6 +1,7 @@ use std::fmt::Write; -use rustc_data_structures::stable_hasher::{Hash64, HashStable, StableHasher}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hashes::Hash64; use rustc_hir::def_id::CrateNum; use rustc_middle::ty::{Instance, TyCtxt}; diff --git a/compiler/rustc_symbol_mangling/src/legacy.rs b/compiler/rustc_symbol_mangling/src/legacy.rs index 8ae35572d01..88754f1f15b 100644 --- a/compiler/rustc_symbol_mangling/src/legacy.rs +++ b/compiler/rustc_symbol_mangling/src/legacy.rs @@ -1,7 +1,8 @@ use std::fmt::{self, Write}; use std::mem::{self, discriminant}; -use rustc_data_structures::stable_hasher::{Hash64, HashStable, StableHasher}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hashes::Hash64; use rustc_hir::def_id::{CrateNum, DefId}; use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData}; use rustc_middle::bug; diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs index 497994a5998..1b56143545f 100644 --- a/compiler/rustc_target/src/spec/base/apple/mod.rs +++ b/compiler/rustc_target/src/spec/base/apple/mod.rs @@ -2,8 +2,8 @@ use std::borrow::Cow; use std::env; use crate::spec::{ - Cc, DebuginfoKind, FloatAbi, FramePointer, LinkerFlavor, Lld, SplitDebuginfo, StackProbeType, - StaticCow, TargetOptions, cvs, + Cc, DebuginfoKind, FloatAbi, FramePointer, LinkerFlavor, Lld, RustcAbi, SplitDebuginfo, + StackProbeType, StaticCow, TargetOptions, cvs, }; #[cfg(test)] @@ -103,7 +103,7 @@ pub(crate) fn base( arch: Arch, abi: TargetAbi, ) -> (TargetOptions, StaticCow<str>, StaticCow<str>) { - let opts = TargetOptions { + let mut opts = TargetOptions { abi: abi.target_abi().into(), llvm_floatabi: Some(FloatAbi::Hard), os: os.into(), @@ -154,6 +154,10 @@ pub(crate) fn base( ..Default::default() }; + if matches!(arch, Arch::I386 | Arch::I686) { + // All Apple x86-32 targets have SSE2. + opts.rustc_abi = Some(RustcAbi::X86Sse2); + } (opts, unversioned_llvm_target(os, arch, abi), arch.target_arch()) } diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 8b20152d3bf..f7e467b0c11 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1109,6 +1109,8 @@ impl ToJson for FloatAbi { /// The Rustc-specific variant of the ABI used for this target. #[derive(Clone, Copy, PartialEq, Hash, Debug)] pub enum RustcAbi { + /// On x86-32 only: make use of SSE and SSE2 for ABI purposes. + X86Sse2, /// On x86-32/64 only: do not use any FPU or SIMD registers for the ABI. X86Softfloat, } @@ -1118,6 +1120,7 @@ impl FromStr for RustcAbi { fn from_str(s: &str) -> Result<RustcAbi, ()> { Ok(match s { + "x86-sse2" => RustcAbi::X86Sse2, "x86-softfloat" => RustcAbi::X86Softfloat, _ => return Err(()), }) @@ -1127,6 +1130,7 @@ impl FromStr for RustcAbi { impl ToJson for RustcAbi { fn to_json(&self) -> Json { match *self { + RustcAbi::X86Sse2 => "x86-sse2", RustcAbi::X86Softfloat => "x86-softfloat", } .to_json() @@ -1654,6 +1658,14 @@ macro_rules! supported_targets { Some(t) } + fn load_all_builtins() -> impl Iterator<Item = Target> { + [ + $( targets::$module::target, )+ + ] + .into_iter() + .map(|f| f()) + } + #[cfg(test)] mod tests { // Cannot put this into a separate file without duplication, make an exception. @@ -3264,6 +3276,11 @@ impl Target { // Check consistency of Rust ABI declaration. if let Some(rust_abi) = self.rustc_abi { match rust_abi { + RustcAbi::X86Sse2 => check_matches!( + &*self.arch, + "x86", + "`x86-sse2` ABI is only valid for x86-32 targets" + ), RustcAbi::X86Softfloat => check_matches!( &*self.arch, "x86" | "x86_64", @@ -3351,6 +3368,11 @@ impl Target { } } + /// Load all built-in targets + pub fn builtins() -> impl Iterator<Item = Target> { + load_all_builtins() + } + /// Search for a JSON file specifying the given target tuple. /// /// If none is found in `$RUST_TARGET_PATH`, look for a file called `target.json` inside the diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs index adee6f5fe99..d3e0a32c8b8 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("macos", Arch::Arm64, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple macOS (11.0+, Big Sur+)".into()), tier: Some(1), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs index efc42b909e4..183a6c6f2d7 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple iOS".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs index be503d18bf1..ce9ae03e699 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetAbi::MacCatalyst); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple Mac Catalyst".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs index 04bbee45cd3..4405e3fec02 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetAbi::Simulator); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple iOS Simulator".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs index fa0bc130e1c..037685db1b3 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, Target, TargetOptions}; +use crate::spec::{FramePointer, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple tvOS".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs index 428045da493..a386220e6fc 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, Target, TargetOptions}; +use crate::spec::{FramePointer, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetAbi::Simulator); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple tvOS Simulator".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs index 9817c5a8eb0..2c1dfdd55ed 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple visionOS".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs index d411f710540..c0b8b409797 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetAbi::Simulator); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple visionOS simulator".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs index abd924b5934..23596271107 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple watchOS".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs index ba85647fddc..62968f5b555 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, Target, TargetOptions}; +use crate::spec::{FramePointer, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetAbi::Simulator); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple watchOS Simulator".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs index de6fe991460..87c07cd3109 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64_be-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Linux (big-endian)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs index 8fdaff822fe..e785069c78a 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64_be-unknown-linux-gnu_ilp32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Linux (big-endian, ILP32 ABI)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs index 4e1e95ab751..97742403c78 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64_be-unknown-netbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 NetBSD (big-endian)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs index 58fc703946e..f58aa1ac043 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs @@ -1,10 +1,10 @@ -use crate::spec::{RelocModel, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{RelocModel, StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let base = base::solid::opts("asp3"); Target { llvm_target: "aarch64-unknown-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 SOLID with TOPPERS/ASP3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs index a021d317cc8..41c25393e12 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs @@ -1,4 +1,4 @@ -use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base}; // See https://developer.android.com/ndk/guides/abis.html#arm64-v8a // for target ABI requirements. @@ -6,7 +6,7 @@ use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-linux-android".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Android".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs index 6ac69e0f57f..9b81362b27d 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs @@ -1,5 +1,6 @@ use crate::spec::{ - Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, StackProbeType, Target, TargetOptions, + Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, StackProbeType, Target, TargetMetadata, + TargetOptions, }; const LINKER_SCRIPT: &str = include_str!("./aarch64_nintendo_switch_freestanding_linker_script.ld"); @@ -8,7 +9,7 @@ const LINKER_SCRIPT: &str = include_str!("./aarch64_nintendo_switch_freestanding pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Nintendo Switch, Horizon".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs index 8b96f589c74..a8b133d19bb 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs @@ -1,4 +1,4 @@ -use crate::spec::{Target, base}; +use crate::spec::{Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_gnullvm::opts(); @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-pc-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 MinGW (Windows 10+), LLVM ABI".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs index 14ce5edd2f3..98d78520c98 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs @@ -1,4 +1,4 @@ -use crate::spec::{Target, base}; +use crate::spec::{Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Windows MSVC".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs index dd90161f440..7306a75aa22 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs @@ -1,9 +1,9 @@ -use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-freebsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 FreeBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs index df13d52a223..23ed92e62b8 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs @@ -1,9 +1,9 @@ -use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-fuchsia".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Fuchsia".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs index 459e888eb94..580a36cb2e9 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs @@ -1,9 +1,9 @@ -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-hermit".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Hermit".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs index 699376a7928..1ed4fdb465d 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, SanitizerSet, Target, base}; +use crate::spec::{Cc, LinkerFlavor, SanitizerSet, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::illumos::opts(); @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { // LLVM does not currently have a separate illumos target, // so we still pass Solaris to it llvm_target: "aarch64-unknown-solaris2.11".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 illumos".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs index 18711cb399d..c6be2c20ea2 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs @@ -1,9 +1,9 @@ -use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Linux (kernel 4.1, glibc 2.17+)".into()), tier: Some(1), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs index 7b0df7d1130..166bb1ed215 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs @@ -1,9 +1,9 @@ -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-gnu_ilp32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Linux (ILP32 ABI)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs index 4fefdfa5c5e..58ba06e124c 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs @@ -1,4 +1,4 @@ -use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Linux with musl 1.2.3".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs index 14a22988a09..f2994b1232e 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs @@ -1,4 +1,4 @@ -use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::linux_ohos::opts(); @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-ohos".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 OpenHarmony".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs index 0ec76e4b42f..461730457aa 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs @@ -1,9 +1,9 @@ -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-netbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 NetBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs index 27dd713cc53..6c14f5df466 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs @@ -8,7 +8,7 @@ use crate::spec::{ Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, StackProbeType, Target, - TargetOptions, + TargetMetadata, TargetOptions, }; pub(crate) fn target() -> Target { @@ -31,7 +31,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "aarch64-unknown-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare ARM64, hardfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs index 3b719ebaf07..35a4dd72b86 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs @@ -8,7 +8,7 @@ use crate::spec::{ Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, StackProbeType, Target, - TargetOptions, + TargetMetadata, TargetOptions, }; pub(crate) fn target() -> Target { @@ -27,7 +27,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "aarch64-unknown-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare ARM64, softfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nuttx.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nuttx.rs index f7f8dc1e1ef..243d84a12ec 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nuttx.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nuttx.rs @@ -8,7 +8,7 @@ use crate::spec::{ Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, StackProbeType, Target, - TargetOptions, cvs, + TargetMetadata, TargetOptions, cvs, }; pub(crate) fn target() -> Target { @@ -33,7 +33,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "aarch64-unknown-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("AArch64 NuttX".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs index 0fcf5c34bb0..c23006adad6 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs @@ -1,9 +1,9 @@ -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-openbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 OpenBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs index 7ff99c574ad..39fe71528d3 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs @@ -1,4 +1,4 @@ -use crate::spec::{StackProbeType, Target, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::redox::opts(); @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-redox".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 RedoxOS".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs index fb8b59f7729..799ff1a806e 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs @@ -1,4 +1,4 @@ -use crate::spec::{StackProbeType, Target, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::teeos::opts(); @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 TEEOS".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs index cebd8ff2f68..126f0251239 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs @@ -1,11 +1,13 @@ // Trusty OS target for AArch64. -use crate::spec::{LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetOptions}; +use crate::spec::{ + LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-unknown-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Trusty".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs index 9656024ddaa..327b52389b9 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs @@ -1,7 +1,7 @@ // This defines the aarch64 target for UEFI systems as described in the UEFI specification. See the // uefi-base module for generic UEFI options. -use crate::spec::{LinkerFlavor, Lld, Target, base}; +use crate::spec::{LinkerFlavor, Lld, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::uefi_msvc::opts(); @@ -12,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-windows".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 UEFI".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs index 3d7c0269808..a40c8c3a3f2 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs @@ -1,4 +1,4 @@ -use crate::spec::{Target, base}; +use crate::spec::{Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_uwp_msvc::opts(); @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs index ac53cbaecce..b6826760183 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs @@ -1,9 +1,9 @@ -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/amdgcn_amd_amdhsa.rs b/compiler/rustc_target/src/spec/targets/amdgcn_amd_amdhsa.rs index bb488c350c2..f20782cabb8 100644 --- a/compiler/rustc_target/src/spec/targets/amdgcn_amd_amdhsa.rs +++ b/compiler/rustc_target/src/spec/targets/amdgcn_amd_amdhsa.rs @@ -1,11 +1,11 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions}; +use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { Target { arch: "amdgpu".into(), data_layout: "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9".into(), llvm_target: "amdgcn-amd-amdhsa".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("AMD GPU".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs index a5a6f772ac8..4c3a2f43743 100644 --- a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("watchos", Arch::Arm64_32, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64 Apple watchOS with 32-bit pointers".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs index 744d95445b8..79b95dbde52 100644 --- a/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("macos", Arch::Arm64e, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64e Apple Darwin".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs index dace11dae24..848dbeec199 100644 --- a/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("ios", Arch::Arm64e, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64e Apple iOS".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs index 2ccdc76c52e..3dbe169e826 100644 --- a/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, Target, TargetOptions}; +use crate::spec::{FramePointer, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("tvos", Arch::Arm64e, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARM64e Apple tvOS".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs index 5026c52429e..bb3e3e544cb 100644 --- a/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs @@ -1,4 +1,4 @@ -use crate::spec::{LinkerFlavor, Lld, Target, add_link_args, base}; +use crate::spec::{LinkerFlavor, Lld, Target, TargetMetadata, add_link_args, base}; pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); @@ -12,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm64ec-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Arm64EC Windows MSVC".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs index 73fb02c6731..d74468899f5 100644 --- a/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, SanitizerSet, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "arm-linux-androideabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv6 Android".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs index 87e790a1f39..3b6c97167cf 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-gnueabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv6 Linux (kernel 3.2, glibc 2.17)".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs index 6470bf6b611..a3f5389f0aa 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-gnueabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv6 Linux, hardfloat (kernel 3.2, glibc 2.17)".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs index 26241dd0bd4..3919a5e0771 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv6 Linux with musl 1.2.3".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs index 4bbde7667b9..ca52e5b3ca6 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv6 Linux with musl 1.2.3, hardfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs index 60ec4edbb0d..afb17fd8203 100644 --- a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armeb-unknown-linux-gnueabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Arm BE8 the default Arm big-endian architecture since Armv6".into()), tier: Some(3), host_tools: None, // ? diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs index 18b93f6cbc4..d227d63c4a3 100644 --- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs @@ -3,13 +3,14 @@ use rustc_abi::Endian; use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { Target { llvm_target: "armebv7r-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare Armv7-R, Big Endian".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs index 6c22cd34fc3..c373afb914e 100644 --- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs @@ -3,13 +3,14 @@ use rustc_abi::Endian; use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { Target { llvm_target: "armebv7r-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare Armv7-R, Big Endian, hardfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs index dc8cb4fb187..9571821656c 100644 --- a/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs @@ -10,13 +10,14 @@ //! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script. use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, cvs, }; pub(crate) fn target() -> Target { Target { llvm_target: "armv4t-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare Armv4T".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs index 081132b0e68..beaec71093c 100644 --- a/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv4t-unknown-linux-gnueabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv4T Linux".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs index e0a4f26f0a6..75ab941c5cf 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs @@ -1,11 +1,11 @@ //! Targets the ARMv5TE, with code as `a32` code by default. -use crate::spec::{FloatAbi, FramePointer, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, FramePointer, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare Armv5TE".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs index ce7060b3847..52e786de3ed 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-unknown-linux-gnueabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv5TE Linux (kernel 4.4, glibc 2.23)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs index 62619546891..e675739629b 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-unknown-linux-musleabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv5TE Linux with musl 1.2.3".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs index 73013bf00b1..dbe1540364a 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-unknown-linux-uclibcgnueabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv5TE Linux with uClibc".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs index 4bbc514f2b3..1625a6b84bb 100644 --- a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv6-unknown-freebsd-gnueabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv6 FreeBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs index 6b9d3ccd215..af9a4359565 100644 --- a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv6-unknown-netbsdelf-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv6 NetBSD w/hard-float".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs b/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs index 5438811803b..4c32a5e6216 100644 --- a/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs +++ b/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{ + Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetMetadata, TargetOptions, cvs, +}; /// A base target for Nintendo 3DS devices using the devkitARM toolchain. /// @@ -12,7 +14,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv6k-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv6K Nintendo 3DS, Horizon (Requires devkitARM toolchain)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs index e1cead9e0b7..706fb12a524 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions, base}; +use crate::spec::{ + Cc, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetMetadata, TargetOptions, base, +}; // This target if is for the baseline of the Android v7a ABI // in thumb mode. It's named armv7-* instead of thumbv7-* @@ -13,7 +15,7 @@ pub(crate) fn target() -> Target { base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv7-a"]); Target { llvm_target: "armv7-none-linux-android".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A Android".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs index 4e8a9d55f9a..c17db36ee61 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs @@ -1,11 +1,12 @@ use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, cvs, }; pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7 RTEMS (Requires RTEMS toolchain and kernel".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs index 4b2ab8b8f20..5d292bbf8ad 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{ + Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetMetadata, TargetOptions, cvs, +}; /// A base target for PlayStation Vita devices using the VITASDK toolchain (using newlib). /// @@ -14,7 +16,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7a-vita-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some( "Armv7-A Cortex-A9 Sony PlayStation Vita (requires VITASDK toolchain)".into(), ), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs index 34f118d4f5d..56f2e090e07 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-freebsd-gnueabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A FreeBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs index bb28427c99b..603afe2c48b 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs @@ -1,4 +1,4 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; // This target is for glibc Linux on ARMv7 without thumb-mode, NEON or // hardfloat. @@ -6,7 +6,7 @@ use crate::spec::{FloatAbi, Target, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-gnueabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A Linux (kernel 4.15, glibc 2.27)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs index 6bffc0da87b..3b5a337b4f1 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs @@ -1,4 +1,4 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; // This target is for glibc Linux on ARMv7 without NEON or // thumb-mode. See the thumbv7neon variant for enabling both. @@ -6,7 +6,7 @@ use crate::spec::{FloatAbi, Target, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-gnueabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A Linux, hardfloat (kernel 3.2, glibc 2.17)".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs index 0436e0d8df4..42fbf6f4861 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs @@ -1,4 +1,4 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; // This target is for musl Linux on ARMv7 without thumb-mode, NEON or // hardfloat. @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { // target. Target { llvm_target: "armv7-unknown-linux-musleabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A Linux with musl 1.2.3".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs index 22e49f2f1b0..a3ac0223c84 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -1,11 +1,11 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; // This target is for musl Linux on ARMv7 without thumb-mode or NEON. pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A Linux with musl 1.2.3, hardfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs index d1261202124..f31dedb04e6 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs @@ -1,4 +1,4 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; // This target is for OpenHarmony on ARMv7 Linux with thumb-mode, but no NEON or // hardfloat. @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { // target. Target { llvm_target: "armv7-unknown-linux-ohos".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A OpenHarmony".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs index ffcd8876eb4..a9e9f4651bb 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs @@ -1,4 +1,4 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; // This target is for uclibc Linux on ARMv7 without NEON, // thumb-mode or hardfloat. @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { let base = base::linux_uclibc::opts(); Target { llvm_target: "armv7-unknown-linux-gnueabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A Linux with uClibc, softfloat".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs index 586bd8d3d88..a95f12d0230 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs @@ -1,4 +1,4 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; // This target is for uclibc Linux on ARMv7 without NEON or // thumb-mode. See the thumbv7neon variant for enabling both. @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { let base = base::linux_uclibc::opts(); Target { llvm_target: "armv7-unknown-linux-gnueabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A Linux with uClibc, hardfloat".into()), tier: Some(3), host_tools: None, // ? diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs index 28d3d572bf3..d155dc58e51 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-netbsdelf-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A NetBSD w/hard-float".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs index b86c788df15..31d492e83cd 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs @@ -1,5 +1,6 @@ use crate::spec::{ - FloatAbi, LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetOptions, + FloatAbi, LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { @@ -8,7 +9,7 @@ pub(crate) fn target() -> Target { // to determine the calling convention and float ABI, and it doesn't // support the "musleabi" value. llvm_target: "armv7-unknown-unknown-gnueabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A Trusty".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs index 212c45424db..05be389b57c 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-gnueabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A for VxWorks".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs index 2ed10045412..26c25139989 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs @@ -1,10 +1,10 @@ -use crate::spec::{FloatAbi, RelocModel, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let base = base::solid::opts("asp3"); Target { llvm_target: "armv7a-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Arm SOLID with TOPPERS/ASP3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs index c9c15b402ae..7032444bea4 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs @@ -1,10 +1,10 @@ -use crate::spec::{FloatAbi, RelocModel, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let base = base::solid::opts("asp3"); Target { llvm_target: "armv7a-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Arm SOLID with TOPPERS/ASP3, hardfloat".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs index d59849ec2c4..fb1d7d6c39d 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs @@ -15,7 +15,8 @@ // linking. rationale: matches `thumb` targets use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { @@ -35,7 +36,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "armv7a-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare Armv7-A".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs index 06481e6f882..df3a76599a7 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs @@ -6,7 +6,8 @@ // `thumb` & `aarch64` targets. use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { @@ -27,7 +28,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "armv7a-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare Armv7-A, hardfloat".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabi.rs index 08cbfc74396..052285b98dc 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabi.rs @@ -5,7 +5,8 @@ // configuration without hardware floating point support. use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, cvs, }; pub(crate) fn target() -> Target { @@ -27,7 +28,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "armv7a-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARMv7-A Cortex-A with NuttX".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabihf.rs index f68c11a9c68..85543e95616 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabihf.rs @@ -5,7 +5,8 @@ // configuration with hardware floating point support. use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, cvs, }; pub(crate) fn target() -> Target { @@ -27,7 +28,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "armv7a-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARMv7-A Cortex-A with NuttX (hard float)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs index e232f54f9b3..8103d132cea 100644 --- a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("watchos", Arch::Armv7k, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-A Apple WatchOS".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs index 1eda0545169..334be483daa 100644 --- a/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs @@ -1,13 +1,14 @@ // Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R) use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { Target { llvm_target: "armv7r-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-R".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs index d4e85bc9b0a..2bb3e70483a 100644 --- a/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs @@ -1,13 +1,14 @@ // Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R) use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { Target { llvm_target: "armv7r-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Armv7-R, hardfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs index 1c3040de06e..ba9edd71461 100644 --- a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("ios", Arch::Armv7s, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("ARMv7-A Apple-A6 Apple iOS".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs index 3df42a1482c..8cf1ff95751 100644 --- a/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs @@ -1,13 +1,14 @@ // Targets the Little-endian Cortex-R52 processor (ARMv8-R) use crate::spec::{ - Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { Target { llvm_target: "armv8r-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare Armv8-R, hardfloat".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs index b95f93c3553..3d39cd26c65 100644 --- a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{Target, base}; +use crate::spec::{Target, TargetMetadata, base}; pub(crate) fn target() -> Target { Target { llvm_target: "bpfeb".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("BPF (big endian)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs index 711bbb04b19..51f45b01244 100644 --- a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{Target, base}; +use crate::spec::{Target, TargetMetadata, base}; pub(crate) fn target() -> Target { Target { llvm_target: "bpfel".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("BPF (little endian)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs index c90d3bcc6ae..6142c1541f0 100644 --- a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs +++ b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base}; // This target is for glibc Linux on Csky @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { //https://github.com/llvm/llvm-project/blob/8b76aea8d8b1b71f6220bc2845abc749f18a19b7/clang/lib/Basic/Targets/CSKY.h llvm_target: "csky-unknown-linux-gnuabiv2".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("C-SKY abiv2 Linux (little endian)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs index d0583b7866b..c233ec3ada7 100644 --- a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs +++ b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base}; // This target is for glibc Linux on Csky @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { //https://github.com/llvm/llvm-project/blob/8b76aea8d8b1b71f6220bc2845abc749f18a19b7/clang/lib/Basic/Targets/CSKY.h llvm_target: "csky-unknown-linux-gnuabiv2".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("C-SKY abiv2 Linux, hardfloat (little endian)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs index 003600c26cc..f7416a7e0fd 100644 --- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "hexagon-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Hexagon Linux with musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs index 730b19abd2b..e5a927d0953 100644 --- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs @@ -1,9 +1,9 @@ -use crate::spec::{PanicStrategy, Target, TargetOptions}; +use crate::spec::{PanicStrategy, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { Target { llvm_target: "hexagon-unknown-none-elf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare Hexagon (v60+, HVX)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs index 41c5fafe341..29865fcd4c4 100644 --- a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { // i386-apple-ios is a simulator target, even though it isn't declared @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("ios", Arch::I386, TargetAbi::Simulator); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86 Apple iOS Simulator".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs b/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs index fa21cfbab8a..6a98a763b36 100644 --- a/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs +++ b/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs @@ -1,5 +1,5 @@ use crate::spec::base::nto_qnx; -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{RustcAbi, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { let mut meta = nto_qnx::meta(); @@ -14,6 +14,7 @@ pub(crate) fn target() -> Target { .into(), arch: "x86".into(), options: TargetOptions { + rustc_abi: Some(RustcAbi::X86Sse2), cpu: "pentium4".into(), max_atomic_width: Some(64), pre_link_args: nto_qnx::pre_link_args( diff --git a/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs index dd38f86bced..394e6f9e6bf 100644 --- a/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs @@ -2,6 +2,7 @@ use crate::spec::Target; pub(crate) fn target() -> Target { let mut base = super::i686_pc_windows_msvc::target(); + base.rustc_abi = None; // overwrite the SSE2 ABI set by the base target base.cpu = "pentium".into(); base.llvm_target = "i586-pc-windows-msvc".into(); base diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs index e481e967ebf..f04e3c2c2a5 100644 --- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs @@ -2,6 +2,7 @@ use crate::spec::Target; pub(crate) fn target() -> Target { let mut base = super::i686_unknown_linux_gnu::target(); + base.rustc_abi = None; // overwrite the SSE2 ABI set by the base target base.cpu = "pentium".into(); base.llvm_target = "i586-unknown-linux-gnu".into(); base diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs index 8ad93496f3a..42babb90da7 100644 --- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs @@ -2,6 +2,7 @@ use crate::spec::Target; pub(crate) fn target() -> Target { let mut base = super::i686_unknown_linux_musl::target(); + base.rustc_abi = None; // overwrite the SSE2 ABI set by the base target base.cpu = "pentium".into(); base.llvm_target = "i586-unknown-linux-musl".into(); // FIXME(compiler-team#422): musl targets should be dynamically linked by default. diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs index 6aa34f157ab..39a71cf1781 100644 --- a/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs @@ -1,4 +1,4 @@ -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i586-unknown-netbsdelf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit x86, resricted to Pentium".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs index 29ef8b883a1..08281eda42e 100644 --- a/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::redox::opts(); @@ -11,12 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i586-unknown-redox".into(), - metadata: crate::spec::TargetMetadata { - description: None, - tier: None, - host_tools: None, - std: None, - }, + metadata: TargetMetadata { description: None, tier: None, host_tools: None, std: None }, pointer_width: 32, data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128" diff --git a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs index 6adf690e0dd..161db9a08bb 100644 --- a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, Target, TargetOptions}; +use crate::spec::{FramePointer, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("macos", Arch::I686, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86 Apple macOS (10.12+, Sierra+)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs index 1b8f4c1be2d..f2d7ec66443 100644 --- a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs +++ b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs @@ -1,4 +1,6 @@ -use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + RustcAbi, SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; // See https://developer.android.com/ndk/guides/abis.html#x86 // for target ABI requirements. @@ -8,6 +10,7 @@ pub(crate) fn target() -> Target { base.max_atomic_width = Some(64); + base.rustc_abi = Some(RustcAbi::X86Sse2); // https://developer.android.com/ndk/guides/abis.html#x86 base.cpu = "pentium4".into(); base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".into(); @@ -15,7 +18,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-linux-android".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit x86 Android".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs index 208fe50912c..2a26323e514 100644 --- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs @@ -1,7 +1,8 @@ -use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, base}; +use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, RustcAbi, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_gnu::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.frame_pointer = FramePointer::Always; // Required for backtraces @@ -17,7 +18,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-pc-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit MinGW (Windows 10+)".into()), tier: Some(1), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs index 5df8dce1aa3..2e2ea8f81be 100644 --- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs +++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs @@ -1,7 +1,8 @@ -use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, base}; +use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, RustcAbi, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_gnullvm::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.frame_pointer = FramePointer::Always; // Required for backtraces @@ -16,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-pc-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit x86 MinGW (Windows 10+), LLVM ABI".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs index 180750bc7a8..6a95afa1d0d 100644 --- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs @@ -1,7 +1,8 @@ -use crate::spec::{LinkerFlavor, Lld, SanitizerSet, Target, base}; +use crate::spec::{LinkerFlavor, Lld, RustcAbi, SanitizerSet, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.supported_sanitizers = SanitizerSet::ADDRESS; @@ -21,7 +22,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit MSVC (Windows 10+)".into()), tier: Some(1), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs index 85ab87cc07f..1dfea64ebed 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs @@ -1,7 +1,8 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-znotext"]); @@ -9,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-freebsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit FreeBSD".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs index 1ab493c787c..ab329170a4f 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs @@ -1,7 +1,8 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::haiku::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); @@ -9,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-haiku".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit Haiku".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs index 2f93e97d9fc..b01f93f7404 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::hurd_gnu::opts(); @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-hurd-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit GNU/Hurd".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs index c95cb308d7f..c70c026f9f7 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs @@ -1,7 +1,21 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, RustcAbi, SanitizerSet, StackProbeType, Target, TargetMetadata, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); + // Dear distribution packager, if you are changing the base CPU model with the goal of removing + // the SSE2 requirement, make sure to also set the `rustc_abi` to `None` above or else the compiler + // will complain that the chosen ABI cannot be realized with the given CPU features. + // Also note that x86 without SSE2 is *not* considered a Tier 1 target by the Rust project, and + // it has some known floating-point correctness issues mostly caused by a lack of people caring + // for LLVM's x87 support (double-rounding, value truncation; see + // <https://github.com/rust-lang/rust/issues/114479> for details). This can lead to incorrect + // math (Rust generally promises exact math, so this can break code in unexpected ways) and it + // can lead to memory safety violations if floating-point values are used e.g. to access an + // array. If users run into such issues and report bugs upstream and then it turns out that the + // bugs are caused by distribution patches, that leads to confusion and frustration. base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.supported_sanitizers = SanitizerSet::ADDRESS; @@ -10,7 +24,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit Linux (kernel 3.2, glibc 2.17+)".into()), tier: Some(1), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs index 6ba87c732b7..47a7eb3d597 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs @@ -1,7 +1,12 @@ -use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{ + Cc, FramePointer, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); + // If you want to change the base CPU, please see `i686_unknown_linux_gnu.rs` + // for an important comment. base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]); @@ -25,7 +30,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit Linux with musl 1.2.3".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs index 092ba5c7baa..cbd61cadb36 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs @@ -1,7 +1,10 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); @@ -9,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-netbsdelf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("NetBSD/i386 with SSE2".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs index 7ae9189e233..48f7be7dc2b 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs @@ -1,7 +1,8 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-fuse-ld=lld"]); @@ -9,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-openbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit OpenBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs index 736b9131022..1a7923ca89b 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs @@ -5,7 +5,7 @@ // The cdecl ABI is used. It differs from the stdcall or fastcall ABI. // "i686-unknown-windows" is used to get the minimal subset of windows-specific features. -use crate::spec::{LinkerFlavor, Lld, RustcAbi, Target, add_link_args, base}; +use crate::spec::{LinkerFlavor, Lld, RustcAbi, Target, TargetMetadata, add_link_args, base}; pub(crate) fn target() -> Target { let mut base = base::uefi_msvc::opts(); @@ -86,7 +86,7 @@ pub(crate) fn target() -> Target { // remove -gnu and use the default one. Target { llvm_target: "i686-unknown-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit UEFI".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs index 6e3733538ed..d95f779774f 100644 --- a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs @@ -1,7 +1,8 @@ -use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, base}; +use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, RustcAbi, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_uwp_gnu::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.frame_pointer = FramePointer::Always; // Required for backtraces @@ -16,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-pc-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs index e0de9b9af45..fa7a103df79 100644 --- a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs @@ -1,13 +1,14 @@ -use crate::spec::{Target, base}; +use crate::spec::{RustcAbi, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_uwp_msvc::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); Target { llvm_target: "i686-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i686_win7_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_win7_windows_gnu.rs index 1d084c0729c..f364c2cb032 100644 --- a/compiler/rustc_target/src/spec/targets/i686_win7_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_win7_windows_gnu.rs @@ -1,8 +1,9 @@ -use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, base}; +use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, RustcAbi, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_gnu::opts(); base.vendor = "win7".into(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.frame_pointer = FramePointer::Always; // Required for backtraces @@ -18,7 +19,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-pc-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit MinGW (Windows 7+)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs index 7efba3aa986..233a1c4fd7a 100644 --- a/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs @@ -1,8 +1,9 @@ -use crate::spec::{LinkerFlavor, Lld, SanitizerSet, Target, base}; +use crate::spec::{LinkerFlavor, Lld, RustcAbi, SanitizerSet, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); base.vendor = "win7".into(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.supported_sanitizers = SanitizerSet::ADDRESS; @@ -22,7 +23,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit MSVC (Windows 7+)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs index dfffa6e138f..63ede7b4ab8 100644 --- a/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs @@ -1,7 +1,8 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); + base.rustc_abi = Some(RustcAbi::X86Sse2); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); @@ -9,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs index 603c0f99314..9e743a35529 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs @@ -1,9 +1,9 @@ -use crate::spec::{CodeModel, SanitizerSet, Target, TargetOptions, base}; +use crate::spec::{CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("LoongArch64 Linux, LP64D ABI (kernel 5.19, glibc 2.36)".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs index d7044dde0f1..d9010b1e4ee 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs @@ -1,9 +1,9 @@ -use crate::spec::{CodeModel, SanitizerSet, Target, TargetOptions, base}; +use crate::spec::{CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("LoongArch64 Linux (LP64D ABI) with musl 1.2.5".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs index 11d05db6b0a..c1c859ef25c 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs @@ -1,9 +1,9 @@ -use crate::spec::{CodeModel, SanitizerSet, Target, TargetOptions, base}; +use crate::spec::{CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-linux-ohos".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("LoongArch64 OpenHarmony".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs index db527c8b636..91e3064aaed 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs @@ -1,11 +1,12 @@ use crate::spec::{ - Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, + Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Freestanding/bare-metal LoongArch64".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs index 221ca02fe3e..24983900683 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs @@ -1,11 +1,12 @@ use crate::spec::{ - Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, + Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Freestanding/bare-metal LoongArch64 softfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs index d3584a1be74..9bd02e842c2 100644 --- a/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{LinkSelfContainedDefault, Target, TargetOptions, base}; +use crate::spec::{LinkSelfContainedDefault, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "m68k-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Motorola 680x0 Linux".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/m68k_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/m68k_unknown_none_elf.rs index 8b8693b55c5..6b66052692a 100644 --- a/compiler/rustc_target/src/spec/targets/m68k_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/m68k_unknown_none_elf.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{CodeModel, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{CodeModel, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let options = TargetOptions { @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "m68k".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Motorola 680x0".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs index 4880e993722..1300280e35b 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs @@ -2,7 +2,7 @@ use rustc_abi::Endian; -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS64 for OpenWrt Linux musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs index daf6d5de4c0..b130ca29c7f 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mips64-unknown-linux-gnuabi64".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS64 Linux, N64 ABI (kernel 4.4, glibc 2.23)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs index 03c8fa92450..4ea7c7bff44 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS64 Linux, N64 ABI, musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs index c7d24871225..a9afea27ef3 100644 --- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs @@ -1,9 +1,9 @@ -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mips64el-unknown-linux-gnuabi64".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS64 Linux, N64 ABI (kernel 4.4, glibc 2.23)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs index 5e7c37fd46c..7bdd9edda70 100644 --- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs @@ -1,4 +1,4 @@ -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64el-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS64 Linux, N64 ABI, musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs b/compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs index 2815d995c31..def12122416 100644 --- a/compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs @@ -1,12 +1,14 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(), llvm_target: "mips".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS32r2 BE Baremetal Softfloat".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs index 19cf62d19f6..29a451b31a6 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mips-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS Linux (kernel 4.4, glibc 2.23)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs index dbca90ba569..82f2fda7fff 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { base.max_atomic_width = Some(32); Target { llvm_target: "mips-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS Linux with musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs index c26c7867ec7..0955b3debea 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mips-unknown-linux-uclibc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS Linux with uClibc".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs b/compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs index f532643b56a..cc9c19e4a0b 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs @@ -1,12 +1,14 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(), llvm_target: "mipsel".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS32r2 LE Baremetal Softfloat".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs b/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs index 2c63b0f2f38..37ebb3d174b 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetMetadata, TargetOptions, cvs}; // The PSP has custom linker requirements. const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld"); @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-sony-psp".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS (LE) Sony PlatStation Portable (PSP)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs b/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs index 1b8f9b71e93..8475a43ea63 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs @@ -1,9 +1,11 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, +}; pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-sony-psx".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS (LE) Sony PlayStation 1 (PSX)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs index 08226449358..6c7ea5c5688 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs @@ -1,9 +1,9 @@ -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS (little endian) Linux (kernel 4.4, glibc 2.23)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs index 339b32b6339..d008bb55189 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs @@ -1,4 +1,4 @@ -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { base.max_atomic_width = Some(32); Target { llvm_target: "mipsel-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS (little endian) Linux with musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs index 88474e71848..08c4347fe01 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs @@ -1,9 +1,9 @@ -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-linux-uclibc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("MIPS (LE) Linux with uClibc".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs index 400e05f1478..502d7382b3c 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-netbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit MIPS (LE), requires mips32 cpu support".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs index bb8eb24908c..6a201c56475 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs @@ -2,12 +2,14 @@ //! //! Can be used for MIPS M4K core (e.g. on PIC32MX devices) -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare MIPS (LE) softfloat".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs index c7b0a05d889..0716f2e483b 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mipsisa32r6-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit MIPS Release 6 Big Endian".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs index c75023385c2..81f2424e4de 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs @@ -1,9 +1,9 @@ -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mipsisa32r6el-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit MIPS Release 6 Little Endian".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs index 49bec90022c..3eefa27ea04 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mipsisa64r6-unknown-linux-gnuabi64".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit MIPS Release 6 Big Endian".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs index 60bda7a5996..0887180791c 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs @@ -1,9 +1,9 @@ -use crate::spec::{Target, TargetOptions, base}; +use crate::spec::{Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "mipsisa64r6el-unknown-linux-gnuabi64".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit MIPS Release 6 Little Endian".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs b/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs index 80cb740450a..b067ac1e54a 100644 --- a/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs @@ -1,9 +1,11 @@ -use crate::spec::{Cc, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{ + Cc, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, +}; pub(crate) fn target() -> Target { Target { llvm_target: "msp430-none-elf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("16-bit MSP430 microcontrollers".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs b/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs index 289251e906a..598f0f19f0d 100644 --- a/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs +++ b/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs @@ -1,13 +1,14 @@ use crate::spec::{ - LinkSelfContainedDefault, LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions, + LinkSelfContainedDefault, LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { Target { arch: "nvptx64".into(), - data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".into(), + data_layout: "e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64".into(), llvm_target: "nvptx64-nvidia-cuda".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("--emit=asm generates PTX code that runs on NVIDIA GPUs".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs b/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs index 2125c95e266..a1405188999 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::aix::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-ibm-aix".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit AIX (7.2 and newer)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs index 201ab0d534f..dba45776c94 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); @@ -11,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-unknown-freebsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("PPC64 FreeBSD (ELFv2)".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs index 1a2f2125942..1f67bc7f3c2 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -11,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("PowerPC Linux (kernel 3.2, glibc 2.17)".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs index 417c8b63c86..49413d27a45 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -13,7 +15,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit PowerPC Linux with musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs index 15947fdb0ac..f5ca54291c6 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); @@ -11,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-unknown-openbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("OpenBSD/powerpc64".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs index d48c2f5e744..3e4a58f568a 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); @@ -11,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs index 13885c7326a..4640d537e8e 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); @@ -9,7 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64le-unknown-freebsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("PPC64LE FreeBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs index 06ae54063ce..dd3f660d81e 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -9,7 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64le-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("PPC64LE Linux (kernel 3.10, glibc 2.17)".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs index f763c37f535..9e2bfe2c56f 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -11,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64le-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit PowerPC Linux with musl 1.2.3, Little Endian".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs index d6a84f55f5e..5e1161e2f7d 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); @@ -14,7 +16,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-freebsd13.0".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("PowerPC FreeBSD".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs index 6f3a2baf405..6cde4bd98ac 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -10,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("PowerPC Linux (kernel 3.2, glibc 2.17)".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs index c4d894823e6..03bae9b5977 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -10,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-gnuspe".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("PowerPC SPE Linux".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs index 5b5fea666bb..316b62d941b 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -12,7 +14,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("PowerPC Linux with musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs index dfd99635ddd..df4fd75b0bd 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -12,7 +14,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-muslspe".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("PowerPC SPE Linux with musl".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs index 7492077bb88..47a61a1aff2 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); @@ -10,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-netbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("NetBSD 32-bit powerpc systems".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs index dd82a6a71cd..bc5a50a0539 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{StackProbeType, Target, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-openbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs index c4f93c60d3e..ca78be2b2b2 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); @@ -10,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs index 0284c50bd65..e6345629f03 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); @@ -10,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-gnuspe".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/riscv32_wrs_vxworks.rs index 4d3df78a563..55dc6a70627 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32_wrs_vxworks.rs @@ -1,9 +1,9 @@ -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32e_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32e_unknown_none_elf.rs index 771ffac7d80..00e8532d238 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32e_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32e_unknown_none_elf.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { let abi = "ilp32e"; @@ -7,7 +9,7 @@ pub(crate) fn target() -> Target { // `options.llvm_abiname`. data_layout: "e-m:e-p:32:32-i64:64-n32-S32".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV32E ISA)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32em_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32em_unknown_none_elf.rs index 3b81c278d3a..f814201601f 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32em_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32em_unknown_none_elf.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { let abi = "ilp32e"; @@ -7,7 +9,7 @@ pub(crate) fn target() -> Target { // `options.llvm_abiname`. data_layout: "e-m:e-p:32:32-i64:64-n32-S32".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV32EM ISA)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32emc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32emc_unknown_none_elf.rs index c18b51ad46e..33df429db72 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32emc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32emc_unknown_none_elf.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { let abi = "ilp32e"; @@ -7,7 +9,7 @@ pub(crate) fn target() -> Target { // `options.llvm_abiname`. data_layout: "e-m:e-p:32:32-i64:64-n32-S32".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV32EMC ISA)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs index e9c57b99b92..6dda346aaaf 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs @@ -1,11 +1,11 @@ use std::borrow::Cow; -use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions, base}; +use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv32-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V Linux (kernel 5.4, glibc 2.33)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs index a07429bb0c5..ba10e3c6881 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs @@ -1,11 +1,11 @@ use std::borrow::Cow; -use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions, base}; +use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv32-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some( "RISC-V Linux (kernel 5.4, musl 1.2.3 + RISCV32 support patches".into(), ), diff --git a/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs index 0e0e13fd1d8..f9a3b217220 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV32I ISA)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs index 669c1702fda..162f21c42ba 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC Zero's zero-knowledge Virtual Machine (RV32IM ISA)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs index 477a6c0e9eb..47b408a12d1 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs index 68146788d20..a173fb00b32 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV32IMA ISA)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs index e12c3af6f8f..48db9f44eac 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs @@ -1,10 +1,10 @@ -use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V ESP-IDF".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs index adc76f3cdb5..1608f051ea8 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV32IMAC ISA)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs index 3eb3d18faf4..4ee02c6b295 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs index 88d112a012d..0893bd5ad6d 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V Xous (RV32IMAC ISA)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs index 0d5eda708d1..0929af7bb75 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs @@ -1,10 +1,10 @@ -use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V ESP-IDF".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs index 7395e1a6aad..44a84d9082c 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV32IMAFC ISA)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs index 7864f7f8f9a..8908c0c53d9 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs index cec97f86538..82a4d58a398 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs @@ -1,10 +1,10 @@ -use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V ESP-IDF".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs index 0e00fc69b41..755ffc6154a 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV32IMC ISA)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs index 60d8ec576af..8da0b0e3e6b 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs @@ -1,10 +1,12 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, +}; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs b/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs index f694a1cb60d..c8ef737b9e7 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs @@ -1,11 +1,13 @@ use std::borrow::Cow; -use crate::spec::{CodeModel, SanitizerSet, SplitDebuginfo, Target, TargetOptions, base}; +use crate::spec::{ + CodeModel, SanitizerSet, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-linux-android".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V 64-bit Android".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/riscv64_wrs_vxworks.rs index 720549e6a01..58ded24b9c5 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64_wrs_vxworks.rs @@ -1,9 +1,9 @@ -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv64".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs index 905bed76db4..ecf65677531 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs @@ -1,9 +1,9 @@ -use crate::spec::{CodeModel, Target, TargetOptions, base}; +use crate::spec::{CodeModel, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-freebsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V FreeBSD".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs index 7a887b604c5..d673936f5f8 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs @@ -1,9 +1,9 @@ -use crate::spec::{CodeModel, SanitizerSet, Target, TargetOptions, base}; +use crate::spec::{CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-fuchsia".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V Fuchsia".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs index a24e24edc59..88b5dca284a 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs @@ -1,9 +1,9 @@ -use crate::spec::{CodeModel, RelocModel, Target, TargetOptions, TlsModel, base}; +use crate::spec::{CodeModel, RelocModel, Target, TargetMetadata, TargetOptions, TlsModel, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-hermit".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V Hermit".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs index da2c272005d..8ffb622511d 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs @@ -1,11 +1,11 @@ use std::borrow::Cow; -use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions, base}; +use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V Linux (kernel 4.20, glibc 2.29)".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs index 0a4cc3b8be6..33b08fdcb05 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs @@ -1,11 +1,11 @@ use std::borrow::Cow; -use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions, base}; +use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V Linux (kernel 4.20, musl 1.2.3)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs index 9edec38f652..2b647e36f18 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs @@ -1,9 +1,9 @@ -use crate::spec::{CodeModel, Target, TargetOptions, base}; +use crate::spec::{CodeModel, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-netbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("RISC-V NetBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs index c32c57d92f7..d6f0a5499b9 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs @@ -1,12 +1,12 @@ use crate::spec::{ Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, - TargetOptions, + TargetMetadata, TargetOptions, }; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV64IMAFDC ISA)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs index 2cbb8c19b84..bc6829897a4 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs @@ -1,12 +1,12 @@ use crate::spec::{ Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, - TargetOptions, cvs, + TargetMetadata, TargetOptions, cvs, }; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs index 6aacb04418e..75f508d8e93 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs @@ -1,9 +1,9 @@ -use crate::spec::{CodeModel, Target, TargetOptions, base}; +use crate::spec::{CodeModel, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-openbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("OpenBSD/riscv64".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs index d62ecc07a5d..5c5d4aa32a2 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs @@ -1,13 +1,13 @@ use crate::spec::{ Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, - TargetOptions, + TargetMetadata, TargetOptions, }; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), llvm_target: "riscv64".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare RISC-V (RV64IMAC ISA)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs index 306b23d2787..0928250dba6 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs @@ -1,12 +1,12 @@ use crate::spec::{ Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, - TargetOptions, cvs, + TargetMetadata, TargetOptions, cvs, }; pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs index 41aa400f3e0..e0d16a7bfa5 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{SanitizerSet, StackProbeType, Target, base}; +use crate::spec::{SanitizerSet, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "s390x-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("S390x Linux (kernel 3.2, glibc 2.17)".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs index 61c01eba70d..47050c1f769 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{SanitizerSet, StackProbeType, Target, base}; +use crate::spec::{SanitizerSet, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "s390x-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("S390x Linux (kernel 3.2, musl 1.2.3)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs index 3317fe51c33..a52dadba5a5 100644 --- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{Target, base}; +use crate::spec::{Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "sparc64-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("SPARC Linux (kernel 4.4, glibc 2.23)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs index 4c2b971c0f1..21eedc5b6bc 100644 --- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "sparc64-unknown-netbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("NetBSD/sparc64".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs index 81d7bf9a628..b573bdf80a9 100644 --- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "sparc64-unknown-openbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("OpenBSD/sparc64".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs index 6abef79be96..ffef6967912 100644 --- a/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs @@ -1,11 +1,11 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "sparc-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("32-bit SPARC Linux".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs index 00cd7438f7e..c2f64998ddd 100644 --- a/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs @@ -1,6 +1,8 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, +}; pub(crate) fn target() -> Target { let options = TargetOptions { @@ -20,7 +22,7 @@ pub(crate) fn target() -> Target { Target { data_layout: "E-m:e-p:32:32-i64:64-i128:128-f128:64-n32-S64".into(), llvm_target: "sparc-unknown-none-elf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare 32-bit SPARC V7+".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs b/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs index 5b7d560a8e0..1c53e15837c 100644 --- a/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs +++ b/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs @@ -1,6 +1,6 @@ use rustc_abi::Endian; -use crate::spec::{Cc, LinkerFlavor, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::solaris::opts(); @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "sparcv9-sun-solaris".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("SPARC Solaris 11.4".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs index b0eefcab209..7221bd8d4ae 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs @@ -10,13 +10,14 @@ //! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script. use crate::spec::{ - FloatAbi, FramePointer, PanicStrategy, RelocModel, Target, TargetOptions, base, cvs, + FloatAbi, FramePointer, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, base, + cvs, }; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv4t-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Thumb-mode Bare ARMv4T".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs index 1439e4a939f..155e25211c1 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs @@ -1,11 +1,11 @@ //! Targets the ARMv5TE, with code as `t32` code by default. -use crate::spec::{FloatAbi, FramePointer, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, FramePointer, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv5te-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Thumb-mode Bare ARMv5TE".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs index 4333a9c631c..3b4b94da057 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs @@ -1,11 +1,11 @@ // Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture) -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv6m-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare ARMv6-M".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs index dcf98acc41f..3c6133dc7ce 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs @@ -1,11 +1,11 @@ // Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture) -use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv6m-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabi.rs index b5cb393f4b0..5660f97c8b5 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabi.rs @@ -4,12 +4,12 @@ // and will use software floating point operations. This matches the NuttX EABI // configuration without hardware floating point support. -use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7a-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabihf.rs index 1aa44a8cc93..d79970b0a0d 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabihf.rs @@ -7,12 +7,12 @@ // This target uses the "hard" floating convention (ABI) where floating point values // are passed to/from subroutines via FPU registers (S0, S1, D0, D1, etc.). -use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7a-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs index a62d03ba0d3..33da885cc1a 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs @@ -1,4 +1,6 @@ -use crate::spec::{FloatAbi, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions, base}; +use crate::spec::{ + FloatAbi, LinkerFlavor, Lld, PanicStrategy, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); @@ -13,7 +15,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7a-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs index c9df66253b3..b4cc960939e 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs @@ -1,9 +1,9 @@ -use crate::spec::{FloatAbi, PanicStrategy, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, PanicStrategy, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7a-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs index b5cf8ce74f4..c747d721b67 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs @@ -9,12 +9,12 @@ // To opt-in to hardware accelerated floating point operations, you can use, for example, // `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`. -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7em-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare ARMv7E-M".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs index c7b54b94efa..309d32042a0 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs @@ -8,12 +8,12 @@ // // To opt into double precision hardware support, use the `-C target-feature=+fp64` flag. -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7em-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare ARMv7E-M, hardfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs index a3bc4013e53..57ef4e75e64 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs @@ -9,12 +9,12 @@ // To opt-in to hardware accelerated floating point operations, you can use, for example, // `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`. -use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7em-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs index 14bbe38257d..0518872dd62 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs @@ -8,12 +8,12 @@ // // To opt into double precision hardware support, use the `-C target-feature=+fp64` flag. -use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7em-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs index 50f7bc1f810..f261009d854 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs @@ -1,11 +1,11 @@ // Targets the Cortex-M3 processor (ARMv7-M) -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7m-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare ARMv7-M".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs index 2a77f48a9cd..611795e58f1 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs @@ -1,11 +1,11 @@ // Targets the Cortex-M3 processor (ARMv7-M) -use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7m-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs index de3ac26a2bd..d3a25163c53 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, Target, TargetOptions, base}; +use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base}; // This target if is for the Android v7a ABI in thumb mode with // NEON unconditionally enabled and, therefore, with 32 FPU registers @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv7-a"]); Target { llvm_target: "armv7-none-linux-android".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Thumb2-mode ARMv7-A Android with NEON".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs index 120f13ae56d..cce49f274ac 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs @@ -1,4 +1,4 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; // This target is for glibc Linux on ARMv7 with thumb mode enabled // (for consistency with Android and Debian-based distributions) @@ -9,7 +9,7 @@ use crate::spec::{FloatAbi, Target, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-gnueabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some( "Thumb2-mode ARMv7-A Linux with NEON (kernel 4.4, glibc 2.23)".into(), ), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs index 1149b6d16eb..81c502bfead 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs @@ -1,4 +1,4 @@ -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; // This target is for musl Linux on ARMv7 with thumb mode enabled // (for consistency with Android and Debian-based distributions) @@ -9,7 +9,7 @@ use crate::spec::{FloatAbi, Target, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs index 823fb828e4d..b35f7bac93b 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs @@ -1,11 +1,11 @@ // Targets the Cortex-M23 processor (Baseline ARMv8-M) -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.base-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare ARMv8-M Baseline".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs index 25a100e9c7e..4e5f6898651 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs @@ -1,11 +1,11 @@ // Targets the Cortex-M23 processor (Baseline ARMv8-M) -use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.base-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs index 47304e3027d..38143904efd 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs @@ -1,12 +1,12 @@ // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), // without the Floating Point extension. -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.main-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare ARMv8-M Mainline".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs index ddb5132ba60..55b7561da84 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs @@ -1,12 +1,12 @@ // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), // with the Floating Point extension. -use crate::spec::{FloatAbi, Target, TargetOptions, base}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.main-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Bare ARMv8-M Mainline, hardfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs index 0bfe2b32ad4..56aca0a8829 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs @@ -1,12 +1,12 @@ // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), // without the Floating Point extension. -use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.main-none-eabi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs index 9f75f23aa93..47525e704da 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs @@ -1,12 +1,12 @@ // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), // with the Floating Point extension. -use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs}; +use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.main-none-eabihf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs b/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs index bdb1fc55711..4624c0fd5cb 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs @@ -1,5 +1,6 @@ use crate::spec::{ - LinkArgs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, base, cvs, + LinkArgs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, base, + cvs, }; pub(crate) fn target() -> Target { @@ -25,7 +26,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "wasm32-unknown-emscripten".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("WebAssembly via Emscripten".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs b/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs index bcf7b69fe74..b5792731a90 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs @@ -10,7 +10,7 @@ //! This target is more or less managed by the Rust and WebAssembly Working //! Group nowadays at <https://github.com/rustwasm>. -use crate::spec::{Cc, LinkerFlavor, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut options = base::wasm::options(); @@ -36,7 +36,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "wasm32-unknown-unknown".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("WebAssembly".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs index 0862958d05d..26add451ed2 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs @@ -10,7 +10,9 @@ //! was since renamed to `wasm32-wasip1` after the preview2 target was //! introduced. -use crate::spec::{Cc, LinkSelfContainedDefault, LinkerFlavor, Target, base, crt_objects}; +use crate::spec::{ + Cc, LinkSelfContainedDefault, LinkerFlavor, Target, TargetMetadata, base, crt_objects, +}; pub(crate) fn target() -> Target { let mut options = base::wasm::options(); @@ -48,7 +50,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "wasm32-wasip1".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("WebAssembly with WASI".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs index 2411d386f52..44d906a507d 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs @@ -7,7 +7,9 @@ //! //! Historically this target was known as `wasm32-wasi-preview1-threads`. -use crate::spec::{Cc, LinkSelfContainedDefault, LinkerFlavor, Target, base, crt_objects}; +use crate::spec::{ + Cc, LinkSelfContainedDefault, LinkerFlavor, Target, TargetMetadata, base, crt_objects, +}; pub(crate) fn target() -> Target { let mut options = base::wasm::options(); @@ -61,7 +63,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "wasm32-wasi".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs index 3f4618fad5a..7ad675dc3cf 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs @@ -16,7 +16,9 @@ //! You can see more about wasi at <https://wasi.dev> and the component model at //! <https://github.com/WebAssembly/component-model>. -use crate::spec::{LinkSelfContainedDefault, RelocModel, Target, base, crt_objects}; +use crate::spec::{ + LinkSelfContainedDefault, RelocModel, Target, TargetMetadata, base, crt_objects, +}; pub(crate) fn target() -> Target { let mut options = base::wasm::options(); @@ -59,7 +61,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "wasm32-wasip2".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("WebAssembly".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/wasm32v1_none.rs b/compiler/rustc_target/src/spec/targets/wasm32v1_none.rs index ab1dc21d125..e554e2ac076 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32v1_none.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32v1_none.rs @@ -12,7 +12,7 @@ //! nightly Rust feature `-Zbuild-std`. This target is for people who want to //! use stable Rust, and target a stable set pf WebAssembly features. -use crate::spec::{Cc, LinkerFlavor, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut options = base::wasm::options(); @@ -43,7 +43,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "wasm32-unknown-unknown".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("WebAssembly".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs b/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs index 596e26d1e9d..e8ac93a87ca 100644 --- a/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs +++ b/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs @@ -7,7 +7,7 @@ //! the standard library is available, most of it returns an error immediately //! (e.g. trying to create a TCP stream or something like that). -use crate::spec::{Cc, LinkerFlavor, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut options = base::wasm::options(); @@ -39,7 +39,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "wasm64-unknown-unknown".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("WebAssembly".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs index 52ef3fc88fd..2f868e38f1a 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("macos", Arch::X86_64, TargetAbi::Normal); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86_64 Apple macOS (10.12+, Sierra+)".into()), tier: Some(1), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs index f421e6b8984..df45f430ecb 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{SanitizerSet, Target, TargetOptions}; +use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { // x86_64-apple-ios is a simulator target, even though it isn't declared @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetAbi::Simulator); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86_64 Apple iOS Simulator".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs index 3687446b939..ee0c2bf31cd 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{SanitizerSet, Target, TargetOptions}; +use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetAbi::MacCatalyst); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86_64 Apple Mac Catalyst".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs index 07338a364e8..80ca80013f0 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { // x86_64-apple-tvos is a simulator target, even though it isn't declared @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("tvos", Arch::X86_64, TargetAbi::Simulator); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86_64 Apple tvOS Simulator".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs index 4a03c250e6f..c503baedb8b 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs @@ -1,11 +1,11 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (opts, llvm_target, arch) = base("watchos", Arch::X86_64, TargetAbi::Simulator); Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86_64 Apple watchOS Simulator".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs b/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs index 60d078371bb..bbaee6c1f6d 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, cvs}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, cvs}; pub(crate) fn target() -> Target { let pre_link_args = TargetOptions::link_args( @@ -74,7 +74,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "x86_64-elf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Fortanix ABI for 64-bit Intel SGX".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs b/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs index d8f74f66f70..3a0acaa028c 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs @@ -1,5 +1,6 @@ use crate::spec::{ - Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions, base, + Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, + base, }; pub(crate) fn target() -> Target { @@ -15,7 +16,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-linux-android".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit x86 Android".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs index 843568a4792..662bbc4a31c 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, SanitizerSet, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, SanitizerSet, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::solaris::opts(); @@ -12,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-pc-solaris".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit Solaris 11.4".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs index b10d4478d5e..16bdd3ee668 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_gnu::opts(); @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-pc-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit MinGW (Windows 10+)".into()), tier: Some(1), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs index 46c233f1863..1a03390c2b8 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_gnullvm::opts(); @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-pc-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit x86 MinGW (Windows 10+), LLVM ABI".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs index baf0d8b0c8b..d88aabaa6d3 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs @@ -1,4 +1,4 @@ -use crate::spec::{SanitizerSet, Target, base}; +use crate::spec::{SanitizerSet, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit MSVC (Windows 10+)".into()), tier: Some(1), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs index 8aa0128aaa3..a5723341fe6 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs @@ -1,9 +1,11 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, +}; pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit Unikraft with musl 1.2.3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs index 6492d3d7d2f..715c0db632b 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::dragonfly::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-dragonfly".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit DragonFlyBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs index 62cafd502e4..4a074539aab 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetMetadata, base, +}; pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); @@ -13,7 +15,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-freebsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit FreeBSD".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs index a45f8159de0..d41c696ac23 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs @@ -1,4 +1,4 @@ -use crate::spec::{SanitizerSet, StackProbeType, Target, base}; +use crate::spec::{SanitizerSet, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::fuchsia::opts(); @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-fuchsia".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit x86 Fuchsia".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs index b70b38dbbfe..ecb9fc80351 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::haiku::opts(); @@ -12,7 +12,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-haiku".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit Haiku".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs index 2e239cafe95..7abde771798 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs @@ -1,9 +1,9 @@ -use crate::spec::{StackProbeType, Target, TargetOptions, base}; +use crate::spec::{StackProbeType, Target, TargetMetadata, TargetOptions, base}; pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-hermit".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86_64 Hermit".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hurd_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hurd_gnu.rs index 34835a20956..57ce67af36d 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hurd_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hurd_gnu.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::hurd_gnu::opts(); @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-hurd-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit GNU/Hurd".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs index 69715fc257f..17f90db0c90 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, SanitizerSet, Target, base}; +use crate::spec::{Cc, LinkerFlavor, SanitizerSet, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::illumos::opts(); @@ -12,7 +12,7 @@ pub(crate) fn target() -> Target { // LLVM does not currently have a separate illumos target, // so we still pass Solaris to it llvm_target: "x86_64-pc-solaris".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("illumos".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs index db7e402cc80..a034a9fb244 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs @@ -1,4 +1,4 @@ -use crate::spec::{PanicStrategy, Target, base}; +use crate::spec::{PanicStrategy, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::l4re::opts(); @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-l4re-uclibc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs index 59ec6c7f9d5..0c8353fad18 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetMetadata, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -27,7 +29,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit Linux (kernel 3.2+, glibc 2.17+)".into()), tier: Some(1), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs index 8a613477940..c5d556e5cc6 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); @@ -14,7 +14,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-gnux32".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs index 8dcdc5be8a9..cc5f8886240 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetMetadata, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); @@ -19,7 +21,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit Linux with musl 1.2.3".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs index 2e63ff21572..896e8a78f86 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, StackProbeType, Target, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, PanicStrategy, StackProbeType, Target, TargetMetadata, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux::opts(); @@ -11,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-none".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: None, host_tools: None, diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs index 522943c91a5..de9027ba962 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs @@ -1,4 +1,6 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base}; +use crate::spec::{ + Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetMetadata, base, +}; pub(crate) fn target() -> Target { let mut base = base::linux_ohos::opts(); @@ -16,7 +18,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-ohos".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86_64 OpenHarmony".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs index e4972941957..0403c220982 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs @@ -1,5 +1,6 @@ use crate::spec::{ - Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions, base, + Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetMetadata, TargetOptions, + base, }; pub(crate) fn target() -> Target { @@ -18,7 +19,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-netbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("NetBSD/amd64".into()), tier: Some(2), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs index e14a3673589..1a6343595f5 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs @@ -6,7 +6,7 @@ use crate::spec::{ Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelroLevel, RustcAbi, SanitizerSet, - StackProbeType, Target, TargetOptions, + StackProbeType, Target, TargetMetadata, TargetOptions, }; pub(crate) fn target() -> Target { @@ -30,7 +30,7 @@ pub(crate) fn target() -> Target { }; Target { llvm_target: "x86_64-unknown-none-elf".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Freestanding/bare-metal x86_64 softfloat".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs index 3135ecf45dc..2eb09b8cbad 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-openbsd".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit OpenBSD".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs index 43a28fca09a..65b8e2543a4 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::redox::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-redox".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Redox OS".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_trusty.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_trusty.rs index a6af06b03db..c7b002bc9bb 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_trusty.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_trusty.rs @@ -1,13 +1,14 @@ // Trusty OS target for X86_64. use crate::spec::{ - LinkSelfContainedDefault, PanicStrategy, RelroLevel, StackProbeType, Target, TargetOptions, + LinkSelfContainedDefault, PanicStrategy, RelroLevel, StackProbeType, Target, TargetMetadata, + TargetOptions, }; pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-unknown-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86_64 Trusty".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs index bce6aa0ebc6..07f853dacaf 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs @@ -6,7 +6,7 @@ // LLVM. "x86_64-unknown-windows" is used to get the minimal subset of windows-specific features. use crate::callconv::Conv; -use crate::spec::{RustcAbi, Target, base}; +use crate::spec::{RustcAbi, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::uefi_msvc::opts(); @@ -30,7 +30,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-windows".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit UEFI".into()), tier: Some(2), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs index 0ef41d315af..bf6179cb6c3 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_uwp_gnu::opts(); @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-pc-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs index 31861c16099..50b0578da35 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs @@ -1,4 +1,4 @@ -use crate::spec::{Target, base}; +use crate::spec::{Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_uwp_msvc::opts(); @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_gnu.rs index 8f903934a90..df1fe8e7853 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_gnu.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_gnu::opts(); @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-pc-windows-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit MinGW (Windows 7+)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs index 2eceb688108..876ac011879 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs @@ -1,4 +1,4 @@ -use crate::spec::{SanitizerSet, Target, base}; +use crate::spec::{SanitizerSet, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-pc-windows-msvc".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("64-bit MSVC (Windows 7+)".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs index f003f939ad1..9ab62b3530f 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs @@ -1,4 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; +use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-gnu".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs index 0f73a860821..11010b7d92f 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs @@ -1,5 +1,5 @@ use crate::spec::base::apple::{Arch, TargetAbi, base}; -use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; +use crate::spec::{FramePointer, SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { let (mut opts, llvm_target, arch) = base("macos", Arch::X86_64h, TargetAbi::Normal); @@ -28,7 +28,7 @@ pub(crate) fn target() -> Target { Target { llvm_target, - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("x86_64 Apple macOS with Intel Haswell+".into()), tier: Some(3), host_tools: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs index b2a7c8551e4..c5b4d472fad 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs @@ -1,7 +1,7 @@ use rustc_abi::Endian; use crate::spec::base::xtensa; -use crate::spec::{Target, TargetOptions, cvs}; +use crate::spec::{Target, TargetMetadata, TargetOptions, cvs}; pub(crate) fn target() -> Target { Target { @@ -9,12 +9,7 @@ pub(crate) fn target() -> Target { pointer_width: 32, data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(), arch: "xtensa".into(), - metadata: crate::spec::TargetMetadata { - description: None, - tier: None, - host_tools: None, - std: None, - }, + metadata: TargetMetadata { description: None, tier: None, host_tools: None, std: None }, options: TargetOptions { endian: Endian::Little, diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs index 254ae54db21..d8638e8ac80 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs @@ -1,5 +1,5 @@ use crate::spec::base::xtensa; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { Target { @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { pointer_width: 32, data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(), arch: "xtensa".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Xtensa ESP32".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs index 4fab2bac8e2..dd98f34d323 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs @@ -1,7 +1,7 @@ use rustc_abi::Endian; use crate::spec::base::xtensa; -use crate::spec::{Target, TargetOptions, cvs}; +use crate::spec::{Target, TargetMetadata, TargetOptions, cvs}; pub(crate) fn target() -> Target { Target { @@ -9,12 +9,7 @@ pub(crate) fn target() -> Target { pointer_width: 32, data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(), arch: "xtensa".into(), - metadata: crate::spec::TargetMetadata { - description: None, - tier: None, - host_tools: None, - std: None, - }, + metadata: TargetMetadata { description: None, tier: None, host_tools: None, std: None }, options: TargetOptions { endian: Endian::Little, diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs index ae7bfbd0394..29bcf12cbaf 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs @@ -1,5 +1,5 @@ use crate::spec::base::xtensa; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { Target { @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { pointer_width: 32, data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(), arch: "xtensa".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Xtensa ESP32-S2".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs index 45d409a509f..dd6e7b6c3e8 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs @@ -1,7 +1,7 @@ use rustc_abi::Endian; use crate::spec::base::xtensa; -use crate::spec::{Target, TargetOptions, cvs}; +use crate::spec::{Target, TargetMetadata, TargetOptions, cvs}; pub(crate) fn target() -> Target { Target { @@ -9,12 +9,7 @@ pub(crate) fn target() -> Target { pointer_width: 32, data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(), arch: "xtensa".into(), - metadata: crate::spec::TargetMetadata { - description: None, - tier: None, - host_tools: None, - std: None, - }, + metadata: TargetMetadata { description: None, tier: None, host_tools: None, std: None }, options: TargetOptions { endian: Endian::Little, diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs index 023a67f2871..ddc909f387e 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs @@ -1,5 +1,5 @@ use crate::spec::base::xtensa; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { Target { @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { pointer_width: 32, data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(), arch: "xtensa".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { description: Some("Xtensa ESP32-S3".into()), tier: Some(3), host_tools: Some(false), diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index 1ba8defedae..bb41d03e87f 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -790,6 +790,13 @@ impl Target { // x87 must be enabled, soft-float must be disabled. FeatureConstraints { required: &["x87"], incompatible: &["soft-float"] } } + Some(RustcAbi::X86Sse2) => { + // Extended hardfloat ABI. x87 and SSE2 must be enabled, soft-float must be disabled. + FeatureConstraints { + required: &["x87", "sse2"], + incompatible: &["soft-float"], + } + } Some(RustcAbi::X86Softfloat) => { // Softfloat ABI, requires corresponding target feature. That feature trumps // `x87` and all other FPU features so those do not matter. @@ -817,6 +824,7 @@ impl Target { // LLVM handles the rest. FeatureConstraints { required: &["soft-float"], incompatible: &[] } } + Some(r) => panic!("invalid Rust ABI for x86_64: {r:?}"), } } "arm" => { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs index 091773009e9..a618bae269f 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs @@ -1989,7 +1989,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { trace: &TypeTrace<'tcx>, span: Span, ) -> Option<TypeErrorAdditionalDiags> { - let hir = self.tcx.hir(); let TypeError::ArraySize(sz) = terr else { return None; }; @@ -1997,7 +1996,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn { body: body_id, .. }, .. }) => { - let body = hir.body(*body_id); + let body = self.tcx.hir_body(*body_id); struct LetVisitor { span: Span, } diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs index 9e7e96dddd7..55eb3f777d6 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs @@ -1202,8 +1202,8 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tecx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tecx.tcx } fn visit_local(&mut self, local: &'tcx LetStmt<'tcx>) { @@ -1320,7 +1320,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> { { let output = args.as_closure().sig().output().skip_binder(); if self.generic_arg_contains_target(output.into()) { - let body = self.tecx.tcx.hir().body(body); + let body = self.tecx.tcx.hir_body(body); let should_wrap_expr = if matches!(body.value.kind, ExprKind::Block(..)) { None } else { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs index b9f3abc2534..5a303c3cd03 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs @@ -3,7 +3,6 @@ use core::ops::ControlFlow; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::intravisit::{self, Visitor, VisitorExt}; use rustc_hir::{self as hir, AmbigArg}; -use rustc_middle::hir::map::Map; use rustc_middle::hir::nested_filter; use rustc_middle::middle::resolve_bound_vars as rbv; use rustc_middle::ty::{self, Region, TyCtxt}; @@ -70,8 +69,8 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> { type Result = ControlFlow<&'tcx hir::Ty<'tcx>>; type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx, AmbigArg>) -> Self::Result { @@ -176,8 +175,8 @@ impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> { type Result = ControlFlow<()>; type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Map<'tcx> { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) -> Self::Result { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs index 886581bc35f..ad2f7f00fa5 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs @@ -66,7 +66,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { ); let mut impl_span = None; let mut implicit_static_lifetimes = Vec::new(); - if let Some(impl_node) = self.tcx().hir().get_if_local(*impl_def_id) { + if let Some(impl_node) = self.tcx().hir_get_if_local(*impl_def_id) { // If an impl is local, then maybe this isn't what they want. Try to // be as helpful as possible with implicit lifetimes. diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs index 039e21cb556..35fd4e588ef 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs @@ -318,7 +318,7 @@ pub fn suggest_new_region_bound( } else { // get a lifetime name of existing named lifetimes if any let existing_lt_name = if let Some(id) = scope_def_id - && let Some(generics) = tcx.hir().get_generics(id) + && let Some(generics) = tcx.hir_get_generics(id) && let named_lifetimes = generics .params .iter() @@ -349,7 +349,7 @@ pub fn suggest_new_region_bound( // if there are more than one elided lifetimes in inputs, the explicit `'_` lifetime cannot be used. // introducing a new lifetime `'a` or making use of one from existing named lifetimes if any if let Some(id) = scope_def_id - && let Some(generics) = tcx.hir().get_generics(id) + && let Some(generics) = tcx.hir_get_generics(id) && let mut spans_suggs = make_elided_region_spans_suggs(name, generics.params.iter()) && spans_suggs.len() > 1 @@ -470,7 +470,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { def_id: DefId, trait_objects: &FxIndexSet<DefId>, ) -> Option<(Ident, &'tcx hir::Ty<'tcx>)> { - match tcx.hir().get_if_local(def_id)? { + match tcx.hir_get_if_local(def_id)? { Node::ImplItem(impl_item) => { let impl_did = tcx.hir().get_parent_item(impl_item.hir_id()); if let hir::OwnerNode::Item(Item { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs index bbcd28c0835..0695cc57978 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs @@ -133,8 +133,8 @@ struct TypeParamSpanVisitor<'tcx> { impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx, AmbigArg>) { diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs index e8d14b89d69..37032b53901 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs @@ -543,7 +543,7 @@ impl<T> Trait<T> for X { let tcx = self.tcx; let assoc = tcx.associated_item(proj_ty.def_id); let (trait_ref, assoc_args) = proj_ty.trait_ref_and_own_args(tcx); - let Some(item) = tcx.hir().get_if_local(body_owner_def_id) else { + let Some(item) = tcx.hir_get_if_local(body_owner_def_id) else { return false; }; let Some(hir_generics) = item.generics() else { @@ -625,7 +625,7 @@ impl<T> Trait<T> for X { ) }; - let body_owner = tcx.hir().get_if_local(body_owner_def_id); + let body_owner = tcx.hir_get_if_local(body_owner_def_id); let current_method_ident = body_owner.and_then(|n| n.ident()).map(|i| i.name); // We don't want to suggest calling an assoc fn in a scope where that isn't feasible. diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs index f35a5349ecb..d009687ef14 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs @@ -487,7 +487,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { &format!("`{sup}: {sub}`"), ); // We should only suggest rewriting the `where` clause if the predicate is within that `where` clause - if let Some(generics) = self.tcx.hir().get_generics(impl_item_def_id) + if let Some(generics) = self.tcx.hir_get_generics(impl_item_def_id) && generics.where_clause_span.contains(span) { self.suggest_copy_trait_method_bounds( @@ -590,7 +590,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { return; }; - let Some(generics) = self.tcx.hir().get_generics(impl_item_def_id) else { + let Some(generics) = self.tcx.hir_get_generics(impl_item_def_id) else { return; }; @@ -763,7 +763,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { // Get the `hir::Param` to verify whether it already has any bounds. // We do this to avoid suggesting code that ends up as `T: 'a'b`, // instead we suggest `T: 'a + 'b` in that case. - let hir_generics = self.tcx.hir().get_generics(scope).unwrap(); + let hir_generics = self.tcx.hir_get_generics(scope).unwrap(); let sugg_span = match hir_generics.bounds_span_for_suggestions(def_id) { Some((span, open_paren_sp)) => Some((span, true, open_paren_sp)), // If `param` corresponds to `Self`, no usable suggestion span. @@ -822,7 +822,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { { // The lifetime found in the `impl` is longer than the one on the RPITIT. // Do not suggest `<Type as Trait>::{opaque}: 'static`. - } else if let Some(generics) = self.tcx.hir().get_generics(suggestion_scope) { + } else if let Some(generics) = self.tcx.hir_get_generics(suggestion_scope) { let pred = format!("{bound_kind}: {lt_name}"); let suggestion = format!("{} {}", generics.add_where_or_trailing_comma(), pred); suggs.push((generics.tail_span_for_predicate_suggestion(), suggestion)) @@ -907,7 +907,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { hir::OwnerNode::Synthetic => unreachable!(), } - let ast_generics = self.tcx.hir().get_generics(lifetime_scope).unwrap(); + let ast_generics = self.tcx.hir_get_generics(lifetime_scope).unwrap(); let sugg = ast_generics .span_for_lifetime_suggestion() .map(|span| (span, format!("{new_lt}, "))) @@ -1382,7 +1382,7 @@ fn suggest_precise_capturing<'tcx>( new_params += name_as_bounds; } - let Some(generics) = tcx.hir().get_generics(fn_def_id) else { + let Some(generics) = tcx.hir_get_generics(fn_def_id) else { // This shouldn't happen, but don't ICE. return; }; diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs index 562000e28ac..bb25c5e8bd1 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs @@ -649,7 +649,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { else { return; }; - let hir::Body { params, .. } = self.tcx.hir().body(*body); + let hir::Body { params, .. } = self.tcx.hir_body(*body); // 1. Get the args of the closure. // 2. Assume exp_found is FnOnce / FnMut / Fn, we can extract function parameters from [1]. @@ -846,7 +846,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { true }; - let hir = self.tcx.hir(); for stmt in blk.stmts.iter().rev() { let hir::StmtKind::Let(local) = &stmt.kind else { continue; @@ -871,7 +870,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { kind: hir::ExprKind::Closure(hir::Closure { body, .. }), .. }) => { - for param in hir.body(*body).params { + for param in self.tcx.hir_body(*body).params { param.pat.walk(&mut find_compatible_candidates); } } diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 49fa21e50c0..ecfffb65fbc 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -925,7 +925,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let hir_id = self.tcx.local_def_id_to_hir_id(obligation.cause.body_id); let Some(body_id) = self.tcx.hir_node(hir_id).body_id() else { return false }; let ControlFlow::Break(expr) = - (FindMethodSubexprOfTry { search_span: span }).visit_body(self.tcx.hir().body(body_id)) + (FindMethodSubexprOfTry { search_span: span }).visit_body(self.tcx.hir_body(body_id)) else { return false; }; @@ -1012,7 +1012,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { && let [arg] = args && let hir::ExprKind::Closure(closure) = arg.kind // The closure has a block for its body with no tail expression - && let body = self.tcx.hir().body(closure.body) + && let body = self.tcx.hir_body(closure.body) && let hir::ExprKind::Block(block, _) = body.value.kind && let None = block.expr // The last statement is of a type that can be converted to the return error type @@ -1447,7 +1447,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let [associated_item]: &[ty::AssocItem] = &associated_items[..] else { return None; }; - match self.tcx.hir().get_if_local(associated_item.def_id) { + match self.tcx.hir_get_if_local(associated_item.def_id) { Some( hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Type(_, Some(ty)), @@ -1514,7 +1514,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { span = match fn_decl.output { hir::FnRetTy::Return(ty) => ty.span, hir::FnRetTy::DefaultReturn(_) => { - let body = self.tcx.hir().body(id); + let body = self.tcx.hir_body(id); match body.value.kind { hir::ExprKind::Block( hir::Block { expr: Some(expr), .. }, @@ -2850,7 +2850,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { _ => None, }; - let found_node = found_did.and_then(|did| self.tcx.hir().get_if_local(did)); + let found_node = found_did.and_then(|did| self.tcx.hir_get_if_local(did)); let found_span = found_did.and_then(|did| self.tcx.hir().span_if_local(did)); if !self.reported_signature_mismatch.borrow_mut().insert((span, found_span)) { @@ -2896,7 +2896,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if found.len() != expected.len() { let (closure_span, closure_arg_span, found) = found_did .and_then(|did| { - let node = self.tcx.hir().get_if_local(did)?; + let node = self.tcx.hir_get_if_local(did)?; let (found_span, closure_arg_span, found) = self.get_fn_like_arguments(node)?; Some((Some(found_span), closure_arg_span, found)) }) @@ -2946,7 +2946,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { }) => ( fn_decl_span, fn_arg_span, - hir.body(body) + self.tcx + .hir_body(body) .params .iter() .map(|arg| { @@ -3208,7 +3209,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { Some(obligation.cause.body_id) }; if let Some(def_id) = def_id - && let Some(generics) = self.tcx.hir().get_generics(def_id) + && let Some(generics) = self.tcx.hir_get_generics(def_id) { err.span_suggestion_verbose( generics.tail_span_for_predicate_suggestion(), 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 e4f250ca4f5..22d219cd64d 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs @@ -68,8 +68,8 @@ impl<'hir> FindExprBySpan<'hir> { impl<'v> Visitor<'v> for FindExprBySpan<'v> { type NestedFilter = rustc_middle::hir::nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, ex: &'v hir::Expr<'v>) { @@ -418,7 +418,7 @@ pub fn report_dyn_incompatibility<'tcx>( violations: &[DynCompatibilityViolation], ) -> Diag<'tcx> { let trait_str = tcx.def_path_str(trait_def_id); - let trait_span = tcx.hir().get_if_local(trait_def_id).and_then(|node| match node { + let trait_span = tcx.hir_get_if_local(trait_def_id).and_then(|node| match node { hir::Node::Item(item) => Some(item.ident.span), _ => None, }); diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 527d2e54e43..ac1ced2ed3c 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -790,8 +790,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } // Get the name of the callable and the arguments to be used in the suggestion. - let hir = self.tcx.hir(); - let msg = match def_id_or_name { DefIdOrName::DefId(def_id) => match self.tcx.def_kind(def_id) { DefKind::Ctor(CtorOf::Struct, _) => { @@ -834,7 +832,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { Applicability::HasPlaceholders, ); } else if let DefIdOrName::DefId(def_id) = def_id_or_name { - let name = match hir.get_if_local(def_id) { + let name = match self.tcx.hir_get_if_local(def_id) { Some(hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(hir::Closure { fn_decl_span, .. }), .. @@ -950,7 +948,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ) -> bool { let self_ty = self.resolve_vars_if_possible(trait_pred.self_ty()); self.enter_forall(self_ty, |ty: Ty<'_>| { - let Some(generics) = self.tcx.hir().get_generics(obligation.cause.body_id) else { + let Some(generics) = self.tcx.hir_get_generics(obligation.cause.body_id) else { return false; }; let ty::Ref(_, inner_ty, hir::Mutability::Not) = ty.kind() else { return false }; @@ -1595,7 +1593,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { && let ty = typeck_results.expr_ty_adjusted(base) && let ty::FnDef(def_id, _args) = ty.kind() && let Some(hir::Node::Item(hir::Item { ident, span, vis_span, .. })) = - hir.get_if_local(*def_id) + self.tcx.hir_get_if_local(*def_id) { let msg = format!("alternatively, consider making `fn {ident}` asynchronous"); if vis_span.is_empty() { @@ -1703,10 +1701,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { span: Span, trait_pred: ty::PolyTraitPredicate<'tcx>, ) -> bool { - let hir = self.tcx.hir(); let node = self.tcx.hir_node_by_def_id(obligation.cause.body_id); if let hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn {sig, body: body_id, .. }, .. }) = node - && let hir::ExprKind::Block(blk, _) = &hir.body(*body_id).value.kind + && let hir::ExprKind::Block(blk, _) = &self.tcx.hir_body(*body_id).value.kind && sig.decl.output.span().overlaps(span) && blk.expr.is_none() && trait_pred.self_ty().skip_binder().is_unit() @@ -2790,7 +2787,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { generics, kind: hir::TraitItemKind::Type(bounds, None), .. - })) = tcx.hir().get_if_local(item_def_id) + })) = tcx.hir_get_if_local(item_def_id) // Do not suggest relaxing if there is an explicit `Sized` obligation. && !bounds.iter() .filter_map(|bound| bound.trait_ref()) @@ -3298,7 +3295,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let trait_name = parent_trait_pred.print_modifiers_and_trait_path().to_string(); let msg = format!("required for `{self_ty_str}` to implement `{trait_name}`"); let mut is_auto_trait = false; - match tcx.hir().get_if_local(data.impl_or_alias_def_id) { + match tcx.hir_get_if_local(data.impl_or_alias_def_id) { Some(Node::Item(hir::Item { kind: hir::ItemKind::Trait(is_auto, ..), ident, @@ -3423,7 +3420,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { .map_bound(|pred| pred.trait_ref) .print_only_trait_path(), ); - match tcx.hir().get_if_local(data.impl_def_id) { + match tcx.hir_get_if_local(data.impl_def_id) { Some(Node::Item(hir::Item { kind: hir::ItemKind::Impl(hir::Impl { of_trait, self_ty, .. }), .. @@ -3564,7 +3561,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let expr = tcx.hir().expect_expr(hir_id); (expr_ty, expr) } else if let Some(body_id) = tcx.hir_node_by_def_id(body_id).body_id() - && let body = tcx.hir().body(body_id) + && let body = tcx.hir_body(body_id) && let hir::ExprKind::Block(block, _) = body.value.kind && let Some(expr) = block.expr && let Some(expr_ty) = self @@ -3841,7 +3838,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { && let hir::ExprKind::Closure(hir::Closure { body, fn_decl_span, .. }) = value.kind - && let body = tcx.hir().body(*body) + && let body = tcx.hir_body(*body) && !matches!(body.value.kind, hir::ExprKind::Block(..)) { // Check if the failed predicate was an expectation of a closure type @@ -4068,7 +4065,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { && let [arg] = args && let hir::ExprKind::Closure(closure) = arg.kind { - let body = tcx.hir().body(closure.body); + let body = tcx.hir_body(closure.body); if let hir::ExprKind::Block(block, None) = body.value.kind && let None = block.expr && let [.., stmt] = block.stmts @@ -4761,7 +4758,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { { let mut sugg_spans = vec![(ret_span, " -> Result<(), Box<dyn std::error::Error>>".to_string())]; - let body = self.tcx.hir().body(body_id); + let body = self.tcx.hir_body(body_id); if let hir::ExprKind::Block(b, _) = body.value.kind && b.expr.is_none() { @@ -4807,7 +4804,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { debug!(?pred, ?item_def_id, ?span); let (Some(node), true) = ( - self.tcx.hir().get_if_local(item_def_id), + self.tcx.hir_get_if_local(item_def_id), self.tcx.is_lang_item(pred.def_id(), LangItem::Sized), ) else { return; @@ -5248,7 +5245,7 @@ pub fn suggest_desugaring_async_fn_to_impl_future_in_trait<'tcx>( // If there's a body, we also need to wrap it in `async {}` if let hir::TraitFn::Provided(body) = body { - let body = tcx.hir().body(body); + let body = tcx.hir_body(body); let body_span = body.value.span; let body_span_without_braces = body_span.with_lo(body_span.lo() + BytePos(1)).with_hi(body_span.hi() - BytePos(1)); diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs index 62cac5b17bd..ac4399750f5 100644 --- a/compiler/rustc_trait_selection/src/errors.rs +++ b/compiler/rustc_trait_selection/src/errors.rs @@ -1857,7 +1857,7 @@ pub fn impl_trait_overcapture_suggestion<'tcx>( new_params += name_as_bounds; } - let Some(generics) = tcx.hir().get_generics(fn_def_id) else { + let Some(generics) = tcx.hir_get_generics(fn_def_id) else { // This shouldn't happen, but don't ICE. return None; }; diff --git a/compiler/rustc_trait_selection/src/errors/note_and_explain.rs b/compiler/rustc_trait_selection/src/errors/note_and_explain.rs index b752dbf3093..4601ddf678a 100644 --- a/compiler/rustc_trait_selection/src/errors/note_and_explain.rs +++ b/compiler/rustc_trait_selection/src/errors/note_and_explain.rs @@ -26,7 +26,7 @@ impl<'a> DescriptionCtx<'a> { .parent(tcx.generics_of(generic_param_scope).region_param(br, tcx).def_id) .expect_local(); let span = if let Some(param) = - tcx.hir().get_generics(scope).and_then(|generics| generics.get_named(br.name)) + tcx.hir_get_generics(scope).and_then(|generics| generics.get_named(br.name)) { param.span } else { @@ -48,8 +48,7 @@ impl<'a> DescriptionCtx<'a> { match fr.kind { ty::LateParamRegionKind::Named(_, name) => { let span = if let Some(param) = tcx - .hir() - .get_generics(scope) + .hir_get_generics(scope) .and_then(|generics| generics.get_named(name)) { param.span diff --git a/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs b/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs index 617bc87a9d2..efe2386d014 100644 --- a/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs +++ b/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs @@ -128,8 +128,7 @@ fn sized_trait_bound_spans<'tcx>( } fn get_sized_bounds(tcx: TyCtxt<'_>, trait_def_id: DefId) -> SmallVec<[Span; 1]> { - tcx.hir() - .get_if_local(trait_def_id) + tcx.hir_get_if_local(trait_def_id) .and_then(|node| match node { hir::Node::Item(hir::Item { kind: hir::ItemKind::Trait(.., generics, bounds, _), @@ -187,7 +186,10 @@ fn predicates_reference_self( fn bounds_reference_self(tcx: TyCtxt<'_>, trait_def_id: DefId) -> SmallVec<[Span; 1]> { tcx.associated_items(trait_def_id) .in_definition_order() + // We're only looking at associated type bounds .filter(|item| item.kind == ty::AssocKind::Type) + // Ignore GATs with `Self: Sized` + .filter(|item| !tcx.generics_require_sized_self(item.def_id)) .flat_map(|item| tcx.explicit_item_bounds(item.def_id).iter_identity_copied()) .filter_map(|(clause, sp)| { // Item bounds *can* have self projections, since they never get @@ -301,7 +303,7 @@ pub fn dyn_compatibility_violations_for_assoc_item( ty::AssocKind::Fn => virtual_call_violations_for_method(tcx, trait_def_id, item) .into_iter() .map(|v| { - let node = tcx.hir().get_if_local(item.def_id); + let node = tcx.hir_get_if_local(item.def_id); // Get an accurate span depending on the violation. let span = match (&v, node) { (MethodViolationCode::ReferencesSelfInput(Some(span)), _) => *span, @@ -346,7 +348,7 @@ fn virtual_call_violations_for_method<'tcx>( generics, kind: hir::TraitItemKind::Fn(sig, _), .. - })) = tcx.hir().get_if_local(method.def_id).as_ref() + })) = tcx.hir_get_if_local(method.def_id).as_ref() { let sm = tcx.sess.source_map(); Some(( @@ -380,7 +382,7 @@ fn virtual_call_violations_for_method<'tcx>( let span = if let Some(hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(sig, _), .. - })) = tcx.hir().get_if_local(method.def_id).as_ref() + })) = tcx.hir_get_if_local(method.def_id).as_ref() { Some(sig.decl.inputs[i].span) } else { @@ -418,7 +420,7 @@ fn virtual_call_violations_for_method<'tcx>( let span = if let Some(hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(sig, _), .. - })) = tcx.hir().get_if_local(method.def_id).as_ref() + })) = tcx.hir_get_if_local(method.def_id).as_ref() { Some(sig.decl.inputs[0].span) } else { diff --git a/compiler/rustc_trait_selection/src/traits/misc.rs b/compiler/rustc_trait_selection/src/traits/misc.rs index 79e178150de..a4b6f330b9d 100644 --- a/compiler/rustc_trait_selection/src/traits/misc.rs +++ b/compiler/rustc_trait_selection/src/traits/misc.rs @@ -208,7 +208,7 @@ pub fn all_fields_implement_trait<'tcx>( } let field_span = tcx.def_span(field.did); - let field_ty_span = match tcx.hir().get_if_local(field.did) { + let field_ty_span = match tcx.hir_get_if_local(field.did) { Some(hir::Node::Field(field_def)) => field_def.ty.span, _ => field_span, }; diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 2f72b44f6b6..7f3e3ce4781 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -289,7 +289,7 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>( && let Some(impl_item) = items.iter().find(|item| item.id.owner_id.to_def_id() == impl_item_id) { - Some(tcx.hir().impl_item(impl_item.id).expect_type().span) + Some(tcx.hir_impl_item(impl_item.id).expect_type().span) } else { None } diff --git a/compiler/rustc_ty_utils/Cargo.toml b/compiler/rustc_ty_utils/Cargo.toml index 40356e0c978..f88f8c38d50 100644 --- a/compiler/rustc_ty_utils/Cargo.toml +++ b/compiler/rustc_ty_utils/Cargo.toml @@ -11,6 +11,7 @@ rustc_ast_ir = { path = "../rustc_ast_ir" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } +rustc_hashes = { path = "../rustc_hashes" } rustc_hir = { path = "../rustc_hir" } rustc_index = { path = "../rustc_index" } rustc_infer = { path = "../rustc_infer" } diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index ee271048fc1..8429e68b600 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -9,6 +9,7 @@ use rustc_abi::{ HasDataLayout, Layout, LayoutCalculatorError, LayoutData, Niche, ReprOptions, Scalar, Size, StructKind, TagEncoding, VariantIdx, Variants, WrappingRange, }; +use rustc_hashes::Hash64; use rustc_index::bit_set::DenseBitSet; use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::bug; @@ -380,7 +381,7 @@ fn layout_of_uncached<'tcx>( size, max_repr_align: None, unadjusted_abi_align: element.align.abi, - randomization_seed: element.randomization_seed.wrapping_add(count), + randomization_seed: element.randomization_seed.wrapping_add(Hash64::new(count)), }) } ty::Slice(element) => { @@ -395,7 +396,9 @@ fn layout_of_uncached<'tcx>( max_repr_align: None, unadjusted_abi_align: element.align.abi, // adding a randomly chosen value to distinguish slices - randomization_seed: element.randomization_seed.wrapping_add(0x2dcba99c39784102), + randomization_seed: element + .randomization_seed + .wrapping_add(Hash64::new(0x2dcba99c39784102)), }) } ty::Str => tcx.mk_layout(LayoutData { @@ -408,7 +411,7 @@ fn layout_of_uncached<'tcx>( max_repr_align: None, unadjusted_abi_align: dl.i8_align.abi, // another random value - randomization_seed: 0xc1325f37d127be22, + randomization_seed: Hash64::new(0xc1325f37d127be22), }), // Odd unit types. @@ -585,7 +588,7 @@ fn layout_of_uncached<'tcx>( align, max_repr_align: None, unadjusted_abi_align: align.abi, - randomization_seed: e_ly.randomization_seed.wrapping_add(e_len), + randomization_seed: e_ly.randomization_seed.wrapping_add(Hash64::new(e_len)), }) } @@ -1051,7 +1054,7 @@ fn coroutine_layout<'tcx>( }; // this is similar to how ReprOptions populates its field_shuffle_seed - let def_hash = tcx.def_path_hash(def_id).0.to_smaller_hash().as_u64(); + let def_hash = tcx.def_path_hash(def_id).0.to_smaller_hash(); let layout = tcx.mk_layout(LayoutData { variants: Variants::Multiple { diff --git a/compiler/rustc_ty_utils/src/opaque_types.rs b/compiler/rustc_ty_utils/src/opaque_types.rs index 34f461aac58..32d9469c296 100644 --- a/compiler/rustc_ty_utils/src/opaque_types.rs +++ b/compiler/rustc_ty_utils/src/opaque_types.rs @@ -125,7 +125,7 @@ impl<'tcx> OpaqueTypeCollector<'tcx> { #[instrument(level = "trace", skip(self))] // Recurse into these, as they are type checked with their parent fn visit_nested_body(&mut self, id: rustc_hir::BodyId) { - let body = self.collector.tcx.hir().body(id); + let body = self.collector.tcx.hir_body(id); self.visit_body(body); } } diff --git a/compiler/rustc_type_ir/src/ty_kind.rs b/compiler/rustc_type_ir/src/ty_kind.rs index 52e4fa19cb0..83631f7fe34 100644 --- a/compiler/rustc_type_ir/src/ty_kind.rs +++ b/compiler/rustc_type_ir/src/ty_kind.rs @@ -14,6 +14,7 @@ use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Gen use self::TyKind::*; pub use self::closure::*; use crate::inherent::*; +#[cfg(feature = "nightly")] use crate::visit::TypeVisitable; use crate::{self as ty, DebruijnIndex, Interner}; diff --git a/library/Cargo.lock b/library/Cargo.lock index 930db2ecd57..0be2f9a1549 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -216,6 +216,15 @@ dependencies = [ ] [[package]] +name = "proc-macro2" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +dependencies = [ + "unicode-ident", +] + +[[package]] name = "proc_macro" version = "0.0.0" dependencies = [ @@ -231,6 +240,15 @@ dependencies = [ ] [[package]] +name = "quote" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +dependencies = [ + "proc-macro2", +] + +[[package]] name = "r-efi" version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -253,24 +271,28 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.5" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_core", + "zerocopy", ] [[package]] name = "rand_core" -version = "0.6.4" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff" +dependencies = [ + "zerocopy", +] [[package]] name = "rand_xorshift" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" dependencies = [ "rand_core", ] @@ -353,6 +375,17 @@ dependencies = [ ] [[package]] +name = "syn" +version = "2.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] name = "sysroot" version = "0.0.0" dependencies = [ @@ -373,6 +406,12 @@ dependencies = [ ] [[package]] +name = "unicode-ident" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" + +[[package]] name = "unicode-width" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -492,3 +531,23 @@ name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zerocopy" +version = "0.8.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa91407dacce3a68c56de03abe2760159582b846c6a4acd2f456618087f12713" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06718a168365cad3d5ff0bb133aad346959a2074bd4a85c121255a11304a8626" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml index 6b0b5761391..c1d7f324f17 100644 --- a/library/alloc/Cargo.toml +++ b/library/alloc/Cargo.toml @@ -13,8 +13,8 @@ core = { path = "../core" } compiler_builtins = { version = "=0.1.146", features = ['rustc-dep-of-std'] } [dev-dependencies] -rand = { version = "0.8.5", default-features = false, features = ["alloc"] } -rand_xorshift = "0.3.0" +rand = { version = "0.9.0", default-features = false, features = ["alloc"] } +rand_xorshift = "0.4.0" [[test]] name = "alloctests" diff --git a/library/alloc/benches/btree/map.rs b/library/alloc/benches/btree/map.rs index 5b15aaeddbc..20f02dc3a96 100644 --- a/library/alloc/benches/btree/map.rs +++ b/library/alloc/benches/btree/map.rs @@ -9,19 +9,19 @@ macro_rules! map_insert_rand_bench { ($name: ident, $n: expr, $map: ident) => { #[bench] pub fn $name(b: &mut Bencher) { - let n: usize = $n; + let n: u32 = $n; let mut map = $map::new(); // setup let mut rng = crate::bench_rng(); for _ in 0..n { - let i = rng.gen::<usize>() % n; + let i = rng.random::<u32>() % n; map.insert(i, i); } // measure b.iter(|| { - let k = rng.gen::<usize>() % n; + let k = rng.random::<u32>() % n; map.insert(k, k); map.remove(&k); }); @@ -57,13 +57,13 @@ macro_rules! map_from_iter_rand_bench { ($name: ident, $n: expr, $map: ident) => { #[bench] pub fn $name(b: &mut Bencher) { - let n: usize = $n; + let n: u32 = $n; // setup let mut rng = crate::bench_rng(); - let mut vec = Vec::with_capacity(n); + let mut vec = Vec::with_capacity(n as usize); for _ in 0..n { - let i = rng.gen::<usize>() % n; + let i = rng.random::<u32>() % n; vec.push((i, i)); } @@ -102,11 +102,11 @@ macro_rules! map_find_rand_bench { #[bench] pub fn $name(b: &mut Bencher) { let mut map = $map::new(); - let n: usize = $n; + let n: u32 = $n; // setup let mut rng = crate::bench_rng(); - let mut keys: Vec<_> = (0..n).map(|_| rng.gen::<usize>() % n).collect(); + let mut keys: Vec<_> = (0..n).map(|_| rng.random::<u32>() % n).collect(); for &k in &keys { map.insert(k, k); @@ -115,9 +115,9 @@ macro_rules! map_find_rand_bench { keys.shuffle(&mut rng); // measure - let mut i = 0; + let mut i = 0u32; b.iter(|| { - let t = map.get(&keys[i]); + let t = map.get(&keys[i as usize]); i = (i + 1) % n; black_box(t); }) @@ -171,7 +171,7 @@ fn bench_iteration(b: &mut Bencher, size: i32) { let mut rng = crate::bench_rng(); for _ in 0..size { - map.insert(rng.gen(), rng.gen()); + map.insert(rng.random(), rng.random()); } b.iter(|| { @@ -201,7 +201,7 @@ fn bench_iteration_mut(b: &mut Bencher, size: i32) { let mut rng = crate::bench_rng(); for _ in 0..size { - map.insert(rng.gen(), rng.gen()); + map.insert(rng.random(), rng.random()); } b.iter(|| { diff --git a/library/alloc/benches/btree/set.rs b/library/alloc/benches/btree/set.rs index 09d72c72064..5aa395b4d52 100644 --- a/library/alloc/benches/btree/set.rs +++ b/library/alloc/benches/btree/set.rs @@ -3,13 +3,13 @@ use std::collections::BTreeSet; use rand::Rng; use test::Bencher; -fn random(n: usize) -> BTreeSet<usize> { +fn random(n: u32) -> BTreeSet<u32> { let mut rng = crate::bench_rng(); let mut set = BTreeSet::new(); - while set.len() < n { - set.insert(rng.gen()); + while set.len() < n as usize { + set.insert(rng.random()); } - assert_eq!(set.len(), n); + assert_eq!(set.len(), n as usize); set } diff --git a/library/alloc/benches/slice.rs b/library/alloc/benches/slice.rs index c45c3722712..c6b46e6a2a1 100644 --- a/library/alloc/benches/slice.rs +++ b/library/alloc/benches/slice.rs @@ -1,7 +1,7 @@ use std::{mem, ptr}; use rand::Rng; -use rand::distributions::{Alphanumeric, DistString, Standard}; +use rand::distr::{Alphanumeric, SampleString, StandardUniform}; use test::{Bencher, black_box}; #[bench] @@ -156,7 +156,7 @@ fn random_inserts(b: &mut Bencher) { let mut v = vec![(0, 0); 30]; for _ in 0..100 { let l = v.len(); - v.insert(rng.gen::<usize>() % (l + 1), (1, 1)); + v.insert(rng.random::<u32>() as usize % (l + 1), (1, 1)); } }) } @@ -168,7 +168,7 @@ fn random_removes(b: &mut Bencher) { let mut v = vec![(0, 0); 130]; for _ in 0..100 { let l = v.len(); - v.remove(rng.gen::<usize>() % l); + v.remove(rng.random::<u32>() as usize % l); } }) } @@ -183,20 +183,20 @@ fn gen_descending(len: usize) -> Vec<u64> { fn gen_random(len: usize) -> Vec<u64> { let mut rng = crate::bench_rng(); - (&mut rng).sample_iter(&Standard).take(len).collect() + (&mut rng).sample_iter(&StandardUniform).take(len).collect() } fn gen_random_bytes(len: usize) -> Vec<u8> { let mut rng = crate::bench_rng(); - (&mut rng).sample_iter(&Standard).take(len).collect() + (&mut rng).sample_iter(&StandardUniform).take(len).collect() } fn gen_mostly_ascending(len: usize) -> Vec<u64> { let mut rng = crate::bench_rng(); let mut v = gen_ascending(len); for _ in (0usize..).take_while(|x| x * x <= len) { - let x = rng.gen::<usize>() % len; - let y = rng.gen::<usize>() % len; + let x = rng.random::<u32>() as usize % len; + let y = rng.random::<u32>() as usize % len; v.swap(x, y); } v @@ -206,8 +206,8 @@ fn gen_mostly_descending(len: usize) -> Vec<u64> { let mut rng = crate::bench_rng(); let mut v = gen_descending(len); for _ in (0usize..).take_while(|x| x * x <= len) { - let x = rng.gen::<usize>() % len; - let y = rng.gen::<usize>() % len; + let x = rng.random::<u32>() as usize % len; + let y = rng.random::<u32>() as usize % len; v.swap(x, y); } v @@ -217,15 +217,15 @@ fn gen_strings(len: usize) -> Vec<String> { let mut rng = crate::bench_rng(); let mut v = vec![]; for _ in 0..len { - let n = rng.gen::<usize>() % 20 + 1; - v.push(Alphanumeric.sample_string(&mut rng, n)); + let n = rng.random::<u32>() % 20 + 1; + v.push(Alphanumeric.sample_string(&mut rng, n as usize)); } v } fn gen_big_random(len: usize) -> Vec<[u64; 16]> { let mut rng = crate::bench_rng(); - (&mut rng).sample_iter(&Standard).map(|x| [x; 16]).take(len).collect() + (&mut rng).sample_iter(&StandardUniform).map(|x| [x; 16]).take(len).collect() } macro_rules! sort { diff --git a/library/alloc/src/borrow.rs b/library/alloc/src/borrow.rs index dbfd2e74abe..17dad3277b9 100644 --- a/library/alloc/src/borrow.rs +++ b/library/alloc/src/borrow.rs @@ -340,8 +340,18 @@ where } } +// `Cow<'_, T>` can only implement `DerefPure` if `<T::Owned as Borrow<T>>` (and `BorrowMut<T>`) is trusted. +// For now, we restrict `DerefPure for Cow<T>` to `T: Sized` (`T as Borrow<T>` is trusted), +// `str` (`String as Borrow<str>` is trusted) and `[T]` (`Vec<T> as Borrow<[T]>` is trusted). +// In the future, a `BorrowPure<T>` trait analogous to `DerefPure` might generalize this. #[unstable(feature = "deref_pure_trait", issue = "87121")] -unsafe impl<B: ?Sized + ToOwned> DerefPure for Cow<'_, B> where B::Owned: Borrow<B> {} +unsafe impl<T: Clone> DerefPure for Cow<'_, T> {} +#[cfg(not(no_global_oom_handling))] +#[unstable(feature = "deref_pure_trait", issue = "87121")] +unsafe impl DerefPure for Cow<'_, str> {} +#[cfg(not(no_global_oom_handling))] +#[unstable(feature = "deref_pure_trait", issue = "87121")] +unsafe impl<T: Clone> DerefPure for Cow<'_, [T]> {} #[stable(feature = "rust1", since = "1.0.0")] impl<B: ?Sized> Eq for Cow<'_, B> where B: Eq + ToOwned {} diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index 8b38e6fc259..4b124b5a3b3 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -24,7 +24,7 @@ //! Creating a recursive data structure: //! //! ``` -//! ##[allow(dead_code)] +//! # #[allow(dead_code)] //! #[derive(Debug)] //! enum List<T> { //! Cons(T, Box<List<T>>), @@ -97,12 +97,12 @@ //! #[repr(C)] //! pub struct Foo; //! -//! #[no_mangle] +//! #[unsafe(no_mangle)] //! pub extern "C" fn foo_new() -> Box<Foo> { //! Box::new(Foo) //! } //! -//! #[no_mangle] +//! #[unsafe(no_mangle)] //! pub extern "C" fn foo_delete(_: Option<Box<Foo>>) {} //! ``` //! @@ -280,13 +280,9 @@ impl<T> Box<T> { /// /// ``` /// let mut five = Box::<u32>::new_uninit(); - /// - /// let five = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5) /// ``` @@ -367,13 +363,9 @@ impl<T> Box<T> { /// #![feature(allocator_api)] /// /// let mut five = Box::<u32>::try_new_uninit()?; - /// - /// let five = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) @@ -435,10 +427,8 @@ impl<T, A: Allocator> Box<T, A> { A: Allocator, { let mut boxed = Self::new_uninit_in(alloc); - unsafe { - boxed.as_mut_ptr().write(x); - boxed.assume_init() - } + boxed.write(x); + unsafe { boxed.assume_init() } } /// Allocates memory in the given allocator then places `x` into it, @@ -463,10 +453,8 @@ impl<T, A: Allocator> Box<T, A> { A: Allocator, { let mut boxed = Self::try_new_uninit_in(alloc)?; - unsafe { - boxed.as_mut_ptr().write(x); - Ok(boxed.assume_init()) - } + boxed.write(x); + unsafe { Ok(boxed.assume_init()) } } /// Constructs a new box with uninitialized contents in the provided allocator. @@ -479,13 +467,9 @@ impl<T, A: Allocator> Box<T, A> { /// use std::alloc::System; /// /// let mut five = Box::<u32, _>::new_uninit_in(System); - /// - /// let five = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5) /// ``` @@ -517,13 +501,9 @@ impl<T, A: Allocator> Box<T, A> { /// use std::alloc::System; /// /// let mut five = Box::<u32, _>::try_new_uninit_in(System)?; - /// - /// let five = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) @@ -669,15 +649,11 @@ impl<T> Box<[T]> { /// /// ``` /// let mut values = Box::<[u32]>::new_uninit_slice(3); - /// - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe {values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]) /// ``` @@ -722,13 +698,11 @@ impl<T> Box<[T]> { /// #![feature(allocator_api)] /// /// let mut values = Box::<[u32]>::try_new_uninit_slice(3)?; - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe { values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]); /// # Ok::<(), std::alloc::AllocError>(()) @@ -814,15 +788,11 @@ impl<T, A: Allocator> Box<[T], A> { /// use std::alloc::System; /// /// let mut values = Box::<[u32], _>::new_uninit_slice_in(3, System); - /// - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe { values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]) /// ``` @@ -873,13 +843,11 @@ impl<T, A: Allocator> Box<[T], A> { /// use std::alloc::System; /// /// let mut values = Box::<[u32], _>::try_new_uninit_slice_in(3, System)?; - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe { values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]); /// # Ok::<(), std::alloc::AllocError>(()) @@ -959,13 +927,9 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> { /// /// ``` /// let mut five = Box::<u32>::new_uninit(); - /// - /// let five: Box<u32> = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five: Box<u32> = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5) /// ``` @@ -1030,15 +994,11 @@ impl<T, A: Allocator> Box<[mem::MaybeUninit<T>], A> { /// /// ``` /// let mut values = Box::<[u32]>::new_uninit_slice(3); - /// - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe { values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]) /// ``` @@ -1093,7 +1053,6 @@ impl<T: ?Sized> Box<T> { /// ``` /// /// [memory layout]: self#memory-layout - /// [`Layout`]: crate::Layout #[stable(feature = "box_raw", since = "1.4.0")] #[inline] #[must_use = "call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`"] @@ -1148,7 +1107,6 @@ impl<T: ?Sized> Box<T> { /// ``` /// /// [memory layout]: self#memory-layout - /// [`Layout`]: crate::Layout #[unstable(feature = "box_vec_non_null", reason = "new API", issue = "130364")] #[inline] #[must_use = "call `drop(Box::from_non_null(ptr))` if you intend to drop the `Box`"] @@ -1205,7 +1163,6 @@ impl<T: ?Sized, A: Allocator> Box<T, A> { /// ``` /// /// [memory layout]: self#memory-layout - /// [`Layout`]: crate::Layout #[unstable(feature = "allocator_api", issue = "32838")] #[rustc_const_unstable(feature = "const_box", issue = "92521")] #[inline] @@ -1259,7 +1216,6 @@ impl<T: ?Sized, A: Allocator> Box<T, A> { /// ``` /// /// [memory layout]: self#memory-layout - /// [`Layout`]: crate::Layout #[unstable(feature = "allocator_api", issue = "32838")] // #[unstable(feature = "box_vec_non_null", reason = "new API", issue = "130364")] #[rustc_const_unstable(feature = "const_box", issue = "92521")] diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index b29f740ef0f..154da691078 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -2442,6 +2442,32 @@ impl<'a> Extend<Cow<'a, str>> for String { } } +#[cfg(not(no_global_oom_handling))] +#[unstable(feature = "ascii_char", issue = "110998")] +impl Extend<core::ascii::Char> for String { + fn extend<I: IntoIterator<Item = core::ascii::Char>>(&mut self, iter: I) { + self.vec.extend(iter.into_iter().map(|c| c.to_u8())); + } + + #[inline] + fn extend_one(&mut self, c: core::ascii::Char) { + self.vec.push(c.to_u8()); + } +} + +#[cfg(not(no_global_oom_handling))] +#[unstable(feature = "ascii_char", issue = "110998")] +impl<'a> Extend<&'a core::ascii::Char> for String { + fn extend<I: IntoIterator<Item = &'a core::ascii::Char>>(&mut self, iter: I) { + self.extend(iter.into_iter().cloned()); + } + + #[inline] + fn extend_one(&mut self, c: &'a core::ascii::Char) { + self.vec.push(c.to_u8()); + } +} + /// A convenience impl that delegates to the impl for `&str`. /// /// # Examples diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 55cd0569538..7d02a15ed7a 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1837,7 +1837,7 @@ impl<T, A: Allocator> Vec<T, A> { /// # // don't use this as a starting point for a real library. /// # pub struct StreamWrapper { strm: *mut std::ffi::c_void } /// # const Z_OK: i32 = 0; - /// # extern "C" { + /// # unsafe extern "C" { /// # fn deflateGetDictionary( /// # strm: *mut std::ffi::c_void, /// # dictionary: *mut u8, diff --git a/library/alloc/tests/sort/patterns.rs b/library/alloc/tests/sort/patterns.rs index e5d31d868b2..0f1ec664d3d 100644 --- a/library/alloc/tests/sort/patterns.rs +++ b/library/alloc/tests/sort/patterns.rs @@ -1,8 +1,8 @@ use std::env; -use std::hash::Hash; use std::str::FromStr; use std::sync::OnceLock; +use rand::distr::Uniform; use rand::prelude::*; use rand_xorshift::XorShiftRng; @@ -23,14 +23,14 @@ pub fn random(len: usize) -> Vec<i32> { pub fn random_uniform<R>(len: usize, range: R) -> Vec<i32> where - R: Into<rand::distributions::Uniform<i32>> + Hash, + Uniform<i32>: TryFrom<R, Error: std::fmt::Debug>, { // :.:.:.:: let mut rng: XorShiftRng = rand::SeedableRng::seed_from_u64(get_or_init_rand_seed()); // Abstracting over ranges in Rust :( - let dist: rand::distributions::Uniform<i32> = range.into(); + let dist = Uniform::try_from(range).unwrap(); (0..len).map(|_| dist.sample(&mut rng)).collect() } @@ -207,5 +207,5 @@ fn rand_root_seed() -> u64 { fn random_vec(len: usize) -> Vec<i32> { let mut rng: XorShiftRng = rand::SeedableRng::seed_from_u64(get_or_init_rand_seed()); - (0..len).map(|_| rng.gen::<i32>()).collect() + (0..len).map(|_| rng.random::<i32>()).collect() } diff --git a/library/alloc/tests/sort/zipf.rs b/library/alloc/tests/sort/zipf.rs index cc774ee5c43..3dad2db521f 100644 --- a/library/alloc/tests/sort/zipf.rs +++ b/library/alloc/tests/sort/zipf.rs @@ -80,7 +80,7 @@ impl ZipfDistribution { loop { use std::cmp; - let u: f64 = hnum + rng.gen::<f64>() * (self.h_integral_x1 - hnum); + let u: f64 = hnum + rng.random::<f64>() * (self.h_integral_x1 - hnum); // u is uniformly distributed in (h_integral_x1, h_integral_num_elements] let x: f64 = ZipfDistribution::h_integral_inv(u, self.exponent); @@ -145,7 +145,7 @@ impl ZipfDistribution { } } -impl rand::distributions::Distribution<usize> for ZipfDistribution { +impl rand::distr::Distribution<usize> for ZipfDistribution { fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> usize { self.next(rng) } diff --git a/library/core/src/alloc/global.rs b/library/core/src/alloc/global.rs index 8f48af24557..5bf6f143b4f 100644 --- a/library/core/src/alloc/global.rs +++ b/library/core/src/alloc/global.rs @@ -70,7 +70,7 @@ use crate::{cmp, ptr}; /// { /// return null_mut(); /// }; -/// self.arena.get().cast::<u8>().add(allocated) +/// unsafe { self.arena.get().cast::<u8>().add(allocated) } /// } /// unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {} /// } diff --git a/library/core/src/error.rs b/library/core/src/error.rs index 33cf2af30b9..69ad7239954 100644 --- a/library/core/src/error.rs +++ b/library/core/src/error.rs @@ -22,6 +22,30 @@ use crate::fmt::{self, Debug, Display, Formatter}; /// accessing that error via [`Error::source()`]. This makes it possible for the /// high-level module to provide its own errors while also revealing some of the /// implementation for debugging. +/// +/// # Example +/// +/// Implementing the `Error` trait only requires that `Debug` and `Display` are implemented too. +/// +/// ``` +/// use std::error::Error; +/// use std::fmt; +/// use std::path::PathBuf; +/// +/// #[derive(Debug)] +/// struct ReadConfigError { +/// path: PathBuf +/// } +/// +/// impl fmt::Display for ReadConfigError { +/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +/// let path = self.path.display(); +/// write!(f, "unable to read configuration at {path}") +/// } +/// } +/// +/// impl Error for ReadConfigError {} +/// ``` #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "Error")] #[rustc_has_incoherent_inherent_impls] diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index 520b9941ae4..76afb3b8e20 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -52,7 +52,7 @@ use crate::{intrinsics, ub_checks}; /// // Safety: `divisor` can't be zero because of `prepare_inputs`, /// // but the compiler does not know about this. We *promise* /// // that we always call `prepare_inputs`. -/// std::hint::unreachable_unchecked() +/// unsafe { std::hint::unreachable_unchecked() } /// } /// // The compiler would normally introduce a check here that prevents /// // a division by zero. However, if `divisor` was zero, the branch diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index 6c9c6d0edc2..99c42f3626e 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -1703,12 +1703,12 @@ pub const fn forget<T: ?Sized>(_: T) { /// ``` /// struct R<'a>(&'a i32); /// unsafe fn extend_lifetime<'b>(r: R<'b>) -> R<'static> { -/// std::mem::transmute::<R<'b>, R<'static>>(r) +/// unsafe { std::mem::transmute::<R<'b>, R<'static>>(r) } /// } /// /// unsafe fn shorten_invariant_lifetime<'b, 'c>(r: &'b mut R<'static>) /// -> &'b mut R<'c> { -/// std::mem::transmute::<&'b mut R<'static>, &'b mut R<'c>>(r) +/// unsafe { std::mem::transmute::<&'b mut R<'static>, &'b mut R<'c>>(r) } /// } /// ``` /// @@ -4498,11 +4498,11 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us /// /// // SAFETY: Our precondition ensures the source is aligned and valid, /// // and `Vec::with_capacity` ensures that we have usable space to write them. -/// ptr::copy(ptr, dst.as_mut_ptr(), elts); +/// unsafe { ptr::copy(ptr, dst.as_mut_ptr(), elts); } /// /// // SAFETY: We created it with this much capacity earlier, /// // and the previous `copy` has initialized these elements. -/// dst.set_len(elts); +/// unsafe { dst.set_len(elts); } /// dst /// } /// ``` diff --git a/library/core/src/iter/mod.rs b/library/core/src/iter/mod.rs index 635e14e769a..d62a445d704 100644 --- a/library/core/src/iter/mod.rs +++ b/library/core/src/iter/mod.rs @@ -420,14 +420,14 @@ pub use self::adapters::{Intersperse, IntersperseWith}; issue = "42168" )] pub use self::range::Step; +#[stable(feature = "iter_empty", since = "1.2.0")] +pub use self::sources::{Empty, empty}; #[unstable( feature = "iter_from_coroutine", issue = "43122", reason = "coroutines are unstable" )] -pub use self::sources::from_coroutine; -#[stable(feature = "iter_empty", since = "1.2.0")] -pub use self::sources::{Empty, empty}; +pub use self::sources::{FromCoroutine, from_coroutine}; #[stable(feature = "iter_from_fn", since = "1.34.0")] pub use self::sources::{FromFn, from_fn}; #[stable(feature = "iter_once", since = "1.2.0")] diff --git a/library/core/src/iter/sources.rs b/library/core/src/iter/sources.rs index c635992dfbd..1eb4367b183 100644 --- a/library/core/src/iter/sources.rs +++ b/library/core/src/iter/sources.rs @@ -15,7 +15,7 @@ pub use self::empty::{Empty, empty}; issue = "43122", reason = "coroutines are unstable" )] -pub use self::from_coroutine::from_coroutine; +pub use self::from_coroutine::{FromCoroutine, from_coroutine}; #[stable(feature = "iter_from_fn", since = "1.34.0")] pub use self::from_fn::{FromFn, from_fn}; #[stable(feature = "iter_once", since = "1.2.0")] diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index 0d8c3ef906b..edc39f8f28c 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -98,7 +98,7 @@ use crate::{fmt, intrinsics, ptr, slice}; /// /// unsafe fn make_vec(out: *mut Vec<i32>) { /// // `write` does not drop the old contents, which is important. -/// out.write(vec![1, 2, 3]); +/// unsafe { out.write(vec![1, 2, 3]); } /// } /// /// let mut v = MaybeUninit::uninit(); @@ -345,7 +345,7 @@ impl<T> MaybeUninit<T> { /// /// use std::mem::MaybeUninit; /// - /// extern "C" { + /// unsafe extern "C" { /// fn read_into_buffer(ptr: *mut u8, max_len: usize) -> usize; /// } /// @@ -844,7 +844,7 @@ impl<T> MaybeUninit<T> { /// # #![allow(unexpected_cfgs)] /// use std::mem::MaybeUninit; /// - /// # unsafe extern "C" fn initialize_buffer(buf: *mut [u8; 1024]) { *buf = [0; 1024] } + /// # unsafe extern "C" fn initialize_buffer(buf: *mut [u8; 1024]) { unsafe { *buf = [0; 1024] } } /// # #[cfg(FALSE)] /// extern "C" { /// /// Initializes *all* the bytes of the input buffer. diff --git a/library/core/src/mem/transmutability.rs b/library/core/src/mem/transmutability.rs index 6a4f84c849c..7b920d7a777 100644 --- a/library/core/src/mem/transmutability.rs +++ b/library/core/src/mem/transmutability.rs @@ -32,7 +32,7 @@ use crate::marker::{ConstParamTy_, UnsizedConstParamTy}; /// src: ManuallyDrop::new(src), /// }; /// -/// let dst = transmute.dst; +/// let dst = unsafe { transmute.dst }; /// /// ManuallyDrop::into_inner(dst) /// } diff --git a/library/core/src/num/niche_types.rs b/library/core/src/num/niche_types.rs index 096713c318f..47ff4254e53 100644 --- a/library/core/src/num/niche_types.rs +++ b/library/core/src/num/niche_types.rs @@ -32,6 +32,16 @@ macro_rules! define_valid_range_type { }; impl $name { + #[inline] + pub const fn new(val: $int) -> Option<Self> { + if (val as $uint) >= ($low as $uint) && (val as $uint) <= ($high as $uint) { + // SAFETY: just checked the inclusive range + Some(unsafe { $name(val) }) + } else { + None + } + } + /// Constructs an instance of this type from the underlying integer /// primitive without checking whether its zero. /// diff --git a/library/core/src/prelude/mod.rs b/library/core/src/prelude/mod.rs index 0ab97f5bbd5..590ffd64b5b 100644 --- a/library/core/src/prelude/mod.rs +++ b/library/core/src/prelude/mod.rs @@ -9,16 +9,7 @@ #![stable(feature = "core_prelude", since = "1.4.0")] -mod common; - -/// The first version of the prelude of The Rust Standard Library. -/// -/// See the [module-level documentation](self) for more. -#[stable(feature = "rust1", since = "1.0.0")] -pub mod v1 { - #[stable(feature = "rust1", since = "1.0.0")] - pub use super::common::*; -} +pub mod v1; /// The 2015 version of the core prelude. /// @@ -64,7 +55,8 @@ pub mod rust_2021 { #[stable(feature = "prelude_2024", since = "1.85.0")] pub mod rust_2024 { #[stable(feature = "rust1", since = "1.0.0")] - pub use super::common::*; + #[doc(no_inline)] + pub use super::v1::*; #[stable(feature = "prelude_2021", since = "1.55.0")] #[doc(no_inline)] diff --git a/library/core/src/prelude/common.rs b/library/core/src/prelude/v1.rs index 8b116cecb52..50fd67e8395 100644 --- a/library/core/src/prelude/common.rs +++ b/library/core/src/prelude/v1.rs @@ -1,7 +1,9 @@ -//! Items common to the prelude of all editions. +//! The first version of the core prelude. //! //! See the [module-level documentation](super) for more. +#![stable(feature = "core_prelude", since = "1.4.0")] + // No formatting: this file is nothing but re-exports, and their order is worth preserving. #![cfg_attr(rustfmt, rustfmt::skip)] diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index 0c6eaf60d04..974946a7818 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -724,13 +724,13 @@ impl<T: ?Sized> *const T { /// that their safety preconditions are met: /// ```rust /// # #![feature(ptr_sub_ptr)] - /// # unsafe fn blah(ptr: *const i32, origin: *const i32, count: usize) -> bool { + /// # unsafe fn blah(ptr: *const i32, origin: *const i32, count: usize) -> bool { unsafe { /// ptr.sub_ptr(origin) == count /// # && /// origin.add(count) == ptr /// # && /// ptr.sub(count) == origin - /// # } + /// # } } /// ``` /// /// # Safety diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index d1b0104c0fa..94ebd0d2522 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -896,13 +896,13 @@ impl<T: ?Sized> *mut T { /// that their safety preconditions are met: /// ```rust /// # #![feature(ptr_sub_ptr)] - /// # unsafe fn blah(ptr: *mut i32, origin: *mut i32, count: usize) -> bool { + /// # unsafe fn blah(ptr: *mut i32, origin: *mut i32, count: usize) -> bool { unsafe { /// ptr.sub_ptr(origin) == count /// # && /// origin.add(count) == ptr /// # && /// ptr.sub(count) == origin - /// # } + /// # } } /// ``` /// /// # Safety diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index d93069d384e..f4ac00062d7 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -857,13 +857,13 @@ impl<T: ?Sized> NonNull<T> { /// that their safety preconditions are met: /// ```rust /// # #![feature(ptr_sub_ptr)] - /// # unsafe fn blah(ptr: std::ptr::NonNull<u32>, origin: std::ptr::NonNull<u32>, count: usize) -> bool { + /// # unsafe fn blah(ptr: std::ptr::NonNull<u32>, origin: std::ptr::NonNull<u32>, count: usize) -> bool { unsafe { /// ptr.sub_ptr(origin) == count /// # && /// origin.add(count) == ptr /// # && /// ptr.sub(count) == origin - /// # } + /// # } } /// ``` /// /// # Safety diff --git a/library/core/src/slice/iter/macros.rs b/library/core/src/slice/iter/macros.rs index 830debe02ea..45e320e66bc 100644 --- a/library/core/src/slice/iter/macros.rs +++ b/library/core/src/slice/iter/macros.rs @@ -30,7 +30,7 @@ macro_rules! if_zst { $zst_body } else { // SAFETY: for non-ZSTs, the type invariant ensures it cannot be null - let $end = unsafe { *(&raw const $this.end_or_len).cast::<NonNull<T>>() }; + let $end = unsafe { mem::transmute::<*const T, NonNull<T>>($this.end_or_len) }; $other_body } }}; diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 5b258a7c844..fd2cd59f88e 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -238,6 +238,7 @@ impl str { /// assert_eq!("💖", sparkle_heart); /// ``` #[unstable(feature = "inherent_str_constructors", issue = "131114")] + #[rustc_diagnostic_item = "str_inherent_from_utf8"] pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> { converts::from_utf8(v) } @@ -274,6 +275,7 @@ impl str { /// errors that can be returned. #[unstable(feature = "inherent_str_constructors", issue = "131114")] #[rustc_const_unstable(feature = "const_str_from_utf8", issue = "91006")] + #[rustc_diagnostic_item = "str_inherent_from_utf8_mut"] pub const fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> { converts::from_utf8_mut(v) } @@ -306,6 +308,7 @@ impl str { #[inline] #[must_use] #[unstable(feature = "inherent_str_constructors", issue = "131114")] + #[rustc_diagnostic_item = "str_inherent_from_utf8_unchecked"] pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str { // SAFETY: converts::from_utf8_unchecked has the same safety requirements as this function. unsafe { converts::from_utf8_unchecked(v) } @@ -331,6 +334,7 @@ impl str { #[inline] #[must_use] #[unstable(feature = "inherent_str_constructors", issue = "131114")] + #[rustc_diagnostic_item = "str_inherent_from_utf8_unchecked_mut"] pub const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str { // SAFETY: converts::from_utf8_unchecked_mut has the same safety requirements as this function. unsafe { converts::from_utf8_unchecked_mut(v) } @@ -361,7 +365,7 @@ impl str { /// ``` #[must_use] #[stable(feature = "is_char_boundary", since = "1.9.0")] - #[rustc_const_unstable(feature = "const_is_char_boundary", issue = "131516")] + #[rustc_const_stable(feature = "const_is_char_boundary", since = "CURRENT_RUSTC_VERSION")] #[inline] pub const fn is_char_boundary(&self, index: usize) -> bool { // 0 is always ok. @@ -818,7 +822,7 @@ impl str { #[inline] #[must_use] #[stable(feature = "str_split_at", since = "1.4.0")] - #[rustc_const_unstable(feature = "const_str_split_at", issue = "131518")] + #[rustc_const_stable(feature = "const_str_split_at", since = "CURRENT_RUSTC_VERSION")] pub const fn split_at(&self, mid: usize) -> (&str, &str) { match self.split_at_checked(mid) { None => slice_error_fail(self, 0, mid), @@ -859,7 +863,7 @@ impl str { #[inline] #[must_use] #[stable(feature = "str_split_at", since = "1.4.0")] - #[rustc_const_unstable(feature = "const_str_split_at", issue = "131518")] + #[rustc_const_stable(feature = "const_str_split_at", since = "CURRENT_RUSTC_VERSION")] pub const fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str) { // is_char_boundary checks that the index is in [0, .len()] if self.is_char_boundary(mid) { @@ -899,7 +903,7 @@ impl str { #[inline] #[must_use] #[stable(feature = "split_at_checked", since = "1.80.0")] - #[rustc_const_unstable(feature = "const_str_split_at", issue = "131518")] + #[rustc_const_stable(feature = "const_str_split_at", since = "CURRENT_RUSTC_VERSION")] pub const fn split_at_checked(&self, mid: usize) -> Option<(&str, &str)> { // is_char_boundary checks that the index is in [0, .len()] if self.is_char_boundary(mid) { @@ -940,7 +944,7 @@ impl str { #[inline] #[must_use] #[stable(feature = "split_at_checked", since = "1.80.0")] - #[rustc_const_unstable(feature = "const_str_split_at", issue = "131518")] + #[rustc_const_stable(feature = "const_str_split_at", since = "CURRENT_RUSTC_VERSION")] pub const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut str, &mut str)> { // is_char_boundary checks that the index is in [0, .len()] if self.is_char_boundary(mid) { diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 4c51ca0a5e4..3f57b04753a 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -40,17 +40,14 @@ impl RawWaker { /// of the `vtable` as the first parameter. /// /// It is important to consider that the `data` pointer must point to a - /// thread safe type such as an `[Arc]<T: Send + Sync>` + /// thread safe type such as an `Arc<T: Send + Sync>` /// when used to construct a [`Waker`]. This restriction is lifted when /// constructing a [`LocalWaker`], which allows using types that do not implement - /// <code>[Send] + [Sync]</code> like `[Rc]<T>`. + /// <code>[Send] + [Sync]</code> like `Rc<T>`. /// /// The `vtable` customizes the behavior of a `Waker` which gets created /// from a `RawWaker`. For each operation on the `Waker`, the associated /// function in the `vtable` of the underlying `RawWaker` will be called. - /// - /// [`Arc`]: std::sync::Arc - /// [`Rc`]: std::rc::Rc #[inline] #[rustc_promotable] #[stable(feature = "futures_api", since = "1.36.0")] diff --git a/library/coretests/Cargo.toml b/library/coretests/Cargo.toml index ec940abea11..e44f01d347b 100644 --- a/library/coretests/Cargo.toml +++ b/library/coretests/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/rust-lang/rust.git" description = "Tests for the Rust Core Library" autotests = false autobenches = false -edition = "2021" +edition = "2024" [lib] path = "lib.rs" @@ -23,5 +23,5 @@ path = "benches/lib.rs" test = true [dev-dependencies] -rand = { version = "0.8.5", default-features = false } -rand_xorshift = { version = "0.3.0", default-features = false } +rand = { version = "0.9.0", default-features = false } +rand_xorshift = { version = "0.4.0", default-features = false } diff --git a/library/coretests/benches/num/int_log/mod.rs b/library/coretests/benches/num/int_log/mod.rs index e5874ddf03b..171d7e31cdb 100644 --- a/library/coretests/benches/num/int_log/mod.rs +++ b/library/coretests/benches/num/int_log/mod.rs @@ -21,7 +21,7 @@ macro_rules! int_log10_bench { /* Exponentially distributed random numbers from the whole range of the type. */ let numbers: Vec<$t> = (0..256) .map(|_| { - let x = rng.gen::<$t>() >> rng.gen_range(0..<$t>::BITS); + let x = rng.random::<$t>() >> rng.random_range(0..<$t>::BITS); if x != 0 { x } else { 1 } }) .collect(); @@ -38,7 +38,7 @@ macro_rules! int_log10_bench { /* Exponentially distributed random numbers from the range 0..256. */ let numbers: Vec<$t> = (0..256) .map(|_| { - let x = (rng.gen::<u8>() >> rng.gen_range(0..u8::BITS)) as $t; + let x = (rng.random::<u8>() >> rng.random_range(0..u8::BITS)) as $t; if x != 0 { x } else { 1 } }) .collect(); @@ -65,7 +65,7 @@ macro_rules! int_log_bench { /* Exponentially distributed random numbers from the whole range of the type. */ let numbers: Vec<$t> = (0..256) .map(|_| { - let x = rng.gen::<$t>() >> rng.gen_range(0..<$t>::BITS); + let x = rng.random::<$t>() >> rng.random_range(0..<$t>::BITS); if x >= 2 { x } else { 2 } }) .collect(); @@ -84,7 +84,7 @@ macro_rules! int_log_bench { /* Exponentially distributed random numbers from the range 0..256. */ let numbers: Vec<$t> = (0..256) .map(|_| { - let x = (rng.gen::<u8>() >> rng.gen_range(0..u8::BITS)) as $t; + let x = (rng.random::<u8>() >> rng.random_range(0..u8::BITS)) as $t; if x >= 2 { x } else { 2 } }) .collect(); diff --git a/library/coretests/benches/num/int_pow/mod.rs b/library/coretests/benches/num/int_pow/mod.rs index 46f47028d56..6b603d2f7b3 100644 --- a/library/coretests/benches/num/int_pow/mod.rs +++ b/library/coretests/benches/num/int_pow/mod.rs @@ -15,9 +15,9 @@ macro_rules! pow_bench_template { // reference through black_box outside of the loop. let mut rng = crate::bench_rng(); let base_array: [IntType; ITERATIONS] = - core::array::from_fn(|_| rng.gen_range((-MAX_BASE..=MAX_BASE))); + core::array::from_fn(|_| rng.random_range((-MAX_BASE..=MAX_BASE))); let exp_array: [u32; ITERATIONS] = - core::array::from_fn(|_| rng.gen_range((0..=EXPONENT_MAX))); + core::array::from_fn(|_| rng.random_range((0..=EXPONENT_MAX))); bench.iter(|| { #[allow(unused, unused_mut)] diff --git a/library/coretests/benches/num/int_sqrt/mod.rs b/library/coretests/benches/num/int_sqrt/mod.rs index e47b92e866e..05cb3c5383b 100644 --- a/library/coretests/benches/num/int_sqrt/mod.rs +++ b/library/coretests/benches/num/int_sqrt/mod.rs @@ -20,7 +20,7 @@ macro_rules! int_sqrt_bench { let mut rng = crate::bench_rng(); /* Exponentially distributed random numbers from the whole range of the type. */ let numbers: Vec<$t> = - (0..256).map(|_| rng.gen::<$t>() >> rng.gen_range(0..<$t>::BITS)).collect(); + (0..256).map(|_| rng.random::<$t>() >> rng.random_range(0..<$t>::BITS)).collect(); bench.iter(|| { for x in &numbers { black_box(black_box(x).isqrt()); @@ -32,8 +32,9 @@ macro_rules! int_sqrt_bench { fn $random_small(bench: &mut Bencher) { let mut rng = crate::bench_rng(); /* Exponentially distributed random numbers from the range 0..256. */ - let numbers: Vec<$t> = - (0..256).map(|_| (rng.gen::<u8>() >> rng.gen_range(0..u8::BITS)) as $t).collect(); + let numbers: Vec<$t> = (0..256) + .map(|_| (rng.random::<u8>() >> rng.random_range(0..u8::BITS)) as $t) + .collect(); bench.iter(|| { for x in &numbers { black_box(black_box(x).isqrt()); @@ -45,7 +46,7 @@ macro_rules! int_sqrt_bench { fn $random_uniform(bench: &mut Bencher) { let mut rng = crate::bench_rng(); /* Exponentially distributed random numbers from the whole range of the type. */ - let numbers: Vec<$t> = (0..256).map(|_| rng.gen::<$t>()).collect(); + let numbers: Vec<$t> = (0..256).map(|_| rng.random::<$t>()).collect(); bench.iter(|| { for x in &numbers { black_box(black_box(x).isqrt()); diff --git a/library/coretests/benches/slice.rs b/library/coretests/benches/slice.rs index 29a66b62199..71027981d94 100644 --- a/library/coretests/benches/slice.rs +++ b/library/coretests/benches/slice.rs @@ -94,7 +94,7 @@ fn binary_search_l3_worst_case(b: &mut Bencher) { struct Rgb(#[allow(dead_code)] u8, #[allow(dead_code)] u8, #[allow(dead_code)] u8); impl Rgb { - fn gen(i: usize) -> Self { + fn new(i: usize) -> Self { Rgb(i as u8, (i as u8).wrapping_add(7), (i as u8).wrapping_add(42)) } } @@ -115,7 +115,7 @@ macro_rules! rotate { } rotate!(rotate_u8, 32, |i| i as u8); -rotate!(rotate_rgb, 32, Rgb::gen); +rotate!(rotate_rgb, 32, Rgb::new); rotate!(rotate_usize, 32, |i| i); rotate!(rotate_16_usize_4, 16, |i| [i; 4]); rotate!(rotate_16_usize_5, 16, |i| [i; 5]); @@ -142,8 +142,8 @@ macro_rules! swap_with_slice { swap_with_slice!(swap_with_slice_u8_30, 30, |i| i as u8); swap_with_slice!(swap_with_slice_u8_3000, 3000, |i| i as u8); -swap_with_slice!(swap_with_slice_rgb_30, 30, Rgb::gen); -swap_with_slice!(swap_with_slice_rgb_3000, 3000, Rgb::gen); +swap_with_slice!(swap_with_slice_rgb_30, 30, Rgb::new); +swap_with_slice!(swap_with_slice_rgb_3000, 3000, Rgb::new); swap_with_slice!(swap_with_slice_usize_30, 30, |i| i); swap_with_slice!(swap_with_slice_usize_3000, 3000, |i| i); swap_with_slice!(swap_with_slice_4x_usize_30, 30, |i| [i; 4]); diff --git a/library/coretests/tests/ascii_char.rs b/library/coretests/tests/ascii_char.rs index 75b5fd4b9e6..f5a15a9469f 100644 --- a/library/coretests/tests/ascii_char.rs +++ b/library/coretests/tests/ascii_char.rs @@ -26,3 +26,15 @@ fn test_debug_control() { assert_eq!(want, format!("{chr:?}"), "byte: {byte}"); } } + +/// Tests Extend implementation for ascii::Char. +#[test] +fn test_extend() { + let mut s = String::from("abc"); + s.extend_one(Char::SmallD); + assert_eq!(s, String::from("abcd")); + + let mut s = String::from("abc"); + s.extend(Char::CapitalA..=Char::CapitalC); + assert_eq!(s, String::from("abcABC")); +} diff --git a/library/coretests/tests/io/borrowed_buf.rs b/library/coretests/tests/io/borrowed_buf.rs index a5dd4e52577..fbd3864dcac 100644 --- a/library/coretests/tests/io/borrowed_buf.rs +++ b/library/coretests/tests/io/borrowed_buf.rs @@ -145,7 +145,7 @@ fn cursor_set_init() { assert_eq!(rbuf.unfilled().init_ref().len(), 8); assert_eq!(rbuf.unfilled().init_mut().len(), 8); assert_eq!(rbuf.unfilled().uninit_mut().len(), 8); - assert_eq!(unsafe { rbuf.unfilled().as_mut() }.len(), 16); + assert_eq!(unsafe { rbuf.unfilled().as_mut().len() }, 16); rbuf.unfilled().advance(4); @@ -163,5 +163,5 @@ fn cursor_set_init() { assert_eq!(rbuf.unfilled().init_ref().len(), 8); assert_eq!(rbuf.unfilled().init_mut().len(), 8); assert_eq!(rbuf.unfilled().uninit_mut().len(), 4); - assert_eq!(unsafe { rbuf.unfilled().as_mut() }.len(), 12); + assert_eq!(unsafe { rbuf.unfilled().as_mut().len() }, 12); } diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index ff4776fb0b2..1e1ff29e161 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -27,6 +27,7 @@ #![feature(duration_constructors)] #![feature(error_generic_member_access)] #![feature(exact_size_is_empty)] +#![feature(extend_one)] #![feature(extern_types)] #![feature(float_minimum_maximum)] #![feature(flt2dec)] diff --git a/library/coretests/tests/num/flt2dec/random.rs b/library/coretests/tests/num/flt2dec/random.rs index 90042ae03bf..586b49df7d9 100644 --- a/library/coretests/tests/num/flt2dec/random.rs +++ b/library/coretests/tests/num/flt2dec/random.rs @@ -5,7 +5,7 @@ use core::num::flt2dec::{DecodableFloat, Decoded, FullDecoded, MAX_SIG_DIGITS, d use std::mem::MaybeUninit; use std::str; -use rand::distributions::{Distribution, Uniform}; +use rand::distr::{Distribution, Uniform}; pub fn decode_finite<T: DecodableFloat>(v: T) -> Decoded { match decode(v).1 { @@ -85,7 +85,7 @@ where G: for<'a> FnMut(&Decoded, &'a mut [MaybeUninit<u8>]) -> (&'a [u8], i16), { let mut rng = crate::test_rng(); - let f32_range = Uniform::new(0x0000_0001u32, 0x7f80_0000); + let f32_range = Uniform::new(0x0000_0001u32, 0x7f80_0000).unwrap(); iterate("f32_random_equivalence_test", k, n, f, g, |_| { let x = f32::from_bits(f32_range.sample(&mut rng)); decode_finite(x) @@ -98,7 +98,7 @@ where G: for<'a> FnMut(&Decoded, &'a mut [MaybeUninit<u8>]) -> (&'a [u8], i16), { let mut rng = crate::test_rng(); - let f64_range = Uniform::new(0x0000_0000_0000_0001u64, 0x7ff0_0000_0000_0000); + let f64_range = Uniform::new(0x0000_0000_0000_0001u64, 0x7ff0_0000_0000_0000).unwrap(); iterate("f64_random_equivalence_test", k, n, f, g, |_| { let x = f64::from_bits(f64_range.sample(&mut rng)); decode_finite(x) diff --git a/library/coretests/tests/pin.rs b/library/coretests/tests/pin.rs index 026d2ca8de2..b3fb06e710d 100644 --- a/library/coretests/tests/pin.rs +++ b/library/coretests/tests/pin.rs @@ -28,7 +28,9 @@ fn pin_const() { const fn pin_mut_const() { let _ = Pin::new(&mut 2).into_ref(); let _ = Pin::new(&mut 2).get_mut(); - let _ = unsafe { Pin::new(&mut 2).get_unchecked_mut() }; + unsafe { + let _ = Pin::new(&mut 2).get_unchecked_mut(); + } } pin_mut_const(); diff --git a/library/coretests/tests/slice.rs b/library/coretests/tests/slice.rs index caffb66767d..1c5c8a9ebf2 100644 --- a/library/coretests/tests/slice.rs +++ b/library/coretests/tests/slice.rs @@ -5,6 +5,8 @@ use core::num::NonZero; use core::ops::{Range, RangeInclusive}; use core::slice; +use rand::seq::IndexedRandom; + #[test] fn test_position() { let b = [1, 2, 3, 5, 5]; @@ -1291,7 +1293,7 @@ fn test_iter_ref_consistency() { fn test<T: Copy + Debug + PartialEq>(x: T) { let v: &[T] = &[x, x, x]; let v_ptrs: [*const T; 3] = match v { - [ref v1, ref v2, ref v3] => [v1 as *const _, v2 as *const _, v3 as *const _], + [v1, v2, v3] => [v1 as *const _, v2 as *const _, v3 as *const _], _ => unreachable!(), }; let len = v.len(); @@ -1346,7 +1348,7 @@ fn test_iter_ref_consistency() { fn test_mut<T: Copy + Debug + PartialEq>(x: T) { let v: &mut [T] = &mut [x, x, x]; let v_ptrs: [*mut T; 3] = match v { - [ref v1, ref v2, ref v3] => { + &mut [ref v1, ref v2, ref v3] => { [v1 as *const _ as *mut _, v2 as *const _ as *mut _, v3 as *const _ as *mut _] } _ => unreachable!(), @@ -1808,7 +1810,6 @@ fn select_nth_unstable() { use core::cmp::Ordering::{Equal, Greater, Less}; use rand::Rng; - use rand::seq::SliceRandom; let mut rng = crate::test_rng(); @@ -1818,7 +1819,7 @@ fn select_nth_unstable() { for &modulus in &[5, 10, 1000] { for _ in 0..10 { for i in 0..len { - orig[i] = rng.gen::<i32>() % modulus; + orig[i] = rng.random::<i32>() % modulus; } let v_sorted = { diff --git a/library/panic_abort/src/android.rs b/library/panic_abort/src/android.rs index 47c22834597..1cc2077d14b 100644 --- a/library/panic_abort/src/android.rs +++ b/library/panic_abort/src/android.rs @@ -16,9 +16,10 @@ type SetAbortMessageType = unsafe extern "C" fn(*const libc::c_char) -> (); // Weakly resolve the symbol for android_set_abort_message. This function is only available // for API >= 21. pub(crate) unsafe fn android_set_abort_message(payload: &mut dyn PanicPayload) { - let func_addr = + let func_addr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, ANDROID_SET_ABORT_MESSAGE.as_ptr() as *const libc::c_char) - as usize; + as usize + }; if func_addr == 0 { return; } @@ -37,13 +38,14 @@ pub(crate) unsafe fn android_set_abort_message(payload: &mut dyn PanicPayload) { // Allocate a new buffer to append the null byte. let size = msg.len() + 1usize; - let buf = libc::malloc(size) as *mut libc::c_char; + let buf = unsafe { libc::malloc(size) as *mut libc::c_char }; if buf.is_null() { return; // allocation failure } - copy_nonoverlapping(msg.as_ptr(), buf as *mut u8, msg.len()); - buf.add(msg.len()).write(0); - - let func = transmute::<usize, SetAbortMessageType>(func_addr); - func(buf); + unsafe { + copy_nonoverlapping(msg.as_ptr(), buf as *mut u8, msg.len()); + buf.add(msg.len()).write(0); + let func = transmute::<usize, SetAbortMessageType>(func_addr); + func(buf); + } } diff --git a/library/panic_abort/src/lib.rs b/library/panic_abort/src/lib.rs index 7718d68aef8..b2ad0f4ac3d 100644 --- a/library/panic_abort/src/lib.rs +++ b/library/panic_abort/src/lib.rs @@ -15,6 +15,7 @@ #![feature(staged_api)] #![feature(rustc_attrs)] #![allow(internal_features)] +#![deny(unsafe_op_in_unsafe_fn)] #[cfg(target_os = "android")] mod android; @@ -36,16 +37,22 @@ pub unsafe extern "C" fn __rust_panic_cleanup(_: *mut u8) -> *mut (dyn Any + Sen pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 { // Android has the ability to attach a message as part of the abort. #[cfg(target_os = "android")] - android::android_set_abort_message(_payload); + unsafe { + android::android_set_abort_message(_payload); + } #[cfg(target_os = "zkvm")] - zkvm::zkvm_set_abort_message(_payload); + unsafe { + zkvm::zkvm_set_abort_message(_payload); + } - abort(); + unsafe { + abort(); + } cfg_if::cfg_if! { if #[cfg(any(unix, target_os = "solid_asp3"))] { unsafe fn abort() -> ! { - libc::abort(); + unsafe { libc::abort(); } } } else if #[cfg(any(target_os = "hermit", all(target_vendor = "fortanix", target_env = "sgx"), @@ -57,7 +64,7 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 { unsafe extern "C" { pub fn __rust_abort() -> !; } - __rust_abort(); + unsafe { __rust_abort(); } } } else if #[cfg(all(windows, not(miri)))] { // On Windows, use the processor-specific __fastfail mechanism. In Windows 8 @@ -75,11 +82,17 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 { const FAST_FAIL_FATAL_APP_EXIT: usize = 7; cfg_if::cfg_if! { if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { - core::arch::asm!("int $$0x29", in("ecx") FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); + unsafe { + core::arch::asm!("int $$0x29", in("ecx") FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); + } } else if #[cfg(all(target_arch = "arm", target_feature = "thumb-mode"))] { - core::arch::asm!(".inst 0xDEFB", in("r0") FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); + unsafe { + core::arch::asm!(".inst 0xDEFB", in("r0") FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); + } } else if #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))] { - core::arch::asm!("brk 0xF003", in("x0") FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); + unsafe { + core::arch::asm!("brk 0xF003", in("x0") FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); + } } else { core::intrinsics::abort(); } @@ -93,7 +106,7 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 { } unsafe fn abort() -> ! { - teeos::TEE_Panic(1); + unsafe { teeos::TEE_Panic(1); } } } else { unsafe fn abort() -> ! { diff --git a/library/panic_abort/src/zkvm.rs b/library/panic_abort/src/zkvm.rs index 11150eafd0b..7b1e89c6a8e 100644 --- a/library/panic_abort/src/zkvm.rs +++ b/library/panic_abort/src/zkvm.rs @@ -20,5 +20,7 @@ pub(crate) unsafe fn zkvm_set_abort_message(payload: &mut dyn PanicPayload) { fn sys_panic(msg_ptr: *const u8, len: usize) -> !; } - sys_panic(msg.as_ptr(), msg.len()); + unsafe { + sys_panic(msg.as_ptr(), msg.len()); + } } diff --git a/library/panic_unwind/src/emcc.rs b/library/panic_unwind/src/emcc.rs index 4140b004ad1..1569c26c9de 100644 --- a/library/panic_unwind/src/emcc.rs +++ b/library/panic_unwind/src/emcc.rs @@ -71,42 +71,46 @@ pub(crate) unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> { ptr: *mut u8, is_rust_panic: bool, } - let catch_data = &*(ptr as *mut CatchData); + unsafe { + let catch_data = &*(ptr as *mut CatchData); - let adjusted_ptr = __cxa_begin_catch(catch_data.ptr as *mut libc::c_void) as *mut Exception; - if !catch_data.is_rust_panic { - super::__rust_foreign_exception(); - } + let adjusted_ptr = __cxa_begin_catch(catch_data.ptr as *mut libc::c_void) as *mut Exception; + if !catch_data.is_rust_panic { + super::__rust_foreign_exception(); + } - let canary = (&raw const (*adjusted_ptr).canary).read(); - if !ptr::eq(canary, &EXCEPTION_TYPE_INFO) { - super::__rust_foreign_exception(); - } + let canary = (&raw const (*adjusted_ptr).canary).read(); + if !ptr::eq(canary, &EXCEPTION_TYPE_INFO) { + super::__rust_foreign_exception(); + } - let was_caught = (*adjusted_ptr).caught.swap(true, Ordering::Relaxed); - if was_caught { - // Since cleanup() isn't allowed to panic, we just abort instead. - intrinsics::abort(); + let was_caught = (*adjusted_ptr).caught.swap(true, Ordering::Relaxed); + if was_caught { + // Since cleanup() isn't allowed to panic, we just abort instead. + intrinsics::abort(); + } + let out = (*adjusted_ptr).data.take().unwrap(); + __cxa_end_catch(); + out } - let out = (*adjusted_ptr).data.take().unwrap(); - __cxa_end_catch(); - out } pub(crate) unsafe fn panic(data: Box<dyn Any + Send>) -> u32 { - let exception = __cxa_allocate_exception(mem::size_of::<Exception>()) as *mut Exception; - if exception.is_null() { - return uw::_URC_FATAL_PHASE1_ERROR as u32; + unsafe { + let exception = __cxa_allocate_exception(mem::size_of::<Exception>()) as *mut Exception; + if exception.is_null() { + return uw::_URC_FATAL_PHASE1_ERROR as u32; + } + ptr::write( + exception, + Exception { + canary: &EXCEPTION_TYPE_INFO, + caught: AtomicBool::new(false), + data: Some(data), + }, + ); + __cxa_throw(exception as *mut _, &EXCEPTION_TYPE_INFO, exception_cleanup); } - ptr::write( - exception, - Exception { - canary: &EXCEPTION_TYPE_INFO, - caught: AtomicBool::new(false), - data: Some(data), - }, - ); - __cxa_throw(exception as *mut _, &EXCEPTION_TYPE_INFO, exception_cleanup); } extern "C" fn exception_cleanup(ptr: *mut libc::c_void) -> *mut libc::c_void { diff --git a/library/panic_unwind/src/gcc.rs b/library/panic_unwind/src/gcc.rs index e478f6c5fc8..5f95870069d 100644 --- a/library/panic_unwind/src/gcc.rs +++ b/library/panic_unwind/src/gcc.rs @@ -69,7 +69,7 @@ pub(crate) unsafe fn panic(data: Box<dyn Any + Send>) -> u32 { cause: data, }); let exception_param = Box::into_raw(exception) as *mut uw::_Unwind_Exception; - return uw::_Unwind_RaiseException(exception_param) as u32; + return unsafe { uw::_Unwind_RaiseException(exception_param) as u32 }; extern "C" fn exception_cleanup( _unwind_code: uw::_Unwind_Reason_Code, @@ -83,26 +83,28 @@ pub(crate) unsafe fn panic(data: Box<dyn Any + Send>) -> u32 { } pub(crate) unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> { - let exception = ptr as *mut uw::_Unwind_Exception; - if (*exception).exception_class != RUST_EXCEPTION_CLASS { - uw::_Unwind_DeleteException(exception); - super::__rust_foreign_exception(); - } + unsafe { + let exception = ptr as *mut uw::_Unwind_Exception; + if (*exception).exception_class != RUST_EXCEPTION_CLASS { + uw::_Unwind_DeleteException(exception); + super::__rust_foreign_exception(); + } - let exception = exception.cast::<Exception>(); - // Just access the canary field, avoid accessing the entire `Exception` as - // it can be a foreign Rust exception. - let canary = (&raw const (*exception).canary).read(); - if !ptr::eq(canary, &CANARY) { - // A foreign Rust exception, treat it slightly differently from other - // foreign exceptions, because call into `_Unwind_DeleteException` will - // call into `__rust_drop_panic` which produces a confusing - // "Rust panic must be rethrown" message. - super::__rust_foreign_exception(); - } + let exception = exception.cast::<Exception>(); + // Just access the canary field, avoid accessing the entire `Exception` as + // it can be a foreign Rust exception. + let canary = (&raw const (*exception).canary).read(); + if !ptr::eq(canary, &CANARY) { + // A foreign Rust exception, treat it slightly differently from other + // foreign exceptions, because call into `_Unwind_DeleteException` will + // call into `__rust_drop_panic` which produces a confusing + // "Rust panic must be rethrown" message. + super::__rust_foreign_exception(); + } - let exception = Box::from_raw(exception as *mut Exception); - exception.cause + let exception = Box::from_raw(exception as *mut Exception); + exception.cause + } } // Rust's exception class identifier. This is used by personality routines to diff --git a/library/panic_unwind/src/hermit.rs b/library/panic_unwind/src/hermit.rs index 9719c133415..8f4562d07fc 100644 --- a/library/panic_unwind/src/hermit.rs +++ b/library/panic_unwind/src/hermit.rs @@ -9,12 +9,16 @@ pub(crate) unsafe fn cleanup(_ptr: *mut u8) -> Box<dyn Any + Send> { unsafe extern "C" { fn __rust_abort() -> !; } - __rust_abort(); + unsafe { + __rust_abort(); + } } pub(crate) unsafe fn panic(_data: Box<dyn Any + Send>) -> u32 { unsafe extern "C" { fn __rust_abort() -> !; } - __rust_abort(); + unsafe { + __rust_abort(); + } } diff --git a/library/panic_unwind/src/lib.rs b/library/panic_unwind/src/lib.rs index 45e2a466b4d..1111c2009b3 100644 --- a/library/panic_unwind/src/lib.rs +++ b/library/panic_unwind/src/lib.rs @@ -27,6 +27,7 @@ #![allow(internal_features)] #![cfg_attr(not(bootstrap), feature(cfg_emscripten_wasm_eh))] #![warn(unreachable_pub)] +#![deny(unsafe_op_in_unsafe_fn)] use alloc::boxed::Box; use core::any::Any; @@ -87,14 +88,16 @@ unsafe extern "C" { #[rustc_std_internal_symbol] #[allow(improper_ctypes_definitions)] pub unsafe extern "C" fn __rust_panic_cleanup(payload: *mut u8) -> *mut (dyn Any + Send + 'static) { - Box::into_raw(imp::cleanup(payload)) + unsafe { Box::into_raw(imp::cleanup(payload)) } } // Entry point for raising an exception, just delegates to the platform-specific // implementation. #[rustc_std_internal_symbol] pub unsafe fn __rust_start_panic(payload: &mut dyn PanicPayload) -> u32 { - let payload = Box::from_raw(payload.take_box()); + unsafe { + let payload = Box::from_raw(payload.take_box()); - imp::panic(payload) + imp::panic(payload) + } } diff --git a/library/panic_unwind/src/miri.rs b/library/panic_unwind/src/miri.rs index ec48b1105ab..d6d4af8218d 100644 --- a/library/panic_unwind/src/miri.rs +++ b/library/panic_unwind/src/miri.rs @@ -16,11 +16,11 @@ pub(crate) unsafe fn panic(payload: Box<dyn Any + Send>) -> u32 { // The payload we pass to `miri_start_unwind` will be exactly the argument we get // in `cleanup` below. So we just box it up once, to get something pointer-sized. let payload_box: Payload = Box::new(payload); - miri_start_unwind(Box::into_raw(payload_box) as *mut u8) + unsafe { miri_start_unwind(Box::into_raw(payload_box) as *mut u8) } } pub(crate) unsafe fn cleanup(payload_box: *mut u8) -> Box<dyn Any + Send> { // Recover the underlying `Box`. - let payload_box: Payload = Box::from_raw(payload_box as *mut _); + let payload_box: Payload = unsafe { Box::from_raw(payload_box as *mut _) }; *payload_box } diff --git a/library/panic_unwind/src/seh.rs b/library/panic_unwind/src/seh.rs index c8dfddf821e..3a95b940221 100644 --- a/library/panic_unwind/src/seh.rs +++ b/library/panic_unwind/src/seh.rs @@ -268,9 +268,11 @@ static mut TYPE_DESCRIPTOR: _TypeDescriptor = _TypeDescriptor { macro_rules! define_cleanup { ($abi:tt $abi2:tt) => { unsafe extern $abi fn exception_cleanup(e: *mut Exception) { - if let Exception { data: Some(b), .. } = e.read() { - drop(b); - super::__rust_drop_panic(); + unsafe { + if let Exception { data: Some(b), .. } = e.read() { + drop(b); + super::__rust_drop_panic(); + } } } unsafe extern $abi2 fn exception_copy( @@ -322,45 +324,51 @@ pub(crate) unsafe fn panic(data: Box<dyn Any + Send>) -> u32 { // // In any case, we basically need to do something like this until we can // express more operations in statics (and we may never be able to). - atomic_store_seqcst( - (&raw mut THROW_INFO.pmfnUnwind).cast(), - ptr_t::new(exception_cleanup as *mut u8).raw(), - ); - atomic_store_seqcst( - (&raw mut THROW_INFO.pCatchableTypeArray).cast(), - ptr_t::new((&raw mut CATCHABLE_TYPE_ARRAY).cast()).raw(), - ); - atomic_store_seqcst( - (&raw mut CATCHABLE_TYPE_ARRAY.arrayOfCatchableTypes[0]).cast(), - ptr_t::new((&raw mut CATCHABLE_TYPE).cast()).raw(), - ); - atomic_store_seqcst( - (&raw mut CATCHABLE_TYPE.pType).cast(), - ptr_t::new((&raw mut TYPE_DESCRIPTOR).cast()).raw(), - ); - atomic_store_seqcst( - (&raw mut CATCHABLE_TYPE.copyFunction).cast(), - ptr_t::new(exception_copy as *mut u8).raw(), - ); + unsafe { + atomic_store_seqcst( + (&raw mut THROW_INFO.pmfnUnwind).cast(), + ptr_t::new(exception_cleanup as *mut u8).raw(), + ); + atomic_store_seqcst( + (&raw mut THROW_INFO.pCatchableTypeArray).cast(), + ptr_t::new((&raw mut CATCHABLE_TYPE_ARRAY).cast()).raw(), + ); + atomic_store_seqcst( + (&raw mut CATCHABLE_TYPE_ARRAY.arrayOfCatchableTypes[0]).cast(), + ptr_t::new((&raw mut CATCHABLE_TYPE).cast()).raw(), + ); + atomic_store_seqcst( + (&raw mut CATCHABLE_TYPE.pType).cast(), + ptr_t::new((&raw mut TYPE_DESCRIPTOR).cast()).raw(), + ); + atomic_store_seqcst( + (&raw mut CATCHABLE_TYPE.copyFunction).cast(), + ptr_t::new(exception_copy as *mut u8).raw(), + ); + } unsafe extern "system-unwind" { fn _CxxThrowException(pExceptionObject: *mut c_void, pThrowInfo: *mut u8) -> !; } - _CxxThrowException(throw_ptr, (&raw mut THROW_INFO) as *mut _); + unsafe { + _CxxThrowException(throw_ptr, (&raw mut THROW_INFO) as *mut _); + } } pub(crate) unsafe fn cleanup(payload: *mut u8) -> Box<dyn Any + Send> { - // A null payload here means that we got here from the catch (...) of - // __rust_try. This happens when a non-Rust foreign exception is caught. - if payload.is_null() { - super::__rust_foreign_exception(); - } - let exception = payload as *mut Exception; - let canary = (&raw const (*exception).canary).read(); - if !core::ptr::eq(canary, &raw const TYPE_DESCRIPTOR) { - // A foreign Rust exception. - super::__rust_foreign_exception(); + unsafe { + // A null payload here means that we got here from the catch (...) of + // __rust_try. This happens when a non-Rust foreign exception is caught. + if payload.is_null() { + super::__rust_foreign_exception(); + } + let exception = payload as *mut Exception; + let canary = (&raw const (*exception).canary).read(); + if !core::ptr::eq(canary, &raw const TYPE_DESCRIPTOR) { + // A foreign Rust exception. + super::__rust_foreign_exception(); + } + (*exception).data.take().unwrap() } - (*exception).data.take().unwrap() } diff --git a/library/proc_macro/src/bridge/closure.rs b/library/proc_macro/src/bridge/closure.rs index 524fdf53d6b..e0e688434dc 100644 --- a/library/proc_macro/src/bridge/closure.rs +++ b/library/proc_macro/src/bridge/closure.rs @@ -19,7 +19,7 @@ struct Env; impl<'a, A, R, F: FnMut(A) -> R> From<&'a mut F> for Closure<'a, A, R> { fn from(f: &'a mut F) -> Self { unsafe extern "C" fn call<A, R, F: FnMut(A) -> R>(env: *mut Env, arg: A) -> R { - (*(env as *mut _ as *mut F))(arg) + unsafe { (*(env as *mut _ as *mut F))(arg) } } Closure { call: call::<A, R, F>, env: f as *mut _ as *mut Env, _marker: PhantomData } } diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 6611ce30a1b..d9141eab591 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -33,6 +33,7 @@ #![deny(ffi_unwind_calls)] #![warn(rustdoc::unescaped_backticks)] #![warn(unreachable_pub)] +#![deny(unsafe_op_in_unsafe_fn)] #[unstable(feature = "proc_macro_internals", issue = "27812")] #[doc(hidden)] diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index add5a20d179..36a0a59d939 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -61,8 +61,8 @@ object = { version = "0.36.0", default-features = false, optional = true, featur path = "../windows_targets" [dev-dependencies] -rand = { version = "0.8.5", default-features = false, features = ["alloc"] } -rand_xorshift = "0.3.0" +rand = { version = "0.9.0", default-features = false, features = ["alloc"] } +rand_xorshift = "0.4.0" [target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), target_os = "xous", all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies] dlmalloc = { version = "0.2.4", features = ['rustc-dep-of-std'] } diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index 3936ed057e6..99d105a2454 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -20,11 +20,11 @@ //! //! unsafe impl GlobalAlloc for MyAllocator { //! unsafe fn alloc(&self, layout: Layout) -> *mut u8 { -//! System.alloc(layout) +//! unsafe { System.alloc(layout) } //! } //! //! unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { -//! System.dealloc(ptr, layout) +//! unsafe { System.dealloc(ptr, layout) } //! } //! } //! @@ -102,7 +102,7 @@ pub use alloc_crate::alloc::*; /// /// unsafe impl GlobalAlloc for Counter { /// unsafe fn alloc(&self, layout: Layout) -> *mut u8 { -/// let ret = System.alloc(layout); +/// let ret = unsafe { System.alloc(layout) }; /// if !ret.is_null() { /// ALLOCATED.fetch_add(layout.size(), Relaxed); /// } @@ -110,7 +110,7 @@ pub use alloc_crate::alloc::*; /// } /// /// unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { -/// System.dealloc(ptr, layout); +/// unsafe { System.dealloc(ptr, layout); } /// ALLOCATED.fetch_sub(layout.size(), Relaxed); /// } /// } diff --git a/library/std/src/env.rs b/library/std/src/env.rs index c665dfd3624..adbd6889624 100644 --- a/library/std/src/env.rs +++ b/library/std/src/env.rs @@ -568,7 +568,7 @@ pub struct JoinPathsError { /// let mut paths = env::split_paths(&path).collect::<Vec<_>>(); /// paths.push(PathBuf::from("/home/xyz/bin")); /// let new_path = env::join_paths(paths)?; -/// env::set_var("PATH", &new_path); +/// unsafe { env::set_var("PATH", &new_path); } /// } /// /// Ok(()) diff --git a/library/std/src/f128.rs b/library/std/src/f128.rs index cff0bf4ccf4..14ce2b69ca4 100644 --- a/library/std/src/f128.rs +++ b/library/std/src/f128.rs @@ -1226,6 +1226,7 @@ impl f128 { #[inline] #[rustc_allow_incoherent_impl] #[unstable(feature = "f128", issue = "116909")] + // #[unstable(feature = "float_gamma", issue = "99842")] #[must_use = "method returns a new number and does not mutate the original value"] pub fn gamma(self) -> f128 { unsafe { cmath::tgammaf128(self) } @@ -1260,10 +1261,83 @@ impl f128 { #[inline] #[rustc_allow_incoherent_impl] #[unstable(feature = "f128", issue = "116909")] + // #[unstable(feature = "float_gamma", issue = "99842")] #[must_use = "method returns a new number and does not mutate the original value"] pub fn ln_gamma(self) -> (f128, i32) { let mut signgamp: i32 = 0; let x = unsafe { cmath::lgammaf128_r(self, &mut signgamp) }; (x, signgamp) } + + /// Error function. + /// + /// # Unspecified precision + /// + /// The precision of this function is non-deterministic. This means it varies by platform, + /// Rust version, and can even differ within the same execution from one invocation to the next. + /// + /// This function currently corresponds to the `erff128` from libc on Unix + /// and Windows. Note that this might change in the future. + /// + /// # Examples + /// + /// ``` + /// #![feature(f128)] + /// #![feature(float_erf)] + /// # #[cfg(reliable_f128_math)] { + /// /// The error function relates what percent of a normal distribution lies + /// /// within `x` standard deviations (scaled by `1/sqrt(2)`). + /// fn within_standard_deviations(x: f128) -> f128 { + /// (x * std::f128::consts::FRAC_1_SQRT_2).erf() * 100.0 + /// } + /// + /// // 68% of a normal distribution is within one standard deviation + /// assert!((within_standard_deviations(1.0) - 68.269).abs() < 0.01); + /// // 95% of a normal distribution is within two standard deviations + /// assert!((within_standard_deviations(2.0) - 95.450).abs() < 0.01); + /// // 99.7% of a normal distribution is within three standard deviations + /// assert!((within_standard_deviations(3.0) - 99.730).abs() < 0.01); + /// # } + /// ``` + #[rustc_allow_incoherent_impl] + #[must_use = "method returns a new number and does not mutate the original value"] + #[unstable(feature = "f128", issue = "116909")] + // #[unstable(feature = "float_erf", issue = "136321")] + #[inline] + pub fn erf(self) -> f128 { + unsafe { cmath::erff128(self) } + } + + /// Complementary error function. + /// + /// # Unspecified precision + /// + /// The precision of this function is non-deterministic. This means it varies by platform, + /// Rust version, and can even differ within the same execution from one invocation to the next. + /// + /// This function currently corresponds to the `erfcf128` from libc on Unix + /// and Windows. Note that this might change in the future. + /// + /// # Examples + /// + /// ``` + /// #![feature(f128)] + /// #![feature(float_erf)] + /// # #[cfg(reliable_f128_math)] { + /// let x: f128 = 0.123; + /// + /// let one = x.erf() + x.erfc(); + /// let abs_difference = (one - 1.0).abs(); + /// + /// assert!(abs_difference <= f128::EPSILON); + /// # } + /// ``` + #[rustc_allow_incoherent_impl] + #[must_use = "method returns a new number and does not mutate the original value"] + #[unstable(feature = "f128", issue = "116909")] + // #[unstable(feature = "float_erf", issue = "136321")] + #[inline] + pub fn erfc(self) -> f128 { + unsafe { cmath::erfcf128(self) } + } } diff --git a/library/std/src/f16.rs b/library/std/src/f16.rs index f6a553b1d0f..bdbe3e21994 100644 --- a/library/std/src/f16.rs +++ b/library/std/src/f16.rs @@ -1224,6 +1224,7 @@ impl f16 { #[inline] #[rustc_allow_incoherent_impl] #[unstable(feature = "f16", issue = "116909")] + // #[unstable(feature = "float_gamma", issue = "99842")] #[must_use = "method returns a new number and does not mutate the original value"] pub fn gamma(self) -> f16 { (unsafe { cmath::tgammaf(self as f32) }) as f16 @@ -1258,10 +1259,81 @@ impl f16 { #[inline] #[rustc_allow_incoherent_impl] #[unstable(feature = "f16", issue = "116909")] + // #[unstable(feature = "float_gamma", issue = "99842")] #[must_use = "method returns a new number and does not mutate the original value"] pub fn ln_gamma(self) -> (f16, i32) { let mut signgamp: i32 = 0; let x = (unsafe { cmath::lgammaf_r(self as f32, &mut signgamp) }) as f16; (x, signgamp) } + + /// Error function. + /// + /// # Unspecified precision + /// + /// The precision of this function is non-deterministic. This means it varies by platform, + /// Rust version, and can even differ within the same execution from one invocation to the next. + /// + /// This function currently corresponds to the `erff` from libc on Unix + /// and Windows. Note that this might change in the future. + /// + /// # Examples + /// + /// ``` + /// #![feature(f16)] + /// #![feature(float_erf)] + /// # #[cfg(reliable_f16_math)] { + /// /// The error function relates what percent of a normal distribution lies + /// /// within `x` standard deviations (scaled by `1/sqrt(2)`). + /// fn within_standard_deviations(x: f16) -> f16 { + /// (x * std::f16::consts::FRAC_1_SQRT_2).erf() * 100.0 + /// } + /// + /// // 68% of a normal distribution is within one standard deviation + /// assert!((within_standard_deviations(1.0) - 68.269).abs() < 0.1); + /// // 95% of a normal distribution is within two standard deviations + /// assert!((within_standard_deviations(2.0) - 95.450).abs() < 0.1); + /// // 99.7% of a normal distribution is within three standard deviations + /// assert!((within_standard_deviations(3.0) - 99.730).abs() < 0.1); + /// # } + /// ``` + #[rustc_allow_incoherent_impl] + #[must_use = "method returns a new number and does not mutate the original value"] + #[unstable(feature = "f16", issue = "116909")] + // #[unstable(feature = "float_erf", issue = "136321")] + #[inline] + pub fn erf(self) -> f16 { + (unsafe { cmath::erff(self as f32) }) as f16 + } + + /// Complementary error function. + /// + /// # Unspecified precision + /// + /// The precision of this function is non-deterministic. This means it varies by platform, + /// Rust version, and can even differ within the same execution from one invocation to the next. + /// + /// This function currently corresponds to the `erfcf` from libc on Unix + /// and Windows. Note that this might change in the future. + /// + /// # Examples + /// + /// ``` + /// #![feature(f16)] + /// #![feature(float_erf)] + /// let x: f16 = 0.123; + /// + /// let one = x.erf() + x.erfc(); + /// let abs_difference = (one - 1.0).abs(); + /// + /// assert!(abs_difference <= f16::EPSILON); + /// ``` + #[rustc_allow_incoherent_impl] + #[must_use = "method returns a new number and does not mutate the original value"] + #[unstable(feature = "f16", issue = "116909")] + // #[unstable(feature = "float_erf", issue = "136321")] + #[inline] + pub fn erfc(self) -> f16 { + (unsafe { cmath::erfcf(self as f32) }) as f16 + } } diff --git a/library/std/src/f32.rs b/library/std/src/f32.rs index 260c499b7f4..295eee8700a 100644 --- a/library/std/src/f32.rs +++ b/library/std/src/f32.rs @@ -1151,4 +1151,68 @@ impl f32 { let x = unsafe { cmath::lgammaf_r(self, &mut signgamp) }; (x, signgamp) } + + /// Error function. + /// + /// # Unspecified precision + /// + /// The precision of this function is non-deterministic. This means it varies by platform, + /// Rust version, and can even differ within the same execution from one invocation to the next. + /// + /// This function currently corresponds to the `erff` from libc on Unix + /// and Windows. Note that this might change in the future. + /// + /// # Examples + /// + /// ``` + /// #![feature(float_erf)] + /// /// The error function relates what percent of a normal distribution lies + /// /// within `x` standard deviations (scaled by `1/sqrt(2)`). + /// fn within_standard_deviations(x: f32) -> f32 { + /// (x * std::f32::consts::FRAC_1_SQRT_2).erf() * 100.0 + /// } + /// + /// // 68% of a normal distribution is within one standard deviation + /// assert!((within_standard_deviations(1.0) - 68.269).abs() < 0.01); + /// // 95% of a normal distribution is within two standard deviations + /// assert!((within_standard_deviations(2.0) - 95.450).abs() < 0.01); + /// // 99.7% of a normal distribution is within three standard deviations + /// assert!((within_standard_deviations(3.0) - 99.730).abs() < 0.01); + /// ``` + #[rustc_allow_incoherent_impl] + #[must_use = "method returns a new number and does not mutate the original value"] + #[unstable(feature = "float_erf", issue = "136321")] + #[inline] + pub fn erf(self) -> f32 { + unsafe { cmath::erff(self) } + } + + /// Complementary error function. + /// + /// # Unspecified precision + /// + /// The precision of this function is non-deterministic. This means it varies by platform, + /// Rust version, and can even differ within the same execution from one invocation to the next. + /// + /// This function currently corresponds to the `erfcf` from libc on Unix + /// and Windows. Note that this might change in the future. + /// + /// # Examples + /// + /// ``` + /// #![feature(float_erf)] + /// let x: f32 = 0.123; + /// + /// let one = x.erf() + x.erfc(); + /// let abs_difference = (one - 1.0).abs(); + /// + /// assert!(abs_difference <= f32::EPSILON); + /// ``` + #[rustc_allow_incoherent_impl] + #[must_use = "method returns a new number and does not mutate the original value"] + #[unstable(feature = "float_erf", issue = "136321")] + #[inline] + pub fn erfc(self) -> f32 { + unsafe { cmath::erfcf(self) } + } } diff --git a/library/std/src/f64.rs b/library/std/src/f64.rs index 7af646f8cfd..0d713ecbc73 100644 --- a/library/std/src/f64.rs +++ b/library/std/src/f64.rs @@ -1151,4 +1151,68 @@ impl f64 { let x = unsafe { cmath::lgamma_r(self, &mut signgamp) }; (x, signgamp) } + + /// Error function. + /// + /// # Unspecified precision + /// + /// The precision of this function is non-deterministic. This means it varies by platform, + /// Rust version, and can even differ within the same execution from one invocation to the next. + /// + /// This function currently corresponds to the `erf` from libc on Unix + /// and Windows. Note that this might change in the future. + /// + /// # Examples + /// + /// ``` + /// #![feature(float_erf)] + /// /// The error function relates what percent of a normal distribution lies + /// /// within `x` standard deviations (scaled by `1/sqrt(2)`). + /// fn within_standard_deviations(x: f64) -> f64 { + /// (x * std::f64::consts::FRAC_1_SQRT_2).erf() * 100.0 + /// } + /// + /// // 68% of a normal distribution is within one standard deviation + /// assert!((within_standard_deviations(1.0) - 68.269).abs() < 0.01); + /// // 95% of a normal distribution is within two standard deviations + /// assert!((within_standard_deviations(2.0) - 95.450).abs() < 0.01); + /// // 99.7% of a normal distribution is within three standard deviations + /// assert!((within_standard_deviations(3.0) - 99.730).abs() < 0.01); + /// ``` + #[rustc_allow_incoherent_impl] + #[must_use = "method returns a new number and does not mutate the original value"] + #[unstable(feature = "float_erf", issue = "136321")] + #[inline] + pub fn erf(self) -> f64 { + unsafe { cmath::erf(self) } + } + + /// Complementary error function. + /// + /// # Unspecified precision + /// + /// The precision of this function is non-deterministic. This means it varies by platform, + /// Rust version, and can even differ within the same execution from one invocation to the next. + /// + /// This function currently corresponds to the `erfc` from libc on Unix + /// and Windows. Note that this might change in the future. + /// + /// # Examples + /// + /// ``` + /// #![feature(float_erf)] + /// let x: f64 = 0.123; + /// + /// let one = x.erf() + x.erfc(); + /// let abs_difference = (one - 1.0).abs(); + /// + /// assert!(abs_difference <= f64::EPSILON); + /// ``` + #[rustc_allow_incoherent_impl] + #[must_use = "method returns a new number and does not mutate the original value"] + #[unstable(feature = "float_erf", issue = "136321")] + #[inline] + pub fn erfc(self) -> f64 { + unsafe { cmath::erfc(self) } + } } diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs index 38b72336617..30bc0e3b088 100644 --- a/library/std/src/io/error.rs +++ b/library/std/src/io/error.rs @@ -83,7 +83,7 @@ impl Error { pub(crate) const UNKNOWN_THREAD_COUNT: Self = const_error!( ErrorKind::NotFound, - "The number of hardware threads is not known for the target platform" + "The number of hardware threads is not known for the target platform", ); pub(crate) const UNSUPPORTED_PLATFORM: Self = diff --git a/library/std/src/io/impls.rs b/library/std/src/io/impls.rs index b952c85addf..8239b29884e 100644 --- a/library/std/src/io/impls.rs +++ b/library/std/src/io/impls.rs @@ -45,6 +45,7 @@ impl<R: Read + ?Sized> Read for &mut R { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { (**self).read_exact(buf) } + #[inline] fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { (**self).read_buf_exact(cursor) @@ -78,6 +79,11 @@ impl<W: Write + ?Sized> Write for &mut W { } #[inline] + fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> { + (**self).write_all_vectored(bufs) + } + + #[inline] fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> { (**self).write_fmt(fmt) } @@ -90,9 +96,24 @@ impl<S: Seek + ?Sized> Seek for &mut S { } #[inline] + fn rewind(&mut self) -> io::Result<()> { + (**self).rewind() + } + + #[inline] + fn stream_len(&mut self) -> io::Result<u64> { + (**self).stream_len() + } + + #[inline] fn stream_position(&mut self) -> io::Result<u64> { (**self).stream_position() } + + #[inline] + fn seek_relative(&mut self, offset: i64) -> io::Result<()> { + (**self).seek_relative(offset) + } } #[stable(feature = "rust1", since = "1.0.0")] impl<B: BufRead + ?Sized> BufRead for &mut B { @@ -107,11 +128,21 @@ impl<B: BufRead + ?Sized> BufRead for &mut B { } #[inline] + fn has_data_left(&mut self) -> io::Result<bool> { + (**self).has_data_left() + } + + #[inline] fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> { (**self).read_until(byte, buf) } #[inline] + fn skip_until(&mut self, byte: u8) -> io::Result<usize> { + (**self).skip_until(byte) + } + + #[inline] fn read_line(&mut self, buf: &mut String) -> io::Result<usize> { (**self).read_line(buf) } @@ -153,6 +184,7 @@ impl<R: Read + ?Sized> Read for Box<R> { fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { (**self).read_exact(buf) } + #[inline] fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { (**self).read_buf_exact(cursor) @@ -186,6 +218,11 @@ impl<W: Write + ?Sized> Write for Box<W> { } #[inline] + fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> { + (**self).write_all_vectored(bufs) + } + + #[inline] fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> { (**self).write_fmt(fmt) } @@ -198,9 +235,24 @@ impl<S: Seek + ?Sized> Seek for Box<S> { } #[inline] + fn rewind(&mut self) -> io::Result<()> { + (**self).rewind() + } + + #[inline] + fn stream_len(&mut self) -> io::Result<u64> { + (**self).stream_len() + } + + #[inline] fn stream_position(&mut self) -> io::Result<u64> { (**self).stream_position() } + + #[inline] + fn seek_relative(&mut self, offset: i64) -> io::Result<()> { + (**self).seek_relative(offset) + } } #[stable(feature = "rust1", since = "1.0.0")] impl<B: BufRead + ?Sized> BufRead for Box<B> { @@ -215,11 +267,21 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> { } #[inline] + fn has_data_left(&mut self) -> io::Result<bool> { + (**self).has_data_left() + } + + #[inline] fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> { (**self).read_until(byte, buf) } #[inline] + fn skip_until(&mut self, byte: u8) -> io::Result<usize> { + (**self).skip_until(byte) + } + + #[inline] fn read_line(&mut self, buf: &mut String) -> io::Result<usize> { (**self).read_line(buf) } diff --git a/library/std/src/io/util.rs b/library/std/src/io/util.rs index 424f862090f..cb3f864fd4e 100644 --- a/library/std/src/io/util.rs +++ b/library/std/src/io/util.rs @@ -7,6 +7,7 @@ use crate::fmt; use crate::io::{ self, BorrowedCursor, BufRead, IoSlice, IoSliceMut, Read, Seek, SeekFrom, SizeHint, Write, }; +use crate::mem::MaybeUninit; /// `Empty` ignores any data written via [`Write`], and will always be empty /// (returning zero bytes) when read via [`Read`]. @@ -182,35 +183,26 @@ pub const fn repeat(byte: u8) -> Repeat { impl Read for Repeat { #[inline] fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { - for slot in &mut *buf { - *slot = self.byte; - } + buf.fill(self.byte); Ok(buf.len()) } + #[inline] fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { - for slot in &mut *buf { - *slot = self.byte; - } + buf.fill(self.byte); Ok(()) } + #[inline] fn read_buf(&mut self, mut buf: BorrowedCursor<'_>) -> io::Result<()> { - // SAFETY: No uninit bytes are being written - for slot in unsafe { buf.as_mut() } { - slot.write(self.byte); - } - - let remaining = buf.capacity(); - - // SAFETY: the entire unfilled portion of buf has been initialized - unsafe { - buf.advance_unchecked(remaining); - } - + // SAFETY: No uninit bytes are being written. + MaybeUninit::fill(unsafe { buf.as_mut() }, self.byte); + // SAFETY: the entire unfilled portion of buf has been initialized. + unsafe { buf.advance_unchecked(buf.capacity()) }; Ok(()) } + #[inline] fn read_buf_exact(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> { self.read_buf(buf) } diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index 825a89fc7f2..bdd330611de 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -398,7 +398,7 @@ mod enum_keyword {} /// The mirror use case of FFI is also done via the `extern` keyword: /// /// ```rust -/// #[no_mangle] +/// #[unsafe(no_mangle)] /// pub extern "C" fn callable_from_c(x: i32) -> bool { /// x % 3 == 0 /// } @@ -1428,7 +1428,7 @@ mod self_upper_keyword {} /// /// ```rust,no_run /// # #![allow(dead_code)] -/// extern "C" { +/// unsafe extern "C" { /// static mut ERROR_MESSAGE: *mut std::os::raw::c_char; /// } /// ``` @@ -1925,7 +1925,7 @@ mod type_keyword {} /// /// unsafe fn unsafe_fn() {} /// -/// extern "C" { +/// unsafe extern "C" { /// fn unsafe_extern_fn(); /// static BAR: *mut u32; /// } diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 7d7d192c4dd..750116c6269 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -302,6 +302,7 @@ #![feature(link_cfg)] #![feature(linkage)] #![feature(macro_metavar_expr_concat)] +#![feature(maybe_uninit_fill)] #![feature(min_specialization)] #![feature(must_not_suspend)] #![feature(needs_panic_runtime)] diff --git a/library/std/src/os/fd/owned.rs b/library/std/src/os/fd/owned.rs index 1e814eca3c1..5cec11ecccf 100644 --- a/library/std/src/os/fd/owned.rs +++ b/library/std/src/os/fd/owned.rs @@ -67,13 +67,11 @@ impl BorrowedFd<'_> { /// The resource pointed to by `fd` must remain open for the duration of /// the returned `BorrowedFd`, and it must not have the value `-1`. #[inline] + #[track_caller] #[rustc_const_stable(feature = "io_safety", since = "1.63.0")] #[stable(feature = "io_safety", since = "1.63.0")] pub const unsafe fn borrow_raw(fd: RawFd) -> Self { - assert!(fd != u32::MAX as RawFd); - // SAFETY: we just asserted that the value is in the valid range and isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned) - let fd = unsafe { ValidRawFd::new_unchecked(fd) }; - Self { fd, _phantom: PhantomData } + Self { fd: ValidRawFd::new(fd).expect("fd != -1"), _phantom: PhantomData } } } @@ -154,11 +152,9 @@ impl FromRawFd for OwnedFd { /// /// [io-safety]: io#io-safety #[inline] + #[track_caller] unsafe fn from_raw_fd(fd: RawFd) -> Self { - assert_ne!(fd, u32::MAX as RawFd); - // SAFETY: we just asserted that the value is in the valid range and isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned) - let fd = unsafe { ValidRawFd::new_unchecked(fd) }; - Self { fd } + Self { fd: ValidRawFd::new(fd).expect("fd != -1") } } } diff --git a/library/std/src/os/solid/io.rs b/library/std/src/os/solid/io.rs index ca58a900c44..c23d842b238 100644 --- a/library/std/src/os/solid/io.rs +++ b/library/std/src/os/solid/io.rs @@ -101,12 +101,9 @@ impl BorrowedFd<'_> { /// the returned `BorrowedFd`, and it must not have the value /// `SOLID_NET_INVALID_FD`. #[inline] + #[track_caller] pub const unsafe fn borrow_raw(fd: RawFd) -> Self { - assert!(fd != -1 as RawFd); - // SAFETY: we just asserted that the value is in the valid range and - // isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned) - let fd = unsafe { ValidRawFd::new_unchecked(fd) }; - Self { fd, _phantom: PhantomData } + Self { fd: ValidRawFd::new(fd).expect("fd != -1"), _phantom: PhantomData } } } @@ -156,12 +153,9 @@ impl FromRawFd for OwnedFd { /// The resource pointed to by `fd` must be open and suitable for assuming /// ownership. The resource must not require any cleanup other than `close`. #[inline] + #[track_caller] unsafe fn from_raw_fd(fd: RawFd) -> Self { - assert_ne!(fd, -1 as RawFd); - // SAFETY: we just asserted that the value is in the valid range and - // isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned) - let fd = unsafe { ValidRawFd::new_unchecked(fd) }; - Self { fd } + Self { fd: ValidRawFd::new(fd).expect("fd != -1") } } } diff --git a/library/std/src/os/windows/io/socket.rs b/library/std/src/os/windows/io/socket.rs index 6e13a8b502a..2bc6ce222ae 100644 --- a/library/std/src/os/windows/io/socket.rs +++ b/library/std/src/os/windows/io/socket.rs @@ -58,12 +58,11 @@ impl BorrowedSocket<'_> { /// the returned `BorrowedSocket`, and it must not have the value /// `INVALID_SOCKET`. #[inline] + #[track_caller] #[rustc_const_stable(feature = "io_safety", since = "1.63.0")] #[stable(feature = "io_safety", since = "1.63.0")] pub const unsafe fn borrow_raw(socket: RawSocket) -> Self { - assert!(socket != sys::c::INVALID_SOCKET as RawSocket); - let socket = unsafe { ValidRawSocket::new_unchecked(socket) }; - Self { socket, _phantom: PhantomData } + Self { socket: ValidRawSocket::new(socket).expect("socket != -1"), _phantom: PhantomData } } } @@ -185,10 +184,9 @@ impl IntoRawSocket for OwnedSocket { #[stable(feature = "io_safety", since = "1.63.0")] impl FromRawSocket for OwnedSocket { #[inline] + #[track_caller] unsafe fn from_raw_socket(socket: RawSocket) -> Self { - debug_assert_ne!(socket, sys::c::INVALID_SOCKET as RawSocket); - let socket = unsafe { ValidRawSocket::new_unchecked(socket) }; - Self { socket } + Self { socket: ValidRawSocket::new(socket).expect("socket != -1") } } } diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs index 153189b8b03..61801db072a 100644 --- a/library/std/src/panic.rs +++ b/library/std/src/panic.rs @@ -376,7 +376,9 @@ pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> { /// use std::panic; /// /// let result = panic::catch_unwind(|| { -/// panic!("oh no!"); +/// if 1 != 2 { +/// panic!("oh no!"); +/// } /// }); /// /// if let Err(err) = result { diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 97e17acadea..f9f3b488f0d 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -3575,7 +3575,7 @@ impl Error for StripPrefixError { pub fn absolute<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> { let path = path.as_ref(); if path.as_os_str().is_empty() { - Err(io::const_error!(io::ErrorKind::InvalidInput, "cannot make an empty path absolute",)) + Err(io::const_error!(io::ErrorKind::InvalidInput, "cannot make an empty path absolute")) } else { sys::path::absolute(path) } diff --git a/library/std/src/prelude/mod.rs b/library/std/src/prelude/mod.rs index 14e6c2715df..992a9207a72 100644 --- a/library/std/src/prelude/mod.rs +++ b/library/std/src/prelude/mod.rs @@ -111,16 +111,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -mod common; - -/// The first version of the prelude of The Rust Standard Library. -/// -/// See the [module-level documentation](self) for more. -#[stable(feature = "rust1", since = "1.0.0")] -pub mod v1 { - #[stable(feature = "rust1", since = "1.0.0")] - pub use super::common::*; -} +pub mod v1; /// The 2015 version of the prelude of The Rust Standard Library. /// @@ -162,7 +153,8 @@ pub mod rust_2021 { #[stable(feature = "prelude_2024", since = "1.85.0")] pub mod rust_2024 { #[stable(feature = "rust1", since = "1.0.0")] - pub use super::common::*; + #[doc(no_inline)] + pub use super::v1::*; #[stable(feature = "prelude_2024", since = "1.85.0")] #[doc(no_inline)] diff --git a/library/std/src/prelude/common.rs b/library/std/src/prelude/v1.rs index 0f2d8334fca..5b324b2e916 100644 --- a/library/std/src/prelude/common.rs +++ b/library/std/src/prelude/v1.rs @@ -1,7 +1,9 @@ -//! Items common to the prelude of all editions. +//! The first version of the prelude of The Rust Standard Library. //! //! See the [module-level documentation](super) for more. +#![stable(feature = "rust1", since = "1.0.0")] + // No formatting: this file is nothing but re-exports, and their order is worth preserving. #![cfg_attr(rustfmt, rustfmt::skip)] diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs index 69273d863eb..5879914ca20 100644 --- a/library/std/src/process/tests.rs +++ b/library/std/src/process/tests.rs @@ -323,9 +323,13 @@ fn test_capture_env_at_spawn() { // This variable will not be present if the environment has already // been captured above. - env::set_var("RUN_TEST_NEW_ENV2", "456"); + unsafe { + env::set_var("RUN_TEST_NEW_ENV2", "456"); + } let result = cmd.output().unwrap(); - env::remove_var("RUN_TEST_NEW_ENV2"); + unsafe { + env::remove_var("RUN_TEST_NEW_ENV2"); + } let output = String::from_utf8_lossy(&result.stdout).to_string(); diff --git a/library/std/src/sys/alloc/sgx.rs b/library/std/src/sys/alloc/sgx.rs index fca9d087e5b..f5c27688fbc 100644 --- a/library/std/src/sys/alloc/sgx.rs +++ b/library/std/src/sys/alloc/sgx.rs @@ -11,7 +11,7 @@ use crate::sys::pal::waitqueue::SpinMutex; // in the rust-lang/rust repository as a submodule. The crate is a port of // dlmalloc.c from C to Rust. #[cfg_attr(test, linkage = "available_externally")] -#[export_name = "_ZN16__rust_internals3std3sys3sgx5alloc8DLMALLOCE"] +#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx5alloc8DLMALLOCE")] static DLMALLOC: SpinMutex<dlmalloc::Dlmalloc<Sgx>> = SpinMutex::new(dlmalloc::Dlmalloc::new_with_allocator(Sgx {})); @@ -85,13 +85,13 @@ unsafe impl GlobalAlloc for System { // The following functions are needed by libunwind. These symbols are named // in pre-link args for the target specification, so keep that in sync. #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn __rust_c_alloc(size: usize, align: usize) -> *mut u8 { unsafe { crate::alloc::alloc(Layout::from_size_align_unchecked(size, align)) } } #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn __rust_c_dealloc(ptr: *mut u8, size: usize, align: usize) { unsafe { crate::alloc::dealloc(ptr, Layout::from_size_align_unchecked(size, align)) } } diff --git a/library/std/src/sys/alloc/xous.rs b/library/std/src/sys/alloc/xous.rs index 9d22e16fdf2..ccaa972c22d 100644 --- a/library/std/src/sys/alloc/xous.rs +++ b/library/std/src/sys/alloc/xous.rs @@ -4,7 +4,7 @@ use crate::alloc::{GlobalAlloc, Layout, System}; #[cfg(not(test))] -#[export_name = "_ZN16__rust_internals3std3sys4xous5alloc8DLMALLOCE"] +#[unsafe(export_name = "_ZN16__rust_internals3std3sys4xous5alloc8DLMALLOCE")] static mut DLMALLOC: dlmalloc::Dlmalloc = dlmalloc::Dlmalloc::new(); #[cfg(test)] diff --git a/library/std/src/sys/cmath.rs b/library/std/src/sys/cmath.rs index e3f41f4fdbb..c9969b4e376 100644 --- a/library/std/src/sys/cmath.rs +++ b/library/std/src/sys/cmath.rs @@ -28,6 +28,10 @@ unsafe extern "C" { pub fn lgamma_r(n: f64, s: &mut i32) -> f64; #[cfg(not(target_os = "aix"))] pub fn lgammaf_r(n: f32, s: &mut i32) -> f32; + pub fn erf(n: f64) -> f64; + pub fn erff(n: f32) -> f32; + pub fn erfc(n: f64) -> f64; + pub fn erfcf(n: f32) -> f32; pub fn acosf128(n: f128) -> f128; pub fn asinf128(n: f128) -> f128; @@ -43,6 +47,8 @@ unsafe extern "C" { pub fn tanhf128(n: f128) -> f128; pub fn tgammaf128(n: f128) -> f128; pub fn lgammaf128_r(n: f128, s: &mut i32) -> f128; + pub fn erff128(n: f128) -> f128; + pub fn erfcf128(n: f128) -> f128; cfg_if::cfg_if! { if #[cfg(not(all(target_os = "windows", target_env = "msvc", target_arch = "x86")))] { diff --git a/library/std/src/sys/net/connection/xous/dns.rs b/library/std/src/sys/net/connection/xous/dns.rs index ff6e49ed2d4..bb29d211fad 100644 --- a/library/std/src/sys/net/connection/xous/dns.rs +++ b/library/std/src/sys/net/connection/xous/dns.rs @@ -123,6 +123,6 @@ impl TryFrom<(&str, u16)> for LookupHost { type Error = io::Error; fn try_from(v: (&str, u16)) -> io::Result<LookupHost> { - lookup(v.0, v.1).map_err(|_e| io::const_error!(io::ErrorKind::InvalidInput, &"DNS failure")) + lookup(v.0, v.1).map_err(|_e| io::const_error!(io::ErrorKind::InvalidInput, "DNS failure")) } } diff --git a/library/std/src/sys/net/connection/xous/tcplistener.rs b/library/std/src/sys/net/connection/xous/tcplistener.rs index 640a02a64f5..851d2eb8178 100644 --- a/library/std/src/sys/net/connection/xous/tcplistener.rs +++ b/library/std/src/sys/net/connection/xous/tcplistener.rs @@ -11,7 +11,7 @@ macro_rules! unimpl { () => { return Err(io::const_error!( io::ErrorKind::Unsupported, - &"This function is not yet implemented", + "This function is not yet implemented", )); }; } @@ -71,7 +71,7 @@ impl TcpListener { 0, 4096, ) else { - return Err(io::const_error!(io::ErrorKind::InvalidInput, &"Invalid response")); + return Err(io::const_error!(io::ErrorKind::InvalidInput, "Invalid response")); }; // The first four bytes should be zero upon success, and will be nonzero @@ -80,15 +80,15 @@ impl TcpListener { if response[0] != 0 || valid == 0 { let errcode = response[1]; if errcode == NetError::SocketInUse as u8 { - return Err(io::const_error!(io::ErrorKind::ResourceBusy, &"Socket in use")); + return Err(io::const_error!(io::ErrorKind::ResourceBusy, "Socket in use")); } else if errcode == NetError::Invalid as u8 { - return Err(io::const_error!(io::ErrorKind::AddrNotAvailable, &"Invalid address")); + return Err(io::const_error!(io::ErrorKind::AddrNotAvailable, "Invalid address")); } else if errcode == NetError::LibraryError as u8 { - return Err(io::const_error!(io::ErrorKind::Other, &"Library error")); + return Err(io::const_error!(io::ErrorKind::Other, "Library error")); } else { return Err(io::const_error!( io::ErrorKind::Other, - &"Unable to connect or internal error" + "Unable to connect or internal error", )); } } @@ -127,15 +127,13 @@ impl TcpListener { if receive_request.raw[0] != 0 { // error case if receive_request.raw[1] == NetError::TimedOut as u8 { - return Err(io::const_error!(io::ErrorKind::TimedOut, &"accept timed out",)); + return Err(io::const_error!(io::ErrorKind::TimedOut, "accept timed out")); } else if receive_request.raw[1] == NetError::WouldBlock as u8 { - return Err( - io::const_error!(io::ErrorKind::WouldBlock, &"accept would block",), - ); + return Err(io::const_error!(io::ErrorKind::WouldBlock, "accept would block")); } else if receive_request.raw[1] == NetError::LibraryError as u8 { - return Err(io::const_error!(io::ErrorKind::Other, &"Library error")); + return Err(io::const_error!(io::ErrorKind::Other, "Library error")); } else { - return Err(io::const_error!(io::ErrorKind::Other, &"library error",)); + return Err(io::const_error!(io::ErrorKind::Other, "library error")); } } else { // accept successful @@ -159,7 +157,7 @@ impl TcpListener { port, ) } else { - return Err(io::const_error!(io::ErrorKind::Other, &"library error",)); + return Err(io::const_error!(io::ErrorKind::Other, "library error")); }; // replenish the listener @@ -171,7 +169,7 @@ impl TcpListener { Ok((TcpStream::from_listener(stream_fd, self.local.port(), port, addr), addr)) } } else { - Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unable to accept")) + Err(io::const_error!(io::ErrorKind::InvalidInput, "Unable to accept")) } } @@ -182,13 +180,13 @@ impl TcpListener { pub fn set_ttl(&self, ttl: u32) -> io::Result<()> { if ttl > 255 { - return Err(io::Error::new(io::ErrorKind::InvalidInput, "TTL must be less than 256")); + return Err(io::const_error!(io::ErrorKind::InvalidInput, "TTL must be less than 256")); } crate::os::xous::ffi::blocking_scalar( services::net_server(), services::NetBlockingScalar::StdSetTtlTcp(self.fd.load(Ordering::Relaxed), ttl).into(), ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value"))) + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value"))) .map(|_| ()) } @@ -197,7 +195,7 @@ impl TcpListener { services::net_server(), services::NetBlockingScalar::StdGetTtlTcp(self.fd.load(Ordering::Relaxed)).into(), ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value"))) + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value"))) .map(|res| res[0] as _)?) } diff --git a/library/std/src/sys/net/connection/xous/tcpstream.rs b/library/std/src/sys/net/connection/xous/tcpstream.rs index 572dd6b3b63..7f7bbfb7fed 100644 --- a/library/std/src/sys/net/connection/xous/tcpstream.rs +++ b/library/std/src/sys/net/connection/xous/tcpstream.rs @@ -12,7 +12,7 @@ macro_rules! unimpl { () => { return Err(io::const_error!( io::ErrorKind::Unsupported, - &"This function is not yet implemented", + "This function is not yet implemented", )); }; } @@ -96,7 +96,7 @@ impl TcpStream { 0, 4096, ) else { - return Err(io::const_error!(io::ErrorKind::InvalidInput, &"Invalid response")); + return Err(io::const_error!(io::ErrorKind::InvalidInput, "Invalid response")); }; // The first four bytes should be zero upon success, and will be nonzero @@ -106,13 +106,13 @@ impl TcpStream { // errcode is a u8 but stuck in a u16 where the upper byte is invalid. Mask & decode accordingly. let errcode = response[0]; if errcode == NetError::SocketInUse as u8 { - return Err(io::const_error!(io::ErrorKind::ResourceBusy, &"Socket in use",)); + return Err(io::const_error!(io::ErrorKind::ResourceBusy, "Socket in use")); } else if errcode == NetError::Unaddressable as u8 { - return Err(io::const_error!(io::ErrorKind::AddrNotAvailable, &"Invalid address",)); + return Err(io::const_error!(io::ErrorKind::AddrNotAvailable, "Invalid address")); } else { return Err(io::const_error!( io::ErrorKind::InvalidInput, - &"Unable to connect or internal error", + "Unable to connect or internal error", )); } } @@ -198,7 +198,7 @@ impl TcpStream { ) else { return Err(io::const_error!( io::ErrorKind::InvalidInput, - &"Library failure: wrong message type or messaging error" + "Library failure: wrong message type or messaging error", )); }; @@ -212,14 +212,14 @@ impl TcpStream { if result[0] != 0 { if result[1] == 8 { // timed out - return Err(io::const_error!(io::ErrorKind::TimedOut, &"Timeout",)); + return Err(io::const_error!(io::ErrorKind::TimedOut, "Timeout")); } if result[1] == 9 { // would block - return Err(io::const_error!(io::ErrorKind::WouldBlock, &"Would block",)); + return Err(io::const_error!(io::ErrorKind::WouldBlock, "Would block")); } } - Err(io::const_error!(io::ErrorKind::Other, &"recv_slice failure")) + Err(io::const_error!(io::ErrorKind::Other, "recv_slice failure")) } } @@ -258,20 +258,20 @@ impl TcpStream { self.write_timeout.load(Ordering::Relaxed) as usize, buf_len, ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Internal error")))?; + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Internal error")))?; if send_request.raw[0] != 0 { if send_request.raw[4] == 8 { // timed out return Err(io::const_error!( io::ErrorKind::BrokenPipe, - &"Timeout or connection closed", + "Timeout or connection closed", )); } else if send_request.raw[4] == 9 { // would block - return Err(io::const_error!(io::ErrorKind::WouldBlock, &"Would block",)); + return Err(io::const_error!(io::ErrorKind::WouldBlock, "Would block")); } else { - return Err(io::const_error!(io::ErrorKind::InvalidInput, &"Error when sending",)); + return Err(io::const_error!(io::ErrorKind::InvalidInput, "Error when sending")); } } Ok(u32::from_le_bytes([ @@ -304,7 +304,7 @@ impl TcpStream { 0, 0, ) else { - return Err(io::const_error!(io::ErrorKind::InvalidInput, &"Internal error")); + return Err(io::const_error!(io::ErrorKind::InvalidInput, "Internal error")); }; let mut i = get_addr.raw.iter(); match *i.next().unwrap() { @@ -324,7 +324,7 @@ impl TcpStream { } Ok(SocketAddr::V6(SocketAddrV6::new(new_addr.into(), self.local_port, 0, 0))) } - _ => Err(io::const_error!(io::ErrorKind::InvalidInput, &"Internal error")), + _ => Err(io::const_error!(io::ErrorKind::InvalidInput, "Internal error")), } } @@ -333,7 +333,7 @@ impl TcpStream { services::net_server(), services::NetBlockingScalar::StdTcpStreamShutdown(self.fd, how).into(), ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value"))) + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value"))) .map(|_| ()) } @@ -355,7 +355,7 @@ impl TcpStream { services::net_server(), services::NetBlockingScalar::StdSetNodelay(self.fd, enabled).into(), ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value"))) + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value"))) .map(|_| ()) } @@ -364,19 +364,19 @@ impl TcpStream { services::net_server(), services::NetBlockingScalar::StdGetNodelay(self.fd).into(), ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value"))) + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value"))) .map(|res| res[0] != 0)?) } pub fn set_ttl(&self, ttl: u32) -> io::Result<()> { if ttl > 255 { - return Err(io::Error::new(io::ErrorKind::InvalidInput, "TTL must be less than 256")); + return Err(io::const_error!(io::ErrorKind::InvalidInput, "TTL must be less than 256")); } crate::os::xous::ffi::blocking_scalar( services::net_server(), services::NetBlockingScalar::StdSetTtlTcp(self.fd, ttl).into(), ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value"))) + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value"))) .map(|_| ()) } @@ -385,7 +385,7 @@ impl TcpStream { services::net_server(), services::NetBlockingScalar::StdGetTtlTcp(self.fd).into(), ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value"))) + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value"))) .map(|res| res[0] as _)?) } diff --git a/library/std/src/sys/net/connection/xous/udp.rs b/library/std/src/sys/net/connection/xous/udp.rs index 1b7ecac6d3a..ab5bd357b61 100644 --- a/library/std/src/sys/net/connection/xous/udp.rs +++ b/library/std/src/sys/net/connection/xous/udp.rs @@ -13,7 +13,7 @@ macro_rules! unimpl { () => { return Err(io::const_error!( io::ErrorKind::Unsupported, - &"This function is not yet implemented", + "This function is not yet implemented", )); }; } @@ -72,18 +72,18 @@ impl UdpSocket { if response[0] != 0 || valid == 0 { let errcode = response[1]; if errcode == NetError::SocketInUse as u8 { - return Err(io::const_error!(io::ErrorKind::ResourceBusy, &"Socket in use")); + return Err(io::const_error!(io::ErrorKind::ResourceBusy, "Socket in use")); } else if errcode == NetError::Invalid as u8 { return Err(io::const_error!( io::ErrorKind::InvalidInput, - &"Port can't be 0 or invalid address" + "Port can't be 0 or invalid address", )); } else if errcode == NetError::LibraryError as u8 { - return Err(io::const_error!(io::ErrorKind::Other, &"Library error")); + return Err(io::const_error!(io::ErrorKind::Other, "Library error")); } else { return Err(io::const_error!( io::ErrorKind::Other, - &"Unable to connect or internal error" + "Unable to connect or internal error", )); } } @@ -98,13 +98,13 @@ impl UdpSocket { nonblocking: Cell::new(false), }); } - Err(io::const_error!(io::ErrorKind::InvalidInput, &"Invalid response")) + Err(io::const_error!(io::ErrorKind::InvalidInput, "Invalid response")) } pub fn peer_addr(&self) -> io::Result<SocketAddr> { match self.remote.get() { Some(dest) => Ok(dest), - None => Err(io::const_error!(io::ErrorKind::NotConnected, &"No peer specified")), + None => Err(io::const_error!(io::ErrorKind::NotConnected, "No peer specified")), } } @@ -141,13 +141,13 @@ impl UdpSocket { if receive_request.raw[0] != 0 { // error case if receive_request.raw[1] == NetError::TimedOut as u8 { - return Err(io::const_error!(io::ErrorKind::TimedOut, &"recv timed out",)); + return Err(io::const_error!(io::ErrorKind::TimedOut, "recv timed out")); } else if receive_request.raw[1] == NetError::WouldBlock as u8 { - return Err(io::const_error!(io::ErrorKind::WouldBlock, &"recv would block",)); + return Err(io::const_error!(io::ErrorKind::WouldBlock, "recv would block")); } else if receive_request.raw[1] == NetError::LibraryError as u8 { - return Err(io::const_error!(io::ErrorKind::Other, &"Library error")); + return Err(io::const_error!(io::ErrorKind::Other, "Library error")); } else { - return Err(io::const_error!(io::ErrorKind::Other, &"library error",)); + return Err(io::const_error!(io::ErrorKind::Other, "library error")); } } else { let rr = &receive_request.raw; @@ -170,7 +170,7 @@ impl UdpSocket { port, ) } else { - return Err(io::const_error!(io::ErrorKind::Other, &"library error",)); + return Err(io::const_error!(io::ErrorKind::Other, "library error")); }; for (&s, d) in rr[22..22 + rxlen as usize].iter().zip(buf.iter_mut()) { *d = s; @@ -178,7 +178,7 @@ impl UdpSocket { Ok((rxlen as usize, addr)) } } else { - Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unable to recv")) + Err(io::const_error!(io::ErrorKind::InvalidInput, "Unable to recv")) } } @@ -208,7 +208,7 @@ impl UdpSocket { if let Some(addr) = self.remote.get() { self.send_to(buf, &addr) } else { - Err(io::const_error!(io::ErrorKind::NotConnected, &"No remote specified")) + Err(io::const_error!(io::ErrorKind::NotConnected, "No remote specified")) } } @@ -281,19 +281,19 @@ impl UdpSocket { if errcode == NetError::SocketInUse as u8 { return Err(io::const_error!( io::ErrorKind::ResourceBusy, - &"Socket in use" + "Socket in use", )); } else if errcode == NetError::Invalid as u8 { return Err(io::const_error!( io::ErrorKind::InvalidInput, - &"Socket not valid" + "Socket not valid", )); } else if errcode == NetError::LibraryError as u8 { - return Err(io::const_error!(io::ErrorKind::Other, &"Library error")); + return Err(io::const_error!(io::ErrorKind::Other, "Library error")); } else { return Err(io::const_error!( io::ErrorKind::Other, - &"Unable to connect" + "Unable to connect", )); } } else { @@ -303,16 +303,13 @@ impl UdpSocket { } Err(crate::os::xous::ffi::Error::ServerQueueFull) => { if now.elapsed() >= write_timeout { - return Err(io::const_error!( - io::ErrorKind::WouldBlock, - &"Write timed out" - )); + return Err(io::const_error!(io::ErrorKind::WouldBlock, "Write timed out")); } else { // question: do we want to do something a bit more gentle than immediately retrying? crate::thread::yield_now(); } } - _ => return Err(io::const_error!(io::ErrorKind::Other, &"Library error")), + _ => return Err(io::const_error!(io::ErrorKind::Other, "Library error")), } } } @@ -360,13 +357,13 @@ impl UdpSocket { pub fn set_ttl(&self, ttl: u32) -> io::Result<()> { if ttl > 255 { - return Err(io::Error::new(io::ErrorKind::InvalidInput, "TTL must be less than 256")); + return Err(io::const_error!(io::ErrorKind::InvalidInput, "TTL must be less than 256")); } crate::os::xous::ffi::blocking_scalar( services::net_server(), services::NetBlockingScalar::StdSetTtlUdp(self.fd, ttl).into(), ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value"))) + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value"))) .map(|_| ()) } @@ -375,7 +372,7 @@ impl UdpSocket { services::net_server(), services::NetBlockingScalar::StdGetTtlUdp(self.fd).into(), ) - .or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value"))) + .or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value"))) .map(|res| res[0] as _)?) } @@ -441,7 +438,7 @@ impl UdpSocket { impl fmt::Debug for UdpSocket { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "UDP listening on {:?} to {:?}", self.local, self.remote.get(),) + write!(f, "UDP listening on {:?} to {:?}", self.local, self.remote.get()) } } diff --git a/library/std/src/sys/pal/hermit/fs.rs b/library/std/src/sys/pal/hermit/fs.rs index 783623552bb..7bc36717f34 100644 --- a/library/std/src/sys/pal/hermit/fs.rs +++ b/library/std/src/sys/pal/hermit/fs.rs @@ -304,16 +304,12 @@ impl OpenOptions { (true, false) => {} (false, false) => { if self.truncate || self.create || self.create_new { - return Err( - io::const_error!(ErrorKind::InvalidInput, "invalid creation mode",), - ); + return Err(io::const_error!(ErrorKind::InvalidInput, "invalid creation mode")); } } (_, true) => { if self.truncate && !self.create_new { - return Err( - io::const_error!(ErrorKind::InvalidInput, "invalid creation mode",), - ); + return Err(io::const_error!(ErrorKind::InvalidInput, "invalid creation mode")); } } } diff --git a/library/std/src/sys/pal/hermit/mod.rs b/library/std/src/sys/pal/hermit/mod.rs index a746b853cbd..21cbac643bb 100644 --- a/library/std/src/sys/pal/hermit/mod.rs +++ b/library/std/src/sys/pal/hermit/mod.rs @@ -53,7 +53,7 @@ pub fn abort_internal() -> ! { // This function is needed by the panic runtime. The symbol is named in // pre-link args for the target specification, so keep that in sync. #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] // NB. used by both libunwind and libpanic_abort pub extern "C" fn __rust_abort() { abort_internal(); @@ -72,7 +72,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) { pub unsafe fn cleanup() {} #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn runtime_entry( argc: i32, argv: *const *const c_char, diff --git a/library/std/src/sys/pal/sgx/abi/mod.rs b/library/std/src/sys/pal/sgx/abi/mod.rs index f52acc41509..90981bd6a6a 100644 --- a/library/std/src/sys/pal/sgx/abi/mod.rs +++ b/library/std/src/sys/pal/sgx/abi/mod.rs @@ -23,7 +23,7 @@ global_asm!(include_str!("entry.S"), options(att_syntax)); struct EntryReturn(u64, u64); #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] unsafe extern "C" fn tcs_init(secondary: bool) { // Be very careful when changing this code: it runs before the binary has been // relocated. Any indirect accesses to symbols will likely fail. @@ -60,7 +60,7 @@ unsafe extern "C" fn tcs_init(secondary: bool) { // (main function exists). If this is a library, the crate author should be // able to specify this #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] extern "C" fn entry(p1: u64, p2: u64, p3: u64, secondary: bool, p4: u64, p5: u64) -> EntryReturn { // FIXME: how to support TLS in library mode? let tls = Box::new(tls::Tls::new()); @@ -103,7 +103,7 @@ pub(super) fn exit_with_code(code: isize) -> ! { } #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] extern "C" fn abort_reentry() -> ! { usercalls::exit(false) } diff --git a/library/std/src/sys/pal/sgx/abi/tls/mod.rs b/library/std/src/sys/pal/sgx/abi/tls/mod.rs index 7131797003b..8e2b271f1c9 100644 --- a/library/std/src/sys/pal/sgx/abi/tls/mod.rs +++ b/library/std/src/sys/pal/sgx/abi/tls/mod.rs @@ -12,14 +12,14 @@ const TLS_KEYS: usize = 128; // Same as POSIX minimum const TLS_KEYS_BITSET_SIZE: usize = (TLS_KEYS + (USIZE_BITS - 1)) / USIZE_BITS; #[cfg_attr(test, linkage = "available_externally")] -#[export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_KEY_IN_USEE"] +#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_KEY_IN_USEE")] static TLS_KEY_IN_USE: SyncBitset = SYNC_BITSET_INIT; macro_rules! dup { ((* $($exp:tt)*) $($val:tt)*) => (dup!( ($($exp)*) $($val)* $($val)* )); (() $($val:tt)*) => ([$($val),*]) } #[cfg_attr(test, linkage = "available_externally")] -#[export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_DESTRUCTORE"] +#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_DESTRUCTORE")] static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = dup!((* * * * * * *) (AtomicUsize::new(0))); unsafe extern "C" { diff --git a/library/std/src/sys/pal/sgx/args.rs b/library/std/src/sys/pal/sgx/args.rs index a72a041da6c..e62bf383954 100644 --- a/library/std/src/sys/pal/sgx/args.rs +++ b/library/std/src/sys/pal/sgx/args.rs @@ -7,7 +7,7 @@ use crate::sys_common::FromInner; use crate::{fmt, slice}; #[cfg_attr(test, linkage = "available_externally")] -#[export_name = "_ZN16__rust_internals3std3sys3sgx4args4ARGSE"] +#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx4args4ARGSE")] static ARGS: AtomicUsize = AtomicUsize::new(0); type ArgsStore = Vec<OsString>; diff --git a/library/std/src/sys/pal/sgx/libunwind_integration.rs b/library/std/src/sys/pal/sgx/libunwind_integration.rs index debfd324c86..6d0d78d1eb9 100644 --- a/library/std/src/sys/pal/sgx/libunwind_integration.rs +++ b/library/std/src/sys/pal/sgx/libunwind_integration.rs @@ -15,7 +15,7 @@ const _: () = unsafe { const EINVAL: i32 = 22; -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn __rust_rwlock_rdlock(p: *mut RwLock) -> i32 { if p.is_null() { return EINVAL; @@ -27,7 +27,7 @@ pub unsafe extern "C" fn __rust_rwlock_rdlock(p: *mut RwLock) -> i32 { return 0; } -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn __rust_rwlock_wrlock(p: *mut RwLock) -> i32 { if p.is_null() { return EINVAL; @@ -36,7 +36,7 @@ pub unsafe extern "C" fn __rust_rwlock_wrlock(p: *mut RwLock) -> i32 { return 0; } -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn __rust_rwlock_unlock(p: *mut RwLock) -> i32 { if p.is_null() { return EINVAL; diff --git a/library/std/src/sys/pal/sgx/mod.rs b/library/std/src/sys/pal/sgx/mod.rs index 9a04fa4b97e..37ca6b08c95 100644 --- a/library/std/src/sys/pal/sgx/mod.rs +++ b/library/std/src/sys/pal/sgx/mod.rs @@ -123,7 +123,7 @@ pub fn abort_internal() -> ! { // This function is needed by the panic runtime. The symbol is named in // pre-link args for the target specification, so keep that in sync. #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] // NB. used by both libunwind and libpanic_abort pub extern "C" fn __rust_abort() { abort_internal(); diff --git a/library/std/src/sys/pal/sgx/os.rs b/library/std/src/sys/pal/sgx/os.rs index 46af710aa39..b1ec2afd764 100644 --- a/library/std/src/sys/pal/sgx/os.rs +++ b/library/std/src/sys/pal/sgx/os.rs @@ -74,10 +74,10 @@ pub fn current_exe() -> io::Result<PathBuf> { } #[cfg_attr(test, linkage = "available_externally")] -#[export_name = "_ZN16__rust_internals3std3sys3sgx2os3ENVE"] +#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx2os3ENVE")] static ENV: AtomicUsize = AtomicUsize::new(0); #[cfg_attr(test, linkage = "available_externally")] -#[export_name = "_ZN16__rust_internals3std3sys3sgx2os8ENV_INITE"] +#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx2os8ENV_INITE")] static ENV_INIT: Once = Once::new(); type EnvStore = Mutex<HashMap<OsString, OsString>>; diff --git a/library/std/src/sys/pal/sgx/stdio.rs b/library/std/src/sys/pal/sgx/stdio.rs index e79a3d971c6..726a93acae4 100644 --- a/library/std/src/sys/pal/sgx/stdio.rs +++ b/library/std/src/sys/pal/sgx/stdio.rs @@ -76,7 +76,7 @@ pub fn panic_output() -> Option<impl io::Write> { // This function is needed by libunwind. The symbol is named in pre-link args // for the target specification, so keep that in sync. #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn __rust_print_err(m: *mut u8, s: i32) { if s < 0 { return; diff --git a/library/std/src/sys/pal/sgx/thread.rs b/library/std/src/sys/pal/sgx/thread.rs index cecd53c352c..b6932df431f 100644 --- a/library/std/src/sys/pal/sgx/thread.rs +++ b/library/std/src/sys/pal/sgx/thread.rs @@ -46,7 +46,7 @@ mod task_queue { } #[cfg_attr(test, linkage = "available_externally")] - #[export_name = "_ZN16__rust_internals3std3sys3sgx6thread10TASK_QUEUEE"] + #[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx6thread10TASK_QUEUEE")] static TASK_QUEUE: Mutex<Vec<Task>> = Mutex::new(Vec::new()); pub(super) fn lock() -> MutexGuard<'static, Vec<Task>> { diff --git a/library/std/src/sys/pal/solid/fs.rs b/library/std/src/sys/pal/solid/fs.rs index fa2e470d6b6..c87a63fde89 100644 --- a/library/std/src/sys/pal/solid/fs.rs +++ b/library/std/src/sys/pal/solid/fs.rs @@ -22,12 +22,9 @@ struct FileDesc { impl FileDesc { #[inline] + #[track_caller] fn new(fd: c_int) -> FileDesc { - assert_ne!(fd, -1i32); - // Safety: we just asserted that the value is in the valid range and - // isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned) - let fd = unsafe { CIntNotMinusOne::new_unchecked(fd) }; - FileDesc { fd } + FileDesc { fd: CIntNotMinusOne::new(fd).expect("fd != -1") } } #[inline] @@ -312,7 +309,7 @@ fn cstr(path: &Path) -> io::Result<CString> { let wrapped_path = [SAFE_PREFIX, &path, &[0]].concat(); CString::from_vec_with_nul(wrapped_path).map_err(|_| { - crate::io::const_error!(io::ErrorKind::InvalidInput, "path provided contains a nul byte",) + crate::io::const_error!(io::ErrorKind::InvalidInput, "path provided contains a nul byte") }) } diff --git a/library/std/src/sys/pal/teeos/mod.rs b/library/std/src/sys/pal/teeos/mod.rs index f850fefc8f2..3632524157d 100644 --- a/library/std/src/sys/pal/teeos/mod.rs +++ b/library/std/src/sys/pal/teeos/mod.rs @@ -148,5 +148,5 @@ pub fn unsupported<T>() -> std_io::Result<T> { } pub fn unsupported_err() -> std_io::Error { - std_io::Error::new(std_io::ErrorKind::Unsupported, "operation not supported on this platform") + std_io::Error::UNSUPPORTED_PLATFORM } diff --git a/library/std/src/sys/pal/teeos/os.rs b/library/std/src/sys/pal/teeos/os.rs index 82cade771b5..bf6945811ab 100644 --- a/library/std/src/sys/pal/teeos/os.rs +++ b/library/std/src/sys/pal/teeos/os.rs @@ -107,11 +107,11 @@ pub fn getenv(_: &OsStr) -> Option<OsString> { } pub unsafe fn setenv(_: &OsStr, _: &OsStr) -> io::Result<()> { - Err(io::Error::new(io::ErrorKind::Unsupported, "cannot set env vars on this platform")) + Err(io::const_error!(io::ErrorKind::Unsupported, "cannot set env vars on this platform")) } pub unsafe fn unsetenv(_: &OsStr) -> io::Result<()> { - Err(io::Error::new(io::ErrorKind::Unsupported, "cannot unset env vars on this platform")) + Err(io::const_error!(io::ErrorKind::Unsupported, "cannot unset env vars on this platform")) } pub fn temp_dir() -> PathBuf { diff --git a/library/std/src/sys/pal/teeos/thread.rs b/library/std/src/sys/pal/teeos/thread.rs index c779c5f3ed8..e3b4908f858 100644 --- a/library/std/src/sys/pal/teeos/thread.rs +++ b/library/std/src/sys/pal/teeos/thread.rs @@ -56,7 +56,7 @@ impl Thread { } }; - let ret = libc::pthread_create(&mut native, &attr, thread_start, p as *mut _); + let ret = unsafe { libc::pthread_create(&mut native, &attr, thread_start, p as *mut _) }; // Note: if the thread creation fails and this assert fails, then p will // be leaked. However, an alternative design could cause double-free // which is clearly worse. diff --git a/library/std/src/sys/pal/uefi/helpers.rs b/library/std/src/sys/pal/uefi/helpers.rs index dccc137d6f5..ec2da4e4ee7 100644 --- a/library/std/src/sys/pal/uefi/helpers.rs +++ b/library/std/src/sys/pal/uefi/helpers.rs @@ -273,7 +273,7 @@ impl OwnedDevicePath { io::Result::Err(const_error!( io::ErrorKind::NotFound, - "DevicePathFromText Protocol not found" + "DevicePathFromText Protocol not found", )) } diff --git a/library/std/src/sys/pal/uefi/mod.rs b/library/std/src/sys/pal/uefi/mod.rs index 4766e2ef0a9..6a03e240c6b 100644 --- a/library/std/src/sys/pal/uefi/mod.rs +++ b/library/std/src/sys/pal/uefi/mod.rs @@ -90,7 +90,7 @@ pub const fn unsupported<T>() -> std_io::Result<T> { #[inline] pub const fn unsupported_err() -> std_io::Error { - std_io::const_error!(std_io::ErrorKind::Unsupported, "operation not supported on UEFI",) + std_io::const_error!(std_io::ErrorKind::Unsupported, "operation not supported on UEFI") } pub fn decode_error_kind(code: RawOsError) -> crate::io::ErrorKind { @@ -169,7 +169,7 @@ pub fn abort_internal() -> ! { // This function is needed by the panic runtime. The symbol is named in // pre-link args for the target specification, so keep that in sync. #[cfg(not(test))] -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn __rust_abort() { abort_internal(); } diff --git a/library/std/src/sys/pal/uefi/process.rs b/library/std/src/sys/pal/uefi/process.rs index 0757f1cb490..9efe9a314f2 100644 --- a/library/std/src/sys/pal/uefi/process.rs +++ b/library/std/src/sys/pal/uefi/process.rs @@ -154,8 +154,8 @@ impl Command { if let Some(e) = &env { for (k, (_, v)) in e { match v { - Some(v) => crate::env::set_var(k, v), - None => crate::env::remove_var(k), + Some(v) => unsafe { crate::env::set_var(k, v) }, + None => unsafe { crate::env::remove_var(k) }, } } } @@ -166,8 +166,8 @@ impl Command { if let Some(e) = env { for (k, (v, _)) in e { match v { - Some(v) => crate::env::set_var(k, v), - None => crate::env::remove_var(k), + Some(v) => unsafe { crate::env::set_var(k, v) }, + None => unsafe { crate::env::remove_var(k) }, } } } diff --git a/library/std/src/sys/pal/uefi/stdio.rs b/library/std/src/sys/pal/uefi/stdio.rs index 703e8ba8e57..d049d19bc83 100644 --- a/library/std/src/sys/pal/uefi/stdio.rs +++ b/library/std/src/sys/pal/uefi/stdio.rs @@ -71,7 +71,7 @@ impl io::Read for Stdin { }; if ch.len() > 1 { - return Err(io::Error::new(io::ErrorKind::InvalidData, "invalid utf-16 sequence")); + return Err(io::const_error!(io::ErrorKind::InvalidData, "invalid utf-16 sequence")); } match ch.pop().unwrap() { diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs index 00cfa7a7fcf..16fb207298d 100644 --- a/library/std/src/sys/pal/unix/fs.rs +++ b/library/std/src/sys/pal/unix/fs.rs @@ -568,8 +568,7 @@ impl FileAttr { Err(io::const_error!( io::ErrorKind::Unsupported, - "creation time is not available on this platform \ - currently", + "creation time is not available on this platform currently", )) } @@ -1459,11 +1458,11 @@ impl File { Some(time) if let Some(ts) = time.t.to_timespec() => Ok(ts), Some(time) if time > crate::sys::time::UNIX_EPOCH => Err(io::const_error!( io::ErrorKind::InvalidInput, - "timestamp is too large to set as a file time" + "timestamp is too large to set as a file time", )), Some(_) => Err(io::const_error!( io::ErrorKind::InvalidInput, - "timestamp is too small to set as a file time" + "timestamp is too small to set as a file time", )), None => Ok(libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }), }; diff --git a/library/std/src/sys/pal/unix/linux/pidfd/tests.rs b/library/std/src/sys/pal/unix/linux/pidfd/tests.rs index fb928c76fbd..17b06bea912 100644 --- a/library/std/src/sys/pal/unix/linux/pidfd/tests.rs +++ b/library/std/src/sys/pal/unix/linux/pidfd/tests.rs @@ -45,8 +45,8 @@ fn test_command_pidfd() { .expect_err("pidfd should not have been created"); // exercise the fork/exec path since the earlier attempts may have used pidfd_spawnp() - let mut child = - unsafe { Command::new("false").pre_exec(|| Ok(())) }.create_pidfd(true).spawn().unwrap(); + let mut cmd = Command::new("false"); + let mut child = unsafe { cmd.pre_exec(|| Ok(())) }.create_pidfd(true).spawn().unwrap(); assert!(child.id() > 0 && child.id() < -1i32 as u32); diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs index 04199c56330..78404b4afa7 100644 --- a/library/std/src/sys/pal/unix/os.rs +++ b/library/std/src/sys/pal/unix/os.rs @@ -260,7 +260,7 @@ pub fn current_exe() -> io::Result<PathBuf> { let exe_path = env::args().next().ok_or(io::const_error!( ErrorKind::NotFound, - "an executable path was not found because no arguments were provided through argv" + "an executable path was not found because no arguments were provided through argv", ))?; let path = PathBuf::from(exe_path); if path.is_absolute() { @@ -382,9 +382,7 @@ pub fn current_exe() -> io::Result<PathBuf> { cvt(libc::sysctl(mib, 4, argv.as_mut_ptr() as *mut _, &mut argv_len, ptr::null_mut(), 0))?; argv.set_len(argv_len as usize); if argv[0].is_null() { - return Err( - io::const_error!(io::ErrorKind::Uncategorized, "no current exe available",), - ); + return Err(io::const_error!(io::ErrorKind::Uncategorized, "no current exe available")); } let argv0 = CStr::from_ptr(argv[0]).to_bytes(); if argv0[0] == b'.' || argv0.iter().any(|b| *b == b'/') { @@ -526,7 +524,7 @@ pub fn current_exe() -> io::Result<PathBuf> { let exe_path = env::args().next().ok_or(io::const_error!( ErrorKind::Uncategorized, - "an executable path was not found because no arguments were provided through argv" + "an executable path was not found because no arguments were provided through argv", ))?; let path = PathBuf::from(exe_path); diff --git a/library/std/src/sys/pal/unix/process/process_unix.rs b/library/std/src/sys/pal/unix/process/process_unix.rs index 2bff192a5bd..aa7406dd548 100644 --- a/library/std/src/sys/pal/unix/process/process_unix.rs +++ b/library/std/src/sys/pal/unix/process/process_unix.rs @@ -228,7 +228,7 @@ impl Command { let envp = self.capture_env(); if self.saw_nul() { - return io::const_error!(ErrorKind::InvalidInput, "nul byte found in provided data",); + return io::const_error!(ErrorKind::InvalidInput, "nul byte found in provided data"); } match self.setup_io(default, true) { @@ -1228,7 +1228,7 @@ mod linux_child_ext { .as_ref() // SAFETY: The os type is a transparent wrapper, therefore we can transmute references .map(|fd| unsafe { mem::transmute::<&imp::PidFd, &os::PidFd>(fd) }) - .ok_or_else(|| io::Error::new(ErrorKind::Uncategorized, "No pidfd was created.")) + .ok_or_else(|| io::const_error!(ErrorKind::Uncategorized, "No pidfd was created.")) } fn into_pidfd(mut self) -> Result<os::PidFd, Self> { diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index 479021af040..69c99782f0b 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -144,7 +144,7 @@ impl Thread { const TASK_COMM_LEN: usize = 16; let name = truncate_cstr::<{ TASK_COMM_LEN }>(name); } else { - // FreeBSD, DragonFly, FreeBSD and NuttX do not enforce length limits. + // FreeBSD, DragonFly BSD and NuttX do not enforce length limits. } }; // Available since glibc 2.12, musl 1.1.16, and uClibc 1.0.20 for Linux, diff --git a/library/std/src/sys/pal/wasi/fs.rs b/library/std/src/sys/pal/wasi/fs.rs index 7705e7f6b88..11002406d2b 100644 --- a/library/std/src/sys/pal/wasi/fs.rs +++ b/library/std/src/sys/pal/wasi/fs.rs @@ -183,7 +183,7 @@ impl Iterator for ReadDir { fn next(&mut self) -> Option<io::Result<DirEntry>> { match &mut self.state { - ReadDirState::FillBuffer { next_read_offset, ref mut buf } => { + ReadDirState::FillBuffer { next_read_offset, buf } => { let result = self.inner.dir.fd.readdir(buf, *next_read_offset); match result { Ok(read_bytes) => { @@ -207,7 +207,7 @@ impl Iterator for ReadDir { } } } - ReadDirState::ProcessEntry { ref mut buf, next_read_offset, offset } => { + ReadDirState::ProcessEntry { buf, next_read_offset, offset } => { let contents = &buf[*offset..]; const DIRENT_SIZE: usize = crate::mem::size_of::<wasi::Dirent>(); if contents.len() >= DIRENT_SIZE { @@ -533,7 +533,7 @@ impl File { Some(time) if let Some(ts) = time.to_wasi_timestamp() => Ok(ts), Some(_) => Err(io::const_error!( io::ErrorKind::InvalidInput, - "timestamp is too large to set as a file time" + "timestamp is too large to set as a file time", )), None => Ok(0), }; @@ -773,8 +773,7 @@ fn open_parent(p: &Path) -> io::Result<(ManuallyDrop<WasiFd>, PathBuf)> { } let msg = format!( "failed to find a pre-opened file descriptor \ - through which {:?} could be opened", - p + through which {p:?} could be opened", ); return Err(io::Error::new(io::ErrorKind::Uncategorized, msg)); } diff --git a/library/std/src/sys/pal/wasip2/cabi_realloc.rs b/library/std/src/sys/pal/wasip2/cabi_realloc.rs index 820063173d6..78adf9002fd 100644 --- a/library/std/src/sys/pal/wasip2/cabi_realloc.rs +++ b/library/std/src/sys/pal/wasip2/cabi_realloc.rs @@ -32,7 +32,7 @@ static FORCE_CODEGEN_OF_CABI_REALLOC: unsafe extern "C" fn( ) -> *mut u8 = cabi_realloc; #[linkage = "weak"] -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe extern "C" fn cabi_realloc( old_ptr: *mut u8, old_len: usize, diff --git a/library/std/src/sys/pal/windows/c/bindings.txt b/library/std/src/sys/pal/windows/c/bindings.txt index c06f274685c..e2c21633279 100644 --- a/library/std/src/sys/pal/windows/c/bindings.txt +++ b/library/std/src/sys/pal/windows/c/bindings.txt @@ -1,2611 +1,2612 @@ --out windows_sys.rs ---config flatten sys +--flat +--sys +--no-core --filter -!Windows.Win32.Foundation.INVALID_HANDLE_VALUE -Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED -Windows.Wdk.Storage.FileSystem.FILE_CONTAINS_EXTENDED_CREATE_INFORMATION -Windows.Wdk.Storage.FileSystem.FILE_CREATE -Windows.Wdk.Storage.FileSystem.FILE_CREATE_TREE_CONNECTION -Windows.Wdk.Storage.FileSystem.FILE_DELETE_ON_CLOSE -Windows.Wdk.Storage.FileSystem.FILE_DIRECTORY_FILE -Windows.Wdk.Storage.FileSystem.FILE_DISALLOW_EXCLUSIVE +!INVALID_HANDLE_VALUE +ABOVE_NORMAL_PRIORITY_CLASS +accept +AcquireSRWLockExclusive +AcquireSRWLockShared +ADDRESS_FAMILY +ADDRINFOA +AddVectoredExceptionHandler +AF_INET +AF_INET6 +AF_UNIX +AF_UNSPEC +ALL_PROCESSOR_GROUPS +ARM64_NT_NEON128 +BELOW_NORMAL_PRIORITY_CLASS +bind +BOOL +BY_HANDLE_FILE_INFORMATION +CALLBACK_CHUNK_FINISHED +CALLBACK_STREAM_SWITCH +CancelIo +CloseHandle +closesocket +COMPARESTRING_RESULT +CompareStringOrdinal +connect +CONSOLE_MODE +CONSOLE_READCONSOLE_CONTROL +CONTEXT +CopyFileExW +CP_UTF8 +CREATE_ALWAYS +CREATE_BREAKAWAY_FROM_JOB +CREATE_DEFAULT_ERROR_MODE +CREATE_FORCEDOS +CREATE_IGNORE_SYSTEM_DEFAULT +CREATE_NEW +CREATE_NEW_CONSOLE +CREATE_NEW_PROCESS_GROUP +CREATE_NO_WINDOW +CREATE_PRESERVE_CODE_AUTHZ_LEVEL +CREATE_PROTECTED_PROCESS +CREATE_SECURE_PROCESS +CREATE_SEPARATE_WOW_VDM +CREATE_SHARED_WOW_VDM +CREATE_SUSPENDED +CREATE_UNICODE_ENVIRONMENT +CREATE_WAITABLE_TIMER_HIGH_RESOLUTION +CREATE_WAITABLE_TIMER_MANUAL_RESET +CreateDirectoryW +CreateEventW +CreateFileW +CreateHardLinkW +CreateNamedPipeW +CreatePipe +CreateProcessW +CreateSymbolicLinkW +CreateThread +CreateWaitableTimerExW +CSTR_EQUAL +CSTR_GREATER_THAN +CSTR_LESS_THAN +DEBUG_ONLY_THIS_PROCESS +DEBUG_PROCESS +DELETE +DeleteFileW +DeleteProcThreadAttributeList +DETACHED_PROCESS +DeviceIoControl +DISABLE_NEWLINE_AUTO_RETURN +DLL_PROCESS_DETACH +DLL_THREAD_DETACH +DNS_ERROR_ADDRESS_REQUIRED +DNS_ERROR_ALIAS_LOOP +DNS_ERROR_AUTOZONE_ALREADY_EXISTS +DNS_ERROR_AXFR +DNS_ERROR_BACKGROUND_LOADING +DNS_ERROR_BAD_KEYMASTER +DNS_ERROR_BAD_PACKET +DNS_ERROR_CANNOT_FIND_ROOT_HINTS +DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS +DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST +DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED +DNS_ERROR_CNAME_COLLISION +DNS_ERROR_CNAME_LOOP +DNS_ERROR_DATAFILE_OPEN_FAILURE +DNS_ERROR_DATAFILE_PARSING +DNS_ERROR_DEFAULT_SCOPE +DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE +DNS_ERROR_DEFAULT_ZONESCOPE +DNS_ERROR_DELEGATION_REQUIRED +DNS_ERROR_DNAME_COLLISION +DNS_ERROR_DNSSEC_IS_DISABLED +DNS_ERROR_DP_ALREADY_ENLISTED +DNS_ERROR_DP_ALREADY_EXISTS +DNS_ERROR_DP_DOES_NOT_EXIST +DNS_ERROR_DP_FSMO_ERROR +DNS_ERROR_DP_NOT_AVAILABLE +DNS_ERROR_DP_NOT_ENLISTED +DNS_ERROR_DS_UNAVAILABLE +DNS_ERROR_DS_ZONE_ALREADY_EXISTS +DNS_ERROR_DWORD_VALUE_TOO_LARGE +DNS_ERROR_DWORD_VALUE_TOO_SMALL +DNS_ERROR_FILE_WRITEBACK_FAILED +DNS_ERROR_FORWARDER_ALREADY_EXISTS +DNS_ERROR_INCONSISTENT_ROOT_HINTS +DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME +DNS_ERROR_INVALID_CLIENT_SUBNET_NAME +DNS_ERROR_INVALID_DATA +DNS_ERROR_INVALID_DATAFILE_NAME +DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET +DNS_ERROR_INVALID_IP_ADDRESS +DNS_ERROR_INVALID_KEY_SIZE +DNS_ERROR_INVALID_NAME +DNS_ERROR_INVALID_NAME_CHAR +DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT +DNS_ERROR_INVALID_POLICY_TABLE +DNS_ERROR_INVALID_PROPERTY +DNS_ERROR_INVALID_ROLLOVER_PERIOD +DNS_ERROR_INVALID_SCOPE_NAME +DNS_ERROR_INVALID_SCOPE_OPERATION +DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD +DNS_ERROR_INVALID_TYPE +DNS_ERROR_INVALID_XML +DNS_ERROR_INVALID_ZONE_OPERATION +DNS_ERROR_INVALID_ZONE_TYPE +DNS_ERROR_INVALID_ZONESCOPE_NAME +DNS_ERROR_KEYMASTER_REQUIRED +DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION +DNS_ERROR_KSP_NOT_ACCESSIBLE +DNS_ERROR_LOAD_ZONESCOPE_FAILED +DNS_ERROR_NAME_DOES_NOT_EXIST +DNS_ERROR_NAME_NOT_IN_ZONE +DNS_ERROR_NBSTAT_INIT_FAILED +DNS_ERROR_NEED_SECONDARY_ADDRESSES +DNS_ERROR_NEED_WINS_SERVERS +DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE +DNS_ERROR_NO_CREATE_CACHE_DATA +DNS_ERROR_NO_DNS_SERVERS +DNS_ERROR_NO_MEMORY +DNS_ERROR_NO_PACKET +DNS_ERROR_NO_TCPIP +DNS_ERROR_NO_VALID_TRUST_ANCHORS +DNS_ERROR_NO_ZONE_INFO +DNS_ERROR_NODE_CREATION_FAILED +DNS_ERROR_NODE_IS_CNAME +DNS_ERROR_NODE_IS_DNAME +DNS_ERROR_NON_RFC_NAME +DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD +DNS_ERROR_NOT_ALLOWED_ON_RODC +DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER +DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE +DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE +DNS_ERROR_NOT_ALLOWED_ON_ZSK +DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION +DNS_ERROR_NOT_ALLOWED_UNDER_DNAME +DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES +DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS +DNS_ERROR_NOT_UNIQUE +DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1 +DNS_ERROR_NSEC3_NAME_COLLISION +DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1 +DNS_ERROR_NUMERIC_NAME +DNS_ERROR_POLICY_ALREADY_EXISTS +DNS_ERROR_POLICY_DOES_NOT_EXIST +DNS_ERROR_POLICY_INVALID_CRITERIA +DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET +DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN +DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE +DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL +DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE +DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY +DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL +DNS_ERROR_POLICY_INVALID_NAME +DNS_ERROR_POLICY_INVALID_SETTINGS +DNS_ERROR_POLICY_INVALID_WEIGHT +DNS_ERROR_POLICY_LOCKED +DNS_ERROR_POLICY_MISSING_CRITERIA +DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID +DNS_ERROR_POLICY_SCOPE_MISSING +DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED +DNS_ERROR_PRIMARY_REQUIRES_DATAFILE +DNS_ERROR_RCODE +DNS_ERROR_RCODE_BADKEY +DNS_ERROR_RCODE_BADSIG +DNS_ERROR_RCODE_BADTIME +DNS_ERROR_RCODE_FORMAT_ERROR +DNS_ERROR_RCODE_NAME_ERROR +DNS_ERROR_RCODE_NOT_IMPLEMENTED +DNS_ERROR_RCODE_NOTAUTH +DNS_ERROR_RCODE_NOTZONE +DNS_ERROR_RCODE_NXRRSET +DNS_ERROR_RCODE_REFUSED +DNS_ERROR_RCODE_SERVER_FAILURE +DNS_ERROR_RCODE_YXDOMAIN +DNS_ERROR_RCODE_YXRRSET +DNS_ERROR_RECORD_ALREADY_EXISTS +DNS_ERROR_RECORD_DOES_NOT_EXIST +DNS_ERROR_RECORD_FORMAT +DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT +DNS_ERROR_RECORD_TIMED_OUT +DNS_ERROR_ROLLOVER_ALREADY_QUEUED +DNS_ERROR_ROLLOVER_IN_PROGRESS +DNS_ERROR_ROLLOVER_NOT_POKEABLE +DNS_ERROR_RRL_INVALID_IPV4_PREFIX +DNS_ERROR_RRL_INVALID_IPV6_PREFIX +DNS_ERROR_RRL_INVALID_LEAK_RATE +DNS_ERROR_RRL_INVALID_TC_RATE +DNS_ERROR_RRL_INVALID_WINDOW_SIZE +DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE +DNS_ERROR_RRL_NOT_ENABLED +DNS_ERROR_SCOPE_ALREADY_EXISTS +DNS_ERROR_SCOPE_DOES_NOT_EXIST +DNS_ERROR_SCOPE_LOCKED +DNS_ERROR_SECONDARY_DATA +DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP +DNS_ERROR_SERVERSCOPE_IS_REFERENCED +DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE +DNS_ERROR_SOA_DELETE_INVALID +DNS_ERROR_STANDBY_KEY_NOT_PRESENT +DNS_ERROR_SUBNET_ALREADY_EXISTS +DNS_ERROR_SUBNET_DOES_NOT_EXIST +DNS_ERROR_TOO_MANY_SKDS +DNS_ERROR_TRY_AGAIN_LATER +DNS_ERROR_UNEXPECTED_CNG_ERROR +DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR +DNS_ERROR_UNKNOWN_RECORD_TYPE +DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION +DNS_ERROR_UNSECURE_PACKET +DNS_ERROR_UNSUPPORTED_ALGORITHM +DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS +DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST +DNS_ERROR_VIRTUALIZATION_TREE_LOCKED +DNS_ERROR_WINS_INIT_FAILED +DNS_ERROR_ZONE_ALREADY_EXISTS +DNS_ERROR_ZONE_CONFIGURATION_ERROR +DNS_ERROR_ZONE_CREATION_FAILED +DNS_ERROR_ZONE_DOES_NOT_EXIST +DNS_ERROR_ZONE_HAS_NO_NS_RECORDS +DNS_ERROR_ZONE_HAS_NO_SOA_RECORD +DNS_ERROR_ZONE_IS_SHUTDOWN +DNS_ERROR_ZONE_LOCKED +DNS_ERROR_ZONE_LOCKED_FOR_SIGNING +DNS_ERROR_ZONE_NOT_SECONDARY +DNS_ERROR_ZONE_REQUIRES_MASTER_IP +DNS_ERROR_ZONESCOPE_ALREADY_EXISTS +DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST +DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED +DNS_ERROR_ZONESCOPE_IS_REFERENCED +DUPLICATE_CLOSE_SOURCE +DUPLICATE_HANDLE_OPTIONS +DUPLICATE_SAME_ACCESS +DuplicateHandle +E_NOTIMPL +ENABLE_AUTO_POSITION +ENABLE_ECHO_INPUT +ENABLE_EXTENDED_FLAGS +ENABLE_INSERT_MODE +ENABLE_LINE_INPUT +ENABLE_LVB_GRID_WORLDWIDE +ENABLE_MOUSE_INPUT +ENABLE_PROCESSED_INPUT +ENABLE_PROCESSED_OUTPUT +ENABLE_QUICK_EDIT_MODE +ENABLE_VIRTUAL_TERMINAL_INPUT +ENABLE_VIRTUAL_TERMINAL_PROCESSING +ENABLE_WINDOW_INPUT +ENABLE_WRAP_AT_EOL_OUTPUT +ERROR_ABANDON_HIBERFILE +ERROR_ABANDONED_WAIT_0 +ERROR_ABANDONED_WAIT_63 +ERROR_ABIOS_ERROR +ERROR_ACCESS_AUDIT_BY_POLICY +ERROR_ACCESS_DENIED +ERROR_ACCESS_DENIED_APPDATA +ERROR_ACCESS_DISABLED_BY_POLICY +ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY +ERROR_ACCESS_DISABLED_WEBBLADE +ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER +ERROR_ACCOUNT_DISABLED +ERROR_ACCOUNT_EXPIRED +ERROR_ACCOUNT_LOCKED_OUT +ERROR_ACCOUNT_RESTRICTION +ERROR_ACPI_ERROR +ERROR_ACTIVE_CONNECTIONS +ERROR_ADAP_HDW_ERR +ERROR_ADDRESS_ALREADY_ASSOCIATED +ERROR_ADDRESS_NOT_ASSOCIATED +ERROR_ALERTED +ERROR_ALIAS_EXISTS +ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED +ERROR_ALLOCATE_BUCKET +ERROR_ALLOTTED_SPACE_EXCEEDED +ERROR_ALREADY_ASSIGNED +ERROR_ALREADY_EXISTS +ERROR_ALREADY_FIBER +ERROR_ALREADY_HAS_STREAM_ID +ERROR_ALREADY_INITIALIZED +ERROR_ALREADY_REGISTERED +ERROR_ALREADY_RUNNING_LKG +ERROR_ALREADY_THREAD +ERROR_ALREADY_WAITING +ERROR_ALREADY_WIN32 +ERROR_API_UNAVAILABLE +ERROR_APP_HANG +ERROR_APP_INIT_FAILURE +ERROR_APP_WRONG_OS +ERROR_APPCONTAINER_REQUIRED +ERROR_APPEXEC_APP_COMPAT_BLOCK +ERROR_APPEXEC_CALLER_WAIT_TIMEOUT +ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_LICENSING +ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_RESOURCES +ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_TERMINATION +ERROR_APPEXEC_CONDITION_NOT_SATISFIED +ERROR_APPEXEC_HANDLE_INVALIDATED +ERROR_APPEXEC_HOST_ID_MISMATCH +ERROR_APPEXEC_INVALID_HOST_GENERATION +ERROR_APPEXEC_INVALID_HOST_STATE +ERROR_APPEXEC_NO_DONOR +ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION +ERROR_APPEXEC_UNKNOWN_USER +ERROR_APPHELP_BLOCK +ERROR_APPX_FILE_NOT_ENCRYPTED +ERROR_ARBITRATION_UNHANDLED +ERROR_ARENA_TRASHED +ERROR_ARITHMETIC_OVERFLOW +ERROR_ASSERTION_FAILURE +ERROR_ATOMIC_LOCKS_NOT_SUPPORTED +ERROR_AUDIT_FAILED +ERROR_AUTHENTICATION_FIREWALL_FAILED +ERROR_AUTHIP_FAILURE +ERROR_AUTODATASEG_EXCEEDS_64k +ERROR_BACKUP_CONTROLLER +ERROR_BAD_ACCESSOR_FLAGS +ERROR_BAD_ARGUMENTS +ERROR_BAD_COMMAND +ERROR_BAD_COMPRESSION_BUFFER +ERROR_BAD_CONFIGURATION +ERROR_BAD_CURRENT_DIRECTORY +ERROR_BAD_DESCRIPTOR_FORMAT +ERROR_BAD_DEV_TYPE +ERROR_BAD_DEVICE +ERROR_BAD_DEVICE_PATH +ERROR_BAD_DLL_ENTRYPOINT +ERROR_BAD_DRIVER_LEVEL +ERROR_BAD_ENVIRONMENT +ERROR_BAD_EXE_FORMAT +ERROR_BAD_FILE_TYPE +ERROR_BAD_FORMAT +ERROR_BAD_FUNCTION_TABLE +ERROR_BAD_IMPERSONATION_LEVEL +ERROR_BAD_INHERITANCE_ACL +ERROR_BAD_LENGTH +ERROR_BAD_LOGON_SESSION_STATE +ERROR_BAD_MCFG_TABLE +ERROR_BAD_NET_NAME +ERROR_BAD_NET_RESP +ERROR_BAD_NETPATH +ERROR_BAD_PATHNAME +ERROR_BAD_PIPE +ERROR_BAD_PROFILE +ERROR_BAD_PROVIDER +ERROR_BAD_QUERY_SYNTAX +ERROR_BAD_RECOVERY_POLICY +ERROR_BAD_REM_ADAP +ERROR_BAD_SERVICE_ENTRYPOINT +ERROR_BAD_STACK +ERROR_BAD_THREADID_ADDR +ERROR_BAD_TOKEN_TYPE +ERROR_BAD_UNIT +ERROR_BAD_USER_PROFILE +ERROR_BAD_USERNAME +ERROR_BAD_VALIDATION_CLASS +ERROR_BADDB +ERROR_BADKEY +ERROR_BADSTARTPOSITION +ERROR_BEGINNING_OF_MEDIA +ERROR_BEYOND_VDL +ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT +ERROR_BLOCK_SHARED +ERROR_BLOCK_SOURCE_WEAK_REFERENCE_INVALID +ERROR_BLOCK_TARGET_WEAK_REFERENCE_INVALID +ERROR_BLOCK_TOO_MANY_REFERENCES +ERROR_BLOCK_WEAK_REFERENCE_INVALID +ERROR_BLOCKED_BY_PARENTAL_CONTROLS +ERROR_BOOT_ALREADY_ACCEPTED +ERROR_BROKEN_PIPE +ERROR_BUFFER_ALL_ZEROS +ERROR_BUFFER_OVERFLOW +ERROR_BUS_RESET +ERROR_BUSY +ERROR_BUSY_DRIVE +ERROR_BYPASSIO_FLT_NOT_SUPPORTED +ERROR_CACHE_PAGE_LOCKED +ERROR_CALL_NOT_IMPLEMENTED +ERROR_CALLBACK_INVOKE_INLINE +ERROR_CALLBACK_POP_STACK +ERROR_CALLBACK_SUPPLIED_INVALID_DATA +ERROR_CAN_NOT_COMPLETE +ERROR_CANCEL_VIOLATION +ERROR_CANCELLED +ERROR_CANNOT_BREAK_OPLOCK +ERROR_CANNOT_COPY +ERROR_CANNOT_DETECT_DRIVER_FAILURE +ERROR_CANNOT_DETECT_PROCESS_ABORT +ERROR_CANNOT_FIND_WND_CLASS +ERROR_CANNOT_GRANT_REQUESTED_OPLOCK +ERROR_CANNOT_IMPERSONATE +ERROR_CANNOT_LOAD_REGISTRY_FILE +ERROR_CANNOT_MAKE +ERROR_CANNOT_OPEN_PROFILE +ERROR_CANT_ACCESS_DOMAIN_INFO +ERROR_CANT_ACCESS_FILE +ERROR_CANT_CLEAR_ENCRYPTION_FLAG +ERROR_CANT_DISABLE_MANDATORY +ERROR_CANT_ENABLE_DENY_ONLY +ERROR_CANT_OPEN_ANONYMOUS +ERROR_CANT_RESOLVE_FILENAME +ERROR_CANT_TERMINATE_SELF +ERROR_CANT_WAIT +ERROR_CANTFETCHBACKWARDS +ERROR_CANTOPEN +ERROR_CANTREAD +ERROR_CANTSCROLLBACKWARDS +ERROR_CANTWRITE +ERROR_CAPAUTHZ_CHANGE_TYPE +ERROR_CAPAUTHZ_DB_CORRUPTED +ERROR_CAPAUTHZ_NO_POLICY +ERROR_CAPAUTHZ_NOT_AUTHORIZED +ERROR_CAPAUTHZ_NOT_DEVUNLOCKED +ERROR_CAPAUTHZ_NOT_PROVISIONED +ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED +ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG +ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY +ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH +ERROR_CAPAUTHZ_SCCD_PARSE_ERROR +ERROR_CARDBUS_NOT_SUPPORTED +ERROR_CASE_DIFFERING_NAMES_IN_DIR +ERROR_CASE_SENSITIVE_PATH +ERROR_CERTIFICATE_VALIDATION_PREFERENCE_CONFLICT +ERROR_CHECKING_FILE_SYSTEM +ERROR_CHECKOUT_REQUIRED +ERROR_CHILD_MUST_BE_VOLATILE +ERROR_CHILD_NOT_COMPLETE +ERROR_CHILD_PROCESS_BLOCKED +ERROR_CHILD_WINDOW_MENU +ERROR_CIMFS_IMAGE_CORRUPT +ERROR_CIMFS_IMAGE_VERSION_NOT_SUPPORTED +ERROR_CIRCULAR_DEPENDENCY +ERROR_CLASS_ALREADY_EXISTS +ERROR_CLASS_DOES_NOT_EXIST +ERROR_CLASS_HAS_WINDOWS +ERROR_CLIENT_SERVER_PARAMETERS_INVALID +ERROR_CLIPBOARD_NOT_OPEN +ERROR_CLOUD_FILE_ACCESS_DENIED +ERROR_CLOUD_FILE_ALREADY_CONNECTED +ERROR_CLOUD_FILE_AUTHENTICATION_FAILED +ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY +ERROR_CLOUD_FILE_DEHYDRATION_DISALLOWED +ERROR_CLOUD_FILE_IN_USE +ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS +ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES +ERROR_CLOUD_FILE_INVALID_REQUEST +ERROR_CLOUD_FILE_METADATA_CORRUPT +ERROR_CLOUD_FILE_METADATA_TOO_LARGE +ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE +ERROR_CLOUD_FILE_NOT_IN_SYNC +ERROR_CLOUD_FILE_NOT_SUPPORTED +ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT +ERROR_CLOUD_FILE_PINNED +ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH +ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE +ERROR_CLOUD_FILE_PROPERTY_CORRUPT +ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT +ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED +ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING +ERROR_CLOUD_FILE_PROVIDER_TERMINATED +ERROR_CLOUD_FILE_READ_ONLY_VOLUME +ERROR_CLOUD_FILE_REQUEST_ABORTED +ERROR_CLOUD_FILE_REQUEST_CANCELED +ERROR_CLOUD_FILE_REQUEST_TIMEOUT +ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT +ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS +ERROR_CLOUD_FILE_UNSUCCESSFUL +ERROR_CLOUD_FILE_US_MESSAGE_TIMEOUT +ERROR_CLOUD_FILE_VALIDATION_FAILED +ERROR_COMMITMENT_LIMIT +ERROR_COMMITMENT_MINIMUM +ERROR_COMPRESSED_FILE_NOT_SUPPORTED +ERROR_COMPRESSION_DISABLED +ERROR_COMPRESSION_NOT_BENEFICIAL +ERROR_CONNECTED_OTHER_PASSWORD +ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT +ERROR_CONNECTION_ABORTED +ERROR_CONNECTION_ACTIVE +ERROR_CONNECTION_COUNT_LIMIT +ERROR_CONNECTION_INVALID +ERROR_CONNECTION_REFUSED +ERROR_CONNECTION_UNAVAIL +ERROR_CONTAINER_ASSIGNED +ERROR_CONTENT_BLOCKED +ERROR_CONTEXT_EXPIRED +ERROR_CONTINUE +ERROR_CONTROL_C_EXIT +ERROR_CONTROL_ID_NOT_FOUND +ERROR_CONVERT_TO_LARGE +ERROR_CORRUPT_LOG_CLEARED +ERROR_CORRUPT_LOG_CORRUPTED +ERROR_CORRUPT_LOG_DELETED_FULL +ERROR_CORRUPT_LOG_OVERFULL +ERROR_CORRUPT_LOG_UNAVAILABLE +ERROR_CORRUPT_SYSTEM_FILE +ERROR_COULD_NOT_INTERPRET +ERROR_COUNTER_TIMEOUT +ERROR_CPU_SET_INVALID +ERROR_CRASH_DUMP +ERROR_CRC +ERROR_CREATE_FAILED +ERROR_CROSS_PARTITION_VIOLATION +ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE +ERROR_CS_ENCRYPTION_FILE_NOT_CSE +ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE +ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE +ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER +ERROR_CSCSHARE_OFFLINE +ERROR_CTX_CLIENT_QUERY_TIMEOUT +ERROR_CTX_MODEM_RESPONSE_TIMEOUT +ERROR_CURRENT_DIRECTORY +ERROR_CURRENT_DOMAIN_NOT_ALLOWED +ERROR_DATA_CHECKSUM_ERROR +ERROR_DATA_NOT_ACCEPTED +ERROR_DATABASE_DOES_NOT_EXIST +ERROR_DATATYPE_MISMATCH +ERROR_DAX_MAPPING_EXISTS +ERROR_DBG_COMMAND_EXCEPTION +ERROR_DBG_CONTINUE +ERROR_DBG_CONTROL_BREAK +ERROR_DBG_CONTROL_C +ERROR_DBG_EXCEPTION_HANDLED +ERROR_DBG_EXCEPTION_NOT_HANDLED +ERROR_DBG_PRINTEXCEPTION_C +ERROR_DBG_REPLY_LATER +ERROR_DBG_RIPEXCEPTION +ERROR_DBG_TERMINATE_PROCESS +ERROR_DBG_TERMINATE_THREAD +ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE +ERROR_DC_NOT_FOUND +ERROR_DDE_FAIL +ERROR_DEBUG_ATTACH_FAILED +ERROR_DEBUGGER_INACTIVE +ERROR_DECRYPTION_FAILED +ERROR_DELAY_LOAD_FAILED +ERROR_DELETE_PENDING +ERROR_DEPENDENT_SERVICES_RUNNING +ERROR_DESTINATION_ELEMENT_FULL +ERROR_DESTROY_OBJECT_OF_OTHER_THREAD +ERROR_DEV_NOT_EXIST +ERROR_DEVICE_ALREADY_ATTACHED +ERROR_DEVICE_ALREADY_REMEMBERED +ERROR_DEVICE_DOOR_OPEN +ERROR_DEVICE_ENUMERATION_ERROR +ERROR_DEVICE_FEATURE_NOT_SUPPORTED +ERROR_DEVICE_HARDWARE_ERROR +ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL +ERROR_DEVICE_IN_MAINTENANCE +ERROR_DEVICE_IN_USE +ERROR_DEVICE_NO_RESOURCES +ERROR_DEVICE_NOT_CONNECTED +ERROR_DEVICE_NOT_PARTITIONED +ERROR_DEVICE_REINITIALIZATION_NEEDED +ERROR_DEVICE_REMOVED +ERROR_DEVICE_REQUIRES_CLEANING +ERROR_DEVICE_RESET_REQUIRED +ERROR_DEVICE_SUPPORT_IN_PROGRESS +ERROR_DEVICE_UNREACHABLE +ERROR_DHCP_ADDRESS_CONFLICT +ERROR_DIFFERENT_SERVICE_ACCOUNT +ERROR_DIR_EFS_DISALLOWED +ERROR_DIR_NOT_EMPTY +ERROR_DIR_NOT_ROOT +ERROR_DIRECT_ACCESS_HANDLE +ERROR_DIRECTORY +ERROR_DIRECTORY_NOT_SUPPORTED +ERROR_DISCARDED +ERROR_DISK_CHANGE +ERROR_DISK_CORRUPT +ERROR_DISK_FULL +ERROR_DISK_OPERATION_FAILED +ERROR_DISK_QUOTA_EXCEEDED +ERROR_DISK_RECALIBRATE_FAILED +ERROR_DISK_REPAIR_DISABLED +ERROR_DISK_REPAIR_REDIRECTED +ERROR_DISK_REPAIR_UNSUCCESSFUL +ERROR_DISK_RESET_FAILED +ERROR_DISK_RESOURCES_EXHAUSTED +ERROR_DISK_TOO_FRAGMENTED +ERROR_DLL_INIT_FAILED +ERROR_DLL_INIT_FAILED_LOGOFF +ERROR_DLL_MIGHT_BE_INCOMPATIBLE +ERROR_DLL_MIGHT_BE_INSECURE +ERROR_DLL_NOT_FOUND +ERROR_DLP_POLICY_DENIES_OPERATION +ERROR_DLP_POLICY_SILENTLY_FAIL +ERROR_DLP_POLICY_WARNS_AGAINST_OPERATION +ERROR_DOMAIN_CONTROLLER_EXISTS +ERROR_DOMAIN_CONTROLLER_NOT_FOUND +ERROR_DOMAIN_CTRLR_CONFIG_ERROR +ERROR_DOMAIN_EXISTS +ERROR_DOMAIN_LIMIT_EXCEEDED +ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION +ERROR_DOMAIN_TRUST_INCONSISTENT +ERROR_DOWNGRADE_DETECTED +ERROR_DPL_NOT_SUPPORTED_FOR_USER +ERROR_DRIVE_LOCKED +ERROR_DRIVER_BLOCKED +ERROR_DRIVER_CANCEL_TIMEOUT +ERROR_DRIVER_DATABASE_ERROR +ERROR_DRIVER_FAILED_PRIOR_UNLOAD +ERROR_DRIVER_FAILED_SLEEP +ERROR_DRIVER_PROCESS_TERMINATED +ERROR_DRIVERS_LEAKING_LOCKED_PAGES +ERROR_DS_ADD_REPLICA_INHIBITED +ERROR_DS_ADMIN_LIMIT_EXCEEDED +ERROR_DS_AFFECTS_MULTIPLE_DSAS +ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER +ERROR_DS_ALIAS_DEREF_PROBLEM +ERROR_DS_ALIAS_POINTS_TO_ALIAS +ERROR_DS_ALIAS_PROBLEM +ERROR_DS_ALIASED_OBJ_MISSING +ERROR_DS_ATT_ALREADY_EXISTS +ERROR_DS_ATT_IS_NOT_ON_OBJ +ERROR_DS_ATT_NOT_DEF_FOR_CLASS +ERROR_DS_ATT_NOT_DEF_IN_SCHEMA +ERROR_DS_ATT_SCHEMA_REQ_ID +ERROR_DS_ATT_SCHEMA_REQ_SYNTAX +ERROR_DS_ATT_VAL_ALREADY_EXISTS +ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS +ERROR_DS_ATTRIBUTE_OWNED_BY_SAM +ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED +ERROR_DS_AUDIT_FAILURE +ERROR_DS_AUTH_METHOD_NOT_SUPPORTED +ERROR_DS_AUTH_UNKNOWN +ERROR_DS_AUTHORIZATION_FAILED +ERROR_DS_AUX_CLS_TEST_FAIL +ERROR_DS_BACKLINK_WITHOUT_LINK +ERROR_DS_BAD_ATT_SCHEMA_SYNTAX +ERROR_DS_BAD_HIERARCHY_FILE +ERROR_DS_BAD_INSTANCE_TYPE +ERROR_DS_BAD_NAME_SYNTAX +ERROR_DS_BAD_RDN_ATT_ID_SYNTAX +ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED +ERROR_DS_BUSY +ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD +ERROR_DS_CANT_ADD_ATT_VALUES +ERROR_DS_CANT_ADD_SYSTEM_ONLY +ERROR_DS_CANT_ADD_TO_GC +ERROR_DS_CANT_CACHE_ATT +ERROR_DS_CANT_CACHE_CLASS +ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC +ERROR_DS_CANT_CREATE_UNDER_SCHEMA +ERROR_DS_CANT_DEL_MASTER_CROSSREF +ERROR_DS_CANT_DELETE +ERROR_DS_CANT_DELETE_DSA_OBJ +ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC +ERROR_DS_CANT_DEREF_ALIAS +ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN +ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF +ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN +ERROR_DS_CANT_FIND_DSA_OBJ +ERROR_DS_CANT_FIND_EXPECTED_NC +ERROR_DS_CANT_FIND_NC_IN_CACHE +ERROR_DS_CANT_MIX_MASTER_AND_REPS +ERROR_DS_CANT_MOD_OBJ_CLASS +ERROR_DS_CANT_MOD_PRIMARYGROUPID +ERROR_DS_CANT_MOD_SYSTEM_ONLY +ERROR_DS_CANT_MOVE_ACCOUNT_GROUP +ERROR_DS_CANT_MOVE_APP_BASIC_GROUP +ERROR_DS_CANT_MOVE_APP_QUERY_GROUP +ERROR_DS_CANT_MOVE_DELETED_OBJECT +ERROR_DS_CANT_MOVE_RESOURCE_GROUP +ERROR_DS_CANT_ON_NON_LEAF +ERROR_DS_CANT_ON_RDN +ERROR_DS_CANT_REM_MISSING_ATT +ERROR_DS_CANT_REM_MISSING_ATT_VAL +ERROR_DS_CANT_REMOVE_ATT_CACHE +ERROR_DS_CANT_REMOVE_CLASS_CACHE +ERROR_DS_CANT_REPLACE_HIDDEN_REC +ERROR_DS_CANT_RETRIEVE_ATTS +ERROR_DS_CANT_RETRIEVE_CHILD +ERROR_DS_CANT_RETRIEVE_DN +ERROR_DS_CANT_RETRIEVE_INSTANCE +ERROR_DS_CANT_RETRIEVE_SD +ERROR_DS_CANT_START +ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ +ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS +ERROR_DS_CHILDREN_EXIST +ERROR_DS_CLASS_MUST_BE_CONCRETE +ERROR_DS_CLASS_NOT_DSA +ERROR_DS_CLIENT_LOOP +ERROR_DS_CODE_INCONSISTENCY +ERROR_DS_COMPARE_FALSE +ERROR_DS_COMPARE_TRUE +ERROR_DS_CONFIDENTIALITY_REQUIRED +ERROR_DS_CONFIG_PARAM_MISSING +ERROR_DS_CONSTRAINT_VIOLATION +ERROR_DS_CONSTRUCTED_ATT_MOD +ERROR_DS_CONTROL_NOT_FOUND +ERROR_DS_COULDNT_CONTACT_FSMO +ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE +ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE +ERROR_DS_COULDNT_UPDATE_SPNS +ERROR_DS_COUNTING_AB_INDICES_FAILED +ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE +ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 +ERROR_DS_CROSS_DOM_MOVE_ERROR +ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD +ERROR_DS_CROSS_NC_DN_RENAME +ERROR_DS_CROSS_REF_BUSY +ERROR_DS_CROSS_REF_EXISTS +ERROR_DS_DATABASE_ERROR +ERROR_DS_DECODING_ERROR +ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED +ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST +ERROR_DS_DIFFERENT_REPL_EPOCHS +ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER +ERROR_DS_DISALLOWED_NC_REDIRECT +ERROR_DS_DNS_LOOKUP_FAILURE +ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST +ERROR_DS_DOMAIN_RENAME_IN_PROGRESS +ERROR_DS_DOMAIN_VERSION_TOO_HIGH +ERROR_DS_DOMAIN_VERSION_TOO_LOW +ERROR_DS_DRA_ABANDON_SYNC +ERROR_DS_DRA_ACCESS_DENIED +ERROR_DS_DRA_BAD_DN +ERROR_DS_DRA_BAD_INSTANCE_TYPE +ERROR_DS_DRA_BAD_NC +ERROR_DS_DRA_BUSY +ERROR_DS_DRA_CONNECTION_FAILED +ERROR_DS_DRA_CORRUPT_UTD_VECTOR +ERROR_DS_DRA_DB_ERROR +ERROR_DS_DRA_DN_EXISTS +ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT +ERROR_DS_DRA_EXTN_CONNECTION_FAILED +ERROR_DS_DRA_GENERIC +ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET +ERROR_DS_DRA_INCONSISTENT_DIT +ERROR_DS_DRA_INTERNAL_ERROR +ERROR_DS_DRA_INVALID_PARAMETER +ERROR_DS_DRA_MAIL_PROBLEM +ERROR_DS_DRA_MISSING_KRBTGT_SECRET +ERROR_DS_DRA_MISSING_PARENT +ERROR_DS_DRA_NAME_COLLISION +ERROR_DS_DRA_NO_REPLICA +ERROR_DS_DRA_NOT_SUPPORTED +ERROR_DS_DRA_OBJ_IS_REP_SOURCE +ERROR_DS_DRA_OBJ_NC_MISMATCH +ERROR_DS_DRA_OUT_OF_MEM +ERROR_DS_DRA_OUT_SCHEDULE_WINDOW +ERROR_DS_DRA_PREEMPTED +ERROR_DS_DRA_RECYCLED_TARGET +ERROR_DS_DRA_REF_ALREADY_EXISTS +ERROR_DS_DRA_REF_NOT_FOUND +ERROR_DS_DRA_REPL_PENDING +ERROR_DS_DRA_RPC_CANCELLED +ERROR_DS_DRA_SCHEMA_CONFLICT +ERROR_DS_DRA_SCHEMA_INFO_SHIP +ERROR_DS_DRA_SCHEMA_MISMATCH +ERROR_DS_DRA_SECRETS_DENIED +ERROR_DS_DRA_SHUTDOWN +ERROR_DS_DRA_SINK_DISABLED +ERROR_DS_DRA_SOURCE_DISABLED +ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA +ERROR_DS_DRA_SOURCE_REINSTALLED +ERROR_DS_DRS_EXTENSIONS_CHANGED +ERROR_DS_DS_REQUIRED +ERROR_DS_DSA_MUST_BE_INT_MASTER +ERROR_DS_DST_DOMAIN_NOT_NATIVE +ERROR_DS_DST_NC_MISMATCH +ERROR_DS_DUP_LDAP_DISPLAY_NAME +ERROR_DS_DUP_LINK_ID +ERROR_DS_DUP_MAPI_ID +ERROR_DS_DUP_MSDS_INTID +ERROR_DS_DUP_OID +ERROR_DS_DUP_RDN +ERROR_DS_DUP_SCHEMA_ID_GUID +ERROR_DS_DUPLICATE_ID_FOUND +ERROR_DS_ENCODING_ERROR +ERROR_DS_EPOCH_MISMATCH +ERROR_DS_EXISTING_AD_CHILD_NC +ERROR_DS_EXISTS_IN_AUX_CLS +ERROR_DS_EXISTS_IN_MAY_HAVE +ERROR_DS_EXISTS_IN_MUST_HAVE +ERROR_DS_EXISTS_IN_POSS_SUP +ERROR_DS_EXISTS_IN_RDNATTID +ERROR_DS_EXISTS_IN_SUB_CLS +ERROR_DS_FILTER_UNKNOWN +ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS +ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST +ERROR_DS_FOREST_VERSION_TOO_HIGH +ERROR_DS_FOREST_VERSION_TOO_LOW +ERROR_DS_GC_NOT_AVAILABLE +ERROR_DS_GC_REQUIRED +ERROR_DS_GCVERIFY_ERROR +ERROR_DS_GENERIC_ERROR +ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER +ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER +ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER +ERROR_DS_GOVERNSID_MISSING +ERROR_DS_GROUP_CONVERSION_ERROR +ERROR_DS_HAVE_PRIMARY_MEMBERS +ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED +ERROR_DS_HIERARCHY_TABLE_TOO_DEEP +ERROR_DS_HIGH_ADLDS_FFL +ERROR_DS_HIGH_DSA_VERSION +ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD +ERROR_DS_ILLEGAL_MOD_OPERATION +ERROR_DS_ILLEGAL_SUPERIOR +ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION +ERROR_DS_INAPPROPRIATE_AUTH +ERROR_DS_INAPPROPRIATE_MATCHING +ERROR_DS_INCOMPATIBLE_CONTROLS_USED +ERROR_DS_INCOMPATIBLE_VERSION +ERROR_DS_INCORRECT_ROLE_OWNER +ERROR_DS_INIT_FAILURE +ERROR_DS_INIT_FAILURE_CONSOLE +ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE +ERROR_DS_INSTALL_NO_SRC_SCH_VERSION +ERROR_DS_INSTALL_SCHEMA_MISMATCH +ERROR_DS_INSUFF_ACCESS_RIGHTS +ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT +ERROR_DS_INTERNAL_FAILURE +ERROR_DS_INVALID_ATTRIBUTE_SYNTAX +ERROR_DS_INVALID_DMD +ERROR_DS_INVALID_DN_SYNTAX +ERROR_DS_INVALID_GROUP_TYPE +ERROR_DS_INVALID_LDAP_DISPLAY_NAME +ERROR_DS_INVALID_NAME_FOR_SPN +ERROR_DS_INVALID_ROLE_OWNER +ERROR_DS_INVALID_SCRIPT +ERROR_DS_INVALID_SEARCH_FLAG +ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE +ERROR_DS_INVALID_SEARCH_FLAG_TUPLE +ERROR_DS_IS_LEAF +ERROR_DS_KEY_NOT_UNIQUE +ERROR_DS_LDAP_SEND_QUEUE_FULL +ERROR_DS_LINK_ID_NOT_AVAILABLE +ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER +ERROR_DS_LOCAL_ERROR +ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY +ERROR_DS_LOOP_DETECT +ERROR_DS_LOW_ADLDS_FFL +ERROR_DS_LOW_DSA_VERSION +ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 +ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED +ERROR_DS_MAPI_ID_NOT_AVAILABLE +ERROR_DS_MASTERDSA_REQUIRED +ERROR_DS_MAX_OBJ_SIZE_EXCEEDED +ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY +ERROR_DS_MISSING_EXPECTED_ATT +ERROR_DS_MISSING_FOREST_TRUST +ERROR_DS_MISSING_FSMO_SETTINGS +ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER +ERROR_DS_MISSING_REQUIRED_ATT +ERROR_DS_MISSING_SUPREF +ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG +ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE +ERROR_DS_MODIFYDN_WRONG_GRANDPARENT +ERROR_DS_MUST_BE_RUN_ON_DST_DC +ERROR_DS_NAME_ERROR_DOMAIN_ONLY +ERROR_DS_NAME_ERROR_NO_MAPPING +ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING +ERROR_DS_NAME_ERROR_NOT_FOUND +ERROR_DS_NAME_ERROR_NOT_UNIQUE +ERROR_DS_NAME_ERROR_RESOLVING +ERROR_DS_NAME_ERROR_TRUST_REFERRAL +ERROR_DS_NAME_NOT_UNIQUE +ERROR_DS_NAME_REFERENCE_INVALID +ERROR_DS_NAME_TOO_LONG +ERROR_DS_NAME_TOO_MANY_PARTS +ERROR_DS_NAME_TYPE_UNKNOWN +ERROR_DS_NAME_UNPARSEABLE +ERROR_DS_NAME_VALUE_TOO_LONG +ERROR_DS_NAMING_MASTER_GC +ERROR_DS_NAMING_VIOLATION +ERROR_DS_NC_MUST_HAVE_NC_PARENT +ERROR_DS_NC_STILL_HAS_DSAS +ERROR_DS_NCNAME_MISSING_CR_REF +ERROR_DS_NCNAME_MUST_BE_NC +ERROR_DS_NO_ATTRIBUTE_OR_VALUE +ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN +ERROR_DS_NO_CHAINED_EVAL +ERROR_DS_NO_CHAINING +ERROR_DS_NO_CHECKPOINT_WITH_PDC +ERROR_DS_NO_CROSSREF_FOR_NC +ERROR_DS_NO_DELETED_NAME +ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS +ERROR_DS_NO_MORE_RIDS +ERROR_DS_NO_MSDS_INTID +ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN +ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN +ERROR_DS_NO_NTDSA_OBJECT +ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC +ERROR_DS_NO_PARENT_OBJECT +ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION +ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA +ERROR_DS_NO_REF_DOMAIN +ERROR_DS_NO_REQUESTED_ATTS_FOUND +ERROR_DS_NO_RESULTS_RETURNED +ERROR_DS_NO_RIDS_ALLOCATED +ERROR_DS_NO_SERVER_OBJECT +ERROR_DS_NO_SUCH_OBJECT +ERROR_DS_NO_TREE_DELETE_ABOVE_NC +ERROR_DS_NON_ASQ_SEARCH +ERROR_DS_NON_BASE_SEARCH +ERROR_DS_NONEXISTENT_MAY_HAVE +ERROR_DS_NONEXISTENT_MUST_HAVE +ERROR_DS_NONEXISTENT_POSS_SUP +ERROR_DS_NONSAFE_SCHEMA_CHANGE +ERROR_DS_NOT_AN_OBJECT +ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC +ERROR_DS_NOT_CLOSEST +ERROR_DS_NOT_INSTALLED +ERROR_DS_NOT_ON_BACKLINK +ERROR_DS_NOT_SUPPORTED +ERROR_DS_NOT_SUPPORTED_SORT_ORDER +ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX +ERROR_DS_NTDSCRIPT_PROCESS_ERROR +ERROR_DS_NTDSCRIPT_SYNTAX_ERROR +ERROR_DS_OBJ_CLASS_NOT_DEFINED +ERROR_DS_OBJ_CLASS_NOT_SUBCLASS +ERROR_DS_OBJ_CLASS_VIOLATION +ERROR_DS_OBJ_GUID_EXISTS +ERROR_DS_OBJ_NOT_FOUND +ERROR_DS_OBJ_STRING_NAME_EXISTS +ERROR_DS_OBJ_TOO_LARGE +ERROR_DS_OBJECT_BEING_REMOVED +ERROR_DS_OBJECT_CLASS_REQUIRED +ERROR_DS_OBJECT_RESULTS_TOO_LARGE +ERROR_DS_OFFSET_RANGE_ERROR +ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS +ERROR_DS_OID_NOT_FOUND +ERROR_DS_OPERATIONS_ERROR +ERROR_DS_OUT_OF_SCOPE +ERROR_DS_OUT_OF_VERSION_STORE +ERROR_DS_PARAM_ERROR +ERROR_DS_PARENT_IS_AN_ALIAS +ERROR_DS_PDC_OPERATION_IN_PROGRESS +ERROR_DS_PER_ATTRIBUTE_AUTHZ_FAILED_DURING_ADD +ERROR_DS_POLICY_NOT_KNOWN +ERROR_DS_PROTOCOL_ERROR +ERROR_DS_RANGE_CONSTRAINT +ERROR_DS_RDN_DOESNT_MATCH_SCHEMA +ERROR_DS_RECALCSCHEMA_FAILED +ERROR_DS_REFERRAL +ERROR_DS_REFERRAL_LIMIT_EXCEEDED +ERROR_DS_REFUSING_FSMO_ROLES +ERROR_DS_REMOTE_CROSSREF_OP_FAILED +ERROR_DS_REPL_LIFETIME_EXCEEDED +ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR +ERROR_DS_REPLICATOR_ONLY +ERROR_DS_RESERVED_LINK_ID +ERROR_DS_RESERVED_MAPI_ID +ERROR_DS_RIDMGR_DISABLED +ERROR_DS_RIDMGR_INIT_ERROR +ERROR_DS_ROLE_NOT_VERIFIED +ERROR_DS_ROOT_CANT_BE_SUBREF +ERROR_DS_ROOT_MUST_BE_NC +ERROR_DS_ROOT_REQUIRES_CLASS_TOP +ERROR_DS_SAM_INIT_FAILURE +ERROR_DS_SAM_INIT_FAILURE_CONSOLE +ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY +ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD +ERROR_DS_SCHEMA_ALLOC_FAILED +ERROR_DS_SCHEMA_NOT_LOADED +ERROR_DS_SCHEMA_UPDATE_DISALLOWED +ERROR_DS_SEC_DESC_INVALID +ERROR_DS_SEC_DESC_TOO_SHORT +ERROR_DS_SECURITY_CHECKING_ERROR +ERROR_DS_SECURITY_ILLEGAL_MODIFY +ERROR_DS_SEMANTIC_ATT_TEST +ERROR_DS_SENSITIVE_GROUP_VIOLATION +ERROR_DS_SERVER_DOWN +ERROR_DS_SHUTTING_DOWN +ERROR_DS_SINGLE_USER_MODE_FAILED +ERROR_DS_SINGLE_VALUE_CONSTRAINT +ERROR_DS_SIZELIMIT_EXCEEDED +ERROR_DS_SORT_CONTROL_MISSING +ERROR_DS_SOURCE_AUDITING_NOT_ENABLED +ERROR_DS_SOURCE_DOMAIN_IN_FOREST +ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST +ERROR_DS_SRC_AND_DST_NC_IDENTICAL +ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH +ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER +ERROR_DS_SRC_GUID_MISMATCH +ERROR_DS_SRC_NAME_MISMATCH +ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER +ERROR_DS_SRC_SID_EXISTS_IN_FOREST +ERROR_DS_STRING_SD_CONVERSION_FAILED +ERROR_DS_STRONG_AUTH_REQUIRED +ERROR_DS_SUB_CLS_TEST_FAIL +ERROR_DS_SUBREF_MUST_HAVE_PARENT +ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD +ERROR_DS_SYNTAX_MISMATCH +ERROR_DS_THREAD_LIMIT_EXCEEDED +ERROR_DS_TIMELIMIT_EXCEEDED +ERROR_DS_TREE_DELETE_NOT_FINISHED +ERROR_DS_UNABLE_TO_SURRENDER_ROLES +ERROR_DS_UNAVAILABLE +ERROR_DS_UNAVAILABLE_CRIT_EXTENSION +ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED +ERROR_DS_UNICODEPWD_NOT_IN_QUOTES +ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER +ERROR_DS_UNKNOWN_ERROR +ERROR_DS_UNKNOWN_OPERATION +ERROR_DS_UNWILLING_TO_PERFORM +ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST +ERROR_DS_USER_BUFFER_TO_SMALL +ERROR_DS_VALUE_KEY_NOT_UNIQUE +ERROR_DS_VERSION_CHECK_FAILURE +ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL +ERROR_DS_WRONG_LINKED_ATT_SYNTAX +ERROR_DS_WRONG_OM_OBJ_CLASS +ERROR_DUP_DOMAINNAME +ERROR_DUP_NAME +ERROR_DUPLICATE_PRIVILEGES +ERROR_DUPLICATE_SERVICE_NAME +ERROR_DYNAMIC_CODE_BLOCKED +ERROR_DYNLINK_FROM_INVALID_RING +ERROR_EA_ACCESS_DENIED +ERROR_EA_FILE_CORRUPT +ERROR_EA_LIST_INCONSISTENT +ERROR_EA_TABLE_FULL +ERROR_EAS_DIDNT_FIT +ERROR_EAS_NOT_SUPPORTED +ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED +ERROR_EDP_POLICY_DENIES_OPERATION +ERROR_EFS_ALG_BLOB_TOO_BIG +ERROR_EFS_DISABLED +ERROR_EFS_SERVER_NOT_TRUSTED +ERROR_EFS_VERSION_NOT_SUPPORT +ERROR_ELEVATION_REQUIRED +ERROR_ENCLAVE_FAILURE +ERROR_ENCLAVE_NOT_TERMINATED +ERROR_ENCLAVE_VIOLATION +ERROR_ENCRYPTED_FILE_NOT_SUPPORTED +ERROR_ENCRYPTED_IO_NOT_POSSIBLE +ERROR_ENCRYPTING_METADATA_DISALLOWED +ERROR_ENCRYPTION_DISABLED +ERROR_ENCRYPTION_FAILED +ERROR_ENCRYPTION_POLICY_DENIES_OPERATION +ERROR_END_OF_MEDIA +ERROR_ENVVAR_NOT_FOUND +ERROR_EOM_OVERFLOW +ERROR_ERRORS_ENCOUNTERED +ERROR_EVALUATION_EXPIRATION +ERROR_EVENT_DONE +ERROR_EVENT_PENDING +ERROR_EVENTLOG_CANT_START +ERROR_EVENTLOG_FILE_CHANGED +ERROR_EVENTLOG_FILE_CORRUPT +ERROR_EXCEPTION_IN_SERVICE +ERROR_EXCL_SEM_ALREADY_OWNED +ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY +ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY +ERROR_EXE_MACHINE_TYPE_MISMATCH +ERROR_EXE_MARKED_INVALID +ERROR_EXTENDED_ERROR +ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN +ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED +ERROR_EXTRANEOUS_INFORMATION +ERROR_FAIL_FAST_EXCEPTION +ERROR_FAIL_I24 +ERROR_FAIL_NOACTION_REBOOT +ERROR_FAIL_RESTART +ERROR_FAIL_SHUTDOWN +ERROR_FAILED_DRIVER_ENTRY +ERROR_FAILED_SERVICE_CONTROLLER_CONNECT +ERROR_FATAL_APP_EXIT +ERROR_FILE_CHECKED_OUT +ERROR_FILE_CORRUPT +ERROR_FILE_ENCRYPTED +ERROR_FILE_EXISTS +ERROR_FILE_HANDLE_REVOKED +ERROR_FILE_INVALID +ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED +ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS +ERROR_FILE_NOT_ENCRYPTED +ERROR_FILE_NOT_FOUND +ERROR_FILE_NOT_SUPPORTED +ERROR_FILE_OFFLINE +ERROR_FILE_PROTECTED_UNDER_DPL +ERROR_FILE_READ_ONLY +ERROR_FILE_SNAP_IN_PROGRESS +ERROR_FILE_SNAP_INVALID_PARAMETER +ERROR_FILE_SNAP_IO_NOT_COORDINATED +ERROR_FILE_SNAP_MODIFY_NOT_SUPPORTED +ERROR_FILE_SNAP_UNEXPECTED_ERROR +ERROR_FILE_SNAP_USER_SECTION_NOT_SUPPORTED +ERROR_FILE_SYSTEM_LIMITATION +ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY +ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION +ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT +ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN +ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE +ERROR_FILE_TOO_LARGE +ERROR_FILEMARK_DETECTED +ERROR_FILENAME_EXCED_RANGE +ERROR_FIRMWARE_UPDATED +ERROR_FLOAT_MULTIPLE_FAULTS +ERROR_FLOAT_MULTIPLE_TRAPS +ERROR_FLOPPY_BAD_REGISTERS +ERROR_FLOPPY_ID_MARK_NOT_FOUND +ERROR_FLOPPY_UNKNOWN_ERROR +ERROR_FLOPPY_VOLUME +ERROR_FLOPPY_WRONG_CYLINDER +ERROR_FORMS_AUTH_REQUIRED +ERROR_FOUND_OUT_OF_SCOPE +ERROR_FS_DRIVER_REQUIRED +ERROR_FS_METADATA_INCONSISTENT +ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY +ERROR_FT_DI_SCAN_REQUIRED +ERROR_FT_READ_FAILURE +ERROR_FT_READ_FROM_COPY_FAILURE +ERROR_FT_READ_RECOVERY_FROM_BACKUP +ERROR_FT_WRITE_FAILURE +ERROR_FT_WRITE_RECOVERY +ERROR_FULLSCREEN_MODE +ERROR_FUNCTION_FAILED +ERROR_FUNCTION_NOT_CALLED +ERROR_GDI_HANDLE_LEAK +ERROR_GEN_FAILURE +ERROR_GENERIC_NOT_MAPPED +ERROR_GLOBAL_ONLY_HOOK +ERROR_GRACEFUL_DISCONNECT +ERROR_GROUP_EXISTS +ERROR_GUID_SUBSTITUTION_MADE +ERROR_HANDLE_DISK_FULL +ERROR_HANDLE_EOF +ERROR_HANDLE_REVOKED +ERROR_HANDLES_CLOSED +ERROR_HAS_SYSTEM_CRITICAL_FILES +ERROR_HIBERNATED +ERROR_HIBERNATION_FAILURE +ERROR_HOOK_NEEDS_HMOD +ERROR_HOOK_NOT_INSTALLED +ERROR_HOOK_TYPE_NOT_ALLOWED +ERROR_HOST_DOWN +ERROR_HOST_UNREACHABLE +ERROR_HOTKEY_ALREADY_REGISTERED +ERROR_HOTKEY_NOT_REGISTERED +ERROR_HWNDS_HAVE_DIFF_PARENT +ERROR_ILL_FORMED_PASSWORD +ERROR_ILLEGAL_CHARACTER +ERROR_ILLEGAL_DLL_RELOCATION +ERROR_ILLEGAL_ELEMENT_ADDRESS +ERROR_ILLEGAL_FLOAT_CONTEXT +ERROR_IMAGE_AT_DIFFERENT_BASE +ERROR_IMAGE_MACHINE_TYPE_MISMATCH +ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE +ERROR_IMAGE_NOT_AT_BASE +ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT +ERROR_IMPLEMENTATION_LIMIT +ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE +ERROR_INCOMPATIBLE_SERVICE_SID_TYPE +ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING +ERROR_INCORRECT_ACCOUNT_TYPE +ERROR_INCORRECT_ADDRESS +ERROR_INCORRECT_SIZE +ERROR_INDEX_ABSENT +ERROR_INDEX_OUT_OF_BOUNDS +ERROR_INFLOOP_IN_RELOC_CHAIN +ERROR_INSTALL_ALREADY_RUNNING +ERROR_INSTALL_FAILURE +ERROR_INSTALL_LANGUAGE_UNSUPPORTED +ERROR_INSTALL_LOG_FAILURE +ERROR_INSTALL_NOTUSED +ERROR_INSTALL_PACKAGE_INVALID +ERROR_INSTALL_PACKAGE_OPEN_FAILED +ERROR_INSTALL_PACKAGE_REJECTED +ERROR_INSTALL_PACKAGE_VERSION +ERROR_INSTALL_PLATFORM_UNSUPPORTED +ERROR_INSTALL_REJECTED +ERROR_INSTALL_REMOTE_DISALLOWED +ERROR_INSTALL_REMOTE_PROHIBITED +ERROR_INSTALL_SERVICE_FAILURE +ERROR_INSTALL_SERVICE_SAFEBOOT +ERROR_INSTALL_SOURCE_ABSENT +ERROR_INSTALL_SUSPEND +ERROR_INSTALL_TEMP_UNWRITABLE +ERROR_INSTALL_TRANSFORM_FAILURE +ERROR_INSTALL_TRANSFORM_REJECTED +ERROR_INSTALL_UI_FAILURE +ERROR_INSTALL_USEREXIT +ERROR_INSTRUCTION_MISALIGNMENT +ERROR_INSUFFICIENT_BUFFER +ERROR_INSUFFICIENT_LOGON_INFO +ERROR_INSUFFICIENT_POWER +ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE +ERROR_INSUFFICIENT_VIRTUAL_ADDR_RESOURCES +ERROR_INTERMIXED_KERNEL_EA_OPERATION +ERROR_INTERNAL_DB_CORRUPTION +ERROR_INTERNAL_DB_ERROR +ERROR_INTERNAL_ERROR +ERROR_INTERRUPT_STILL_CONNECTED +ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED +ERROR_INVALID_ACCEL_HANDLE +ERROR_INVALID_ACCESS +ERROR_INVALID_ACCOUNT_NAME +ERROR_INVALID_ACE_CONDITION +ERROR_INVALID_ACL +ERROR_INVALID_ADDRESS +ERROR_INVALID_AT_INTERRUPT_TIME +ERROR_INVALID_BLOCK +ERROR_INVALID_BLOCK_LENGTH +ERROR_INVALID_CAP +ERROR_INVALID_CATEGORY +ERROR_INVALID_COMBOBOX_MESSAGE +ERROR_INVALID_COMMAND_LINE +ERROR_INVALID_COMPUTERNAME +ERROR_INVALID_CRUNTIME_PARAMETER +ERROR_INVALID_CURSOR_HANDLE +ERROR_INVALID_DATA +ERROR_INVALID_DATATYPE +ERROR_INVALID_DEVICE_OBJECT_PARAMETER +ERROR_INVALID_DLL +ERROR_INVALID_DOMAIN_ROLE +ERROR_INVALID_DOMAIN_STATE +ERROR_INVALID_DOMAINNAME +ERROR_INVALID_DRIVE +ERROR_INVALID_DWP_HANDLE +ERROR_INVALID_EA_HANDLE +ERROR_INVALID_EA_NAME +ERROR_INVALID_EDIT_HEIGHT +ERROR_INVALID_ENVIRONMENT +ERROR_INVALID_EVENT_COUNT +ERROR_INVALID_EVENTNAME +ERROR_INVALID_EXCEPTION_HANDLER +ERROR_INVALID_EXE_SIGNATURE +ERROR_INVALID_FIELD +ERROR_INVALID_FIELD_IN_PARAMETER_LIST +ERROR_INVALID_FILTER_PROC +ERROR_INVALID_FLAG_NUMBER +ERROR_INVALID_FLAGS +ERROR_INVALID_FORM_NAME +ERROR_INVALID_FORM_SIZE +ERROR_INVALID_FUNCTION +ERROR_INVALID_GROUP_ATTRIBUTES +ERROR_INVALID_GROUPNAME +ERROR_INVALID_GW_COMMAND +ERROR_INVALID_HANDLE +ERROR_INVALID_HANDLE_STATE +ERROR_INVALID_HOOK_FILTER +ERROR_INVALID_HOOK_HANDLE +ERROR_INVALID_HW_PROFILE +ERROR_INVALID_ICON_HANDLE +ERROR_INVALID_ID_AUTHORITY +ERROR_INVALID_IMAGE_HASH +ERROR_INVALID_IMPORT_OF_NON_DLL +ERROR_INVALID_INDEX +ERROR_INVALID_KERNEL_INFO_VERSION +ERROR_INVALID_KEYBOARD_HANDLE +ERROR_INVALID_LABEL +ERROR_INVALID_LB_MESSAGE +ERROR_INVALID_LDT_DESCRIPTOR +ERROR_INVALID_LDT_OFFSET +ERROR_INVALID_LDT_SIZE +ERROR_INVALID_LEVEL +ERROR_INVALID_LIST_FORMAT +ERROR_INVALID_LOCK_RANGE +ERROR_INVALID_LOGON_HOURS +ERROR_INVALID_LOGON_TYPE +ERROR_INVALID_MEMBER +ERROR_INVALID_MENU_HANDLE +ERROR_INVALID_MESSAGE +ERROR_INVALID_MESSAGEDEST +ERROR_INVALID_MESSAGENAME +ERROR_INVALID_MINALLOCSIZE +ERROR_INVALID_MODULETYPE +ERROR_INVALID_MONITOR_HANDLE +ERROR_INVALID_MSGBOX_STYLE +ERROR_INVALID_NAME +ERROR_INVALID_NETNAME +ERROR_INVALID_OPLOCK_PROTOCOL +ERROR_INVALID_ORDINAL +ERROR_INVALID_OWNER +ERROR_INVALID_PACKAGE_SID_LENGTH +ERROR_INVALID_PARAMETER +ERROR_INVALID_PASSWORD +ERROR_INVALID_PASSWORDNAME +ERROR_INVALID_PATCH_XML +ERROR_INVALID_PEP_INFO_VERSION +ERROR_INVALID_PLUGPLAY_DEVICE_PATH +ERROR_INVALID_PORT_ATTRIBUTES +ERROR_INVALID_PRIMARY_GROUP +ERROR_INVALID_PRINTER_COMMAND +ERROR_INVALID_PRINTER_NAME +ERROR_INVALID_PRINTER_STATE +ERROR_INVALID_PRIORITY +ERROR_INVALID_QUOTA_LOWER +ERROR_INVALID_REPARSE_DATA +ERROR_INVALID_SCROLLBAR_RANGE +ERROR_INVALID_SECURITY_DESCR +ERROR_INVALID_SEGDPL +ERROR_INVALID_SEGMENT_NUMBER +ERROR_INVALID_SEPARATOR_FILE +ERROR_INVALID_SERVER_STATE +ERROR_INVALID_SERVICE_ACCOUNT +ERROR_INVALID_SERVICE_CONTROL +ERROR_INVALID_SERVICE_LOCK +ERROR_INVALID_SERVICENAME +ERROR_INVALID_SHARENAME +ERROR_INVALID_SHOWWIN_COMMAND +ERROR_INVALID_SID +ERROR_INVALID_SIGNAL_NUMBER +ERROR_INVALID_SPI_VALUE +ERROR_INVALID_STACKSEG +ERROR_INVALID_STARTING_CODESEG +ERROR_INVALID_SUB_AUTHORITY +ERROR_INVALID_TABLE +ERROR_INVALID_TARGET_HANDLE +ERROR_INVALID_TASK_INDEX +ERROR_INVALID_TASK_NAME +ERROR_INVALID_THREAD_ID +ERROR_INVALID_TIME +ERROR_INVALID_TOKEN +ERROR_INVALID_UNWIND_TARGET +ERROR_INVALID_USER_BUFFER +ERROR_INVALID_USER_PRINCIPAL_NAME +ERROR_INVALID_VARIANT +ERROR_INVALID_VERIFY_SWITCH +ERROR_INVALID_WINDOW_HANDLE +ERROR_INVALID_WORKSTATION +ERROR_IO_DEVICE +ERROR_IO_INCOMPLETE +ERROR_IO_PENDING +ERROR_IO_PRIVILEGE_FAILED +ERROR_IO_REISSUE_AS_CACHED +ERROR_IOPL_NOT_ENABLED +ERROR_IP_ADDRESS_CONFLICT1 +ERROR_IP_ADDRESS_CONFLICT2 +ERROR_IPSEC_IKE_TIMED_OUT +ERROR_IRQ_BUSY +ERROR_IS_JOIN_PATH +ERROR_IS_JOIN_TARGET +ERROR_IS_JOINED +ERROR_IS_SUBST_PATH +ERROR_IS_SUBST_TARGET +ERROR_IS_SUBSTED +ERROR_ITERATED_DATA_EXCEEDS_64k +ERROR_JOB_NO_CONTAINER +ERROR_JOIN_TO_JOIN +ERROR_JOIN_TO_SUBST +ERROR_JOURNAL_DELETE_IN_PROGRESS +ERROR_JOURNAL_ENTRY_DELETED +ERROR_JOURNAL_HOOK_SET +ERROR_JOURNAL_NOT_ACTIVE +ERROR_KERNEL_APC +ERROR_KEY_DELETED +ERROR_KEY_HAS_CHILDREN +ERROR_KM_DRIVER_BLOCKED +ERROR_LABEL_TOO_LONG +ERROR_LAST_ADMIN +ERROR_LB_WITHOUT_TABSTOPS +ERROR_LICENSE_QUOTA_EXCEEDED +ERROR_LINUX_SUBSYSTEM_NOT_PRESENT +ERROR_LINUX_SUBSYSTEM_UPDATE_REQUIRED +ERROR_LISTBOX_ID_NOT_FOUND +ERROR_LM_CROSS_ENCRYPTION_REQUIRED +ERROR_LOCAL_POLICY_MODIFICATION_NOT_SUPPORTED +ERROR_LOCAL_USER_SESSION_KEY +ERROR_LOCK_FAILED +ERROR_LOCK_VIOLATION +ERROR_LOCKED +ERROR_LOG_FILE_FULL +ERROR_LOG_HARD_ERROR +ERROR_LOGIN_TIME_RESTRICTION +ERROR_LOGIN_WKSTA_RESTRICTION +ERROR_LOGON_FAILURE +ERROR_LOGON_NOT_GRANTED +ERROR_LOGON_SERVER_CONFLICT +ERROR_LOGON_SESSION_COLLISION +ERROR_LOGON_SESSION_EXISTS +ERROR_LOGON_TYPE_NOT_GRANTED +ERROR_LONGJUMP +ERROR_LOST_MODE_LOGON_RESTRICTION +ERROR_LOST_WRITEBEHIND_DATA +ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR +ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED +ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR +ERROR_LUIDS_EXHAUSTED +ERROR_MACHINE_LOCKED +ERROR_MAGAZINE_NOT_PRESENT +ERROR_MAPPED_ALIGNMENT +ERROR_MARKED_TO_DISALLOW_WRITES +ERROR_MARSHALL_OVERFLOW +ERROR_MAX_SESSIONS_REACHED +ERROR_MAX_THRDS_REACHED +ERROR_MCA_EXCEPTION +ERROR_MCA_OCCURED +ERROR_MEDIA_CHANGED +ERROR_MEDIA_CHECK +ERROR_MEMBER_IN_ALIAS +ERROR_MEMBER_IN_GROUP +ERROR_MEMBER_NOT_IN_ALIAS +ERROR_MEMBER_NOT_IN_GROUP +ERROR_MEMBERS_PRIMARY_GROUP +ERROR_MEMORY_HARDWARE +ERROR_MENU_ITEM_NOT_FOUND +ERROR_MESSAGE_SYNC_ONLY +ERROR_META_EXPANSION_TOO_LONG +ERROR_MISSING_SYSTEMFILE +ERROR_MOD_NOT_FOUND +ERROR_MORE_DATA +ERROR_MORE_WRITES +ERROR_MOUNT_POINT_NOT_RESOLVED +ERROR_MP_PROCESSOR_MISMATCH +ERROR_MR_MID_NOT_FOUND +ERROR_MULTIPLE_FAULT_VIOLATION +ERROR_MUTANT_LIMIT_EXCEEDED +ERROR_MUTUAL_AUTH_FAILED +ERROR_NEGATIVE_SEEK +ERROR_NESTING_NOT_ALLOWED +ERROR_NET_OPEN_FAILED +ERROR_NET_WRITE_FAULT +ERROR_NETLOGON_NOT_STARTED +ERROR_NETNAME_DELETED +ERROR_NETWORK_ACCESS_DENIED +ERROR_NETWORK_ACCESS_DENIED_EDP +ERROR_NETWORK_BUSY +ERROR_NETWORK_UNREACHABLE +ERROR_NO_ACE_CONDITION +ERROR_NO_ASSOCIATION +ERROR_NO_BYPASSIO_DRIVER_SUPPORT +ERROR_NO_CALLBACK_ACTIVE +ERROR_NO_DATA +ERROR_NO_DATA_DETECTED +ERROR_NO_EFS +ERROR_NO_EVENT_PAIR +ERROR_NO_GUID_TRANSLATION +ERROR_NO_IMPERSONATION_TOKEN +ERROR_NO_INHERITANCE +ERROR_NO_LOG_SPACE +ERROR_NO_LOGON_SERVERS +ERROR_NO_MATCH +ERROR_NO_MEDIA_IN_DRIVE +ERROR_NO_MORE_DEVICES +ERROR_NO_MORE_FILES +ERROR_NO_MORE_ITEMS +ERROR_NO_MORE_MATCHES +ERROR_NO_MORE_SEARCH_HANDLES +ERROR_NO_MORE_USER_HANDLES +ERROR_NO_NET_OR_BAD_PATH +ERROR_NO_NETWORK +ERROR_NO_NVRAM_RESOURCES +ERROR_NO_PAGEFILE +ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND +ERROR_NO_PROC_SLOTS +ERROR_NO_PROMOTION_ACTIVE +ERROR_NO_QUOTAS_FOR_ACCOUNT +ERROR_NO_RANGES_PROCESSED +ERROR_NO_RECOVERY_POLICY +ERROR_NO_RECOVERY_PROGRAM +ERROR_NO_SCROLLBARS +ERROR_NO_SECRETS +ERROR_NO_SECURITY_ON_OBJECT +ERROR_NO_SHUTDOWN_IN_PROGRESS +ERROR_NO_SIGNAL_SENT +ERROR_NO_SITE_SETTINGS_OBJECT +ERROR_NO_SITENAME +ERROR_NO_SPOOL_SPACE +ERROR_NO_SUCH_ALIAS +ERROR_NO_SUCH_DEVICE +ERROR_NO_SUCH_DOMAIN +ERROR_NO_SUCH_GROUP +ERROR_NO_SUCH_LOGON_SESSION +ERROR_NO_SUCH_MEMBER +ERROR_NO_SUCH_PACKAGE +ERROR_NO_SUCH_PRIVILEGE +ERROR_NO_SUCH_SITE +ERROR_NO_SUCH_USER +ERROR_NO_SYSTEM_MENU +ERROR_NO_SYSTEM_RESOURCES +ERROR_NO_TASK_QUEUE +ERROR_NO_TOKEN +ERROR_NO_TRACKING_SERVICE +ERROR_NO_TRUST_LSA_SECRET +ERROR_NO_TRUST_SAM_ACCOUNT +ERROR_NO_UNICODE_TRANSLATION +ERROR_NO_USER_KEYS +ERROR_NO_USER_SESSION_KEY +ERROR_NO_VOLUME_ID +ERROR_NO_VOLUME_LABEL +ERROR_NO_WILDCARD_CHARACTERS +ERROR_NO_WORK_DONE +ERROR_NO_WRITABLE_DC_FOUND +ERROR_NO_YIELD_PERFORMED +ERROR_NOACCESS +ERROR_NOINTERFACE +ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT +ERROR_NOLOGON_SERVER_TRUST_ACCOUNT +ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT +ERROR_NON_ACCOUNT_SID +ERROR_NON_DOMAIN_SID +ERROR_NON_MDICHILD_WINDOW +ERROR_NONE_MAPPED +ERROR_NONPAGED_SYSTEM_RESOURCES +ERROR_NOT_A_CLOUD_FILE +ERROR_NOT_A_CLOUD_SYNC_ROOT +ERROR_NOT_A_DAX_VOLUME +ERROR_NOT_A_REPARSE_POINT +ERROR_NOT_ALL_ASSIGNED +ERROR_NOT_ALLOWED_ON_SYSTEM_FILE +ERROR_NOT_APPCONTAINER +ERROR_NOT_AUTHENTICATED +ERROR_NOT_CAPABLE +ERROR_NOT_CHILD_WINDOW +ERROR_NOT_CONNECTED +ERROR_NOT_CONTAINER +ERROR_NOT_DAX_MAPPABLE +ERROR_NOT_DOS_DISK +ERROR_NOT_ENOUGH_MEMORY +ERROR_NOT_ENOUGH_QUOTA +ERROR_NOT_ENOUGH_SERVER_MEMORY +ERROR_NOT_EXPORT_FORMAT +ERROR_NOT_FOUND +ERROR_NOT_GUI_PROCESS +ERROR_NOT_JOINED +ERROR_NOT_LOCKED +ERROR_NOT_LOGGED_ON +ERROR_NOT_LOGON_PROCESS +ERROR_NOT_OWNER +ERROR_NOT_READ_FROM_COPY +ERROR_NOT_READY +ERROR_NOT_REDUNDANT_STORAGE +ERROR_NOT_REGISTRY_FILE +ERROR_NOT_SAFE_MODE_DRIVER +ERROR_NOT_SAFEBOOT_SERVICE +ERROR_NOT_SAME_DEVICE +ERROR_NOT_SAME_OBJECT +ERROR_NOT_SUBSTED +ERROR_NOT_SUPPORTED +ERROR_NOT_SUPPORTED_IN_APPCONTAINER +ERROR_NOT_SUPPORTED_ON_DAX +ERROR_NOT_SUPPORTED_ON_SBS +ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER +ERROR_NOT_SUPPORTED_WITH_AUDITING +ERROR_NOT_SUPPORTED_WITH_BTT +ERROR_NOT_SUPPORTED_WITH_BYPASSIO +ERROR_NOT_SUPPORTED_WITH_CACHED_HANDLE +ERROR_NOT_SUPPORTED_WITH_COMPRESSION +ERROR_NOT_SUPPORTED_WITH_DEDUPLICATION +ERROR_NOT_SUPPORTED_WITH_ENCRYPTION +ERROR_NOT_SUPPORTED_WITH_MONITORING +ERROR_NOT_SUPPORTED_WITH_REPLICATION +ERROR_NOT_SUPPORTED_WITH_SNAPSHOT +ERROR_NOT_SUPPORTED_WITH_VIRTUALIZATION +ERROR_NOT_TINY_STREAM +ERROR_NOTHING_TO_TERMINATE +ERROR_NOTIFICATION_GUID_ALREADY_DEFINED +ERROR_NOTIFY_CLEANUP +ERROR_NOTIFY_ENUM_DIR +ERROR_NT_CROSS_ENCRYPTION_REQUIRED +ERROR_NTLM_BLOCKED +ERROR_NULL_LM_PASSWORD +ERROR_OBJECT_IS_IMMUTABLE +ERROR_OBJECT_NAME_EXISTS +ERROR_OBJECT_NOT_EXTERNALLY_BACKED +ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED +ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED +ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED +ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED +ERROR_OFFSET_ALIGNMENT_VIOLATION +ERROR_OLD_WIN_VERSION +ERROR_ONLY_IF_CONNECTED +ERROR_OPEN_FAILED +ERROR_OPEN_FILES +ERROR_OPERATION_ABORTED +ERROR_OPERATION_IN_PROGRESS +ERROR_OPLOCK_BREAK_IN_PROGRESS +ERROR_OPLOCK_HANDLE_CLOSED +ERROR_OPLOCK_NOT_GRANTED +ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE +ERROR_ORPHAN_NAME_EXHAUSTED +ERROR_OUT_OF_PAPER +ERROR_OUT_OF_STRUCTURES +ERROR_OUTOFMEMORY +ERROR_OVERRIDE_NOCHANGES +ERROR_PAGE_FAULT_COPY_ON_WRITE +ERROR_PAGE_FAULT_DEMAND_ZERO +ERROR_PAGE_FAULT_GUARD_PAGE +ERROR_PAGE_FAULT_PAGING_FILE +ERROR_PAGE_FAULT_TRANSITION +ERROR_PAGED_SYSTEM_RESOURCES +ERROR_PAGEFILE_CREATE_FAILED +ERROR_PAGEFILE_NOT_SUPPORTED +ERROR_PAGEFILE_QUOTA +ERROR_PAGEFILE_QUOTA_EXCEEDED +ERROR_PARAMETER_QUOTA_EXCEEDED +ERROR_PARTIAL_COPY +ERROR_PARTITION_FAILURE +ERROR_PARTITION_TERMINATING +ERROR_PASSWORD_CHANGE_REQUIRED +ERROR_PASSWORD_EXPIRED +ERROR_PASSWORD_MUST_CHANGE +ERROR_PASSWORD_RESTRICTION +ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT +ERROR_PATCH_NO_SEQUENCE +ERROR_PATCH_PACKAGE_INVALID +ERROR_PATCH_PACKAGE_OPEN_FAILED +ERROR_PATCH_PACKAGE_REJECTED +ERROR_PATCH_PACKAGE_UNSUPPORTED +ERROR_PATCH_REMOVAL_DISALLOWED +ERROR_PATCH_REMOVAL_UNSUPPORTED +ERROR_PATCH_TARGET_NOT_FOUND +ERROR_PATH_BUSY +ERROR_PATH_NOT_FOUND +ERROR_PER_USER_TRUST_QUOTA_EXCEEDED +ERROR_PIPE_BUSY +ERROR_PIPE_CONNECTED +ERROR_PIPE_LISTENING +ERROR_PIPE_LOCAL +ERROR_PIPE_NOT_CONNECTED +ERROR_PKINIT_FAILURE +ERROR_PLUGPLAY_QUERY_VETOED +ERROR_PNP_BAD_MPS_TABLE +ERROR_PNP_INVALID_ID +ERROR_PNP_IRQ_TRANSLATION_FAILED +ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT +ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT +ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT +ERROR_PNP_REBOOT_REQUIRED +ERROR_PNP_RESTART_ENUMERATION +ERROR_PNP_TRANSLATION_FAILED +ERROR_POINT_NOT_FOUND +ERROR_POLICY_OBJECT_NOT_FOUND +ERROR_POLICY_ONLY_IN_DS +ERROR_POPUP_ALREADY_ACTIVE +ERROR_PORT_MESSAGE_TOO_LONG +ERROR_PORT_NOT_SET +ERROR_PORT_UNREACHABLE +ERROR_POSSIBLE_DEADLOCK +ERROR_POTENTIAL_FILE_FOUND +ERROR_PREDEFINED_HANDLE +ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED +ERROR_PRINT_CANCELLED +ERROR_PRINTER_ALREADY_EXISTS +ERROR_PRINTER_DELETED +ERROR_PRINTER_DRIVER_ALREADY_INSTALLED +ERROR_PRINTQ_FULL +ERROR_PRIVATE_DIALOG_INDEX +ERROR_PRIVILEGE_NOT_HELD +ERROR_PROC_NOT_FOUND +ERROR_PROCESS_ABORTED +ERROR_PROCESS_IN_JOB +ERROR_PROCESS_IS_PROTECTED +ERROR_PROCESS_MODE_ALREADY_BACKGROUND +ERROR_PROCESS_MODE_NOT_BACKGROUND +ERROR_PROCESS_NOT_IN_JOB +ERROR_PRODUCT_UNINSTALLED +ERROR_PRODUCT_VERSION +ERROR_PROFILING_AT_LIMIT +ERROR_PROFILING_NOT_STARTED +ERROR_PROFILING_NOT_STOPPED +ERROR_PROMOTION_ACTIVE +ERROR_PROTOCOL_UNREACHABLE +ERROR_PWD_HISTORY_CONFLICT +ERROR_PWD_TOO_LONG +ERROR_PWD_TOO_RECENT +ERROR_PWD_TOO_SHORT +ERROR_QUOTA_ACTIVITY +ERROR_QUOTA_LIST_INCONSISTENT +ERROR_RANGE_LIST_CONFLICT +ERROR_RANGE_NOT_FOUND +ERROR_READ_FAULT +ERROR_RECEIVE_EXPEDITED +ERROR_RECEIVE_PARTIAL +ERROR_RECEIVE_PARTIAL_EXPEDITED +ERROR_RECOVERY_FAILURE +ERROR_REDIR_PAUSED +ERROR_REDIRECTOR_HAS_OPEN_HANDLES +ERROR_REG_NAT_CONSUMPTION +ERROR_REGISTRY_CORRUPT +ERROR_REGISTRY_HIVE_RECOVERED +ERROR_REGISTRY_IO_FAILED +ERROR_REGISTRY_QUOTA_LIMIT +ERROR_REGISTRY_RECOVERED +ERROR_RELOC_CHAIN_XEEDS_SEGLIM +ERROR_REM_NOT_LIST +ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED +ERROR_REMOTE_SESSION_LIMIT_EXCEEDED +ERROR_REMOTE_STORAGE_MEDIA_ERROR +ERROR_REMOTE_STORAGE_NOT_ACTIVE +ERROR_REPARSE +ERROR_REPARSE_ATTRIBUTE_CONFLICT +ERROR_REPARSE_OBJECT +ERROR_REPARSE_POINT_ENCOUNTERED +ERROR_REPARSE_TAG_INVALID +ERROR_REPARSE_TAG_MISMATCH +ERROR_REPLY_MESSAGE_MISMATCH +ERROR_REQ_NOT_ACCEP +ERROR_REQUEST_ABORTED +ERROR_REQUEST_OUT_OF_SEQUENCE +ERROR_REQUEST_PAUSED +ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION +ERROR_RESIDENT_FILE_NOT_SUPPORTED +ERROR_RESOURCE_CALL_TIMED_OUT +ERROR_RESOURCE_DATA_NOT_FOUND +ERROR_RESOURCE_LANG_NOT_FOUND +ERROR_RESOURCE_NAME_NOT_FOUND +ERROR_RESOURCE_REQUIREMENTS_CHANGED +ERROR_RESOURCE_TYPE_NOT_FOUND +ERROR_RESTART_APPLICATION +ERROR_RESUME_HIBERNATION +ERROR_RETRY +ERROR_RETURN_ADDRESS_HIJACK_ATTEMPT +ERROR_REVISION_MISMATCH +ERROR_RING2_STACK_IN_USE +ERROR_RING2SEG_MUST_BE_MOVABLE +ERROR_RMODE_APP +ERROR_ROWSNOTRELEASED +ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT +ERROR_RUNLEVEL_SWITCH_TIMEOUT +ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED +ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET +ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE +ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER +ERROR_RXACT_COMMIT_FAILURE +ERROR_RXACT_COMMIT_NECESSARY +ERROR_RXACT_COMMITTED +ERROR_RXACT_INVALID_STATE +ERROR_RXACT_STATE_CREATED +ERROR_SAM_INIT_FAILURE +ERROR_SAME_DRIVE +ERROR_SCOPE_NOT_FOUND +ERROR_SCREEN_ALREADY_LOCKED +ERROR_SCRUB_DATA_DISABLED +ERROR_SECRET_TOO_LONG +ERROR_SECTION_DIRECT_MAP_ONLY +ERROR_SECTOR_NOT_FOUND +ERROR_SECURITY_DENIES_OPERATION +ERROR_SECURITY_STREAM_IS_INCONSISTENT +ERROR_SEEK +ERROR_SEEK_ON_DEVICE +ERROR_SEGMENT_NOTIFICATION +ERROR_SEM_IS_SET +ERROR_SEM_NOT_FOUND +ERROR_SEM_OWNER_DIED +ERROR_SEM_TIMEOUT +ERROR_SEM_USER_LIMIT +ERROR_SERIAL_NO_DEVICE +ERROR_SERVER_DISABLED +ERROR_SERVER_HAS_OPEN_HANDLES +ERROR_SERVER_NOT_DISABLED +ERROR_SERVER_SHUTDOWN_IN_PROGRESS +ERROR_SERVER_SID_MISMATCH +ERROR_SERVER_TRANSPORT_CONFLICT +ERROR_SERVICE_ALREADY_RUNNING +ERROR_SERVICE_CANNOT_ACCEPT_CTRL +ERROR_SERVICE_DATABASE_LOCKED +ERROR_SERVICE_DEPENDENCY_DELETED +ERROR_SERVICE_DEPENDENCY_FAIL +ERROR_SERVICE_DISABLED +ERROR_SERVICE_DOES_NOT_EXIST +ERROR_SERVICE_EXISTS +ERROR_SERVICE_LOGON_FAILED +ERROR_SERVICE_MARKED_FOR_DELETE +ERROR_SERVICE_NEVER_STARTED +ERROR_SERVICE_NO_THREAD +ERROR_SERVICE_NOT_ACTIVE +ERROR_SERVICE_NOT_FOUND +ERROR_SERVICE_NOT_IN_EXE +ERROR_SERVICE_NOTIFICATION +ERROR_SERVICE_NOTIFY_CLIENT_LAGGING +ERROR_SERVICE_REQUEST_TIMEOUT +ERROR_SERVICE_SPECIFIC_ERROR +ERROR_SERVICE_START_HANG +ERROR_SESSION_CREDENTIAL_CONFLICT +ERROR_SESSION_KEY_TOO_SHORT +ERROR_SET_CONTEXT_DENIED +ERROR_SET_NOT_FOUND +ERROR_SET_POWER_STATE_FAILED +ERROR_SET_POWER_STATE_VETOED +ERROR_SETCOUNT_ON_BAD_LB +ERROR_SETMARK_DETECTED +ERROR_SHARED_POLICY +ERROR_SHARING_BUFFER_EXCEEDED +ERROR_SHARING_PAUSED +ERROR_SHARING_VIOLATION +ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME +ERROR_SHUTDOWN_DISKS_NOT_IN_MAINTENANCE_MODE +ERROR_SHUTDOWN_IN_PROGRESS +ERROR_SHUTDOWN_IS_SCHEDULED +ERROR_SHUTDOWN_USERS_LOGGED_ON +ERROR_SIGNAL_PENDING +ERROR_SIGNAL_REFUSED +ERROR_SINGLE_INSTANCE_APP +ERROR_SMARTCARD_SUBSYSTEM_FAILURE +ERROR_SMB1_NOT_AVAILABLE +ERROR_SMB_GUEST_LOGON_BLOCKED +ERROR_SMR_GARBAGE_COLLECTION_REQUIRED +ERROR_SOME_NOT_MAPPED +ERROR_SOURCE_ELEMENT_EMPTY +ERROR_SPARSE_FILE_NOT_SUPPORTED +ERROR_SPECIAL_ACCOUNT +ERROR_SPECIAL_GROUP +ERROR_SPECIAL_USER +ERROR_SRC_SRV_DLL_LOAD_FAILED +ERROR_STACK_BUFFER_OVERRUN +ERROR_STACK_OVERFLOW +ERROR_STACK_OVERFLOW_READ +ERROR_STOPPED_ON_SYMLINK +ERROR_STORAGE_LOST_DATA_PERSISTENCE +ERROR_STORAGE_RESERVE_ALREADY_EXISTS +ERROR_STORAGE_RESERVE_DOES_NOT_EXIST +ERROR_STORAGE_RESERVE_ID_INVALID +ERROR_STORAGE_RESERVE_NOT_EMPTY +ERROR_STORAGE_STACK_ACCESS_DENIED +ERROR_STORAGE_TOPOLOGY_ID_MISMATCH +ERROR_STRICT_CFG_VIOLATION +ERROR_SUBST_TO_JOIN +ERROR_SUBST_TO_SUBST +ERROR_SUCCESS +ERROR_SUCCESS_REBOOT_INITIATED +ERROR_SWAPERROR +ERROR_SYMLINK_CLASS_DISABLED +ERROR_SYMLINK_NOT_SUPPORTED +ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED +ERROR_SYNCHRONIZATION_REQUIRED +ERROR_SYSTEM_HIVE_TOO_LARGE +ERROR_SYSTEM_IMAGE_BAD_SIGNATURE +ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION +ERROR_SYSTEM_POWERSTATE_TRANSITION +ERROR_SYSTEM_PROCESS_TERMINATED +ERROR_SYSTEM_SHUTDOWN +ERROR_SYSTEM_TRACE +ERROR_THREAD_1_INACTIVE +ERROR_THREAD_ALREADY_IN_TASK +ERROR_THREAD_MODE_ALREADY_BACKGROUND +ERROR_THREAD_MODE_NOT_BACKGROUND +ERROR_THREAD_NOT_IN_PROCESS +ERROR_THREAD_WAS_SUSPENDED +ERROR_TIME_SENSITIVE_THREAD +ERROR_TIME_SKEW +ERROR_TIMEOUT +ERROR_TIMER_NOT_CANCELED +ERROR_TIMER_RESOLUTION_NOT_SET +ERROR_TIMER_RESUME_IGNORED +ERROR_TLW_WITH_WSCHILD +ERROR_TOKEN_ALREADY_IN_USE +ERROR_TOO_MANY_CMDS +ERROR_TOO_MANY_CONTEXT_IDS +ERROR_TOO_MANY_DESCRIPTORS +ERROR_TOO_MANY_LINKS +ERROR_TOO_MANY_LUIDS_REQUESTED +ERROR_TOO_MANY_MODULES +ERROR_TOO_MANY_MUXWAITERS +ERROR_TOO_MANY_NAMES +ERROR_TOO_MANY_OPEN_FILES +ERROR_TOO_MANY_POSTS +ERROR_TOO_MANY_SECRETS +ERROR_TOO_MANY_SEM_REQUESTS +ERROR_TOO_MANY_SEMAPHORES +ERROR_TOO_MANY_SESS +ERROR_TOO_MANY_SIDS +ERROR_TOO_MANY_TCBS +ERROR_TOO_MANY_THREADS +ERROR_TRANSLATION_COMPLETE +ERROR_TRUST_FAILURE +ERROR_TRUSTED_DOMAIN_FAILURE +ERROR_TRUSTED_RELATIONSHIP_FAILURE +ERROR_UNABLE_TO_LOCK_MEDIA +ERROR_UNABLE_TO_MOVE_REPLACEMENT +ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 +ERROR_UNABLE_TO_REMOVE_REPLACED +ERROR_UNABLE_TO_UNLOAD_MEDIA +ERROR_UNDEFINED_CHARACTER +ERROR_UNDEFINED_SCOPE +ERROR_UNEXP_NET_ERR +ERROR_UNEXPECTED_MM_CREATE_ERR +ERROR_UNEXPECTED_MM_EXTEND_ERR +ERROR_UNEXPECTED_MM_MAP_ERROR +ERROR_UNEXPECTED_NTCACHEMANAGER_ERROR +ERROR_UNHANDLED_EXCEPTION +ERROR_UNIDENTIFIED_ERROR +ERROR_UNKNOWN_COMPONENT +ERROR_UNKNOWN_FEATURE +ERROR_UNKNOWN_PATCH +ERROR_UNKNOWN_PORT +ERROR_UNKNOWN_PRINTER_DRIVER +ERROR_UNKNOWN_PRINTPROCESSOR +ERROR_UNKNOWN_PRODUCT +ERROR_UNKNOWN_PROPERTY +ERROR_UNKNOWN_REVISION +ERROR_UNRECOGNIZED_MEDIA +ERROR_UNRECOGNIZED_VOLUME +ERROR_UNSATISFIED_DEPENDENCIES +ERROR_UNSUPPORTED_COMPRESSION +ERROR_UNSUPPORTED_TYPE +ERROR_UNTRUSTED_MOUNT_POINT +ERROR_UNWIND +ERROR_UNWIND_CONSOLIDATE +ERROR_USER_APC +ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED +ERROR_USER_EXISTS +ERROR_USER_MAPPED_FILE +ERROR_USER_PROFILE_LOAD +ERROR_VALIDATE_CONTINUE +ERROR_VC_DISCONNECTED +ERROR_VDM_DISALLOWED +ERROR_VDM_HARD_ERROR +ERROR_VERIFIER_STOP +ERROR_VERSION_PARSE_ERROR +ERROR_VIRUS_DELETED +ERROR_VIRUS_INFECTED +ERROR_VOLSNAP_HIBERNATE_READY +ERROR_VOLSNAP_PREPARE_HIBERNATE +ERROR_VOLUME_MOUNTED +ERROR_VOLUME_NOT_CLUSTER_ALIGNED +ERROR_VOLUME_NOT_SIS_ENABLED +ERROR_VOLUME_NOT_SUPPORT_EFS +ERROR_VOLUME_NOT_SUPPORTED +ERROR_VOLUME_WRITE_ACCESS_DENIED +ERROR_WAIT_1 +ERROR_WAIT_2 +ERROR_WAIT_3 +ERROR_WAIT_63 +ERROR_WAIT_FOR_OPLOCK +ERROR_WAIT_NO_CHILDREN +ERROR_WAKE_SYSTEM +ERROR_WAKE_SYSTEM_DEBUGGER +ERROR_WAS_LOCKED +ERROR_WAS_UNLOCKED +ERROR_WEAK_WHFBKEY_BLOCKED +ERROR_WINDOW_NOT_COMBOBOX +ERROR_WINDOW_NOT_DIALOG +ERROR_WINDOW_OF_OTHER_THREAD +ERROR_WIP_ENCRYPTION_FAILED +ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT +ERROR_WOF_WIM_HEADER_CORRUPT +ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT +ERROR_WORKING_SET_QUOTA +ERROR_WOW_ASSERTION +ERROR_WRITE_FAULT +ERROR_WRITE_PROTECT +ERROR_WRONG_COMPARTMENT +ERROR_WRONG_DISK +ERROR_WRONG_EFS +ERROR_WRONG_PASSWORD +ERROR_WRONG_TARGET_NAME +ERROR_WX86_ERROR +ERROR_WX86_WARNING +ERROR_XML_PARSE_ERROR +ERROR_XMLDSIG_ERROR +EXCEPTION_DISPOSITION +EXCEPTION_MAXIMUM_PARAMETERS +EXCEPTION_RECORD +EXCEPTION_STACK_OVERFLOW +ExceptionCollidedUnwind +ExceptionContinueExecution +ExceptionContinueSearch +ExceptionNestedException +ExitProcess +EXTENDED_STARTUPINFO_PRESENT +FACILITY_CODE +FACILITY_NT_BIT +FALSE +FARPROC +FAST_FAIL_FATAL_APP_EXIT +FD_SET +FILE_ACCESS_RIGHTS +FILE_ADD_FILE +FILE_ADD_SUBDIRECTORY +FILE_ALL_ACCESS +FILE_ALLOCATION_INFO +FILE_APPEND_DATA +FILE_ATTRIBUTE_ARCHIVE +FILE_ATTRIBUTE_COMPRESSED +FILE_ATTRIBUTE_DEVICE +FILE_ATTRIBUTE_DIRECTORY +FILE_ATTRIBUTE_EA +FILE_ATTRIBUTE_ENCRYPTED +FILE_ATTRIBUTE_HIDDEN +FILE_ATTRIBUTE_INTEGRITY_STREAM +FILE_ATTRIBUTE_NO_SCRUB_DATA +FILE_ATTRIBUTE_NORMAL +FILE_ATTRIBUTE_NOT_CONTENT_INDEXED +FILE_ATTRIBUTE_OFFLINE +FILE_ATTRIBUTE_PINNED +FILE_ATTRIBUTE_READONLY +FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS +FILE_ATTRIBUTE_RECALL_ON_OPEN +FILE_ATTRIBUTE_REPARSE_POINT +FILE_ATTRIBUTE_SPARSE_FILE +FILE_ATTRIBUTE_SYSTEM +FILE_ATTRIBUTE_TAG_INFO +FILE_ATTRIBUTE_TEMPORARY +FILE_ATTRIBUTE_UNPINNED +FILE_ATTRIBUTE_VIRTUAL +FILE_BASIC_INFO +FILE_BEGIN +FILE_COMPLETE_IF_OPLOCKED +FILE_CONTAINS_EXTENDED_CREATE_INFORMATION +FILE_CREATE +FILE_CREATE_PIPE_INSTANCE +FILE_CREATE_TREE_CONNECTION +FILE_CREATION_DISPOSITION +FILE_CURRENT +FILE_DELETE_CHILD +FILE_DELETE_ON_CLOSE +FILE_DIRECTORY_FILE +FILE_DISALLOW_EXCLUSIVE +FILE_DISPOSITION_FLAG_DELETE +FILE_DISPOSITION_FLAG_DO_NOT_DELETE +FILE_DISPOSITION_FLAG_FORCE_IMAGE_SECTION_CHECK +FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE +FILE_DISPOSITION_FLAG_ON_CLOSE +FILE_DISPOSITION_FLAG_POSIX_SEMANTICS +FILE_DISPOSITION_INFO +FILE_DISPOSITION_INFO_EX +FILE_DISPOSITION_INFO_EX_FLAGS +FILE_END +FILE_END_OF_FILE_INFO +FILE_EXECUTE +FILE_FLAG_BACKUP_SEMANTICS +FILE_FLAG_DELETE_ON_CLOSE +FILE_FLAG_FIRST_PIPE_INSTANCE +FILE_FLAG_NO_BUFFERING +FILE_FLAG_OPEN_NO_RECALL +FILE_FLAG_OPEN_REPARSE_POINT +FILE_FLAG_OVERLAPPED +FILE_FLAG_POSIX_SEMANTICS +FILE_FLAG_RANDOM_ACCESS +FILE_FLAG_SEQUENTIAL_SCAN +FILE_FLAG_SESSION_AWARE +FILE_FLAG_WRITE_THROUGH +FILE_FLAGS_AND_ATTRIBUTES +FILE_GENERIC_EXECUTE +FILE_GENERIC_READ +FILE_GENERIC_WRITE +FILE_ID_BOTH_DIR_INFO +FILE_INFO_BY_HANDLE_CLASS +FILE_IO_PRIORITY_HINT_INFO +FILE_LIST_DIRECTORY +FILE_NAME_NORMALIZED +FILE_NAME_OPENED +FILE_NO_EA_KNOWLEDGE +FILE_NO_INTERMEDIATE_BUFFERING +FILE_NON_DIRECTORY_FILE +FILE_OPEN +FILE_OPEN_BY_FILE_ID +FILE_OPEN_FOR_BACKUP_INTENT +FILE_OPEN_FOR_FREE_SPACE_QUERY +FILE_OPEN_IF +FILE_OPEN_REPARSE_POINT +FILE_OPEN_REQUIRING_OPLOCK +FILE_OVERWRITE +FILE_OVERWRITE_IF +FILE_RANDOM_ACCESS +FILE_READ_ATTRIBUTES +FILE_READ_DATA +FILE_READ_EA +FILE_RENAME_FLAG_POSIX_SEMANTICS +FILE_RENAME_FLAG_REPLACE_IF_EXISTS +FILE_RENAME_INFO +FILE_RESERVE_OPFILTER +FILE_SEQUENTIAL_ONLY +FILE_SESSION_AWARE +FILE_SHARE_DELETE +FILE_SHARE_MODE +FILE_SHARE_NONE +FILE_SHARE_READ +FILE_SHARE_WRITE +FILE_STANDARD_INFO +FILE_SUPERSEDE +FILE_SYNCHRONOUS_IO_ALERT +FILE_SYNCHRONOUS_IO_NONALERT +FILE_TRAVERSE +FILE_TYPE +FILE_TYPE_CHAR +FILE_TYPE_DISK +FILE_TYPE_PIPE +FILE_TYPE_REMOTE +FILE_TYPE_UNKNOWN +FILE_WRITE_ATTRIBUTES +FILE_WRITE_DATA +FILE_WRITE_EA +FILE_WRITE_THROUGH +FileAlignmentInfo +FileAllocationInfo +FileAttributeTagInfo +FileBasicInfo +FileCaseSensitiveInfo +FileCompressionInfo +FileDispositionInfo +FileDispositionInfoEx +FileEndOfFileInfo +FileFullDirectoryInfo +FileFullDirectoryRestartInfo +FileIdBothDirectoryInfo +FileIdBothDirectoryRestartInfo +FileIdExtdDirectoryInfo +FileIdExtdDirectoryRestartInfo +FileIdInfo +FileIoPriorityHintInfo +FileNameInfo +FileNormalizedNameInfo +FileRemoteProtocolInfo +FileRenameInfo +FileRenameInfoEx +FileStandardInfo +FileStorageInfo +FileStreamInfo +FILETIME +FindClose +FindExInfoBasic +FindExSearchNameMatch +FindFirstFileExW +FindNextFileW +FIONBIO +FlushFileBuffers +FORMAT_MESSAGE_ALLOCATE_BUFFER +FORMAT_MESSAGE_ARGUMENT_ARRAY +FORMAT_MESSAGE_FROM_HMODULE +FORMAT_MESSAGE_FROM_STRING +FORMAT_MESSAGE_FROM_SYSTEM +FORMAT_MESSAGE_IGNORE_INSERTS +FORMAT_MESSAGE_OPTIONS +FormatMessageW +freeaddrinfo +FreeEnvironmentStringsW +FRS_ERR_SYSVOL_POPULATE_TIMEOUT +FSCTL_GET_REPARSE_POINT +FSCTL_SET_REPARSE_POINT +GENERIC_ACCESS_RIGHTS +GENERIC_ALL +GENERIC_EXECUTE +GENERIC_READ +GENERIC_WRITE +GetActiveProcessorCount +getaddrinfo +GetCommandLineW +GetConsoleMode +GetConsoleOutputCP +GetCurrentDirectoryW +GetCurrentProcess +GetCurrentProcessId +GetCurrentThread +GetEnvironmentStringsW +GetEnvironmentVariableW +GetExitCodeProcess +GetFileAttributesW +GetFileInformationByHandle +GetFileInformationByHandleEx +GetFileType +GETFINALPATHNAMEBYHANDLE_FLAGS +GetFinalPathNameByHandleW +GetFullPathNameW +GetLastError +GetModuleFileNameW +GetModuleHandleA +GetModuleHandleW +GetOverlappedResult +getpeername +GetProcAddress +GetProcessId +getsockname +getsockopt +GetStdHandle +GetSystemDirectoryW +GetSystemInfo +GetSystemTimeAsFileTime +GetSystemTimePreciseAsFileTime +GetTempPathW +GetUserProfileDirectoryW +GetWindowsDirectoryW +HANDLE +HANDLE_FLAG_INHERIT +HANDLE_FLAG_PROTECT_FROM_CLOSE +HANDLE_FLAGS +HIGH_PRIORITY_CLASS +HMODULE +IDLE_PRIORITY_CLASS +IN6_ADDR +IN_ADDR +INFINITE +INHERIT_CALLER_PRIORITY +INHERIT_PARENT_AFFINITY +INIT_ONCE_INIT_FAILED +InitializeProcThreadAttributeList +InitOnceBeginInitialize +InitOnceComplete +INVALID_FILE_ATTRIBUTES +INVALID_SOCKET +IO_REPARSE_TAG_MOUNT_POINT +IO_REPARSE_TAG_SYMLINK +ioctlsocket +IP_ADD_MEMBERSHIP +IP_DROP_MEMBERSHIP +IP_MREQ +IP_MULTICAST_LOOP +IP_MULTICAST_TTL +IP_TTL +IPPROTO +IPPROTO_AH +IPPROTO_CBT +IPPROTO_DSTOPTS +IPPROTO_EGP +IPPROTO_ESP +IPPROTO_FRAGMENT +IPPROTO_GGP +IPPROTO_HOPOPTS +IPPROTO_ICLFXBM +IPPROTO_ICMP +IPPROTO_ICMPV6 +IPPROTO_IDP +IPPROTO_IGMP +IPPROTO_IGP +IPPROTO_IP +IPPROTO_IPV4 +IPPROTO_IPV6 +IPPROTO_L2TP +IPPROTO_MAX +IPPROTO_ND +IPPROTO_NONE +IPPROTO_PGM +IPPROTO_PIM +IPPROTO_PUP +IPPROTO_RAW +IPPROTO_RDP +IPPROTO_RESERVED_IPSEC +IPPROTO_RESERVED_IPSECOFFLOAD +IPPROTO_RESERVED_MAX +IPPROTO_RESERVED_RAW +IPPROTO_RESERVED_WNV +IPPROTO_RM +IPPROTO_ROUTING +IPPROTO_SCTP +IPPROTO_ST +IPPROTO_TCP +IPPROTO_UDP +IPV6_ADD_MEMBERSHIP +IPV6_DROP_MEMBERSHIP +IPV6_MREQ +IPV6_MULTICAST_LOOP +IPV6_V6ONLY +LINGER +listen +LocalFree +LOCKFILE_EXCLUSIVE_LOCK +LOCKFILE_FAIL_IMMEDIATELY +LockFileEx +LPOVERLAPPED_COMPLETION_ROUTINE +LPPROC_THREAD_ATTRIBUTE_LIST +LPPROGRESS_ROUTINE +LPPROGRESS_ROUTINE_CALLBACK_REASON +LPTHREAD_START_ROUTINE +LPWSAOVERLAPPED_COMPLETION_ROUTINE +M128A +MAX_PATH +MAXIMUM_REPARSE_DATA_BUFFER_SIZE +MaximumFileInfoByHandleClass +MB_COMPOSITE +MB_ERR_INVALID_CHARS +MB_PRECOMPOSED +MB_USEGLYPHCHARS +MOVE_FILE_FLAGS +MOVEFILE_COPY_ALLOWED +MOVEFILE_CREATE_HARDLINK +MOVEFILE_DELAY_UNTIL_REBOOT +MOVEFILE_FAIL_IF_NOT_TRACKABLE +MOVEFILE_REPLACE_EXISTING +MOVEFILE_WRITE_THROUGH +MoveFileExW +MSG_DONTROUTE +MSG_OOB +MSG_PEEK +MSG_PUSH_IMMEDIATE +MSG_WAITALL +MULTI_BYTE_TO_WIDE_CHAR_FLAGS +MultiByteToWideChar +NAMED_PIPE_MODE +NO_ERROR +NORMAL_PRIORITY_CLASS +NtCreateFile +NTCREATEFILE_CREATE_DISPOSITION +NTCREATEFILE_CREATE_OPTIONS +NtOpenFile +NtReadFile +NTSTATUS +NtWriteFile +OBJ_DONT_REPARSE +OPEN_ALWAYS +OPEN_EXISTING +OpenProcessToken +OVERLAPPED +PIPE_ACCEPT_REMOTE_CLIENTS +PIPE_ACCESS_DUPLEX +PIPE_ACCESS_INBOUND +PIPE_ACCESS_OUTBOUND +PIPE_CLIENT_END +PIPE_NOWAIT +PIPE_READMODE_BYTE +PIPE_READMODE_MESSAGE +PIPE_REJECT_REMOTE_CLIENTS +PIPE_SERVER_END +PIPE_TYPE_BYTE +PIPE_TYPE_MESSAGE +PIPE_WAIT +PROCESS_CREATION_FLAGS +PROCESS_INFORMATION +PROCESS_MODE_BACKGROUND_BEGIN +PROCESS_MODE_BACKGROUND_END +PROCESSOR_ARCHITECTURE +PROFILE_KERNEL +PROFILE_SERVER +PROFILE_USER +PROGRESS_CONTINUE +QueryPerformanceCounter +QueryPerformanceFrequency +READ_CONTROL +ReadConsoleW +ReadFile +ReadFileEx +REALTIME_PRIORITY_CLASS +recv +recvfrom +ReleaseSRWLockExclusive +ReleaseSRWLockShared +RemoveDirectoryW +RtlGenRandom +RtlNtStatusToDosError +SD_BOTH +SD_RECEIVE +SD_SEND +SECURITY_ANONYMOUS +SECURITY_ATTRIBUTES +SECURITY_CONTEXT_TRACKING +SECURITY_DELEGATION +SECURITY_EFFECTIVE_ONLY +SECURITY_IDENTIFICATION +SECURITY_IMPERSONATION +SECURITY_SQOS_PRESENT +SECURITY_VALID_SQOS_FLAGS +select +send +SEND_RECV_FLAGS +sendto +SET_FILE_POINTER_MOVE_METHOD +SetCurrentDirectoryW +SetEnvironmentVariableW +SetFileAttributesW +SetFileInformationByHandle +SetFilePointerEx +SetFileTime +SetHandleInformation +SetLastError +setsockopt +SetThreadStackGuarantee +SetWaitableTimer +shutdown +Sleep +SleepConditionVariableSRW +SleepEx +SO_BROADCAST +SO_ERROR +SO_LINGER +SO_RCVTIMEO +SO_SNDTIMEO +SOCK_DGRAM +SOCK_RAW +SOCK_RDM +SOCK_SEQPACKET +SOCK_STREAM +SOCKADDR +SOCKADDR_STORAGE +SOCKADDR_UN +SOCKET +SOCKET_ERROR +SOL_SOCKET +SPECIFIC_RIGHTS_ALL +STACK_SIZE_PARAM_IS_A_RESERVATION +STANDARD_RIGHTS_ALL +STANDARD_RIGHTS_EXECUTE +STANDARD_RIGHTS_READ +STANDARD_RIGHTS_REQUIRED +STANDARD_RIGHTS_WRITE +STARTF_FORCEOFFFEEDBACK +STARTF_FORCEONFEEDBACK +STARTF_PREVENTPINNING +STARTF_RUNFULLSCREEN +STARTF_TITLEISAPPID +STARTF_TITLEISLINKNAME +STARTF_UNTRUSTEDSOURCE +STARTF_USECOUNTCHARS +STARTF_USEFILLATTRIBUTE +STARTF_USEHOTKEY +STARTF_USEPOSITION +STARTF_USESHOWWINDOW +STARTF_USESIZE +STARTF_USESTDHANDLES +STARTUPINFOEXW +STARTUPINFOW +STARTUPINFOW_FLAGS +STATUS_DELETE_PENDING +STATUS_DIRECTORY_NOT_EMPTY +STATUS_END_OF_FILE +STATUS_FILE_DELETED +STATUS_INVALID_HANDLE +STATUS_INVALID_PARAMETER +STATUS_NOT_IMPLEMENTED +STATUS_PENDING +STATUS_SHARING_VIOLATION +STATUS_SUCCESS +STD_ERROR_HANDLE +STD_HANDLE +STD_INPUT_HANDLE +STD_OUTPUT_HANDLE +SwitchToThread +SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE +SYMBOLIC_LINK_FLAG_DIRECTORY +SYMBOLIC_LINK_FLAGS +SYMLINK_FLAG_RELATIVE +SYNCHRONIZE +SYSTEM_INFO +TCP_NODELAY +TerminateProcess +THREAD_CREATE_RUN_IMMEDIATELY +THREAD_CREATE_SUSPENDED +THREAD_CREATION_FLAGS +TIMER_ALL_ACCESS +TIMER_MODIFY_STATE +TIMEVAL +TLS_OUT_OF_INDEXES +TlsAlloc +TlsFree +TlsGetValue +TlsSetValue +TOKEN_ACCESS_MASK +TOKEN_ACCESS_PSEUDO_HANDLE +TOKEN_ACCESS_PSEUDO_HANDLE_WIN8 +TOKEN_ACCESS_SYSTEM_SECURITY +TOKEN_ADJUST_DEFAULT +TOKEN_ADJUST_GROUPS +TOKEN_ADJUST_PRIVILEGES +TOKEN_ADJUST_SESSIONID +TOKEN_ALL_ACCESS +TOKEN_ASSIGN_PRIMARY +TOKEN_DELETE +TOKEN_DUPLICATE +TOKEN_EXECUTE +TOKEN_IMPERSONATE +TOKEN_QUERY +TOKEN_QUERY_SOURCE +TOKEN_READ +TOKEN_READ_CONTROL +TOKEN_TRUST_CONSTRAINT_MASK +TOKEN_WRITE +TOKEN_WRITE_DAC +TOKEN_WRITE_OWNER +TRUE +TRUNCATE_EXISTING +TryAcquireSRWLockExclusive +TryAcquireSRWLockShared +UNICODE_STRING +UnlockFile +UpdateProcThreadAttribute +VOLUME_NAME_DOS +VOLUME_NAME_GUID +VOLUME_NAME_NONE +WAIT_ABANDONED +WAIT_ABANDONED_0 +WAIT_FAILED +WAIT_IO_COMPLETION +WAIT_OBJECT_0 +WAIT_TIMEOUT +WaitForMultipleObjects +WaitForSingleObject +WakeAllConditionVariable +WakeConditionVariable +WC_ERR_INVALID_CHARS +WideCharToMultiByte +WIN32_ERROR +WIN32_FIND_DATAW Windows.Wdk.Storage.FileSystem.FILE_NO_COMPRESSION -Windows.Wdk.Storage.FileSystem.FILE_NO_EA_KNOWLEDGE -Windows.Wdk.Storage.FileSystem.FILE_NO_INTERMEDIATE_BUFFERING -Windows.Wdk.Storage.FileSystem.FILE_NON_DIRECTORY_FILE -Windows.Wdk.Storage.FileSystem.FILE_OPEN -Windows.Wdk.Storage.FileSystem.FILE_OPEN_BY_FILE_ID -Windows.Wdk.Storage.FileSystem.FILE_OPEN_FOR_BACKUP_INTENT -Windows.Wdk.Storage.FileSystem.FILE_OPEN_FOR_FREE_SPACE_QUERY -Windows.Wdk.Storage.FileSystem.FILE_OPEN_IF Windows.Wdk.Storage.FileSystem.FILE_OPEN_NO_RECALL -Windows.Wdk.Storage.FileSystem.FILE_OPEN_REPARSE_POINT -Windows.Wdk.Storage.FileSystem.FILE_OPEN_REQUIRING_OPLOCK -Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE -Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE_IF -Windows.Wdk.Storage.FileSystem.FILE_RANDOM_ACCESS -Windows.Wdk.Storage.FileSystem.FILE_RESERVE_OPFILTER -Windows.Wdk.Storage.FileSystem.FILE_SEQUENTIAL_ONLY -Windows.Wdk.Storage.FileSystem.FILE_SESSION_AWARE -Windows.Wdk.Storage.FileSystem.FILE_SUPERSEDE -Windows.Wdk.Storage.FileSystem.FILE_SYNCHRONOUS_IO_ALERT -Windows.Wdk.Storage.FileSystem.FILE_SYNCHRONOUS_IO_NONALERT -Windows.Wdk.Storage.FileSystem.FILE_WRITE_THROUGH -Windows.Wdk.Storage.FileSystem.NtCreateFile -Windows.Wdk.Storage.FileSystem.NTCREATEFILE_CREATE_DISPOSITION -Windows.Wdk.Storage.FileSystem.NTCREATEFILE_CREATE_OPTIONS -Windows.Wdk.Storage.FileSystem.NtOpenFile -Windows.Wdk.Storage.FileSystem.NtReadFile -Windows.Wdk.Storage.FileSystem.NtWriteFile -Windows.Wdk.Storage.FileSystem.SYMLINK_FLAG_RELATIVE -Windows.Win32.Foundation.BOOL -Windows.Win32.Foundation.BOOLEAN -Windows.Win32.Foundation.CloseHandle -Windows.Win32.Foundation.DNS_ERROR_ADDRESS_REQUIRED -Windows.Win32.Foundation.DNS_ERROR_ALIAS_LOOP -Windows.Win32.Foundation.DNS_ERROR_AUTOZONE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_AXFR -Windows.Win32.Foundation.DNS_ERROR_BACKGROUND_LOADING -Windows.Win32.Foundation.DNS_ERROR_BAD_KEYMASTER -Windows.Win32.Foundation.DNS_ERROR_BAD_PACKET -Windows.Win32.Foundation.DNS_ERROR_CANNOT_FIND_ROOT_HINTS -Windows.Win32.Foundation.DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED -Windows.Win32.Foundation.DNS_ERROR_CNAME_COLLISION -Windows.Win32.Foundation.DNS_ERROR_CNAME_LOOP -Windows.Win32.Foundation.DNS_ERROR_DATAFILE_OPEN_FAILURE -Windows.Win32.Foundation.DNS_ERROR_DATAFILE_PARSING -Windows.Win32.Foundation.DNS_ERROR_DEFAULT_SCOPE -Windows.Win32.Foundation.DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE -Windows.Win32.Foundation.DNS_ERROR_DEFAULT_ZONESCOPE -Windows.Win32.Foundation.DNS_ERROR_DELEGATION_REQUIRED -Windows.Win32.Foundation.DNS_ERROR_DNAME_COLLISION -Windows.Win32.Foundation.DNS_ERROR_DNSSEC_IS_DISABLED -Windows.Win32.Foundation.DNS_ERROR_DP_ALREADY_ENLISTED -Windows.Win32.Foundation.DNS_ERROR_DP_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_DP_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_DP_FSMO_ERROR -Windows.Win32.Foundation.DNS_ERROR_DP_NOT_AVAILABLE -Windows.Win32.Foundation.DNS_ERROR_DP_NOT_ENLISTED -Windows.Win32.Foundation.DNS_ERROR_DS_UNAVAILABLE -Windows.Win32.Foundation.DNS_ERROR_DS_ZONE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_DWORD_VALUE_TOO_LARGE -Windows.Win32.Foundation.DNS_ERROR_DWORD_VALUE_TOO_SMALL -Windows.Win32.Foundation.DNS_ERROR_FILE_WRITEBACK_FAILED -Windows.Win32.Foundation.DNS_ERROR_FORWARDER_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_INCONSISTENT_ROOT_HINTS -Windows.Win32.Foundation.DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_CLIENT_SUBNET_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_DATA -Windows.Win32.Foundation.DNS_ERROR_INVALID_DATAFILE_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET -Windows.Win32.Foundation.DNS_ERROR_INVALID_IP_ADDRESS -Windows.Win32.Foundation.DNS_ERROR_INVALID_KEY_SIZE -Windows.Win32.Foundation.DNS_ERROR_INVALID_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_NAME_CHAR -Windows.Win32.Foundation.DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT -Windows.Win32.Foundation.DNS_ERROR_INVALID_POLICY_TABLE -Windows.Win32.Foundation.DNS_ERROR_INVALID_PROPERTY -Windows.Win32.Foundation.DNS_ERROR_INVALID_ROLLOVER_PERIOD -Windows.Win32.Foundation.DNS_ERROR_INVALID_SCOPE_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_SCOPE_OPERATION -Windows.Win32.Foundation.DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD -Windows.Win32.Foundation.DNS_ERROR_INVALID_TYPE -Windows.Win32.Foundation.DNS_ERROR_INVALID_XML -Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONE_OPERATION -Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONE_TYPE -Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONESCOPE_NAME -Windows.Win32.Foundation.DNS_ERROR_KEYMASTER_REQUIRED -Windows.Win32.Foundation.DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION -Windows.Win32.Foundation.DNS_ERROR_KSP_NOT_ACCESSIBLE -Windows.Win32.Foundation.DNS_ERROR_LOAD_ZONESCOPE_FAILED -Windows.Win32.Foundation.DNS_ERROR_NAME_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_NAME_NOT_IN_ZONE -Windows.Win32.Foundation.DNS_ERROR_NBSTAT_INIT_FAILED -Windows.Win32.Foundation.DNS_ERROR_NEED_SECONDARY_ADDRESSES -Windows.Win32.Foundation.DNS_ERROR_NEED_WINS_SERVERS -Windows.Win32.Foundation.DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE -Windows.Win32.Foundation.DNS_ERROR_NO_CREATE_CACHE_DATA -Windows.Win32.Foundation.DNS_ERROR_NO_DNS_SERVERS -Windows.Win32.Foundation.DNS_ERROR_NO_MEMORY -Windows.Win32.Foundation.DNS_ERROR_NO_PACKET -Windows.Win32.Foundation.DNS_ERROR_NO_TCPIP -Windows.Win32.Foundation.DNS_ERROR_NO_VALID_TRUST_ANCHORS -Windows.Win32.Foundation.DNS_ERROR_NO_ZONE_INFO -Windows.Win32.Foundation.DNS_ERROR_NODE_CREATION_FAILED -Windows.Win32.Foundation.DNS_ERROR_NODE_IS_CNAME -Windows.Win32.Foundation.DNS_ERROR_NODE_IS_DNAME -Windows.Win32.Foundation.DNS_ERROR_NON_RFC_NAME -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_RODC -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_ZSK -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_UNDER_DNAME -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES -Windows.Win32.Foundation.DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS -Windows.Win32.Foundation.DNS_ERROR_NOT_UNIQUE -Windows.Win32.Foundation.DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1 -Windows.Win32.Foundation.DNS_ERROR_NSEC3_NAME_COLLISION -Windows.Win32.Foundation.DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1 -Windows.Win32.Foundation.DNS_ERROR_NUMERIC_NAME -Windows.Win32.Foundation.DNS_ERROR_POLICY_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_POLICY_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_NAME -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_SETTINGS -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_WEIGHT -Windows.Win32.Foundation.DNS_ERROR_POLICY_LOCKED -Windows.Win32.Foundation.DNS_ERROR_POLICY_MISSING_CRITERIA -Windows.Win32.Foundation.DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID -Windows.Win32.Foundation.DNS_ERROR_POLICY_SCOPE_MISSING -Windows.Win32.Foundation.DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED -Windows.Win32.Foundation.DNS_ERROR_PRIMARY_REQUIRES_DATAFILE -Windows.Win32.Foundation.DNS_ERROR_RCODE -Windows.Win32.Foundation.DNS_ERROR_RCODE_BADKEY -Windows.Win32.Foundation.DNS_ERROR_RCODE_BADSIG -Windows.Win32.Foundation.DNS_ERROR_RCODE_BADTIME -Windows.Win32.Foundation.DNS_ERROR_RCODE_FORMAT_ERROR -Windows.Win32.Foundation.DNS_ERROR_RCODE_NAME_ERROR -Windows.Win32.Foundation.DNS_ERROR_RCODE_NOT_IMPLEMENTED -Windows.Win32.Foundation.DNS_ERROR_RCODE_NOTAUTH -Windows.Win32.Foundation.DNS_ERROR_RCODE_NOTZONE -Windows.Win32.Foundation.DNS_ERROR_RCODE_NXRRSET -Windows.Win32.Foundation.DNS_ERROR_RCODE_REFUSED -Windows.Win32.Foundation.DNS_ERROR_RCODE_SERVER_FAILURE -Windows.Win32.Foundation.DNS_ERROR_RCODE_YXDOMAIN -Windows.Win32.Foundation.DNS_ERROR_RCODE_YXRRSET -Windows.Win32.Foundation.DNS_ERROR_RECORD_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_RECORD_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_RECORD_FORMAT -Windows.Win32.Foundation.DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT -Windows.Win32.Foundation.DNS_ERROR_RECORD_TIMED_OUT -Windows.Win32.Foundation.DNS_ERROR_ROLLOVER_ALREADY_QUEUED -Windows.Win32.Foundation.DNS_ERROR_ROLLOVER_IN_PROGRESS -Windows.Win32.Foundation.DNS_ERROR_ROLLOVER_NOT_POKEABLE -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_IPV4_PREFIX -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_IPV6_PREFIX -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_LEAK_RATE -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_TC_RATE -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_WINDOW_SIZE -Windows.Win32.Foundation.DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE -Windows.Win32.Foundation.DNS_ERROR_RRL_NOT_ENABLED -Windows.Win32.Foundation.DNS_ERROR_SCOPE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_SCOPE_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_SCOPE_LOCKED -Windows.Win32.Foundation.DNS_ERROR_SECONDARY_DATA -Windows.Win32.Foundation.DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP -Windows.Win32.Foundation.DNS_ERROR_SERVERSCOPE_IS_REFERENCED -Windows.Win32.Foundation.DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE -Windows.Win32.Foundation.DNS_ERROR_SOA_DELETE_INVALID -Windows.Win32.Foundation.DNS_ERROR_STANDBY_KEY_NOT_PRESENT -Windows.Win32.Foundation.DNS_ERROR_SUBNET_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_SUBNET_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_TOO_MANY_SKDS -Windows.Win32.Foundation.DNS_ERROR_TRY_AGAIN_LATER -Windows.Win32.Foundation.DNS_ERROR_UNEXPECTED_CNG_ERROR -Windows.Win32.Foundation.DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR -Windows.Win32.Foundation.DNS_ERROR_UNKNOWN_RECORD_TYPE -Windows.Win32.Foundation.DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION -Windows.Win32.Foundation.DNS_ERROR_UNSECURE_PACKET -Windows.Win32.Foundation.DNS_ERROR_UNSUPPORTED_ALGORITHM -Windows.Win32.Foundation.DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_VIRTUALIZATION_TREE_LOCKED -Windows.Win32.Foundation.DNS_ERROR_WINS_INIT_FAILED -Windows.Win32.Foundation.DNS_ERROR_ZONE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_ZONE_CONFIGURATION_ERROR -Windows.Win32.Foundation.DNS_ERROR_ZONE_CREATION_FAILED -Windows.Win32.Foundation.DNS_ERROR_ZONE_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_ZONE_HAS_NO_NS_RECORDS -Windows.Win32.Foundation.DNS_ERROR_ZONE_HAS_NO_SOA_RECORD -Windows.Win32.Foundation.DNS_ERROR_ZONE_IS_SHUTDOWN -Windows.Win32.Foundation.DNS_ERROR_ZONE_LOCKED -Windows.Win32.Foundation.DNS_ERROR_ZONE_LOCKED_FOR_SIGNING -Windows.Win32.Foundation.DNS_ERROR_ZONE_NOT_SECONDARY -Windows.Win32.Foundation.DNS_ERROR_ZONE_REQUIRES_MASTER_IP -Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED -Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_IS_REFERENCED -Windows.Win32.Foundation.DUPLICATE_CLOSE_SOURCE -Windows.Win32.Foundation.DUPLICATE_HANDLE_OPTIONS -Windows.Win32.Foundation.DUPLICATE_SAME_ACCESS -Windows.Win32.Foundation.DuplicateHandle -Windows.Win32.Foundation.E_NOTIMPL -Windows.Win32.Foundation.ERROR_ABANDON_HIBERFILE -Windows.Win32.Foundation.ERROR_ABANDONED_WAIT_0 -Windows.Win32.Foundation.ERROR_ABANDONED_WAIT_63 -Windows.Win32.Foundation.ERROR_ABIOS_ERROR -Windows.Win32.Foundation.ERROR_ACCESS_AUDIT_BY_POLICY -Windows.Win32.Foundation.ERROR_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_ACCESS_DENIED_APPDATA -Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_BY_POLICY -Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY -Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_WEBBLADE -Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER -Windows.Win32.Foundation.ERROR_ACCOUNT_DISABLED -Windows.Win32.Foundation.ERROR_ACCOUNT_EXPIRED -Windows.Win32.Foundation.ERROR_ACCOUNT_LOCKED_OUT -Windows.Win32.Foundation.ERROR_ACCOUNT_RESTRICTION -Windows.Win32.Foundation.ERROR_ACPI_ERROR -Windows.Win32.Foundation.ERROR_ACTIVE_CONNECTIONS -Windows.Win32.Foundation.ERROR_ADAP_HDW_ERR -Windows.Win32.Foundation.ERROR_ADDRESS_ALREADY_ASSOCIATED -Windows.Win32.Foundation.ERROR_ADDRESS_NOT_ASSOCIATED -Windows.Win32.Foundation.ERROR_ALERTED -Windows.Win32.Foundation.ERROR_ALIAS_EXISTS -Windows.Win32.Foundation.ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_ALLOCATE_BUCKET -Windows.Win32.Foundation.ERROR_ALLOTTED_SPACE_EXCEEDED -Windows.Win32.Foundation.ERROR_ALREADY_ASSIGNED -Windows.Win32.Foundation.ERROR_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_ALREADY_FIBER -Windows.Win32.Foundation.ERROR_ALREADY_HAS_STREAM_ID -Windows.Win32.Foundation.ERROR_ALREADY_INITIALIZED -Windows.Win32.Foundation.ERROR_ALREADY_REGISTERED -Windows.Win32.Foundation.ERROR_ALREADY_RUNNING_LKG -Windows.Win32.Foundation.ERROR_ALREADY_THREAD -Windows.Win32.Foundation.ERROR_ALREADY_WAITING -Windows.Win32.Foundation.ERROR_ALREADY_WIN32 -Windows.Win32.Foundation.ERROR_API_UNAVAILABLE -Windows.Win32.Foundation.ERROR_APP_HANG -Windows.Win32.Foundation.ERROR_APP_INIT_FAILURE -Windows.Win32.Foundation.ERROR_APP_WRONG_OS -Windows.Win32.Foundation.ERROR_APPCONTAINER_REQUIRED -Windows.Win32.Foundation.ERROR_APPEXEC_APP_COMPAT_BLOCK -Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT -Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_LICENSING -Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_RESOURCES -Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_TERMINATION -Windows.Win32.Foundation.ERROR_APPEXEC_CONDITION_NOT_SATISFIED -Windows.Win32.Foundation.ERROR_APPEXEC_HANDLE_INVALIDATED -Windows.Win32.Foundation.ERROR_APPEXEC_HOST_ID_MISMATCH -Windows.Win32.Foundation.ERROR_APPEXEC_INVALID_HOST_GENERATION -Windows.Win32.Foundation.ERROR_APPEXEC_INVALID_HOST_STATE -Windows.Win32.Foundation.ERROR_APPEXEC_NO_DONOR -Windows.Win32.Foundation.ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION -Windows.Win32.Foundation.ERROR_APPEXEC_UNKNOWN_USER -Windows.Win32.Foundation.ERROR_APPHELP_BLOCK -Windows.Win32.Foundation.ERROR_APPX_FILE_NOT_ENCRYPTED -Windows.Win32.Foundation.ERROR_ARBITRATION_UNHANDLED -Windows.Win32.Foundation.ERROR_ARENA_TRASHED -Windows.Win32.Foundation.ERROR_ARITHMETIC_OVERFLOW -Windows.Win32.Foundation.ERROR_ASSERTION_FAILURE -Windows.Win32.Foundation.ERROR_ATOMIC_LOCKS_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_AUDIT_FAILED -Windows.Win32.Foundation.ERROR_AUTHENTICATION_FIREWALL_FAILED -Windows.Win32.Foundation.ERROR_AUTHIP_FAILURE -Windows.Win32.Foundation.ERROR_AUTODATASEG_EXCEEDS_64k -Windows.Win32.Foundation.ERROR_BACKUP_CONTROLLER -Windows.Win32.Foundation.ERROR_BAD_ACCESSOR_FLAGS -Windows.Win32.Foundation.ERROR_BAD_ARGUMENTS -Windows.Win32.Foundation.ERROR_BAD_COMMAND -Windows.Win32.Foundation.ERROR_BAD_COMPRESSION_BUFFER -Windows.Win32.Foundation.ERROR_BAD_CONFIGURATION -Windows.Win32.Foundation.ERROR_BAD_CURRENT_DIRECTORY -Windows.Win32.Foundation.ERROR_BAD_DESCRIPTOR_FORMAT -Windows.Win32.Foundation.ERROR_BAD_DEV_TYPE -Windows.Win32.Foundation.ERROR_BAD_DEVICE -Windows.Win32.Foundation.ERROR_BAD_DEVICE_PATH -Windows.Win32.Foundation.ERROR_BAD_DLL_ENTRYPOINT -Windows.Win32.Foundation.ERROR_BAD_DRIVER_LEVEL -Windows.Win32.Foundation.ERROR_BAD_ENVIRONMENT -Windows.Win32.Foundation.ERROR_BAD_EXE_FORMAT -Windows.Win32.Foundation.ERROR_BAD_FILE_TYPE -Windows.Win32.Foundation.ERROR_BAD_FORMAT -Windows.Win32.Foundation.ERROR_BAD_FUNCTION_TABLE -Windows.Win32.Foundation.ERROR_BAD_IMPERSONATION_LEVEL -Windows.Win32.Foundation.ERROR_BAD_INHERITANCE_ACL -Windows.Win32.Foundation.ERROR_BAD_LENGTH -Windows.Win32.Foundation.ERROR_BAD_LOGON_SESSION_STATE -Windows.Win32.Foundation.ERROR_BAD_MCFG_TABLE -Windows.Win32.Foundation.ERROR_BAD_NET_NAME -Windows.Win32.Foundation.ERROR_BAD_NET_RESP -Windows.Win32.Foundation.ERROR_BAD_NETPATH -Windows.Win32.Foundation.ERROR_BAD_PATHNAME -Windows.Win32.Foundation.ERROR_BAD_PIPE -Windows.Win32.Foundation.ERROR_BAD_PROFILE -Windows.Win32.Foundation.ERROR_BAD_PROVIDER -Windows.Win32.Foundation.ERROR_BAD_QUERY_SYNTAX -Windows.Win32.Foundation.ERROR_BAD_RECOVERY_POLICY -Windows.Win32.Foundation.ERROR_BAD_REM_ADAP -Windows.Win32.Foundation.ERROR_BAD_SERVICE_ENTRYPOINT -Windows.Win32.Foundation.ERROR_BAD_STACK -Windows.Win32.Foundation.ERROR_BAD_THREADID_ADDR -Windows.Win32.Foundation.ERROR_BAD_TOKEN_TYPE -Windows.Win32.Foundation.ERROR_BAD_UNIT -Windows.Win32.Foundation.ERROR_BAD_USER_PROFILE -Windows.Win32.Foundation.ERROR_BAD_USERNAME -Windows.Win32.Foundation.ERROR_BAD_VALIDATION_CLASS -Windows.Win32.Foundation.ERROR_BADDB -Windows.Win32.Foundation.ERROR_BADKEY -Windows.Win32.Foundation.ERROR_BADSTARTPOSITION -Windows.Win32.Foundation.ERROR_BEGINNING_OF_MEDIA -Windows.Win32.Foundation.ERROR_BEYOND_VDL -Windows.Win32.Foundation.ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT -Windows.Win32.Foundation.ERROR_BLOCK_SHARED -Windows.Win32.Foundation.ERROR_BLOCK_SOURCE_WEAK_REFERENCE_INVALID -Windows.Win32.Foundation.ERROR_BLOCK_TARGET_WEAK_REFERENCE_INVALID -Windows.Win32.Foundation.ERROR_BLOCK_TOO_MANY_REFERENCES -Windows.Win32.Foundation.ERROR_BLOCK_WEAK_REFERENCE_INVALID -Windows.Win32.Foundation.ERROR_BLOCKED_BY_PARENTAL_CONTROLS -Windows.Win32.Foundation.ERROR_BOOT_ALREADY_ACCEPTED -Windows.Win32.Foundation.ERROR_BROKEN_PIPE -Windows.Win32.Foundation.ERROR_BUFFER_ALL_ZEROS -Windows.Win32.Foundation.ERROR_BUFFER_OVERFLOW -Windows.Win32.Foundation.ERROR_BUS_RESET -Windows.Win32.Foundation.ERROR_BUSY -Windows.Win32.Foundation.ERROR_BUSY_DRIVE -Windows.Win32.Foundation.ERROR_BYPASSIO_FLT_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CACHE_PAGE_LOCKED -Windows.Win32.Foundation.ERROR_CALL_NOT_IMPLEMENTED -Windows.Win32.Foundation.ERROR_CALLBACK_INVOKE_INLINE -Windows.Win32.Foundation.ERROR_CALLBACK_POP_STACK -Windows.Win32.Foundation.ERROR_CALLBACK_SUPPLIED_INVALID_DATA -Windows.Win32.Foundation.ERROR_CAN_NOT_COMPLETE -Windows.Win32.Foundation.ERROR_CANCEL_VIOLATION -Windows.Win32.Foundation.ERROR_CANCELLED -Windows.Win32.Foundation.ERROR_CANNOT_BREAK_OPLOCK -Windows.Win32.Foundation.ERROR_CANNOT_COPY -Windows.Win32.Foundation.ERROR_CANNOT_DETECT_DRIVER_FAILURE -Windows.Win32.Foundation.ERROR_CANNOT_DETECT_PROCESS_ABORT -Windows.Win32.Foundation.ERROR_CANNOT_FIND_WND_CLASS -Windows.Win32.Foundation.ERROR_CANNOT_GRANT_REQUESTED_OPLOCK -Windows.Win32.Foundation.ERROR_CANNOT_IMPERSONATE -Windows.Win32.Foundation.ERROR_CANNOT_LOAD_REGISTRY_FILE -Windows.Win32.Foundation.ERROR_CANNOT_MAKE -Windows.Win32.Foundation.ERROR_CANNOT_OPEN_PROFILE -Windows.Win32.Foundation.ERROR_CANT_ACCESS_DOMAIN_INFO -Windows.Win32.Foundation.ERROR_CANT_ACCESS_FILE -Windows.Win32.Foundation.ERROR_CANT_CLEAR_ENCRYPTION_FLAG -Windows.Win32.Foundation.ERROR_CANT_DISABLE_MANDATORY -Windows.Win32.Foundation.ERROR_CANT_ENABLE_DENY_ONLY -Windows.Win32.Foundation.ERROR_CANT_OPEN_ANONYMOUS -Windows.Win32.Foundation.ERROR_CANT_RESOLVE_FILENAME -Windows.Win32.Foundation.ERROR_CANT_TERMINATE_SELF -Windows.Win32.Foundation.ERROR_CANT_WAIT -Windows.Win32.Foundation.ERROR_CANTFETCHBACKWARDS -Windows.Win32.Foundation.ERROR_CANTOPEN -Windows.Win32.Foundation.ERROR_CANTREAD -Windows.Win32.Foundation.ERROR_CANTSCROLLBACKWARDS -Windows.Win32.Foundation.ERROR_CANTWRITE -Windows.Win32.Foundation.ERROR_CAPAUTHZ_CHANGE_TYPE -Windows.Win32.Foundation.ERROR_CAPAUTHZ_DB_CORRUPTED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_NO_POLICY -Windows.Win32.Foundation.ERROR_CAPAUTHZ_NOT_AUTHORIZED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_NOT_DEVUNLOCKED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_NOT_PROVISIONED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_PARSE_ERROR -Windows.Win32.Foundation.ERROR_CARDBUS_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CASE_DIFFERING_NAMES_IN_DIR -Windows.Win32.Foundation.ERROR_CASE_SENSITIVE_PATH -Windows.Win32.Foundation.ERROR_CERTIFICATE_VALIDATION_PREFERENCE_CONFLICT -Windows.Win32.Foundation.ERROR_CHECKING_FILE_SYSTEM -Windows.Win32.Foundation.ERROR_CHECKOUT_REQUIRED -Windows.Win32.Foundation.ERROR_CHILD_MUST_BE_VOLATILE -Windows.Win32.Foundation.ERROR_CHILD_NOT_COMPLETE -Windows.Win32.Foundation.ERROR_CHILD_PROCESS_BLOCKED -Windows.Win32.Foundation.ERROR_CHILD_WINDOW_MENU -Windows.Win32.Foundation.ERROR_CIMFS_IMAGE_CORRUPT -Windows.Win32.Foundation.ERROR_CIMFS_IMAGE_VERSION_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CIRCULAR_DEPENDENCY -Windows.Win32.Foundation.ERROR_CLASS_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_CLASS_DOES_NOT_EXIST -Windows.Win32.Foundation.ERROR_CLASS_HAS_WINDOWS -Windows.Win32.Foundation.ERROR_CLIENT_SERVER_PARAMETERS_INVALID -Windows.Win32.Foundation.ERROR_CLIPBOARD_NOT_OPEN -Windows.Win32.Foundation.ERROR_CLOUD_FILE_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_ALREADY_CONNECTED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_AUTHENTICATION_FAILED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY -Windows.Win32.Foundation.ERROR_CLOUD_FILE_DEHYDRATION_DISALLOWED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_IN_USE -Windows.Win32.Foundation.ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS -Windows.Win32.Foundation.ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES -Windows.Win32.Foundation.ERROR_CLOUD_FILE_INVALID_REQUEST -Windows.Win32.Foundation.ERROR_CLOUD_FILE_METADATA_CORRUPT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_METADATA_TOO_LARGE -Windows.Win32.Foundation.ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE -Windows.Win32.Foundation.ERROR_CLOUD_FILE_NOT_IN_SYNC -Windows.Win32.Foundation.ERROR_CLOUD_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PINNED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_CORRUPT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROVIDER_TERMINATED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_READ_ONLY_VOLUME -Windows.Win32.Foundation.ERROR_CLOUD_FILE_REQUEST_ABORTED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_REQUEST_CANCELED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_REQUEST_TIMEOUT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS -Windows.Win32.Foundation.ERROR_CLOUD_FILE_UNSUCCESSFUL -Windows.Win32.Foundation.ERROR_CLOUD_FILE_US_MESSAGE_TIMEOUT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_VALIDATION_FAILED -Windows.Win32.Foundation.ERROR_COMMITMENT_LIMIT -Windows.Win32.Foundation.ERROR_COMMITMENT_MINIMUM -Windows.Win32.Foundation.ERROR_COMPRESSED_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_COMPRESSION_DISABLED -Windows.Win32.Foundation.ERROR_COMPRESSION_NOT_BENEFICIAL -Windows.Win32.Foundation.ERROR_CONNECTED_OTHER_PASSWORD -Windows.Win32.Foundation.ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT -Windows.Win32.Foundation.ERROR_CONNECTION_ABORTED -Windows.Win32.Foundation.ERROR_CONNECTION_ACTIVE -Windows.Win32.Foundation.ERROR_CONNECTION_COUNT_LIMIT -Windows.Win32.Foundation.ERROR_CONNECTION_INVALID -Windows.Win32.Foundation.ERROR_CONNECTION_REFUSED -Windows.Win32.Foundation.ERROR_CONNECTION_UNAVAIL -Windows.Win32.Foundation.ERROR_CONTAINER_ASSIGNED -Windows.Win32.Foundation.ERROR_CONTENT_BLOCKED -Windows.Win32.Foundation.ERROR_CONTEXT_EXPIRED -Windows.Win32.Foundation.ERROR_CONTINUE -Windows.Win32.Foundation.ERROR_CONTROL_C_EXIT -Windows.Win32.Foundation.ERROR_CONTROL_ID_NOT_FOUND -Windows.Win32.Foundation.ERROR_CONVERT_TO_LARGE -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_CLEARED -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_CORRUPTED -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_DELETED_FULL -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_OVERFULL -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_UNAVAILABLE -Windows.Win32.Foundation.ERROR_CORRUPT_SYSTEM_FILE -Windows.Win32.Foundation.ERROR_COULD_NOT_INTERPRET -Windows.Win32.Foundation.ERROR_COUNTER_TIMEOUT -Windows.Win32.Foundation.ERROR_CPU_SET_INVALID -Windows.Win32.Foundation.ERROR_CRASH_DUMP -Windows.Win32.Foundation.ERROR_CRC -Windows.Win32.Foundation.ERROR_CREATE_FAILED -Windows.Win32.Foundation.ERROR_CROSS_PARTITION_VIOLATION -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_FILE_NOT_CSE -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER -Windows.Win32.Foundation.ERROR_CSCSHARE_OFFLINE -Windows.Win32.Foundation.ERROR_CTX_CLIENT_QUERY_TIMEOUT -Windows.Win32.Foundation.ERROR_CTX_MODEM_RESPONSE_TIMEOUT -Windows.Win32.Foundation.ERROR_CURRENT_DIRECTORY -Windows.Win32.Foundation.ERROR_CURRENT_DOMAIN_NOT_ALLOWED -Windows.Win32.Foundation.ERROR_DATA_CHECKSUM_ERROR -Windows.Win32.Foundation.ERROR_DATA_NOT_ACCEPTED -Windows.Win32.Foundation.ERROR_DATABASE_DOES_NOT_EXIST -Windows.Win32.Foundation.ERROR_DATATYPE_MISMATCH -Windows.Win32.Foundation.ERROR_DAX_MAPPING_EXISTS -Windows.Win32.Foundation.ERROR_DBG_COMMAND_EXCEPTION -Windows.Win32.Foundation.ERROR_DBG_CONTINUE -Windows.Win32.Foundation.ERROR_DBG_CONTROL_BREAK -Windows.Win32.Foundation.ERROR_DBG_CONTROL_C -Windows.Win32.Foundation.ERROR_DBG_EXCEPTION_HANDLED -Windows.Win32.Foundation.ERROR_DBG_EXCEPTION_NOT_HANDLED -Windows.Win32.Foundation.ERROR_DBG_PRINTEXCEPTION_C -Windows.Win32.Foundation.ERROR_DBG_REPLY_LATER -Windows.Win32.Foundation.ERROR_DBG_RIPEXCEPTION -Windows.Win32.Foundation.ERROR_DBG_TERMINATE_PROCESS -Windows.Win32.Foundation.ERROR_DBG_TERMINATE_THREAD -Windows.Win32.Foundation.ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE -Windows.Win32.Foundation.ERROR_DC_NOT_FOUND -Windows.Win32.Foundation.ERROR_DDE_FAIL -Windows.Win32.Foundation.ERROR_DEBUG_ATTACH_FAILED -Windows.Win32.Foundation.ERROR_DEBUGGER_INACTIVE -Windows.Win32.Foundation.ERROR_DECRYPTION_FAILED -Windows.Win32.Foundation.ERROR_DELAY_LOAD_FAILED -Windows.Win32.Foundation.ERROR_DELETE_PENDING -Windows.Win32.Foundation.ERROR_DEPENDENT_SERVICES_RUNNING -Windows.Win32.Foundation.ERROR_DESTINATION_ELEMENT_FULL -Windows.Win32.Foundation.ERROR_DESTROY_OBJECT_OF_OTHER_THREAD -Windows.Win32.Foundation.ERROR_DEV_NOT_EXIST -Windows.Win32.Foundation.ERROR_DEVICE_ALREADY_ATTACHED -Windows.Win32.Foundation.ERROR_DEVICE_ALREADY_REMEMBERED -Windows.Win32.Foundation.ERROR_DEVICE_DOOR_OPEN -Windows.Win32.Foundation.ERROR_DEVICE_ENUMERATION_ERROR -Windows.Win32.Foundation.ERROR_DEVICE_FEATURE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DEVICE_HARDWARE_ERROR -Windows.Win32.Foundation.ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL -Windows.Win32.Foundation.ERROR_DEVICE_IN_MAINTENANCE -Windows.Win32.Foundation.ERROR_DEVICE_IN_USE -Windows.Win32.Foundation.ERROR_DEVICE_NO_RESOURCES -Windows.Win32.Foundation.ERROR_DEVICE_NOT_CONNECTED -Windows.Win32.Foundation.ERROR_DEVICE_NOT_PARTITIONED -Windows.Win32.Foundation.ERROR_DEVICE_REINITIALIZATION_NEEDED -Windows.Win32.Foundation.ERROR_DEVICE_REMOVED -Windows.Win32.Foundation.ERROR_DEVICE_REQUIRES_CLEANING -Windows.Win32.Foundation.ERROR_DEVICE_RESET_REQUIRED -Windows.Win32.Foundation.ERROR_DEVICE_SUPPORT_IN_PROGRESS -Windows.Win32.Foundation.ERROR_DEVICE_UNREACHABLE -Windows.Win32.Foundation.ERROR_DHCP_ADDRESS_CONFLICT -Windows.Win32.Foundation.ERROR_DIFFERENT_SERVICE_ACCOUNT -Windows.Win32.Foundation.ERROR_DIR_EFS_DISALLOWED -Windows.Win32.Foundation.ERROR_DIR_NOT_EMPTY -Windows.Win32.Foundation.ERROR_DIR_NOT_ROOT -Windows.Win32.Foundation.ERROR_DIRECT_ACCESS_HANDLE -Windows.Win32.Foundation.ERROR_DIRECTORY -Windows.Win32.Foundation.ERROR_DIRECTORY_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DISCARDED -Windows.Win32.Foundation.ERROR_DISK_CHANGE -Windows.Win32.Foundation.ERROR_DISK_CORRUPT -Windows.Win32.Foundation.ERROR_DISK_FULL -Windows.Win32.Foundation.ERROR_DISK_OPERATION_FAILED -Windows.Win32.Foundation.ERROR_DISK_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_DISK_RECALIBRATE_FAILED -Windows.Win32.Foundation.ERROR_DISK_REPAIR_DISABLED -Windows.Win32.Foundation.ERROR_DISK_REPAIR_REDIRECTED -Windows.Win32.Foundation.ERROR_DISK_REPAIR_UNSUCCESSFUL -Windows.Win32.Foundation.ERROR_DISK_RESET_FAILED -Windows.Win32.Foundation.ERROR_DISK_RESOURCES_EXHAUSTED -Windows.Win32.Foundation.ERROR_DISK_TOO_FRAGMENTED -Windows.Win32.Foundation.ERROR_DLL_INIT_FAILED -Windows.Win32.Foundation.ERROR_DLL_INIT_FAILED_LOGOFF -Windows.Win32.Foundation.ERROR_DLL_MIGHT_BE_INCOMPATIBLE -Windows.Win32.Foundation.ERROR_DLL_MIGHT_BE_INSECURE -Windows.Win32.Foundation.ERROR_DLL_NOT_FOUND -Windows.Win32.Foundation.ERROR_DLP_POLICY_DENIES_OPERATION -Windows.Win32.Foundation.ERROR_DLP_POLICY_SILENTLY_FAIL -Windows.Win32.Foundation.ERROR_DLP_POLICY_WARNS_AGAINST_OPERATION -Windows.Win32.Foundation.ERROR_DOMAIN_CONTROLLER_EXISTS -Windows.Win32.Foundation.ERROR_DOMAIN_CONTROLLER_NOT_FOUND -Windows.Win32.Foundation.ERROR_DOMAIN_CTRLR_CONFIG_ERROR -Windows.Win32.Foundation.ERROR_DOMAIN_EXISTS -Windows.Win32.Foundation.ERROR_DOMAIN_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION -Windows.Win32.Foundation.ERROR_DOMAIN_TRUST_INCONSISTENT -Windows.Win32.Foundation.ERROR_DOWNGRADE_DETECTED -Windows.Win32.Foundation.ERROR_DPL_NOT_SUPPORTED_FOR_USER -Windows.Win32.Foundation.ERROR_DRIVE_LOCKED -Windows.Win32.Foundation.ERROR_DRIVER_BLOCKED -Windows.Win32.Foundation.ERROR_DRIVER_CANCEL_TIMEOUT -Windows.Win32.Foundation.ERROR_DRIVER_DATABASE_ERROR -Windows.Win32.Foundation.ERROR_DRIVER_FAILED_PRIOR_UNLOAD -Windows.Win32.Foundation.ERROR_DRIVER_FAILED_SLEEP -Windows.Win32.Foundation.ERROR_DRIVER_PROCESS_TERMINATED -Windows.Win32.Foundation.ERROR_DRIVERS_LEAKING_LOCKED_PAGES -Windows.Win32.Foundation.ERROR_DS_ADD_REPLICA_INHIBITED -Windows.Win32.Foundation.ERROR_DS_ADMIN_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_AFFECTS_MULTIPLE_DSAS -Windows.Win32.Foundation.ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_ALIAS_DEREF_PROBLEM -Windows.Win32.Foundation.ERROR_DS_ALIAS_POINTS_TO_ALIAS -Windows.Win32.Foundation.ERROR_DS_ALIAS_PROBLEM -Windows.Win32.Foundation.ERROR_DS_ALIASED_OBJ_MISSING -Windows.Win32.Foundation.ERROR_DS_ATT_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_DS_ATT_IS_NOT_ON_OBJ -Windows.Win32.Foundation.ERROR_DS_ATT_NOT_DEF_FOR_CLASS -Windows.Win32.Foundation.ERROR_DS_ATT_NOT_DEF_IN_SCHEMA -Windows.Win32.Foundation.ERROR_DS_ATT_SCHEMA_REQ_ID -Windows.Win32.Foundation.ERROR_DS_ATT_SCHEMA_REQ_SYNTAX -Windows.Win32.Foundation.ERROR_DS_ATT_VAL_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS -Windows.Win32.Foundation.ERROR_DS_ATTRIBUTE_OWNED_BY_SAM -Windows.Win32.Foundation.ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED -Windows.Win32.Foundation.ERROR_DS_AUDIT_FAILURE -Windows.Win32.Foundation.ERROR_DS_AUTH_METHOD_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DS_AUTH_UNKNOWN -Windows.Win32.Foundation.ERROR_DS_AUTHORIZATION_FAILED -Windows.Win32.Foundation.ERROR_DS_AUX_CLS_TEST_FAIL -Windows.Win32.Foundation.ERROR_DS_BACKLINK_WITHOUT_LINK -Windows.Win32.Foundation.ERROR_DS_BAD_ATT_SCHEMA_SYNTAX -Windows.Win32.Foundation.ERROR_DS_BAD_HIERARCHY_FILE -Windows.Win32.Foundation.ERROR_DS_BAD_INSTANCE_TYPE -Windows.Win32.Foundation.ERROR_DS_BAD_NAME_SYNTAX -Windows.Win32.Foundation.ERROR_DS_BAD_RDN_ATT_ID_SYNTAX -Windows.Win32.Foundation.ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED -Windows.Win32.Foundation.ERROR_DS_BUSY -Windows.Win32.Foundation.ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD -Windows.Win32.Foundation.ERROR_DS_CANT_ADD_ATT_VALUES -Windows.Win32.Foundation.ERROR_DS_CANT_ADD_SYSTEM_ONLY -Windows.Win32.Foundation.ERROR_DS_CANT_ADD_TO_GC -Windows.Win32.Foundation.ERROR_DS_CANT_CACHE_ATT -Windows.Win32.Foundation.ERROR_DS_CANT_CACHE_CLASS -Windows.Win32.Foundation.ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC -Windows.Win32.Foundation.ERROR_DS_CANT_CREATE_UNDER_SCHEMA -Windows.Win32.Foundation.ERROR_DS_CANT_DEL_MASTER_CROSSREF -Windows.Win32.Foundation.ERROR_DS_CANT_DELETE -Windows.Win32.Foundation.ERROR_DS_CANT_DELETE_DSA_OBJ -Windows.Win32.Foundation.ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC -Windows.Win32.Foundation.ERROR_DS_CANT_DEREF_ALIAS -Windows.Win32.Foundation.ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN -Windows.Win32.Foundation.ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF -Windows.Win32.Foundation.ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN -Windows.Win32.Foundation.ERROR_DS_CANT_FIND_DSA_OBJ -Windows.Win32.Foundation.ERROR_DS_CANT_FIND_EXPECTED_NC -Windows.Win32.Foundation.ERROR_DS_CANT_FIND_NC_IN_CACHE -Windows.Win32.Foundation.ERROR_DS_CANT_MIX_MASTER_AND_REPS -Windows.Win32.Foundation.ERROR_DS_CANT_MOD_OBJ_CLASS -Windows.Win32.Foundation.ERROR_DS_CANT_MOD_PRIMARYGROUPID -Windows.Win32.Foundation.ERROR_DS_CANT_MOD_SYSTEM_ONLY -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_ACCOUNT_GROUP -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_APP_BASIC_GROUP -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_APP_QUERY_GROUP -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_DELETED_OBJECT -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_RESOURCE_GROUP -Windows.Win32.Foundation.ERROR_DS_CANT_ON_NON_LEAF -Windows.Win32.Foundation.ERROR_DS_CANT_ON_RDN -Windows.Win32.Foundation.ERROR_DS_CANT_REM_MISSING_ATT -Windows.Win32.Foundation.ERROR_DS_CANT_REM_MISSING_ATT_VAL -Windows.Win32.Foundation.ERROR_DS_CANT_REMOVE_ATT_CACHE -Windows.Win32.Foundation.ERROR_DS_CANT_REMOVE_CLASS_CACHE -Windows.Win32.Foundation.ERROR_DS_CANT_REPLACE_HIDDEN_REC -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_ATTS -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_CHILD -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_DN -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_INSTANCE -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_SD -Windows.Win32.Foundation.ERROR_DS_CANT_START -Windows.Win32.Foundation.ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ -Windows.Win32.Foundation.ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS -Windows.Win32.Foundation.ERROR_DS_CHILDREN_EXIST -Windows.Win32.Foundation.ERROR_DS_CLASS_MUST_BE_CONCRETE -Windows.Win32.Foundation.ERROR_DS_CLASS_NOT_DSA -Windows.Win32.Foundation.ERROR_DS_CLIENT_LOOP -Windows.Win32.Foundation.ERROR_DS_CODE_INCONSISTENCY -Windows.Win32.Foundation.ERROR_DS_COMPARE_FALSE -Windows.Win32.Foundation.ERROR_DS_COMPARE_TRUE -Windows.Win32.Foundation.ERROR_DS_CONFIDENTIALITY_REQUIRED -Windows.Win32.Foundation.ERROR_DS_CONFIG_PARAM_MISSING -Windows.Win32.Foundation.ERROR_DS_CONSTRAINT_VIOLATION -Windows.Win32.Foundation.ERROR_DS_CONSTRUCTED_ATT_MOD -Windows.Win32.Foundation.ERROR_DS_CONTROL_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_COULDNT_CONTACT_FSMO -Windows.Win32.Foundation.ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE -Windows.Win32.Foundation.ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE -Windows.Win32.Foundation.ERROR_DS_COULDNT_UPDATE_SPNS -Windows.Win32.Foundation.ERROR_DS_COUNTING_AB_INDICES_FAILED -Windows.Win32.Foundation.ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE -Windows.Win32.Foundation.ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 -Windows.Win32.Foundation.ERROR_DS_CROSS_DOM_MOVE_ERROR -Windows.Win32.Foundation.ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD -Windows.Win32.Foundation.ERROR_DS_CROSS_NC_DN_RENAME -Windows.Win32.Foundation.ERROR_DS_CROSS_REF_BUSY -Windows.Win32.Foundation.ERROR_DS_CROSS_REF_EXISTS -Windows.Win32.Foundation.ERROR_DS_DATABASE_ERROR -Windows.Win32.Foundation.ERROR_DS_DECODING_ERROR -Windows.Win32.Foundation.ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED -Windows.Win32.Foundation.ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_DIFFERENT_REPL_EPOCHS -Windows.Win32.Foundation.ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER -Windows.Win32.Foundation.ERROR_DS_DISALLOWED_NC_REDIRECT -Windows.Win32.Foundation.ERROR_DS_DNS_LOOKUP_FAILURE -Windows.Win32.Foundation.ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_DOMAIN_RENAME_IN_PROGRESS -Windows.Win32.Foundation.ERROR_DS_DOMAIN_VERSION_TOO_HIGH -Windows.Win32.Foundation.ERROR_DS_DOMAIN_VERSION_TOO_LOW -Windows.Win32.Foundation.ERROR_DS_DRA_ABANDON_SYNC -Windows.Win32.Foundation.ERROR_DS_DRA_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_DS_DRA_BAD_DN -Windows.Win32.Foundation.ERROR_DS_DRA_BAD_INSTANCE_TYPE -Windows.Win32.Foundation.ERROR_DS_DRA_BAD_NC -Windows.Win32.Foundation.ERROR_DS_DRA_BUSY -Windows.Win32.Foundation.ERROR_DS_DRA_CONNECTION_FAILED -Windows.Win32.Foundation.ERROR_DS_DRA_CORRUPT_UTD_VECTOR -Windows.Win32.Foundation.ERROR_DS_DRA_DB_ERROR -Windows.Win32.Foundation.ERROR_DS_DRA_DN_EXISTS -Windows.Win32.Foundation.ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT -Windows.Win32.Foundation.ERROR_DS_DRA_EXTN_CONNECTION_FAILED -Windows.Win32.Foundation.ERROR_DS_DRA_GENERIC -Windows.Win32.Foundation.ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET -Windows.Win32.Foundation.ERROR_DS_DRA_INCONSISTENT_DIT -Windows.Win32.Foundation.ERROR_DS_DRA_INTERNAL_ERROR -Windows.Win32.Foundation.ERROR_DS_DRA_INVALID_PARAMETER -Windows.Win32.Foundation.ERROR_DS_DRA_MAIL_PROBLEM -Windows.Win32.Foundation.ERROR_DS_DRA_MISSING_KRBTGT_SECRET -Windows.Win32.Foundation.ERROR_DS_DRA_MISSING_PARENT -Windows.Win32.Foundation.ERROR_DS_DRA_NAME_COLLISION -Windows.Win32.Foundation.ERROR_DS_DRA_NO_REPLICA -Windows.Win32.Foundation.ERROR_DS_DRA_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DS_DRA_OBJ_IS_REP_SOURCE -Windows.Win32.Foundation.ERROR_DS_DRA_OBJ_NC_MISMATCH -Windows.Win32.Foundation.ERROR_DS_DRA_OUT_OF_MEM -Windows.Win32.Foundation.ERROR_DS_DRA_OUT_SCHEDULE_WINDOW -Windows.Win32.Foundation.ERROR_DS_DRA_PREEMPTED -Windows.Win32.Foundation.ERROR_DS_DRA_RECYCLED_TARGET -Windows.Win32.Foundation.ERROR_DS_DRA_REF_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_DS_DRA_REF_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_DRA_REPL_PENDING -Windows.Win32.Foundation.ERROR_DS_DRA_RPC_CANCELLED -Windows.Win32.Foundation.ERROR_DS_DRA_SCHEMA_CONFLICT -Windows.Win32.Foundation.ERROR_DS_DRA_SCHEMA_INFO_SHIP -Windows.Win32.Foundation.ERROR_DS_DRA_SCHEMA_MISMATCH -Windows.Win32.Foundation.ERROR_DS_DRA_SECRETS_DENIED -Windows.Win32.Foundation.ERROR_DS_DRA_SHUTDOWN -Windows.Win32.Foundation.ERROR_DS_DRA_SINK_DISABLED -Windows.Win32.Foundation.ERROR_DS_DRA_SOURCE_DISABLED -Windows.Win32.Foundation.ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA -Windows.Win32.Foundation.ERROR_DS_DRA_SOURCE_REINSTALLED -Windows.Win32.Foundation.ERROR_DS_DRS_EXTENSIONS_CHANGED -Windows.Win32.Foundation.ERROR_DS_DS_REQUIRED -Windows.Win32.Foundation.ERROR_DS_DSA_MUST_BE_INT_MASTER -Windows.Win32.Foundation.ERROR_DS_DST_DOMAIN_NOT_NATIVE -Windows.Win32.Foundation.ERROR_DS_DST_NC_MISMATCH -Windows.Win32.Foundation.ERROR_DS_DUP_LDAP_DISPLAY_NAME -Windows.Win32.Foundation.ERROR_DS_DUP_LINK_ID -Windows.Win32.Foundation.ERROR_DS_DUP_MAPI_ID -Windows.Win32.Foundation.ERROR_DS_DUP_MSDS_INTID -Windows.Win32.Foundation.ERROR_DS_DUP_OID -Windows.Win32.Foundation.ERROR_DS_DUP_RDN -Windows.Win32.Foundation.ERROR_DS_DUP_SCHEMA_ID_GUID -Windows.Win32.Foundation.ERROR_DS_DUPLICATE_ID_FOUND -Windows.Win32.Foundation.ERROR_DS_ENCODING_ERROR -Windows.Win32.Foundation.ERROR_DS_EPOCH_MISMATCH -Windows.Win32.Foundation.ERROR_DS_EXISTING_AD_CHILD_NC -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_AUX_CLS -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_MAY_HAVE -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_MUST_HAVE -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_POSS_SUP -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_RDNATTID -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_SUB_CLS -Windows.Win32.Foundation.ERROR_DS_FILTER_UNKNOWN -Windows.Win32.Foundation.ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS -Windows.Win32.Foundation.ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_FOREST_VERSION_TOO_HIGH -Windows.Win32.Foundation.ERROR_DS_FOREST_VERSION_TOO_LOW -Windows.Win32.Foundation.ERROR_DS_GC_NOT_AVAILABLE -Windows.Win32.Foundation.ERROR_DS_GC_REQUIRED -Windows.Win32.Foundation.ERROR_DS_GCVERIFY_ERROR -Windows.Win32.Foundation.ERROR_DS_GENERIC_ERROR -Windows.Win32.Foundation.ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER -Windows.Win32.Foundation.ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_GOVERNSID_MISSING -Windows.Win32.Foundation.ERROR_DS_GROUP_CONVERSION_ERROR -Windows.Win32.Foundation.ERROR_DS_HAVE_PRIMARY_MEMBERS -Windows.Win32.Foundation.ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED -Windows.Win32.Foundation.ERROR_DS_HIERARCHY_TABLE_TOO_DEEP -Windows.Win32.Foundation.ERROR_DS_HIGH_ADLDS_FFL -Windows.Win32.Foundation.ERROR_DS_HIGH_DSA_VERSION -Windows.Win32.Foundation.ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD -Windows.Win32.Foundation.ERROR_DS_ILLEGAL_MOD_OPERATION -Windows.Win32.Foundation.ERROR_DS_ILLEGAL_SUPERIOR -Windows.Win32.Foundation.ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION -Windows.Win32.Foundation.ERROR_DS_INAPPROPRIATE_AUTH -Windows.Win32.Foundation.ERROR_DS_INAPPROPRIATE_MATCHING -Windows.Win32.Foundation.ERROR_DS_INCOMPATIBLE_CONTROLS_USED -Windows.Win32.Foundation.ERROR_DS_INCOMPATIBLE_VERSION -Windows.Win32.Foundation.ERROR_DS_INCORRECT_ROLE_OWNER -Windows.Win32.Foundation.ERROR_DS_INIT_FAILURE -Windows.Win32.Foundation.ERROR_DS_INIT_FAILURE_CONSOLE -Windows.Win32.Foundation.ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE -Windows.Win32.Foundation.ERROR_DS_INSTALL_NO_SRC_SCH_VERSION -Windows.Win32.Foundation.ERROR_DS_INSTALL_SCHEMA_MISMATCH -Windows.Win32.Foundation.ERROR_DS_INSUFF_ACCESS_RIGHTS -Windows.Win32.Foundation.ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT -Windows.Win32.Foundation.ERROR_DS_INTERNAL_FAILURE -Windows.Win32.Foundation.ERROR_DS_INVALID_ATTRIBUTE_SYNTAX -Windows.Win32.Foundation.ERROR_DS_INVALID_DMD -Windows.Win32.Foundation.ERROR_DS_INVALID_DN_SYNTAX -Windows.Win32.Foundation.ERROR_DS_INVALID_GROUP_TYPE -Windows.Win32.Foundation.ERROR_DS_INVALID_LDAP_DISPLAY_NAME -Windows.Win32.Foundation.ERROR_DS_INVALID_NAME_FOR_SPN -Windows.Win32.Foundation.ERROR_DS_INVALID_ROLE_OWNER -Windows.Win32.Foundation.ERROR_DS_INVALID_SCRIPT -Windows.Win32.Foundation.ERROR_DS_INVALID_SEARCH_FLAG -Windows.Win32.Foundation.ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE -Windows.Win32.Foundation.ERROR_DS_INVALID_SEARCH_FLAG_TUPLE -Windows.Win32.Foundation.ERROR_DS_IS_LEAF -Windows.Win32.Foundation.ERROR_DS_KEY_NOT_UNIQUE -Windows.Win32.Foundation.ERROR_DS_LDAP_SEND_QUEUE_FULL -Windows.Win32.Foundation.ERROR_DS_LINK_ID_NOT_AVAILABLE -Windows.Win32.Foundation.ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_LOCAL_ERROR -Windows.Win32.Foundation.ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY -Windows.Win32.Foundation.ERROR_DS_LOOP_DETECT -Windows.Win32.Foundation.ERROR_DS_LOW_ADLDS_FFL -Windows.Win32.Foundation.ERROR_DS_LOW_DSA_VERSION -Windows.Win32.Foundation.ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 -Windows.Win32.Foundation.ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_MAPI_ID_NOT_AVAILABLE -Windows.Win32.Foundation.ERROR_DS_MASTERDSA_REQUIRED -Windows.Win32.Foundation.ERROR_DS_MAX_OBJ_SIZE_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY -Windows.Win32.Foundation.ERROR_DS_MISSING_EXPECTED_ATT -Windows.Win32.Foundation.ERROR_DS_MISSING_FOREST_TRUST -Windows.Win32.Foundation.ERROR_DS_MISSING_FSMO_SETTINGS -Windows.Win32.Foundation.ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER -Windows.Win32.Foundation.ERROR_DS_MISSING_REQUIRED_ATT -Windows.Win32.Foundation.ERROR_DS_MISSING_SUPREF -Windows.Win32.Foundation.ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG -Windows.Win32.Foundation.ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE -Windows.Win32.Foundation.ERROR_DS_MODIFYDN_WRONG_GRANDPARENT -Windows.Win32.Foundation.ERROR_DS_MUST_BE_RUN_ON_DST_DC -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_DOMAIN_ONLY -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NO_MAPPING -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NOT_UNIQUE -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_RESOLVING -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_TRUST_REFERRAL -Windows.Win32.Foundation.ERROR_DS_NAME_NOT_UNIQUE -Windows.Win32.Foundation.ERROR_DS_NAME_REFERENCE_INVALID -Windows.Win32.Foundation.ERROR_DS_NAME_TOO_LONG -Windows.Win32.Foundation.ERROR_DS_NAME_TOO_MANY_PARTS -Windows.Win32.Foundation.ERROR_DS_NAME_TYPE_UNKNOWN -Windows.Win32.Foundation.ERROR_DS_NAME_UNPARSEABLE -Windows.Win32.Foundation.ERROR_DS_NAME_VALUE_TOO_LONG -Windows.Win32.Foundation.ERROR_DS_NAMING_MASTER_GC -Windows.Win32.Foundation.ERROR_DS_NAMING_VIOLATION -Windows.Win32.Foundation.ERROR_DS_NC_MUST_HAVE_NC_PARENT -Windows.Win32.Foundation.ERROR_DS_NC_STILL_HAS_DSAS -Windows.Win32.Foundation.ERROR_DS_NCNAME_MISSING_CR_REF -Windows.Win32.Foundation.ERROR_DS_NCNAME_MUST_BE_NC -Windows.Win32.Foundation.ERROR_DS_NO_ATTRIBUTE_OR_VALUE -Windows.Win32.Foundation.ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN -Windows.Win32.Foundation.ERROR_DS_NO_CHAINED_EVAL -Windows.Win32.Foundation.ERROR_DS_NO_CHAINING -Windows.Win32.Foundation.ERROR_DS_NO_CHECKPOINT_WITH_PDC -Windows.Win32.Foundation.ERROR_DS_NO_CROSSREF_FOR_NC -Windows.Win32.Foundation.ERROR_DS_NO_DELETED_NAME -Windows.Win32.Foundation.ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS -Windows.Win32.Foundation.ERROR_DS_NO_MORE_RIDS -Windows.Win32.Foundation.ERROR_DS_NO_MSDS_INTID -Windows.Win32.Foundation.ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN -Windows.Win32.Foundation.ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN -Windows.Win32.Foundation.ERROR_DS_NO_NTDSA_OBJECT -Windows.Win32.Foundation.ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC -Windows.Win32.Foundation.ERROR_DS_NO_PARENT_OBJECT -Windows.Win32.Foundation.ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION -Windows.Win32.Foundation.ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA -Windows.Win32.Foundation.ERROR_DS_NO_REF_DOMAIN -Windows.Win32.Foundation.ERROR_DS_NO_REQUESTED_ATTS_FOUND -Windows.Win32.Foundation.ERROR_DS_NO_RESULTS_RETURNED -Windows.Win32.Foundation.ERROR_DS_NO_RIDS_ALLOCATED -Windows.Win32.Foundation.ERROR_DS_NO_SERVER_OBJECT -Windows.Win32.Foundation.ERROR_DS_NO_SUCH_OBJECT -Windows.Win32.Foundation.ERROR_DS_NO_TREE_DELETE_ABOVE_NC -Windows.Win32.Foundation.ERROR_DS_NON_ASQ_SEARCH -Windows.Win32.Foundation.ERROR_DS_NON_BASE_SEARCH -Windows.Win32.Foundation.ERROR_DS_NONEXISTENT_MAY_HAVE -Windows.Win32.Foundation.ERROR_DS_NONEXISTENT_MUST_HAVE -Windows.Win32.Foundation.ERROR_DS_NONEXISTENT_POSS_SUP -Windows.Win32.Foundation.ERROR_DS_NONSAFE_SCHEMA_CHANGE -Windows.Win32.Foundation.ERROR_DS_NOT_AN_OBJECT -Windows.Win32.Foundation.ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC -Windows.Win32.Foundation.ERROR_DS_NOT_CLOSEST -Windows.Win32.Foundation.ERROR_DS_NOT_INSTALLED -Windows.Win32.Foundation.ERROR_DS_NOT_ON_BACKLINK -Windows.Win32.Foundation.ERROR_DS_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DS_NOT_SUPPORTED_SORT_ORDER -Windows.Win32.Foundation.ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX -Windows.Win32.Foundation.ERROR_DS_NTDSCRIPT_PROCESS_ERROR -Windows.Win32.Foundation.ERROR_DS_NTDSCRIPT_SYNTAX_ERROR -Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_NOT_DEFINED -Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_NOT_SUBCLASS -Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_VIOLATION -Windows.Win32.Foundation.ERROR_DS_OBJ_GUID_EXISTS -Windows.Win32.Foundation.ERROR_DS_OBJ_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_OBJ_STRING_NAME_EXISTS -Windows.Win32.Foundation.ERROR_DS_OBJ_TOO_LARGE -Windows.Win32.Foundation.ERROR_DS_OBJECT_BEING_REMOVED -Windows.Win32.Foundation.ERROR_DS_OBJECT_CLASS_REQUIRED -Windows.Win32.Foundation.ERROR_DS_OBJECT_RESULTS_TOO_LARGE -Windows.Win32.Foundation.ERROR_DS_OFFSET_RANGE_ERROR -Windows.Win32.Foundation.ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS -Windows.Win32.Foundation.ERROR_DS_OID_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_OPERATIONS_ERROR -Windows.Win32.Foundation.ERROR_DS_OUT_OF_SCOPE -Windows.Win32.Foundation.ERROR_DS_OUT_OF_VERSION_STORE -Windows.Win32.Foundation.ERROR_DS_PARAM_ERROR -Windows.Win32.Foundation.ERROR_DS_PARENT_IS_AN_ALIAS -Windows.Win32.Foundation.ERROR_DS_PDC_OPERATION_IN_PROGRESS -Windows.Win32.Foundation.ERROR_DS_PER_ATTRIBUTE_AUTHZ_FAILED_DURING_ADD -Windows.Win32.Foundation.ERROR_DS_POLICY_NOT_KNOWN -Windows.Win32.Foundation.ERROR_DS_PROTOCOL_ERROR -Windows.Win32.Foundation.ERROR_DS_RANGE_CONSTRAINT -Windows.Win32.Foundation.ERROR_DS_RDN_DOESNT_MATCH_SCHEMA -Windows.Win32.Foundation.ERROR_DS_RECALCSCHEMA_FAILED -Windows.Win32.Foundation.ERROR_DS_REFERRAL -Windows.Win32.Foundation.ERROR_DS_REFERRAL_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_REFUSING_FSMO_ROLES -Windows.Win32.Foundation.ERROR_DS_REMOTE_CROSSREF_OP_FAILED -Windows.Win32.Foundation.ERROR_DS_REPL_LIFETIME_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR -Windows.Win32.Foundation.ERROR_DS_REPLICATOR_ONLY -Windows.Win32.Foundation.ERROR_DS_RESERVED_LINK_ID -Windows.Win32.Foundation.ERROR_DS_RESERVED_MAPI_ID -Windows.Win32.Foundation.ERROR_DS_RIDMGR_DISABLED -Windows.Win32.Foundation.ERROR_DS_RIDMGR_INIT_ERROR -Windows.Win32.Foundation.ERROR_DS_ROLE_NOT_VERIFIED -Windows.Win32.Foundation.ERROR_DS_ROOT_CANT_BE_SUBREF -Windows.Win32.Foundation.ERROR_DS_ROOT_MUST_BE_NC -Windows.Win32.Foundation.ERROR_DS_ROOT_REQUIRES_CLASS_TOP -Windows.Win32.Foundation.ERROR_DS_SAM_INIT_FAILURE -Windows.Win32.Foundation.ERROR_DS_SAM_INIT_FAILURE_CONSOLE -Windows.Win32.Foundation.ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY -Windows.Win32.Foundation.ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD -Windows.Win32.Foundation.ERROR_DS_SCHEMA_ALLOC_FAILED -Windows.Win32.Foundation.ERROR_DS_SCHEMA_NOT_LOADED -Windows.Win32.Foundation.ERROR_DS_SCHEMA_UPDATE_DISALLOWED -Windows.Win32.Foundation.ERROR_DS_SEC_DESC_INVALID -Windows.Win32.Foundation.ERROR_DS_SEC_DESC_TOO_SHORT -Windows.Win32.Foundation.ERROR_DS_SECURITY_CHECKING_ERROR -Windows.Win32.Foundation.ERROR_DS_SECURITY_ILLEGAL_MODIFY -Windows.Win32.Foundation.ERROR_DS_SEMANTIC_ATT_TEST -Windows.Win32.Foundation.ERROR_DS_SENSITIVE_GROUP_VIOLATION -Windows.Win32.Foundation.ERROR_DS_SERVER_DOWN -Windows.Win32.Foundation.ERROR_DS_SHUTTING_DOWN -Windows.Win32.Foundation.ERROR_DS_SINGLE_USER_MODE_FAILED -Windows.Win32.Foundation.ERROR_DS_SINGLE_VALUE_CONSTRAINT -Windows.Win32.Foundation.ERROR_DS_SIZELIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_SORT_CONTROL_MISSING -Windows.Win32.Foundation.ERROR_DS_SOURCE_AUDITING_NOT_ENABLED -Windows.Win32.Foundation.ERROR_DS_SOURCE_DOMAIN_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_SRC_AND_DST_NC_IDENTICAL -Windows.Win32.Foundation.ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH -Windows.Win32.Foundation.ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER -Windows.Win32.Foundation.ERROR_DS_SRC_GUID_MISMATCH -Windows.Win32.Foundation.ERROR_DS_SRC_NAME_MISMATCH -Windows.Win32.Foundation.ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER -Windows.Win32.Foundation.ERROR_DS_SRC_SID_EXISTS_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_STRING_SD_CONVERSION_FAILED -Windows.Win32.Foundation.ERROR_DS_STRONG_AUTH_REQUIRED -Windows.Win32.Foundation.ERROR_DS_SUB_CLS_TEST_FAIL -Windows.Win32.Foundation.ERROR_DS_SUBREF_MUST_HAVE_PARENT -Windows.Win32.Foundation.ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD -Windows.Win32.Foundation.ERROR_DS_SYNTAX_MISMATCH -Windows.Win32.Foundation.ERROR_DS_THREAD_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_TIMELIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_TREE_DELETE_NOT_FINISHED -Windows.Win32.Foundation.ERROR_DS_UNABLE_TO_SURRENDER_ROLES -Windows.Win32.Foundation.ERROR_DS_UNAVAILABLE -Windows.Win32.Foundation.ERROR_DS_UNAVAILABLE_CRIT_EXTENSION -Windows.Win32.Foundation.ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED -Windows.Win32.Foundation.ERROR_DS_UNICODEPWD_NOT_IN_QUOTES -Windows.Win32.Foundation.ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_UNKNOWN_ERROR -Windows.Win32.Foundation.ERROR_DS_UNKNOWN_OPERATION -Windows.Win32.Foundation.ERROR_DS_UNWILLING_TO_PERFORM -Windows.Win32.Foundation.ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_USER_BUFFER_TO_SMALL -Windows.Win32.Foundation.ERROR_DS_VALUE_KEY_NOT_UNIQUE -Windows.Win32.Foundation.ERROR_DS_VERSION_CHECK_FAILURE -Windows.Win32.Foundation.ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL -Windows.Win32.Foundation.ERROR_DS_WRONG_LINKED_ATT_SYNTAX -Windows.Win32.Foundation.ERROR_DS_WRONG_OM_OBJ_CLASS -Windows.Win32.Foundation.ERROR_DUP_DOMAINNAME -Windows.Win32.Foundation.ERROR_DUP_NAME -Windows.Win32.Foundation.ERROR_DUPLICATE_PRIVILEGES -Windows.Win32.Foundation.ERROR_DUPLICATE_SERVICE_NAME -Windows.Win32.Foundation.ERROR_DYNAMIC_CODE_BLOCKED -Windows.Win32.Foundation.ERROR_DYNLINK_FROM_INVALID_RING -Windows.Win32.Foundation.ERROR_EA_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_EA_FILE_CORRUPT -Windows.Win32.Foundation.ERROR_EA_LIST_INCONSISTENT -Windows.Win32.Foundation.ERROR_EA_TABLE_FULL -Windows.Win32.Foundation.ERROR_EAS_DIDNT_FIT -Windows.Win32.Foundation.ERROR_EAS_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED -Windows.Win32.Foundation.ERROR_EDP_POLICY_DENIES_OPERATION -Windows.Win32.Foundation.ERROR_EFS_ALG_BLOB_TOO_BIG -Windows.Win32.Foundation.ERROR_EFS_DISABLED -Windows.Win32.Foundation.ERROR_EFS_SERVER_NOT_TRUSTED -Windows.Win32.Foundation.ERROR_EFS_VERSION_NOT_SUPPORT -Windows.Win32.Foundation.ERROR_ELEVATION_REQUIRED -Windows.Win32.Foundation.ERROR_ENCLAVE_FAILURE -Windows.Win32.Foundation.ERROR_ENCLAVE_NOT_TERMINATED -Windows.Win32.Foundation.ERROR_ENCLAVE_VIOLATION -Windows.Win32.Foundation.ERROR_ENCRYPTED_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_ENCRYPTED_IO_NOT_POSSIBLE -Windows.Win32.Foundation.ERROR_ENCRYPTING_METADATA_DISALLOWED -Windows.Win32.Foundation.ERROR_ENCRYPTION_DISABLED -Windows.Win32.Foundation.ERROR_ENCRYPTION_FAILED -Windows.Win32.Foundation.ERROR_ENCRYPTION_POLICY_DENIES_OPERATION -Windows.Win32.Foundation.ERROR_END_OF_MEDIA -Windows.Win32.Foundation.ERROR_ENVVAR_NOT_FOUND -Windows.Win32.Foundation.ERROR_EOM_OVERFLOW -Windows.Win32.Foundation.ERROR_ERRORS_ENCOUNTERED -Windows.Win32.Foundation.ERROR_EVALUATION_EXPIRATION -Windows.Win32.Foundation.ERROR_EVENT_DONE -Windows.Win32.Foundation.ERROR_EVENT_PENDING -Windows.Win32.Foundation.ERROR_EVENTLOG_CANT_START -Windows.Win32.Foundation.ERROR_EVENTLOG_FILE_CHANGED -Windows.Win32.Foundation.ERROR_EVENTLOG_FILE_CORRUPT -Windows.Win32.Foundation.ERROR_EXCEPTION_IN_SERVICE -Windows.Win32.Foundation.ERROR_EXCL_SEM_ALREADY_OWNED -Windows.Win32.Foundation.ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY -Windows.Win32.Foundation.ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY -Windows.Win32.Foundation.ERROR_EXE_MACHINE_TYPE_MISMATCH -Windows.Win32.Foundation.ERROR_EXE_MARKED_INVALID -Windows.Win32.Foundation.ERROR_EXTENDED_ERROR -Windows.Win32.Foundation.ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN -Windows.Win32.Foundation.ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_EXTRANEOUS_INFORMATION -Windows.Win32.Foundation.ERROR_FAIL_FAST_EXCEPTION -Windows.Win32.Foundation.ERROR_FAIL_I24 -Windows.Win32.Foundation.ERROR_FAIL_NOACTION_REBOOT -Windows.Win32.Foundation.ERROR_FAIL_RESTART -Windows.Win32.Foundation.ERROR_FAIL_SHUTDOWN -Windows.Win32.Foundation.ERROR_FAILED_DRIVER_ENTRY -Windows.Win32.Foundation.ERROR_FAILED_SERVICE_CONTROLLER_CONNECT -Windows.Win32.Foundation.ERROR_FATAL_APP_EXIT -Windows.Win32.Foundation.ERROR_FILE_CHECKED_OUT -Windows.Win32.Foundation.ERROR_FILE_CORRUPT -Windows.Win32.Foundation.ERROR_FILE_ENCRYPTED -Windows.Win32.Foundation.ERROR_FILE_EXISTS -Windows.Win32.Foundation.ERROR_FILE_HANDLE_REVOKED -Windows.Win32.Foundation.ERROR_FILE_INVALID -Windows.Win32.Foundation.ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS -Windows.Win32.Foundation.ERROR_FILE_NOT_ENCRYPTED -Windows.Win32.Foundation.ERROR_FILE_NOT_FOUND -Windows.Win32.Foundation.ERROR_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_FILE_OFFLINE -Windows.Win32.Foundation.ERROR_FILE_PROTECTED_UNDER_DPL -Windows.Win32.Foundation.ERROR_FILE_READ_ONLY -Windows.Win32.Foundation.ERROR_FILE_SNAP_IN_PROGRESS -Windows.Win32.Foundation.ERROR_FILE_SNAP_INVALID_PARAMETER -Windows.Win32.Foundation.ERROR_FILE_SNAP_IO_NOT_COORDINATED -Windows.Win32.Foundation.ERROR_FILE_SNAP_MODIFY_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_FILE_SNAP_UNEXPECTED_ERROR -Windows.Win32.Foundation.ERROR_FILE_SNAP_USER_SECTION_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_LIMITATION -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE -Windows.Win32.Foundation.ERROR_FILE_TOO_LARGE -Windows.Win32.Foundation.ERROR_FILEMARK_DETECTED -Windows.Win32.Foundation.ERROR_FILENAME_EXCED_RANGE -Windows.Win32.Foundation.ERROR_FIRMWARE_UPDATED -Windows.Win32.Foundation.ERROR_FLOAT_MULTIPLE_FAULTS -Windows.Win32.Foundation.ERROR_FLOAT_MULTIPLE_TRAPS -Windows.Win32.Foundation.ERROR_FLOPPY_BAD_REGISTERS -Windows.Win32.Foundation.ERROR_FLOPPY_ID_MARK_NOT_FOUND -Windows.Win32.Foundation.ERROR_FLOPPY_UNKNOWN_ERROR -Windows.Win32.Foundation.ERROR_FLOPPY_VOLUME -Windows.Win32.Foundation.ERROR_FLOPPY_WRONG_CYLINDER -Windows.Win32.Foundation.ERROR_FORMS_AUTH_REQUIRED -Windows.Win32.Foundation.ERROR_FOUND_OUT_OF_SCOPE -Windows.Win32.Foundation.ERROR_FS_DRIVER_REQUIRED -Windows.Win32.Foundation.ERROR_FS_METADATA_INCONSISTENT -Windows.Win32.Foundation.ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY -Windows.Win32.Foundation.ERROR_FT_DI_SCAN_REQUIRED -Windows.Win32.Foundation.ERROR_FT_READ_FAILURE -Windows.Win32.Foundation.ERROR_FT_READ_FROM_COPY_FAILURE -Windows.Win32.Foundation.ERROR_FT_READ_RECOVERY_FROM_BACKUP -Windows.Win32.Foundation.ERROR_FT_WRITE_FAILURE -Windows.Win32.Foundation.ERROR_FT_WRITE_RECOVERY -Windows.Win32.Foundation.ERROR_FULLSCREEN_MODE -Windows.Win32.Foundation.ERROR_FUNCTION_FAILED -Windows.Win32.Foundation.ERROR_FUNCTION_NOT_CALLED -Windows.Win32.Foundation.ERROR_GDI_HANDLE_LEAK -Windows.Win32.Foundation.ERROR_GEN_FAILURE -Windows.Win32.Foundation.ERROR_GENERIC_NOT_MAPPED -Windows.Win32.Foundation.ERROR_GLOBAL_ONLY_HOOK -Windows.Win32.Foundation.ERROR_GRACEFUL_DISCONNECT -Windows.Win32.Foundation.ERROR_GROUP_EXISTS -Windows.Win32.Foundation.ERROR_GUID_SUBSTITUTION_MADE -Windows.Win32.Foundation.ERROR_HANDLE_DISK_FULL -Windows.Win32.Foundation.ERROR_HANDLE_EOF -Windows.Win32.Foundation.ERROR_HANDLE_REVOKED -Windows.Win32.Foundation.ERROR_HANDLES_CLOSED -Windows.Win32.Foundation.ERROR_HAS_SYSTEM_CRITICAL_FILES -Windows.Win32.Foundation.ERROR_HIBERNATED -Windows.Win32.Foundation.ERROR_HIBERNATION_FAILURE -Windows.Win32.Foundation.ERROR_HOOK_NEEDS_HMOD -Windows.Win32.Foundation.ERROR_HOOK_NOT_INSTALLED -Windows.Win32.Foundation.ERROR_HOOK_TYPE_NOT_ALLOWED -Windows.Win32.Foundation.ERROR_HOST_DOWN -Windows.Win32.Foundation.ERROR_HOST_UNREACHABLE -Windows.Win32.Foundation.ERROR_HOTKEY_ALREADY_REGISTERED -Windows.Win32.Foundation.ERROR_HOTKEY_NOT_REGISTERED -Windows.Win32.Foundation.ERROR_HWNDS_HAVE_DIFF_PARENT -Windows.Win32.Foundation.ERROR_ILL_FORMED_PASSWORD -Windows.Win32.Foundation.ERROR_ILLEGAL_CHARACTER -Windows.Win32.Foundation.ERROR_ILLEGAL_DLL_RELOCATION -Windows.Win32.Foundation.ERROR_ILLEGAL_ELEMENT_ADDRESS -Windows.Win32.Foundation.ERROR_ILLEGAL_FLOAT_CONTEXT -Windows.Win32.Foundation.ERROR_IMAGE_AT_DIFFERENT_BASE -Windows.Win32.Foundation.ERROR_IMAGE_MACHINE_TYPE_MISMATCH -Windows.Win32.Foundation.ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE -Windows.Win32.Foundation.ERROR_IMAGE_NOT_AT_BASE -Windows.Win32.Foundation.ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT -Windows.Win32.Foundation.ERROR_IMPLEMENTATION_LIMIT -Windows.Win32.Foundation.ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE -Windows.Win32.Foundation.ERROR_INCOMPATIBLE_SERVICE_SID_TYPE -Windows.Win32.Foundation.ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING -Windows.Win32.Foundation.ERROR_INCORRECT_ACCOUNT_TYPE -Windows.Win32.Foundation.ERROR_INCORRECT_ADDRESS -Windows.Win32.Foundation.ERROR_INCORRECT_SIZE -Windows.Win32.Foundation.ERROR_INDEX_ABSENT -Windows.Win32.Foundation.ERROR_INDEX_OUT_OF_BOUNDS -Windows.Win32.Foundation.ERROR_INFLOOP_IN_RELOC_CHAIN -Windows.Win32.Foundation.ERROR_INSTALL_ALREADY_RUNNING -Windows.Win32.Foundation.ERROR_INSTALL_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_LANGUAGE_UNSUPPORTED -Windows.Win32.Foundation.ERROR_INSTALL_LOG_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_NOTUSED -Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_INVALID -Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_OPEN_FAILED -Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_REJECTED -Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_VERSION -Windows.Win32.Foundation.ERROR_INSTALL_PLATFORM_UNSUPPORTED -Windows.Win32.Foundation.ERROR_INSTALL_REJECTED -Windows.Win32.Foundation.ERROR_INSTALL_REMOTE_DISALLOWED -Windows.Win32.Foundation.ERROR_INSTALL_REMOTE_PROHIBITED -Windows.Win32.Foundation.ERROR_INSTALL_SERVICE_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_SERVICE_SAFEBOOT -Windows.Win32.Foundation.ERROR_INSTALL_SOURCE_ABSENT -Windows.Win32.Foundation.ERROR_INSTALL_SUSPEND -Windows.Win32.Foundation.ERROR_INSTALL_TEMP_UNWRITABLE -Windows.Win32.Foundation.ERROR_INSTALL_TRANSFORM_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_TRANSFORM_REJECTED -Windows.Win32.Foundation.ERROR_INSTALL_UI_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_USEREXIT -Windows.Win32.Foundation.ERROR_INSTRUCTION_MISALIGNMENT -Windows.Win32.Foundation.ERROR_INSUFFICIENT_BUFFER -Windows.Win32.Foundation.ERROR_INSUFFICIENT_LOGON_INFO -Windows.Win32.Foundation.ERROR_INSUFFICIENT_POWER -Windows.Win32.Foundation.ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE -Windows.Win32.Foundation.ERROR_INSUFFICIENT_VIRTUAL_ADDR_RESOURCES -Windows.Win32.Foundation.ERROR_INTERMIXED_KERNEL_EA_OPERATION -Windows.Win32.Foundation.ERROR_INTERNAL_DB_CORRUPTION -Windows.Win32.Foundation.ERROR_INTERNAL_DB_ERROR -Windows.Win32.Foundation.ERROR_INTERNAL_ERROR -Windows.Win32.Foundation.ERROR_INTERRUPT_STILL_CONNECTED -Windows.Win32.Foundation.ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED -Windows.Win32.Foundation.ERROR_INVALID_ACCEL_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_ACCESS -Windows.Win32.Foundation.ERROR_INVALID_ACCOUNT_NAME -Windows.Win32.Foundation.ERROR_INVALID_ACE_CONDITION -Windows.Win32.Foundation.ERROR_INVALID_ACL -Windows.Win32.Foundation.ERROR_INVALID_ADDRESS -Windows.Win32.Foundation.ERROR_INVALID_AT_INTERRUPT_TIME -Windows.Win32.Foundation.ERROR_INVALID_BLOCK -Windows.Win32.Foundation.ERROR_INVALID_BLOCK_LENGTH -Windows.Win32.Foundation.ERROR_INVALID_CAP -Windows.Win32.Foundation.ERROR_INVALID_CATEGORY -Windows.Win32.Foundation.ERROR_INVALID_COMBOBOX_MESSAGE -Windows.Win32.Foundation.ERROR_INVALID_COMMAND_LINE -Windows.Win32.Foundation.ERROR_INVALID_COMPUTERNAME -Windows.Win32.Foundation.ERROR_INVALID_CRUNTIME_PARAMETER -Windows.Win32.Foundation.ERROR_INVALID_CURSOR_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_DATA -Windows.Win32.Foundation.ERROR_INVALID_DATATYPE -Windows.Win32.Foundation.ERROR_INVALID_DEVICE_OBJECT_PARAMETER -Windows.Win32.Foundation.ERROR_INVALID_DLL -Windows.Win32.Foundation.ERROR_INVALID_DOMAIN_ROLE -Windows.Win32.Foundation.ERROR_INVALID_DOMAIN_STATE -Windows.Win32.Foundation.ERROR_INVALID_DOMAINNAME -Windows.Win32.Foundation.ERROR_INVALID_DRIVE -Windows.Win32.Foundation.ERROR_INVALID_DWP_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_EA_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_EA_NAME -Windows.Win32.Foundation.ERROR_INVALID_EDIT_HEIGHT -Windows.Win32.Foundation.ERROR_INVALID_ENVIRONMENT -Windows.Win32.Foundation.ERROR_INVALID_EVENT_COUNT -Windows.Win32.Foundation.ERROR_INVALID_EVENTNAME -Windows.Win32.Foundation.ERROR_INVALID_EXCEPTION_HANDLER -Windows.Win32.Foundation.ERROR_INVALID_EXE_SIGNATURE -Windows.Win32.Foundation.ERROR_INVALID_FIELD -Windows.Win32.Foundation.ERROR_INVALID_FIELD_IN_PARAMETER_LIST -Windows.Win32.Foundation.ERROR_INVALID_FILTER_PROC -Windows.Win32.Foundation.ERROR_INVALID_FLAG_NUMBER -Windows.Win32.Foundation.ERROR_INVALID_FLAGS -Windows.Win32.Foundation.ERROR_INVALID_FORM_NAME -Windows.Win32.Foundation.ERROR_INVALID_FORM_SIZE -Windows.Win32.Foundation.ERROR_INVALID_FUNCTION -Windows.Win32.Foundation.ERROR_INVALID_GROUP_ATTRIBUTES -Windows.Win32.Foundation.ERROR_INVALID_GROUPNAME -Windows.Win32.Foundation.ERROR_INVALID_GW_COMMAND -Windows.Win32.Foundation.ERROR_INVALID_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_HANDLE_STATE -Windows.Win32.Foundation.ERROR_INVALID_HOOK_FILTER -Windows.Win32.Foundation.ERROR_INVALID_HOOK_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_HW_PROFILE -Windows.Win32.Foundation.ERROR_INVALID_ICON_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_ID_AUTHORITY -Windows.Win32.Foundation.ERROR_INVALID_IMAGE_HASH -Windows.Win32.Foundation.ERROR_INVALID_IMPORT_OF_NON_DLL -Windows.Win32.Foundation.ERROR_INVALID_INDEX -Windows.Win32.Foundation.ERROR_INVALID_KERNEL_INFO_VERSION -Windows.Win32.Foundation.ERROR_INVALID_KEYBOARD_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_LABEL -Windows.Win32.Foundation.ERROR_INVALID_LB_MESSAGE -Windows.Win32.Foundation.ERROR_INVALID_LDT_DESCRIPTOR -Windows.Win32.Foundation.ERROR_INVALID_LDT_OFFSET -Windows.Win32.Foundation.ERROR_INVALID_LDT_SIZE -Windows.Win32.Foundation.ERROR_INVALID_LEVEL -Windows.Win32.Foundation.ERROR_INVALID_LIST_FORMAT -Windows.Win32.Foundation.ERROR_INVALID_LOCK_RANGE -Windows.Win32.Foundation.ERROR_INVALID_LOGON_HOURS -Windows.Win32.Foundation.ERROR_INVALID_LOGON_TYPE -Windows.Win32.Foundation.ERROR_INVALID_MEMBER -Windows.Win32.Foundation.ERROR_INVALID_MENU_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_MESSAGE -Windows.Win32.Foundation.ERROR_INVALID_MESSAGEDEST -Windows.Win32.Foundation.ERROR_INVALID_MESSAGENAME -Windows.Win32.Foundation.ERROR_INVALID_MINALLOCSIZE -Windows.Win32.Foundation.ERROR_INVALID_MODULETYPE -Windows.Win32.Foundation.ERROR_INVALID_MONITOR_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_MSGBOX_STYLE -Windows.Win32.Foundation.ERROR_INVALID_NAME -Windows.Win32.Foundation.ERROR_INVALID_NETNAME -Windows.Win32.Foundation.ERROR_INVALID_OPLOCK_PROTOCOL -Windows.Win32.Foundation.ERROR_INVALID_ORDINAL -Windows.Win32.Foundation.ERROR_INVALID_OWNER -Windows.Win32.Foundation.ERROR_INVALID_PACKAGE_SID_LENGTH -Windows.Win32.Foundation.ERROR_INVALID_PARAMETER -Windows.Win32.Foundation.ERROR_INVALID_PASSWORD -Windows.Win32.Foundation.ERROR_INVALID_PASSWORDNAME -Windows.Win32.Foundation.ERROR_INVALID_PATCH_XML -Windows.Win32.Foundation.ERROR_INVALID_PEP_INFO_VERSION -Windows.Win32.Foundation.ERROR_INVALID_PLUGPLAY_DEVICE_PATH -Windows.Win32.Foundation.ERROR_INVALID_PORT_ATTRIBUTES -Windows.Win32.Foundation.ERROR_INVALID_PRIMARY_GROUP -Windows.Win32.Foundation.ERROR_INVALID_PRINTER_COMMAND -Windows.Win32.Foundation.ERROR_INVALID_PRINTER_NAME -Windows.Win32.Foundation.ERROR_INVALID_PRINTER_STATE -Windows.Win32.Foundation.ERROR_INVALID_PRIORITY -Windows.Win32.Foundation.ERROR_INVALID_QUOTA_LOWER -Windows.Win32.Foundation.ERROR_INVALID_REPARSE_DATA -Windows.Win32.Foundation.ERROR_INVALID_SCROLLBAR_RANGE -Windows.Win32.Foundation.ERROR_INVALID_SECURITY_DESCR -Windows.Win32.Foundation.ERROR_INVALID_SEGDPL -Windows.Win32.Foundation.ERROR_INVALID_SEGMENT_NUMBER -Windows.Win32.Foundation.ERROR_INVALID_SEPARATOR_FILE -Windows.Win32.Foundation.ERROR_INVALID_SERVER_STATE -Windows.Win32.Foundation.ERROR_INVALID_SERVICE_ACCOUNT -Windows.Win32.Foundation.ERROR_INVALID_SERVICE_CONTROL -Windows.Win32.Foundation.ERROR_INVALID_SERVICE_LOCK -Windows.Win32.Foundation.ERROR_INVALID_SERVICENAME -Windows.Win32.Foundation.ERROR_INVALID_SHARENAME -Windows.Win32.Foundation.ERROR_INVALID_SHOWWIN_COMMAND -Windows.Win32.Foundation.ERROR_INVALID_SID -Windows.Win32.Foundation.ERROR_INVALID_SIGNAL_NUMBER -Windows.Win32.Foundation.ERROR_INVALID_SPI_VALUE -Windows.Win32.Foundation.ERROR_INVALID_STACKSEG -Windows.Win32.Foundation.ERROR_INVALID_STARTING_CODESEG -Windows.Win32.Foundation.ERROR_INVALID_SUB_AUTHORITY -Windows.Win32.Foundation.ERROR_INVALID_TABLE -Windows.Win32.Foundation.ERROR_INVALID_TARGET_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_TASK_INDEX -Windows.Win32.Foundation.ERROR_INVALID_TASK_NAME -Windows.Win32.Foundation.ERROR_INVALID_THREAD_ID -Windows.Win32.Foundation.ERROR_INVALID_TIME -Windows.Win32.Foundation.ERROR_INVALID_TOKEN -Windows.Win32.Foundation.ERROR_INVALID_UNWIND_TARGET -Windows.Win32.Foundation.ERROR_INVALID_USER_BUFFER -Windows.Win32.Foundation.ERROR_INVALID_USER_PRINCIPAL_NAME -Windows.Win32.Foundation.ERROR_INVALID_VARIANT -Windows.Win32.Foundation.ERROR_INVALID_VERIFY_SWITCH -Windows.Win32.Foundation.ERROR_INVALID_WINDOW_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_WORKSTATION -Windows.Win32.Foundation.ERROR_IO_DEVICE -Windows.Win32.Foundation.ERROR_IO_INCOMPLETE -Windows.Win32.Foundation.ERROR_IO_PENDING -Windows.Win32.Foundation.ERROR_IO_PRIVILEGE_FAILED -Windows.Win32.Foundation.ERROR_IO_REISSUE_AS_CACHED -Windows.Win32.Foundation.ERROR_IOPL_NOT_ENABLED -Windows.Win32.Foundation.ERROR_IP_ADDRESS_CONFLICT1 -Windows.Win32.Foundation.ERROR_IP_ADDRESS_CONFLICT2 -Windows.Win32.Foundation.ERROR_IPSEC_IKE_TIMED_OUT -Windows.Win32.Foundation.ERROR_IRQ_BUSY -Windows.Win32.Foundation.ERROR_IS_JOIN_PATH -Windows.Win32.Foundation.ERROR_IS_JOIN_TARGET -Windows.Win32.Foundation.ERROR_IS_JOINED -Windows.Win32.Foundation.ERROR_IS_SUBST_PATH -Windows.Win32.Foundation.ERROR_IS_SUBST_TARGET -Windows.Win32.Foundation.ERROR_IS_SUBSTED -Windows.Win32.Foundation.ERROR_ITERATED_DATA_EXCEEDS_64k -Windows.Win32.Foundation.ERROR_JOB_NO_CONTAINER -Windows.Win32.Foundation.ERROR_JOIN_TO_JOIN -Windows.Win32.Foundation.ERROR_JOIN_TO_SUBST -Windows.Win32.Foundation.ERROR_JOURNAL_DELETE_IN_PROGRESS -Windows.Win32.Foundation.ERROR_JOURNAL_ENTRY_DELETED -Windows.Win32.Foundation.ERROR_JOURNAL_HOOK_SET -Windows.Win32.Foundation.ERROR_JOURNAL_NOT_ACTIVE -Windows.Win32.Foundation.ERROR_KERNEL_APC -Windows.Win32.Foundation.ERROR_KEY_DELETED -Windows.Win32.Foundation.ERROR_KEY_HAS_CHILDREN -Windows.Win32.Foundation.ERROR_KM_DRIVER_BLOCKED -Windows.Win32.Foundation.ERROR_LABEL_TOO_LONG -Windows.Win32.Foundation.ERROR_LAST_ADMIN -Windows.Win32.Foundation.ERROR_LB_WITHOUT_TABSTOPS -Windows.Win32.Foundation.ERROR_LICENSE_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_LINUX_SUBSYSTEM_NOT_PRESENT -Windows.Win32.Foundation.ERROR_LINUX_SUBSYSTEM_UPDATE_REQUIRED -Windows.Win32.Foundation.ERROR_LISTBOX_ID_NOT_FOUND -Windows.Win32.Foundation.ERROR_LM_CROSS_ENCRYPTION_REQUIRED -Windows.Win32.Foundation.ERROR_LOCAL_POLICY_MODIFICATION_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_LOCAL_USER_SESSION_KEY -Windows.Win32.Foundation.ERROR_LOCK_FAILED -Windows.Win32.Foundation.ERROR_LOCK_VIOLATION -Windows.Win32.Foundation.ERROR_LOCKED -Windows.Win32.Foundation.ERROR_LOG_FILE_FULL -Windows.Win32.Foundation.ERROR_LOG_HARD_ERROR -Windows.Win32.Foundation.ERROR_LOGIN_TIME_RESTRICTION -Windows.Win32.Foundation.ERROR_LOGIN_WKSTA_RESTRICTION -Windows.Win32.Foundation.ERROR_LOGON_FAILURE -Windows.Win32.Foundation.ERROR_LOGON_NOT_GRANTED -Windows.Win32.Foundation.ERROR_LOGON_SERVER_CONFLICT -Windows.Win32.Foundation.ERROR_LOGON_SESSION_COLLISION -Windows.Win32.Foundation.ERROR_LOGON_SESSION_EXISTS -Windows.Win32.Foundation.ERROR_LOGON_TYPE_NOT_GRANTED -Windows.Win32.Foundation.ERROR_LONGJUMP -Windows.Win32.Foundation.ERROR_LOST_MODE_LOGON_RESTRICTION -Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA -Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR -Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED -Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR -Windows.Win32.Foundation.ERROR_LUIDS_EXHAUSTED -Windows.Win32.Foundation.ERROR_MACHINE_LOCKED -Windows.Win32.Foundation.ERROR_MAGAZINE_NOT_PRESENT -Windows.Win32.Foundation.ERROR_MAPPED_ALIGNMENT -Windows.Win32.Foundation.ERROR_MARKED_TO_DISALLOW_WRITES -Windows.Win32.Foundation.ERROR_MARSHALL_OVERFLOW -Windows.Win32.Foundation.ERROR_MAX_SESSIONS_REACHED -Windows.Win32.Foundation.ERROR_MAX_THRDS_REACHED -Windows.Win32.Foundation.ERROR_MCA_EXCEPTION -Windows.Win32.Foundation.ERROR_MCA_OCCURED -Windows.Win32.Foundation.ERROR_MEDIA_CHANGED -Windows.Win32.Foundation.ERROR_MEDIA_CHECK -Windows.Win32.Foundation.ERROR_MEMBER_IN_ALIAS -Windows.Win32.Foundation.ERROR_MEMBER_IN_GROUP -Windows.Win32.Foundation.ERROR_MEMBER_NOT_IN_ALIAS -Windows.Win32.Foundation.ERROR_MEMBER_NOT_IN_GROUP -Windows.Win32.Foundation.ERROR_MEMBERS_PRIMARY_GROUP -Windows.Win32.Foundation.ERROR_MEMORY_HARDWARE -Windows.Win32.Foundation.ERROR_MENU_ITEM_NOT_FOUND -Windows.Win32.Foundation.ERROR_MESSAGE_SYNC_ONLY -Windows.Win32.Foundation.ERROR_META_EXPANSION_TOO_LONG -Windows.Win32.Foundation.ERROR_MISSING_SYSTEMFILE -Windows.Win32.Foundation.ERROR_MOD_NOT_FOUND -Windows.Win32.Foundation.ERROR_MORE_DATA -Windows.Win32.Foundation.ERROR_MORE_WRITES -Windows.Win32.Foundation.ERROR_MOUNT_POINT_NOT_RESOLVED -Windows.Win32.Foundation.ERROR_MP_PROCESSOR_MISMATCH -Windows.Win32.Foundation.ERROR_MR_MID_NOT_FOUND -Windows.Win32.Foundation.ERROR_MULTIPLE_FAULT_VIOLATION -Windows.Win32.Foundation.ERROR_MUTANT_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_MUTUAL_AUTH_FAILED -Windows.Win32.Foundation.ERROR_NEGATIVE_SEEK -Windows.Win32.Foundation.ERROR_NESTING_NOT_ALLOWED -Windows.Win32.Foundation.ERROR_NET_OPEN_FAILED -Windows.Win32.Foundation.ERROR_NET_WRITE_FAULT -Windows.Win32.Foundation.ERROR_NETLOGON_NOT_STARTED -Windows.Win32.Foundation.ERROR_NETNAME_DELETED -Windows.Win32.Foundation.ERROR_NETWORK_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_NETWORK_ACCESS_DENIED_EDP -Windows.Win32.Foundation.ERROR_NETWORK_BUSY -Windows.Win32.Foundation.ERROR_NETWORK_UNREACHABLE -Windows.Win32.Foundation.ERROR_NO_ACE_CONDITION -Windows.Win32.Foundation.ERROR_NO_ASSOCIATION -Windows.Win32.Foundation.ERROR_NO_BYPASSIO_DRIVER_SUPPORT -Windows.Win32.Foundation.ERROR_NO_CALLBACK_ACTIVE -Windows.Win32.Foundation.ERROR_NO_DATA -Windows.Win32.Foundation.ERROR_NO_DATA_DETECTED -Windows.Win32.Foundation.ERROR_NO_EFS -Windows.Win32.Foundation.ERROR_NO_EVENT_PAIR -Windows.Win32.Foundation.ERROR_NO_GUID_TRANSLATION -Windows.Win32.Foundation.ERROR_NO_IMPERSONATION_TOKEN -Windows.Win32.Foundation.ERROR_NO_INHERITANCE -Windows.Win32.Foundation.ERROR_NO_LOG_SPACE -Windows.Win32.Foundation.ERROR_NO_LOGON_SERVERS -Windows.Win32.Foundation.ERROR_NO_MATCH -Windows.Win32.Foundation.ERROR_NO_MEDIA_IN_DRIVE -Windows.Win32.Foundation.ERROR_NO_MORE_DEVICES -Windows.Win32.Foundation.ERROR_NO_MORE_FILES -Windows.Win32.Foundation.ERROR_NO_MORE_ITEMS -Windows.Win32.Foundation.ERROR_NO_MORE_MATCHES -Windows.Win32.Foundation.ERROR_NO_MORE_SEARCH_HANDLES -Windows.Win32.Foundation.ERROR_NO_MORE_USER_HANDLES -Windows.Win32.Foundation.ERROR_NO_NET_OR_BAD_PATH -Windows.Win32.Foundation.ERROR_NO_NETWORK -Windows.Win32.Foundation.ERROR_NO_NVRAM_RESOURCES -Windows.Win32.Foundation.ERROR_NO_PAGEFILE -Windows.Win32.Foundation.ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND -Windows.Win32.Foundation.ERROR_NO_PROC_SLOTS -Windows.Win32.Foundation.ERROR_NO_PROMOTION_ACTIVE -Windows.Win32.Foundation.ERROR_NO_QUOTAS_FOR_ACCOUNT -Windows.Win32.Foundation.ERROR_NO_RANGES_PROCESSED -Windows.Win32.Foundation.ERROR_NO_RECOVERY_POLICY -Windows.Win32.Foundation.ERROR_NO_RECOVERY_PROGRAM -Windows.Win32.Foundation.ERROR_NO_SCROLLBARS -Windows.Win32.Foundation.ERROR_NO_SECRETS -Windows.Win32.Foundation.ERROR_NO_SECURITY_ON_OBJECT -Windows.Win32.Foundation.ERROR_NO_SHUTDOWN_IN_PROGRESS -Windows.Win32.Foundation.ERROR_NO_SIGNAL_SENT -Windows.Win32.Foundation.ERROR_NO_SITE_SETTINGS_OBJECT -Windows.Win32.Foundation.ERROR_NO_SITENAME -Windows.Win32.Foundation.ERROR_NO_SPOOL_SPACE -Windows.Win32.Foundation.ERROR_NO_SUCH_ALIAS -Windows.Win32.Foundation.ERROR_NO_SUCH_DEVICE -Windows.Win32.Foundation.ERROR_NO_SUCH_DOMAIN -Windows.Win32.Foundation.ERROR_NO_SUCH_GROUP -Windows.Win32.Foundation.ERROR_NO_SUCH_LOGON_SESSION -Windows.Win32.Foundation.ERROR_NO_SUCH_MEMBER -Windows.Win32.Foundation.ERROR_NO_SUCH_PACKAGE -Windows.Win32.Foundation.ERROR_NO_SUCH_PRIVILEGE -Windows.Win32.Foundation.ERROR_NO_SUCH_SITE -Windows.Win32.Foundation.ERROR_NO_SUCH_USER -Windows.Win32.Foundation.ERROR_NO_SYSTEM_MENU -Windows.Win32.Foundation.ERROR_NO_SYSTEM_RESOURCES -Windows.Win32.Foundation.ERROR_NO_TASK_QUEUE -Windows.Win32.Foundation.ERROR_NO_TOKEN -Windows.Win32.Foundation.ERROR_NO_TRACKING_SERVICE -Windows.Win32.Foundation.ERROR_NO_TRUST_LSA_SECRET -Windows.Win32.Foundation.ERROR_NO_TRUST_SAM_ACCOUNT -Windows.Win32.Foundation.ERROR_NO_UNICODE_TRANSLATION -Windows.Win32.Foundation.ERROR_NO_USER_KEYS -Windows.Win32.Foundation.ERROR_NO_USER_SESSION_KEY -Windows.Win32.Foundation.ERROR_NO_VOLUME_ID -Windows.Win32.Foundation.ERROR_NO_VOLUME_LABEL -Windows.Win32.Foundation.ERROR_NO_WILDCARD_CHARACTERS -Windows.Win32.Foundation.ERROR_NO_WORK_DONE -Windows.Win32.Foundation.ERROR_NO_WRITABLE_DC_FOUND -Windows.Win32.Foundation.ERROR_NO_YIELD_PERFORMED -Windows.Win32.Foundation.ERROR_NOACCESS -Windows.Win32.Foundation.ERROR_NOINTERFACE -Windows.Win32.Foundation.ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT -Windows.Win32.Foundation.ERROR_NOLOGON_SERVER_TRUST_ACCOUNT -Windows.Win32.Foundation.ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT -Windows.Win32.Foundation.ERROR_NON_ACCOUNT_SID -Windows.Win32.Foundation.ERROR_NON_DOMAIN_SID -Windows.Win32.Foundation.ERROR_NON_MDICHILD_WINDOW -Windows.Win32.Foundation.ERROR_NONE_MAPPED -Windows.Win32.Foundation.ERROR_NONPAGED_SYSTEM_RESOURCES -Windows.Win32.Foundation.ERROR_NOT_A_CLOUD_FILE -Windows.Win32.Foundation.ERROR_NOT_A_CLOUD_SYNC_ROOT -Windows.Win32.Foundation.ERROR_NOT_A_DAX_VOLUME -Windows.Win32.Foundation.ERROR_NOT_A_REPARSE_POINT -Windows.Win32.Foundation.ERROR_NOT_ALL_ASSIGNED -Windows.Win32.Foundation.ERROR_NOT_ALLOWED_ON_SYSTEM_FILE -Windows.Win32.Foundation.ERROR_NOT_APPCONTAINER -Windows.Win32.Foundation.ERROR_NOT_AUTHENTICATED -Windows.Win32.Foundation.ERROR_NOT_CAPABLE -Windows.Win32.Foundation.ERROR_NOT_CHILD_WINDOW -Windows.Win32.Foundation.ERROR_NOT_CONNECTED -Windows.Win32.Foundation.ERROR_NOT_CONTAINER -Windows.Win32.Foundation.ERROR_NOT_DAX_MAPPABLE -Windows.Win32.Foundation.ERROR_NOT_DOS_DISK -Windows.Win32.Foundation.ERROR_NOT_ENOUGH_MEMORY -Windows.Win32.Foundation.ERROR_NOT_ENOUGH_QUOTA -Windows.Win32.Foundation.ERROR_NOT_ENOUGH_SERVER_MEMORY -Windows.Win32.Foundation.ERROR_NOT_EXPORT_FORMAT -Windows.Win32.Foundation.ERROR_NOT_FOUND -Windows.Win32.Foundation.ERROR_NOT_GUI_PROCESS -Windows.Win32.Foundation.ERROR_NOT_JOINED -Windows.Win32.Foundation.ERROR_NOT_LOCKED -Windows.Win32.Foundation.ERROR_NOT_LOGGED_ON -Windows.Win32.Foundation.ERROR_NOT_LOGON_PROCESS -Windows.Win32.Foundation.ERROR_NOT_OWNER -Windows.Win32.Foundation.ERROR_NOT_READ_FROM_COPY -Windows.Win32.Foundation.ERROR_NOT_READY -Windows.Win32.Foundation.ERROR_NOT_REDUNDANT_STORAGE -Windows.Win32.Foundation.ERROR_NOT_REGISTRY_FILE -Windows.Win32.Foundation.ERROR_NOT_SAFE_MODE_DRIVER -Windows.Win32.Foundation.ERROR_NOT_SAFEBOOT_SERVICE -Windows.Win32.Foundation.ERROR_NOT_SAME_DEVICE -Windows.Win32.Foundation.ERROR_NOT_SAME_OBJECT -Windows.Win32.Foundation.ERROR_NOT_SUBSTED -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_IN_APPCONTAINER -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_ON_DAX -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_ON_SBS -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_AUDITING -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_BTT -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_BYPASSIO -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_CACHED_HANDLE -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_COMPRESSION -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_DEDUPLICATION -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_ENCRYPTION -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_MONITORING -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_REPLICATION -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_SNAPSHOT -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_VIRTUALIZATION -Windows.Win32.Foundation.ERROR_NOT_TINY_STREAM -Windows.Win32.Foundation.ERROR_NOTHING_TO_TERMINATE -Windows.Win32.Foundation.ERROR_NOTIFICATION_GUID_ALREADY_DEFINED -Windows.Win32.Foundation.ERROR_NOTIFY_CLEANUP -Windows.Win32.Foundation.ERROR_NOTIFY_ENUM_DIR -Windows.Win32.Foundation.ERROR_NT_CROSS_ENCRYPTION_REQUIRED -Windows.Win32.Foundation.ERROR_NTLM_BLOCKED -Windows.Win32.Foundation.ERROR_NULL_LM_PASSWORD -Windows.Win32.Foundation.ERROR_OBJECT_IS_IMMUTABLE -Windows.Win32.Foundation.ERROR_OBJECT_NAME_EXISTS -Windows.Win32.Foundation.ERROR_OBJECT_NOT_EXTERNALLY_BACKED -Windows.Win32.Foundation.ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_OFFSET_ALIGNMENT_VIOLATION -Windows.Win32.Foundation.ERROR_OLD_WIN_VERSION -Windows.Win32.Foundation.ERROR_ONLY_IF_CONNECTED -Windows.Win32.Foundation.ERROR_OPEN_FAILED -Windows.Win32.Foundation.ERROR_OPEN_FILES -Windows.Win32.Foundation.ERROR_OPERATION_ABORTED -Windows.Win32.Foundation.ERROR_OPERATION_IN_PROGRESS -Windows.Win32.Foundation.ERROR_OPLOCK_BREAK_IN_PROGRESS -Windows.Win32.Foundation.ERROR_OPLOCK_HANDLE_CLOSED -Windows.Win32.Foundation.ERROR_OPLOCK_NOT_GRANTED -Windows.Win32.Foundation.ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE -Windows.Win32.Foundation.ERROR_ORPHAN_NAME_EXHAUSTED -Windows.Win32.Foundation.ERROR_OUT_OF_PAPER -Windows.Win32.Foundation.ERROR_OUT_OF_STRUCTURES -Windows.Win32.Foundation.ERROR_OUTOFMEMORY -Windows.Win32.Foundation.ERROR_OVERRIDE_NOCHANGES -Windows.Win32.Foundation.ERROR_PAGE_FAULT_COPY_ON_WRITE -Windows.Win32.Foundation.ERROR_PAGE_FAULT_DEMAND_ZERO -Windows.Win32.Foundation.ERROR_PAGE_FAULT_GUARD_PAGE -Windows.Win32.Foundation.ERROR_PAGE_FAULT_PAGING_FILE -Windows.Win32.Foundation.ERROR_PAGE_FAULT_TRANSITION -Windows.Win32.Foundation.ERROR_PAGED_SYSTEM_RESOURCES -Windows.Win32.Foundation.ERROR_PAGEFILE_CREATE_FAILED -Windows.Win32.Foundation.ERROR_PAGEFILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_PAGEFILE_QUOTA -Windows.Win32.Foundation.ERROR_PAGEFILE_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_PARAMETER_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_PARTIAL_COPY -Windows.Win32.Foundation.ERROR_PARTITION_FAILURE -Windows.Win32.Foundation.ERROR_PARTITION_TERMINATING -Windows.Win32.Foundation.ERROR_PASSWORD_CHANGE_REQUIRED -Windows.Win32.Foundation.ERROR_PASSWORD_EXPIRED -Windows.Win32.Foundation.ERROR_PASSWORD_MUST_CHANGE -Windows.Win32.Foundation.ERROR_PASSWORD_RESTRICTION -Windows.Win32.Foundation.ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT -Windows.Win32.Foundation.ERROR_PATCH_NO_SEQUENCE -Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_INVALID -Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_OPEN_FAILED -Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_REJECTED -Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_UNSUPPORTED -Windows.Win32.Foundation.ERROR_PATCH_REMOVAL_DISALLOWED -Windows.Win32.Foundation.ERROR_PATCH_REMOVAL_UNSUPPORTED -Windows.Win32.Foundation.ERROR_PATCH_TARGET_NOT_FOUND -Windows.Win32.Foundation.ERROR_PATH_BUSY -Windows.Win32.Foundation.ERROR_PATH_NOT_FOUND -Windows.Win32.Foundation.ERROR_PER_USER_TRUST_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_PIPE_BUSY -Windows.Win32.Foundation.ERROR_PIPE_CONNECTED -Windows.Win32.Foundation.ERROR_PIPE_LISTENING -Windows.Win32.Foundation.ERROR_PIPE_LOCAL -Windows.Win32.Foundation.ERROR_PIPE_NOT_CONNECTED -Windows.Win32.Foundation.ERROR_PKINIT_FAILURE -Windows.Win32.Foundation.ERROR_PLUGPLAY_QUERY_VETOED -Windows.Win32.Foundation.ERROR_PNP_BAD_MPS_TABLE -Windows.Win32.Foundation.ERROR_PNP_INVALID_ID -Windows.Win32.Foundation.ERROR_PNP_IRQ_TRANSLATION_FAILED -Windows.Win32.Foundation.ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT -Windows.Win32.Foundation.ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT -Windows.Win32.Foundation.ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT -Windows.Win32.Foundation.ERROR_PNP_REBOOT_REQUIRED -Windows.Win32.Foundation.ERROR_PNP_RESTART_ENUMERATION -Windows.Win32.Foundation.ERROR_PNP_TRANSLATION_FAILED -Windows.Win32.Foundation.ERROR_POINT_NOT_FOUND -Windows.Win32.Foundation.ERROR_POLICY_OBJECT_NOT_FOUND -Windows.Win32.Foundation.ERROR_POLICY_ONLY_IN_DS -Windows.Win32.Foundation.ERROR_POPUP_ALREADY_ACTIVE -Windows.Win32.Foundation.ERROR_PORT_MESSAGE_TOO_LONG -Windows.Win32.Foundation.ERROR_PORT_NOT_SET -Windows.Win32.Foundation.ERROR_PORT_UNREACHABLE -Windows.Win32.Foundation.ERROR_POSSIBLE_DEADLOCK -Windows.Win32.Foundation.ERROR_POTENTIAL_FILE_FOUND -Windows.Win32.Foundation.ERROR_PREDEFINED_HANDLE -Windows.Win32.Foundation.ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED -Windows.Win32.Foundation.ERROR_PRINT_CANCELLED -Windows.Win32.Foundation.ERROR_PRINTER_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_PRINTER_DELETED -Windows.Win32.Foundation.ERROR_PRINTER_DRIVER_ALREADY_INSTALLED -Windows.Win32.Foundation.ERROR_PRINTQ_FULL -Windows.Win32.Foundation.ERROR_PRIVATE_DIALOG_INDEX -Windows.Win32.Foundation.ERROR_PRIVILEGE_NOT_HELD -Windows.Win32.Foundation.ERROR_PROC_NOT_FOUND -Windows.Win32.Foundation.ERROR_PROCESS_ABORTED -Windows.Win32.Foundation.ERROR_PROCESS_IN_JOB -Windows.Win32.Foundation.ERROR_PROCESS_IS_PROTECTED -Windows.Win32.Foundation.ERROR_PROCESS_MODE_ALREADY_BACKGROUND -Windows.Win32.Foundation.ERROR_PROCESS_MODE_NOT_BACKGROUND -Windows.Win32.Foundation.ERROR_PROCESS_NOT_IN_JOB -Windows.Win32.Foundation.ERROR_PRODUCT_UNINSTALLED -Windows.Win32.Foundation.ERROR_PRODUCT_VERSION -Windows.Win32.Foundation.ERROR_PROFILING_AT_LIMIT -Windows.Win32.Foundation.ERROR_PROFILING_NOT_STARTED -Windows.Win32.Foundation.ERROR_PROFILING_NOT_STOPPED -Windows.Win32.Foundation.ERROR_PROMOTION_ACTIVE -Windows.Win32.Foundation.ERROR_PROTOCOL_UNREACHABLE -Windows.Win32.Foundation.ERROR_PWD_HISTORY_CONFLICT -Windows.Win32.Foundation.ERROR_PWD_TOO_LONG -Windows.Win32.Foundation.ERROR_PWD_TOO_RECENT -Windows.Win32.Foundation.ERROR_PWD_TOO_SHORT -Windows.Win32.Foundation.ERROR_QUOTA_ACTIVITY -Windows.Win32.Foundation.ERROR_QUOTA_LIST_INCONSISTENT -Windows.Win32.Foundation.ERROR_RANGE_LIST_CONFLICT -Windows.Win32.Foundation.ERROR_RANGE_NOT_FOUND -Windows.Win32.Foundation.ERROR_READ_FAULT -Windows.Win32.Foundation.ERROR_RECEIVE_EXPEDITED -Windows.Win32.Foundation.ERROR_RECEIVE_PARTIAL -Windows.Win32.Foundation.ERROR_RECEIVE_PARTIAL_EXPEDITED -Windows.Win32.Foundation.ERROR_RECOVERY_FAILURE -Windows.Win32.Foundation.ERROR_REDIR_PAUSED -Windows.Win32.Foundation.ERROR_REDIRECTOR_HAS_OPEN_HANDLES -Windows.Win32.Foundation.ERROR_REG_NAT_CONSUMPTION -Windows.Win32.Foundation.ERROR_REGISTRY_CORRUPT -Windows.Win32.Foundation.ERROR_REGISTRY_HIVE_RECOVERED -Windows.Win32.Foundation.ERROR_REGISTRY_IO_FAILED -Windows.Win32.Foundation.ERROR_REGISTRY_QUOTA_LIMIT -Windows.Win32.Foundation.ERROR_REGISTRY_RECOVERED -Windows.Win32.Foundation.ERROR_RELOC_CHAIN_XEEDS_SEGLIM -Windows.Win32.Foundation.ERROR_REM_NOT_LIST -Windows.Win32.Foundation.ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED -Windows.Win32.Foundation.ERROR_REMOTE_SESSION_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_REMOTE_STORAGE_MEDIA_ERROR -Windows.Win32.Foundation.ERROR_REMOTE_STORAGE_NOT_ACTIVE -Windows.Win32.Foundation.ERROR_REPARSE -Windows.Win32.Foundation.ERROR_REPARSE_ATTRIBUTE_CONFLICT -Windows.Win32.Foundation.ERROR_REPARSE_OBJECT -Windows.Win32.Foundation.ERROR_REPARSE_POINT_ENCOUNTERED -Windows.Win32.Foundation.ERROR_REPARSE_TAG_INVALID -Windows.Win32.Foundation.ERROR_REPARSE_TAG_MISMATCH -Windows.Win32.Foundation.ERROR_REPLY_MESSAGE_MISMATCH -Windows.Win32.Foundation.ERROR_REQ_NOT_ACCEP -Windows.Win32.Foundation.ERROR_REQUEST_ABORTED -Windows.Win32.Foundation.ERROR_REQUEST_OUT_OF_SEQUENCE -Windows.Win32.Foundation.ERROR_REQUEST_PAUSED -Windows.Win32.Foundation.ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION -Windows.Win32.Foundation.ERROR_RESIDENT_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_RESOURCE_CALL_TIMED_OUT -Windows.Win32.Foundation.ERROR_RESOURCE_DATA_NOT_FOUND -Windows.Win32.Foundation.ERROR_RESOURCE_LANG_NOT_FOUND -Windows.Win32.Foundation.ERROR_RESOURCE_NAME_NOT_FOUND -Windows.Win32.Foundation.ERROR_RESOURCE_REQUIREMENTS_CHANGED -Windows.Win32.Foundation.ERROR_RESOURCE_TYPE_NOT_FOUND -Windows.Win32.Foundation.ERROR_RESTART_APPLICATION -Windows.Win32.Foundation.ERROR_RESUME_HIBERNATION -Windows.Win32.Foundation.ERROR_RETRY -Windows.Win32.Foundation.ERROR_RETURN_ADDRESS_HIJACK_ATTEMPT -Windows.Win32.Foundation.ERROR_REVISION_MISMATCH -Windows.Win32.Foundation.ERROR_RING2_STACK_IN_USE -Windows.Win32.Foundation.ERROR_RING2SEG_MUST_BE_MOVABLE -Windows.Win32.Foundation.ERROR_RMODE_APP -Windows.Win32.Foundation.ERROR_ROWSNOTRELEASED -Windows.Win32.Foundation.ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT -Windows.Win32.Foundation.ERROR_RUNLEVEL_SWITCH_TIMEOUT -Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED -Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET -Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE -Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER -Windows.Win32.Foundation.ERROR_RXACT_COMMIT_FAILURE -Windows.Win32.Foundation.ERROR_RXACT_COMMIT_NECESSARY -Windows.Win32.Foundation.ERROR_RXACT_COMMITTED -Windows.Win32.Foundation.ERROR_RXACT_INVALID_STATE -Windows.Win32.Foundation.ERROR_RXACT_STATE_CREATED -Windows.Win32.Foundation.ERROR_SAM_INIT_FAILURE -Windows.Win32.Foundation.ERROR_SAME_DRIVE -Windows.Win32.Foundation.ERROR_SCOPE_NOT_FOUND -Windows.Win32.Foundation.ERROR_SCREEN_ALREADY_LOCKED -Windows.Win32.Foundation.ERROR_SCRUB_DATA_DISABLED -Windows.Win32.Foundation.ERROR_SECRET_TOO_LONG -Windows.Win32.Foundation.ERROR_SECTION_DIRECT_MAP_ONLY -Windows.Win32.Foundation.ERROR_SECTOR_NOT_FOUND -Windows.Win32.Foundation.ERROR_SECURITY_DENIES_OPERATION -Windows.Win32.Foundation.ERROR_SECURITY_STREAM_IS_INCONSISTENT -Windows.Win32.Foundation.ERROR_SEEK -Windows.Win32.Foundation.ERROR_SEEK_ON_DEVICE -Windows.Win32.Foundation.ERROR_SEGMENT_NOTIFICATION -Windows.Win32.Foundation.ERROR_SEM_IS_SET -Windows.Win32.Foundation.ERROR_SEM_NOT_FOUND -Windows.Win32.Foundation.ERROR_SEM_OWNER_DIED -Windows.Win32.Foundation.ERROR_SEM_TIMEOUT -Windows.Win32.Foundation.ERROR_SEM_USER_LIMIT -Windows.Win32.Foundation.ERROR_SERIAL_NO_DEVICE -Windows.Win32.Foundation.ERROR_SERVER_DISABLED -Windows.Win32.Foundation.ERROR_SERVER_HAS_OPEN_HANDLES -Windows.Win32.Foundation.ERROR_SERVER_NOT_DISABLED -Windows.Win32.Foundation.ERROR_SERVER_SHUTDOWN_IN_PROGRESS -Windows.Win32.Foundation.ERROR_SERVER_SID_MISMATCH -Windows.Win32.Foundation.ERROR_SERVER_TRANSPORT_CONFLICT -Windows.Win32.Foundation.ERROR_SERVICE_ALREADY_RUNNING -Windows.Win32.Foundation.ERROR_SERVICE_CANNOT_ACCEPT_CTRL -Windows.Win32.Foundation.ERROR_SERVICE_DATABASE_LOCKED -Windows.Win32.Foundation.ERROR_SERVICE_DEPENDENCY_DELETED -Windows.Win32.Foundation.ERROR_SERVICE_DEPENDENCY_FAIL -Windows.Win32.Foundation.ERROR_SERVICE_DISABLED -Windows.Win32.Foundation.ERROR_SERVICE_DOES_NOT_EXIST -Windows.Win32.Foundation.ERROR_SERVICE_EXISTS -Windows.Win32.Foundation.ERROR_SERVICE_LOGON_FAILED -Windows.Win32.Foundation.ERROR_SERVICE_MARKED_FOR_DELETE -Windows.Win32.Foundation.ERROR_SERVICE_NEVER_STARTED -Windows.Win32.Foundation.ERROR_SERVICE_NO_THREAD -Windows.Win32.Foundation.ERROR_SERVICE_NOT_ACTIVE -Windows.Win32.Foundation.ERROR_SERVICE_NOT_FOUND -Windows.Win32.Foundation.ERROR_SERVICE_NOT_IN_EXE -Windows.Win32.Foundation.ERROR_SERVICE_NOTIFICATION -Windows.Win32.Foundation.ERROR_SERVICE_NOTIFY_CLIENT_LAGGING -Windows.Win32.Foundation.ERROR_SERVICE_REQUEST_TIMEOUT -Windows.Win32.Foundation.ERROR_SERVICE_SPECIFIC_ERROR -Windows.Win32.Foundation.ERROR_SERVICE_START_HANG -Windows.Win32.Foundation.ERROR_SESSION_CREDENTIAL_CONFLICT -Windows.Win32.Foundation.ERROR_SESSION_KEY_TOO_SHORT -Windows.Win32.Foundation.ERROR_SET_CONTEXT_DENIED -Windows.Win32.Foundation.ERROR_SET_NOT_FOUND -Windows.Win32.Foundation.ERROR_SET_POWER_STATE_FAILED -Windows.Win32.Foundation.ERROR_SET_POWER_STATE_VETOED -Windows.Win32.Foundation.ERROR_SETCOUNT_ON_BAD_LB -Windows.Win32.Foundation.ERROR_SETMARK_DETECTED -Windows.Win32.Foundation.ERROR_SHARED_POLICY -Windows.Win32.Foundation.ERROR_SHARING_BUFFER_EXCEEDED -Windows.Win32.Foundation.ERROR_SHARING_PAUSED -Windows.Win32.Foundation.ERROR_SHARING_VIOLATION -Windows.Win32.Foundation.ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME -Windows.Win32.Foundation.ERROR_SHUTDOWN_DISKS_NOT_IN_MAINTENANCE_MODE -Windows.Win32.Foundation.ERROR_SHUTDOWN_IN_PROGRESS -Windows.Win32.Foundation.ERROR_SHUTDOWN_IS_SCHEDULED -Windows.Win32.Foundation.ERROR_SHUTDOWN_USERS_LOGGED_ON -Windows.Win32.Foundation.ERROR_SIGNAL_PENDING -Windows.Win32.Foundation.ERROR_SIGNAL_REFUSED -Windows.Win32.Foundation.ERROR_SINGLE_INSTANCE_APP -Windows.Win32.Foundation.ERROR_SMARTCARD_SUBSYSTEM_FAILURE -Windows.Win32.Foundation.ERROR_SMB1_NOT_AVAILABLE -Windows.Win32.Foundation.ERROR_SMB_GUEST_LOGON_BLOCKED -Windows.Win32.Foundation.ERROR_SMR_GARBAGE_COLLECTION_REQUIRED -Windows.Win32.Foundation.ERROR_SOME_NOT_MAPPED -Windows.Win32.Foundation.ERROR_SOURCE_ELEMENT_EMPTY -Windows.Win32.Foundation.ERROR_SPARSE_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_SPECIAL_ACCOUNT -Windows.Win32.Foundation.ERROR_SPECIAL_GROUP -Windows.Win32.Foundation.ERROR_SPECIAL_USER -Windows.Win32.Foundation.ERROR_SRC_SRV_DLL_LOAD_FAILED -Windows.Win32.Foundation.ERROR_STACK_BUFFER_OVERRUN -Windows.Win32.Foundation.ERROR_STACK_OVERFLOW -Windows.Win32.Foundation.ERROR_STACK_OVERFLOW_READ -Windows.Win32.Foundation.ERROR_STOPPED_ON_SYMLINK -Windows.Win32.Foundation.ERROR_STORAGE_LOST_DATA_PERSISTENCE -Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_DOES_NOT_EXIST -Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_ID_INVALID -Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_NOT_EMPTY -Windows.Win32.Foundation.ERROR_STORAGE_STACK_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_STORAGE_TOPOLOGY_ID_MISMATCH -Windows.Win32.Foundation.ERROR_STRICT_CFG_VIOLATION -Windows.Win32.Foundation.ERROR_SUBST_TO_JOIN -Windows.Win32.Foundation.ERROR_SUBST_TO_SUBST -Windows.Win32.Foundation.ERROR_SUCCESS -Windows.Win32.Foundation.ERROR_SUCCESS_REBOOT_INITIATED -Windows.Win32.Foundation.ERROR_SWAPERROR -Windows.Win32.Foundation.ERROR_SYMLINK_CLASS_DISABLED -Windows.Win32.Foundation.ERROR_SYMLINK_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED -Windows.Win32.Foundation.ERROR_SYNCHRONIZATION_REQUIRED -Windows.Win32.Foundation.ERROR_SYSTEM_HIVE_TOO_LARGE -Windows.Win32.Foundation.ERROR_SYSTEM_IMAGE_BAD_SIGNATURE -Windows.Win32.Foundation.ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION -Windows.Win32.Foundation.ERROR_SYSTEM_POWERSTATE_TRANSITION -Windows.Win32.Foundation.ERROR_SYSTEM_PROCESS_TERMINATED -Windows.Win32.Foundation.ERROR_SYSTEM_SHUTDOWN -Windows.Win32.Foundation.ERROR_SYSTEM_TRACE -Windows.Win32.Foundation.ERROR_THREAD_1_INACTIVE -Windows.Win32.Foundation.ERROR_THREAD_ALREADY_IN_TASK -Windows.Win32.Foundation.ERROR_THREAD_MODE_ALREADY_BACKGROUND -Windows.Win32.Foundation.ERROR_THREAD_MODE_NOT_BACKGROUND -Windows.Win32.Foundation.ERROR_THREAD_NOT_IN_PROCESS -Windows.Win32.Foundation.ERROR_THREAD_WAS_SUSPENDED -Windows.Win32.Foundation.ERROR_TIME_SENSITIVE_THREAD -Windows.Win32.Foundation.ERROR_TIME_SKEW -Windows.Win32.Foundation.ERROR_TIMEOUT -Windows.Win32.Foundation.ERROR_TIMER_NOT_CANCELED -Windows.Win32.Foundation.ERROR_TIMER_RESOLUTION_NOT_SET -Windows.Win32.Foundation.ERROR_TIMER_RESUME_IGNORED -Windows.Win32.Foundation.ERROR_TLW_WITH_WSCHILD -Windows.Win32.Foundation.ERROR_TOKEN_ALREADY_IN_USE -Windows.Win32.Foundation.ERROR_TOO_MANY_CMDS -Windows.Win32.Foundation.ERROR_TOO_MANY_CONTEXT_IDS -Windows.Win32.Foundation.ERROR_TOO_MANY_DESCRIPTORS -Windows.Win32.Foundation.ERROR_TOO_MANY_LINKS -Windows.Win32.Foundation.ERROR_TOO_MANY_LUIDS_REQUESTED -Windows.Win32.Foundation.ERROR_TOO_MANY_MODULES -Windows.Win32.Foundation.ERROR_TOO_MANY_MUXWAITERS -Windows.Win32.Foundation.ERROR_TOO_MANY_NAMES -Windows.Win32.Foundation.ERROR_TOO_MANY_OPEN_FILES -Windows.Win32.Foundation.ERROR_TOO_MANY_POSTS -Windows.Win32.Foundation.ERROR_TOO_MANY_SECRETS -Windows.Win32.Foundation.ERROR_TOO_MANY_SEM_REQUESTS -Windows.Win32.Foundation.ERROR_TOO_MANY_SEMAPHORES -Windows.Win32.Foundation.ERROR_TOO_MANY_SESS -Windows.Win32.Foundation.ERROR_TOO_MANY_SIDS -Windows.Win32.Foundation.ERROR_TOO_MANY_TCBS -Windows.Win32.Foundation.ERROR_TOO_MANY_THREADS -Windows.Win32.Foundation.ERROR_TRANSLATION_COMPLETE -Windows.Win32.Foundation.ERROR_TRUST_FAILURE -Windows.Win32.Foundation.ERROR_TRUSTED_DOMAIN_FAILURE -Windows.Win32.Foundation.ERROR_TRUSTED_RELATIONSHIP_FAILURE -Windows.Win32.Foundation.ERROR_UNABLE_TO_LOCK_MEDIA -Windows.Win32.Foundation.ERROR_UNABLE_TO_MOVE_REPLACEMENT -Windows.Win32.Foundation.ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 -Windows.Win32.Foundation.ERROR_UNABLE_TO_REMOVE_REPLACED -Windows.Win32.Foundation.ERROR_UNABLE_TO_UNLOAD_MEDIA -Windows.Win32.Foundation.ERROR_UNDEFINED_CHARACTER -Windows.Win32.Foundation.ERROR_UNDEFINED_SCOPE -Windows.Win32.Foundation.ERROR_UNEXP_NET_ERR -Windows.Win32.Foundation.ERROR_UNEXPECTED_MM_CREATE_ERR -Windows.Win32.Foundation.ERROR_UNEXPECTED_MM_EXTEND_ERR -Windows.Win32.Foundation.ERROR_UNEXPECTED_MM_MAP_ERROR -Windows.Win32.Foundation.ERROR_UNEXPECTED_NTCACHEMANAGER_ERROR -Windows.Win32.Foundation.ERROR_UNHANDLED_EXCEPTION -Windows.Win32.Foundation.ERROR_UNIDENTIFIED_ERROR -Windows.Win32.Foundation.ERROR_UNKNOWN_COMPONENT -Windows.Win32.Foundation.ERROR_UNKNOWN_FEATURE -Windows.Win32.Foundation.ERROR_UNKNOWN_PATCH -Windows.Win32.Foundation.ERROR_UNKNOWN_PORT -Windows.Win32.Foundation.ERROR_UNKNOWN_PRINTER_DRIVER -Windows.Win32.Foundation.ERROR_UNKNOWN_PRINTPROCESSOR -Windows.Win32.Foundation.ERROR_UNKNOWN_PRODUCT -Windows.Win32.Foundation.ERROR_UNKNOWN_PROPERTY -Windows.Win32.Foundation.ERROR_UNKNOWN_REVISION -Windows.Win32.Foundation.ERROR_UNRECOGNIZED_MEDIA -Windows.Win32.Foundation.ERROR_UNRECOGNIZED_VOLUME -Windows.Win32.Foundation.ERROR_UNSATISFIED_DEPENDENCIES -Windows.Win32.Foundation.ERROR_UNSUPPORTED_COMPRESSION -Windows.Win32.Foundation.ERROR_UNSUPPORTED_TYPE -Windows.Win32.Foundation.ERROR_UNTRUSTED_MOUNT_POINT -Windows.Win32.Foundation.ERROR_UNWIND -Windows.Win32.Foundation.ERROR_UNWIND_CONSOLIDATE -Windows.Win32.Foundation.ERROR_USER_APC -Windows.Win32.Foundation.ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_USER_EXISTS -Windows.Win32.Foundation.ERROR_USER_MAPPED_FILE -Windows.Win32.Foundation.ERROR_USER_PROFILE_LOAD -Windows.Win32.Foundation.ERROR_VALIDATE_CONTINUE -Windows.Win32.Foundation.ERROR_VC_DISCONNECTED -Windows.Win32.Foundation.ERROR_VDM_DISALLOWED -Windows.Win32.Foundation.ERROR_VDM_HARD_ERROR -Windows.Win32.Foundation.ERROR_VERIFIER_STOP -Windows.Win32.Foundation.ERROR_VERSION_PARSE_ERROR -Windows.Win32.Foundation.ERROR_VIRUS_DELETED -Windows.Win32.Foundation.ERROR_VIRUS_INFECTED -Windows.Win32.Foundation.ERROR_VOLSNAP_HIBERNATE_READY -Windows.Win32.Foundation.ERROR_VOLSNAP_PREPARE_HIBERNATE -Windows.Win32.Foundation.ERROR_VOLUME_MOUNTED -Windows.Win32.Foundation.ERROR_VOLUME_NOT_CLUSTER_ALIGNED -Windows.Win32.Foundation.ERROR_VOLUME_NOT_SIS_ENABLED -Windows.Win32.Foundation.ERROR_VOLUME_NOT_SUPPORT_EFS -Windows.Win32.Foundation.ERROR_VOLUME_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_VOLUME_WRITE_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_WAIT_1 -Windows.Win32.Foundation.ERROR_WAIT_2 -Windows.Win32.Foundation.ERROR_WAIT_3 -Windows.Win32.Foundation.ERROR_WAIT_63 -Windows.Win32.Foundation.ERROR_WAIT_FOR_OPLOCK -Windows.Win32.Foundation.ERROR_WAIT_NO_CHILDREN -Windows.Win32.Foundation.ERROR_WAKE_SYSTEM -Windows.Win32.Foundation.ERROR_WAKE_SYSTEM_DEBUGGER -Windows.Win32.Foundation.ERROR_WAS_LOCKED -Windows.Win32.Foundation.ERROR_WAS_UNLOCKED -Windows.Win32.Foundation.ERROR_WEAK_WHFBKEY_BLOCKED -Windows.Win32.Foundation.ERROR_WINDOW_NOT_COMBOBOX -Windows.Win32.Foundation.ERROR_WINDOW_NOT_DIALOG -Windows.Win32.Foundation.ERROR_WINDOW_OF_OTHER_THREAD -Windows.Win32.Foundation.ERROR_WIP_ENCRYPTION_FAILED -Windows.Win32.Foundation.ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT -Windows.Win32.Foundation.ERROR_WOF_WIM_HEADER_CORRUPT -Windows.Win32.Foundation.ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT -Windows.Win32.Foundation.ERROR_WORKING_SET_QUOTA -Windows.Win32.Foundation.ERROR_WOW_ASSERTION -Windows.Win32.Foundation.ERROR_WRITE_FAULT -Windows.Win32.Foundation.ERROR_WRITE_PROTECT -Windows.Win32.Foundation.ERROR_WRONG_COMPARTMENT -Windows.Win32.Foundation.ERROR_WRONG_DISK -Windows.Win32.Foundation.ERROR_WRONG_EFS -Windows.Win32.Foundation.ERROR_WRONG_PASSWORD -Windows.Win32.Foundation.ERROR_WRONG_TARGET_NAME -Windows.Win32.Foundation.ERROR_WX86_ERROR -Windows.Win32.Foundation.ERROR_WX86_WARNING -Windows.Win32.Foundation.ERROR_XML_PARSE_ERROR -Windows.Win32.Foundation.ERROR_XMLDSIG_ERROR -Windows.Win32.Foundation.EXCEPTION_STACK_OVERFLOW -Windows.Win32.Foundation.FALSE -Windows.Win32.Foundation.FARPROC -Windows.Win32.Foundation.FILETIME -Windows.Win32.Foundation.FRS_ERR_SYSVOL_POPULATE_TIMEOUT -Windows.Win32.Foundation.GENERIC_ACCESS_RIGHTS -Windows.Win32.Foundation.GENERIC_ALL -Windows.Win32.Foundation.GENERIC_EXECUTE -Windows.Win32.Foundation.GENERIC_READ -Windows.Win32.Foundation.GENERIC_WRITE -Windows.Win32.Foundation.GetLastError -Windows.Win32.Foundation.HANDLE -Windows.Win32.Foundation.HANDLE_FLAG_INHERIT -Windows.Win32.Foundation.HANDLE_FLAG_PROTECT_FROM_CLOSE -Windows.Win32.Foundation.HANDLE_FLAGS -Windows.Win32.Foundation.HMODULE -Windows.Win32.Foundation.LocalFree -Windows.Win32.Foundation.MAX_PATH -Windows.Win32.Foundation.NO_ERROR -Windows.Win32.Foundation.NTSTATUS -Windows.Win32.Foundation.RtlNtStatusToDosError -Windows.Win32.Foundation.SetHandleInformation -Windows.Win32.Foundation.SetLastError -Windows.Win32.Foundation.STATUS_DELETE_PENDING -Windows.Win32.Foundation.STATUS_DIRECTORY_NOT_EMPTY -Windows.Win32.Foundation.STATUS_END_OF_FILE -Windows.Win32.Foundation.STATUS_FILE_DELETED -Windows.Win32.Foundation.STATUS_INVALID_HANDLE -Windows.Win32.Foundation.STATUS_INVALID_PARAMETER -Windows.Win32.Foundation.STATUS_NOT_IMPLEMENTED -Windows.Win32.Foundation.STATUS_PENDING -Windows.Win32.Foundation.STATUS_SHARING_VIOLATION -Windows.Win32.Foundation.STATUS_SUCCESS -Windows.Win32.Foundation.TRUE -Windows.Win32.Foundation.UNICODE_STRING -Windows.Win32.Foundation.WAIT_ABANDONED -Windows.Win32.Foundation.WAIT_ABANDONED_0 -Windows.Win32.Foundation.WAIT_FAILED -Windows.Win32.Foundation.WAIT_IO_COMPLETION -Windows.Win32.Foundation.WAIT_OBJECT_0 -Windows.Win32.Foundation.WAIT_TIMEOUT -Windows.Win32.Foundation.WIN32_ERROR -Windows.Win32.Globalization.COMPARESTRING_RESULT -Windows.Win32.Globalization.CompareStringOrdinal -Windows.Win32.Globalization.CP_UTF8 -Windows.Win32.Globalization.CSTR_EQUAL -Windows.Win32.Globalization.CSTR_GREATER_THAN -Windows.Win32.Globalization.CSTR_LESS_THAN -Windows.Win32.Globalization.MB_COMPOSITE -Windows.Win32.Globalization.MB_ERR_INVALID_CHARS -Windows.Win32.Globalization.MB_PRECOMPOSED -Windows.Win32.Globalization.MB_USEGLYPHCHARS -Windows.Win32.Globalization.MULTI_BYTE_TO_WIDE_CHAR_FLAGS -Windows.Win32.Globalization.MultiByteToWideChar -Windows.Win32.Globalization.WC_ERR_INVALID_CHARS -Windows.Win32.Globalization.WideCharToMultiByte -Windows.Win32.Networking.WinSock.accept -Windows.Win32.Networking.WinSock.ADDRESS_FAMILY -Windows.Win32.Networking.WinSock.ADDRINFOA -Windows.Win32.Networking.WinSock.AF_INET -Windows.Win32.Networking.WinSock.AF_INET6 -Windows.Win32.Networking.WinSock.AF_UNIX -Windows.Win32.Networking.WinSock.AF_UNSPEC -Windows.Win32.Networking.WinSock.bind -Windows.Win32.Networking.WinSock.closesocket -Windows.Win32.Networking.WinSock.connect -Windows.Win32.Networking.WinSock.FD_SET -Windows.Win32.Networking.WinSock.FIONBIO -Windows.Win32.Networking.WinSock.freeaddrinfo -Windows.Win32.Networking.WinSock.getaddrinfo -Windows.Win32.Networking.WinSock.getpeername -Windows.Win32.Networking.WinSock.getsockname -Windows.Win32.Networking.WinSock.getsockopt -Windows.Win32.Networking.WinSock.IN6_ADDR -Windows.Win32.Networking.WinSock.IN_ADDR -Windows.Win32.Networking.WinSock.INVALID_SOCKET -Windows.Win32.Networking.WinSock.ioctlsocket -Windows.Win32.Networking.WinSock.IP_ADD_MEMBERSHIP -Windows.Win32.Networking.WinSock.IP_DROP_MEMBERSHIP -Windows.Win32.Networking.WinSock.IP_MREQ -Windows.Win32.Networking.WinSock.IP_MULTICAST_LOOP -Windows.Win32.Networking.WinSock.IP_MULTICAST_TTL -Windows.Win32.Networking.WinSock.IP_TTL -Windows.Win32.Networking.WinSock.IPPROTO -Windows.Win32.Networking.WinSock.IPPROTO_AH -Windows.Win32.Networking.WinSock.IPPROTO_CBT -Windows.Win32.Networking.WinSock.IPPROTO_DSTOPTS -Windows.Win32.Networking.WinSock.IPPROTO_EGP -Windows.Win32.Networking.WinSock.IPPROTO_ESP -Windows.Win32.Networking.WinSock.IPPROTO_FRAGMENT -Windows.Win32.Networking.WinSock.IPPROTO_GGP -Windows.Win32.Networking.WinSock.IPPROTO_HOPOPTS -Windows.Win32.Networking.WinSock.IPPROTO_ICLFXBM -Windows.Win32.Networking.WinSock.IPPROTO_ICMP -Windows.Win32.Networking.WinSock.IPPROTO_ICMPV6 -Windows.Win32.Networking.WinSock.IPPROTO_IDP -Windows.Win32.Networking.WinSock.IPPROTO_IGMP -Windows.Win32.Networking.WinSock.IPPROTO_IGP -Windows.Win32.Networking.WinSock.IPPROTO_IP -Windows.Win32.Networking.WinSock.IPPROTO_IPV4 -Windows.Win32.Networking.WinSock.IPPROTO_IPV6 -Windows.Win32.Networking.WinSock.IPPROTO_L2TP -Windows.Win32.Networking.WinSock.IPPROTO_MAX -Windows.Win32.Networking.WinSock.IPPROTO_ND -Windows.Win32.Networking.WinSock.IPPROTO_NONE -Windows.Win32.Networking.WinSock.IPPROTO_PGM -Windows.Win32.Networking.WinSock.IPPROTO_PIM -Windows.Win32.Networking.WinSock.IPPROTO_PUP -Windows.Win32.Networking.WinSock.IPPROTO_RAW -Windows.Win32.Networking.WinSock.IPPROTO_RDP -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_IPSEC -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_IPSECOFFLOAD -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_MAX -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_RAW -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_WNV -Windows.Win32.Networking.WinSock.IPPROTO_RM -Windows.Win32.Networking.WinSock.IPPROTO_ROUTING -Windows.Win32.Networking.WinSock.IPPROTO_SCTP -Windows.Win32.Networking.WinSock.IPPROTO_ST -Windows.Win32.Networking.WinSock.IPPROTO_TCP -Windows.Win32.Networking.WinSock.IPPROTO_UDP -Windows.Win32.Networking.WinSock.IPV6_ADD_MEMBERSHIP -Windows.Win32.Networking.WinSock.IPV6_DROP_MEMBERSHIP -Windows.Win32.Networking.WinSock.IPV6_MREQ -Windows.Win32.Networking.WinSock.IPV6_MULTICAST_LOOP -Windows.Win32.Networking.WinSock.IPV6_V6ONLY -Windows.Win32.Networking.WinSock.LINGER -Windows.Win32.Networking.WinSock.listen -Windows.Win32.Networking.WinSock.LPWSAOVERLAPPED_COMPLETION_ROUTINE -Windows.Win32.Networking.WinSock.MSG_DONTROUTE -Windows.Win32.Networking.WinSock.MSG_OOB -Windows.Win32.Networking.WinSock.MSG_PEEK -Windows.Win32.Networking.WinSock.MSG_PUSH_IMMEDIATE -Windows.Win32.Networking.WinSock.MSG_WAITALL -Windows.Win32.Networking.WinSock.recv -Windows.Win32.Networking.WinSock.recvfrom -Windows.Win32.Networking.WinSock.SD_BOTH -Windows.Win32.Networking.WinSock.SD_RECEIVE -Windows.Win32.Networking.WinSock.SD_SEND -Windows.Win32.Networking.WinSock.select -Windows.Win32.Networking.WinSock.send -Windows.Win32.Networking.WinSock.SEND_RECV_FLAGS -Windows.Win32.Networking.WinSock.sendto -Windows.Win32.Networking.WinSock.setsockopt -Windows.Win32.Networking.WinSock.shutdown -Windows.Win32.Networking.WinSock.SO_BROADCAST -Windows.Win32.Networking.WinSock.SO_ERROR -Windows.Win32.Networking.WinSock.SO_LINGER -Windows.Win32.Networking.WinSock.SO_RCVTIMEO -Windows.Win32.Networking.WinSock.SO_SNDTIMEO -Windows.Win32.Networking.WinSock.SOCK_DGRAM -Windows.Win32.Networking.WinSock.SOCK_RAW -Windows.Win32.Networking.WinSock.SOCK_RDM -Windows.Win32.Networking.WinSock.SOCK_SEQPACKET -Windows.Win32.Networking.WinSock.SOCK_STREAM -Windows.Win32.Networking.WinSock.SOCKADDR -Windows.Win32.Networking.WinSock.SOCKADDR_STORAGE -Windows.Win32.Networking.WinSock.SOCKADDR_UN -Windows.Win32.Networking.WinSock.SOCKET -Windows.Win32.Networking.WinSock.SOCKET_ERROR -Windows.Win32.Networking.WinSock.SOL_SOCKET -Windows.Win32.Networking.WinSock.TCP_NODELAY -Windows.Win32.Networking.WinSock.TIMEVAL -Windows.Win32.Networking.WinSock.WINSOCK_SHUTDOWN_HOW -Windows.Win32.Networking.WinSock.WINSOCK_SOCKET_TYPE -Windows.Win32.Networking.WinSock.WSA_E_CANCELLED -Windows.Win32.Networking.WinSock.WSA_E_NO_MORE -Windows.Win32.Networking.WinSock.WSA_ERROR -Windows.Win32.Networking.WinSock.WSA_FLAG_NO_HANDLE_INHERIT -Windows.Win32.Networking.WinSock.WSA_FLAG_OVERLAPPED -Windows.Win32.Networking.WinSock.WSA_INVALID_HANDLE -Windows.Win32.Networking.WinSock.WSA_INVALID_PARAMETER -Windows.Win32.Networking.WinSock.WSA_IO_INCOMPLETE -Windows.Win32.Networking.WinSock.WSA_IO_PENDING -Windows.Win32.Networking.WinSock.WSA_IPSEC_NAME_POLICY_ERROR -Windows.Win32.Networking.WinSock.WSA_NOT_ENOUGH_MEMORY -Windows.Win32.Networking.WinSock.WSA_OPERATION_ABORTED -Windows.Win32.Networking.WinSock.WSA_QOS_ADMISSION_FAILURE -Windows.Win32.Networking.WinSock.WSA_QOS_BAD_OBJECT -Windows.Win32.Networking.WinSock.WSA_QOS_BAD_STYLE -Windows.Win32.Networking.WinSock.WSA_QOS_EFILTERCOUNT -Windows.Win32.Networking.WinSock.WSA_QOS_EFILTERSTYLE -Windows.Win32.Networking.WinSock.WSA_QOS_EFILTERTYPE -Windows.Win32.Networking.WinSock.WSA_QOS_EFLOWCOUNT -Windows.Win32.Networking.WinSock.WSA_QOS_EFLOWDESC -Windows.Win32.Networking.WinSock.WSA_QOS_EFLOWSPEC -Windows.Win32.Networking.WinSock.WSA_QOS_EOBJLENGTH -Windows.Win32.Networking.WinSock.WSA_QOS_EPOLICYOBJ -Windows.Win32.Networking.WinSock.WSA_QOS_EPROVSPECBUF -Windows.Win32.Networking.WinSock.WSA_QOS_EPSFILTERSPEC -Windows.Win32.Networking.WinSock.WSA_QOS_EPSFLOWSPEC -Windows.Win32.Networking.WinSock.WSA_QOS_ESDMODEOBJ -Windows.Win32.Networking.WinSock.WSA_QOS_ESERVICETYPE -Windows.Win32.Networking.WinSock.WSA_QOS_ESHAPERATEOBJ -Windows.Win32.Networking.WinSock.WSA_QOS_EUNKOWNPSOBJ -Windows.Win32.Networking.WinSock.WSA_QOS_GENERIC_ERROR -Windows.Win32.Networking.WinSock.WSA_QOS_NO_RECEIVERS -Windows.Win32.Networking.WinSock.WSA_QOS_NO_SENDERS -Windows.Win32.Networking.WinSock.WSA_QOS_POLICY_FAILURE -Windows.Win32.Networking.WinSock.WSA_QOS_RECEIVERS -Windows.Win32.Networking.WinSock.WSA_QOS_REQUEST_CONFIRMED -Windows.Win32.Networking.WinSock.WSA_QOS_RESERVED_PETYPE -Windows.Win32.Networking.WinSock.WSA_QOS_SENDERS -Windows.Win32.Networking.WinSock.WSA_QOS_TRAFFIC_CTRL_ERROR -Windows.Win32.Networking.WinSock.WSA_SECURE_HOST_NOT_FOUND -Windows.Win32.Networking.WinSock.WSA_WAIT_EVENT_0 -Windows.Win32.Networking.WinSock.WSA_WAIT_IO_COMPLETION -Windows.Win32.Networking.WinSock.WSABASEERR -Windows.Win32.Networking.WinSock.WSABUF -Windows.Win32.Networking.WinSock.WSACleanup -Windows.Win32.Networking.WinSock.WSADATA -Windows.Win32.Networking.WinSock.WSADuplicateSocketW -Windows.Win32.Networking.WinSock.WSAEACCES -Windows.Win32.Networking.WinSock.WSAEADDRINUSE -Windows.Win32.Networking.WinSock.WSAEADDRNOTAVAIL -Windows.Win32.Networking.WinSock.WSAEAFNOSUPPORT -Windows.Win32.Networking.WinSock.WSAEALREADY -Windows.Win32.Networking.WinSock.WSAEBADF -Windows.Win32.Networking.WinSock.WSAECANCELLED -Windows.Win32.Networking.WinSock.WSAECONNABORTED -Windows.Win32.Networking.WinSock.WSAECONNREFUSED -Windows.Win32.Networking.WinSock.WSAECONNRESET -Windows.Win32.Networking.WinSock.WSAEDESTADDRREQ -Windows.Win32.Networking.WinSock.WSAEDISCON -Windows.Win32.Networking.WinSock.WSAEDQUOT -Windows.Win32.Networking.WinSock.WSAEFAULT -Windows.Win32.Networking.WinSock.WSAEHOSTDOWN -Windows.Win32.Networking.WinSock.WSAEHOSTUNREACH -Windows.Win32.Networking.WinSock.WSAEINPROGRESS -Windows.Win32.Networking.WinSock.WSAEINTR -Windows.Win32.Networking.WinSock.WSAEINVAL -Windows.Win32.Networking.WinSock.WSAEINVALIDPROCTABLE -Windows.Win32.Networking.WinSock.WSAEINVALIDPROVIDER -Windows.Win32.Networking.WinSock.WSAEISCONN -Windows.Win32.Networking.WinSock.WSAELOOP -Windows.Win32.Networking.WinSock.WSAEMFILE -Windows.Win32.Networking.WinSock.WSAEMSGSIZE -Windows.Win32.Networking.WinSock.WSAENAMETOOLONG -Windows.Win32.Networking.WinSock.WSAENETDOWN -Windows.Win32.Networking.WinSock.WSAENETRESET -Windows.Win32.Networking.WinSock.WSAENETUNREACH -Windows.Win32.Networking.WinSock.WSAENOBUFS -Windows.Win32.Networking.WinSock.WSAENOMORE -Windows.Win32.Networking.WinSock.WSAENOPROTOOPT -Windows.Win32.Networking.WinSock.WSAENOTCONN -Windows.Win32.Networking.WinSock.WSAENOTEMPTY -Windows.Win32.Networking.WinSock.WSAENOTSOCK -Windows.Win32.Networking.WinSock.WSAEOPNOTSUPP -Windows.Win32.Networking.WinSock.WSAEPFNOSUPPORT -Windows.Win32.Networking.WinSock.WSAEPROCLIM -Windows.Win32.Networking.WinSock.WSAEPROTONOSUPPORT -Windows.Win32.Networking.WinSock.WSAEPROTOTYPE -Windows.Win32.Networking.WinSock.WSAEPROVIDERFAILEDINIT -Windows.Win32.Networking.WinSock.WSAEREFUSED -Windows.Win32.Networking.WinSock.WSAEREMOTE -Windows.Win32.Networking.WinSock.WSAESHUTDOWN -Windows.Win32.Networking.WinSock.WSAESOCKTNOSUPPORT -Windows.Win32.Networking.WinSock.WSAESTALE -Windows.Win32.Networking.WinSock.WSAETIMEDOUT -Windows.Win32.Networking.WinSock.WSAETOOMANYREFS -Windows.Win32.Networking.WinSock.WSAEUSERS -Windows.Win32.Networking.WinSock.WSAEWOULDBLOCK -Windows.Win32.Networking.WinSock.WSAGetLastError -Windows.Win32.Networking.WinSock.WSAHOST_NOT_FOUND -Windows.Win32.Networking.WinSock.WSANO_DATA -Windows.Win32.Networking.WinSock.WSANO_RECOVERY -Windows.Win32.Networking.WinSock.WSANOTINITIALISED -Windows.Win32.Networking.WinSock.WSAPROTOCOL_INFOW -Windows.Win32.Networking.WinSock.WSAPROTOCOLCHAIN -Windows.Win32.Networking.WinSock.WSARecv -Windows.Win32.Networking.WinSock.WSASend -Windows.Win32.Networking.WinSock.WSASERVICE_NOT_FOUND -Windows.Win32.Networking.WinSock.WSASocketW -Windows.Win32.Networking.WinSock.WSAStartup -Windows.Win32.Networking.WinSock.WSASYSCALLFAILURE -Windows.Win32.Networking.WinSock.WSASYSNOTREADY -Windows.Win32.Networking.WinSock.WSATRY_AGAIN -Windows.Win32.Networking.WinSock.WSATYPE_NOT_FOUND -Windows.Win32.Networking.WinSock.WSAVERNOTSUPPORTED -Windows.Win32.Security.Authentication.Identity.RtlGenRandom -Windows.Win32.Security.SECURITY_ATTRIBUTES -Windows.Win32.Security.TOKEN_ACCESS_MASK -Windows.Win32.Security.TOKEN_ACCESS_PSEUDO_HANDLE -Windows.Win32.Security.TOKEN_ACCESS_PSEUDO_HANDLE_WIN8 -Windows.Win32.Security.TOKEN_ACCESS_SYSTEM_SECURITY -Windows.Win32.Security.TOKEN_ADJUST_DEFAULT -Windows.Win32.Security.TOKEN_ADJUST_GROUPS -Windows.Win32.Security.TOKEN_ADJUST_PRIVILEGES -Windows.Win32.Security.TOKEN_ADJUST_SESSIONID -Windows.Win32.Security.TOKEN_ALL_ACCESS -Windows.Win32.Security.TOKEN_ASSIGN_PRIMARY -Windows.Win32.Security.TOKEN_DELETE -Windows.Win32.Security.TOKEN_DUPLICATE -Windows.Win32.Security.TOKEN_EXECUTE -Windows.Win32.Security.TOKEN_IMPERSONATE -Windows.Win32.Security.TOKEN_QUERY -Windows.Win32.Security.TOKEN_QUERY_SOURCE -Windows.Win32.Security.TOKEN_READ -Windows.Win32.Security.TOKEN_READ_CONTROL -Windows.Win32.Security.TOKEN_TRUST_CONSTRAINT_MASK -Windows.Win32.Security.TOKEN_WRITE -Windows.Win32.Security.TOKEN_WRITE_DAC -Windows.Win32.Security.TOKEN_WRITE_OWNER -Windows.Win32.Storage.FileSystem.BY_HANDLE_FILE_INFORMATION -Windows.Win32.Storage.FileSystem.CALLBACK_CHUNK_FINISHED -Windows.Win32.Storage.FileSystem.CALLBACK_STREAM_SWITCH -Windows.Win32.Storage.FileSystem.CopyFileExW -Windows.Win32.Storage.FileSystem.CREATE_ALWAYS -Windows.Win32.Storage.FileSystem.CREATE_NEW -Windows.Win32.Storage.FileSystem.CreateDirectoryW -Windows.Win32.Storage.FileSystem.CreateFileW -Windows.Win32.Storage.FileSystem.CreateHardLinkW -Windows.Win32.Storage.FileSystem.CreateSymbolicLinkW -Windows.Win32.Storage.FileSystem.DELETE -Windows.Win32.Storage.FileSystem.DeleteFileW -Windows.Win32.Storage.FileSystem.FILE_ACCESS_RIGHTS -Windows.Win32.Storage.FileSystem.FILE_ADD_FILE -Windows.Win32.Storage.FileSystem.FILE_ADD_SUBDIRECTORY -Windows.Win32.Storage.FileSystem.FILE_ALL_ACCESS -Windows.Win32.Storage.FileSystem.FILE_ALLOCATION_INFO -Windows.Win32.Storage.FileSystem.FILE_APPEND_DATA -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_ARCHIVE -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_COMPRESSED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_DEVICE -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_DIRECTORY -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_EA -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_ENCRYPTED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_HIDDEN -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_INTEGRITY_STREAM -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NO_SCRUB_DATA -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NORMAL -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_OFFLINE -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_PINNED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_READONLY -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_RECALL_ON_OPEN -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_REPARSE_POINT -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_SPARSE_FILE -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_SYSTEM -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_TAG_INFO -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_TEMPORARY -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_UNPINNED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_VIRTUAL -Windows.Win32.Storage.FileSystem.FILE_BASIC_INFO -Windows.Win32.Storage.FileSystem.FILE_BEGIN -Windows.Win32.Storage.FileSystem.FILE_CREATE_PIPE_INSTANCE -Windows.Win32.Storage.FileSystem.FILE_CREATION_DISPOSITION -Windows.Win32.Storage.FileSystem.FILE_CURRENT -Windows.Win32.Storage.FileSystem.FILE_DELETE_CHILD -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_DELETE -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_DO_NOT_DELETE -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_FORCE_IMAGE_SECTION_CHECK -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_ON_CLOSE -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_POSIX_SEMANTICS -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_INFO -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_INFO_EX -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_INFO_EX_FLAGS -Windows.Win32.Storage.FileSystem.FILE_END -Windows.Win32.Storage.FileSystem.FILE_END_OF_FILE_INFO -Windows.Win32.Storage.FileSystem.FILE_EXECUTE -Windows.Win32.Storage.FileSystem.FILE_FLAG_BACKUP_SEMANTICS -Windows.Win32.Storage.FileSystem.FILE_FLAG_DELETE_ON_CLOSE -Windows.Win32.Storage.FileSystem.FILE_FLAG_FIRST_PIPE_INSTANCE -Windows.Win32.Storage.FileSystem.FILE_FLAG_NO_BUFFERING -Windows.Win32.Storage.FileSystem.FILE_FLAG_OPEN_NO_RECALL -Windows.Win32.Storage.FileSystem.FILE_FLAG_OPEN_REPARSE_POINT -Windows.Win32.Storage.FileSystem.FILE_FLAG_OVERLAPPED -Windows.Win32.Storage.FileSystem.FILE_FLAG_POSIX_SEMANTICS -Windows.Win32.Storage.FileSystem.FILE_FLAG_RANDOM_ACCESS -Windows.Win32.Storage.FileSystem.FILE_FLAG_SEQUENTIAL_SCAN -Windows.Win32.Storage.FileSystem.FILE_FLAG_SESSION_AWARE -Windows.Win32.Storage.FileSystem.FILE_FLAG_WRITE_THROUGH -Windows.Win32.Storage.FileSystem.FILE_FLAGS_AND_ATTRIBUTES -Windows.Win32.Storage.FileSystem.FILE_GENERIC_EXECUTE -Windows.Win32.Storage.FileSystem.FILE_GENERIC_READ -Windows.Win32.Storage.FileSystem.FILE_GENERIC_WRITE -Windows.Win32.Storage.FileSystem.FILE_ID_BOTH_DIR_INFO -Windows.Win32.Storage.FileSystem.FILE_INFO_BY_HANDLE_CLASS -Windows.Win32.Storage.FileSystem.FILE_IO_PRIORITY_HINT_INFO -Windows.Win32.Storage.FileSystem.FILE_LIST_DIRECTORY -Windows.Win32.Storage.FileSystem.FILE_NAME_NORMALIZED -Windows.Win32.Storage.FileSystem.FILE_NAME_OPENED -Windows.Win32.Storage.FileSystem.FILE_READ_ATTRIBUTES -Windows.Win32.Storage.FileSystem.FILE_READ_DATA -Windows.Win32.Storage.FileSystem.FILE_READ_EA -Windows.Win32.Storage.FileSystem.FILE_RENAME_INFO -Windows.Win32.Storage.FileSystem.FILE_SHARE_DELETE -Windows.Win32.Storage.FileSystem.FILE_SHARE_MODE -Windows.Win32.Storage.FileSystem.FILE_SHARE_NONE -Windows.Win32.Storage.FileSystem.FILE_SHARE_READ -Windows.Win32.Storage.FileSystem.FILE_SHARE_WRITE -Windows.Win32.Storage.FileSystem.FILE_STANDARD_INFO -Windows.Win32.Storage.FileSystem.FILE_TRAVERSE -Windows.Win32.Storage.FileSystem.FILE_TYPE -Windows.Win32.Storage.FileSystem.FILE_TYPE_CHAR -Windows.Win32.Storage.FileSystem.FILE_TYPE_DISK -Windows.Win32.Storage.FileSystem.FILE_TYPE_PIPE -Windows.Win32.Storage.FileSystem.FILE_TYPE_REMOTE -Windows.Win32.Storage.FileSystem.FILE_TYPE_UNKNOWN -Windows.Win32.Storage.FileSystem.FILE_WRITE_ATTRIBUTES -Windows.Win32.Storage.FileSystem.FILE_WRITE_DATA -Windows.Win32.Storage.FileSystem.FILE_WRITE_EA -Windows.Win32.Storage.FileSystem.FileAlignmentInfo -Windows.Win32.Storage.FileSystem.FileAllocationInfo -Windows.Win32.Storage.FileSystem.FileAttributeTagInfo -Windows.Win32.Storage.FileSystem.FileBasicInfo -Windows.Win32.Storage.FileSystem.FileCaseSensitiveInfo -Windows.Win32.Storage.FileSystem.FileCompressionInfo -Windows.Win32.Storage.FileSystem.FileDispositionInfo -Windows.Win32.Storage.FileSystem.FileDispositionInfoEx -Windows.Win32.Storage.FileSystem.FileEndOfFileInfo -Windows.Win32.Storage.FileSystem.FileFullDirectoryInfo -Windows.Win32.Storage.FileSystem.FileFullDirectoryRestartInfo -Windows.Win32.Storage.FileSystem.FileIdBothDirectoryInfo -Windows.Win32.Storage.FileSystem.FileIdBothDirectoryRestartInfo -Windows.Win32.Storage.FileSystem.FileIdExtdDirectoryInfo -Windows.Win32.Storage.FileSystem.FileIdExtdDirectoryRestartInfo -Windows.Win32.Storage.FileSystem.FileIdInfo -Windows.Win32.Storage.FileSystem.FileIoPriorityHintInfo -Windows.Win32.Storage.FileSystem.FileNameInfo -Windows.Win32.Storage.FileSystem.FileNormalizedNameInfo -Windows.Win32.Storage.FileSystem.FileRemoteProtocolInfo -Windows.Win32.Storage.FileSystem.FileRenameInfo -Windows.Win32.Storage.FileSystem.FileRenameInfoEx -Windows.Win32.Storage.FileSystem.FileStandardInfo -Windows.Win32.Storage.FileSystem.FileStorageInfo -Windows.Win32.Storage.FileSystem.FileStreamInfo -Windows.Win32.Storage.FileSystem.FindClose -Windows.Win32.Storage.FileSystem.FindExInfoBasic -Windows.Win32.Storage.FileSystem.FindExSearchNameMatch -Windows.Win32.Storage.FileSystem.FindFirstFileExW -Windows.Win32.Storage.FileSystem.FindNextFileW -Windows.Win32.Storage.FileSystem.FlushFileBuffers -Windows.Win32.Storage.FileSystem.GetFileAttributesW -Windows.Win32.Storage.FileSystem.GetFileInformationByHandle -Windows.Win32.Storage.FileSystem.GetFileInformationByHandleEx -Windows.Win32.Storage.FileSystem.GetFileType -Windows.Win32.Storage.FileSystem.GETFINALPATHNAMEBYHANDLE_FLAGS -Windows.Win32.Storage.FileSystem.GetFinalPathNameByHandleW -Windows.Win32.Storage.FileSystem.GetFullPathNameW -Windows.Win32.Storage.FileSystem.GetTempPathW -Windows.Win32.Storage.FileSystem.INVALID_FILE_ATTRIBUTES -Windows.Win32.Storage.FileSystem.LOCKFILE_EXCLUSIVE_LOCK -Windows.Win32.Storage.FileSystem.LOCKFILE_FAIL_IMMEDIATELY -Windows.Win32.Storage.FileSystem.LockFileEx -Windows.Win32.Storage.FileSystem.LPPROGRESS_ROUTINE -Windows.Win32.Storage.FileSystem.LPPROGRESS_ROUTINE_CALLBACK_REASON -Windows.Win32.Storage.FileSystem.MAXIMUM_REPARSE_DATA_BUFFER_SIZE -Windows.Win32.Storage.FileSystem.MaximumFileInfoByHandleClass -Windows.Win32.Storage.FileSystem.MOVE_FILE_FLAGS -Windows.Win32.Storage.FileSystem.MOVEFILE_COPY_ALLOWED -Windows.Win32.Storage.FileSystem.MOVEFILE_CREATE_HARDLINK -Windows.Win32.Storage.FileSystem.MOVEFILE_DELAY_UNTIL_REBOOT -Windows.Win32.Storage.FileSystem.MOVEFILE_FAIL_IF_NOT_TRACKABLE -Windows.Win32.Storage.FileSystem.MOVEFILE_REPLACE_EXISTING -Windows.Win32.Storage.FileSystem.MOVEFILE_WRITE_THROUGH -Windows.Win32.Storage.FileSystem.MoveFileExW -Windows.Win32.Storage.FileSystem.OPEN_ALWAYS -Windows.Win32.Storage.FileSystem.OPEN_EXISTING -Windows.Win32.Storage.FileSystem.PIPE_ACCESS_DUPLEX -Windows.Win32.Storage.FileSystem.PIPE_ACCESS_INBOUND -Windows.Win32.Storage.FileSystem.PIPE_ACCESS_OUTBOUND -Windows.Win32.Storage.FileSystem.READ_CONTROL -Windows.Win32.Storage.FileSystem.ReadFile -Windows.Win32.Storage.FileSystem.ReadFileEx -Windows.Win32.Storage.FileSystem.RemoveDirectoryW -Windows.Win32.Storage.FileSystem.SECURITY_ANONYMOUS -Windows.Win32.Storage.FileSystem.SECURITY_CONTEXT_TRACKING -Windows.Win32.Storage.FileSystem.SECURITY_DELEGATION -Windows.Win32.Storage.FileSystem.SECURITY_EFFECTIVE_ONLY -Windows.Win32.Storage.FileSystem.SECURITY_IDENTIFICATION -Windows.Win32.Storage.FileSystem.SECURITY_IMPERSONATION -Windows.Win32.Storage.FileSystem.SECURITY_SQOS_PRESENT -Windows.Win32.Storage.FileSystem.SECURITY_VALID_SQOS_FLAGS -Windows.Win32.Storage.FileSystem.SET_FILE_POINTER_MOVE_METHOD -Windows.Win32.Storage.FileSystem.SetFileAttributesW -Windows.Win32.Storage.FileSystem.SetFileInformationByHandle -Windows.Win32.Storage.FileSystem.SetFilePointerEx -Windows.Win32.Storage.FileSystem.SetFileTime -Windows.Win32.Storage.FileSystem.SPECIFIC_RIGHTS_ALL -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_ALL -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_EXECUTE -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_READ -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_REQUIRED -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_WRITE -Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE -Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAG_DIRECTORY -Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAGS -Windows.Win32.Storage.FileSystem.SYNCHRONIZE -Windows.Win32.Storage.FileSystem.TRUNCATE_EXISTING -Windows.Win32.Storage.FileSystem.UnlockFile -Windows.Win32.Storage.FileSystem.VOLUME_NAME_DOS -Windows.Win32.Storage.FileSystem.VOLUME_NAME_GUID -Windows.Win32.Storage.FileSystem.VOLUME_NAME_NONE -Windows.Win32.Storage.FileSystem.WIN32_FIND_DATAW -Windows.Win32.Storage.FileSystem.WRITE_DAC -Windows.Win32.Storage.FileSystem.WRITE_OWNER -Windows.Win32.Storage.FileSystem.WriteFileEx -Windows.Win32.System.Console.CONSOLE_MODE -Windows.Win32.System.Console.CONSOLE_READCONSOLE_CONTROL -Windows.Win32.System.Console.DISABLE_NEWLINE_AUTO_RETURN -Windows.Win32.System.Console.ENABLE_AUTO_POSITION -Windows.Win32.System.Console.ENABLE_ECHO_INPUT -Windows.Win32.System.Console.ENABLE_EXTENDED_FLAGS -Windows.Win32.System.Console.ENABLE_INSERT_MODE -Windows.Win32.System.Console.ENABLE_LINE_INPUT -Windows.Win32.System.Console.ENABLE_LVB_GRID_WORLDWIDE -Windows.Win32.System.Console.ENABLE_MOUSE_INPUT -Windows.Win32.System.Console.ENABLE_PROCESSED_INPUT -Windows.Win32.System.Console.ENABLE_PROCESSED_OUTPUT -Windows.Win32.System.Console.ENABLE_QUICK_EDIT_MODE -Windows.Win32.System.Console.ENABLE_VIRTUAL_TERMINAL_INPUT -Windows.Win32.System.Console.ENABLE_VIRTUAL_TERMINAL_PROCESSING -Windows.Win32.System.Console.ENABLE_WINDOW_INPUT -Windows.Win32.System.Console.ENABLE_WRAP_AT_EOL_OUTPUT -Windows.Win32.System.Console.GetConsoleMode -Windows.Win32.System.Console.GetConsoleOutputCP -Windows.Win32.System.Console.GetStdHandle -Windows.Win32.System.Console.ReadConsoleW -Windows.Win32.System.Console.STD_ERROR_HANDLE -Windows.Win32.System.Console.STD_HANDLE -Windows.Win32.System.Console.STD_INPUT_HANDLE -Windows.Win32.System.Console.STD_OUTPUT_HANDLE -Windows.Win32.System.Console.WriteConsoleW -Windows.Win32.System.Diagnostics.Debug.AddVectoredExceptionHandler -Windows.Win32.System.Diagnostics.Debug.ARM64_NT_NEON128 -Windows.Win32.System.Diagnostics.Debug.CONTEXT -Windows.Win32.System.Diagnostics.Debug.EXCEPTION_RECORD -Windows.Win32.System.Diagnostics.Debug.FACILITY_CODE -Windows.Win32.System.Diagnostics.Debug.FACILITY_NT_BIT -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_ALLOCATE_BUFFER -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_ARGUMENT_ARRAY -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_FROM_HMODULE -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_FROM_STRING -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_FROM_SYSTEM -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_IGNORE_INSERTS -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_OPTIONS -Windows.Win32.System.Diagnostics.Debug.FormatMessageW -Windows.Win32.System.Diagnostics.Debug.M128A Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT -Windows.Win32.System.Environment.FreeEnvironmentStringsW -Windows.Win32.System.Environment.GetCommandLineW -Windows.Win32.System.Environment.GetCurrentDirectoryW -Windows.Win32.System.Environment.GetEnvironmentStringsW -Windows.Win32.System.Environment.GetEnvironmentVariableW -Windows.Win32.System.Environment.SetCurrentDirectoryW -Windows.Win32.System.Environment.SetEnvironmentVariableW -Windows.Win32.System.IO.CancelIo -Windows.Win32.System.IO.DeviceIoControl -Windows.Win32.System.IO.GetOverlappedResult -Windows.Win32.System.IO.LPOVERLAPPED_COMPLETION_ROUTINE -Windows.Win32.System.IO.OVERLAPPED -Windows.Win32.System.Ioctl.FSCTL_GET_REPARSE_POINT -Windows.Win32.System.Ioctl.FSCTL_SET_REPARSE_POINT -Windows.Win32.System.Kernel.EXCEPTION_DISPOSITION -Windows.Win32.System.Kernel.ExceptionCollidedUnwind -Windows.Win32.System.Kernel.ExceptionContinueExecution -Windows.Win32.System.Kernel.ExceptionContinueSearch -Windows.Win32.System.Kernel.ExceptionNestedException Windows.Win32.System.Kernel.FLOATING_SAVE_AREA -Windows.Win32.System.Kernel.OBJ_DONT_REPARSE -Windows.Win32.System.LibraryLoader.GetModuleFileNameW -Windows.Win32.System.LibraryLoader.GetModuleHandleA -Windows.Win32.System.LibraryLoader.GetModuleHandleW -Windows.Win32.System.LibraryLoader.GetProcAddress -Windows.Win32.System.Performance.QueryPerformanceCounter -Windows.Win32.System.Performance.QueryPerformanceFrequency -Windows.Win32.System.Pipes.CreateNamedPipeW -Windows.Win32.System.Pipes.CreatePipe -Windows.Win32.System.Pipes.NAMED_PIPE_MODE -Windows.Win32.System.Pipes.PIPE_ACCEPT_REMOTE_CLIENTS -Windows.Win32.System.Pipes.PIPE_CLIENT_END -Windows.Win32.System.Pipes.PIPE_NOWAIT -Windows.Win32.System.Pipes.PIPE_READMODE_BYTE -Windows.Win32.System.Pipes.PIPE_READMODE_MESSAGE -Windows.Win32.System.Pipes.PIPE_REJECT_REMOTE_CLIENTS -Windows.Win32.System.Pipes.PIPE_SERVER_END -Windows.Win32.System.Pipes.PIPE_TYPE_BYTE -Windows.Win32.System.Pipes.PIPE_TYPE_MESSAGE -Windows.Win32.System.Pipes.PIPE_WAIT -Windows.Win32.System.SystemInformation.GetSystemDirectoryW -Windows.Win32.System.SystemInformation.GetSystemInfo -Windows.Win32.System.SystemInformation.GetSystemTimeAsFileTime -Windows.Win32.System.SystemInformation.GetSystemTimePreciseAsFileTime -Windows.Win32.System.SystemInformation.GetWindowsDirectoryW -Windows.Win32.System.SystemInformation.PROCESSOR_ARCHITECTURE -Windows.Win32.System.SystemInformation.SYSTEM_INFO -Windows.Win32.System.SystemServices.DLL_PROCESS_DETACH -Windows.Win32.System.SystemServices.DLL_THREAD_DETACH -Windows.Win32.System.SystemServices.EXCEPTION_MAXIMUM_PARAMETERS -Windows.Win32.System.SystemServices.FAST_FAIL_FATAL_APP_EXIT -Windows.Win32.System.SystemServices.IO_REPARSE_TAG_MOUNT_POINT -Windows.Win32.System.SystemServices.IO_REPARSE_TAG_SYMLINK -Windows.Win32.System.Threading.ABOVE_NORMAL_PRIORITY_CLASS -Windows.Win32.System.Threading.AcquireSRWLockExclusive -Windows.Win32.System.Threading.AcquireSRWLockShared -Windows.Win32.System.Threading.ALL_PROCESSOR_GROUPS -Windows.Win32.System.Threading.BELOW_NORMAL_PRIORITY_CLASS -Windows.Win32.System.Threading.CREATE_BREAKAWAY_FROM_JOB -Windows.Win32.System.Threading.CREATE_DEFAULT_ERROR_MODE -Windows.Win32.System.Threading.CREATE_FORCEDOS -Windows.Win32.System.Threading.CREATE_IGNORE_SYSTEM_DEFAULT -Windows.Win32.System.Threading.CREATE_NEW_CONSOLE -Windows.Win32.System.Threading.CREATE_NEW_PROCESS_GROUP -Windows.Win32.System.Threading.CREATE_NO_WINDOW -Windows.Win32.System.Threading.CREATE_PRESERVE_CODE_AUTHZ_LEVEL -Windows.Win32.System.Threading.CREATE_PROTECTED_PROCESS -Windows.Win32.System.Threading.CREATE_SECURE_PROCESS -Windows.Win32.System.Threading.CREATE_SEPARATE_WOW_VDM -Windows.Win32.System.Threading.CREATE_SHARED_WOW_VDM -Windows.Win32.System.Threading.CREATE_SUSPENDED -Windows.Win32.System.Threading.CREATE_UNICODE_ENVIRONMENT -Windows.Win32.System.Threading.CREATE_WAITABLE_TIMER_HIGH_RESOLUTION -Windows.Win32.System.Threading.CREATE_WAITABLE_TIMER_MANUAL_RESET -Windows.Win32.System.Threading.CreateEventW -Windows.Win32.System.Threading.CreateProcessW -Windows.Win32.System.Threading.CreateThread -Windows.Win32.System.Threading.CreateWaitableTimerExW -Windows.Win32.System.Threading.DEBUG_ONLY_THIS_PROCESS -Windows.Win32.System.Threading.DEBUG_PROCESS -Windows.Win32.System.Threading.DeleteProcThreadAttributeList -Windows.Win32.System.Threading.DETACHED_PROCESS -Windows.Win32.System.Threading.ExitProcess -Windows.Win32.System.Threading.EXTENDED_STARTUPINFO_PRESENT -Windows.Win32.System.Threading.GetActiveProcessorCount -Windows.Win32.System.Threading.GetCurrentProcess -Windows.Win32.System.Threading.GetCurrentProcessId -Windows.Win32.System.Threading.GetCurrentThread -Windows.Win32.System.Threading.GetExitCodeProcess -Windows.Win32.System.Threading.GetProcessId -Windows.Win32.System.Threading.HIGH_PRIORITY_CLASS -Windows.Win32.System.Threading.IDLE_PRIORITY_CLASS -Windows.Win32.System.Threading.INFINITE -Windows.Win32.System.Threading.INHERIT_CALLER_PRIORITY -Windows.Win32.System.Threading.INHERIT_PARENT_AFFINITY -Windows.Win32.System.Threading.INIT_ONCE_INIT_FAILED -Windows.Win32.System.Threading.InitializeProcThreadAttributeList -Windows.Win32.System.Threading.InitOnceBeginInitialize -Windows.Win32.System.Threading.InitOnceComplete -Windows.Win32.System.Threading.LPPROC_THREAD_ATTRIBUTE_LIST -Windows.Win32.System.Threading.LPTHREAD_START_ROUTINE -Windows.Win32.System.Threading.NORMAL_PRIORITY_CLASS -Windows.Win32.System.Threading.OpenProcessToken -Windows.Win32.System.Threading.PROCESS_CREATION_FLAGS -Windows.Win32.System.Threading.PROCESS_INFORMATION -Windows.Win32.System.Threading.PROCESS_MODE_BACKGROUND_BEGIN -Windows.Win32.System.Threading.PROCESS_MODE_BACKGROUND_END -Windows.Win32.System.Threading.PROFILE_KERNEL -Windows.Win32.System.Threading.PROFILE_SERVER -Windows.Win32.System.Threading.PROFILE_USER -Windows.Win32.System.Threading.REALTIME_PRIORITY_CLASS -Windows.Win32.System.Threading.ReleaseSRWLockExclusive -Windows.Win32.System.Threading.ReleaseSRWLockShared -Windows.Win32.System.Threading.SetThreadStackGuarantee -Windows.Win32.System.Threading.SetWaitableTimer -Windows.Win32.System.Threading.Sleep -Windows.Win32.System.Threading.SleepConditionVariableSRW -Windows.Win32.System.Threading.SleepEx -Windows.Win32.System.Threading.STACK_SIZE_PARAM_IS_A_RESERVATION -Windows.Win32.System.Threading.STARTF_FORCEOFFFEEDBACK -Windows.Win32.System.Threading.STARTF_FORCEONFEEDBACK -Windows.Win32.System.Threading.STARTF_PREVENTPINNING -Windows.Win32.System.Threading.STARTF_RUNFULLSCREEN -Windows.Win32.System.Threading.STARTF_TITLEISAPPID -Windows.Win32.System.Threading.STARTF_TITLEISLINKNAME -Windows.Win32.System.Threading.STARTF_UNTRUSTEDSOURCE -Windows.Win32.System.Threading.STARTF_USECOUNTCHARS -Windows.Win32.System.Threading.STARTF_USEFILLATTRIBUTE -Windows.Win32.System.Threading.STARTF_USEHOTKEY -Windows.Win32.System.Threading.STARTF_USEPOSITION -Windows.Win32.System.Threading.STARTF_USESHOWWINDOW -Windows.Win32.System.Threading.STARTF_USESIZE -Windows.Win32.System.Threading.STARTF_USESTDHANDLES -Windows.Win32.System.Threading.STARTUPINFOEXW -Windows.Win32.System.Threading.STARTUPINFOW -Windows.Win32.System.Threading.STARTUPINFOW_FLAGS -Windows.Win32.System.Threading.SwitchToThread -Windows.Win32.System.Threading.TerminateProcess -Windows.Win32.System.Threading.THREAD_CREATE_RUN_IMMEDIATELY -Windows.Win32.System.Threading.THREAD_CREATE_SUSPENDED -Windows.Win32.System.Threading.THREAD_CREATION_FLAGS -Windows.Win32.System.Threading.TIMER_ALL_ACCESS -Windows.Win32.System.Threading.TIMER_MODIFY_STATE -Windows.Win32.System.Threading.TLS_OUT_OF_INDEXES -Windows.Win32.System.Threading.TlsAlloc -Windows.Win32.System.Threading.TlsFree -Windows.Win32.System.Threading.TlsGetValue -Windows.Win32.System.Threading.TlsSetValue -Windows.Win32.System.Threading.TryAcquireSRWLockExclusive -Windows.Win32.System.Threading.TryAcquireSRWLockShared -Windows.Win32.System.Threading.UpdateProcThreadAttribute -Windows.Win32.System.Threading.WaitForMultipleObjects -Windows.Win32.System.Threading.WaitForSingleObject -Windows.Win32.System.Threading.WakeAllConditionVariable -Windows.Win32.System.Threading.WakeConditionVariable -Windows.Win32.System.WindowsProgramming.FILE_RENAME_FLAG_POSIX_SEMANTICS -Windows.Win32.System.WindowsProgramming.FILE_RENAME_FLAG_REPLACE_IF_EXISTS -Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE -Windows.Win32.UI.Shell.GetUserProfileDirectoryW +WINSOCK_SHUTDOWN_HOW +WINSOCK_SOCKET_TYPE +WRITE_DAC +WRITE_OWNER +WriteConsoleW +WriteFileEx +WSA_E_CANCELLED +WSA_E_NO_MORE +WSA_ERROR +WSA_FLAG_NO_HANDLE_INHERIT +WSA_FLAG_OVERLAPPED +WSA_INVALID_HANDLE +WSA_INVALID_PARAMETER +WSA_IO_INCOMPLETE +WSA_IO_PENDING +WSA_IPSEC_NAME_POLICY_ERROR +WSA_NOT_ENOUGH_MEMORY +WSA_OPERATION_ABORTED +WSA_QOS_ADMISSION_FAILURE +WSA_QOS_BAD_OBJECT +WSA_QOS_BAD_STYLE +WSA_QOS_EFILTERCOUNT +WSA_QOS_EFILTERSTYLE +WSA_QOS_EFILTERTYPE +WSA_QOS_EFLOWCOUNT +WSA_QOS_EFLOWDESC +WSA_QOS_EFLOWSPEC +WSA_QOS_EOBJLENGTH +WSA_QOS_EPOLICYOBJ +WSA_QOS_EPROVSPECBUF +WSA_QOS_EPSFILTERSPEC +WSA_QOS_EPSFLOWSPEC +WSA_QOS_ESDMODEOBJ +WSA_QOS_ESERVICETYPE +WSA_QOS_ESHAPERATEOBJ +WSA_QOS_EUNKOWNPSOBJ +WSA_QOS_GENERIC_ERROR +WSA_QOS_NO_RECEIVERS +WSA_QOS_NO_SENDERS +WSA_QOS_POLICY_FAILURE +WSA_QOS_RECEIVERS +WSA_QOS_REQUEST_CONFIRMED +WSA_QOS_RESERVED_PETYPE +WSA_QOS_SENDERS +WSA_QOS_TRAFFIC_CTRL_ERROR +WSA_SECURE_HOST_NOT_FOUND +WSA_WAIT_EVENT_0 +WSA_WAIT_IO_COMPLETION +WSABASEERR +WSABUF +WSACleanup +WSADATA +WSADuplicateSocketW +WSAEACCES +WSAEADDRINUSE +WSAEADDRNOTAVAIL +WSAEAFNOSUPPORT +WSAEALREADY +WSAEBADF +WSAECANCELLED +WSAECONNABORTED +WSAECONNREFUSED +WSAECONNRESET +WSAEDESTADDRREQ +WSAEDISCON +WSAEDQUOT +WSAEFAULT +WSAEHOSTDOWN +WSAEHOSTUNREACH +WSAEINPROGRESS +WSAEINTR +WSAEINVAL +WSAEINVALIDPROCTABLE +WSAEINVALIDPROVIDER +WSAEISCONN +WSAELOOP +WSAEMFILE +WSAEMSGSIZE +WSAENAMETOOLONG +WSAENETDOWN +WSAENETRESET +WSAENETUNREACH +WSAENOBUFS +WSAENOMORE +WSAENOPROTOOPT +WSAENOTCONN +WSAENOTEMPTY +WSAENOTSOCK +WSAEOPNOTSUPP +WSAEPFNOSUPPORT +WSAEPROCLIM +WSAEPROTONOSUPPORT +WSAEPROTOTYPE +WSAEPROVIDERFAILEDINIT +WSAEREFUSED +WSAEREMOTE +WSAESHUTDOWN +WSAESOCKTNOSUPPORT +WSAESTALE +WSAETIMEDOUT +WSAETOOMANYREFS +WSAEUSERS +WSAEWOULDBLOCK +WSAGetLastError +WSAHOST_NOT_FOUND +WSANO_DATA +WSANO_RECOVERY +WSANOTINITIALISED +WSAPROTOCOL_INFOW +WSAPROTOCOLCHAIN +WSARecv +WSASend +WSASERVICE_NOT_FOUND +WSASocketW +WSAStartup +WSASYSCALLFAILURE +WSASYSNOTREADY +WSATRY_AGAIN +WSATYPE_NOT_FOUND +WSAVERNOTSUPPORTED diff --git a/library/std/src/sys/pal/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs index 79513d33a1a..1d0e89f5d0f 100644 --- a/library/std/src/sys/pal/windows/c/windows_sys.rs +++ b/library/std/src/sys/pal/windows/c/windows_sys.rs @@ -1,15 +1,14 @@ -// Bindings generated by `windows-bindgen` 0.58.0 +// Bindings generated by `windows-bindgen` 0.59.0 #![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] -windows_targets::link!("advapi32.dll" "system" fn OpenProcessToken(processhandle : HANDLE, desiredaccess : TOKEN_ACCESS_MASK, tokenhandle : *mut HANDLE) -> BOOL); -windows_targets::link!("advapi32.dll" "system" "SystemFunction036" fn RtlGenRandom(randombuffer : *mut core::ffi::c_void, randombufferlength : u32) -> BOOLEAN); + windows_targets::link!("kernel32.dll" "system" fn AcquireSRWLockExclusive(srwlock : *mut SRWLOCK)); windows_targets::link!("kernel32.dll" "system" fn AcquireSRWLockShared(srwlock : *mut SRWLOCK)); windows_targets::link!("kernel32.dll" "system" fn AddVectoredExceptionHandler(first : u32, handler : PVECTORED_EXCEPTION_HANDLER) -> *mut core::ffi::c_void); windows_targets::link!("kernel32.dll" "system" fn CancelIo(hfile : HANDLE) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn CloseHandle(hobject : HANDLE) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn CompareStringOrdinal(lpstring1 : PCWSTR, cchcount1 : i32, lpstring2 : PCWSTR, cchcount2 : i32, bignorecase : BOOL) -> COMPARESTRING_RESULT); -windows_targets::link!("kernel32.dll" "system" fn CopyFileExW(lpexistingfilename : PCWSTR, lpnewfilename : PCWSTR, lpprogressroutine : LPPROGRESS_ROUTINE, lpdata : *const core::ffi::c_void, pbcancel : *mut BOOL, dwcopyflags : u32) -> BOOL); +windows_targets::link!("kernel32.dll" "system" fn CopyFileExW(lpexistingfilename : PCWSTR, lpnewfilename : PCWSTR, lpprogressroutine : LPPROGRESS_ROUTINE, lpdata : *const core::ffi::c_void, pbcancel : *mut BOOL, dwcopyflags : COPYFILE_FLAGS) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn CreateDirectoryW(lppathname : PCWSTR, lpsecurityattributes : *const SECURITY_ATTRIBUTES) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn CreateEventW(lpeventattributes : *const SECURITY_ATTRIBUTES, bmanualreset : BOOL, binitialstate : BOOL, lpname : PCWSTR) -> HANDLE); windows_targets::link!("kernel32.dll" "system" fn CreateFileW(lpfilename : PCWSTR, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, lpsecurityattributes : *const SECURITY_ATTRIBUTES, dwcreationdisposition : FILE_CREATION_DISPOSITION, dwflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES, htemplatefile : HANDLE) -> HANDLE); @@ -17,7 +16,7 @@ windows_targets::link!("kernel32.dll" "system" fn CreateHardLinkW(lpfilename : P windows_targets::link!("kernel32.dll" "system" fn CreateNamedPipeW(lpname : PCWSTR, dwopenmode : FILE_FLAGS_AND_ATTRIBUTES, dwpipemode : NAMED_PIPE_MODE, nmaxinstances : u32, noutbuffersize : u32, ninbuffersize : u32, ndefaulttimeout : u32, lpsecurityattributes : *const SECURITY_ATTRIBUTES) -> HANDLE); windows_targets::link!("kernel32.dll" "system" fn CreatePipe(hreadpipe : *mut HANDLE, hwritepipe : *mut HANDLE, lppipeattributes : *const SECURITY_ATTRIBUTES, nsize : u32) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn CreateProcessW(lpapplicationname : PCWSTR, lpcommandline : PWSTR, lpprocessattributes : *const SECURITY_ATTRIBUTES, lpthreadattributes : *const SECURITY_ATTRIBUTES, binherithandles : BOOL, dwcreationflags : PROCESS_CREATION_FLAGS, lpenvironment : *const core::ffi::c_void, lpcurrentdirectory : PCWSTR, lpstartupinfo : *const STARTUPINFOW, lpprocessinformation : *mut PROCESS_INFORMATION) -> BOOL); -windows_targets::link!("kernel32.dll" "system" fn CreateSymbolicLinkW(lpsymlinkfilename : PCWSTR, lptargetfilename : PCWSTR, dwflags : SYMBOLIC_LINK_FLAGS) -> BOOLEAN); +windows_targets::link!("kernel32.dll" "system" fn CreateSymbolicLinkW(lpsymlinkfilename : PCWSTR, lptargetfilename : PCWSTR, dwflags : SYMBOLIC_LINK_FLAGS) -> bool); windows_targets::link!("kernel32.dll" "system" fn CreateThread(lpthreadattributes : *const SECURITY_ATTRIBUTES, dwstacksize : usize, lpstartaddress : LPTHREAD_START_ROUTINE, lpparameter : *const core::ffi::c_void, dwcreationflags : THREAD_CREATION_FLAGS, lpthreadid : *mut u32) -> HANDLE); windows_targets::link!("kernel32.dll" "system" fn CreateWaitableTimerExW(lptimerattributes : *const SECURITY_ATTRIBUTES, lptimername : PCWSTR, dwflags : u32, dwdesiredaccess : u32) -> HANDLE); windows_targets::link!("kernel32.dll" "system" fn DeleteFileW(lpfilename : PCWSTR) -> BOOL); @@ -61,6 +60,7 @@ windows_targets::link!("kernel32.dll" "system" fn GetSystemInfo(lpsysteminfo : * windows_targets::link!("kernel32.dll" "system" fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime : *mut FILETIME)); windows_targets::link!("kernel32.dll" "system" fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime : *mut FILETIME)); windows_targets::link!("kernel32.dll" "system" fn GetTempPathW(nbufferlength : u32, lpbuffer : PWSTR) -> u32); +windows_targets::link!("userenv.dll" "system" fn GetUserProfileDirectoryW(htoken : HANDLE, lpprofiledir : PWSTR, lpcchsize : *mut u32) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn GetWindowsDirectoryW(lpbuffer : PWSTR, usize : u32) -> u32); windows_targets::link!("kernel32.dll" "system" fn InitOnceBeginInitialize(lpinitonce : *mut INIT_ONCE, dwflags : u32, fpending : *mut BOOL, lpcontext : *mut *mut core::ffi::c_void) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn InitOnceComplete(lpinitonce : *mut INIT_ONCE, dwflags : u32, lpcontext : *const core::ffi::c_void) -> BOOL); @@ -69,6 +69,11 @@ windows_targets::link!("kernel32.dll" "system" fn LocalFree(hmem : HLOCAL) -> HL windows_targets::link!("kernel32.dll" "system" fn LockFileEx(hfile : HANDLE, dwflags : LOCK_FILE_FLAGS, dwreserved : u32, nnumberofbytestolocklow : u32, nnumberofbytestolockhigh : u32, lpoverlapped : *mut OVERLAPPED) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn MoveFileExW(lpexistingfilename : PCWSTR, lpnewfilename : PCWSTR, dwflags : MOVE_FILE_FLAGS) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn MultiByteToWideChar(codepage : u32, dwflags : MULTI_BYTE_TO_WIDE_CHAR_FLAGS, lpmultibytestr : PCSTR, cbmultibyte : i32, lpwidecharstr : PWSTR, cchwidechar : i32) -> i32); +windows_targets::link!("ntdll.dll" "system" fn NtCreateFile(filehandle : *mut HANDLE, desiredaccess : FILE_ACCESS_RIGHTS, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, allocationsize : *const i64, fileattributes : FILE_FLAGS_AND_ATTRIBUTES, shareaccess : FILE_SHARE_MODE, createdisposition : NTCREATEFILE_CREATE_DISPOSITION, createoptions : NTCREATEFILE_CREATE_OPTIONS, eabuffer : *const core::ffi::c_void, ealength : u32) -> NTSTATUS); +windows_targets::link!("ntdll.dll" "system" fn NtOpenFile(filehandle : *mut HANDLE, desiredaccess : u32, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, shareaccess : u32, openoptions : u32) -> NTSTATUS); +windows_targets::link!("ntdll.dll" "system" fn NtReadFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *mut core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS); +windows_targets::link!("ntdll.dll" "system" fn NtWriteFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *const core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS); +windows_targets::link!("advapi32.dll" "system" fn OpenProcessToken(processhandle : HANDLE, desiredaccess : TOKEN_ACCESS_MASK, tokenhandle : *mut HANDLE) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn QueryPerformanceCounter(lpperformancecount : *mut i64) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn QueryPerformanceFrequency(lpfrequency : *mut i64) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn ReadConsoleW(hconsoleinput : HANDLE, lpbuffer : *mut core::ffi::c_void, nnumberofcharstoread : u32, lpnumberofcharsread : *mut u32, pinputcontrol : *const CONSOLE_READCONSOLE_CONTROL) -> BOOL); @@ -77,6 +82,8 @@ windows_targets::link!("kernel32.dll" "system" fn ReadFileEx(hfile : HANDLE, lpb windows_targets::link!("kernel32.dll" "system" fn ReleaseSRWLockExclusive(srwlock : *mut SRWLOCK)); windows_targets::link!("kernel32.dll" "system" fn ReleaseSRWLockShared(srwlock : *mut SRWLOCK)); windows_targets::link!("kernel32.dll" "system" fn RemoveDirectoryW(lppathname : PCWSTR) -> BOOL); +windows_targets::link!("advapi32.dll" "system" "SystemFunction036" fn RtlGenRandom(randombuffer : *mut core::ffi::c_void, randombufferlength : u32) -> bool); +windows_targets::link!("ntdll.dll" "system" fn RtlNtStatusToDosError(status : NTSTATUS) -> u32); windows_targets::link!("kernel32.dll" "system" fn SetCurrentDirectoryW(lppathname : PCWSTR) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn SetEnvironmentVariableW(lpname : PCWSTR, lpvalue : PCWSTR) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn SetFileAttributesW(lpfilename : PCWSTR, dwfileattributes : FILE_FLAGS_AND_ATTRIBUTES) -> BOOL); @@ -96,23 +103,10 @@ windows_targets::link!("kernel32.dll" "system" fn TlsAlloc() -> u32); windows_targets::link!("kernel32.dll" "system" fn TlsFree(dwtlsindex : u32) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn TlsGetValue(dwtlsindex : u32) -> *mut core::ffi::c_void); windows_targets::link!("kernel32.dll" "system" fn TlsSetValue(dwtlsindex : u32, lptlsvalue : *const core::ffi::c_void) -> BOOL); -windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockExclusive(srwlock : *mut SRWLOCK) -> BOOLEAN); -windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockShared(srwlock : *mut SRWLOCK) -> BOOLEAN); +windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockExclusive(srwlock : *mut SRWLOCK) -> bool); +windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockShared(srwlock : *mut SRWLOCK) -> bool); windows_targets::link!("kernel32.dll" "system" fn UnlockFile(hfile : HANDLE, dwfileoffsetlow : u32, dwfileoffsethigh : u32, nnumberofbytestounlocklow : u32, nnumberofbytestounlockhigh : u32) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn UpdateProcThreadAttribute(lpattributelist : LPPROC_THREAD_ATTRIBUTE_LIST, dwflags : u32, attribute : usize, lpvalue : *const core::ffi::c_void, cbsize : usize, lppreviousvalue : *mut core::ffi::c_void, lpreturnsize : *const usize) -> BOOL); -windows_targets::link!("kernel32.dll" "system" fn WaitForMultipleObjects(ncount : u32, lphandles : *const HANDLE, bwaitall : BOOL, dwmilliseconds : u32) -> WAIT_EVENT); -windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT); -windows_targets::link!("kernel32.dll" "system" fn WakeAllConditionVariable(conditionvariable : *mut CONDITION_VARIABLE)); -windows_targets::link!("kernel32.dll" "system" fn WakeConditionVariable(conditionvariable : *mut CONDITION_VARIABLE)); -windows_targets::link!("kernel32.dll" "system" fn WideCharToMultiByte(codepage : u32, dwflags : u32, lpwidecharstr : PCWSTR, cchwidechar : i32, lpmultibytestr : PSTR, cbmultibyte : i32, lpdefaultchar : PCSTR, lpuseddefaultchar : *mut BOOL) -> i32); -windows_targets::link!("kernel32.dll" "system" fn WriteConsoleW(hconsoleoutput : HANDLE, lpbuffer : PCWSTR, nnumberofcharstowrite : u32, lpnumberofcharswritten : *mut u32, lpreserved : *const core::ffi::c_void) -> BOOL); -windows_targets::link!("kernel32.dll" "system" fn WriteFileEx(hfile : HANDLE, lpbuffer : *const u8, nnumberofbytestowrite : u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPOVERLAPPED_COMPLETION_ROUTINE) -> BOOL); -windows_targets::link!("ntdll.dll" "system" fn NtCreateFile(filehandle : *mut HANDLE, desiredaccess : FILE_ACCESS_RIGHTS, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, allocationsize : *const i64, fileattributes : FILE_FLAGS_AND_ATTRIBUTES, shareaccess : FILE_SHARE_MODE, createdisposition : NTCREATEFILE_CREATE_DISPOSITION, createoptions : NTCREATEFILE_CREATE_OPTIONS, eabuffer : *const core::ffi::c_void, ealength : u32) -> NTSTATUS); -windows_targets::link!("ntdll.dll" "system" fn NtOpenFile(filehandle : *mut HANDLE, desiredaccess : u32, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, shareaccess : u32, openoptions : u32) -> NTSTATUS); -windows_targets::link!("ntdll.dll" "system" fn NtReadFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *mut core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS); -windows_targets::link!("ntdll.dll" "system" fn NtWriteFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *const core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS); -windows_targets::link!("ntdll.dll" "system" fn RtlNtStatusToDosError(status : NTSTATUS) -> u32); -windows_targets::link!("userenv.dll" "system" fn GetUserProfileDirectoryW(htoken : HANDLE, lpprofiledir : PWSTR, lpcchsize : *mut u32) -> BOOL); windows_targets::link!("ws2_32.dll" "system" fn WSACleanup() -> i32); windows_targets::link!("ws2_32.dll" "system" fn WSADuplicateSocketW(s : SOCKET, dwprocessid : u32, lpprotocolinfo : *mut WSAPROTOCOL_INFOW) -> i32); windows_targets::link!("ws2_32.dll" "system" fn WSAGetLastError() -> WSA_ERROR); @@ -120,6 +114,13 @@ windows_targets::link!("ws2_32.dll" "system" fn WSARecv(s : SOCKET, lpbuffers : windows_targets::link!("ws2_32.dll" "system" fn WSASend(s : SOCKET, lpbuffers : *const WSABUF, dwbuffercount : u32, lpnumberofbytessent : *mut u32, dwflags : u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPWSAOVERLAPPED_COMPLETION_ROUTINE) -> i32); windows_targets::link!("ws2_32.dll" "system" fn WSASocketW(af : i32, r#type : i32, protocol : i32, lpprotocolinfo : *const WSAPROTOCOL_INFOW, g : u32, dwflags : u32) -> SOCKET); windows_targets::link!("ws2_32.dll" "system" fn WSAStartup(wversionrequested : u16, lpwsadata : *mut WSADATA) -> i32); +windows_targets::link!("kernel32.dll" "system" fn WaitForMultipleObjects(ncount : u32, lphandles : *const HANDLE, bwaitall : BOOL, dwmilliseconds : u32) -> WAIT_EVENT); +windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT); +windows_targets::link!("kernel32.dll" "system" fn WakeAllConditionVariable(conditionvariable : *mut CONDITION_VARIABLE)); +windows_targets::link!("kernel32.dll" "system" fn WakeConditionVariable(conditionvariable : *mut CONDITION_VARIABLE)); +windows_targets::link!("kernel32.dll" "system" fn WideCharToMultiByte(codepage : u32, dwflags : u32, lpwidecharstr : PCWSTR, cchwidechar : i32, lpmultibytestr : PSTR, cbmultibyte : i32, lpdefaultchar : PCSTR, lpuseddefaultchar : *mut BOOL) -> i32); +windows_targets::link!("kernel32.dll" "system" fn WriteConsoleW(hconsoleoutput : HANDLE, lpbuffer : PCWSTR, nnumberofcharstowrite : u32, lpnumberofcharswritten : *mut u32, lpreserved : *const core::ffi::c_void) -> BOOL); +windows_targets::link!("kernel32.dll" "system" fn WriteFileEx(hfile : HANDLE, lpbuffer : *const u8, nnumberofbytestowrite : u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPOVERLAPPED_COMPLETION_ROUTINE) -> BOOL); windows_targets::link!("ws2_32.dll" "system" fn accept(s : SOCKET, addr : *mut SOCKADDR, addrlen : *mut i32) -> SOCKET); windows_targets::link!("ws2_32.dll" "system" fn bind(s : SOCKET, name : *const SOCKADDR, namelen : i32) -> i32); windows_targets::link!("ws2_32.dll" "system" fn closesocket(s : SOCKET) -> i32); @@ -139,6 +140,15 @@ windows_targets::link!("ws2_32.dll" "system" fn sendto(s : SOCKET, buf : PCSTR, windows_targets::link!("ws2_32.dll" "system" fn setsockopt(s : SOCKET, level : i32, optname : i32, optval : PCSTR, optlen : i32) -> i32); windows_targets::link!("ws2_32.dll" "system" fn shutdown(s : SOCKET, how : WINSOCK_SHUTDOWN_HOW) -> i32); pub const ABOVE_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32768u32; +#[repr(C)] +#[derive(Clone, Copy)] +pub struct ACL { + pub AclRevision: u8, + pub Sbz1: u8, + pub AclSize: u16, + pub AceCount: u16, + pub Sbz2: u16, +} pub type ADDRESS_FAMILY = u16; #[repr(C)] #[derive(Clone, Copy)] @@ -174,7 +184,6 @@ pub struct ARM64_NT_NEON128_0 { } pub const BELOW_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 16384u32; pub type BOOL = i32; -pub type BOOLEAN = u8; #[repr(C)] #[derive(Clone, Copy)] pub struct BY_HANDLE_FILE_INFORMATION { @@ -207,64 +216,34 @@ pub struct CONSOLE_READCONSOLE_CONTROL { pub dwControlKeyState: u32, } #[repr(C)] -#[cfg(target_arch = "aarch64")] +#[cfg(target_arch = "x86")] #[derive(Clone, Copy)] pub struct CONTEXT { pub ContextFlags: CONTEXT_FLAGS, - pub Cpsr: u32, - pub Anonymous: CONTEXT_0, - pub Sp: u64, - pub Pc: u64, - pub V: [ARM64_NT_NEON128; 32], - pub Fpcr: u32, - pub Fpsr: u32, - pub Bcr: [u32; 8], - pub Bvr: [u64; 8], - pub Wcr: [u32; 2], - pub Wvr: [u64; 2], -} -#[repr(C)] -#[cfg(target_arch = "aarch64")] -#[derive(Clone, Copy)] -pub union CONTEXT_0 { - pub Anonymous: CONTEXT_0_0, - pub X: [u64; 31], -} -#[repr(C)] -#[cfg(target_arch = "aarch64")] -#[derive(Clone, Copy)] -pub struct CONTEXT_0_0 { - pub X0: u64, - pub X1: u64, - pub X2: u64, - pub X3: u64, - pub X4: u64, - pub X5: u64, - pub X6: u64, - pub X7: u64, - pub X8: u64, - pub X9: u64, - pub X10: u64, - pub X11: u64, - pub X12: u64, - pub X13: u64, - pub X14: u64, - pub X15: u64, - pub X16: u64, - pub X17: u64, - pub X18: u64, - pub X19: u64, - pub X20: u64, - pub X21: u64, - pub X22: u64, - pub X23: u64, - pub X24: u64, - pub X25: u64, - pub X26: u64, - pub X27: u64, - pub X28: u64, - pub Fp: u64, - pub Lr: u64, + pub Dr0: u32, + pub Dr1: u32, + pub Dr2: u32, + pub Dr3: u32, + pub Dr6: u32, + pub Dr7: u32, + pub FloatSave: FLOATING_SAVE_AREA, + pub SegGs: u32, + pub SegFs: u32, + pub SegEs: u32, + pub SegDs: u32, + pub Edi: u32, + pub Esi: u32, + pub Ebx: u32, + pub Edx: u32, + pub Ecx: u32, + pub Eax: u32, + pub Ebp: u32, + pub Eip: u32, + pub SegCs: u32, + pub EFlags: u32, + pub Esp: u32, + pub SegSs: u32, + pub ExtendedRegisters: [u8; 512], } #[repr(C)] #[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))] @@ -348,36 +327,68 @@ pub struct CONTEXT_0_0 { pub Xmm15: M128A, } #[repr(C)] -#[cfg(target_arch = "x86")] +#[cfg(target_arch = "aarch64")] #[derive(Clone, Copy)] pub struct CONTEXT { pub ContextFlags: CONTEXT_FLAGS, - pub Dr0: u32, - pub Dr1: u32, - pub Dr2: u32, - pub Dr3: u32, - pub Dr6: u32, - pub Dr7: u32, - pub FloatSave: FLOATING_SAVE_AREA, - pub SegGs: u32, - pub SegFs: u32, - pub SegEs: u32, - pub SegDs: u32, - pub Edi: u32, - pub Esi: u32, - pub Ebx: u32, - pub Edx: u32, - pub Ecx: u32, - pub Eax: u32, - pub Ebp: u32, - pub Eip: u32, - pub SegCs: u32, - pub EFlags: u32, - pub Esp: u32, - pub SegSs: u32, - pub ExtendedRegisters: [u8; 512], + pub Cpsr: u32, + pub Anonymous: CONTEXT_0, + pub Sp: u64, + pub Pc: u64, + pub V: [ARM64_NT_NEON128; 32], + pub Fpcr: u32, + pub Fpsr: u32, + pub Bcr: [u32; 8], + pub Bvr: [u64; 8], + pub Wcr: [u32; 2], + pub Wvr: [u64; 2], +} +#[repr(C)] +#[cfg(target_arch = "aarch64")] +#[derive(Clone, Copy)] +pub union CONTEXT_0 { + pub Anonymous: CONTEXT_0_0, + pub X: [u64; 31], +} +#[repr(C)] +#[cfg(target_arch = "aarch64")] +#[derive(Clone, Copy)] +pub struct CONTEXT_0_0 { + pub X0: u64, + pub X1: u64, + pub X2: u64, + pub X3: u64, + pub X4: u64, + pub X5: u64, + pub X6: u64, + pub X7: u64, + pub X8: u64, + pub X9: u64, + pub X10: u64, + pub X11: u64, + pub X12: u64, + pub X13: u64, + pub X14: u64, + pub X15: u64, + pub X16: u64, + pub X17: u64, + pub X18: u64, + pub X19: u64, + pub X20: u64, + pub X21: u64, + pub X22: u64, + pub X23: u64, + pub X24: u64, + pub X25: u64, + pub X26: u64, + pub X27: u64, + pub X28: u64, + pub Fp: u64, + pub Lr: u64, } pub type CONTEXT_FLAGS = u32; +pub type COPYFILE_FLAGS = u32; +pub type COPYPROGRESSROUTINE_PROGRESS = u32; pub const CP_UTF8: u32 = 65001u32; pub const CREATE_ALWAYS: FILE_CREATION_DISPOSITION = 2u32; pub const CREATE_BREAKAWAY_FROM_JOB: PROCESS_CREATION_FLAGS = 16777216u32; @@ -2396,7 +2407,7 @@ pub const FILE_DISPOSITION_FLAG_POSIX_SEMANTICS: FILE_DISPOSITION_INFO_EX_FLAGS #[repr(C)] #[derive(Clone, Copy)] pub struct FILE_DISPOSITION_INFO { - pub DeleteFile: BOOLEAN, + pub DeleteFile: bool, } #[repr(C)] #[derive(Clone, Copy)] @@ -2486,7 +2497,7 @@ pub struct FILE_RENAME_INFO { #[repr(C)] #[derive(Clone, Copy)] pub union FILE_RENAME_INFO_0 { - pub ReplaceIfExists: BOOLEAN, + pub ReplaceIfExists: bool, pub Flags: u32, } pub const FILE_RESERVE_OPFILTER: NTCREATEFILE_CREATE_OPTIONS = 1048576u32; @@ -2503,8 +2514,8 @@ pub struct FILE_STANDARD_INFO { pub AllocationSize: i64, pub EndOfFile: i64, pub NumberOfLinks: u32, - pub DeletePending: BOOLEAN, - pub Directory: BOOLEAN, + pub DeletePending: bool, + pub Directory: bool, } pub const FILE_SUPERSEDE: NTCREATEFILE_CREATE_DISPOSITION = 0u32; pub const FILE_SYNCHRONOUS_IO_ALERT: NTCREATEFILE_CREATE_OPTIONS = 16u32; @@ -2525,7 +2536,7 @@ pub type FINDEX_SEARCH_OPS = i32; pub type FIND_FIRST_EX_FLAGS = u32; pub const FIONBIO: i32 = -2147195266i32; #[repr(C)] -#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))] +#[cfg(target_arch = "x86")] #[derive(Clone, Copy)] pub struct FLOATING_SAVE_AREA { pub ControlWord: u32, @@ -2536,10 +2547,10 @@ pub struct FLOATING_SAVE_AREA { pub DataOffset: u32, pub DataSelector: u32, pub RegisterArea: [u8; 80], - pub Cr0NpxState: u32, + pub Spare0: u32, } #[repr(C)] -#[cfg(target_arch = "x86")] +#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))] #[derive(Clone, Copy)] pub struct FLOATING_SAVE_AREA { pub ControlWord: u32, @@ -2550,7 +2561,7 @@ pub struct FLOATING_SAVE_AREA { pub DataOffset: u32, pub DataSelector: u32, pub RegisterArea: [u8; 80], - pub Spare0: u32, + pub Cr0NpxState: u32, } pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: FORMAT_MESSAGE_OPTIONS = 256u32; pub const FORMAT_MESSAGE_ARGUMENT_ARRAY: FORMAT_MESSAGE_OPTIONS = 8192u32; @@ -2618,6 +2629,7 @@ pub type HANDLE_FLAGS = u32; pub const HANDLE_FLAG_INHERIT: HANDLE_FLAGS = 1u32; pub const HANDLE_FLAG_PROTECT_FROM_CLOSE: HANDLE_FLAGS = 2u32; pub const HIGH_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 128u32; +pub type HINSTANCE = *mut core::ffi::c_void; pub type HLOCAL = *mut core::ffi::c_void; pub type HMODULE = *mut core::ffi::c_void; pub type HRESULT = i32; @@ -2771,7 +2783,7 @@ pub type LPPROGRESS_ROUTINE = Option< hsourcefile: HANDLE, hdestinationfile: HANDLE, lpdata: *const core::ffi::c_void, - ) -> u32, + ) -> COPYPROGRESSROUTINE_PROGRESS, >; pub type LPPROGRESS_ROUTINE_CALLBACK_REASON = u32; pub type LPTHREAD_START_ROUTINE = @@ -2822,11 +2834,12 @@ pub struct OBJECT_ATTRIBUTES { pub Length: u32, pub RootDirectory: HANDLE, pub ObjectName: *const UNICODE_STRING, - pub Attributes: u32, - pub SecurityDescriptor: *const core::ffi::c_void, - pub SecurityQualityOfService: *const core::ffi::c_void, + pub Attributes: OBJECT_ATTRIBUTE_FLAGS, + pub SecurityDescriptor: *const SECURITY_DESCRIPTOR, + pub SecurityQualityOfService: *const SECURITY_QUALITY_OF_SERVICE, } -pub const OBJ_DONT_REPARSE: i32 = 4096i32; +pub type OBJECT_ATTRIBUTE_FLAGS = u32; +pub const OBJ_DONT_REPARSE: OBJECT_ATTRIBUTE_FLAGS = 4096u32; pub const OPEN_ALWAYS: FILE_CREATION_DISPOSITION = 4u32; pub const OPEN_EXISTING: FILE_CREATION_DISPOSITION = 3u32; #[repr(C)] @@ -2887,7 +2900,8 @@ pub const PROCESS_MODE_BACKGROUND_END: PROCESS_CREATION_FLAGS = 2097152u32; pub const PROFILE_KERNEL: PROCESS_CREATION_FLAGS = 536870912u32; pub const PROFILE_SERVER: PROCESS_CREATION_FLAGS = 1073741824u32; pub const PROFILE_USER: PROCESS_CREATION_FLAGS = 268435456u32; -pub const PROGRESS_CONTINUE: u32 = 0u32; +pub const PROGRESS_CONTINUE: COPYPROGRESSROUTINE_PROGRESS = 0u32; +pub type PSID = *mut core::ffi::c_void; pub type PSTR = *mut u8; pub type PTIMERAPCROUTINE = Option< unsafe extern "system" fn( @@ -2914,9 +2928,30 @@ pub struct SECURITY_ATTRIBUTES { } pub const SECURITY_CONTEXT_TRACKING: FILE_FLAGS_AND_ATTRIBUTES = 262144u32; pub const SECURITY_DELEGATION: FILE_FLAGS_AND_ATTRIBUTES = 196608u32; +#[repr(C)] +#[derive(Clone, Copy)] +pub struct SECURITY_DESCRIPTOR { + pub Revision: u8, + pub Sbz1: u8, + pub Control: SECURITY_DESCRIPTOR_CONTROL, + pub Owner: PSID, + pub Group: PSID, + pub Sacl: *mut ACL, + pub Dacl: *mut ACL, +} +pub type SECURITY_DESCRIPTOR_CONTROL = u16; pub const SECURITY_EFFECTIVE_ONLY: FILE_FLAGS_AND_ATTRIBUTES = 524288u32; pub const SECURITY_IDENTIFICATION: FILE_FLAGS_AND_ATTRIBUTES = 65536u32; pub const SECURITY_IMPERSONATION: FILE_FLAGS_AND_ATTRIBUTES = 131072u32; +pub type SECURITY_IMPERSONATION_LEVEL = i32; +#[repr(C)] +#[derive(Clone, Copy)] +pub struct SECURITY_QUALITY_OF_SERVICE { + pub Length: u32, + pub ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL, + pub ContextTrackingMode: u8, + pub EffectiveOnly: bool, +} pub const SECURITY_SQOS_PRESENT: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32; pub const SECURITY_VALID_SQOS_FLAGS: FILE_FLAGS_AND_ATTRIBUTES = 2031616u32; pub type SEND_RECV_FLAGS = i32; @@ -3137,28 +3172,28 @@ pub struct WSABUF { pub buf: PSTR, } #[repr(C)] -#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))] +#[cfg(target_arch = "x86")] #[derive(Clone, Copy)] pub struct WSADATA { pub wVersion: u16, pub wHighVersion: u16, + pub szDescription: [i8; 257], + pub szSystemStatus: [i8; 129], pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: PSTR, - pub szDescription: [i8; 257], - pub szSystemStatus: [i8; 129], } #[repr(C)] -#[cfg(target_arch = "x86")] +#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))] #[derive(Clone, Copy)] pub struct WSADATA { pub wVersion: u16, pub wHighVersion: u16, - pub szDescription: [i8; 257], - pub szSystemStatus: [i8; 129], pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: PSTR, + pub szDescription: [i8; 257], + pub szSystemStatus: [i8; 129], } pub const WSAEACCES: WSA_ERROR = 10013i32; pub const WSAEADDRINUSE: WSA_ERROR = 10048i32; @@ -3293,7 +3328,7 @@ pub const WSA_SECURE_HOST_NOT_FOUND: WSA_ERROR = 11032i32; pub const WSA_WAIT_EVENT_0: WSA_ERROR = 0i32; pub const WSA_WAIT_IO_COMPLETION: WSA_ERROR = 192i32; #[repr(C)] -#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))] +#[cfg(target_arch = "x86")] #[derive(Clone, Copy)] pub struct XSAVE_FORMAT { pub ControlWord: u16, @@ -3310,11 +3345,11 @@ pub struct XSAVE_FORMAT { pub MxCsr: u32, pub MxCsr_Mask: u32, pub FloatRegisters: [M128A; 8], - pub XmmRegisters: [M128A; 16], - pub Reserved4: [u8; 96], + pub XmmRegisters: [M128A; 8], + pub Reserved4: [u8; 224], } #[repr(C)] -#[cfg(target_arch = "x86")] +#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "x86_64"))] #[derive(Clone, Copy)] pub struct XSAVE_FORMAT { pub ControlWord: u16, @@ -3331,8 +3366,8 @@ pub struct XSAVE_FORMAT { pub MxCsr: u32, pub MxCsr_Mask: u32, pub FloatRegisters: [M128A; 8], - pub XmmRegisters: [M128A; 8], - pub Reserved4: [u8; 224], + pub XmmRegisters: [M128A; 16], + pub Reserved4: [u8; 96], } #[cfg(target_arch = "arm")] diff --git a/library/std/src/sys/pal/windows/fs.rs b/library/std/src/sys/pal/windows/fs.rs index b786c79004f..ff02737dcf8 100644 --- a/library/std/src/sys/pal/windows/fs.rs +++ b/library/std/src/sys/pal/windows/fs.rs @@ -812,7 +812,7 @@ impl File { /// will prevent anyone from opening a new handle to the file. #[allow(unused)] fn win32_delete(&self) -> Result<(), WinError> { - let info = c::FILE_DISPOSITION_INFO { DeleteFile: c::TRUE as _ }; + let info = c::FILE_DISPOSITION_INFO { DeleteFile: true }; api::set_file_information_by_handle(self.handle.as_raw_handle(), &info) } @@ -1372,7 +1372,7 @@ pub fn rename(old: &Path, new: &Path) -> io::Result<()> { if let Err(err) = result { if err.raw_os_error() == Some(c::ERROR_INVALID_PARAMETER as _) { // FileRenameInfoEx and FILE_RENAME_FLAG_POSIX_SEMANTICS were added in Windows 10 1607; retry with FileRenameInfo. - file_rename_info.Anonymous.ReplaceIfExists = 1; + file_rename_info.Anonymous.ReplaceIfExists = true; cvt(unsafe { c::SetFileInformationByHandle( @@ -1468,9 +1468,7 @@ pub fn link(original: &Path, link: &Path) -> io::Result<()> { #[cfg(target_vendor = "uwp")] pub fn link(_original: &Path, _link: &Path) -> io::Result<()> { - return Err( - io::const_error!(io::ErrorKind::Unsupported, "hard link are not supported on UWP",), - ); + return Err(io::const_error!(io::ErrorKind::Unsupported, "hard link are not supported on UWP")); } pub fn stat(path: &Path) -> io::Result<FileAttr> { diff --git a/library/std/src/sys/pal/windows/process.rs b/library/std/src/sys/pal/windows/process.rs index 9332c9b49ff..a41dfbfe601 100644 --- a/library/std/src/sys/pal/windows/process.rs +++ b/library/std/src/sys/pal/windows/process.rs @@ -435,9 +435,7 @@ fn resolve_exe<'a>( ) -> io::Result<Vec<u16>> { // Early return if there is no filename. if exe_path.is_empty() || path::has_trailing_slash(exe_path) { - return Err( - io::const_error!(io::ErrorKind::InvalidInput, "program path has no file name",), - ); + return Err(io::const_error!(io::ErrorKind::InvalidInput, "program path has no file name")); } // Test if the file name has the `exe` extension. // This does a case-insensitive `ends_with`. diff --git a/library/std/src/sys/pal/windows/process/tests.rs b/library/std/src/sys/pal/windows/process/tests.rs index 90f1157d7c4..1377e12162f 100644 --- a/library/std/src/sys/pal/windows/process/tests.rs +++ b/library/std/src/sys/pal/windows/process/tests.rs @@ -138,8 +138,10 @@ fn windows_env_unicode_case() { let mut cmd = Command::new("cmd"); cmd.env(a, "1"); cmd.env(b, "2"); - env::set_var(a, "1"); - env::set_var(b, "2"); + unsafe { + env::set_var(a, "1"); + env::set_var(b, "2"); + } for (key, value) in cmd.get_envs() { assert_eq!( diff --git a/library/std/src/sys/pal/windows/stack_overflow_uwp.rs b/library/std/src/sys/pal/windows/stack_overflow_uwp.rs index 9e9b3efaf1b..6f1ea12fc1e 100644 --- a/library/std/src/sys/pal/windows/stack_overflow_uwp.rs +++ b/library/std/src/sys/pal/windows/stack_overflow_uwp.rs @@ -1,4 +1,4 @@ #![cfg_attr(test, allow(dead_code))] -pub unsafe fn reserve_stack() {} -pub unsafe fn init() {} +pub fn reserve_stack() {} +pub fn init() {} diff --git a/library/std/src/sys/pal/xous/os.rs b/library/std/src/sys/pal/xous/os.rs index 307623c0425..2c87e7d91f2 100644 --- a/library/std/src/sys/pal/xous/os.rs +++ b/library/std/src/sys/pal/xous/os.rs @@ -41,12 +41,12 @@ mod c_compat { fn main() -> u32; } - #[no_mangle] + #[unsafe(no_mangle)] pub extern "C" fn abort() { exit(1); } - #[no_mangle] + #[unsafe(no_mangle)] pub extern "C" fn _start(eh_frame: usize, params_address: usize) { #[cfg(feature = "panic_unwind")] { @@ -67,7 +67,7 @@ mod c_compat { // This function is needed by the panic runtime. The symbol is named in // pre-link args for the target specification, so keep that in sync. - #[no_mangle] + #[unsafe(no_mangle)] // NB. used by both libunwind and libpanic_abort pub extern "C" fn __rust_abort() -> ! { exit(101); diff --git a/library/std/src/sys/thread_local/key/xous.rs b/library/std/src/sys/thread_local/key/xous.rs index 6c5e6447d19..55ac5b20e1a 100644 --- a/library/std/src/sys/thread_local/key/xous.rs +++ b/library/std/src/sys/thread_local/key/xous.rs @@ -51,11 +51,11 @@ const TLS_MEMORY_SIZE: usize = 4096; /// TLS keys start at `1`. Index `0` is unused #[cfg(not(test))] -#[export_name = "_ZN16__rust_internals3std3sys4xous16thread_local_key13TLS_KEY_INDEXE"] +#[unsafe(export_name = "_ZN16__rust_internals3std3sys4xous16thread_local_key13TLS_KEY_INDEXE")] static TLS_KEY_INDEX: AtomicUsize = AtomicUsize::new(1); #[cfg(not(test))] -#[export_name = "_ZN16__rust_internals3std3sys4xous16thread_local_key9DTORSE"] +#[unsafe(export_name = "_ZN16__rust_internals3std3sys4xous16thread_local_key9DTORSE")] static DTORS: AtomicPtr<Node> = AtomicPtr::new(ptr::null_mut()); #[cfg(test)] diff --git a/library/std/tests/env_modify.rs b/library/std/tests/env_modify.rs index 60747447350..ba84978b35f 100644 --- a/library/std/tests/env_modify.rs +++ b/library/std/tests/env_modify.rs @@ -4,7 +4,7 @@ use std::env::*; use std::ffi::{OsStr, OsString}; -use rand::distributions::{Alphanumeric, DistString}; +use rand::distr::{Alphanumeric, SampleString}; mod common; use std::thread; @@ -26,26 +26,32 @@ fn eq(a: Option<OsString>, b: Option<&str>) { #[test] fn test_set_var() { let n = make_rand_name(); - set_var(&n, "VALUE"); + unsafe { + set_var(&n, "VALUE"); + } eq(var_os(&n), Some("VALUE")); } #[test] fn test_remove_var() { let n = make_rand_name(); - set_var(&n, "VALUE"); - remove_var(&n); + unsafe { + set_var(&n, "VALUE"); + remove_var(&n); + } eq(var_os(&n), None); } #[test] fn test_set_var_overwrite() { let n = make_rand_name(); - set_var(&n, "1"); - set_var(&n, "2"); - eq(var_os(&n), Some("2")); - set_var(&n, ""); - eq(var_os(&n), Some("")); + unsafe { + set_var(&n, "1"); + set_var(&n, "2"); + eq(var_os(&n), Some("2")); + set_var(&n, ""); + eq(var_os(&n), Some("")); + } } #[test] @@ -58,7 +64,9 @@ fn test_var_big() { i += 1; } let n = make_rand_name(); - set_var(&n, &s); + unsafe { + set_var(&n, &s); + } eq(var_os(&n), Some(&s)); } @@ -67,10 +75,12 @@ fn test_var_big() { fn test_env_set_get_huge() { let n = make_rand_name(); let s = "x".repeat(10000); - set_var(&n, &s); - eq(var_os(&n), Some(&s)); - remove_var(&n); - eq(var_os(&n), None); + unsafe { + set_var(&n, &s); + eq(var_os(&n), Some(&s)); + remove_var(&n); + eq(var_os(&n), None); + } } #[test] @@ -78,7 +88,9 @@ fn test_env_set_var() { let n = make_rand_name(); let mut e = vars_os(); - set_var(&n, "VALUE"); + unsafe { + set_var(&n, "VALUE"); + } assert!(!e.any(|(k, v)| { &*k == &*n && &*v == "VALUE" })); assert!(vars_os().any(|(k, v)| { &*k == &*n && &*v == "VALUE" })); @@ -102,10 +114,12 @@ fn env_home_dir() { if #[cfg(unix)] { let oldhome = var_to_os_string(var("HOME")); - set_var("HOME", "/home/MountainView"); - assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView"))); + unsafe { + set_var("HOME", "/home/MountainView"); + assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView"))); - remove_var("HOME"); + remove_var("HOME"); + } if cfg!(target_os = "android") { assert!(home_dir().is_none()); } else { @@ -115,33 +129,35 @@ fn env_home_dir() { assert_ne!(home_dir(), Some(PathBuf::from("/home/MountainView"))); } - if let Some(oldhome) = oldhome { set_var("HOME", oldhome); } + if let Some(oldhome) = oldhome { unsafe { set_var("HOME", oldhome); } } } else if #[cfg(windows)] { let oldhome = var_to_os_string(var("HOME")); let olduserprofile = var_to_os_string(var("USERPROFILE")); - remove_var("HOME"); - remove_var("USERPROFILE"); + unsafe { + remove_var("HOME"); + remove_var("USERPROFILE"); - assert!(home_dir().is_some()); + assert!(home_dir().is_some()); - set_var("HOME", "/home/PaloAlto"); - assert_ne!(home_dir(), Some(PathBuf::from("/home/PaloAlto")), "HOME must not be used"); + set_var("HOME", "/home/PaloAlto"); + assert_ne!(home_dir(), Some(PathBuf::from("/home/PaloAlto")), "HOME must not be used"); - set_var("USERPROFILE", "/home/MountainView"); - assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView"))); + set_var("USERPROFILE", "/home/MountainView"); + assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView"))); - remove_var("HOME"); + remove_var("HOME"); - assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView"))); + assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView"))); - set_var("USERPROFILE", ""); - assert_ne!(home_dir(), Some(PathBuf::from("")), "Empty USERPROFILE must be ignored"); + set_var("USERPROFILE", ""); + assert_ne!(home_dir(), Some(PathBuf::from("")), "Empty USERPROFILE must be ignored"); - remove_var("USERPROFILE"); + remove_var("USERPROFILE"); - if let Some(oldhome) = oldhome { set_var("HOME", oldhome); } - if let Some(olduserprofile) = olduserprofile { set_var("USERPROFILE", olduserprofile); } + if let Some(oldhome) = oldhome { set_var("HOME", oldhome); } + if let Some(olduserprofile) = olduserprofile { set_var("USERPROFILE", olduserprofile); } + } } } } @@ -157,7 +173,9 @@ fn test_env_get_set_multithreaded() { let setter = thread::spawn(|| { for _ in 0..100 { - set_var("foo", "bar"); + unsafe { + set_var("foo", "bar"); + } } }); diff --git a/library/std/tests/sync/rwlock.rs b/library/std/tests/sync/rwlock.rs index bd4bc7a14bc..49f260648c6 100644 --- a/library/std/tests/sync/rwlock.rs +++ b/library/std/tests/sync/rwlock.rs @@ -59,7 +59,7 @@ fn frob() { thread::spawn(move || { let mut rng = crate::common::test_rng(); for _ in 0..M { - if rng.gen_bool(1.0 / (N as f64)) { + if rng.random_bool(1.0 / (N as f64)) { drop(r.write().unwrap()); } else { drop(r.read().unwrap()); diff --git a/library/test/src/formatters/junit.rs b/library/test/src/formatters/junit.rs index 57b1b0fecee..36158b0258a 100644 --- a/library/test/src/formatters/junit.rs +++ b/library/test/src/formatters/junit.rs @@ -39,15 +39,15 @@ fn str_to_cdata(s: &str) -> String { impl<T: Write> OutputFormatter for JunitFormatter<T> { fn write_discovery_start(&mut self) -> io::Result<()> { - Err(io::Error::new(io::ErrorKind::NotFound, "Not yet implemented!")) + Err(io::const_error!(io::ErrorKind::NotFound, "Not yet implemented!")) } fn write_test_discovered(&mut self, _desc: &TestDesc, _test_type: &str) -> io::Result<()> { - Err(io::Error::new(io::ErrorKind::NotFound, "Not yet implemented!")) + Err(io::const_error!(io::ErrorKind::NotFound, "Not yet implemented!")) } fn write_discovery_finish(&mut self, _state: &ConsoleTestDiscoveryState) -> io::Result<()> { - Err(io::Error::new(io::ErrorKind::NotFound, "Not yet implemented!")) + Err(io::const_error!(io::ErrorKind::NotFound, "Not yet implemented!")) } fn write_run_start( diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs index e523d302866..7ada3f269a0 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -20,6 +20,7 @@ #![feature(rustdoc_internals)] #![feature(file_buffered)] #![feature(internal_output_capture)] +#![feature(io_const_error)] #![feature(staged_api)] #![feature(process_exitcode_internals)] #![feature(panic_can_unwind)] diff --git a/library/test/src/term/terminfo/mod.rs b/library/test/src/term/terminfo/mod.rs index 974b8afd598..75fa594908d 100644 --- a/library/test/src/term/terminfo/mod.rs +++ b/library/test/src/term/terminfo/mod.rs @@ -90,7 +90,7 @@ impl TermInfo { get_dbpath_for_term(name) .ok_or_else(|| { - Error::IoError(io::Error::new(io::ErrorKind::NotFound, "terminfo file not found")) + Error::IoError(io::const_error!(io::ErrorKind::NotFound, "terminfo file not found")) }) .and_then(|p| TermInfo::from_path(&(*p))) } diff --git a/library/test/src/term/terminfo/parser/compiled.rs b/library/test/src/term/terminfo/parser/compiled.rs index e687b3be41f..d1dd0f10d86 100644 --- a/library/test/src/term/terminfo/parser/compiled.rs +++ b/library/test/src/term/terminfo/parser/compiled.rs @@ -173,7 +173,7 @@ fn read_le_u32(r: &mut dyn io::Read) -> io::Result<u32> { fn read_byte(r: &mut dyn io::Read) -> io::Result<u8> { match r.bytes().next() { Some(s) => s, - None => Err(io::Error::new(io::ErrorKind::Other, "end of file")), + None => Err(io::const_error!(io::ErrorKind::Other, "end of file")), } } diff --git a/library/test/src/term/terminfo/searcher/tests.rs b/library/test/src/term/terminfo/searcher/tests.rs index e1edd3b25cf..ff532a97d5e 100644 --- a/library/test/src/term/terminfo/searcher/tests.rs +++ b/library/test/src/term/terminfo/searcher/tests.rs @@ -11,7 +11,11 @@ fn test_get_dbpath_for_term() { } assert_eq!(x("screen"), PathBuf::from("/usr/share/terminfo/s/screen")); assert_eq!(get_dbpath_for_term(""), None); - env::set_var("TERMINFO_DIRS", ":"); + unsafe { + env::set_var("TERMINFO_DIRS", ":"); + } assert_eq!(x("screen"), PathBuf::from("/usr/share/terminfo/s/screen")); - env::remove_var("TERMINFO_DIRS"); + unsafe { + env::remove_var("TERMINFO_DIRS"); + } } diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 2650b273a4d..761f9248446 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -9,6 +9,7 @@ )] #![allow(internal_features)] #![cfg_attr(not(bootstrap), feature(cfg_emscripten_wasm_eh))] +#![deny(unsafe_op_in_unsafe_fn)] // Force libc to be included even if unused. This is required by many platforms. #[cfg(not(all(windows, target_env = "msvc")))] diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index 62165f8a200..1a640bbde71 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -218,36 +218,38 @@ if #[cfg(any(target_vendor = "apple", target_os = "netbsd", not(target_arch = "a pub unsafe fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word { let mut val: _Unwind_Word = core::ptr::null(); - _Unwind_VRS_Get(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, - (&raw mut val) as *mut c_void); + unsafe { _Unwind_VRS_Get(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, + (&raw mut val) as *mut c_void); } val } pub unsafe fn _Unwind_SetGR(ctx: *mut _Unwind_Context, reg_index: c_int, value: _Unwind_Word) { let mut value = value; - _Unwind_VRS_Set(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, - (&raw mut value) as *mut c_void); + unsafe { _Unwind_VRS_Set(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32, + (&raw mut value) as *mut c_void); } } pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> _Unwind_Word { - let val = _Unwind_GetGR(ctx, UNWIND_IP_REG); + let val = unsafe { _Unwind_GetGR(ctx, UNWIND_IP_REG) }; val.map_addr(|v| v & !1) } pub unsafe fn _Unwind_SetIP(ctx: *mut _Unwind_Context, value: _Unwind_Word) { // Propagate thumb bit to instruction pointer - let thumb_state = _Unwind_GetGR(ctx, UNWIND_IP_REG).addr() & 1; + let thumb_state = unsafe { _Unwind_GetGR(ctx, UNWIND_IP_REG).addr() & 1 }; let value = value.map_addr(|v| v | thumb_state); - _Unwind_SetGR(ctx, UNWIND_IP_REG, value); + unsafe { _Unwind_SetGR(ctx, UNWIND_IP_REG, value); } } pub unsafe fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context, ip_before_insn: *mut c_int) -> _Unwind_Word { - *ip_before_insn = 0; - _Unwind_GetIP(ctx) + unsafe { + *ip_before_insn = 0; + _Unwind_GetIP(ctx) + } } // This function also doesn't exist on Android or ARM/Linux, so make it a no-op diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index 7e6a39a236e..88aa70d4f2f 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -99,16 +99,18 @@ prepare: # Set of tests that represent around half of the time of the test suite. # Used to split tests across multiple CI runners. -STAGE_2_TEST_SET1 := test --stage 2 --skip=compiler --skip=src -STAGE_2_TEST_SET2 := test --stage 2 --skip=tests --skip=coverage-map --skip=coverage-run --skip=library --skip=tidyselftest +SKIP_COMPILER := --skip=compiler +SKIP_SRC := --skip=src +TEST_SET1 := $(SKIP_COMPILER) $(SKIP_SRC) +TEST_SET2 := --skip=tests --skip=coverage-map --skip=coverage-run --skip=library --skip=tidyselftest ## MSVC native builders # this intentionally doesn't use `$(BOOTSTRAP)` so we can test the shebang on Windows ci-msvc-py: - $(Q)$(CFG_SRC_DIR)/x.py $(STAGE_2_TEST_SET1) + $(Q)$(CFG_SRC_DIR)/x.py test --stage 2 $(TEST_SET1) ci-msvc-ps1: - $(Q)$(CFG_SRC_DIR)/x.ps1 $(STAGE_2_TEST_SET2) + $(Q)$(CFG_SRC_DIR)/x.ps1 test --stage 2 $(TEST_SET2) ci-msvc: ci-msvc-py ci-msvc-ps1 ## MingW native builders @@ -116,10 +118,14 @@ ci-msvc: ci-msvc-py ci-msvc-ps1 # Set of tests that should represent half of the time of the test suite. # Used to split tests across multiple CI runners. # Test both x and bootstrap entrypoints. +ci-mingw-x-1: + $(Q)$(CFG_SRC_DIR)/x test --stage 2 $(SKIP_COMPILER) $(TEST_SET2) +ci-mingw-x-2: + $(Q)$(CFG_SRC_DIR)/x test --stage 2 $(SKIP_SRC) $(TEST_SET2) ci-mingw-x: - $(Q)$(CFG_SRC_DIR)/x $(STAGE_2_TEST_SET1) + $(Q)$(CFG_SRC_DIR)/x test --stage 2 $(TEST_SET1) ci-mingw-bootstrap: - $(Q)$(BOOTSTRAP) $(STAGE_2_TEST_SET2) + $(Q)$(BOOTSTRAP) test --stage 2 $(TEST_SET2) ci-mingw: ci-mingw-x ci-mingw-bootstrap .PHONY: dist diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 479327d6369..c62c36390ea 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -16,6 +16,8 @@ use std::process::Stdio; use std::{env, fs, str}; use serde_derive::Deserialize; +#[cfg(feature = "tracing")] +use tracing::{instrument, span}; use crate::core::build_steps::tool::SourceType; use crate::core::build_steps::{dist, llvm}; @@ -30,7 +32,7 @@ use crate::utils::exec::command; use crate::utils::helpers::{ exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, symlink_dir, t, up_to_date, }; -use crate::{CLang, Compiler, DependencyType, GitRepo, LLVM_TOOLS, Mode}; +use crate::{CLang, Compiler, DependencyType, GitRepo, LLVM_TOOLS, Mode, debug, trace}; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Std { @@ -95,9 +97,10 @@ impl Step for Std { const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.crate_or_deps("sysroot").path("library").alias("core") + run.crate_or_deps("sysroot").path("library") } + #[cfg_attr(feature = "tracing", instrument(level = "trace", name = "Std::make_run", skip_all))] fn make_run(run: RunConfig<'_>) { let crates = std_crates_for_run_make(&run); let builder = run.builder; @@ -109,6 +112,14 @@ impl Step for Std { && builder.download_rustc() && builder.config.last_modified_commit(&["library"], "download-rustc", true).is_none(); + trace!("is managed git repo: {}", builder.rust_info().is_managed_git_subrepository()); + trace!("download_rustc: {}", builder.download_rustc()); + trace!( + "last modified commit: {:?}", + builder.config.last_modified_commit(&["library"], "download-rustc", true) + ); + trace!(force_recompile); + run.builder.ensure(Std { compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()), target: run.target, @@ -124,13 +135,26 @@ impl Step for Std { /// This will build the standard library for a particular stage of the build /// using the `compiler` targeting the `target` architecture. The artifacts /// created will also be linked into the sysroot directory. + #[cfg_attr( + feature = "tracing", + instrument( + level = "debug", + name = "Std::run", + skip_all, + fields( + target = ?self.target, + compiler = ?self.compiler, + force_recompile = self.force_recompile + ), + ), + )] fn run(self, builder: &Builder<'_>) { let target = self.target; let compiler = self.compiler; // When using `download-rustc`, we already have artifacts for the host available. Don't // recompile them. - if builder.download_rustc() && target == builder.build.build + if builder.download_rustc() && builder.is_builder_target(target) // NOTE: the beta compiler may generate different artifacts than the downloaded compiler, so // its artifacts can't be reused. && compiler.stage != 0 @@ -148,6 +172,9 @@ impl Step for Std { if builder.config.keep_stage.contains(&compiler.stage) || builder.config.keep_stage_std.contains(&compiler.stage) { + trace!(keep_stage = ?builder.config.keep_stage); + trace!(keep_stage_std = ?builder.config.keep_stage_std); + builder.info("WARNING: Using a potentially old libstd. This may not behave well."); builder.ensure(StartupObjects { compiler, target }); @@ -163,7 +190,15 @@ impl Step for Std { let mut target_deps = builder.ensure(StartupObjects { compiler, target }); let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); + trace!(?compiler_to_use); + if compiler_to_use != compiler { + trace!( + ?compiler_to_use, + ?compiler, + "compiler != compiler_to_use, handling cross-compile scenario" + ); + builder.ensure(Std::new(compiler_to_use, target)); let msg = if compiler_to_use.host == target { format!( @@ -186,12 +221,21 @@ impl Step for Std { return; } + trace!( + ?compiler_to_use, + ?compiler, + "compiler == compiler_to_use, handling not-cross-compile scenario" + ); + target_deps.extend(self.copy_extra_objects(builder, &compiler, target)); // The LLD wrappers and `rust-lld` are self-contained linking components that can be // necessary to link the stdlib on some targets. We'll also need to copy these binaries to // the `stage0-sysroot` to ensure the linker is found when bootstrapping on such a target. - if compiler.stage == 0 && builder.is_builder_target(&compiler.host) { + if compiler.stage == 0 && builder.is_builder_target(compiler.host) { + trace!( + "(build == host) copying linking components to `stage0-sysroot` for bootstrapping" + ); // We want to copy the host `bin` folder within the `rustlib` folder in the sysroot. let src_sysroot_bin = builder .rustc_snapshot_sysroot() @@ -210,6 +254,7 @@ impl Step for Std { // with -Zalways-encode-mir. This frees us from the need to have a target linker, and the // fact that this is a check build integrates nicely with run_cargo. let mut cargo = if self.is_for_mir_opt_tests { + trace!("building special sysroot for mir-opt tests"); let mut cargo = builder::Cargo::new_for_mir_opt_tests( builder, compiler, @@ -222,6 +267,7 @@ impl Step for Std { cargo.arg("--manifest-path").arg(builder.src.join("library/sysroot/Cargo.toml")); cargo } else { + trace!("building regular sysroot"); let mut cargo = builder::Cargo::new( builder, compiler, @@ -665,6 +711,19 @@ impl Step for StdLink { /// Note that this assumes that `compiler` has already generated the libstd /// libraries for `target`, and this method will find them in the relevant /// output directory. + #[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "StdLink::run", + skip_all, + fields( + compiler = ?self.compiler, + target_compiler = ?self.target_compiler, + target = ?self.target + ), + ), + )] fn run(self, builder: &Builder<'_>) { let compiler = self.compiler; let target_compiler = self.target_compiler; @@ -822,6 +881,15 @@ impl Step for StartupObjects { /// They don't require any library support as they're just plain old object /// files, so we just use the nightly snapshot compiler to always build them (as /// no other compilers are guaranteed to be available). + #[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "StartupObjects::run", + skip_all, + fields(compiler = ?self.compiler, target = ?self.target), + ), + )] fn run(self, builder: &Builder<'_>) -> Vec<(PathBuf, DependencyType)> { let for_compiler = self.compiler; let target = self.target; @@ -936,6 +1004,15 @@ impl Step for Rustc { /// This will build the compiler for a particular stage of the build using /// the `compiler` targeting the `target` architecture. The artifacts /// created will also be linked into the sysroot directory. + #[cfg_attr( + feature = "tracing", + instrument( + level = "debug", + name = "Rustc::run", + skip_all, + fields(previous_compiler = ?self.compiler, target = ?self.target), + ), + )] fn run(self, builder: &Builder<'_>) -> u32 { let compiler = self.compiler; let target = self.target; @@ -943,6 +1020,8 @@ impl Step for Rustc { // NOTE: the ABI of the beta compiler is different from the ABI of the downloaded compiler, // so its artifacts can't be reused. if builder.download_rustc() && compiler.stage != 0 { + trace!(stage = compiler.stage, "`download_rustc` requested"); + let sysroot = builder.ensure(Sysroot { compiler, force_recompile: false }); cp_rustc_component_to_ci_sysroot( builder, @@ -955,6 +1034,8 @@ impl Step for Rustc { builder.ensure(Std::new(compiler, target)); if builder.config.keep_stage.contains(&compiler.stage) { + trace!(stage = compiler.stage, "`keep-stage` requested"); + builder.info("WARNING: Using a potentially old librustc. This may not behave well."); builder.info("WARNING: Use `--keep-stage-std` if you want to rebuild the compiler when it changes"); builder.ensure(RustcLink::from_rustc(self, compiler)); @@ -1374,6 +1455,19 @@ impl Step for RustcLink { } /// Same as `std_link`, only for librustc + #[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "RustcLink::run", + skip_all, + fields( + compiler = ?self.compiler, + previous_stage_compiler = ?self.previous_stage_compiler, + target = ?self.target, + ), + ), + )] fn run(self, builder: &Builder<'_>) { let compiler = self.compiler; let previous_stage_compiler = self.previous_stage_compiler; @@ -1462,6 +1556,19 @@ impl Step for CodegenBackend { } } + #[cfg_attr( + feature = "tracing", + instrument( + level = "debug", + name = "CodegenBackend::run", + skip_all, + fields( + compiler = ?self.compiler, + target = ?self.target, + backend = ?self.target, + ), + ), + )] fn run(self, builder: &Builder<'_>) { let compiler = self.compiler; let target = self.target; @@ -1470,6 +1577,7 @@ impl Step for CodegenBackend { builder.ensure(Rustc::new(compiler, target)); if builder.config.keep_stage.contains(&compiler.stage) { + trace!("`keep-stage` requested"); builder.info( "WARNING: Using a potentially old codegen backend. \ This may not behave well.", @@ -1617,6 +1725,15 @@ impl Step for Sysroot { /// Returns the sysroot that `compiler` is supposed to use. /// For the stage0 compiler, this is stage0-sysroot (because of the initial std build). /// For all other stages, it's the same stage directory that the compiler lives in. + #[cfg_attr( + feature = "tracing", + instrument( + level = "debug", + name = "Sysroot::run", + skip_all, + fields(compiler = ?self.compiler), + ), + )] fn run(self, builder: &Builder<'_>) -> PathBuf { let compiler = self.compiler; let host_dir = builder.out.join(compiler.host); @@ -1633,6 +1750,7 @@ impl Step for Sysroot { } }; let sysroot = sysroot_dir(compiler.stage); + trace!(stage = ?compiler.stage, ?sysroot); builder .verbose(|| println!("Removing sysroot {} to avoid caching bugs", sysroot.display())); @@ -1787,10 +1905,20 @@ impl Step for Assemble { /// This will assemble a compiler in `build/$host/stage$stage`. The compiler /// must have been previously produced by the `stage - 1` builder.build /// compiler. + #[cfg_attr( + feature = "tracing", + instrument( + level = "debug", + name = "Assemble::run", + skip_all, + fields(target_compiler = ?self.target_compiler), + ), + )] fn run(self, builder: &Builder<'_>) -> Compiler { let target_compiler = self.target_compiler; if target_compiler.stage == 0 { + trace!("stage 0 build compiler is always available, simply returning"); assert_eq!( builder.config.build, target_compiler.host, "Cannot obtain compiler for non-native build triple at stage 0" @@ -1806,9 +1934,13 @@ impl Step for Assemble { t!(fs::create_dir_all(&libdir_bin)); if builder.config.llvm_enabled(target_compiler.host) { + trace!("target_compiler.host" = ?target_compiler.host, "LLVM enabled"); + let llvm::LlvmResult { llvm_config, .. } = builder.ensure(llvm::Llvm { target: target_compiler.host }); if !builder.config.dry_run() && builder.config.llvm_tools_enabled { + trace!("LLVM tools enabled"); + let llvm_bin_dir = command(llvm_config).arg("--bindir").run_capture_stdout(builder).stdout(); let llvm_bin_dir = Path::new(llvm_bin_dir.trim()); @@ -1818,7 +1950,13 @@ impl Step for Assemble { // rustup, and lets developers use a locally built toolchain to // build projects that expect llvm tools to be present in the sysroot // (e.g. the `bootimage` crate). + + #[cfg(feature = "tracing")] + let _llvm_tools_span = + span!(tracing::Level::TRACE, "installing llvm tools to sysroot", ?libdir_bin) + .entered(); for tool in LLVM_TOOLS { + trace!("installing `{tool}`"); let tool_exe = exe(tool, target_compiler.host); let src_path = llvm_bin_dir.join(&tool_exe); // When using `download-ci-llvm`, some of the tools @@ -1838,6 +1976,7 @@ impl Step for Assemble { let maybe_install_llvm_bitcode_linker = |compiler| { if builder.config.llvm_bitcode_linker_enabled { + trace!("llvm-bitcode-linker enabled, installing"); let src_path = builder.ensure(crate::core::build_steps::tool::LlvmBitcodeLinker { compiler, target: target_compiler.host, @@ -1850,6 +1989,8 @@ impl Step for Assemble { // If we're downloading a compiler from CI, we can use the same compiler for all stages other than 0. if builder.download_rustc() { + trace!("`download-rustc` requested, reusing CI compiler for stage > 0"); + builder.ensure(Std::new(target_compiler, target_compiler.host)); let sysroot = builder.ensure(Sysroot { compiler: target_compiler, force_recompile: false }); @@ -1879,16 +2020,17 @@ impl Step for Assemble { // // FIXME: It may be faster if we build just a stage 1 compiler and then // use that to bootstrap this compiler forward. + debug!( + "ensuring build compiler is available: compiler(stage = {}, host = {:?})", + target_compiler.stage - 1, + builder.config.build, + ); let mut build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build); // Build enzyme - let enzyme_install = if builder.config.llvm_enzyme { - Some(builder.ensure(llvm::Enzyme { target: build_compiler.host })) - } else { - None - }; - - if let Some(enzyme_install) = enzyme_install { + if builder.config.llvm_enzyme { + debug!("`llvm_enzyme` requested"); + let enzyme_install = builder.ensure(llvm::Enzyme { target: build_compiler.host }); let lib_ext = std::env::consts::DLL_EXTENSION; let src_lib = enzyme_install.join("build/Enzyme/libEnzyme-19").with_extension(lib_ext); let libdir = builder.sysroot_target_libdir(build_compiler, build_compiler.host); @@ -1905,13 +2047,27 @@ impl Step for Assemble { // link to these. (FIXME: Is that correct? It seems to be correct most // of the time but I think we do link to these for stage2/bin compilers // when not performing a full bootstrap). + debug!( + ?build_compiler, + "target_compiler.host" = ?target_compiler.host, + "building compiler libraries to link to" + ); let actual_stage = builder.ensure(Rustc::new(build_compiler, target_compiler.host)); // Current build_compiler.stage might be uplifted instead of being built; so update it // to not fail while linking the artifacts. + debug!( + "(old) build_compiler.stage" = build_compiler.stage, + "(adjusted) build_compiler.stage" = actual_stage, + "temporarily adjusting `build_compiler.stage` to account for uplifted libraries" + ); build_compiler.stage = actual_stage; + #[cfg(feature = "tracing")] + let _codegen_backend_span = + span!(tracing::Level::DEBUG, "building requested codegen backends").entered(); for backend in builder.config.codegen_backends(target_compiler.host) { if backend == "llvm" { + debug!("llvm codegen backend is already built as part of rustc"); continue; // Already built as part of rustc } @@ -1921,6 +2077,8 @@ impl Step for Assemble { backend: backend.clone(), }); } + #[cfg(feature = "tracing")] + drop(_codegen_backend_span); let stage = target_compiler.stage; let host = target_compiler.host; @@ -1980,6 +2138,7 @@ impl Step for Assemble { } } + debug!("copying codegen backends to sysroot"); copy_codegen_backends_to_sysroot(builder, build_compiler, target_compiler); if builder.config.lld_enabled { @@ -1990,6 +2149,11 @@ impl Step for Assemble { } if builder.config.llvm_enabled(target_compiler.host) && builder.config.llvm_tools_enabled { + debug!( + "llvm and llvm tools enabled; copying `llvm-objcopy` as `rust-objcopy` to \ + workaround faulty homebrew `strip`s" + ); + // `llvm-strip` is used by rustc, which is actually just a symlink to `llvm-objcopy`, so // copy and rename `llvm-objcopy`. // @@ -2022,6 +2186,11 @@ impl Step for Assemble { // Ensure that `libLLVM.so` ends up in the newly build compiler directory, // so that it can be found when the newly built `rustc` is run. + debug!( + "target_compiler.host" = ?target_compiler.host, + ?sysroot, + "ensuring availability of `libLLVM.so` in compiler directory" + ); dist::maybe_install_llvm_runtime(builder, target_compiler.host, &sysroot); dist::maybe_install_llvm_target(builder, target_compiler.host, &sysroot); @@ -2031,6 +2200,7 @@ impl Step for Assemble { let bindir = sysroot.join("bin"); t!(fs::create_dir_all(bindir)); let compiler = builder.rustc(target_compiler); + debug!(src = ?rustc, dst = ?compiler, "linking compiler binary itself"); builder.copy_link(&rustc, &compiler); target_compiler @@ -2315,7 +2485,7 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path) // FIXME: to make things simpler for now, limit this to the host and target where we know // `strip -g` is both available and will fix the issue, i.e. on a x64 linux host that is not // cross-compiling. Expand this to other appropriate targets in the future. - if target != "x86_64-unknown-linux-gnu" || !builder.is_builder_target(&target) || !path.exists() + if target != "x86_64-unknown-linux-gnu" || !builder.is_builder_target(target) || !path.exists() { return; } diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index ae3761a97e5..509ee9e1acf 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -16,6 +16,8 @@ use std::{env, fs}; use object::BinaryFormat; use object::read::archive::ArchiveFile; +#[cfg(feature = "tracing")] +use tracing::instrument; use crate::core::build_steps::doc::DocumentationFormat; use crate::core::build_steps::tool::{self, Tool}; @@ -30,7 +32,7 @@ use crate::utils::helpers::{ exe, is_dylib, move_file, t, target_supports_cranelift_backend, timeit, }; use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball}; -use crate::{Compiler, DependencyType, LLVM_TOOLS, Mode}; +use crate::{Compiler, DependencyType, LLVM_TOOLS, Mode, trace}; pub fn pkgname(builder: &Builder<'_>, component: &str) -> String { format!("{}-{}", component, builder.rust_package_vers()) @@ -582,7 +584,7 @@ impl Step for DebuggerScripts { fn skip_host_target_lib(builder: &Builder<'_>, compiler: Compiler) -> bool { // The only true set of target libraries came from the build triple, so // let's reduce redundant work by only producing archives from that host. - if !builder.is_builder_target(&compiler.host) { + if !builder.is_builder_target(compiler.host) { builder.info("\tskipping, not a build host"); true } else { @@ -637,7 +639,7 @@ fn copy_target_libs( for (path, dependency_type) in builder.read_stamp_file(stamp) { if dependency_type == DependencyType::TargetSelfContained { builder.copy_link(&path, &self_contained_dst.join(path.file_name().unwrap())); - } else if dependency_type == DependencyType::Target || builder.is_builder_target(&target) { + } else if dependency_type == DependencyType::Target || builder.is_builder_target(target) { builder.copy_link(&path, &dst.join(path.file_name().unwrap())); } } @@ -786,7 +788,7 @@ impl Step for Analysis { fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> { let compiler = self.compiler; let target = self.target; - if !builder.is_builder_target(&compiler.host) { + if !builder.is_builder_target(compiler.host) { return None; } @@ -2029,6 +2031,15 @@ fn install_llvm_file( /// Maybe add LLVM object files to the given destination lib-dir. Allows either static or dynamic linking. /// /// Returns whether the files were actually copied. +#[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "maybe_install_llvm", + skip_all, + fields(target = ?target, dst_libdir = ?dst_libdir, install_symlink = install_symlink), + ), +)] fn maybe_install_llvm( builder: &Builder<'_>, target: TargetSelection, @@ -2052,6 +2063,7 @@ fn maybe_install_llvm( // If the LLVM is coming from ourselves (just from CI) though, we // still want to install it, as it otherwise won't be available. if builder.is_system_llvm(target) { + trace!("system LLVM requested, no install"); return false; } @@ -2070,6 +2082,7 @@ fn maybe_install_llvm( } else if let llvm::LlvmBuildStatus::AlreadyBuilt(llvm::LlvmResult { llvm_config, .. }) = llvm::prebuilt_llvm_config(builder, target, true) { + trace!("LLVM already built, installing LLVM files"); let mut cmd = command(llvm_config); cmd.arg("--libfiles"); builder.verbose(|| println!("running {cmd:?}")); @@ -2092,6 +2105,19 @@ fn maybe_install_llvm( } /// Maybe add libLLVM.so to the target lib-dir for linking. +#[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "maybe_install_llvm_target", + skip_all, + fields( + llvm_link_shared = ?builder.llvm_link_shared(), + target = ?target, + sysroot = ?sysroot, + ), + ), +)] pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) { let dst_libdir = sysroot.join("lib/rustlib").join(target).join("lib"); // We do not need to copy LLVM files into the sysroot if it is not @@ -2103,6 +2129,19 @@ pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection, } /// Maybe add libLLVM.so to the runtime lib-dir for rustc itself. +#[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "maybe_install_llvm_runtime", + skip_all, + fields( + llvm_link_shared = ?builder.llvm_link_shared(), + target = ?target, + sysroot = ?sysroot, + ), + ), +)] pub fn maybe_install_llvm_runtime(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) { let dst_libdir = sysroot.join(builder.sysroot_libdir_relative(Compiler { stage: 1, host: target })); diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index dedcc139ae1..23bb47dcc58 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -572,10 +572,7 @@ impl Step for Std { fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { let builder = run.builder; - run.crate_or_deps("sysroot") - .path("library") - .alias("core") - .default_condition(builder.config.docs) + run.crate_or_deps("sysroot").path("library").default_condition(builder.config.docs) } fn make_run(run: RunConfig<'_>) { diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 18da0e8252b..3025f955660 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -16,6 +16,8 @@ use std::{env, fs}; use build_helper::ci::CiEnv; use build_helper::git::get_closest_merge_commit; +#[cfg(feature = "tracing")] +use tracing::instrument; use crate::core::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::core::config::{Config, TargetSelection}; @@ -24,7 +26,7 @@ use crate::utils::exec::command; use crate::utils::helpers::{ self, exe, get_clang_cl_resource_dir, t, unhashed_basename, up_to_date, }; -use crate::{CLang, GitRepo, Kind}; +use crate::{CLang, GitRepo, Kind, trace}; #[derive(Clone)] pub struct LlvmResult { @@ -516,7 +518,7 @@ impl Step for Llvm { } // https://llvm.org/docs/HowToCrossCompileLLVM.html - if !builder.is_builder_target(&target) { + if !builder.is_builder_target(target) { let LlvmResult { llvm_config, .. } = builder.ensure(Llvm { target: builder.config.build }); if !builder.config.dry_run() { @@ -668,7 +670,7 @@ fn configure_cmake( } cfg.target(&target.triple).host(&builder.config.build.triple); - if !builder.is_builder_target(&target) { + if !builder.is_builder_target(target) { cfg.define("CMAKE_CROSSCOMPILING", "True"); if target.contains("netbsd") { @@ -934,6 +936,15 @@ impl Step for Enzyme { } /// Compile Enzyme for `target`. + #[cfg_attr( + feature = "tracing", + instrument( + level = "debug", + name = "Enzyme::run", + skip_all, + fields(target = ?self.target), + ), + )] fn run(self, builder: &Builder<'_>) -> PathBuf { builder.require_submodule( "src/tools/enzyme", @@ -959,7 +970,9 @@ impl Step for Enzyme { let out_dir = builder.enzyme_out(target); let stamp = BuildStamp::new(&out_dir).with_prefix("enzyme").add_stamp(smart_stamp_hash); + trace!("checking build stamp to see if we need to rebuild enzyme artifacts"); if stamp.is_up_to_date() { + trace!(?out_dir, "enzyme build artifacts are up to date"); if stamp.stamp().is_empty() { builder.info( "Could not determine the Enzyme submodule commit hash. \ @@ -973,6 +986,7 @@ impl Step for Enzyme { return out_dir; } + trace!(?target, "(re)building enzyme artifacts"); builder.info(&format!("Building Enzyme for {}", target)); t!(stamp.remove()); let _time = helpers::timeit(builder); @@ -994,6 +1008,7 @@ impl Step for Enzyme { (true, false) => "Release", (true, true) => "RelWithDebInfo", }; + trace!(?profile); cfg.out_dir(&out_dir) .profile(profile) @@ -1118,7 +1133,7 @@ impl Step for Lld { .define("LLVM_CMAKE_DIR", llvm_cmake_dir) .define("LLVM_INCLUDE_TESTS", "OFF"); - if !builder.is_builder_target(&target) { + if !builder.is_builder_target(target) { // Use the host llvm-tblgen binary. cfg.define( "LLVM_TABLEGEN_EXE", diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 26ed0e5deaa..b3f4a7bad99 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2743,7 +2743,7 @@ impl Step for Crate { cargo } else { // Also prepare a sysroot for the target. - if !builder.is_builder_target(&target) { + if !builder.is_builder_target(target) { builder.ensure(compile::Std::new(compiler, target).force_recompile(true)); builder.ensure(RemoteCopyLibs { compiler, target }); } diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 1291a634a6f..a54db9d7815 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -1,6 +1,9 @@ use std::path::PathBuf; use std::{env, fs}; +#[cfg(feature = "tracing")] +use tracing::instrument; + use crate::core::build_steps::compile::is_lto_stage; use crate::core::build_steps::toolstate::ToolState; use crate::core::build_steps::{compile, llvm}; @@ -304,6 +307,14 @@ macro_rules! bootstrap_tool { }); } + #[cfg_attr( + feature = "tracing", + instrument( + level = "debug", + name = $tool_name, + skip_all, + ), + )] fn run(self, builder: &Builder<'_>) -> PathBuf { $( for submodule in $submodules { @@ -758,6 +769,15 @@ impl Step for LldWrapper { run.never() } + #[cfg_attr( + feature = "tracing", + instrument( + level = "debug", + name = "LldWrapper::run", + skip_all, + fields(build_compiler = ?self.build_compiler, target_compiler = ?self.target_compiler), + ), + )] fn run(self, builder: &Builder<'_>) { if builder.config.dry_run() { return; @@ -914,6 +934,10 @@ impl Step for LlvmBitcodeLinker { }); } + #[cfg_attr( + feature = "tracing", + instrument(level = "debug", name = "LlvmBitcodeLinker::run", skip_all) + )] fn run(self, builder: &Builder<'_>) -> PathBuf { let bin_name = "llvm-bitcode-linker"; diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index ecec589fc32..daef8fa3c8a 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -10,6 +10,8 @@ use std::time::{Duration, Instant}; use std::{env, fs}; use clap::ValueEnum; +#[cfg(feature = "tracing")] +use tracing::instrument; pub use self::cargo::{Cargo, cargo_profile_var}; pub use crate::Compiler; @@ -21,7 +23,7 @@ use crate::core::config::{DryRun, TargetSelection}; use crate::utils::cache::Cache; use crate::utils::exec::{BootstrapCommand, command}; use crate::utils::helpers::{self, LldThreads, add_dylib_path, exe, libdir, linker_args, t}; -use crate::{Build, Crate}; +use crate::{Build, Crate, trace}; mod cargo; @@ -127,10 +129,14 @@ impl RunConfig<'_> { pub fn cargo_crates_in_set(&self) -> Vec<String> { let mut crates = Vec::new(); for krate in &self.paths { - let path = krate.assert_single_path(); - let Some(crate_name) = self.builder.crate_paths.get(&path.path) else { - panic!("missing crate for path {}", path.path.display()) - }; + let path = &krate.assert_single_path().path; + + let crate_name = self + .builder + .crate_paths + .get(path) + .unwrap_or_else(|| panic!("missing crate for path {}", path.display())); + crates.push(crate_name.to_string()); } crates @@ -1214,6 +1220,19 @@ impl<'a> Builder<'a> { /// compiler will run on, *not* the target it will build code for). Explicitly does not take /// `Compiler` since all `Compiler` instances are meant to be obtained through this function, /// since it ensures that they are valid (i.e., built and assembled). + #[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "Builder::compiler", + target = "COMPILER", + skip_all, + fields( + stage = stage, + host = ?host, + ), + ), + )] pub fn compiler(&self, stage: u32, host: TargetSelection) -> Compiler { self.ensure(compile::Assemble { target_compiler: Compiler { stage, host } }) } @@ -1229,19 +1248,39 @@ impl<'a> Builder<'a> { /// sysroot. /// /// See `force_use_stage1` and `force_use_stage2` for documentation on what each argument is. + #[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "Builder::compiler_for", + target = "COMPILER_FOR", + skip_all, + fields( + stage = stage, + host = ?host, + target = ?target, + ), + ), + )] pub fn compiler_for( &self, stage: u32, host: TargetSelection, target: TargetSelection, ) -> Compiler { - if self.build.force_use_stage2(stage) { + #![allow(clippy::let_and_return)] + let resolved_compiler = if self.build.force_use_stage2(stage) { + trace!(target: "COMPILER_FOR", ?stage, "force_use_stage2"); self.compiler(2, self.config.build) } else if self.build.force_use_stage1(stage, target) { + trace!(target: "COMPILER_FOR", ?stage, "force_use_stage1"); self.compiler(1, self.config.build) } else { + trace!(target: "COMPILER_FOR", ?stage, ?host, "no force, fallback to `compiler()`"); self.compiler(stage, host) - } + }; + trace!(target: "COMPILER_FOR", ?resolved_compiler); + resolved_compiler } pub fn sysroot(&self, compiler: Compiler) -> PathBuf { diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index a0be474ca3e..445b5dfbeab 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1051,19 +1051,22 @@ fn test_prebuilt_llvm_config_path_resolution() { "#, ); - let build = Build::new(config.clone()); - let builder = Builder::new(&build); + // CI-LLVM isn't always available; check if it's enabled before testing. + if config.llvm_from_ci { + let build = Build::new(config.clone()); + let builder = Builder::new(&build); - let actual = prebuilt_llvm_config(&builder, builder.config.build, false) - .llvm_result() - .llvm_config - .clone(); - let expected = builder - .out - .join(builder.config.build) - .join("ci-llvm/bin") - .join(exe("llvm-config", builder.config.build)); - assert_eq!(expected, actual); + let actual = prebuilt_llvm_config(&builder, builder.config.build, false) + .llvm_result() + .llvm_config + .clone(); + let expected = builder + .out + .join(builder.config.build) + .join("ci-llvm/bin") + .join(exe("llvm-config", builder.config.build)); + assert_eq!(expected, actual); + } } #[test] @@ -1077,7 +1080,7 @@ fn test_is_builder_target() { let build = Build::new(config); let builder = Builder::new(&build); - assert!(builder.is_builder_target(&target1)); - assert!(!builder.is_builder_target(&target2)); + assert!(builder.is_builder_target(target1)); + assert!(!builder.is_builder_target(target2)); } } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 62625fc3660..d27a8b155df 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -2747,6 +2747,15 @@ impl Config { /// tarball). Typically [`crate::Build::require_submodule`] should be /// used instead to provide a nice error to the user if the submodule is /// missing. + #[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "Config::update_submodule", + skip_all, + fields(relative_path = ?relative_path), + ), + )] pub(crate) fn update_submodule(&self, relative_path: &str) { if !self.submodules() { return; diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index 9e4a0816e0d..241b7386d18 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -329,7 +329,7 @@ than building it. if target.contains("musl") && !target.contains("unikraft") { // If this is a native target (host is also musl) and no musl-root is given, // fall back to the system toolchain in /usr before giving up - if build.musl_root(*target).is_none() && build.is_builder_target(target) { + if build.musl_root(*target).is_none() && build.is_builder_target(*target) { let target = build.config.target_config.entry(*target).or_default(); target.musl_root = Some("/usr".into()); } diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 7cd8aacf0d6..62ddc7d682e 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -469,6 +469,15 @@ impl Build { /// /// The given `err_hint` will be shown to the user if the submodule is not /// checked out and submodule management is disabled. + #[cfg_attr( + feature = "tracing", + instrument( + level = "trace", + name = "Build::require_submodule", + skip_all, + fields(submodule = submodule), + ), + )] pub fn require_submodule(&self, submodule: &str, err_hint: Option<&str>) { // When testing bootstrap itself, it is much faster to ignore // submodules. Almost all Steps work fine without their submodules. @@ -739,7 +748,7 @@ impl Build { /// Note that if LLVM is configured externally then the directory returned /// will likely be empty. fn llvm_out(&self, target: TargetSelection) -> PathBuf { - if self.config.llvm_from_ci && self.is_builder_target(&target) { + if self.config.llvm_from_ci && self.is_builder_target(target) { self.config.ci_llvm_root() } else { self.out.join(target).join("llvm") @@ -789,7 +798,7 @@ impl Build { fn is_system_llvm(&self, target: TargetSelection) -> bool { match self.config.target_config.get(&target) { Some(Target { llvm_config: Some(_), .. }) => { - let ci_llvm = self.config.llvm_from_ci && self.is_builder_target(&target); + let ci_llvm = self.config.llvm_from_ci && self.is_builder_target(target); !ci_llvm } // We're building from the in-tree src/llvm-project sources. @@ -1277,7 +1286,7 @@ Executed at: {executed_at}"#, // need to use CXX compiler as linker to resolve the exception functions // that are only existed in CXX libraries Some(self.cxx.borrow()[&target].path().into()) - } else if !self.is_builder_target(&target) + } else if !self.is_builder_target(target) && helpers::use_host_linker(target) && !target.is_msvc() { @@ -1930,8 +1939,8 @@ to download LLVM rather than building it. } /// Checks if the given target is the same as the builder target. - fn is_builder_target(&self, target: &TargetSelection) -> bool { - &self.config.build == target + fn is_builder_target(&self, target: TargetSelection) -> bool { + self.config.build == target } } diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs index 45797c1276c..1e84a7deff1 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs @@ -29,6 +29,7 @@ use crate::core::config::TargetSelection; use crate::utils::exec::{BootstrapCommand, command}; use crate::{Build, CLang, GitRepo}; +/// Finds archiver tool for the given target if possible. /// FIXME(onur-ozkan): This logic should be replaced by calling into the `cc` crate. fn cc2ar(cc: &Path, target: TargetSelection, default_ar: PathBuf) -> Option<PathBuf> { if let Some(ar) = env::var_os(format!("AR_{}", target.triple.replace('-', "_"))) { @@ -58,6 +59,7 @@ fn cc2ar(cc: &Path, target: TargetSelection, default_ar: PathBuf) -> Option<Path } } +/// Creates and configures a new [`cc::Build`] instance for the given target. fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build { let mut cfg = cc::Build::new(); cfg.cargo_metadata(false) @@ -84,6 +86,12 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build { cfg } +/// Probes for C and C++ compilers and configures the corresponding entries in the [`Build`] +/// structure. +/// +/// This function determines which targets need a C compiler (and, if needed, a C++ compiler) +/// by combining the primary build target, host targets, and any additional targets. For +/// each target, it calls [`find_target`] to configure the necessary compiler tools. pub fn find(build: &Build) { let targets: HashSet<_> = match build.config.cmd { // We don't need to check cross targets for these commands. @@ -112,6 +120,11 @@ pub fn find(build: &Build) { } } +/// Probes and configures the C and C++ compilers for a single target. +/// +/// This function uses both user-specified configuration (from `config.toml`) and auto-detection +/// logic to determine the correct C/C++ compilers for the target. It also determines the appropriate +/// archiver (`ar`) and sets up additional compilation flags (both handled and unhandled). pub fn find_target(build: &Build, target: TargetSelection) { let mut cfg = new_cc_build(build, target); let config = build.config.target_config.get(&target); @@ -172,6 +185,8 @@ pub fn find_target(build: &Build, target: TargetSelection) { } } +/// Determines the default compiler for a given target and language when not explicitly +/// configured in `config.toml`. fn default_compiler( cfg: &mut cc::Build, compiler: Language, @@ -248,6 +263,12 @@ fn default_compiler( } } +/// Constructs the path to the Android NDK compiler for the given target triple and language. +/// +/// This helper function transform the target triple by converting certain architecture names +/// (for example, translating "arm" to "arm7a"), appends the minimum API level (hardcoded as "21" +/// for NDK r26d), and then constructs the full path based on the provided NDK directory and host +/// platform. pub(crate) fn ndk_compiler(compiler: Language, triple: &str, ndk: &Path) -> PathBuf { let mut triple_iter = triple.split('-'); let triple_translated = if let Some(arch) = triple_iter.next() { @@ -277,7 +298,11 @@ pub(crate) fn ndk_compiler(compiler: Language, triple: &str, ndk: &Path) -> Path ndk.join("toolchains").join("llvm").join("prebuilt").join(host_tag).join("bin").join(compiler) } -/// The target programming language for a native compiler. +/// Representing the target programming language for a native compiler. +/// +/// This enum is used to indicate whether a particular compiler is intended for C or C++. +/// It also provides helper methods for obtaining the standard executable names for GCC and +/// clang-based compilers. #[derive(PartialEq)] pub(crate) enum Language { /// The compiler is targeting C. @@ -287,7 +312,7 @@ pub(crate) enum Language { } impl Language { - /// Obtains the name of a compiler in the GCC collection. + /// Returns the executable name for a GCC compiler corresponding to this language. fn gcc(self) -> &'static str { match self { Language::C => "gcc", @@ -295,7 +320,7 @@ impl Language { } } - /// Obtains the name of a compiler in the clang suite. + /// Returns the executable name for a clang-based compiler corresponding to this language. fn clang(self) -> &'static str { match self { Language::C => "clang", @@ -303,3 +328,6 @@ impl Language { } } } + +#[cfg(test)] +mod tests; diff --git a/src/bootstrap/src/utils/cc_detect/tests.rs b/src/bootstrap/src/utils/cc_detect/tests.rs new file mode 100644 index 00000000000..006dfe7e5d7 --- /dev/null +++ b/src/bootstrap/src/utils/cc_detect/tests.rs @@ -0,0 +1,254 @@ +use std::path::{Path, PathBuf}; +use std::{env, iter}; + +use super::*; +use crate::core::config::{Target, TargetSelection}; +use crate::{Build, Config, Flags}; + +#[test] +fn test_cc2ar_env_specific() { + let triple = "x86_64-unknown-linux-gnu"; + let key = "AR_x86_64_unknown_linux_gnu"; + env::set_var(key, "custom-ar"); + let target = TargetSelection::from_user(triple); + let cc = Path::new("/usr/bin/clang"); + let default_ar = PathBuf::from("default-ar"); + let result = cc2ar(cc, target, default_ar); + env::remove_var(key); + assert_eq!(result, Some(PathBuf::from("custom-ar"))); +} + +#[test] +fn test_cc2ar_musl() { + let triple = "x86_64-unknown-linux-musl"; + env::remove_var("AR_x86_64_unknown_linux_musl"); + env::remove_var("AR"); + let target = TargetSelection::from_user(triple); + let cc = Path::new("/usr/bin/clang"); + let default_ar = PathBuf::from("default-ar"); + let result = cc2ar(cc, target, default_ar); + assert_eq!(result, Some(PathBuf::from("ar"))); +} + +#[test] +fn test_cc2ar_openbsd() { + let triple = "x86_64-unknown-openbsd"; + env::remove_var("AR_x86_64_unknown_openbsd"); + env::remove_var("AR"); + let target = TargetSelection::from_user(triple); + let cc = Path::new("/usr/bin/cc"); + let default_ar = PathBuf::from("default-ar"); + let result = cc2ar(cc, target, default_ar); + assert_eq!(result, Some(PathBuf::from("ar"))); +} + +#[test] +fn test_cc2ar_vxworks() { + let triple = "armv7-wrs-vxworks"; + env::remove_var("AR_armv7_wrs_vxworks"); + env::remove_var("AR"); + let target = TargetSelection::from_user(triple); + let cc = Path::new("/usr/bin/clang"); + let default_ar = PathBuf::from("default-ar"); + let result = cc2ar(cc, target, default_ar); + assert_eq!(result, Some(PathBuf::from("wr-ar"))); +} + +#[test] +fn test_cc2ar_nto_i586() { + let triple = "i586-unknown-nto-something"; + env::remove_var("AR_i586_unknown_nto_something"); + env::remove_var("AR"); + let target = TargetSelection::from_user(triple); + let cc = Path::new("/usr/bin/clang"); + let default_ar = PathBuf::from("default-ar"); + let result = cc2ar(cc, target, default_ar); + assert_eq!(result, Some(PathBuf::from("ntox86-ar"))); +} + +#[test] +fn test_cc2ar_nto_aarch64() { + let triple = "aarch64-unknown-nto-something"; + env::remove_var("AR_aarch64_unknown_nto_something"); + env::remove_var("AR"); + let target = TargetSelection::from_user(triple); + let cc = Path::new("/usr/bin/clang"); + let default_ar = PathBuf::from("default-ar"); + let result = cc2ar(cc, target, default_ar); + assert_eq!(result, Some(PathBuf::from("ntoaarch64-ar"))); +} + +#[test] +fn test_cc2ar_nto_x86_64() { + let triple = "x86_64-unknown-nto-something"; + env::remove_var("AR_x86_64_unknown_nto_something"); + env::remove_var("AR"); + let target = TargetSelection::from_user(triple); + let cc = Path::new("/usr/bin/clang"); + let default_ar = PathBuf::from("default-ar"); + let result = cc2ar(cc, target, default_ar); + assert_eq!(result, Some(PathBuf::from("ntox86_64-ar"))); +} + +#[test] +#[should_panic(expected = "Unknown architecture, cannot determine archiver for Neutrino QNX")] +fn test_cc2ar_nto_unknown() { + let triple = "powerpc-unknown-nto-something"; + env::remove_var("AR_powerpc_unknown_nto_something"); + env::remove_var("AR"); + let target = TargetSelection::from_user(triple); + let cc = Path::new("/usr/bin/clang"); + let default_ar = PathBuf::from("default-ar"); + let _ = cc2ar(cc, target, default_ar); +} + +#[test] +fn test_ndk_compiler_c() { + let ndk_path = PathBuf::from("/ndk"); + let target_triple = "arm-unknown-linux-android"; + let expected_triple_translated = "armv7a-unknown-linux-android"; + let expected_compiler = format!("{}21-{}", expected_triple_translated, Language::C.clang()); + let host_tag = if cfg!(target_os = "macos") { + "darwin-x86_64" + } else if cfg!(target_os = "windows") { + "windows-x86_64" + } else { + "linux-x86_64" + }; + let expected_path = ndk_path + .join("toolchains") + .join("llvm") + .join("prebuilt") + .join(host_tag) + .join("bin") + .join(&expected_compiler); + let result = ndk_compiler(Language::C, target_triple, &ndk_path); + assert_eq!(result, expected_path); +} + +#[test] +fn test_ndk_compiler_cpp() { + let ndk_path = PathBuf::from("/ndk"); + let target_triple = "arm-unknown-linux-android"; + let expected_triple_translated = "armv7a-unknown-linux-android"; + let expected_compiler = + format!("{}21-{}", expected_triple_translated, Language::CPlusPlus.clang()); + let host_tag = if cfg!(target_os = "macos") { + "darwin-x86_64" + } else if cfg!(target_os = "windows") { + "windows-x86_64" + } else { + "linux-x86_64" + }; + let expected_path = ndk_path + .join("toolchains") + .join("llvm") + .join("prebuilt") + .join(host_tag) + .join("bin") + .join(&expected_compiler); + let result = ndk_compiler(Language::CPlusPlus, target_triple, &ndk_path); + assert_eq!(result, expected_path); +} + +#[test] +fn test_language_gcc() { + assert_eq!(Language::C.gcc(), "gcc"); + assert_eq!(Language::CPlusPlus.gcc(), "g++"); +} + +#[test] +fn test_language_clang() { + assert_eq!(Language::C.clang(), "clang"); + assert_eq!(Language::CPlusPlus.clang(), "clang++"); +} + +#[test] +fn test_new_cc_build() { + let build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) }); + let target = TargetSelection::from_user("x86_64-unknown-linux-gnu"); + let cfg = new_cc_build(&build, target.clone()); + let compiler = cfg.get_compiler(); + assert!(!compiler.path().to_str().unwrap().is_empty(), "Compiler path should not be empty"); +} + +#[test] +fn test_default_compiler_wasi() { + let build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) }); + let target = TargetSelection::from_user("wasm32-wasi"); + let wasi_sdk = PathBuf::from("/wasi-sdk"); + env::set_var("WASI_SDK_PATH", &wasi_sdk); + let mut cfg = cc::Build::new(); + if let Some(result) = default_compiler(&mut cfg, Language::C, target.clone(), &build) { + let expected = { + let compiler = format!("{}-clang", target.triple); + wasi_sdk.join("bin").join(compiler) + }; + assert_eq!(result, expected); + } else { + panic!( + "default_compiler should return a compiler path for wasi target when WASI_SDK_PATH is set" + ); + } + env::remove_var("WASI_SDK_PATH"); +} + +#[test] +fn test_default_compiler_fallback() { + let build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) }); + let target = TargetSelection::from_user("x86_64-unknown-linux-gnu"); + let mut cfg = cc::Build::new(); + let result = default_compiler(&mut cfg, Language::C, target, &build); + assert!(result.is_none(), "default_compiler should return None for generic targets"); +} + +#[test] +fn test_find_target_with_config() { + let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) }); + let target = TargetSelection::from_user("x86_64-unknown-linux-gnu"); + let mut target_config = Target::default(); + target_config.cc = Some(PathBuf::from("dummy-cc")); + target_config.cxx = Some(PathBuf::from("dummy-cxx")); + target_config.ar = Some(PathBuf::from("dummy-ar")); + target_config.ranlib = Some(PathBuf::from("dummy-ranlib")); + build.config.target_config.insert(target.clone(), target_config); + find_target(&build, target.clone()); + let binding = build.cc.borrow(); + let cc_tool = binding.get(&target).unwrap(); + assert_eq!(cc_tool.path(), &PathBuf::from("dummy-cc")); + let binding = build.cxx.borrow(); + let cxx_tool = binding.get(&target).unwrap(); + assert_eq!(cxx_tool.path(), &PathBuf::from("dummy-cxx")); + let binding = build.ar.borrow(); + let ar = binding.get(&target).unwrap(); + assert_eq!(ar, &PathBuf::from("dummy-ar")); + let binding = build.ranlib.borrow(); + let ranlib = binding.get(&target).unwrap(); + assert_eq!(ranlib, &PathBuf::from("dummy-ranlib")); +} + +#[test] +fn test_find_target_without_config() { + let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) }); + let target = TargetSelection::from_user("x86_64-unknown-linux-gnu"); + build.config.target_config.clear(); + find_target(&build, target.clone()); + assert!(build.cc.borrow().contains_key(&target)); + if !target.triple.contains("vxworks") { + assert!(build.cxx.borrow().contains_key(&target)); + } + assert!(build.ar.borrow().contains_key(&target)); +} + +#[test] +fn test_find() { + let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) }); + let target1 = TargetSelection::from_user("x86_64-unknown-linux-gnu"); + let target2 = TargetSelection::from_user("arm-linux-androideabi"); + build.targets.push(target1.clone()); + build.hosts.push(target2.clone()); + find(&build); + for t in build.hosts.iter().chain(build.targets.iter()).chain(iter::once(&build.build)) { + assert!(build.cc.borrow().contains_key(t), "CC not set for target {}", t.triple); + } +} diff --git a/src/ci/docker/scripts/musl.sh b/src/ci/docker/scripts/musl.sh index ece8e6c15c0..9878bec6fbe 100644 --- a/src/ci/docker/scripts/musl.sh +++ b/src/ci/docker/scripts/musl.sh @@ -30,6 +30,47 @@ MUSL=musl-1.2.3 # may have been downloaded in a previous run if [ ! -d $MUSL ]; then curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf - + + # Apply patches for CVE-2025-26519. At the time of adding these patches no release containing them + # has been published by the musl project, so we just apply them directly on top of the version we + # were distributing already. The patches should be removed once we upgrade to musl >= 1.2.6. + # + # Advisory: https://www.openwall.com/lists/musl/2025/02/13/1 + # + # Patches applied: + # - https://www.openwall.com/lists/musl/2025/02/13/1/1 + # - https://www.openwall.com/lists/musl/2025/02/13/1/2 + # + # ignore-tidy-tab + # ignore-tidy-linelength + patch -p1 -d $MUSL <<EOF +--- a/src/locale/iconv.c ++++ b/src/locale/iconv.c +@@ -502,7 +502,7 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri + if (c >= 93 || d >= 94) { + c += (0xa1-0x81); + d += 0xa1; +- if (c >= 93 || c>=0xc6-0x81 && d>0x52) ++ if (c > 0xc6-0x81 || c==0xc6-0x81 && d>0x52) + goto ilseq; + if (d-'A'<26) d = d-'A'; + else if (d-'a'<26) d = d-'a'+26; +EOF + patch -p1 -d $MUSL <<EOF +--- a/src/locale/iconv.c ++++ b/src/locale/iconv.c +@@ -545,6 +545,10 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri + if (*outb < k) goto toobig; + memcpy(*out, tmp, k); + } else k = wctomb_utf8(*out, c); ++ /* This failure condition should be unreachable, but ++ * is included to prevent decoder bugs from translating ++ * into advancement outside the output buffer range. */ ++ if (k>4) goto ilseq; + *out += k; + *outb -= k; + break; +EOF fi cd $MUSL diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 729cc70cb8e..64e64867de2 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -50,7 +50,7 @@ runners: - &job-aarch64-linux # Free some disk space to avoid running out of space during the build. free_disk: true - os: ubuntu-22.04-arm + os: ubuntu-24.04-arm - &job-aarch64-linux-8c os: ubuntu-22.04-arm64-8core-32gb @@ -456,6 +456,7 @@ auto: # Windows Builders # ###################### + # x86_64-msvc is split into two jobs to run tests in parallel. - name: x86_64-msvc-1 env: RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-sanitizers --enable-profiler @@ -527,13 +528,30 @@ auto: # came from the mingw-w64 SourceForge download site. Unfortunately # SourceForge is notoriously flaky, so we mirror it on our own infrastructure. - - name: i686-mingw + # i686-mingw is split into three jobs to run tests in parallel. + - name: i686-mingw-1 env: RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu - SCRIPT: make ci-mingw + SCRIPT: make ci-mingw-x-1 # There is no dist-i686-mingw-alt, so there is no prebuilt LLVM with assertions NO_DOWNLOAD_CI_LLVM: 1 - <<: *job-windows-25-8c + <<: *job-windows-25 + + - name: i686-mingw-2 + env: + RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu + SCRIPT: make ci-mingw-x-2 + # There is no dist-i686-mingw-alt, so there is no prebuilt LLVM with assertions + NO_DOWNLOAD_CI_LLVM: 1 + <<: *job-windows-25 + + - name: i686-mingw-3 + env: + RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu + SCRIPT: make ci-mingw-bootstrap + # There is no dist-i686-mingw-alt, so there is no prebuilt LLVM with assertions + NO_DOWNLOAD_CI_LLVM: 1 + <<: *job-windows-25 # x86_64-mingw is split into two jobs to run tests in parallel. - name: x86_64-mingw-1 diff --git a/src/ci/scripts/free-disk-space.sh b/src/ci/scripts/free-disk-space.sh index 89f95c5e894..055a6ac2211 100755 --- a/src/ci/scripts/free-disk-space.sh +++ b/src/ci/scripts/free-disk-space.sh @@ -71,7 +71,6 @@ printDF() { removeUnusedFilesAndDirs() { local to_remove=( - "/etc/mysql" "/usr/local/aws-sam-cli" "/usr/local/doc/cmake" "/usr/local/julia"* @@ -151,15 +150,11 @@ execAndMeasureSpaceChange() { # Remove large packages # REF: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh cleanPackages() { - # Stop services to avoid issues when removing their packages. - sudo systemctl stop mysql - local packages=( '^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' '^mongodb-.*' - '^mysql-.*' 'azure-cli' 'firefox' 'libgl1-mesa-dri' diff --git a/src/ci/scripts/upload-artifacts.sh b/src/ci/scripts/upload-artifacts.sh index 0bc91f6ba71..975b4c52726 100755 --- a/src/ci/scripts/upload-artifacts.sh +++ b/src/ci/scripts/upload-artifacts.sh @@ -52,10 +52,15 @@ access_url="https://ci-artifacts.rust-lang.org/${deploy_dir}/$(ciCommit)" # to make them easily accessible. if [ -n "${GITHUB_STEP_SUMMARY}" ] then - echo "# CI artifacts" >> "${GITHUB_STEP_SUMMARY}" + archives=($(find "${upload_dir}" -maxdepth 1 -name "*.xz")) - for filename in "${upload_dir}"/*.xz; do - filename=$(basename "${filename}") - echo "- [${filename}](${access_url}/${filename})" >> "${GITHUB_STEP_SUMMARY}" - done + # Avoid generating an invalid "*.xz" file if there are no archives + if [ ${#archives[@]} -gt 0 ]; then + echo "# CI artifacts" >> "${GITHUB_STEP_SUMMARY}" + + for filename in "${upload_dir}"/*.xz; do + filename=$(basename "${filename}") + echo "- [${filename}](${access_url}/${filename})" >> "${GITHUB_STEP_SUMMARY}" + done + fi fi diff --git a/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs b/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs index 9fcb16b0fca..dc63e1aa511 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs @@ -75,7 +75,7 @@ impl rustc_driver::Callbacks for MyCallbacks { let item = hir_krate.item(id); // Use pattern-matching to find a specific node inside the main function. if let rustc_hir::ItemKind::Fn(_, _, body_id) = item.kind { - let expr = &tcx.hir().body(body_id).value; + let expr = &tcx.hir_body(body_id).value; if let rustc_hir::ExprKind::Block(block, _) = expr.kind { if let rustc_hir::StmtKind::Let(let_stmt) = block.stmts[0].kind { if let Some(expr) = let_stmt.init { diff --git a/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md b/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md index 04fa5b204dd..04d8e91dcb4 100644 --- a/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md +++ b/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md @@ -76,6 +76,14 @@ $ BOOTSTRAP_TRACING=CONFIG_HANDLING=TRACE ./x build library --stage 1 [tracing-env-filter]: https://docs.rs/tracing-subscriber/0.3.19/tracing_subscriber/filter/struct.EnvFilter.html +##### FIXME(#96176): specific tracing for `compiler()` vs `compiler_for()` + +The additional targets `COMPILER` and `COMPILER_FOR` are used to help trace what +`builder.compiler()` and `builder.compiler_for()` does. They should be removed +if [#96176][cleanup-compiler-for] is resolved. + +[cleanup-compiler-for]: https://github.com/rust-lang/rust/issues/96176 + ### Using `tracing` in bootstrap Both `tracing::*` macros and the `tracing::instrument` proc-macro attribute need to be gated behind `tracing` feature. Examples: diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index b6209bcb2d8..00bb2bc4dbb 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -154,6 +154,7 @@ Some examples of `X` in `ignore-X` or `only-X`: `ignore-coverage-map`, `ignore-coverage-run` - When testing a dist toolchain: `dist` - This needs to be enabled with `COMPILETEST_ENABLE_DIST_TESTS=1` +- The `rustc_abi` of the target: e.g. `rustc_abi-x86_64-sse2` The following directives will check rustc build settings and target settings: diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index b576f28176e..bec7fbe8f52 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -13,8 +13,8 @@ use rustc_session::parse::ParseSess; use rustc_span::Span; use rustc_span::symbol::{Symbol, sym}; +use crate::display::Joined as _; use crate::html::escape::Escape; -use crate::joined::Joined as _; #[cfg(test)] mod tests; diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 3d51ab1967d..e10a74221ae 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -488,7 +488,7 @@ pub(crate) fn build_impl( impl_ .items .iter() - .map(|item| tcx.hir().impl_item(item.id)) + .map(|item| tcx.hir_impl_item(item.id)) .filter(|item| { // Filter out impl items whose corresponding trait item has `doc(hidden)` // not to document such impl items. @@ -703,7 +703,7 @@ fn build_module_items( pub(crate) fn print_inlined_const(tcx: TyCtxt<'_>, did: DefId) -> String { if let Some(did) = did.as_local() { let hir_id = tcx.local_def_id_to_hir_id(did); - rustc_hir_pretty::id_to_string(&tcx.hir(), hir_id) + rustc_hir_pretty::id_to_string(&tcx, hir_id) } else { tcx.rendered_const(did).clone() } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 1d62a93e723..92ef3ab7a1d 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1145,7 +1145,7 @@ fn clean_args_from_types_and_body_id<'tcx>( types: &[hir::Ty<'tcx>], body_id: hir::BodyId, ) -> Arguments { - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); Arguments { values: types @@ -2845,7 +2845,7 @@ fn clean_maybe_renamed_item<'tcx>( ItemKind::Trait(_, _, generics, bounds, item_ids) => { let items = item_ids .iter() - .map(|ti| clean_trait_item(cx.tcx.hir().trait_item(ti.id), cx)) + .map(|ti| clean_trait_item(cx.tcx.hir_trait_item(ti.id), cx)) .collect(); TraitItem(Box::new(Trait { @@ -2891,7 +2891,7 @@ fn clean_impl<'tcx>( let items = impl_ .items .iter() - .map(|ii| clean_impl_item(tcx.hir().impl_item(ii.id), cx)) + .map(|ii| clean_impl_item(tcx.hir_impl_item(ii.id), cx)) .collect::<Vec<_>>(); // If this impl block is an implementation of the Deref trait, then we diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 5f7c30a33ab..8b424499724 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -220,12 +220,11 @@ impl ExternalCrate { None }; if root.is_local() { - tcx.hir() - .root_module() + tcx.hir_root_module() .item_ids .iter() .filter_map(|&id| { - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); match item.kind { hir::ItemKind::Mod(_) => { as_keyword(Res::Def(DefKind::Mod, id.owner_id.to_def_id())) @@ -277,12 +276,11 @@ impl ExternalCrate { }; if root.is_local() { - tcx.hir() - .root_module() + tcx.hir_root_module() .item_ids .iter() .filter_map(|&id| { - let item = tcx.hir().item(id); + let item = tcx.hir_item(id); match item.kind { hir::ItemKind::Mod(_) => { as_primitive(Res::Def(DefKind::Mod, id.owner_id.to_def_id())) @@ -2122,9 +2120,8 @@ impl Discriminant { /// Will be `None` in the case of cross-crate reexports, and may be /// simplified pub(crate) fn expr(&self, tcx: TyCtxt<'_>) -> Option<String> { - self.expr.map(|body| { - rendered_const(tcx, tcx.hir().body(body), tcx.hir().body_owner_def_id(body)) - }) + self.expr + .map(|body| rendered_const(tcx, tcx.hir_body(body), tcx.hir().body_owner_def_id(body))) } pub(crate) fn value(&self, tcx: TyCtxt<'_>, with_underscores: bool) -> String { print_evaluated_const(tcx, self.value, with_underscores, false).unwrap() @@ -2420,7 +2417,7 @@ impl ConstantKind { ConstantKind::Path { ref path } => path.to_string(), ConstantKind::Extern { def_id } => print_inlined_const(tcx, def_id), ConstantKind::Local { body, .. } | ConstantKind::Anonymous { body } => { - rendered_const(tcx, tcx.hir().body(body), tcx.hir().body_owner_def_id(body)) + rendered_const(tcx, tcx.hir_body(body), tcx.hir().body_owner_def_id(body)) } ConstantKind::Infer { .. } => "_".to_string(), } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 5c146da03ac..1ead87fd69d 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -378,7 +378,7 @@ pub(crate) fn run_global_ctxt( ctxt.external_traits.insert(sized_trait_did, sized_trait); } - debug!("crate: {:?}", tcx.hir().krate()); + debug!("crate: {:?}", tcx.hir_crate(())); let mut krate = tcx.sess.time("clean_crate", || clean::krate(&mut ctxt)); @@ -464,10 +464,10 @@ impl<'tcx> EmitIgnoredResolutionErrors<'tcx> { impl<'tcx> Visitor<'tcx> for EmitIgnoredResolutionErrors<'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { // We need to recurse into nested closures, // since those will fallback to the parent for type checking. - self.tcx.hir() + self.tcx } fn visit_path(&mut self, path: &Path<'tcx>, _id: HirId) { diff --git a/src/librustdoc/joined.rs b/src/librustdoc/display.rs index f369c6cf237..ee8dde013ee 100644 --- a/src/librustdoc/joined.rs +++ b/src/librustdoc/display.rs @@ -1,3 +1,5 @@ +//! Various utilities for working with [`fmt::Display`] implementations. + use std::fmt::{self, Display, Formatter}; pub(crate) trait Joined: IntoIterator { @@ -27,3 +29,19 @@ where Ok(()) } } + +pub(crate) trait MaybeDisplay { + /// For a given `Option<T: Display>`, returns a `Display` implementation that will display `t` if `Some(t)`, or nothing if `None`. + fn maybe_display(self) -> impl Display; +} + +impl<T: Display> MaybeDisplay for Option<T> { + fn maybe_display(self) -> impl Display { + fmt::from_fn(move |f| { + if let Some(t) = self.as_ref() { + t.fmt(f)?; + } + Ok(()) + }) + } +} diff --git a/src/librustdoc/doctest/rust.rs b/src/librustdoc/doctest/rust.rs index c4956bfd2b4..0d52e21419f 100644 --- a/src/librustdoc/doctest/rust.rs +++ b/src/librustdoc/doctest/rust.rs @@ -147,14 +147,14 @@ impl HirCollector<'_> { impl<'tcx> intravisit::Visitor<'tcx> for HirCollector<'tcx> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_item(&mut self, item: &'tcx hir::Item<'_>) { let name = match &item.kind { hir::ItemKind::Impl(impl_) => { - rustc_hir_pretty::id_to_string(&self.tcx.hir(), impl_.self_ty.hir_id) + rustc_hir_pretty::id_to_string(&self.tcx, impl_.self_ty.hir_id) } _ => item.ident.to_string(), }; diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 086a85aa616..91b4b3ba1eb 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -30,11 +30,11 @@ use super::url_parts_builder::{UrlPartsBuilder, estimate_item_path_byte_length}; use crate::clean::types::ExternalLocation; use crate::clean::utils::find_nearest_parent_module; use crate::clean::{self, ExternalCrate, PrimitiveType}; +use crate::display::Joined as _; use crate::formats::cache::Cache; use crate::formats::item_type::ItemType; use crate::html::escape::{Escape, EscapeBodyText}; use crate::html::render::Context; -use crate::joined::Joined as _; use crate::passes::collect_intra_doc_links::UrlFragment; pub(crate) fn write_str(s: &mut String, f: fmt::Arguments<'_>) { @@ -709,19 +709,22 @@ fn resolved_path( if w.alternate() { write!(w, "{}{:#}", last.name, last.args.print(cx))?; } else { - let path = if use_absolute { - if let Ok((_, _, fqp)) = href(did, cx) { - format!( - "{path}::{anchor}", - path = join_with_double_colon(&fqp[..fqp.len() - 1]), - anchor = anchor(did, *fqp.last().unwrap(), cx) - ) + let path = fmt::from_fn(|f| { + if use_absolute { + if let Ok((_, _, fqp)) = href(did, cx) { + write!( + f, + "{path}::{anchor}", + path = join_with_double_colon(&fqp[..fqp.len() - 1]), + anchor = anchor(did, *fqp.last().unwrap(), cx) + ) + } else { + write!(f, "{}", last.name) + } } else { - last.name.to_string() + write!(f, "{}", anchor(did, last.name, cx)) } - } else { - anchor(did, last.name, cx).to_string() - }; + }); write!(w, "{path}{args}", args = last.args.print(cx))?; } Ok(()) @@ -749,16 +752,20 @@ fn primitive_link_fragment( match m.primitive_locations.get(&prim) { Some(&def_id) if def_id.is_local() => { let len = cx.current.len(); - let path = if len == 0 { - let cname_sym = ExternalCrate { crate_num: def_id.krate }.name(cx.tcx()); - format!("{cname_sym}/") - } else { - "../".repeat(len - 1) - }; + let path = fmt::from_fn(|f| { + if len == 0 { + let cname_sym = ExternalCrate { crate_num: def_id.krate }.name(cx.tcx()); + write!(f, "{cname_sym}/")?; + } else { + for _ in 0..(len - 1) { + f.write_str("../")?; + } + } + Ok(()) + }); write!( f, - "<a class=\"primitive\" href=\"{}primitive.{}.html{fragment}\">", - path, + "<a class=\"primitive\" href=\"{path}primitive.{}.html{fragment}\">", prim.as_sym() )?; needs_termination = true; diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index bd8eda2fed6..d9e49577d39 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -38,7 +38,7 @@ use std::sync::{Arc, Weak}; use pulldown_cmark::{ BrokenLink, CodeBlockKind, CowStr, Event, LinkType, Options, Parser, Tag, TagEnd, html, }; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; use rustc_errors::{Diag, DiagMessage}; use rustc_hir::def_id::LocalDefId; use rustc_middle::ty::TyCtxt; @@ -1763,6 +1763,46 @@ pub(crate) fn markdown_links<'md, R>( } }; + let span_for_refdef = |link: &CowStr<'_>, span: Range<usize>| { + // We want to underline the link's definition, but `span` will point at the entire refdef. + // Skip the label, then try to find the entire URL. + let mut square_brace_count = 0; + let mut iter = md.as_bytes()[span.start..span.end].iter().copied().enumerate(); + for (_i, c) in &mut iter { + match c { + b':' if square_brace_count == 0 => break, + b'[' => square_brace_count += 1, + b']' => square_brace_count -= 1, + _ => {} + } + } + while let Some((i, c)) = iter.next() { + if c == b'<' { + while let Some((j, c)) = iter.next() { + match c { + b'\\' => { + let _ = iter.next(); + } + b'>' => { + return MarkdownLinkRange::Destination( + i + 1 + span.start..j + span.start, + ); + } + _ => {} + } + } + } else if !c.is_ascii_whitespace() { + while let Some((j, c)) = iter.next() { + if c.is_ascii_whitespace() { + return MarkdownLinkRange::Destination(i + span.start..j + span.start); + } + } + return MarkdownLinkRange::Destination(i + span.start..span.end); + } + } + span_for_link(link, span) + }; + let span_for_offset_backward = |span: Range<usize>, open: u8, close: u8| { let mut open_brace = !0; let mut close_brace = !0; @@ -1844,9 +1884,16 @@ pub(crate) fn markdown_links<'md, R>( .into_offset_iter(); let mut links = Vec::new(); + let mut refdefs = FxIndexMap::default(); + for (label, refdef) in event_iter.reference_definitions().iter() { + refdefs.insert(label.to_string(), (false, refdef.dest.to_string(), refdef.span.clone())); + } + for (event, span) in event_iter { match event { - Event::Start(Tag::Link { link_type, dest_url, .. }) if may_be_doc_link(link_type) => { + Event::Start(Tag::Link { link_type, dest_url, id, .. }) + if may_be_doc_link(link_type) => + { let range = match link_type { // Link is pulled from the link itself. LinkType::ReferenceUnknown | LinkType::ShortcutUnknown => { @@ -1856,7 +1903,12 @@ pub(crate) fn markdown_links<'md, R>( LinkType::Inline => span_for_offset_backward(span, b'(', b')'), // Link is pulled from elsewhere in the document. LinkType::Reference | LinkType::Collapsed | LinkType::Shortcut => { - span_for_link(&dest_url, span) + if let Some((is_used, dest_url, span)) = refdefs.get_mut(&id[..]) { + *is_used = true; + span_for_refdef(&CowStr::from(&dest_url[..]), span.clone()) + } else { + span_for_link(&dest_url, span) + } } LinkType::Autolink | LinkType::Email => unreachable!(), }; @@ -1873,6 +1925,18 @@ pub(crate) fn markdown_links<'md, R>( } } + for (_label, (is_used, dest_url, span)) in refdefs.into_iter() { + if !is_used + && let Some(link) = preprocess_link(MarkdownLink { + kind: LinkType::Reference, + range: span_for_refdef(&CowStr::from(&dest_url[..]), span), + link: dest_url, + }) + { + links.push(link); + } + } + links } diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index b774e60c62d..146bdd34069 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -1,8 +1,9 @@ use std::cell::RefCell; use std::collections::BTreeMap; +use std::fmt::{self, Write as _}; +use std::io; use std::path::{Path, PathBuf}; use std::sync::mpsc::{Receiver, channel}; -use std::{fmt, io}; use rinja::Template; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; @@ -265,12 +266,12 @@ impl<'tcx> Context<'tcx> { // preventing an infinite redirection loop in the generated // documentation. - let mut path = String::new(); - for name in &names[..names.len() - 1] { - path.push_str(name.as_str()); - path.push('/'); - } - path.push_str(&item_path(ty, names.last().unwrap().as_str())); + let path = fmt::from_fn(|f| { + for name in &names[..names.len() - 1] { + write!(f, "{name}/")?; + } + write!(f, "{}", item_path(ty, names.last().unwrap().as_str())) + }); match self.shared.redirections { Some(ref redirections) => { let mut current_path = String::new(); @@ -278,8 +279,12 @@ impl<'tcx> Context<'tcx> { current_path.push_str(name.as_str()); current_path.push('/'); } - current_path.push_str(&item_path(ty, names.last().unwrap().as_str())); - redirections.borrow_mut().insert(current_path, path); + let _ = write!( + current_path, + "{}", + item_path(ty, names.last().unwrap().as_str()) + ); + redirections.borrow_mut().insert(current_path, path.to_string()); } None => { return layout::redirect(&format!( @@ -854,9 +859,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { if !buf.is_empty() { let name = item.name.as_ref().unwrap(); let item_type = item.type_(); - let file_name = &item_path(item_type, name.as_str()); + let file_name = item_path(item_type, name.as_str()).to_string(); self.shared.ensure_dir(&self.dst)?; - let joint_dst = self.dst.join(file_name); + let joint_dst = self.dst.join(&file_name); self.shared.fs.write(joint_dst, buf)?; if !self.info.render_redirect_pages { @@ -873,7 +878,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { format!("{crate_name}/{file_name}"), ); } else { - let v = layout::redirect(file_name); + let v = layout::redirect(&file_name); let redir_dst = self.dst.join(redir_name); self.shared.fs.write(redir_dst, v)?; } diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 2f52a38c581..204631063a2 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -63,6 +63,7 @@ pub(crate) use self::context::*; pub(crate) use self::span_map::{LinkFromSrc, collect_spans_and_sources}; pub(crate) use self::write_shared::*; use crate::clean::{self, ItemId, RenderedLink}; +use crate::display::{Joined as _, MaybeDisplay as _}; use crate::error::Error; use crate::formats::Impl; use crate::formats::cache::Cache; @@ -568,17 +569,27 @@ fn document_short<'a, 'cx: 'a>( let (mut summary_html, has_more_content) = MarkdownSummaryLine(&s, &item.links(cx)).into_string_with_has_more_content(); - if has_more_content { - let link = format!(" <a{}>Read more</a>", assoc_href_attr(item, link, cx)); + let link = if has_more_content { + let link = fmt::from_fn(|f| { + write!( + f, + " <a{}>Read more</a>", + assoc_href_attr(item, link, cx).maybe_display() + ) + }); if let Some(idx) = summary_html.rfind("</p>") { - summary_html.insert_str(idx, &link); + summary_html.insert_str(idx, &link.to_string()); + None } else { - summary_html.push_str(&link); + Some(link) } + } else { + None } + .maybe_display(); - write!(f, "<div class='docblock'>{summary_html}</div>")?; + write!(f, "<div class='docblock'>{summary_html}{link}</div>")?; } Ok(()) }) @@ -788,13 +799,23 @@ pub(crate) fn render_impls( } /// Build a (possibly empty) `href` attribute (a key-value pair) for the given associated item. -fn assoc_href_attr(it: &clean::Item, link: AssocItemLink<'_>, cx: &Context<'_>) -> String { +fn assoc_href_attr<'a, 'tcx>( + it: &clean::Item, + link: AssocItemLink<'a>, + cx: &Context<'tcx>, +) -> Option<impl fmt::Display + 'a + Captures<'tcx>> { let name = it.name.unwrap(); let item_type = it.type_(); + enum Href<'a> { + AnchorId(&'a str), + Anchor(ItemType), + Url(String, ItemType), + } + let href = match link { - AssocItemLink::Anchor(Some(ref id)) => Some(format!("#{id}")), - AssocItemLink::Anchor(None) => Some(format!("#{item_type}.{name}")), + AssocItemLink::Anchor(Some(ref id)) => Href::AnchorId(id), + AssocItemLink::Anchor(None) => Href::Anchor(item_type), AssocItemLink::GotoSource(did, provided_methods) => { // We're creating a link from the implementation of an associated item to its // declaration in the trait declaration. @@ -814,7 +835,7 @@ fn assoc_href_attr(it: &clean::Item, link: AssocItemLink<'_>, cx: &Context<'_>) }; match href(did.expect_def_id(), cx) { - Ok((url, ..)) => Some(format!("{url}#{item_type}.{name}")), + Ok((url, ..)) => Href::Url(url, item_type), // The link is broken since it points to an external crate that wasn't documented. // Do not create any link in such case. This is better than falling back to a // dummy anchor like `#{item_type}.{name}` representing the `id` of *this* impl item @@ -826,15 +847,25 @@ fn assoc_href_attr(it: &clean::Item, link: AssocItemLink<'_>, cx: &Context<'_>) // those two items are distinct! // In this scenario, the actual `id` of this impl item would be // `#{item_type}.{name}-{n}` for some number `n` (a disambiguator). - Err(HrefError::DocumentationNotBuilt) => None, - Err(_) => Some(format!("#{item_type}.{name}")), + Err(HrefError::DocumentationNotBuilt) => return None, + Err(_) => Href::Anchor(item_type), } } }; + let href = fmt::from_fn(move |f| match &href { + Href::AnchorId(id) => write!(f, "#{id}"), + Href::Url(url, item_type) => { + write!(f, "{url}#{item_type}.{name}") + } + Href::Anchor(item_type) => { + write!(f, "#{item_type}.{name}") + } + }); + // If there is no `href` for the reason explained above, simply do not render it which is valid: // https://html.spec.whatwg.org/multipage/links.html#links-created-by-a-and-area-elements - href.map(|href| format!(" href=\"{href}\"")).unwrap_or_default() + Some(fmt::from_fn(move |f| write!(f, " href=\"{href}\""))) } #[derive(Debug)] @@ -865,7 +896,7 @@ fn assoc_const( "{indent}{vis}const <a{href} class=\"constant\">{name}</a>{generics}: {ty}", indent = " ".repeat(indent), vis = visibility_print_with_space(it, cx), - href = assoc_href_attr(it, link, cx), + href = assoc_href_attr(it, link, cx).maybe_display(), name = it.name.as_ref().unwrap(), generics = generics.print(cx), ty = ty.print(cx), @@ -905,7 +936,7 @@ fn assoc_type( "{indent}{vis}type <a{href} class=\"associatedtype\">{name}</a>{generics}", indent = " ".repeat(indent), vis = visibility_print_with_space(it, cx), - href = assoc_href_attr(it, link, cx), + href = assoc_href_attr(it, link, cx).maybe_display(), name = it.name.as_ref().unwrap(), generics = generics.print(cx), ), @@ -948,7 +979,7 @@ fn assoc_method( let asyncness = header.asyncness.print_with_space(); let safety = header.safety.print_with_space(); let abi = print_abi_with_space(header.abi).to_string(); - let href = assoc_href_attr(meth, link, cx); + let href = assoc_href_attr(meth, link, cx).maybe_display(); // NOTE: `{:#}` does not print HTML formatting, `{}` does. So `g.print` can't be reused between the length calculation and `write!`. let generics_len = format!("{:#}", g.print(cx)).len(); @@ -962,7 +993,7 @@ fn assoc_method( + name.as_str().len() + generics_len; - let notable_traits = notable_traits_button(&d.output, cx); + let notable_traits = notable_traits_button(&d.output, cx).maybe_display(); let (indent, indent_str, end_newline) = if parent == ItemType::Trait { header_len += 4; @@ -990,7 +1021,6 @@ fn assoc_method( name = name, generics = g.print(cx), decl = d.full_print(header_len, indent, cx), - notable_traits = notable_traits.unwrap_or_default(), where_clause = print_where_clause(g, cx, indent, end_newline), ), ); @@ -1438,7 +1468,10 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) -> } } -pub(crate) fn notable_traits_button(ty: &clean::Type, cx: &Context<'_>) -> Option<String> { +pub(crate) fn notable_traits_button<'a, 'tcx>( + ty: &'a clean::Type, + cx: &'a Context<'tcx>, +) -> Option<impl fmt::Display + 'a + Captures<'tcx>> { let mut has_notable_trait = false; if ty.is_unit() { @@ -1480,15 +1513,16 @@ pub(crate) fn notable_traits_button(ty: &clean::Type, cx: &Context<'_>) -> Optio } } - if has_notable_trait { + has_notable_trait.then(|| { cx.types_with_notable_traits.borrow_mut().insert(ty.clone()); - Some(format!( - " <a href=\"#\" class=\"tooltip\" data-notable-ty=\"{ty}\">ⓘ</a>", - ty = Escape(&format!("{:#}", ty.print(cx))), - )) - } else { - None - } + fmt::from_fn(|f| { + write!( + f, + " <a href=\"#\" class=\"tooltip\" data-notable-ty=\"{ty}\">ⓘ</a>", + ty = Escape(&format!("{:#}", ty.print(cx))), + ) + }) + }) } fn notable_traits_decl(ty: &clean::Type, cx: &Context<'_>) -> (String, String) { @@ -2117,11 +2151,11 @@ pub(crate) fn render_impl_summary( ) { let inner_impl = i.inner_impl(); let id = cx.derive_id(get_id_for_impl(cx.tcx(), i.impl_item.item_id)); - let aliases = if aliases.is_empty() { - String::new() - } else { - format!(" data-aliases=\"{}\"", aliases.join(",")) - }; + let aliases = (!aliases.is_empty()) + .then_some(fmt::from_fn(|f| { + write!(f, " data-aliases=\"{}\"", fmt::from_fn(|f| aliases.iter().joined(",", f))) + })) + .maybe_display(); write_str(w, format_args!("<section id=\"{id}\" class=\"impl\"{aliases}>")); render_rightside(w, cx, &i.impl_item, RenderMode::Normal); write_str( diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 9c1afef75ef..d2d7415261b 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1,6 +1,6 @@ use std::cmp::Ordering; use std::fmt; -use std::fmt::{Display, Write}; +use std::fmt::Display; use itertools::Itertools; use rinja::Template; @@ -27,6 +27,7 @@ use super::{ }; use crate::clean; use crate::config::ModuleSorting; +use crate::display::{Joined as _, MaybeDisplay as _}; use crate::formats::Impl; use crate::formats::item_type::ItemType; use crate::html::escape::{Escape, EscapeBodyTextWithWbr}; @@ -37,7 +38,6 @@ use crate::html::format::{ use crate::html::markdown::{HeadingOffset, MarkdownSummaryLine}; use crate::html::render::{document_full, document_item_info}; use crate::html::url_parts_builder::UrlPartsBuilder; -use crate::joined::Joined as _; /// Generates a Rinja template struct for rendering items with common methods. /// @@ -619,7 +619,7 @@ fn item_function(w: &mut String, cx: &Context<'_>, it: &clean::Item, f: &clean:: + name.as_str().len() + generics_len; - let notable_traits = notable_traits_button(&f.decl.output, cx); + let notable_traits = notable_traits_button(&f.decl.output, cx).maybe_display(); wrap_item(w, |w| { w.reserve(header_len); @@ -638,7 +638,6 @@ fn item_function(w: &mut String, cx: &Context<'_>, it: &clean::Item, f: &clean:: generics = f.generics.print(cx), where_clause = print_where_clause(&f.generics, cx, 0, Ending::Newline), decl = f.decl.full_print(header_len, 0, cx), - notable_traits = notable_traits.unwrap_or_default(), ), ); }); @@ -2116,34 +2115,33 @@ pub(super) fn full_path(cx: &Context<'_>, item: &clean::Item) -> String { s } -pub(super) fn item_path(ty: ItemType, name: &str) -> String { - match ty { - ItemType::Module => format!("{}index.html", ensure_trailing_slash(name)), - _ => format!("{ty}.{name}.html"), - } +pub(super) fn item_path(ty: ItemType, name: &str) -> impl Display + '_ { + fmt::from_fn(move |f| match ty { + ItemType::Module => write!(f, "{}index.html", ensure_trailing_slash(name)), + _ => write!(f, "{ty}.{name}.html"), + }) } -fn bounds(t_bounds: &[clean::GenericBound], trait_alias: bool, cx: &Context<'_>) -> String { - let mut bounds = String::new(); - if t_bounds.is_empty() { - return bounds; - } - let has_lots_of_bounds = t_bounds.len() > 2; - let inter_str = if has_lots_of_bounds { "\n + " } else { " + " }; - if !trait_alias { - if has_lots_of_bounds { - bounds.push_str(":\n "); - } else { - bounds.push_str(": "); - } - } - write!( - bounds, - "{}", - fmt::from_fn(|f| t_bounds.iter().map(|p| p.print(cx)).joined(inter_str, f)) - ) - .unwrap(); - bounds +fn bounds<'a, 'tcx>( + bounds: &'a [clean::GenericBound], + trait_alias: bool, + cx: &'a Context<'tcx>, +) -> impl Display + 'a + Captures<'tcx> { + (!bounds.is_empty()) + .then_some(fmt::from_fn(move |f| { + let has_lots_of_bounds = bounds.len() > 2; + let inter_str = if has_lots_of_bounds { "\n + " } else { " + " }; + if !trait_alias { + if has_lots_of_bounds { + f.write_str(":\n ")?; + } else { + f.write_str(": ")?; + } + } + + bounds.iter().map(|p| p.print(cx)).joined(inter_str, f) + })) + .maybe_display() } fn wrap_item<W, F>(w: &mut W, f: F) diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index a15ac155123..fa2465c1926 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -221,8 +221,8 @@ impl SpanMapVisitor<'_> { impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_path(&mut self, path: &rustc_hir::Path<'tcx>, _id: HirId) { diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index a348c6c5678..e46cc1897e9 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -2039,7 +2039,10 @@ function preLoadCss(cssUrl) { // Most page titles are '<Item> in <path::to::module> - Rust', except // modules (which don't have the first part) and keywords/primitives // (which don't have a module path) - const [item, module] = document.title.split(" in "); + const titleElement = document.querySelector("title"); + const title = titleElement && titleElement.textContent ? + titleElement.textContent.replace(" - Rust", "") : ""; + const [item, module] = title.split(" in "); const path = [item]; if (module !== undefined) { path.unshift(module); diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 121a43e3d92..ccbd6811b07 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -5318,8 +5318,9 @@ function registerSearchEvents() { // @ts-expect-error searchState.input.addEventListener("blur", () => { - // @ts-expect-error - searchState.input.placeholder = searchState.input.origPlaceholder; + if (window.searchState.input) { + window.searchState.input.placeholder = window.searchState.origPlaceholder; + } }); // Push and pop states are used to add search results to the browser diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index fcee2960979..bef59469179 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -846,7 +846,7 @@ fn convert_static( is_unsafe: safety.is_unsafe(), expr: stat .expr - .map(|e| rendered_const(tcx, tcx.hir().body(e), tcx.hir().body_owner_def_id(e))) + .map(|e| rendered_const(tcx, tcx.hir_body(e), tcx.hir().body_owner_def_id(e))) .unwrap_or_default(), } } diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 4e4cff40686..e4acbcf2c62 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -106,6 +106,7 @@ macro_rules! map { mod clean; mod config; mod core; +mod display; mod docfs; mod doctest; mod error; @@ -114,7 +115,6 @@ mod fold; mod formats; // used by the error-index generator, so it needs to be public pub mod html; -mod joined; mod json; pub(crate) mod lint; mod markdown; diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index 135aa799060..45b8dafa907 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -232,7 +232,7 @@ impl DocVisitor<'_> for CoverageCalculator<'_, '_> { .item_id .as_def_id() .and_then(|def_id| self.ctx.tcx.opt_parent(def_id)) - .and_then(|def_id| self.ctx.tcx.hir().get_if_local(def_id)) + .and_then(|def_id| self.ctx.tcx.hir_get_if_local(def_id)) .map(|node| { matches!( node, diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs index 599671bd4d4..dd9dbd7170e 100644 --- a/src/librustdoc/scrape_examples.rs +++ b/src/librustdoc/scrape_examples.rs @@ -123,8 +123,8 @@ where { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx().hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx() } fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) { diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index e4628e4f837..f606a3d8a92 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -96,7 +96,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { let om = Module::new( cx.tcx.crate_name(LOCAL_CRATE), CRATE_DEF_ID, - cx.tcx.hir().root_module().spans.inner_span, + cx.tcx.hir_root_module().spans.inner_span, None, None, ); @@ -119,7 +119,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { } pub(crate) fn visit(mut self) -> Module<'tcx> { - let root_module = self.cx.tcx.hir().root_module(); + let root_module = self.cx.tcx.hir_root_module(); self.visit_mod_contents(CRATE_DEF_ID, root_module); let mut top_level_module = self.modules.pop().unwrap(); @@ -193,13 +193,13 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { // Reimplementation of `walk_mod` because we need to do it in two passes (explanations in // the second loop): for &i in m.item_ids { - let item = self.cx.tcx.hir().item(i); + let item = self.cx.tcx.hir_item(i); if !matches!(item.kind, hir::ItemKind::Use(_, hir::UseKind::Glob)) { self.visit_item(item); } } for &i in m.item_ids { - let item = self.cx.tcx.hir().item(i); + let item = self.cx.tcx.hir_item(i); // To match the way import precedence works, visit glob imports last. // Later passes in rustdoc will de-duplicate by name and kind, so if glob- // imported items appear last, then they'll be the ones that get discarded. @@ -315,7 +315,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { Node::Item(&hir::Item { kind: hir::ItemKind::Mod(m), .. }) if glob => { let prev = mem::replace(&mut self.inlining, true); for &i in m.item_ids { - let i = tcx.hir().item(i); + let i = tcx.hir_item(i); self.visit_item_inner(i, None, Some(def_id)); } self.inlining = prev; @@ -433,7 +433,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { match item.kind { hir::ItemKind::ForeignMod { items, .. } => { for item in items { - let item = tcx.hir().foreign_item(item.id); + let item = tcx.hir_foreign_item(item.id); self.visit_foreign_item_inner(item, None); } } @@ -563,8 +563,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { impl<'tcx> Visitor<'tcx> for RustdocVisitor<'_, 'tcx> { type NestedFilter = nested_filter::All; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_item(&mut self, i: &'tcx hir::Item<'tcx>) { diff --git a/src/tools/cargo b/src/tools/cargo -Subproject 2928e32734b04925ee51e1ae88bea9a83d2fd45 +Subproject ce948f4616e3d4277e30c75c8bb01e094910df3 diff --git a/src/tools/clippy/clippy_lints/src/arbitrary_source_item_ordering.rs b/src/tools/clippy/clippy_lints/src/arbitrary_source_item_ordering.rs index f519a65fc27..aff40fa846b 100644 --- a/src/tools/clippy/clippy_lints/src/arbitrary_source_item_ordering.rs +++ b/src/tools/clippy/clippy_lints/src/arbitrary_source_item_ordering.rs @@ -338,7 +338,7 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering { return; } - let items = module.item_ids.iter().map(|&id| cx.tcx.hir().item(id)); + let items = module.item_ids.iter().map(|&id| cx.tcx.hir_item(id)); // Iterates over the items within a module. // diff --git a/src/tools/clippy/clippy_lints/src/async_yields_async.rs b/src/tools/clippy/clippy_lints/src/async_yields_async.rs index eeaa3de3725..013819b0da8 100644 --- a/src/tools/clippy/clippy_lints/src/async_yields_async.rs +++ b/src/tools/clippy/clippy_lints/src/async_yields_async.rs @@ -60,12 +60,12 @@ impl<'tcx> LateLintPass<'tcx> for AsyncYieldsAsync { // XXXkhuey maybe we should? return; }, - CoroutineSource::Block => cx.tcx.hir().body(*body_id).value, + CoroutineSource::Block => cx.tcx.hir_body(*body_id).value, CoroutineSource::Closure => { // Like `async fn`, async closures are wrapped in an additional block // to move all of the closure's arguments into the future. - let async_closure_body = cx.tcx.hir().body(*body_id).value; + let async_closure_body = cx.tcx.hir_body(*body_id).value; let ExprKind::Block(block, _) = async_closure_body.kind else { return; }; diff --git a/src/tools/clippy/clippy_lints/src/attrs/utils.rs b/src/tools/clippy/clippy_lints/src/attrs/utils.rs index 152e6ec70a1..a667649f734 100644 --- a/src/tools/clippy/clippy_lints/src/attrs/utils.rs +++ b/src/tools/clippy/clippy_lints/src/attrs/utils.rs @@ -22,7 +22,7 @@ pub(super) fn is_lint_level(symbol: Symbol, attr_id: AttrId) -> bool { pub(super) fn is_relevant_item(cx: &LateContext<'_>, item: &Item<'_>) -> bool { if let ItemKind::Fn { body: eid, .. } = item.kind { - is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir().body(eid).value) + is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir_body(eid).value) } else { true } @@ -30,7 +30,7 @@ pub(super) fn is_relevant_item(cx: &LateContext<'_>, item: &Item<'_>) -> bool { pub(super) fn is_relevant_impl(cx: &LateContext<'_>, item: &ImplItem<'_>) -> bool { match item.kind { - ImplItemKind::Fn(_, eid) => is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir().body(eid).value), + ImplItemKind::Fn(_, eid) => is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir_body(eid).value), _ => false, } } @@ -39,7 +39,7 @@ pub(super) fn is_relevant_trait(cx: &LateContext<'_>, item: &TraitItem<'_>) -> b match item.kind { TraitItemKind::Fn(_, TraitFn::Required(_)) => true, TraitItemKind::Fn(_, TraitFn::Provided(eid)) => { - is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir().body(eid).value) + is_relevant_expr(cx, cx.tcx.typeck_body(eid), cx.tcx.hir_body(eid).value) }, _ => false, } diff --git a/src/tools/clippy/clippy_lints/src/booleans.rs b/src/tools/clippy/clippy_lints/src/booleans.rs index f8c30d1c881..f30f16997d7 100644 --- a/src/tools/clippy/clippy_lints/src/booleans.rs +++ b/src/tools/clippy/clippy_lints/src/booleans.rs @@ -452,7 +452,7 @@ fn simplify_not(cx: &LateContext<'_>, curr_msrv: &Msrv, expr: &Expr<'_>) -> Opti }) }, ExprKind::Closure(closure) => { - let body = cx.tcx.hir().body(closure.body); + let body = cx.tcx.hir_body(closure.body); let params = body .params .iter() diff --git a/src/tools/clippy/clippy_lints/src/collection_is_never_read.rs b/src/tools/clippy/clippy_lints/src/collection_is_never_read.rs index 8276e53648c..1279be34ed8 100644 --- a/src/tools/clippy/clippy_lints/src/collection_is_never_read.rs +++ b/src/tools/clippy/clippy_lints/src/collection_is_never_read.rs @@ -118,7 +118,7 @@ fn has_no_read_access<'tcx, T: Visitable<'tcx>>(cx: &LateContext<'tcx>, id: HirI let is_read_in_closure_arg = args.iter().any(|arg| { if let ExprKind::Closure(closure) = arg.kind // To keep things simple, we only check the first param to see if its read. - && let Body { params: [param, ..], value } = cx.tcx.hir().body(closure.body) + && let Body { params: [param, ..], value } = cx.tcx.hir_body(closure.body) { !has_no_read_access(cx, param.hir_id, *value) } else { diff --git a/src/tools/clippy/clippy_lints/src/derivable_impls.rs b/src/tools/clippy/clippy_lints/src/derivable_impls.rs index 9569081ad08..bb445e0155f 100644 --- a/src/tools/clippy/clippy_lints/src/derivable_impls.rs +++ b/src/tools/clippy/clippy_lints/src/derivable_impls.rs @@ -197,7 +197,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls { && let impl_item_hir = child.id.hir_id() && let Node::ImplItem(impl_item) = cx.tcx.hir_node(impl_item_hir) && let ImplItemKind::Fn(_, b) = &impl_item.kind - && let Body { value: func_expr, .. } = cx.tcx.hir().body(*b) + && let Body { value: func_expr, .. } = cx.tcx.hir_body(*b) && let &ty::Adt(adt_def, args) = cx.tcx.type_of(item.owner_id).instantiate_identity().kind() && let attrs = cx.tcx.hir().attrs(item.hir_id()) && !attrs.iter().any(|attr| attr.doc_str().is_some()) diff --git a/src/tools/clippy/clippy_lints/src/derive.rs b/src/tools/clippy/clippy_lints/src/derive.rs index 91ddbb44ff8..db3e6034c5b 100644 --- a/src/tools/clippy/clippy_lints/src/derive.rs +++ b/src/tools/clippy/clippy_lints/src/derive.rs @@ -437,8 +437,8 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> { walk_expr(self, expr) } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_lints/src/doc/missing_headers.rs b/src/tools/clippy/clippy_lints/src/doc/missing_headers.rs index 8e2af6bf14a..d1ffbb6ffe2 100644 --- a/src/tools/clippy/clippy_lints/src/doc/missing_headers.rs +++ b/src/tools/clippy/clippy_lints/src/doc/missing_headers.rs @@ -68,7 +68,7 @@ pub fn check( } else if let Some(body_id) = body_id && let Some(future) = cx.tcx.lang_items().future_trait() && let typeck = cx.tcx.typeck_body(body_id) - && let body = cx.tcx.hir().body(body_id) + && let body = cx.tcx.hir_body(body_id) && let ret_ty = typeck.expr_ty(body.value) && implements_trait_with_env( cx.tcx, diff --git a/src/tools/clippy/clippy_lints/src/doc/mod.rs b/src/tools/clippy/clippy_lints/src/doc/mod.rs index 42e1f7fd950..93c2b7a2d18 100644 --- a/src/tools/clippy/clippy_lints/src/doc/mod.rs +++ b/src/tools/clippy/clippy_lints/src/doc/mod.rs @@ -597,7 +597,7 @@ impl<'tcx> LateLintPass<'tcx> for Documentation { if !(is_entrypoint_fn(cx, item.owner_id.to_def_id()) || item.span.in_external_macro(cx.tcx.sess.source_map())) { - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); let panic_info = FindPanicUnwrap::find_span(cx, cx.tcx.typeck(item.owner_id), body.value); missing_headers::check( @@ -649,7 +649,7 @@ impl<'tcx> LateLintPass<'tcx> for Documentation { && !impl_item.span.in_external_macro(cx.tcx.sess.source_map()) && !is_trait_impl_item(cx, impl_item.hir_id()) { - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); let panic_span = FindPanicUnwrap::find_span(cx, cx.tcx.typeck(impl_item.owner_id), body.value); missing_headers::check( @@ -1079,8 +1079,8 @@ impl<'tcx> Visitor<'tcx> for FindPanicUnwrap<'_, 'tcx> { // Panics in const blocks will cause compilation to fail. fn visit_anon_const(&mut self, _: &'tcx AnonConst) {} - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_lints/src/empty_drop.rs b/src/tools/clippy/clippy_lints/src/empty_drop.rs index 10a84b1b2ff..d557a36c7ac 100644 --- a/src/tools/clippy/clippy_lints/src/empty_drop.rs +++ b/src/tools/clippy/clippy_lints/src/empty_drop.rs @@ -44,7 +44,7 @@ impl LateLintPass<'_> for EmptyDrop { && let impl_item_hir = child.id.hir_id() && let Node::ImplItem(impl_item) = cx.tcx.hir_node(impl_item_hir) && let ImplItemKind::Fn(_, b) = &impl_item.kind - && let Body { value: func_expr, .. } = cx.tcx.hir().body(*b) + && let Body { value: func_expr, .. } = cx.tcx.hir_body(*b) && let func_expr = peel_blocks(func_expr) && let ExprKind::Block(block, _) = func_expr.kind && block.stmts.is_empty() diff --git a/src/tools/clippy/clippy_lints/src/eta_reduction.rs b/src/tools/clippy/clippy_lints/src/eta_reduction.rs index ae3acc1c4b1..d1782d582f4 100644 --- a/src/tools/clippy/clippy_lints/src/eta_reduction.rs +++ b/src/tools/clippy/clippy_lints/src/eta_reduction.rs @@ -97,7 +97,7 @@ fn check_closure<'tcx>(cx: &LateContext<'tcx>, outer_receiver: Option<&Expr<'tcx && matches!(c.fn_decl.output, FnRetTy::DefaultReturn(_)) && !expr.span.from_expansion() { - cx.tcx.hir().body(c.body) + cx.tcx.hir_body(c.body) } else { return; }; diff --git a/src/tools/clippy/clippy_lints/src/extra_unused_type_parameters.rs b/src/tools/clippy/clippy_lints/src/extra_unused_type_parameters.rs index 5d93aceb33f..6a217b6182c 100644 --- a/src/tools/clippy/clippy_lints/src/extra_unused_type_parameters.rs +++ b/src/tools/clippy/clippy_lints/src/extra_unused_type_parameters.rs @@ -241,13 +241,13 @@ impl<'tcx> Visitor<'tcx> for TypeWalker<'_, 'tcx> { } } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } fn is_empty_body(cx: &LateContext<'_>, body: BodyId) -> bool { - matches!(cx.tcx.hir().body(body).value.kind, ExprKind::Block(b, _) if b.stmts.is_empty() && b.expr.is_none()) + matches!(cx.tcx.hir_body(body).value.kind, ExprKind::Block(b, _) if b.stmts.is_empty() && b.expr.is_none()) } impl<'tcx> LateLintPass<'tcx> for ExtraUnusedTypeParameters { diff --git a/src/tools/clippy/clippy_lints/src/fallible_impl_from.rs b/src/tools/clippy/clippy_lints/src/fallible_impl_from.rs index f822432cce6..f67d38d932b 100644 --- a/src/tools/clippy/clippy_lints/src/fallible_impl_from.rs +++ b/src/tools/clippy/clippy_lints/src/fallible_impl_from.rs @@ -98,10 +98,10 @@ fn lint_impl_body(cx: &LateContext<'_>, impl_span: Span, impl_items: &[hir::Impl for impl_item in impl_items { if impl_item.ident.name == sym::from - && let ImplItemKind::Fn(_, body_id) = cx.tcx.hir().impl_item(impl_item.id).kind + && let ImplItemKind::Fn(_, body_id) = cx.tcx.hir_impl_item(impl_item.id).kind { // check the body for `begin_panic` or `unwrap` - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); let mut fpu = FindPanicUnwrap { lcx: cx, typeck_results: cx.tcx.typeck(impl_item.id.owner_id.def_id), diff --git a/src/tools/clippy/clippy_lints/src/format_impl.rs b/src/tools/clippy/clippy_lints/src/format_impl.rs index 5619cb0ab1b..ff75fcf2b41 100644 --- a/src/tools/clippy/clippy_lints/src/format_impl.rs +++ b/src/tools/clippy/clippy_lints/src/format_impl.rs @@ -262,7 +262,7 @@ fn is_format_trait_impl(cx: &LateContext<'_>, impl_item: &ImplItem<'_>) -> Optio && let Some(name) = cx.tcx.get_diagnostic_name(did) && matches!(name, sym::Debug | sym::Display) { - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); let formatter_name = body .params .get(1) diff --git a/src/tools/clippy/clippy_lints/src/from_over_into.rs b/src/tools/clippy/clippy_lints/src/from_over_into.rs index 9a73d0c0993..41bf6e81916 100644 --- a/src/tools/clippy/clippy_lints/src/from_over_into.rs +++ b/src/tools/clippy/clippy_lints/src/from_over_into.rs @@ -134,8 +134,8 @@ impl<'tcx> Visitor<'tcx> for SelfFinder<'_, 'tcx> { type Result = ControlFlow<()>; type NestedFilter = OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_path(&mut self, path: &Path<'tcx>, _id: HirId) -> Self::Result { @@ -175,11 +175,11 @@ fn convert_to_from( // bad suggestion/fix. return None; } - let impl_item = cx.tcx.hir().impl_item(impl_item_ref.id); + let impl_item = cx.tcx.hir_impl_item(impl_item_ref.id); let ImplItemKind::Fn(ref sig, body_id) = impl_item.kind else { return None; }; - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); let [input] = body.params else { return None }; let PatKind::Binding(.., self_ident, None) = input.pat.kind else { return None; diff --git a/src/tools/clippy/clippy_lints/src/functions/impl_trait_in_params.rs b/src/tools/clippy/clippy_lints/src/functions/impl_trait_in_params.rs index 752dbc0db4d..6d1c55d0693 100644 --- a/src/tools/clippy/clippy_lints/src/functions/impl_trait_in_params.rs +++ b/src/tools/clippy/clippy_lints/src/functions/impl_trait_in_params.rs @@ -56,7 +56,7 @@ pub(super) fn check_impl_item(cx: &LateContext<'_>, impl_item: &ImplItem<'_>) { && let hir::ItemKind::Impl(impl_) = item.kind && let hir::Impl { of_trait, .. } = *impl_ && of_trait.is_none() - && let body = cx.tcx.hir().body(body_id) + && let body = cx.tcx.hir_body(body_id) && cx.tcx.visibility(cx.tcx.hir().body_owner_def_id(body.id())).is_public() && !is_in_test(cx.tcx, impl_item.hir_id()) { diff --git a/src/tools/clippy/clippy_lints/src/functions/must_use.rs b/src/tools/clippy/clippy_lints/src/functions/must_use.rs index e480805cac2..e6e3ea59a9f 100644 --- a/src/tools/clippy/clippy_lints/src/functions/must_use.rs +++ b/src/tools/clippy/clippy_lints/src/functions/must_use.rs @@ -37,7 +37,7 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_> check_must_use_candidate( cx, sig.decl, - cx.tcx.hir().body(*body_id), + cx.tcx.hir_body(*body_id), item.span, item.owner_id, item.span.with_hi(sig.decl.output.span().hi()), @@ -59,7 +59,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp check_must_use_candidate( cx, sig.decl, - cx.tcx.hir().body(*body_id), + cx.tcx.hir_body(*body_id), item.span, item.owner_id, item.span.with_hi(sig.decl.output.span().hi()), @@ -79,7 +79,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr if let Some(attr) = attr { check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr, attrs, sig); } else if let hir::TraitFn::Provided(eid) = *eid { - let body = cx.tcx.hir().body(eid); + let body = cx.tcx.hir_body(eid); if attr.is_none() && is_public && !is_proc_macro(attrs) { check_must_use_candidate( cx, diff --git a/src/tools/clippy/clippy_lints/src/functions/not_unsafe_ptr_arg_deref.rs b/src/tools/clippy/clippy_lints/src/functions/not_unsafe_ptr_arg_deref.rs index 8a74951ef63..906bbd006d4 100644 --- a/src/tools/clippy/clippy_lints/src/functions/not_unsafe_ptr_arg_deref.rs +++ b/src/tools/clippy/clippy_lints/src/functions/not_unsafe_ptr_arg_deref.rs @@ -30,7 +30,7 @@ pub(super) fn check_fn<'tcx>( pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::TraitItem<'_>) { if let hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(eid)) = item.kind { - let body = cx.tcx.hir().body(eid); + let body = cx.tcx.hir_body(eid); check_raw_ptr(cx, sig.header.safety(), sig.decl, body, item.owner_id.def_id); } } diff --git a/src/tools/clippy/clippy_lints/src/implicit_hasher.rs b/src/tools/clippy/clippy_lints/src/implicit_hasher.rs index 47a5c19215b..d2545e57652 100644 --- a/src/tools/clippy/clippy_lints/src/implicit_hasher.rs +++ b/src/tools/clippy/clippy_lints/src/implicit_hasher.rs @@ -130,7 +130,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher { }); let mut ctr_vis = ImplicitHasherConstructorVisitor::new(cx, target); - for item in impl_.items.iter().map(|item| cx.tcx.hir().impl_item(item.id)) { + for item in impl_.items.iter().map(|item| cx.tcx.hir_impl_item(item.id)) { ctr_vis.visit_impl_item(item); } @@ -154,7 +154,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher { body: body_id, .. } => { - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); for ty in sig.decl.inputs { let mut vis = ImplicitHasherTypeVisitor::new(cx); @@ -363,7 +363,7 @@ impl<'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'_, '_, 'tcx> { walk_expr(self, e); } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs b/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs index 15650c4f732..deac51ab4c4 100644 --- a/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs +++ b/src/tools/clippy/clippy_lints/src/index_refutable_slice.rs @@ -223,8 +223,8 @@ struct SliceIndexLintingVisitor<'a, 'tcx> { impl<'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'_, 'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) { diff --git a/src/tools/clippy/clippy_lints/src/infinite_iter.rs b/src/tools/clippy/clippy_lints/src/infinite_iter.rs index d3aade31f14..3cb47d8ef91 100644 --- a/src/tools/clippy/clippy_lints/src/infinite_iter.rs +++ b/src/tools/clippy/clippy_lints/src/infinite_iter.rs @@ -159,7 +159,7 @@ fn is_infinite(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness { } if method.ident.name.as_str() == "flat_map" && args.len() == 1 { if let ExprKind::Closure(&Closure { body, .. }) = args[0].kind { - let body = cx.tcx.hir().body(body); + let body = cx.tcx.hir_body(body); return is_infinite(cx, body.value); } } diff --git a/src/tools/clippy/clippy_lints/src/items_after_statements.rs b/src/tools/clippy/clippy_lints/src/items_after_statements.rs index f5ad79a0027..021d43cefdd 100644 --- a/src/tools/clippy/clippy_lints/src/items_after_statements.rs +++ b/src/tools/clippy/clippy_lints/src/items_after_statements.rs @@ -59,7 +59,7 @@ impl LateLintPass<'_> for ItemsAfterStatements { .iter() .skip_while(|stmt| matches!(stmt.kind, StmtKind::Item(..))) .filter_map(|stmt| match stmt.kind { - StmtKind::Item(id) => Some(cx.tcx.hir().item(id)), + StmtKind::Item(id) => Some(cx.tcx.hir_item(id)), _ => None, }) // Ignore macros since they can only see previously defined locals. diff --git a/src/tools/clippy/clippy_lints/src/items_after_test_module.rs b/src/tools/clippy/clippy_lints/src/items_after_test_module.rs index 1ac549b74ac..9df044f25eb 100644 --- a/src/tools/clippy/clippy_lints/src/items_after_test_module.rs +++ b/src/tools/clippy/clippy_lints/src/items_after_test_module.rs @@ -58,7 +58,7 @@ fn cfg_test_module<'tcx>(cx: &LateContext<'tcx>, item: &Item<'tcx>) -> bool { impl LateLintPass<'_> for ItemsAfterTestModule { fn check_mod(&mut self, cx: &LateContext<'_>, module: &Mod<'_>, _: HirId) { - let mut items = module.item_ids.iter().map(|&id| cx.tcx.hir().item(id)); + let mut items = module.item_ids.iter().map(|&id| cx.tcx.hir_item(id)); let Some((mod_pos, test_mod)) = items.by_ref().enumerate().find(|(_, item)| cfg_test_module(cx, item)) else { return; @@ -91,7 +91,7 @@ impl LateLintPass<'_> for ItemsAfterTestModule { "items after a test module", |diag| { if let Some(prev) = mod_pos.checked_sub(1) - && let prev = cx.tcx.hir().item(module.item_ids[prev]) + && let prev = cx.tcx.hir_item(module.item_ids[prev]) && let items_span = last.span.with_lo(test_mod.span.hi()) && let Some(items) = items_span.get_source_text(cx) { diff --git a/src/tools/clippy/clippy_lints/src/iter_without_into_iter.rs b/src/tools/clippy/clippy_lints/src/iter_without_into_iter.rs index 238f66d6675..173232c511a 100644 --- a/src/tools/clippy/clippy_lints/src/iter_without_into_iter.rs +++ b/src/tools/clippy/clippy_lints/src/iter_without_into_iter.rs @@ -142,7 +142,7 @@ impl LateLintPass<'_> for IterWithoutIntoIter { }) && let Some(iter_assoc_span) = imp.items.iter().find_map(|item| { if item.ident.name.as_str() == "IntoIter" { - Some(cx.tcx.hir().impl_item(item.id).expect_type().span) + Some(cx.tcx.hir_impl_item(item.id).expect_type().span) } else { None } diff --git a/src/tools/clippy/clippy_lints/src/len_zero.rs b/src/tools/clippy/clippy_lints/src/len_zero.rs index 26bea8d633a..98ba52f1270 100644 --- a/src/tools/clippy/clippy_lints/src/len_zero.rs +++ b/src/tools/clippy/clippy_lints/src/len_zero.rs @@ -316,7 +316,7 @@ enum LenOutput { fn extract_future_output<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<&'tcx PathSegment<'tcx>> { if let ty::Alias(_, alias_ty) = ty.kind() - && let Some(Node::OpaqueTy(opaque)) = cx.tcx.hir().get_if_local(alias_ty.def_id) + && let Some(Node::OpaqueTy(opaque)) = cx.tcx.hir_get_if_local(alias_ty.def_id) && let OpaqueTyOrigin::AsyncFn { .. } = opaque.origin && let [GenericBound::Trait(trait_ref)] = &opaque.bounds && let Some(segment) = trait_ref.trait_ref.path.segments.last() diff --git a/src/tools/clippy/clippy_lints/src/lifetimes.rs b/src/tools/clippy/clippy_lints/src/lifetimes.rs index 860c0584acc..f08812017b9 100644 --- a/src/tools/clippy/clippy_lints/src/lifetimes.rs +++ b/src/tools/clippy/clippy_lints/src/lifetimes.rs @@ -19,8 +19,8 @@ use rustc_hir::{ WherePredicateKind, lang_items, }; use rustc_lint::{LateContext, LateLintPass, LintContext}; -use rustc_middle::hir::map::Map; use rustc_middle::hir::nested_filter as middle_nested_filter; +use rustc_middle::ty::TyCtxt; use rustc_session::impl_lint_pass; use rustc_span::Span; use rustc_span::def_id::LocalDefId; @@ -275,7 +275,7 @@ fn could_use_elision<'tcx>( } if let Some(body_id) = body { - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); let first_ident = body.params.first().and_then(|param| param.pat.simple_ident()); if non_elidable_self_type(cx, func, first_ident, msrv) { @@ -582,7 +582,7 @@ impl<'tcx, F> Visitor<'tcx> for LifetimeChecker<'_, 'tcx, F> where F: NestedFilter<'tcx>, { - type Map = Map<'tcx>; + type MaybeTyCtxt = TyCtxt<'tcx>; type NestedFilter = F; // for lifetimes as parameters of generics @@ -628,8 +628,8 @@ where self.lifetime_elision_impossible = false; } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_lints/src/lines_filter_map_ok.rs b/src/tools/clippy/clippy_lints/src/lines_filter_map_ok.rs index 8206c75927b..f022598651b 100644 --- a/src/tools/clippy/clippy_lints/src/lines_filter_map_ok.rs +++ b/src/tools/clippy/clippy_lints/src/lines_filter_map_ok.rs @@ -101,7 +101,7 @@ fn should_lint(cx: &LateContext<'_>, args: &[Expr<'_>], method_str: &str) -> boo ExprKind::Closure(Closure { body, .. }) => { if let Body { params: [param], value, .. - } = cx.tcx.hir().body(*body) + } = cx.tcx.hir_body(*body) && let ExprKind::MethodCall(method, receiver, [], _) = value.kind && path_to_local_id(receiver, param.pat.hir_id) && let Some(method_did) = cx.typeck_results().type_dependent_def_id(value.hir_id) diff --git a/src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs b/src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs index 2e6442156ef..e98c3c9698b 100644 --- a/src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs +++ b/src/tools/clippy/clippy_lints/src/loops/needless_range_loop.rs @@ -370,7 +370,7 @@ impl<'tcx> Visitor<'tcx> for VarVisitor<'_, 'tcx> { } }, ExprKind::Closure(&Closure { body, .. }) => { - let body = self.cx.tcx.hir().body(body); + let body = self.cx.tcx.hir_body(body); self.visit_expr(body.value); }, _ => walk_expr(self, expr), diff --git a/src/tools/clippy/clippy_lints/src/loops/utils.rs b/src/tools/clippy/clippy_lints/src/loops/utils.rs index 51fde5288ab..a5185d38e7c 100644 --- a/src/tools/clippy/clippy_lints/src/loops/utils.rs +++ b/src/tools/clippy/clippy_lints/src/loops/utils.rs @@ -240,8 +240,8 @@ impl<'tcx> Visitor<'tcx> for InitializeVisitor<'_, 'tcx> { } } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_lints/src/loops/while_let_on_iterator.rs b/src/tools/clippy/clippy_lints/src/loops/while_let_on_iterator.rs index b7e37c1a876..6000ff7a360 100644 --- a/src/tools/clippy/clippy_lints/src/loops/while_let_on_iterator.rs +++ b/src/tools/clippy/clippy_lints/src/loops/while_let_on_iterator.rs @@ -245,8 +245,8 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: & impl<'tcx> Visitor<'tcx> for AfterLoopVisitor<'_, '_, 'tcx> { type NestedFilter = OnlyBodies; type Result = ControlFlow<()>; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_expr(&mut self, e: &'tcx Expr<'_>) -> Self::Result { @@ -288,8 +288,8 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: & } impl<'tcx> Visitor<'tcx> for NestedLoopVisitor<'_, '_, 'tcx> { type NestedFilter = OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_local(&mut self, l: &'tcx LetStmt<'_>) { @@ -351,7 +351,7 @@ fn needs_mutable_borrow(cx: &LateContext<'_>, iter_expr: &IterExpr, loop_expr: & loop_id: loop_expr.hir_id, after_loop: false, }; - v.visit_expr(cx.tcx.hir().body(cx.enclosing_body.unwrap()).value) + v.visit_expr(cx.tcx.hir_body(cx.enclosing_body.unwrap()).value) .is_break() } } diff --git a/src/tools/clippy/clippy_lints/src/manual_async_fn.rs b/src/tools/clippy/clippy_lints/src/manual_async_fn.rs index 9f3b0957eab..6f3a7d8cccc 100644 --- a/src/tools/clippy/clippy_lints/src/manual_async_fn.rs +++ b/src/tools/clippy/clippy_lints/src/manual_async_fn.rs @@ -168,7 +168,7 @@ fn desugared_async_block<'tcx>(cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>) && let ClosureKind::Coroutine(CoroutineKind::Desugared(CoroutineDesugaring::Async, CoroutineSource::Block)) = kind { - return Some(cx.tcx.hir().body(body)); + return Some(cx.tcx.hir_body(body)); } None diff --git a/src/tools/clippy/clippy_lints/src/manual_option_as_slice.rs b/src/tools/clippy/clippy_lints/src/manual_option_as_slice.rs index 5c40c945c69..e4360518b66 100644 --- a/src/tools/clippy/clippy_lints/src/manual_option_as_slice.rs +++ b/src/tools/clippy/clippy_lints/src/manual_option_as_slice.rs @@ -191,7 +191,7 @@ fn check_arms(cx: &LateContext<'_>, none_arm: &Arm<'_>, some_arm: &Arm<'_>) -> b fn returns_empty_slice(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { match expr.kind { ExprKind::Path(_) => clippy_utils::is_path_diagnostic_item(cx, expr, sym::default_fn), - ExprKind::Closure(cl) => is_empty_slice(cx, cx.tcx.hir().body(cl.body).value), + ExprKind::Closure(cl) => is_empty_slice(cx, cx.tcx.hir_body(cl.body).value), _ => false, } } diff --git a/src/tools/clippy/clippy_lints/src/manual_retain.rs b/src/tools/clippy/clippy_lints/src/manual_retain.rs index 708980ac503..0a4e756096e 100644 --- a/src/tools/clippy/clippy_lints/src/manual_retain.rs +++ b/src/tools/clippy/clippy_lints/src/manual_retain.rs @@ -92,7 +92,7 @@ fn check_into_iter( && SpanlessEq::new(cx).eq_expr(left_expr, struct_expr) && let hir::ExprKind::MethodCall(_, _, [closure_expr], _) = target_expr.kind && let hir::ExprKind::Closure(closure) = closure_expr.kind - && let filter_body = cx.tcx.hir().body(closure.body) + && let filter_body = cx.tcx.hir_body(closure.body) && let [filter_params] = filter_body.params { if match_map_type(cx, left_expr) { @@ -139,7 +139,7 @@ fn check_iter( && SpanlessEq::new(cx).eq_expr(left_expr, struct_expr) && let hir::ExprKind::MethodCall(_, _, [closure_expr], _) = filter_expr.kind && let hir::ExprKind::Closure(closure) = closure_expr.kind - && let filter_body = cx.tcx.hir().body(closure.body) + && let filter_body = cx.tcx.hir_body(closure.body) && let [filter_params] = filter_body.params { match filter_params.pat.kind { @@ -198,7 +198,7 @@ fn check_to_owned( && SpanlessEq::new(cx).eq_expr(left_expr, str_expr) && let hir::ExprKind::MethodCall(_, _, [closure_expr], _) = filter_expr.kind && let hir::ExprKind::Closure(closure) = closure_expr.kind - && let filter_body = cx.tcx.hir().body(closure.body) + && let filter_body = cx.tcx.hir_body(closure.body) && let [filter_params] = filter_body.params { if let hir::PatKind::Ref(pat, _) = filter_params.pat.kind { diff --git a/src/tools/clippy/clippy_lints/src/map_unit_fn.rs b/src/tools/clippy/clippy_lints/src/map_unit_fn.rs index 3221a04d2d0..56aead85e7c 100644 --- a/src/tools/clippy/clippy_lints/src/map_unit_fn.rs +++ b/src/tools/clippy/clippy_lints/src/map_unit_fn.rs @@ -163,7 +163,7 @@ fn unit_closure<'tcx>( expr: &hir::Expr<'_>, ) -> Option<(&'tcx hir::Param<'tcx>, &'tcx hir::Expr<'tcx>)> { if let hir::ExprKind::Closure(&hir::Closure { fn_decl, body, .. }) = expr.kind - && let body = cx.tcx.hir().body(body) + && let body = cx.tcx.hir_body(body) && let body_expr = &body.value && fn_decl.inputs.len() == 1 && is_unit_expression(cx, body_expr) diff --git a/src/tools/clippy/clippy_lints/src/methods/bind_instead_of_map.rs b/src/tools/clippy/clippy_lints/src/methods/bind_instead_of_map.rs index 91a5de16e96..1e9b29f567f 100644 --- a/src/tools/clippy/clippy_lints/src/methods/bind_instead_of_map.rs +++ b/src/tools/clippy/clippy_lints/src/methods/bind_instead_of_map.rs @@ -163,7 +163,7 @@ impl BindInsteadOfMap { match arg.kind { hir::ExprKind::Closure(&hir::Closure { body, fn_decl_span, .. }) => { - let closure_body = cx.tcx.hir().body(body); + let closure_body = cx.tcx.hir_body(body); let closure_expr = peel_blocks(closure_body.value); if self.lint_closure_autofixable(cx, expr, recv, closure_expr, fn_decl_span) { diff --git a/src/tools/clippy/clippy_lints/src/methods/bytecount.rs b/src/tools/clippy/clippy_lints/src/methods/bytecount.rs index 687272e550b..0498f317442 100644 --- a/src/tools/clippy/clippy_lints/src/methods/bytecount.rs +++ b/src/tools/clippy/clippy_lints/src/methods/bytecount.rs @@ -18,7 +18,7 @@ pub(super) fn check<'tcx>( filter_arg: &'tcx Expr<'_>, ) { if let ExprKind::Closure(&Closure { body, .. }) = filter_arg.kind - && let body = cx.tcx.hir().body(body) + && let body = cx.tcx.hir_body(body) && let [param] = body.params && let PatKind::Binding(_, arg_id, _, _) = strip_pat_refs(param.pat).kind && let ExprKind::Binary(ref op, l, r) = body.value.kind diff --git a/src/tools/clippy/clippy_lints/src/methods/filter_map.rs b/src/tools/clippy/clippy_lints/src/methods/filter_map.rs index c1653b65e98..5b9df6c2bfd 100644 --- a/src/tools/clippy/clippy_lints/src/methods/filter_map.rs +++ b/src/tools/clippy/clippy_lints/src/methods/filter_map.rs @@ -22,7 +22,7 @@ fn is_method(cx: &LateContext<'_>, expr: &Expr<'_>, method_name: Symbol) -> bool ExprKind::Path(QPath::Resolved(_, segments)) => segments.segments.last().unwrap().ident.name == method_name, ExprKind::MethodCall(segment, _, _, _) => segment.ident.name == method_name, ExprKind::Closure(Closure { body, .. }) => { - let body = cx.tcx.hir().body(*body); + let body = cx.tcx.hir_body(*body); let closure_expr = peel_blocks(body.value); match closure_expr.kind { ExprKind::MethodCall(PathSegment { ident, .. }, receiver, ..) => { @@ -404,7 +404,7 @@ fn is_find_or_filter<'a>( if is_trait_method(cx, map_recv, sym::Iterator) // filter(|x| ...is_some())... && let ExprKind::Closure(&Closure { body: filter_body_id, .. }) = filter_arg.kind - && let filter_body = cx.tcx.hir().body(filter_body_id) + && let filter_body = cx.tcx.hir_body(filter_body_id) && let [filter_param] = filter_body.params // optional ref pattern: `filter(|&x| ..)` && let (filter_pat, is_filter_param_ref) = if let PatKind::Ref(ref_pat, _) = filter_param.pat.kind { @@ -417,7 +417,7 @@ fn is_find_or_filter<'a>( && let Some(mut offending_expr) = OffendingFilterExpr::hir(cx, filter_body.value, filter_param_id) && let ExprKind::Closure(&Closure { body: map_body_id, .. }) = map_arg.kind - && let map_body = cx.tcx.hir().body(map_body_id) + && let map_body = cx.tcx.hir_body(map_body_id) && let [map_param] = map_body.params && let PatKind::Binding(_, map_param_id, map_param_ident, None) = map_param.pat.kind diff --git a/src/tools/clippy/clippy_lints/src/methods/filter_map_bool_then.rs b/src/tools/clippy/clippy_lints/src/methods/filter_map_bool_then.rs index d550c145466..f7e116c5310 100644 --- a/src/tools/clippy/clippy_lints/src/methods/filter_map_bool_then.rs +++ b/src/tools/clippy/clippy_lints/src/methods/filter_map_bool_then.rs @@ -14,7 +14,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, arg: & if !expr.span.in_external_macro(cx.sess().source_map()) && is_trait_method(cx, expr, sym::Iterator) && let ExprKind::Closure(closure) = arg.kind - && let body = cx.tcx.hir().body(closure.body) + && let body = cx.tcx.hir_body(closure.body) && let value = peel_blocks(body.value) // Indexing should be fine as `filter_map` always has 1 input, we unfortunately need both // `inputs` and `params` here as we need both the type and the span @@ -31,7 +31,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, arg: & && is_copy(cx, param_ty) && let ExprKind::MethodCall(_, recv, [then_arg], _) = value.kind && let ExprKind::Closure(then_closure) = then_arg.kind - && let then_body = peel_blocks(cx.tcx.hir().body(then_closure.body).value) + && let then_body = peel_blocks(cx.tcx.hir_body(then_closure.body).value) && let Some(def_id) = cx.typeck_results().type_dependent_def_id(value.hir_id) && cx.tcx.is_diagnostic_item(sym::bool_then, def_id) && !is_from_proc_macro(cx, expr) diff --git a/src/tools/clippy/clippy_lints/src/methods/format_collect.rs b/src/tools/clippy/clippy_lints/src/methods/format_collect.rs index 3e5162ef458..1b28596d50d 100644 --- a/src/tools/clippy/clippy_lints/src/methods/format_collect.rs +++ b/src/tools/clippy/clippy_lints/src/methods/format_collect.rs @@ -19,7 +19,7 @@ fn peel_non_expn_blocks<'tcx>(expr: &'tcx Expr<'tcx>) -> Option<&'tcx Expr<'tcx> pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, map_arg: &Expr<'_>, map_span: Span) { if is_type_lang_item(cx, cx.typeck_results().expr_ty(expr), LangItem::String) && let ExprKind::Closure(closure) = map_arg.kind - && let body = cx.tcx.hir().body(closure.body) + && let body = cx.tcx.hir_body(closure.body) && let Some(value) = peel_non_expn_blocks(body.value) && let Some(mac) = root_macro_call_first_node(cx, value) && is_format_macro(cx, mac.def_id) diff --git a/src/tools/clippy/clippy_lints/src/methods/iter_filter.rs b/src/tools/clippy/clippy_lints/src/methods/iter_filter.rs index 30387ba62a7..76a0c0061e5 100644 --- a/src/tools/clippy/clippy_lints/src/methods/iter_filter.rs +++ b/src/tools/clippy/clippy_lints/src/methods/iter_filter.rs @@ -95,7 +95,7 @@ fn is_method( false }, ExprKind::Closure(&hir::Closure { body, .. }) => { - let body = cx.tcx.hir().body(body); + let body = cx.tcx.hir_body(body); let closure_expr = peel_blocks(body.value); let params = body.params.iter().map(|param| param.pat).collect::<Vec<_>>(); is_method(cx, closure_expr, type_symbol, method_name, params.as_slice()) diff --git a/src/tools/clippy/clippy_lints/src/methods/iter_kv_map.rs b/src/tools/clippy/clippy_lints/src/methods/iter_kv_map.rs index 299f6d10112..518041177e9 100644 --- a/src/tools/clippy/clippy_lints/src/methods/iter_kv_map.rs +++ b/src/tools/clippy/clippy_lints/src/methods/iter_kv_map.rs @@ -30,7 +30,7 @@ pub(super) fn check<'tcx>( && let Body { params: [p], value: body_expr, - } = cx.tcx.hir().body(c.body) + } = cx.tcx.hir_body(c.body) && let PatKind::Tuple([key_pat, val_pat], _) = p.pat.kind && let (replacement_kind, annotation, bound_ident) = match (&key_pat.kind, &val_pat.kind) { (key, PatKind::Binding(ann, _, value, _)) if pat_is_wild(cx, key, m_arg) => ("value", ann, value), diff --git a/src/tools/clippy/clippy_lints/src/methods/iter_overeager_cloned.rs b/src/tools/clippy/clippy_lints/src/methods/iter_overeager_cloned.rs index 5ccb5243e90..a80977459f2 100644 --- a/src/tools/clippy/clippy_lints/src/methods/iter_overeager_cloned.rs +++ b/src/tools/clippy/clippy_lints/src/methods/iter_overeager_cloned.rs @@ -62,7 +62,7 @@ pub(super) fn check<'tcx>( let ExprKind::Closure(closure) = expr.kind else { return; }; - let body @ Body { params: [p], .. } = cx.tcx.hir().body(closure.body) else { + let body @ Body { params: [p], .. } = cx.tcx.hir_body(closure.body) else { return; }; let mut delegate = MoveDelegate { diff --git a/src/tools/clippy/clippy_lints/src/methods/manual_inspect.rs b/src/tools/clippy/clippy_lints/src/methods/manual_inspect.rs index 20e4d233525..de37df2394d 100644 --- a/src/tools/clippy/clippy_lints/src/methods/manual_inspect.rs +++ b/src/tools/clippy/clippy_lints/src/methods/manual_inspect.rs @@ -22,7 +22,7 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, arg: &Expr<'_>, name: && (is_diag_trait_item(cx, fn_id, sym::Iterator) || (msrv.meets(msrvs::OPTION_RESULT_INSPECT) && (is_diag_item_method(cx, fn_id, sym::Option) || is_diag_item_method(cx, fn_id, sym::Result)))) - && let body = cx.tcx.hir().body(c.body) + && let body = cx.tcx.hir_body(c.body) && let [param] = body.params && let PatKind::Binding(BindingMode(ByRef::No, Mutability::Not), arg_id, _, None) = param.pat.kind && let arg_ty = typeck.node_type(arg_id) @@ -45,7 +45,7 @@ pub(crate) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, arg: &Expr<'_>, name: let can_lint = for_each_expr_without_closures(block.stmts, |e| { if let ExprKind::Closure(c) = e.kind { // Nested closures don't need to treat returns specially. - let _: Option<!> = for_each_expr(cx, cx.tcx.hir().body(c.body).value, |e| { + let _: Option<!> = for_each_expr(cx, cx.tcx.hir_body(c.body).value, |e| { if path_to_local_id(e, arg_id) { let (kind, same_ctxt) = check_use(cx, e); match (kind, same_ctxt && e.span.ctxt() == ctxt) { diff --git a/src/tools/clippy/clippy_lints/src/methods/manual_ok_or.rs b/src/tools/clippy/clippy_lints/src/methods/manual_ok_or.rs index 4321dd6b0e0..8265c93bfe9 100644 --- a/src/tools/clippy/clippy_lints/src/methods/manual_ok_or.rs +++ b/src/tools/clippy/clippy_lints/src/methods/manual_ok_or.rs @@ -44,7 +44,7 @@ fn is_ok_wrapping(cx: &LateContext<'_>, map_expr: &Expr<'_>) -> bool { match map_expr.kind { ExprKind::Path(ref qpath) if is_res_lang_ctor(cx, cx.qpath_res(qpath, map_expr.hir_id), ResultOk) => true, ExprKind::Closure(closure) => { - let body = cx.tcx.hir().body(closure.body); + let body = cx.tcx.hir_body(closure.body); if let PatKind::Binding(_, param_id, ..) = body.params[0].pat.kind && let ExprKind::Call(callee, [ok_arg]) = body.value.kind && is_res_lang_ctor(cx, path_res(cx, callee), ResultOk) diff --git a/src/tools/clippy/clippy_lints/src/methods/map_clone.rs b/src/tools/clippy/clippy_lints/src/methods/map_clone.rs index 1252f7ccd35..b2705e1ffc2 100644 --- a/src/tools/clippy/clippy_lints/src/methods/map_clone.rs +++ b/src/tools/clippy/clippy_lints/src/methods/map_clone.rs @@ -47,7 +47,7 @@ pub(super) fn check(cx: &LateContext<'_>, e: &hir::Expr<'_>, recv: &hir::Expr<'_ { match arg.kind { hir::ExprKind::Closure(&hir::Closure { body, .. }) => { - let closure_body = cx.tcx.hir().body(body); + let closure_body = cx.tcx.hir_body(body); let closure_expr = peel_blocks(closure_body.value); match closure_body.params[0].pat.kind { hir::PatKind::Ref(inner, Mutability::Not) => { diff --git a/src/tools/clippy/clippy_lints/src/methods/map_err_ignore.rs b/src/tools/clippy/clippy_lints/src/methods/map_err_ignore.rs index 162f0ac564d..5d0d4dae35f 100644 --- a/src/tools/clippy/clippy_lints/src/methods/map_err_ignore.rs +++ b/src/tools/clippy/clippy_lints/src/methods/map_err_ignore.rs @@ -16,7 +16,7 @@ pub(super) fn check(cx: &LateContext<'_>, e: &Expr<'_>, arg: &Expr<'_>) { fn_decl_span, .. }) = arg.kind - && let closure_body = cx.tcx.hir().body(body) + && let closure_body = cx.tcx.hir_body(body) && let [param] = closure_body.params && let PatKind::Wild = param.pat.kind { diff --git a/src/tools/clippy/clippy_lints/src/methods/map_with_unused_argument_over_ranges.rs b/src/tools/clippy/clippy_lints/src/methods/map_with_unused_argument_over_ranges.rs index 78656ace831..35dd7c082c9 100644 --- a/src/tools/clippy/clippy_lints/src/methods/map_with_unused_argument_over_ranges.rs +++ b/src/tools/clippy/clippy_lints/src/methods/map_with_unused_argument_over_ranges.rs @@ -68,7 +68,7 @@ pub(super) fn check( let mut applicability = Applicability::MaybeIncorrect; if let Some(range) = higher::Range::hir(receiver) && let ExprKind::Closure(Closure { body, .. }) = arg.kind - && let body_hir = cx.tcx.hir().body(*body) + && let body_hir = cx.tcx.hir_body(*body) && let Body { params: [param], value: body_expr, diff --git a/src/tools/clippy/clippy_lints/src/methods/mod.rs b/src/tools/clippy/clippy_lints/src/methods/mod.rs index 0a8eafad0e8..ccc5cd4fa41 100644 --- a/src/tools/clippy/clippy_lints/src/methods/mod.rs +++ b/src/tools/clippy/clippy_lints/src/methods/mod.rs @@ -4716,7 +4716,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods { if sig.decl.implicit_self.has_implicit_self() && !(self.avoid_breaking_exported_api && cx.effective_visibilities.is_exported(impl_item.owner_id.def_id)) - && let Some(first_arg) = iter_input_pats(sig.decl, cx.tcx.hir().body(id)).next() + && let Some(first_arg) = iter_input_pats(sig.decl, cx.tcx.hir_body(id)).next() && let Some(first_arg_ty) = first_arg_ty_opt { wrong_self_convention::check( @@ -4852,7 +4852,7 @@ impl Methods { ), Some(("chars", recv, _, _, _)) if let ExprKind::Closure(arg) = arg.kind - && let body = cx.tcx.hir().body(arg.body) + && let body = cx.tcx.hir_body(arg.body) && let [param] = body.params => { string_lit_chars_any::check(cx, expr, recv, param, peel_blocks(body.value), &self.msrv); diff --git a/src/tools/clippy/clippy_lints/src/methods/needless_character_iteration.rs b/src/tools/clippy/clippy_lints/src/methods/needless_character_iteration.rs index 6993150fb57..743aacf0588 100644 --- a/src/tools/clippy/clippy_lints/src/methods/needless_character_iteration.rs +++ b/src/tools/clippy/clippy_lints/src/methods/needless_character_iteration.rs @@ -99,7 +99,7 @@ fn handle_expr( pub(super) fn check(cx: &LateContext<'_>, call_expr: &Expr<'_>, recv: &Expr<'_>, closure_arg: &Expr<'_>, is_all: bool) { if let ExprKind::Closure(&Closure { body, .. }) = closure_arg.kind - && let body = cx.tcx.hir().body(body) + && let body = cx.tcx.hir_body(body) && let Some(first_param) = body.params.first() && let ExprKind::MethodCall(method, mut recv, [], _) = recv.kind && method.ident.name.as_str() == "chars" diff --git a/src/tools/clippy/clippy_lints/src/methods/needless_collect.rs b/src/tools/clippy/clippy_lints/src/methods/needless_collect.rs index 2780c3f8af5..45f79dd44f2 100644 --- a/src/tools/clippy/clippy_lints/src/methods/needless_collect.rs +++ b/src/tools/clippy/clippy_lints/src/methods/needless_collect.rs @@ -456,8 +456,8 @@ impl<'tcx> Visitor<'tcx> for UsedCountVisitor<'_, 'tcx> { } } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } @@ -498,7 +498,7 @@ fn get_captured_ids(cx: &LateContext<'_>, ty: Ty<'_>) -> HirIdSet { } }, ty::Closure(def_id, _) => { - let closure_hir_node = cx.tcx.hir().get_if_local(*def_id).unwrap(); + let closure_hir_node = cx.tcx.hir_get_if_local(*def_id).unwrap(); if let Node::Expr(closure_expr) = closure_hir_node { can_move_expr_to_closure(cx, closure_expr) .unwrap() diff --git a/src/tools/clippy/clippy_lints/src/methods/obfuscated_if_else.rs b/src/tools/clippy/clippy_lints/src/methods/obfuscated_if_else.rs index b71f79f8482..e0905374dda 100644 --- a/src/tools/clippy/clippy_lints/src/methods/obfuscated_if_else.rs +++ b/src/tools/clippy/clippy_lints/src/methods/obfuscated_if_else.rs @@ -27,7 +27,7 @@ pub(super) fn check<'tcx>( let if_then = match then_method_name { "then" if let ExprKind::Closure(closure) = then_arg.kind => { - let body = cx.tcx.hir().body(closure.body); + let body = cx.tcx.hir_body(closure.body); snippet_with_applicability(cx, body.value.span, "..", &mut applicability) }, "then_some" => snippet_with_applicability(cx, then_arg.span, "..", &mut applicability), diff --git a/src/tools/clippy/clippy_lints/src/methods/option_as_ref_deref.rs b/src/tools/clippy/clippy_lints/src/methods/option_as_ref_deref.rs index 8d97d1c72a6..469fcccbe4f 100644 --- a/src/tools/clippy/clippy_lints/src/methods/option_as_ref_deref.rs +++ b/src/tools/clippy/clippy_lints/src/methods/option_as_ref_deref.rs @@ -54,7 +54,7 @@ pub(super) fn check( }) }, hir::ExprKind::Closure(&hir::Closure { body, .. }) => { - let closure_body = cx.tcx.hir().body(body); + let closure_body = cx.tcx.hir_body(body); let closure_expr = peel_blocks(closure_body.value); match &closure_expr.kind { diff --git a/src/tools/clippy/clippy_lints/src/methods/option_map_or_none.rs b/src/tools/clippy/clippy_lints/src/methods/option_map_or_none.rs index 193deafccf6..1a273f77fb7 100644 --- a/src/tools/clippy/clippy_lints/src/methods/option_map_or_none.rs +++ b/src/tools/clippy/clippy_lints/src/methods/option_map_or_none.rs @@ -60,7 +60,7 @@ pub(super) fn check<'tcx>( let self_snippet = snippet(cx, recv.span, ".."); if let hir::ExprKind::Closure(&hir::Closure { body, fn_decl_span, .. }) = map_arg.kind && let arg_snippet = snippet(cx, fn_decl_span, "..") - && let body = cx.tcx.hir().body(body) + && let body = cx.tcx.hir_body(body) && let Some((func, [arg_char])) = reduce_unit_expression(body.value) && let Some(id) = path_def_id(cx, func).map(|ctor_id| cx.tcx.parent(ctor_id)) && Some(id) == cx.tcx.lang_items().option_some_variant() diff --git a/src/tools/clippy/clippy_lints/src/methods/option_map_unwrap_or.rs b/src/tools/clippy/clippy_lints/src/methods/option_map_unwrap_or.rs index 7c4dc4ffb20..4a8a221e8c3 100644 --- a/src/tools/clippy/clippy_lints/src/methods/option_map_unwrap_or.rs +++ b/src/tools/clippy/clippy_lints/src/methods/option_map_unwrap_or.rs @@ -143,8 +143,8 @@ impl<'tcx> Visitor<'tcx> for UnwrapVisitor<'_, 'tcx> { walk_path(self, path); } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } @@ -174,7 +174,7 @@ impl<'tcx> Visitor<'tcx> for ReferenceVisitor<'_, 'tcx> { rustc_hir::intravisit::walk_expr(self, expr) } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_lints/src/methods/or_fun_call.rs b/src/tools/clippy/clippy_lints/src/methods/or_fun_call.rs index 6b39b753885..f5f404070ca 100644 --- a/src/tools/clippy/clippy_lints/src/methods/or_fun_call.rs +++ b/src/tools/clippy/clippy_lints/src/methods/or_fun_call.rs @@ -253,7 +253,7 @@ pub(super) fn check<'tcx>( fn closure_body_returns_empty_to_string(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> bool { if let hir::ExprKind::Closure(&hir::Closure { body, .. }) = e.kind { - let body = cx.tcx.hir().body(body); + let body = cx.tcx.hir_body(body); if body.params.is_empty() && let hir::Expr { kind, .. } = &body.value diff --git a/src/tools/clippy/clippy_lints/src/methods/result_map_or_else_none.rs b/src/tools/clippy/clippy_lints/src/methods/result_map_or_else_none.rs index 3b0dc506305..af619c9e3bb 100644 --- a/src/tools/clippy/clippy_lints/src/methods/result_map_or_else_none.rs +++ b/src/tools/clippy/clippy_lints/src/methods/result_map_or_else_none.rs @@ -23,7 +23,7 @@ pub(super) fn check<'tcx>( // We check that it is mapped as `Some`. && is_res_lang_ctor(cx, path_res(cx, map_arg), OptionSome) && let hir::ExprKind::Closure(&hir::Closure { body, .. }) = def_arg.kind - && let body = cx.tcx.hir().body(body) + && let body = cx.tcx.hir_body(body) // And finally we check that we return a `None` in the "else case". && is_res_lang_ctor(cx, path_res(cx, peel_blocks(body.value)), OptionNone) { diff --git a/src/tools/clippy/clippy_lints/src/methods/return_and_then.rs b/src/tools/clippy/clippy_lints/src/methods/return_and_then.rs index 7b1199ad1e2..68ffa81a278 100644 --- a/src/tools/clippy/clippy_lints/src/methods/return_and_then.rs +++ b/src/tools/clippy/clippy_lints/src/methods/return_and_then.rs @@ -44,7 +44,7 @@ pub(super) fn check<'tcx>( }; let closure_arg = fn_decl.inputs[0]; - let closure_expr = peel_blocks(cx.tcx.hir().body(body).value); + let closure_expr = peel_blocks(cx.tcx.hir_body(body).value); let mut applicability = Applicability::MachineApplicable; let arg_snip = snippet_with_applicability(cx, closure_arg.span, "_", &mut applicability); diff --git a/src/tools/clippy/clippy_lints/src/methods/search_is_some.rs b/src/tools/clippy/clippy_lints/src/methods/search_is_some.rs index 4ab165a5528..97c8ce2bcdd 100644 --- a/src/tools/clippy/clippy_lints/src/methods/search_is_some.rs +++ b/src/tools/clippy/clippy_lints/src/methods/search_is_some.rs @@ -37,7 +37,7 @@ pub(super) fn check<'tcx>( let mut applicability = Applicability::MachineApplicable; let any_search_snippet = if search_method == "find" && let ExprKind::Closure(&hir::Closure { body, .. }) = search_arg.kind - && let closure_body = cx.tcx.hir().body(body) + && let closure_body = cx.tcx.hir_body(body) && let Some(closure_arg) = closure_body.params.first() { if let PatKind::Ref(..) = closure_arg.pat.kind { diff --git a/src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs b/src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs index ed49233acb7..1bd48525f12 100644 --- a/src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs +++ b/src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs @@ -10,7 +10,7 @@ use super::SUSPICIOUS_MAP; pub fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, count_recv: &hir::Expr<'_>, map_arg: &hir::Expr<'_>) { if is_trait_method(cx, count_recv, sym::Iterator) && let hir::ExprKind::Closure(closure) = expr_or_init(cx, map_arg).kind - && let closure_body = cx.tcx.hir().body(closure.body) + && let closure_body = cx.tcx.hir_body(closure.body) && !cx.typeck_results().expr_ty(closure_body.value).is_unit() { if let Some(map_mutated_vars) = mutated_variables(closure_body.value, cx) { diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_filter_map.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_filter_map.rs index 5b9e9e70e47..ca42a9ac04e 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_filter_map.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_filter_map.rs @@ -20,7 +20,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>, a } if let hir::ExprKind::Closure(&hir::Closure { body, .. }) = arg.kind { - let body = cx.tcx.hir().body(body); + let body = cx.tcx.hir_body(body); let arg_id = body.params[0].pat.hir_id; let mutates_arg = mutated_variables(body.value, cx).is_none_or(|used_mutably| used_mutably.contains(&arg_id)); let (clone_or_copy_needed, _) = clone_or_copy_needed(cx, body.params[0].pat, body.value); diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_fold.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_fold.rs index e7adf3b43ba..8e3cc9abe83 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_fold.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_fold.rs @@ -62,7 +62,7 @@ fn check_fold_with_op( ) { if let hir::ExprKind::Closure(&hir::Closure { body, .. }) = acc.kind // Extract the body of the closure passed to fold - && let closure_body = cx.tcx.hir().body(body) + && let closure_body = cx.tcx.hir_body(body) && let closure_expr = peel_blocks(closure_body.value) // Check if the closure body is of the form `acc <op> some_expr(x)` diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_lazy_eval.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_lazy_eval.rs index 7af550fa7c6..9f4080100da 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_lazy_eval.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_lazy_eval.rs @@ -25,7 +25,7 @@ pub(super) fn check<'tcx>( if is_option || is_result || is_bool { if let hir::ExprKind::Closure(&hir::Closure { body, fn_decl, .. }) = arg.kind { - let body = cx.tcx.hir().body(body); + let body = cx.tcx.hir_body(body); let body_expr = &body.value; if usage::BindingUsageFinder::are_params_used(cx, body) || is_from_proc_macro(cx, expr) { diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs index 10112b62878..00690aca6d1 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs @@ -99,7 +99,7 @@ pub(super) fn check( ("None", "unwrap_or_else", _) => match args[0].kind { hir::ExprKind::Closure(hir::Closure { body, .. }) => Some(vec![ ( - expr.span.with_hi(cx.tcx.hir().body(*body).value.span.lo()), + expr.span.with_hi(cx.tcx.hir_body(*body).value.span.lo()), String::new(), ), (expr.span.with_lo(args[0].span.hi()), String::new()), diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_map_or.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_map_or.rs index 6dea1506d0e..5f88a7fd31f 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_map_or.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_map_or.rs @@ -63,7 +63,7 @@ pub(super) fn check<'a>( let ext_def_span = def.span.until(map.span); let (sugg, method, applicability) = if let ExprKind::Closure(map_closure) = map.kind - && let closure_body = cx.tcx.hir().body(map_closure.body) + && let closure_body = cx.tcx.hir_body(map_closure.body) && let closure_body_value = closure_body.value.peel_blocks() && let ExprKind::Binary(op, l, r) = closure_body_value.kind && let Some(param) = closure_body.params.first() diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_result_map_or_else.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_result_map_or_else.rs index dc50717112d..f84d0d6dff0 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_result_map_or_else.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_result_map_or_else.rs @@ -53,7 +53,7 @@ pub(super) fn check<'tcx>( // lint if the caller of `map_or_else()` is a `Result` if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(recv), sym::Result) && let ExprKind::Closure(&Closure { body, .. }) = map_arg.kind - && let body = cx.tcx.hir().body(body) + && let body = cx.tcx.hir_body(body) && let Some(first_param) = body.params.first() { let body_expr = peel_blocks(body.value); diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_sort_by.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_sort_by.rs index f0b29213e1e..fb4984914eb 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_sort_by.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_sort_by.rs @@ -117,7 +117,7 @@ fn detect_lint(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, arg: &Exp && let Some(impl_id) = cx.tcx.impl_of_method(method_id) && cx.tcx.type_of(impl_id).instantiate_identity().is_slice() && let ExprKind::Closure(&Closure { body, .. }) = arg.kind - && let closure_body = cx.tcx.hir().body(body) + && let closure_body = cx.tcx.hir_body(body) && let &[ Param { pat: diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs index 7d72310c1c4..e80d99dca56 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs @@ -506,7 +506,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty< if has_lifetime(output_ty) && has_lifetime(ty) { return false; } - let body = cx.tcx.hir().body(*body_id); + let body = cx.tcx.hir_body(*body_id); let body_expr = &body.value; let mut count = 0; return find_all_ret_expressions(cx, body_expr, |_| { diff --git a/src/tools/clippy/clippy_lints/src/methods/unused_enumerate_index.rs b/src/tools/clippy/clippy_lints/src/methods/unused_enumerate_index.rs index 0aec26f1011..af466fe091c 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unused_enumerate_index.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unused_enumerate_index.rs @@ -46,7 +46,7 @@ pub(super) fn check(cx: &LateContext<'_>, call_expr: &Expr<'_>, recv: &Expr<'_>, && is_trait_method(cx, call_expr, sym::Iterator) // And the map argument is a closure && let ExprKind::Closure(closure) = closure_arg.kind - && let closure_body = cx.tcx.hir().body(closure.body) + && let closure_body = cx.tcx.hir_body(closure.body) // And that closure has one argument ... && let [closure_param] = closure_body.params // .. which is a tuple of 2 elements diff --git a/src/tools/clippy/clippy_lints/src/methods/useless_asref.rs b/src/tools/clippy/clippy_lints/src/methods/useless_asref.rs index 82313257e5c..19152362fb5 100644 --- a/src/tools/clippy/clippy_lints/src/methods/useless_asref.rs +++ b/src/tools/clippy/clippy_lints/src/methods/useless_asref.rs @@ -113,7 +113,7 @@ fn is_calling_clone(cx: &LateContext<'_>, arg: &hir::Expr<'_>) -> bool { match arg.kind { hir::ExprKind::Closure(&hir::Closure { body, .. }) // If it's a closure, we need to check what is called. - if let closure_body = cx.tcx.hir().body(body) + if let closure_body = cx.tcx.hir_body(body) && let [param] = closure_body.params && let hir::PatKind::Binding(_, local_id, ..) = strip_pat_refs(param.pat).kind => { diff --git a/src/tools/clippy/clippy_lints/src/methods/utils.rs b/src/tools/clippy/clippy_lints/src/methods/utils.rs index 6e39e7be2c4..3611b341897 100644 --- a/src/tools/clippy/clippy_lints/src/methods/utils.rs +++ b/src/tools/clippy/clippy_lints/src/methods/utils.rs @@ -89,8 +89,8 @@ struct CloneOrCopyVisitor<'cx, 'tcx> { impl<'tcx> Visitor<'tcx> for CloneOrCopyVisitor<'_, 'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { diff --git a/src/tools/clippy/clippy_lints/src/missing_fields_in_debug.rs b/src/tools/clippy/clippy_lints/src/missing_fields_in_debug.rs index e9ec23b1efa..675989156ca 100644 --- a/src/tools/clippy/clippy_lints/src/missing_fields_in_debug.rs +++ b/src/tools/clippy/clippy_lints/src/missing_fields_in_debug.rs @@ -213,8 +213,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingFieldsInDebug { && !item.span.from_expansion() // find `Debug::fmt` function && let Some(fmt_item) = items.iter().find(|i| i.ident.name == sym::fmt) - && let ImplItem { kind: ImplItemKind::Fn(_, body_id), .. } = cx.tcx.hir().impl_item(fmt_item.id) - && let body = cx.tcx.hir().body(*body_id) + && let ImplItem { kind: ImplItemKind::Fn(_, body_id), .. } = cx.tcx.hir_impl_item(fmt_item.id) + && let body = cx.tcx.hir_body(*body_id) && let ExprKind::Block(block, _) = body.value.kind // inspect `self` && let self_ty = cx.tcx.type_of(self_path_did).skip_binder().peel_refs() diff --git a/src/tools/clippy/clippy_lints/src/missing_inline.rs b/src/tools/clippy/clippy_lints/src/missing_inline.rs index 18385ac9269..fdc0930e957 100644 --- a/src/tools/clippy/clippy_lints/src/missing_inline.rs +++ b/src/tools/clippy/clippy_lints/src/missing_inline.rs @@ -105,7 +105,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline { // note: we need to check if the trait is exported so we can't use // `LateLintPass::check_trait_item` here. for tit in trait_items { - let tit_ = cx.tcx.hir().trait_item(tit.id); + let tit_ = cx.tcx.hir_trait_item(tit.id); match tit_.kind { hir::TraitItemKind::Const(..) | hir::TraitItemKind::Type(..) => {}, hir::TraitItemKind::Fn(..) => { @@ -113,7 +113,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline { // trait method with default body needs inline in case // an impl is not provided let desc = "a default trait method"; - let item = cx.tcx.hir().trait_item(tit.id); + let item = cx.tcx.hir_trait_item(tit.id); let attrs = cx.tcx.hir().attrs(item.hir_id()); check_missing_inline_attrs(cx, attrs, item.span, desc); } diff --git a/src/tools/clippy/clippy_lints/src/mutable_debug_assertion.rs b/src/tools/clippy/clippy_lints/src/mutable_debug_assertion.rs index 152635a5c35..13a23a13b9c 100644 --- a/src/tools/clippy/clippy_lints/src/mutable_debug_assertion.rs +++ b/src/tools/clippy/clippy_lints/src/mutable_debug_assertion.rs @@ -119,7 +119,7 @@ impl<'tcx> Visitor<'tcx> for MutArgVisitor<'_, 'tcx> { walk_expr(self, expr); } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_lints/src/needless_for_each.rs b/src/tools/clippy/clippy_lints/src/needless_for_each.rs index 93e20f37ef8..90b27f5dbac 100644 --- a/src/tools/clippy/clippy_lints/src/needless_for_each.rs +++ b/src/tools/clippy/clippy_lints/src/needless_for_each.rs @@ -71,7 +71,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessForEach { // Skip the lint if the body is not block because this is simpler than `for` loop. // e.g. `v.iter().for_each(f)` is simpler and clearer than using `for` loop. && let ExprKind::Closure(&Closure { body, .. }) = for_each_arg.kind - && let body = cx.tcx.hir().body(body) + && let body = cx.tcx.hir_body(body) // Skip the lint if the body is not safe, so as not to suggest `for … in … unsafe {}` // and suggesting `for … in … { unsafe { } }` is a little ugly. && let ExprKind::Block(Block { rules: BlockCheckMode::DefaultBlock, .. }, ..) = body.value.kind diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs index 996251fdf16..6a1dc5e41a0 100644 --- a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs +++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs @@ -103,7 +103,6 @@ fn check_closures<'tcx>( checked_closures: &mut FxHashSet<LocalDefId>, closures: FxIndexSet<LocalDefId>, ) { - let hir = cx.tcx.hir(); for closure in closures { if !checked_closures.insert(closure) { continue; @@ -114,7 +113,7 @@ fn check_closures<'tcx>( .tcx .hir_node_by_def_id(closure) .associated_body() - .map(|(_, body_id)| hir.body(body_id)) + .map(|(_, body_id)| cx.tcx.hir_body(body_id)) { euv::ExprUseVisitor::for_clippy(cx, closure, &mut *ctx) .consume_body(body) diff --git a/src/tools/clippy/clippy_lints/src/new_without_default.rs b/src/tools/clippy/clippy_lints/src/new_without_default.rs index cc56df3a23d..cf407e51f7a 100644 --- a/src/tools/clippy/clippy_lints/src/new_without_default.rs +++ b/src/tools/clippy/clippy_lints/src/new_without_default.rs @@ -67,7 +67,7 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault { { for assoc_item in *items { if assoc_item.kind == (hir::AssocItemKind::Fn { has_self: false }) { - let impl_item = cx.tcx.hir().impl_item(assoc_item.id); + let impl_item = cx.tcx.hir_impl_item(assoc_item.id); if impl_item.span.in_external_macro(cx.sess().source_map()) { return; } diff --git a/src/tools/clippy/clippy_lints/src/non_canonical_impls.rs b/src/tools/clippy/clippy_lints/src/non_canonical_impls.rs index dad1e8a3d6a..448bb603cf2 100644 --- a/src/tools/clippy/clippy_lints/src/non_canonical_impls.rs +++ b/src/tools/clippy/clippy_lints/src/non_canonical_impls.rs @@ -121,10 +121,10 @@ impl LateLintPass<'_> for NonCanonicalImpls { if cx.tcx.is_automatically_derived(item.owner_id.to_def_id()) { return; } - let ImplItemKind::Fn(_, impl_item_id) = cx.tcx.hir().impl_item(impl_item.impl_item_id()).kind else { + let ImplItemKind::Fn(_, impl_item_id) = cx.tcx.hir_impl_item(impl_item.impl_item_id()).kind else { return; }; - let body = cx.tcx.hir().body(impl_item_id); + let body = cx.tcx.hir_body(impl_item_id); let ExprKind::Block(block, ..) = body.value.kind else { return; }; diff --git a/src/tools/clippy/clippy_lints/src/non_std_lazy_statics.rs b/src/tools/clippy/clippy_lints/src/non_std_lazy_statics.rs index 22116505a1c..774a182d089 100644 --- a/src/tools/clippy/clippy_lints/src/non_std_lazy_statics.rs +++ b/src/tools/clippy/clippy_lints/src/non_std_lazy_statics.rs @@ -214,7 +214,7 @@ impl LazyInfo { && state.once_cell_sync_lazy.contains(&path_def_id) { let ty_span_no_args = path_span_without_args(path); - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); // visit body to collect `Lazy::new` calls let mut new_fn_calls = FxIndexMap::default(); diff --git a/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs b/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs index 95403403217..73c31b83b51 100644 --- a/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs +++ b/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs @@ -136,7 +136,7 @@ impl PassByRefOrValue { } let fn_sig = cx.tcx.fn_sig(def_id).instantiate_identity(); - let fn_body = cx.enclosing_body.map(|id| cx.tcx.hir().body(id)); + let fn_body = cx.enclosing_body.map(|id| cx.tcx.hir_body(id)); // Gather all the lifetimes found in the output type which may affect whether // `TRIVIALLY_COPY_PASS_BY_REF` should be linted. diff --git a/src/tools/clippy/clippy_lints/src/ptr.rs b/src/tools/clippy/clippy_lints/src/ptr.rs index 7fba4b6a6c8..9b241edf4cc 100644 --- a/src/tools/clippy/clippy_lints/src/ptr.rs +++ b/src/tools/clippy/clippy_lints/src/ptr.rs @@ -583,8 +583,8 @@ fn check_ptr_arg_usage<'tcx>(cx: &LateContext<'tcx>, body: &Body<'tcx>, args: &[ } impl<'tcx> Visitor<'tcx> for V<'_, 'tcx> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_anon_const(&mut self, _: &'tcx AnonConst) {} diff --git a/src/tools/clippy/clippy_lints/src/redundant_async_block.rs b/src/tools/clippy/clippy_lints/src/redundant_async_block.rs index 65fd312b3a0..bc5e8fd2c25 100644 --- a/src/tools/clippy/clippy_lints/src/redundant_async_block.rs +++ b/src/tools/clippy/clippy_lints/src/redundant_async_block.rs @@ -75,7 +75,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantAsyncBlock { /// any variable by ref. fn desugar_async_block<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> { if let ExprKind::Closure(Closure { body, def_id, kind, .. }) = expr.kind - && let body = cx.tcx.hir().body(*body) + && let body = cx.tcx.hir_body(*body) && matches!( kind, ClosureKind::Coroutine(CoroutineKind::Desugared( diff --git a/src/tools/clippy/clippy_lints/src/redundant_closure_call.rs b/src/tools/clippy/clippy_lints/src/redundant_closure_call.rs index 91d023500ca..1498a49a7a4 100644 --- a/src/tools/clippy/clippy_lints/src/redundant_closure_call.rs +++ b/src/tools/clippy/clippy_lints/src/redundant_closure_call.rs @@ -90,7 +90,7 @@ fn find_innermost_closure<'tcx>( let mut data = None; while let ExprKind::Closure(closure) = expr.kind - && let body = cx.tcx.hir().body(closure.body) + && let body = cx.tcx.hir_body(closure.body) && { let mut visitor = ReturnVisitor; !visitor.visit_expr(body.value).is_break() @@ -179,7 +179,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall { // Like `async fn`, async closures are wrapped in an additional block // to move all of the closure's arguments into the future. - let async_closure_body = cx.tcx.hir().body(closure.body).value; + let async_closure_body = cx.tcx.hir_body(closure.body).value; let ExprKind::Block(block, _) = async_closure_body.kind else { return; }; @@ -241,8 +241,8 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClosureCall { hir_visit::walk_expr(self, expr); } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } let mut closure_usage_count = ClosureUsageCount { cx, path, count: 0 }; diff --git a/src/tools/clippy/clippy_lints/src/returns.rs b/src/tools/clippy/clippy_lints/src/returns.rs index a1cf16e6ce9..9f0ea84246d 100644 --- a/src/tools/clippy/clippy_lints/src/returns.rs +++ b/src/tools/clippy/clippy_lints/src/returns.rs @@ -205,7 +205,7 @@ impl<'tcx> LateLintPass<'tcx> for Return { // Ensure this is not the final stmt, otherwise removing it would cause a compile error && let OwnerNode::Item(item) = cx.tcx.hir_owner_node(cx.tcx.hir().get_parent_item(expr.hir_id)) && let ItemKind::Fn { body, .. } = item.kind - && let block = cx.tcx.hir().body(body).value + && let block = cx.tcx.hir_body(body).value && let ExprKind::Block(block, _) = block.kind && !is_inside_let_else(cx.tcx, expr) && let [.., final_stmt] = block.stmts diff --git a/src/tools/clippy/clippy_lints/src/same_name_method.rs b/src/tools/clippy/clippy_lints/src/same_name_method.rs index 29914d4379f..552135b15fd 100644 --- a/src/tools/clippy/clippy_lints/src/same_name_method.rs +++ b/src/tools/clippy/clippy_lints/src/same_name_method.rs @@ -50,9 +50,9 @@ impl<'tcx> LateLintPass<'tcx> for SameNameMethod { fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { let mut map = FxHashMap::<Res, ExistingName>::default(); - for id in cx.tcx.hir().items() { + for id in cx.tcx.hir_free_items() { if matches!(cx.tcx.def_kind(id.owner_id), DefKind::Impl { .. }) - && let item = cx.tcx.hir().item(id) + && let item = cx.tcx.hir_item(id) && let ItemKind::Impl(Impl { items, of_trait, diff --git a/src/tools/clippy/clippy_lints/src/string_patterns.rs b/src/tools/clippy/clippy_lints/src/string_patterns.rs index 3834087f797..694ad4f6347 100644 --- a/src/tools/clippy/clippy_lints/src/string_patterns.rs +++ b/src/tools/clippy/clippy_lints/src/string_patterns.rs @@ -138,7 +138,7 @@ fn get_char_span<'tcx>(cx: &'_ LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Optio fn check_manual_pattern_char_comparison(cx: &LateContext<'_>, method_arg: &Expr<'_>, msrv: &Msrv) { if let ExprKind::Closure(closure) = method_arg.kind - && let body = cx.tcx.hir().body(closure.body) + && let body = cx.tcx.hir_body(closure.body) && let Some(PatKind::Binding(_, binding, ..)) = body.params.first().map(|p| p.pat.kind) { let mut set_char_spans: Vec<Span> = Vec::new(); diff --git a/src/tools/clippy/clippy_lints/src/strings.rs b/src/tools/clippy/clippy_lints/src/strings.rs index 6164a6191db..4a5f143a2d3 100644 --- a/src/tools/clippy/clippy_lints/src/strings.rs +++ b/src/tools/clippy/clippy_lints/src/strings.rs @@ -2,8 +2,8 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg, span_lint_and_the use clippy_utils::source::{snippet, snippet_with_applicability}; use clippy_utils::ty::is_type_lang_item; use clippy_utils::{ - SpanlessEq, get_expr_use_or_unification_node, get_parent_expr, is_lint_allowed, is_path_diagnostic_item, - method_calls, peel_blocks, + SpanlessEq, get_expr_use_or_unification_node, get_parent_expr, is_lint_allowed, method_calls, path_def_id, + peel_blocks, }; use rustc_errors::Applicability; use rustc_hir::def_id::DefId; @@ -253,8 +253,9 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes { use rustc_ast::LitKind; if let ExprKind::Call(fun, [bytes_arg]) = e.kind - // Find std::str::converts::from_utf8 - && is_path_diagnostic_item(cx, fun, sym::str_from_utf8) + // Find `std::str::converts::from_utf8` or `std::primitive::str::from_utf8` + && let Some(sym::str_from_utf8 | sym::str_inherent_from_utf8) = + path_def_id(cx, fun).and_then(|id| cx.tcx.get_diagnostic_name(id)) // Find string::as_bytes && let ExprKind::AddrOf(BorrowKind::Ref, _, args) = bytes_arg.kind diff --git a/src/tools/clippy/clippy_lints/src/suspicious_trait_impl.rs b/src/tools/clippy/clippy_lints/src/suspicious_trait_impl.rs index e9779d437d4..9326b2adaff 100644 --- a/src/tools/clippy/clippy_lints/src/suspicious_trait_impl.rs +++ b/src/tools/clippy/clippy_lints/src/suspicious_trait_impl.rs @@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for SuspiciousImpl { && let parent_fn = cx.tcx.hir().get_parent_item(expr.hir_id).def_id && let hir::Node::ImplItem(impl_item) = cx.tcx.hir_node_by_def_id(parent_fn) && let hir::ImplItemKind::Fn(_, body_id) = impl_item.kind - && let body = cx.tcx.hir().body(body_id) + && let body = cx.tcx.hir_body(body_id) && let parent_fn = cx.tcx.hir().get_parent_item(expr.hir_id).def_id && let Some(trait_ref) = trait_ref_of_method(cx, parent_fn) && let trait_id = trait_ref.path.res.def_id() diff --git a/src/tools/clippy/clippy_lints/src/trait_bounds.rs b/src/tools/clippy/clippy_lints/src/trait_bounds.rs index 790e0965198..cbf7b126632 100644 --- a/src/tools/clippy/clippy_lints/src/trait_bounds.rs +++ b/src/tools/clippy/clippy_lints/src/trait_bounds.rs @@ -135,7 +135,7 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds { && let Some(Node::Item(Item { kind: ItemKind::Trait(_, _, _, self_bounds, _), .. - })) = cx.tcx.hir().get_if_local(*def_id) + })) = cx.tcx.hir_get_if_local(*def_id) { if self_bounds_map.is_empty() { for bound in *self_bounds { diff --git a/src/tools/clippy/clippy_lints/src/types/borrowed_box.rs b/src/tools/clippy/clippy_lints/src/types/borrowed_box.rs index 2e97772407f..004ad03e708 100644 --- a/src/tools/clippy/clippy_lints/src/types/borrowed_box.rs +++ b/src/tools/clippy/clippy_lints/src/types/borrowed_box.rs @@ -96,10 +96,10 @@ fn is_any_trait(cx: &LateContext<'_>, t: &hir::Ty<'_>) -> bool { fn get_bounds_if_impl_trait<'tcx>(cx: &LateContext<'tcx>, qpath: &QPath<'_>, id: HirId) -> Option<GenericBounds<'tcx>> { if let Some(did) = cx.qpath_res(qpath, id).opt_def_id() - && let Some(Node::GenericParam(generic_param)) = cx.tcx.hir().get_if_local(did) + && let Some(Node::GenericParam(generic_param)) = cx.tcx.hir_get_if_local(did) && let GenericParamKind::Type { synthetic, .. } = generic_param.kind && synthetic - && let Some(generics) = cx.tcx.hir().get_generics(id.owner.def_id) + && let Some(generics) = cx.tcx.hir_get_generics(id.owner.def_id) && let Some(pred) = generics.bounds_for_param(did.expect_local()).next() { Some(pred.bounds) diff --git a/src/tools/clippy/clippy_lints/src/unconditional_recursion.rs b/src/tools/clippy/clippy_lints/src/unconditional_recursion.rs index 207f2ef4563..529f85be372 100644 --- a/src/tools/clippy/clippy_lints/src/unconditional_recursion.rs +++ b/src/tools/clippy/clippy_lints/src/unconditional_recursion.rs @@ -9,7 +9,6 @@ use rustc_hir::intravisit::{FnKind, Visitor, walk_body, walk_expr}; use rustc_hir::{Body, Expr, ExprKind, FnDecl, HirId, Item, ItemKind, Node, QPath, TyKind}; use rustc_hir_analysis::lower_ty; use rustc_lint::{LateContext, LateLintPass}; -use rustc_middle::hir::map::Map; use rustc_middle::hir::nested_filter; use rustc_middle::ty::{self, AssocKind, Ty, TyCtxt}; use rustc_session::impl_lint_pass; @@ -275,7 +274,6 @@ fn is_default_method_on_current_ty<'tcx>(tcx: TyCtxt<'tcx>, qpath: QPath<'tcx>, struct CheckCalls<'a, 'tcx> { cx: &'a LateContext<'tcx>, - map: Map<'tcx>, implemented_ty_id: DefId, method_span: Span, } @@ -287,8 +285,8 @@ where type NestedFilter = nested_filter::OnlyBodies; type Result = ControlFlow<()>; - fn nested_visit_map(&mut self) -> Self::Map { - self.map + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) -> ControlFlow<()> { @@ -326,9 +324,9 @@ impl UnconditionalRecursion { .find(|item| { item.kind == AssocKind::Fn && item.def_id.is_local() && item.name == kw::Default }) - && let Some(body_node) = cx.tcx.hir().get_if_local(assoc_item.def_id) + && let Some(body_node) = cx.tcx.hir_get_if_local(assoc_item.def_id) && let Some(body_id) = body_node.body_id() - && let body = cx.tcx.hir().body(body_id) + && let body = cx.tcx.hir_body(body_id) // We don't want to keep it if it has conditional return. && let [return_expr] = get_return_calls_in_body(body).as_slice() && let ExprKind::Call(call_expr, _) = return_expr.kind @@ -380,7 +378,6 @@ impl UnconditionalRecursion { { let mut c = CheckCalls { cx, - map: cx.tcx.hir(), implemented_ty_id, method_span, }; diff --git a/src/tools/clippy/clippy_lints/src/undocumented_unsafe_blocks.rs b/src/tools/clippy/clippy_lints/src/undocumented_unsafe_blocks.rs index b3d26908093..c8e3c46f2f6 100644 --- a/src/tools/clippy/clippy_lints/src/undocumented_unsafe_blocks.rs +++ b/src/tools/clippy/clippy_lints/src/undocumented_unsafe_blocks.rs @@ -245,7 +245,7 @@ impl<'tcx> LateLintPass<'tcx> for UndocumentedUnsafeBlocks { // const and static items only need a safety comment if their body is an unsafe block, lint otherwise (&ItemKind::Const(.., body) | &ItemKind::Static(.., body), HasSafetyComment::Yes(pos)) => { if !is_lint_allowed(cx, UNNECESSARY_SAFETY_COMMENT, body.hir_id) { - let body = cx.tcx.hir().body(body); + let body = cx.tcx.hir_body(body); if !matches!( body.value.kind, hir::ExprKind::Block(block, _) if block.rules == BlockCheckMode::UnsafeBlock(UnsafeSource::UserProvided) @@ -558,7 +558,7 @@ fn comment_start_before_item_in_mod( // some_item /* comment */ unsafe impl T {} // ^-------^ returns the end of this span // ^---------------^ finally checks comments in this range - let prev_item = cx.tcx.hir().item(parent_mod.item_ids[idx - 1]); + let prev_item = cx.tcx.hir_item(parent_mod.item_ids[idx - 1]); if let Some(sp) = walk_span_to_context(prev_item.span, SyntaxContext::root()) { return Some(sp.hi()); } @@ -605,7 +605,7 @@ fn span_from_macro_expansion_has_safety_comment(cx: &LateContext<'_>, span: Span fn get_body_search_span(cx: &LateContext<'_>) -> Option<Span> { let body = cx.enclosing_body?; let map = cx.tcx.hir(); - let mut span = map.body(body).value.span; + let mut span = cx.tcx.hir_body(body).value.span; let mut maybe_global_var = false; for (_, node) in map.parent_iter(body.hir_id) { match node { diff --git a/src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs b/src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs index 87478a120dd..67ceac92dbc 100644 --- a/src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs +++ b/src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs @@ -123,7 +123,7 @@ fn check_arg<'tcx>(cx: &LateContext<'tcx>, arg: &'tcx Expr<'tcx>) -> Option<(Spa && let ty = cx.tcx.instantiate_bound_regions_with_erased(ret_ty) && ty.is_unit() { - let body = cx.tcx.hir().body(body); + let body = cx.tcx.hir_body(body); if let ExprKind::Block(block, _) = body.value.kind && block.expr.is_none() && let Some(stmt) = block.stmts.last() diff --git a/src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs b/src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs index 00b80e827d8..87f184e13ce 100644 --- a/src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs +++ b/src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs @@ -84,7 +84,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, local: &'tcx LetStmt<'_>) { if let PatKind::Binding(_, binding_hir_id, ..) = local.pat.kind && let Some(body_id) = cx.enclosing_body.as_ref() { - let body = cx.tcx.hir().body(*body_id); + let body = cx.tcx.hir_body(*body_id); // Collect variable usages let mut visitor = UnitVariableCollector::new(binding_hir_id); diff --git a/src/tools/clippy/clippy_lints/src/unused_async.rs b/src/tools/clippy/clippy_lints/src/unused_async.rs index d00bd7f2b3d..1c1c841e964 100644 --- a/src/tools/clippy/clippy_lints/src/unused_async.rs +++ b/src/tools/clippy/clippy_lints/src/unused_async.rs @@ -101,8 +101,8 @@ impl<'tcx> Visitor<'tcx> for AsyncFnVisitor<'_, 'tcx> { } } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_lints/src/unused_peekable.rs b/src/tools/clippy/clippy_lints/src/unused_peekable.rs index 71aa57e0a14..0f9b05c84d4 100644 --- a/src/tools/clippy/clippy_lints/src/unused_peekable.rs +++ b/src/tools/clippy/clippy_lints/src/unused_peekable.rs @@ -112,8 +112,8 @@ impl<'tcx> Visitor<'tcx> for PeekableVisitor<'_, 'tcx> { type NestedFilter = OnlyBodies; type Result = ControlFlow<()>; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) -> ControlFlow<()> { diff --git a/src/tools/clippy/clippy_lints/src/unused_self.rs b/src/tools/clippy/clippy_lints/src/unused_self.rs index 781f51aa9b0..d8305a62829 100644 --- a/src/tools/clippy/clippy_lints/src/unused_self.rs +++ b/src/tools/clippy/clippy_lints/src/unused_self.rs @@ -77,7 +77,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedSelf { && assoc_item.fn_has_self_parameter && let ImplItemKind::Fn(.., body_id) = &impl_item.kind && (!cx.effective_visibilities.is_exported(impl_item.owner_id.def_id) || !self.avoid_breaking_exported_api) - && let body = cx.tcx.hir().body(*body_id) + && let body = cx.tcx.hir_body(*body_id) && let [self_param, ..] = body.params && !is_local_used(cx, body, self_param.pat.hir_id) && !contains_todo(cx, body) diff --git a/src/tools/clippy/clippy_lints/src/unwrap.rs b/src/tools/clippy/clippy_lints/src/unwrap.rs index 6a952c0d97a..76b9bbbd32f 100644 --- a/src/tools/clippy/clippy_lints/src/unwrap.rs +++ b/src/tools/clippy/clippy_lints/src/unwrap.rs @@ -374,8 +374,8 @@ impl<'tcx> Visitor<'tcx> for UnwrappableVariablesVisitor<'_, 'tcx> { } } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_lints/src/unwrap_in_result.rs b/src/tools/clippy/clippy_lints/src/unwrap_in_result.rs index 9b9a2ffbbc8..f870eb71e19 100644 --- a/src/tools/clippy/clippy_lints/src/unwrap_in_result.rs +++ b/src/tools/clippy/clippy_lints/src/unwrap_in_result.rs @@ -74,7 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for UnwrapInResult { fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, impl_item: &'tcx hir::ImplItem<'_>) { if let ImplItemKind::Fn(_, body_id) = impl_item.kind { - let body = cx.tcx.hir().body(body_id); + let body = cx.tcx.hir_body(body_id); let typeck = cx.tcx.typeck(impl_item.owner_id.def_id); let mut result = Vec::new(); let _: Option<!> = for_each_expr(cx, body.value, |e| { diff --git a/src/tools/clippy/clippy_lints/src/utils/author.rs b/src/tools/clippy/clippy_lints/src/utils/author.rs index 6bad78cf871..ce489054e16 100644 --- a/src/tools/clippy/clippy_lints/src/utils/author.rs +++ b/src/tools/clippy/clippy_lints/src/utils/author.rs @@ -637,9 +637,9 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> { } fn body(&self, body_id: &Binding<hir::BodyId>) { - let expr = self.cx.tcx.hir().body(body_id.value).value; + let expr = self.cx.tcx.hir_body(body_id.value).value; bind!(self, expr); - chain!(self, "{expr} = &cx.tcx.hir().body({body_id}).value"); + chain!(self, "{expr} = &cx.tcx.hir_body({body_id}).value"); self.expr(expr); } diff --git a/src/tools/clippy/clippy_lints/src/utils/internal_lints/collapsible_calls.rs b/src/tools/clippy/clippy_lints/src/utils/internal_lints/collapsible_calls.rs index eaeb754a23f..2e6fb7c4ce4 100644 --- a/src/tools/clippy/clippy_lints/src/utils/internal_lints/collapsible_calls.rs +++ b/src/tools/clippy/clippy_lints/src/utils/internal_lints/collapsible_calls.rs @@ -80,7 +80,7 @@ impl<'tcx> LateLintPass<'tcx> for CollapsibleCalls { if let ExprKind::Call(func, [call_cx, call_lint, call_sp, call_msg, call_f]) = expr.kind && is_expr_path_def_path(cx, func, &["clippy_utils", "diagnostics", "span_lint_and_then"]) && let ExprKind::Closure(&Closure { body, .. }) = call_f.kind - && let body = cx.tcx.hir().body(body) + && let body = cx.tcx.hir_body(body) && let only_expr = peel_blocks_with_stmt(body.value) && let ExprKind::MethodCall(ps, recv, span_call_args, _) = &only_expr.kind && let ExprKind::Path(..) = recv.kind diff --git a/src/tools/clippy/clippy_lints/src/utils/internal_lints/invalid_paths.rs b/src/tools/clippy/clippy_lints/src/utils/internal_lints/invalid_paths.rs index 08c178ed229..252ac5e6768 100644 --- a/src/tools/clippy/clippy_lints/src/utils/internal_lints/invalid_paths.rs +++ b/src/tools/clippy/clippy_lints/src/utils/internal_lints/invalid_paths.rs @@ -37,7 +37,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidPaths { ty::TypingEnv::post_analysis(cx.tcx, item.owner_id), cx.tcx.typeck(item.owner_id), ) - .eval_simple(cx.tcx.hir().body(body_id).value) + .eval_simple(cx.tcx.hir_body(body_id).value) && let Some(path) = path .iter() .map(|x| { diff --git a/src/tools/clippy/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs b/src/tools/clippy/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs index dac1951489c..e31da9e9f61 100644 --- a/src/tools/clippy/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs +++ b/src/tools/clippy/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs @@ -108,7 +108,7 @@ impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass { if is_lint_ref_type(cx, ty) { check_invalid_clippy_version_attribute(cx, item); - let expr = &cx.tcx.hir().body(body_id).value; + let expr = &cx.tcx.hir_body(body_id).value; let fields = if let ExprKind::AddrOf(_, _, inner_exp) = expr.kind && let ExprKind::Struct(_, struct_fields, _) = inner_exp.kind { @@ -277,7 +277,7 @@ impl<'tcx> Visitor<'tcx> for LintCollector<'_, 'tcx> { } } - fn nested_visit_map(&mut self) -> Self::Map { + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { self.cx.tcx.hir() } } diff --git a/src/tools/clippy/clippy_lints/src/zero_repeat_side_effects.rs b/src/tools/clippy/clippy_lints/src/zero_repeat_side_effects.rs index 05f85650769..30fdf22fdbb 100644 --- a/src/tools/clippy/clippy_lints/src/zero_repeat_side_effects.rs +++ b/src/tools/clippy/clippy_lints/src/zero_repeat_side_effects.rs @@ -47,7 +47,6 @@ declare_lint_pass!(ZeroRepeatSideEffects => [ZERO_REPEAT_SIDE_EFFECTS]); impl LateLintPass<'_> for ZeroRepeatSideEffects { fn check_expr(&mut self, cx: &LateContext<'_>, expr: &rustc_hir::Expr<'_>) { - let hir_map = cx.tcx.hir(); if let Some(args) = VecArgs::hir(cx, expr) && let VecArgs::Repeat(inner_expr, len) = args && let ExprKind::Lit(l) = len.kind @@ -62,7 +61,7 @@ impl LateLintPass<'_> for ZeroRepeatSideEffects { // sessions). else if let ExprKind::Repeat(inner_expr, const_arg) = expr.kind && let ConstArgKind::Anon(anon_const) = const_arg.kind - && let length_expr = hir_map.body(anon_const.body).value + && let length_expr = cx.tcx.hir_body(anon_const.body).value && !length_expr.span.from_expansion() && let ExprKind::Lit(literal) = length_expr.kind && let LitKind::Int(Pu128(0), _) = literal.node diff --git a/src/tools/clippy/clippy_lints/src/zombie_processes.rs b/src/tools/clippy/clippy_lints/src/zombie_processes.rs index 4df34891a2b..9bd00b1e5c8 100644 --- a/src/tools/clippy/clippy_lints/src/zombie_processes.rs +++ b/src/tools/clippy/clippy_lints/src/zombie_processes.rs @@ -249,8 +249,8 @@ impl<'tcx> Visitor<'tcx> for WaitFinder<'_, 'tcx> { walk_expr(self, ex) } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } 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 59aaaa3d9fb..4f48fb3b8a9 100644 --- a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs +++ b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs @@ -192,7 +192,7 @@ fn expr_search_pat(tcx: TyCtxt<'_>, e: &Expr<'_>) -> (Pat, Pat) { }, ExprKind::Closure(&Closure { body, .. }) => ( Pat::Str(""), - expr_search_pat_inner(tcx, tcx.hir().body(body).value, outer_span).1, + expr_search_pat_inner(tcx, tcx.hir_body(body).value, outer_span).1, ), ExprKind::Block( Block { diff --git a/src/tools/clippy/clippy_utils/src/consts.rs b/src/tools/clippy/clippy_utils/src/consts.rs index db82c458f70..4f707e34abf 100644 --- a/src/tools/clippy/clippy_utils/src/consts.rs +++ b/src/tools/clippy/clippy_utils/src/consts.rs @@ -455,7 +455,7 @@ impl<'tcx> ConstEvalCtxt<'tcx> { Some(val) } }, - PatExprKind::ConstBlock(ConstBlock { body, .. }) => self.expr(self.tcx.hir().body(*body).value), + PatExprKind::ConstBlock(ConstBlock { body, .. }) => self.expr(self.tcx.hir_body(*body).value), PatExprKind::Path(qpath) => self.qpath(qpath, pat_expr.hir_id), } } @@ -483,7 +483,7 @@ impl<'tcx> ConstEvalCtxt<'tcx> { /// Simple constant folding: Insert an expression, get a constant or none. fn expr(&self, e: &Expr<'_>) -> Option<Constant<'tcx>> { match e.kind { - ExprKind::ConstBlock(ConstBlock { body, .. }) => self.expr(self.tcx.hir().body(body).value), + ExprKind::ConstBlock(ConstBlock { body, .. }) => self.expr(self.tcx.hir_body(body).value), ExprKind::DropTemps(e) => self.expr(e), ExprKind::Path(ref qpath) => self.qpath(qpath, e.hir_id), ExprKind::Block(block, _) => self.block(block), @@ -550,7 +550,7 @@ impl<'tcx> ConstEvalCtxt<'tcx> { /// leaves the local crate. pub fn eval_is_empty(&self, e: &Expr<'_>) -> Option<bool> { match e.kind { - ExprKind::ConstBlock(ConstBlock { body, .. }) => self.eval_is_empty(self.tcx.hir().body(body).value), + ExprKind::ConstBlock(ConstBlock { body, .. }) => self.eval_is_empty(self.tcx.hir_body(body).value), ExprKind::DropTemps(e) => self.eval_is_empty(e), ExprKind::Path(ref qpath) => { if !self @@ -645,7 +645,7 @@ impl<'tcx> ConstEvalCtxt<'tcx> { Res::Def(DefKind::Const | DefKind::AssocConst, def_id) => { // Check if this constant is based on `cfg!(..)`, // which is NOT constant for our purposes. - if let Some(node) = self.tcx.hir().get_if_local(def_id) + if let Some(node) = self.tcx.hir_get_if_local(def_id) && let Node::Item(Item { kind: ItemKind::Const(.., body_id), .. diff --git a/src/tools/clippy/clippy_utils/src/hir_utils.rs b/src/tools/clippy/clippy_utils/src/hir_utils.rs index 4bbf28115a6..9ee30094d60 100644 --- a/src/tools/clippy/clippy_utils/src/hir_utils.rs +++ b/src/tools/clippy/clippy_utils/src/hir_utils.rs @@ -273,8 +273,8 @@ impl HirEqInterExpr<'_, '_, '_> { self.inner.cx.tcx.typeck_body(right), )); let res = self.eq_expr( - self.inner.cx.tcx.hir().body(left).value, - self.inner.cx.tcx.hir().body(right).value, + self.inner.cx.tcx.hir_body(left).value, + self.inner.cx.tcx.hir_body(right).value, ); self.inner.maybe_typeck_results = old_maybe_typeck_results; res @@ -906,7 +906,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { }) => { std::mem::discriminant(&capture_clause).hash(&mut self.s); // closures inherit TypeckResults - self.hash_expr(self.cx.tcx.hir().body(body).value); + self.hash_expr(self.cx.tcx.hir_body(body).value); }, ExprKind::ConstBlock(ref l_id) => { self.hash_body(l_id.body); @@ -1316,7 +1316,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { pub fn hash_body(&mut self, body_id: BodyId) { // swap out TypeckResults when hashing a body let old_maybe_typeck_results = self.maybe_typeck_results.replace(self.cx.tcx.typeck_body(body_id)); - self.hash_expr(self.cx.tcx.hir().body(body_id).value); + self.hash_expr(self.cx.tcx.hir_body(body_id).value); self.maybe_typeck_results = old_maybe_typeck_results; } diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 79cc5066580..ccf32f42a47 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -652,8 +652,6 @@ fn non_local_item_children_by_name(tcx: TyCtxt<'_>, def_id: DefId, name: Symbol) } fn local_item_children_by_name(tcx: TyCtxt<'_>, local_id: LocalDefId, name: Symbol) -> Vec<Res> { - let hir = tcx.hir(); - let root_mod; let item_kind = match tcx.hir_node_by_def_id(local_id) { Node::Crate(r#mod) => { @@ -677,7 +675,7 @@ fn local_item_children_by_name(tcx: TyCtxt<'_>, local_id: LocalDefId, name: Symb ItemKind::Mod(r#mod) => r#mod .item_ids .iter() - .filter_map(|&item_id| res(hir.item(item_id).ident, item_id.owner_id)) + .filter_map(|&item_id| res(tcx.hir_item(item_id).ident, item_id.owner_id)) .collect(), ItemKind::Impl(r#impl) => r#impl .items @@ -944,7 +942,7 @@ pub fn is_default_equivalent(cx: &LateContext<'_>, e: &Expr<'_>) -> bool { ExprKind::Tup(items) | ExprKind::Array(items) => items.iter().all(|x| is_default_equivalent(cx, x)), ExprKind::Repeat(x, len) => { if let ConstArgKind::Anon(anon_const) = len.kind - && let ExprKind::Lit(const_lit) = cx.tcx.hir().body(anon_const.body).value.kind + && let ExprKind::Lit(const_lit) = cx.tcx.hir_body(anon_const.body).value.kind && let LitKind::Int(v, _) = const_lit.node && v <= 32 && is_default_equivalent(cx, x) @@ -974,7 +972,7 @@ fn is_default_equivalent_from(cx: &LateContext<'_>, from_func: &Expr<'_>, arg: & ExprKind::Array([]) => return is_path_diagnostic_item(cx, ty, sym::Vec), ExprKind::Repeat(_, len) => { if let ConstArgKind::Anon(anon_const) = len.kind - && let ExprKind::Lit(const_lit) = cx.tcx.hir().body(anon_const.body).value.kind + && let ExprKind::Lit(const_lit) = cx.tcx.hir_body(anon_const.body).value.kind && let LitKind::Int(v, _) = const_lit.node { return v == 0 && is_path_diagnostic_item(cx, ty, sym::Vec); @@ -1372,8 +1370,8 @@ impl<'tcx> Visitor<'tcx> for ContainsName<'_, 'tcx> { } } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } @@ -1424,7 +1422,7 @@ pub fn get_enclosing_block<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Optio | Node::ImplItem(&ImplItem { kind: ImplItemKind::Fn(_, eid), .. - }) => match cx.tcx.hir().body(eid).value.kind { + }) => match cx.tcx.hir_body(eid).value.kind { ExprKind::Block(block, _) => Some(block), _ => None, }, @@ -2067,7 +2065,7 @@ pub fn get_async_fn_body<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Option<&'t .. }, _, - ) = tcx.hir().body(body).value.kind + ) = tcx.hir_body(body).value.kind { return Some(expr); } @@ -2175,7 +2173,7 @@ pub fn is_expr_untyped_identity_function(cx: &LateContext<'_>, expr: &Expr<'_>) ExprKind::Closure(&Closure { body, fn_decl, .. }) if fn_decl.inputs.iter().all(|ty| matches!(ty.kind, TyKind::Infer(()))) => { - is_body_identity_function(cx, cx.tcx.hir().body(body)) + is_body_identity_function(cx, cx.tcx.hir_body(body)) }, ExprKind::Path(QPath::Resolved(_, path)) if path.segments.iter().all(|seg| seg.infer_args) @@ -2197,7 +2195,7 @@ pub fn is_expr_untyped_identity_function(cx: &LateContext<'_>, expr: &Expr<'_>) /// errors. pub fn is_expr_identity_function(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { match expr.kind { - ExprKind::Closure(&Closure { body, .. }) => is_body_identity_function(cx, cx.tcx.hir().body(body)), + ExprKind::Closure(&Closure { body, .. }) => is_body_identity_function(cx, cx.tcx.hir_body(body)), _ => path_def_id(cx, expr).is_some_and(|id| cx.tcx.is_diagnostic_item(sym::convert_identity, id)), } } @@ -2552,9 +2550,9 @@ fn with_test_item_names(tcx: TyCtxt<'_>, module: LocalModDefId, f: impl Fn(&[Sym Entry::Occupied(entry) => f(entry.get()), Entry::Vacant(entry) => { let mut names = Vec::new(); - for id in tcx.hir().module_items(module) { + for id in tcx.hir_module_free_items(module) { if matches!(tcx.def_kind(id.owner_id), DefKind::Const) - && let item = tcx.hir().item(id) + && let item = tcx.hir_item(id) && let ItemKind::Const(ty, _generics, _body) = item.kind { if let TyKind::Path(QPath::Resolved(_, path)) = ty.kind { @@ -2932,7 +2930,7 @@ pub fn expr_use_ctxt<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) -> ExprU #[allow(unreachable_patterns)] Some(ControlFlow::Break(_)) => unreachable!("type of node is ControlFlow<!>"), None => ExprUseCtxt { - node: Node::Crate(cx.tcx.hir().root_module()), + node: Node::Crate(cx.tcx.hir_root_module()), child_id: HirId::INVALID, adjustments: &[], is_ty_unified: true, diff --git a/src/tools/clippy/clippy_utils/src/ptr.rs b/src/tools/clippy/clippy_utils/src/ptr.rs index 273c1b0defa..360c6251a57 100644 --- a/src/tools/clippy/clippy_utils/src/ptr.rs +++ b/src/tools/clippy/clippy_utils/src/ptr.rs @@ -13,7 +13,7 @@ pub fn get_spans( idx: usize, replacements: &[(&'static str, &'static str)], ) -> Option<Vec<(Span, Cow<'static, str>)>> { - if let Some(body) = opt_body_id.map(|id| cx.tcx.hir().body(id)) { + if let Some(body) = opt_body_id.map(|id| cx.tcx.hir_body(id)) { if let PatKind::Binding(_, binding_id, _, _) = strip_pat_refs(body.params[idx].pat).kind { extract_clone_suggestions(cx, binding_id, replacements, body) } else { diff --git a/src/tools/clippy/clippy_utils/src/sugg.rs b/src/tools/clippy/clippy_utils/src/sugg.rs index 088abd7c479..d5e0e2e3436 100644 --- a/src/tools/clippy/clippy_utils/src/sugg.rs +++ b/src/tools/clippy/clippy_utils/src/sugg.rs @@ -809,7 +809,7 @@ pub fn deref_closure_args(cx: &LateContext<'_>, closure: &hir::Expr<'_>) -> Opti fn_decl, def_id, body, .. }) = closure.kind { - let closure_body = cx.tcx.hir().body(body); + let closure_body = cx.tcx.hir_body(body); // is closure arg a type annotated double reference (i.e.: `|x: &&i32| ...`) // a type annotation is present if param `kind` is different from `TyKind::Infer` let closure_arg_is_type_annotated_double_ref = if let TyKind::Ref(_, MutTy { ty, .. }) = fn_decl.inputs[0].kind diff --git a/src/tools/clippy/clippy_utils/src/usage.rs b/src/tools/clippy/clippy_utils/src/usage.rs index 37f72966892..3bf518f7fe7 100644 --- a/src/tools/clippy/clippy_utils/src/usage.rs +++ b/src/tools/clippy/clippy_utils/src/usage.rs @@ -133,8 +133,8 @@ impl<'tcx> Visitor<'tcx> for BindingUsageFinder<'_, 'tcx> { ControlFlow::Continue(()) } - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } } diff --git a/src/tools/clippy/clippy_utils/src/visitors.rs b/src/tools/clippy/clippy_utils/src/visitors.rs index 70910f5bf52..2ac0efd7e39 100644 --- a/src/tools/clippy/clippy_utils/src/visitors.rs +++ b/src/tools/clippy/clippy_utils/src/visitors.rs @@ -154,8 +154,8 @@ pub fn for_each_expr<'tcx, B, C: Continue>( type NestedFilter = nested_filter::OnlyBodies; type Result = ControlFlow<B>; - fn nested_visit_map(&mut self) -> Self::Map { - self.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.tcx } fn visit_expr(&mut self, e: &'tcx Expr<'tcx>) -> Self::Result { @@ -296,7 +296,7 @@ where /// Checks if the given resolved path is used in the given body. pub fn is_res_used(cx: &LateContext<'_>, res: Res, body: BodyId) -> bool { - for_each_expr(cx, cx.tcx.hir().body(body).value, |e| { + for_each_expr(cx, cx.tcx.hir_body(body).value, |e| { if let ExprKind::Path(p) = &e.kind { if cx.qpath_res(p, e.hir_id) == res { return ControlFlow::Break(()); @@ -412,8 +412,8 @@ pub fn is_expr_unsafe<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> bool { type NestedFilter = nested_filter::OnlyBodies; type Result = ControlFlow<()>; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_expr(&mut self, e: &'tcx Expr<'_>) -> Self::Result { match e.kind { @@ -456,7 +456,7 @@ pub fn is_expr_unsafe<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> bool { } } fn visit_nested_item(&mut self, id: ItemId) -> Self::Result { - if let ItemKind::Impl(i) = &self.cx.tcx.hir().item(id).kind + if let ItemKind::Impl(i) = &self.cx.tcx.hir_item(id).kind && i.safety.is_unsafe() { ControlFlow::Break(()) @@ -477,8 +477,8 @@ pub fn contains_unsafe_block<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) impl<'tcx> Visitor<'tcx> for V<'_, 'tcx> { type Result = ControlFlow<()>; type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_block(&mut self, b: &'tcx Block<'_>) -> Self::Result { @@ -544,8 +544,8 @@ pub fn for_each_local_use_after_expr<'tcx, B>( } impl<'tcx, F: FnMut(&'tcx Expr<'tcx>) -> ControlFlow<B>, B> Visitor<'tcx> for V<'_, 'tcx, F, B> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_expr(&mut self, e: &'tcx Expr<'tcx>) { @@ -729,8 +729,8 @@ pub fn for_each_local_assignment<'tcx, B>( } impl<'tcx, F: FnMut(&'tcx Expr<'tcx>) -> ControlFlow<B>, B> Visitor<'tcx> for V<'_, 'tcx, F, B> { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx.hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx } fn visit_expr(&mut self, e: &'tcx Expr<'tcx>) { diff --git a/src/tools/clippy/tests/ui/author/blocks.stdout b/src/tools/clippy/tests/ui/author/blocks.stdout index 6bf48d5ba4e..54325f9776c 100644 --- a/src/tools/clippy/tests/ui/author/blocks.stdout +++ b/src/tools/clippy/tests/ui/author/blocks.stdout @@ -42,10 +42,10 @@ if let ExprKind::Block(block, None) = expr.kind } if let ExprKind::Closure { capture_clause: CaptureBy::Value { .. }, fn_decl: fn_decl, body: body_id, closure_kind: ClosureKind::CoroutineClosure(CoroutineDesugaring::Async), .. } = expr.kind && let FnRetTy::DefaultReturn(_) = fn_decl.output - && expr1 = &cx.tcx.hir().body(body_id).value + && expr1 = &cx.tcx.hir_body(body_id).value && let ExprKind::Closure { capture_clause: CaptureBy::Ref, fn_decl: fn_decl1, body: body_id1, closure_kind: ClosureKind::Coroutine(CoroutineKind::Desugared(CoroutineDesugaring::Async, CoroutineSource::Closure)), .. } = expr1.kind && let FnRetTy::DefaultReturn(_) = fn_decl1.output - && expr2 = &cx.tcx.hir().body(body_id1).value + && expr2 = &cx.tcx.hir_body(body_id1).value && let ExprKind::Block(block, None) = expr2.kind && block.stmts.is_empty() && let Some(trailing_expr) = block.expr diff --git a/src/tools/clippy/tests/ui/author/macro_in_closure.stdout b/src/tools/clippy/tests/ui/author/macro_in_closure.stdout index 66caf382d89..3186d0cbc27 100644 --- a/src/tools/clippy/tests/ui/author/macro_in_closure.stdout +++ b/src/tools/clippy/tests/ui/author/macro_in_closure.stdout @@ -2,7 +2,7 @@ if let StmtKind::Let(local) = stmt.kind && let Some(init) = local.init && let ExprKind::Closure { capture_clause: CaptureBy::Ref, fn_decl: fn_decl, body: body_id, closure_kind: ClosureKind::Closure, .. } = init.kind && let FnRetTy::DefaultReturn(_) = fn_decl.output - && expr = &cx.tcx.hir().body(body_id).value + && expr = &cx.tcx.hir_body(body_id).value && let ExprKind::Block(block, None) = expr.kind && block.stmts.len() == 1 && let StmtKind::Semi(e) = block.stmts[0].kind diff --git a/src/tools/clippy/tests/ui/author/repeat.stdout b/src/tools/clippy/tests/ui/author/repeat.stdout index 1a608734ada..f2c6b3f807f 100644 --- a/src/tools/clippy/tests/ui/author/repeat.stdout +++ b/src/tools/clippy/tests/ui/author/repeat.stdout @@ -2,7 +2,7 @@ if let ExprKind::Repeat(value, length) = expr.kind && let ExprKind::Lit(ref lit) = value.kind && let LitKind::Int(1, LitIntType::Unsigned(UintTy::U8)) = lit.node && let ConstArgKind::Anon(anon_const) = length.kind - && expr1 = &cx.tcx.hir().body(anon_const.body).value + && expr1 = &cx.tcx.hir_body(anon_const.body).value && let ExprKind::Lit(ref lit1) = expr1.kind && let LitKind::Int(5, LitIntType::Unsuffixed) = lit1.node { diff --git a/src/tools/clippy/tests/ui/implicit_return.stderr b/src/tools/clippy/tests/ui/implicit_return.stderr index 0d2faa5e067..7ea72307450 100644 --- a/src/tools/clippy/tests/ui/implicit_return.stderr +++ b/src/tools/clippy/tests/ui/implicit_return.stderr @@ -8,8 +8,7 @@ LL | true = help: to override `-D warnings` add `#[allow(clippy::implicit_return)]` help: add `return` as shown | -LL - true -LL + return true +LL | return true | error: missing `return` statement @@ -20,9 +19,8 @@ LL | if true { true } else { false } | help: add `return` as shown | -LL - if true { true } else { false } -LL + if true { return true } else { false } - | +LL | if true { return true } else { false } + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:19:29 @@ -32,9 +30,8 @@ LL | if true { true } else { false } | help: add `return` as shown | -LL - if true { true } else { false } -LL + if true { true } else { return false } - | +LL | if true { true } else { return false } + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:25:17 @@ -44,9 +41,8 @@ LL | true => false, | help: add `return` as shown | -LL - true => false, -LL + true => return false, - | +LL | true => return false, + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:26:20 @@ -56,9 +52,8 @@ LL | false => { true }, | help: add `return` as shown | -LL - false => { true }, -LL + false => { return true }, - | +LL | false => { return true }, + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:39:9 @@ -104,9 +99,8 @@ LL | let _ = || { true }; | help: add `return` as shown | -LL - let _ = || { true }; -LL + let _ = || { return true }; - | +LL | let _ = || { return true }; + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:73:16 @@ -116,9 +110,8 @@ LL | let _ = || true; | help: add `return` as shown | -LL - let _ = || true; -LL + let _ = || return true; - | +LL | let _ = || return true; + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:81:5 @@ -128,8 +121,7 @@ LL | format!("test {}", "test") | help: add `return` as shown | -LL - format!("test {}", "test") -LL + return format!("test {}", "test") +LL | return format!("test {}", "test") | error: missing `return` statement @@ -140,8 +132,7 @@ LL | m!(true, false) | help: add `return` as shown | -LL - m!(true, false) -LL + return m!(true, false) +LL | return m!(true, false) | error: missing `return` statement @@ -191,8 +182,7 @@ LL | true | help: add `return` as shown | -LL - true -LL + return true +LL | return true | error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr b/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr index 74fe09e0f5c..91dfe79d55b 100644 --- a/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr +++ b/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr @@ -68,9 +68,8 @@ LL | MAX; | help: use the associated constant instead | -LL - MAX; -LL + u32::MAX; - | +LL | u32::MAX; + | +++++ error: usage of a legacy numeric method --> tests/ui/legacy_numeric_constants.rs:49:10 diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index cde4f7a665c..1614c35cb1c 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -517,6 +517,7 @@ pub struct TargetCfgs { pub all_abis: HashSet<String>, pub all_families: HashSet<String>, pub all_pointer_widths: HashSet<String>, + pub all_rustc_abis: HashSet<String>, } impl TargetCfgs { @@ -536,6 +537,9 @@ impl TargetCfgs { let mut all_abis = HashSet::new(); let mut all_families = HashSet::new(); let mut all_pointer_widths = HashSet::new(); + // NOTE: for distinction between `abi` and `rustc_abi`, see comment on + // `TargetCfg::rustc_abi`. + let mut all_rustc_abis = HashSet::new(); // If current target is not included in the `--print=all-target-specs-json` output, // we check whether it is a custom target from the user or a synthetic target from bootstrap. @@ -576,7 +580,9 @@ impl TargetCfgs { all_families.insert(family.clone()); } all_pointer_widths.insert(format!("{}bit", cfg.pointer_width)); - + if let Some(rustc_abi) = &cfg.rustc_abi { + all_rustc_abis.insert(rustc_abi.clone()); + } all_targets.insert(target.clone()); } @@ -590,6 +596,7 @@ impl TargetCfgs { all_abis, all_families, all_pointer_widths, + all_rustc_abis, } } @@ -676,6 +683,10 @@ pub struct TargetCfg { pub(crate) xray: bool, #[serde(default = "default_reloc_model")] pub(crate) relocation_model: String, + // NOTE: `rustc_abi` should not be confused with `abi`. `rustc_abi` was introduced in #137037 to + // make SSE2 *required* by the ABI (kind of a hack to make a target feature *required* via the + // target spec). + pub(crate) rustc_abi: Option<String>, // Not present in target cfg json output, additional derived information. #[serde(skip)] diff --git a/src/tools/compiletest/src/directive-list.rs b/src/tools/compiletest/src/directive-list.rs index a7ac875d0a3..8c909bcb195 100644 --- a/src/tools/compiletest/src/directive-list.rs +++ b/src/tools/compiletest/src/directive-list.rs @@ -87,6 +87,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "ignore-remote", "ignore-riscv64", "ignore-rustc-debug-assertions", + "ignore-rustc_abi-x86-sse2", "ignore-s390x", "ignore-sgx", "ignore-sparc64", @@ -198,6 +199,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "only-nvptx64", "only-powerpc", "only-riscv64", + "only-rustc_abi-x86-sse2", "only-s390x", "only-sparc", "only-sparc64", diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index cfe51b5655f..72a3b9d85c8 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -234,6 +234,14 @@ fn parse_cfg_name_directive<'a>( allowed_names: ["coverage-map", "coverage-run"], message: "when the test mode is {name}", } + condition! { + name: target_cfg.rustc_abi.as_ref().map(|abi| format!("rustc_abi-{abi}")).unwrap_or_default(), + allowed_names: ContainsPrefixed { + prefix: "rustc_abi-", + inner: target_cfgs.all_rustc_abis.clone(), + }, + message: "when the target `rustc_abi` is {name}", + } condition! { name: "dist", diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index 522d340b678..55292c46bba 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -889,3 +889,17 @@ fn test_needs_target_has_atomic() { assert!(!check_ignore(&config, "//@ needs-target-has-atomic: 8, ptr")); assert!(check_ignore(&config, "//@ needs-target-has-atomic: 8, ptr, 128")); } + +#[test] +// FIXME: this test will fail against stage 0 until #137037 changes reach beta. +#[cfg_attr(bootstrap, ignore)] +fn test_rustc_abi() { + let config = cfg().target("i686-unknown-linux-gnu").build(); + assert_eq!(config.target_cfg().rustc_abi, Some("x86-sse2".to_string())); + assert!(check_ignore(&config, "//@ ignore-rustc_abi-x86-sse2")); + assert!(!check_ignore(&config, "//@ only-rustc_abi-x86-sse2")); + let config = cfg().target("x86_64-unknown-linux-gnu").build(); + assert_eq!(config.target_cfg().rustc_abi, None); + assert!(!check_ignore(&config, "//@ ignore-rustc_abi-x86-sse2")); + assert!(check_ignore(&config, "//@ only-rustc_abi-x86-sse2")); +} diff --git a/src/tools/generate-windows-sys/Cargo.toml b/src/tools/generate-windows-sys/Cargo.toml index 882d3d63525..f5c0e56bb3c 100644 --- a/src/tools/generate-windows-sys/Cargo.toml +++ b/src/tools/generate-windows-sys/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies.windows-bindgen] -version = "0.58.0" +version = "0.59.0" diff --git a/src/tools/generate-windows-sys/src/main.rs b/src/tools/generate-windows-sys/src/main.rs index 6dbf29d957f..6bf47e84062 100644 --- a/src/tools/generate-windows-sys/src/main.rs +++ b/src/tools/generate-windows-sys/src/main.rs @@ -29,8 +29,7 @@ fn main() -> Result<(), Box<dyn Error>> { sort_bindings("bindings.txt")?; - let info = windows_bindgen::bindgen(["--etc", "bindings.txt"])?; - println!("{info}"); + windows_bindgen::bindgen(["--etc", "bindings.txt"]); let mut f = std::fs::File::options().append(true).open("windows_sys.rs")?; f.write_all(ARM32_SHIM.as_bytes())?; diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index a717d8ccf28..44e4f1a2932 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -2,6 +2,7 @@ #![feature(rustc_private)] #![feature(cell_update)] #![feature(float_gamma)] +#![feature(float_erf)] #![feature(map_try_insert)] #![feature(never_type)] #![feature(try_blocks)] diff --git a/src/tools/miri/src/shims/foreign_items.rs b/src/tools/miri/src/shims/foreign_items.rs index 97bfb04f1f4..bedc1ebdc95 100644 --- a/src/tools/miri/src/shims/foreign_items.rs +++ b/src/tools/miri/src/shims/foreign_items.rs @@ -742,6 +742,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { | "log1pf" | "expm1f" | "tgammaf" + | "erff" + | "erfcf" => { let [f] = this.check_shim(abi, Conv::C , link_name, args)?; let f = this.read_scalar(f)?.to_f32()?; @@ -759,6 +761,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { "log1pf" => f_host.ln_1p(), "expm1f" => f_host.exp_m1(), "tgammaf" => f_host.gamma(), + "erff" => f_host.erf(), + "erfcf" => f_host.erfc(), _ => bug!(), }; let res = res.to_soft(); @@ -799,6 +803,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { | "log1p" | "expm1" | "tgamma" + | "erf" + | "erfc" => { let [f] = this.check_shim(abi, Conv::C , link_name, args)?; let f = this.read_scalar(f)?.to_f64()?; @@ -816,6 +822,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { "log1p" => f_host.ln_1p(), "expm1" => f_host.exp_m1(), "tgamma" => f_host.gamma(), + "erf" => f_host.erf(), + "erfc" => f_host.erfc(), _ => bug!(), }; let res = res.to_soft(); diff --git a/src/tools/miri/tests/fail/panic/panic_abort1.rs b/src/tools/miri/tests/fail/panic/panic_abort1.rs index 300bfa32ecb..7552c7b7e80 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort1.rs +++ b/src/tools/miri/tests/fail/panic/panic_abort1.rs @@ -1,6 +1,6 @@ //@error-in-other-file: the program aborted execution //@normalize-stderr-test: "\| +\^+" -> "| ^" -//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();" +//@normalize-stderr-test: "unsafe \{ libc::abort\(\); \}|core::intrinsics::abort\(\);" -> "ABORT();" //@compile-flags: -C panic=abort fn main() { diff --git a/src/tools/miri/tests/fail/panic/panic_abort2.rs b/src/tools/miri/tests/fail/panic/panic_abort2.rs index 5d691350577..624f9933545 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort2.rs +++ b/src/tools/miri/tests/fail/panic/panic_abort2.rs @@ -1,6 +1,6 @@ //@error-in-other-file: the program aborted execution //@normalize-stderr-test: "\| +\^+" -> "| ^" -//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();" +//@normalize-stderr-test: "unsafe \{ libc::abort\(\); \}|core::intrinsics::abort\(\);" -> "ABORT();" //@compile-flags: -C panic=abort fn main() { diff --git a/src/tools/miri/tests/fail/panic/panic_abort3.rs b/src/tools/miri/tests/fail/panic/panic_abort3.rs index 25afc315628..d1435b55946 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort3.rs +++ b/src/tools/miri/tests/fail/panic/panic_abort3.rs @@ -1,6 +1,6 @@ //@error-in-other-file: the program aborted execution //@normalize-stderr-test: "\| +\^+" -> "| ^" -//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();" +//@normalize-stderr-test: "unsafe \{ libc::abort\(\); \}|core::intrinsics::abort\(\);" -> "ABORT();" //@compile-flags: -C panic=abort fn main() { diff --git a/src/tools/miri/tests/fail/panic/panic_abort4.rs b/src/tools/miri/tests/fail/panic/panic_abort4.rs index 025b51a5cf5..54b9c9cbfdb 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort4.rs +++ b/src/tools/miri/tests/fail/panic/panic_abort4.rs @@ -1,6 +1,6 @@ //@error-in-other-file: the program aborted execution //@normalize-stderr-test: "\| +\^+" -> "| ^" -//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();" +//@normalize-stderr-test: "unsafe \{ libc::abort\(\); \}|core::intrinsics::abort\(\);" -> "ABORT();" //@compile-flags: -C panic=abort fn main() { diff --git a/src/tools/miri/tests/pass/float.rs b/src/tools/miri/tests/pass/float.rs index 2f4f64b1aa8..51cafbb3f43 100644 --- a/src/tools/miri/tests/pass/float.rs +++ b/src/tools/miri/tests/pass/float.rs @@ -1,4 +1,5 @@ #![feature(stmt_expr_attributes)] +#![feature(float_erf)] #![feature(float_gamma)] #![feature(core_intrinsics)] #![feature(f128)] @@ -1076,6 +1077,11 @@ pub fn libm() { let (val, sign) = (-0.5f64).ln_gamma(); assert_approx_eq!(val, (2.0 * f64::consts::PI.sqrt()).ln()); assert_eq!(sign, -1); + + assert_approx_eq!(1.0f32.erf(), 0.84270079294971486934122063508260926f32); + assert_approx_eq!(1.0f64.erf(), 0.84270079294971486934122063508260926f64); + assert_approx_eq!(1.0f32.erfc(), 0.15729920705028513065877936491739074f32); + assert_approx_eq!(1.0f64.erfc(), 0.15729920705028513065877936491739074f64); } fn test_fast() { 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 new file mode 100644 index 00000000000..171bf0c82d5 --- /dev/null +++ b/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.stderr @@ -0,0 +1,5 @@ +warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 <https://github.com/rust-lang/rust/issues/116344> + diff --git a/src/tools/rust-analyzer/crates/hir-def/src/data/adt.rs b/src/tools/rust-analyzer/crates/hir-def/src/data/adt.rs index 8fc19854033..5d1834a8642 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/data/adt.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/data/adt.rs @@ -9,6 +9,7 @@ use hir_expand::name::Name; use intern::sym; use la_arena::Arena; use rustc_abi::{Align, Integer, IntegerType, ReprFlags, ReprOptions}; +use rustc_hashes::Hash64; use triomphe::Arc; use tt::iter::TtElement; @@ -172,7 +173,7 @@ fn parse_repr_tt(tt: &TopSubtree) -> Option<ReprOptions> { } } - Some(ReprOptions { int, align: max_align, pack: min_pack, flags, field_shuffle_seed: 0 }) + Some(ReprOptions { int, align: max_align, pack: min_pack, flags, field_shuffle_seed: Hash64::ZERO }) } impl StructData { diff --git a/src/tools/rust-analyzer/crates/hir-def/src/lib.rs b/src/tools/rust-analyzer/crates/hir-def/src/lib.rs index c8efd904320..9c947df35e9 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/lib.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/lib.rs @@ -18,9 +18,15 @@ extern crate ra_ap_rustc_parse_format as rustc_parse_format; #[cfg(feature = "in-rust-tree")] extern crate rustc_abi; +#[cfg(feature = "in-rust-tree")] +extern crate rustc_hashes; + #[cfg(not(feature = "in-rust-tree"))] extern crate ra_ap_rustc_abi as rustc_abi; +#[cfg(not(feature = "in-rust-tree"))] +extern crate ra_ap_rustc_hashes as rustc_hashes; + pub mod db; pub mod attr; diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs index 2b854310a15..3312da470c0 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs @@ -95,7 +95,7 @@ impl<'db> MatchCheckCtx<'db> { let place_validity = PlaceValidity::from_bool(known_valid_scrutinee.unwrap_or(true)); // Measured to take ~100ms on modern hardware. - let complexity_limit = Some(500000); + let complexity_limit = 500000; compute_match_usefulness(self, arms, scrut_ty, place_validity, complexity_limit) } diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs b/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs index 108171586ea..b6f7c44c2ae 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/layout.rs @@ -15,6 +15,7 @@ use hir_def::{ use la_arena::{Idx, RawIdx}; use rustc_abi::AddressSpace; use rustc_index::{IndexSlice, IndexVec}; +use rustc_hashes::Hash64; use triomphe::Arc; @@ -197,7 +198,7 @@ fn layout_of_simd_ty( align, max_repr_align: None, unadjusted_abi_align: align.abi, - randomization_seed: 0, + randomization_seed: Hash64::ZERO, })) } @@ -314,7 +315,7 @@ pub fn layout_of_ty_query( size, max_repr_align: None, unadjusted_abi_align: element.align.abi, - randomization_seed: 0, + randomization_seed: Hash64::ZERO, } } TyKind::Slice(element) => { @@ -328,7 +329,7 @@ pub fn layout_of_ty_query( size: Size::ZERO, max_repr_align: None, unadjusted_abi_align: element.align.abi, - randomization_seed: 0, + randomization_seed: Hash64::ZERO, } } TyKind::Str => Layout { @@ -340,7 +341,7 @@ pub fn layout_of_ty_query( size: Size::ZERO, max_repr_align: None, unadjusted_abi_align: dl.i8_align.abi, - randomization_seed: 0, + randomization_seed: Hash64::ZERO, }, // Potentially-wide pointers. TyKind::Ref(_, _, pointee) | TyKind::Raw(_, pointee) => { diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs b/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs index 55d81875a2b..daddcf0b242 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs @@ -12,6 +12,9 @@ extern crate ra_ap_rustc_index as rustc_index; #[cfg(feature = "in-rust-tree")] extern crate rustc_abi; +#[cfg(feature = "in-rust-tree")] +extern crate rustc_hashes; + #[cfg(not(feature = "in-rust-tree"))] extern crate ra_ap_rustc_abi as rustc_abi; @@ -21,6 +24,9 @@ extern crate rustc_pattern_analysis; #[cfg(not(feature = "in-rust-tree"))] extern crate ra_ap_rustc_pattern_analysis as rustc_pattern_analysis; +#[cfg(not(feature = "in-rust-tree"))] +extern crate ra_ap_rustc_hashes as rustc_hashes; + mod builder; mod chalk_db; mod chalk_ext; diff --git a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs index 14af22c3193..ed9d6c67501 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs @@ -9107,8 +9107,8 @@ The tracking issue for this feature is: [#27721] deny_since: None, }, Lint { - label: "pattern_complexity", - description: r##"# `pattern_complexity` + label: "pattern_complexity_limit", + description: r##"# `pattern_complexity_limit` This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use. diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 5478ff4a6c6..e8e7dfe0d84 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -132,6 +132,7 @@ const EXCEPTIONS_CARGO: ExceptionList = &[ ("dunce", "CC0-1.0 OR MIT-0 OR Apache-2.0"), ("encoding_rs", "(Apache-2.0 OR MIT) AND BSD-3-Clause"), ("fiat-crypto", "MIT OR Apache-2.0 OR BSD-1-Clause"), + ("foldhash", "Zlib"), ("im-rc", "MPL-2.0+"), ("normalize-line-endings", "Apache-2.0"), ("openssl", "Apache-2.0"), @@ -476,6 +477,8 @@ const PERMITTED_STDLIB_DEPENDENCIES: &[&str] = &[ "memchr", "miniz_oxide", "object", + "proc-macro2", + "quote", "r-efi", "r-efi-alloc", "rand", @@ -483,6 +486,8 @@ const PERMITTED_STDLIB_DEPENDENCIES: &[&str] = &[ "rand_xorshift", "rustc-demangle", "shlex", + "syn", + "unicode-ident", "unicode-width", "unwinding", "wasi", @@ -496,6 +501,8 @@ const PERMITTED_STDLIB_DEPENDENCIES: &[&str] = &[ "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", + "zerocopy", + "zerocopy-derive", // tidy-alphabetical-end ]; diff --git a/src/version b/src/version index b7844a6ffdc..f6342716723 100644 --- a/src/version +++ b/src/version @@ -1 +1 @@ -1.86.0 +1.87.0 diff --git a/tests/assembly/asm/aarch64-types.rs b/tests/assembly/asm/aarch64-types.rs index 439385b14b0..8e4e0850325 100644 --- a/tests/assembly/asm/aarch64-types.rs +++ b/tests/assembly/asm/aarch64-types.rs @@ -11,8 +11,6 @@ #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -// FIXME(f16_f128): Only needed for FIXME in check! and check_reg! -#![feature(auto_traits, lang_items)] extern crate minicore; use minicore::*; @@ -63,12 +61,6 @@ impl Copy for f16x8 {} impl Copy for f32x4 {} impl Copy for f64x2 {} -// FIXME(f16_f128): Only needed for FIXME in check! and check_reg! -#[lang = "freeze"] -unsafe auto trait Freeze {} -#[lang = "unpin"] -auto trait Unpin {} - extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 1c5f9eeba3c..0aa8b6b8f89 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -14,9 +14,20 @@ //! <https://github.com/rust-lang/rust/blob/c0b5cc9003f6464c11ae1c0662c6a7e06f6f5cab/compiler/rustc_codegen_cranelift/example/mini_core.rs>. // ignore-tidy-linelength -#![feature(no_core, lang_items, rustc_attrs, decl_macro, naked_functions, f16, f128)] +#![feature( + no_core, + lang_items, + auto_traits, + freeze_impls, + negative_impls, + rustc_attrs, + decl_macro, + naked_functions, + f16, + f128, + asm_experimental_arch +)] #![allow(unused, improper_ctypes_definitions, internal_features)] -#![feature(asm_experimental_arch)] #![no_std] #![no_core] @@ -42,6 +53,12 @@ pub trait Copy: Sized {} #[lang = "bikeshed_guaranteed_no_drop"] pub trait BikeshedGuaranteedNoDrop {} +#[lang = "freeze"] +pub unsafe auto trait Freeze {} + +#[lang = "unpin"] +pub auto trait Unpin {} + impl_marker_trait!( Copy => [ bool, char, @@ -83,6 +100,7 @@ impl<T: Copy + ?Sized> Copy for ManuallyDrop<T> {} pub struct UnsafeCell<T: ?Sized> { value: T, } +impl<T: ?Sized> !Freeze for UnsafeCell<T> {} #[rustc_builtin_macro] pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { diff --git a/tests/codegen/abi-win64-zst.rs b/tests/codegen/abi-win64-zst.rs index dd361898144..825a5c1b09c 100644 --- a/tests/codegen/abi-win64-zst.rs +++ b/tests/codegen/abi-win64-zst.rs @@ -1,4 +1,5 @@ //@ compile-flags: -Z merge-functions=disabled +//@ add-core-stubs //@ revisions: windows-gnu //@[windows-gnu] compile-flags: --target x86_64-pc-windows-gnu @@ -13,12 +14,12 @@ //@[linux] compile-flags: --target x86_64-unknown-linux-gnu //@[linux] needs-llvm-components: x86 -#![feature(no_core, lang_items, rustc_attrs, abi_vectorcall)] +#![feature(no_core, rustc_attrs, abi_vectorcall)] #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // Make sure the argument is always passed when explicitly requesting a Windows ABI. // Our goal here is to match clang: <https://clang.godbolt.org/z/Wr4jMWq3P>. diff --git a/tests/codegen/align-byval-alignment-mismatch.rs b/tests/codegen/align-byval-alignment-mismatch.rs index 835cc7393e5..46cfb2972df 100644 --- a/tests/codegen/align-byval-alignment-mismatch.rs +++ b/tests/codegen/align-byval-alignment-mismatch.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions:i686-linux x86_64-linux //@[i686-linux] compile-flags: --target i686-unknown-linux-gnu -C panic=abort @@ -16,18 +17,14 @@ // on i686-unknown-linux-gnu, since the alignment needs to be increased, and should codegen // to a direct call on x86_64-unknown-linux-gnu, where byval alignment matches Rust alignment. -#![feature(no_core, lang_items)] +#![feature(no_core)] #![crate_type = "lib"] #![no_std] #![no_core] #![allow(non_camel_case_types)] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // This type has align 1 in Rust, but as a byval argument on i686-linux, it will have align 4. #[repr(C)] diff --git a/tests/codegen/align-byval-vector.rs b/tests/codegen/align-byval-vector.rs index 60d49f93081..c33b41a7bbe 100644 --- a/tests/codegen/align-byval-vector.rs +++ b/tests/codegen/align-byval-vector.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions:x86-linux x86-darwin //@[x86-linux] compile-flags: --target i686-unknown-linux-gnu @@ -7,18 +8,14 @@ // Tests that aggregates containing vector types get their alignment increased to 16 on Darwin. -#![feature(no_core, lang_items, repr_simd, simd_ffi)] +#![feature(no_core, repr_simd, simd_ffi)] #![crate_type = "lib"] #![no_std] #![no_core] #![allow(non_camel_case_types)] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i32x4([i32; 4]); diff --git a/tests/codegen/align-byval.rs b/tests/codegen/align-byval.rs index b057147ab13..75dabd74a79 100644 --- a/tests/codegen/align-byval.rs +++ b/tests/codegen/align-byval.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions:m68k x86_64-linux x86_64-windows i686-linux i686-windows //@[m68k] compile-flags: --target m68k-unknown-linux-gnu @@ -16,20 +17,13 @@ // The only targets that use `byval` are m68k, x86-64, and x86. // Note also that Windows mandates a by-ref ABI here, so it does not use byval. -#![feature(no_core, lang_items)] +#![feature(no_core)] #![crate_type = "lib"] #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} -impl Copy for i64 {} +extern crate minicore; +use minicore::*; // This struct can be represented as a pair, so it exercises the OperandValue::Pair // codepath in `codegen_argument`. diff --git a/tests/codegen/common_prim_int_ptr.rs b/tests/codegen/common_prim_int_ptr.rs index 8eb05024174..a1d7a125f32 100644 --- a/tests/codegen/common_prim_int_ptr.rs +++ b/tests/codegen/common_prim_int_ptr.rs @@ -40,7 +40,7 @@ pub unsafe fn extract_int(x: Result<usize, Box<()>>) -> usize { } // CHECK-LABEL: @extract_box -// CHECK-SAME: (i{{[0-9]+}} {{[^%]+}} [[DISCRIMINANT:%[0-9]+]], ptr {{[^,]+}} [[PAYLOAD:%[0-9]+]]) +// CHECK-SAME: (i{{[0-9]+}} {{[^%]+}} [[DISCRIMINANT:%[0-9]+]], ptr {{[^%]+}} [[PAYLOAD:%[0-9]+]]) #[no_mangle] pub unsafe fn extract_box(x: Result<usize, Box<i32>>) -> Box<i32> { // CHECK: ret ptr [[PAYLOAD]] diff --git a/tests/codegen/intrinsics/transmute-niched.rs b/tests/codegen/intrinsics/transmute-niched.rs index 88119ccb8b2..5ded0e192fa 100644 --- a/tests/codegen/intrinsics/transmute-niched.rs +++ b/tests/codegen/intrinsics/transmute-niched.rs @@ -6,6 +6,7 @@ use std::mem::transmute; use std::num::NonZero; +use std::ptr::NonNull; #[repr(u8)] pub enum SmallEnum { @@ -192,3 +193,31 @@ pub unsafe fn check_bool_to_ordering(x: bool) -> std::cmp::Ordering { transmute(x) } + +// CHECK-LABEL: @check_nonnull_to_ptr( +#[no_mangle] +pub unsafe fn check_nonnull_to_ptr(x: NonNull<u8>) -> *const u8 { + // CHECK-NOT: icmp + // CHECK-NOT: assume + // OPT: %0 = icmp ne ptr %x, null + // OPT: call void @llvm.assume(i1 %0) + // CHECK-NOT: icmp + // CHECK-NOT: assume + // CHECK: ret ptr %x + + transmute(x) +} + +// CHECK-LABEL: @check_ptr_to_nonnull( +#[no_mangle] +pub unsafe fn check_ptr_to_nonnull(x: *const u8) -> NonNull<u8> { + // CHECK-NOT: icmp + // CHECK-NOT: assume + // OPT: %0 = icmp ne ptr %x, null + // OPT: call void @llvm.assume(i1 %0) + // CHECK-NOT: icmp + // CHECK-NOT: assume + // CHECK: ret ptr %x + + transmute(x) +} diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen/intrinsics/transmute.rs index 541333a52b0..5b40a6a12c0 100644 --- a/tests/codegen/intrinsics/transmute.rs +++ b/tests/codegen/intrinsics/transmute.rs @@ -370,9 +370,11 @@ pub unsafe fn check_issue_110005(x: (usize, bool)) -> Option<Box<[u8]>> { #[no_mangle] pub unsafe fn check_pair_to_dst_ref<'a>(x: (usize, usize)) -> &'a [u8] { // CHECK: %_0.0 = getelementptr i8, ptr null, i64 %x.0 - // CHECK: %0 = insertvalue { ptr, i64 } poison, ptr %_0.0, 0 - // CHECK: %1 = insertvalue { ptr, i64 } %0, i64 %x.1, 1 - // CHECK: ret { ptr, i64 } %1 + // CHECK: %0 = icmp ne ptr %_0.0, null + // CHECK: call void @llvm.assume(i1 %0) + // CHECK: %1 = insertvalue { ptr, i64 } poison, ptr %_0.0, 0 + // CHECK: %2 = insertvalue { ptr, i64 } %1, i64 %x.1, 1 + // CHECK: ret { ptr, i64 } %2 transmute(x) } diff --git a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs index dce156dd425..7b3a20a295e 100644 --- a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs +++ b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs @@ -11,7 +11,7 @@ pub fn simple_size_of_nowrap(x: &[u32]) -> usize { // Make sure the shift used to compute the size has a nowrap flag. - // CHECK: [[A:%.*]] = shl nsw {{.*}}, 2 + // CHECK: [[A:%.*]] = shl nuw nsw {{.*}}, 2 // CHECK-NEXT: ret {{.*}} [[A]] core::mem::size_of_val(x) } @@ -26,3 +26,13 @@ pub fn drop_write(mut x: Box<[u32]>) { // CHECK-NOT: store i32 42 x[1] = 42; } + +// CHECK-LABEL: @slice_size_plus_2 +#[no_mangle] +pub fn slice_size_plus_2(x: &[u16]) -> usize { + // Before #136575 this didn't get the `nuw` in the add. + + // CHECK: [[BYTES:%.+]] = shl nuw nsw {{i16|i32|i64}} %x.1, 1 + // CHECK: = add nuw {{i16|i32|i64}} [[BYTES]], 2 + core::mem::size_of_val(x) + 2 +} diff --git a/tests/codegen/slice-iter-len-eq-zero.rs b/tests/codegen/slice-iter-len-eq-zero.rs index c85861d47f8..6998d98e498 100644 --- a/tests/codegen/slice-iter-len-eq-zero.rs +++ b/tests/codegen/slice-iter-len-eq-zero.rs @@ -1,4 +1,5 @@ //@ compile-flags: -Copt-level=3 +//@ needs-deterministic-layouts (opposite scalar pair orders breaks it) #![crate_type = "lib"] type Demo = [u8; 3]; @@ -7,7 +8,40 @@ type Demo = [u8; 3]; #[no_mangle] pub fn slice_iter_len_eq_zero(y: std::slice::Iter<'_, Demo>) -> bool { // CHECK-NOT: sub - // CHECK: %[[RET:.+]] = icmp eq ptr {{%1|%0}}, {{%1|%0}} + // CHECK: %[[RET:.+]] = icmp eq ptr {{%y.0, %y.1|%y.1, %y.0}} + // CHECK: ret i1 %[[RET]] + y.len() == 0 +} + +// CHECK-LABEL: @slice_iter_len_eq_zero_ref +#[no_mangle] +pub fn slice_iter_len_eq_zero_ref(y: &mut std::slice::Iter<'_, Demo>) -> bool { + // CHECK-NOT: sub + // CHECK: %[[A:.+]] = load ptr + // CHECK-SAME: !nonnull + // CHECK: %[[B:.+]] = load ptr + // CHECK-SAME: !nonnull + // CHECK: %[[RET:.+]] = icmp eq ptr %[[A]], %[[B]] + // CHECK: ret i1 %[[RET]] + y.len() == 0 +} + +struct MyZST; + +// CHECK-LABEL: @slice_zst_iter_len_eq_zero +#[no_mangle] +pub fn slice_zst_iter_len_eq_zero(y: std::slice::Iter<'_, MyZST>) -> bool { + // CHECK: %[[RET:.+]] = icmp eq ptr %y.1, null + // CHECK: ret i1 %[[RET]] + y.len() == 0 +} + +// CHECK-LABEL: @slice_zst_iter_len_eq_zero_ref +#[no_mangle] +pub fn slice_zst_iter_len_eq_zero_ref(y: &mut std::slice::Iter<'_, MyZST>) -> bool { + // CHECK: %[[LEN:.+]] = load ptr + // CHECK-NOT: !nonnull + // CHECK: %[[RET:.+]] = icmp eq ptr %[[LEN]], null // CHECK: ret i1 %[[RET]] y.len() == 0 } diff --git a/tests/codegen/slice-ref-equality.rs b/tests/codegen/slice-ref-equality.rs index a5046a75944..2940378da3c 100644 --- a/tests/codegen/slice-ref-equality.rs +++ b/tests/codegen/slice-ref-equality.rs @@ -47,7 +47,7 @@ pub fn is_zero_array(data: &[u8; 4]) -> bool { #[no_mangle] fn eq_slice_of_nested_u8(x: &[[u8; 3]], y: &[[u8; 3]]) -> bool { // CHECK: icmp eq [[USIZE]] %x.1, %y.1 - // CHECK: %[[BYTES:.+]] = mul nsw [[USIZE]] {{%x.1|%y.1}}, 3 + // CHECK: %[[BYTES:.+]] = mul nuw nsw [[USIZE]] {{%x.1|%y.1}}, 3 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y @@ -59,7 +59,7 @@ fn eq_slice_of_nested_u8(x: &[[u8; 3]], y: &[[u8; 3]]) -> bool { #[no_mangle] fn eq_slice_of_i32(x: &[i32], y: &[i32]) -> bool { // CHECK: icmp eq [[USIZE]] %x.1, %y.1 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] {{%x.1|%y.1}}, 2 + // CHECK: %[[BYTES:.+]] = shl nuw nsw [[USIZE]] {{%x.1|%y.1}}, 2 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y @@ -71,7 +71,7 @@ fn eq_slice_of_i32(x: &[i32], y: &[i32]) -> bool { #[no_mangle] fn eq_slice_of_nonzero(x: &[NonZero<i32>], y: &[NonZero<i32>]) -> bool { // CHECK: icmp eq [[USIZE]] %x.1, %y.1 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] {{%x.1|%y.1}}, 2 + // CHECK: %[[BYTES:.+]] = shl nuw nsw [[USIZE]] {{%x.1|%y.1}}, 2 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y @@ -83,7 +83,7 @@ fn eq_slice_of_nonzero(x: &[NonZero<i32>], y: &[NonZero<i32>]) -> bool { #[no_mangle] fn eq_slice_of_option_of_nonzero(x: &[Option<NonZero<i16>>], y: &[Option<NonZero<i16>>]) -> bool { // CHECK: icmp eq [[USIZE]] %x.1, %y.1 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] {{%x.1|%y.1}}, 1 + // CHECK: %[[BYTES:.+]] = shl nuw nsw [[USIZE]] {{%x.1|%y.1}}, 1 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.diff b/tests/mir-opt/box_expr.main.ElaborateDrops.diff index ec40fac2894..827dc6ac7ae 100644 --- a/tests/mir-opt/box_expr.main.ElaborateDrops.diff +++ b/tests/mir-opt/box_expr.main.ElaborateDrops.diff @@ -12,6 +12,7 @@ let mut _7: std::boxed::Box<S>; + let mut _8: &mut std::boxed::Box<S>; + let mut _9: (); ++ let mut _10: *const S; scope 1 { debug x => _1; } @@ -68,7 +69,7 @@ bb8 (cleanup): { - drop(_5) -> [return: bb9, unwind terminate(cleanup)]; -+ goto -> bb11; ++ goto -> bb12; } bb9 (cleanup): { @@ -82,6 +83,11 @@ + + bb11 (cleanup): { + goto -> bb10; ++ } ++ ++ bb12 (cleanup): { ++ _10 = copy ((_5.0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>) as *const S (Transmute); ++ goto -> bb11; } } diff --git a/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff new file mode 100644 index 00000000000..f090795e886 --- /dev/null +++ b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff @@ -0,0 +1,94 @@ +- // MIR for `maybe_move` before ElaborateDrops ++ // MIR for `maybe_move` after ElaborateDrops + + fn maybe_move(_1: bool, _2: Box<String>) -> Option<String> { + debug cond => _1; + debug thing => _2; + let mut _0: std::option::Option<std::string::String>; + let mut _3: bool; + let mut _4: std::string::String; ++ let mut _5: bool; ++ let mut _6: &mut std::boxed::Box<std::string::String>; ++ let mut _7: (); ++ let mut _8: &mut std::boxed::Box<std::string::String>; ++ let mut _9: (); ++ let mut _10: *const std::string::String; + + bb0: { ++ _5 = const false; ++ _5 = const true; + StorageLive(_3); + _3 = copy _1; + switchInt(move _3) -> [0: bb3, otherwise: bb1]; + } + + bb1: { + StorageLive(_4); ++ _5 = const false; + _4 = move (*_2); + _0 = Option::<String>::Some(move _4); +- drop(_4) -> [return: bb2, unwind: bb6]; ++ goto -> bb2; + } + + bb2: { + StorageDead(_4); + goto -> bb4; + } + + bb3: { + _0 = Option::<String>::None; + goto -> bb4; + } + + bb4: { + StorageDead(_3); +- drop(_2) -> [return: bb5, unwind continue]; ++ goto -> bb14; + } + + bb5: { + return; + } + + bb6 (cleanup): { +- drop(_2) -> [return: bb7, unwind terminate(cleanup)]; ++ goto -> bb7; + } + + bb7 (cleanup): { + resume; ++ } ++ ++ bb8: { ++ goto -> bb5; ++ } ++ ++ bb9: { ++ _6 = &mut _2; ++ _7 = <Box<String> as Drop>::drop(move _6) -> [return: bb8, unwind: bb7]; ++ } ++ ++ bb10 (cleanup): { ++ _8 = &mut _2; ++ _9 = <Box<String> as Drop>::drop(move _8) -> [return: bb7, unwind terminate(cleanup)]; ++ } ++ ++ bb11: { ++ goto -> bb13; ++ } ++ ++ bb12: { ++ drop((*_10)) -> [return: bb9, unwind: bb10]; ++ } ++ ++ bb13: { ++ switchInt(copy _5) -> [0: bb9, otherwise: bb12]; ++ } ++ ++ bb14: { ++ _10 = copy ((_2.0: std::ptr::Unique<std::string::String>).0: std::ptr::NonNull<std::string::String>) as *const std::string::String (Transmute); ++ goto -> bb11; + } + } + diff --git a/tests/mir-opt/box_partial_move.rs b/tests/mir-opt/box_partial_move.rs new file mode 100644 index 00000000000..5cbd242986f --- /dev/null +++ b/tests/mir-opt/box_partial_move.rs @@ -0,0 +1,17 @@ +//@ test-mir-pass: ElaborateDrops +//@ needs-unwind + +#![feature(rustc_attrs, liballoc_internals)] + +// EMIT_MIR box_partial_move.maybe_move.ElaborateDrops.diff +fn maybe_move(cond: bool, thing: Box<String>) -> Option<String> { + // CHECK-LABEL: fn maybe_move( + // CHECK: let mut [[PTR:_[0-9]+]]: *const std::string::String; + // CHECK: [[PTR]] = copy ((_2.0: std::ptr::Unique<std::string::String>).0: std::ptr::NonNull<std::string::String>) as *const std::string::String (Transmute); + // CHECK: drop((*[[PTR]])) + if cond { Some(*thing) } else { None } +} + +fn main() { + maybe_move(false, Box::new("hello".to_string())); +} diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs index 635ad825a12..4368933dc62 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs @@ -1,5 +1,6 @@ // skip-filecheck //@ compile-flags: -Zmir-enable-passes=+Inline,+GVN --crate-type lib +// EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR dont_reset_cast_kind_without_updating_operand.test.GVN.diff diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff index 37dd14e6c89..37dd14e6c89 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff index 6bac6805943..6bac6805943 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.panic-unwind.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff new file mode 100644 index 00000000000..1cf0f6de011 --- /dev/null +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff @@ -0,0 +1,180 @@ +- // MIR for `test` before GVN ++ // MIR for `test` after GVN + + fn test() -> () { + let mut _0: (); + let _1: &std::boxed::Box<()>; + let _2: &std::boxed::Box<()>; + let _3: std::boxed::Box<()>; + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _23: usize; + scope 1 { + debug vp_ctx => _1; + let _4: *const (); + scope 2 { + debug slf => _10; + let _5: *const [()]; + scope 3 { + debug bytes => _5; + let _7: *mut (); + scope 4 { + debug _x => _7; + } + scope 18 (inlined foo) { + } + } + scope 16 (inlined slice_from_raw_parts::<()>) { + scope 17 (inlined std::ptr::from_raw_parts::<[()], ()>) { + } + } + } + } + scope 5 (inlined Box::<()>::new) { + let mut _11: usize; + let mut _12: usize; + let mut _13: *mut u8; + scope 6 (inlined alloc::alloc::exchange_malloc) { + let _14: std::alloc::Layout; + let mut _15: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>; + let mut _16: isize; + let mut _18: !; + scope 7 { + let _17: std::ptr::NonNull<[u8]>; + scope 8 { + scope 11 (inlined NonNull::<[u8]>::as_mut_ptr) { + scope 12 (inlined NonNull::<[u8]>::as_non_null_ptr) { + scope 13 (inlined NonNull::<[u8]>::cast::<u8>) { + let mut _22: *mut [u8]; + scope 14 (inlined NonNull::<[u8]>::as_ptr) { + } + } + } + scope 15 (inlined NonNull::<u8>::as_ptr) { + } + } + } + scope 10 (inlined <std::alloc::Global as Allocator>::allocate) { + } + } + scope 9 (inlined Layout::from_size_align_unchecked) { + let mut _19: bool; + let _20: (); + let mut _21: std::ptr::Alignment; + } + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + StorageLive(_11); + StorageLive(_12); + StorageLive(_13); +- _11 = SizeOf(()); +- _12 = AlignOf(()); ++ _11 = const 0_usize; ++ _12 = const 1_usize; + StorageLive(_14); + StorageLive(_16); + StorageLive(_17); + StorageLive(_19); + _19 = const false; +- switchInt(move _19) -> [0: bb6, otherwise: bb5]; ++ switchInt(const false) -> [0: bb6, otherwise: bb5]; + } + + bb1: { + StorageDead(_3); + StorageDead(_1); + return; + } + + bb2: { + unreachable; + } + + bb3: { +- _18 = handle_alloc_error(move _14) -> unwind unreachable; ++ _18 = handle_alloc_error(const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}) -> unwind unreachable; + } + + bb4: { + _17 = copy ((_15 as Ok).0: std::ptr::NonNull<[u8]>); + StorageLive(_22); + _22 = copy _17 as *mut [u8] (Transmute); + _13 = copy _22 as *mut u8 (PtrToPtr); + StorageDead(_22); + StorageDead(_15); + StorageDead(_17); + StorageDead(_16); + StorageDead(_14); + _3 = ShallowInitBox(move _13, ()); + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + _2 = &_3; + _1 = copy _2; +- StorageDead(_2); ++ nop; + StorageLive(_4); +- _9 = deref_copy _3; ++ _9 = copy _3; + _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute); + _4 = copy _10; +- StorageLive(_5); ++ nop; + StorageLive(_6); +- _6 = copy _4; ++ _6 = copy _10; + StorageLive(_23); + _23 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _23); ++ _5 = *const [()] from (copy _10, const 1_usize); + StorageDead(_23); + StorageDead(_6); + StorageLive(_7); + StorageLive(_8); + _8 = copy _5; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _7 = copy _5 as *mut () (PtrToPtr); + StorageDead(_8); + StorageDead(_7); +- StorageDead(_5); ++ nop; + StorageDead(_4); + drop(_3) -> [return: bb1, unwind unreachable]; + } + + bb5: { +- _20 = Layout::from_size_align_unchecked::precondition_check(copy _11, copy _12) -> [return: bb6, unwind unreachable]; ++ _20 = Layout::from_size_align_unchecked::precondition_check(const 0_usize, const 1_usize) -> [return: bb6, unwind unreachable]; + } + + bb6: { + StorageDead(_19); + StorageLive(_21); +- _21 = copy _12 as std::ptr::Alignment (Transmute); +- _14 = Layout { size: copy _11, align: move _21 }; ++ _21 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); ++ _14 = const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}; + StorageDead(_21); + StorageLive(_15); +- _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], copy _14, const false) -> [return: bb7, unwind unreachable]; ++ _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}, const false) -> [return: bb7, unwind unreachable]; + } + + bb7: { + _16 = discriminant(_15); + switchInt(move _16) -> [0: bb4, 1: bb3, otherwise: bb2]; + } ++ } ++ ++ ALLOC0 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ + } + diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff new file mode 100644 index 00000000000..6bac6805943 --- /dev/null +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff @@ -0,0 +1,88 @@ +- // MIR for `test` before GVN ++ // MIR for `test` after GVN + + fn test() -> () { + let mut _0: (); + let _1: &std::boxed::Box<()>; + let _2: &std::boxed::Box<()>; + let _3: std::boxed::Box<()>; + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _11: usize; + scope 1 { + debug vp_ctx => _1; + let _4: *const (); + scope 2 { + debug slf => _10; + let _5: *const [()]; + scope 3 { + debug bytes => _5; + let _7: *mut (); + scope 4 { + debug _x => _7; + } + scope 7 (inlined foo) { + } + } + scope 5 (inlined slice_from_raw_parts::<()>) { + scope 6 (inlined std::ptr::from_raw_parts::<[()], ()>) { + } + } + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + _3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; + } + + bb1: { + _2 = &_3; + _1 = copy _2; +- StorageDead(_2); ++ nop; + StorageLive(_4); +- _9 = deref_copy _3; ++ _9 = copy _3; + _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute); + _4 = copy _10; +- StorageLive(_5); ++ nop; + StorageLive(_6); +- _6 = copy _4; ++ _6 = copy _10; + StorageLive(_11); + _11 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _11); ++ _5 = *const [()] from (copy _10, const 1_usize); + StorageDead(_11); + StorageDead(_6); + StorageLive(_7); + StorageLive(_8); + _8 = copy _5; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _7 = copy _5 as *mut () (PtrToPtr); + StorageDead(_8); + StorageDead(_7); +- StorageDead(_5); ++ nop; + StorageDead(_4); + drop(_3) -> [return: bb2, unwind: bb3]; + } + + bb2: { + StorageDead(_3); + StorageDead(_1); + return; + } + + bb3 (cleanup): { + resume; + } + } + diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir index 22be48c47b2..38d00cfbabd 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir @@ -4,22 +4,21 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { debug it => _1; let mut _0: bool; scope 1 (inlined <std::slice::Iter<'_, T> as ExactSizeIterator>::is_empty) { - let mut _2: *const *const T; - let mut _3: *const std::ptr::NonNull<T>; - let mut _8: *const T; + let mut _2: *const T; + let mut _7: *const T; scope 2 { - let _4: std::ptr::NonNull<T>; - let _9: usize; + let _3: std::ptr::NonNull<T>; + let _8: usize; scope 3 { } scope 4 { - scope 8 (inlined <NonNull<T> as PartialEq>::eq) { - let mut _5: std::ptr::NonNull<T>; + scope 7 (inlined <NonNull<T> as PartialEq>::eq) { + let mut _4: std::ptr::NonNull<T>; + let mut _5: *mut T; let mut _6: *mut T; - let mut _7: *mut T; - scope 9 (inlined NonNull::<T>::as_ptr) { + scope 8 (inlined NonNull::<T>::as_ptr) { } - scope 10 (inlined NonNull::<T>::as_ptr) { + scope 9 (inlined NonNull::<T>::as_ptr) { } } } @@ -27,50 +26,45 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { scope 6 (inlined std::ptr::const_ptr::<impl *const T>::cast::<()>) { } } - scope 7 (inlined std::ptr::const_ptr::<impl *const *const T>::cast::<NonNull<T>>) { - } } } bb0: { - StorageLive(_9); StorageLive(_8); - StorageLive(_4); + StorageLive(_7); + StorageLive(_3); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_3); StorageLive(_2); - _2 = &raw const ((*_1).1: *const T); - _3 = copy _2 as *const std::ptr::NonNull<T> (PtrToPtr); + _2 = copy ((*_1).1: *const T); + _3 = move _2 as std::ptr::NonNull<T> (Transmute); StorageDead(_2); - _4 = copy (*_3); - StorageDead(_3); - StorageLive(_6); StorageLive(_5); - _5 = copy ((*_1).0: std::ptr::NonNull<T>); - _6 = copy _5 as *mut T (Transmute); - StorageDead(_5); - StorageLive(_7); - _7 = copy _4 as *mut T (Transmute); - _0 = Eq(move _6, move _7); - StorageDead(_7); + StorageLive(_4); + _4 = copy ((*_1).0: std::ptr::NonNull<T>); + _5 = copy _4 as *mut T (Transmute); + StorageDead(_4); + StorageLive(_6); + _6 = copy _3 as *mut T (Transmute); + _0 = Eq(move _5, move _6); StorageDead(_6); + StorageDead(_5); goto -> bb3; } bb2: { - _8 = copy ((*_1).1: *const T); - _9 = copy _8 as usize (Transmute); - _0 = Eq(copy _9, const 0_usize); + _7 = copy ((*_1).1: *const T); + _8 = copy _7 as usize (Transmute); + _0 = Eq(copy _8, const 0_usize); goto -> bb3; } bb3: { - StorageDead(_4); + StorageDead(_3); + StorageDead(_7); StorageDead(_8); - StorageDead(_9); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir index 22be48c47b2..38d00cfbabd 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir @@ -4,22 +4,21 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { debug it => _1; let mut _0: bool; scope 1 (inlined <std::slice::Iter<'_, T> as ExactSizeIterator>::is_empty) { - let mut _2: *const *const T; - let mut _3: *const std::ptr::NonNull<T>; - let mut _8: *const T; + let mut _2: *const T; + let mut _7: *const T; scope 2 { - let _4: std::ptr::NonNull<T>; - let _9: usize; + let _3: std::ptr::NonNull<T>; + let _8: usize; scope 3 { } scope 4 { - scope 8 (inlined <NonNull<T> as PartialEq>::eq) { - let mut _5: std::ptr::NonNull<T>; + scope 7 (inlined <NonNull<T> as PartialEq>::eq) { + let mut _4: std::ptr::NonNull<T>; + let mut _5: *mut T; let mut _6: *mut T; - let mut _7: *mut T; - scope 9 (inlined NonNull::<T>::as_ptr) { + scope 8 (inlined NonNull::<T>::as_ptr) { } - scope 10 (inlined NonNull::<T>::as_ptr) { + scope 9 (inlined NonNull::<T>::as_ptr) { } } } @@ -27,50 +26,45 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { scope 6 (inlined std::ptr::const_ptr::<impl *const T>::cast::<()>) { } } - scope 7 (inlined std::ptr::const_ptr::<impl *const *const T>::cast::<NonNull<T>>) { - } } } bb0: { - StorageLive(_9); StorageLive(_8); - StorageLive(_4); + StorageLive(_7); + StorageLive(_3); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_3); StorageLive(_2); - _2 = &raw const ((*_1).1: *const T); - _3 = copy _2 as *const std::ptr::NonNull<T> (PtrToPtr); + _2 = copy ((*_1).1: *const T); + _3 = move _2 as std::ptr::NonNull<T> (Transmute); StorageDead(_2); - _4 = copy (*_3); - StorageDead(_3); - StorageLive(_6); StorageLive(_5); - _5 = copy ((*_1).0: std::ptr::NonNull<T>); - _6 = copy _5 as *mut T (Transmute); - StorageDead(_5); - StorageLive(_7); - _7 = copy _4 as *mut T (Transmute); - _0 = Eq(move _6, move _7); - StorageDead(_7); + StorageLive(_4); + _4 = copy ((*_1).0: std::ptr::NonNull<T>); + _5 = copy _4 as *mut T (Transmute); + StorageDead(_4); + StorageLive(_6); + _6 = copy _3 as *mut T (Transmute); + _0 = Eq(move _5, move _6); StorageDead(_6); + StorageDead(_5); goto -> bb3; } bb2: { - _8 = copy ((*_1).1: *const T); - _9 = copy _8 as usize (Transmute); - _0 = Eq(copy _9, const 0_usize); + _7 = copy ((*_1).1: *const T); + _8 = copy _7 as usize (Transmute); + _0 = Eq(copy _8, const 0_usize); goto -> bb3; } bb3: { - StorageDead(_4); + StorageDead(_3); + StorageDead(_7); StorageDead(_8); - StorageDead(_9); return; } } diff --git a/tests/run-make/amdgpu-kd/foo.rs b/tests/run-make/amdgpu-kd/foo.rs new file mode 100644 index 00000000000..a0d803ab813 --- /dev/null +++ b/tests/run-make/amdgpu-kd/foo.rs @@ -0,0 +1,11 @@ +#![allow(internal_features)] +#![feature(no_core, lang_items, abi_gpu_kernel)] +#![no_core] +#![no_std] + +// This is needed because of #![no_core]: +#[lang = "sized"] +trait Sized {} + +#[no_mangle] +extern "gpu-kernel" fn kernel() {} diff --git a/tests/run-make/amdgpu-kd/rmake.rs b/tests/run-make/amdgpu-kd/rmake.rs new file mode 100644 index 00000000000..a787fa1da93 --- /dev/null +++ b/tests/run-make/amdgpu-kd/rmake.rs @@ -0,0 +1,20 @@ +// On the amdhsa OS, the host runtime (HIP or HSA) expects a kernel descriptor object for each +// kernel in the ELF file. The amdgpu LLVM backend generates the object. It is created as a symbol +// with the name of the kernel plus a .kd suffix. +// Check that the produced object has the .kd symbol exported. + +//@ needs-llvm-components: amdgpu +//@ needs-rust-lld + +use run_make_support::{llvm_readobj, rustc}; + +fn main() { + rustc() + .crate_name("foo") + .target("amdgcn-amd-amdhsa") + .arg("-Ctarget-cpu=gfx900") + .crate_type("cdylib") + .input("foo.rs") + .run(); + llvm_readobj().input("foo.elf").symbols().run().assert_stdout_contains("kernel.kd"); +} diff --git a/tests/run-make/rustc-crates-on-stable/rmake.rs b/tests/run-make/rustc-crates-on-stable/rmake.rs index 9fbc675cc9a..cbc1f24b8c1 100644 --- a/tests/run-make/rustc-crates-on-stable/rmake.rs +++ b/tests/run-make/rustc-crates-on-stable/rmake.rs @@ -35,6 +35,8 @@ fn main() { "rustc_abi", "-p", "rustc_parse_format", + "-p", + "rustc_hashes", ]) .run(); } diff --git a/tests/rustdoc-js-std/vec-new.js b/tests/rustdoc-js-std/vec-new.js index bb122ff4398..0eae8b6c197 100644 --- a/tests/rustdoc-js-std/vec-new.js +++ b/tests/rustdoc-js-std/vec-new.js @@ -9,7 +9,7 @@ const EXPECTED = [ { 'query': 'prelude::vec', 'others': [ - { 'path': 'std::prelude::rust_2024', 'name': 'Vec' }, + { 'path': 'std::prelude::v1', 'name': 'Vec' }, ], }, { diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout index ca6e7750264..13e142df837 100644 --- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout @@ -5,7 +5,7 @@ test $DIR/relative-path-include-bytes-132203.rs - (line 18) ... FAILED failures: ---- $DIR/relative-path-include-bytes-132203.rs - (line 18) stdout ---- -error: couldn't read `$DIR/relative-dir-empty-file`: No such file or directory (os error 2) +error: couldn't read `$DIR/relative-dir-empty-file`: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/relative-path-include-bytes-132203.rs:19:9 | LL | let x = include_bytes!("relative-dir-empty-file"); diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs index 6fddaa49fac..ceacd69a5fd 100644 --- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs @@ -1,4 +1,3 @@ -//@ ignore-windows different error message //@ revisions: edition2015 edition2024 //@[edition2015]edition:2015 //@[edition2015]check-fail @@ -7,8 +6,9 @@ //@[edition2024]edition:2024 //@[edition2024]check-pass //@[edition2024]compile-flags:--test --test-args=--test-threads=1 -//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout: "tests.rustdoc-ui.doctest." -> "$$DIR/" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "`: .* \(os error 2\)" -> "`: $$FILE_NOT_FOUND_MSG (os error 2)" // https://github.com/rust-lang/rust/issues/132203 // This version, because it's edition2024, passes thanks to the new diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.rs b/tests/rustdoc-ui/intra-doc/weird-syntax.rs index ca18842fb21..d2a922b2b62 100644 --- a/tests/rustdoc-ui/intra-doc/weird-syntax.rs +++ b/tests/rustdoc-ui/intra-doc/weird-syntax.rs @@ -117,24 +117,49 @@ pub struct WLinkToCloneWithUnmatchedEscapedCloseParenAndDoubleSpace; // References -/// The [cln][] link here is going to be unresolved, because `Clone()` gets rejected //~ERROR link -/// in Markdown for not being URL-shaped enough. -/// -/// [cln]: Clone() //~ERROR link +/// The [cln][] link here is going to be unresolved, because `Clone()` gets +//~^ ERROR link +/// rejected in Markdown for not being URL-shaped enough. +/// [cln]: Clone() +//~^ ERROR link pub struct LinkToCloneWithParensInReference; -/// The [cln][] link here is going to be unresolved, because `struct@Clone` gets //~ERROR link -/// rejected in Markdown for not being URL-shaped enough. +/// The [cln][] link here is going to produce a good inline suggestion /// -/// [cln]: struct@Clone //~ERROR link +/// [cln]: struct@Clone +//~^ ERROR link pub struct LinkToCloneWithWrongPrefix; -/// The [cln][] link here will produce a plain text suggestion //~ERROR link +/// The [cln][] link here will produce a good inline suggestion /// /// [cln]: Clone\(\) +//~^ ERROR link pub struct LinkToCloneWithEscapedParensInReference; -/// The [cln][] link here will produce a plain text suggestion //~ERROR link +/// The [cln][] link here will produce a good inline suggestion /// /// [cln]: struct\@Clone +//~^ ERROR link pub struct LinkToCloneWithEscapedAtsInReference; + + +/// This link reference definition isn't used, but since it is still parsed, +/// it should still produce a warning. +/// +/// [cln]: struct\@Clone +//~^ ERROR link +pub struct UnusedLinkToCloneReferenceDefinition; + +/// <https://github.com/rust-lang/rust/issues/133150> +/// +/// - [`SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`]: the +//~^ ERROR link +/// `(__unsafe_unretained)` NSWindow associated with the window, if you want +/// to wrap an existing window. +/// - [`SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER`]: the `(__unsafe_unretained)` +/// NSView associated with the window, defaults to `[window contentView]` +pub fn a() {} +#[allow(nonstandard_style)] +pub struct SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER; +#[allow(nonstandard_style)] +pub struct SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER; diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr index 1381c1b31eb..ad813f0f9b6 100644 --- a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr +++ b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr @@ -230,7 +230,7 @@ LL | /// [w](Clone \)) error: unresolved link to `cln` --> $DIR/weird-syntax.rs:120:10 | -LL | /// The [cln][] link here is going to be unresolved, because `Clone()` gets rejected +LL | /// The [cln][] link here is going to be unresolved, because `Clone()` gets | ^^^ no item named `cln` in scope | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` @@ -243,37 +243,61 @@ LL | /// [cln]: Clone() | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` -error: unresolved link to `cln` - --> $DIR/weird-syntax.rs:126:10 +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:129:12 | -LL | /// The [cln][] link here is going to be unresolved, because `struct@Clone` gets - | ^^^ no item named `cln` in scope +LL | /// [cln]: struct@Clone + | ^^^^^^^^^^^^ this link resolved to a trait, which is not a struct | - = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` - -error: unresolved link to `cln` - --> $DIR/weird-syntax.rs:129:6 +help: to link to the trait, prefix with `trait@` | -LL | /// [cln]: struct@Clone - | ^^^ no item named `cln` in scope +LL - /// [cln]: struct@Clone +LL + /// [cln]: trait@Clone | - = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` error: unresolved link to `Clone` - --> $DIR/weird-syntax.rs:132:9 + --> $DIR/weird-syntax.rs:135:12 + | +LL | /// [cln]: Clone\(\) + | ^^^^^^^^^ this link resolves to the trait `Clone`, which is not a function + | +help: to link to the trait, prefix with `trait@` | -LL | /// The [cln][] link here will produce a plain text suggestion - | ^^^^^ this link resolves to the trait `Clone`, which is not a function +LL - /// [cln]: Clone\(\) +LL + /// [cln]: trait@Clone | - = help: to link to the trait, prefix with `trait@`: trait@Clone error: incompatible link kind for `Clone` - --> $DIR/weird-syntax.rs:137:9 + --> $DIR/weird-syntax.rs:141:12 | -LL | /// The [cln][] link here will produce a plain text suggestion - | ^^^^^ this link resolved to a trait, which is not a struct +LL | /// [cln]: struct\@Clone + | ^^^^^^^^^^^^^ this link resolved to a trait, which is not a struct | - = help: to link to the trait, prefix with `trait@`: trait@Clone +help: to link to the trait, prefix with `trait@` + | +LL - /// [cln]: struct\@Clone +LL + /// [cln]: trait@struct + | + +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:149:12 + | +LL | /// [cln]: struct\@Clone + | ^^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [cln]: struct\@Clone +LL + /// [cln]: trait@struct + | + +error: unresolved link to `the` + --> $DIR/weird-syntax.rs:155:56 + | +LL | /// - [`SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`]: the + | ^^^ no item named `the` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` -error: aborting due to 26 previous errors +error: aborting due to 27 previous errors diff --git a/tests/ui-fulldeps/missing-rustc-driver-error.stderr b/tests/ui-fulldeps/missing-rustc-driver-error.stderr index d7bf27d6349..faad6264522 100644 --- a/tests/ui-fulldeps/missing-rustc-driver-error.stderr +++ b/tests/ui-fulldeps/missing-rustc-driver-error.stderr @@ -2,5 +2,13 @@ error: crate `rustc_serialize` required to be available in rlib format, but was | = help: try adding `extern crate rustc_driver;` at the top level of this crate +error: crate `rustc_hashes` required to be available in rlib format, but was not found in this form + | + = help: try adding `extern crate rustc_driver;` at the top level of this crate + +error: crate `rustc_stable_hash` required to be available in rlib format, but was not found in this form + | + = help: try adding `extern crate rustc_driver;` at the top level of this crate + error: aborting due to NUMBER previous errors diff --git a/tests/ui-fulldeps/obtain-borrowck.rs b/tests/ui-fulldeps/obtain-borrowck.rs index c6bec4f77a0..84f6970c83a 100644 --- a/tests/ui-fulldeps/obtain-borrowck.rs +++ b/tests/ui-fulldeps/obtain-borrowck.rs @@ -67,7 +67,6 @@ impl rustc_driver::Callbacks for CompilerCalls { fn after_analysis<'tcx>(&mut self, _compiler: &Compiler, tcx: TyCtxt<'tcx>) -> Compilation { tcx.sess.dcx().abort_if_errors(); // Collect definition ids of MIR bodies. - let hir = tcx.hir(); let mut bodies = Vec::new(); let crate_items = tcx.hir_crate_items(()); @@ -79,7 +78,7 @@ impl rustc_driver::Callbacks for CompilerCalls { for id in crate_items.trait_items() { if matches!(tcx.def_kind(id.owner_id), DefKind::AssocFn) { - let trait_item = hir.trait_item(id); + let trait_item = tcx.hir_trait_item(id); if let rustc_hir::TraitItemKind::Fn(_, trait_fn) = &trait_item.kind { if let rustc_hir::TraitFn::Provided(_) = trait_fn { bodies.push(trait_item.owner_id); diff --git a/tests/ui/abi/c-zst.aarch64-darwin.stderr b/tests/ui/abi/c-zst.aarch64-darwin.stderr index d9742612bcf..c8f7d0a517c 100644 --- a/tests/ui/abi/c-zst.aarch64-darwin.stderr +++ b/tests/ui/abi/c-zst.aarch64-darwin.stderr @@ -60,7 +60,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.powerpc-linux.stderr b/tests/ui/abi/c-zst.powerpc-linux.stderr index 0e98b5f806b..1015f7d8898 100644 --- a/tests/ui/abi/c-zst.powerpc-linux.stderr +++ b/tests/ui/abi/c-zst.powerpc-linux.stderr @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.rs b/tests/ui/abi/c-zst.rs index 6b299ffadb7..c1dac41f876 100644 --- a/tests/ui/abi/c-zst.rs +++ b/tests/ui/abi/c-zst.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ normalize-stderr: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" /*! C doesn't have zero-sized types... except it does. @@ -52,12 +53,12 @@ extern "C" fn(i32, (), i32); //@[x86_64-pc-windows-gnu] needs-llvm-components: x86 -#![feature(lang_items, no_core, rustc_attrs)] +#![feature(no_core, rustc_attrs)] #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[rustc_abi(debug)] extern "C" fn pass_zst(_: ()) {} //~ ERROR: fn_abi diff --git a/tests/ui/abi/c-zst.s390x-linux.stderr b/tests/ui/abi/c-zst.s390x-linux.stderr index 0e98b5f806b..1015f7d8898 100644 --- a/tests/ui/abi/c-zst.s390x-linux.stderr +++ b/tests/ui/abi/c-zst.s390x-linux.stderr @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.sparc64-linux.stderr b/tests/ui/abi/c-zst.sparc64-linux.stderr index 0e98b5f806b..1015f7d8898 100644 --- a/tests/ui/abi/c-zst.sparc64-linux.stderr +++ b/tests/ui/abi/c-zst.sparc64-linux.stderr @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.x86_64-linux.stderr b/tests/ui/abi/c-zst.x86_64-linux.stderr index d9742612bcf..c8f7d0a517c 100644 --- a/tests/ui/abi/c-zst.x86_64-linux.stderr +++ b/tests/ui/abi/c-zst.x86_64-linux.stderr @@ -60,7 +60,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr index 0e98b5f806b..1015f7d8898 100644 --- a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr +++ b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index b9ea541e981..5e19674250f 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -134,9 +134,8 @@ LL | type Baz = T; | --- required by a bound in this associated type help: consider further restricting type parameter `T` with trait `Clone` | -LL - Self::Baz: Clone, -LL + Self::Baz: Clone, T: std::clone::Clone - | +LL | Self::Baz: Clone, T: std::clone::Clone + | ++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index b9ea541e981..5e19674250f 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -134,9 +134,8 @@ LL | type Baz = T; | --- required by a bound in this associated type help: consider further restricting type parameter `T` with trait `Clone` | -LL - Self::Baz: Clone, -LL + Self::Baz: Clone, T: std::clone::Clone - | +LL | Self::Baz: Clone, T: std::clone::Clone + | ++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index b29e9cc16e2..dc919299710 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -13,9 +13,8 @@ LL | impl<T: NotNull> IntoNullable for T { | unsatisfied trait bound introduced here help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | -LL - Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, -LL + Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull - | +LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull + | +++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:40:1 @@ -38,9 +37,8 @@ LL | impl<T: NotNull> IntoNullable for T { | unsatisfied trait bound introduced here help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | -LL - Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, -LL + Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull - | +LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull + | +++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:10 diff --git a/tests/ui/associated-types/issue-54108.current.stderr b/tests/ui/associated-types/issue-54108.current.stderr index 1b2285b214f..115a591c68f 100644 --- a/tests/ui/associated-types/issue-54108.current.stderr +++ b/tests/ui/associated-types/issue-54108.current.stderr @@ -12,9 +12,8 @@ LL | type Size: Add<Output = Self::Size>; | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` help: consider further restricting the associated type | -LL - T: SubEncoder, -LL + T: SubEncoder, <T as SubEncoder>::ActualSize: Add - | +LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add + | ++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-54108.next.stderr b/tests/ui/associated-types/issue-54108.next.stderr index cc80ab63901..e6d65d8246a 100644 --- a/tests/ui/associated-types/issue-54108.next.stderr +++ b/tests/ui/associated-types/issue-54108.next.stderr @@ -12,9 +12,8 @@ LL | type Size: Add<Output = Self::Size>; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` help: consider further restricting the associated type | -LL - T: SubEncoder, -LL + T: SubEncoder, <T as SubEncoder>::ActualSize: Add - | +LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add + | ++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/crate-name-macro-call.rs b/tests/ui/attributes/crate-name-macro-call.rs new file mode 100644 index 00000000000..1aae2e506e2 --- /dev/null +++ b/tests/ui/attributes/crate-name-macro-call.rs @@ -0,0 +1,6 @@ +// issue: rust-lang/rust#122001 +// Ensure we reject macro calls inside `#![crate_name]` as their result wouldn't get honored anyway. + +#![crate_name = concat!("my", "crate")] //~ ERROR malformed `crate_name` attribute input + +fn main() {} diff --git a/tests/ui/attributes/crate-name-macro-call.stderr b/tests/ui/attributes/crate-name-macro-call.stderr new file mode 100644 index 00000000000..ab562b41a31 --- /dev/null +++ b/tests/ui/attributes/crate-name-macro-call.stderr @@ -0,0 +1,8 @@ +error: malformed `crate_name` attribute input + --> $DIR/crate-name-macro-call.rs:4:1 + | +LL | #![crate_name = concat!("my", "crate")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid_crate_type_syntax.rs b/tests/ui/attributes/crate-type-delimited.rs index 621587af35e..621587af35e 100644 --- a/tests/ui/invalid_crate_type_syntax.rs +++ b/tests/ui/attributes/crate-type-delimited.rs diff --git a/tests/ui/invalid_crate_type_syntax.stderr b/tests/ui/attributes/crate-type-delimited.stderr index a5563720f62..0bbbe07b198 100644 --- a/tests/ui/invalid_crate_type_syntax.stderr +++ b/tests/ui/attributes/crate-type-delimited.stderr @@ -1,5 +1,5 @@ error: malformed `crate_type` attribute input - --> $DIR/invalid_crate_type_syntax.rs:2:1 + --> $DIR/crate-type-delimited.rs:2:1 | LL | #![crate_type(lib)] | ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "bin|lib|..."]` diff --git a/tests/ui/no_crate_type.rs b/tests/ui/attributes/crate-type-empty.rs index d8e687e04a7..d8e687e04a7 100644 --- a/tests/ui/no_crate_type.rs +++ b/tests/ui/attributes/crate-type-empty.rs diff --git a/tests/ui/no_crate_type.stderr b/tests/ui/attributes/crate-type-empty.stderr index 85d8f87afa6..b9279d961ee 100644 --- a/tests/ui/no_crate_type.stderr +++ b/tests/ui/attributes/crate-type-empty.stderr @@ -1,5 +1,5 @@ error: malformed `crate_type` attribute input - --> $DIR/no_crate_type.rs:2:1 + --> $DIR/crate-type-empty.rs:2:1 | LL | #![crate_type] | ^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "bin|lib|..."]` diff --git a/tests/ui/invalid/invalid-crate-type-macro.rs b/tests/ui/attributes/crate-type-macro-call.rs index 9ba5e79ba94..9ba5e79ba94 100644 --- a/tests/ui/invalid/invalid-crate-type-macro.rs +++ b/tests/ui/attributes/crate-type-macro-call.rs diff --git a/tests/ui/invalid/invalid-crate-type-macro.stderr b/tests/ui/attributes/crate-type-macro-call.stderr index 1cf77d4086b..6ccc3edf885 100644 --- a/tests/ui/invalid/invalid-crate-type-macro.stderr +++ b/tests/ui/attributes/crate-type-macro-call.stderr @@ -1,5 +1,5 @@ error: malformed `crate_type` attribute input - --> $DIR/invalid-crate-type-macro.rs:1:1 + --> $DIR/crate-type-macro-call.rs:1:1 | LL | #![crate_type = foo!()] | ^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "bin|lib|..."]` diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index f475e9c494e..dc71d974daf 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -35,9 +35,8 @@ LL | x.inser(); | help: there is a method `insert` with a similar name | -LL - x.inser(); -LL + x.insert(); - | +LL | x.insert(); + | + error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:15:7 diff --git a/tests/ui/attributes/rustc_confusables_std_cases.stderr b/tests/ui/attributes/rustc_confusables_std_cases.stderr index b9acf2d31ab..f2d9ebe2c0e 100644 --- a/tests/ui/attributes/rustc_confusables_std_cases.stderr +++ b/tests/ui/attributes/rustc_confusables_std_cases.stderr @@ -38,9 +38,8 @@ LL | let mut x = VecDeque::new(); | ----- earlier `x` shadowed here with type `VecDeque` help: you might have meant to use `push_back` | -LL - x.push(1); -LL + x.push_back(1); - | +LL | x.push_back(1); + | +++++ error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:15:7 @@ -98,9 +97,8 @@ note: method defined here --> $SRC_DIR/alloc/src/string.rs:LL:COL help: you might have meant to use `push_str` | -LL - String::new().push(""); -LL + String::new().push_str(""); - | +LL | String::new().push_str(""); + | ++++ error[E0599]: no method named `append` found for struct `String` in the current scope --> $DIR/rustc_confusables_std_cases.rs:24:19 diff --git a/tests/ui/borrowck/alias-liveness/name-region.rs b/tests/ui/borrowck/alias-liveness/name-region.rs new file mode 100644 index 00000000000..9545a9eed2f --- /dev/null +++ b/tests/ui/borrowck/alias-liveness/name-region.rs @@ -0,0 +1,13 @@ +// Make sure we don't ICE when trying to name the regions that appear in the alias +// of the type test error. + +trait AnotherTrait { + type Ty2<'a>; +} + +fn test_alias<T: AnotherTrait>(_: &'static T::Ty2<'_>) { + let _: &'static T::Ty2<'_>; + //~^ ERROR the associated type `<T as AnotherTrait>::Ty2<'_>` may not live long enough +} + +fn main() {} diff --git a/tests/ui/borrowck/alias-liveness/name-region.stderr b/tests/ui/borrowck/alias-liveness/name-region.stderr new file mode 100644 index 00000000000..9a5dd711c68 --- /dev/null +++ b/tests/ui/borrowck/alias-liveness/name-region.stderr @@ -0,0 +1,14 @@ +error[E0310]: the associated type `<T as AnotherTrait>::Ty2<'_>` may not live long enough + --> $DIR/name-region.rs:9:12 + | +LL | let _: &'static T::Ty2<'_>; + | ^^^^^^^^^^^^^^^^^^^ + | | + | the associated type `<T as AnotherTrait>::Ty2<'_>` must be valid for the static lifetime... + | ...so that the type `<T as AnotherTrait>::Ty2<'_>` will meet its required lifetime bounds + | + = help: consider adding an explicit lifetime bound `<T as AnotherTrait>::Ty2<'_>: 'static`... + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr index 53b833e7c91..61c01f0f024 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr @@ -8,9 +8,8 @@ LL | self.layers.iter().fold(0, |result, mut layer| result + layer.proce | help: you may want to use `iter_mut` here | -LL - self.layers.iter().fold(0, |result, mut layer| result + layer.process()) -LL + self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) - | +LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr index 86d53012cf3..c6955317d87 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr @@ -8,9 +8,8 @@ LL | vec.iter().flat_map(|container| container.things()).cloned().co | help: you may want to use `iter_mut` here | -LL - vec.iter().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>(); -LL + vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>(); - | +LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>(); + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr index f0a17d76a67..ae4920b2a8c 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr @@ -8,9 +8,8 @@ LL | v.iter().for_each(|a| a.double()); | help: you may want to use `iter_mut` here | -LL - v.iter().for_each(|a| a.double()); -LL + v.iter_mut().for_each(|a| a.double()); - | +LL | v.iter_mut().for_each(|a| a.double()); + | ++++ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/issue-62387-suggest-iter-mut.rs:25:39 @@ -22,9 +21,8 @@ LL | v.iter().rev().rev().for_each(|a| a.double()); | help: you may want to use `iter_mut` here | -LL - v.iter().rev().rev().for_each(|a| a.double()); -LL + v.iter_mut().rev().rev().for_each(|a| a.double()); - | +LL | v.iter_mut().rev().rev().for_each(|a| a.double()); + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr index 4ad3b73fd66..ce31f0d300f 100644 --- a/tests/ui/c-variadic/issue-86053-1.stderr +++ b/tests/ui/c-variadic/issue-86053-1.stderr @@ -63,9 +63,8 @@ LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize | help: a trait with a similar name exists | -LL - self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { -LL + self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { - | +LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { + | + help: you might be missing a type parameter | LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self , diff --git a/tests/ui/cfg/cfg-method-receiver.stderr b/tests/ui/cfg/cfg-method-receiver.stderr index 639413b90fa..44f3d8d058e 100644 --- a/tests/ui/cfg/cfg-method-receiver.stderr +++ b/tests/ui/cfg/cfg-method-receiver.stderr @@ -16,9 +16,8 @@ LL | cbor_map! { #[cfg(test)] 4}; = note: this error originates in the macro `cbor_map` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `i32` | -LL - cbor_map! { #[cfg(test)] 4}; -LL + cbor_map! { #[cfg(test)] 4_i32}; - | +LL | cbor_map! { #[cfg(test)] 4_i32}; + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr index ab7111eca24..ebfc9a935d2 100644 --- a/tests/ui/check-cfg/diagnotics.cargo.stderr +++ b/tests/ui/check-cfg/diagnotics.cargo.stderr @@ -17,9 +17,8 @@ LL | #[cfg(featur = "foo")] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration help: there is a config with a similar name and value | -LL - #[cfg(featur = "foo")] -LL + #[cfg(feature = "foo")] - | +LL | #[cfg(feature = "foo")] + | + warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/check-cfg/diagnotics.rustc.stderr b/tests/ui/check-cfg/diagnotics.rustc.stderr index 4aae1f00e70..8860b3ff5da 100644 --- a/tests/ui/check-cfg/diagnotics.rustc.stderr +++ b/tests/ui/check-cfg/diagnotics.rustc.stderr @@ -19,9 +19,8 @@ LL | #[cfg(featur = "foo")] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration help: there is a config with a similar name and value | -LL - #[cfg(featur = "foo")] -LL + #[cfg(feature = "foo")] - | +LL | #[cfg(feature = "foo")] + | + warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr index f5cbecc5704..ced582c9ff5 100644 --- a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr +++ b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr @@ -108,9 +108,8 @@ LL | let PAT = v1; = note: the matched value is of type `u32` help: introduce a variable instead | -LL - let PAT = v1; -LL + let PAT_var = v1; - | +LL | let PAT_var = v1; + | ++++ error: aborting due to 7 previous errors diff --git a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr index f717343122e..bfe4afc4b58 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr @@ -8,9 +8,8 @@ LL | V(x) = func_arg; | help: consider dereferencing to access the inner value using the Deref trait | -LL - V(x) = func_arg; -LL + V(x) = &*func_arg; - | +LL | V(x) = &*func_arg; + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/closures/eager-mono-with-normalizable-upvars.rs b/tests/ui/closures/eager-mono-with-normalizable-upvars.rs new file mode 100644 index 00000000000..4d934f7a7a9 --- /dev/null +++ b/tests/ui/closures/eager-mono-with-normalizable-upvars.rs @@ -0,0 +1,19 @@ +//@ compile-flags: -Clink-dead-code -Csymbol-mangling-version=v0 +//@ build-pass + +// Ensure that when eagerly collecting `test::{closure#0}`, we don't try +// collecting an unnormalized version of the closure (specifically its +// upvars), since the closure captures the RPIT `opaque::{opaque#0}`. + +fn opaque() -> impl Sized {} + +fn test() -> impl FnOnce() { + let opaque = opaque(); + move || { + let opaque = opaque; + } +} + +fn main() { + test()(); +} diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index acce1dc191a..90672cd83d7 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -15,9 +15,8 @@ LL | _func: F, | help: a trait with a similar name exists | -LL - _func: F, -LL + _func: Fn, - | +LL | _func: Fn, + | + help: you might be missing a type parameter | LL | struct Map2<Segment2, F> { diff --git a/tests/ui/command/need-crate-arg-ignore-tidy$x.stderr b/tests/ui/command/need-crate-arg-ignore-tidy$x.stderr deleted file mode 100644 index 28f6d31b1ce..00000000000 --- a/tests/ui/command/need-crate-arg-ignore-tidy$x.stderr +++ /dev/null @@ -1,6 +0,0 @@ -error: invalid character `'$'` in crate name: `need_crate_arg_ignore_tidy$x` - | - = help: you can either pass `--crate-name` on the command line or add `#![crate_name="…"]` to set the crate name - -error: aborting due to 1 previous error - diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr index f662b5a11cb..bc1587883a3 100644 --- a/tests/ui/compare-method/bad-self-type.stderr +++ b/tests/ui/compare-method/bad-self-type.stderr @@ -8,9 +8,8 @@ LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { found signature `fn(MyFuture, &mut Context<'_>) -> Poll<_>` help: change the self-receiver type to match the trait | -LL - fn poll(self, _: &mut Context<'_>) -> Poll<()> { -LL + fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { - | +LL | fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { + | ++++++++++++++++++++ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/bad-self-type.rs:22:18 diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr index 397902846ec..0a03ea49de1 100644 --- a/tests/ui/const-generics/ensure_is_evaluatable.stderr +++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr @@ -14,9 +14,8 @@ LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` help: try adding a `where` bound | -LL - [(); M + 1]:, -LL + [(); M + 1]:, [(); N + 1]: - | +LL | [(); M + 1]:, [(); N + 1]: + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr index 147a2c91fd0..7fb79da2d61 100644 --- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr +++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr @@ -14,9 +14,8 @@ LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` help: try adding a `where` bound | -LL - [(); both(N + 1, M + 1)]:, -LL + [(); both(N + 1, M + 1)]:, [(); N + 1]: - | +LL | [(); both(N + 1, M + 1)]:, [(); N + 1]: + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index 9cb71ad8a09..8d0b2e91473 100644 --- a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -16,9 +16,8 @@ LL | fn assert_impl<T: Trait>() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as u128}>:, { -LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -52,9 +51,8 @@ LL | fn assert_impl<T: Trait>() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as u128}>:, { -LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -116,9 +114,8 @@ LL | fn assert_impl<T: Trait>() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as _}>:, { -LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -152,9 +149,8 @@ LL | fn assert_impl<T: Trait>() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as _}>:, { -LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 diff --git a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr index b43ce5eca43..6cf4e881ada 100644 --- a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr +++ b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr @@ -6,9 +6,8 @@ LL | bar::<{ T::ASSOC }>(); | help: try adding a `where` bound | -LL - fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, { -LL + fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { - | +LL | fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { + | +++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr index 86e35e17a07..3c79cbeb730 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr @@ -26,9 +26,8 @@ LL | foo::<_, L>([(); L + 1 + L]); | help: try adding a `where` bound | -LL - [(); (L - 1) + 1 + L]:, -LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | +LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: + | ++++++++++++++++ error: unconstrained generic constant --> $DIR/issue_114151.rs:17:17 diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr index c63a79e64ed..af4543e7ef2 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr @@ -15,9 +15,8 @@ LL | foo::<_, L>([(); L + 1 + L]); | help: try adding a `where` bound | -LL - [(); (L - 1) + 1 + L]:, -LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | +LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: + | ++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index c63beeac367..b9db7461699 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -9,9 +9,8 @@ LL | let f: F = async { 1 }; | help: a trait with a similar name exists | -LL - let f: F = async { 1 }; -LL + let f: Fn = async { 1 }; - | +LL | let f: Fn = async { 1 }; + | + help: you might be missing a type parameter | LL | fn f<T, F>( diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr index a97e35e385f..06bd01bff79 100644 --- a/tests/ui/consts/const-pattern-irrefutable.stderr +++ b/tests/ui/consts/const-pattern-irrefutable.stderr @@ -12,9 +12,8 @@ LL | let a = 4; = note: the matched value is of type `u8` help: introduce a variable instead | -LL - let a = 4; -LL + let a_var = 4; - | +LL | let a_var = 4; + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:28:9 @@ -48,9 +47,8 @@ LL | let d = (4, 4); = note: the matched value is of type `(u8, u8)` help: introduce a variable instead | -LL - let d = (4, 4); -LL + let d_var = (4, 4); - | +LL | let d_var = (4, 4); + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:36:9 @@ -71,9 +69,8 @@ LL | struct S { = note: the matched value is of type `S` help: introduce a variable instead | -LL - let e = S { -LL + let e_var = S { - | +LL | let e_var = S { + | ++++ error: aborting due to 4 previous errors diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr index 72b65006a3f..411eec84963 100644 --- a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr +++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr @@ -10,9 +10,8 @@ LL | const CRATE: Crate = Crate { fiel: () }; = note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info) help: a field with a similar name exists | -LL - const CRATE: Crate = Crate { fiel: () }; -LL + const CRATE: Crate = Crate { field: () }; - | +LL | const CRATE: Crate = Crate { field: () }; + | + error[E0609]: no field `field` on type `Compound` --> $DIR/dont-suggest-hygienic-fields.rs:24:16 diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr index 650244ac02a..12d7f5b6cd3 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr @@ -11,9 +11,8 @@ LL | struct DropMe<T: Copy>(T); | ^^^^ required by this bound in `DropMe` help: consider further restricting type parameter `T` with trait `Copy` | -LL - [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy` -LL + [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | +LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` + | ++++++++++++++++++++ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/explicit-drop-bounds.rs:32:18 @@ -28,9 +27,8 @@ LL | struct DropMe<T: Copy>(T); | ^^^^ required by this bound in `DropMe` help: consider further restricting type parameter `T` with trait `Copy` | -LL - [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy` -LL + [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | +LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` + | ++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr index c54cc858129..db749436855 100644 --- a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr @@ -67,9 +67,8 @@ LL | fn wants_write(_: impl Write) {} | ^^^^^ required by this bound in `wants_write` help: consider changing this borrow's mutability | -LL - wants_write(&[0u8][..]); -LL + wants_write(&mut [0u8][..]); - | +LL | wants_write(&mut [0u8][..]); + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/dyn-compatibility/associated_type_bound_mentions_self.rs b/tests/ui/dyn-compatibility/associated_type_bound_mentions_self.rs new file mode 100644 index 00000000000..0be5fa27b4c --- /dev/null +++ b/tests/ui/dyn-compatibility/associated_type_bound_mentions_self.rs @@ -0,0 +1,14 @@ +// Ensure that we properly ignore the `B<Self>` associated type bound on `A::T` +// since that associated type requires `Self: Sized`. + +//@ check-pass + +struct X(&'static dyn A); + +trait A { + type T: B<Self> where Self: Sized; +} + +trait B<T> {} + +fn main() {} diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index 3411702a12d..8ec8ecf46bf 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -14,9 +14,8 @@ LL | pub struct XEmpty2; | help: use struct literal syntax instead | -LL - let e1 = Empty1; -LL + let e1 = Empty1 {}; - | +LL | let e1 = Empty1 {}; + | ++ help: a unit struct with a similar name exists | LL - let e1 = Empty1; @@ -38,9 +37,8 @@ LL | pub struct XEmpty2; | help: use struct literal syntax instead | -LL - let xe1 = XEmpty1; -LL + let xe1 = XEmpty1 {}; - | +LL | let xe1 = XEmpty1 {}; + | ++ help: a unit struct with a similar name exists | LL - let xe1 = XEmpty1; @@ -127,9 +125,8 @@ LL | let xe3 = XE::Empty3; | help: there is a variant with a similar name | -LL - let xe3 = XE::Empty3; -LL + let xe3 = XE::XEmpty3; - | +LL | let xe3 = XE::XEmpty3; + | + error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 diff --git a/tests/ui/empty/empty-struct-tuple-pat.stderr b/tests/ui/empty/empty-struct-tuple-pat.stderr index 3906a0e2060..09b454653f6 100644 --- a/tests/ui/empty/empty-struct-tuple-pat.stderr +++ b/tests/ui/empty/empty-struct-tuple-pat.stderr @@ -46,9 +46,8 @@ LL | XEmpty5(), | help: use the tuple variant pattern syntax instead | -LL - XE::XEmpty5 => (), -LL + XE::XEmpty5() => (), - | +LL | XE::XEmpty5() => (), + | ++ help: a unit variant with a similar name exists | LL - XE::XEmpty5 => (), diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr index cda9aa330d2..f1cacf5420e 100644 --- a/tests/ui/env-macro/error-recovery-issue-55897.stderr +++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr @@ -30,9 +30,8 @@ LL | use env; | help: consider importing this module instead | -LL - use env; -LL + use std::env; - | +LL | use std::env; + | +++++ error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr index 701e636dc58..3a1ebf29719 100644 --- a/tests/ui/error-codes/E0027.stderr +++ b/tests/ui/error-codes/E0027.stderr @@ -6,19 +6,16 @@ LL | Dog { age: x } => {} | help: include the missing field in the pattern | -LL - Dog { age: x } => {} -LL + Dog { age: x, name } => {} - | +LL | Dog { age: x, name } => {} + | ++++++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Dog { age: x } => {} -LL + Dog { age: x, name: _ } => {} - | +LL | Dog { age: x, name: _ } => {} + | +++++++++ help: or always ignore missing fields here | -LL - Dog { age: x } => {} -LL + Dog { age: x, .. } => {} - | +LL | Dog { age: x, .. } => {} + | ++++ error[E0027]: pattern does not mention field `age` --> $DIR/E0027.rs:15:9 diff --git a/tests/ui/extern/not-in-block.stderr b/tests/ui/extern/not-in-block.stderr index f35d98e9948..e35c50343fc 100644 --- a/tests/ui/extern/not-in-block.stderr +++ b/tests/ui/extern/not-in-block.stderr @@ -11,9 +11,8 @@ LL + extern fn none_fn(x: bool) -> i32 { <body> } | help: if you meant to declare an externally defined function, use an `extern` block | -LL - extern fn none_fn(x: bool) -> i32; -LL + extern { fn none_fn(x: bool) -> i32; } - | +LL | extern { fn none_fn(x: bool) -> i32; } + | + + error: free function without a body --> $DIR/not-in-block.rs:6:1 @@ -28,9 +27,8 @@ LL + extern "C" fn c_fn(x: bool) -> i32 { <body> } | help: if you meant to declare an externally defined function, use an `extern` block | -LL - extern "C" fn c_fn(x: bool) -> i32; -LL + extern "C" { fn c_fn(x: bool) -> i32; } - | +LL | extern "C" { fn c_fn(x: bool) -> i32; } + | + + error: aborting due to 2 previous errors diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs new file mode 100644 index 00000000000..d1f6f4755f0 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs @@ -0,0 +1,6 @@ +// check that `pattern_complexity_limit` is feature-gated + +#![pattern_complexity_limit = "42"] +//~^ ERROR: the `#[pattern_complexity_limit]` attribute is just used for rustc unit tests + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.stderr index c05e6abb017..e6f17710e09 100644 --- a/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr +++ b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.stderr @@ -1,8 +1,8 @@ -error[E0658]: the `#[pattern_complexity]` attribute is just used for rustc unit tests and will never be stable - --> $DIR/feature-gate-pattern-complexity.rs:3:1 +error[E0658]: the `#[pattern_complexity_limit]` attribute is just used for rustc unit tests and will never be stable + --> $DIR/feature-gate-pattern-complexity-limit.rs:3:1 | -LL | #![pattern_complexity = "42"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![pattern_complexity_limit = "42"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.rs b/tests/ui/feature-gates/feature-gate-pattern-complexity.rs deleted file mode 100644 index 43e9a00c9a7..00000000000 --- a/tests/ui/feature-gates/feature-gate-pattern-complexity.rs +++ /dev/null @@ -1,6 +0,0 @@ -// check that `pattern_complexity` is feature-gated - -#![pattern_complexity = "42"] -//~^ ERROR: the `#[pattern_complexity]` attribute is just used for rustc unit tests - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 7271ca48877..214725b77c0 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -95,9 +95,8 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} found signature `extern "rust-call" fn(Foo, ()) -> ()` help: change the self-receiver type to match the trait | -LL - extern "rust-call" fn call(self, args: ()) -> () {} -LL + extern "rust-call" fn call(&self, args: ()) -> () {} - | +LL | extern "rust-call" fn call(&self, args: ()) -> () {} + | + error[E0183]: manual implementations of `FnOnce` are experimental --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 diff --git a/tests/ui/fmt/no-inline-literals-out-of-range.stderr b/tests/ui/fmt/no-inline-literals-out-of-range.stderr index 78047eabf49..e1702388704 100644 --- a/tests/ui/fmt/no-inline-literals-out-of-range.stderr +++ b/tests/ui/fmt/no-inline-literals-out-of-range.stderr @@ -51,9 +51,8 @@ LL | format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32 = help: consider using the type `u32` instead help: to use as a negative number (decimal `-1`), consider using the type `u32` for the literal and cast it to `i32` | -LL - format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32 -LL + format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32 - | +LL | format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32 + | ++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/generics/single-colon-path-not-const-generics.stderr b/tests/ui/generics/single-colon-path-not-const-generics.stderr index 4e695b2dcd6..c14a5e62a0c 100644 --- a/tests/ui/generics/single-colon-path-not-const-generics.stderr +++ b/tests/ui/generics/single-colon-path-not-const-generics.stderr @@ -1,8 +1,6 @@ error: path separator must be a double colon --> $DIR/single-colon-path-not-const-generics.rs:8:18 | -LL | pub struct Foo { - | --- while parsing this struct LL | a: Vec<foo::bar:A>, | ^ | @@ -10,7 +8,7 @@ LL | a: Vec<foo::bar:A>, help: use a double colon instead | LL | a: Vec<foo::bar::A>, - | + + | + error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs b/tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs new file mode 100644 index 00000000000..3655bff63eb --- /dev/null +++ b/tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs @@ -0,0 +1,37 @@ +//@ check-pass +// Regression test for <https;//github.com/rust-lang/rust/issues/107883> +#![feature(impl_trait_in_fn_trait_return)] +#![feature(unboxed_closures)] // only for `h` + +use std::fmt::Debug; + +fn f<T>() -> impl Fn(T) -> impl Debug { + |_x| 15 +} + +fn g<T>() -> impl MyFn<(T,), Out = impl Debug> { + |_x| 15 +} + +trait MyFn<T> { + type Out; +} + +impl<T, U, F: Fn(T) -> U> MyFn<(T,)> for F { + type Out = U; +} + +fn h<T>() -> impl Fn<(T,), Output = impl Debug> { + |_x| 15 +} + +fn f_<T>() -> impl Fn(T) -> impl Debug { + std::convert::identity(|_x| 15) +} + +fn f__<T>() -> impl Fn(T) -> impl Debug { + let r = |_x| 15; + r +} + +fn main() {} diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index af6d492c74d..0a974668188 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -17,9 +17,8 @@ LL + use no_method_suggested_traits::qux::PrivPub; | help: there is a method `method2` with a similar name | -LL - 1u32.method(); -LL + 1u32.method2(); - | +LL | 1u32.method2(); + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:26:44 @@ -40,9 +39,8 @@ LL + use no_method_suggested_traits::qux::PrivPub; | help: there is a method `method2` with a similar name | -LL - std::rc::Rc::new(&mut Box::new(&1u32)).method(); -LL + std::rc::Rc::new(&mut Box::new(&1u32)).method2(); - | +LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2(); + | + error[E0599]: no method named `method` found for type `char` in the current scope --> $DIR/no-method-suggested-traits.rs:30:9 @@ -60,9 +58,8 @@ LL + use foo::Bar; | help: there is a method `method2` with a similar name | -LL - 'a'.method(); -LL + 'a'.method2(); - | +LL | 'a'.method2(); + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope --> $DIR/no-method-suggested-traits.rs:32:43 @@ -77,9 +74,8 @@ LL + use foo::Bar; | help: there is a method `method2` with a similar name | -LL - std::rc::Rc::new(&mut Box::new(&'a')).method(); -LL + std::rc::Rc::new(&mut Box::new(&'a')).method2(); - | +LL | std::rc::Rc::new(&mut Box::new(&'a')).method2(); + | + error[E0599]: no method named `method` found for type `i32` in the current scope --> $DIR/no-method-suggested-traits.rs:35:10 @@ -99,9 +95,8 @@ LL + use no_method_suggested_traits::foo::PubPub; | help: there is a method `method3` with a similar name | -LL - 1i32.method(); -LL + 1i32.method3(); - | +LL | 1i32.method3(); + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:37:44 @@ -116,9 +111,8 @@ LL + use no_method_suggested_traits::foo::PubPub; | help: there is a method `method3` with a similar name | -LL - std::rc::Rc::new(&mut Box::new(&1i32)).method(); -LL + std::rc::Rc::new(&mut Box::new(&1i32)).method3(); - | +LL | std::rc::Rc::new(&mut Box::new(&1i32)).method3(); + | + error[E0599]: no method named `method` found for struct `Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:40:9 diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 6a48e36d378..75e65681c3a 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -37,9 +37,8 @@ LL | | } | |_____^ help: you might have meant to use the following enum variant | -LL - B; -LL + B::B1; - | +LL | B::B1; + | ++++ error[E0425]: cannot find value `C` in this scope --> $DIR/glob-resolve1.rs:29:5 diff --git a/tests/ui/imports/issue-45829/import-self.stderr b/tests/ui/imports/issue-45829/import-self.stderr index 62bc559b778..b392d93c154 100644 --- a/tests/ui/imports/issue-45829/import-self.stderr +++ b/tests/ui/imports/issue-45829/import-self.stderr @@ -32,9 +32,8 @@ LL | use foo::{self}; = note: `foo` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL - use foo::{self}; -LL + use foo::{self as other_foo}; - | +LL | use foo::{self as other_foo}; + | ++++++++++++ error[E0255]: the name `foo` is defined multiple times --> $DIR/import-self.rs:12:5 diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr index c9cfe769aeb..10b8db62edc 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); | help: a similar path exists | -LL - println!("Hello, {}!", crate::bar::do_the_thing); -LL + println!("Hello, {}!", crate::foo::bar::do_the_thing); - | +LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); + | +++++ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr index c9cfe769aeb..10b8db62edc 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); | help: a similar path exists | -LL - println!("Hello, {}!", crate::bar::do_the_thing); -LL + println!("Hello, {}!", crate::foo::bar::do_the_thing); - | +LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); + | +++++ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/command/need-crate-arg-ignore-tidy$x.rs b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.rs index b1ac4a4ae21..b1ac4a4ae21 100644 --- a/tests/ui/command/need-crate-arg-ignore-tidy$x.rs +++ b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.rs diff --git a/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.stderr b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.stderr new file mode 100644 index 00000000000..861510212f9 --- /dev/null +++ b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.stderr @@ -0,0 +1,6 @@ +error: invalid character '$' in crate name: `need_crate_arg_ignore_tidy$x` + | + = help: you can either pass `--crate-name` on the command line or add `#![crate_name = "…"]` to set the crate name + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.rs b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.rs new file mode 100644 index 00000000000..c7f3c2c5403 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.rs @@ -0,0 +1,5 @@ +// Ensure we validate `#![crate_name]` on print requests and reject macro calls inside of it. +// See also <https://github.com/rust-lang/rust/issues/122001>. + +//@ compile-flags: --print=crate-name +#![crate_name = concat!("wrapped")] //~ ERROR malformed `crate_name` attribute input diff --git a/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.stderr b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.stderr new file mode 100644 index 00000000000..6bf09a2b131 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.stderr @@ -0,0 +1,8 @@ +error: malformed `crate_name` attribute input + --> $DIR/print-crate-name-request-malformed-crate-name.rs:5:1 + | +LL | #![crate_name = concat!("wrapped")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.rs b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.rs new file mode 100644 index 00000000000..5cf1ae36b42 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.rs @@ -0,0 +1,4 @@ +// Ensure we validate `#![crate_name]` on print requests. + +//@ compile-flags: --print=file-names +#![crate_name] //~ ERROR malformed `crate_name` attribute input diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.stderr b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.stderr new file mode 100644 index 00000000000..de62aed79fc --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.stderr @@ -0,0 +1,8 @@ +error: malformed `crate_name` attribute input + --> $DIR/print-file-names-request-malformed-crate-name-1.rs:4:1 + | +LL | #![crate_name] + | ^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.rs b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.rs new file mode 100644 index 00000000000..13c9d1e0027 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.rs @@ -0,0 +1,7 @@ +// Ensure that we validate *all* `#![crate_name]`s on print requests, not just the first, +// and that we reject macro calls inside of them. +// See also <https://github.com/rust-lang/rust/issues/122001>. + +//@ compile-flags: --print=file-names +#![crate_name = "this_one_is_okay"] +#![crate_name = concat!("this_one_is_not")] //~ ERROR malformed `crate_name` attribute input diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.stderr b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.stderr new file mode 100644 index 00000000000..42c33de1221 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.stderr @@ -0,0 +1,8 @@ +error: malformed `crate_name` attribute input + --> $DIR/print-file-names-request-malformed-crate-name-2.rs:7:1 + | +LL | #![crate_name = concat!("this_one_is_not")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.rs b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.rs new file mode 100644 index 00000000000..5fe8bd7945f --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.rs @@ -0,0 +1,5 @@ +// Ensure we validate `#![crate_name]` on print requests and reject macro calls inside of it. +// See also <https://github.com/rust-lang/rust/issues/122001>. + +//@ compile-flags: --print=file-names +#![crate_name = concat!("wrapped")] //~ ERROR malformed `crate_name` attribute input diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.stderr b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.stderr new file mode 100644 index 00000000000..cb5ffaab9ca --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.stderr @@ -0,0 +1,8 @@ +error: malformed `crate_name` attribute input + --> $DIR/print-file-names-request-malformed-crate-name.rs:5:1 + | +LL | #![crate_name = concat!("wrapped")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/issues/issue-32004.stderr index 88395cd8520..fcbec97661b 100644 --- a/tests/ui/issues/issue-32004.stderr +++ b/tests/ui/issues/issue-32004.stderr @@ -11,9 +11,8 @@ LL | Foo::Bar => {} | help: use the tuple variant pattern syntax instead | -LL - Foo::Bar => {} -LL + Foo::Bar(_) => {} - | +LL | Foo::Bar(_) => {} + | +++ help: a unit variant with a similar name exists | LL - Foo::Bar => {} diff --git a/tests/ui/issues/issue-41652/issue-41652.stderr b/tests/ui/issues/issue-41652/issue-41652.stderr index c8299f28d34..4a81e76af75 100644 --- a/tests/ui/issues/issue-41652/issue-41652.stderr +++ b/tests/ui/issues/issue-41652/issue-41652.stderr @@ -6,9 +6,8 @@ LL | 3.f() | help: you must specify a concrete type for this numeric value, like `i32` | -LL - 3.f() -LL + 3_i32.f() - | +LL | 3_i32.f() + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-51874.stderr b/tests/ui/issues/issue-51874.stderr index 18328450145..5c9331b4e1e 100644 --- a/tests/ui/issues/issue-51874.stderr +++ b/tests/ui/issues/issue-51874.stderr @@ -6,9 +6,8 @@ LL | let a = (1.0).pow(1.0); | help: you must specify a concrete type for this numeric value, like `f32` | -LL - let a = (1.0).pow(1.0); -LL + let a = (1.0_f32).pow(1.0); - | +LL | let a = (1.0_f32).pow(1.0); + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr index f598cf33911..e68db865dc4 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/issues/issue-5358-1.stderr @@ -14,9 +14,8 @@ LL | S(Either::Right(_)) => {} | ++ + help: you might have meant to use field `0` whose type is `Either<usize, usize>` | -LL - match S(Either::Left(5)) { -LL + match S(Either::Left(5)).0 { - | +LL | match S(Either::Left(5)).0 { + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 695aa2ac796..df4cd6ce8a7 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -16,9 +16,8 @@ LL + use reexported_trait::Trait; | help: there is a method `trait_method_b` with a similar name | -LL - reexported_trait::FooStruct.trait_method(); -LL + reexported_trait::FooStruct.trait_method_b(); - | +LL | reexported_trait::FooStruct.trait_method_b(); + | ++ error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope --> $DIR/issue-56175.rs:7:33 diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr index 713a19f6cb0..62d83a54614 100644 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr @@ -10,9 +10,8 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:19 @@ -26,9 +25,8 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:9 @@ -42,9 +40,8 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:22 @@ -58,9 +55,8 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | + error: aborting due to 4 previous errors diff --git a/tests/ui/let-else/let-else-deref-coercion.stderr b/tests/ui/let-else/let-else-deref-coercion.stderr index 07347af76e4..543737868c9 100644 --- a/tests/ui/let-else/let-else-deref-coercion.stderr +++ b/tests/ui/let-else/let-else-deref-coercion.stderr @@ -8,9 +8,8 @@ LL | let Bar::Present(z) = self else { | help: consider dereferencing to access the inner value using the Deref trait | -LL - let Bar::Present(z) = self else { -LL + let Bar::Present(z) = &**self else { - | +LL | let Bar::Present(z) = &**self else { + | +++ error[E0308]: mismatched types --> $DIR/let-else-deref-coercion.rs:68:13 @@ -22,9 +21,8 @@ LL | let Bar(z) = x; | help: consider dereferencing to access the inner value using the Deref trait | -LL - let Bar(z) = x; -LL + let Bar(z) = &**x; - | +LL | let Bar(z) = &**x; + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-1.stderr b/tests/ui/lexer/lex-bad-char-literals-1.stderr index 49683c10237..0985e274c02 100644 --- a/tests/ui/lexer/lex-bad-char-literals-1.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-1.stderr @@ -32,9 +32,8 @@ LL | "\●" = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL - "\●" -LL + r"\●" - | +LL | r"\●" + | + error: aborting due to 4 previous errors diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index e0adb164140..4703d7f10dc 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -12,9 +12,8 @@ LL | x.use_mut(); = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider consuming the `Vec<i32>` when turning it into an `Iterator` | -LL - let mut x = vec![1].iter(); -LL + let mut x = vec![1].into_iter(); - | +LL | let mut x = vec![1].into_iter(); + | +++++ help: consider using a `let` binding to create a longer lived value | LL ~ let binding = vec![1]; diff --git a/tests/ui/lint/invalid_from_utf8.rs b/tests/ui/lint/invalid_from_utf8.rs index 2d1822a54ac..8f8000fe34d 100644 --- a/tests/ui/lint/invalid_from_utf8.rs +++ b/tests/ui/lint/invalid_from_utf8.rs @@ -1,7 +1,7 @@ //@ check-pass #![feature(concat_bytes)] - +#![feature(inherent_str_constructors)] #![warn(invalid_from_utf8_unchecked)] #![warn(invalid_from_utf8)] @@ -9,7 +9,9 @@ pub fn from_utf8_unchecked_mut() { // Valid unsafe { std::str::from_utf8_unchecked_mut(&mut [99, 108, 105, 112, 112, 121]); + str::from_utf8_unchecked_mut(&mut [99, 108, 105, 112, 112, 121]); std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']); + str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']); let x = 0xA0; std::str::from_utf8_unchecked_mut(&mut [0xC0, x]); @@ -19,8 +21,12 @@ pub fn from_utf8_unchecked_mut() { unsafe { std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]); //~^ WARN calls to `std::str::from_utf8_unchecked_mut` + str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]); + //~^ WARN calls to `str::from_utf8_unchecked_mut` std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); //~^ WARN calls to `std::str::from_utf8_unchecked_mut` + str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + //~^ WARN calls to `str::from_utf8_unchecked_mut` } } @@ -28,23 +34,35 @@ pub fn from_utf8_unchecked() { // Valid unsafe { std::str::from_utf8_unchecked(&[99, 108, 105, 112, 112, 121]); + str::from_utf8_unchecked(&[99, 108, 105, 112, 112, 121]); std::str::from_utf8_unchecked(&[b'c', b'l', b'i', b'p', b'p', b'y']); + str::from_utf8_unchecked(&[b'c', b'l', b'i', b'p', b'p', b'y']); std::str::from_utf8_unchecked(b"clippy"); + str::from_utf8_unchecked(b"clippy"); let x = 0xA0; std::str::from_utf8_unchecked(&[0xC0, x]); + str::from_utf8_unchecked(&[0xC0, x]); } // Invalid unsafe { std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]); //~^ WARN calls to `std::str::from_utf8_unchecked` + str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]); + //~^ WARN calls to `str::from_utf8_unchecked` std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); //~^ WARN calls to `std::str::from_utf8_unchecked` + str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + //~^ WARN calls to `str::from_utf8_unchecked` std::str::from_utf8_unchecked(b"cl\x82ippy"); //~^ WARN calls to `std::str::from_utf8_unchecked` + str::from_utf8_unchecked(b"cl\x82ippy"); + //~^ WARN calls to `str::from_utf8_unchecked` std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy")); //~^ WARN calls to `std::str::from_utf8_unchecked` + str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy")); + //~^ WARN calls to `str::from_utf8_unchecked` } } @@ -52,18 +70,25 @@ pub fn from_utf8_mut() { // Valid { std::str::from_utf8_mut(&mut [99, 108, 105, 112, 112, 121]); + str::from_utf8_mut(&mut [99, 108, 105, 112, 112, 121]); std::str::from_utf8_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']); + str::from_utf8_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']); let x = 0xa0; std::str::from_utf8_mut(&mut [0xc0, x]); + str::from_utf8_mut(&mut [0xc0, x]); } // Invalid { std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]); //~^ WARN calls to `std::str::from_utf8_mut` + str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]); + //~^ WARN calls to `str::from_utf8_mut` std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); //~^ WARN calls to `std::str::from_utf8_mut` + str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + //~^ WARN calls to `str::from_utf8_mut` } } @@ -71,23 +96,35 @@ pub fn from_utf8() { // Valid { std::str::from_utf8(&[99, 108, 105, 112, 112, 121]); + str::from_utf8(&[99, 108, 105, 112, 112, 121]); std::str::from_utf8(&[b'c', b'l', b'i', b'p', b'p', b'y']); + str::from_utf8(&[b'c', b'l', b'i', b'p', b'p', b'y']); std::str::from_utf8(b"clippy"); + str::from_utf8(b"clippy"); let x = 0xA0; std::str::from_utf8(&[0xC0, x]); + str::from_utf8(&[0xC0, x]); } // Invalid { std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]); + //~^ WARN calls to `str::from_utf8` std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + //~^ WARN calls to `str::from_utf8` std::str::from_utf8(b"cl\x82ippy"); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(b"cl\x82ippy"); + //~^ WARN calls to `str::from_utf8` std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy")); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(concat_bytes!(b"cl", b"\x82ippy")); + //~^ WARN calls to `str::from_utf8` } } @@ -95,25 +132,39 @@ pub fn from_utf8_with_indirections() { let mut a = [99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8_mut(&mut a); //~^ WARN calls to `std::str::from_utf8_mut` + str::from_utf8_mut(&mut a); + //~^ WARN calls to `str::from_utf8_mut` let mut b = &mut a; let mut c = b; std::str::from_utf8_mut(c); //~^ WARN calls to `std::str::from_utf8_mut` + str::from_utf8_mut(c); + //~^ WARN calls to `str::from_utf8_mut` let mut c = &[99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8(c); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(c); + //~^ WARN calls to `str::from_utf8` const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8(&INVALID_1); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(&INVALID_1); + //~^ WARN calls to `str::from_utf8` static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8(&INVALID_2); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(&INVALID_2); + //~^ WARN calls to `str::from_utf8` const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8(INVALID_3); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(INVALID_3); + //~^ WARN calls to `str::from_utf8` const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] }; std::str::from_utf8(INVALID_4); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(INVALID_4); + //~^ WARN calls to `str::from_utf8` } fn main() {} diff --git a/tests/ui/lint/invalid_from_utf8.stderr b/tests/ui/lint/invalid_from_utf8.stderr index 07616e11801..715ecf56f21 100644 --- a/tests/ui/lint/invalid_from_utf8.stderr +++ b/tests/ui/lint/invalid_from_utf8.stderr @@ -1,5 +1,5 @@ -warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:20:9 +warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:22:9 | LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ @@ -12,48 +12,96 @@ note: the lint level is defined here LL | #![warn(invalid_from_utf8_unchecked)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:22:9 +warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:24:9 + | +LL | str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:26:9 | LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:40:9 +warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:28:9 + | +LL | str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:50:9 | LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:42:9 +warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:52:9 + | +LL | str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:54:9 | LL | std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:44:9 +warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:56:9 + | +LL | str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:58:9 | LL | std::str::from_utf8_unchecked(b"cl\x82ippy"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:46:9 +warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:60:9 + | +LL | str::from_utf8_unchecked(b"cl\x82ippy"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:62:9 | LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:63:9 +warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:64:9 + | +LL | str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:84:9 | LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ @@ -66,56 +114,113 @@ note: the lint level is defined here LL | #![warn(invalid_from_utf8)] | ^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:65:9 +warning: calls to `str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:86:9 + | +LL | str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]); + | ^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:88:9 | LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:83:9 +warning: calls to `str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:90:9 + | +LL | str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + | ^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:112:9 | LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]); | ^^^^^^^^^^^^^^^^^^^^^----------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:85:9 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:114:9 + | +LL | str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]); + | ^^^^^^^^^^^^^^^^----------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:116:9 | LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); | ^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:87:9 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:118:9 + | +LL | str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + | ^^^^^^^^^^^^^^^^---------------------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:120:9 | LL | std::str::from_utf8(b"cl\x82ippy"); | ^^^^^^^^^^^^^^^^^^^^-------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:89:9 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:122:9 + | +LL | str::from_utf8(b"cl\x82ippy"); + | ^^^^^^^^^^^^^^^-------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:124:9 | LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy")); | ^^^^^^^^^^^^^^^^^^^^---------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:96:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:126:9 + | +LL | str::from_utf8(concat_bytes!(b"cl", b"\x82ippy")); + | ^^^^^^^^^^^^^^^---------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:133:5 | LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8_mut(&mut a); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:100:5 +warning: calls to `str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:135:5 + | +LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8_mut(&mut a); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:139:5 | LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes @@ -123,45 +228,99 @@ LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; LL | std::str::from_utf8_mut(c); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:103:5 +warning: calls to `str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:141:5 + | +LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8_mut(c); + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:144:5 | LL | let mut c = &[99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(c); | ^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:106:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:146:5 + | +LL | let mut c = &[99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(c); + | ^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:149:5 | LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(&INVALID_1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:109:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:151:5 + | +LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(&INVALID_1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:154:5 | LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(&INVALID_2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:112:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:156:5 + | +LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(&INVALID_2); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:159:5 | LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(INVALID_3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:115:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:161:5 + | +LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(INVALID_3); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:164:5 | LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] }; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(INVALID_4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: 19 warnings emitted +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:166:5 + | +LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] }; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(INVALID_4); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 38 warnings emitted diff --git a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr index a244d7604d7..105506968b1 100644 --- a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr +++ b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr @@ -11,9 +11,8 @@ LL | #![deny(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = foo(); -LL + let _unused = foo(); - | +LL | let _unused = foo(); + | ++++++ help: consider immediately dropping the value | LL - let _ = foo(); diff --git a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr index 8773d5df443..3ff57ab441d 100644 --- a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr +++ b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr @@ -28,9 +28,8 @@ LL | let _ = field; | help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = field; -LL + let _unused = field; - | +LL | let _unused = field; + | ++++++ help: consider immediately dropping the value | LL - let _ = field; diff --git a/tests/ui/lint/let_underscore/let_underscore_drop.stderr b/tests/ui/lint/let_underscore/let_underscore_drop.stderr index c7984d629da..001827b0d37 100644 --- a/tests/ui/lint/let_underscore/let_underscore_drop.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_drop.stderr @@ -11,9 +11,8 @@ LL | #![warn(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = NontrivialDrop; -LL + let _unused = NontrivialDrop; - | +LL | let _unused = NontrivialDrop; + | ++++++ help: consider immediately dropping the value | LL - let _ = NontrivialDrop; diff --git a/tests/ui/lint/let_underscore/let_underscore_lock.stderr b/tests/ui/lint/let_underscore/let_underscore_lock.stderr index 60d5ed649f5..a54a23e364b 100644 --- a/tests/ui/lint/let_underscore/let_underscore_lock.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_lock.stderr @@ -7,9 +7,8 @@ LL | let _ = data.lock().unwrap(); = note: `#[deny(let_underscore_lock)]` on by default help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = data.lock().unwrap(); -LL + let _unused = data.lock().unwrap(); - | +LL | let _unused = data.lock().unwrap(); + | ++++++ help: consider immediately dropping the value | LL - let _ = data.lock().unwrap(); @@ -24,9 +23,8 @@ LL | let _ = data.lock(); | help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = data.lock(); -LL + let _unused = data.lock(); - | +LL | let _unused = data.lock(); + | ++++++ help: consider immediately dropping the value | LL - let _ = data.lock(); @@ -42,9 +40,8 @@ LL | let (_, _) = (data.lock(), 1); = help: consider immediately dropping the value using `drop(..)` after the `let` statement help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let (_, _) = (data.lock(), 1); -LL + let (_unused, _) = (data.lock(), 1); - | +LL | let (_unused, _) = (data.lock(), 1); + | ++++++ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:16:26 @@ -55,9 +52,8 @@ LL | let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); = help: consider immediately dropping the value using `drop(..)` after the `let` statement help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); -LL + let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); - | +LL | let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); + | ++++++ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:18:6 diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr index aeee69ae7af..bcef0ae424e 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -25,9 +25,8 @@ LL | let addr_32bit = &x as *const u8 as u32; = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead help: use `.addr()` to obtain the address of a pointer | -LL - let addr_32bit = &x as *const u8 as u32; -LL + let addr_32bit = (&x as *const u8).addr() as u32; - | +LL | let addr_32bit = (&x as *const u8).addr() as u32; + | + ++++++++ error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index abd579b336f..337d5d0b307 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -9,9 +9,8 @@ LL | let _y = &X; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - let _y = &X; -LL + let _y = &raw const X; - | +LL | let _y = &raw const X; + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,9 +45,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&raw const X, &Y); - | +LL | let (_b, _c) = (&raw const X, &Y); + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -60,9 +58,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&X, &raw const Y); - | +LL | let (_b, _c) = (&X, &raw const Y); + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -74,9 +71,8 @@ LL | foo(&X); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - foo(&X); -LL + foo(&raw const X); - | +LL | foo(&raw const X); + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -106,9 +102,8 @@ LL | let _v = &A.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _v = &A.value; -LL + let _v = &raw const A.value; - | +LL | let _v = &raw const A.value; + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -120,9 +115,8 @@ LL | let _s = &A.s.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _s = &A.s.value; -LL + let _s = &raw const A.s.value; - | +LL | let _s = &raw const A.s.value; + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index 1387cdf0b32..cf7f0a86f4f 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -9,9 +9,8 @@ LL | let _y = &X; = note: `#[deny(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - let _y = &X; -LL + let _y = &raw const X; - | +LL | let _y = &raw const X; + | +++++++++ error: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,9 +45,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&raw const X, &Y); - | +LL | let (_b, _c) = (&raw const X, &Y); + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -60,9 +58,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&X, &raw const Y); - | +LL | let (_b, _c) = (&X, &raw const Y); + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -74,9 +71,8 @@ LL | foo(&X); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - foo(&X); -LL + foo(&raw const X); - | +LL | foo(&raw const X); + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -106,9 +102,8 @@ LL | let _v = &A.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _v = &A.value; -LL + let _v = &raw const A.value; - | +LL | let _v = &raw const A.value; + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -120,9 +115,8 @@ LL | let _s = &A.s.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _s = &A.s.value; -LL + let _s = &raw const A.s.value; - | +LL | let _s = &raw const A.s.value; + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr index 0ac67fddaa7..6ba0c9d907c 100644 --- a/tests/ui/lint/type-overflow.stderr +++ b/tests/ui/lint/type-overflow.stderr @@ -66,9 +66,8 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; = help: consider using the type `u128` instead help: to use as a negative number (decimal `-170141183460469231731687303715884105728`), consider using the type `u128` for the literal and cast it to `i128` | -LL - let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; -LL + let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; - | +LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; + | ++++++++++++ warning: literal out of range for `i32` --> $DIR/type-overflow.rs:27:16 @@ -117,9 +116,8 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; = help: consider using the type `u64` instead help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` | -LL - let fail = 0x8FFF_FFFF_FFFF_FFFE; -LL + let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; - | +LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; + | ++++++++++ warning: literal out of range for `i8` --> $DIR/type-overflow.rs:46:17 diff --git a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr index 8922f484d3e..2d43e612580 100644 --- a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr +++ b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr @@ -12,9 +12,8 @@ LL | #![deny(unused)] = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` help: try ignoring the field | -LL - A { i, j } | B { i, j } => { -LL + A { i, j: _ } | B { i, j: _ } => { - | +LL | A { i, j: _ } | B { i, j: _ } => { + | +++ +++ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16 @@ -36,9 +35,8 @@ LL | Some(A { i, j } | B { i, j }) => { | help: try ignoring the field | -LL - Some(A { i, j } | B { i, j }) => { -LL + Some(A { i, j: _ } | B { i, j: _ }) => { - | +LL | Some(A { i, j: _ } | B { i, j: _ }) => { + | +++ +++ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21 diff --git a/tests/ui/lint/wide_pointer_comparisons.stderr b/tests/ui/lint/wide_pointer_comparisons.stderr index f5f8060902b..5a0b914d832 100644 --- a/tests/ui/lint/wide_pointer_comparisons.stderr +++ b/tests/ui/lint/wide_pointer_comparisons.stderr @@ -627,9 +627,8 @@ LL | cmp!(a, b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL - cmp!(a, b); -LL + cmp!(std::ptr::addr_eq(a, b)); - | +LL | cmp!(std::ptr::addr_eq(a, b)); + | ++++++++++++++++++ + warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:159:39 diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr index 8ab6938fe19..a2c281d9c0a 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr @@ -13,9 +13,8 @@ LL | #![warn(edition_2024_expr_fragment_specifier)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to keep the existing behavior, use the `expr_2021` fragment specifier | -LL - ($e:expr) => { -LL + ($e:expr_2021) => { - | +LL | ($e:expr_2021) => { + | +++++ warning: the `expr` fragment specifier will accept more expressions in the 2024 edition --> $DIR/expr_2021_cargo_fix_edition.rs:11:11 @@ -27,9 +26,8 @@ LL | ($($i:expr)*) => { }; = note: for more information, see Migration Guide <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/macro-fragment-specifiers.html> help: to keep the existing behavior, use the `expr_2021` fragment specifier | -LL - ($($i:expr)*) => { }; -LL + ($($i:expr_2021)*) => { }; - | +LL | ($($i:expr_2021)*) => { }; + | +++++ warning: 2 warnings emitted diff --git a/tests/ui/macros/macro-backtrace-invalid-internals.stderr b/tests/ui/macros/macro-backtrace-invalid-internals.stderr index bb8250d58b0..836098bd9c0 100644 --- a/tests/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/tests/ui/macros/macro-backtrace-invalid-internals.stderr @@ -43,9 +43,8 @@ LL | real_method_stmt!(); = note: this error originates in the macro `real_method_stmt` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | -LL - 2.0.neg() -LL + 2.0_f32.neg() - | +LL | 2.0_f32.neg() + | ++++ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 @@ -92,9 +91,8 @@ LL | let _ = real_method_expr!(); = note: this error originates in the macro `real_method_expr` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | -LL - 2.0.neg() -LL + 2.0_f32.neg() - | +LL | 2.0_f32.neg() + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/match/issue-56685.stderr b/tests/ui/match/issue-56685.stderr index 9655a380811..6a1d152ed5b 100644 --- a/tests/ui/match/issue-56685.stderr +++ b/tests/ui/match/issue-56685.stderr @@ -11,9 +11,8 @@ LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore | -LL - E::A(x) | E::B(x) => {} -LL + E::A(_x) | E::B(_x) => {} - | +LL | E::A(_x) | E::B(_x) => {} + | + + error: unused variable: `x` --> $DIR/issue-56685.rs:25:14 @@ -23,9 +22,8 @@ LL | F::A(x, y) | F::B(x, y) => { y }, | help: if this is intentional, prefix it with an underscore | -LL - F::A(x, y) | F::B(x, y) => { y }, -LL + F::A(_x, y) | F::B(_x, y) => { y }, - | +LL | F::A(_x, y) | F::B(_x, y) => { y }, + | + + error: unused variable: `a` --> $DIR/issue-56685.rs:27:14 @@ -47,9 +45,8 @@ LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL - let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { -LL + let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | +LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | + + error: unused variable: `x` --> $DIR/issue-56685.rs:39:20 @@ -59,9 +56,8 @@ LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL - while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { -LL + while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | +LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | + + error: aborting due to 6 previous errors diff --git a/tests/ui/methods/issues/issue-90315.stderr b/tests/ui/methods/issues/issue-90315.stderr index e194a918834..e495701a3d7 100644 --- a/tests/ui/methods/issues/issue-90315.stderr +++ b/tests/ui/methods/issues/issue-90315.stderr @@ -181,9 +181,8 @@ LL | let _res: i32 = ..6.take(2).sum(); | help: you must specify a concrete type for this numeric value, like `i32` | -LL - let _res: i32 = ..6.take(2).sum(); -LL + let _res: i32 = ..6_i32.take(2).sum(); - | +LL | let _res: i32 = ..6_i32.take(2).sum(); + | ++++ error: aborting due to 18 previous errors diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr index d688bcc90c8..c9a54951307 100644 --- a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -6,9 +6,8 @@ LL | let x = 2.0.neg(); | help: you must specify a concrete type for this numeric value, like `f32` | -LL - let x = 2.0.neg(); -LL + let x = 2.0_f32.neg(); - | +LL | let x = 2.0_f32.neg(); + | ++++ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/method-on-ambiguous-numeric-type.rs:17:15 diff --git a/tests/ui/mir/issue-112269.stderr b/tests/ui/mir/issue-112269.stderr index 29b69cb7e20..fc8bf5d67b5 100644 --- a/tests/ui/mir/issue-112269.stderr +++ b/tests/ui/mir/issue-112269.stderr @@ -11,9 +11,8 @@ LL | let x: i32 = 3; = note: the matched value is of type `i32` help: introduce a variable instead | -LL - let x: i32 = 3; -LL + let x_var: i32 = 3; - | +LL | let x_var: i32 = 3; + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/issue-112269.rs:7:9 @@ -28,9 +27,8 @@ LL | let y = 4; = note: the matched value is of type `i32` help: introduce a variable instead | -LL - let y = 4; -LL + let y_var = 4; - | +LL | let y_var = 4; + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr index 29559980cb4..fed6b11a7b2 100644 --- a/tests/ui/mismatched_types/issue-112036.stderr +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -8,9 +8,8 @@ LL | fn drop(self) {} found signature `fn(Foo)` help: change the self-receiver type to match the trait | -LL - fn drop(self) {} -LL + fn drop(&mut self) {} - | +LL | fn drop(&mut self) {} + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index 62f087ca6b7..d69e83cce9a 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -195,9 +195,8 @@ LL | [t, t]; | - you could clone this value help: consider further restricting type parameter `T` with trait `Copy` | -LL - T:, -LL + T:, T: Copy - | +LL | T:, T: Copy + | +++++++ error: aborting due to 11 previous errors diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index 41891c5144b..412ea4aba30 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -10,9 +10,8 @@ LL | check(m1::S); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL - check(m1::S); -LL + check(m1::TS); - | +LL | check(m1::TS); + | + help: consider importing one of these constants instead | LL + use m2::S; @@ -39,9 +38,8 @@ LL | pub struct TS(); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL - check(xm1::S); -LL + check(xm1::TS); - | +LL | check(xm1::TS); + | + help: consider importing one of these constants instead | LL + use m2::S; @@ -66,9 +64,8 @@ LL | check(m7::V); = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL - check(m7::V); -LL + check(m7::TV); - | +LL | check(m7::TV); + | + help: consider importing one of these constants instead | LL + use m8::V; @@ -95,9 +92,8 @@ LL | TV(), = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL - check(xm7::V); -LL + check(xm7::TV); - | +LL | check(xm7::TV); + | + help: consider importing one of these constants instead | LL + use m8::V; diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 980670fee69..a01b1d5174d 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -33,9 +33,8 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | help: consider adding an explicit lifetime bound | -LL - T: Iterator, -LL + T: Iterator, <T as Iterator>::Item: 'a - | +LL | T: Iterator, <T as Iterator>::Item: 'a + | +++++++++++++++++++++++++ note: external requirements --> $DIR/projection-no-regions-closure.rs:34:23 @@ -96,9 +95,8 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | help: consider adding an explicit lifetime bound | -LL - T: 'b + Iterator, -LL + T: 'b + Iterator, <T as Iterator>::Item: 'a - | +LL | T: 'b + Iterator, <T as Iterator>::Item: 'a + | +++++++++++++++++++++++++ note: external requirements --> $DIR/projection-no-regions-closure.rs:52:23 diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr index 53da981d702..07debd308c2 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr @@ -9,9 +9,8 @@ LL | Box::new(x.next()) | help: consider adding an explicit lifetime bound | -LL - T: Iterator, -LL + T: Iterator, <T as Iterator>::Item: 'a - | +LL | T: Iterator, <T as Iterator>::Item: 'a + | +++++++++++++++++++++++++ error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough --> $DIR/projection-no-regions-fn.rs:28:5 @@ -24,9 +23,8 @@ LL | Box::new(x.next()) | help: consider adding an explicit lifetime bound | -LL - T: 'b + Iterator, -LL + T: 'b + Iterator, <T as Iterator>::Item: 'a - | +LL | T: 'b + Iterator, <T as Iterator>::Item: 'a + | +++++++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 34498f68f67..4b779103a6d 100644 --- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -34,9 +34,8 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | help: consider adding an explicit lifetime bound | -LL - T: Anything<'b, 'c>, -LL + T: Anything<'b, 'c>, <T as Anything<'b/#0, 'c/#1>>::AssocType: 'a - | +LL | T: Anything<'b, 'c>, <T as Anything<'b/#0, 'c/#1>>::AssocType: 'a + | ++++++++++++++++++++++++++++++++++++++++++++ note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 @@ -74,9 +73,8 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | help: consider adding an explicit lifetime bound | -LL - 'a: 'a, -LL + 'a: 'a, <T as Anything<'b/#1, 'c/#2>>::AssocType: 'a - | +LL | 'a: 'a, <T as Anything<'b/#1, 'c/#2>>::AssocType: 'a + | ++++++++++++++++++++++++++++++++++++++++++++ note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:61:29 diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr index a53c01e506e..4b1e59053c9 100644 --- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr @@ -9,9 +9,8 @@ LL | bar::<T::Output>() | help: consider adding an explicit lifetime bound | -LL - <T as MyTrait<'a>>::Output: 'b, -LL + <T as MyTrait<'a>>::Output: 'b, <T as MyTrait<'a>>::Output: 'a - | +LL | <T as MyTrait<'a>>::Output: 'b, <T as MyTrait<'a>>::Output: 'a + | ++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr index 36a0f40246e..9c93d663e2d 100644 --- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr +++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr @@ -9,9 +9,8 @@ LL | bar::<<T as MyTrait<'a>>::Output>() | help: consider adding an explicit lifetime bound | -LL - <T as MyTrait<'b>>::Output: 'a, -LL + <T as MyTrait<'b>>::Output: 'a, <T as MyTrait<'a>>::Output: 'a - | +LL | <T as MyTrait<'b>>::Output: 'a, <T as MyTrait<'a>>::Output: 'a + | ++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 7e3a13dd90b..ac8e069cfd2 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -9,9 +9,8 @@ LL | x.owned(); | help: there is a method `to_owned` with a similar name | -LL - x.owned(); -LL + x.to_owned(); - | +LL | x.to_owned(); + | +++ error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/parser/attribute/attr-pat-struct-rest.rs b/tests/ui/parser/attribute/attr-pat-struct-rest.rs new file mode 100644 index 00000000000..b2bfcf82df8 --- /dev/null +++ b/tests/ui/parser/attribute/attr-pat-struct-rest.rs @@ -0,0 +1,8 @@ +// #81282: Attributes are not allowed on struct field rest patterns (the ..). + +struct S {} + +fn main() { + let S { #[cfg(any())] .. } = S {}; + //~^ ERROR expected identifier, found `..` +} diff --git a/tests/ui/parser/attribute/attr-pat-struct-rest.stderr b/tests/ui/parser/attribute/attr-pat-struct-rest.stderr new file mode 100644 index 00000000000..f72c54973fc --- /dev/null +++ b/tests/ui/parser/attribute/attr-pat-struct-rest.stderr @@ -0,0 +1,10 @@ +error: expected identifier, found `..` + --> $DIR/attr-pat-struct-rest.rs:6:27 + | +LL | let S { #[cfg(any())] .. } = S {}; + | - ^^ expected identifier + | | + | while parsing the fields for this pattern + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index 3513055cb55..b5b05c2c142 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -6,9 +6,8 @@ LL | '''; | help: escape the character | -LL - '''; -LL + '\''; - | +LL | '\''; + | + error: character constant must be escaped: `\n` --> $DIR/bad-char-literals.rs:10:6 diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.stderr b/tests/ui/parser/bad-escape-suggest-raw-string.stderr index 5afa1f4a7f8..15e99b3cb32 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.stderr +++ b/tests/ui/parser/bad-escape-suggest-raw-string.stderr @@ -7,9 +7,8 @@ LL | let bad = "ab\[c"; = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL - let bad = "ab\[c"; -LL + let bad = r"ab\[c"; - | +LL | let bad = r"ab\[c"; + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index fe3cfb23de8..1c89e8e2864 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -39,9 +39,8 @@ LL | b'''; | help: escape the character | -LL - b'''; -LL + b'\''; - | +LL | b'\''; + | + error: non-ASCII character in byte literal --> $DIR/byte-literals.rs:10:7 diff --git a/tests/ui/parser/char/whitespace-character-literal.stderr b/tests/ui/parser/char/whitespace-character-literal.stderr index 53f2eb3ecba..f273b5d61d5 100644 --- a/tests/ui/parser/char/whitespace-character-literal.stderr +++ b/tests/ui/parser/char/whitespace-character-literal.stderr @@ -11,9 +11,8 @@ LL | let _hair_space_around = ' x'; | ^^ help: consider removing the non-printing characters | -LL - let _hair_space_around = ' x'; -LL + let _hair_space_around = 'x'; - | +LL | let _hair_space_around = 'x'; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/extern-no-fn.stderr b/tests/ui/parser/extern-no-fn.stderr index 2ee905429c4..67acbf9b87f 100644 --- a/tests/ui/parser/extern-no-fn.stderr +++ b/tests/ui/parser/extern-no-fn.stderr @@ -11,9 +11,8 @@ LL | } | help: if you meant to call a macro, try | -LL - f(); -LL + f!(); - | +LL | f!(); + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr index 767f63d6958..7146949ca2f 100644 --- a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr +++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr @@ -54,9 +54,8 @@ LL | mut n = 0; | help: missing keyword | -LL - mut n = 0; -LL + let mut n = 0; - | +LL | let mut n = 0; + | +++ error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5 @@ -66,9 +65,8 @@ LL | mut var; | help: missing keyword | -LL - mut var; -LL + let mut var; - | +LL | let mut var; + | +++ error[E0308]: mismatched types --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33 diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index fa848368945..a9bad96f9af 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -8,9 +8,8 @@ LL | Foo:Bar => {} | help: maybe write a path separator here | -LL - Foo:Bar => {} -LL + Foo::Bar => {} - | +LL | Foo::Bar => {} + | + error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 @@ -22,9 +21,8 @@ LL | qux::Foo:Bar => {} | help: maybe write a path separator here | -LL - qux::Foo:Bar => {} -LL + qux::Foo::Bar => {} - | +LL | qux::Foo::Bar => {} + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 @@ -36,9 +34,8 @@ LL | qux:Foo::Baz => {} | help: maybe write a path separator here | -LL - qux:Foo::Baz => {} -LL + qux::Foo::Baz => {} - | +LL | qux::Foo::Baz => {} + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 @@ -50,9 +47,8 @@ LL | qux: Foo::Baz if true => {} | help: maybe write a path separator here | -LL - qux: Foo::Baz if true => {} -LL + qux::Foo::Baz if true => {} - | +LL | qux::Foo::Baz if true => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:40:15 @@ -64,9 +60,8 @@ LL | if let Foo:Bar = f() { | help: maybe write a path separator here | -LL - if let Foo:Bar = f() { -LL + if let Foo::Bar = f() { - | +LL | if let Foo::Bar = f() { + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:49:16 @@ -78,9 +73,8 @@ LL | ref qux: Foo::Baz => {} | help: maybe write a path separator here | -LL - ref qux: Foo::Baz => {} -LL + ref qux::Foo::Baz => {} - | +LL | ref qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:58:16 @@ -92,9 +86,8 @@ LL | mut qux: Foo::Baz => {} | help: maybe write a path separator here | -LL - mut qux: Foo::Baz => {} -LL + mut qux::Foo::Baz => {} - | +LL | mut qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:69:12 @@ -106,9 +99,8 @@ LL | Foo:Bar::Baz => {} | help: maybe write a path separator here | -LL - Foo:Bar::Baz => {} -LL + Foo::Bar::Baz => {} - | +LL | Foo::Bar::Baz => {} + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:75:12 @@ -120,9 +112,8 @@ LL | Foo:Bar => {} | help: maybe write a path separator here | -LL - Foo:Bar => {} -LL + Foo::Bar => {} - | +LL | Foo::Bar => {} + | + warning: irrefutable `if let` pattern --> $DIR/issue-87086-colon-path-sep.rs:40:8 diff --git a/tests/ui/parser/missing-fn-issue-65381-2.stderr b/tests/ui/parser/missing-fn-issue-65381-2.stderr index ba2cf497df2..17a25bc6671 100644 --- a/tests/ui/parser/missing-fn-issue-65381-2.stderr +++ b/tests/ui/parser/missing-fn-issue-65381-2.stderr @@ -6,9 +6,8 @@ LL | main(); | help: if you meant to call a macro, try | -LL - main(); -LL + main!(); - | +LL | main!(); + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const.stderr b/tests/ui/parser/misspelled-keywords/const.stderr index ca76f51f4ed..59346461ce7 100644 --- a/tests/ui/parser/misspelled-keywords/const.stderr +++ b/tests/ui/parser/misspelled-keywords/const.stderr @@ -6,9 +6,8 @@ LL | cons A: u8 = 10; | help: there is a keyword `const` with a similar name | -LL - cons A: u8 = 10; -LL + const A: u8 = 10; - | +LL | const A: u8 = 10; + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/raw/raw-idents.rs b/tests/ui/parser/raw/raw-idents.rs new file mode 100644 index 00000000000..93015ee6c49 --- /dev/null +++ b/tests/ui/parser/raw/raw-idents.rs @@ -0,0 +1,158 @@ +//@ check-pass +//@ revisions:e2015 e2018 e2021 e2024 +//@[e2015] edition:2015 +//@[e2018] edition:2018 +//@[e2021] edition:2021 +//@[e2024] edition:2024 + +// Ensure that all (usable as identifier) keywords work as raw identifiers in all positions. +// This was motivated by issue #137128, where `r#move`/`r#static`` did not work as `const` names +// due to a parser check not acounting for raw identifiers. + +#![crate_type = "lib"] +#![allow(dead_code, nonstandard_style)] + +// NOTE: It is vital to only use a `tt` fragment to avoid confusing +// the parser with nonterminals that can mask bugs. + +macro_rules! tests { + ($kw:tt) => { + mod $kw { + mod const_item { + const $kw: () = (); + } + mod static_item { + static $kw: () = (); + } + mod fn_item { + fn $kw() {} + } + mod mod_and_use_item { + mod $kw { + use super::$kw; + } + } + mod ty_alias_item { + type $kw = (); + } + mod struct_item { + struct $kw { $kw: () } + } + mod enum_item { + enum $kw { $kw } + } + mod union_item { + union $kw { $kw: () } + } + mod trait_item { + trait $kw { + fn $kw() {} + } + } + mod generics_and_impl { + struct A<$kw>($kw); + enum B<$kw> { A($kw) } + trait Tr<$kw> { + type $kw; + } + + impl<$kw> Tr<$kw> for A<$kw> { + type $kw = (); + } + impl<$kw> B<$kw> {} + } + mod extern_crate { + #[cfg(any())] + extern crate $kw; + } + mod body { + fn expr() { + let $kw = 0; + let b = $kw; + assert_eq!($kw, b); + type $kw = (); + let $kw: $kw = (); + let _ = $kw as $kw; + } + fn pat_const() { + const $kw: u8 = 0; + + // Ensure that $kw actually matches the constant. + #[forbid(unreachable_patterns)] + match 1 { + $kw => {} + _ => {} + } + } + fn pat_binding() { + match 1 { + $kw => {} + _ => {} + } + } + } + } + }; +} + +tests!(r#break); +tests!(r#const); +tests!(r#continue); +tests!(r#else); +tests!(r#enum); +tests!(r#extern); +tests!(r#false); +tests!(r#fn); +tests!(r#for); +tests!(r#if); +tests!(r#impl); +tests!(r#in); +tests!(r#let); +tests!(r#loop); +tests!(r#match); +tests!(r#mod); +tests!(r#move); +tests!(r#mut); +tests!(r#pub); +tests!(r#ref); +tests!(r#return); +tests!(r#static); +tests!(r#struct); +tests!(r#trait); +tests!(r#true); +tests!(r#type); +tests!(r#unsafe); +tests!(r#use); +tests!(r#where); +tests!(r#while); +tests!(r#abstract); +tests!(r#become); +tests!(r#box); +tests!(r#do); +tests!(r#final); +tests!(r#macro); +tests!(r#override); +tests!(r#priv); +tests!(r#typeof); +tests!(r#unsized); +tests!(r#virtual); +tests!(r#yield); +tests!(r#async); +tests!(r#await); +tests!(r#dyn); +tests!(r#gen); +tests!(r#try); + +// Weak keywords: +tests!(auto); +tests!(builtin); +tests!(catch); +tests!(default); +tests!(macro_rules); +tests!(raw); +tests!(reuse); +tests!(contract_ensures); +tests!(contract_requires); +tests!(safe); +tests!(union); +tests!(yeet); diff --git a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr index 15866211954..583b98c650f 100644 --- a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr +++ b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr @@ -7,9 +7,8 @@ LL | let x = Tr<A, A:>; = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> help: maybe write a path separator here | -LL - let x = Tr<A, A:>; -LL + let x = Tr<A, A::>; - | +LL | let x = Tr<A, A::>; + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/type-ascription-in-pattern.stderr b/tests/ui/parser/type-ascription-in-pattern.stderr index d29c76baa7b..09190754993 100644 --- a/tests/ui/parser/type-ascription-in-pattern.stderr +++ b/tests/ui/parser/type-ascription-in-pattern.stderr @@ -8,9 +8,8 @@ LL | x: i32 => x, | help: maybe write a path separator here | -LL - x: i32 => x, -LL + x::i32 => x, - | +LL | x::i32 => x, + | ~~ error: expected one of `...`, `..=`, `..`, or `|`, found `:` --> $DIR/type-ascription-in-pattern.rs:12:11 @@ -38,9 +37,8 @@ LL | x: i32 => (), | help: maybe write a path separator here | -LL - x: i32 => (), -LL + x::i32 => (), - | +LL | x::i32 => (), + | ~~ error[E0308]: mismatched types --> $DIR/type-ascription-in-pattern.rs:3:19 diff --git a/tests/ui/parser/use-colon-as-mod-sep.stderr b/tests/ui/parser/use-colon-as-mod-sep.stderr index f25a779f31f..9b4cc0ca237 100644 --- a/tests/ui/parser/use-colon-as-mod-sep.stderr +++ b/tests/ui/parser/use-colon-as-mod-sep.stderr @@ -7,9 +7,8 @@ LL | use std::process:Command; = note: import paths are delimited using `::` help: use double colon | -LL - use std::process:Command; -LL + use std::process::Command; - | +LL | use std::process::Command; + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:5:8 @@ -20,9 +19,8 @@ LL | use std:fs::File; = note: import paths are delimited using `::` help: use double colon | -LL - use std:fs::File; -LL + use std::fs::File; - | +LL | use std::fs::File; + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:8 @@ -33,9 +31,8 @@ LL | use std:collections:HashMap; = note: import paths are delimited using `::` help: use double colon | -LL - use std:collections:HashMap; -LL + use std::collections:HashMap; - | +LL | use std::collections:HashMap; + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:20 @@ -46,9 +43,8 @@ LL | use std:collections:HashMap; = note: import paths are delimited using `::` help: use double colon | -LL - use std:collections:HashMap; -LL + use std:collections::HashMap; - | +LL | use std:collections::HashMap; + | + error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/complexity_limit.rs b/tests/ui/pattern/complexity_limit.rs index c9a3f99bccd..7c127820511 100644 --- a/tests/ui/pattern/complexity_limit.rs +++ b/tests/ui/pattern/complexity_limit.rs @@ -1,5 +1,5 @@ #![feature(rustc_attrs)] -#![pattern_complexity = "10000"] +#![pattern_complexity_limit = "10000"] #[derive(Default)] struct BaseCommand { diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index c084ec0b532..e164281826b 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -121,9 +121,8 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use the tuple variant pattern syntax instead | -LL - E1::Z1 => {} -LL + E1::Z1() => {} - | +LL | E1::Z1() => {} + | ++ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/pat-tuple-overfield.stderr b/tests/ui/pattern/pat-tuple-overfield.stderr index 4e8261cb15b..b19b9d19347 100644 --- a/tests/ui/pattern/pat-tuple-overfield.stderr +++ b/tests/ui/pattern/pat-tuple-overfield.stderr @@ -155,9 +155,8 @@ LL | E1::Z1 => {} | help: use the tuple variant pattern syntax instead | -LL - E1::Z1 => {} -LL + E1::Z1() => {} - | +LL | E1::Z1() => {} + | ++ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr index a12b94176c0..a6623c6306b 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr @@ -6,9 +6,8 @@ LL | b.make_ascii_uppercase(); | help: consider changing this to be mutable | -LL - let &b = a; -LL + let &(mut b) = a; - | +LL | let &(mut b) = a; + | ++++ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr index 68141af4910..7fa65e3d6bd 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr @@ -6,9 +6,8 @@ LL | mutate(&mut x); | help: consider changing this to be mutable | -LL - fn foo(&x: &i32) { -LL + fn foo(&(mut x): &i32) { - | +LL | fn foo(&(mut x): &i32) { + | ++++ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr index 2f53ebe6f3f..d7e1b54e749 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr @@ -17,19 +17,16 @@ LL | let HiddenStruct { one } = HiddenStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, two, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, two, .. } = HiddenStruct::default(); + | +++++++++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); + | ++++++++++++ help: or always ignore missing fields here | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, .. } = HiddenStruct::default(); + | ++++ error[E0027]: pattern does not mention field `two` --> $DIR/doc-hidden-fields.rs:21:9 @@ -39,19 +36,16 @@ LL | let HiddenStruct { one, hide } = HiddenStruct::default(); | help: include the missing field in the pattern | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, two } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, two } = HiddenStruct::default(); + | +++++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); + | ++++++++ help: or always ignore missing fields here | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default(); + | ++++ error[E0027]: pattern does not mention field `im_hidden` --> $DIR/doc-hidden-fields.rs:24:9 @@ -61,19 +55,16 @@ LL | let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; | help: include the missing field in the pattern | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; + | +++++++++++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ++++++++++++++ help: or always ignore missing fields here | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ++++ error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs index 783512d5cca..44d1586ce4f 100644 --- a/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs +++ b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs @@ -1,5 +1,5 @@ #![feature(rustc_attrs)] -#![pattern_complexity = "61"] +#![pattern_complexity_limit = "61"] //@ check-pass struct BaseCommand { diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr index 7b44bc79acf..7c30b530d6d 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr @@ -6,19 +6,16 @@ LL | let UnstableStruct { stable } = UnstableStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); + | +++++++++++++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); + | ++++++++++++++++ help: or always ignore missing fields here | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, .. } = UnstableStruct::default(); + | ++++ error: pattern requires `..` due to inaccessible fields --> $DIR/stable-gated-fields.rs:11:9 diff --git a/tests/ui/privacy/privacy5.stderr b/tests/ui/privacy/privacy5.stderr index 8f28f629ba3..ec3abe9b816 100644 --- a/tests/ui/privacy/privacy5.stderr +++ b/tests/ui/privacy/privacy5.stderr @@ -52,9 +52,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:56:12 @@ -262,9 +261,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:69:12 @@ -282,9 +280,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:70:12 @@ -302,9 +299,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:71:12 @@ -322,9 +318,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:72:18 @@ -342,9 +337,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:73:18 @@ -362,9 +356,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:74:18 @@ -382,9 +375,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:75:18 @@ -402,9 +394,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:83:17 @@ -460,9 +451,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:90:20 diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index da8405fd0e8..b651348de29 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -9,9 +9,8 @@ LL | let _ = std::collections::HashMap(); | help: you might have meant to use an associated function to build this type | -LL - let _ = std::collections::HashMap(); -LL + let _ = std::collections::HashMap::new(); - | +LL | let _ = std::collections::HashMap::new(); + | +++++ LL - let _ = std::collections::HashMap(); LL + let _ = std::collections::HashMap::with_capacity(_); | @@ -23,9 +22,8 @@ LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); | help: consider using the `Default` trait | -LL - let _ = std::collections::HashMap(); -LL + let _ = <std::collections::HashMap as std::default::Default>::default(); - | +LL | let _ = <std::collections::HashMap as std::default::Default>::default(); + | + ++++++++++++++++++++++++++++++++++ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-box-new.rs:8:19 diff --git a/tests/ui/pub/pub-ident-fn-or-struct.stderr b/tests/ui/pub/pub-ident-fn-or-struct.stderr index 1bdb547be1e..99c8e5754ef 100644 --- a/tests/ui/pub/pub-ident-fn-or-struct.stderr +++ b/tests/ui/pub/pub-ident-fn-or-struct.stderr @@ -6,9 +6,8 @@ LL | pub S (foo) bar | help: if you meant to call a macro, try | -LL - pub S (foo) bar -LL + pub S! (foo) bar - | +LL | pub S! (foo) bar + | + error: aborting due to 1 previous error diff --git a/tests/ui/pub/pub-restricted.stderr b/tests/ui/pub/pub-restricted.stderr index 35c48c6d769..6c913938bb8 100644 --- a/tests/ui/pub/pub-restricted.stderr +++ b/tests/ui/pub/pub-restricted.stderr @@ -10,9 +10,8 @@ LL | pub (a) fn afn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL - pub (a) fn afn() {} -LL + pub (in a) fn afn() {} - | +LL | pub (in a) fn afn() {} + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:4:6 @@ -26,9 +25,8 @@ LL | pub (b) fn bfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `b` with `in` | -LL - pub (b) fn bfn() {} -LL + pub (in b) fn bfn() {} - | +LL | pub (in b) fn bfn() {} + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 @@ -42,9 +40,8 @@ LL | pub (crate::a) fn cfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `crate::a` with `in` | -LL - pub (crate::a) fn cfn() {} -LL + pub (in crate::a) fn cfn() {} - | +LL | pub (in crate::a) fn cfn() {} + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 @@ -58,9 +55,8 @@ LL | pub (a) invalid: usize, `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL - pub (a) invalid: usize, -LL + pub (in a) invalid: usize, - | +LL | pub (in a) invalid: usize, + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 @@ -74,9 +70,8 @@ LL | pub (xyz) fn xyz() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `xyz` with `in` | -LL - pub (xyz) fn xyz() {} -LL + pub (in xyz) fn xyz() {} - | +LL | pub (in xyz) fn xyz() {} + | ++ error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 diff --git a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr index f142f91064f..ef641eb5681 100644 --- a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr +++ b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr @@ -73,9 +73,8 @@ LL | _ => {} | help: you might have meant to pattern match against the value of constant `ARCH` instead of introducing a new catch-all binding | -LL - ARCH => {} -LL + std::env::consts::ARCH => {} - | +LL | std::env::consts::ARCH => {} + | ++++++++++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/issue-39226.stderr b/tests/ui/resolve/issue-39226.stderr index 3d771b4fc42..1cd2a5fb221 100644 --- a/tests/ui/resolve/issue-39226.stderr +++ b/tests/ui/resolve/issue-39226.stderr @@ -9,9 +9,8 @@ LL | handle: Handle | help: use struct literal syntax instead | -LL - handle: Handle -LL + handle: Handle {} - | +LL | handle: Handle {} + | ++ help: a local variable with a similar name exists | LL - handle: Handle diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr index 30b1cd09085..2695868b771 100644 --- a/tests/ui/resolve/issue-55673.stderr +++ b/tests/ui/resolve/issue-55673.stderr @@ -18,9 +18,8 @@ LL | T::Baa: std::fmt::Debug, | help: consider further restricting type parameter `T` with trait `Foo` | -LL - T::Baa: std::fmt::Debug, -LL + T::Baa: std::fmt::Debug, T: Foo - | +LL | T::Baa: std::fmt::Debug, T: Foo + | ++++++ help: ...and changing the associated type name | LL - T::Baa: std::fmt::Debug, diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 890bb04f24d..fccbfe547cb 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -20,9 +20,8 @@ help: you might have meant to use one of the following enum variants LL - A.foo(); LL + (A::Tuple()).foo(); | -LL - A.foo(); -LL + A::Unit.foo(); - | +LL | A::Unit.foo(); + | ++++++ help: alternatively, the following enum variant is available | LL - A.foo(); @@ -61,9 +60,8 @@ LL | | } | |_^ help: you might have meant to use the following enum variant | -LL - C.foo(); -LL + C::Unit.foo(); - | +LL | C::Unit.foo(); + | ++++++ help: alternatively, the following enum variant is available | LL - C.foo(); @@ -86,9 +84,8 @@ LL | | } | |_^ help: you might have meant to use the following enum variant | -LL - D.foo(); -LL + D::Unit.foo(); - | +LL | D::Unit.foo(); + | ++++++ help: alternatively, the following enum variant is available | LL - D.foo(); @@ -144,12 +141,10 @@ LL | | } | |_^ help: try to match against one of the enum's variants | -LL - if let A(3) = x { } -LL + if let A::Tuple(3) = x { } - | -LL - if let A(3) = x { } -LL + if let A::TupleWithFields(3) = x { } - | +LL | if let A::Tuple(3) = x { } + | +++++++ +LL | if let A::TupleWithFields(3) = x { } + | +++++++++++++++++ error[E0423]: expected function, tuple struct or tuple variant, found enum `A` --> $DIR/issue-73427.rs:46:13 @@ -171,12 +166,10 @@ LL | | } | |_^ help: try to construct one of the enum's variants | -LL - let x = A(3); -LL + let x = A::Tuple(3); - | -LL - let x = A(3); -LL + let x = A::TupleWithFields(3); - | +LL | let x = A::Tuple(3); + | +++++++ +LL | let x = A::TupleWithFields(3); + | +++++++++++++++++ error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index 3bbab3716af..f349b9391d1 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -124,9 +124,8 @@ LL | | } | |_____^ help: you might have meant to use the following enum variant | -LL - let _: E = E; -LL + let _: E = E::Unit; - | +LL | let _: E = E::Unit; + | ++++++ help: alternatively, the following enum variant is available | LL - let _: E = E; diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index 3197e0b0894..5fac622eef2 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -34,9 +34,8 @@ LL | (A, B) | (ref B, c) | (c, A) => () | help: if you meant to match on unit variant `E::A`, use the full path in the pattern | -LL - (A, B) | (ref B, c) | (c, A) => () -LL + (E::A, B) | (ref B, c) | (c, A) => () - | +LL | (E::A, B) | (ref B, c) | (c, A) => () + | +++ error[E0408]: variable `B` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:19:31 @@ -65,9 +64,8 @@ LL | (CONST1, _) | (_, Const2) => () | help: if you meant to match on constant `m::Const2`, use the full path in the pattern | -LL - (CONST1, _) | (_, Const2) => () -LL + (CONST1, _) | (_, m::Const2) => () - | +LL | (CONST1, _) | (_, m::Const2) => () + | +++ error[E0408]: variable `CONST1` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:31:23 diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr index 3d6d47578c3..366bc1bf03c 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr @@ -11,9 +11,8 @@ LL | const DEFAULT: u32 = 0; = note: the matched value is of type `u32` help: introduce a variable instead | -LL - let DEFAULT: u32 = 0; -LL + let DEFAULT_var: u32 = 0; - | +LL | let DEFAULT_var: u32 = 0; + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr index f041487da41..1392eb48f8c 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr @@ -21,9 +21,8 @@ LL | const DEFAULT: u32 = 0; = note: the matched value is of type `u32` help: introduce a variable instead | -LL - let DEFAULT: u32 = 0; -LL + let DEFAULT_var: u32 = 0; - | +LL | let DEFAULT_var: u32 = 0; + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr index 15fdb975a1b..5832cb69a3d 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -66,9 +66,8 @@ LL | Self::BAR; | ++++++ help: a constant with a similar name exists | -LL - BAR; -LL + BARR; - | +LL | BARR; + | + error[E0412]: cannot find type `Baz` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:37:18 diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index 1ea7f1d39cb..2d0d0d0f386 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -39,9 +39,8 @@ LL | modul::foo(); | help: there is a crate or module with a similar name | -LL - modul::foo(); -LL + module::foo(); - | +LL | module::foo(); + | + error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr index d0244f39769..88411f29b16 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr @@ -58,9 +58,8 @@ LL | let NormalStruct { first_field, second_field } = ns; | help: add `..` at the end of the field list to ignore all other fields | -LL - let NormalStruct { first_field, second_field } = ns; -LL + let NormalStruct { first_field, second_field , .. } = ns; - | +LL | let NormalStruct { first_field, second_field , .. } = ns; + | ++++ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/struct.rs:20:14 @@ -76,9 +75,8 @@ LL | let TupleStruct { 0: first_field, 1: second_field } = ts; | help: add `..` at the end of the field list to ignore all other fields | -LL - let TupleStruct { 0: first_field, 1: second_field } = ts; -LL + let TupleStruct { 0: first_field, 1: second_field , .. } = ts; - | +LL | let TupleStruct { 0: first_field, 1: second_field , .. } = ts; + | ++++ error[E0638]: `..` required with struct marked as non-exhaustive --> $DIR/struct.rs:35:9 @@ -88,9 +86,8 @@ LL | let UnitStruct { } = us; | help: add `..` at the end of the field list to ignore all other fields | -LL - let UnitStruct { } = us; -LL + let UnitStruct { .. } = us; - | +LL | let UnitStruct { .. } = us; + | ++ error: aborting due to 9 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr index 4cabd5a8140..dcecd53d38a 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr @@ -82,9 +82,8 @@ LL | NonExhaustiveVariants::Struct { field } => "" | help: add `..` at the end of the field list to ignore all other fields | -LL - NonExhaustiveVariants::Struct { field } => "" -LL + NonExhaustiveVariants::Struct { field , .. } => "" - | +LL | NonExhaustiveVariants::Struct { field , .. } => "" + | ++++ error[E0638]: `..` required with variant marked as non-exhaustive --> $DIR/variant.rs:30:12 @@ -94,9 +93,8 @@ LL | if let NonExhaustiveVariants::Struct { field } = variant_struct { | help: add `..` at the end of the field list to ignore all other fields | -LL - if let NonExhaustiveVariants::Struct { field } = variant_struct { -LL + if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { - | +LL | if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr index 37a0f2bcaa8..38360e06cbe 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -6,9 +6,8 @@ LL | use alloc; | help: consider importing this module instead | -LL - use alloc; -LL + use std::alloc; - | +LL | use std::alloc; + | +++++ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 077b4a6cf2f..488044ee852 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -34,9 +34,8 @@ LL + use crate::foo::Bar; | help: there is a method `foobar` with a similar name | -LL - x.bar(); -LL + x.foobar(); - | +LL | x.foobar(); + | +++ error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 diff --git a/tests/ui/simd-abi-checks-empty-list.rs b/tests/ui/simd-abi-checks-empty-list.rs index c1785051e5a..ca0889364fc 100644 --- a/tests/ui/simd-abi-checks-empty-list.rs +++ b/tests/ui/simd-abi-checks-empty-list.rs @@ -1,19 +1,18 @@ +//@ add-core-stubs //@ needs-llvm-components: sparc //@ compile-flags: --target=sparc-unknown-none-elf --crate-type=rlib //@ build-pass //@ ignore-pass (test emits codegen-time warnings) #![no_core] -#![feature(no_core, lang_items, repr_simd)] +#![feature(no_core, repr_simd)] #![allow(improper_ctypes_definitions)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct SimdVec([i32; 4]); pub extern "C" fn pass_by_vec(_: SimdVec) {} -//~^ this function definition uses a SIMD vector type that is not currently supported with the chosen ABI +//~^ this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI //~| WARNING this was previously accepted by the compiler diff --git a/tests/ui/simd-abi-checks-empty-list.stderr b/tests/ui/simd-abi-checks-empty-list.stderr index c49fe1a01de..111dda42f33 100644 --- a/tests/ui/simd-abi-checks-empty-list.stderr +++ b/tests/ui/simd-abi-checks-empty-list.stderr @@ -1,5 +1,5 @@ -warning: this function definition uses a SIMD vector type that is not currently supported with the chosen ABI - --> $DIR/simd-abi-checks-empty-list.rs:17:1 +warning: this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI + --> $DIR/simd-abi-checks-empty-list.rs:16:1 | LL | pub extern "C" fn pass_by_vec(_: SimdVec) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -11,8 +11,8 @@ LL | pub extern "C" fn pass_by_vec(_: SimdVec) {} warning: 1 warning emitted Future incompatibility report: Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that is not currently supported with the chosen ABI - --> $DIR/simd-abi-checks-empty-list.rs:17:1 +warning: this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI + --> $DIR/simd-abi-checks-empty-list.rs:16:1 | LL | pub extern "C" fn pass_by_vec(_: SimdVec) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/simd-abi-checks-s390x.rs b/tests/ui/simd-abi-checks-s390x.rs index 15df66a2ced..424ac00edcf 100644 --- a/tests/ui/simd-abi-checks-s390x.rs +++ b/tests/ui/simd-abi-checks-s390x.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: z10 z13_no_vector z13_soft_float //@ build-fail //@[z10] compile-flags: --target s390x-unknown-linux-gnu @@ -8,20 +9,14 @@ //@[z13_soft_float] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13 -C target-feature=-vector,+soft-float //@[z13_soft_float] needs-llvm-components: systemz -#![feature(no_core, lang_items, repr_simd, s390x_target_feature)] +#![feature(no_core, repr_simd, s390x_target_feature)] #![no_core] #![crate_type = "lib"] #![allow(non_camel_case_types, improper_ctypes_definitions)] #![deny(abi_unsupported_vector_types)] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -#[lang = "freeze"] -pub trait Freeze {} - -impl<T: Copy, const N: usize> Copy for [T; N] {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i8x8([i8; 8]); @@ -34,8 +29,6 @@ pub struct Wrapper<T>(T); #[repr(transparent)] pub struct TransparentWrapper<T>(T); -impl Copy for i8 {} -impl Copy for i64 {} impl Copy for i8x8 {} impl Copy for i8x16 {} impl Copy for i8x32 {} @@ -44,13 +37,13 @@ impl<T: Copy> Copy for TransparentWrapper<T> {} #[no_mangle] extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted *x } #[no_mangle] extern "C" fn vector_ret(x: &i8x16) -> i8x16 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted *x } @@ -99,7 +92,7 @@ extern "C" fn vector_wrapper_ret_large(x: &Wrapper<i8x32>) -> Wrapper<i8x32> { extern "C" fn vector_transparent_wrapper_ret_small( x: &TransparentWrapper<i8x8>, ) -> TransparentWrapper<i8x8> { - //~^^^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^^^ ERROR requires the `vector` target feature, which is not enabled //~^^^^ WARN this was previously accepted *x } @@ -107,7 +100,7 @@ extern "C" fn vector_transparent_wrapper_ret_small( extern "C" fn vector_transparent_wrapper_ret( x: &TransparentWrapper<i8x16>, ) -> TransparentWrapper<i8x16> { - //~^^^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^^^ ERROR requires the `vector` target feature, which is not enabled //~^^^^ WARN this was previously accepted *x } @@ -121,13 +114,13 @@ extern "C" fn vector_transparent_wrapper_ret_large( #[no_mangle] extern "C" fn vector_arg_small(x: i8x8) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const i8x8 as *const i64) } } #[no_mangle] extern "C" fn vector_arg(x: i8x16) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const i8x16 as *const i64) } } @@ -139,13 +132,13 @@ extern "C" fn vector_arg_large(x: i8x32) -> i64 { #[no_mangle] extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const Wrapper<i8x8> as *const i64) } } #[no_mangle] extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const Wrapper<i8x16> as *const i64) } } @@ -157,13 +150,13 @@ extern "C" fn vector_wrapper_arg_large(x: Wrapper<i8x32>) -> i64 { #[no_mangle] extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const TransparentWrapper<i8x8> as *const i64) } } #[no_mangle] extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const TransparentWrapper<i8x16> as *const i64) } } diff --git a/tests/ui/simd-abi-checks-s390x.z10.stderr b/tests/ui/simd-abi-checks-s390x.z10.stderr index cf135afb428..d2f7abb7c32 100644 --- a/tests/ui/simd-abi-checks-s390x.z10.stderr +++ b/tests/ui/simd-abi-checks-s390x.z10.stderr @@ -1,5 +1,5 @@ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -8,13 +8,13 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -23,8 +23,8 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -35,8 +35,8 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -47,8 +47,8 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -57,8 +57,8 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -67,8 +67,8 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -77,8 +77,8 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -87,8 +87,8 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -97,8 +97,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -110,8 +110,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) error: aborting due to 10 previous errors Future incompatibility report: Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -120,14 +120,14 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -136,14 +136,14 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -154,14 +154,14 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -172,14 +172,14 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -188,14 +188,14 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -204,14 +204,14 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -220,14 +220,14 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -236,14 +236,14 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -252,14 +252,14 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -268,7 +268,7 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd-abi-checks-s390x.z13_no_vector.stderr b/tests/ui/simd-abi-checks-s390x.z13_no_vector.stderr index cf135afb428..d2f7abb7c32 100644 --- a/tests/ui/simd-abi-checks-s390x.z13_no_vector.stderr +++ b/tests/ui/simd-abi-checks-s390x.z13_no_vector.stderr @@ -1,5 +1,5 @@ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -8,13 +8,13 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -23,8 +23,8 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -35,8 +35,8 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -47,8 +47,8 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -57,8 +57,8 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -67,8 +67,8 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -77,8 +77,8 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -87,8 +87,8 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -97,8 +97,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -110,8 +110,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) error: aborting due to 10 previous errors Future incompatibility report: Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -120,14 +120,14 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -136,14 +136,14 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -154,14 +154,14 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -172,14 +172,14 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -188,14 +188,14 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -204,14 +204,14 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -220,14 +220,14 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -236,14 +236,14 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -252,14 +252,14 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -268,7 +268,7 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd-abi-checks-s390x.z13_soft_float.stderr b/tests/ui/simd-abi-checks-s390x.z13_soft_float.stderr index cf135afb428..d2f7abb7c32 100644 --- a/tests/ui/simd-abi-checks-s390x.z13_soft_float.stderr +++ b/tests/ui/simd-abi-checks-s390x.z13_soft_float.stderr @@ -1,5 +1,5 @@ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -8,13 +8,13 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -23,8 +23,8 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -35,8 +35,8 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -47,8 +47,8 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -57,8 +57,8 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -67,8 +67,8 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -77,8 +77,8 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -87,8 +87,8 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -97,8 +97,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -110,8 +110,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) error: aborting due to 10 previous errors Future incompatibility report: Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -120,14 +120,14 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -136,14 +136,14 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -154,14 +154,14 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -172,14 +172,14 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -188,14 +188,14 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -204,14 +204,14 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -220,14 +220,14 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -236,14 +236,14 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -252,14 +252,14 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -268,7 +268,7 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd-abi-checks.rs b/tests/ui/simd-abi-checks.rs index 3a344a1f5f8..acab74300b8 100644 --- a/tests/ui/simd-abi-checks.rs +++ b/tests/ui/simd-abi-checks.rs @@ -13,19 +13,19 @@ use std::arch::x86_64::*; struct Wrapper(__m256); unsafe extern "C" fn w(_: Wrapper) { - //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled + //~^ requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } unsafe extern "C" fn f(_: __m256) { - //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled + //~^ requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } unsafe extern "C" fn g() -> __m256 { - //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled + //~^ requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } @@ -55,23 +55,23 @@ unsafe fn test() { unsafe fn in_closure() -> impl FnOnce() -> __m256 { #[inline(always)] // this disables target-feature inheritance || g() - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler } fn main() { unsafe { f(g()); - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller - //~| WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller + //~| WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler } unsafe { gavx(favx()); - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller - //~| WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller + //~| WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler } @@ -82,8 +82,8 @@ fn main() { unsafe { w(Wrapper(g())); - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller - //~| WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller + //~| WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler } @@ -98,7 +98,7 @@ fn main() { fn some_extern() -> __m256; } some_extern(); - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler } } diff --git a/tests/ui/simd-abi-checks.stderr b/tests/ui/simd-abi-checks.stderr index eb7d9e81029..a849993a166 100644 --- a/tests/ui/simd-abi-checks.stderr +++ b/tests/ui/simd-abi-checks.stderr @@ -1,4 +1,4 @@ -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:64:11 | LL | f(g()); @@ -9,7 +9,7 @@ LL | f(g()); = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) = note: `#[warn(abi_unsupported_vector_types)]` on by default -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:64:9 | LL | f(g()); @@ -19,7 +19,7 @@ LL | f(g()); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:72:14 | LL | gavx(favx()); @@ -29,7 +29,7 @@ LL | gavx(favx()); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:72:9 | LL | gavx(favx()); @@ -39,7 +39,7 @@ LL | gavx(favx()); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:84:19 | LL | w(Wrapper(g())); @@ -49,7 +49,7 @@ LL | w(Wrapper(g())); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:84:9 | LL | w(Wrapper(g())); @@ -59,7 +59,7 @@ LL | w(Wrapper(g())); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:100:9 | LL | some_extern(); @@ -69,7 +69,7 @@ LL | some_extern(); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:27:1 | LL | unsafe extern "C" fn g() -> __m256 { @@ -79,7 +79,7 @@ LL | unsafe extern "C" fn g() -> __m256 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:21:1 | LL | unsafe extern "C" fn f(_: __m256) { @@ -89,7 +89,7 @@ LL | unsafe extern "C" fn f(_: __m256) { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:15:1 | LL | unsafe extern "C" fn w(_: Wrapper) { @@ -99,7 +99,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:57:8 | LL | || g() @@ -112,7 +112,7 @@ LL | || g() warning: 11 warnings emitted Future incompatibility report: Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:64:11 | LL | f(g()); @@ -124,7 +124,7 @@ LL | f(g()); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:64:9 | LL | f(g()); @@ -136,7 +136,7 @@ LL | f(g()); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:72:14 | LL | gavx(favx()); @@ -148,7 +148,7 @@ LL | gavx(favx()); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:72:9 | LL | gavx(favx()); @@ -160,7 +160,7 @@ LL | gavx(favx()); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:84:19 | LL | w(Wrapper(g())); @@ -172,7 +172,7 @@ LL | w(Wrapper(g())); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:84:9 | LL | w(Wrapper(g())); @@ -184,7 +184,7 @@ LL | w(Wrapper(g())); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:100:9 | LL | some_extern(); @@ -196,7 +196,7 @@ LL | some_extern(); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:27:1 | LL | unsafe extern "C" fn g() -> __m256 { @@ -208,7 +208,7 @@ LL | unsafe extern "C" fn g() -> __m256 { = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:21:1 | LL | unsafe extern "C" fn f(_: __m256) { @@ -220,7 +220,7 @@ LL | unsafe extern "C" fn f(_: __m256) { = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:15:1 | LL | unsafe extern "C" fn w(_: Wrapper) { @@ -232,7 +232,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) { = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:57:8 | LL | || g() diff --git a/tests/ui/sse-abi-checks.rs b/tests/ui/sse-abi-checks.rs index c453e91d11b..cb3128a890f 100644 --- a/tests/ui/sse-abi-checks.rs +++ b/tests/ui/sse-abi-checks.rs @@ -1,6 +1,7 @@ //! Ensure we trigger abi_unsupported_vector_types for target features that are usually enabled //! on a target, but disabled in this file via a `-C` flag. -//@ compile-flags: --crate-type=rlib --target=i686-unknown-linux-gnu -C target-feature=-sse,-sse2 +//@ add-core-stubs +//@ compile-flags: --crate-type=rlib --target=i586-unknown-linux-gnu -C target-feature=-sse,-sse2 //@ build-pass //@ ignore-pass (test emits codegen-time warnings) //@ needs-llvm-components: x86 @@ -8,17 +9,14 @@ #![no_core] #![allow(improper_ctypes_definitions)] -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct SseVector([i64; 2]); #[no_mangle] pub unsafe extern "C" fn f(_: SseVector) { - //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `sse` target feature, which is not enabled + //~^ this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler } diff --git a/tests/ui/sse-abi-checks.stderr b/tests/ui/sse-abi-checks.stderr index e08b2d4e191..9944aa093b4 100644 --- a/tests/ui/sse-abi-checks.stderr +++ b/tests/ui/sse-abi-checks.stderr @@ -1,5 +1,5 @@ -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `sse` target feature, which is not enabled - --> $DIR/sse-abi-checks.rs:21:1 +warning: this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled + --> $DIR/sse-abi-checks.rs:19:1 | LL | pub unsafe extern "C" fn f(_: SseVector) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -12,8 +12,8 @@ LL | pub unsafe extern "C" fn f(_: SseVector) { warning: 1 warning emitted Future incompatibility report: Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `sse` target feature, which is not enabled - --> $DIR/sse-abi-checks.rs:21:1 +warning: this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled + --> $DIR/sse-abi-checks.rs:19:1 | LL | pub unsafe extern "C" fn f(_: SseVector) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr index 4cbd93d17cf..34bf1c6c10a 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `const_foobar` | -LL - #![feature(const_foo)] -LL + #![feature(const_foobar)] - | +LL | #![feature(const_foobar)] + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr index 38331919ee8..095c37fd0b6 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `const_foobar` | -LL - #![feature(const_foo)] -LL + #![feature(const_foobar)] - | +LL | #![feature(const_foobar)] + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr index 1080b977410..86cb764a4b3 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `foobar` | -LL - #![feature(foo)] -LL + #![feature(foobar)] - | +LL | #![feature(foobar)] + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr index 02cb25633ab..2537646eb98 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `foobar` | -LL - #![feature(foo)] -LL + #![feature(foobar)] - | +LL | #![feature(foobar)] + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr index 7edd79e08b1..7e6aebcbb1f 100644 --- a/tests/ui/statics/issue-15261.stderr +++ b/tests/ui/statics/issue-15261.stderr @@ -9,9 +9,8 @@ LL | static n: &'static usize = unsafe { &n_mut }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - static n: &'static usize = unsafe { &n_mut }; -LL + static n: &'static usize = unsafe { &raw const n_mut }; - | +LL | static n: &'static usize = unsafe { &raw const n_mut }; + | +++++++++ warning: 1 warning emitted diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr index f428f9a18d4..3d4b55909cd 100644 --- a/tests/ui/statics/static-mut-shared-parens.stderr +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -9,9 +9,8 @@ LL | let _ = unsafe { (&TEST) as *const usize }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - let _ = unsafe { (&TEST) as *const usize }; -LL + let _ = unsafe { (&raw const TEST) as *const usize }; - | +LL | let _ = unsafe { (&raw const TEST) as *const usize }; + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-shared-parens.rs:11:22 diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr index d03835c30d8..48cac28a6eb 100644 --- a/tests/ui/statics/static-mut-xc.stderr +++ b/tests/ui/statics/static-mut-xc.stderr @@ -54,9 +54,8 @@ LL | static_bound(&static_mut_xc::a); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - static_bound(&static_mut_xc::a); -LL + static_bound(&raw const static_mut_xc::a); - | +LL | static_bound(&raw const static_mut_xc::a); + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-xc.rs:35:22 diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr index 8ea997fa214..039934dfc69 100644 --- a/tests/ui/statics/static-recursive.stderr +++ b/tests/ui/statics/static-recursive.stderr @@ -9,9 +9,8 @@ LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; -LL + static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; - | +LL | static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-recursive.rs:19:20 diff --git a/tests/ui/structs-enums/multiple-reprs.rs b/tests/ui/structs-enums/multiple-reprs.rs index 1528db126ae..ce50b62ce47 100644 --- a/tests/ui/structs-enums/multiple-reprs.rs +++ b/tests/ui/structs-enums/multiple-reprs.rs @@ -69,7 +69,7 @@ pub fn main() { assert_eq!(size_of::<E4>(), 8); assert_eq!(size_of::<E5>(), align_size(10, align_of::<u32>())); assert_eq!(size_of::<E6>(), align_size(14, align_of::<u64>())); - assert_eq!(size_of::<E7>(), align_size(6 + size_of::<c_int>(), align_of::<c_int>())); + assert_eq!(size_of::<E7>(), align_size(6 + c_enum_min_size(), align_of::<c_int>())); assert_eq!(size_of::<p0f_api_query>(), 21); } @@ -80,3 +80,13 @@ fn align_size(size: usize, align: usize) -> usize { size } } + +// this is `TargetOptions.c_enum_min_bits` which is not available as a `cfg` value so we retrieve +// the value at runtime. On most targets this is `sizeof(c_int)` but on `thumb*-none` is 1 byte +fn c_enum_min_size() -> usize { + #[repr(C)] + enum E { + A, + } + size_of::<E>() +} diff --git a/tests/ui/structs/struct-fields-hints-no-dupe.stderr b/tests/ui/structs/struct-fields-hints-no-dupe.stderr index 650f6ddfa88..aeba7f00b9d 100644 --- a/tests/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/tests/ui/structs/struct-fields-hints-no-dupe.stderr @@ -6,9 +6,8 @@ LL | bar : 42, | help: a field with a similar name exists | -LL - bar : 42, -LL + barr : 42, - | +LL | barr : 42, + | + error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index a086de08983..7fceb95cc5d 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -24,19 +24,16 @@ LL | let A { x, y } = self.d; | help: include the missing fields in the pattern | -LL - let A { x, y } = self.d; -LL + let A { x, y, b, c } = self.d; - | +LL | let A { x, y, b, c } = self.d; + | ++++++ help: if you don't care about these missing fields, you can explicitly ignore them | -LL - let A { x, y } = self.d; -LL + let A { x, y, b: _, c: _ } = self.d; - | +LL | let A { x, y, b: _, c: _ } = self.d; + | ++++++++++++ help: or always ignore missing fields here | -LL - let A { x, y } = self.d; -LL + let A { x, y, .. } = self.d; - | +LL | let A { x, y, .. } = self.d; + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index 7692010aa54..953f01e1fb6 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -30,19 +30,16 @@ LL | if let E::S { 0: a } = x { | help: include the missing field in the pattern | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, 1: _ } = x { - | +LL | if let E::S { 0: a, 1: _ } = x { + | ++++++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, 1: _ } = x { - | +LL | if let E::S { 0: a, 1: _ } = x { + | ++++++ help: or always ignore missing fields here | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, .. } = x { - | +LL | if let E::S { 0: a, .. } = x { + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index befc6a1b538..3a828e95577 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -15,19 +15,16 @@ LL | Foo::Bar { a, aa: 1, c } => (), | help: include the missing field in the pattern | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, b } => (), - | +LL | Foo::Bar { a, aa: 1, c, b } => (), + | +++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, b: _ } => (), - | +LL | Foo::Bar { a, aa: 1, c, b: _ } => (), + | ++++++ help: or always ignore missing fields here | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, .. } => (), - | +LL | Foo::Bar { a, aa: 1, c, .. } => (), + | ++++ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 @@ -46,19 +43,16 @@ LL | Foo::Baz { bb: 1.0 } => (), | help: include the missing field in the pattern | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, a } => (), - | +LL | Foo::Baz { bb: 1.0, a } => (), + | +++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, a: _ } => (), - | +LL | Foo::Baz { bb: 1.0, a: _ } => (), + | ++++++ help: or always ignore missing fields here | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, .. } => (), - | +LL | Foo::Baz { bb: 1.0, .. } => (), + | ++++ error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:20:23 @@ -74,19 +68,16 @@ LL | Foo::Bar { a, aa: "", c } => (), | help: include the missing field in the pattern | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, b } => (), - | +LL | Foo::Bar { a, aa: "", c, b } => (), + | +++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, b: _ } => (), - | +LL | Foo::Bar { a, aa: "", c, b: _ } => (), + | ++++++ help: or always ignore missing fields here | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, .. } => (), - | +LL | Foo::Bar { a, aa: "", c, .. } => (), + | ++++ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:23:20 @@ -102,19 +93,16 @@ LL | Foo::Baz { bb: "" } => (), | help: include the missing field in the pattern | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", a } => (), - | +LL | Foo::Baz { bb: "", a } => (), + | +++ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", a: _ } => (), - | +LL | Foo::Baz { bb: "", a: _ } => (), + | ++++++ help: or always ignore missing fields here | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", .. } => (), - | +LL | Foo::Baz { bb: "", .. } => (), + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/suggestions/argument-list-from-path-sep-error-129273.fixed b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.fixed new file mode 100644 index 00000000000..f5dbf0c8b6f --- /dev/null +++ b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.fixed @@ -0,0 +1,15 @@ +//@ run-rustfix + +use std::fmt; + +struct Hello; + +impl fmt::Display for Hello { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { //~ ERROR path separator must be a double colon + write!(f, "hello") + } +} + +fn main() { + let _ = Hello; +} diff --git a/tests/ui/suggestions/argument-list-from-path-sep-error-129273.rs b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.rs new file mode 100644 index 00000000000..c41880a26f6 --- /dev/null +++ b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.rs @@ -0,0 +1,15 @@ +//@ run-rustfix + +use std::fmt; + +struct Hello; + +impl fmt::Display for Hello { + fn fmt(&self, f: &mut fmt:Formatter) -> fmt::Result { //~ ERROR path separator must be a double colon + write!(f, "hello") + } +} + +fn main() { + let _ = Hello; +} diff --git a/tests/ui/suggestions/argument-list-from-path-sep-error-129273.stderr b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.stderr new file mode 100644 index 00000000000..92947e3b177 --- /dev/null +++ b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.stderr @@ -0,0 +1,14 @@ +error: path separator must be a double colon + --> $DIR/argument-list-from-path-sep-error-129273.rs:8:30 + | +LL | fn fmt(&self, f: &mut fmt:Formatter) -> fmt::Result { + | ^ + | + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> +help: use a double colon instead + | +LL | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + | + + +error: aborting due to 1 previous error + diff --git a/tests/ui/suggestions/bound-suggestions.stderr b/tests/ui/suggestions/bound-suggestions.stderr index 51a6a51e7da..f23e086afe4 100644 --- a/tests/ui/suggestions/bound-suggestions.stderr +++ b/tests/ui/suggestions/bound-suggestions.stderr @@ -43,9 +43,8 @@ LL | println!("{:?} {:?}", x, y); = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `Y` with trait `Debug` | -LL - fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, { -LL + fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { - | +LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { + | ++++++++++++++++++ error[E0277]: `X` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:33:22 diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index 55a353c40ca..0dc17f2c25c 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -12,9 +12,8 @@ LL | const A: i32 = 2; = note: the matched value is of type `i32` help: introduce a variable instead | -LL - let A = 3; -LL + let A_var = 3; - | +LL | let A_var = 3; + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr index 0ca0582105b..2ec4fc7ed6c 100644 --- a/tests/ui/suggestions/crate-or-module-typo.stderr +++ b/tests/ui/suggestions/crate-or-module-typo.stderr @@ -6,9 +6,8 @@ LL | use st::cell::Cell; | help: there is a crate or module with a similar name | -LL - use st::cell::Cell; -LL + use std::cell::Cell; - | +LL | use std::cell::Cell; + | + error[E0432]: unresolved import `bas` --> $DIR/crate-or-module-typo.rs:11:5 @@ -30,9 +29,8 @@ LL | bar: st::cell::Cell<bool> | help: there is a crate or module with a similar name | -LL - bar: st::cell::Cell<bool> -LL + bar: std::cell::Cell<bool> - | +LL | bar: std::cell::Cell<bool> + | + help: consider importing this module | LL + use std::cell; diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr index ac93c5df05e..c275cdccaa8 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr @@ -20,9 +20,8 @@ LL | fn foo(&self) where Self: Other, { } | +++++ help: alternatively, consider constraining `foo` so it does not apply to trait objects | -LL - fn foo() where Self: Other, { } -LL + fn foo() where Self: Other, Self: Sized { } - | +LL | fn foo() where Self: Other, Self: Sized { } + | +++++++++++ help: consider changing method `bar`'s `self` parameter to be `&self` | LL - fn bar(self: ()) {} diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index 4696950930f..362dae172c7 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -11,9 +11,8 @@ LL | if let B::Fst = a {}; | help: you might have meant to use field `b` whose type is `B` | -LL - if let B::Fst = a {}; -LL + if let B::Fst = a.b {}; - | +LL | if let B::Fst = a.b {}; + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:25:9 @@ -29,9 +28,8 @@ LL | B::Fst => (), | help: you might have meant to use field `b` whose type is `B` | -LL - match a { -LL + match a.b { - | +LL | match a.b { + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:26:9 @@ -47,9 +45,8 @@ LL | B::Snd => (), | help: you might have meant to use field `b` whose type is `B` | -LL - match a { -LL + match a.b { - | +LL | match a.b { + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:32:9 diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr index 90dee9005ab..4b770d572c5 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -14,9 +14,8 @@ LL | fn foo<X: Trait>(_: X) {} | ^^^^^ required by this bound in `foo` help: consider changing this borrow's mutability | -LL - foo(&s); -LL + foo(&mut s); - | +LL | foo(&mut s); + | +++ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:13:7 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 299cf1d74d5..204209179ad 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -11,9 +11,8 @@ LL | fn g(mut x: impl Iterator<Item = &()>) -> Option<&'static ()> { x.next( | +++++++ help: consider introducing a named lifetime parameter | -LL - fn g(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } -LL + fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } - | +LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } + | ++++ ++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } @@ -33,9 +32,8 @@ LL | async fn i(mut x: impl Iterator<Item = &()>) -> Option<&'static ()> { x | +++++++ help: consider introducing a named lifetime parameter | -LL - async fn i(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } -LL + async fn i<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } - | +LL | async fn i<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } + | ++++ ++ ++ help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } @@ -101,9 +99,8 @@ LL | fn g(mut x: impl Foo) -> Option<&'static ()> { x.next() } | +++++++ help: consider introducing a named lifetime parameter | -LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } -LL + fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } - | +LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } + | ++++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } @@ -123,9 +120,8 @@ LL | fn g(mut x: impl Foo<()>) -> Option<&'static ()> { x.next() } | +++++++ help: consider introducing a named lifetime parameter | -LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } -LL + fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } - | +LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } + | ++++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } diff --git a/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr b/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr index 06f465e9c0d..d43d1f9bb7e 100644 --- a/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr +++ b/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr @@ -41,9 +41,8 @@ LL | let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>(); | help: surround the type parameters with angle brackets | -LL - let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>(); -LL + let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>(); - | +LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>(); + | + error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/struct-field-type-including-single-colon.rs b/tests/ui/suggestions/struct-field-type-including-single-colon.rs index b7ad6d996f1..a3111028895 100644 --- a/tests/ui/suggestions/struct-field-type-including-single-colon.rs +++ b/tests/ui/suggestions/struct-field-type-including-single-colon.rs @@ -7,14 +7,14 @@ mod foo { struct Foo { a: foo:A, - //~^ ERROR found single colon in a struct field type path - //~| expected `,`, or `}`, found `:` + //~^ ERROR path separator must be a double colon + //~| ERROR struct `A` is private } struct Bar { b: foo::bar:B, - //~^ ERROR found single colon in a struct field type path - //~| expected `,`, or `}`, found `:` + //~^ ERROR path separator must be a double colon + //~| ERROR module `bar` is private } fn main() {} diff --git a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr index 247454b8710..ce16aca1e14 100644 --- a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr +++ b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr @@ -1,42 +1,53 @@ -error: found single colon in a struct field type path +error: path separator must be a double colon --> $DIR/struct-field-type-including-single-colon.rs:9:11 | LL | a: foo:A, | ^ | -help: write a path separator here - | -LL - a: foo:A, -LL + a: foo::A, + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> +help: use a double colon instead | +LL | a: foo::A, + | + -error: expected `,`, or `}`, found `:` - --> $DIR/struct-field-type-including-single-colon.rs:9:11 - | -LL | struct Foo { - | --- while parsing this struct -LL | a: foo:A, - | ^ - -error: found single colon in a struct field type path +error: path separator must be a double colon --> $DIR/struct-field-type-including-single-colon.rs:15:16 | LL | b: foo::bar:B, | ^ | -help: write a path separator here + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> +help: use a double colon instead + | +LL | b: foo::bar::B, + | + + +error[E0603]: struct `A` is private + --> $DIR/struct-field-type-including-single-colon.rs:9:12 + | +LL | a: foo:A, + | ^ private struct | -LL - b: foo::bar:B, -LL + b: foo::bar::B, +note: the struct `A` is defined here + --> $DIR/struct-field-type-including-single-colon.rs:2:5 | +LL | struct A; + | ^^^^^^^^^ -error: expected `,`, or `}`, found `:` - --> $DIR/struct-field-type-including-single-colon.rs:15:16 +error[E0603]: module `bar` is private + --> $DIR/struct-field-type-including-single-colon.rs:15:13 | -LL | struct Bar { - | --- while parsing this struct LL | b: foo::bar:B, - | ^ + | ^^^ - struct `B` is not publicly re-exported + | | + | private module + | +note: the module `bar` is defined here + --> $DIR/struct-field-type-including-single-colon.rs:3:5 + | +LL | mod bar { + | ^^^^^^^ error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/suggestions/suggest-change-mut.stderr b/tests/ui/suggestions/suggest-change-mut.stderr index 5315456efea..c47ae433ab8 100644 --- a/tests/ui/suggestions/suggest-change-mut.stderr +++ b/tests/ui/suggestions/suggest-change-mut.stderr @@ -19,9 +19,8 @@ LL | fn issue_81421<T: Read + Write>(mut stream: T) where &T: std::io::Read { | +++++++++++++++++++++++ help: consider changing this borrow's mutability | -LL - let mut stream_reader = BufReader::new(&stream); -LL + let mut stream_reader = BufReader::new(&mut stream); - | +LL | let mut stream_reader = BufReader::new(&mut stream); + | +++ error[E0599]: the method `read_until` exists for struct `BufReader<&T>`, but its trait bounds were not satisfied --> $DIR/suggest-change-mut.rs:16:23 diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr index 54c927b59d4..2061b3f122a 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr @@ -11,9 +11,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match x { -LL + match *x { - | +LL | match *x { + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:9:9 @@ -28,9 +27,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match x { -LL + match *x { - | +LL | match *x { + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:16:9 @@ -79,9 +77,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y { -LL + match *y { - | +LL | match *y { + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 @@ -96,9 +93,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y { -LL + match *y { - | +LL | match *y { + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:36:9 @@ -147,9 +143,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_const { -LL + match &**z_const { - | +LL | match &**z_const { + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:48:9 @@ -164,9 +159,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_const { -LL + match &**z_const { - | +LL | match &**z_const { + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:57:9 @@ -181,9 +175,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_mut { -LL + match &**z_mut { - | +LL | match &**z_mut { + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:59:9 @@ -198,9 +191,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_mut { -LL + match &**z_mut { - | +LL | match &**z_mut { + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:68:9 @@ -215,9 +207,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y_mut { -LL + match &**y_mut { - | +LL | match &**y_mut { + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:70:9 @@ -232,9 +223,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y_mut { -LL + match &**y_mut { - | +LL | match &**y_mut { + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:79:9 diff --git a/tests/ui/suggestions/suggest-methods.stderr b/tests/ui/suggestions/suggest-methods.stderr index 6f1c2cc4cab..b6925a4c626 100644 --- a/tests/ui/suggestions/suggest-methods.stderr +++ b/tests/ui/suggestions/suggest-methods.stderr @@ -45,9 +45,8 @@ LL | let _ = 63u32.count_o(); | help: there is a method `count_ones` with a similar name | -LL - let _ = 63u32.count_o(); -LL + let _ = 63u32.count_ones(); - | +LL | let _ = 63u32.count_ones(); + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-variants.stderr b/tests/ui/suggestions/suggest-variants.stderr index b422da8fbfa..50286a96875 100644 --- a/tests/ui/suggestions/suggest-variants.stderr +++ b/tests/ui/suggestions/suggest-variants.stderr @@ -24,9 +24,8 @@ LL | println!("My shape is {:?}", Shape::Circl { size: 5}); | help: there is a variant with a similar name | -LL - println!("My shape is {:?}", Shape::Circl { size: 5}); -LL + println!("My shape is {:?}", Shape::Circle { size: 5}); - | +LL | println!("My shape is {:?}", Shape::Circle { size: 5}); + | + error[E0599]: no variant named `Rombus` found for enum `Shape` --> $DIR/suggest-variants.rs:14:41 @@ -63,9 +62,8 @@ LL | Shape::Circl; | help: there is a variant with a similar name | -LL - Shape::Circl; -LL + Shape::Circle { radius: /* value */ }; - | +LL | Shape::Circle { radius: /* value */ }; + | +++++++++++++++++++++++++ error[E0599]: no variant or associated item named `Rombus` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:17:12 diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr index 70e8f5b58ac..0b37bf9a57b 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr @@ -7,9 +7,8 @@ LL | let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?; = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> help: maybe write a path separator here | -LL - let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?; -LL + let _ = vec![Ok(2)].into_iter().collect::<Result<Vec<_>,_>>()?; - | +LL | let _ = vec![Ok(2)].into_iter().collect::<Result<Vec<_>,_>>()?; + | + error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index 5ba56d095f7..a424bc7e724 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -6,9 +6,8 @@ LL | let _: Vec<A:B> = A::B; | help: you might have meant to write a path instead of an associated type bound | -LL - let _: Vec<A:B> = A::B; -LL + let _: Vec<A::B> = A::B; - | +LL | let _: Vec<A::B> = A::B; + | + error[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied --> $DIR/type-ascription-instead-of-path-in-type.rs:6:12 diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index e96ead569d9..7211d77fdcb 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -8,9 +8,8 @@ LL | let _x: u8 = 'X'; | help: if you meant to write a byte literal, prefix with `b` | -LL - let _x: u8 = 'X'; -LL + let _x: u8 = b'X'; - | +LL | let _x: u8 = b'X'; + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:11:9 @@ -27,9 +26,8 @@ LL | fn foo(_t: u8) {} | ^^^ ------ help: if you meant to write a byte literal, prefix with `b` | -LL - foo('#'); -LL + foo(b'#'); - | +LL | foo(b'#'); + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:15:18 @@ -41,9 +39,8 @@ LL | let _a: u8 = '\x20'; | help: if you meant to write a byte literal, prefix with `b` | -LL - let _a: u8 = '\x20'; -LL + let _a: u8 = b'\x20'; - | +LL | let _a: u8 = b'\x20'; + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:20:9 diff --git a/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs new file mode 100644 index 00000000000..28d026c1a9a --- /dev/null +++ b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs @@ -0,0 +1,12 @@ +//@ compile-flags: --target=i686-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +//@ compile-flags: -Ctarget-cpu=pentium +// For now this is just a warning. +//@ build-pass +//@error-pattern: must be enabled + +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} diff --git a/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr new file mode 100644 index 00000000000..7ec8b04cfce --- /dev/null +++ b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr @@ -0,0 +1,7 @@ +warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = 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 <https://github.com/rust-lang/rust/issues/116344> + +warning: 1 warning emitted + diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr index 39f69b164fb..dfb6985730a 100644 --- a/tests/ui/test-attrs/inaccessible-test-modules.stderr +++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr @@ -12,9 +12,8 @@ LL | use test as y; | help: consider importing this module instead | -LL - use test as y; -LL + use test::test as y; - | +LL | use test::test as y; + | ++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 23974c5b4aa..2288bd1129c 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -14,9 +14,8 @@ LL + struct Foo<T> where T: Bar, T: Bar<Baz = String> { | help: a trait with a similar name exists | -LL - struct Foo<T> where T: Bar, <T as Bar>::Baz: String { -LL + struct Foo<T> where T: Bar, <T as Bar>::Baz: ToString { - | +LL | struct Foo<T> where T: Bar, <T as Bar>::Baz: ToString { + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:9:54 @@ -34,9 +33,8 @@ LL + struct Qux<'a, T> where T: Bar, &'a T: Bar<Baz = String> { | help: a trait with a similar name exists | -LL - struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { -LL + struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { - | +LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:13:45 @@ -54,9 +52,8 @@ LL + fn foo<T: Bar>(_: T) where T: Bar<Baz = String> { | help: a trait with a similar name exists | -LL - fn foo<T: Bar>(_: T) where <T as Bar>::Baz: String { -LL + fn foo<T: Bar>(_: T) where <T as Bar>::Baz: ToString { - | +LL | fn foo<T: Bar>(_: T) where <T as Bar>::Baz: ToString { + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:16:57 @@ -74,9 +71,8 @@ LL + fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar<Baz = String> { | help: a trait with a similar name exists | -LL - fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { -LL + fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { - | +LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { + | ++ error[E0405]: cannot find trait `Unresolved` in this scope --> $DIR/assoc_type_bound_with_struct.rs:19:31 diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index 1117ee7efb3..9d54675c260 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -25,9 +25,8 @@ LL | for<F> F: 'a, | ^^ help: consider adding an explicit lifetime bound | -LL - for<F> F: 'a, -LL + for<F> F: 'a, !1_"F": 'a - | +LL | for<F> F: 'a, !1_"F": 'a + | ++++++++++ error[E0309]: the placeholder type `!1_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -40,9 +39,8 @@ LL | {} | help: consider adding an explicit lifetime bound | -LL - for<F> F: 'a, -LL + for<F> F: 'a, !1_"F": 'a - | +LL | for<F> F: 'a, !1_"F": 'a + | ++++++++++ error[E0309]: the placeholder type `!2_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -55,9 +53,8 @@ LL | {} | help: consider adding an explicit lifetime bound | -LL - for<F> F: 'a, -LL + for<F> F: 'a, !2_"F": 'a - | +LL | for<F> F: 'a, !2_"F": 'a + | ++++++++++ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/transmutability/assoc-bound.stderr b/tests/ui/transmutability/assoc-bound.stderr index 4ff67bd636a..4dff24e2002 100644 --- a/tests/ui/transmutability/assoc-bound.stderr +++ b/tests/ui/transmutability/assoc-bound.stderr @@ -12,9 +12,8 @@ LL | type AssocB: std::mem::TransmuteFrom<()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `B::AssocB` help: consider further restricting the associated type | -LL - T: A, -LL + T: A, <T as A>::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> - | +LL | T: A, <T as A>::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0277]: `()` cannot be safely transmuted into `<&i32 as A>::AssocA` --> $DIR/assoc-bound.rs:24:19 diff --git a/tests/ui/type/issue-100584.stderr b/tests/ui/type/issue-100584.stderr index 7cbab154066..1523bdda761 100644 --- a/tests/ui/type/issue-100584.stderr +++ b/tests/ui/type/issue-100584.stderr @@ -19,9 +19,8 @@ LL | let _ = format!("{xyza}"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL - fn foo(xyza: &str) { -LL + fn foo(_xyza: &str) { - | +LL | fn foo(_xyza: &str) { + | + error: unused variable: `xyza` --> $DIR/issue-100584.rs:7:9 @@ -38,9 +37,8 @@ LL | let _ = format!("aaa{xyza}bbb"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL - fn foo3(xyza: &str) { -LL + fn foo3(_xyza: &str) { - | +LL | fn foo3(_xyza: &str) { + | + error: aborting due to 2 previous errors diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr index aaf41ed6eba..4af92a89c44 100644 --- a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr @@ -6,9 +6,8 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); -LL + const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); - | +LL | const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); + | + error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:8:47 @@ -18,9 +17,8 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); -LL + const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); - | +LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); + | + error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:12:43 diff --git a/tests/ui/typeck/issue-29181.stderr b/tests/ui/typeck/issue-29181.stderr index e73c3e51881..ca82405966e 100644 --- a/tests/ui/typeck/issue-29181.stderr +++ b/tests/ui/typeck/issue-29181.stderr @@ -12,9 +12,8 @@ LL | let _ = |x: f64| x * 2.0.exp(); | help: you must specify a concrete type for this numeric value, like `f32` | -LL - let _ = |x: f64| x * 2.0.exp(); -LL + let _ = |x: f64| x * 2.0_f32.exp(); - | +LL | let _ = |x: f64| x * 2.0_f32.exp(); + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/method-chain-gats.stderr b/tests/ui/typeck/method-chain-gats.stderr index 902255a28a6..d3a54dbd0f9 100644 --- a/tests/ui/typeck/method-chain-gats.stderr +++ b/tests/ui/typeck/method-chain-gats.stderr @@ -19,9 +19,8 @@ LL | Self::Base<B>: Functor<B>; | ^^^^^^^^^^ required by this bound in `Functor::fmap` help: consider further restricting the associated type | -LL - T::Base<B>: Functor<B, Base<C> = T::Base<C>>, -LL + T::Base<B>: Functor<B, Base<C> = T::Base<C>>, <T as Base>::Base<C>: Functor<C> - | +LL | T::Base<B>: Functor<B, Base<C> = T::Base<C>>, <T as Base>::Base<C>: Functor<C> + | ++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index fd6b3093ec9..541de25749e 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -13,9 +13,8 @@ LL | fn values(&self) -> Self::Values; found signature `fn(Option<_>)` help: change the self-receiver type to match the trait | -LL - fn values(self) -> Self::Values { -LL + fn values(&self) -> Self::Values { - | +LL | fn values(&self) -> Self::Values { + | + error[E0631]: type mismatch in function arguments --> $DIR/mismatched-map-under-self.rs:12:18 diff --git a/tests/ui/unpretty/staged-api-invalid-path-108697.rs b/tests/ui/unpretty/staged-api-invalid-path-108697.rs index 71bad213576..8a806b10d9d 100644 --- a/tests/ui/unpretty/staged-api-invalid-path-108697.rs +++ b/tests/ui/unpretty/staged-api-invalid-path-108697.rs @@ -2,8 +2,8 @@ // ICE: tcx.resolutions(()) is not supported for local crate -Zunpretty=mir // on invalid module path with staged_api //@ compile-flags: -Zunpretty=mir -//@ normalize-stderr: "The system cannot find the file specified." -> "No such file or directory" +//@ normalize-stderr: "lol`: .*\(" -> "lol`: $$FILE_NOT_FOUND_MSG (" #![feature(staged_api)] #[path = "lol"] mod foo; -//~^ ERROR couldn't read +//~^ ERROR couldn't read `$DIR/lol` diff --git a/tests/ui/unpretty/staged-api-invalid-path-108697.stderr b/tests/ui/unpretty/staged-api-invalid-path-108697.stderr index e68e19c4dc9..188f4985ded 100644 --- a/tests/ui/unpretty/staged-api-invalid-path-108697.stderr +++ b/tests/ui/unpretty/staged-api-invalid-path-108697.stderr @@ -1,4 +1,4 @@ -error: couldn't read `$DIR/lol`: No such file or directory (os error 2) +error: couldn't read `$DIR/lol`: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/staged-api-invalid-path-108697.rs:8:1 | LL | mod foo; diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index 0810f90306e..7be1bcd38de 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -6,9 +6,8 @@ LL | use Trait; | help: consider importing this trait instead | -LL - use Trait; -LL + use a::Trait; - | +LL | use a::Trait; + | +++ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/unresolved-candidates.rs:10:10 diff --git a/triagebot.toml b/triagebot.toml index 52355189419..31061bd288e 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -227,6 +227,16 @@ exclude_labels = [ "T-*", ] +trigger_labels = [ + "A-rustdoc-json", + "A-rustdoc-type-layout", + "A-rustdoc-scrape-examples", + "A-link-to-definition", + "A-cross-crate-reexports", + "A-intra-doc-links", + "A-doc-alias", +] + [autolabel."A-rustdoc-json"] trigger_files = [ "src/librustdoc/json/", @@ -245,6 +255,33 @@ trigger_files = [ "compiler/rustc_attr_validation", ] +[autolabel."T-rustdoc-frontend"] +trigger_labels = [ + "A-rustdoc-search", + "A-rustdoc-ui", + "A-rustdoc-js", +] + +trigger_files = [ + "src/librustdoc/html/", + "tests/rustdoc/", + "tests/rustdoc-gui/", + "tests/rustdoc-js/", + "tests/rustdoc-js-std/", + # note: tests/rustdoc-ui tests the CLI, not the web frontend +] + +[autolabel."A-rustdoc-search"] +trigger_files = [ + "src/librustdoc/html/static/js/search.js", + "tests/rustdoc-js", + "tests/rustdoc-js-std", +] + +trigger_labels = [ + "A-type-based-search", +] + [autolabel."T-compiler"] trigger_files = [ # Source code @@ -925,6 +962,9 @@ message = "This PR changes how LLVM is built. Consider updating src/bootstrap/do [mentions."test/crashes"] message = "This PR changes a file inside `tests/crashes`. If a crash was fixed, please move into the corresponding `ui` subdir and add 'Fixes #<issueNr>' to the PR description to autoclose the issue upon merge." +[mentions."tests/rustdoc-json"] +cc = ["@aDotInTheVoid"] + [mentions."tests/ui/deriving/deriving-all-codegen.stdout"] message = "Changes to the code generated for builtin derived traits." cc = ["@nnethercote"] |
